emacs-diffs
[Top][All Lists]
Advanced

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

scratch/comp-static-data e7459fcbde 9/9: Merge branch 'master' into scra


From: Vibhav Pant
Subject: scratch/comp-static-data e7459fcbde 9/9: Merge branch 'master' into scratch/comp-static-data
Date: Tue, 20 Dec 2022 11:29:41 -0500 (EST)

branch: scratch/comp-static-data
commit e7459fcbde4e468f9dfc74477072c7405b59e03e
Merge: 89892db0af 9fafeb2a66
Author: Vibhav Pant <vibhavp@gmail.com>
Commit: Vibhav Pant <vibhavp@gmail.com>

    Merge branch 'master' into scratch/comp-static-data
---
 .clang-format                                      |    2 +
 .dir-locals.el                                     |    3 +-
 .gitignore                                         |    5 +
 ChangeLog.2                                        |    6 +-
 ChangeLog.3                                        |   70 +-
 README                                             |    2 +-
 admin/check-man-pages                              |   56 +
 admin/cus-test.el                                  |   32 +-
 admin/git-bisect-start                             | 1627 ++++++-
 admin/make-tarball.txt                             |    6 +
 admin/merge-gnulib                                 |    5 +-
 admin/notes/git-workflow                           |    8 +-
 admin/notes/repo                                   |    8 +-
 admin/notes/tree-sitter/build-module/batch.sh      |    7 +
 admin/notes/tree-sitter/build-module/build.sh      |   73 +-
 admin/notes/tree-sitter/starter-guide              |    2 +-
 build-aux/config.guess                             |    8 +-
 build-aux/config.sub                               |   27 +-
 configure.ac                                       |   30 +-
 doc/emacs/macos.texi                               |    2 +-
 doc/emacs/maintaining.texi                         |   10 +-
 doc/emacs/misc.texi                                |   41 +-
 doc/emacs/msdos.texi                               |   22 +-
 doc/emacs/programs.texi                            |   48 +-
 doc/lispref/ChangeLog.1                            |    2 +-
 doc/lispref/commands.texi                          |   12 +-
 doc/lispref/compile.texi                           |    2 +-
 doc/lispref/display.texi                           |  147 +-
 doc/lispref/files.texi                             |   21 +-
 doc/lispref/frames.texi                            |   12 +-
 doc/lispref/internals.texi                         |   19 +-
 doc/lispref/keymaps.texi                           |    2 +-
 doc/lispref/modes.texi                             |   28 +-
 doc/lispref/package.texi                           |    4 +-
 doc/lispref/parsing.texi                           |   42 +-
 doc/lispref/positions.texi                         |   31 +-
 doc/lispref/sequences.texi                         |    2 +-
 doc/lispref/text.texi                              |    4 +
 doc/lispref/variables.texi                         |   40 +-
 doc/lispref/windows.texi                           |    3 +-
 doc/man/etags.1                                    |   12 +-
 doc/misc/Makefile.in                               |   19 +-
 doc/misc/auth.texi                                 |   11 +-
 doc/misc/eglot.texi                                |    8 +
 doc/misc/erc.texi                                  |  571 ++-
 doc/misc/eshell.texi                               |  139 +-
 doc/misc/eww.texi                                  |   12 +-
 doc/misc/flymake.texi                              |    2 +-
 doc/misc/gnus.texi                                 |    5 +-
 doc/misc/org-setup.org                             |    2 +-
 doc/misc/org.org                                   | 2280 +++++----
 doc/misc/rcirc.texi                                |    8 +-
 doc/misc/texinfo.tex                               |  428 +-
 doc/misc/tramp.texi                                |   14 +-
 doc/misc/trampver.texi                             |   10 +-
 doc/misc/transient.texi                            |  129 +-
 doc/misc/use-package.texi                          | 2163 +++++++++
 etc/DEBUG                                          |   22 +
 etc/ERC-NEWS                                       |   20 +-
 etc/HELLO                                          |    2 +-
 etc/NEWS                                           | 4392 +----------------
 etc/NEWS.19                                        |    4 +-
 etc/NEWS.22                                        |    2 +-
 etc/NEWS.24                                        |    2 +-
 etc/{NEWS => NEWS.29}                              |  414 +-
 etc/ORG-NEWS                                       |  743 +++
 etc/PROBLEMS                                       |   24 +-
 etc/org/README                                     |    2 +-
 etc/publicsuffix.txt                               |   39 +-
 etc/refcards/orgcard.tex                           |    2 +-
 etc/refcards/ru-refcard.tex                        |    2 +-
 lib-src/ChangeLog.1                                |    2 +-
 lib-src/be_resources.cc                            |   14 +-
 lib-src/emacsclient.c                              |    6 +-
 lib-src/etags.c                                    |  228 +-
 lib-src/ntlib.c                                    |    9 -
 lib-src/ntlib.h                                    |    1 -
 lib-src/seccomp-filter.c                           |    2 +
 lib/canonicalize-lgpl.c                            |  122 +-
 lib/explicit_bzero.c                               |   74 -
 lib/gnulib.mk.in                                   |  164 +-
 lib/malloc/scratch_buffer.h                        |   16 -
 lib/memset_explicit.c                              |   55 +
 lib/scratch_buffer.h                               |   10 -
 lib/stat-time.h                                    |    5 +-
 lib/string.in.h                                    |   17 +
 lib/verify.h                                       |    2 +-
 lisp/ChangeLog.10                                  |    2 +-
 lisp/ChangeLog.11                                  |    9 +-
 lisp/ChangeLog.12                                  |    7 +-
 lisp/ChangeLog.14                                  |    2 +-
 lisp/ChangeLog.15                                  |    2 +-
 lisp/ChangeLog.16                                  |    7 +-
 lisp/ChangeLog.17                                  |    2 +-
 lisp/ChangeLog.3                                   |    3 +-
 lisp/ChangeLog.4                                   |    3 +-
 lisp/ChangeLog.6                                   |    2 +-
 lisp/ChangeLog.7                                   |    5 +-
 lisp/ChangeLog.8                                   |   11 +-
 lisp/ChangeLog.9                                   |    8 +-
 lisp/ansi-osc.el                                   |   10 +-
 lisp/apropos.el                                    |    2 +-
 lisp/auth-source-pass.el                           |   19 +-
 lisp/autorevert.el                                 |    4 +-
 lisp/bindings.el                                   |    2 +
 lisp/bs.el                                         |  130 +-
 lisp/buff-menu.el                                  |   41 +-
 lisp/calc/calc-units.el                            |   49 +-
 lisp/calendar/icalendar.el                         |    8 +-
 lisp/cedet/semantic/bovine/c.el                    |    2 +-
 lisp/cedet/semantic/complete.el                    |    2 +-
 lisp/cedet/semantic/db.el                          |    2 +-
 lisp/cedet/semantic/decorate/include.el            |    8 +-
 lisp/cedet/semantic/format.el                      |    2 +-
 lisp/cedet/semantic/grm-wy-boot.el                 |    4 +-
 lisp/cedet/semantic/ia.el                          |    2 +-
 lisp/cedet/semantic/idle.el                        |    2 +-
 lisp/cedet/semantic/lex-spp.el                     |    2 +-
 lisp/cedet/semantic/lex.el                         |    6 +-
 lisp/cedet/semantic/sort.el                        |    2 +-
 lisp/cedet/semantic/symref.el                      |    3 +-
 lisp/comint.el                                     |   14 +-
 lisp/cus-edit.el                                   |    8 +-
 lisp/descr-text.el                                 |    7 +-
 lisp/dired-aux.el                                  |   53 +-
 lisp/emacs-lisp/byte-opt.el                        |   10 +-
 lisp/emacs-lisp/byte-run.el                        |    5 +-
 lisp/emacs-lisp/bytecomp.el                        |   77 +
 lisp/emacs-lisp/chart.el                           |    2 +-
 lisp/emacs-lisp/checkdoc.el                        |   25 +-
 lisp/emacs-lisp/cl-extra.el                        |    2 +-
 lisp/emacs-lisp/cl-macs.el                         |    3 +-
 lisp/emacs-lisp/comp.el                            |   12 +-
 lisp/emacs-lisp/easymenu.el                        |   11 +-
 lisp/emacs-lisp/ert.el                             |    9 +-
 lisp/emacs-lisp/gv.el                              |    6 +-
 lisp/emacs-lisp/icons.el                           |    4 +
 lisp/emacs-lisp/lisp-mode.el                       |    4 +-
 lisp/emacs-lisp/loaddefs-gen.el                    |   35 +-
 lisp/emacs-lisp/macroexp.el                        |    2 +-
 lisp/emacs-lisp/multisession.el                    |    5 +-
 lisp/emacs-lisp/oclosure.el                        |    8 +-
 lisp/emacs-lisp/package-vc.el                      |   90 +-
 lisp/emacs-lisp/package.el                         |   24 +-
 lisp/emacs-lisp/rx.el                              |   14 +-
 lisp/emacs-lisp/shortdoc.el                        |  154 +-
 lisp/emacs-lisp/subr-x.el                          |    7 +-
 lisp/emacs-lisp/tabulated-list.el                  |    2 -
 lisp/emacs-lock.el                                 |    7 +-
 lisp/emulation/viper-cmd.el                        |    6 +-
 lisp/epa-ks.el                                     |    2 +-
 lisp/epg.el                                        |    2 +-
 lisp/erc/erc-backend.el                            |   43 +-
 lisp/erc/erc-common.el                             |   99 +-
 lisp/erc/erc-compat.el                             |  112 +-
 lisp/erc/erc-goodies.el                            |    1 +
 lisp/erc/erc-networks.el                           |  134 +-
 lisp/erc/erc-sasl.el                               |  449 ++
 lisp/erc/erc-services.el                           |    7 +-
 lisp/erc/erc.el                                    |  250 +-
 lisp/eshell/em-alias.el                            |    4 +-
 lisp/eshell/em-cmpl.el                             |   26 +-
 lisp/eshell/em-unix.el                             |   12 +-
 lisp/eshell/esh-arg.el                             |  132 +-
 lisp/eshell/esh-cmd.el                             |   15 +-
 lisp/eshell/esh-opt.el                             |    4 +-
 lisp/eshell/esh-util.el                            |    6 +-
 lisp/eshell/esh-var.el                             |   35 +-
 lisp/external-completion.el                        |  176 +
 lisp/files.el                                      |  117 +-
 lisp/frame.el                                      |    9 +-
 lisp/gnus/ChangeLog.2                              |    2 +-
 lisp/gnus/ChangeLog.3                              |    5 +-
 lisp/gnus/gnus-cache.el                            |    2 +-
 lisp/gnus/gnus-icalendar.el                        |    2 +-
 lisp/gnus/message.el                               |    2 +-
 lisp/gnus/mml.el                                   |   13 +-
 lisp/gnus/nnmaildir.el                             |   23 +-
 lisp/help.el                                       |   15 +-
 lisp/ibuf-ext.el                                   |   10 +-
 lisp/icomplete.el                                  |    1 -
 lisp/ido.el                                        |    2 +-
 lisp/info.el                                       |   16 +-
 lisp/international/ogonek.el                       |    4 +-
 lisp/international/ucs-normalize.el                |    1 +
 lisp/isearch.el                                    |    2 +-
 lisp/jsonrpc.el                                    |   19 +-
 lisp/keymap.el                                     |    2 +-
 lisp/language/european.el                          |    2 +-
 lisp/language/indian.el                            |   42 +-
 lisp/ldefs-boot.el                                 |  903 +++-
 lisp/leim/quail/cyrillic.el                        |  132 +
 lisp/mail/rmailsum.el                              |   62 +-
 lisp/mh-e/mh-identity.el                           |    2 +-
 lisp/minibuffer.el                                 |    8 +-
 lisp/mouse-drag.el                                 |   19 +-
 lisp/mouse.el                                      |   20 +-
 lisp/net/ange-ftp.el                               |   21 +-
 lisp/net/goto-addr.el                              |   31 +-
 lisp/net/rcirc.el                                  |   21 +-
 lisp/net/sasl-scram-rfc.el                         |   21 +-
 lisp/net/tramp-adb.el                              |    1 +
 lisp/net/tramp-archive.el                          |   10 +-
 lisp/net/tramp-crypt.el                            |    3 +-
 lisp/net/tramp-gvfs.el                             |    3 +-
 lisp/net/tramp-rclone.el                           |    1 +
 lisp/net/tramp-sh.el                               |    2 +
 lisp/net/tramp-smb.el                              |   14 +-
 lisp/net/tramp-sshfs.el                            |    4 +-
 lisp/net/tramp-sudoedit.el                         |    1 +
 lisp/net/tramp.el                                  |   90 +-
 lisp/obsolete/rfc2368.el                           |   12 +-
 lisp/org/ChangeLog.1                               |    6 +-
 lisp/org/ob-C.el                                   |    9 +-
 lisp/org/ob-R.el                                   |   33 +-
 lisp/org/ob-awk.el                                 |    8 +-
 lisp/org/ob-calc.el                                |    6 +-
 lisp/org/ob-clojure.el                             |  118 +-
 lisp/org/ob-comint.el                              |   41 +-
 lisp/org/ob-core.el                                |  794 +--
 lisp/org/ob-css.el                                 |    6 +-
 lisp/org/ob-ditaa.el                               |    6 +-
 lisp/org/ob-dot.el                                 |    8 +-
 lisp/org/ob-emacs-lisp.el                          |    7 +-
 lisp/org/ob-eshell.el                              |    6 +-
 lisp/org/ob-eval.el                                |   56 +-
 lisp/org/ob-exp.el                                 |  319 +-
 lisp/org/ob-forth.el                               |    6 +-
 lisp/org/ob-fortran.el                             |    6 +-
 lisp/org/ob-gnuplot.el                             |   16 +-
 lisp/org/ob-groovy.el                              |   12 +-
 lisp/org/ob-haskell.el                             |   10 +-
 lisp/org/ob-java.el                                |   25 +-
 lisp/org/ob-js.el                                  |    6 +-
 lisp/org/ob-julia.el                               |    6 +-
 lisp/org/ob-latex.el                               |   21 +-
 lisp/org/ob-lilypond.el                            |   12 +-
 lisp/org/ob-lisp.el                                |    6 +-
 lisp/org/ob-lob.el                                 |   28 +-
 lisp/org/ob-lua.el                                 |    8 +-
 lisp/org/ob-makefile.el                            |    6 +-
 lisp/org/ob-matlab.el                              |    6 +-
 lisp/org/ob-maxima.el                              |   15 +-
 lisp/org/ob-ocaml.el                               |    6 +-
 lisp/org/ob-octave.el                              |   10 +-
 lisp/org/ob-org.el                                 |    6 +-
 lisp/org/ob-perl.el                                |    8 +-
 lisp/org/ob-plantuml.el                            |   31 +-
 lisp/org/ob-processing.el                          |    9 +-
 lisp/org/ob-python.el                              |   30 +-
 lisp/org/ob-ref.el                                 |   30 +-
 lisp/org/ob-ruby.el                                |    6 +-
 lisp/org/ob-sass.el                                |    6 +-
 lisp/org/ob-scheme.el                              |   22 +-
 lisp/org/ob-screen.el                              |    8 +-
 lisp/org/ob-sed.el                                 |    8 +-
 lisp/org/ob-shell.el                               |   91 +-
 lisp/org/ob-sql.el                                 |   31 +-
 lisp/org/ob-sqlite.el                              |    8 +-
 lisp/org/ob-table.el                               |   75 +-
 lisp/org/ob-tangle.el                              |  183 +-
 lisp/org/ob.el                                     |    6 +-
 lisp/org/oc-basic.el                               |  122 +-
 lisp/org/oc-biblatex.el                            |  229 +-
 lisp/org/oc-bibtex.el                              |   87 +
 lisp/org/oc-csl.el                                 |  198 +-
 lisp/org/oc-natbib.el                              |    4 +
 lisp/org/oc.el                                     |  193 +-
 lisp/org/ol-bbdb.el                                |    7 +-
 lisp/org/ol-bibtex.el                              |   70 +-
 lisp/org/ol-docview.el                             |    8 +-
 lisp/org/ol-doi.el                                 |    3 +
 lisp/org/ol-eshell.el                              |    9 +-
 lisp/org/ol-eww.el                                 |   20 +-
 lisp/org/ol-gnus.el                                |    7 +-
 lisp/org/ol-info.el                                |   86 +-
 lisp/org/ol-irc.el                                 |    3 +
 lisp/org/ol-man.el                                 |   25 +-
 lisp/org/ol-mhe.el                                 |    5 +-
 lisp/org/ol-rmail.el                               |    5 +-
 lisp/org/ol-w3m.el                                 |    5 +-
 lisp/org/ol.el                                     |  222 +-
 lisp/org/org-agenda.el                             | 1626 +++++--
 lisp/org/org-archive.el                            |   30 +-
 lisp/org/org-attach-git.el                         |    6 +-
 lisp/org/org-attach.el                             |  182 +-
 lisp/org/org-capture.el                            |  101 +-
 lisp/org/org-clock.el                              |  496 +-
 lisp/org/org-colview.el                            |   54 +-
 lisp/org/org-compat.el                             |  628 ++-
 lisp/org/org-crypt.el                              |   16 +-
 lisp/org/org-ctags.el                              |   25 +-
 lisp/org/org-cycle.el                              |  817 ++++
 lisp/org/org-datetree.el                           |   16 +-
 lisp/org/org-duration.el                           |   54 +-
 lisp/org/org-element.el                            | 4074 +++++++++++-----
 lisp/org/org-entities.el                           |   11 +-
 lisp/org/org-faces.el                              |   13 +-
 lisp/org/org-feed.el                               |    9 +-
 lisp/org/org-fold-core.el                          | 1516 ++++++
 lisp/org/org-fold.el                               |  906 ++++
 lisp/org/org-footnote.el                           |   32 +-
 lisp/org/org-goto.el                               |   17 +-
 lisp/org/org-habit.el                              |    8 +-
 lisp/org/org-id.el                                 |   66 +-
 lisp/org/org-indent.el                             |   17 +-
 lisp/org/org-inlinetask.el                         |   23 +-
 lisp/org/org-install.el                            |   17 -
 lisp/org/org-keys.el                               |   44 +-
 lisp/org/org-lint.el                               | 1094 +++--
 lisp/org/org-list.el                               |  296 +-
 lisp/org/org-macro.el                              |   24 +-
 lisp/org/org-macs.el                               |  506 +-
 lisp/org/org-mobile.el                             |    7 +-
 lisp/org/org-mouse.el                              |   48 +-
 lisp/org/org-num.el                                |    4 +
 lisp/org/org-pcomplete.el                          |   21 +-
 lisp/org/org-persist.el                            |  993 ++++
 lisp/org/org-plot.el                               |   26 +-
 lisp/org/org-protocol.el                           |   43 +-
 lisp/org/org-refile.el                             |   29 +-
 lisp/org/org-src.el                                |  196 +-
 lisp/org/org-table.el                              |  166 +-
 lisp/org/org-tempo.el                              |   27 +-
 lisp/org/org-timer.el                              |   16 +-
 lisp/org/org-version.el                            |    4 +-
 lisp/org/org.el                                    | 5099 ++++++++++----------
 lisp/org/ox-ascii.el                               |    8 +-
 lisp/org/ox-beamer.el                              |   35 +-
 lisp/org/ox-html.el                                |  317 +-
 lisp/org/ox-icalendar.el                           |   73 +-
 lisp/org/ox-koma-letter.el                         |    3 +
 lisp/org/ox-latex.el                               | 1408 ++++--
 lisp/org/ox-man.el                                 |    4 +-
 lisp/org/ox-md.el                                  |   33 +-
 lisp/org/ox-odt.el                                 |  107 +-
 lisp/org/ox-org.el                                 |    9 +-
 lisp/org/ox-publish.el                             |   28 +-
 lisp/org/ox-texinfo.el                             |  346 +-
 lisp/org/ox.el                                     |  737 ++-
 lisp/outline.el                                    |   43 +-
 lisp/paren.el                                      |    6 +-
 lisp/pcomplete.el                                  |    4 +-
 lisp/play/zone.el                                  |    2 +-
 lisp/proced.el                                     |  354 +-
 lisp/progmodes/antlr-mode.el                       |    2 +-
 lisp/progmodes/asm-mode.el                         |    2 +-
 lisp/progmodes/bat-mode.el                         |    2 +-
 lisp/progmodes/c-ts-mode.el                        |  216 +-
 lisp/progmodes/cc-defs.el                          |    2 +-
 lisp/progmodes/cc-engine.el                        |   22 +-
 lisp/progmodes/cc-langs.el                         |    2 +-
 lisp/progmodes/cc-mode.el                          |    5 +-
 lisp/progmodes/cc-vars.el                          |    2 +
 lisp/progmodes/cmake-ts-mode.el                    |  234 +
 lisp/progmodes/compile.el                          |    3 +-
 lisp/progmodes/csharp-mode.el                      |  959 ++++
 lisp/progmodes/dockerfile-ts-mode.el               |  177 +
 lisp/progmodes/eglot.el                            |  249 +-
 lisp/progmodes/flymake.el                          |    7 +-
 lisp/progmodes/gdb-mi.el                           |   75 +-
 lisp/progmodes/go-ts-mode.el                       |  354 ++
 lisp/progmodes/grep.el                             |    4 +
 lisp/progmodes/gud.el                              |    3 +
 lisp/progmodes/idlwave.el                          |    2 +-
 lisp/progmodes/java-ts-mode.el                     |   63 +-
 lisp/progmodes/js.el                               |   71 +-
 lisp/progmodes/json-ts-mode.el                     |   27 +-
 lisp/progmodes/prog-mode.el                        |   37 +-
 lisp/progmodes/project.el                          |  241 +-
 lisp/progmodes/python.el                           |  168 +-
 lisp/progmodes/ruby-mode.el                        |   74 +-
 lisp/progmodes/rust-ts-mode.el                     |  371 ++
 lisp/progmodes/scheme.el                           |    2 +-
 lisp/progmodes/sh-script.el                        |  103 +-
 lisp/progmodes/sql.el                              |    3 +-
 lisp/progmodes/ts-mode.el                          |  339 --
 lisp/progmodes/typescript-ts-mode.el               |  422 ++
 lisp/progmodes/verilog-mode.el                     | 1588 ++++--
 lisp/progmodes/which-func.el                       |   35 +-
 lisp/progmodes/xref.el                             |  158 +-
 lisp/replace.el                                    |   10 +-
 lisp/server.el                                     |  324 +-
 lisp/shell.el                                      |    3 +-
 lisp/simple.el                                     |   86 +-
 lisp/so-long.el                                    |    2 +-
 lisp/speedbar.el                                   |    2 +-
 lisp/startup.el                                    |    6 +
 lisp/strokes.el                                    |    2 +-
 lisp/subr.el                                       |   50 +-
 lisp/tab-bar.el                                    |  228 +-
 lisp/tab-line.el                                   |    2 +-
 lisp/term.el                                       |    8 +-
 lisp/term/xterm.el                                 |    2 +
 lisp/textmodes/css-mode.el                         |   40 +-
 lisp/textmodes/emacs-news-mode.el                  |    2 +-
 lisp/textmodes/reftex.el                           |   14 +-
 lisp/textmodes/texinfo.el                          |    2 +
 lisp/textmodes/toml-ts-mode.el                     |  187 +
 lisp/textmodes/yaml-ts-mode.el                     |  151 +
 lisp/transient.el                                  |   34 +-
 lisp/treesit.el                                    |  571 ++-
 lisp/url/url-future.el                             |    5 +-
 lisp/use-package/bind-key.el                       |  569 +++
 lisp/use-package/use-package-bind-key.el           |  176 +
 lisp/use-package/use-package-core.el               | 1691 +++++++
 lisp/use-package/use-package-delight.el            |   88 +
 lisp/use-package/use-package-diminish.el           |   77 +
 .../use-package-ensure-system-package.el           |  106 +
 lisp/use-package/use-package-ensure.el             |  212 +
 lisp/use-package/use-package-jump.el               |   74 +
 lisp/use-package/use-package-lint.el               |   80 +
 lisp/use-package/use-package.el                    |   53 +
 lisp/vc/vc-git.el                                  |   68 +-
 lisp/vc/vc-rcs.el                                  |    4 +-
 lisp/vc/vc.el                                      |   35 +-
 lisp/wid-edit.el                                   |    2 +-
 lisp/windmove.el                                   |    3 +-
 lisp/window.el                                     |   19 +-
 m4/assert_h.m4                                     |    6 +
 m4/explicit_bzero.m4                               |   23 -
 m4/gnulib-comp.m4                                  |   96 +-
 m4/memset_explicit.m4                              |   20 +
 m4/pthread_sigmask.m4                              |    7 +-
 m4/string_h.m4                                     |    7 +-
 msdos/sed2v2.inp                                   |    2 +-
 nt/README.W32                                      |    2 +-
 oldXMenu/ChangeLog.1                               |    2 +-
 src/.lldbinit                                      |    2 +-
 src/ChangeLog.11                                   |    2 +-
 src/ChangeLog.12                                   |    2 +-
 src/ChangeLog.13                                   |    2 +-
 src/ChangeLog.3                                    |    2 +-
 src/alloc.c                                        |  289 +-
 src/buffer.c                                       |   69 +-
 src/buffer.h                                       |   14 +-
 src/data.c                                         |    1 +
 src/dispextern.h                                   |   10 +
 src/editfns.c                                      |  397 +-
 src/emacs-module.h.in                              |   15 +
 src/emacs.c                                        |    7 +
 src/fileio.c                                       |   42 +-
 src/fns.c                                          |   15 +-
 src/frame.c                                        |   62 +-
 src/frame.h                                        |    1 -
 src/gnutls.c                                       |    2 +-
 src/gtkutil.c                                      |    6 +-
 src/image.c                                        |   17 +-
 src/itree.c                                        |    4 +-
 src/itree.h                                        |   11 +-
 src/keyboard.c                                     |   22 +-
 src/lisp.h                                         |   23 +-
 src/lread.c                                        |   27 +-
 src/module-env-29.h                                |    3 -
 src/{module-env-29.h => module-env-30.h}           |    0
 src/pdumper.c                                      |    7 +-
 src/sqlite.c                                       |   15 +
 src/sysdep.c                                       |    7 +-
 src/timefns.c                                      |    6 +-
 src/treesit.c                                      |  683 ++-
 src/treesit.h                                      |   13 +-
 src/window.c                                       |   10 +-
 src/xdisp.c                                        |  143 +-
 src/xfaces.c                                       |   90 +-
 src/xfns.c                                         |   65 +-
 src/xftfont.c                                      |    6 +
 src/xselect.c                                      |  940 ++--
 src/xterm.c                                        |  660 ++-
 src/xterm.h                                        |   63 +-
 test/README                                        |    2 +-
 test/infra/gitlab-ci.yml                           |   28 +-
 test/infra/test-jobs.yml                           |   17 +
 test/lib-src/emacsclient-tests.el                  |    4 +-
 test/lisp/auth-source-pass-tests.el                |   31 +-
 test/lisp/calendar/icalendar-tests.el              |   59 +-
 test/lisp/cedet/semantic-utest.el                  |    2 +-
 test/lisp/comint-tests.el                          |   16 +-
 test/lisp/delim-col-tests.el                       |    2 +-
 test/lisp/emacs-lisp/bytecomp-tests.el             |   64 +-
 test/lisp/emacs-lisp/cconv-tests.el                |    4 +-
 test/lisp/emacs-lisp/checkdoc-tests.el             |   12 +-
 test/lisp/emacs-lisp/cl-lib-tests.el               |    5 +-
 test/lisp/emacs-lisp/comp-tests.el                 |   55 +-
 .../eieio-tests/eieio-test-methodinvoke.el         |    2 +-
 test/lisp/emacs-lisp/find-func-tests.el            |    2 +-
 test/lisp/emacs-lisp/lisp-mnt-tests.el             |   12 +-
 test/lisp/emacs-lisp/rx-tests.el                   |    6 +
 test/lisp/emacs-lisp/subr-x-tests.el               |   11 +-
 test/lisp/erc/erc-join-tests.el                    |    2 +-
 test/lisp/erc/erc-networks-tests.el                |   37 +-
 test/lisp/erc/erc-sasl-tests.el                    |  359 ++
 test/lisp/erc/erc-scenarios-auth-source.el         |   31 +-
 .../erc/erc-scenarios-base-association-nick.el     |  113 +-
 .../erc/erc-scenarios-base-association-query.el    |  107 +
 .../erc/erc-scenarios-base-association-samenet.el  |   29 +-
 test/lisp/erc/erc-scenarios-base-association.el    |   29 +-
 .../erc-scenarios-base-compat-rename-bouncer.el    |   29 +-
 test/lisp/erc/erc-scenarios-base-local-modules.el  |  242 +
 .../erc/erc-scenarios-base-misc-regressions.el     |   29 +-
 .../erc/erc-scenarios-base-netid-bouncer-id.el     |   29 +-
 .../erc-scenarios-base-netid-bouncer-recon-base.el |   29 +-
 .../erc-scenarios-base-netid-bouncer-recon-id.el   |   29 +-
 test/lisp/erc/erc-scenarios-base-netid-bouncer.el  |   29 +-
 test/lisp/erc/erc-scenarios-base-netid-samenet.el  |   32 +-
 test/lisp/erc/erc-scenarios-base-reconnect.el      |   29 +-
 test/lisp/erc/erc-scenarios-base-renick.el         |   29 +-
 test/lisp/erc/erc-scenarios-base-reuse-buffers.el  |   29 +-
 test/lisp/erc/erc-scenarios-base-unstable.el       |   29 +-
 .../erc/erc-scenarios-base-upstream-recon-soju.el  |   31 +-
 .../erc/erc-scenarios-base-upstream-recon-znc.el   |   31 +-
 test/lisp/erc/erc-scenarios-internal.el            |   29 +-
 test/lisp/erc/erc-scenarios-join-auth-source.el    |   29 +-
 .../lisp/erc/erc-scenarios-join-netid-newcmd-id.el |   29 +-
 test/lisp/erc/erc-scenarios-join-netid-newcmd.el   |   29 +-
 test/lisp/erc/erc-scenarios-join-netid-recon-id.el |   29 +-
 test/lisp/erc/erc-scenarios-join-netid-recon.el    |   29 +-
 test/lisp/erc/erc-scenarios-misc.el                |   34 +-
 test/lisp/erc/erc-scenarios-sasl.el                |  143 +
 test/lisp/erc/erc-scenarios-services-misc.el       |   88 +-
 test/lisp/erc/erc-services-tests.el                |   16 +-
 test/lisp/erc/erc-tests.el                         |  181 +
 .../erc/resources/base/assoc/queries/netnick.eld   |   42 +
 .../erc/resources/base/assoc/queries/non-erc.eld   |   33 +
 .../erc/resources/base/local-modules/first.eld     |   53 +
 .../erc/resources/base/local-modules/fourth.eld    |   53 +
 .../erc/resources/base/local-modules/second.eld    |   47 +
 .../erc/resources/base/local-modules/third.eld     |   43 +
 test/lisp/erc/resources/erc-d/erc-d-i.el           |   27 +-
 test/lisp/erc/resources/erc-d/erc-d-t.el           |   30 +-
 test/lisp/erc/resources/erc-d/erc-d-tests.el       |   30 +-
 test/lisp/erc/resources/erc-d/erc-d-u.el           |   27 +-
 test/lisp/erc/resources/erc-d/erc-d.el             |   27 +-
 .../resources/erc-d/resources/proxy-subprocess.el  |   28 +-
 test/lisp/erc/resources/erc-scenarios-common.el    |   29 +-
 .../networks/announced-missing/foonet.eld          |    3 -
 test/lisp/erc/resources/sasl/external.eld          |   33 +
 test/lisp/erc/resources/sasl/plain-failed.eld      |   16 +
 test/lisp/erc/resources/sasl/plain.eld             |   39 +
 test/lisp/erc/resources/sasl/scram-sha-1.eld       |   47 +
 test/lisp/erc/resources/sasl/scram-sha-256.eld     |   47 +
 .../erc/resources/services/auth-source/recon.eld   |   48 +
 test/lisp/eshell/em-alias-tests.el                 |    9 +
 test/lisp/eshell/esh-arg-tests.el                  |  105 +
 test/lisp/eshell/esh-var-tests.el                  |   78 +-
 test/lisp/eshell/eshell-tests.el                   |   31 -
 test/lisp/filenotify-tests.el                      |    4 +-
 test/lisp/files-tests.el                           |   26 +-
 test/lisp/gnus/mml-sec-tests.el                    |    2 +-
 test/lisp/international/ucs-normalize-tests.el     |  103 +-
 test/lisp/loadhist-resources/loadhist--bar.el      |    8 +-
 test/lisp/loadhist-resources/loadhist--foo.el      |    8 +-
 test/lisp/net/eudc-resources/bbdb                  |    1 +
 test/lisp/net/eudc-tests.el                        |    7 +-
 test/lisp/net/tramp-archive-tests.el               |    2 +-
 test/lisp/net/tramp-tests.el                       |   27 +-
 test/lisp/proced-tests.el                          |  105 +
 test/lisp/progmodes/eglot-tests.el                 | 1320 +++++
 .../progmodes/project-resources/.dir-locals.el     |    1 +
 test/lisp/progmodes/project-resources/etc          |    1 +
 test/lisp/progmodes/project-resources/foo          |    1 +
 test/lisp/progmodes/project-tests.el               |   44 +-
 test/lisp/progmodes/python-tests.el                |  113 +-
 test/lisp/progmodes/ruby-mode-resources/ruby.rb    |   38 +
 test/lisp/progmodes/ruby-mode-tests.el             |   39 +
 test/lisp/server-tests.el                          |  202 +-
 test/lisp/url/url-future-tests.el                  |    2 +-
 test/lisp/use-package/use-package-tests.el         | 1959 ++++++++
 test/manual/cedet/cedet-utests.el                  |    3 +-
 test/manual/cedet/semantic-tests.el                |    3 +-
 test/manual/cedet/tests/testpolymorph.cpp          |   10 +-
 test/manual/cedet/tests/testsppreplace.c           |    4 +-
 test/manual/cedet/tests/testsppreplaced.c          |    4 +-
 test/manual/etags/CTAGS.good_crlf                  | 4484 +++++++++++++++++
 test/manual/etags/CTAGS.good_update                | 4483 +++++++++++++++++
 test/manual/etags/Makefile                         |   15 +
 test/manual/etags/crlf                             |    2 +
 test/manual/noverlay/itree-tests.c                 |  182 +-
 test/src/sqlite-tests.el                           |    2 +
 test/src/treesit-tests.el                          |  472 ++
 579 files changed, 58033 insertions(+), 19051 deletions(-)

diff --git a/.clang-format b/.clang-format
index 2208240a66..5c987536b0 100644
--- a/.clang-format
+++ b/.clang-format
@@ -7,6 +7,8 @@ BreakBeforeBinaryOperators: All
 BreakBeforeBraces: GNU
 ColumnLimit: 70
 ContinuationIndentWidth: 2
+IndentPPDirectives: AfterHash
+PPIndentWidth: 1
 ForEachMacros:
   - FOR_EACH_TAIL
   - FOR_EACH_TAIL_SAFE
diff --git a/.dir-locals.el b/.dir-locals.el
index f0ab46236f..fc89dff87f 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -11,7 +11,8 @@
          (vc-prepare-patches-separately . nil)))
  (c-mode . ((c-file-style . "GNU")
             (c-noise-macro-names . ("INLINE" "NO_INLINE" 
"ATTRIBUTE_NO_SANITIZE_UNDEFINED"
-                                    "UNINIT" "CALLBACK" "ALIGN_STACK"))
+                                    "UNINIT" "CALLBACK" "ALIGN_STACK" 
"ATTRIBUTE_MALLOC"
+                                    "ATTRIBUTE_DEALLOC_FREE"))
             (electric-quote-comment . nil)
             (electric-quote-string . nil)
             (indent-tabs-mode . t)
diff --git a/.gitignore b/.gitignore
index e6310b644a..af0ba0eb41 100644
--- a/.gitignore
+++ b/.gitignore
@@ -158,6 +158,7 @@ test/manual/etags/srclist
 test/manual/etags/regexfile
 test/manual/etags/ETAGS
 test/manual/etags/CTAGS
+test/manual/etags/CTAGS*.sorted
 test/manual/indent/*.new
 test/lisp/gnus/mml-sec-resources/random_seed
 test/lisp/play/fortune-resources/fortunes.dat
@@ -333,3 +334,7 @@ lib-src/seccomp-filter-exec.pfc
 # Ignore a directory used by dap-mode.
 .vscode
 /test/gmp.h
+
+# GDB history
+.gdb_history
+_gdb_history
diff --git a/ChangeLog.2 b/ChangeLog.2
index 483dec2542..5d4c1afc36 100644
--- a/ChangeLog.2
+++ b/ChangeLog.2
@@ -23054,8 +23054,8 @@
 
        Fix tests in file-notify-tests.el
        * test/automated/file-notify-tests.el: Remove Tramp declarations.
-       (file-notify-test00-availability): Print remote command w/o Tramp
-       internal functions.
+       (file-notify-test00-availability): Print remote command without
+       Tramp internal functions.
        (file-notify-test02-events, file-notify-test02-events-remote):
        Adapt docstring.
        (file-notify-test03-autorevert): Use `format-message' when
@@ -28676,7 +28676,7 @@
        * lisp/faces.el (set-face-attribute): Don't be fooled too easily
        by a hyphen in a font's name.
 
-       Fix value of posn-at-pont in R2L lines
+       Fix value of posn-at-point in R2L lines
        * src/keyboard.c (Fposn_at_x_y, Fposn_at_point): Allow X pixel
        coordinate of -1, for a newline in a right-to-left line that
        overflowed into the left fringe.
diff --git a/ChangeLog.3 b/ChangeLog.3
index d27a14d427..4b3507bae3 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -1654,7 +1654,7 @@
        This reverts commit 78f76fe16e2737b40694f82af28d17a90a21ed7b.
 
        The commit made calls to cl-concatenate bug out, since
-       autoloading defalises doesn't work very well (bug#54901).
+       autoloading defaliases doesn't work very well (bug#54901).
 
 2022-04-12  Eli Zaretskii  <eliz@gnu.org>
 
@@ -14724,7 +14724,7 @@
 
        * lisp/icomplete.el (icomplete-vertical-mode):
        (fido-vertical-mode): Tweak docstring.  Turn on
-       icomplete-mode. and fido-mdoe
+       icomplete-mode. and fido-mode
 
 2021-08-16  Glenn Morris  <rgm@gnu.org>
 
@@ -20654,7 +20654,7 @@
        * lisp/progmodes/cc-engine.el (c-clear-<-pair-props, 
c-clear->-pair-props)
        (c-clear-<-pair-props-if-match-after, 
c-clear->-pair-props-if-match-before)
        (c-forward-<>-arglist-recur):
-       Invalidate caches with c-trunctate-lit-pos-cache.
+       Invalidate caches with c-truncate-lit-pos-cache.
        (c-forward-<>-arglist-recur): If in a matching <...> expression, the < 
has a
        syntax-table property, but the > not, remove that property.
 
@@ -28297,7 +28297,7 @@
 
 2021-04-17  Eli Zaretskii  <eliz@gnu.org>
 
-       * src/emacs.c (load_pdump): Fix compilation on picky-complier platforms.
+       * src/emacs.c (load_pdump): Fix compilation on picky-compiler platforms.
 
 2021-04-17  Daniel Martín  <mardani29@yahoo.es>
 
@@ -29362,7 +29362,7 @@
        Make the function correctly recognize a brace block preceded by an
        introductory line without a parameter list.
 
-       * lisp/progmodes/cc-cmds.el (c-where-wrt-brace-contruct): Reintroduce 
the use
+       * lisp/progmodes/cc-cmds.el (c-where-wrt-brace-construct): Reintroduce 
the use
        of c-beginning-of-decl-1, which was removed some weeks ago, in place of 
a
        c-syntactic-skip-backward.  Reformulate the code generally.
 
@@ -31051,7 +31051,7 @@
 
 2021-03-28  Lars Ingebrigtsen  <larsi@gnus.org>
 
-       Clarify the doc string of plist-memeber and plist-put
+       Clarify the doc string of plist-member and plist-put
 
        * src/fns.c (Fplist_member):
        (Fplist_put): Clarify what comparison function is used for PROP
@@ -32685,7 +32685,7 @@
        * test/README: Mention $EMACS_TEST_DIRECTORY.
 
        * test/lisp/image-tests.el (image-tests--emacs-images-directory):
-       Use `data-directory', for runs w/o of make.
+       Use `data-directory', for runs without of make.
        (image-type/from-filename): Check for `image-load-path'.
 
 2021-03-16  Michael Albinus  <michael.albinus@gmx.de>
@@ -35236,7 +35236,7 @@
 
 2021-03-04  Andrea Corallo  <akrl@sdf.org>
 
-       * src/comp.c (hash_native_abi): Account for 
`system-configuraton-options'.
+       * src/comp.c (hash_native_abi): Account for 
`system-configuration-options'.
 
 2021-03-04  Glenn Morris  <rgm@gnu.org>
 
@@ -46491,7 +46491,7 @@
 
        Fix Quit button in dictionary buffer
 
-       * lisp/net/dictionary.el (dictionay-close): Changing the arity of the
+       * lisp/net/dictionary.el (dictionary-close): Changing the arity of the
        function in cc5f2803785c5dc785f09a292313cf799e8d29bb was a mistake.
        Restore it, but mark the argument as unused to avoid a
        wrong-number-of-arguments error when using the Quit button.
@@ -69072,7 +69072,7 @@
 
 2020-08-27  Tino Calancha  <tino.calancha@gmail.com>
 
-       dired: Show broken/circular links w/ different face
+       dired: Show broken/circular links with different face
 
        * lisp/dired.el (dired-broken-symlink): New face.
        (dired-font-lock-keywords):
@@ -80628,7 +80628,7 @@
 
 2020-05-17  Andrea Corallo  <akrl@sdf.org>
 
-       Fix Garbage Collector for missing calle-saved regs content (Bug#41357)
+       Fix Garbage Collector for missing callee-saved regs content (Bug#41357)
 
        * src/alloc.c (SET_STACK_TOP_ADDRESS): Do not call
        __builtin_unwind_init.
@@ -88998,7 +88998,7 @@
 
 2020-01-19  Stefan Kangas  <stefankangas@gmail.com>
 
-       Make arguments to dired-chage-marks non-optional
+       Make arguments to dired-change-marks non-optional
 
        * lisp/dired.el (dired-change-marks): Make arguments
        non-optional.  (Bug#29842)
@@ -103735,7 +103735,7 @@
 
        Fixes bug#38131.
 
-       This is not the best way to have fido-mdoe emulate that particular bit
+       This is not the best way to have fido-mode emulate that particular bit
        of ido-mode.
 
        This reverts commit 5761a1a3939e23d8e8c725241dd9398a12f191b0.
@@ -107948,7 +107948,7 @@
 
 2019-10-12  Rolf Ade  <rolf@pointsman.de>  (tiny change)
 
-       TCL indentation fix outside functions
+       Tcl indentation fix outside functions
 
        * lisp/progmodes/tcl.el (tcl-calculate-indent): Indent code
        correctly outside of function definitions (bug#23565).
@@ -113661,7 +113661,7 @@
 
 2019-09-04  Lars Ingebrigtsen  <larsi@gnus.org>
 
-       Make the NSM not pop up an X dialogue on non-mouse actions
+       Make the NSM not pop up an X dialog on non-mouse actions
 
        * lisp/emacs-lisp/rmc.el (read-multiple-choice): Don't pop up X
        dialogs on (url-retrieve "https://expired.badssl.com/"; #'ignore)
@@ -118445,7 +118445,7 @@
        internal variable...
        (browse-url-browser-function, browse-url-external-browser): Used
        by these two; the latter of which is a new variable.
-       (browse-url-botton-regexp): New variable.
+       (browse-url-button-regexp): New variable.
        (browse-url-button-map): New keymap.
        (browse-url-button): New face.
        (browse-url-add-buttons): New function to add clickable browse-url
@@ -124088,7 +124088,7 @@
        This is fine when the GPG key is cached and each entry can be
        decrypted without user interaction.  However, for security some people
        have their GPG on a hardware token like a Yubikey setup so that they
-       have to touch a sensor on the toke for every cryptographic operation,
+       have to touch a sensor on the token for every cryptographic operation,
        in which case it becomes inconvenient as each attempt to find an entry
        requires a variable number of touches of the hardware token.
 
@@ -139023,7 +139023,7 @@
        Add 'breakpoint' to builtins for Python
 
        * lisp/progmodes/python.el (python-font-lock-keywords-level-2)
-       (python-font-lock-keywords-maxiumum-decoration): Add 'breakpoint'
+       (python-font-lock-keywords-maximum-decoration): Add 'breakpoint'
        to the list of builtins, it's new as of Python 3.7.
 
 2019-03-01  Eli Zaretskii  <eliz@gnu.org>
@@ -143055,7 +143055,7 @@
 
 2019-01-05  João Távora  <joaotavora@gmail.com>
 
-       New flymake-supress-zero-counters defcustom
+       New flymake-suppress-zero-counters defcustom
 
        A feature suggested by Yuri Khan <yurivkhan@gmail.com>.
 
@@ -143455,7 +143455,8 @@
 
 2018-12-28  Michael Albinus  <michael.albinus@gmx.de>
 
-       * lisp/net/tramp-sh.el (tramp-set-remote-path): Handle platforms w/o 
getconf.
+       * lisp/net/tramp-sh.el (tramp-set-remote-path): Handle platforms
+       without getconf.
 
 2018-12-27  Paul Eggert  <eggert@cs.ucla.edu>
 
@@ -157203,7 +157204,7 @@
        Fix file name completion in Tramp
 
        * lisp/net/tramp.el (tramp-handle-file-name-directory): Fix case
-       of localname starts w/o a slash.
+       of localname starts without a slash.
 
        * test/lisp/net/tramp-tests.el (tramp-test06-directory-file-name):
        Extend test.
@@ -177123,7 +177124,7 @@
        Mention pcase as a fifth conditional form
 
        * doc/lispref/control.texi (Conditionals): ...here,
-       in first para, w/ xref to "Pattern-Matching Conditional".
+       in first para, with xref to "Pattern-Matching Conditional".
 
 2018-05-27  Thien-Thi Nguyen  <ttn@gnu.org>
 
@@ -185860,7 +185861,7 @@
        (flymake-start-syntax-check-on-find-file): Obsolete alias for
        flymake-start-on-flymake-mode.
        (flymake-start): Redesign.  Affect the global post-command-hook
-       and local window-configuraiton-change-hook.
+       and local window-configuration-change-hook.
        (flymake--schedule-timer-maybe)
        (flymake-after-change-function, flymake-after-save-hook): Pass
        t to flymake-start.
@@ -190902,7 +190903,7 @@
        (initFrameFromEmacs) [NS_IMPL_COCOA]: Handle ns-appearance and
        ns-transparent-titlebar frame parameters.
        * doc/lispref/frames.texi (Window Management Parameters): Document
-       ns-apperance and ns-transparent-titlebar.
+       ns-appearance and ns-transparent-titlebar.
 
 2017-08-22  Alan Mackenzie  <acm@muc.de>
 
@@ -192390,7 +192391,7 @@
 
 2017-08-06  Tino Calancha  <tino.calancha@gmail.com>
 
-       Dired w/ eshell-ls: Handle shell wildcards in file name
+       Dired with eshell-ls: Handle shell wildcards in file name
 
        * lisp/eshell/em-ls.el (eshell-ls--insert-directory):
        Use eshell-extended-glob (Bug#27844).
@@ -192767,7 +192768,7 @@
 
 2017-08-01  Tino Calancha  <tino.calancha@gmail.com>
 
-       Insert subdir content if dir-or-list is a string w/o wildcards
+       Insert subdir content if dir-or-list is a string without wildcards
 
        * lisp/eshell/em-ls.el (eshell-ls--insert-directory):
        Append '("-d") into 'eshell-ls-dired-initial-args'
@@ -202761,7 +202762,7 @@
        (w32_frame_parm_handlers): Add entries for new frame
        parameters.
        * src/w32font.c (Fx_select_font): Handle `z-group-above'
-       frames during font selection dialogue.
+       frames during font selection dialog.
        * src/w32term.c (construct_mouse_wheel): Construct mouse wheel
        event from F's w32 window.
        (w32_mouse_position): Handle child frames.
@@ -204015,7 +204016,7 @@
 
 2017-04-02  Michael Albinus  <michael.albinus@gmx.de>
 
-       Apply connecion-local variables for shells
+       Apply connection-local variables for shells
 
        * doc/misc/tramp.texi (Remote processes): Show use of connection-local
        variables.  Don't mention Emacs 23 anymore.
@@ -204026,7 +204027,7 @@
        (connection-local-set-profiles, with-connection-local-profiles):
        Adapt docstring.
 
-       * lisp/shell.el (shell): Apply connecion-local variables.
+       * lisp/shell.el (shell): Apply connection-local variables.
 
 2017-04-01  Evgeni Kolev  <evgenysw@gmail.com>  (tiny change)
 
@@ -206236,7 +206237,7 @@
 
 2017-03-03  Rolf Ade  <rolf@pointsman.de>  (tiny change)
 
-       sql-mode w/ sqlite: In-memory database
+       sql-mode with sqlite: In-memory database
 
        Enable the usage of an in-memory database. Prior to this, sql-mode w/
        sqlite could only be used with file databases.
@@ -206672,7 +206673,7 @@
        * lisp/emacs-lisp/package.el (package-initialize): Check
        `after-init-time' rather than `load-file-name' to decide if
        `package--ensure-init-file' should be called.  Depending on
-       `load-file-name' will fail if the user calls `pacakge-initialize' in
+       `load-file-name' will fail if the user calls `package-initialize' in
        file which is loaded from the init file (Bug#24643, Bug#25819).
 
 2017-02-26  Eli Zaretskii  <eliz@gnu.org>
@@ -211195,7 +211196,8 @@
 
 2017-01-03  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       (cl-defstruct): Improve error message for slots w/o value (bug#25312)
+       (cl-defstruct): Improve error message for slots without value
+       (bug#25312)
 
        * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Don't signal an error but
        emit a warning for those coders who forgot to put a default value in
@@ -229956,7 +229958,7 @@
        Use #' read syntax for functions.
        (file-notify-test05-dir-validity)
        (file-notify-test06-many-events): Simplify directory creation.
-       (file-notify-test09-sufficient-ressources): New test.
+       (file-notify-test09-sufficient-resources): New test.
 
 2016-03-04  Lars Ingebrigtsen  <larsi@gnus.org>
 
@@ -231086,7 +231088,7 @@
        * lisp/gnus/gnus-rfc1843.el: New file for Gnus/rfc1843
        interface functions.
 
-       * lisp/gnus/gnus-rfc1843.el: Move all Gnus-specifig functions to
+       * lisp/gnus/gnus-rfc1843.el: Move all Gnus-specific functions to
        gnus-rfc1843.
 
 2016-02-22  Lars Ingebrigtsen  <larsi@gnus.org>
diff --git a/README b/README
index 80c04e20fe..f982c55b4c 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@ Copyright (C) 2001-2022 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
-This directory tree holds version 29.0.50 of GNU Emacs, the extensible,
+This directory tree holds version 30.0.50 of GNU Emacs, the extensible,
 customizable, self-documenting real-time display editor.
 
 The file INSTALL in this directory says how to build and install GNU
diff --git a/admin/check-man-pages b/admin/check-man-pages
new file mode 100755
index 0000000000..c7d781ba3d
--- /dev/null
+++ b/admin/check-man-pages
@@ -0,0 +1,56 @@
+#!/bin/bash
+### check-man-pages - check man pages for errors
+
+## Copyright (C) 2022 Free Software Foundation, Inc.
+
+## Author: Stefan Kangas <stefankangas@gmail.com>
+
+## 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:
+
+## Check Emacs man pages for errors using `man'.
+
+### Code:
+
+source "${0%/*}/emacs-shell-lib"
+
+exit_status=0
+
+cd "$PD"/../doc/man
+for page in *.1; do
+    # ctags.1 just includes the man page etags.1, which AFAICT will
+    # default to the one installed on the system (!), instead of the
+    # one in the repository.  So checking it is pointless, and we will
+    # in any case already check etags.1 separately.
+    if [ "$page" == "ctags.1" ]; then
+        continue
+    fi
+    log=$(emacs_mktemp)
+    LC_ALL=C.UTF-8 MANROFFSEQ='' MANWIDTH=80 \
+        man --warnings=all,mac -E UTF-8 -l -Tutf8 -Z "$page" >/dev/null 2> 
"$log"
+    log_size=$(stat --format=%s "$log")
+    if [ "$log_size" -ne 0 ]; then
+        echo "doc/man/$page:"
+        # Point to the correct file for *compilation* buffers.
+        cat "$log" \
+            | sed 's/troff: man1\/\([^ ]\+\)\.1/troff: doc\/man\/\1.1/' \
+            | sed "s/<standard input>/doc\/man\/$page/"
+        exit_status=1
+    fi
+done
+
+exit $exit_status
diff --git a/admin/cus-test.el b/admin/cus-test.el
index 7e73f2e44a..44897cd106 100644
--- a/admin/cus-test.el
+++ b/admin/cus-test.el
@@ -145,7 +145,8 @@ Names should be as they appear in loaddefs.el.")
 (require 'cus-load)
 
 (defvar cus-test-errors nil
-  "List of problematic variables found by `cus-test-apropos'.")
+  "List of problematic variables found by `cus-test-apropos'.
+Each element is (VARIABLE . PROBLEM); see `cus-test--format-problem'.")
 
 (defvar cus-test-tested-variables nil
   "List of options tested by last call of `cus-test-apropos'.")
@@ -181,6 +182,15 @@ Set by `cus-test-noloads'.")
 ;; (defvar cus-test-vars-cus-loaded nil
 ;;   "A list of options loaded by `custom-load-symbol'.")
 
+(defun cus-test--format-error (err)
+  "Format an element of `cus-test-errors'."
+  (pcase err
+    (`(,var :type-error ,value ,type)
+     (format "variable: %s\n   value: %S\n    type: %S" var value type))
+    (`(,var :other-error ,e)
+     (format "variable: %s\n   error: %S" var e))
+    (_ (format "%S" err))))
+
 (defun cus-test-apropos (regexp)
   "Check the options matching REGEXP.
 The detected problematic options are stored in `cus-test-errors'."
@@ -200,8 +210,7 @@ The detected problematic options are stored in 
`cus-test-errors'."
         (let* ((type (custom-variable-type symbol))
                (conv (widget-convert type))
                (get (or (get symbol 'custom-get) 'default-value))
-               values
-               mismatch)
+               values)
           (when (default-boundp symbol)
             (push (funcall get symbol) values)
             (push (eval (car (get symbol 'standard-value)) t) values))
@@ -215,7 +224,9 @@ The detected problematic options are stored in 
`cus-test-errors'."
                   ;; TODO for booleans, check for values that can be
                   ;; evaluated and are not t or nil.  Usually a bug.
                   (unless (widget-apply conv :match value)
-                    (setq mismatch 'mismatch)))
+                     (let ((err (list symbol :type-error value type)))
+                       (unless (member err cus-test-errors)
+                         (push err cus-test-errors)))))
                 values)
 
           ;; Store symbols with a custom-get property.
@@ -231,13 +242,12 @@ The detected problematic options are stored in 
`cus-test-errors'."
             (and (consp c-value)
                  (boundp symbol)
                  (not (equal (eval (car c-value) t) (symbol-value symbol)))
-                 (add-to-list 'cus-test-vars-with-changed-state symbol)))
-
-          (if mismatch
-              (push symbol cus-test-errors)))
+                 (add-to-list 'cus-test-vars-with-changed-state symbol))))
 
        (error
-       (push symbol cus-test-errors)
+        (let ((err (list symbol :other-error alpha)))
+          (unless (member err cus-test-errors)
+           (push err cus-test-errors)))
        (message "Error for %s: %s" symbol alpha))))
    (cus-test-get-options regexp))
   (message "%s options tested"
@@ -292,7 +302,7 @@ currently defined groups."
        (insert "No errors found by cus-test.")
       (insert "The following variables seem to have problems:\n\n")
       (dolist (e cus-test-errors)
-       (insert (symbol-name e) "\n")))))
+       (insert (cus-test--format-error e) "\n")))))
 
 (defun cus-test-load-custom-loads ()
   "Call `custom-load-symbol' on all atoms."
@@ -399,7 +409,7 @@ Returns a list of variables with suspicious types."
         (message "No problems found")
         nil)
     (message "The following options might have problems:")
-    (cus-test-message cus-test-errors)
+    (cus-test-message (mapcar #'cus-test--format-error cus-test-errors))
     cus-test-errors))
 
 (defun cus-test-deps ()
diff --git a/admin/git-bisect-start b/admin/git-bisect-start
index cf0c8cde41..945d4901c1 100755
--- a/admin/git-bisect-start
+++ b/admin/git-bisect-start
@@ -1,7 +1,8 @@
 #!/bin/bash
 
-### Start a git bisection, and prune the branches that are the result of
-### merging external trees into the Emacs repository.
+### Start a git bisection, ensuring that commits in branches that are
+### the result of merging external trees into the Emacs repository, as
+### well as certain commits on which Emacs fails to build, are skipped.
 
 ## Copyright (C) 2022 Free Software Foundation, Inc.
 
@@ -22,19 +23,1617 @@
 
 ### Commentary:
 
-## Marking the last commits of external tree merges as "good" ensures
-## that all the commits between the external tree root and the merge
-## (excluding the merge-commit itself) are regarded as "good", so "git
-## bisect" will never descend into these branches, which only have the
-## files of the external tree, and in which Emacs can therefore not be
-## built.  The last commit is the parent of the merge commit in the
-## external tree, that is, the parent of the merge commit that is not
-## on master.
+## This script can be executed directly, at the root of the Emacs
+## repository, with:
+##
+## ./admin/git-bisect-start
+##
+## The arguments to that script, if any, are passed to 'git bisect
+## start' (see 'git help bisect' for a description of the arguments
+## that can be used with 'git bisect start').
+##
+## It can also be executed automatically, when 'git bisect start' is
+## called, with the help of the following wrapper script, that should
+## be named 'git' and should be placed before the actual git binary in
+## PATH.  This is useful in particular when git is used through an
+## interface such as Magit.
+##
+## #!/bin/bash
+## REAL_GIT=$(which -a git | sed -n 2p)
+## [ -z $REAL_GIT ] && { echo "fatal: 'git' not found"; exit 128; }
+## if [[ "$($REAL_GIT rev-parse --show-toplevel 2> /dev/null)" == "$(pwd)" ]] 
&&
+##    [ -x ./admin/git-bisect-start ] &&
+##    [[ "$1" == "bisect" && "$2" == "start" ]]
+## then
+##   shift 2
+##   exec env REAL_GIT=$REAL_GIT ./admin/git-bisect-start "$@"
+## else
+##   exec $REAL_GIT "$@"
+## fi
 
 ### Code:
 
-git bisect start
+[ -z $REAL_GIT ] && REAL_GIT=git
+
+$REAL_GIT bisect start "$@"
+
+## After the merge of an external tree, the last commit in the
+## external tree and all its parents should be skipped, because Emacs
+## cannot be built on these commits, as they only contain the files of
+## the external tree.  That last commit that should be placed after a
+## '# SKIP-BRANCH ' below is the parent of the merge commit in the
+## external tree, that is, the parent of the merge commit that is not
+## already on master.  In other words, it is the parent of the merge
+## commit for which 'git rev-list --max-parents=0 <commit>' does not
+## include ce5584125c44a1a2fbb46e810459c50b227a95e2 (which is the root
+## commit of the Emacs respository).
+
+for C in $(cat $0 | grep '^# SKIP-BRANCH ' | sed 's/^# SKIP-BRANCH //')
+do
+  $REAL_GIT bisect skip $($REAL_GIT rev-list $C)
+done
+
+# Prune commits 1e5b753bf4..806734c1b1 introduced by 0186faf2a1
+# (Eglot merge on Oct 20 2022)
+# SKIP-BRANCH 806734c1b1f433de43d59d9a5e3a1e89d64315f6
+
+# Prune commits 31ea42e15e..58cc931e92 introduced by 4a1e9d61b5
+# (use-package merge on Nov 30 2022)
+# SKIP-BRANCH 58cc931e92ece70c3e64131ee12a799d65409100
+
+## The list below is the exhaustive list of all commits between Dec 1
+## 2016 and Nov 30 2022 on which building Emacs with the default
+## options, on a GNU/Linux computer and with GCC, fails.  It is
+## possible (though unlikely) that building Emacs with non-default
+## options, with other compilers, or on other platforms, would succeed
+## on some of these commits.  It is of course also possible (and
+## likely) that building Emacs on some commits not present in that
+## list will fail with non-default options, with other compilers, or
+## on other platforms.
+
+$REAL_GIT bisect skip $(cat $0 | grep '^# SKIP-SINGLE ' | sed 's/^# 
SKIP-SINGLE //')
 
-# Prune commits 1e5b753bf4..806734c1b1 introduced by 0186faf2a1 (Eglot
-# merge on Oct 20 2022)
-git bisect good 806734c1b1f433de43d59d9a5e3a1e89d64315f6
+# SKIP-SINGLE f37f93f364aed34275f515a8c933f48a0e2735b9
+# SKIP-SINGLE ba8e883fa30f1267c27751c1ee9df25a5dde4c0c
+# SKIP-SINGLE 3ef50c1ff691b0a6c2f56da76f7c1c9b572d8be8
+# SKIP-SINGLE 54f52a1390c394f42203f39d0b4d73318203e092
+# SKIP-SINGLE 128cacda1c79983f0b64773afc029bc757cfb7b8
+# SKIP-SINGLE fa7d1f075fb862ae4ca28390abf33d625dbd2813
+# SKIP-SINGLE 16ac7c0fc91b5eb09f2a129fc2c01281369f897a
+# SKIP-SINGLE 8ad92413b9349613f9815bd0aaf523896a84b479
+# SKIP-SINGLE 137898d89359c63ec05d7bb5eedc2d2f59102a11
+# SKIP-SINGLE 66a5abb102ec1d6e4c327632ef235d1eb6433291
+# SKIP-SINGLE e4deba098e0281538a0e7b04d849989f17e5bcc7
+# SKIP-SINGLE de4624c99ea5bbe38ad5aff7b6461cc5c740d0be
+# SKIP-SINGLE bfa88520136dd6b187ba101e6db5a5f8f0d5e874
+# SKIP-SINGLE f441451658ecb8d0d8ba386d9fd3eebf3b17d549
+# SKIP-SINGLE bf7f7c0d82a56ed1b76358657e74ca2833b19fe2
+# SKIP-SINGLE a1cb68be6c94513c436fd52e4453cb7afe28f2ba
+# SKIP-SINGLE 25d38a06eceb0853190a2d9acf53d85686f524bd
+# SKIP-SINGLE a7e4870f165e9fd36d5cfcabb19b215b94373602
+# SKIP-SINGLE 6a82d19db18f8480342cc4c1a0ad76c75df41941
+# SKIP-SINGLE cd0e63652445c90af7167b48d83e410af1e6e590
+# SKIP-SINGLE 097b1686b6ac518ba8c2ae225eb62560c2010431
+# SKIP-SINGLE 27accec97022a49b362feeb36293fdce2947eb43
+# SKIP-SINGLE e0e95199b93a232e5d4da67823364676ca9cb67c
+# SKIP-SINGLE 36cbe217c818000d90fea132f0c8041f06748502
+# SKIP-SINGLE 6b4195f2ace1f6328c5a833fde40f39babef4fa6
+# SKIP-SINGLE 4e6140b28324a9a63d54084c920206d00aed094e
+# SKIP-SINGLE 19cb3985a3795539b51d70625904e95a6e581eef
+# SKIP-SINGLE c52a9b6ddd9166571e6bc8bb9426b0267874f9fa
+# SKIP-SINGLE 8189b97e5ca12aff8ea34617431a868010643b5b
+# SKIP-SINGLE 0d3c57dcf3187864c0b6fd6115ee80ad33faf553
+# SKIP-SINGLE 23a130ee0d61fc39cee157921679809017a02b39
+# SKIP-SINGLE fbe6b90b0ced594cf74d5fd0dc9a32666f0d7d38
+# SKIP-SINGLE 5f3379b33866ff7dc16856b6c29712eae860af0e
+# SKIP-SINGLE 46193d5209780d21b848374d8c377fb6c8896d1b
+# SKIP-SINGLE 522f16dac945eee351cefb066af40f0d1a683f38
+# SKIP-SINGLE 1fcbd352f8116aca1ecdb62e84f3d86b89bc446f
+# SKIP-SINGLE 086c4eaf9d4ecc5074088115fa01c0b2fb061246
+# SKIP-SINGLE 37956463d67795819fe7d8fe02d6249388364783
+# SKIP-SINGLE 309b46420e83826ed1e0b947f98a47e8525e3c36
+# SKIP-SINGLE 8c0f326ea237e8acd03c51c1b3a44d237c044562
+# SKIP-SINGLE 88549ec38e9bb30e338a9985d0de4e6263b40fb7
+# SKIP-SINGLE 99af58d74e431da6b55f21272bf72a9f56ce0900
+# SKIP-SINGLE 630e2d2e6aeba60f178c6ef2b283622070b873b3
+# SKIP-SINGLE 79f017d5c3019f8bc2a5014beda28bb3b829a8e3
+# SKIP-SINGLE 78f869687e86d4a9f91003dbbbbacde2e2741487
+# SKIP-SINGLE 3ea055c90ed0b6c486518265300fa7219f8e5a29
+# SKIP-SINGLE b91bfa10413182654a76d0ba337198f39a4d0e8e
+# SKIP-SINGLE 7cc95d4d86e5a9f2df248d2aa7c8cc423c8f06e3
+# SKIP-SINGLE cb70725584a754a491ddad82c42278f17c714a2f
+# SKIP-SINGLE 0b544b676473dedf34c6cb6a3315bec1f42d7162
+# SKIP-SINGLE 8929746489bb257d1e29c3bab629b3b67e3117d2
+# SKIP-SINGLE 064541af6a71bf45d530fe34b7e00c8123ee93d8
+# SKIP-SINGLE 501ad546263ed2a902be1c9d8c1bb3af5794066b
+# SKIP-SINGLE 236648fe2623a10c8ca02637b79cd0ceffd0b6b9
+# SKIP-SINGLE 1b4442bee921d6698fc8ecac1c95c39f7ca2efe4
+# SKIP-SINGLE 8ed8ef307d9a28f6c3336a448c7fbdfe8a733d83
+# SKIP-SINGLE adfb6f1dc26a927cf4bab24bdfae54b51e3ae0ec
+# SKIP-SINGLE 6220faeb4e9be16b9dec728e72ea8dff2cfe35ba
+# SKIP-SINGLE 5ec3a58462e99533ea5200de356302181d634d0b
+# SKIP-SINGLE 04ea55fa471f0c75eeee6ccea33cf91c81fc246c
+# SKIP-SINGLE e9ec1c5b26139057f85548184ee4b47f3e29f564
+# SKIP-SINGLE ee9970734facdff57c79811a7b60973a0b9ec6b2
+# SKIP-SINGLE 4c1d7acf81a4dcec97fa4daf9e9f414e1321bfdb
+# SKIP-SINGLE 01ebe5dc0b1c71191f6a713fec245a188d587772
+# SKIP-SINGLE d8cca4d8c56a90ec9215d7bfb0b0edfa3a36ad4f
+# SKIP-SINGLE 382f6603ad4ba2a69b3961bdc68580ce77d222f9
+# SKIP-SINGLE 490fc5a5029c0d8e527a0c7f423ba83fd6afda60
+# SKIP-SINGLE cadb044fc2e69266308cdcabe6181be0f624b484
+# SKIP-SINGLE fea1ad36a0f7b1538984ab0f077095a53c570aa4
+# SKIP-SINGLE 84eef501554324b22c7a838aabed77aa79315121
+# SKIP-SINGLE 44c95c58b26b7b9d75965a83930ec3d77ffae28f
+# SKIP-SINGLE de456d1e4a1d7e34be6d040e0d8a04c42b14e62e
+# SKIP-SINGLE ce16aba66d39c076aeef0c898403e44cbfbfabbb
+# SKIP-SINGLE 89159e78bb449d3c13506a37d4a5df4424958279
+# SKIP-SINGLE 4db844a4532592ed2542c05a1747dad7ed319e15
+# SKIP-SINGLE 5b0fdefb4ca54b0d3dac3047ac1e4b380beb6ba7
+# SKIP-SINGLE c1e71d3899daca49e216dfa3a6e6e07169d02e1e
+# SKIP-SINGLE 735ae5cd3a76735c1b51913eaeff5df5f0b2b53e
+# SKIP-SINGLE e0150de010af2d9770380217f90bdc09592c968e
+# SKIP-SINGLE d22ddf5944b97ca7f853d034f9e2e812d9bf5552
+# SKIP-SINGLE 46dafe4103d1d24a9ec9b3a7a561829bcd5807aa
+# SKIP-SINGLE 622c24a2b75a564b9861fc3ca7a7878741e8568d
+# SKIP-SINGLE 6e45de6bacc508db11b15b2c8ba86aad8c0570df
+# SKIP-SINGLE 2d0a3feda61186319b7c834ee08c96926dd7ab92
+# SKIP-SINGLE 53f8f4bf2db097f4a2c68194c55a87c5a1176c8c
+# SKIP-SINGLE 2205546269bf5af01d766dc38720f71046b08dfa
+# SKIP-SINGLE e589018b48f802d69f62ab1e7e266df1c7d8cf68
+# SKIP-SINGLE fe304efa5155cd6a5c20a0731475a0ad6d087c4c
+# SKIP-SINGLE a1f93c1dfa53dbe007faa09ab0c6e913e86e3ffe
+# SKIP-SINGLE a02885a37031ec0e199dcb38ff9cb93e65e7b7cb
+# SKIP-SINGLE b20d05c6d76ddaf7e70da1430c9aac56ef1d6b31
+# SKIP-SINGLE 5317193fe55d130a456fe0cf06c56f027d617b09
+# SKIP-SINGLE 03f63888923404cd99023b853294f92536d3c87c
+# SKIP-SINGLE ea9acccd643272962831b63d932e283b8ecca7a7
+# SKIP-SINGLE 6df3eea9380f3684475e205a680804f3ff355402
+# SKIP-SINGLE 6fa9cc0593150a318f0e08e69ec10672d548a7c1
+# SKIP-SINGLE 4713dd425beac5cb459704e67dcb8f6faf714375
+# SKIP-SINGLE 2f6769f9cdb799e880fdcc09057353a0a2349bfc
+# SKIP-SINGLE 8bb5d7adaf45264900385530c7f76175ba490a77
+# SKIP-SINGLE 43c84577a3055d5ddf1f5d1b999e6ecca6139f60
+# SKIP-SINGLE 66dc8dd6d13d37ef23b52873293d95d87dca497f
+# SKIP-SINGLE 1c91bc9221d12618c9fb5507561dd35b7e392cb6
+# SKIP-SINGLE ace38bafa6ae0d40bf3fac9f998c8ecbe36d5f41
+# SKIP-SINGLE d354fc38286cba05b3ba2fefb9d9cd6d30deac3d
+# SKIP-SINGLE eb52828a439f674733ba70844b795c6673733572
+# SKIP-SINGLE 401e41df0c6aee6c071a26e0b89f16c70375fc2d
+# SKIP-SINGLE d812d20fbc3e1eff0f10443baed801adda9031cd
+# SKIP-SINGLE a3b8618d79657af0d7fea9cb6fd914ccf0f67849
+# SKIP-SINGLE 89898e43c7ceef28bb3c2116b4d8a3ec96d9c8da
+# SKIP-SINGLE 72d7961d678f9c5f4cb812e0bb9b6dffafb47c68
+# SKIP-SINGLE b1fe497a445a8be1b50c5b5952f3380ee9546710
+# SKIP-SINGLE 0ca61907cf4fe8afc723ed1e89e1a15ee69507ce
+# SKIP-SINGLE e8875bcbe067ea020dba95530ec4e9485942babd
+# SKIP-SINGLE a6b375ba4bfc9453abc428dcb73e65bfcf61b794
+# SKIP-SINGLE d490770dd09f1121b637eebdad82531de654189b
+# SKIP-SINGLE b389379c87481b6bc647ceb4d323f861281cad72
+# SKIP-SINGLE 4364a769b489c044c4e9eeac6cfbabcc844ab332
+# SKIP-SINGLE cd56490fef9cf585708b9d11de2f3f2ec1e2d5b2
+# SKIP-SINGLE 992e2019d3c535a61df064de25f664c01b8c309f
+# SKIP-SINGLE 41a5b76f79e2ef12a089e94406159e2d0e1fad1f
+# SKIP-SINGLE 3533623c4a007df80d57fe2dbc47d7e40d85041c
+# SKIP-SINGLE 21fa90b0488b2344b9b93ccc77263968d1b903b7
+# SKIP-SINGLE aca21d42d3c1327ddc202a03585416f2821e6839
+# SKIP-SINGLE 0f8343394675480f18c121520eed2203bbe1d6ec
+# SKIP-SINGLE d831312d668fbedeffe3711b13cd455309da84a1
+# SKIP-SINGLE 0c98dec5c9d0e0146a1519b9a7e099aae668c059
+# SKIP-SINGLE 491531b20d05a0f2cc747aa01e697a764c34a99d
+# SKIP-SINGLE 861824dbecc96339c68b1e15008a21c31e04721b
+# SKIP-SINGLE a13eaddce2ddbe3ba0b7f4c81715bc0fcdba99f6
+# SKIP-SINGLE 4ad6be65f68a5c875ecbaa9e66d8ced28f43670a
+# SKIP-SINGLE 2d42bf7f5e57001a836b7b4e6303fac9d3f00a1d
+# SKIP-SINGLE 2e3a33659fb85330ec76a67b2113472e7e0b546a
+# SKIP-SINGLE d0397f4a5764d3be93be3e3d35bccc1bf27522cf
+# SKIP-SINGLE d5ead735a07e619e514dd10b9e84e5d788b8a5f0
+# SKIP-SINGLE b8e0d203febffe7446cbc5e0ee7d9bf168854a88
+# SKIP-SINGLE 932698b7891668318ba9ca93375d8d27d52a07f5
+# SKIP-SINGLE 09eaf661eb6ea49c6324d8819a872c523133dc2b
+# SKIP-SINGLE 630df0587e1069b2cd2f2536d5fb61175adac3a2
+# SKIP-SINGLE edc63bf94f3cd3f52fab86fe7b92a3ec6a19de40
+# SKIP-SINGLE 47122295521c63febe9fc64680430812da3a3acf
+# SKIP-SINGLE 750721c3943e5837d7d9292d6462a144a49347c7
+# SKIP-SINGLE 1cad61030160ebc4b73e1f4212155a180d417be3
+# SKIP-SINGLE c68cce94c46140f2ad1411550427d3cc2658ec02
+# SKIP-SINGLE 8750a4546a1da4f03243df12c7e5b89f2c32d27e
+# SKIP-SINGLE 8d96feae07c618f591a952f8f10ae949735b4050
+# SKIP-SINGLE 92879a1b035baf297158812ccdbaf6ae1d157e16
+# SKIP-SINGLE bdd0c8600fcd33b6f8a535a66343591a29575042
+# SKIP-SINGLE 58430f29968a5661caff630d20dbbe7c864fe08d
+# SKIP-SINGLE f3b24e90dc9fad355102e1fdf2828ca33d447a07
+# SKIP-SINGLE 1bf7ca623b3d3e02617cf0b5f8d7f980384838d3
+# SKIP-SINGLE 0ef7f64407525a1e1bcc8aef4d1fd19a1cf60ec6
+# SKIP-SINGLE 23d3eeb798c7edc27898b0dbd4c2364a6ca6247d
+# SKIP-SINGLE 28718c4449972640c39a7be1b62ccc7f50c6e801
+# SKIP-SINGLE e6750596ef55352c260c200747bec3303e181fe8
+# SKIP-SINGLE fc05d4fec98387097c30a5c60e2f343cb797af26
+# SKIP-SINGLE 96644ed496cfc36ef886c401250203c57d77ab75
+# SKIP-SINGLE 86e512ed10d83e2d233cfb95bff68b6c05729686
+# SKIP-SINGLE a855473b7079b467ac01dbcee89cb57b3599fdac
+# SKIP-SINGLE e8adf68824178ea25a5fda0c53233a42883de861
+# SKIP-SINGLE 393228bd7a96b121f2ffba5fb7072a6cbf5ecefd
+# SKIP-SINGLE ad128fee434a954da2ead75647b6396ddbf91f6a
+# SKIP-SINGLE 056548283884d61b1b9637c3e56855ce3a17274d
+# SKIP-SINGLE aa779b0f15faa114fa5e3f59b17e628b1a837af8
+# SKIP-SINGLE cb8fcbc3cbd8f6cf95bb858b72188d752672cf6b
+# SKIP-SINGLE 0397f85c6f9b0a5325f774e2a56e7cd85176e228
+# SKIP-SINGLE 22fc91704be4737865b3715e5278dc78029791bd
+# SKIP-SINGLE 6d58dda40a0a43d14dffdd995f0cb3dcc329fa4b
+# SKIP-SINGLE 5772b920f40a8c9f0a5266caf8d0f4729f6d2c13
+# SKIP-SINGLE b104d764216026d77680a79993a051725e5ab94c
+# SKIP-SINGLE 89b5a8283375f83b8f0e174a3a8760158b99be6e
+# SKIP-SINGLE 1784ce6080e4895a48ce71747a136d9642baa73e
+# SKIP-SINGLE a3e9694078e24d19db860aa4ff8dec8bc34b59b7
+# SKIP-SINGLE 5e47c2e52b9b7616668c5586084e0128b231272a
+# SKIP-SINGLE 7a762fbbfc1c05be8de3d253251f5e7b32da2c73
+# SKIP-SINGLE eebb9783e1674732b7c63d50211b524ff0fea7bd
+# SKIP-SINGLE d533f5f2a783e4c6448f841e709f4528f498b7ea
+# SKIP-SINGLE 85f6aa33f55da97b13b5e81616f16a517d24f3d5
+# SKIP-SINGLE 59f3c86659c061e2673eb0da0bc78528d30f8f76
+# SKIP-SINGLE b91455633b03add918af3eb166ac797fd6c95722
+# SKIP-SINGLE 6c106712a8d2ffd0c932541cb50cc59a6df732f4
+# SKIP-SINGLE 65d428228bb57ce434a8eb5a4eeb2274171586b8
+# SKIP-SINGLE 4219240e1df6abbd842f4474fe7862f341cc355a
+# SKIP-SINGLE 6f6639d6ed6c6314b2643f6c22498fc2e23d34c7
+# SKIP-SINGLE 633db417fc3e905b28b017facdf596b36914b44d
+# SKIP-SINGLE 28e6584861a7f80b199edcd0d9eb3d97e344958f
+# SKIP-SINGLE 9b4b2e9fc8dfd37ad8f44940a16330c477f896ea
+# SKIP-SINGLE c3ac93bb9ff8b1fe1fc32f99c725e6cc209aa6ca
+# SKIP-SINGLE 885c512603f946dfb7a45c181e94b8677be2678d
+# SKIP-SINGLE 2cb9805702a4f15ca7ee4ef4edb6e6048b1d3320
+# SKIP-SINGLE 66d37175ecac41dfb2f854dbb148dcc7ca87b345
+# SKIP-SINGLE bb47c72de35312b742a1964b31ff315727baed00
+# SKIP-SINGLE 2c39565dc046d428127735552db6e7814631d4d4
+# SKIP-SINGLE 3c2e8eff8cc9a4a535f473b3e150cb056d8f891d
+# SKIP-SINGLE d79cf638f278e50c22feb53d6ba556f5ce9d7853
+# SKIP-SINGLE 06e452a57287c797cb96a6d4b45220358daab379
+# SKIP-SINGLE 85b4e88194cae541a0093a9166f4306e6fd3109e
+# SKIP-SINGLE 9613690f6e51e2f2aa2bcbbede3e209d08cfaaad
+# SKIP-SINGLE 6735df4443fe0aa60862a95c38746edf2b053862
+# SKIP-SINGLE f07c325d1f49e4b722f76aa730ac5d084bd0e77a
+# SKIP-SINGLE 151496a4b96430924bc148f85b9c8471d1e132b1
+# SKIP-SINGLE 9793a4616833a26157b4c60278ec17a9be233d8f
+# SKIP-SINGLE dad1aeb30760ef524e95e636c22346b051233a38
+# SKIP-SINGLE 8ba61ffd8cebb0ff9f7a219022f3c1f3eac2f6d0
+# SKIP-SINGLE e9ca57cfcbaf1a8dfc6bde5a2afd5f3c7b357cb1
+# SKIP-SINGLE 682118f5a06eebdc38767047e65d42aa9356cfe8
+# SKIP-SINGLE 2825d849451be45ea738e2d2b2567c834fe5a0fb
+# SKIP-SINGLE 0263216ec39d0914f17b662a3e45b4163ab6cc78
+# SKIP-SINGLE 3ba07bfc3ec43aa10d8e2d06a8f36f7022287573
+# SKIP-SINGLE e442879b5a963a6eb37403fe09f476e7ee8e0f55
+# SKIP-SINGLE 4575ae5a9c5589ac903362486951f0d36c8ff8ee
+# SKIP-SINGLE 67afa75e2b97c08976f0e5a8502dac5851d45f93
+# SKIP-SINGLE 64eb2fc74013a221927f9bef920e367758e1bc15
+# SKIP-SINGLE 37dd95866a004a9db1d77f075715243246033773
+# SKIP-SINGLE 8af26410a91c3c9679bb0281ddd71f0dd77ec97c
+# SKIP-SINGLE 76715f8921dca740880cd22c644a6328cd810846
+# SKIP-SINGLE 678881e428073b39a906c1ffd01e1b76e271cb5d
+# SKIP-SINGLE 155ec5096928ddb121fb725fca65436d6353cb67
+# SKIP-SINGLE cc3d7580fc1cab3119e5e05c427575a2668cbb4f
+# SKIP-SINGLE e2a78b0d6d844f29acaaddd775c7b1cd6dec7af8
+# SKIP-SINGLE 45eb3b3513619d97d046a8efbe0d16fafc75a734
+# SKIP-SINGLE 27980e36040d0693fe997de6b6b73c09c3ce1cb5
+# SKIP-SINGLE cca0e79ea81712786f92a6668c61001e60d24f32
+# SKIP-SINGLE 3dea8f8f53f81a1d15a55c9e3c87a7eade7ca273
+# SKIP-SINGLE d0fac17abdf6883bbf82b1752988db38d05282e6
+# SKIP-SINGLE 8fb995b9e360270b6a4d7b7732a127a6234eba23
+# SKIP-SINGLE a770fb44288c75fa2b0471ceaf00bf741376e40f
+# SKIP-SINGLE c7e393bc4130c871a92fef7e9ac0c7c1832aa614
+# SKIP-SINGLE 0d868917efb46400cf7dd57a1cdbba7404f322a7
+# SKIP-SINGLE 025adce2cf43f4ce9f3c543c1b8973541e1414d2
+# SKIP-SINGLE 872faabbd8cb0f5518777b2d4fe7de187f684a92
+# SKIP-SINGLE d14808cd271abf6a723bf495a6a01c14d18b5893
+# SKIP-SINGLE 23eab9a6a67604b5ebcdc99efc42fbfd3345c0b0
+# SKIP-SINGLE 6d4bf2cedab365411f0aedb373b63291086658e9
+# SKIP-SINGLE 5875fbaa2dfd919a2ba22db1d20ffa6c4c6e13bd
+# SKIP-SINGLE babe0d4508273c5fe0a3228b3d2b4d3dcb72cd58
+# SKIP-SINGLE eb83344fc7c08ec08b51e7700f1ac2632afa462c
+# SKIP-SINGLE 5c3dba24ef5f40825a01e30d2790c66df202b8b1
+# SKIP-SINGLE 47b7a5bd492e92dda928843e28a707b9682cb32f
+# SKIP-SINGLE accb7b7ecc19f85c2750ded1046a464bc73c6a52
+# SKIP-SINGLE 10a45096988f6f19e36e2e7865b6eb35c0929b6d
+# SKIP-SINGLE fe859a07870d5204adfd5c9a7f83bf69658d37c8
+# SKIP-SINGLE 61f3a4b4fcc43241caaac63195205774ab1a5732
+# SKIP-SINGLE 410e65e4ce6f871fd1b8a2ef4b227cbeeb17c1dd
+# SKIP-SINGLE 4fbdccedd58ffe4cd5f7ed7b744123cc25084bc4
+# SKIP-SINGLE a9140091dd0df7e89ddbaabec17608a20f06f7b0
+# SKIP-SINGLE 0c9bce3fc490d6f5e935883e9690871cce4f9150
+# SKIP-SINGLE 6c560a3b16f9015a19044395f0ef41b718d73496
+# SKIP-SINGLE cd06d173a602bf0aa8a227ff1626dc70013fe480
+# SKIP-SINGLE d1ea675d2cfccfb043c8e853c410427ca62dd921
+# SKIP-SINGLE 5e841bc9e5ff878b3dce36a712386ed6f53b6e60
+# SKIP-SINGLE 284f635da833d2dbf0102af3442197b46adf78c5
+# SKIP-SINGLE 41e20ee4bc01576d23fb8fd4f875385ce57eb36a
+# SKIP-SINGLE a411517faf624657aa58979f5463115115093309
+# SKIP-SINGLE da9541dd1086b7bab52940c82915efe114bb7419
+# SKIP-SINGLE fe6c507f5ce0fd744b5bd1d0db6ea175e1188a7f
+# SKIP-SINGLE e08e0880f9892fba747abdb95b1f3382ebd17e32
+# SKIP-SINGLE b6d8d34aede02a6af7a614f32b86292ee4ba1757
+# SKIP-SINGLE c4bacb1215bfdf058b374312256c27eaea1304a4
+# SKIP-SINGLE 534c33cf375182c97291d2dd242f936df5953321
+# SKIP-SINGLE d8a6d82c4d34286b377fd7bddd4be0116e8dd4b9
+# SKIP-SINGLE b3df3729596332a39404c364798a61bfef2adcc2
+# SKIP-SINGLE 134edc10367a8434167656e631865c85b5f10c42
+# SKIP-SINGLE d3a0ddedba53b9e2c99274c8ec125d53f991da5d
+# SKIP-SINGLE 4498e5a13a3b63a3024ceef102ae3b5c50f58be1
+# SKIP-SINGLE 9813905f834aa43eb194023f579c7e7951d96d0f
+# SKIP-SINGLE ec2e5a54b3b6324f1039f355fa646034918f6dba
+# SKIP-SINGLE 4a04046b7200b9c7201c252c23a8c313d4687b5f
+# SKIP-SINGLE bfcff8f88a472bd1a64922da094cd007d3b7a70a
+# SKIP-SINGLE b552fc05c231ca6800330a318d3a74ddd0f5a13c
+# SKIP-SINGLE 01963fbbe10d290ba037cd523d21ebbcd2536b40
+# SKIP-SINGLE c31823a51bba1e4f0c87af1a08ce856cc600f5c8
+# SKIP-SINGLE 66c388c21aa83d3ddb5a1827f81dd432514242ac
+# SKIP-SINGLE 77b1148b5164c71c4ba673173eed2a37918d4f78
+# SKIP-SINGLE 63091313490beee4c5ed9767195c2a3df98f0332
+# SKIP-SINGLE f0c0b2cea3ffea7e3c53ff24c58e7a08ac40babb
+# SKIP-SINGLE 1ac5c6c3cfc4c50347af893aa72926cdf2edb8c1
+# SKIP-SINGLE 926a394997eaae55b797a90cb2cd037bbe3c3db4
+# SKIP-SINGLE 31c60dfbd8541c9f1b1bc8127dde85e5d5af51b5
+# SKIP-SINGLE be3ab9f301bf741b0410c1f9fb1c5ce6dda1c39a
+# SKIP-SINGLE 4bfde2a79046519815e2bb8a8eb72e22eca0641f
+# SKIP-SINGLE 7bba702e1ad1ed343618e44cf5bbc2a1f079be0c
+# SKIP-SINGLE c64cb02cca320811032bb300ea6d12cf59acf65d
+# SKIP-SINGLE f208d5ae77cf381c6f1db9b1aef76d5e9805a106
+# SKIP-SINGLE c113d6f3c1e12fed3aa627e74a2a43be0350c31c
+# SKIP-SINGLE fa3af359df8754423a197682d31245ad88c02033
+# SKIP-SINGLE 6fe661342a24edcaea255c3ba9a37613031554da
+# SKIP-SINGLE b93e5463885f9c99e74b52d2f569ad06ec2d0ff8
+# SKIP-SINGLE 8a11e430ec261c08cc928a7a5b05ee1027f50368
+# SKIP-SINGLE 699fce296b13d7db386b1cb5cecf2710e5196691
+# SKIP-SINGLE 698ff554ac2699ec48fefc85a1307cbc4a183b0d
+# SKIP-SINGLE ab9e58b8e39f19cb35513f77310141a344a4de15
+# SKIP-SINGLE 648fdbbcec159e6bfdb7cd06d32c59e8a17a055e
+# SKIP-SINGLE 52e17e53b7dbafb4877d98d99188c335db6a3b5b
+# SKIP-SINGLE 394282142563fe1341eba1845672e2412bf8c7d9
+# SKIP-SINGLE f0151e17d296bfdeb1ca3f002c9b430c8302a6e7
+# SKIP-SINGLE 90c25b245259e99013dfb9292bea054a0ab4ffb6
+# SKIP-SINGLE b26c2767edd98787297879c4570a2702eef031be
+# SKIP-SINGLE 8c17995f7f948955c765562f32526d0a3b87398e
+# SKIP-SINGLE 093f5d0045cc5facd3728e385a71ef84f218bdfe
+# SKIP-SINGLE 18a7e5414c534db38eedb06b16ef68f2c17b98fd
+# SKIP-SINGLE 34f01eb88f87fb8bd5b816d76a2527b5277862a7
+# SKIP-SINGLE a1deb6cac305a73e799c63e2fbfe7221790e1e61
+# SKIP-SINGLE 58a3c54c7ea86ea6b715483e7b017008a78fbf14
+# SKIP-SINGLE 2da3305c3c335adcbc9e541b7c50e4e814df87d1
+# SKIP-SINGLE 2c5a3f413b7477544ba8f5b18ed233ea6ab6f2aa
+# SKIP-SINGLE 45a0ce0905e495ae93b39e75cedb34ac95c6ea71
+# SKIP-SINGLE b67a6cb8dd7f8e6757a54f1547f631f26fe26e74
+# SKIP-SINGLE c2e27949d5917256bb419dcdae73566079844b4d
+# SKIP-SINGLE 0701634aa788b316f331ccbb6c44dfd8304a271d
+# SKIP-SINGLE 8b379bbeca9b3765e2b1e948d9d9c90ab92ff4b6
+# SKIP-SINGLE f6ab713bbc3dc8fccf5fe490615aa2b679071010
+# SKIP-SINGLE a7f71e8dfae9b1571a2ad34e44f000ff4a391644
+# SKIP-SINGLE f21ec24524c705e18674a2e9e4db37b11fa3ebab
+# SKIP-SINGLE d715ae8788e16b22f7f68cb82b51a40ad95c78c2
+# SKIP-SINGLE 7bbb56bc430465a6807a8129a322c704c89e3eba
+# SKIP-SINGLE 7f6b0c1ee93663892c6220b982f7bc3275dcaa85
+# SKIP-SINGLE 18c83aedd91023a677153abeafe561eddb430146
+# SKIP-SINGLE 68b8980eee5683128035800d6a04c27c764fcc5f
+# SKIP-SINGLE 26577415400b88c66add5ac8848e6e370739bc21
+# SKIP-SINGLE 5b525f4f56f458d88b66be73cae2d1fc5b382db4
+# SKIP-SINGLE 9fac0e70e3f5b7d0b12b77cac50078e01f68ee70
+# SKIP-SINGLE c717a5bf53a9f08f2123968b62800a8450589719
+# SKIP-SINGLE 73ab8f4b8cb6f08e7b694bdadcd42751b3916dae
+# SKIP-SINGLE e2e63dc3f062ec3dee56f003efb3e093b56692d4
+# SKIP-SINGLE d16b73fb4a9d87ec220444d220c6b45879806fc0
+# SKIP-SINGLE 982af7f516efb190d19946bff7bb37567328b4b9
+# SKIP-SINGLE 9645b5752a3e40754d22d9e805778e95fdc86337
+# SKIP-SINGLE 1743da11d0fdbb24f6c6e8d084e98d0b6e4d3f62
+# SKIP-SINGLE 7556772ac2e375d3812665dd8e31548e0dd1f7ee
+# SKIP-SINGLE e4636297c630a81e1e201210b4e6da7e99b823a7
+# SKIP-SINGLE 5fb3782e95d512ddb9a23e7d713de5980c7c4c2a
+# SKIP-SINGLE 7e911d007d25df9a483eaad54956a4273405574e
+# SKIP-SINGLE daf32f1f87b3d71cddd9ab2e9e4c3f5b523ae409
+# SKIP-SINGLE 0dc5a85a1c3772a6e78f077719d82f437f626b1e
+# SKIP-SINGLE 0c450e09b8eea8839d10c329debb3be37ccd9a34
+# SKIP-SINGLE a7aae1473c1aed7758b550a23cda61ee17668e23
+# SKIP-SINGLE 48daf77a9d963c05ee198b3ab108c7f0b3686da6
+# SKIP-SINGLE 8f522efe9a963cd3523ea6863f9bd44881cdf6b7
+# SKIP-SINGLE b82f34f996c25deda1b89fc7006833335bb1a6fa
+# SKIP-SINGLE d38110efa75372d4c3be702f157d3a8c6b7f37b5
+# SKIP-SINGLE 30026cfe666e9647aeef73e26df5ffca2fa2c662
+# SKIP-SINGLE dff4f9c759f5cf19047719716ea5ee8ffdc3006e
+# SKIP-SINGLE 6eb122c8db9d6a445b2002f025e01215ab560843
+# SKIP-SINGLE 79a01866a01754b9f566af76ef96e80cd90d094b
+# SKIP-SINGLE 34f1035e878a06ad181ff7fc533cd1fa0a565847
+# SKIP-SINGLE b478444099655f36f7b243e21e8f98051299ca8f
+# SKIP-SINGLE feae2de4242d7288f94c4bb41a9b7deed8679da0
+# SKIP-SINGLE 7fc0292f5c49d11fc39853f8bc25586d54221e6a
+# SKIP-SINGLE 278b7c1b52be11e8c49b8252953e8e84d45765c3
+# SKIP-SINGLE 2385dddb3338fd0f34aac0633dde78dd650f7d94
+# SKIP-SINGLE 5ea28ea4d12140ebcfaa293b6f29521a80b3de25
+# SKIP-SINGLE 981c309325d55e8c5947274e4df6346ea51a056a
+# SKIP-SINGLE 11c3ec3df6ad79ee5175094f0cf14248d9724aa2
+# SKIP-SINGLE 21f5bd6154f254a53942a9823c9c708ffa4b22a4
+# SKIP-SINGLE 9a56b9bf71af83292d6831e08a8179b7cf5ee7d8
+# SKIP-SINGLE 120f691e99d7d98a959ec9a6075cb4e473831bee
+# SKIP-SINGLE c4fcaf5e729fe5ff9249a56b1d0f5927ef3932a5
+# SKIP-SINGLE 9aa13cd4beccfe41e8f4930cb029bd60e7788e93
+# SKIP-SINGLE 8aeba640460adbad283d4a18f91cce8e0364c40d
+# SKIP-SINGLE f521225736b2a6ab38bb94298fb4d3ace3d9a9ec
+# SKIP-SINGLE eac531b760aa805c293339eba78e58b5b89fa211
+# SKIP-SINGLE a590a8058d52c1cbe0f80b7ed0d8b0abed7bf7ef
+# SKIP-SINGLE f0f2a53b27187903c86189bd03f072ac6ddaba9c
+# SKIP-SINGLE d8c2da46e7e51a11882dabd593af29f4146aa0b3
+# SKIP-SINGLE 7844846e3fedac8f32f0d81d3c5e906715d39fd2
+# SKIP-SINGLE 3886a5c140b03f07c8faea7cacad0a791bc54fa5
+# SKIP-SINGLE a397fa06d18d6ae37a3a1288f269e1ae9eb3b569
+# SKIP-SINGLE ad33e3e549e24c48259c6bdfb069e41be0a31f98
+# SKIP-SINGLE afe4969a3b3b38014387a828b66f5dbc3a462a57
+# SKIP-SINGLE 5c74b806a6fb0a4cb237300ab0a5418a109ced5e
+# SKIP-SINGLE d9c6b4378ac851f5e730daa0ae36c9ee2d0292fe
+# SKIP-SINGLE 7362554eafd7e255b3d96a4f711e11708dee950f
+# SKIP-SINGLE b293aa91bcc7f553ffbc6c67027f3c86d06ffbd7
+# SKIP-SINGLE 232a36f17e2796c52cb0b1afd5872c454b92ce62
+# SKIP-SINGLE c4687d920db081f29e93cca8156793d545a827e2
+# SKIP-SINGLE 3fc859d9550ff6d35dbb453eb75c3296f23a94cb
+# SKIP-SINGLE 11192b29adf4ee500f5056d1b02d35908f858b53
+# SKIP-SINGLE 3ba1b52e277261286738b637e45a675b7d587f58
+# SKIP-SINGLE 498468a2367524c7bd763826df5aad2b76345912
+# SKIP-SINGLE c4b886831acb82643a38f48c91456b15363bed75
+# SKIP-SINGLE b18f92a942dca6f95c9a74835644e482f3b1b907
+# SKIP-SINGLE 6c77a9e046de682aaace72aaf3af78e6ba9e5489
+# SKIP-SINGLE 976b7fcc8ced57fa12a0504899974b5b2057c943
+# SKIP-SINGLE f0290502f3354f9ed7e8ec84c24ac13a7bad2fc0
+# SKIP-SINGLE 4946ed48fee637eba75b674b9ad568b9df26bac9
+# SKIP-SINGLE 2875340c9fcc3bd6a799a3c4a4d875fc753ea7b1
+# SKIP-SINGLE 037b9897a464bf25ef9587ee860cc7f20376a97c
+# SKIP-SINGLE e666bf781f1d3d74068e8d2b505e35dd75b5b423
+# SKIP-SINGLE 00f7fd7d427b85e69a53403a1d10ac122a92a95d
+# SKIP-SINGLE 0bb5a47402313634b0e8654355e519388851e07f
+# SKIP-SINGLE c00236a880567c72dcdba5fc90d6de1125616c76
+# SKIP-SINGLE 1c08dc82121d50e80bd2dcb0d1f39654cc6762dd
+# SKIP-SINGLE f4cb9cc9034c09a8798df3d98f6fa9313a777a96
+# SKIP-SINGLE a5a1b53807a9449298f62c761223e6a1c5654bf7
+# SKIP-SINGLE 92e285fdf0821d8a01db598c4e2ac7e2e0fbb3cf
+# SKIP-SINGLE fdb31d6a2709bff751c2ad240c41b30db1848b44
+# SKIP-SINGLE 9514dbf7ed70b6c08a11fd58c7889ff49e30ac13
+# SKIP-SINGLE 4beb850efb99b881fb8b648ad7bb43c6539a2431
+# SKIP-SINGLE 5f63ac26ccc18bcf9e364b74af4424f9e3677cf8
+# SKIP-SINGLE 726d8c5bae847a3240b758a1d25135865e9304f0
+# SKIP-SINGLE 44db9b912f1d8165383b5b30732fa9caa3d3a185
+# SKIP-SINGLE cedc19297e47473ae599faa7cbcb2f3f6c9d5846
+# SKIP-SINGLE e678021f0c3db705c91831cff466561fd73c3040
+# SKIP-SINGLE ef59b67e4657fa80d1528b9d476c67f01abecc35
+# SKIP-SINGLE 2ccce1bc3954ce5f2faa0dcf7fa68ec5cae710ca
+# SKIP-SINGLE 568883c9be8bfbb15ea48ae0de2c117894e8db4e
+# SKIP-SINGLE b6d6e7feb75b792c74fe3e1d036b9edf540d771e
+# SKIP-SINGLE 15ac087712250b5ffeb4d162761b2495a5e572a3
+# SKIP-SINGLE 36ab5c6d49f8fbfb858844743223414e6f2f2564
+# SKIP-SINGLE 080dacda7896e0eb5ee54b1550097e45a4f423de
+# SKIP-SINGLE df62baa7d4e8ce0760f32122899ae3c803180907
+# SKIP-SINGLE 8b1d9b8e5ed8035bd2f42517bb6bc3c8a6d6f0ae
+# SKIP-SINGLE ca8d5ed6ecd5ca3eafa2923ee04e56dc474bd964
+# SKIP-SINGLE df0a7547cbaf19152a74b5dda760e5d1f6c92ecc
+# SKIP-SINGLE 12639610f78f9006b70933bfc6898c1312f95290
+# SKIP-SINGLE fd3c00ff92826b466a3292a05072eb5b4f23a701
+# SKIP-SINGLE 0a74771ee9c406cf98d391378340c79645c88d52
+# SKIP-SINGLE 5dae0a9a55101aeb668f90e1fece1ffbab5e7ee2
+# SKIP-SINGLE b275ddd63a24b15dd8f90ea0c4f27341a8dfa977
+# SKIP-SINGLE 5ecb71c1e65038b79933c06e1c0303b3e58ef4b5
+# SKIP-SINGLE 42362d991443689162c3e0bf1eb683a85481a391
+# SKIP-SINGLE a88e5f0f199ad018d57d07016dce20e5462dbbca
+# SKIP-SINGLE 4c8b46514d87856e5e2044bce804ad0156097d04
+# SKIP-SINGLE c5bb62f99db4b1c70e68e7c7a30ede8227f199a3
+# SKIP-SINGLE 79436f0c744a65ed2757f0119f5bd13e2fbef995
+# SKIP-SINGLE 54677f96f3ad8e489e04c8bc7875e1ec4d6b9a79
+# SKIP-SINGLE 9a8f33f285295daff8ed02d35ece5e8fe11ac887
+# SKIP-SINGLE f0671c60637e218a54f9f3ac8e5950d17884f50b
+# SKIP-SINGLE 4496a3f5ba899c89e45cd478a22b25ddf77869ec
+# SKIP-SINGLE b3cbdfc86474932e4ef8d1237ed100a6f4f4c854
+# SKIP-SINGLE a647a97320e72db275a05961ae09e487ee3063e2
+# SKIP-SINGLE ee4feb005ffe1d35ffc4d390d18b88ecfdebe2c2
+# SKIP-SINGLE 88671e638b308886a9d6b5a590ee1aee56746d7b
+# SKIP-SINGLE a10405386f83333184c94a0a194b404e4273e2d0
+# SKIP-SINGLE d0fcb15fa9858eb600b0a8f35ebbdf5aadc2cd7c
+# SKIP-SINGLE d0173ecd0ce8c2ac458cd84c25216f59f3fc9889
+# SKIP-SINGLE ac08a7f26c53d65df7d9c2a5d76300a6a1a8106b
+# SKIP-SINGLE 694ece772220346aef12520bc66ca401d08809bb
+# SKIP-SINGLE 740462da6153b111a8196b003791a55c7f7fa878
+# SKIP-SINGLE 8234a62e6fb9f706f410a96e2ce9877c19e44a20
+# SKIP-SINGLE 26ce5664ae431ec141e852a4183844d83c3f8856
+# SKIP-SINGLE 54e0b112d3a91c86230bc4329e00ae8f2faa05e8
+# SKIP-SINGLE 6c9acd13d0d2aa181d21bf78d6530b3399520533
+# SKIP-SINGLE b3db331e8c36ef9706ad16c12055079bcd93c022
+# SKIP-SINGLE 3345399e87fe6100ef82c399337760ab01182240
+# SKIP-SINGLE a248dfe2c3341ed73de38c2feea64ec12f053aaa
+# SKIP-SINGLE 48f5530e7922e4c46db1c4ab82b1c3532db724c9
+# SKIP-SINGLE d7071c64575bd3116e154f93915ff099c6e0f3a0
+# SKIP-SINGLE e2855d93ee41bf23a72fdcb49bd5347512989f6f
+# SKIP-SINGLE f4de790beec514808eafd1cb22fa5eacdecd4552
+# SKIP-SINGLE e05253cb9bc4a35c7dedc3cbb2830e37d385a339
+# SKIP-SINGLE 60a81f44e49c77ef9143a665f94f89109002133d
+# SKIP-SINGLE 4a639f3ae9594f0d16835d5151b6dda7e83e1a1f
+# SKIP-SINGLE ce254ffa44e33352605e49aaa7d5fc4f545c1add
+# SKIP-SINGLE 9a87c4404fd0097e2efa14f63b97a9df8df6c07d
+# SKIP-SINGLE 7f5f60d54340aa0b36f22057fd3f2665fbcd5d67
+# SKIP-SINGLE a214a29e48397cf259327e1ffb44479648301e47
+# SKIP-SINGLE 5411beae0225937446eb8509c56277b120a2eb92
+# SKIP-SINGLE ba51c31b47a62e6815d8cb2cb34ecd642a677105
+# SKIP-SINGLE 10adad440b2eb3b09d9d4e876023dd13d8b3dab9
+# SKIP-SINGLE 6a3624eecbc0a116b293d05e044b8b40a86022e9
+# SKIP-SINGLE 44023f3db21c0365ceeb179657447d7cdb1feb8f
+# SKIP-SINGLE ba2bbea816ac5a20fa3090b634a17ed0d4a1c2ca
+# SKIP-SINGLE 9650e5a1a90768953ce9f3eef014616180bfed8e
+# SKIP-SINGLE 831f5e606125c48f783daee9643d101b7fad665f
+# SKIP-SINGLE f0b1519fbd0fea728238758d6bec074c32be1142
+# SKIP-SINGLE ea421cfefef6826dd99a9cc884b46178b2c0e1a8
+# SKIP-SINGLE d4a5aba954c838b32317560dd84e6681578b0e32
+# SKIP-SINGLE d2d229043674c59dead9a58a9ae20f8e62427fc1
+# SKIP-SINGLE 4fc8524df0e2ce0579d6bc298dc07d1e442587c6
+# SKIP-SINGLE 0c94e69fa6ed5a4f5d551f37f7f2632d2f2b2952
+# SKIP-SINGLE 960aa0c7985f6c61a26f99653c6e9ae9369e944e
+# SKIP-SINGLE c039822082983d6618b6e06c73a31cf6b63467cc
+# SKIP-SINGLE a421c277237ab6b5923473f6dbb9c196b16bc833
+# SKIP-SINGLE d901221e2bb2168cd1f05e3b2355e078c45f1f42
+# SKIP-SINGLE 954eb9b4a0b9d616db9646f081d11b2c6dd19581
+# SKIP-SINGLE 8ef0a1814eca5dc7f32e2784b3fa61498d220a70
+# SKIP-SINGLE 99258421bbb123e6f277610dcf94e022dde3a5c0
+# SKIP-SINGLE d0e6a276643b2590eebf81e305b006c768653b10
+# SKIP-SINGLE 0bf55d3a8131da02999fe694caf34096d7408952
+# SKIP-SINGLE 71b363e2b3c709e64f8ef8ab7446cc3a19573eeb
+# SKIP-SINGLE 23874aee8825a6f670b6c2da9eca2d9cf643b3af
+# SKIP-SINGLE 4fe02acb6b0556c4b17c7a8e01f41698f5109512
+# SKIP-SINGLE 95eb82644d348c59af9f4ec10ad315bf5e498353
+# SKIP-SINGLE eae7f30a9a338b5713d7808c9f791e1a7f79b3cf
+# SKIP-SINGLE 630fcab4fcfa9afab4688d803892d76cf6f46961
+# SKIP-SINGLE 37989f9431bc32f7ebac76cfc02f5e1d03486bcf
+# SKIP-SINGLE e97826ab845597fe09be43b2df888e96c7502bee
+# SKIP-SINGLE 0c60b3bae71a010e6abdcfd4d8d38b92c7874609
+# SKIP-SINGLE ab5611c25b92ca06238de3d0ae53226176c2ae0d
+# SKIP-SINGLE 407f5aac70f1481dfb365db7ba2e435f439498d0
+# SKIP-SINGLE 3681402bf163a3b5a7b7642f553e87693028649e
+# SKIP-SINGLE 16fe8a4678d20eac893bd05941071396b67bc84d
+# SKIP-SINGLE a99a3fbc40076aa3965feb759e816a8a25621c6a
+# SKIP-SINGLE 42b08f8a9ada7791c992894e88f648909e1ecc95
+# SKIP-SINGLE 41bfb91f5db878d139d5c0c631c569475018a7c2
+# SKIP-SINGLE 77c9236957a195a4ad0f50e8f19653a5c6918c8e
+# SKIP-SINGLE 41e5c9400cd9eeeecff2262907c09c3b10a5cde7
+# SKIP-SINGLE 3850be836ec7223c895901dd21f2a4e429314b94
+# SKIP-SINGLE 065dd0b5c6a7e11e79fe5ec02b153bb53bde0e77
+# SKIP-SINGLE 207b15147366be47d58c40a6f03888243602b11e
+# SKIP-SINGLE 6a546e63d0134861b208ab1bac259f71fcb30b83
+# SKIP-SINGLE f6b58e8016c7ce7b332a3b2a8a56bd2f9987d95a
+# SKIP-SINGLE ab3f36fac2da2979713109561f086d95bb26d580
+# SKIP-SINGLE 437c75cfcda4a0e9fd387d22aa8c0177c835c66b
+# SKIP-SINGLE 13f3b52fa422bed85fd7d50b43a167bb011e9070
+# SKIP-SINGLE f7c52087b2a836ab8913b7718ad37230a2895ef3
+# SKIP-SINGLE 3d0a3a51b8f1635ec872fc3f0a54c2d58ba48b4e
+# SKIP-SINGLE 76fcc2a69a96a7ab68b82ebc96c234dd58ef7e61
+# SKIP-SINGLE a82f1929fef5072a4b04e326b467cca8a8a21c0e
+# SKIP-SINGLE 4bb671f1c6adb6cbdcf90abe73967c24e5296372
+# SKIP-SINGLE 11b34169f802908348e99d0a52b9c50a64028964
+# SKIP-SINGLE b91cbf80aeb4487ad3e1fa0e64e3cb5549ec663c
+# SKIP-SINGLE 787444c7690d97d8702db059cb51ac506cb8a5e4
+# SKIP-SINGLE a1fd3d6eacaf425eadd121dcacee95a26f96505f
+# SKIP-SINGLE 0f526028b1830e72df1c39220c5efdc7e545885b
+# SKIP-SINGLE 9b44051ea530247e73dbc0bdc2998d2dbf9688c1
+# SKIP-SINGLE 6317f9e7b847f83e6a6d0f9ce9233a0566d84f0c
+# SKIP-SINGLE 0f59ce58fc558643f97175a32f2a82cc209f2bb4
+# SKIP-SINGLE 06fc663f519eefb431912ebdae8711ed016e0703
+# SKIP-SINGLE f59a96f5655c0ac2846a06cbad11ef3039476fb0
+# SKIP-SINGLE d8f3f8736c7d36b220a478f98deae9f82f25a4f7
+# SKIP-SINGLE 8b8b8539d7415f1decde46d088c89c2fc69b1010
+# SKIP-SINGLE 4320307843b44fa049ba7e8217f0349932ff56e5
+# SKIP-SINGLE 0cf4a9fdfc63577c97ff0d0e46f49cd685c5291f
+# SKIP-SINGLE fd42b6c696564cdb44999f6d4d3f91a63799191a
+# SKIP-SINGLE 009089f0d69a26e9779628e5b9c1d139eddf20d2
+# SKIP-SINGLE 7c9a3556e3d66c1ebe75f675341117bb28041da8
+# SKIP-SINGLE 37a04737218281fecf7b4e8b9a58839e25f02815
+# SKIP-SINGLE 3bc77cca86fbed8c12fb6c10c51e1237d65c9143
+# SKIP-SINGLE 13816f14b2f459a97d309f202f218282888e9bc9
+# SKIP-SINGLE e1128305102bab268272770b4a77361dcd9efb5d
+# SKIP-SINGLE 942702f506de1c7c3eff4e13470248be1a26e778
+# SKIP-SINGLE 00c493f01703f619a62e08bea17a49ce12f2367b
+# SKIP-SINGLE c9f367950652a3728cc94c7a7faf0aa55c2aae9f
+# SKIP-SINGLE c33c2ef5119a3e1ba9c97ca03e001916f83d09f9
+# SKIP-SINGLE d5ffb4949044ae58fb418b1b214cc7c6eb16a29c
+# SKIP-SINGLE f9ea53442e6f492f1543a5e21479e72be8eff4c3
+# SKIP-SINGLE aee75b87719abfaed605e33ed0c9e3a9a81417d8
+# SKIP-SINGLE 76dd30a98590f2266290a70f2e3d4d272c092310
+# SKIP-SINGLE e176d04d45adbb51f6bfa0b5a0352927056f3519
+# SKIP-SINGLE 26aeca29801a8e8950141d9d54aeb9a22ee6c5ad
+# SKIP-SINGLE 2ee2c67736cd76a52a2eb1002d0ec15e883082e0
+# SKIP-SINGLE 105e7180230dc22db91af2c8cbfa6fc3d2fee7e6
+# SKIP-SINGLE 3ed524c908d4aefd174ae6a8adc2bdaabb4bc4da
+# SKIP-SINGLE c47892201b2b9f1ef903ff2a12bb9ed9e64d19de
+# SKIP-SINGLE 6d230fc2c04532b4abf2474411b2995c237d5cc8
+# SKIP-SINGLE ce4375f57f9b89d68fb639590f3e4a0a28e3a627
+# SKIP-SINGLE 6a34ff5d9c13688a7264b2654f04982c5a3cfc6b
+# SKIP-SINGLE ec00ef8d48afaef65527c02ea013ba4489ed279d
+# SKIP-SINGLE eca71dd5c7a8b7013eb20e1457eddf62776e6c29
+# SKIP-SINGLE 6761e69a2bce255bbd78e08b5c592f4de19253f5
+# SKIP-SINGLE 93aeb781e1da3cab6ae90c90cd3668862155ab85
+# SKIP-SINGLE f97c03ebca440229ff953baee9e458a3ddcdaa70
+# SKIP-SINGLE 33d8b736b0330f51050ca1fc389527d708b1eb23
+# SKIP-SINGLE d392276b63cd0d9eb16f0e624bd8da9737cc66cb
+# SKIP-SINGLE 9f15b4c3ca98e6af3dfe61f70d0043ae896167ac
+# SKIP-SINGLE 9ee6b685a338cd06d4b053e39f3e2da505d20612
+# SKIP-SINGLE 809bd5aa34727151bdf40230e2fbc3151760466b
+# SKIP-SINGLE a2ed435e3aa18c0e6d4997cbb9a81426c952a622
+# SKIP-SINGLE 5c188552341204daf53f0ae2aa4e0c73ec4feb1e
+# SKIP-SINGLE bf91dd23fb7dd37650dfdb218358c8bac659c5a6
+# SKIP-SINGLE 03d2dda12f9e5d877edd15e31d6076361ccbd75a
+# SKIP-SINGLE fb41165adf7c6a354876a26fd7a6cc686f3fe142
+# SKIP-SINGLE fb309c14f0f5075cd649c083abf2a0713b949030
+# SKIP-SINGLE 5eb8d3dba14d94386f42dbb8fcdd28a98d10ac64
+# SKIP-SINGLE d6ae5369b0682ada2e7d801a3cc54f671ed03bf3
+# SKIP-SINGLE 0720354082858f59db9f70ada33efc424126d668
+# SKIP-SINGLE 0f68de830acb5eef41307efc119f3f16fdb35ab3
+# SKIP-SINGLE a18e54f54bdcd5d9b2c11b0307b0a157f52e5926
+# SKIP-SINGLE e0e0b92c1d3fe39085731db04bacd9def31f3940
+# SKIP-SINGLE 515644edc0ed2e73198f4c4eeb822715b2589dc9
+# SKIP-SINGLE 0b9bec6863e138efee77c2948c355b53951e6d18
+# SKIP-SINGLE 283b0db31c87a8bed736a8459ab16ae066ceb024
+# SKIP-SINGLE 10c6303d242ce8f01f38e78da71d01c7a379e651
+# SKIP-SINGLE 96bca89e5b03b6d5ab7ac8bda8216adfc1911205
+# SKIP-SINGLE 475b4768c856c0a25ee236faf0c30b39d5cd804a
+# SKIP-SINGLE 67ac8603eaa5618622d746f4097a0ba6ca2f76b3
+# SKIP-SINGLE 45158ed98b345145eb3e9f8c27b0591433465ff1
+# SKIP-SINGLE cf72d9de0f46960d260e3f5eba843ff01f30eff0
+# SKIP-SINGLE face460c41f59b5097748159ce64a5a09b277dc7
+# SKIP-SINGLE 59f7b155119b5718b83f0bac7409dd597002c89b
+# SKIP-SINGLE 1d3c0d1716eb2025c1dd2e07195b55bb5781fdd3
+# SKIP-SINGLE adac6fa11a95b5c3dd5ae5766b1539687d5931f5
+# SKIP-SINGLE 4847522fd4030af7ddb92b789545bc4e253524ee
+# SKIP-SINGLE 96e2863f2e85bc907e5fc0cb7d86e0b6ff54317a
+# SKIP-SINGLE 8d08a8a1070435e12b77517808df34a8093abc67
+# SKIP-SINGLE 7ba9a4c895b61d5c12118a18cb337f621bea4442
+# SKIP-SINGLE 922c4128034149abb130c6a9a06efa72659ffaf3
+# SKIP-SINGLE e4684a2f9d07ca6ad836028514dda8e3e6643bf8
+# SKIP-SINGLE eab243d22203e0aa56576b00568a93f18e8196cd
+# SKIP-SINGLE 50604ff3872a46baec8578b35db92d9892a35396
+# SKIP-SINGLE 63a1f317d05c8eed256251e7952e621a37b5cf7b
+# SKIP-SINGLE f24c0c7111d9a11921c057eb8d77ca4287294c0d
+# SKIP-SINGLE 689bb582623450826a9e2cdcc2aa63aaa6ab5764
+# SKIP-SINGLE aadb83da748c6befaabab0583fd38bac7fb094ba
+# SKIP-SINGLE 661567b7cd8092e1b41346b77e97201ea4d2efc2
+# SKIP-SINGLE f0e83548ee9d08a558363f73d6ec8e6f30e1cab0
+# SKIP-SINGLE 1a4aa391eea22fc053aa40c1827c7726de5fa7ac
+# SKIP-SINGLE 3b58bac273b517844210c9ecd07757625dc9804d
+# SKIP-SINGLE 26db0a032640a107bb0155b2f1eb7a586dbd8985
+# SKIP-SINGLE c6d819ecb5dafddb7b4dffa4c84f5264a3061d53
+# SKIP-SINGLE a90803a4d1bc47fcfc3b9a3af519cd8441bd92de
+# SKIP-SINGLE ca907fe89b16d59b067669f1c43af3eace1509ea
+# SKIP-SINGLE cae7d6cd58868916bcec34d9572736e7541b9710
+# SKIP-SINGLE 6bbbf3fd829f5000acb63536b5019b5be62d3e66
+# SKIP-SINGLE 01334409d6b03ef101bfd5cc8f5589220fa16483
+# SKIP-SINGLE f69a2b851d80602a158f8878811a63b219eb7fc4
+# SKIP-SINGLE 4a00e47d4d75528ec69291c03615bd669c58ed7e
+# SKIP-SINGLE 4a526ab48d10a26c9f58bde504023dd83017b088
+# SKIP-SINGLE 4cc1374786dcc28b80da546e708f7360f102abd4
+# SKIP-SINGLE f8a454f3efa10d59b8228b5c1373bfc9fb8ed718
+# SKIP-SINGLE 63078fb5af152934c5aa5facc5afd7f8e1907ade
+# SKIP-SINGLE 0cbe9c204e938977fef12dd4cc47d43a702ebfa9
+# SKIP-SINGLE 0ae14c17a24545dacf8ed309b2a75f8f1ed7da5c
+# SKIP-SINGLE 65c0d931f79672e15c6dfd633b619eabfbe9183a
+# SKIP-SINGLE 1f91b8c6eedc12fce03e76ebf8b9c039c5a0a0b4
+# SKIP-SINGLE abac70f198fc6502e3b4d81f9d9590e9d7432378
+# SKIP-SINGLE 9ff098615f92cf9fe4aa0f1c6835dbf9198daa6c
+# SKIP-SINGLE d19bb4861553fe82b86ef09db6cb6b1fe1eae829
+# SKIP-SINGLE b8127e988e2af662bdcd7cf25d281469a5142df6
+# SKIP-SINGLE bf253dd2e9e41a14b813692828ffc43ed24391ae
+# SKIP-SINGLE de1f89c202427a8bcb783f0b44fd02326b320a65
+# SKIP-SINGLE 734eb8f940c197e4b3548e7b79d716203e37aa8d
+# SKIP-SINGLE 8f1670b40fc9a779303207710a913b769170e82a
+# SKIP-SINGLE 9da698575addc4b9c007d7d6c1590bc5ac245bdc
+# SKIP-SINGLE 7d3da0a37edd57f6a31dff4864bcf1753de48698
+# SKIP-SINGLE 5630ebaf74f2f86e5d59fe4cba5ba96333e9fa6f
+# SKIP-SINGLE 9c31066ccdd6dbc7e9bd7a9a56de5c3103841018
+# SKIP-SINGLE bb25117eb40a08824142a5a56acc14d3fb4c89a4
+# SKIP-SINGLE 82a018e0622221910a7a02f683601c9f8c569cb1
+# SKIP-SINGLE d66d6ec5138049b98d99c4dcdd2c78582a6afe0f
+# SKIP-SINGLE d9db77704026ab0871325d431cae765981d167c2
+# SKIP-SINGLE c0ac7d039fb003444769700d60d06538341ba884
+# SKIP-SINGLE 8f3af3f61f43f2090bef30edbb9f8ae1a36c2e5d
+# SKIP-SINGLE bdea0f62b55e986136f5677369f354e4f5849863
+# SKIP-SINGLE 414a2b5bbc6ce441a8102254c593699e503d4f57
+# SKIP-SINGLE 89abc8d66f7668060305e9f0e5dc3ebfddfff3fa
+# SKIP-SINGLE 9b5f8ebb5bb970c34400b149190b2d16886ae814
+# SKIP-SINGLE 59d53e1fde516b911c29cedf338779df29f59dff
+# SKIP-SINGLE 84caa1a404cb89a6f02aa1cb517f5251e7e0e022
+# SKIP-SINGLE 6eb77feeee2d85cca1d6695f809072c357875ba8
+# SKIP-SINGLE eaade31040503efdce5c0daccd4c06f856d3fe2f
+# SKIP-SINGLE d9670ef135893c41d33e5bd12c69659bb5d6158f
+# SKIP-SINGLE e3ed0208a8ce25ed1d6c82e7e5bb3058d074afc5
+# SKIP-SINGLE 86a22004c9bdd1e93aac773cfda1932061f3b724
+# SKIP-SINGLE 6e205873992a2f8eeaecb30adf56346481a2c192
+# SKIP-SINGLE 772357698a226cdbf123d04d58573b79fd8814a2
+# SKIP-SINGLE c8d745d10a45ca3f378d7434f1cff73ae02ba42d
+# SKIP-SINGLE b45122b7132bb4b7e41fff5434e669e4ca671b8c
+# SKIP-SINGLE fcab7f72e1765b883537a0ae2c3a82a802539375
+# SKIP-SINGLE a49be9dba96575b68f0657c21eebcfbb56463021
+# SKIP-SINGLE 4c33696014d28975bce559a333c845fffc695428
+# SKIP-SINGLE 4a0adfec2a1caabca3bf99881f98f24ad12216f9
+# SKIP-SINGLE be1b64bdb515d8328228138982850475d15a0feb
+# SKIP-SINGLE c6be6fd6ccca9b9af1d9c5916d3da39f965e0ec5
+# SKIP-SINGLE 5976919a3325c4512e450b9649a510f05e7d4fcd
+# SKIP-SINGLE 0a014a386200532d92974d255b0b3f6b33d07a22
+# SKIP-SINGLE 82778374fef72583ac7c64f96187f56b1641ddea
+# SKIP-SINGLE 10d7284a2a1e8a543b31e5c99c2fc0c26c8eb681
+# SKIP-SINGLE baf16746960ad5f7baaf21b44feff9c8f3a4fc29
+# SKIP-SINGLE 2fb2862facf3eb70897a2e5ba342971ce696bc5d
+# SKIP-SINGLE bbf8b1df90f327a74423b2ccbfe557da9b04dd9d
+# SKIP-SINGLE d87d9e41f5890fbe7d279053c9c7328890c94b2f
+# SKIP-SINGLE 89172ac4376403b987bad897cdcfd22f9e5d97c8
+# SKIP-SINGLE c31b471cadcb9b8171de04b09a044bb775682a3a
+# SKIP-SINGLE 4088e467b3be3fcf6a1813bc74de7c4d3c193f1f
+# SKIP-SINGLE 8124ddf387451ec95ee4f8e0f726ab234bd8b762
+# SKIP-SINGLE 2cd60cb592930d985565612e0f22766b98fcf341
+# SKIP-SINGLE 403a7e59d5c79d81ee018fd9e648a2af744211c1
+# SKIP-SINGLE a8d358ed231b7656be50b034484b498b0b222445
+# SKIP-SINGLE 9709ff1436d547664e6b3ca252cd37665467b4de
+# SKIP-SINGLE bd3cd579cb43ace253e245a7026b172f216f3a1f
+# SKIP-SINGLE a317620a52746ea4346eabf4559a1caac2b63011
+# SKIP-SINGLE 47b22e55141da090a3d4688851eaa808f9489078
+# SKIP-SINGLE 69cbf2b2f304f82c6d77cd663d4211bf125ebe74
+# SKIP-SINGLE 83a146b24ec230539c4520a4315b8bcdeebdb434
+# SKIP-SINGLE 17ecb1c728edebd00a787fd6c4bdf8b7722e9a2f
+# SKIP-SINGLE aba160b043588171eac8235105d45b30a7f141f5
+# SKIP-SINGLE 05b733e86c108bdacd3ff45d05d560d7b8778a9b
+# SKIP-SINGLE ca28d5fd72d3cc7e960f4f2bd1d8cf00ac3622dd
+# SKIP-SINGLE 6d1c453726cf8a903c6bc555bacf20b7a4ac8651
+# SKIP-SINGLE 747c6a0dc8e53d66c785500d122957f4a17a9325
+# SKIP-SINGLE 351576f913ded76fc2e984c3ad42d47c5c5bc482
+# SKIP-SINGLE 94cae7b2bc02f49f238496ae4c386bcb9cafaeea
+# SKIP-SINGLE bbde29c012868e130388d9975beded563643a7a7
+# SKIP-SINGLE 33ce5fe9da02f0d0f4e0c32b86dde5c5e81c9565
+# SKIP-SINGLE c74f30c8e0f1799ebca7eb144c56506a53290243
+# SKIP-SINGLE d7173579a7e9a0f71ccd02fdc9f694b49aadbd47
+# SKIP-SINGLE 7abf1ca1212d91d0d50d3dd4f6386fac98fd2209
+# SKIP-SINGLE b7d1b2e9462e8d81ec44c41d82d1b840ebc831f0
+# SKIP-SINGLE cb2e6461f3db45df70334016b2a8411605eb847f
+# SKIP-SINGLE 6963deed24b13b448835be0d72d9b943ae2a345f
+# SKIP-SINGLE e4b32e3c572ef0786d2e6215ceeffb21d6046177
+# SKIP-SINGLE deeae4c415166eb144d008f0e904ffa70034c146
+# SKIP-SINGLE 634f71a2238b9e29d6bcab196092edfef19ebaef
+# SKIP-SINGLE e39f5e5c806dc0f7ee0f3520993ba061af7cb040
+# SKIP-SINGLE 03045e2e73eba5578218e09127055ab07a7c398b
+# SKIP-SINGLE c158b52ea421b4ea49adb79c445b712d18ad8273
+# SKIP-SINGLE 89c144b83077aea584e9bbbf04e1d786220aec4c
+# SKIP-SINGLE d6d5062bbae5ee708a0b80ad9b5f400320239fcc
+# SKIP-SINGLE 7edbb163b322072da6666240a698b5dc5fc6aaef
+# SKIP-SINGLE 77e80ae0136d1d79c0ee33b9780445aa6498664d
+# SKIP-SINGLE 6a69e49f01fdd025912e2d4397ebe2f51e3f188d
+# SKIP-SINGLE 59035c17d08f0999ba96c74d1763eedb0347d11e
+# SKIP-SINGLE 24dcbf47d826f46821ed484f93ffb89d306a0b2d
+# SKIP-SINGLE 63ecf01d0b0897b948296eaaffd690290d536b72
+# SKIP-SINGLE b9f37a2a09ac6bcef1a03cc49489f15ff01a74b7
+# SKIP-SINGLE c702e25a7a9e1ba2b75942dcc00402947757786d
+# SKIP-SINGLE 5f1039630dc8bf63f65df5c7882246f267d01295
+# SKIP-SINGLE b32900474fb5e4afdfd0c0015f6b08d58b5e7847
+# SKIP-SINGLE a8517ba3ceb21f3fb5c452226d5ca6a3981ae852
+# SKIP-SINGLE a70e54f6f7a6e711bcc49fce4e117d9c3e9d71a1
+# SKIP-SINGLE a2b9d58b2e2f56679b33995e2d86b0624c0b1905
+# SKIP-SINGLE 5adfe6520b5a3ff2e3bacc603487c4f12e54dfc7
+# SKIP-SINGLE ef6c633b9d5532d8888535a43ec8abc7de0a34f7
+# SKIP-SINGLE 1b9b19ebf911a959948de513afe3f639e23f346a
+# SKIP-SINGLE 4c6272373d4e5a6fbb8668f4980bbafbdc28405e
+# SKIP-SINGLE f74ab3e9ef7a5a63efdb4a7e0bca0c9cc71bf575
+# SKIP-SINGLE 038f46c2526fcc3643a74a6c3e9fda40691f4067
+# SKIP-SINGLE fca675dae325a974c625893fb0ad1aa88abeab8f
+# SKIP-SINGLE 59a428ed6ccd7ee41e847b1d63889845fae7ebd5
+# SKIP-SINGLE 314f9fcf6cb8a6f513022a40ee384ff0e4ca513a
+# SKIP-SINGLE 555450c7b1b1c02126bd9fc86486090fe2b829b5
+# SKIP-SINGLE 06ad74581385cd1930a073b2fda314230b254608
+# SKIP-SINGLE 17259826f263f87d45eb98c8effe0ba7ee774f5d
+# SKIP-SINGLE 4814c6b1184a2b3fe673c5389ce0a8d2c67aec09
+# SKIP-SINGLE ac47ef773e0cf734a3e3e4237aca50704a0a68be
+# SKIP-SINGLE 29fcb6ca1280fc01c652dcecc331b20cd88a5729
+# SKIP-SINGLE 37a794ce21aa52180c3b5037c3825efee91ee7a0
+# SKIP-SINGLE 3d9d7b34511bc3601efa2ab4ad24d62c73b80cc0
+# SKIP-SINGLE 2b51859d447cf2914cb64936f18231363d971b21
+# SKIP-SINGLE 82eb75bd542ddc97b94a21bab25387f34c86f54a
+# SKIP-SINGLE 9913638cc596a018c7d687652a3abb61325dc4f1
+# SKIP-SINGLE ff7093d74b51f094b65314e3567fc96a3a37ffdf
+# SKIP-SINGLE c05d414844f6e1e0af05ef0cbcabe3313f5089d0
+# SKIP-SINGLE 43172dd01fc7344f71f6e1d92fe051942f360355
+# SKIP-SINGLE 5d6e42e013caf236f5f1c7a8bca6d76916bb404a
+# SKIP-SINGLE 7e92976bc7973a4b4be0719b06d3751e57ad80ea
+# SKIP-SINGLE 6d4d9225afcca63f36b318b11be945146007b00e
+# SKIP-SINGLE 2f559c267806f8524d43bc46c5814c69074b0b0a
+# SKIP-SINGLE f23894516ac731bc858158c3e7198db8aa54bfb6
+# SKIP-SINGLE 41f1fd53c830666c1274a602ca48c433da2425d6
+# SKIP-SINGLE 6cd45fbf37bd344c87b83424ecaccc8119c30dad
+# SKIP-SINGLE d88d35ffed6c1073a0695ba1e980cb8ea7f09c3a
+# SKIP-SINGLE 17cf659fdfab02d7c5008d4a4b1df11f93b4764d
+# SKIP-SINGLE 6ac6e5b4752a596436b35419e7ca111b04f35d95
+# SKIP-SINGLE 3f841a942b22c4b6b140654d3d8de535b08b672a
+# SKIP-SINGLE e672990d882ce53167b22969eec6b32e96503573
+# SKIP-SINGLE 211db146a2f475047b38b010ea55c27c08701114
+# SKIP-SINGLE 6df64d170a93970fd57932980fceed6bf1853ccb
+# SKIP-SINGLE 94c542da1ac13fc6052d02fc7b960176c09bbaa8
+# SKIP-SINGLE 895bb4c9112c715a1bfa66d9af0d945f4719db55
+# SKIP-SINGLE b9b5cf4196e7a5368c5e36c0c5e0364b5d3e15b3
+# SKIP-SINGLE 999e625bc94d08eadf92d42d5bb0fd6f6d35c268
+# SKIP-SINGLE bfc298ca31d11c09d49d792a88a9f72415bb4513
+# SKIP-SINGLE 76021e1e06c5c1af05b658310505da333bc0c214
+# SKIP-SINGLE 90425b6d4b314f8f4c26cbf61ec24fdffec4c0f7
+# SKIP-SINGLE a102f471b3973d46d6954bc31c6170ddffd508da
+# SKIP-SINGLE c698ac791b3755c340ff945c137f6732cd4e20e4
+# SKIP-SINGLE a2b1795b96b5ac5981220b1056f6ea222bc193f5
+# SKIP-SINGLE a2257a531d0cd4c1d2bbfe374f490fa956be0330
+# SKIP-SINGLE 3b696d1cdcc79505313b2f087fbf742e503a1998
+# SKIP-SINGLE 4c03c46946d95a7e9079a087b5e0e835f5a5beac
+# SKIP-SINGLE e3163f1d4cec335b5941c9bea267fe161c5ab83d
+# SKIP-SINGLE dc52036074c46d1772557436cda2866b346b4d16
+# SKIP-SINGLE 9413488ab4e8752a2fe88ce9f42ca83ffbe5f1a8
+# SKIP-SINGLE ad5488cad62b04ff1ae28cbbe2a0dcb2af817f27
+# SKIP-SINGLE cf0053a66a8055e05e9842c41f60c2130f4dd642
+# SKIP-SINGLE ed2d884872ab18e38ac7d8ba17e1d3a3446029e8
+# SKIP-SINGLE d34eb7a39f15524dd13681864be14f85d15b4a0b
+# SKIP-SINGLE 620794aa93107115b52f3622c7b6934ebc3fc8ac
+# SKIP-SINGLE 5e06f2fc31a12012d73ef741715a68e47f0c3a09
+# SKIP-SINGLE 8bf2e4e282ff3c0661ebea70e574cce16bdcc356
+# SKIP-SINGLE 5ebc3fc47cfefb9f6726e9308f153c0df6941c12
+# SKIP-SINGLE 79d4b6915c0dc3e27ca18353bf53ceb31a14ded2
+# SKIP-SINGLE 20d42249ce8d7fad1e377621e717b238df3a4b05
+# SKIP-SINGLE 4d7a51eba2c780d10a0b0dac33936c178c677f50
+# SKIP-SINGLE 70a7c65742244403422d7c3e4b79a2046c1cefb7
+# SKIP-SINGLE c8a0b81f8ffe093910dd3ad2852dd47a15587d9e
+# SKIP-SINGLE 6f6362207f7d39b5fb10b2968d238e37848a5a9d
+# SKIP-SINGLE eb6ac423aa21a50d86056fdda4b2bd58278dbef4
+# SKIP-SINGLE 6a65498228c80a6cafc514dee7092b64e9bb84c4
+# SKIP-SINGLE b6540a8ef5b2725812760f5a9a5cdaef591cb5b4
+# SKIP-SINGLE 765e57e2d25d34280b25b925dd8ede4cbfd39020
+# SKIP-SINGLE f5ab0db4b03c497112fdcde3b8b270c3fa14a3c3
+# SKIP-SINGLE 7cd401f63db705acb8ede6624c293843b41e7e20
+# SKIP-SINGLE 941937d295dce322e00a1d77b61041e6bda5cfd8
+# SKIP-SINGLE 52089993aa3231ccdfd0469aeb7c3e7b6b89edad
+# SKIP-SINGLE f4603ab67438ec1a31b35918608dc4db410be9c5
+# SKIP-SINGLE 311c278c5bb26291fbe6d2e28130c43a08dce096
+# SKIP-SINGLE c4d723e865e86a83cf87d4cc42e7dbca799dc4ff
+# SKIP-SINGLE bdcd8dd9fe4a9926a0dbc46ee1180ef53a91bf17
+# SKIP-SINGLE 24fe275711aa0964051f3b95c9bc9b4a3e524826
+# SKIP-SINGLE 281d3a7aadefb673917bc585224c9bf7dae449e6
+# SKIP-SINGLE 291531a7e46edcf52f49e193114e818c111d7af6
+# SKIP-SINGLE fd6c673cfa76b30d3910963982e2c28ca208e827
+# SKIP-SINGLE 15e31a4a1fa359cfabda074903fce79f4982245b
+# SKIP-SINGLE 916a87f0a9748b4c31f20496fff3223553f5226e
+# SKIP-SINGLE d73dd4c12c92db4419df1b96b1562c5c821bf877
+# SKIP-SINGLE ac036532599bdd49ab3bdd36437a06a12224a620
+# SKIP-SINGLE b72d1c5b157214bc8feb4e6364ba624f9feae271
+# SKIP-SINGLE 4ed657604d669b4ba05a9280734c5f006939cdab
+# SKIP-SINGLE 92fc5baf17ccd0999f631d469708523de50ac06e
+# SKIP-SINGLE b30bbf030bacdb0b66c0296d1368db7b4c07558c
+# SKIP-SINGLE 643771818e36a8448744f061184cb3411b13291e
+# SKIP-SINGLE af51e6556daaa4e847209f79ac9dbc1a3ecc8836
+# SKIP-SINGLE 757a95906805b1d7fcbe4b536841a7b53ce0c047
+# SKIP-SINGLE ab69bb63641d12f8a53a262f37908d8234935e13
+# SKIP-SINGLE b6288d1322ec476c156c165496d08e8f782bcb03
+# SKIP-SINGLE 74635dafacb9ebb640a4a69108dabdd897c2498f
+# SKIP-SINGLE 29e17e08b395db8e08e4c91a543750f8021376e8
+# SKIP-SINGLE 0c33a8ff4bd20fcb5f2d4d2a27907c77804f4e42
+# SKIP-SINGLE b6e7df0926b1a569a582b0d3ff0da0c27ad368bd
+# SKIP-SINGLE bb8f8f5cfa0f66729c6c6a333bee5bd4ba16c24c
+# SKIP-SINGLE 7dc99d5d51fcadafcd7e38f169ef8b353db61e81
+# SKIP-SINGLE bdadeff503d1796758a498dee218751520bb0cf8
+# SKIP-SINGLE 128cc4a2f401e96936e9e5791e65fbdc35ace6b2
+# SKIP-SINGLE 3e18100038a0514b1ea6bee01a141f1477fdfbf6
+# SKIP-SINGLE 5992502ca42263855e327239eeb7f51b59a2703d
+# SKIP-SINGLE f63e1740edac418c2ab88d72e1ee56cecfec038a
+# SKIP-SINGLE 5dda07d22c8d974b31e196a802414c267fac5cc9
+# SKIP-SINGLE 9901f47ef77e777ebe0183624024527ce691256d
+# SKIP-SINGLE e65d2f364cf40891d15009e9764143a45c2d164c
+# SKIP-SINGLE b9c228438d34b15ae2804a563d4d52b5e0de62ad
+# SKIP-SINGLE 9273afa89034783aa26d4f5bb43cf22afce57e74
+# SKIP-SINGLE df59970cc41cee834f2432a18a098ec7de16f7ae
+# SKIP-SINGLE a42d67628942244b0cb90276c4e0ec77e967c0bc
+# SKIP-SINGLE 26da67d10b93e2997679e27b56a072e4767102c2
+# SKIP-SINGLE e1757517c33d9c6428ecab8bc277aea14ec0c96f
+# SKIP-SINGLE 7720dceba1079151c37aa0a3117ac22dac45a119
+# SKIP-SINGLE b670b2d8be07dd47274e4e771437b6c4e8649d66
+# SKIP-SINGLE 39e224ba18485d7da68d13579c74afb2cc86f382
+# SKIP-SINGLE a5e428a638718223b0ab667382a8493a135db0ca
+# SKIP-SINGLE b3dc6e8f06892869e0dcf39fd226b63752ce6cf9
+# SKIP-SINGLE f46bfdf3234548f664824b7c96838d3f918950d7
+# SKIP-SINGLE 6465002b8a51d065a662cb589e8e1cf0a78ad160
+# SKIP-SINGLE dba7034ea10fb394b0dcf91256b7df094218119f
+# SKIP-SINGLE 63bcc81d1df8524b20dab1fd45b2cba4d822a786
+# SKIP-SINGLE c77ad1866d0e559db41118ad5a2c306c81fa3c21
+# SKIP-SINGLE 318c4772af4fa04fd8dc498bdc252b691b3cdab5
+# SKIP-SINGLE bebe5a9791f7db3f088e0c07b2fd68e1d21bb161
+# SKIP-SINGLE 79f7d40fa850806450621f2fa4c73974399bd7f9
+# SKIP-SINGLE 1b72dad74f2e193e8da8de58ef8c46341897269a
+# SKIP-SINGLE 8b22849a5cef3e81e8b81cf7f32c186471607e06
+# SKIP-SINGLE 868b6b454ea75361a706ab57b45b6a49b124231d
+# SKIP-SINGLE a2cf65d2030c7856d029e43fec378efe42934400
+# SKIP-SINGLE 976357769fe33e36afb37d5cd663587f46e88d0e
+# SKIP-SINGLE 759a15d446b7f728d2d146cb1bfd6d722df9e998
+# SKIP-SINGLE 7726cb254503c2c3d082ffb8aed9c12cbeeec12e
+# SKIP-SINGLE e25cf441152746a4686ab7adca8d3302e0740189
+# SKIP-SINGLE 6e1e1bdc2c6ee45ac12283f8e8096723d60d93a1
+# SKIP-SINGLE d025ce26f849ae8429f5250eeaf6f4915befe804
+# SKIP-SINGLE 80826b8220c6f26609ce916ceee3a0bd143a1b41
+# SKIP-SINGLE 8da012e224276e42c15d613c0aac3ce3e1a3d939
+# SKIP-SINGLE 13651c52ca6c90265fe568a62db1f81152cfbfa7
+# SKIP-SINGLE 231c71706b3b5eec8038986f54198a8983ae83c0
+# SKIP-SINGLE 45a4510738a0878267fca5fdd687981c70209023
+# SKIP-SINGLE c7341aad72ee4cfca5c989ef982f07fbd14d8837
+# SKIP-SINGLE f78257006c46ac537aba00658b11a75a11bd1fce
+# SKIP-SINGLE a556a2ef5b45a25ff5df9a7cf3dc50e1ec46224b
+# SKIP-SINGLE fb9711df98be83c357321761d06e902e5410da79
+# SKIP-SINGLE 13811eba32c8d43126e3d137ddcedbdab4dd81c6
+# SKIP-SINGLE c87027e054ec247f3c7b80b2159cfcc633bfab7c
+# SKIP-SINGLE 099f9159c4312ad17e51fd3c9571cf525fc01b15
+# SKIP-SINGLE f9723f947a919f70aeb54a9cb6515a4ead3c90d3
+# SKIP-SINGLE 53947aa60b193ec9a34442d4492ddee9ea36ff30
+# SKIP-SINGLE 5aee49d203aeae2dabd1263736c0c6bf799f4f8e
+# SKIP-SINGLE 721d1102986ad16bc71dc7a460ad08cbbe3ae979
+# SKIP-SINGLE 15e4c44564829f2eb3a7845ae94e064540ac1a4c
+# SKIP-SINGLE 8c149505a08ddec931b54e358f4d43e847920861
+# SKIP-SINGLE af7bfaad6a6efa67cab0855b93ebdd920548a007
+# SKIP-SINGLE 988a5133dc86e28e4b097d2c8d64d25e37bb6c5d
+# SKIP-SINGLE 1deb54f5c9c0b4f3c594e4f4aa76b42a67643976
+# SKIP-SINGLE e1d945421522f5b944b35e70cc0a535acc942230
+# SKIP-SINGLE ac297b67bb5fbd4488023ca693a1dc62f012da5d
+# SKIP-SINGLE 210a3c0b3ad2a944bfed4e87a5039a9e4e14329a
+# SKIP-SINGLE a11dc2c8ad5f4162fbad497ce7a813d9f58837b4
+# SKIP-SINGLE 8f446c06498b0c41e58d9265aa72c4615a220956
+# SKIP-SINGLE 79dc3a717e23cf66d04cf3ec3392bd7635839bd0
+# SKIP-SINGLE 187c1eed6f5e21088c5b9b129c65b3e2fe512d1b
+# SKIP-SINGLE d88694315f88baa24d4e0bd40be450218088292b
+# SKIP-SINGLE f3fd0293d9112e5e1ad9ad3bfb1e982dcb0d032b
+# SKIP-SINGLE d6ab30499153b2d6b9565039714f210930a10f65
+# SKIP-SINGLE 592bfe5a978c949883472e66bd6c00f58808a506
+# SKIP-SINGLE b3d858da8d577449e2ab40572422fdd1bdf8b538
+# SKIP-SINGLE 4da353c6a3900ddacab00d685432fba12099dbd0
+# SKIP-SINGLE 1001af9b847c1c338638ba1aee037dd8451882d0
+# SKIP-SINGLE 87bf022f2f5457febf23c2ce792c549928771bbd
+# SKIP-SINGLE 203b6ce9fa148ca05fc2688a8a1a607dc922acd7
+# SKIP-SINGLE edcadf5c440a95c0c6a564d89eb9beac64e229fc
+# SKIP-SINGLE 3ee58c64e57cde232a062cb199688b2686488ef1
+# SKIP-SINGLE 5c406adac75e1b007545991fb7f20068bcaa5b22
+# SKIP-SINGLE 7ce2c17a0fbde3203f311c6b91d8bb2ba77adeda
+# SKIP-SINGLE 65eb55ff4194c67ede020ceabd7b92e7d2128908
+# SKIP-SINGLE 097f36bc75a6570e64f80451ae4bbe2172d610e0
+# SKIP-SINGLE f867699b23ad012ad71f08f88ecf3e0e8df045da
+# SKIP-SINGLE a5803441934b5a128f02169c37e4e00b25b4fc10
+# SKIP-SINGLE 8bfe8ce8d0885e8022b2bea82d1cff9cbed86fb1
+# SKIP-SINGLE 96fc40d7dbdc77efa7b2e01f231bef9e19e96786
+# SKIP-SINGLE efd20b8c4bec0b6edfeb0c415719cb7b230496ba
+# SKIP-SINGLE 34d1a15307a4cb1f667e8af6ecca523369c436c1
+# SKIP-SINGLE 1e9bd1df4c1def12750b2ce6dc335c1921a21686
+# SKIP-SINGLE e642113184136a66fee782c3cdec832ec2ba4c0b
+# SKIP-SINGLE b8aeb2e35d99e14970d15561fcf161ce78fd2426
+# SKIP-SINGLE 16b2a5471eaa7ae2514398720696b3da12514e84
+# SKIP-SINGLE 5cbb6ad8951e8393c3cd728738214a0c87e149be
+# SKIP-SINGLE b3038fa86716edfe9f015c3d0a4c53b9a61c975e
+# SKIP-SINGLE 2b56339f75811a670a18439fedd17de932662c78
+# SKIP-SINGLE c43a9d940a9d033f7770f241f920a537167b211b
+# SKIP-SINGLE 37381fb9b2cc225d127d8eb7cfc0e42c27cc1413
+# SKIP-SINGLE d234e9bc8ae3c8ea1ecb82970a4fd1fd89850249
+# SKIP-SINGLE 70fc2a742d28697b0bb05c16665f038f6f79c86e
+# SKIP-SINGLE 3943db1ab27a29105520bb4e2975e68540e3f055
+# SKIP-SINGLE c6680e15d7c46b9c15358c5bcca4c70b3b2608be
+# SKIP-SINGLE 1121416cfde99f0738d0dac63b6fdd2667de2c5e
+# SKIP-SINGLE 15b4f9d8786d4ecc9eab81d114f09448de2b9ce9
+# SKIP-SINGLE 68472f45a6a441b1436b5949c0384dd57111077c
+# SKIP-SINGLE a80140032be992d170925f274fad215de97d9a50
+# SKIP-SINGLE 7e3d6657e7a952c2eaf9d814ac639613ec81ac1d
+# SKIP-SINGLE 7ad90d410813dae9d2fda3c251d14678b8f104d0
+# SKIP-SINGLE a5524504164ed9077984b90ecf5067d1e8bcbdb2
+# SKIP-SINGLE 2a5c81a5c92d15e8db471d16f3a014a338f9c271
+# SKIP-SINGLE 6ce8092a01519acd2afe29a68b11809280677ad7
+# SKIP-SINGLE 28cd3abbdf24660d8c3587ee983037f82058b87c
+# SKIP-SINGLE 38a5a36a17578a5e06ab18986ce6dae68938e1be
+# SKIP-SINGLE f42b2b0143f5f6e6fd9741b482cd98785feb95da
+# SKIP-SINGLE 17807af213da9eb08507d47dff142a1f8672b4e7
+# SKIP-SINGLE bebd14acc1f646c79702fca4f7081df30a49a66c
+# SKIP-SINGLE 770e52e7001ccdd309a47cbf8b8c9862bfd44ab5
+# SKIP-SINGLE 2b48e5f979610de9c92df24d7cc6c47b6d8d83da
+# SKIP-SINGLE 5a9d4d67043e86831df9c8b3dcb398c45b01bb06
+# SKIP-SINGLE f4d2f75a0782c53bfb09b70bc75de3c974ae5002
+# SKIP-SINGLE b21539f6083bb7be6ce3b7d7701b270bc0bf384b
+# SKIP-SINGLE 1f2529df7d4663597d6ac72ac001def4cd049c1b
+# SKIP-SINGLE 25127da57f5de6ca42c90206f1bb7de0efb41ea0
+# SKIP-SINGLE 54e18532e7e731ec556e4039d677592215a78ac3
+# SKIP-SINGLE 5238cd1e6a9b3c310743fdb4497f8f16d965367e
+# SKIP-SINGLE 01442a9ac9c6e6a652b628cf18b90a7e30bff845
+# SKIP-SINGLE ffa59bb1611609879151b6dfa94772f9e2144849
+# SKIP-SINGLE 6696b561d4d37aebdbb42833d8b5a8d1f4e14482
+# SKIP-SINGLE 530faee2752c7b316fa21f2ac4d1266d3e7a38e6
+# SKIP-SINGLE 53f9bc6908a4da8f5c985e8f204a479c828c432d
+# SKIP-SINGLE c69c185109c90ecc486ab707ed32d7bb7aa467d5
+# SKIP-SINGLE 89cbff32e41771a64ba62e449ec797d55f86f15c
+# SKIP-SINGLE 3c5e3ca2badeda8637e84586eace6ba619f0110a
+# SKIP-SINGLE d5f6dc131b63d6bde096c03927c05a490c707c41
+# SKIP-SINGLE 9d8ce520f03217e5aaf08b3e252a1bb82c3fc641
+# SKIP-SINGLE 05f89e8ef4eb5fbcd04fcc9c0dcb92f90ad6b28c
+# SKIP-SINGLE 79483a5873a90bb28178af59acfdb00040c3d23d
+# SKIP-SINGLE bb0496e7e55a7fca89c51eb0b85dcfa6904ea3ec
+# SKIP-SINGLE 4acc4ac66753ff1556be907f2611b48ffc3fc79c
+# SKIP-SINGLE f7e10297d18b17f55b4a8442a3307db00605d46d
+# SKIP-SINGLE 73ced8c23ec3d5cdfa6d926af649235104707d85
+# SKIP-SINGLE 8cc8adb04d2861fb1b1bbb38e53feccf3a2fc1c5
+# SKIP-SINGLE f8b07ff4f318d799a471c9363903e3929fd5c844
+# SKIP-SINGLE eb1d22b136a3f7a49b4060553b79ee188f55a498
+# SKIP-SINGLE 6487d4ac5da92aab4d54b5702bba24a5a1ce8432
+# SKIP-SINGLE 1f3ba658fccdb0b35bdbbdfeb8591dba72ee983f
+# SKIP-SINGLE 43b6f05dfb46637a414520b27430fbe3b0f005fa
+# SKIP-SINGLE 65cc8efa333bbb66acd7b19f4b39c3138995e864
+# SKIP-SINGLE d432cbeb27c1f0a2e59c6853b61ecba3615f645e
+# SKIP-SINGLE 886ded1b70f24c52ee526f0c4a69ca06829fb2a3
+# SKIP-SINGLE c5ed3a72a8a70931ef9b0f9d69f73ff0fd40cadb
+# SKIP-SINGLE 208a11d3f0ede17b29da45c2491b703b6942a764
+# SKIP-SINGLE 1b809f378f6263bc099da45c5e4a42c89fef8d71
+# SKIP-SINGLE 5c890bfc191d0cf18dccbbf50ebdcde946a0d7fb
+# SKIP-SINGLE b16d553ecd1b0478ba28dca5d898fd22aa130fd8
+# SKIP-SINGLE 3568c5d86fc8d37d761245c19246f76803fb1f16
+# SKIP-SINGLE 1e09364d677b0fb57efd18369c55e8c2d0e826f5
+# SKIP-SINGLE de1b33f5a8c6ceee9be59285f70370c3cb2efd34
+# SKIP-SINGLE caf155c4638d4704b2a099657153c9abc115720b
+# SKIP-SINGLE 79e133da034cd2d7cccfc5a6eb7db340f2dc45a8
+# SKIP-SINGLE 7be160d80002cd000f33da38d3a2f7a2920c1bf5
+# SKIP-SINGLE f6d6ccc984ac241e1a5f61d770bf77c15f30ad07
+# SKIP-SINGLE b23daca20788ab6b54362c5bdb0470887de106fb
+# SKIP-SINGLE 0fc8671d10ccab52d78afdaeb715bcc9e52c0ac0
+# SKIP-SINGLE ba0a61d10a5aedaf4b7bb61aa3626f385d6aba12
+# SKIP-SINGLE c6f42387e32a4e99cd9ddd203ab51f3c5694054e
+# SKIP-SINGLE 46e7613ad3b88807d25cfab3d78bf46c9e2fe13e
+# SKIP-SINGLE 843b55f6822bc1e8b97b91222e7bc03b5caa9919
+# SKIP-SINGLE ed943db794987cb6fc87b55d68d6164190ba9a24
+# SKIP-SINGLE b799cc271d69fc494da1fe04ca8ec6c529a19a19
+# SKIP-SINGLE 289d6b2265e19822ed5ad44e5c62e9bf3750f606
+# SKIP-SINGLE b42df36757e7c86f33730090a8a0789e957f8fba
+# SKIP-SINGLE 527b8a807143253ed8e52de004fb3cc9a17123c0
+# SKIP-SINGLE 2e669305fca1d20e9224dfe0146cef8267c47071
+# SKIP-SINGLE 99f8a1c91733a8aaa47818e78dfe86c5635ce086
+# SKIP-SINGLE a8e3b29b2b73292c8497fee8932b04fa07a2c08a
+# SKIP-SINGLE 8264e8deaf6d67492964b63bb729ab6fcc350781
+# SKIP-SINGLE 50dd037338784381300f411c64d39a9fbaaa7f5a
+# SKIP-SINGLE a2323c7ccb0eab1b6395d5d1d7e18db617354e13
+# SKIP-SINGLE 91d539b0772d4b2a6bdc3fbccf92dc1fcc7f747a
+# SKIP-SINGLE 4ea90a711d11b14be728241a4454f8c5ee7b6478
+# SKIP-SINGLE c3b53559965a4c6f48274c3cbcb43eb6ef23ae14
+# SKIP-SINGLE 97267d2bf1fbb9279d32f75eda9dbcf0c4316edd
+# SKIP-SINGLE e704a6956d86ae394ecb029e066bf8d8c061baf3
+# SKIP-SINGLE 809934f0220e1d9a1780ab97d04fececf2b934eb
+# SKIP-SINGLE 31ec1a7d329cc9374b16c5831d30248c99e93dfb
+# SKIP-SINGLE d93bca019713e98228aca9f4d1a4838a72b1cf92
+# SKIP-SINGLE d168110a322389a9f991d7a5bdd1cf777642c990
+# SKIP-SINGLE fe7263803c37c836b3484861fbe13674a5063b4e
+# SKIP-SINGLE 29c7f8c915c3889dfd5b25878aa0692f826cd38f
+# SKIP-SINGLE 6e73e07a6f5cbdd1c5ae6e0f3fbd0f8f56813f1a
+# SKIP-SINGLE 3b9dad88e02f05773c599808266febf3e4128222
+# SKIP-SINGLE fddd63f8b854f6bfa91403f69ba694ccb54197bc
+# SKIP-SINGLE 97eec9db79443f99eecfd84af73e5249748b9796
+# SKIP-SINGLE 11e22452b0ab6f2ea7679665ed8e9abcbc03eae9
+# SKIP-SINGLE 79d585c2befb81ac5480a9577eaeb6e8915cae23
+# SKIP-SINGLE 59698d924e541b1768a61caafd0dfa40b5ed4b34
+# SKIP-SINGLE 77e194971c5370856a63cf02397d79f85d6b342b
+# SKIP-SINGLE abd8c9b4d71651b00552d3d5dea119f22adf3874
+# SKIP-SINGLE 69caa111c290eb1f02013c407f4ac2549b172c36
+# SKIP-SINGLE 8933cf86a1c64fc3302188629356084bcbfc65dc
+# SKIP-SINGLE 6e90768143ff47e96a70d91534344161a1d85f46
+# SKIP-SINGLE ffdb91c6b344b6b341e75ae981ebdb3e66b94130
+# SKIP-SINGLE 2601aa9105d935441ed25370feeeae3e717cc791
+# SKIP-SINGLE 8d5dfafab7dc40d4b74dc0b56d1b314fd8cac390
+# SKIP-SINGLE 4467073c50d2c7fbbb30530d1a0a25f8272ff56f
+# SKIP-SINGLE 4459dcc07865f6ae1f21f624fcb09cf8fdaecdb5
+# SKIP-SINGLE 21e475ea0c0d04ae7634f377ed64fe179388b133
+# SKIP-SINGLE c0d24d5316626a3d5e76f99a0f418463cb355459
+# SKIP-SINGLE df06cfe4a9859a00d7ea046be8f82f1b9e4564ec
+# SKIP-SINGLE 1ae8a18d949e3a3dc3f7a6f2284ecb35871416ca
+# SKIP-SINGLE 6e974130d709e9e8624dab5c24a6639c0331cb77
+# SKIP-SINGLE ca194ae5c9d63c032827af6c58132b066bce7fbd
+# SKIP-SINGLE 6927f237679e73343aea0d70e356fc247c05c4d6
+# SKIP-SINGLE 673d281b82886490707f3356a87b5a992d1dc0ed
+# SKIP-SINGLE a902af6c1b04abcac4d6d221a2b0086cc076bda1
+# SKIP-SINGLE e2613f41213c89bfd90d34a7a5fb120e7366ec6d
+# SKIP-SINGLE 3a964dc5c124d1b5402e7e5cf7a6b6f28310e67b
+# SKIP-SINGLE ac4dd5f244032148595fb787ff926882390b36b9
+# SKIP-SINGLE 952550258dcf06bc03662974aa6b6db9d792aedb
+# SKIP-SINGLE 667e002e91a26c20089c5843254a39b771b64ab7
+# SKIP-SINGLE efd80237ca6085f28497bded259a92a48bb6005e
+# SKIP-SINGLE 22910e71e5092250b2134dae07bd8e2a82e4f750
+# SKIP-SINGLE b9683230ecaada87f23bdba59ef044c4b0374216
+# SKIP-SINGLE da383aeb8e629f642b46e9c64b2ffcec9976c23f
+# SKIP-SINGLE 0689a4ac508a213f29c11ed6230596885d42f89b
+# SKIP-SINGLE 1fdbeffe3a65cb23abb43a4ea59df9553c9246f9
+# SKIP-SINGLE 40842f67afb2931de6789237a49570f99b70404f
+# SKIP-SINGLE 4e1f92feb3a861f93b7a285715d03be930b41b91
+# SKIP-SINGLE a0f060939456f3680823e34f430e482fcde2f5dd
+# SKIP-SINGLE 5dd2d50f3d5e65b85c87da86e2e8a6d087fe5767
+# SKIP-SINGLE 0776ac06803100e36d2ff7532744186f70bfcb56
+# SKIP-SINGLE e490ffcf953cd2a82aef86e05da24352db5d4568
+# SKIP-SINGLE 58de11fe1339a1248f9b0bccb3a3601a9d8f56c6
+# SKIP-SINGLE 515eb6989575dc1d8e8f996ec65494e637f24ffe
+# SKIP-SINGLE 9034dd053163d6fc383d1ea4223c0b4dd7e9fb39
+# SKIP-SINGLE 13824c44d28427931a7e3284adec9a3a38cd2323
+# SKIP-SINGLE 681faf9f0bc41972932b72ef34c026419b6eb54d
+# SKIP-SINGLE 63cbb54d7e163f74657dba46829262282ccda0df
+# SKIP-SINGLE 3478e64c88fe0187f49343ed778d7e9231cf5837
+# SKIP-SINGLE d1aacceae939318f419e0c265358e041c53f1eea
+# SKIP-SINGLE 164aac0a9919fb34896ddd824394a65802343a50
+# SKIP-SINGLE bf9ec3d91a79414deac039f7bf83352a9b0a9a85
+# SKIP-SINGLE dc94ca7b2b878c9a88be72fea118bf6557259ffd
+# SKIP-SINGLE 9fc1fdcbf330b0a85cd019bb75afcb8d36243524
+# SKIP-SINGLE 758753431af51f7ac79a55d426b915443e66a077
+# SKIP-SINGLE 49c748e336ee3c50e28d2aeda6396efc358d961b
+# SKIP-SINGLE 6fecf6ef2552a9b44c4311b7d5af3af0a5a54dbe
+# SKIP-SINGLE 71857d410635743d437ce1ee73dff69de50030d6
+# SKIP-SINGLE d4a6e42e92ee215659d09b0456032714aab73ca5
+# SKIP-SINGLE ceb9da3b7125fbdf0da04a3b158ac1e792c87f4f
+# SKIP-SINGLE 252d06dd5d177ad3d6d0464eb3e65dd6ce4cce79
+# SKIP-SINGLE 155dba943263236ba2c41926bae3cc45229b15bc
+# SKIP-SINGLE a602d548dfaa1dcd44c3af017ccbbcd3586ca023
+# SKIP-SINGLE dd3f6b13f673433e590c55b24232cf0a7e70de6e
+# SKIP-SINGLE c1e45419c7ad9679771718e91205502d30da6f2d
+# SKIP-SINGLE ec0527d8e9a7f12898c8fe9fdb6daec21c1d2ba8
+# SKIP-SINGLE b2164df86ba80cf4b7f3499596fbcf803395b6e7
+# SKIP-SINGLE 3d49ad73e5a93625629c96b6c0b921bb019ea9da
+# SKIP-SINGLE 89068554d7d0e9970a7269a0963e7a2bd0b1cc99
+# SKIP-SINGLE 483df14d5c4e04ff2a9fec18b68399c0ab2b56b4
+# SKIP-SINGLE 0934363c96ff774ce242b51529688bbfbb48ba02
+# SKIP-SINGLE 159dbd5eb211e36d98e200781f2eae93f0973aeb
+# SKIP-SINGLE 56254fb98c3369392dc2bd4383b7ff2ea24f2dc4
+# SKIP-SINGLE 4633e02726fbd683332eb64dee97b109aef4361f
+# SKIP-SINGLE 79eb840753edb2dd9e0bf1d4befb8e3e1275e009
+# SKIP-SINGLE aec08e609e6c672c6e85d91b84f45e38019ccc9e
+# SKIP-SINGLE 7d9d3951c6736d5606828e2727a7319856511ddb
+# SKIP-SINGLE e793a73fbea3167368bd173211c1995e07dcf913
+# SKIP-SINGLE 404023299429a2619c6e4bc5da80eb248d060ef9
+# SKIP-SINGLE 59ff342869062caba72af7834c00b36753fa7461
+# SKIP-SINGLE e4300777e8cc7559ea29faaeab6cafd3f7ebf3b7
+# SKIP-SINGLE e40f5a91eed69b5d6131671ba1699ce3ccb92f16
+# SKIP-SINGLE aa6cacd7138519aa8906c850950020d0546ae355
+# SKIP-SINGLE 2e595b3e8b887068e47e64116d5a910c1045a229
+# SKIP-SINGLE 91e7df281ee628eb56e7d016093a751f4e04366f
+# SKIP-SINGLE 0aa9f478e962e3e2d146871fa37267709404c52e
+# SKIP-SINGLE 2671ea0de8e90e20241fe0441f4f8b79eeccdb12
+# SKIP-SINGLE 958d6b4cf77af951d1ad40c02c5d5dcc28f31120
+# SKIP-SINGLE e36d3fc452735d1a1a2293e18b8e4ef944f8793d
+# SKIP-SINGLE c094b8c20a79c731cd36e86a3a6bc777606586bc
+# SKIP-SINGLE ae9bfaa891c4f3cacb118aef6e35432d5fbeb88d
+# SKIP-SINGLE 9d14e410dac11990cf0e95a1a77e83827323530d
+# SKIP-SINGLE 148b136651413d8eca0f805c786fb04b9c5878b8
+# SKIP-SINGLE 3c972723e44c9428ea990562033acfbd84ed29d9
+# SKIP-SINGLE 194c299470e087aeeff5c496c7dfc6400e1185a7
+# SKIP-SINGLE 8f5d2a3181d22f858ede3fb6a1452f99272901fe
+# SKIP-SINGLE d50e0bdbac8e6683c6af4efa172c1b801d250486
+# SKIP-SINGLE 1e8074f5ea9e61a6fba33ab2af0c79b9af7d7a24
+# SKIP-SINGLE 9e79575486fb6aeb0deb23e17cb2ce9ec02b5fd7
+# SKIP-SINGLE 3be2a6b8b4098e5cf118d196e4cba37054d8292b
+# SKIP-SINGLE 0fd79ee039de664bc06b0dbcaee786f88a2b079c
+# SKIP-SINGLE de477ec683482a5dd27d791d7fdcfc4021ed3cb7
+# SKIP-SINGLE 8df7f89af672f0592b6a31be9d1687b1369692f6
+# SKIP-SINGLE 19206fd1e764cfe89234ae9245bafa88ef1ec354
+# SKIP-SINGLE 92ffe44834b8f77ee3f4d37edfdb19f30a376869
+# SKIP-SINGLE 5e5cde55e5be6e2d388252c3ccb0d019aee6b89e
+# SKIP-SINGLE f6339412eebdc027b00263ae2b5c38a029e2f7b4
+# SKIP-SINGLE 32d12840e666d1d07c92cc31f0b12965451f7726
+# SKIP-SINGLE 895215854db66ee8017e5ad5c3215eb089d33e07
+# SKIP-SINGLE 469fe6a040d6df612c00ea169670c6d8d7e58563
+# SKIP-SINGLE 9e131f55d8d5a1eeb44e7c5a3a5e56804be60dba
+# SKIP-SINGLE 73d6b19024db10b65ba368bd079223157d73e737
+# SKIP-SINGLE f25ad39983cc3e89b007390bc0fd860f48379497
+# SKIP-SINGLE e0ca8f791c2e4396f1e40d86c136ae547b40185d
+# SKIP-SINGLE fc520f8b7090fb95e61a498b5b23be6041475bd3
+# SKIP-SINGLE cea0d61a69ef443924fdd4e4c429d7103b4acb9a
+# SKIP-SINGLE dd0727e1ec1f535b9b06be88173b4d3ccd55abcb
+# SKIP-SINGLE 3e6c69de9d1ae99ebb71eb2ed04bdb9ee42cbb80
+# SKIP-SINGLE 34e3ad5ae449f4801af09d1df89d57350d0dc579
+# SKIP-SINGLE e726a00381e0f2d8dbfa52a10c82116a8352adf0
+# SKIP-SINGLE 32b9b22f66b1afcc614d5f76860d56d5630c5bc4
+# SKIP-SINGLE 0b43e7a49327ce32c67648eb898551002f135ef5
+# SKIP-SINGLE 81b589518c2e574b084907c7d7fb8e6e5049800b
+# SKIP-SINGLE ed77d1a8c0f005d4f158b635d39db0d5d79fe1ee
+# SKIP-SINGLE bc60ce7ffdf39fc3288938337e7f6c0706b37082
+# SKIP-SINGLE 35dbc79cc3233129da90ae2f4916d73e189b63cc
+# SKIP-SINGLE 41b1d223c6ab7bca1b626a4c07a4f2dda2855feb
+# SKIP-SINGLE bf79dad3f20345ddf095325ce22c0f2a3408d3ba
+# SKIP-SINGLE c4dab6c179a78ae17d02becf66a098bd72a12233
+# SKIP-SINGLE 4c7faf33776c6566fdb374ae2b54960fc70c3228
+# SKIP-SINGLE c469efbd8361cffff72fb6a4aeaeea40c5adf110
+# SKIP-SINGLE 9ea5a915bd1b9458af1587d63170888346e8baec
+# SKIP-SINGLE a516ab79c300517d5c3ab68c45ff9c90bda6c67a
+# SKIP-SINGLE d45e72fe5a9205b2e146d27e8e26233ee8518331
+# SKIP-SINGLE aa6a05c146e94c0afc35b5354d68da55aecb2db7
+# SKIP-SINGLE e2494bdaeea309c6b270dc09beba34da5f193573
+# SKIP-SINGLE dfc7338828a8db6cf177633f942efcb0d7930aaa
+# SKIP-SINGLE 6927841ecba6494858cc3af7c0500e6cd3c4923a
+# SKIP-SINGLE 105c7562dc38de31cda6dfed00a1c260a6e72ea2
+# SKIP-SINGLE 4844aaac199de9af8da0a62b5ae92b1f5a7abb2c
+# SKIP-SINGLE 7fa11be2fae2b9fa5981e01da05cb618859d77ca
+# SKIP-SINGLE 2f6b519eaeb3be4ee6a912b40a21686be12d4d88
+# SKIP-SINGLE 3f98188b864fb4f16a7c2878a96c880ec55452dd
+# SKIP-SINGLE 7ca865dc52a31374c68dc870246353db5acc023c
+# SKIP-SINGLE 5db380abad0482ae74aa71761f0da2b2351ce97a
+# SKIP-SINGLE d353c08d2bf25ea8e42ae4664c3a276d549937b5
+# SKIP-SINGLE 20ab7e07afef7a878565bac97f63bafe5f9d6e04
+# SKIP-SINGLE 35075267a67b6474416e0e413d0d60c1f5f5fc36
+# SKIP-SINGLE d633db5189f335873a03544f9f41dcaf77c8e31d
+# SKIP-SINGLE 88e1f8b02086aaf652e3058b36b7612c073c04b3
+# SKIP-SINGLE c8ea3f09e09b18b909f5a6c5434185b8dbf2fa63
+# SKIP-SINGLE ecdda194a82c8c52bdb948160f55ebbabe733d79
+# SKIP-SINGLE 4765487d5d24fc8a2a06c329dc9cc3bed9803391
+# SKIP-SINGLE d5499e3eb2765ddf212e3f21fed7b356b8f0ec76
+# SKIP-SINGLE c274bd5c52fd64c888b1c713060da881bf72caa7
+# SKIP-SINGLE d96db7b2e8c35ec2970d12c96e2328b684626f24
+# SKIP-SINGLE 935cc42795686710f82b8928b6802f20be8f27c0
+# SKIP-SINGLE 52d5771e0a803f57b8cdd7675bf15f2f9b946039
+# SKIP-SINGLE 9e1186a73279f9e6416cc594171482be5a223820
+# SKIP-SINGLE 905fabe5904c9588bf0c5d0ae15ca0ed354b3656
+# SKIP-SINGLE ba0264e19153281bcf264e99c01c130c701151e2
+# SKIP-SINGLE c1fa5bd8ee3c7f37a9b9304eab6b522cf8718472
+# SKIP-SINGLE 4290f64dc9948264b5d9bdad2330ee15aafe6589
+# SKIP-SINGLE 5a10e6377c2b97420e5617f114bb374d67ec1a58
+# SKIP-SINGLE 2a2b3f583430df8495b566a1dfb1f41c4d61292f
+# SKIP-SINGLE 58398dea254dcfdab58d5439061a513b48cfe895
+# SKIP-SINGLE 5acf75cec1c2cef383a7c022171f5a1d195c09ca
+# SKIP-SINGLE aab5d7b3f3bb6fb82924aaabdfdd6e2a79ad3141
+# SKIP-SINGLE b3023de5431fc308e2a6db61ed4fdd18db785324
+# SKIP-SINGLE 02ae85e8aa735b0d9a312f811d03204bf8fdbd51
+# SKIP-SINGLE d1f315751d960f003317713a65cc480b3d0ee726
+# SKIP-SINGLE 760107639be7657c4a209c9c04b17c79fc19f2c6
+# SKIP-SINGLE 8b7aaf3e56c63cae7e2affc249179e5022451595
+# SKIP-SINGLE 56fb536e78f3e3019b85995ba1d788065c3ac415
+# SKIP-SINGLE 02ef00d89c64d713f29f4ed12dbcae9f8d31bb9a
+# SKIP-SINGLE 6dc4e3b95ca9589f24530979cdc83ea346d1ca45
+# SKIP-SINGLE ec464789dfc5179c72e6929ea99a72f508c562b6
+# SKIP-SINGLE 5ed566cae08d4f39920bea81fd6bf2160f38348f
+# SKIP-SINGLE be0cf9e2995df4d0ff504561afdefba00b49438f
+# SKIP-SINGLE 8c153047e78e078b2001be9cf16ef3bbaa375a39
+# SKIP-SINGLE f14f6180b78656eec2f4dad5b79eb5da20bd0b70
+# SKIP-SINGLE 3f746d44decf9f991ee2a0a0529a2bba9ad12988
+# SKIP-SINGLE a0524584e93a66278dcf7bb998398f7484f9e8b5
+# SKIP-SINGLE b2a5bf142fb25094ff623dc93d2ce916aee3d971
+# SKIP-SINGLE 2f68673a712508f70de20f485422c7e01b8ab21b
+# SKIP-SINGLE 45694a25948146e860738cb4e01de7e7e9aa91b0
+# SKIP-SINGLE 91bc24c46768aab4a851c87edaea05c7476ff779
+# SKIP-SINGLE d2e0d1452b976a51579cf044257326850804c562
+# SKIP-SINGLE 3294ad44ebcd024b4ada68d00bedca33acc52de6
+# SKIP-SINGLE 3933ece030150908c9189c11cf683bb3df9e4e18
+# SKIP-SINGLE 7fa37d7a1439bf8cd76b336ea95d3a1982b3ae03
+# SKIP-SINGLE b257a7894b6b8536ee16e6b334207c8f5c887280
+# SKIP-SINGLE cdbb02a597298b7812b456fca3d61e223dc40b7c
+# SKIP-SINGLE 41c09d347feb94b9070a9aa2c78ccf65be7fd268
+# SKIP-SINGLE c7f141d67829ccef64a5e4e961f098f09774afe2
+# SKIP-SINGLE de0b7af169345442852622bb337483398c583a9e
+# SKIP-SINGLE 6fbea946bfd0119cf517211d058ea277c9209a87
+# SKIP-SINGLE cd479aa8bd498da4d7980a7fe7a37e238761482f
+# SKIP-SINGLE 36af7004e2bf0db1d9c2fd1312215a931c1db3df
+# SKIP-SINGLE 3fd58ad37e12845fab905c00e87ae1d49755504a
+# SKIP-SINGLE 58965d91e7fb5a26a5422357f44d6e841f67db74
+# SKIP-SINGLE c50718dcfa54293b695f8a3fa5cd4d77848ee084
+# SKIP-SINGLE 5276519255c27e7dd01cbc3fea00d1c29f44d514
+# SKIP-SINGLE d9bd334ef367f3e16967ae2ed714ff419f2b5328
+# SKIP-SINGLE 3d6af11c42453065d5ace1223fe99228b7927318
+# SKIP-SINGLE b7f227ed8bece1a8fafd36ce5f0ee0d5913b6f8b
+# SKIP-SINGLE ee93a06b8b1922b31e12cfe60566779f185ddeba
+# SKIP-SINGLE db03eda6369a9d4af3c72a8ab6ec29e3cc58acc4
+# SKIP-SINGLE cdaa3b51f1500ca1d91452037efe68fa0f7808bc
+# SKIP-SINGLE c6029ed34ea83c7c0adbd723d63bd78ff0ec0796
+# SKIP-SINGLE 77882158b2aeff7f235c409d6572173ae4c3a38f
+# SKIP-SINGLE 67a218d33926931b20096edce3eaba2958283bde
+# SKIP-SINGLE d3c4833d1350e26a2ae35e00eaf2d6bef1724679
+# SKIP-SINGLE 2bab0f2db6fff3a99d3bc498d6139ee42aab96ea
+# SKIP-SINGLE 4313c695cd6370667ccf086cef0d9201fdf796ca
+# SKIP-SINGLE a25cd7f68aa5babb7cc9002d89ff02077937927b
+# SKIP-SINGLE cd41ce8c6c107901a499bf55dd2b0383befd37af
+# SKIP-SINGLE 280b8c96ccaeb95548adda78466ef2b1c3cf4546
+# SKIP-SINGLE 57a978fd74454392a041ac65a5abba8d012b88cc
+# SKIP-SINGLE fc53961c1df8bee07b6a1d461d31f449b66f1d65
+# SKIP-SINGLE 350e97d78e7803650c6dd2bf46fcfece8e2b4b32
+# SKIP-SINGLE 304e2a3a05feee6578aadfa0228dde734fe850cf
+# SKIP-SINGLE 874e2525035d45efa6fa374a2ebec3740ecc1457
+# SKIP-SINGLE e2df22fa016247dccc632b2cb4fc5b8ffb4c3c7c
+# SKIP-SINGLE 0069085be2d0e6c7d439372b06b866df4c669891
+# SKIP-SINGLE 72278f21e0ef0c79f756bca08577297d11e22518
+# SKIP-SINGLE 616da8fa8efa9023f56fa731072d877e2150afbc
+# SKIP-SINGLE 51f8e86374a57efe5b8e5c31d96078e63c023da4
+# SKIP-SINGLE a29a3ad55d650af6230e2cfe8ef1ef45b5feb133
+# SKIP-SINGLE 7a9f8ed6fba0d6728cbf185696bdc1a95b1acfea
+# SKIP-SINGLE 7f298bab5234073b1565a7008f63b89979a925d4
+# SKIP-SINGLE ad1baff0a12cb22c5c515e0ba3ed29d4b876451b
+# SKIP-SINGLE fe82c0743b3feecb9b80549ef4bb3dc8529891a8
+# SKIP-SINGLE 89c589bae47fa7faa7273a9df0f4be836e9da29b
+# SKIP-SINGLE 6d8638e5e494fb0ceafffe19bbf349fff643e12d
+# SKIP-SINGLE e89532c7c7c5098a77f3ec6fb5def98b1f9034a2
+# SKIP-SINGLE 15a9e73a1793a61b87d3f460e2e4bc5b7df1e6a8
+# SKIP-SINGLE 4e091c8ddf6bf421a4dd0210a3a4b77a3ecf24f5
+# SKIP-SINGLE e2b774e64a903e856356971c0fc3a3835d3883c1
+# SKIP-SINGLE 82b602dc2f52775a4082d24d64380867da051350
+# SKIP-SINGLE 8ae173a8373c12f17acc9d7b22910cd106c12b4b
+# SKIP-SINGLE cfb295f1e55e4d04beaad5d57ede494c436cf277
+# SKIP-SINGLE 9a9634dc725278a6a676fa4590f53543cada34b2
+# SKIP-SINGLE fdbe3362c5a72be7d4c930a614fe5853bf6eff1f
+# SKIP-SINGLE 72c7ee2e525d87b58a28aea8af8cef31f607d7c0
+# SKIP-SINGLE 85f1ad0c798b5556c37185f4930929d5aa386a5e
+# SKIP-SINGLE e1553142fefaf39d4742d1a161de2bce691204b2
+# SKIP-SINGLE 39aa623479128b465b01490845f0781c03eece8d
+# SKIP-SINGLE 286e308561d00a31e0321919ef36d9bc6dadbeb3
+# SKIP-SINGLE 8af91dee9a9031ac0d49848b16bd288685f1f370
+# SKIP-SINGLE 8783700b23e70874c4996908bf02c010ae6f3fe1
+# SKIP-SINGLE 344b48f490416cb1200e19b28d356e7fb5b04387
+# SKIP-SINGLE 409327ff68f9ccdc8099f6a2ba2fee76abaaab70
+# SKIP-SINGLE f25f4699d760c5409a1571dcfdf4ed0fdac9e0ec
+# SKIP-SINGLE 5cceb6d6acf6299f1347133aec7097b8771ff952
+# SKIP-SINGLE f5f296b0800de4cd459e41b4a7b1cb97673e8dbb
+# SKIP-SINGLE 9aef9e2cb6b547f62911d06e90081af32134de66
+# SKIP-SINGLE 43e9c8e9d28dcb659a43e58778e2745d1279051f
+# SKIP-SINGLE fbf2bfba0770b7f575d8ef06ca3a08cf1a38cc2d
+# SKIP-SINGLE 7ca456da7f72feeeec571ece3c373e2b3a3d327b
+# SKIP-SINGLE 0e7361a5ccce084613d54d6ba3954ffca6074817
+# SKIP-SINGLE 2a9797b422fe8a28bfaab49974ea2be21ae2502e
+# SKIP-SINGLE 5d73bc5c69f56ce1b22c950d19ef6406b662949f
+# SKIP-SINGLE 16986a9cc42ef4de580456f4acc5feba682ac8b1
+# SKIP-SINGLE 2d2cdb4741a3c1e42c8ed771303a878fd428911b
+# SKIP-SINGLE 4725c123f33eb9579b695748fa9f85c9af3eb01a
+# SKIP-SINGLE 0c7024d0d9172322052de2ee571ba64afff905f0
+# SKIP-SINGLE 20d44771201ef96fcfd6aebffe05aa50c5fa8074
+# SKIP-SINGLE 7a551e92005dc9964c1a74a2896b5dbf0ca231b9
+# SKIP-SINGLE c681f374788235cbaf1dca062450202e90fd2a86
+# SKIP-SINGLE b92a5174939fba17ffb5235dd926c7063c13b1d1
+# SKIP-SINGLE 6cabef8799eb053c593f0a5241503ccbfb616c8a
+# SKIP-SINGLE 3e5856b21a83a52dda8c0b3ab541d106d809d625
+# SKIP-SINGLE 86581698acc1a0991592e018c1ba749f3ded21be
+# SKIP-SINGLE baa39e48495e100af6704af9287b544e612c245a
+# SKIP-SINGLE 9c67e8e56d40926454e00b5652c2b519ae0b507b
+# SKIP-SINGLE e961a31507e6fba86a5d45fec7fa616e80028882
+# SKIP-SINGLE 65456668ab1048fe8d77dc76a9e4d84481c218a5
+# SKIP-SINGLE c96157c8f8290bc2049dc947b6d264564659a545
+# SKIP-SINGLE a7ed5071b70f07da4c99198126c48cc6b448090a
+# SKIP-SINGLE 1e624452004e17bec2070b0c0b9f5639f66df1f8
+# SKIP-SINGLE 3f25b22cadc9f73583e83b00f828ee00efa8764e
+# SKIP-SINGLE 938e68bb280c96eaf163bd932ab2582fbe27e780
+# SKIP-SINGLE 3069849bd4c1048a8f8c0467d26560fad939e791
+# SKIP-SINGLE d45253996670509e668d266d577f48deb9c7018f
+# SKIP-SINGLE 43f25120c9a2578df3df47491ed68a0566ff6f61
+# SKIP-SINGLE 9d266f2a6c0e51f184d55c8bba4551abdeca02bc
+# SKIP-SINGLE 76eb88df0243dd15492e71f068fd476be8efc800
+# SKIP-SINGLE 32870d2f207536bb7932beeb2e0ec9a4e0146560
+# SKIP-SINGLE 625ea08652053617034bf8ceee0d6cfae34f2dcc
+# SKIP-SINGLE 657947dc7cf01a13a4fa260691a6fa0147107950
+# SKIP-SINGLE 4fa13b2d838e11cbe3b713f3172721cb61d499f3
+# SKIP-SINGLE f17ca55a0a3c9de1061285763cbf0bd3754f6718
+# SKIP-SINGLE 4c5f1737c4815bd6d167108343a61da9a3882f32
+# SKIP-SINGLE ac9bc819bc438f21bd38a995812d756727ed8e2a
+# SKIP-SINGLE 7d7e9ef46a1b310fb3f481cdf8023082f5ec1618
+# SKIP-SINGLE d6362b632e3c76cb55a05248aa221e426c5adb5a
+# SKIP-SINGLE 00df4566af9dff0a27fd6da566ef1e53268a6d47
+# SKIP-SINGLE 655957087c8654577e7c59004f16be7abcc2c46c
+# SKIP-SINGLE e41af3971de8f71b5241698a8b29349905f1a969
+# SKIP-SINGLE 59eaa30b07e9a79a9b2bb6ade0be9aac846384e2
+# SKIP-SINGLE 5d77eb4b7c00d0652b190166c393efa16d0775a9
+# SKIP-SINGLE c6384e9bfbc765229ea9676ba1044b9db28fec2d
+# SKIP-SINGLE 409f0430b6a0c138836e5067141bf6b2a7beb6b3
+# SKIP-SINGLE 2f03053e568f38a1dce5ffe02ad1359069ef84c8
+# SKIP-SINGLE d5c6d69b4fea2d5a1167a0bcc0b9994a5939b97e
+# SKIP-SINGLE 28490cd65ba50ce4e1f411556e1faa36f1db84ec
+# SKIP-SINGLE d06127e5736b0564daf99a41c77c8c23d394e759
+# SKIP-SINGLE b440fa0a6b48a95323fa922b88e9a9a73d6c6360
+# SKIP-SINGLE 62e37ecc4020b3a5b18cfdcff9a7cb259fd8145a
+# SKIP-SINGLE ddbc33343cca8c66d841cc16eac77ea626e50e23
+# SKIP-SINGLE 902649a170ab651cffe2bbb421e1331b23c7ed01
+# SKIP-SINGLE 7bc615fd23c1304f8682f2443db235fbc37bfde9
+# SKIP-SINGLE 7f57d80846b5f674c49a717d6fc086c14f506415
+# SKIP-SINGLE 639821d49ab9497908d8d3bcd472aed558c251e1
+# SKIP-SINGLE 75b65b3f67eb9a4e5722780cb915b880e667d674
+# SKIP-SINGLE 306e49285a04c02f0a575a7d7b2f82eeb032c86b
+# SKIP-SINGLE d1ef0243eb6e7cd9720236eb0e900fe7163b3c2b
+# SKIP-SINGLE 162c3da7a0ae4cb5e1b0e34731621ec13ac01e43
+# SKIP-SINGLE ab70ab19be64902123b0e2c08191d5ebf70feb62
+# SKIP-SINGLE 8175497ccac1b3afc2208260be91423e2bca2d25
+# SKIP-SINGLE 63f8a838eccf201d6290d0dc8f83881f41785afb
+# SKIP-SINGLE e0760599b045a7ef3828ae4b624246b6beec2e75
+# SKIP-SINGLE 34e50dc4a23505dce0499f120477e2e1a1327432
+# SKIP-SINGLE 06db8015ea05cc17efb16684de23533ee315be61
+# SKIP-SINGLE ecb216fd93dc959bda283d27d759b253ee0e2798
+# SKIP-SINGLE 0d195584f20bba1c1de165fbc4162417737755c4
+# SKIP-SINGLE 829c7e3566ed425c0204067c654a58970af6d4fe
+# SKIP-SINGLE 7e9c2e295283b4dcf4f88cf25a094e37731543fc
+# SKIP-SINGLE 3a0c94ac0b5d5098f9140c5ab4231d6dd06ec393
+# SKIP-SINGLE 3a5c4bdc0c079f72bad98e01f70343ba9e9b0043
+# SKIP-SINGLE 908aab6144bf9f62dd5b2c2f1776ed177fa6d18f
+# SKIP-SINGLE c78dc25a5351b1a4191028ba252c892ae1dd2438
+# SKIP-SINGLE 67f9705fc0fc5ecc91172ab02df8c1f31fe654e2
+# SKIP-SINGLE 25c6bc7a3d3679b26406bbcac33954186db491f2
+# SKIP-SINGLE faf44e2c61734cfe2422498ed27b4f645635120d
+# SKIP-SINGLE e333f040e9f68bdce2b5735b4b9dd68944199056
+# SKIP-SINGLE 5cd3db73bed06e394ea8e7b0e332b1b1e5bd9571
+# SKIP-SINGLE 4489450f37deafb013b1f0fc00c89f0973fda14a
+# SKIP-SINGLE 98ed6db34f76cfe37d70d8ad82d29fcfa2a56e24
+# SKIP-SINGLE 2ec403f777adf39d3e972667513086f2053530dd
+# SKIP-SINGLE c5e3b99467dd07522f9522cc77cddbaa69222a7b
+# SKIP-SINGLE ab4edbf60eca767775e18d8d0e318c28a74792b3
+# SKIP-SINGLE a5a047a07f2d4f98fc67b40eb1f1a1d711905381
+# SKIP-SINGLE f5084ed197cfea8387ffa7dd72b72933905fe699
+# SKIP-SINGLE e06953b02a0e7b26b33c511a22896d0db4e5d63d
+# SKIP-SINGLE 77cb95c851edc338c94cb35effdc8c9ffc64a461
+# SKIP-SINGLE eecc2d45b94513ba95789dfe0ef58aeb8b029049
+# SKIP-SINGLE 663d768d44be150439a58cd858615cac3c1f572f
+# SKIP-SINGLE 838fc77254286de318b65602b31c6d3915594a8e
+# SKIP-SINGLE a7042fa051c69b8c647fce3ec52b74974b5ea2be
+# SKIP-SINGLE 2332c3eb55b2c8541ea83d4a847c56f888239f6a
+# SKIP-SINGLE 077c66405261381704da33e6858f4b6639763f5a
+# SKIP-SINGLE 2b4d46f99be3735823666c2a6d9f058cedeb031c
+# SKIP-SINGLE 5858921f409f6ee9d2e08dbdcd1719969a4f5544
+# SKIP-SINGLE 29418f954eb114bf3c108b6e03569036f854ae45
+# SKIP-SINGLE 07292b1344549a164eff9d548f819235a14a0b4e
+# SKIP-SINGLE 1bed1f0b8e9095d66f905ed7b409a397f1972262
+# SKIP-SINGLE 98f5b74808a54ad9093888b72b2c04e085f4b369
+# SKIP-SINGLE 1ae314dfda1a7746fb31957ac3eedefd70b3c1fe
+# SKIP-SINGLE 488a6efe323927a4064afc193b66cd11e2caf77c
+# SKIP-SINGLE 9fbbb2355298f75e8fd09b35306e843ce45b9e25
+# SKIP-SINGLE 076a25810127cb8c56ff0f5272a3d8b98192ee77
+# SKIP-SINGLE f847ecc40bc768d97ba57083fd669ca0104e500f
+# SKIP-SINGLE b471f7f6141b3db8fb00f62f12900846f59beb9a
+# SKIP-SINGLE 5fbb7a126d19b41848b57e7e012619fa13cfa4d2
+# SKIP-SINGLE d4e8c90b66b4aba66ff1a12a0894a33af91feb0e
+# SKIP-SINGLE 243ee7b244797aae460b9e2a7224f75599f3a9b8
+# SKIP-SINGLE 951dd2a4d98aafe88bf2c6c2f86901230e3f0cd2
+# SKIP-SINGLE c924b6afb6810d6b9585092fc5693e3c9efcd1cf
+# SKIP-SINGLE ce9e7204138261f71d0e1636036727d8b05ac81e
+# SKIP-SINGLE e0e3299c01d3ad7236a7a950f43f54a1bff548d8
+# SKIP-SINGLE 784f53a2152181b687f9543ddba9c393dda1c715
+# SKIP-SINGLE 673a55780d2194f74c5774de83d0dce5131e7a31
+# SKIP-SINGLE 8ad4c4009e1c7360df6f59175b1a701d7f4ecfae
+# SKIP-SINGLE d9d66764e2a02db9f19f5c76ce34ac7d8bc1edc6
+# SKIP-SINGLE f6dc55f516a88765bbd8b8c34f0ec663b8948373
+# SKIP-SINGLE b86deb617b109bcb40e9c95b10a033a209c1d8fd
+# SKIP-SINGLE c5f24f76eb1653d64c2ae90764e395cf6e050657
+# SKIP-SINGLE b028d4f7dfbd72790679423a8dcce9994b07834d
+# SKIP-SINGLE e3663d0e9c6ec32a70226947767850924b90bba7
+# SKIP-SINGLE f9f9b43df5bdadb54a1ba14e1624aa254d9f092d
+# SKIP-SINGLE 5416ae5990337f5fb2b3e0fbf9c4575508da808e
+# SKIP-SINGLE 99096528494a653d1ee9d7832ee3956a613aeb95
+# SKIP-SINGLE 6b91ea5a6159791d1d1e5006f8cbc384c0da1701
+# SKIP-SINGLE bd8e19e1e2ccfb76c1fccc4dff1f8774185cfea4
+# SKIP-SINGLE 88d54756d46101b97b7fde97b4bc3b62f7bd6c06
+# SKIP-SINGLE 32e87f09c8c2711c421363d0361693dcfbe5a688
+# SKIP-SINGLE 69ab588bb54178df0d3be6b4c04dabb49f5a2ac9
+# SKIP-SINGLE f331be1f074d68e7e5cdbac324419e07c186492a
+# SKIP-SINGLE 040991a4697b50ebcb54e498e7de54b8d0885101
+# SKIP-SINGLE 5070278539a8e47988cd9529c9c2e4ada8c92472
+# SKIP-SINGLE 0be9a639fca70c278d1b79fcea5d6beebdf7799c
+# SKIP-SINGLE 31f75430999b9021fc68739af231261608aac255
+# SKIP-SINGLE 77f1533ccbba1a5dc0824770046696181a2b7b6c
+# SKIP-SINGLE 57e37e9128b4f6f9a2aae0bc25de6c208d58e5d0
+# SKIP-SINGLE c6dce90d7e57486db687606bffd92d580a7d25ca
+# SKIP-SINGLE c88a1631e3f76926bf0fed49fa1b704d6eaf2155
+# SKIP-SINGLE 8607f018fd8bef7443415ff2e356d035843ad828
+# SKIP-SINGLE 1cd42bfb8a5ff2aade43f31b864a8d2cd643d5a3
+# SKIP-SINGLE f0e9085a17be8866c123b120e3252c52845ec38e
+# SKIP-SINGLE 9d3f8912b431ed5540d9d06d85b7e338732268c9
+# SKIP-SINGLE c8909fa3688aca164e4fd38f6293c4a201e148eb
+# SKIP-SINGLE 10f96a8c57b031b521ae8ba5a02413b94ece423b
+# SKIP-SINGLE c2ecb08775dc24618de507d2d1ce0f9b0debe17e
+# SKIP-SINGLE cb183f6467401fb5ed2b7fc98ca75be9d943cbe3
+# SKIP-SINGLE 76b86d98534da2c9e6cf8fd1c7edcbe53d84eb82
+# SKIP-SINGLE 85073998cb47567cb30fb41f12135bd799ad2588
+# SKIP-SINGLE f1e058d46b5a83ddd0423a3616aa50ac3ec7f551
+# SKIP-SINGLE f46eb3d3ca759ab3944cedda1339a6d1760298cd
+# SKIP-SINGLE 9fab83ed7a90209e3873039e7ae4993c667e2759
+# SKIP-SINGLE c957832cbf3e87e5a25f7c2bdb70abd959391d98
+# SKIP-SINGLE e5043db2f1f3d0ce6618eb45419e85f0d58fbf19
+# SKIP-SINGLE e8df6c311fcf59bf23d31b9db2bb8fec9d78fbe7
+# SKIP-SINGLE da87895df2d6b21468b187f5a4e2ca8710e35ee7
+# SKIP-SINGLE 6203b9db347d2d002c0cb660d5b4daeea54bf3ad
+# SKIP-SINGLE f6e92035a7c3c29aa980e1bebf9c48f1bb7264d8
+# SKIP-SINGLE 7ebbd4efc3d45403cf845d35c36c21756baeeba8
+# SKIP-SINGLE b584569014abb1fe9f59decd86ea097a189d9bb5
+# SKIP-SINGLE 17422c2cfcbf1670ba4dbe3ecdf3c5ff719201cc
+# SKIP-SINGLE 2349ecb3216bb9f7808ac58e5ce6abd6bcf90387
+# SKIP-SINGLE 6fb6cb075f05629a562275064851bef6b72d5dd2
+# SKIP-SINGLE 6a2399c55e9505be06cb98ffbe1a3878f9e96fb2
+# SKIP-SINGLE 4ba76224eaf5fade94438bf990bf5eb05912b530
+# SKIP-SINGLE 77e6a704ac819580b81400ff1d8503d142cb3905
+# SKIP-SINGLE 524d10c86b539ef6fe27f31ed3df2590d1849a83
+# SKIP-SINGLE baacad1771e3551ffdb1b88c41224fa1957e766c
+# SKIP-SINGLE 9ed53535f5543910f746662618927052dd718991
+# SKIP-SINGLE f6483526cd4b4b9ed7d830599add82ecb45009e6
+# SKIP-SINGLE c4122067d90857594508f6c00e8af87d91ddb7d4
+# SKIP-SINGLE 1bb7b43e1cfb911737bc4807671910238277470f
+# SKIP-SINGLE 5532ae81cff138a2f6d30c3541210311a4894ac1
+# SKIP-SINGLE ccd2509ed31f953408240357e9b84c3d3b3f6a2b
+# SKIP-SINGLE bc66ff98756fa28bbc733ef81103cac6730438fa
+# SKIP-SINGLE 9b5ecffeb00f22ca6663aa14e7807c9886ed1716
+# SKIP-SINGLE bb8376145abadd901b0d8f7f586bef658e2b333c
+# SKIP-SINGLE 092776c7ebf20b4d1208a0e0d860a1f3abd7d119
+# SKIP-SINGLE 434fc2a22e4fd65fd63018e9373cbf56b51f8ab2
+# SKIP-SINGLE 591759d508024a666a863cf918287744e72b1267
+# SKIP-SINGLE 75c8cc5eab51d1080424687167fec4feb34f68c1
+# SKIP-SINGLE f6e3de3f63616d7bd52c1390f9dea70fa33e49c2
+# SKIP-SINGLE bb8a46e559ec39437a1524b3e9746746768effcc
+# SKIP-SINGLE 52c8fdde1667ac4b5d7f2af5eff94d6512d83caa
+# SKIP-SINGLE 8bc6e31502244ca16bbf7b163a7a321ec9094882
+# SKIP-SINGLE 3a4406975338eb6dad9327b5d17f67a677114e6a
+# SKIP-SINGLE 02f78c09b0a97ba044a43682a366a9d7732b885d
+# SKIP-SINGLE 954b6e1dc3edb6a8260be810c3f02c335e90b6b8
+# SKIP-SINGLE 79ee266f13fa5c657b24dc45d5f573c393a671b6
+# SKIP-SINGLE c4179117afd37a03a7ba322e66b5bd6bae5637bd
+# SKIP-SINGLE 45b8204e09b7d399b792bb26c799efe48835c4a7
+# SKIP-SINGLE 2a762336da4d886a4f1b3ee463fd66393d739309
+# SKIP-SINGLE e45d8dbeea488ac14fe486e5582266980d29e82c
+# SKIP-SINGLE 253126bf339a16589e86acd51c0f96da07e658d9
+# SKIP-SINGLE e868955bff3b97bad88bd09b4401e87cab94011c
+# SKIP-SINGLE 6e60d464188994bdce97f1aef3b81fae3fd28583
+# SKIP-SINGLE 5868580e94ed93ce4f0ec88b03b232f5cd29178d
+# SKIP-SINGLE 18947103fabf8070738b3bd9c5a8d02f90988a3d
+# SKIP-SINGLE 3114eb807864e19cd8ffdc5d8f8e11366a619769
+# SKIP-SINGLE c352392420236d4fa7a8ac7f324f1a0358ad3584
+# SKIP-SINGLE a915d836fce238cd57233f67e8d2451a26d2fb6b
+# SKIP-SINGLE 5c1b9e65b9d1c73ccc4ce18842d10bc507cdee38
+# SKIP-SINGLE 57b904f4bab7aea7ddb9d3b36229008a47b32ff1
+# SKIP-SINGLE 2f6b017e3dc646d317b56fb453c90aaa44c27089
+# SKIP-SINGLE fa9bede36c18d063f6f599e102cd42f9d0afc071
+# SKIP-SINGLE 0c7a7df98e1fb0bc156707b379e4147fac97359a
+# SKIP-SINGLE 0480e9c445d59fd5ec9b38ebe3919fee2aabf8d2
+# SKIP-SINGLE 5a2c1a743b54f7d3355f9b1dc893bbe72e8df6bc
+# SKIP-SINGLE 629f222ba2abf5a149c381e27c89e88963f7466d
+# SKIP-SINGLE ef6e18a6b9ab103f3f076b35100d09cff1687396
+# SKIP-SINGLE 9e339415b4c068242e7cd785d2ac95420f1934ba
+# SKIP-SINGLE 8c385f05120bdf905a027fe99eab23a59d0f837e
+# SKIP-SINGLE c4ad36cd2daab764649db451c4a3f1a35c5f519a
+# SKIP-SINGLE b755f45f65090665dd40ed0f0dc4eb6f9e4923a0
+# SKIP-SINGLE 1ea503ed4b3a14b3dc0a597cfbfe57d73b871422
+# SKIP-SINGLE eba65824364474bde89bdce5f57a772d74a2c409
+# SKIP-SINGLE 17b65f52921b6a9314a2709f0e5c3ef88b37f2ab
+# SKIP-SINGLE 170924e945f4cceda12b5e1681391c3b828a3dec
+# SKIP-SINGLE cea1e95d386270e1e682719232f2cfad384fab91
+# SKIP-SINGLE b341864d9002fd081a8a6dfeb5a5a00373738a2f
+# SKIP-SINGLE 6cf2a9c55dbf8dfbc93409340065cf02881502b1
+# SKIP-SINGLE 50e33639fe190f0a1c47b8e4c0fcc4735cb60909
+# SKIP-SINGLE af288d813b3c31a528ddcbdce08f497855a56e94
+# SKIP-SINGLE 007d8c485906be46d40e74ddb8046e065c722786
+# SKIP-SINGLE 08a1c32d0bcaa9369a34e7f7d6d01c3885f62e21
+# SKIP-SINGLE ceb9591e5dcb5264573371a573433fd76320954e
+# SKIP-SINGLE 1787e651d376486909e736478b1be92c949a368d
+# SKIP-SINGLE 734df28368c7f7c21b1068a67d4ae89e64d4a3d3
+# SKIP-SINGLE c5147882a91e51b59c7da035e9ef38a4731b943d
+# SKIP-SINGLE 6b475da972d7e2ff7a2a3cafc1aea2a4937e64e9
+# SKIP-SINGLE 7e36fd64d2ce06b821e0f57f6d850ff4386608bf
+# SKIP-SINGLE c120b0ebdb20cfff73dd1d43541f1ba1bbc54b74
+# SKIP-SINGLE 0b3f785c4a272b909108108cf7931779ae48cfba
+# SKIP-SINGLE f071e61d106e6f3c17b660e3aa1a5b7890ea5d41
+# SKIP-SINGLE 6a3caeab580f61f88c4ad49ff32cdf74eea4fb97
+# SKIP-SINGLE 06b5ec4bbde119d14d866fc3713a4ed390d531f2
+# SKIP-SINGLE 795e01ac248d389a581589b13a02465a2f99202f
+# SKIP-SINGLE aaaa4ca77e440499ec852069efaea42410ebe30b
+# SKIP-SINGLE 6f28810f6ba112059c09bc3bfbb2ef8e5c3f15ee
+# SKIP-SINGLE 773cce640fc5d67cb1a64622defa073d7ec5fcc4
+# SKIP-SINGLE 260e47e9a3c9b3baecef81e69c218989dc0cd7a4
+# SKIP-SINGLE e504eabe88727141e70ae9793be71d4285f839a5
+# SKIP-SINGLE eeeae5e9ee34da5539046ff8dac4f4fffa19a5b9
+# SKIP-SINGLE 861e1fb595eb1f01ca5c137fb4830695f9c1e7d2
+# SKIP-SINGLE 7c5d4348330b206aff1f8e5bc4fd241d6a6dc0b5
+# SKIP-SINGLE 1575ee2eeb1ebb5b73b4b76fc7dc7f5702748540
+# SKIP-SINGLE ce5ae0117e3ea009ccdd8d8f4c1365301d24f90b
+# SKIP-SINGLE 851a8f65e9a6b00b51f6a41f4c8f2ec2a797862b
+# SKIP-SINGLE 5159789e55d64c7482dff3dc1a621d01f530f83c
+# SKIP-SINGLE 25cb49ad565c764c390a411661088970db1f2b22
+# SKIP-SINGLE 9c4dddad456e23892a80303da26774a13250b647
+# SKIP-SINGLE 4c328daf0130fc139e827a8a8d6689e2b15c73ea
+# SKIP-SINGLE 1ee7c3041ac84b6c6f3f4f5275c417d91727312e
+# SKIP-SINGLE c9df4cace0f88197e69ae45d18bfc1692eecca05
+# SKIP-SINGLE b49250ada978c7b21cb93177c874c81a27fa4fec
+# SKIP-SINGLE 377ee8158b2fab3efccb4e9b262e6129b51e28f8
+# SKIP-SINGLE bd13ce184bfaf43f905faff64c5306ff3518f892
+# SKIP-SINGLE 914f68da059d5aeed3459e3944769aa4370a4075
+# SKIP-SINGLE e7b09065dae0aa8018c959ad3c69626bbcce8f17
+# SKIP-SINGLE 9f7c359f4023570616c9961487069ba1122a5bb0
+# SKIP-SINGLE a3651d3237e91f788211e507d61c2dcf886c185f
+# SKIP-SINGLE 62c8c8e51a23540cd189d6b2a22dd1a1cdbbf2cb
+# SKIP-SINGLE 7a4380b9051ddd0bcc4d5c90abe0f826a9b922dc
+# SKIP-SINGLE 23bb724c922de95573f73b22ae311696ae08464e
+# SKIP-SINGLE ddae8d4a13d58720a3118355fabc225a9d907160
+# SKIP-SINGLE a31538ea5b006c3901ab85354725993b689a259d
+# SKIP-SINGLE 1cdb24fe35a9ff2e4f92c5acc93a5a5b0e70d93f
+# SKIP-SINGLE 7c750343be6309a78d3fd289959bca241d9daf5d
+# SKIP-SINGLE bde8e87cb7b3be0e0bc9e72c3634f108570cac3e
+# SKIP-SINGLE 013c7d6aaef5f90730b1cfe42a01534d891e895a
+# SKIP-SINGLE 85d0c11119fbd14d508d228f5edf4cf53fb4e4cb
+# SKIP-SINGLE 53584db07ed3411d659678425c4481997e56c834
+# SKIP-SINGLE bb0a427e9d3c29c17c1b03773697989328f53056
+# SKIP-SINGLE 4ef50ccd3f8bc177ef6dd7183a9268bb8057f064
+# SKIP-SINGLE 285f8c7cfecee0c91568cd850139c48ec3f21a28
+# SKIP-SINGLE 96d44c4321724556819e2f718f1d94470d753d07
+# SKIP-SINGLE 1f74e9112e28faa57a7bf56547a9ebf8f6618273
+# SKIP-SINGLE 3a784d1321487be4031555d19ace635598bba21c
+# SKIP-SINGLE 4552b01d8c8052f607dca2fcddcf7b2e270f1db6
+# SKIP-SINGLE b6568c1389128d47538b646d940427949ddf58d0
+# SKIP-SINGLE 6d5b34d9de7b2f1b346d9aff123ad20c942166dc
diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt
index d881b81612..45da3ed6be 100644
--- a/admin/make-tarball.txt
+++ b/admin/make-tarball.txt
@@ -150,6 +150,12 @@ General steps (for each step, check for possible errors):
 4.    autoreconf -i -I m4 --force
       make bootstrap
 
+      ./admin/check-man-pages
+
+    The above script checks for any mistakes in the source text of
+    manual pages.  Fix any errors and re-run the script to verify.
+    Then do this:
+
       make -C etc/refcards
       make -C etc/refcards clean
 
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index d3c5520ad0..99f834b0ae 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -33,13 +33,14 @@ GNULIB_MODULES='
   crypto/md5 crypto/md5-buffer
   crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer
   d-type diffseq double-slash-root dtoastr dtotimespec dup2
-  environ execinfo explicit_bzero faccessat
+  environ execinfo faccessat
   fchmodat fcntl fcntl-h fdopendir file-has-acl
   filemode filename filevercmp flexmember fpieee
   free-posix fstatat fsusage fsync futimens
   getloadavg getopt-gnu getrandom gettime gettimeofday gitlog-to-changelog
   ieee754-h ignore-value intprops largefile libgmp lstat
-  manywarnings memmem-simple mempcpy memrchr minmax mkostemp mktime
+  manywarnings memmem-simple mempcpy memrchr memset_explicit
+  minmax mkostemp mktime
   nanosleep nproc nstrftime
   pathmax pipe2 pselect pthread_sigmask
   qcopy-acl readlink readlinkat regex
diff --git a/admin/notes/git-workflow b/admin/notes/git-workflow
index 265a106bad..d33f49a1ac 100644
--- a/admin/notes/git-workflow
+++ b/admin/notes/git-workflow
@@ -16,14 +16,14 @@ Initial setup
 
 Then we want to clone the repository.  We normally want to have both
 the current master and (if there is one) the active release branch
-(eg emacs-28).
+(eg emacs-29).
 
 mkdir ~/emacs
 cd ~/emacs
 git clone <membername>@git.sv.gnu.org:/srv/git/emacs.git master
 cd master
 git config push.default current
-git worktree add ../emacs-28 emacs-28
+git worktree add ../emacs-29 emacs-29
 
 You now have both branches conveniently accessible, and you can do
 "git pull" in them once in a while to keep updated.
@@ -67,7 +67,7 @@ which will look like
 
 commit 958b768a6534ae6e77a8547a56fc31b46b63710b
 
-cd ~/emacs/emacs-28
+cd ~/emacs/emacs-29
 git cherry-pick -xe 958b768a6534ae6e77a8547a56fc31b46b63710b
 
 and add "Backport:" to the commit string.  Then
@@ -109,7 +109,7 @@ up-to-date by doing a pull.  Then start Emacs with
   emacs -l admin/gitmerge.el -f gitmerge
 
 You'll be asked for the branch to merge, which will default to
-(eg) 'origin/emacs-28', which you should accept.  Merging a local tracking
+(eg) 'origin/emacs-29', which you should accept.  Merging a local tracking
 branch is discouraged, since it might not be up-to-date, or worse,
 contain commits from you which are not yet pushed upstream.
 
diff --git a/admin/notes/repo b/admin/notes/repo
index 97f02ab605..2be707db27 100644
--- a/admin/notes/repo
+++ b/admin/notes/repo
@@ -129,8 +129,12 @@ This is a semi-automated way to find the revision that 
introduced a bug.
 Browse 'git help bisect' for technical instructions.
 
 It is recommended to start a bisection with the admin/git-bisect-start
-script.  This script prunes the branches that are the result of
-merging external trees into the Emacs repository.
+script.  Using that script ensures that commits in branches that are
+the result of merging external trees into the Emacs repository, as
+well as certain commits on which Emacs fails to build, are skipped
+during the bisection process.  That script can also be executed
+automatically when 'git bisect start' is called, with the help of a
+wrapper script that is included in its commentary section.
 
 * Maintaining ChangeLog history
 
diff --git a/admin/notes/tree-sitter/build-module/batch.sh 
b/admin/notes/tree-sitter/build-module/batch.sh
index deed18978a..58272c7454 100755
--- a/admin/notes/tree-sitter/build-module/batch.sh
+++ b/admin/notes/tree-sitter/build-module/batch.sh
@@ -1,17 +1,24 @@
 #!/bin/bash
 
 languages=(
+    'bash'
     'c'
+    'cmake'
     'cpp'
     'css'
     'c-sharp'
+    'dockerfile'
     'go'
+    'go-mod'
     'html'
     'javascript'
     'json'
     'python'
     'rust'
+    'toml'
+    'tsx'
     'typescript'
+    'yaml'
 )
 
 for language in "${languages[@]}"
diff --git a/admin/notes/tree-sitter/build-module/build.sh 
b/admin/notes/tree-sitter/build-module/build.sh
index 102ab310fa..f096294028 100755
--- a/admin/notes/tree-sitter/build-module/build.sh
+++ b/admin/notes/tree-sitter/build-module/build.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 lang=$1
+topdir="$PWD"
 
 if [ $(uname) == "Darwin" ]
 then
@@ -11,25 +12,49 @@ fi
 
 echo "Building ${lang}"
 
-# Retrieve sources.
-git clone "https://github.com/tree-sitter/tree-sitter-${lang}.git"; \
+### Retrieve sources
+
+org="tree-sitter"
+repo="tree-sitter-${lang}"
+sourcedir="tree-sitter-${lang}/src"
+grammardir="tree-sitter-${lang}"
+
+case "${lang}" in
+    "dockerfile")
+        org="camdencheek"
+        ;;
+    "cmake")
+        org="uyha"
+        ;;
+    "go-mod")
+        # The parser is called "gomod".
+        lang="gomod"
+        org="camdencheek"
+        ;;
+    "typescript")
+        sourcedir="tree-sitter-typescript/typescript/src"
+        grammardir="tree-sitter-typescript/typescript"
+        ;;
+    "tsx")
+        repo="tree-sitter-typescript"
+        sourcedir="tree-sitter-typescript/tsx/src"
+        grammardir="tree-sitter-typescript/tsx"
+        ;;
+    "yaml")
+        org="ikatyang"
+        ;;
+esac
+
+git clone "https://github.com/${org}/${repo}.git"; \
     --depth 1 --quiet
-if [ "${lang}" == "typescript" ]
-then
-    lang="typescript/tsx"
-fi
-cp tree-sitter-lang.in "tree-sitter-${lang}/src"
-cp emacs-module.h "tree-sitter-${lang}/src"
-cp "tree-sitter-${lang}/grammar.js" "tree-sitter-${lang}/src"
-cd "tree-sitter-${lang}/src"
+cp "${grammardir}"/grammar.js "${sourcedir}"
+# We have to go into the source directory to compile, because some
+# C files refer to files like "../../common/scanner.h".
+cd "${sourcedir}"
 
-if [ "${lang}" == "typescript/tsx" ]
-then
-    lang="tsx"
-fi
+### Build
 
-# Build.
-cc -c -I. parser.c
+cc -fPIC -c -I. parser.c
 # Compile scanner.c.
 if test -f scanner.c
 then
@@ -48,15 +73,9 @@ else
     cc -fPIC -shared *.o -o "libtree-sitter-${lang}.${soext}"
 fi
 
-# Copy out.
-
-if [ "${lang}" == "typescript" ]
-then
-    cp "libtree-sitter-${lang}.${soext}" ..
-    cd ..
-fi
+### Copy out
 
-mkdir -p ../../dist
-cp "libtree-sitter-${lang}.${soext}" ../../dist
-cd ../../
-rm -rf "tree-sitter-${lang}"
+mkdir -p "${topdir}/dist"
+cp "libtree-sitter-${lang}.${soext}" "${topdir}/dist"
+cd "${topdir}"
+rm -rf "${repo}"
diff --git a/admin/notes/tree-sitter/starter-guide 
b/admin/notes/tree-sitter/starter-guide
index 123dabd9f2..a6a4c647f2 100644
--- a/admin/notes/tree-sitter/starter-guide
+++ b/admin/notes/tree-sitter/starter-guide
@@ -282,7 +282,7 @@ For MATHCER we have
            NODE-INDEX-MIN NODE-INDEX-MAX)
 
     => checks everything. If an argument is nil, don’t match that. Eg,
-    (match nil nil TYPE) is the same as (parent-is TYPE)
+    (match nil TYPE) is the same as (parent-is TYPE)
 
 For ANCHOR we have
 
diff --git a/build-aux/config.guess b/build-aux/config.guess
index a419d8643b..980b020838 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -4,7 +4,7 @@
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2022-08-01'
+timestamp='2022-09-17'
 
 # 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
@@ -966,6 +966,12 @@ EOF
        GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
        GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
        ;;
+    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
+       GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
+       ;;
+    *:[Mm]anagarm:*:*)
+       GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
+       ;;
     *:Minix:*:*)
        GUESS=$UNAME_MACHINE-unknown-minix
        ;;
diff --git a/build-aux/config.sub b/build-aux/config.sub
index fbaa37f235..baf1512b3c 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -4,7 +4,7 @@
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2022-08-01'
+timestamp='2022-09-17'
 
 # 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
@@ -145,7 +145,7 @@ case $1 in
                        nto-qnx* | linux-* | uclinux-uclibc* \
                        | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | 
netbsd*-gnu* \
                        | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
-                       | storm-chaos* | os2-emx* | rtmk-nova*)
+                       | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*)
                                basic_machine=$field1
                                basic_os=$maybe_os
                                ;;
@@ -1341,6 +1341,10 @@ EOF
                kernel=linux
                os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
                ;;
+       managarm*)
+               kernel=managarm
+               os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
+               ;;
        *)
                kernel=
                os=$basic_os
@@ -1754,7 +1758,7 @@ case $os in
             | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
             | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
             | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
-            | fiwix* )
+            | fiwix* | mlibc* )
                ;;
        # This one is extra strict with allowed versions
        sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@@ -1762,6 +1766,9 @@ case $os in
                ;;
        none)
                ;;
+       kernel* )
+               # Restricted further below
+               ;;
        *)
                echo Invalid configuration \`"$1"\': OS \`"$os"\' not 
recognized 1>&2
                exit 1
@@ -1772,16 +1779,26 @@ esac
 # (given a valid OS), if there is a kernel.
 case $kernel-$os in
        linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
-                  | linux-musl* | linux-relibc* | linux-uclibc* )
+                  | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* 
)
                ;;
        uclinux-uclibc* )
                ;;
-       -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
+       managarm-mlibc* | managarm-kernel* )
+               ;;
+       -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* )
                # These are just libc implementations, not actual OSes, and thus
                # require a kernel.
                echo "Invalid configuration \`$1': libc \`$os' needs explicit 
kernel." 1>&2
                exit 1
                ;;
+       -kernel* )
+               echo "Invalid configuration \`$1': \`$os' needs explicit 
kernel." 1>&2
+               exit 1
+               ;;
+       *-kernel* )
+               echo "Invalid configuration \`$1': \`$kernel' does not support 
\`$os'." 1>&2
+               exit 1
+               ;;
        kfreebsd*-gnu* | kopensolaris*-gnu*)
                ;;
        vxworks-simlinux | vxworks-simwindows | vxworks-spe)
diff --git a/configure.ac b/configure.ac
index cc4e59ee5a..5bd6645a25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ dnl  along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.
 
 AC_PREREQ([2.65])
 dnl Note this is parsed by (at least) make-dist and lisp/cedet/ede/emacs.el.
-AC_INIT([GNU Emacs], [29.0.50], [bug-gnu-emacs@gnu.org], [],
+AC_INIT([GNU Emacs], [30.0.50], [bug-gnu-emacs@gnu.org], [],
   [https://www.gnu.org/software/emacs/])
 
 dnl Set emacs_config_options to the options of 'configure', quoted for the 
shell,
@@ -1841,7 +1841,9 @@ AC_CHECK_HEADERS_ONCE(
   coff.h pty.h
   sys/resource.h
   sys/utsname.h pwd.h utmp.h util.h
-  sanitizer/lsan_interface.h])
+  sanitizer/lsan_interface.h
+  sanitizer/asan_interface.h
+  sanitizer/common_interface_defs.h])
 
 AC_CACHE_CHECK([for ADDR_NO_RANDOMIZE],
   [emacs_cv_personality_addr_no_randomize],
@@ -3933,21 +3935,10 @@ if test "${HAVE_X11}" = "yes"; then
   if test "${HAVE_XCB}" = "yes"; then
     AC_CHECK_LIB([X11-xcb], [XGetXCBConnection], [HAVE_X11_XCB=yes])
     if test "${HAVE_X11_XCB}" = "yes"; then
-      AC_CHECK_LIB([xcb-util], [xcb_aux_sync], [HAVE_XCB_UTIL=yes])
-      if test "${HAVE_XCB_UTIL}" = "yes"; then
-       AC_DEFINE([USE_XCB], [1],
+      AC_DEFINE([USE_XCB], [1],
 [Define to 1 if you have the XCB library and X11-XCB library for mixed
-  X11/XCB programming.])
-        XCB_LIBS="-lX11-xcb -lxcb -lxcb-util"
-      else
-       AC_CHECK_LIB([xcb-aux], [xcb_aux_sync], [HAVE_XCB_AUX=yes])
-        if test "${HAVE_XCB_AUX}" = "yes"; then
-         AC_DEFINE([USE_XCB], [1],
-[Define to 1 if you have the XCB library and X11-XCB library for mixed
- X11/XCB programming.])
-          XCB_LIBS="-lX11-xcb -lxcb -lxcb-aux"
-        fi
-      fi
+X11/XCB programming.])
+      XCB_LIBS="-lX11-xcb -lxcb"
     fi
   fi
 fi
@@ -4216,11 +4207,13 @@ AC_SUBST_FILE([module_env_snippet_26])
 AC_SUBST_FILE([module_env_snippet_27])
 AC_SUBST_FILE([module_env_snippet_28])
 AC_SUBST_FILE([module_env_snippet_29])
+AC_SUBST_FILE([module_env_snippet_30])
 module_env_snippet_25="$srcdir/src/module-env-25.h"
 module_env_snippet_26="$srcdir/src/module-env-26.h"
 module_env_snippet_27="$srcdir/src/module-env-27.h"
 module_env_snippet_28="$srcdir/src/module-env-28.h"
 module_env_snippet_29="$srcdir/src/module-env-29.h"
+module_env_snippet_30="$srcdir/src/module-env-30.h"
 emacs_major_version="${PACKAGE_VERSION%%.*}"
 AC_SUBST([emacs_major_version])
 
@@ -4702,7 +4695,7 @@ AC_SUBST([XINERAMA_LIBS])
 ### Use Xfixes (-lXfixes) if available
 HAVE_XFIXES=no
 if test "${HAVE_X11}" = "yes"; then
-  XFIXES_REQUIRED=4.0.0
+  XFIXES_REQUIRED=1.0.0
   XFIXES_MODULES="xfixes >= $XFIXES_REQUIRED"
   EMACS_CHECK_MODULES([XFIXES], [$XFIXES_MODULES])
   if test $HAVE_XFIXES = no; then
@@ -5006,6 +4999,7 @@ pthread_sigmask strsignal setitimer \
 sendto recvfrom getsockname getifaddrs freeifaddrs \
 gai_strerror sync \
 getpwent endpwent getgrent endgrent \
+renameat2 \
 cfmakeraw cfsetspeed __executable_start log2 pthread_setname_np \
 pthread_set_name_np])
 LIBS=$OLD_LIBS
@@ -5998,7 +5992,7 @@ case $opsys in
   gnu-linux | gnu-kfreebsd )
     AC_DEFINE([USG], [])
     AC_DEFINE([GNU_LINUX], [],
-      [Define if ths system is compatible with GNU/Linux.])
+      [Define if this system is compatible with GNU/Linux.])
     ;;
 
   hpux*)
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
index 1457a8bc3a..96f881ca12 100644
--- a/doc/emacs/macos.texi
+++ b/doc/emacs/macos.texi
@@ -154,7 +154,7 @@ titlebar.
 @vindex ns-confirm-quit
 @item ns-confirm-quit
 This variable specifies whether to display a graphical confirmation
-dialogue on quitting.
+dialog on quitting.
 
 @vindex ns-auto-hide-menu-bar
 @item ns-auto-hide-menu-bar
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 44e9e1896f..9ebb044652 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1673,16 +1673,16 @@ is known as the @dfn{project root}.
 @cindex project back-end
   Whether a given directory is a root of some project is determined by
 the project-specific infrastructure, known as @dfn{project back-end}.
-Emacs currently supports two such back-ends: VC (@pxref{Version
+Emacs currently supports two such back-ends: VC-aware (@pxref{Version
 Control}), whereby a VCS repository is considered a project; and EDE
 (@pxref{EDE}).  This is expected to be extended in the future to
 support additional types of projects.
 
   Which files do or don't belong to a project is also determined by
-the project back-end.  For example, the VC back-end doesn't consider
-``ignored'' files (@pxref{VC Ignore}) to be part of the project.
-Also, the VC Project back-end considers ``untracked'' files by default.
-That behavior is controllable with the variable
+the project back-end.  For example, the VC-aware back-end doesn't
+consider ``ignored'' files (@pxref{VC Ignore}) to be part of the
+project.  Also, the VC-aware Project back-end considers ``untracked''
+files by default.  That behavior is controllable with the variable
 @code{project-vc-include-untracked}.
 
 @menu
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 29c0bed19c..702c72bac2 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1808,31 +1808,28 @@ you can give each daemon its own server name like this:
   emacs --daemon=foo
 @end example
 
-@findex server-stop-automatically
+@vindex server-stop-automatically
   The Emacs server can optionally be stopped automatically when
-certain conditions are met.  To do this, call the function
-@code{server-stop-automatically} in your init file (@pxref{Init
-File}), with one of the following arguments:
+certain conditions are met.  To do this, set the option
+@code{server-stop-automatically} to one of the following values:
 
-@itemize
-@item
-With the argument @code{empty}, the server is stopped when it has no
-clients, no unsaved file-visiting buffers and no running processes
-anymore.
-
-@item
-With the argument @code{delete-frame}, when the last client frame is
-being closed, you are asked whether each unsaved file-visiting buffer
-must be saved and each unfinished process can be stopped, and if so,
-the server is stopped.
-
-@item
-With the argument @code{kill-terminal}, when the last client frame is
-being closed with @kbd{C-x C-c} (@code{save-buffers-kill-terminal}),
-you are asked whether each unsaved file-visiting buffer must be saved
-and each unfinished process can be stopped, and if so, the server is
+@table @code
+@item empty
+This value causes the server to be stopped when it has no clients, no
+unsaved file-visiting buffers and no running processes anymore.
+
+@item delete-frame
+This value means that when the last client frame is being closed, you
+are asked whether each unsaved file-visiting buffer must be saved and
+each unfinished process can be stopped, and if so, the server is
 stopped.
-@end itemize
+
+@item kill-terminal
+This value means that when the last client frame is being closed with
+@kbd{C-x C-c} (@code{save-buffers-kill-terminal}), you are asked
+whether each unsaved file-visiting buffer must be saved and each
+unfinished process can be stopped, and if so, the server is stopped.
+@end table
 
 @findex server-eval-at
   If you have defined a server by a unique server name, it is possible
diff --git a/doc/emacs/msdos.texi b/doc/emacs/msdos.texi
index dd0787cd38..d55c751210 100644
--- a/doc/emacs/msdos.texi
+++ b/doc/emacs/msdos.texi
@@ -206,40 +206,40 @@ format, that effectively converts the file to Unix EOL 
style, like the
 @code{dos2unix} program.
 
 @cindex untranslated file system
-@findex add-untranslated-filesystem
+@findex w32-add-untranslated-filesystem
   When you use NFS, Samba, or some other similar method to access file
 systems that reside on computers using GNU or Unix systems, Emacs
 should not perform end-of-line translation on any files in these file
 systems---not even when you create a new file.  To request this,
 designate these file systems as @dfn{untranslated} file systems by
-calling the function @code{add-untranslated-filesystem}.  It takes one
-argument: the file system name, including a drive letter and
+calling the function @code{w32-add-untranslated-filesystem}.  It takes
+one argument: the file system name, including a drive letter and
 optionally a directory.  For example,
 
 @example
-(add-untranslated-filesystem "Z:")
+(w32-add-untranslated-filesystem "Z:")
 @end example
 
 @noindent
 designates drive Z as an untranslated file system, and
 
 @example
-(add-untranslated-filesystem "Z:\\foo")
+(w32-add-untranslated-filesystem "Z:\\foo")
 @end example
 
 @noindent
 designates directory @file{\foo} on drive Z as an untranslated file
 system.
 
-  Most often you would use @code{add-untranslated-filesystem} in your
+  Most often you would use @code{w32-add-untranslated-filesystem} in your
 @file{.emacs} or @file{init.el} init file, or in @file{site-start.el}
 so that all the users at your site get the benefit of it.
 
-@findex remove-untranslated-filesystem
-  To countermand the effect of @code{add-untranslated-filesystem}, use
-the function @code{remove-untranslated-filesystem}.  This function takes
-one argument, which should be a string just like the one that was used
-previously with @code{add-untranslated-filesystem}.
+@findex w32-remove-untranslated-filesystem
+  To countermand the effect of @code{w32-add-untranslated-filesystem},
+use the function @code{w32-remove-untranslated-filesystem}.  This
+function takes one argument, which should be a string just like the
+one that was used previously with @code{w32-add-untranslated-filesystem}.
 
   Designating a file system as untranslated does not affect character
 set conversion, only end-of-line conversion.  Essentially, it directs
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 6abf29c009..3812c2aa28 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -83,22 +83,38 @@ mode for the C programming language is @code{c-mode}.
 @cindex DNS mode
 @cindex Javascript mode
 @cindex Awk mode
+@cindex C# mode
+@cindex IDLWAVE mode
+@cindex JSON mode
+@cindex SQL mode
+@cindex TypeScript mode
+@cindex CSS mode
+@cindex Dockerfile mode
+@cindex CMake mode
+@cindex TOML mode
   Emacs has programming language modes for Lisp, Scheme, the
-Scheme-based DSSSL expression language, Ada, ASM, AWK, C, C++,
+Scheme-based DSSSL expression language, Ada, ASM, AWK, C, C++, C#,
 Fortran, Icon, IDL (CORBA), IDLWAVE, Java, Javascript, M4, Makefiles,
 Metafont (@TeX{}'s companion for font creation), Modula2, Object
 Pascal, Objective-C, Octave, Pascal, Perl, Pike, PostScript, Prolog,
-Python, Ruby, Simula, SQL, Tcl, Verilog, and VHDL@.  An alternative
-mode for Perl is called CPerl mode.  Modes are also available for the
-scripting languages of the common GNU and Unix shells, and
-MS-DOS/MS-Windows @samp{BAT} files, and for makefiles, DNS master
-files, and various sorts of configuration files.
+Python, Ruby, Simula, SQL, Tcl, TypeScript, Verilog, and VHDL@.  An
+alternative mode for Perl is called CPerl mode.  Modes are also
+available for the scripting languages of the common GNU and Unix
+shells, and MS-DOS/MS-Windows @samp{BAT} files, JSON, DNS master
+files, CSS (Cascading Style Sheets), Dockerfiles, CMake files, and various 
sorts of configuration files.
 
   Ideally, Emacs should have a major mode for each programming
 language that you might want to edit.  If it doesn't have a mode for
 your favorite language, the mode might be implemented in a package not
 distributed with Emacs (@pxref{Packages}); or you can contribute one.
 
+@cindex tree-sitter library, supported major modes
+  If Emacs has been compiled with the @samp{tree-sitter} library, it
+offers several optional editing modes based on that library, which
+utilize the incremental parsing capabilities provided by
+@samp{tree-sitter}.  These modes have @samp{-ts-} in their names; for
+example @code{c-ts-mode}, @code{python-ts-mode}, etc.
+
 @kindex DEL @r{(programming modes)}
 @findex backward-delete-char-untabify
   In most programming languages, indentation should vary from line to
@@ -404,6 +420,9 @@ large chunks of code:
 @table @kbd
 @item C-M-q
 Reindent all the lines within one parenthetical grouping.
+@item M-q
+Fill a single paragraph in a defun, or reindent all the lines within
+that defun.
 @item C-u @key{TAB}
 Shift an entire parenthetical grouping rigidly sideways so that its
 first line is properly indented.
@@ -424,6 +443,21 @@ indentation of the line where the grouping starts).  The 
function that
 etc.  To correct the overall indentation as well, type @kbd{@key{TAB}}
 first.
 
+@kindex M-q
+@findex prog-fill-reindent-defun
+@vindex beginning-of-defun-function
+@vindex end-of-defun-function
+@vindex fill-paragraph-function
+  To reindent the entire defun around point, type @kbd{M-q}
+(@code{prog-fill-reindent-defun}).  If point is in a comment or a
+string, this command fills and indents the comment or string instead.
+What exactly constitutes a comment, a string, or a defun depends on
+the major mode: the bounds of a defun are decided by the variables
+@code{beginning-of-defun-function} and @code{end-of-defun-function}
+(@pxref{List Motion,,, elisp, The Emacs Lisp Reference Manual}),
+and the filling mechanism is decided by @code{fill-paragraph-function}
+(@pxref{Filling,,, elisp, The Emacs Lisp Reference Manual}).
+
 @kindex C-u TAB
   If you like the relative indentation within a grouping but not the
 indentation of its first line, move point to that first line and type
@@ -1419,7 +1453,7 @@ displaying all of the documentation texts concatenated 
together.
 This abnormal hook's value is a list of functions that can produce
 documentation for the symbol at point as appropriate for the current
 buffer's major-mode.  These functions act as a collection of backends
-for ElDoc.  Major mode register their documentation lookup functions
+for ElDoc.  Major modes register their documentation lookup functions
 with ElDoc by adding their functions to the buffer-local value of this
 variable.
 @end vtable
diff --git a/doc/lispref/ChangeLog.1 b/doc/lispref/ChangeLog.1
index 7c7d49967c..82840aed1d 100644
--- a/doc/lispref/ChangeLog.1
+++ b/doc/lispref/ChangeLog.1
@@ -886,7 +886,7 @@
 2014-03-15  Dmitry Gutov  <dgutov@yandex.ru>
 
        * display.texi (Blinking): Update WRT to the new
-       `blink-matchin-paren' behavior.
+       `blink-matching-paren' behavior.
 
 2014-03-14  Martin Rudalics  <rudalics@gmx.at>
 
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 377b433cae..662de29d45 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -1676,10 +1676,14 @@ as returned by @code{find-image} (@pxref{Defining 
Images}); otherwise
 this is @code{nil}.
 
 @item @var{dx}, @var{dy}
-These are the pixel coordinates of the click, relative to the top left
-corner of @var{object}, which is @code{(0 . 0)}.  If @var{object} is
-@code{nil}, which stands for a buffer, the coordinates are relative to
-the top left corner of the character glyph clicked on.
+These are the pixel offsets of the click relative to the top left
+corner of the @var{object}'s glyph that is the nearest one to the
+click. The relevant @var{object}s can be either a buffer, or a string,
+or an image, see above.  If @var{object} is @code{nil} or a string,
+the coordinates are relative to the top left corner of the character
+glyph clicked on.  Note that the offsets are always zero on text-mode
+frames, when @var{object} is @code{nil}, since each glyph there is
+considered to have exactly 1x1 pixel dimensions.
 
 @item @var{width}, @var{height}
 If the click is on a character, either from buffer text or from
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi
index d1d281d709..3e39734999 100644
--- a/doc/lispref/compile.texi
+++ b/doc/lispref/compile.texi
@@ -516,7 +516,7 @@ using the @code{with-suppressed-warnings} macro:
 @defspec with-suppressed-warnings warnings body@dots{}
 In execution, this is equivalent to @code{(progn @var{body}...)}, but
 the compiler does not issue warnings for the specified conditions in
-@var{body}.  @var{warnings} is an associative list of warning symbols
+@var{body}.  @var{warnings} is an association list of warning symbols
 and function/variable symbols they apply to.  For instance, if you
 wish to call an obsolete function called @code{foo}, but want to
 suppress the compilation warning, say:
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 10a1a18dd1..4111a86aa7 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -1460,19 +1460,10 @@ You can use @dfn{overlays} to alter the appearance of a 
buffer's text on
 the screen, for the sake of presentation features.  An overlay is an
 object that belongs to a particular buffer, and has a specified
 beginning and end.  It also has properties that you can examine and set;
-these affect the display of the text within the overlay.
-
-@cindex scalability of overlays
-@cindex overlays, scalability
-The visual effect of an overlay is the same as of the corresponding
-text property (@pxref{Text Properties}).  However, due to a different
-implementation, overlays generally don't scale well (many operations
-take a time that is proportional to the number of overlays in the
-buffer).  If you need to affect the visual appearance of many portions
-in the buffer, we recommend using text properties.
-
-An overlay uses markers to record its beginning and end; thus,
-editing the text of the buffer adjusts the beginning and end of each
+these affect the display of the text within the overlaid portion of
+the buffer.
+
+Editing the text of the buffer adjusts the beginning and end of each
 overlay so that it stays with the text.  When you create the overlay,
 you can specify whether text inserted at the beginning should be
 inside the overlay or outside, and likewise for the end of the overlay.
@@ -1492,7 +1483,7 @@ inside the overlay or outside, and likewise for the end 
of the overlay.
   This section describes the functions to create, delete and move
 overlays, and to examine their contents.  Overlay changes are not
 recorded in the buffer's undo list, since the overlays are not
-part of the buffer's contents.
+considered part of the buffer's contents.
 
 @defun overlayp object
 This function returns @code{t} if @var{object} is an overlay.
@@ -1514,15 +1505,14 @@ When that happens, the overlay is by default not 
deleted, but you can
 cause it to be deleted by giving it the @samp{evaporate} property
 (@pxref{Overlay Properties, evaporate property}).
 
-The arguments @var{front-advance} and @var{rear-advance} specify the
-marker insertion type for the start of the overlay and for the end of
-the overlay, respectively.  @xref{Marker Insertion Types}.  If they
-are both @code{nil}, the default, then the overlay extends to include
-any text inserted at the beginning, but not text inserted at the end.
-If @var{front-advance} is non-@code{nil}, text inserted at the
-beginning of the overlay is excluded from the overlay.  If
-@var{rear-advance} is non-@code{nil}, text inserted at the end of the
-overlay is included in the overlay.
+The arguments @var{front-advance} and @var{rear-advance} specify what
+happens when text is inserted at the beginning (i.e., before
+@var{start}) and at the end.  If they are both @code{nil}, the
+default, then the overlay extends to include any text inserted at the
+beginning, but not text inserted at the end.  If @var{front-advance}
+is non-@code{nil}, text inserted at the beginning of the overlay is
+excluded from the overlay.  If @var{rear-advance} is non-@code{nil},
+text inserted at the end of the overlay is included in the overlay.
 @end defun
 
 @defun overlay-start overlay
@@ -1541,36 +1531,36 @@ returns @code{nil} if @var{overlay} has been deleted.
 @end defun
 
 @defun delete-overlay overlay
-This function deletes @var{overlay}.  The overlay continues to exist as
-a Lisp object, and its property list is unchanged, but it ceases to be
-attached to the buffer it belonged to, and ceases to have any effect on
-display.
+This function deletes the specified @var{overlay}.  The overlay
+continues to exist as a Lisp object, and its property list is
+unchanged, but it ceases to be attached to the buffer it belonged to,
+and ceases to have any effect on display.
 
 A deleted overlay is not permanently disconnected.  You can give it a
 position in a buffer again by calling @code{move-overlay}.
 @end defun
 
 @defun move-overlay overlay start end &optional buffer
-This function moves @var{overlay} to @var{buffer}, and places its bounds
-at @var{start} and @var{end}.  Both arguments @var{start} and @var{end}
-must specify buffer positions; they may be integers or markers.
+This function moves @var{overlay} to @var{buffer}, and places its
+bounds at @var{start} and @var{end} in that buffer.  Both arguments
+@var{start} and @var{end} must specify buffer positions; they may be
+integers or markers.
 
 If @var{buffer} is omitted, @var{overlay} stays in the same buffer it
-was already associated with; if @var{overlay} was deleted, it goes into
-the current buffer.
+was already associated with; if @var{overlay} was previously deleted
+(and thus isn't associated with any buffer), it goes into the current
+buffer.
 
 The return value is @var{overlay}.
 
-This is the only valid way to change the endpoints of an overlay.  Do
-not try modifying the markers in the overlay by hand, as that fails to
-update other vital data structures and can cause some overlays to be
-lost.
+This function is the only valid way to change the endpoints of an
+overlay.
 @end defun
 
 @defun remove-overlays &optional start end name value
 This function removes all the overlays between @var{start} and
-@var{end} whose property @var{name} has the value @var{value}.  It can
-move the endpoints of the overlays in the region, or split them.
+@var{end} whose property @var{name} has the specified @var{value}.  It
+can move the endpoints of the overlays in the region, or split them.
 
 If @var{name} is omitted or @code{nil}, it means to delete all overlays in
 the specified region.  If @var{start} and/or @var{end} are omitted or
@@ -1581,20 +1571,24 @@ current buffer.
 
 @defun copy-overlay overlay
 This function returns a copy of @var{overlay}.  The copy has the same
-endpoints and properties as @var{overlay}.  However, the marker
+endpoints and properties as @var{overlay}.  However, the text
 insertion type for the start of the overlay and for the end of the
-overlay are set to their default values (@pxref{Marker Insertion
-Types}).
+overlay are set to their default values.
 @end defun
 
   Here are some examples:
 
 @example
+@group
 ;; @r{Create an overlay.}
 (setq foo (make-overlay 1 10))
      @result{} #<overlay from 1 to 10 in display.texi>
+@end group
+@group
 (overlay-start foo)
      @result{} 1
+@end group
+@group
 (overlay-end foo)
      @result{} 10
 (overlay-buffer foo)
@@ -1605,6 +1599,8 @@ Types}).
 ;; @r{Verify the property is present.}
 (overlay-get foo 'happy)
      @result{} t
+@end group
+@group
 ;; @r{Move the overlay.}
 (move-overlay foo 5 20)
      @result{} #<overlay from 5 to 20 in display.texi>
@@ -1612,6 +1608,8 @@ Types}).
      @result{} 5
 (overlay-end foo)
      @result{} 20
+@end group
+@group
 ;; @r{Delete the overlay.}
 (delete-overlay foo)
      @result{} nil
@@ -1625,6 +1623,8 @@ foo
      @result{} nil
 (overlay-buffer foo)
      @result{} nil
+@end group
+@group
 ;; @r{Undelete the overlay.}
 (move-overlay foo 1 20)
      @result{} #<overlay from 1 to 20 in display.texi>
@@ -1635,26 +1635,14 @@ foo
      @result{} 20
 (overlay-buffer foo)
      @result{} #<buffer display.texi>
+@end group
+@group
 ;; @r{Moving and deleting the overlay does not change its properties.}
 (overlay-get foo 'happy)
      @result{} t
+@end group
 @end example
 
-  Emacs stores the overlays of each buffer in two lists, divided
-around an arbitrary center position.  One list extends backwards
-through the buffer from that center position, and the other extends
-forwards from that center position.  The center position can be anywhere
-in the buffer.
-
-@defun overlay-recenter pos
-This function recenters the overlays of the current buffer around
-position @var{pos}.  That makes overlay lookup faster for positions
-near @var{pos}, but slower for positions far away from @var{pos}.
-@end defun
-
-  A loop that scans the buffer forwards, creating overlays, can run
-faster if you do @code{(overlay-recenter (point-max))} first.
-
 @node Overlay Properties
 @subsection Overlay Properties
 @cindex overlay properties
@@ -1711,15 +1699,15 @@ If you want to specify a priority value, use either 
@code{nil}
 (or zero), or a positive integer.  Any other value has undefined behavior.
 
 The priority matters when two or more overlays cover the same
-character and both specify the same property; the one whose
-@code{priority} value is larger overrides the other.  (For the
-@code{face} property, the higher priority overlay's value does not
-completely override the other value; instead, its face attributes
-override the face attributes of the lower priority @code{face}
-property.)  If two overlays have the same priority value, and one is
-nested in the other, then the inner one will prevail over the outer
-one.  If neither is nested in the other then you should not make
-assumptions about which overlay will prevail.
+character and both specify the same property with different values;
+the one whose @code{priority} value is larger overrides the other.
+(For the @code{face} property, the higher priority overlay's value
+does not completely override the other value; instead, its face
+attributes override the face attributes of the @code{face} property
+whose priority is lower.)  If two overlays have the same priority
+value, and one is nested in the other, then the inner one will prevail
+over the outer one.  If neither is nested in the other then you should
+not make assumptions about which overlay will prevail.
 
 Currently, all overlays take priority over text properties.
 
@@ -1780,7 +1768,7 @@ avoided.
 This property is used instead of @code{face} when the mouse is within
 the range of the overlay.  However, Emacs ignores all face attributes
 from this property that alter the text size (e.g., @code{:height},
-@code{:weight}, and @code{:slant}).  Those attributes are always the
+@code{:weight}, and @code{:slant}); those attributes are always the
 same as in the unhighlighted text.
 
 @item display
@@ -1793,9 +1781,8 @@ or shorter, higher or lower, wider or narrower, or 
replaced with an image.
 @item help-echo
 @kindex help-echo @r{(overlay property)}
 If an overlay has a @code{help-echo} property, then when you move the
-mouse onto the text in the overlay, Emacs displays a help string in the
-echo area, or in the tooltip window.  For details see @ref{Text
-help-echo}.
+mouse onto the text in the overlay, Emacs displays a help string in
+the echo area, or as a tooltip.  For details see @ref{Text help-echo}.
 
 @item field
 @kindex field @r{(overlay property)}
@@ -1862,7 +1849,8 @@ The @code{intangible} property on an overlay works just 
like the
 Properties}, for details.
 
 @item isearch-open-invisible
-This property tells incremental search how to make an invisible overlay
+This property tells incremental search (@pxref{Incremental Search,,,
+emacs, The GNU Emacs Manual}) how to make an invisible overlay
 visible, permanently, if the final match overlaps it.  @xref{Invisible
 Text}.
 
@@ -1874,13 +1862,15 @@ visible, temporarily, during the search.  
@xref{Invisible Text}.
 @kindex before-string @r{(overlay property)}
 This property's value is a string to add to the display at the beginning
 of the overlay.  The string does not appear in the buffer in any
-sense---only on the screen.
+sense---only on the screen.  Note that if the text at the beginning of
+the overlay is made invisible, the string will not be displayed.
 
 @item after-string
 @kindex after-string @r{(overlay property)}
 This property's value is a string to add to the display at the end of
 the overlay.  The string does not appear in the buffer in any
-sense---only on the screen.
+sense---only on the screen.  Note that if the text at the end of the
+overlay is made invisible, the string will not be displayed.
 
 @item line-prefix
 This property specifies a display spec to prepend to each
@@ -5419,7 +5409,7 @@ before @code{height}.
 
 @c We put all the '@code{(when ...)}' on one line to encourage
 @c makeinfo's end-of-sentence heuristics to DTRT.  Previously, the dot
-@c was at eol; the info file ended up w/ two spaces rendered after it.
+@c was at eol; the info file ended up with two spaces rendered after it.
   You can make any display specification conditional.  To do that,
 package it in another list of the form
 @code{(when @var{condition} . @var{spec})}.
@@ -5467,8 +5457,9 @@ or an image descriptor.
 
   To display something in the margin @emph{in association with}
 certain buffer text, without altering or preventing the display of
-that text, put a @code{before-string} property on the text and put the
-margin display specification on the contents of the before-string.
+that text, put on that text an overlay with a @code{before-string}
+property, and put the margin display specification on the contents of
+the before-string.
 
   Note that if the string to be displayed in the margin doesn't
 specify a face, its face is determined using the same rules and
@@ -7124,6 +7115,12 @@ This is only valid for @code{image} icons, and can be 
either a number
 (which specifies the height in pixels), or the symbol @code{line},
 which will use the default line height in the currently selected
 window.
+
+@item :width
+This is only valid for @code{image} icons, and can be either a number
+(which specifies the width in pixels), or the symbol @code{font},
+which will use the width in pixels of the current buffer’s default
+face font.
 @end table
 
 @var{doc} should be a doc string.
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 183b2786ea..a767f9c28d 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -895,10 +895,14 @@ permissions of the file itself.)
 If the file does not exist, or if there was trouble determining
 whether the file exists, this function returns @code{nil}.
 
-Directories are files, so @code{file-exists-p} can return @code{t} when
-given a directory.  However, because @code{file-exists-p} follows
-symbolic links, it returns @code{t} for a symbolic link
-name only if the target file exists.
+@cindex dangling symlinks, testing for existence
+Directories are files, so @code{file-exists-p} can return @code{t}
+when given a directory.  However, because @code{file-exists-p} follows
+symbolic links, it returns @code{t} for a symbolic link name only if
+the target of the link exists; if your Lisp program needs to consider
+@dfn{dangling symlinks} whose target doesn't exist as existing files,
+use @code{file-attributes} (@pxref{File Attributes}) instead of
+@code{file-exists-p}.
 @end defun
 
 @defun file-readable-p filename
@@ -3205,6 +3209,9 @@ This command creates a directory named @var{dirname}.  If
 @var{parents} is non-@code{nil}, as is always the case in an
 interactive call, that means to create the parent directories first,
 if they don't already exist.
+As a function, @code{make-directory} returns non-@code{nil} if @var{dirname}
+already exists as a directory and @var{parents} is non-@code{nil},
+and returns @code{nil} if it successfully created @var{dirname}.
 @code{mkdir} is an alias for this.
 @end deffn
 
@@ -3378,12 +3385,11 @@ first, before handlers for jobs such as remote file 
access.
 @code{load}, @code{lock-file},
 @code{make-auto-save-file-name},
 @code{make-directory},
-@code{make-directory-internal},
 @code{make-lock-file-name},
 @code{make-nearby-temp-file},
 @code{make-process},
 @code{make-symbolic-link},@*
-@code{process-attributes}, @code{process-file},
+@code{memory-info}, @code{process-attributes}, @code{process-file},
 @code{rename-file}, @code{set-file-acl}, @code{set-file-modes},
 @code{set-file-selinux-context}, @code{set-file-times},
 @code{set-visited-file-modtime}, @code{shell-command},
@@ -3440,12 +3446,11 @@ first, before handlers for jobs such as remote file 
access.
 @code{load}, @code{lock-file},
 @code{make-auto-save-file-name},
 @code{make-direc@discretionary{}{}{}tory},
-@code{make-direc@discretionary{}{}{}tory-internal},
 @code{make-lock-file-name},
 @code{make-nearby-temp-file},
 @code{make-process},
 @code{make-symbolic-link},
-@code{process-attributes}, @code{process-file},
+@code{memory-info}, @code{process-attributes}, @code{process-file},
 @code{rename-file}, @code{set-file-acl}, @code{set-file-modes},
 @code{set-file-selinux-context}, @code{set-file-times},
 @code{set-visited-file-modtime}, @code{shell-command},
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index b3f1a29ae8..a656964198 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -2854,10 +2854,18 @@ The plural ``frames'' in the previous paragraph is 
deliberate: while
 Emacs itself has only one selected frame, Emacs can have frames on
 many different terminals (recall that a connection to a window system
 counts as a terminal), and each terminal has its own idea of which
-frame has input focus.  When you set the input focus to a frame, you
-set the focus for that frame's terminal, but frames on other terminals
+frame has input focus.  Under the X Window System, where user input is
+organized into individual ``seats'' of input, each seat in turn can
+have its own specific input focus.  When you set the input focus to a
+frame, you set the focus for that frame's terminal on the last seat
+which interacted with Emacs, but frames on other terminals and seats
 may still remain focused.
 
+If the input focus is set before any user interaction has occurred on
+the specified terminal, then the X server picks a random seat
+(normally the one with the lowest number) and sets the input focus
+there.
+
 Lisp programs can switch frames temporarily by calling the function
 @code{select-frame}.  This does not alter the window system's concept
 of focus; rather, it escapes from the window manager's control until
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 4640b6d759..3174056ed8 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -622,6 +622,9 @@ a certain kind of object.  See the documentation string for 
details.
 @defun memory-info
 This functions returns an amount of total system memory and how much
 of it is free.  On an unsupported system, the value may be @code{nil}.
+
+If @code{default-directory} points to a remote host, memory
+information of that host is returned.
 @end defun
 
 @defvar gcs-done
@@ -2420,19 +2423,6 @@ Buffers}), and avoids slowing down internal or temporary 
buffers, such
 as those created by @code{with-temp-buffer} (@pxref{Definition of
 with-temp-buffer,, Current Buffer}).
 
-@item overlay_center
-This field holds the current overlay center position.  @xref{Managing
-Overlays}.
-
-@item overlays_before
-@itemx overlays_after
-These fields hold, respectively, a list of overlays that end at or
-before the current overlay center, and a list of overlays that end
-after the current overlay center.  @xref{Managing Overlays}.
-@code{overlays_before} is sorted in order of decreasing end position,
-and @code{overlays_after} is sorted in order of increasing beginning
-position.
-
 @item name
 A Lisp string that names the buffer.  It is guaranteed to be unique.
 @xref{Buffer Names}.  This and the following fields have their names
@@ -2559,6 +2549,9 @@ buffer-local (@pxref{Buffer-Local Variables}), whose 
corresponding
 variable names have underscores replaced with dashes.  For instance,
 @code{mode_line_format} stores the value of @code{mode-line-format}.
 
+@item overlays
+The inveral tree containing this buffer's overlays.
+
 @item last_selected_window
 This is the last window that was selected with this buffer in it, or @code{nil}
 if that window no longer displays this buffer.
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index 1e4bf4eb86..5882f24794 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -841,7 +841,7 @@ keymaps:
           (@var{find-in-any} emulation-mode-map-alists)
           (@var{find-in-any} minor-mode-overriding-map-alist)
           (@var{find-in-any} minor-mode-map-alist)
-          (if (get-text-property (point) 'local-map)
+          (if (get-char-property (point) 'local-map)
               (@var{find-in} (get-char-property (point) 'local-map))
             (@var{find-in} (current-local-map)))))
     (@var{find-in} (current-global-map)))
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index c472f9b441..c44938f392 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -4967,12 +4967,22 @@ first child where parent is @code{argument_list}, use
 (match nil "argument_list" nil nil 0 0)
 @end example
 
+@item n-p-gp
+Short for ``node-parent-grandparent'', this matcher is a function of 3
+arguments: @var{node-type}, @var{parent-type}, and
+@var{grandparent-type}.  It returns a function that is called with 3
+arguments: @var{node}, @var{parent}, and @var{bol}, and returns
+non-@code{nil} if: (1) @var{node-type} matches @var{node}'s type, and
+(2) @var{parent-type} matches @var{parent}'s type, and (3)
+@var{grandparent-type} matches @var{parent}'s parent's type.  If any
+of @var{node-type}, @var{parent-type}, and @var{grandparent-type} is
+@code{nil}, this function doesn't check for it.
+
 @item comment-end
 This matcher is a function that is called with 3 arguments:
 @var{node}, @var{parent}, and @var{bol}, and returns non-@code{nil} if
 point is before a comment ending token.  Comment ending tokens are
-defined by regular expression @code{treesit-comment-end}
-(@pxref{Tree-sitter major modes, treesit-comment-end}).
+defined by regular expression @code{comment-end-skip}
 
 @item first-sibling
 This anchor is a function that is called with 3 arguments: @var{node},
@@ -5009,19 +5019,11 @@ This is useful as the beginning of the buffer is always 
at column 0.
 
 @item comment-start
 This anchor is a function that is called with 3 arguments: @var{node},
-@var{parent}, and @var{bol}, and returns the position right after the
+@var{parent}, and @var{bol}, and returns the position after the
 comment-start token.  Comment-start tokens are defined by regular
-expression @code{treesit-comment-start} (@pxref{Tree-sitter major
-modes, treesit-comment-start}).  This function assumes @var{parent} is
-the comment node.
+expression @code{comment-start-skip}.  This function assumes
+@var{parent} is the comment node.
 
-@item coment-start-skip
-This anchor is a function that is called with 3 arguments: @var{node},
-@var{parent}, and @var{bol}, and returns the position after the
-comment-start token and any whitespace characters following that
-token.  Comment-start tokens are defined by regular expression
-@code{treesit-comment-start}.  This function assumes @var{parent} is
-the comment node.
 @end ftable
 @end defvar
 
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi
index a503a7edde..4cb0c3214a 100644
--- a/doc/lispref/package.texi
+++ b/doc/lispref/package.texi
@@ -152,9 +152,9 @@ the various headers, as illustrated by the following 
example:
 
 @example
 @group
-;;; superfrobnicator.el --- Frobnicate and bifurcate flanges
+;;; superfrobnicator.el --- Frobnicate and bifurcate flanges  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2022 Free Software Foundation, Inc.
 @end group
 
 ;; Author: J. R. Hacker <jrh@@example.com>
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi
index 0f6a99b299..adb4c5e6e0 100644
--- a/doc/lispref/parsing.texi
+++ b/doc/lispref/parsing.texi
@@ -409,6 +409,13 @@ Create a parser for the specified @var{buffer} and 
@var{language}
 By default, this function reuses a parser if one already exists for
 @var{language} in @var{buffer}, but if @var{no-reuse} is
 non-@code{nil}, this function always creates a new parser.
+
+If that buffer is an indirect buffer, its base buffer is used instead.
+That is, indirect buffers use their base buffer's parsers.  If the
+base buffer is narrowed, an indirect buffer might not be able to
+retrieve information of the portion of the buffer text that are
+invisible in the base buffer.  Lisp programs should widen as necessary
+should they want to use a parser in an indirect buffer.
 @end defun
 
 Given a parser, we can query information about it.
@@ -447,7 +454,8 @@ tree incrementally.
 @defun treesit-parser-list &optional buffer
 This function returns the parser list of @var{buffer}.  If
 @var{buffer} is @code{nil} or omitted, it defaults to the current
-buffer.
+buffer.  If that buffer is an indirect buffer, its base buffer is used
+instead.  That is, indirect buffers use their base buffer's parsers.
 @end defun
 
 @defun treesit-parser-delete parser
@@ -725,10 +733,11 @@ the first node that matches, or @code{nil} if none does.
 
 By default, this function only traverses named nodes, but if @var{all}
 is non-@code{nil}, it traverses all the nodes.  If @var{backward} is
-non-@code{nil}, it traverses backwards (i.e., it visits the last child first
-when traversing down the tree).  If @var{limit} is non-@code{nil}, it
-must be a number that limits the tree traversal to that many levels
-down the tree.
+non-@code{nil}, it traverses backwards (i.e., it visits the last child
+first when traversing down the tree).  If @var{limit} is
+non-@code{nil}, it must be a number that limits the tree traversal to
+that many levels down the tree.  If @var{limit} is @code{nil}, it
+defaults to 1000.
 @end defun
 
 @defun treesit-search-forward start predicate &optional backward all
@@ -814,10 +823,11 @@ b   1   2         b   |   |      b   c   d
 @end group
 @end example
 
-If @var{process-fn} is non-@code{nil}, instead of returning the matched
-nodes, this function passes each node to @var{process-fn} and uses the
-returned value instead.  If non-@code{nil}, @var{limit} is the number of
-levels to go down from @var{root}.
+If @var{process-fn} is non-@code{nil}, instead of returning the
+matched nodes, this function passes each node to @var{process-fn} and
+uses the returned value instead.  If non-@code{nil}, @var{limit} is
+the number of levels to go down from @var{root}.  If @var{limit} is
+@code{nil}, it defaults to 1000.
 
 Each node in the returned tree looks like
 @w{@code{(@var{tree-sitter-node} . (@var{child} @dots{}))}}.  The
@@ -1725,20 +1735,6 @@ For more information of these built-in tree-sitter 
features,
 For supporting mixing of multiple languages in a major mode,
 @pxref{Multiple Languages}.
 
-Setting the following local variables allows tree-sitter's indentation
-engine to correctly indent multi-line comments:
-
-@defvar treesit-comment-start
-This should be a regular expression matching an opening comment token.
-For example, it should match @samp{//}, @samp{////}, @samp{/*},
-@samp{/****}, etc., in C.
-@end defvar
-
-@defvar treesit-comment-end
-This should be a regular expression matching a closing comment token.
-For example, it should match @samp{*/}, @samp{****/}, etc., in C.
-@end defvar
-
 @node Tree-sitter C API
 @section Tree-sitter C API Correspondence
 
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index a01e568de0..7acf2d052a 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -836,20 +836,39 @@ of using its normal method.
 
 @findex treesit-beginning-of-defun
 @findex treesit-end-of-defun
-If Emacs is compiled with tree-sitter, it can use the tree-sitter parser
-information to move across syntax constructs.  A major mode can set
-@code{treesit-defun-type-regexp} and get navigation functionality for
-free, by using @code{treesit-beginning-of-defun} and
-@code{treesit-end-of-defun}.
+If Emacs is compiled with tree-sitter, it can use the tree-sitter
+parser information to move across syntax constructs.  Since what
+exactly is considered a defun varies between languages, a major mode
+should set @code{treesit-defun-type-regexp} to determine that.  Then
+the mode can get navigation-by-defun functionality for free, by using
+@code{treesit-beginning-of-defun} and @code{treesit-end-of-defun}.
 
 @defvar treesit-defun-type-regexp
 The value of this variable is a regexp matching the node type of defun
-nodes.  (For ``node'', ``node type'', @pxref{Parsing Program Source}.)
+nodes.  (For ``node'' and ``node type'', @pxref{Parsing Program Source}.)
 
 For example, @code{python-mode} sets this variable to a regexp that
 matches either @code{function_definition} or @code{class_definition}.
 @end defvar
 
+@defvar treesit-defun-prefer-top-level
+If this variable is non-@code{nil}, Emacs skips nested defuns, when it
+looks for beginning and end of a defun, and prefers to go to the
+top-level defun instead.
+
+In some languages, a defun could be nested in another one.  By default,
+Emacs stops at the first defun it encounters.  But if this variable's
+value is @code{t}, whenever Emacs finds a defun node, it tries to go
+up the parse tree until it finds the top-level defun.
+
+This variable can also be a list of cons cells of the form
+@w{@code{(@var{from} . @var{to}))}}, where @var{from} and @var{to} are
+regexps matching tree-sitter node types.  When Emacs finds a defun
+node whose type matches any of the @var{from} regexps in the list, it
+then tries to go up the parse tree until it finds a higher-level node
+matching the corresponding @var{to} regexp.
+@end defvar
+
 @node Skipping Characters
 @subsection Skipping Characters
 @cindex skipping characters
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index bc5a4cf24a..58f2703c8b 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -719,7 +719,7 @@ calling @var{function} on the elements in @var{sequence}.
 then with that result and the third element of @var{sequence}, etc.
 @var{function} should be a function of two arguments.
 
-@var{function} is called with two arguments.  @var{intial-value}
+@var{function} is called with two arguments.  @var{initial-value}
 (and then the accumulated value) is used as the first argument, and
 the elements in @var{sequence} are used for the second argument.
 
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 793c22949c..ef938e88ec 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -5460,6 +5460,10 @@ Extensions are usually shared-library files; on GNU and 
Unix systems,
 they have the @file{.so} file-name extension.
 @end defun
 
+@defun sqlite-version
+Return a string denoting the version of the SQLite library in use.
+@end defun
+
 @findex sqlite-mode-open-file
 If you wish to list the contents of an SQLite file, you can use the
 @code{sqlite-mode-open-file} command.  This will pop to a buffer using
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 7206f2acd2..12dd58c85b 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -188,15 +188,18 @@ It determines the value returned by evaluating the 
variable symbol,
 and it is the binding acted on by @code{setq}.
 
   For most purposes, you can think of the current binding as the
-innermost local binding, or the global binding if there is no
-local binding.  To be more precise, a rule called the @dfn{scoping
-rule} determines where in a program a local binding takes effect.  The
+innermost local binding, or the global binding if there is no local
+binding.  To be more precise, a rule called the @dfn{scoping rule}
+determines where in a program a local binding takes effect.  The
 default scoping rule in Emacs Lisp is called @dfn{dynamic scoping},
 which simply states that the current binding at any given point in the
 execution of a program is the most recently-created binding for that
 variable that still exists.  For details about dynamic scoping, and an
 alternative scoping rule called @dfn{lexical scoping}, @pxref{Variable
-Scoping}.
+Scoping}.  Lately Emacs is moving towards using lexical binding in
+more and more places, with the goal of eventually making lexical
+binding the default.  In particular, all Emacs Lisp source files and
+the @file{*scratch*} buffer use lexical scoping.
 
   The special forms @code{let} and @code{let*} exist to create local
 bindings:
@@ -266,6 +269,17 @@ Compare the following example with the example above for 
@code{let}.
      @result{} (1 1)
 @end group
 @end example
+
+@noindent
+Basically, the @code{let*} binding of @code{x} and @code{y} in the
+previous example is equivalent to using nested @code{let} bindings:
+
+@example
+(let ((y 1))
+  (let ((z y))
+    (list y z)))
+@end example
+
 @end defspec
 
 @defspec letrec (bindings@dots{}) forms@dots{}
@@ -843,9 +857,10 @@ error is signaled.
 
 @defmac setopt [symbol form]@dots{}
 This is like @code{setq} (see above), but meant for user options.
-This macro uses the Customize machinery to set the variable(s).  In
-particular, @code{setopt} will run the setter function associated with
-the variable.  For instance, if you have:
+This macro uses the Customize machinery to set the variable(s)
+(@pxref{Variable Definitions}).  In particular, @code{setopt} will run
+the setter function associated with the variable.  For instance, if
+you have:
 
 @example
 @group
@@ -870,6 +885,12 @@ will also issue a message:
 option.  For instance, using @code{setopt} to set a user option
 defined with a @code{number} type to a string will signal an error.
 
+Unlike @code{defcustom} and related customization commands, such as
+@code{customize-variable}, @code{setopt} is meant for non-interactive
+use, in particular in the user init file.  For that reason, it doesn't
+record the standard, saved, and user-set values, and doesn't mark the
+variable as candidate for saving in the custom file.
+
 The @code{setopt} macro can be used on regular, non-user option
 variables, but is much less efficient than @code{setq}.  The main use
 case for this macro is setting user options in the user's init file.
@@ -974,6 +995,11 @@ binding can also be accessed from the Lisp debugger.}.  It 
also has
 binding can live on even after the binding construct has finished
 executing, by means of special objects called @dfn{closures}.
 
+  The dynamic binding was (and still is) the default in Emacs for many
+years, but lately Emacs is moving towards using lexical binding in
+more and more places, with the goal of eventually making that the
+default.
+
   The following subsections describe dynamic binding and lexical
 binding in greater detail, and how to enable lexical binding in Emacs
 Lisp programs.
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 37884faec7..5b50d5f296 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -588,8 +588,7 @@ within that frame.  @var{frame} should be a live frame; if 
omitted or
 @defun set-frame-selected-window frame window &optional norecord
 This function makes @var{window} the window selected within the frame
 @var{frame}.  @var{frame} should be a live frame; if @code{nil}, it
-defaults to the selected frame.  @var{window} should be a live window;
-if @code{nil}, it defaults to the selected window.
+defaults to the selected frame.  @var{window} must denote a live window.
 
 If @var{frame} is the selected frame, this makes @var{window} the
 selected window.
diff --git a/doc/man/etags.1 b/doc/man/etags.1
index 4681a9dadb..d3d58b8212 100644
--- a/doc/man/etags.1
+++ b/doc/man/etags.1
@@ -209,7 +209,7 @@ otherwise.  This is particularly useful when storing many 
predefined
 regexps in a file.
 .br
 In its second form, \fIregexfile\fP is the name of a file that contains
-a number of arguments to the \fI\-\-regex\=\fP option,
+a number of arguments to the \fI\-\-regex=\fP option,
 one per line.  Lines beginning with a space or tab are assumed
 to be comments, and ignored.
 
@@ -220,22 +220,22 @@ from shell interpretation.
 
 Tag the DEFVAR macros in the emacs source files:
 .br
-\fI\-\-regex\='/[ \\t]*DEFVAR_[A-Z_ \\t(]+"\\([^"]+\\)"/'\fP
+\fI\-\-regex='/[ \\t]*DEFVAR_[A-Z_ \\t(]+"\\([^"]+\\)"/'\fP
 .\"" This comment is to avoid confusion to Emacs syntax highlighting
 .br
 
 Tag VHDL files (this example is a single long line, broken here for
 formatting reasons):
 .br
-\fI\-\-language\=none\ \-\-regex='/[\ \\t]*\\(ARCHITECTURE\\|\\
-CONFIGURATION\\)\ +[^\ ]*\ +OF/'\ \-\-regex\='/[\ \\t]*\\
+\fI\-\-language=none\ \-\-regex='/[\ \\t]*\\(ARCHITECTURE\\|\\
+CONFIGURATION\\)\ +[^\ ]*\ +OF/'\ \-\-regex='/[\ \\t]*\\
 \\(ATTRIBUTE\\|ENTITY\\|FUNCTION\\|PACKAGE\\(\ BODY\\)?\\
 \\|PROCEDURE\\|PROCESS\\|TYPE\\)[\ \\t]+\\([^\ \\t(]+\\)/\\3/'\fP
 .br
 
-Tag TCL files (this last example shows the usage of a \fItagregexp\fP):
+Tag Tcl files (this last example shows the usage of a \fItagregexp\fP):
 .br
-\fI\-\-lang\=none \-\-regex\='/proc[\ \\t]+\\([^\ \\t]+\\)/\\1/'\fP
+\fI\-\-lang=none \-\-regex='/proc[\ \\t]+\\([^\ \\t]+\\)/\\1/'\fP
 
 .br
 A regexp can be preceded by {\fIlang\fP}, thus restricting it to match
diff --git a/doc/misc/Makefile.in b/doc/misc/Makefile.in
index a7dbbbb48f..60b14172c3 100644
--- a/doc/misc/Makefile.in
+++ b/doc/misc/Makefile.in
@@ -67,14 +67,14 @@ MAKEINFO_OPTS = --force -I$(emacsdir)
 DOCMISC_W32 = @DOCMISC_W32@
 
 ## Info files to build and install on all platforms.
-INFO_COMMON = auth autotype bovine calc ccmode cl \
-       dbus dired-x ebrowse ede ediff edt efaq eglot eieio \
-       emacs-gnutls emacs-mime epa erc ert eshell eudc eww \
-       flymake forms gnus htmlfontify idlwave ido info.info \
-       mairix-el message mh-e modus-themes newsticker nxml-mode \
-       octave-mode org pcl-cvs pgg rcirc reftex remember sasl \
-       sc semantic ses sieve smtpmail speedbar srecode todo-mode \
-       tramp transient url vhdl-mode vip viper vtable widget wisent woman
+INFO_COMMON = auth autotype bovine calc ccmode cl dbus dired-x         \
+       ebrowse ede ediff edt efaq eglot eieio emacs-gnutls             \
+       emacs-mime epa erc ert eshell eudc eww flymake forms gnus       \
+       htmlfontify idlwave ido info.info mairix-el message mh-e        \
+       modus-themes newsticker nxml-mode octave-mode org pcl-cvs pgg   \
+       rcirc reftex remember sasl sc semantic ses sieve smtpmail       \
+       speedbar srecode todo-mode tramp transient url use-package      \
+       vhdl-mode vip viper vtable widget wisent woman
 
 ## Info files to install on current platform.
 INFO_INSTALL = $(INFO_COMMON) $(DOCMISC_W32)
@@ -186,7 +186,8 @@ $(foreach ifile,$(filter-out 
info.info,$(INFO_TARGETS)),$(eval $(call info_templ
 ## Extra dependencies.
 
 ## 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 = calc cl dired-x efaq efaq-w32 erc forms ido    \
+       newsticker reftex remember use-package 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 872e5f88f5..83728be0a5 100644
--- a/doc/misc/auth.texi
+++ b/doc/misc/auth.texi
@@ -560,11 +560,12 @@ favors the @samp{rms@@gnu.org.gpg} form for usernames 
over the
 param was provided.
 
 In general, if you prefer idiosyncrasies traditionally exhibited by
-this backend, such as prioritizing field count in a filename, try
-setting this option to @code{nil}.  But, if you experience problems
-predicting the outcome of searches relative to other auth-source
-backends or encounter code expecting to query multiple backends
-uniformly, try flipping it back to @code{t} (the default).
+this backend, such as prioritizing field count in a filename or
+matching against subdomain labels, keep this option set to @code{nil}
+(the default).  But, if you experience problems predicting the outcome
+of searches relative to other auth-source backends or encounter code
+expecting to query multiple backends uniformly, try flipping it to
+@code{t}.
 @end defvar
 
 @node Help for developers
diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi
index a815aebf59..2aff038b9a 100644
--- a/doc/misc/eglot.texi
+++ b/doc/misc/eglot.texi
@@ -178,6 +178,7 @@ start it.
 @node Setting Up LSP Servers
 @section Setting Up LSP Servers
 @cindex setting up LSP server for Eglot
+@cindex LSP server for Eglot, setting up
 @cindex language server for Eglot
 
 For Eglot to be useful, it must first be combined with a suitable
@@ -954,6 +955,13 @@ Note that you can still configure the excluded Emacs 
features manually
 to use Eglot in your @code{eglot-managed-mode-hook} or via some other
 mechanism.
 
+@vindex eglot-report-progress
+@cindex progress
+@item eglot-report-progress
+Set this variable to true if you'd like progress notifications coming
+from the LSP server to be handled as Emacs's progress reporting
+facilities.
+
 @vindex eglot-workspace-configuration
 @cindex server workspace configuration
 @item eglot-workspace-configuration
diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi
index 0d807e323e..2ab2e90894 100644
--- a/doc/misc/erc.texi
+++ b/doc/misc/erc.texi
@@ -78,6 +78,7 @@ Getting Started
 Advanced Usage
 
 * Connecting::                  Ways of connecting to an IRC server.
+* SASL::                        Authenticating via SASL.
 * Sample Configuration::        An example configuration file.
 * Integrations::                Integrations available for ERC.
 * Options::                     Options that are available for ERC.
@@ -390,8 +391,15 @@ modules are loaded.
 
 There is a spiffy customize interface, which may be reached by typing
 @kbd{M-x customize-option @key{RET} erc-modules @key{RET}}.
-Alternatively, set @code{erc-modules} manually and then call
-@code{erc-update-modules}.
+When removing a module outside of the Custom ecosystem, you may wish
+to ensure it's disabled by invoking its associated minor-mode toggle
+with a nonpositive prefix argument, for example, @kbd{C-u - M-x
+erc-spelling-mode @key{RET}}.  Additionally, if you plan on loading
+third-party modules that perform atypical setup on activation, you may
+need to arrange for calling @code{erc-update-modules} in your init
+file.  Examples of such setup might include registering an
+@code{erc-before-connect} hook, advising @code{erc-open}, and
+modifying @code{erc-modules} itself.
 
 The following is a list of available modules.
 
@@ -479,6 +487,10 @@ Replace text in messages
 @item ring
 Enable an input history
 
+@cindex modules, sasl
+@item sasl
+Enable SASL authentication
+
 @cindex modules, scrolltobottom
 @item scrolltobottom
 Scroll to the bottom of the buffer
@@ -517,6 +529,38 @@ Translate morse code in messages
 
 @end table
 
+@subheading Local Modules
+@cindex local modules
+
+All modules operate as minor modes under the hood, and some newer ones
+may be defined as buffer-local.  These so-called ``local modules'' are
+a work in progress and their behavior and interface are subject to
+change.  As of ERC 5.5, the only practical differences are
+
+@enumerate
+@item
+``Control variables,'' like @code{erc-sasl-mode}, are stateful across
+IRC sessions and override @code{erc-module} membership when influencing
+module activation in new sessions.
+@item
+Removing a local module from @code{erc-modules} via Customize not only
+disables its mode but also kills its control variable in all ERC
+buffers.
+@item
+``Mode toggles,'' like @code{erc-sasl-mode} and
+@code{erc-sasl-enable}, behave differently relative to each other and
+to their global counterparts.  (More on this just below.)
+@end enumerate
+
+By default, all local-mode toggles, like @code{erc-sasl-mode}, only
+affect the current buffer, but their ``non-mode'' variants, such as
+@code{erc-sasl-enable}, operate on all buffers belonging to a
+connection when called interactively.  Keep in mind that whether
+enabled or not, a module may effectively be ``inert'' in certain types
+of buffers, such as queries and channels.  Whatever the case, a local
+toggle never mutates @code{erc-modules}.
+
+
 @c PRE5_4: Document every option of every module in its own subnode
 
 
@@ -526,9 +570,20 @@ Translate morse code in messages
 
 @menu
 * Connecting::                  Ways of connecting to an IRC server.
+* SASL::                        Authenticating via SASL.
 * Sample Configuration::        An example configuration file.
 * Integrations::                Integrations available for ERC.
 * Options::                     Options that are available for ERC.
+
+@detailmenu
+--- Detailed Node Listing ---
+
+Integrations
+
+* URL::                         Opening IRC URLs in ERC.
+* auth-source::                 Retrieving auth-source entries with ERC.
+
+@end detailmenu
 @end menu
 
 @node Connecting
@@ -598,6 +653,7 @@ while helpers, like @code{erc-compute-nick}, will determine 
other
 parameters, and some, like @code{client-certificate}, will just be
 @code{nil}.
 
+@anchor{client-certificate}
 To use a certificate with @code{erc-tls}, specify the optional
 @var{client-certificate} keyword argument, whose value should be as
 described in the documentation of @code{open-network-stream}: if
@@ -641,6 +697,8 @@ machine irc.libera.chat key /home/bandali/my-cert.key cert 
/home/bandali/my-cert
 
 @xref{Help for users,,,auth, Emacs auth-source Library}, for more on the
 @file{.authinfo}/@file{.netrc} backend of @code{auth-source}.
+For other uses of auth-source throughout ERC, @pxref{auth-source,
+ERC's auth-source integration}.
 @end defun
 
 @subheading Server
@@ -732,7 +790,10 @@ ERC should automatically attempt to connect with another 
nickname.
 You can manually set another nickname with the /NICK command.
 @end defopt
 
+@anchor{username parameter}
 @subheading User
+@cindex username parameter
+
 @defun erc-compute-user &optional user
 Determine a suitable value to send as the first argument of the
 opening @samp{USER} IRC command by consulting the following sources:
@@ -754,8 +815,27 @@ A permanent username value to send for all connections.  
It should be
 a string abiding by the rules of the network.
 @end defopt
 
+@anchor{password parameter}
+@anchor{server password}
+@cindex password, server
 @subheading Password
-@cindex password
+
+This parameter was traditionally meant to specify a @dfn{server
+password} to be sent along with the IRC @samp{PASS} command.  However,
+such passwords aren't widely used.  Instead, networks typically expect
+them, when present, to convey other authentication information.  In
+the case of account-services (a.k.a., ``NickServ'') credentials, this
+typically involves a special syntax, such as @samp{myuser:mypass}.
+IRC bouncers often do something similar but include a pre-configured
+network-ID component, for example, @samp{bncuser/mynet:bncpass}.
+
+In general, if you have @emph{not} been asked by your network or
+bouncer to specify a repurposed server password, you should instead
+consider setting up @samp{services} or, preferably, @samp{sasl}, both
+ERC modules (@pxref{Modules}).  In addition to performing
+network-account authentication, these obviate the need for this
+parameter completely, although both can optionally borrow it for their
+own purposes.  (@xref{SASL, SASL in ERC}.)
 
 @defopt erc-prompt-for-password
 If non-@code{nil} (the default), @kbd{M-x erc} and @kbd{M-x erc-tls}
@@ -765,107 +845,9 @@ invocations of @code{erc} and @code{erc-tls}.
 
 @noindent
 If you prefer, you can set this option to @code{nil} and use the
-@code{auth-source} mechanism to store your password.  For instance, if
-the option @code{auth-sources} contains @file{~/.authinfo}, put
-something like the following in that file:
-
-@example
-machine irc.example.net login mynick password sEcReT
-@end example
-
-@noindent
-For server passwords, that is, passwords sent for the IRC @samp{PASS}
-command, the @samp{host} field (@w{@code{machine irc.example.net}} in
-the above example)
-corresponds to the @var{server} parameter used by @code{erc} and
-@code{erc-tls}.  Unfortunately, specifying a network, like
-@samp{Libera.Chat}, or a specific network server, like
-@samp{platinum.libera.chat}, won't normally work for looking up a server
-password because such information isn't available during opening
-introductions.  (Actually, ERC @emph{can} find entries with arbitrary
-@samp{host} values for any context, including server passwords, but
-that requires customizing the more advanced options below.)
-
-If ERC can't find a suitable server password, it will just skip the IRC
-@samp{PASS} command altogether, something users may want when using
-CertFP or engaging NickServ via ERC's ``services'' module.  If that is
-what you'd like to do, you can also customize the option
-@code{erc-auth-source-server-function} to @code{nil} to skip
-server-password lookup for all servers.  Note that some networks and
-IRCds may accept account-services authentication via server password
-using the nonstandard @samp{mynick:sEcReT} convention.
-
-As just mentioned, you can also use @code{auth-source} to authenticate
-to account services the traditional way, through a bot called
-@samp{NickServ}.  To tell ERC to do that, set
-@code{erc-use-auth-source-for-nickserv-password} to @code{t}.  For
-these and most other queries, entries featuring custom identifiers and
-networks are matched first, followed by network-specific servers and
-dialed endpoints (typically, the @var{server} argument passed to
-@code{erc}). The following netrc-style entries appear in order of
-precedence:
-
-@example
-machine Libera/cellphone login MyNick password sEcReT
-machine Libera.Chat login MyNick password sEcReT
-machine zirconium.libera.chat login MyNick password sEcReT
-machine irc.libera.chat login MyNick password sEcReT
-@end example
-
-@noindent
-Remember that field labels vary per backend, so @samp{machine} (in
-netrc's case) maps to auth-source's generalized notion of a host,
-hence the @samp{:host} keyword property.  Also, be sure to mind the
-syntax of your chosen backend medium.  For example, always quote
-channel names in a netrc file.
-
-If this all seems overly nuanced or just plain doesn't appeal to you,
-see options @code{erc-auth-source-services-function} and friends, described
-below.  These let you query auth-source your way.  Most users can
-simply ignore the passed-in arguments and get by with something like
-the following:
-
-@lisp
-(defun my-fancy-auth-source-func (&rest _)
-  (let* ((host (read-string "host: " nil nil "default"))
-         (pass (auth-source-pick-first-password :host host)))
-    (if (and pass (string-search "libera" host))
-        (concat "MyNick:" pass)
-      pass)))
-@end lisp
-
-Lastly, ERC also consults @code{auth-source} to find ``keys'' that may
-be required by certain channels you join.  When modifying a
-traditional @code{auth-source} entry for this purpose, put the channel
-name in the @samp{user} field (for example, @samp{login "#fsf"}, in
-netrc's case).  The actual key goes in the @samp{password} (or
-@samp{secret}) field.
-
-@noindent
-For details, @pxref{Top,,auth-source, auth, Emacs auth-source Library}.
-
-@defopt erc-auth-source-server-function
-@end defopt
-@defopt erc-auth-source-services-function
-@end defopt
-@defopt erc-auth-source-join-function
-
-ERC calls these functions with keyword arguments recognized by
-@code{auth-source-search}, namely, those deemed most relevant to the
-current context, if any.  For example, with NickServ queries,
-@code{:user} is the ``desired'' nickname rather than the current one.
-Generalized names, like @code{:user} and @code{:host}, are always used
-over back-end specific ones, like @code{:login} or @code{:machine}.
-ERC expects a string to use as the secret or nil, if the search fails.
-
-@findex erc-auth-source-search
-The default value for all three options is the function
-@code{erc-auth-source-search}.  It tries to merge relevant contextual
-parameters with those provided or discovered from the logical connection
-or the underlying transport.  Some auth-source back ends may not be
-compatible; netrc, plstore, json, secrets, and pass are currently
-supported.
-@end defopt
+auth-source facility to retrieve a server password, although hitting
+@kbd{RET} at the prompt may achieve the same effect.
+@xref{auth-source, ERC's auth-source integration}, for more.
 
 @subheading Full name
 
@@ -895,8 +877,8 @@ This can be either a string or a function to call.
 @end defopt
 
 
-@subheading ID
 @anchor{Network Identifier}
+@subheading ID
 
 ERC uses an abstract designation, called @dfn{network context
 identifier}, for referring to a connection internally.  While normally
@@ -918,6 +900,220 @@ When providing an ID as an entry-point argument, strings 
and symbols
 make the most sense, but any reasonably printable object is
 acceptable.
 
+@node SASL
+@section Authenticating via SASL
+@cindex SASL
+
+Regardless of the mechanism or the network, you'll likely have to be
+registered before first use.  Please refer to the network's own
+instructions for details.  If you're new to IRC and using a bouncer,
+know that you probably won't be needing SASL for the client-to-bouncer
+connection.  To get started, just add @code{sasl} to
+@code{erc-modules} like any other module.  But before that, please
+explore all custom options pertaining to your chosen mechanism.
+
+@defopt erc-sasl-mechanism
+The name of an SASL subprotocol type as a @emph{lowercase} symbol.
+The value can be one of the following:
+
+@table @asis
+@item @code{plain} and @code{scram} (``password-based'')
+Here, ``password'' refers to your account password, which is usually
+your @samp{NickServ} password.  To make this work, customize
+@code{erc-sasl-user} and @code{erc-sasl-password} or specify the
+@code{:user} and @code{:password} keyword arguments when invoking
+@code{erc-tls}.  Note that @code{:user} cannot be given interactively.
+
+@item @code{external} (via Client TLS Certificate)
+This works in conjunction with the @code{:client-certificate} keyword
+offered by @code{erc-tls}.  Just ensure you've registered your
+fingerprint with the network beforehand.  The fingerprint is usually a
+SHA1 or SHA256 digest in either "normalized" or "openssl" forms.  The
+first is lowercase without delims (@samp{deadbeef}) and the second
+uppercase with colon seps (@samp{DE:AD:BE:EF}).  These days, there's
+usually a @samp{CERT ADD} command offered by NickServ that can
+register you automatically if you issue it while connected with a
+client cert.  @xref{client-certificate}.
+
+Additional considerations:
+@enumerate
+@item
+Most IRCds will allow you to authenticate with a client cert but
+without the hassle of SASL (meaning you may not need this module).
+@item
+Technically, @var{EXTERNAL} merely indicates that an out-of-band mode
+of authentication is in effect (being deferred to), so depending on
+the specific application or service, there's a remote chance your
+server has something else in mind.
+@end enumerate
+
+@item @code{ecdsa-nist256p-challenge}
+This mechanism is quite complicated and currently requires the
+external @samp{openssl} executable, so please use something else if at
+all possible.  Ignoring that, specify your key file (e.g.,
+@samp{~/pki/mykey.pem}) as the value of @code{erc-sasl-password}, and
+then configure your network settings.  On servers running Atheme
+services, you can add your public key with @samp{NickServ} like so:
+
+@example
+ERC> /msg NickServ set property \
+     pubkey AgGZmlYTUjJlea/BVz7yrjJ6gysiAPaQxzeUzTH4hd5j
+
+@end example
+(You may be able to omit the @samp{property} subcommand.)
+@end table
+
+@end defopt
+
+@defopt erc-sasl-user
+This should be your network account username, typically the same one
+registered with nickname services.  Specify this when your NickServ
+login differs from the @code{:user} you're connecting with.
+@xref{username parameter}.
+@end defopt
+
+@defopt erc-sasl-password
+As noted elsewhere, the entry-point @code{:password} param was
+originally intended for traditional ``server passwords,'' but these
+aren't really used any more (@pxref{password parameter}).  As such,
+this option defaults to borrowing that parameter for its own uses,
+thus allowing you to call @code{erc-tls} with @code{:password} set to
+your NickServ password.
+
+You can also set this to a nonemtpy string, and ERC will send that
+when needed, no questions asked.  Or, if you'd rather use auth-source,
+set @code{erc-sasl-auth-source-function} to a function, and ERC will
+perform an auth-source query instead.  In all cases, ERC will prompt
+you for input as a last resort.
+
+Lastly, if your mechanism is @code{ecdsa-nist256p-challenge}, this
+option should instead hold the file name of your key.
+@end defopt
+
+@anchor{SASL auth-source function}
+@defopt erc-sasl-auth-source-function
+This is nearly identical to the other ERC @samp{auth-source} function
+options (@pxref{auth-source functions}) except that the default value
+here is @code{nil}, meaning you have to set it to something like
+@code{erc-auth-source-search} for queries to be performed.  For
+convenience, this module provides the following as a possible value:
+
+@defun erc-sasl-auth-source-password-as-host &rest plist
+Setting @code{erc-sasl-auth-source-function} to this function tells
+ERC to use @code{erc-sasl-password} for the @code{:host} field when
+querying auth-source, even if its value is the default
+@code{:password}, in which case ERC knows to ``resolve'' it to
+@code{erc-session-password} and use that as long as it's
+non-@code{nil}.  Otherwise, ERC just defers to
+@code{erc-auth-source-search} to determine the @code{:host}, along
+with everything else.
+@end defun
+
+As long as this option specifies a function, ERC will pass it the
+``resolved'' value of @code{erc-sasl-user} for the auth-source
+@code{:user} param.
+@end defopt
+
+@defopt erc-sasl-authzid
+In the rarest of circumstances, a network may want you to specify a
+specific role or assume an alternate identity.  In most cases, this
+happens because the server is buggy or misconfigured.  If you suspect
+such a thing, please contact your network operator.  Otherwise, just
+leave this set to @code{nil}.
+@end defopt
+
+@subheading Examples
+
+@itemize @bullet
+@item
+Defaults
+
+@lisp
+(erc-tls :server "irc.libera.chat" :port 6697
+         :nick "aph"
+         :user "APHacker"
+         :password "changeme")
+@end lisp
+
+Here, after adding @code{sasl} to @code{erc-modules} via the Customize
+interface, you authenticate to Libera.Chat using the @samp{PLAIN}
+mechanism and your NickServ credentials, @samp{APHacker} and
+@samp{changeme}.
+
+@item
+External
+
+@lisp
+(setopt erc-sasl-mechanism 'external)
+
+(erc-tls :server "irc.libera.chat" :port 6697 :nick "aph"
+         :client-certificate
+         '("/home/aph/my.key" "/home/aph/my.crt"))
+@end lisp
+
+You decide to switch things up and try out the @samp{EXTERNAL}
+mechanism.  You follow your network's instructions for telling
+NickServ about your client-certificate's fingerprint, and you
+authenticate successfully.
+
+@item
+Multiple networks
+
+@example
+# ~/.authinfo.gpg
+
+machine irc.libera.chat key /home/aph/my.key cert /home/aph/my.crt
+machine Example.Net login alyssa password sEcReT
+machine Example.Net login aph-bot password sesame
+@end example
+
+@lisp
+;; init.el
+
+(defun my-erc-up (network)
+  (interactive "Snetwork: ")
+
+  (pcase network
+    ('libera
+     (let ((erc-sasl-mechanism 'external))
+       (erc-tls :server "irc.libera.chat" :port 6697
+                :client-certificate t)))
+    ('example
+     (let ((erc-sasl-auth-source-function
+            #'erc-sasl-auth-source-password-as-host))
+       (erc-tls :server "irc.example.net" :port 6697
+                :user "alyssa"
+                :password "Example.Net")))))
+@end lisp
+
+You've started storing your credentials with auth-source and have
+decided to try SASL on another network as well.  But there's a catch:
+this network doesn't support @samp{EXTERNAL}.  You use
+@code{let}-binding to get around this and successfully authenticate to
+both networks.
+
+@end itemize
+
+@subheading Troubleshooting
+
+First and foremost, please know that ERC's SASL offering is currently
+limited by a lack of support for proper IRCv3 capability negotiation.
+In most cases, this shouldn't affect your ability to authenticate.
+
+If you're struggling, remember that your SASL password is almost
+always your NickServ password.  When in doubt, try restoring all SASL
+options to their defaults and calling @code{erc-tls} with @code{:user}
+set to your NickServ account name and @code{:password} to your
+NickServ password.  If you're still having trouble, please contact us
+(@pxref{Getting Help and Reporting Bugs}).
+
+As you try out different settings, keep in mind that it's best to
+create a fresh session for every change, for example, by calling
+@code{erc-tls} from scratch.  More experienced users may be able to
+get away with cycling @code{erc-sasl-mode} and issuing a
+@samp{/reconnect}, but that's generally not recommended.  Whatever the
+case, you'll probably want to temporarily disable
+@code{erc-server-auto-reconnect} while experimenting.
 
 @node Sample Configuration
 @section Sample Configuration
@@ -997,12 +1193,19 @@ stuff, to the current ERC buffer."
 @section Integrations
 @cindex integrations
 
-@subheading URL
+@menu
+* auth-source::                 Retrieving auth-source entries with ERC.
+@end menu
+
+@anchor{URL}
+@subsection URL
+@cindex URL
+
 For anything to work, you'll want to set @code{url-irc-function} to
 @code{url-irc-erc}.  As a rule of thumb, libraries relying directly on
 @code{url-retrieve} should be fine out the box from Emacs 29.1 onward.
 On older versions of Emacs, you may need to @code{(require 'erc)}
-beforehand. @pxref{Retrieving URLs,,, url, URL}.
+beforehand.  @xref{Retrieving URLs,,, url, URL}.
 
 For other apps and libraries, such as those relying on the
 higher-level @code{browse-url}, you'll oftentimes be asked to specify
@@ -1019,6 +1222,160 @@ need a function as well:
 @noindent
 Users on Emacs 28 and below may need to use @code{browse-url} instead.
 
+@node auth-source
+@subsection auth-source
+@cindex auth-source
+
+You can configure ERC to use the built-in auth-source library for
+looking up passwords. @xref{Top,,auth-source, auth, Emacs auth-source
+Library}, for general info on setting up various backends, but keep in
+mind that some of these may not be compatible.  Those currently
+supported are netrc, plstore, json, secrets, and pass.  To get started
+with the default backend, netrc, put a line like the following in your
+@file{~/.authinfo.gpg} (or any file named in the option
+@code{auth-sources}):
+
+@example
+machine irc.example.net login mynick password sEcReT
+@end example
+
+@subsubheading Server Passwords
+When retrieving passwords to accompany the IRC @samp{PASS} command
+(@pxref{password parameter}), ERC asks auth-source to match the
+@var{server} parameter of @code{erc-tls} against each entry's
+@samp{host} field (@w{@code{machine irc.example.net}} in the above
+example).  Unfortunately, specifying a network, like
+@samp{Libera.Chat}, or a specific network server, like
+@samp{platinum.libera.chat}, won't normally work for looking up a
+server password because that information isn't available during
+opening introductions.  (Actually, ERC @emph{can} find entries with
+arbitrary @samp{host} values for any context, including server
+passwords, but that requires customizing the more advanced options
+below.)
+
+If ERC can't find a suitable server password, it will just skip the
+IRC @samp{PASS} command altogether, something users may want when
+using CertFP or engaging NickServ via ERC's @code{services} module.
+If that appeals to you, consider customizing the option
+@code{erc-auth-source-server-function} to @code{nil} to skip
+server-password lookup for all servers.  Note that some networks and
+IRCds may accept account-services authentication via server password.
+Also, some ERC modules may commandeer the @code{erc-tls}
+@var{password} parameter for their own ends, which likely don't
+involve a server password.
+
+@subsubheading The @samp{services} module
+You can use auth-source to authenticate to account services the
+traditional way through a bot called @samp{NickServ}.  To do so, add
+@code{services} to @code{erc-modules} and set the option
+@code{erc-use-auth-source-for-nickserv-password} to @code{t}.  After
+that, expect the @samp{user} parameter in relevant auth-source queries
+to be your current nickname.
+
+Most of the time, a query's precise contextual details (such as
+whether a nick was granted or forcibly assigned) shouldn't affect how
+you define entries in your backend.  However, if something isn't quite
+working, you may want to investigate the interplay between the option
+@code{erc-nickserv-identify-mode} and account services.  In
+particular, if you find yourself facing nicks suffixed with an
+@code{erc-nick-uniquifier} (the infamous @samp{`}), check that the
+network's entry in @code{erc-nickserv-alist} is up to date, and do let
+us know if something's off (@pxref{Getting Help and Reporting Bugs}).
+Of course, if you've had your fill of fiddling with this module,
+consider switching to SASL for what's likely a more consistent
+auth-source experience.  (@xref{SASL}.)
+
+@subsubheading Default query behavior
+When preparing entries for your backend, it may help to get a feel for
+how ERC and its modules conduct searches, especially when exploring a
+new context, such as channel keys.  (Hint: in such situations, try
+temporarily setting the variable @code{auth-source-debug} to @code{t}
+and checking @samp{*Messages*} periodically for insights into how
+auth-source is operating.)  Overall, though, ERC tries to be
+consistent in performing queries across various authentication
+contexts.  Here's what to expect with respect to the @samp{host}
+field, which, by default, most heavily influences the fate of a query:
+
+@enumerate
+@item
+entries featuring custom identifiers and networks are matched first
+(@pxref{Network Identifier})
+@item
+followed by network-specific servers
+@item
+and, finally, dialed endpoints (typically the @var{server} argument
+passed to @code{erc-tls})
+@end enumerate
+
+@noindent
+The following netrc-style entries appear in order of precedence:
+
+@example
+machine Libera/cellphone login MyNick password sEcReT
+machine Libera.Chat login MyNick password sEcReT
+machine zirconium.libera.chat login MyNick password sEcReT
+machine irc.libera.chat login MyNick password sEcReT
+@end example
+
+@noindent
+Remember that field labels vary per backend, so @samp{machine} (in
+netrc's case) maps to auth-source's generalized notion of a host,
+hence the @samp{:host} keyword parameter to @code{auth-source-search}.
+Also, be sure to mind the syntax of your chosen backend medium.  For
+example, always quote channel names in a netrc file.
+
+Lastly, if this all seems overly nuanced or just plain doesn't appeal
+to you, please see options @code{erc-auth-source-services-function}
+and friends, described just below.
+
+@subsubheading Custom query functions
+These let you query auth-source your way.  Most users can
+simply ignore the passed-in arguments and get by with something like
+the following:
+
+@lisp
+(defun my-fancy-auth-source-func (&rest _)
+  (let* ((host (read-string "host: " nil nil "default"))
+         (pass (auth-source-pick-first-password :host host)))
+    (if (and pass (string-search "libera" host))
+        (concat "MyNick:" pass)
+      pass)))
+@end lisp
+
+@anchor{auth-source functions}
+@defopt erc-auth-source-server-function
+@end defopt
+@defopt erc-auth-source-services-function
+@end defopt
+@defopt erc-auth-source-join-function
+
+ERC calls these functions with keyword arguments recognized by
+@code{auth-source-search}, namely, those deemed most relevant to the
+current context, if any.  For example, when identifying to services,
+@code{:user} contains your current nickname.  Generalized parameter
+names, like @code{:user} and @code{:host}, are always preferred over
+backend specific ones, like @code{:login} or @code{:machine}.  In
+return, ERC expects a string if the search succeeds or @code{nil} if
+it fails.
+
+@findex erc-auth-source-search
+The default value for all three options is the function
+@code{erc-auth-source-search}.  It tries to merge relevant contextual
+parameters with those provided or discovered from the logical
+connection or the underlying transport.
+
+For using auth-source along with SASL, @pxref{SASL auth-source
+function}.
+@end defopt
+
+@subsubheading Channel keys
+ERC also consults @code{auth-source} to find ``keys'' that may be
+required by certain channels you join.  When modifying a traditional
+@code{auth-source} entry for this purpose, put the channel name in the
+@samp{user} field (for example, @samp{login "#fsf"}, in netrc's case).
+The actual key goes in the @samp{password} (or @samp{secret}) field.
+
+
 @node Options
 @section Options
 @cindex options
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index e6ddcf11df..f9796d69a9 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -256,12 +256,40 @@ as an argument will ``spread'' the elements into multiple 
arguments:
 @end example
 
 @subsection Quoting and escaping
-As with other shells, you can escape special characters and spaces
-with by prefixing the character with a backslash (@code{\}), or by
-surrounding the string with apostrophes (@code{''}) or double quotes
-(@code{""}).  This is needed especially for file names with special
-characters like pipe (@code{|}), which could be part of remote file
-names.
+As with other shells, you can escape special characters and spaces by
+prefixing the character with a backslash (@samp{\}), or by surrounding
+the string with apostrophes (@samp{''}) or double quotes (@samp{""}).
+This is needed especially for file names with special characters like
+pipe (@samp{|}), which could be part of remote file names.
+
+When you escape a character with @samp{\} outside of any quotes, the
+result is the literal character immediately following it.  For
+example, @code{\$10} means the literal string @code{$10}.
+
+Inside of double quotes, most characters have no special meaning.
+However, @samp{\}, @samp{"}, and @samp{$} are still special; to escape
+them, use backslash as above.  Thus, if the value of the variable
+@var{answer} is @code{42}, then @code{"The answer is: \"$answer\""}
+returns the string @code{The answer is: "42"}.  However, when escaping
+characters with no special meaning, the result is the full
+@code{\@var{c}} sequence.  For example, @code{"foo\bar"} means the
+literal string @code{foo\bar}.
+
+Additionally, when escaping a newline, the whole escape sequence is
+removed by the parser.  This lets you continue commands across
+multiple lines:
+
+@example
+~ $ echo "foo\
+bar"
+foobar
+@end example
+
+Inside apostrophes, escaping works differently.  All characters
+between the apostrophes have their literal meaning except @samp{'},
+which ends the quoted string.  To insert a literal apostrophe, you can
+use @samp{''}, so @code{'It''s me'} means the literal string
+@code{It's me}.
 
 When using expansions (@pxref{Expansion}) in an Eshell command, the
 result may potentially be of any data type.  To ensure that the result
@@ -321,9 +349,9 @@ alias (@pxref{Aliases}).  Example:
 @example
 ~ $ which sudo
 eshell/sudo is a compiled Lisp function in `em-tramp.el'.
-~ $ alias sudo '*sudo $*'
+~ $ alias sudo '*sudo $@@*'
 ~ $ which sudo
-sudo is an alias, defined as "*sudo $*"
+sudo is an alias, defined as "*sudo $@@*"
 @end example
 
 @vindex eshell-prefer-lisp-functions
@@ -447,7 +475,7 @@ Manual}.
 
 If @code{eshell-plain-diff-behavior} is non-@code{nil}, then this
 command does not use Emacs's internal @code{diff}.  This is the same
-as using @samp{alias diff '*diff $*'}.
+as using @samp{alias diff '*diff $@@*'}.
 
 @item dirname
 @cmindex dirname
@@ -517,9 +545,9 @@ but use Emacs's internal @code{grep} instead.
 
 If @code{eshell-plain-grep-behavior} is non-@code{nil}, then these
 commands do not use Emacs's internal @code{grep}.  This is the same as
-using @samp{alias grep '*grep $*'}, though this setting applies to all
-of the built-in commands for which you would need to create a separate
-alias.
+using @samp{alias grep '*grep $@@*'}, though this setting applies to
+all of the built-in commands for which you would need to create a
+separate alias.
 
 @item history
 @cmindex history
@@ -575,7 +603,7 @@ Alias to Emacs's @code{locate} function, which simply runs 
the external
 
 If @code{eshell-plain-locate-behavior} is non-@code{nil}, then Emacs's
 internal @code{locate} is not used.  This is the same as using
-@samp{alias locate '*locate $*'}.
+@samp{alias locate '*locate $@@*'}.
 
 @item ls
 @cmindex ls
@@ -999,24 +1027,47 @@ necessary.  Its value is 
@code{@var{emacs-version},eshell}.
 @node Aliases
 @section Aliases
 
-@vindex $*
+@findex eshell-read-aliases-list
 Aliases are commands that expand to a longer input line.  For example,
-@command{ll} is a common alias for @code{ls -l}, and would be defined
-with the command invocation @kbd{alias ll 'ls -l $*'}; with this defined,
-running @samp{ll foo} in Eshell will actually run @samp{ls -l foo}.
-Aliases defined (or deleted) by the @command{alias} command are
-automatically written to the file named by @code{eshell-aliases-file},
-which you can also edit directly (although you will have to manually
-reload it).
-
-@vindex $1, $2, @dots{}
+@command{ll} is a common alias for @code{ls -l}.  To define this alias
+in Eshell, you can use the command invocation @kbd{alias ll 'ls -l
+$@@*'}; with this defined, running @samp{ll foo} in Eshell will
+actually run @samp{ls -l foo}.  Aliases defined (or deleted) by the
+@command{alias} command are automatically written to the file named by
+@code{eshell-aliases-file}, which you can also edit directly.  After
+doing so, use @w{@kbd{M-x eshell-read-aliases-list}} to load the
+edited aliases.
+
 Note that unlike aliases in Bash, arguments must be handled
-explicitly.  Typically the alias definition would end in @samp{$*} to
-pass all arguments along.  More selective use of arguments via
-@samp{$1}, @samp{$2}, etc., is also possible.  For example,
+explicitly.  Within aliases, you can use the special variables
+@samp{$*}, @samp{$0}, @samp{$1}, @samp{$2}, etc. to refer to the
+arguments passed to the alias.
+
+@table @code
+
+@vindex $*
+@item $*
+This expands to the list of arguments passed to the alias.  For
+example, if you run @code{my-alias 1 2 3}, then @samp{$*} would be the
+list @code{(1 2 3)}.  Note that since this variable is a list, using
+@samp{$*} in an alias will pass this list as a single argument to the
+aliased command.  Therefore, when defining an alias, you should
+usually use @samp{$@@*} to pass all arguments along, splicing them
+into your argument list (@pxref{Dollars Expansion}).
+
+@vindex $0
+@item $0
+This expands to the name of the alias currently being executed.
+
+@vindex $1, $2, @dots{}, $9
+@item $1, $2, @dots{}, $9
+These variables expand to the nth argument (starting at 1) passed to
+the alias.  This lets you selectively use an alias's arguments, so
 @kbd{alias mcd 'mkdir $1 && cd $1'} would cause @kbd{mcd foo} to
 create and switch to a directory called @samp{foo}.
 
+@end table
+
 @node History
 @section History
 @cmindex history
@@ -1278,12 +1329,36 @@ to split the string.  @var{regexp} can be any form 
other than a
 number.  For example, @samp{$@var{var}[: 0]} will return the first
 element of a colon-delimited string.
 
+@cindex length operator, in variable expansion
 @item $#@var{expr}
-Expands to the length of the result of @var{expr}, an expression in
-one of the above forms.  For example, @samp{$#@var{var}} returns the
-length of the variable @var{var} and @samp{$#@var{var}[0]} returns the
-length of the first element of @var{var}.  Again, signals an error if
-the result of @var{expr} is not a string or a sequence.
+This is the @dfn{length operator}.  It expands to the length of the
+result of @var{expr}, an expression in one of the above forms.  For
+example, @samp{$#@var{var}} returns the length of the variable
+@var{var} and @samp{$#@var{var}[0]} returns the length of the first
+element of @var{var}.  Again, signals an error if the result of
+@var{expr} is not a string or a sequence.
+
+@cindex splice operator, in variable expansion
+@item $@@@var{expr}
+This is the @dfn{splice operator}.  It ``splices'' the elements of
+@var{expr} (an expression of one of the above forms) into the
+resulting list of arguments, much like the @samp{,@@} marker in Emacs
+Lisp (@pxref{Backquote, , , elisp, The Emacs Lisp Reference Manual}).
+The elements of @var{expr} become arguments at the same level as the
+other arguments around it.  For example, if @var{numbers} is the list
+@code{(1 2 3)}, then:
+
+@example
+@group
+~ $ echo 0 $numbers
+(0
+ (1 2 3))
+@end group
+@group
+~ $ echo 0 $@@numbers
+(0 1 2 3)
+@end group
+@end example
 
 @end table
 
@@ -2002,7 +2077,7 @@ Allow for a Bash-compatible syntax, such as:
 
 @example
 alias arg=blah
-function arg () @{ blah $* @}
+function arg () @{ blah $@@* @}
 @end example
 
 @item Pcomplete sometimes gets stuck
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index 1060cd805a..7b32f04aa8 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -67,9 +67,15 @@ Indices
 
 @node Overview
 @chapter Overview
-@dfn{EWW}, the Emacs Web Wowser, is a web browser for GNU Emacs.  It
-can load, parse, and display various web pages using @dfn{shr.el}.
-However, a GNU Emacs with @code{libxml2} support is required.
+
+@dfn{EWW}, the Emacs Web Wowser, is a web browser for GNU Emacs that
+provides a simple, no-frills experience that focuses on readability.
+It loads, parses, and displays web pages using @dfn{shr.el}.  It can
+display images inline, if Emacs was built with image support, but
+there is no support for CSS or JavaScript.
+
+To use EWW, you need to use an Emacs built with @code{libxml2}
+support.
 
 @node Basics
 @chapter Basic Usage
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index 4561b760c0..80e1bceb8e 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -847,7 +847,7 @@ Binding,,, elisp, The Emacs Lisp Reference Manual}) to be 
active.
 @findex flymake-proc-legacy-flymake
 The backend @code{flymake-proc-legacy-flymake} was originally designed
 to be extended for supporting new syntax check tools and error message
-patterns.  It is also controlled by its own set of customization variables
+patterns.  It is also controlled by its own set of customization variables.
 
 @node Proc customization variables
 @section Customization variables for the Proc backend
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index b0fef2b5b6..94c75ed30c 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -16808,8 +16808,7 @@ value is @code{nil}.
 Do @emph{not} use the same maildir both in @code{mail-sources} and as
 an @code{nnmaildir} group.  The results might happen to be useful, but
 that would be by chance, not by design, and the results might be
-different in the future.  If your split rules create new groups,
-remember to supply a @code{create-directory} server parameter.
+different in the future.
 @end table
 
 @node nnmaildir Group Parameters
@@ -20565,7 +20564,7 @@ returned value is required to be an integer.
 (score-fn (custom-scoring))
 @end example
 
-The user-defined function is called with an associative list with the
+The user-defined function is called with an association list with the
 keys @code{number subject from date id refs chars lines xref extra}
 followed by the article's score before the function is run.
 
diff --git a/doc/misc/org-setup.org b/doc/misc/org-setup.org
index 88474538e5..561f05d7d9 100644
--- a/doc/misc/org-setup.org
+++ b/doc/misc/org-setup.org
@@ -49,5 +49,5 @@
 
 # The "kbd" macro turns KBD into @kbd{KBD}.  Additionally, it
 # encloses case-sensitive special keys (SPC, RET...) within @key{...}.
-#+macro: kbd (eval (let ((case-fold-search nil) (regexp (regexp-opt '("SPC" 
"RET" "LFD" "TAB" "BS" "ESC" "DELETE" "SHIFT" "Ctrl" "Meta" "Alt" "Cmd" "Super" 
"UP" "LEFT" "RIGHT" "DOWN") 'words))) (format 
"@@texinfo:@kbd{@@%s@@texinfo:}@@" (replace-regexp-in-string regexp 
"@@texinfo:@key{@@\\&@@texinfo:}@@" $1 t))))
+#+macro: kbd (eval (org-texinfo-kbd-macro $1))
 
diff --git a/doc/misc/org.org b/doc/misc/org.org
index 6ad8c462cc..c6b8e73fd1 100644
--- a/doc/misc/org.org
+++ b/doc/misc/org.org
@@ -18,24 +18,30 @@
 :END:
 #+cindex: summary
 
-Org is a mode for keeping notes, maintaining TODO lists, and project
-planning with a fast and effective plain-text markup language.  It
-also is an authoring system with unique support for literate
-programming and reproducible research.
-
-Org is implemented on top of Outline mode, which makes it possible to
-keep the content of large files well structured.  Visibility cycling
-and structure editing help to work with the tree.  Tables are easily
-created with a built-in table editor.  Plain text URL-like links
-connect to websites, emails, Usenet messages, BBDB entries, and any
-files related to the projects.
+Org Mode is an authoring tool and a TODO lists manager for GNU Emacs.
+It relies on a lightweight plain-text markup language used in files
+with the =.org= extension.
+
+As an authoring tool, Org helps you write structured documents and
+provides exporting facilities. Org files can also be used for literate
+programming and reproducible research.  As a TODO lists manager, Org
+helps you organize your tasks in a flexible way, from daily needs to
+detailed project-planning, allowing logging, multiple views on your
+tasks, exporting your agendas, etc.
+
+Org mode is implemented on top of Outline mode, which makes it
+possible to keep the content of large files well structured.
+Visibility cycling and structure editing help to work with the tree.
+Tables are easily created with a built-in table editor.  Plain text
+URL-like links connect to websites, emails, Usenet messages, BBDB
+entries, and any files related to the projects.
 
 Org develops organizational tasks around notes files that contain
 lists or information about projects as plain text.  Project planning
 and task management make use of metadata which is part of an outline
 node.  Based on this data, specific entries can be extracted in
-queries and create dynamic /agenda views/ that also integrate the
-Emacs calendar and diary.  Org can be used to implement many different
+queries and create dynamic /agenda views/ that also integrate the Emacs
+calendar and diary.  Org can be used to implement many different
 project planning schemes, such as David Allen's GTD system.
 
 Org files can serve as a single source authoring system with export to
@@ -68,8 +74,8 @@ of Org, as well as additional information, frequently asked 
questions
 [[https://orgmode.org]].
 
 #+cindex: print edition
-An earlier version (7.3) of this manual was published as a paperback book by
-Network Theory Ltd. in 2010.
+An earlier version (7.3) of this manual was available as a paperback
+book from the Network Theory Ltd. publishing company, closed in 2009.
 
 ** Installation
 :PROPERTIES:
@@ -77,15 +83,18 @@ Network Theory Ltd. in 2010.
 :END:
 #+cindex: installation
 
-Org is included in all recent distributions of GNU Emacs, so you
-probably do not need to install it.  Most users will simply activate
-Org and begin exploring its many features.
+Org is included in distributions of GNU Emacs, you probably do not
+need to install it.  Most users will simply activate Org and begin
+exploring its features.
 
 If, for one reason or another, you want to install Org on top of this
 pre-packaged version, you can use the Emacs package system or clone
-Org's git repository.
+Org's git repository.  We *strongly recommend* sticking to a single
+installation method.
 
-We *strongly recommend* sticking to a single installation method.
+When installing Org on top of the pre-packaged version, please note
+that Org stable versions are meant to be fully compatible with the
+last three stable versions of Emacs but not with older Emacsen.
 
 *** Using Emacs packaging system
 :PROPERTIES:
@@ -121,8 +130,11 @@ Note that in this case, =make autoloads= is mandatory: it 
defines
 Org's version in =org-version.el= and Org's autoloads in
 =org-loaddefs.el=.
 
-Remember to add the correct load path as described in the method
-above.
+Make sure you set the load path correctly in your Emacs init file:
+
+#+begin_src emacs-lisp
+(add-to-list 'load-path "~/src/org-mode/lisp")
+#+end_src
 
 You can also compile with =make=, generate the documentation with
 =make doc=, create a local configuration with =make config= and
@@ -138,9 +150,13 @@ Org Build System page on 
[[https://orgmode.org/worg/dev/org-build-system.html][W
 :END:
 
 Org's repository used to contain =contrib/= directory for add-ons
-contributed by others.  As of Org 9.5, the directory has bee moved to
-this new dedicated [[https://git.sr.ht/~bzg/org-contrib][org-contrib]] 
repository, which you can install
-separately.
+contributed by others.  As of Org 9.5, the directory has been moved to
+the dedicated org-contrib [[https://git.sr.ht/~bzg/org-contrib][repository]], 
which you can install
+separately as a [[https://elpa.nongnu.org/nongnu/org-contrib.html][package]] 
from NonGNU ELPA.
+
+There are enough valuable packages maintained outside of the Org repository.
+Worg has a list of 
[[https://orgmode.org/worg/org-contrib/index.html][org-contrib and external 
packages]], certainly it is not
+exhaustive.
 
 ** Activation
 :PROPERTIES:
@@ -153,7 +169,8 @@ separately.
 #+cindex: key bindings, global
 
 Org mode buffers need Font Lock to be turned on: this is the default
-in Emacs[fn:1].
+in Emacs[fn:: If you do not use Font Lock globally turn it on in Org
+buffer with =(add-hook 'org-mode-hook #'turn-on-font-lock)=.].
 
 There are compatibility issues between Org mode and some other Elisp
 packages (see [[*Packages that conflict with Org mode]]).  Please take the
@@ -205,11 +222,17 @@ region by using the mouse to select a region, or pressing
 
 If you find problems with Org, or if you have questions, remarks, or
 ideas about it, please send an email to the Org mailing list
-[[mailto:emacs-orgmode@gnu.org]].  You can subscribe to the list 
[[https://lists.gnu.org/mailman/listinfo/emacs-orgmode][from this
-web page]].  If you are not a member of the mailing list, your mail will
-be passed to the list after a moderator has approved it[fn:2].  We ask
-you to read and respect the 
[[https://www.gnu.org/philosophy/kind-communication.html][GNU Kind 
Communications Guidelines]] when
-sending messages on this mailing list.
+[[mailto:emacs-orgmode@gnu.org]].  You can subscribe to the list
+[[https://lists.gnu.org/mailman/listinfo/emacs-orgmode][from this web
+page]].  If you are not a member of the mailing list, your mail will
+be passed to the list after a moderator has approved it[fn:: Please
+consider subscribing to the mailing list in order to minimize the work
+the mailing list moderators have to do.].  We ask you to read and
+respect the
+[[https://www.gnu.org/philosophy/kind-communication.html][GNU Kind
+Communications Guidelines]] when sending messages on this mailing
+list.  Please allow up to one month for the response and followup if
+no response is received on the bug report.
 
 #+findex: org-version
 #+findex: org-submit-bug-report
@@ -256,6 +279,14 @@ shown below.
 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
 #+end_src
 
+If you are using Org mode version from Git repository, you can start
+minimal session using make.
+
+: # Bare Emacs
+: make repro
+: # or pass extra arguments
+: make repro REPRO_ARGS="-l /path/to/minimal/config.el /tmp/bug.org"
+
 If an error occurs, a "backtrace" can be very useful---see below on
 how to create one.  Often a small example file helps, along with clear
 information about:
@@ -380,7 +411,7 @@ the entire show and hide functionalities into a single 
command,
 #+vindex: org-ctrl-k-protect-subtree
 
 Headlines define the structure of an outline tree.  Org headlines
-start on the left margin[fn:3] with one or more stars followed by
+start on the left margin[fn:1] with one or more stars followed by
 a space.  For example:
 
 #+begin_example
@@ -449,7 +480,8 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
   #+end_example
 
   #+vindex: org-cycle-emulate-tab
-  Point must be on a headline for this to work[fn:4].
+  Point must be on a headline for this to work[fn:: See, however, the
+  option ~org-cycle-emulate-tab~.].
 
 - {{{kbd(S-TAB)}}} (~org-global-cycle~), {{{kbd(C-u TAB)}}} ::
 
@@ -488,11 +520,11 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
   Switch back to the startup visibility of the buffer (see [[*Initial
   visibility]]).
 
-- {{{kbd(C-u C-u C-u TAB)}}} (~outline-show-all~) ::
+- {{{kbd(C-u C-u C-u TAB)}}} (~org-show-all~) ::
 
   #+cindex: show all, command
   #+kindex: C-u C-u C-u TAB
-  #+findex: outline-show-all
+  #+findex: org-show-all
   Show all, including drawers.
 
 - {{{kbd(C-c C-r)}}} (~org-reveal~) ::
@@ -508,18 +540,18 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
   headings.  With a double prefix argument, also show the entire
   subtree of the parent.
 
-- {{{kbd(C-c C-k)}}} (~outline-show-branches~) ::
+- {{{kbd(C-c C-k)}}} (~org-show-branches~) ::
 
   #+cindex: show branches, command
   #+kindex: C-c C-k
-  #+findex: outline-show-branches
+  #+findex: org-show-branches
   Expose all the headings of the subtree, but not their bodies.
 
-- {{{kbd(C-c TAB)}}} (~outline-show-children~) ::
+- {{{kbd(C-c TAB)}}} (~org-show-children~) ::
 
   #+cindex: show children, command
   #+kindex: C-c TAB
-  #+findex: outline-show-children
+  #+findex: org-show-children
   Expose all direct children of the subtree.  With a numeric prefix
   argument {{{var(N)}}}, expose all children down to level
   {{{var(N)}}}.
@@ -528,7 +560,7 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
 
   #+kindex: C-c C-x b
   #+findex: org-tree-to-indirect-buffer
-  Show the current subtree in an indirect buffer[fn:5].  With
+  Show the current subtree in an indirect buffer[fn:2].  With
   a numeric prefix argument {{{var(N)}}}, go up to level {{{var(N)}}}
   and then take that tree.  If {{{var(N)}}} is negative then go up
   that many levels.  With a {{{kbd(C-u)}}} prefix, do not remove the
@@ -547,10 +579,12 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
 
 #+vindex: org-startup-folded
 When Emacs first visits an Org file, the global state is set to
-~showeverything~, i.e., all file content is visible[fn:6].  This can
-be configured through the variable ~org-startup-folded~, or on
-a per-file basis by adding one of the following lines anywhere in the
-buffer:
+~showeverything~, i.e., all file content is visible[fn:: When
+~org-agenda-inhibit-startup~ is non-~nil~, Org does not honor the
+default visibility state when first opening a file for the agenda (see
+[[*Speeding Up Your Agendas]]).].  This can be configured through the
+variable ~org-startup-folded~, or on a per-file basis by adding one of
+the following lines anywhere in the buffer:
 
 #+cindex: @samp{STARTUP}, keyword
 #+begin_example
@@ -583,10 +617,10 @@ for this property are =folded=, =children=, =content=, 
and =all=.
 :END:
 #+cindex: edits, catching invisible
 
-#+vindex: org-catch-invisible-edits
+#+vindex: org-fold-catch-invisible-edits
 Sometimes you may inadvertently edit an invisible part of the buffer
 and be confused on what has been edited and how to undo the mistake.
-Setting ~org-catch-invisible-edits~ to non-~nil~ helps preventing
+Setting ~org-fold-catch-invisible-edits~ to non-~nil~ helps preventing
 this.  See the docstring of this option on how Org should catch
 invisible edits and process them.
 
@@ -897,8 +931,10 @@ keys have different functionality.
 An important feature of Org mode is the ability to construct /sparse
 trees/ for selected information in an outline tree, so that the entire
 document is folded as much as possible, but the selected information
-is made visible along with the headline structure above it[fn:7].
-Just try it out and you will see immediately how it works.
+is made visible along with the headline structure above it[fn:: See
+also the variable ~org-show-context-detail~ to decide how much context
+is shown around each match.].  Just try it out and you will see
+immediately how it works.
 
 Org mode contains several commands creating such trees, all these
 commands can be accessed through a dispatcher:
@@ -916,16 +952,18 @@ commands can be accessed through a dispatcher:
   #+kindex: C-c / /
   #+findex: org-occur
   #+vindex: org-remove-highlights-with-change
-  Prompts for a regexp (see [[*Regular Expressions]]) and shows a sparse
-  tree with all matches.  If the match is in a headline, the headline
-  is made visible.  If the match is in the body of an entry, headline
-  and body are made visible.  In order to provide minimal context,
-  also the full hierarchy of headlines above the match is shown, as
-  well as the headline following the match.  Each match is also
-  highlighted; the highlights disappear when the buffer is changed by
-  an editing command, or by pressing {{{kbd(C-c C-c)}}}[fn:8].  When
-  called with a {{{kbd(C-u)}}} prefix argument, previous highlights
-  are kept, so several calls to this command can be stacked.
+  Prompts for a regexp (see [[*Regular Expressions]]) and shows a
+  sparse tree with all matches.  If the match is in a headline, the
+  headline is made visible.  If the match is in the body of an entry,
+  headline and body are made visible.  In order to provide minimal
+  context, also the full hierarchy of headlines above the match is
+  shown, as well as the headline following the match.  Each match is
+  also highlighted; the highlights disappear when the buffer is
+  changed by an editing command, or by pressing {{{kbd(C-c
+  C-c)}}}[fn:: This depends on the option
+  ~org-remove-highlights-with-change~.].  When called with a
+  {{{kbd(C-u)}}} prefix argument, previous highlights are kept, so
+  several calls to this command can be stacked.
 
 - {{{kbd(M-g n)}}} or {{{kbd(M-g M-n)}}} (~next-error~) ::
 
@@ -986,17 +1024,18 @@ every exporter (see [[*Exporting]]) can parse and format 
them.
 Org knows ordered lists, unordered lists, and description lists.
 
 #+attr_texinfo: :indic @bullet
-- /Unordered/ list items start with =-=, =+=, or =*=[fn:9] as bullets.
+- /Unordered/ list items start with =-=, =+=, or =*=[fn:3] as bullets.
 
 -
   #+vindex: org-plain-list-ordered-item-terminator
   #+vindex: org-alphabetical-lists
-  /Ordered/ list items start with a numeral followed by either
-  a period or a right parenthesis[fn:10], such as =1.= or =1)=[fn:11]
-  If you want a list to start with a different value---e.g.,
-  20---start the text of the item with =[@20]=[fn:12].  Those
-  constructs can be used in any item of the list in order to enforce
-  a particular numbering.
+  /Ordered/ list items start with a numeral followed by either a
+  period or a right parenthesis[fn:: You can filter out any of them by
+  configuring ~org-plain-list-ordered-item-terminator~.], such as =1.=
+  or =1)=[fn:4] If you want a list to start with a different
+  value---e.g., 20---start the text of the item with =[@20]=[fn:5].
+  Those constructs can be used in any item of the list in order to
+  enforce a particular numbering.
 
 - /Description/ list items are unordered list items, and contain the
   separator =::= to distinguish the description /term/ from the
@@ -1075,12 +1114,13 @@ to disable them individually.
   #+kindex: M-RET
   #+findex: org-insert-heading
   #+vindex: org-M-RET-may-split-line
-  Insert new item at current level.  With a prefix argument, force
-  a new heading (see [[*Structure Editing]]).  If this command is used in
-  the middle of an item, that item is /split/ in two, and the second
-  part becomes the new item[fn:13].  If this command is executed
-  /before item's body/, the new item is created /before/ the current
-  one.
+  Insert new item at current level.  With a prefix argument, force a
+  new heading (see [[*Structure Editing]]).  If this command is used
+  in the middle of an item, that item is /split/ in two, and the
+  second part becomes the new item[fn:: If you do not want the item to
+  be split, customize the variable ~org-M-RET-may-split-line~.].  If
+  this command is executed /before item's body/, the new item is
+  created /before/ the current one.
 
 - {{{kbd(M-S-RET)}}} ::
 
@@ -1095,17 +1135,19 @@ to disable them individually.
   #+vindex: org-support-shift-select
   #+vindex: org-list-use-circular-motion
   Jump to the previous/next item in the current list, but only if
-  ~org-support-shift-select~ is off[fn:14].  If not, you can still use
-  paragraph jumping commands like {{{kbd(C-UP)}}} and
-  {{{kbd(C-DOWN)}}} to quite similar effect.
+  ~org-support-shift-select~ is off[fn:: If you want to cycle around
+  items that way, you may customize ~org-list-use-circular-motion~.].
+  If not, you can still use paragraph jumping commands like
+  {{{kbd(C-UP)}}} and {{{kbd(C-DOWN)}}} to quite similar effect.
 
 - {{{kbd(M-UP)}}}, {{{kbd(M-DOWN)}}} ::
 
   #+kindex: M-UP
   #+kindex: M-DOWN
-  Move the item including subitems up/down[fn:15], i.e., swap with
-  previous/next item of same indentation.  If the list is ordered,
-  renumbering is automatic.
+  Move the item including subitems up/down[fn:: See
+  ~org-list-use-circular-motion~ for a cyclic behavior.], i.e., swap
+  with previous/next item of same indentation.  If the list is
+  ordered, renumbering is automatic.
 
 - {{{kbd(M-LEFT)}}}, {{{kbd(M-RIGHT)}}} ::
 
@@ -1214,7 +1256,7 @@ Org mode uses this special drawer for storing properties 
(see
 [[*Properties and Columns]]).  You cannot use it for anything else.
 
 Completion over drawer keywords is also possible using
-{{{kbd(M-TAB)}}}[fn:16].
+{{{kbd(M-TAB)}}}[fn:6].
 
 Visibility cycling (see [[*Visibility Cycling]]) on the headline hides and
 shows the entry, but keep the drawer collapsed to a single line.  In
@@ -1274,10 +1316,11 @@ Calculator Manual]]).
 #+cindex: table syntax
 Org makes it easy to format tables in plain ASCII.  Any line with =|=
 as the first non-whitespace character is considered part of a table.
-=|= is also the column separator[fn:17].  Moreover, a line starting
-with =|-= is a horizontal rule.  It separates rows explicitly.  Rows
-before the first horizontal rule are header lines.  A table might look
-like this:
+=|= is also the column separator[fn:: To insert a vertical bar into a
+table field, use =\vert= or, inside a word =abc\vert{}def=.].
+Moreover, a line starting with =|-= is a horizontal rule.  It
+separates rows explicitly.  Rows before the first horizontal rule are
+header lines.  A table might look like this:
 
 #+begin_example
 | Name  | Phone | Age |
@@ -1358,7 +1401,7 @@ you, configure the option ~org-table-auto-blank-field~.
 - {{{kbd(M-x org-table-blank-field)}}} ::
 
   #+findex: org-table-blank-field
-  Blank the field at point.
+  Blank the current table field or active region.
 
 - {{{kbd(S-TAB)}}} (~org-table-previous-field~) ::
 
@@ -1839,7 +1882,7 @@ Formulas can reference the value of another field in two 
ways.  Like
 in any other spreadsheet, you may reference fields with
 a letter/number combination like =B3=, meaning the second field in the
 third row.  However, Org prefers to use another, more general
-representation that looks like this:[fn:18]
+representation that looks like this:[fn:7]
 
 : @ROW$COLUMN
 
@@ -1946,7 +1989,9 @@ and ~org-table-current-column~.  Examples:
 #+texinfo: @noindent
 For the second and third examples, table {{{var(FOO)}}} must have at
 least as many rows or columns as the current table.  Note that this is
-inefficient[fn:19] for large number of rows.
+inefficient[fn:: The computation time scales as O(N^2) because table
+{{{var(FOO)}}} is parsed for each field to be copied.] for large
+number of rows.
 
 **** Named references
 :PROPERTIES:
@@ -1974,7 +2019,7 @@ constants in table formulas: for a property =Xyz= use the 
name
 entry and in the hierarchy above it.  If you have the =constants.el=
 package, it will also be used to resolve constants, including natural
 constants like =$h= for Planck's constant, and units like =$km= for
-kilometers[fn:20].  Column names and parameters can be specified in
+kilometers[fn:8].  Column names and parameters can be specified in
 special table lines.  These are described below, see [[*Advanced
 features]].  All names must start with a letter, and further consist
 of letters and numbers.
@@ -2095,7 +2140,7 @@ Unless you use large integer numbers or high-precision 
calculation and
 display for floating point numbers you may alternatively provide
 a ~printf~ format specifier to reformat the Calc result after it has
 been passed back to Org instead of letting Calc already do the
-formatting[fn:21].  A few examples:
+formatting[fn:9].  A few examples:
 
 | =$1+$2=            | Sum of first and second field                    |
 | =$1+$2;%.2f=       | Same, format result to two decimals              |
@@ -2124,7 +2169,7 @@ Operations]]).  For example
   required to not convert empty fields to 0.  =f-1= is an optional
   Calc format string similar to =%.1f= but leaves empty results empty.
 
-- =if(typeof(vmean($1..$7)) =​= 12, string(""), vmean($1..$7); E= ::
+- =if(typeof(vmean($1..$7)) =​= 12, string(""), vmean($1..$7)); E= ::
 
   Mean value of a range unless there is any empty field.  Every field
   in the range that is empty is replaced by =nan= which lets =vmean=
@@ -2620,11 +2665,11 @@ keyword.
 #+cindex: debugging, of table formulas
 
 When the evaluation of a formula leads to an error, the field content
-becomes the string =#ERROR=.  If you would like to see what is going
-on during variable substitution and calculation in order to find
-a bug, turn on formula debugging in the Tbl menu and repeat the
-calculation, for example by pressing {{{kbd(C-u C-u C-c = RET)}}} in
-a field.  Detailed information are displayed.
+becomes the string =#ERROR=.  If you want to see what is going on
+during variable substitution and calculation in order to find a bug,
+turn on formula debugging in the Tbl menu and repeat the calculation,
+for example by pressing {{{kbd(C-u C-u C-c = RET)}}} in a field.
+Detailed information are displayed.
 
 *** Updating the table
 :PROPERTIES:
@@ -2682,9 +2727,10 @@ following commands:
 :END:
 
 If you want the recalculation of fields to happen automatically, or if
-you want to be able to assign /names/[fn:22] to fields and columns,
-you need to reserve the first column of the table for special marking
-characters.
+you want to be able to assign /names/[fn:: Such names must start with
+an alphabetic character and use only alphanumeric/underscore
+characters.] to fields and columns, you need to reserve the first
+column of the table for special marking characters.
 
 - {{{kbd(C-#)}}} (~org-table-rotate-recalc-marks~) ::
 
@@ -2991,7 +3037,7 @@ links to other files, Usenet articles, emails, and much 
more.
 #+cindex: angle bracket links
 #+cindex: plain links
 Org recognizes plain URIs, possibly wrapped within angle
-brackets[fn:23], and activate them as clickable links.
+brackets[fn:10], and activate them as clickable links.
 
 #+cindex: bracket links
 The general link format, however, looks like this:
@@ -3035,11 +3081,13 @@ the {{{var(LINK)}}} part, if there is no description, 
or the
 
 If you place point at the beginning or just behind the end of the
 displayed text and press {{{kbd(BS)}}}, you remove
-the---invisible---bracket at that location[fn:24].  This makes the link
+the---invisible---bracket at that location[fn:: More accurately, the
+precise behavior depends on how point arrived there---see
+[[info:elisp#Invisible Text][Invisible Text]].].  This makes the link
 incomplete and the internals are again displayed as plain text.
 Inserting the missing bracket hides the link internals again.  To show
-the internal structure of all links, use the menu: Org \rarr Hyperlinks \rarr
-Literal links.
+the internal structure of all links, use the menu: Org \rarr
+Hyperlinks \rarr Literal links.
 
 ** Internal Links
 :PROPERTIES:
@@ -3058,7 +3106,7 @@ Org provides several refinements to internal navigation 
within
 a document.  Most notably, a construct like =[[#my-custom-id]]=
 specifically targets the entry with the =CUSTOM_ID= property set to
 =my-custom-id=.  Also, an internal link looking like =[[*Some
-section]]= points to a headline with the name =Some section=[fn:25].
+section]]= points to a headline with the name =Some section=[fn:11].
 
 #+cindex: targets, for links
 When the link does not belong to any of the cases above, Org looks for
@@ -3091,8 +3139,9 @@ you in the process, if needed.  See [[*Org Syntax]].
 During export, internal links are used to mark objects and assign them
 a number.  Marked objects are then referenced by links pointing to
 them.  In particular, links without a description appear as the number
-assigned to the marked object[fn:26].  In the following excerpt from
-an Org buffer
+assigned to the marked object[fn:: When targeting a =NAME= keyword,
+the =CAPTION= keyword is mandatory in order to get proper numbering
+(see [[*Captions]]).].  In the following excerpt from an Org buffer
 
 #+begin_example
 1. one item
@@ -3234,7 +3283,7 @@ options:
 
 | Link Type  | Example                                                  |
 |------------+----------------------------------------------------------|
-| http       | =https://staff.science.uva.nl/c.dominik/=                |
+| http       | =http://staff.science.uva.nl/c.dominik/=                 |
 | https      | =https://orgmode.org/=                                   |
 | doi        | =doi:10.1000/182=                                        |
 | file       | =file:/home/dominik/images/jupiter.jpg=                  |
@@ -3245,7 +3294,7 @@ options:
 |            | =/ssh:me@some.where:papers/last.pdf= (same as above)     |
 |            | =file:sometextfile::NNN= (jump to line number)           |
 |            | =file:projects.org=                                      |
-|            | =file:projects.org::some words= (text search)[fn:27]     |
+|            | =file:projects.org::some words= (text search)[fn:12]     |
 |            | =file:projects.org::*task title= (headline search)       |
 |            | =file:projects.org::#custom-id= (headline search)        |
 | attachment | =attachment:projects.org=                                |
@@ -3328,7 +3377,7 @@ current buffer:
 
   For Org files, if there is a =<<target>>= at point, the link points
   to the target.  Otherwise it points to the current headline, which
-  is also the description[fn:28].
+  is also the description.
 
   #+vindex: org-id-link-to-org-use-id
   #+cindex: @samp{CUSTOM_ID}, property
@@ -3336,12 +3385,15 @@ current buffer:
   If the headline has a =CUSTOM_ID= property, store a link to this
   custom ID.  In addition or alternatively, depending on the value of
   ~org-id-link-to-org-use-id~, create and/or use a globally unique
-  =ID= property for the link[fn:29].  So using this command in Org
-  buffers potentially creates two links: a human-readable link from
-  the custom ID, and one that is globally unique and works even if the
-  entry is moved from file to file.  The =ID= property can be either a
-  UUID (default) or a timestamp, depending on ~org-id-method~.  Later,
-  when inserting the link, you need to decide which one to use.
+  =ID= property for the link[fn:: The Org Id library must first be
+  loaded, either through ~org-customize~, by enabling ~id~ in
+  ~org-modules~, or by adding =(require 'org-id)= in your Emacs init
+  file.].  So using this command in Org buffers potentially creates
+  two links: a human-readable link from the custom ID, and one that is
+  globally unique and works even if the entry is moved from file to
+  file.  The =ID= property can be either a UUID (default) or a
+  timestamp, depending on ~org-id-method~.  Later, when inserting the
+  link, you need to decide which one to use.
 
 - /Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus/ ::
 
@@ -3398,11 +3450,11 @@ generally, act on links.
   #+cindex: completion, of links
   #+cindex: inserting links
   #+vindex: org-link-keep-stored-after-insertion
-  Insert a link[fn:30].  This prompts for a link to be inserted into
+  Insert a link[fn:13].  This prompts for a link to be inserted into
   the buffer.  You can just type a link, using text for an internal
   link, or one of the link type prefixes mentioned in the examples
   above.  The link is inserted into the buffer, along with
-  a descriptive text[fn:31].  If some text was selected at this time,
+  a descriptive text[fn:14].  If some text was selected at this time,
   it becomes the default description.
 
   - /Inserting stored links/ ::
@@ -3417,11 +3469,12 @@ generally, act on links.
     prefixes like =http= or =ftp=, including the prefixes defined
     through link abbreviations (see [[*Link Abbreviations]]).  If you
     press {{{kbd(RET)}}} after inserting only the prefix, Org offers
-    specific completion support for some link types[fn:32].  For
-    example, if you type {{{kbd(f i l e RET)}}}---alternative access:
-    {{{kbd(C-u C-c C-l)}}}, see below---Org offers file name
-    completion, and after {{{kbd(b b d b RET)}}} you can complete
-    contact names.
+    specific completion support for some link types[fn:: This works if
+    a function has been defined in the ~:complete~ property of a link
+    in ~org-link-parameters~.].  For example, if you type {{{kbd(f i l
+    e RET)}}}---alternative access: {{{kbd(C-u C-c C-l)}}}, see
+    below---Org offers file name completion, and after {{{kbd(b b d b
+    RET)}}} you can complete contact names.
 
 - {{{kbd(C-u C-c C-l)}}} ::
 
@@ -3488,7 +3541,8 @@ generally, act on links.
   #+vindex: org-link-use-indirect-buffer-for-internals
   #+kindex: mouse-3
   Like {{{kbd(mouse-2)}}}, but force file links to be opened with
-  Emacs, and internal links to be displayed in another window[fn:33].
+  Emacs, and internal links to be displayed in another window[fn:: See
+  the variable ~org-link-use-indirect-buffer-for-internals~.].
 
 - {{{kbd(C-c %)}}} (~org-mark-ring-push~) ::
 
@@ -3566,7 +3620,7 @@ replacement text.  Here is an example:
 (setq org-link-abbrev-alist
       '(("bugzilla"        . "http://10.1.2.9/bugzilla/show_bug.cgi?id=";)
         ("Nu Html Checker" . "https://validator.w3.org/nu/?doc=%h";)
-       ("duckduckgo"      . "https://duckduckgo.com/?q=%s";)
+        ("duckduckgo"      . "https://duckduckgo.com/?q=%s";)
         ("omap"            . 
"https://nominatim.openstreetmap.org/search?q=%s&polygon=1";)
         ("ads"             . 
"https://ui.adsabs.harvard.edu/search/q=%20author%3A\"%s\"";)))
 #+end_src
@@ -3598,8 +3652,11 @@ can define them in the file with
 #+begin_example
 ,#+LINK: bugzilla  https://10.1.2.9/bugzilla/show_bug.cgi?id=
 ,#+LINK: duckduckgo https://duckduckgo.com/?q=%s
+,#+LINK: "Nu Html Checker" https://validator.w3.org/nu/?doc=%h
 #+end_example
 
+The abbreviations containing spaces must be quoted.
+
 In-buffer completion (see [[*Completion]]) can be used after =[= to
 complete link abbreviations.  You may also define a Lisp function that
 implements special (e.g., completion) support for inserting such a
@@ -3622,11 +3679,12 @@ the link completion function like this:
 
 File links can contain additional information to make Emacs jump to a
 particular location in the file when following a link.  This can be a
-line number or a search option after a double colon[fn:34].  For
+line number or a search option after a double colon[fn:: For backward
+compatibility, line numbers can also follow a single colon.].  For
 example, when the command ~org-store-link~ creates a link (see
-[[*Handling Links]]) to a file, it encodes the words in the current line
-as a search string that can be used to find this line back later when
-following the link with {{{kbd(C-c C-o)}}}.
+[[*Handling Links]]) to a file, it encodes the words in the current
+line as a search string that can be used to find this line back later
+when following the link with {{{kbd(C-c C-o)}}}.
 
 Note that all search options apply for Attachment links in the same
 way that they apply for File links.
@@ -3706,12 +3764,13 @@ implementation example.  See the file =ol-bibtex.el=.
 :END:
 #+cindex: TODO items
 
-Org mode does not maintain TODO lists as separate documents[fn:35].
-Instead, TODO items are an integral part of the notes file, because
-TODO items usually come up while taking notes!  With Org mode, simply
-mark any entry in a tree as being a TODO item.  In this way,
-information is not duplicated, and the entire context from which the
-TODO item emerged is always present.
+Org mode does not maintain TODO lists as separate documents[fn:: Of
+course, you can make a document that contains only long lists of TODO
+items, but this is not required.].  Instead, TODO items are an
+integral part of the notes file, because TODO items usually come up
+while taking notes!  With Org mode, simply mark any entry in a tree as
+being a TODO item.  In this way, information is not duplicated, and
+the entire context from which the TODO item emerged is always present.
 
 Of course, this technique for managing TODO items scatters them
 throughout your notes file.  Org mode compensates for this by
@@ -3825,7 +3884,9 @@ TODO items in particular (see [[*Tags]]).
 #+cindex: workflow states as TODO keywords
 
 You can use TODO keywords to indicate different, possibly /sequential/
-states in the process of working on an item, for example[fn:36]:
+states in the process of working on an item, for example[fn:: Changing
+the variable ~org-todo-keywords~ only becomes effective after
+restarting Org mode in a buffer.]:
 
 #+begin_src emacs-lisp
 (setq org-todo-keywords
@@ -3874,22 +3935,22 @@ Using TODO types, it would be set up like this:
 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
 #+end_src
 
-In this case, different keywords do not indicate states, but
-rather different types.  So the normal work flow would be to assign
-a task to a person, and later to mark it DONE.  Org mode supports this
-style by adapting the workings of the command {{{kbd(C-c
-C-t)}}}[fn:37].  When used several times in succession, it still
-cycles through all names, in order to first select the right type for
-a task.  But when you return to the item after some time and execute
-{{{kbd(C-c C-t)}}} again, it will switch from any name directly to
-=DONE=.  Use prefix arguments or completion to quickly select
-a specific name.  You can also review the items of a specific TODO
-type in a sparse tree by using a numeric prefix to {{{kbd(C-c / t)}}}.
-For example, to see all things Lucy has to do, you would use
-{{{kbd(C-3 C-c / t)}}}.  To collect Lucy's items from all agenda files
-into a single buffer, you would use the numeric prefix argument as
-well when creating the global TODO list: {{{kbd(C-3 M-x org-agenda
-t)}}}.
+In this case, different keywords do not indicate states, but rather
+different types.  So the normal work flow would be to assign a task to
+a person, and later to mark it DONE.  Org mode supports this style by
+adapting the workings of the command {{{kbd(C-c C-t)}}}[fn:: This is
+also true for the {{{kbd(t)}}} command in the agenda buffer.].  When
+used several times in succession, it still cycles through all names,
+in order to first select the right type for a task.  But when you
+return to the item after some time and execute {{{kbd(C-c C-t)}}}
+again, it will switch from any name directly to =DONE=.  Use prefix
+arguments or completion to quickly select a specific name.  You can
+also review the items of a specific TODO type in a sparse tree by
+using a numeric prefix to {{{kbd(C-c / t)}}}.  For example, to see all
+things Lucy has to do, you would use {{{kbd(C-3 C-c / t)}}}.  To
+collect Lucy's items from all agenda files into a single buffer, you
+would use the numeric prefix argument as well when creating the global
+TODO list: {{{kbd(C-3 M-x org-agenda t)}}}.
 
 *** Multiple keyword sets in one file
 :PROPERTIES:
@@ -3950,8 +4011,9 @@ correct sequence.  In addition to typing a keyword or 
using completion
 If you would like to quickly change an entry to an arbitrary TODO
 state instead of cycling through the states, you can set up keys for
 single-letter access to the states.  This is done by adding the
-selection character after each keyword, in parentheses[fn:38].  For
-example:
+selection character after each keyword, in parentheses[fn:: All
+characters are allowed except =@=, =^= and =!=, which have a special
+meaning here.].  For example:
 
 #+begin_src emacs-lisp
 (setq org-todo-keywords
@@ -3963,7 +4025,7 @@ example:
 #+vindex: org-fast-tag-selection-include-todo
 If you then press {{{kbd(C-c C-t)}}} followed by the selection key,
 the entry is switched to this state.  {{{kbd(SPC)}}} can be used to
-remove any TODO keyword from an entry[fn:39].
+remove any TODO keyword from an entry[fn:15].
 
 *** Setting up keywords for individual files
 :PROPERTIES:
@@ -4008,7 +4070,10 @@ Remember that the keywords after the vertical bar---or 
the last
 keyword if no bar is there---must always mean that the item is DONE,
 although you may use a different word.  After changing one of these
 lines, use {{{kbd(C-c C-c)}}} with point still in the line to make the
-changes known to Org mode[fn:40].
+changes known to Org mode[fn:: Org mode parses these lines only when
+Org mode is activated after visiting a file. {{{kbd(C-c C-c)}}} with
+point in a line starting with =#+= is simply restarting Org mode for
+the current buffer.].
 
 *** Faces for TODO keywords
 :PROPERTIES:
@@ -4151,7 +4216,8 @@ clock working time for a task, see [[*Clocking Work 
Time]].
 :END:
 
 The most basic automatic logging is to keep track of /when/ a certain
-TODO item was marked as done.  This can be achieved with[fn:41]
+TODO item was marked as done.  This can be achieved with[fn:: The
+corresponding in-buffer setting is: =#+STARTUP: logdone=.]
 
 #+begin_src emacs-lisp
 (setq org-log-done 'time)
@@ -4165,8 +4231,9 @@ after the headline.  If you turn the entry back into a 
TODO item
 through further state cycling, that line is removed again.  If you
 turn the entry back to a non-TODO state (by pressing {{{kbd(C-c C-t
 SPC)}}} for example), that line is also removed, unless you set
-~org-closed-keep-when-no-todo~ to non-~nil~.  If you want to record
-a note along with the timestamp, use[fn:42]
+~org-closed-keep-when-no-todo~ to non-~nil~.  If you want to record a
+note along with the timestamp, use[fn:: The corresponding in-buffer
+setting is: =#+STARTUP: lognotedone=.]
 
 #+begin_src emacs-lisp
 (setq org-log-done 'note)
@@ -4188,13 +4255,16 @@ entry with a =Closing Note= heading.
 You might want to automatically keep track of when a state change
 occurred and maybe take a note about this change.  You can either
 record just a timestamp, or a time-stamped note.  These records are
-inserted after the headline as an itemized list, newest first[fn:43].
-When taking a lot of notes, you might want to get the notes out of the
-way into a drawer (see [[*Drawers]]).  Customize the variable
-~org-log-into-drawer~ to get this behavior---the recommended drawer
-for this is called =LOGBOOK=[fn:44].  You can also overrule the
-setting of this variable for a subtree by setting a =LOG_INTO_DRAWER=
-property.
+inserted after the headline as an itemized list, newest first[fn:: See
+the variable ~org-log-states-order-reversed~.].  When taking a lot of
+notes, you might want to get the notes out of the way into a drawer
+(see [[*Drawers]]).  Customize the variable ~org-log-into-drawer~ to
+get this behavior---the recommended drawer for this is called
+=LOGBOOK=[fn:: Note that the =LOGBOOK= drawer is unfolded when
+pressing {{{kbd(SPC)}}} in the agenda to show an entry---use
+{{{kbd(C-u SPC)}}} to keep it folded here.].  You can also overrule
+the setting of this variable for a subtree by setting a
+=LOG_INTO_DRAWER= property.
 
 Since it is normally too much to record a note for every state, Org
 mode expects configuration on a per-keyword basis for this.  This is
@@ -4211,7 +4281,7 @@ example, with the setting
 You not only define global TODO keywords and fast access keys, but
 also request that a time is recorded when the entry is set to =DONE=,
 and that a note is recorded when switching to =WAIT= or
-=CANCELED=[fn:45].  The setting for =WAIT= is even more special: the
+=CANCELED=[fn:16].  The setting for =WAIT= is even more special: the
 =!= after the slash means that in addition to the note taken when
 entering the state, a timestamp should be recorded when /leaving/ the
 =WAIT= state, if and only if the /target/ state does not configure
@@ -4260,7 +4330,7 @@ specific settings like =TODO(!)=.  For example:
 #+cindex: @samp{STYLE}, property
 
 Org has the ability to track the consistency of a special category of
-TODO, called "habits."  To use habits, you have to enable the ~habits~
+TODO, called "habits."  To use habits, you have to enable the ~habit~
 module by customizing the variable ~org-modules~.
 
 A habit has the following properties:
@@ -4416,10 +4486,11 @@ TODO items.
   #+findex: org-priority-up
   #+findex: org-priority-down
   #+vindex: org-priority-start-cycle-with-default
-  Increase/decrease the priority of the current headline[fn:46].  Note
-  that these keys are also used to modify timestamps (see [[*Creating
-  Timestamps]]).  See also [[*Packages that conflict with Org mode]], for
-  a discussion of the interaction with shift-selection.
+  Increase/decrease the priority of the current headline[fn:: See also
+  the option ~org-priority-start-cycle-with-default~.].  Note that
+  these keys are also used to modify timestamps (see [[*Creating
+  Timestamps]]).  See also [[*Packages that conflict with Org mode]],
+  for a discussion of the interaction with shift-selection.
 
 #+vindex: org-priority-highest
 #+vindex: org-priority-lowest
@@ -4448,11 +4519,13 @@ Or, using numeric values:
 #+vindex: org-agenda-todo-list-sublevels
 It is often advisable to break down large tasks into smaller,
 manageable subtasks.  You can do this by creating an outline tree
-below a TODO item, with detailed subtasks on the tree[fn:47].  To keep
-an overview of the fraction of subtasks that have already been marked
-as done, insert either =[/]= or =[%]= anywhere in the headline.  These
-cookies are updated each time the TODO status of a child changes, or
-when pressing {{{kbd(C-c C-c)}}} on the cookie.  For example:
+below a TODO item, with detailed subtasks on the tree[fn:: To keep
+subtasks out of the global TODO list, see the option
+~org-agenda-todo-list-sublevels~.].  To keep an overview of the
+fraction of subtasks that have already been marked as done, insert
+either =[/]= or =[%]= anywhere in the headline.  These cookies are
+updated each time the TODO status of a child changes, or when pressing
+{{{kbd(C-c C-c)}}} on the cookie.  For example:
 
 #+begin_example
 ,* Organize Party [33%]
@@ -4475,7 +4548,7 @@ in the subtree (not just direct children), configure the 
variable
 include the word =recursive= into the value of the =COOKIE_DATA=
 property.
 
-#+begin_example org
+#+begin_example
 ,* Parent capturing statistics [2/20]
   :PROPERTIES:
   :COOKIE_DATA: todo recursive
@@ -4504,7 +4577,7 @@ of) a large number of subtasks (see [[*Checkboxes]]).
 #+cindex: checkboxes
 
 #+vindex: org-list-automatic-rules
-Every item in a plain list[fn:48] (see [[*Plain Lists]]) can be made into
+Every item in a plain list[fn:17] (see [[*Plain Lists]]) can be made into
 a checkbox by starting it with the string =[ ]=.  This feature is
 similar to TODO items (see [[*TODO Items]]), but is more lightweight.
 Checkboxes are not included into the global TODO list, so they are
@@ -4540,14 +4613,17 @@ idea on how many checkboxes remain, even without 
opening a folded
 entry.  The cookies can be placed into a headline or into (the first
 line of) a plain list item.  Each cookie covers checkboxes of direct
 children structurally below the headline/item on which the cookie
-appears[fn:49].  You have to insert the cookie yourself by typing
-either =[/]= or =[%]=.  With =[/]= you get an =n out of m= result, as
-in the examples above.  With =[%]= you get information about the
-percentage of checkboxes checked (in the above example, this would be
-=[50%]= and =[33%]=, respectively).  In a headline, a cookie can count
-either checkboxes below the heading or TODO states of children, and it
-displays whatever was changed last.  Set the property =COOKIE_DATA= to
-either =checkbox= or =todo= to resolve this issue.
+appears[fn:: Set the variable ~org-hierarchical-checkbox-statistics~
+if you want such cookies to count all checkboxes below the cookie, not
+just those belonging to direct children.].  You have to insert the
+cookie yourself by typing either =[/]= or =[%]=.  With =[/]= you get
+an =n out of m= result, as in the examples above.  With =[%]= you get
+information about the percentage of checkboxes checked (in the above
+example, this would be =[50%]= and =[33%]=, respectively).  In a
+headline, a cookie can count either checkboxes below the heading or
+TODO states of children, and it displays whatever was changed last.
+Set the property =COOKIE_DATA= to either =checkbox= or =todo= to
+resolve this issue.
 
 #+cindex: blocking, of checkboxes
 #+cindex: checkbox blocking
@@ -4564,8 +4640,10 @@ The following commands work with checkboxes:
   #+findex: org-toggle-checkbox
   Toggle checkbox status or---with prefix argument---checkbox presence
   at point.  With a single prefix argument, add an empty checkbox or
-  remove the current one[fn:50].  With a double prefix argument, set
-  it to =[-]=, which is considered to be an intermediate state.
+  remove the current one[fn:: {{{kbd(C-u C-c C-c)}}} on the /first/
+  item of a list with no checkbox adds checkboxes to the rest of the
+  list.].  With a double prefix argument, set it to =[-]=, which is
+  considered to be an intermediate state.
 
 - {{{kbd(C-c C-x C-b)}}} (~org-toggle-checkbox~) ::
 
@@ -4677,7 +4755,9 @@ the final heading has the tags =work=, =boss=, =notes=, 
and =action=
 even though the final heading is not explicitly marked with those
 tags.  You can also set tags that all entries in a file should inherit
 just as if these tags were defined in a hypothetical level zero that
-surrounds the entire file.  Use a line like this[fn:51]
+surrounds the entire file.  Use a line like this[fn:: As with all
+these in-buffer settings, pressing {{{kbd(C-c C-c)}}} activates any
+changes in the line.]
 
 #+cindex: @samp{FILETAGS}, keyword
 : #+FILETAGS: :Peter:Boss:Secret:
@@ -4691,10 +4771,11 @@ use the variables ~org-use-tag-inheritance~ and
 #+vindex: org-tags-match-list-sublevels
 When a headline matches during a tags search while tag inheritance is
 turned on, all the sublevels in the same tree---for a simple match
-form---match as well[fn:52].  The list of matches may then become
-very long.  If you only want to see the first tags match in a subtree,
-configure the variable ~org-tags-match-list-sublevels~ (not
-recommended).
+form---match as well[fn:: This is only true if the search does not
+involve more complex tests including properties (see [[*Property
+Searches]]).].  The list of matches may then become very long.  If you
+only want to see the first tags match in a subtree, configure the
+variable ~org-tags-match-list-sublevels~ (not recommended).
 
 #+vindex: org-agenda-use-tag-inheritance
 Tag inheritance is relevant when the agenda search tries to match
@@ -4744,9 +4825,12 @@ also a special command for inserting tags:
 #+cindex: @samp{TAGS}, keyword
 Org supports tag insertion based on a /list of tags/.  By default this
 list is constructed dynamically, containing all tags currently used in
-the buffer[fn:53].  You may also globally specify a hard list of tags
-with the variable ~org-tag-alist~.  Finally you can set the default
-tags for a given file using the =TAGS= keyword, like
+the buffer[fn:: To extend this default list to all tags used in all
+agenda files (see [[*Agenda Views]]), customize the variable
+~org-complete-tags-always-offer-all-agenda-tags~.].  You may also
+globally specify a hard list of tags with the variable
+~org-tag-alist~.  Finally you can set the default tags for a given
+file using the =TAGS= keyword, like
 
 #+begin_example
 ,#+TAGS: @work @home @tennisclub
@@ -4830,7 +4914,8 @@ by the following configuration:
 If at least one tag has a selection key then pressing {{{kbd(C-c
 C-c)}}} automatically presents you with a special interface, listing
 inherited tags, the tags of the current headline, and a list of all
-valid tags with corresponding keys[fn:54].
+valid tags with corresponding keys[fn:: Keys are automatically
+assigned to tags that have no configured keys.].
 
 Pressing keys assigned to tags adds or removes them from the list of
 tags in the current line.  Selecting a tag in a group of mutually
@@ -5101,7 +5186,7 @@ value after it.  Keys are case-insensitive.  Here is an 
example:
 
 Depending on the value of ~org-use-property-inheritance~, a property
 set this way is associated either with a single entry, or with the
-sub-tree defined by the entry, see [[*Property Inheritance]].
+subtree defined by the entry, see [[*Property Inheritance]].
 
 You may define the allowed values for a particular property =Xyz= by
 setting a property =Xyz_ALL=.  This special property is /inherited/,
@@ -5470,7 +5555,9 @@ optional.  The individual parts have the following 
meaning:
 - {{{var(SUMMARY-TYPE)}}} ::
 
   The summary type.  If specified, the column values for parent nodes
-  are computed from the children[fn:55].
+  are computed from the children[fn:: If more than one summary type
+  applies to the same property, the parent values are computed
+  according to the first of them.].
 
   Supported summary types are:
 
@@ -5487,7 +5574,7 @@ optional.  The individual parts have the following 
meaning:
   | =:min=   | Smallest time value in column.                        |
   | =:max=   | Largest time value.                                   |
   | =:mean=  | Arithmetic mean of time values.                       |
-  | =@min=   | Minimum age[fn:56] (in days/hours/mins/seconds).      |
+  | =@min=   | Minimum age[fn:18] (in days/hours/mins/seconds).      |
   | =@max=   | Maximum age (in days/hours/mins/seconds).             |
   | =@mean=  | Arithmetic mean of ages (in days/hours/mins/seconds). |
   | =est+=   | Add low-high estimates.                               |
@@ -5515,7 +5602,9 @@ contrast, =est+= estimates the full job more 
realistically, at 10--15
 days.
 
 Here is an example for a complete columns definition, along with
-allowed values[fn:57].
+allowed values[fn:: Please note that the =COLUMNS= definition must be
+on a single line; it is wrapped here only because of formatting
+constraints.].
 
 #+begin_example
 :COLUMNS:  %25ITEM %9Approved(Approved?){X} %Owner %11Status \
@@ -5788,7 +5877,9 @@ recalculated automatically after an update.
 
 An alternative way to capture and process property values into a table
 is provided by Eric Schulte's =org-collector.el=, which is a package
-in =org-contrib=[fn:58].  It provides a general API to collect
+in =org-contrib=[fn:: Contributed packages are not part of Emacs, but
+are distributed with the main distribution of Org---visit
+[[https://orgmode.org]].].  It provides a general API to collect
 properties from entries in a certain scope, and arbitrary Lisp
 expressions to process these values before inserting them into a table
 or a dynamic block.
@@ -5821,7 +5912,7 @@ is used in a much wider sense.
 
 A timestamp is a specification of a date (possibly with a time or
 a range of times) in a special format, either =<2003-09-16 Tue>= or
-=<2003-09-16 Tue 09:39>= or =<2003-09-16 Tue 12:00-12:30>=[fn:59].
+=<2003-09-16 Tue 09:39>= or =<2003-09-16 Tue 12:00-12:30>=[fn:19].
 A timestamp can appear anywhere in the headline or body of an Org tree
 entry.  Its presence causes entries to be shown on specific dates in
 the agenda (see [[*Weekly/daily agenda]]).  We distinguish:
@@ -5847,8 +5938,8 @@ the agenda (see [[*Weekly/daily agenda]]).  We 
distinguish:
   #+cindex: timestamp, with repeater interval
   A timestamp may contain a /repeater interval/, indicating that it
   applies not only on the given date, but again and again after
-  a certain interval of N days (d), weeks (w), months (m), or years
-  (y).  The following shows up in the agenda every Wednesday:
+  a certain interval of N hours (h), days (d), weeks (w), months (m),
+  or years (y).  The following shows up in the agenda every Wednesday:
 
   #+begin_example
   ,* Pick up Sam at school
@@ -5859,9 +5950,15 @@ the agenda (see [[*Weekly/daily agenda]]).  We 
distinguish:
 
   #+cindex: diary style timestamps
   #+cindex: sexp timestamps
+  # Mentioned inside the footnote.
+  #+findex: org-date
+  #+findex: org-anniversary
+  #+findex: org-cyclic
+  #+findex: org-block
+
   For more complex date specifications, Org mode supports using the
   special expression diary entries implemented in the Emacs Calendar
-  package[fn:60].  For example, with optional time:
+  package[fn:20].  For example, with optional time:
 
   #+begin_example
   ,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
@@ -6013,7 +6110,7 @@ a range, it is taken from the stamp in the buffer.  When 
filling in
 information, Org mode assumes that most of the time you want to enter
 a date in the future: if you omit the month/year and the given
 day/month is /before/ today, it assumes that you mean a future
-date[fn:61].  If the date has been automatically shifted into the
+date[fn:21].  If the date has been automatically shifted into the
 future, the time prompt shows this with =(=>F)=.
 
 For example, let's assume that today is *June 13, 2006*.  Here is how
@@ -6078,11 +6175,13 @@ separator in the latter case, e.g.:
 
 #+cindex: calendar, for selecting date
 #+vindex: org-popup-calendar-for-date-prompt
-Parallel to the minibuffer prompt, a calendar is popped up[fn:62].
-When you exit the date prompt, either by clicking on a date in the
-calendar, or by pressing {{{kbd(RET)}}}, the date selected in the
-calendar is combined with the information entered at the prompt.  You
-can control the calendar fully from the minibuffer:
+Parallel to the minibuffer prompt, a calendar is popped up[fn:: If you
+do not need/want the calendar, configure the variable
+~org-popup-calendar-for-date-prompt~.].  When you exit the date
+prompt, either by clicking on a date in the calendar, or by pressing
+{{{kbd(RET)}}}, the date selected in the calendar is combined with the
+information entered at the prompt.  You can control the calendar fully
+from the minibuffer:
 
 #+kindex: <
 #+kindex: >
@@ -6111,14 +6210,15 @@ can control the calendar fully from the minibuffer:
 | {{{kbd(<)}}}         | Scroll calendar backward by one month. |
 | {{{kbd(M-v)}}}       | Scroll calendar forward by 3 months.   |
 | {{{kbd(C-v)}}}       | Scroll calendar backward by 3 months.  |
-| {{{kbd(C-.)}}}       | Select today's date[fn:63]             |
+| {{{kbd(C-.)}}}       | Select today's date[fn:22]             |
 
 #+vindex: org-read-date-display-live
 The actions of the date/time prompt may seem complex, but I assure you
 they will grow on you, and you will start getting annoyed by pretty
 much any other way of entering a date/time out there.  To help you
 understand what is going on, the current interpretation of your input
-is displayed live in the minibuffer[fn:64].
+is displayed live in the minibuffer[fn:: If you find this distracting,
+turn off the display with ~org-read-date-display-live~.].
 
 *** Custom time format
 :PROPERTIES:
@@ -6210,7 +6310,7 @@ immediately after the task they refer to.
   date.
 
   #+vindex: org-agenda-skip-scheduled-if-done
-  The headline is listed under the given date[fn:65].  In addition,
+  The headline is listed under the given date[fn:23].  In addition,
   a reminder that the scheduled date has passed is present in the
   compilation for /today/, until the entry is marked as done, i.e.,
   the task is automatically forwarded until completed.
@@ -6262,7 +6362,7 @@ expression entry matches.
 :END:
 
 The following commands allow you to quickly insert a deadline or to
-schedule an item:[fn:66]
+schedule an item:[fn:24]
 
 - {{{kbd(C-c C-d)}}} (~org-deadline~) ::
 
@@ -6274,7 +6374,8 @@ schedule an item:[fn:66]
   timestamp .  When called with a prefix argument, also remove any
   existing deadline from the entry.  Depending on the variable
   ~org-log-redeadline~, take a note when changing an existing
-  deadline[fn:67].
+  deadline[fn:: Note the corresponding =STARTUP= options
+  =logredeadline=, =lognoteredeadline=, and =nologredeadline=.].
 
 - {{{kbd(C-c C-s)}}} (~org-schedule~) ::
 
@@ -6286,7 +6387,8 @@ schedule an item:[fn:66]
   =CLOSED= timestamp.  When called with a prefix argument, also remove
   the scheduling date from the entry.  Depending on the variable
   ~org-log-reschedule~, take a note when changing an existing
-  scheduling time[fn:68].
+  scheduling time[fn:: Note the corresponding =STARTUP= options
+  =logreschedule=, =lognotereschedule=, and =nologreschedule=.].
 
 - {{{kbd(C-c / d)}}} (~org-check-deadlines~) ::
 
@@ -6326,7 +6428,7 @@ any current timestamp.
 
 Some tasks need to be repeated again and again.  Org mode helps to
 organize such tasks using a so-called repeater in a =DEADLINE=,
-=SCHEDULED=, or plain timestamps[fn:69].  In the following example:
+=SCHEDULED=, or plain timestamps[fn:25].  In the following example:
 
 #+begin_example
 ,** TODO Pay the rent
@@ -6347,16 +6449,19 @@ period last
 #+vindex: org-todo-repeat-to-state
 Deadlines and scheduled items produce entries in the agenda when they
 are over-due, so it is important to be able to mark such an entry as
-done once you have done so.  When you mark a =DEADLINE= or
-a =SCHEDULED= with the TODO keyword =DONE=, it no longer produces
+done once you have done so.  When you mark a =DEADLINE= or a
+=SCHEDULED= with the TODO keyword =DONE=, it no longer produces
 entries in the agenda.  The problem with this is, however, is that
 then also the /next/ instance of the repeated entry will not be
 active.  Org mode deals with this in the following way: when you try
 to mark such an entry as done, using {{{kbd(C-c C-t)}}}, it shifts the
 base date of the repeating timestamp by the repeater interval, and
-immediately sets the entry state back to TODO[fn:70].  In the example
-above, setting the state to =DONE= would actually switch the date like
-this:
+immediately sets the entry state back to TODO[fn:: In fact, the target
+state is taken from, in this sequence, the =REPEAT_TO_STATE= property,
+the variable ~org-todo-repeat-to-state~ if it is a string, the
+previous TODO state if ~org-todo-repeat-to-state~ is ~t~, or the first
+state of the TODO state sequence.].  In the example above, setting the
+state to =DONE= would actually switch the date like this:
 
 #+begin_example
 ,** TODO Pay the rent
@@ -6367,7 +6472,7 @@ To mark a task with a repeater as DONE, use {{{kbd(C-- 1 
C-c C-t)}}},
 i.e., ~org-todo~ with a numeric prefix argument of =-1=.
 
 #+vindex: org-log-repeat
-A timestamp[fn:71] is added under the deadline, to keep a record that
+A timestamp[fn:26] is added under the deadline, to keep a record that
 you actually acted on the previous instance of this deadline.
 
 As a consequence of shifting the base date, this entry is no longer
@@ -6437,7 +6542,7 @@ a project.  When you start working on an item, you can 
start the
 clock.  When you stop working on that task, or when you mark the task
 done, the clock is stopped and the corresponding time interval is
 recorded.  It also computes the total time spent on each
-subtree[fn:72] of a project.  And it remembers a history or tasks
+subtree[fn:27] of a project.  And it remembers a history or tasks
 recently clocked, so that you can jump quickly between a number of
 tasks absorbing your time.
 
@@ -6450,8 +6555,10 @@ To save the clock history across Emacs sessions, use:
 
 #+vindex: org-clock-persist
 When you clock into a new task after resuming Emacs, the incomplete
-clock[fn:73] is retrieved (see [[*Resolving idle time]]) and you are
-prompted about what to do with it.
+clock[fn:: To resume the clock under the assumption that you have
+worked on this task while outside Emacs, use =(setq org-clock-persist
+t)=.] is retrieved (see [[*Resolving idle time]]) and you are prompted
+about what to do with it.
 
 *** Clocking commands
 :PROPERTIES:
@@ -6487,17 +6594,20 @@ prompted about what to do with it.
   While the clock is running, Org shows the current clocking time in
   the mode line, along with the title of the task.  The clock time
   shown is all time ever clocked for this task and its children.  If
-  the task has an effort estimate (see [[*Effort Estimates]]), the mode
-  line displays the current clocking time against it[fn:74].  If the
-  task is a repeating one (see [[*Repeated tasks]]), show only the time
-  since the last reset of the task[fn:75].  You can exercise more
-  control over show time with the =CLOCK_MODELINE_TOTAL= property.  It
-  may have the values =current= to show only the current clocking
-  instance, =today= to show all time clocked on this tasks today---see
-  also the variable ~org-extend-today-until~, ~all~ to include all
-  time, or ~auto~ which is the default[fn:76].  Clicking with
-  {{{kbd(mouse-1)}}} onto the mode line entry pops up a menu with
-  clocking options.
+  the task has an effort estimate (see [[*Effort Estimates]]), the
+  mode line displays the current clocking time against it[fn:: To add
+  an effort estimate "on the fly", hook a function doing this to
+  ~org-clock-in-prepare-hook~.].  If the task is a repeating one (see
+  [[*Repeated tasks]]), show only the time since the last reset of the
+  task[fn:: The last reset of the task is recorded by the
+  =LAST_REPEAT= property.].  You can exercise more control over show
+  time with the =CLOCK_MODELINE_TOTAL= property.  It may have the
+  values =current= to show only the current clocking instance, =today=
+  to show all time clocked on this tasks today---see also the variable
+  ~org-extend-today-until~, ~all~ to include all time, or ~auto~ which
+  is the default[fn:: See also the variable
+  ~org-clock-mode-line-total~.].  Clicking with {{{kbd(mouse-1)}}}
+  onto the mode line entry pops up a menu with clocking options.
 
 - {{{kbd(C-c C-x C-o)}}} (~org-clock-out~) ::
 
@@ -6509,7 +6619,8 @@ prompted about what to do with it.
   computes the resulting time in inserts it after the time range as
   ==>HH:MM=.  See the variable ~org-log-note-clock-out~ for the
   possibility to record an additional note together with the clock-out
-  timestamp[fn:77].
+  timestamp[fn:: The corresponding in-buffer setting is: =#+STARTUP:
+  lognoteclock-out=.].
 
 - {{{kbd(C-c C-x C-x)}}} (~org-clock-in-last~) ::
 
@@ -6652,7 +6763,7 @@ into the buffer by ~org-clock-report~:
 #+cindex: @samp{BEGIN clocktable}
 #+begin_example
 ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
-,#+END: clocktable
+,#+END:
 #+end_example
 
 #+vindex: org-clocktable-defaults
@@ -6689,16 +6800,16 @@ be selected:
   absolutely, or relative to the current time and may be any of these
   formats:
 
-  | =2007-12-31=                            | New year eve 2007     |
-  | =2007-12=                               | December 2007         |
-  | =2007-W50=                              | ISO-week 50 in 2007   |
-  | =2007-Q2=                               | 2nd quarter in 2007   |
-  | =2007=                                  | the year 2007         |
-  | =today=, =yesterday=, =today-N=         | a relative day        |
-  | =thisweek=, =lastweek=, =thisweek-N=    | a relative week       |
-  | =thismonth=, =lastmonth=, =thismonth-N= | a relative month      |
-  | =thisyear=, =lastyear=, =thisyear-N=    | a relative year       |
-  | =untilnow=[fn:78]                       | all clocked time ever |
+  | =2007-12-31=                                                               
                                   | New year eve 2007     |
+  | =2007-12=                                                                  
                                   | December 2007         |
+  | =2007-W50=                                                                 
                                   | ISO-week 50 in 2007   |
+  | =2007-Q2=                                                                  
                                   | 2nd quarter in 2007   |
+  | =2007=                                                                     
                                   | the year 2007         |
+  | =today=, =yesterday=, =today-N=                                            
                                   | a relative day        |
+  | =thisweek=, =lastweek=, =thisweek-N=                                       
                                   | a relative week       |
+  | =thismonth=, =lastmonth=, =thismonth-N=                                    
                                   | a relative month      |
+  | =thisyear=, =lastyear=, =thisyear-N=                                       
                                   | a relative year       |
+  | =untilnow=[fn:: When using ~:step~, ~untilnow~ starts from the beginning 
of 2003, not the beginning of time.] | all clocked time ever |
 
   #+vindex: org-clock-display-default-range
   When this option is not set, Org falls back to the value in
@@ -6730,7 +6841,7 @@ be selected:
 
 - =:step= ::
 
-  Set to =day=, =week=, =semimonth=, =month=, or =year= to split the
+  Set to =day=, =week=, =semimonth=, =month=, =quarter=, or =year= to split the
   table into chunks.  To use this, either =:block=, or =:tstart= and
   =:tend= are required.
 
@@ -6760,7 +6871,9 @@ using the =:formatter= parameter.
 
 - =:lang= ::
 
-  Language[fn:79] to use for descriptive cells like "Task".
+  Language[fn:: Language terms can be set through the variable
+  ~org-clock-clocktable-language-setup~.] to use for descriptive cells
+  like "Task".
 
 - =:link= ::
 
@@ -6776,6 +6889,10 @@ using the =:formatter= parameter.
 
   Indent each headline field according to its level.
 
+- =:filetitle= ::
+
+  Show title in the file column if the file has a =#+title=.
+
 - =:hidefiles= ::
 
   Hide the file column when multiple files are used to produce the
@@ -6836,16 +6953,18 @@ day, you could write:
 
 #+begin_example
 ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
-,#+END: clocktable
+,#+END:
 #+end_example
 
 #+texinfo: @noindent
-To use a specific time range you could write[fn:80]
+To use a specific time range you could write[fn:: Note that all
+parameters must be specified in a single line---the line is broken
+here only to fit it into the manual.]
 
 #+begin_example
 ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
                     :tend "<2006-08-10 Thu 12:00>"
-,#+END: clocktable
+,#+END:
 #+end_example
 
 #+texinfo: @noindent
@@ -6853,7 +6972,7 @@ A range starting a week ago and ending right now could be 
written as
 
 #+begin_example
 ,#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
-,#+END: clocktable
+,#+END:
 #+end_example
 
 #+texinfo: @noindent
@@ -6861,7 +6980,7 @@ A summary of the current subtree with % times would be
 
 #+begin_example
 ,#+BEGIN: clocktable :scope subtree :link t :formula %
-,#+END: clocktable
+,#+END:
 #+end_example
 
 #+texinfo: @noindent
@@ -6870,7 +6989,7 @@ last week would be
 
 #+begin_example
 ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
-,#+END: clocktable
+,#+END:
 #+end_example
 
 *** Resolving idle time and continuous clocking
@@ -6896,7 +7015,7 @@ current clock, or applying it to another one.
 #+vindex: org-clock-x11idle-program-name
 By customizing the variable ~org-clock-idle-time~ to some integer,
 such as 10 or 15, Emacs can alert you when you get back to your
-computer after being idle for that many minutes[fn:81], and ask what
+computer after being idle for that many minutes[fn:28], and ask what
 you want to do with the idle time.  There will be a question waiting
 for you when you get back, indicating how much idle time has passed
 constantly updated with the current amount, as well as a set of
@@ -7065,12 +7184,14 @@ displayed.
 
 #+vindex: org-agenda-columns-add-appointments-to-effort-sum
 If you switch to column view in the daily/weekly agenda, the effort
-column summarizes the estimated work effort for each day[fn:82], and
-you can use this to find space in your schedule.  To get an overview
-of the entire part of the day that is committed, you can set the
-option ~org-agenda-columns-add-appointments-to-effort-sum~.  The
-appointments on a day that take place over a specified time interval
-are then also added to the load estimate of the day.
+column summarizes the estimated work effort for each day[fn:: Please
+note the pitfalls of summing hierarchical data in a flat list (see
+[[*Using Column View in the Agenda]]).], and you can use this to find
+space in your schedule.  To get an overview of the entire part of the
+day that is committed, you can set the option
+~org-agenda-columns-add-appointments-to-effort-sum~.  The appointments
+on a day that take place over a specified time interval are then also
+added to the load estimate of the day.
 
 Effort estimates can be used in secondary agenda filtering that is
 triggered with the {{{kbd(/)}}} key in the agenda (see [[*Commands in
@@ -7098,12 +7219,12 @@ The relative and countdown are started with separate 
commands.
   #+findex: org-timer-start
   Start or reset the relative timer.  By default, the timer is set
   to 0.  When called with a {{{kbd(C-u)}}} prefix, prompt the user for
-  a starting offset.  If there is a timer string at point, this is
-  taken as the default, providing a convenient way to restart taking
-  notes after a break in the process.  When called with a double
-  prefix argument {{{kbd(C-u C-u)}}}, change all timer strings in the
-  active region by a certain amount.  This can be used to fix timer
-  strings if the timer was not started at exactly the right moment.
+  a starting offset.  The prompt will default to a timer string at
+  point (if any), providing a convenient way to restart taking notes
+  after a break in the process.  When called with a double prefix
+  argument {{{kbd(C-u C-u)}}}, change all timer strings in the active
+  region by a certain amount.  This can be used to fix timer strings
+  if the timer was not started at exactly the right moment.
 
 - {{{kbd(C-c C-x ;)}}} (~org-timer-set-timer~) ::
 
@@ -7198,14 +7319,15 @@ special command:
   By default, all level 1 headlines in the current buffer are
   considered to be targets, but you can have more complex definitions
   across a number of files.  See the variable ~org-refile-targets~ for
-  details.  If you would like to select a location via
-  a file-path-like completion along the outline path, see the
-  variables ~org-refile-use-outline-path~ and
+  details.  If you would like to select a location via a
+  file-path-like completion along the outline path, see the variables
+  ~org-refile-use-outline-path~ and
   ~org-outline-path-complete-in-steps~.  If you would like to be able
   to create new nodes as new parents for refiling on the fly, check
   the variable ~org-refile-allow-creating-parent-nodes~.  When the
-  variable ~org-log-refile~[fn:83] is set, a timestamp or a note is
-  recorded whenever an entry is refiled.
+  variable ~org-log-refile~[fn:: Note the corresponding =STARTUP=
+  options =logrefile=, =lognoterefile=, and =nologrefile=.] is set, a
+  timestamp or a note is recorded whenever an entry is refiled.
 
 - {{{kbd(C-u C-c C-w)}}} ::
 
@@ -7360,9 +7482,9 @@ its location in the outline tree, but behaves in the 
following way:
   #+vindex: org-cycle-open-archived-trees
   It does not open when you attempt to do so with a visibility cycling
   command (see [[*Visibility Cycling]]).  You can force cycling archived
-  subtrees with {{{kbd(C-TAB)}}}, or by setting the option
+  subtrees with {{{kbd(C-c C-TAB)}}}, or by setting the option
   ~org-cycle-open-archived-trees~.  Also normal outline commands, like
-  ~outline-show-all~, open archived subtrees.
+  ~org-show-all~, open archived subtrees.
 
 -
   #+vindex: org-sparse-tree-open-archived-trees
@@ -7408,9 +7530,9 @@ The following commands help manage the =ARCHIVE= tag:
   child.  If point is /not/ on a headline when this command is
   invoked, check the level 1 trees.
 
-- {{{kbd(C-c C-TAB)}}} (~org-force-cycle-archived~) ::
+- {{{kbd(C-c C-TAB)}}} (~org-cycle-force-archived~) ::
 
-  #+kindex: C-TAB
+  #+kindex: C-c C-TAB
   Cycle a tree even if it is tagged with =ARCHIVE=.
 
 - {{{kbd(C-c C-x A)}}} (~org-archive-to-archive-sibling~) ::
@@ -7474,7 +7596,6 @@ You may also define a global key for capturing new 
material (see
 - {{{kbd(M-x org-capture)}}} (~org-capture~) ::
 
   #+findex: org-capture
-  #+cindex: date tree
   Display the capture templates menu.  If you have templates defined
   (see [[*Capture templates]]), it offers these templates for selection or
   use a new Org outline node as the default template.  It inserts the
@@ -7653,6 +7774,7 @@ Now lets look at the elements of a template definition.  
Each entry in
 
   #+vindex: org-default-notes-file
   #+vindex: org-directory
+  #+cindex: date tree
   Specification of where the captured item should be placed.  In Org
   files, targets usually define a node.  Entries will become children
   of this node.  Other types will be added to the table or list in the
@@ -7686,7 +7808,7 @@ Now lets look at the elements of a template definition.  
Each entry in
 
   - =(file+olp+datetree "filename" [ "Level 1 heading" ...])= ::
 
-    This target[fn:84] creates a heading in a date tree[fn:85] for
+    This target[fn:29] creates a heading in a date tree[fn:30] for
     today's date.  If the optional outline path is given, the tree
     will be built under the node it is pointing to, instead of at top
     level.  Check out the ~:time-prompt~ and ~:tree-type~ properties
@@ -7711,8 +7833,9 @@ Now lets look at the elements of a template definition.  
Each entry in
   empty, an appropriate default template will be used.  Otherwise this
   is a string with escape codes, which will be replaced depending on
   time and context of the capture call.  You may also get this
-  template string from a file[fn:86], or dynamically, from a function
-  using either syntax:
+  template string from a file[fn:: When the file name is not absolute,
+  Org assumes it is relative to ~org-directory~.], or dynamically,
+  from a function using either syntax:
 
   : (file "/path/to/template-file")
   : (function FUNCTION-RETURNING-THE-TEMPLATE)
@@ -7807,17 +7930,38 @@ Now lets look at the elements of a template definition. 
 Each entry in
 
     Do not save the target file after finishing the capture.
 
-  - ~:refile-targets :: Temporarily set ~org-refile-targets~ to the
+  - ~:refile-targets~ :: Temporarily set ~org-refile-targets~ to the
     value of this property.
 
+  - ~:hook~ ::
+
+    A nullary function or list of nullary functions run before
+    ~org-capture-mode-hook~ when the template is selected.
+
+ - ~:prepare-finalize~ ::
+
+    A nullary function or list of nullary functions run before
+    ~org-capture-prepare-finalize-hook~ when the template is selected.
+
+ - ~:before-finalize~ ::
+
+    A nullary function or list of nullary functions run before
+    ~org-capture-before-finalize-hook~ when the template is selected.
+
+ - ~:after-finalize~ ::
+
+    A nullary function or list of nullary functions run before
+    ~org-capture-after-finalize-hook~ when the template is selected.
+
 **** Template expansion
 :PROPERTIES:
 :DESCRIPTION: Filling in information about time and context.
 :END:
 
-In the template itself, special "%-escapes"[fn:87] allow dynamic
-insertion of content.  The templates are expanded in the order given
-here:
+In the template itself, special "%-escapes"[fn:: If you need one of
+these sequences literally, escape the =%= with a backslash.] allow
+dynamic insertion of content.  The templates are expanded in the order
+given here:
 
 - =%[FILE]= ::
 
@@ -7947,7 +8091,10 @@ here:
   After completing the template, position point here.
 
 #+vindex: org-store-link-props
-For specific link types, the following keywords are defined[fn:88]:
+For specific link types, the following keywords are defined[fn:: If
+you define your own link types (see [[*Adding Hyperlink Types]]), any
+property you store with ~org-store-link-props~ can be accessed in
+capture templates in a similar way.]:
 
 #+vindex: org-link-from-user-regexp
 | Link type    | Available keywords                                       |
@@ -7960,7 +8107,7 @@ For specific link types, the following keywords are 
defined[fn:88]:
 |              | =%:date= (message date header field)                     |
 |              | =%:date-timestamp= (date as active timestamp)            |
 |              | =%:date-timestamp-inactive= (date as inactive timestamp) |
-|              | =%:fromto= (either "to NAME" or "from NAME")[fn:89]      |
+|              | =%:fromto= (either "to NAME" or "from NAME")[fn:31]      |
 | gnus         | =%:group=, for messages also all email fields            |
 | w3, w3m      | =%:url=                                                  |
 | info         | =%:file=, =%:node=                                       |
@@ -8019,7 +8166,9 @@ By default, Org attach uses ID properties when adding 
attachments to
 outline nodes.  This makes working with attachments fully automated.
 There is no decision needed for folder-name or location.  ID-based
 directories are by default located in the =data/= directory, which
-lives in the same directory where your Org file lives[fn:90].
+lives in the same directory where your Org file lives[fn:: If you move
+entries or Org files from one directory to another, you may want to
+configure ~org-attach-id-dir~ to contain an absolute path.].
 
 When attachments are made using ~org-attach~ a default tag =ATTACH= is
 added to the node that gets the attachments.
@@ -8416,13 +8565,18 @@ the window configuration is restored when the agenda 
exits:
 
 #+vindex: org-agenda-files
 The information to be shown is normally collected from all /agenda
-files/, the files listed in the variable ~org-agenda-files~[fn:91].
-If a directory is part of this list, all files with the extension
-=.org= in this directory are part of the list.
+files/, the files listed in the variable ~org-agenda-files~[fn:: If
+the value of that variable is not a list, but a single file name, then
+the list of agenda files in maintained in that external file.].  If a
+directory is part of this list, all files with the extension =.org= in
+this directory are part of the list.
 
 Thus, even if you only work with a single Org file, that file should
-be put into the list[fn:92].  You can customize ~org-agenda-files~,
-but the easiest way to maintain it is through the following commands
+be put into the list[fn:: When using the dispatcher, pressing
+{{{kbd(<)}}} before selecting a command actually limits the command to
+the current file, and ignores ~org-agenda-files~ until the next
+dispatcher command.].  You can customize ~org-agenda-files~, but the
+easiest way to maintain it is through the following commands
 
 #+attr_texinfo: :sep and
 - {{{kbd(C-c [)}}} (~org-agenda-file-to-front~) ::
@@ -8558,18 +8712,20 @@ commands:
 - {{{kbd(<)}}} ::
 
   #+kindex: < @r{(Agenda dispatcher)}
-  Restrict an agenda command to the current buffer[fn:93].  If
-  narrowing is in effect restrict to the narrowed part of the buffer.
-  After pressing {{{kbd(<)}}}, you still need to press the character
-  selecting the command.
+  Restrict an agenda command to the current buffer[fn:: For backward
+  compatibility, you can also press {{{kbd(1)}}} to restrict to the
+  current buffer.].  If narrowing is in effect restrict to the
+  narrowed part of the buffer.  After pressing {{{kbd(<)}}}, you still
+  need to press the character selecting the command.
 
 - {{{kbd(< <)}}} ::
 
   #+kindex: < < @r{(Agenda dispatcher)}
   If there is an active region, restrict the following agenda command
-  to the region.  Otherwise, restrict it to the current
-  subtree[fn:94].  After pressing {{{kbd(< <)}}}, you still need to
-  press the character selecting the command.
+  to the region.  Otherwise, restrict it to the current subtree[fn::
+  For backward compatibility, you can also press {{{kbd(0)}}} to
+  restrict to the current region/subtree.].  After pressing {{{kbd(<
+  <)}}}, you still need to press the character selecting the command.
 
 - {{{kbd(*)}}} ::
 
@@ -8618,7 +8774,7 @@ a paper agenda, showing all the tasks for the current 
week or day.
   #+cindex: org-agenda, command
   Compile an agenda for the current week from a list of Org files.
   The agenda shows the entries for each day.  With a numeric prefix
-  argument[fn:95]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you may
+  argument[fn:32]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you may
   set the number of days to be displayed.
 
 #+vindex: org-agenda-span
@@ -8677,7 +8833,10 @@ move the entries into an Org file.  Org mode evaluates 
diary-style
 expression entries, and does it faster because there is no overhead
 for first creating the diary display.  Note that the expression
 entries must start at the left margin, no whitespace is allowed before
-them, as seen in the following segment of an Org file:[fn:96]
+them, as seen in the following segment of an Org file:[fn:: The
+variable ~org-anniversary~ used in the example is just like
+~diary-anniversary~, but the argument order is always according to ISO
+and therefore independent of the value of ~calendar-date-style~.]
 
 #+begin_example
 ,* Holidays
@@ -8789,7 +8948,7 @@ collected into a single place.
   #+findex: org-todo-list
   Show the global TODO list.  This collects the TODO items from all
   agenda files (see [[*Agenda Views]]) into a single buffer.  By default,
-  this lists items with a state the is not a DONE state.  The buffer
+  this lists items with a state that is not a DONE state.  The buffer
   is in Agenda mode, so there are commands to examine and manipulate
   the TODO entries directly from that buffer (see [[*Commands in the
   Agenda Buffer]]).
@@ -9179,8 +9338,10 @@ Time ranges can be specified with two timestamps:
 : <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
 
 #+vindex: org-agenda-search-headline-for-time
-In the headline of the entry itself, a time(range)---like =12:45= or
-a =8:30-1pm=---may also appear as plain text[fn:97].
+In the headline of the entry itself, a time(range)---like =12:45= or a
+=8:30-1pm=---may also appear as plain text[fn:: You can, however,
+disable this by setting ~org-agenda-search-headline-for-time~ variable
+to a ~nil~ value.].
 
 If the agenda integrates the Emacs diary (see [[*Weekly/daily agenda]]),
 time specifications in diary entries are recognized as well.
@@ -9270,7 +9431,7 @@ filters and limits allow to flexibly narrow down the list 
of agenda
 entries.
 
 /Filters/ only change the visibility of items, are very fast and are
-mostly used interactively[fn:98].  You can switch quickly between
+mostly used interactively[fn:33].  You can switch quickly between
 different filters without having to recreate the agenda.  /Limits/ on
 the other hand take effect before the agenda buffer is populated, so
 they are mostly useful when defined as local variables within custom
@@ -9402,11 +9563,11 @@ the Internet, and outside of business hours, with 
something like this:
 #+begin_src emacs-lisp
 (defun my-auto-exclude-fn (tag)
   (when (cond ((string= tag "net")
-              (/= 0 (call-process "/sbin/ping" nil nil nil
-                                  "-c1" "-q" "-t1" "mail.gnu.org")))
+               (/= 0 (call-process "/sbin/ping" nil nil nil
+                                   "-c1" "-q" "-t1" "mail.gnu.org")))
               ((member tag '("errand" "call"))
-              (let ((hr (nth 2 (decode-time))))
-                (or (< hr 8) (> hr 21)))))
+               (let ((hr (nth 2 (decode-time))))
+                 (or (< hr 8) (> hr 21)))))
     (concat "-" tag)))
 
 (setq org-agenda-auto-exclude-function #'my-auto-exclude-fn)
@@ -9732,11 +9893,13 @@ the other commands, point needs to be in the desired 
line.
   agenda always shows a table with the clocked times for the time span
   and file scope covered by the current agenda view.  The initial
   setting for this mode in new agenda buffers can be set with the
-  variable ~org-agenda-start-with-clockreport-mode~.  By using
-  a prefix argument when toggling this mode (i.e., {{{kbd(C-u R)}}}),
+  variable ~org-agenda-start-with-clockreport-mode~.  By using a
+  prefix argument when toggling this mode (i.e., {{{kbd(C-u R)}}}),
   the clock table does not show contributions from entries that are
-  hidden by agenda filtering[fn:99].  See also the variable
-  ~org-clock-report-include-clocking-task~.
+  hidden by agenda filtering[fn:: Only tags filtering is respected
+  here, effort filtering is ignored.].  See also the variables
+  ~org-clock-report-include-clocking-task~ and
+  ~org-agenda-clock-report-header~.
 
 - {{{kbd(v c)}}} ::
 
@@ -10175,9 +10338,10 @@ the other commands, point needs to be in the desired 
line.
   - {{{kbd(f)}}} ::
 
     #+vindex: org-agenda-bulk-custom-functions
-    Apply a function[fn:100] to marked entries.  For example, the
-    function below sets the =CATEGORY= property of the entries to
-    =web=.
+    Apply a function[fn:: You can also create persistent custom
+    functions through ~org-agenda-bulk-custom-functions~.] to marked
+    entries.  For example, the function below sets the =CATEGORY=
+    property of the entries to =web=.
 
     #+begin_src emacs-lisp
     (defun set-category ()
@@ -10215,9 +10379,10 @@ the other commands, point needs to be in the desired 
line.
   #+cindex: diary entries, creating from agenda
   Insert a new entry into the diary, using the date at point and (for
   block entries) the date at the mark.  This adds to the Emacs diary
-  file[fn:101], in a way similar to the {{{kbd(i)}}} command in the
-  calendar.  The diary file pops up in another window, where you can
-  add the entry.
+  file[fn:: This file is parsed for the agenda when
+  ~org-agenda-include-diary~ is set.], in a way similar to the
+  {{{kbd(i)}}} command in the calendar.  The diary file pops up in
+  another window, where you can add the entry.
 
   #+vindex: org-agenda-diary-file
   If you configure ~org-agenda-diary-file~ to point to an Org file,
@@ -10341,13 +10506,14 @@ after the dispatcher command in order to access the 
command.  Usually
 this is just a single character, but if you have many similar
 commands, you can also define two-letter combinations where the first
 character is the same in several combinations and serves as a prefix
-key[fn:102].  The second parameter is the search type, followed by the
-string or regular expression to be used for the matching.  The example
-above will therefore define:
+key[fn:: You can provide a description for a prefix key by inserting a
+cons cell with the prefix and the description.].  The second parameter
+is the search type, followed by the string or regular expression to be
+used for the matching.  The example above will therefore define:
 
 - {{{kbd(x)}}} ::
 
-  as a global search for agenda entries planned[fn:103] this week/day.
+  as a global search for agenda entries planned[fn:34] this week/day.
 
 - {{{kbd(y)}}} ::
 
@@ -10527,11 +10693,14 @@ See the docstring of the variable for more 
information.
 :END:
 #+cindex: agenda views, exporting
 
-If you are away from your computer, it can be very useful to have
-a printed version of some agenda views to carry around.  Org mode can
-export custom agenda views as plain text, HTML[fn:104], Postscript,
-PDF[fn:105], and iCalendar files.  If you want to do this only
-occasionally, use the following command:
+If you are away from your computer, it can be very useful to have a
+printed version of some agenda views to carry around.  Org mode can
+export custom agenda views as plain text, HTML[fn:: For HTML you need
+to install Hrvoje Nikšić's =htmlize.el= as an Emacs package from
+[[https://elpa.nongnu.org/][NonGNU ELPA]] or from
+[[https://github.com/hniksic/emacs-htmlize][Hrvoje Nikšić's repository]].],
+Postscript, PDF[fn:35], and iCalendar files.  If you
+want to do this only occasionally, use the following command:
 
 - {{{kbd(C-x C-w)}}} (~org-agenda-write~) ::
   #+kindex: C-x C-w
@@ -10544,11 +10713,14 @@ occasionally, use the following command:
 
 If you need to export certain agenda views frequently, you can
 associate any custom agenda command with a list of output file
-names[fn:106].  Here is an example that first defines custom commands
-for the agenda and the global TODO list, together with a number of
-files to which to export them.  Then we define two block agenda
-commands and specify file names for them as well.  File names can be
-relative to the current working directory, or absolute.
+names[fn:: If you want to store standard views like the weekly agenda
+or the global TODO list as well, you need to define custom commands
+for them in order to be able to specify file names.].  Here is an
+example that first defines custom commands for the agenda and the
+global TODO list, together with a number of files to which to export
+them.  Then we define two block agenda commands and specify file names
+for them as well.  File names can be relative to the current working
+directory, or absolute.
 
 #+begin_src emacs-lisp
 (setq org-agenda-custom-commands
@@ -10632,7 +10804,8 @@ emacs -eval (org-batch-store-agenda-views) -kill
 #+end_src
 
 #+texinfo: @noindent
-or, if you need to modify some parameters[fn:107]
+or, if you need to modify some parameters[fn:: Quoting depends on the
+system you use, please check the FAQ for examples.]
 
 #+begin_src shell
 emacs -eval '(org-batch-store-agenda-views                      \
@@ -10902,7 +11075,9 @@ becomes =&nbsp;= in HTML and =~= in LaTeX.
 
 #+cindex: special symbols, in-buffer display
 If you would like to see entities displayed as UTF-8 characters, use
-the following command[fn:108]:
+the following command[fn:: You can turn this on by default by setting
+the variable ~org-pretty-entities~, or on a per-file base with the
+=STARTUP= option =entitiespretty=.]:
 
 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) ::
   #+kindex: C-c C-x \
@@ -10915,8 +11090,9 @@ the following command[fn:108]:
 #+cindex: shy hyphen, special symbol
 #+cindex: dash, special symbol
 #+cindex: ellipsis, special symbol
-In addition to regular entities defined above, Org exports in
-a special way[fn:109] the following commonly used character
+In addition to regular entities defined above, Org exports in a
+special way[fn:: This behavior can be disabled with =-= export setting
+(see [[*Export Settings]]).] the following commonly used character
 combinations: =\-= is treated as a shy hyphen, =--= and =---= are
 converted into dashes, and =...= becomes a compact set of dots.
 
@@ -10929,7 +11105,7 @@ converted into dashes, and =...= becomes a compact set 
of dots.
 
 Plain ASCII is normally sufficient for almost all note taking.
 Exceptions include scientific notes, which often require mathematical
-symbols and the occasional formula.  LaTeX[fn:110] is widely used to
+symbols and the occasional formula.  LaTeX[fn:36] is widely used to
 typeset scientific documents.  Org mode supports embedding LaTeX code
 into its files, because many academics are used to writing and reading
 LaTeX source code, and because it can be readily processed to produce
@@ -10951,7 +11127,7 @@ into images (see [[*Previewing LaTeX fragments]]).
 LaTeX fragments do not need any special marking at all.  The following
 snippets are identified as LaTeX source code:
 
-- Environments of any kind[fn:111].  The only requirement is that the
+- Environments of any kind[fn:37].  The only requirement is that the
   =\begin= statement appears on a new line, preceded by only
   whitespace.
 
@@ -10995,7 +11171,7 @@ lines:
 
 #+vindex: org-preview-latex-default-process
 If you have a working LaTeX installation and =dvipng=, =dvisvgm= or
-=convert= installed[fn:112], LaTeX fragments can be processed to
+=convert= installed[fn:38], LaTeX fragments can be processed to
 produce images of the typeset expressions to be used for inclusion
 while exporting to HTML (see [[*LaTeX fragments]]), or for inline
 previewing within Org mode.
@@ -11065,10 +11241,12 @@ more details see the documentation of CDLaTeX mode):
 - {{{kbd(TAB)}}} ::
   #+kindex: TAB
 
-  The {{{kbd(TAB)}}} key expands the template if point is inside
-  a LaTeX fragment[fn:113].  For example, {{{kbd(TAB)}}} expands =fr=
-  to =\frac{}{}= and position point correctly inside the first brace.
-  Another {{{kbd(TAB)}}} gets you into the second brace.
+  The {{{kbd(TAB)}}} key expands the template if point is inside a
+  LaTeX fragment[fn:: Org mode has a method to test if point is inside
+  such a fragment, see the documentation of the function
+  ~org-inside-LaTeX-fragment-p~.].  For example, {{{kbd(TAB)}}}
+  expands =fr= to =\frac{}{}= and position point correctly inside the
+  first brace.  Another {{{kbd(TAB)}}} gets you into the second brace.
 
   Even outside fragments, {{{kbd(TAB)}}} expands environment
   abbreviations at the beginning of a line.  For example, if you write
@@ -11099,8 +11277,8 @@ more details see the documentation of CDLaTeX mode):
   #+kindex: '
 
   Pressing the single-quote followed by another character modifies the
-  symbol before point with an accent or a font.  If you wait more than
-  1.5 seconds after the single-quote, a help window pops up.
+  LaTeX symbol before point with an accent or a font.  If you wait
+  more than 1.5 seconds after the single-quote, a help window pops up.
   Character modification works only inside LaTeX fragments; outside
   the quote is normal.
 
@@ -11146,12 +11324,12 @@ Here is an example
 #+end_example
 
 #+cindex: formatting source code, markup rules
-#+vindex: org-latex-listings
+#+vindex: org-latex-src-block-backend
 If the example is source code from a programming language, or any
 other text that can be marked up by Font Lock in Emacs, you can ask
-for the example to look like the fontified Emacs buffer[fn:114].  This
+for the example to look like the fontified Emacs buffer[fn:39].  This
 is done with the code block, where you also need to specify the name
-of the major mode that should be used to fontify the example[fn:115],
+of the major mode that should be used to fontify the example[fn:40],
 see [[*Structure Templates]] for shortcuts to easily insert code blocks.
 
 #+cindex: @samp{BEGIN_SRC}
@@ -11192,9 +11370,12 @@ In HTML, hovering the mouse over such a link 
remote-highlights the
 corresponding code line, which is kind of cool.
 
 You can also add a =-r= switch which /removes/ the labels from the
-source code[fn:116].  With the =-n= switch, links to these references
-are labeled by the line numbers from the code listing.  Otherwise
-links use the labels with no parentheses.  Here is an example:
+source code[fn:: Adding =-k= to =-n -r= /keeps/ the labels in the
+source code while using line numbers for the links, which might be
+useful to explain those in an Org mode example code.].  With the =-n=
+switch, links to these references are labeled by the line numbers from
+the code listing.  Otherwise links use the labels with no parentheses.
+Here is an example:
 
 #+begin_example -l "(dumb-reference:%s)"
 ,#+BEGIN_SRC emacs-lisp -n -r
@@ -11236,10 +11417,11 @@ a shortcut is provided (see [[*Structure Templates]]).
   works by switching to a temporary buffer with the source code.  You
   need to exit by pressing {{{kbd(C-c ')}}} again.  The edited version
   then replaces the old version in the Org buffer.  Fixed-width
-  regions---where each line starts with a colon followed by
-  a space---are edited using Artist mode[fn:117] to allow creating
-  ASCII drawings easily.  Using this command in an empty line creates
-  a new fixed-width region.
+  regions---where each line starts with a colon followed by a
+  space---are edited using Artist mode[fn:: You may select a different
+  mode with the variable ~org-edit-fixed-width-region-mode~.] to allow
+  creating ASCII drawings easily.  Using this command in an empty line
+  creates a new fixed-width region.
 
 #+cindex: storing link, in a source code buffer
 Calling ~org-store-link~ (see [[*Handling Links]]) while editing a source
@@ -11256,8 +11438,10 @@ the end of the current line.  Then the label is stored 
as a link
 
 #+cindex: inlining images
 #+cindex: images, markup rules
-An image is a link to an image file[fn:118] that does not have
-a description part, for example
+An image is a link to an image file[fn:: What Emacs considers to be an
+image depends on ~image-file-name-extensions~ and
+~image-file-name-regexps~.] that does not have a description part, for
+example
 
 : ./img/cat.jpg
 
@@ -11280,11 +11464,40 @@ command:
   #+kindex: C-c C-x C-v
   #+findex: org-toggle-inline-images
   #+vindex: org-startup-with-inline-images
-  Toggle the inline display of linked images.  When called with
-  a prefix argument, also display images that do have a link
+  Toggle the inline display of linked images.  When called with a
+  prefix argument, also display images that do have a link
   description.  You can ask for inline images to be displayed at
   startup by configuring the variable
-  ~org-startup-with-inline-images~[fn:119].
+  ~org-startup-with-inline-images~[fn:: The variable
+  ~org-startup-with-inline-images~ can be set within a buffer with the
+  =STARTUP= options =inlineimages= and =noinlineimages=.].
+
+
+  #+vindex: org-image-actual-width
+  #+cindex: @samp{ORG-IMAGE-ACTUAL-WIDTH}, property
+  By default, Org mode displays inline images according to their
+  actual width.  You can customize the displayed image width using
+  ~org-image-actual-width~ variable (globally) or
+  =ORG-IMAGE-ACTUAL-WIDTH= property (subtree-level)[fn:: The width can
+  be customized in Emacs >= 24.1, built with imagemagick support.].
+  Their value can be the following:
+  - (default) Non-nil, use the actual width of images when inlining them.
+  - When set to a number, use imagemagick (when available) to set the
+    image's width to this value.
+  - When set to a number in a list, try to get the width from any
+    =#+ATTR.*= keyword if it matches a width specification like:
+    #+begin_example
+    ,#+ATTR_HTML: :width 300px
+    #+end_example
+    and fall back on that number if none is found.
+  - When set to nil, try to get the width from an =#+ATTR.*= keyword
+    and fall back on the original width if none is found.
+
+
+#+vindex: org-cycle-inline-images-display
+Inline images can also be displayed when cycling the folding state.
+When custom option ~org-cycle-inline-images-display~ is set, the
+visible inline images under subtree will be displayed automatically.
 
 ** Captions
 :PROPERTIES:
@@ -11333,9 +11546,9 @@ footnote reference is simply the marker in square 
brackets, inside
 text.  Markers always start with =fn:=.  For example:
 
 #+begin_example
-The Org homepage[fn:1] now looks a lot better than it used to.
+The Org website[fn:1] now looks a lot better than it used to.
 ...
-[fn:1] The link is: https://orgmode.org
+[fn:55] The link is: https://orgmode.org
 #+end_example
 
 Org mode extends the number-based syntax to /named/ footnotes and
@@ -11376,9 +11589,11 @@ The following command handles footnotes:
   #+vindex: org-footnote-define-inline
   #+vindex: org-footnote-section
   Otherwise, create a new footnote.  Depending on the variable
-  ~org-footnote-define-inline~[fn:120], the definition is placed right
-  into the text as part of the reference, or separately into the
-  location determined by the variable ~org-footnote-section~.
+  ~org-footnote-define-inline~[fn:: The corresponding in-buffer
+  setting is: =#+STARTUP: fninline= or =#+STARTUP: nofninline=.], the
+  definition is placed right into the text as part of the reference,
+  or separately into the location determined by the variable
+  ~org-footnote-section~.
 
   When this command is called with a prefix argument, a menu of
   additional options is offered:
@@ -11391,9 +11606,10 @@ The following command handles footnotes:
   | {{{kbd(d)}}} | Delete the footnote at point, including definition and 
references. |
 
   #+vindex: org-footnote-auto-adjust
-  Depending on the variable ~org-footnote-auto-adjust~[fn:121],
-  renumbering and sorting footnotes can be automatic after each
-  insertion or deletion.
+  Depending on the variable ~org-footnote-auto-adjust~[fn:: The
+  corresponding in-buffer options are =#+STARTUP: fnadjust= and
+  =#+STARTUP: nofnadjust=.], renumbering and sorting footnotes can be
+  automatic after each insertion or deletion.
 
 - {{{kbd(C-c C-c)}}} ::
 
@@ -11479,7 +11695,7 @@ the hierarchical menu, press {{{kbd(?)}}}.
 
   Invokes the export dispatcher interface.  The options show default
   settings.  The {{{kbd(C-u)}}} prefix argument preserves options from
-  the previous export, including any sub-tree selections.
+  the previous export, including any subtree selections.
 
 Org exports the entire buffer by default.  If the Org buffer has an
 active region, then Org exports just that region.
@@ -11518,15 +11734,15 @@ further alter what is exported, and how.
 - {{{kbd(C-s)}}} ::
   #+kindex: C-c C-e C-s
 
-  Toggle sub-tree export.  When turned on, Org exports only the
-  sub-tree starting from point position at the time the export
-  dispatcher was invoked.  Org uses the top heading of this sub-tree
+  Toggle subtree export.  When turned on, Org exports only the
+  subtree starting from point position at the time the export
+  dispatcher was invoked.  Org uses the top heading of this subtree
   as the document's title.  If point is not on a heading, Org uses the
   nearest enclosing header.  If point is in the document preamble, Org
   signals an error and aborts export.
 
   #+vindex: org-export-initial-scope
-  To make sub-tree export the default, customize the variable
+  To make subtree export the default, customize the variable
   ~org-export-initial-scope~.
 
 - {{{kbd(C-v)}}} ::
@@ -11559,7 +11775,7 @@ can be inserted from the export dispatcher (see [[*The 
Export
 Dispatcher]]) using the =Insert template= command by pressing
 {{{kbd(#)}}}.  To insert keywords individually, a good way to make
 sure the keyword is correct is to type =#+= and then to use
-{{{kbd(M-TAB)}}}[fn:16] for completion.
+{{{kbd(M-TAB)}}}[fn:6] for completion.
 
 The export keywords available for every back-end, and their equivalent
 global variables, include:
@@ -11581,7 +11797,9 @@ global variables, include:
 
   #+cindex: @samp{DATE}, keyword
   #+vindex: org-export-date-timestamp-format
-  A date or a time-stamp[fn:122].
+  A date or a time-stamp[fn:: The variable
+  ~org-export-date-timestamp-format~ defines how this timestamp are
+  exported.].
 
 - =EMAIL= ::
 
@@ -11596,7 +11814,7 @@ global variables, include:
   Language to use for translating certain strings
   (~org-export-default-language~).  With =#+LANGUAGE: fr=, for
   example, Org translates =Table of contents= to the French =Table des
-  matières=[fn:123].
+  matières=[fn:41].
 
 - =SELECT_TAGS= ::
 
@@ -11604,7 +11822,7 @@ global variables, include:
   #+vindex: org-export-select-tags
   The default value is =("export")=.  When a tree is tagged with
   =export= (~org-export-select-tags~), Org selects that tree and its
-  sub-trees for export.  Org excludes trees with =noexport= tags, see
+  subtrees for export.  Org excludes trees with =noexport= tags, see
   below.  When selectively exporting files with =export= tags set, Org
   does not export any text that appears before the first headline.
 
@@ -11614,9 +11832,9 @@ global variables, include:
   #+vindex: org-export-exclude-tags
   The default value is =("noexport")=.  When a tree is tagged with
   =noexport= (~org-export-exclude-tags~), Org excludes that tree and
-  its sub-trees from export.  Entries tagged with =noexport= are
+  its subtrees from export.  Entries tagged with =noexport= are
   unconditionally excluded from the export, even if they have an
-  =export= tag.  Even if a sub-tree is not exported, Org executes any
+  =export= tag.  Even if a subtree is not exported, Org executes any
   code blocks contained there.
 
 - =TITLE= ::
@@ -11835,10 +12053,10 @@ following arguments.
   #+vindex: org-export-with-tables
   Toggle inclusion of tables (~org-export-with-tables~).
 
-When exporting sub-trees, special node properties can override the
+When exporting subtrees, special node properties can override the
 above keywords.  These properties have an =EXPORT_= prefix.  For
 example, =DATE= becomes, =EXPORT_DATE= when used for a specific
-sub-tree.  Except for =SETUPFILE=, all other keywords listed above
+subtree.  Except for =SETUPFILE=, all other keywords listed above
 have an =EXPORT_= equivalent.
 
 #+cindex: @samp{BIND}, keyword
@@ -11873,7 +12091,7 @@ keyword:
 #+cindex: excluding entries from table of contents
 #+cindex: table of contents, exclude entries
 Org includes both numbered and unnumbered headlines in the table of
-contents[fn:124].  If you need to exclude an unnumbered headline,
+contents[fn:42].  If you need to exclude an unnumbered headline,
 along with all its children, set the =UNNUMBERED= property to =notoc=
 value.
 
@@ -11992,7 +12210,7 @@ be omitted to use the obvious defaults.
 | =#+INCLUDE: "~/.emacs" :lines "10-"=  | Include lines from 10 to EOF       |
 
 Inclusions may specify a file-link to extract an object matched by
-~org-link-search~[fn:125] (see [[*Search Options in File Links]]).  The
+~org-link-search~[fn:43] (see [[*Search Options in File Links]]).  The
 ranges for =:lines= keyword are relative to the requested element.
 Therefore,
 
@@ -12032,7 +12250,7 @@ following syntax:
 : #+MACRO: name   replacement text; $1, $2 are arguments
 
 #+texinfo: @noindent
-which can be referenced using ={{{name(arg1, arg2)}}}=[fn:126].  For
+which can be referenced using ={{{name(arg1, arg2)}}}=[fn:44].  For
 example
 
 #+begin_example
@@ -12151,8 +12369,9 @@ are not exported.
 Finally, a =COMMENT= keyword at the beginning of an entry, but after
 any other keyword or priority cookie, comments out the entire subtree.
 In this case, the subtree is not exported and no code block within it
-is executed either[fn:127].  The command below helps changing the
-comment status of a headline.
+is executed either[fn:: For a less drastic behavior, consider using a
+select tag (see [[*Export Settings]]) instead.].  The command below
+helps changing the comment status of a headline.
 
 - {{{kbd(C-c ;)}}} (~org-toggle-comment~) ::
   #+kindex: C-c ;
@@ -12423,7 +12642,7 @@ should in principle be exportable as a Beamer 
presentation.
 
 - Org exports a Beamer frame's objects as block environments.  Org can
   enforce wrapping in special block types when =BEAMER_ENV= property
-  is set[fn:128].  For valid values see
+  is set[fn:45].  For valid values see
   ~org-beamer-environments-default~.  To add more values, see
   ~org-beamer-environments-extra~.
   #+vindex: org-beamer-environments-default
@@ -12492,7 +12711,7 @@ Insert Beamer-specific code using the following 
constructs:
 
 ,#+BEGIN_EXPORT beamer
   Only Beamer export back-end exports this.
-,#+END_BEAMER
+,#+END_EXPORT
 
 Text @@beamer:some code@@ within a paragraph.
 #+end_example
@@ -12811,17 +13030,17 @@ exporter insert the preamble.  See the variable
 ~org-html-preamble-format~ for the format string.
 
 Set ~org-html-preamble~ to a string to override the default format
-string.  If the string is a function, the HTML exporter expects the
-function to return a string upon execution.  The HTML exporter inserts
-this string in the preamble.  The HTML exporter does not insert
-a preamble if ~org-html-preamble~ is set ~nil~.
-
-The default value for ~org-html-postamble~ is ~auto~, which makes the
-HTML exporter build a postamble from looking up author's name, email
-address, creator's name, and date.  Set ~org-html-postamble~ to ~t~ to
-insert the postamble in the format specified in the
-~org-html-postamble-format~ variable.  The HTML exporter does not
-insert a postamble if ~org-html-postamble~ is set to ~nil~.
+string.  If set to a function, the HTML exporter expects the function
+to return a string upon execution.  The HTML exporter inserts this
+string in the preamble.  The HTML exporter does not insert a preamble
+if ~org-html-preamble~ is set ~nil~.
+
+The above also applies to ~org-html-postamble~ and
+~org-html-postamble-format~.  In addition, ~org-html-postamble~ can be
+set to ~auto~ (its default value), which makes the HTML exporter build
+a postamble from looking up author's name, email address, creator's
+name, and date.
+
 
 *** Quoting HTML tags
 :PROPERTIES:
@@ -12894,7 +13113,7 @@ changing the link's title and style:
 
 #+cindex: @samp{ATTR_HTML}, keyword
 #+begin_example
-,#+ATTR_HTML: :title The Org mode homepage :style color:red;
+,#+ATTR_HTML: :title The Org mode website :style color:red;
 [[https://orgmode.org]]
 #+end_example
 
@@ -13010,20 +13229,22 @@ as-is.
 
 #+vindex: org-html-mathjax-options~
 LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two
-different ways on HTML pages.  The default is to use the 
[[https://www.mathjax.org][MathJax]],
-which should work out of the box with Org[fn:129][fn:130].  Some MathJax
-display options can be configured via ~org-html-mathjax-options~, or
-in the buffer.  For example, with the following settings,
+different ways on HTML pages.  The default is to use the
+[[https://www.mathjax.org][MathJax]], which should work out of the box
+with Org[fn:: By default, Org loads MathJax from
+[[https://www.jsdelivr.com/][jsDelivr]], as recommended in
+[[https://docs.mathjax.org/en/latest/web/start.html][Getting Started
+with MathJax Components]].][fn:46].  Some MathJax display options can
+be configured via ~org-html-mathjax-options~, or in the buffer.  For
+example, with the following settings,
 
 #+begin_example
-,#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
-,#+HTML_MATHJAX: cancel.js noErrors.js
+,#+HTML_MATHJAX: align: left indent: 5em tagside: left
 #+end_example
 
 #+texinfo: @noindent
 equation labels are displayed on the left margin and equations are
-five em from the left margin.  In addition, it loads the two MathJax
-extensions =cancel.js= and =noErrors.js=[fn:131].
+five em from the left margin.
 
 #+vindex: org-html-mathjax-template
 See the docstring of ~org-html-mathjax-options~ for all supported
@@ -13086,10 +13307,12 @@ line.
 #+vindex: org-export-html-todo-kwd-class-prefix
 #+vindex: org-export-html-tag-class-prefix
 You can modify the CSS style definitions for the exported file.  The
-HTML exporter assigns the following special CSS classes[fn:132] to
-appropriate parts of the document---your style specifications may
-change these, in addition to any of the standard classes like for
-headlines, tables, etc.
+HTML exporter assigns the following special CSS classes[fn:: If the
+classes on TODO keywords and tags lead to conflicts, use the variables
+~org-html-todo-kwd-class-prefix~ and ~org-html-tag-class-prefix~ to
+make them unique.] to appropriate parts of the document---your style
+specifications may change these, in addition to any of the standard
+classes like for headlines, tables, etc.
 
 | ~p.author~           | author information, including email                   
 |
 | ~p.date~             | publishing date                                       
 |
@@ -13154,7 +13377,7 @@ external file.
 
 #+cindex: @samp{HTML_CONTAINER_CLASS}, property
 #+cindex: @samp{HTML_HEADLINE_CLASS}, property
-In order to add styles to a sub-tree, use the =HTML_CONTAINER_CLASS=
+In order to add styles to a subtree, use the =HTML_CONTAINER_CLASS=
 property to assign a class to the tree.  In order to specify CSS
 styles for a particular headline, you can use the ID specified in
 a =CUSTOM_ID= property.  You can also assign a specific class to
@@ -13323,7 +13546,7 @@ LaTeX export back-end finds the compiler version to use 
from
 Org file.  See the docstring for the
 ~org-latex-default-packages-alist~ for loading packages with certain
 compilers.  Also see ~org-latex-bibtex-compiler~ to set the
-bibliography compiler[fn:133].
+bibliography compiler[fn:47].
 
 *** LaTeX specific export settings
 :PROPERTIES:
@@ -13349,15 +13572,23 @@ general options (see [[*Export Settings]]).
 - =LANGUAGE= ::
   #+cindex: @samp{LANGUAGE}, keyword
   #+vindex: org-latex-packages-alist
+  #+vindex: org-latex-language-alist
+
+  Language code of the primary document language.
+
+  The list of language codes supported by Org is stored in the
+  variable ~org-latex-language-alist~.
+
   In order to be effective, the =babel= or =polyglossia=
   packages---according to the LaTeX compiler used---must be loaded
   with the appropriate language as argument.  This can be accomplished
   by modifying the ~org-latex-packages-alist~ variable, e.g., with the
-  following snippet:
+  following snippet (note that =polyglossia= does not work with
+  pdfLaTeX):
 
   #+begin_src emacs-lisp
   (add-to-list 'org-latex-packages-alist
-               '("AUTO" "babel" t ("pdflatex")))
+               '("AUTO" "babel" t ("pdflatex" "xelatex" "lualatex")))
   (add-to-list 'org-latex-packages-alist
                '("AUTO" "polyglossia" t ("xelatex" "lualatex")))
   #+end_src
@@ -13447,7 +13678,7 @@ By default, the LaTeX export back-end uses the 
/article/ class.
 To change the default class globally, edit ~org-latex-default-class~.
 To change the default class locally in an Org file, add option lines
 =#+LATEX_CLASS: myclass=.  To change the default class for just a part
-of the Org file, set a sub-tree property, =EXPORT_LATEX_CLASS=.  The
+of the Org file, set a subtree property, =EXPORT_LATEX_CLASS=.  The
 class name entered here must be valid member of ~org-latex-classes~.
 This variable defines a header template for each class into which the
 exporter splices the values of ~org-latex-default-packages-alist~ and
@@ -13487,6 +13718,54 @@ A sample Org file with the above headers:
   some more text
 #+end_example
 
+#+cindex: @samp{LANGUAGE}, keyword
+#+vindex: org-export-default-language
+LaTeX packages =babel= or =polyglossia= can also be loaded in a
+document.  The "AUTO" string will be replaced in both cases by the
+appropriate value for the =LANGUAGE= keyword, if present in the
+document, or by the value of ~org-export-default-language~.  Let's see
+some examples in one or another case.
+
+=Babel= accepts the classic syntax and (in addition) the new syntax
+with the =\babelprovide= command to load the languages using the new
+=INI= files procedure.  Keep in mind that there are a number of
+languages that are only served in babel using =INI= files, so they
+cannot be declared using the classic syntax, but only using the
+=\babelprovide= command (see
+https://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf).
+Valid usage examples could be:
+
+#+begin_example
+,#+LATEX_HEADER: \usepackage[french,italian,AUTO]{babel}
+#+end_example
+
+where "AUTO" is the main language.  But it can also be loaded using
+the =\babelprovide= command:
+
+#+begin_example
+,#+LATEX_HEADER: \usepackage[french,italian]{babel}
+,#+LATEX_HEADER: \babelprovide[import, main]{AUTO}
+#+end_example
+
+=Polyglossia=, for this procedure to be effective, must be loaded
+using the same =babel= classic syntax (but note that /this is not/
+the actual polyglossia syntax).  For example, suppose a document
+declares Polytonic Greek as the primary language, and French as the
+secondary language.  In this case, it would be expressed as:
+
+#+begin_example
+,#+LANGUAGE: el-polyton
+,#+LATEX_HEADER: \usepackage[french,AUTO]{polyglossia}
+#+end_example
+
+This would produce in LaTeX (with the actual =polyglossia= syntax):
+
+#+begin_example
+\usepackage{polyglossia}
+\setmainlanguage[variant=polytonic]{greek}
+\setotherlanguage{french}
+#+end_example
+
 *** Quoting LaTeX code
 :PROPERTIES:
 :DESCRIPTION: Incorporating literal @LaTeX{} code.
@@ -13533,10 +13812,12 @@ include:
   #+vindex: org-latex-default-table-mode
   The LaTeX export back-end wraps the table differently depending on
   the mode for accurate rendering of math symbols.  Mode is either
-  =table=, =math=, =inline-math= or =verbatim=.
+  =table=, =math=, =inline-math=, =verbatim= or =tabbing=.
 
   For =math= or =inline-math= mode, LaTeX export back-end wraps the
   table in a math environment, but every cell in it is exported as-is.
+  For =tabbing= the LaTeX tabbing environment is used and the correct
+  tabbing delimiters =\>= are used.
   The LaTeX export back-end determines the default mode from
   ~org-latex-default-table-mode~.  The LaTeX export back-end merges
   contiguous tables in the same mode into a single environment.
@@ -13565,7 +13846,12 @@ include:
 
   The table environments by default are not floats in LaTeX.  To make
   them floating objects use =:float= with one of the following
-  options: =sideways=, =multicolumn=, =t=, and =nil=.
+  options: =t= (for a default =table= environment), =sideways= (for a
+  =sidewaystable= environment), =multicolumn= (to span the table
+  across multiple columns of a page in a =table*= environment) and
+  =nil=.  In addition to these three values, =:float= can pass through
+  any arbitrary value, for example a user-defined float type with the
+  =float= LaTeX package.
 
   LaTeX floats can also have additional layout =:placement=
   attributes.  These are the usual =[h t b p ! H]= permissions
@@ -13577,6 +13863,14 @@ include:
   The LaTeX export back-end uses these attributes for regular tables
   to set their alignments, fonts, and widths.
 
+- =:options= ::
+
+  The =:options= attribute allows adding an optional argument with
+  a list of various table options (between brackets in LaTeX export),
+  since certain tabular environments, such as longtblr of the
+  tabularray LaTeX package, provides this structure.  For example:
+  =:options remark{Note}={note},remark{Source}={source}=.
+
 - =:spread= ::
 
   When =:spread= is non-~nil~, the LaTeX export back-end spreads or
@@ -13671,8 +13965,7 @@ attribute to one of the following:
 
 - =t= ::
 
-  For a standard =figure= environment; used by default whenever an
-  image has a caption.
+  For a default =figure= environment.
 
 - =multicolumn= ::
 
@@ -13693,6 +13986,12 @@ attribute to one of the following:
 
   To avoid a =:float= even if using a caption.
 
+- Any arbitrary value ::
+
+  For example, a user-defined float type with the =float= LaTeX
+  package.
+
+
 Use the =placement= attribute to modify a floating environment's
 placement.
 
@@ -13780,22 +14079,29 @@ objects through the attributes =:float= and 
=:options=.  For =:float=:
 
 #+vindex: org-latex-listings-options
 #+vindex: org-latex-minted-options
+#+vindex: org-latex-engraved-options
 The LaTeX export back-end passes string values in =:options= to LaTeX
 packages for customization of that specific source block.  In the
-example below, the =:options= are set for Minted.  Minted is a source
-code highlighting LaTeX package with many configurable options[fn:134].
+example below, the =:options= are set for Engraved or Minted.  Minted
+is a source code highlighting LaTeX package with many configurable
+options[fn:: Minted uses an external Python package for code
+highlighting, which requires the flag =-shell-escape= to be added to
+~org-latex-pdf-process~.].  Both Minted and Engraved are built on
+[[https://www.ctan.org/pkg/fvextra][fvextra]], and so support many of
+the same options.
 
 #+begin_example
-,#+ATTR_LATEX: :options commentstyle=\bfseries
+,#+ATTR_LATEX: :options mathescape
 ,#+BEGIN_SRC emacs-lisp
-  (defun Fib (n)
+  (defun Fib (n) ; $n_i = n_{i-2} + n_{i-1}$
     (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
 ,#+END_SRC
 #+end_example
 
-To apply similar configuration options for all source blocks in
-a file, use the ~org-latex-listings-options~ and
-~org-latex-minted-options~ variables.
+To apply similar configuration options for all source blocks in a
+file, use the ~org-latex-listings-options~,
+~org-latex-engraved-options~, and ~org-latex-minted-options~
+variables.
 
 *** Example blocks in LaTeX export
 :PROPERTIES:
@@ -14034,8 +14340,10 @@ a limit to a level before the absolute limit (see 
[[*Export Settings]]).
 
 The ODT export back-end handles creating of OpenDocument Text (ODT)
 format.  Documents created by this exporter use the
-{{{cite(OpenDocument-v1.2 specification)}}}[fn:135] and are compatible
-with LibreOffice 3.4.
+{{{cite(OpenDocument-v1.2 specification)}}}[fn:: See
+[[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open
+Document Format for Office Applications (OpenDocument) Version 1.2]].]
+and are compatible with LibreOffice 3.4.
 
 *** Pre-requisites for ODT export
 :PROPERTIES:
@@ -14070,7 +14378,7 @@ executable.  Without it, export cannot finish.
 
   If the selected region is a single tree, the ODT export back-end
   makes the tree head the document title.  Incidentally, {{{kbd(C-c
-  @)}}} selects the current sub-tree.  If the tree head entry has, or
+  @)}}} selects the current subtree.  If the tree head entry has, or
   inherits, an =EXPORT_FILE_NAME= property, the ODT export back-end
   uses that for file name.
 
@@ -14220,7 +14528,7 @@ The example here shows creating a style using 
LibreOffice.
 
 The ODT export back-end relies on many templates and style names.
 Using third-party styles and templates can lead to mismatches.
-Templates derived from built in ODT templates and styles seem to have
+Templates derived from built-in ODT templates and styles seem to have
 fewer problems.
 
 *** Links in ODT export
@@ -14435,8 +14743,10 @@ document in one of the following ways:
   variables ~org-latex-to-mathml-convert-command~ and
   ~org-latex-to-mathml-jar-file~.
 
-  If you prefer to use MathToWeb[fn:136] as your converter, you can
-  configure the above variables as shown below.
+  If you prefer to use MathToWeb[fn:: See
+  [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].]
+  as your converter, you can configure the above variables as shown
+  below.
 
   #+begin_src emacs-lisp
   (setq org-latex-to-mathml-convert-command
@@ -14446,7 +14756,8 @@ document in one of the following ways:
   #+end_src
 
   #+texinfo: @noindent
-  or, to use LaTeX​ML[fn:137] instead,
+  or, to use LaTeX​ML[fn:: See [[https://dlmf.nist.gov/LaTeXML/]].]
+  instead,
 
   #+begin_src emacs-lisp
   (setq org-latex-to-mathml-convert-command
@@ -14765,7 +15076,9 @@ with the =#+ATTR_ODT= line.  For a discussion on 
default formatting of
 tables, see [[*Tables in ODT export]].
 
 This feature closely mimics the way table templates are defined in the
-OpenDocument-v1.2 specification[fn:138].
+OpenDocument-v1.2 specification[fn::
+[[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2
+Specification]]].
 
 #+vindex: org-odt-table-styles
 For quick preview of this feature, install the settings below and export the
@@ -14799,7 +15112,8 @@ templates, define new styles there.
 
 To use this feature proceed as follows:
 
-1. Create a table template[fn:139].
+1. Create a table template[fn:: See the =<table:table-template>=
+   element of the OpenDocument-v1.2 specification.].
 
    A table template is set of =table-cell= and =paragraph= styles for
    each of the following table cell categories:
@@ -14838,7 +15152,12 @@ To use this feature proceed as follows:
    =</office:automatic-styles>= element of the content template file
    (see [[x-orgodtcontenttemplate-xml][Factory styles]]).
 
-2. Define a table style[fn:140].
+2. Define a table style[fn:: See the attributes =table:template-name=,
+   =table:use-first-row-styles=, =table:use-last-row-styles=,
+   =table:use-first-column-styles=, =table:use-last-column-styles=,
+   =table:use-banding-rows-styles=, and
+   =table:use-banding-column-styles= of the =<table:table>= element in
+   the OpenDocument-v1.2 specification.].
 
    #+vindex: org-odt-table-styles
    To define a table style, create an entry for the style in the
@@ -15221,6 +15540,23 @@ This paragraph is preceded by...
 :DESCRIPTION: List attributes.
 :END:
 
+#+cindex: lettered lists, in Texinfo export
+#+cindex: enum, Texinfo attribute
+The Texinfo export back-end converts unordered and ordered lists in
+the Org file using the default command =@itemize=.
+
+Ordered lists are numbered when exported to Texinfo format.  Such
+numbering obeys any counter (see [[*Plain Lists]]) in the first item of
+the list.  The =:enum= attribute also let you start the list at a
+specific number, or switch to a lettered list, as illustrated here:
+
+#+begin_example
+#+ATTR_TEXINFO: :enum A
+1. Alpha
+2. Bravo
+3. Charlie
+#+end_example
+
 #+cindex: @samp{ATTR_TEXINFO}, keyword
 #+cindex: two-column tables, in Texinfo export
 #+cindex: table-type, Texinfo attribute
@@ -15262,20 +15598,89 @@ This is the common text for variables foo and bar.
 @end table
 #+end_example
 
-#+cindex: lettered lists, in Texinfo export
-#+cindex: enum, Texinfo attribute
-Ordered lists are numbered when exported to Texinfo format.  Such
-numbering obeys any counter (see [[*Plain Lists]]) in the first item of
-the list.  The =:enum= attribute also let you start the list at
-a specific number, or switch to a lettered list, as illustrated here
+The =:compact= attribute is an alternative to the =:sep= attribute,
+which allows writing each entry on its own line.  If this attribute is
+non-nil and an item in a description list has no body but is followed
+by another item, then the second item is transcoded to =@itemx=.  This
+example is transcoded to the same output as above.
 
 #+begin_example
-#+ATTR_TEXINFO: :enum A
-1. Alpha
-2. Bravo
-3. Charlie
+,#+ATTR_TEXINFO: :table-type vtable :indic asis :compact t
+- foo ::
+- bar ::
+  This is the common text for variables foo and bar.
+#+end_example
+
+Support for this compact syntax can also be enabled for all lists in
+a file using the =compact-itemx= export option, or globally using the
+variable ~org-texinfo-compact-itemx~.
+
+The Texinfo export back-end also supports two approaches to writing
+Texinfo definition commands (see [[info:texinfo::Definition Commands]]).
+One of them uses description lists and is described below, the other
+relies on special blocks (see [[*Special blocks in Texinfo export]]).
+
+Items in a description list in a Org file that begin with =Function:=
+or certain other prefixes are converted using Texinfo definition
+commands.  This works even if other items in the same list do not have
+such a prefix; if necessary a single description list is converted
+using multiple tables (such as =@vtable=) and definition commands
+(such as =@defun=).
+
+#+begin_example
+- Function: org-texinfo-drawer drawer contents info ::
+  Transcode a DRAWER element from Org to Texinfo.
+#+end_example
+
+#+texinfo: @noindent
+becomes
+
+#+begin_example
+@defun org-texinfo-drawer drawer contents info ::
+  Transcode a DRAWER element from Org to Texinfo.
+@end defun
 #+end_example
 
+The recognized prefixes are =Command:=, =Function:=, =Macro:=,
+=Special Form:=, =Variable:= and =User Option:=.  These are the same
+prefixes that appear in the Info file for the respective definition
+commands.  For example a =Function:= item in the Org file is converted
+to a =@defun= command in the Texinfo file, which in turn is converted
+to a definition prefixed with =-- Function:= in the Info file.
+
+As a special case the prefix =Key:= is also recognized.  No Texinfo
+definition command exists for key bindings and the output in Info
+files also lacks the =Key:= prefix.  Even so this special case is
+supported because it provides a convenient shorthand, as illustrated
+here:
+
+#+begin_example
+- Key: C-c C-c (do-something) ::
+  This command does something.
+
+- User Option: do-something-somehow ::
+  This option controls how exactly ~do-something~ does its thing.
+#+end_example
+
+#+texinfo: @noindent
+becomes
+
+#+begin_example
+@table @asis
+@item @kbd{C-c C-c} (@code{do-something})
+@kindex C-c C-c
+@findex do-something
+This command does something.
+@end table
+
+@defopt do-something-somehow
+This option controls how exactly @code{do-something} does its thing.
+@end defopt
+#+end_example
+
+#+texinfo: @noindent
+Command in parenthesis, as done above, is optional.
+
 *** Tables in Texinfo export
 :PROPERTIES:
 :DESCRIPTION: Table attributes.
@@ -15338,11 +15743,42 @@ your king.
 ,#+END_QUOTE
 #+end_example
 
+*** Key bindings in Texinfo export
+:PROPERTIES:
+:DESCRIPTION: @@kbd Texinfo command.
+:END:
+
+Org does not provide any markup for key bindings that corresponds to
+Texinfo's ~@kbd~ and ~@key~ commands.  One way to deal with this is to
+fall back to code syntax.  =~C-x SPC~=, for example, is transcoded to
+~@code{C-x SPC}~.
+
+A better approach is to define and use an Org macro named ~kbd~.  To
+make that easier the function ~org-texinfo-kbd-macro~ is provided,
+which is intended to be used like this:
+
+#+begin_example
+,#+macro: kbd (eval (org-texinfo-kbd-macro $1))
+
+Type {{{kbd(C-c SPC)}}}.
+#+end_example
+
+#+texinfo: @noindent
+which becomes
+
+#+begin_example
+Type @kbd{C-c @key{SPC}}.
+#+end_example
+
 *** Special blocks in Texinfo export
 :PROPERTIES:
 :DESCRIPTION: Special block attributes.
 :END:
 
+The Texinfo export back-end supports two approaches to writing Texinfo
+definition commands.  One of them is described here, the other in
+[[*Plain lists in Texinfo export]].
+
 #+cindex: @samp{ATTR_TEXINFO}, keyword
 
 The Texinfo export back-end converts special blocks to commands with
@@ -15952,7 +16388,9 @@ If you want to publish the Org file as an =.org= file 
but with
 ~org-org-publish-to-org~.  This produces =file.org= and puts it in the
 publishing directory.  If you want a htmlized version of this file,
 set the parameter ~:htmlized-source~ to ~t~.  It produces
-=file.org.html= in the publishing directory[fn:141].
+=file.org.html= in the publishing directory[fn:: If the publishing
+directory is the same as the source directory, =file.org= is exported
+as =file.org.org=, so you probably do not want to do this.].
 
 Other files like images only need to be copied to the publishing
 destination; for this you can use ~org-publish-attachment~.  For
@@ -16110,7 +16548,7 @@ Settings]]), however, override everything.
 | ~:html-preamble-format~                        | ~org-html-preamble-format~  
                      |
 | ~:html-preamble~                               | ~org-html-preamble~         
                      |
 | ~:html-self-link-headlines~                    | 
~org-html-self-link-headlines~                    |
-| ~:html-table-align-individual-field~           | 
~de{org-html-table-align-individual-fields~       |
+| ~:html-table-align-individual-field~           | 
~org-html-table-align-individual-fields~          |
 | ~:html-table-attributes~                       | 
~org-html-table-default-attributes~               |
 | ~:html-table-caption-above~                    | 
~org-html-table-caption-above~                    |
 | ~:html-table-data-tags~                        | ~org-html-table-data-tags~  
                      |
@@ -16141,6 +16579,9 @@ Settings]]), however, override everything.
 | ~:latex-default-table-environment~     | 
~org-latex-default-table-environment~     |
 | ~:latex-default-table-mode~            | ~org-latex-default-table-mode~      
      |
 | ~:latex-diary-timestamp-format~        | ~org-latex-diary-timestamp-format~  
      |
+| ~:latex-engraved-options~              | ~org-latex-engraved-options~        
      |
+| ~:latex-engraved-preamble~             | ~org-latex-engraved-preamble~       
      |
+| ~:latex-engraved-theme~                | ~org-latex-engraved-theme~          
      |
 | ~:latex-footnote-defined-format~       | ~org-latex-footnote-defined-format~ 
      |
 | ~:latex-footnote-separator~            | ~org-latex-footnote-separator~      
      |
 | ~:latex-format-drawer-function~        | ~org-latex-format-drawer-function~  
      |
@@ -16156,12 +16597,12 @@ Settings]]), however, override everything.
 | ~:latex-link-with-unknown-path-format~ | 
~org-latex-link-with-unknown-path-format~ |
 | ~:latex-listings-langs~                | ~org-latex-listings-langs~          
      |
 | ~:latex-listings-options~              | ~org-latex-listings-options~        
      |
-| ~:latex-listings~                      | ~org-latex-listings~                
      |
 | ~:latex-minted-langs~                  | ~org-latex-minted-langs~            
      |
 | ~:latex-minted-options~                | ~org-latex-minted-options~          
      |
 | ~:latex-prefer-user-labels~            | ~org-latex-prefer-user-labels~      
      |
 | ~:latex-subtitle-format~               | ~org-latex-subtitle-format~         
      |
 | ~:latex-subtitle-separate~             | ~org-latex-subtitle-separate~       
      |
+| ~:latex-src-block-backend~             | ~org-latex-src-block-backend~       
      |
 | ~:latex-table-scientific-notation~     | 
~org-latex-table-scientific-notation~     |
 | ~:latex-tables-booktabs~               | ~org-latex-tables-booktabs~         
      |
 | ~:latex-tables-centered~               | ~org-latex-tables-centered~         
      |
@@ -16177,6 +16618,7 @@ Settings]]), however, override everything.
 | ~:md-footnote-format~   | ~org-md-footnote-format~   |
 | ~:md-footnotes-section~ | ~org-md-footnotes-section~ |
 | ~:md-headline-style~    | ~org-md-headline-style~    |
+| ~:md-toplevel-hlevel~   | ~org-md-toplevel-hlevel~   |
 
 **** ODT specific properties
 :PROPERTIES:
@@ -16204,6 +16646,7 @@ Settings]]), however, override everything.
 | ~:texinfo-active-timestamp-format~       | 
~org-texinfo-active-timestamp-format~       |
 | ~:texinfo-classes~                       | ~org-texinfo-classes~             
          |
 | ~:texinfo-class~                         | ~org-texinfo-default-class~       
          |
+| ~:texinfo-compact-itemx                  | ~org-texinfo-compact-itemx~       
          |
 | ~:texinfo-table-default-markup~          | 
~org-texinfo-table-default-markup~          |
 | ~:texinfo-diary-timestamp-format~        | 
~org-texinfo-diary-timestamp-format~        |
 | ~:texinfo-filename~                      | ~org-texinfo-filename~            
          |
@@ -16224,13 +16667,16 @@ Settings]]), however, override everything.
 #+cindex: links, publishing
 
 To create a link from one Org file to another, you would use something
-like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see [[*External 
Links]]).  When
-published, this link becomes a link to =foo.html=.  You can thus
-interlink the pages of your "Org web" project and the links will work
-as expected when you publish them to HTML.  If you also publish the
-Org source file and want to link to it, use an =http= link instead of
-a =file:= link, because =file= links are converted to link to the
-corresponding =.html= file.
+like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see
+[[*External Links]]).  When published, this link becomes a link to
+=foo.html=.  You can thus interlink the pages of your "Org web"
+project and the links will work as expected when you publish them to
+HTML.  If you also publish the Org source file and want to link to it,
+use an =http= link instead of a =file:= link, because =file= links are
+converted to link to the corresponding =.html= file.
+
+Links to encrypted Org files, like =[[file:foo.org.gpg]]= are also
+supported.
 
 You may also link to related files, such as images.  Provided you are
 careful with relative file names, and provided you have also
@@ -16238,11 +16684,11 @@ configured Org to upload the related files, these 
links will work too.
 See [[*Example: complex publishing configuration]], for an example of this
 usage.
 
-Eventually, links between published documents can contain some search
-options (see [[*Search Options in File Links]]), which will be resolved to
-the appropriate location in the linked file.  For example, once
-published to HTML, the following links all point to a dedicated anchor
-in =foo.html=.
+Links between published documents can contain some search options (see
+[[*Search Options in File Links]]), which will be resolved to the
+appropriate location in the linked file.  For example, once published
+to HTML, the following links all point to a dedicated anchor in
+=foo.html=.
 
 #+begin_example
 [[file:foo.org::*heading]]
@@ -16537,7 +16983,13 @@ capabilities:
 - insert :: Add and edit citations via ~org-cite-insert~.
 - export :: Via different libraries for different target formats.
 
-The user can configure these with ~org-cite-activate-processor~,
+To use a "citation processor", the user must load them; for example;
+
+#+begin_src emacs-lisp
+(require 'oc-bibtex)
+#+end_src
+
+They can then configure them with ~org-cite-activate-processor~,
 ~org-cite-follow-processor~, ~org-cite-insert-processor~, and
 ~org-cite-export-processors~ respectively.
 
@@ -16602,15 +17054,18 @@ Org currently includes the following export 
processors:
   - csl :: this export processor uses format files written in 
[[https://en.wikipedia.org/wiki/Citation_Style_Language][Citation
     Style Language]] via 
[[https://github.com/andras-simonyi/citeproc-el][citeproc-el]];
 
-- In contrast, two other processors target LaTeX and LaTeX-derived
+- In contrast, three other processors target LaTeX and LaTeX-derived
   formats exclusively:
 
-  - natbib :: this export processor uses BibTeX, the historical
+  - bibtex :: this export processor uses BibTeX, the historical
     bibliographic processor used with LaTeX, thus allowing the use of
-    data and style files compatible with this processor (including
-    a large number of publishers' styles).  It uses citation commands
-    implemented in the LaTeX package =natbib=, allowing more stylistic
-    variants that LaTeX's =\cite= command.
+    data and style files compatible with this processor (including a
+    large number of publishers' styles). It only supports LaTeX's
+    =\cite= and =\nocite= commands.
+
+  - natbib :: as with the bibtex processor, but using the LaTeX
+    package =natbib=, allowing more stylistic variants that LaTeX's
+    =\cite= command.
 
   - biblatex :: this backend allows the use of data and formats
     prepared for BibLaTeX, an alternate bibliographic processor used
@@ -16643,6 +17098,72 @@ conformant to the Harvard style and the specification 
of the
 Wolkers-Kluwer publisher; since it relies on the ~bibtex~ processor of
 your LaTeX installation, it won't export to anything but PDF.
 
+** Bibliography printing
+
+The =PRINT_BIBLIOGRAPHY= keyword specifies where the bibliography
+should be printed (note the colon):
+
+: #+print_bibliography:
+
+The bibliography printed by the LaTeX-based export processors
+"bibtex", "natbib" and "biblatex" has a chapter or section heading by
+default, while the "basic" and "csl" processors print the list of
+bibliography entries without a heading.
+
+A document may contain more than one =PRINT_BIBLIOGRAPHY= keywords.
+Each of the keywords will trigger printing the bibliography.
+
+The keywords can be used with or without additional options.  Options
+can be used, for example, to print only entries that belong to a
+certain category or to control formatting.  The set of supported
+=PRINT_BIBLIOGRAPHY= options and their interpretation varies between
+the different citation export processors.  Some export processors do
+not support passing options.
+
+*** Bibliography options in the "biblatex" and "csl" export processors
+
+The "biblatex" and "csl" export processors support bibliography
+options through a property list attached to the =PRINT_BIBLIOGRAPHY=
+keyword.  For example,
+
+: #print_bibliography: :keyword algebra :type book
+
+Values including spaces must be surrounded with double quotes.  If you
+need to use a key multiple times, you can separate its values with
+commas, but without any space in-between:
+
+: #print_bibliography: :keyword "algebraic logic" :nottype article,book
+
+The "biblatex" export processor accepts all options supported by
+BibLaTeX's ~\printbibliography~ command, while the "csl" processor
+accepts the following ones:
+
+- =:keyword <keyword(,keyword2...)>= :: Print only entries whose
+  keyword field contains all given keywords.
+
+- =:notkeyword <keyword(,keyword2...)>= :: Print only entries whose
+  keyword field does not contain any of the given keywords.
+
+- =:type <entrytype>= :: Print only entries whose type is
+  =<entrytype>=.  Entry type is the BibTeX/BibLaTeX entry type if this
+  information is available (the entry was read from a BibTeX/BibLaTeX
+  bibliography) and the CSL entry type otherwise.
+
+- =:nottype <entrytype(,entrytype2...)>= :: Print only entries whose
+  type is not among the given entry types.  Entry type is determined
+  as in the case of =:type=.
+
+- =:csltype <entrytype>= :: Print only entries whose CSL entry type
+  (possibly based on a conversion from BibTeX/BibLaTeX to CSL) is
+  =<entrytype>=.
+
+- =:notcsltype <entrytype(,entrytype2...)>= :: Print only entries whose
+  CSL entry type (possibly based on a conversion from BibTeX/BibLaTeX
+  to CSL) is not among the listed entry types.
+
+- =:filter <predicate>= :: Print only entries for which the given
+  Emacs Lisp predicate returns a non-~nil~ value.
+
 * Working with Source Code
 :PROPERTIES:
 :DESCRIPTION: Export, evaluate, and tangle code blocks.
@@ -16803,7 +17324,7 @@ or
   Optional.  Heading arguments control many aspects of evaluation,
   export and tangling of code blocks (see [[*Using Header Arguments]]).
   Using Org's properties feature, header arguments can be selectively
-  applied to the entire buffer or specific sub-trees of the Org
+  applied to the entire buffer or specific subtrees of the Org
   document.
 
 - =<body>= ::
@@ -16843,8 +17364,31 @@ following values:
 :exports    => "code"
 :cache      => "no"
 :noweb      => "no"
+:hlines     => "no"
+:tangle     => "no"
 #+end_example
 
+#+vindex: org-babel-default-inline-header-args
+Inline source blocks (see [[*Structure of Code Blocks]]) use slightly
+different default header arguments defined in
+~org-babel-default-inline-header-args~:
+
+#+begin_example
+:session    => "none"
+:results    => "replace"
+:exports    => "results"
+:hlines     => "yes"
+#+end_example
+
+The most notable difference between default header arguments for
+inline and normal source blocks is =:exports= argument.  For inline
+source blocks, results of evaluation are exported by default; not the
+code.
+
+Unlike the default values, header arguments set using Org mode
+properties (see [[*Header arguments in Org mode properties]]) do apply to
+both the normal source blocks and inline source blocks.
+
 The example below sets =:noweb= header arguments to =yes=, which makes
 Org expand =:noweb= references by default.
 
@@ -16882,13 +17426,13 @@ for any block.
 
 #+vindex: org-use-property-inheritance
 Header arguments set through Org's property drawers (see [[*Property
-Syntax]]) apply at the sub-tree level on down.  Since these property
+Syntax]]) apply at the subtree level on down.  Since these property
 drawers can appear anywhere in the file hierarchy, Org uses outermost
 call or source block to resolve the values.  Org ignores
 ~org-use-property-inheritance~ setting.
 
 In this example, =:cache= defaults to =yes= for all code blocks in the
-sub-tree.
+subtree.
 
 #+begin_example
 ,* sample header
@@ -17177,9 +17721,10 @@ a colon, for example: =:var 
table=other-file.org:example-table=.
   : 4
   #+end_example
 
-- literal example ::
+- literal example, or code block contents ::
 
-  A literal example block named with a =NAME= keyword.
+  A code block or literal example block named with a =NAME= keyword,
+  followed by brackets (optional for example blocks).
 
   #+begin_example
   ,#+NAME: literal-example
@@ -17189,7 +17734,7 @@ a colon, for example: =:var 
table=other-file.org:example-table=.
   ,#+END_EXAMPLE
 
   ,#+NAME: read-literal-example
-  ,#+BEGIN_SRC emacs-lisp :var x=literal-example
+  ,#+BEGIN_SRC emacs-lisp :var x=literal-example[]
     (concatenate #'string x " for you.")
   ,#+END_SRC
 
@@ -17372,6 +17917,13 @@ directory with {{{kbd(M-x cd RET DIRECTORY)}}}, and 
then not setting
 variable ~default-directory~.  Setting =mkdirp= header argument to
 a non-~nil~ value creates the directory, if necessary.
 
+Setting =dir= to the symbol ~attach~ or the string ~"'attach"~ will
+set =dir= to the directory returned by ~(org-attach-dir)~, set =:mkdir
+yes=, and insert any file paths, as when using =:results file=, which
+are under the node's attachment directory using =attachment:= links
+instead of the usual =file:= links.  Any returned path outside of the
+attachment directory will use =file:= links as per usual.
+
 For example, to save the plot file in the =Work/= folder of the home
 directory---notice tilde is expanded:
 
@@ -17450,7 +18002,8 @@ see [[*Code Evaluation and Security Issues]].
 Org captures the results of the code block evaluation and inserts them
 in the Org file, right after the code block.  The insertion point is
 after a newline and the =RESULTS= keyword.  Org creates the =RESULTS=
-keyword if one is not already there.
+keyword if one is not already there.  More details in [[*Results of
+Evaluation]].
 
 By default, Org enables only Emacs Lisp code blocks for execution.
 See [[*Languages]] to enable other languages.
@@ -17459,13 +18012,15 @@ See [[*Languages]] to enable other languages.
 #+kindex: C-c C-v e
 #+findex: org-babel-execute-src-block
 Org provides many ways to execute code blocks.  {{{kbd(C-c C-c)}}} or
-{{{kbd(C-c C-v e)}}} with the point on a code block[fn:142] calls the
+{{{kbd(C-c C-v e)}}} with the point on a code block[fn:: The option
+~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used to remove code
+evaluation from the {{{kbd(C-c C-c)}}} key binding.] calls the
 ~org-babel-execute-src-block~ function, which executes the code in the
 block, collects the results, and inserts them in the buffer.
 
 #+cindex: @samp{CALL}, keyword
 #+vindex: org-babel-inline-result-wrap
-By calling a named code block[fn:143] from an Org mode buffer or
+By calling a named code block[fn:48] from an Org mode buffer or
 a table.  Org can call the named code blocks from the current Org mode
 buffer or from the "Library of Babel" (see [[*Library of Babel]]).
 
@@ -17536,6 +18091,10 @@ The =eval= header argument can limit evaluation of 
specific code
 blocks and =CALL= keyword.  It is useful for protection against
 evaluating untrusted code blocks by prompting for a confirmation.
 
+- =yes= ::
+
+  Org always evaluates the source code without asking permission.
+
 - =never= or =no= ::
 
   Org never evaluates the source code.
@@ -17608,10 +18167,12 @@ The =cache= header argument can have one of two 
values: =yes= or =no=.
 In this example, both functions are cached.  But =caller= runs only if
 the result from =random= has changed since the last run.
 
+# +1 here is to work around Emacs bug#59293.
+# Otherwise, (1) is recognized as footnote reference by info.el.
 #+begin_example
 ,#+NAME: random
 ,#+BEGIN_SRC R :cache yes
-  runif(1)
+  runif(+1)
 ,#+END_SRC
 
 ,#+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
@@ -17666,7 +18227,7 @@ they are mutually exclusive.
 
 - =value= ::
 
-  Default for most Babel libraries[fn:143].  Functional mode.  Org
+  Default for most Babel libraries[fn:48].  Functional mode.  Org
   gets the value by wrapping the code in a function definition in the
   language of the source block.  That is why when using =:results
   value=, code should execute like a function and return a value.  For
@@ -17697,8 +18258,12 @@ they are mutually exclusive.
 :END:
 
 Type tells what result types to expect from the execution of the code
-block.  Choose one of the options; they are mutually exclusive.  The
-default behavior is to automatically determine the result type.
+block.  Choose one of the options; they are mutually exclusive.
+
+The default behavior is to automatically determine the result type.
+The result type detection depends on the code block language, as
+described in the documentation for individual languages.  See
+[[*Languages]].
 
 #+attr_texinfo: :sep ,
 - =table=, =vector= ::
@@ -17849,13 +18414,17 @@ follows from the type specified above.
 
   When used along with =file= type, the result is a link to the file
   specified in =:file= header argument.  However, unlike plain =file=
-  type, nothing is written to the disk.  The block is used for its
-  side-effects only, as in the following example:
+  type, code block output is not written to the disk.  The block is
+  expected to generate the file by its side-effects only, as in the
+  following example:
 
   #+begin_example
-  ,#+begin_src shell :results file link :file "download.tar.gz"
-  wget -c "https://example.com/download.tar.gz";
+  ,#+begin_src shell :results file link :file "org-mode-unicorn.svg"
+    wget -c "https://orgmode.org/resources/img/org-mode-unicorn.svg";
   ,#+end_src
+
+  ,#+RESULTS:
+  [[file:org-mode-unicorn.svg]]
   #+end_example
 
 - =org= ::
@@ -17898,7 +18467,8 @@ value listed above.  E.g.,
 :UNNUMBERED: notoc
 :END:
 
-Handling options after collecting the results.
+Handling options after collecting the results.  Choose one of the
+options; they are mutually exclusive.
 
 - =replace= ::
 
@@ -17912,8 +18482,18 @@ Handling options after collecting the results.
 
 - =none= ::
 
-  Do not process results at all.  No inserting in the Org mode buffer
-  nor echo them in the minibuffer.  Usage example: =:results none=.
+  Compute results, but do not do anything with them.  No inserting in
+  the Org mode buffer nor echo them in the minibuffer.  The results
+  can still be used when referenced from another code block.
+  Usage example: =:results none=.
+
+- =discard= ::
+
+  Ignore the results completely.  This option is similar to =none=,
+  but no processing is performed on the return value.  Calling the
+  code block programmatically (see [[*How to evaluate source code]]) or by
+  reference (see [[*Passing arguments]] and [[*Noweb Reference Syntax]]) will
+  always yield nil.
 
 - =append= ::
 
@@ -18004,10 +18584,11 @@ to pass data between code blocks.
 It is possible to export the /code/ of code blocks, the /results/ of
 code block evaluation, /both/ the code and the results of code block
 evaluation, or /none/.  Org defaults to exporting /code/ for most
-languages.  For some languages, such as ditaa, Org defaults to
-/results/.  To export just the body of code blocks, see [[*Literal
-Examples]].  To selectively export sub-trees of an Org document, see
-[[*Exporting]].
+languages and /results/ for inline code blocks.  For some languages,
+such as ditaa, Org defaults to /results/ both in ordinary source
+blocks and in inline source blocks.  To export just the body of code
+blocks, see [[*Literal Examples]].  To selectively export subtrees of an
+Org document, see [[*Exporting]].
 
 #+cindex: @samp{exports}, header argument
 The =exports= header argument is to specify if that part of the Org
@@ -18034,6 +18615,36 @@ file is exported to, say, HTML or LaTeX formats.
   exported file.  Whether the code is evaluated at all depends on
   other options.  Example: =:exports none=.
 
+If a source block is named using =NAME= keyword, the same name will be
+assigned to the results of evaluation.  This way, fuzzy links pointing
+to the named source blocks exported using =:exports results= will
+remain valid and point to the results of evaluation.
+
+Results of evaluation of a named block can also be explicitly named
+using a separate =NAME= keyword.  The name value set via =NAME=
+keyword will be preferred over the parent source block.
+
+: #+NAME: code name
+: #+BEGIN_SRC emacs-lisp :exports both value
+: (+ 1 2)
+: #+END_SRC
+:
+: #+NAME: results name
+: #+RESULTS: code name
+: 3
+:
+: This [[code name][link]] will point to the code block.
+: Another [[results name][link]] will point to the results.
+
+Explicit setting of the result name may be necessary when a named code
+block is exported using =:exports both=.  Links to such block may
+arbitrarily point either to the code block or to its results when
+results do not have a distinct name.
+
+Note that all the links pointing to a source block exported using
+=:exports none= will be broken.  This will make export process fail,
+unless broken links are allowed during export (see [[*Export Settings]]).
+
 #+vindex: org-export-use-babel
 To stop Org from evaluating code blocks to speed exports, use the
 header argument =:eval never-export= (see [[*Evaluating Code Blocks]]).
@@ -18049,9 +18660,9 @@ in some circumstances.  So during export, to allow 
evaluation of just
 the header arguments but not any code evaluation in the source block,
 set =:eval never-export= (see [[*Evaluating Code Blocks]]).
 
-Org never evaluates code blocks in commented sub-trees when exporting
+Org never evaluates code blocks in commented subtrees when exporting
 (see [[*Comment Lines]]).  On the other hand, Org does evaluate code
-blocks in sub-trees excluded from export (see [[*Export Settings]]).
+blocks in subtrees excluded from export (see [[*Export Settings]]).
 
 ** Extracting Source Code
 :PROPERTIES:
@@ -18165,13 +18776,23 @@ the tangled file's executable permission.
 
 #+cindex: @samp{tangle-mode}, header argument
 The =tangle-mode= header argument specifies what permissions to set
-for tangled files by ~set-file-modes~.  For example, to make
-a read-only tangled file, use =:tangle-mode (identity #o444)=.  To
-make it executable, use =:tangle-mode (identity #o755)=.  It also
-overrides executable permission granted by =shebang=.  When multiple
-source code blocks tangle to a single file with different and
-conflicting =tangle-mode= header arguments, Org's behavior is
-undefined.
+for tangled files by ~set-file-modes~.  Permissions are given by an
+octal value, which can be provided calling the ~identity~ function on
+an elisp octal value. For instance, to create a read-only file one may
+use =:tangle-mode (identity #o444)=. To reduce the verbosity required,
+a octal shorthand is defined, =oXXX= (=o= for octal). Using this, our
+read-only example is =:tangle-mode o444=. Omitting the =o= prefix will
+cause the argument to be interpreted as an integer, which can lead to
+unexpected results (=444= is the same as =o674=).
+Two other shorthands are recognized, ls-style strings like
+=rw-r--r--=, and chmod-style permissions like =g+w=.
+Note that chmod-style permissions are based on
+~org-babel-tangle-default-file-mode~, which is =#o544= by default.
+
+When =:tangle-mode= and =:shebang= are both specified, the give
+=:tangle-mode= will override the permissions from =:shebang=. When
+multiple source code blocks tangle to a single file with conflicting
+=:tangle-mode= header arguments, Org's behavior is undefined.
 
 #+cindex: @samp{no-expand}, header argument
 By default Org expands code blocks during tangling.  The =no-expand=
@@ -18208,6 +18829,20 @@ expanded anyway.
 :UNNUMBERED: notoc
 :END:
 
+- ~org-babel-pre-tangle-hook~ ::
+
+  #+vindex: org-babel-pre-tangle-hook
+  This hook is run before the tangle process begins.  The active
+  buffer is buffer to be tangled.
+
+- ~org-babel-tangle-body-hook~ ::
+
+  #+vindex: org-babel-tangle-body-hook
+  This hook is run from a temporary buffer containing expanded code of
+  every tangled code block.  The hook can modify the expanded code as
+  needed.  The contents of the current buffer will be used as actual
+  code block expansion.
+
 - ~org-babel-post-tangle-hook~ ::
 
   #+vindex: org-babel-post-tangle-hook
@@ -18215,6 +18850,10 @@ expanded anyway.
   ~org-babel-tangle~, making it suitable for post-processing,
   compilation, and evaluation of code in the tangled files.
 
+- ~org-babel-tangle-finished-hook~ ::
+  #+vindex: org-babel-tangle-finished-hook
+  This hook is run after post-tangle hooks, in the original buffer.
+
 *** Jumping between code and Org
 :PROPERTIES:
 :UNNUMBERED: notoc
@@ -18239,8 +18878,8 @@ code block header arguments:
 #+cindex: source code, languages
 #+cindex: code block, languages
 
-Code blocks in dozens of languages are supported.  See Worg for
-[[https://orgmode.org/worg/org-contrib/babel/languages/index.html][language 
specific documentation]].
+Code blocks in dozens of languages are supported.  See Worg website
+for 
[[https://orgmode.org/worg/org-contrib/babel/languages/index.html][language 
specific documentation]].
 
 #+vindex: org-babel-load-languages
 By default, only Emacs Lisp is enabled for evaluation.  To enable or
@@ -18354,7 +18993,8 @@ for Python and Emacs Lisp languages.
 
 #+cindex: @samp{noweb-ref}, header argument
 Source code blocks can include references to other source code blocks,
-using a noweb[fn:144] style syntax:
+using a noweb[fn:: For noweb literate programming details, see
+https://www.cs.tufts.edu/~nr/noweb/.] style syntax:
 
 : <<CODE-BLOCK-ID>>
 
@@ -18387,6 +19027,12 @@ tangled, or exported.
   Expansion of noweb syntax references in the body of the code block
   when tangling.  No expansion when evaluating or exporting.
 
+- =strip-tangle= ::
+
+  Expansion of noweb syntax references in the body of the code block
+  when evaluating or exporting.  Removes noweb syntax references
+  when exporting.
+
 - =no-export= ::
 
   Expansion of noweb syntax references in the body of the code block
@@ -18429,7 +19075,7 @@ the second code block is expanded as
 #+end_example
 
 You may also include the contents of multiple blocks sharing a common
-=noweb-ref= header argument, which can be set at the file, sub-tree,
+=noweb-ref= header argument, which can be set at the file, subtree,
 or code block level.  In the example Org file shown next, the body of
 the source code in each block is extracted for concatenation to a pure
 code file when tangled.
@@ -18587,6 +19233,23 @@ else:
     print('do things when false')
 #+end_example
 
+This prefix behavior can be turned off in a block by setting the
+=noweb-prefix= header argument to =no=, as in:
+
+#+begin_example
+,#+BEGIN_SRC elisp :noweb-prefix no
+  (setq example-data "<<example>>")
+,#+END_SRC
+#+end_example
+
+#+texinfo: @noindent
+which expands to:
+
+#+begin_example
+(setq example-data "this is the
+multi-line body of example")
+#+end_example
+
 When in doubt about the outcome of a source code block expansion, you
 can preview the results with the following command:
 
@@ -18865,7 +19528,8 @@ Org Tempo expands snippets to structures defined in
 ~org-structure-template-alist~ and ~org-tempo-keywords-alist~.  For
 example, {{{kbd(< s TAB)}}} creates a code block.  Enable it by
 customizing ~org-modules~ or add =(require 'org-tempo)= to your Emacs
-init file[fn:145].
+init file[fn:: For more information, please refer to the commentary
+section in =org-tempo.el=.].
 
 #+attr_texinfo: :columns 0.1 0.9
 | {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= |
@@ -18945,7 +19609,7 @@ in the desired amount with hard spaces and hiding 
leading stars.
 To display the buffer in the indented view, activate Org Indent minor
 mode, using {{{kbd(M-x org-indent-mode)}}}.  Text lines that are not
 headlines are prefixed with virtual spaces to vertically align with
-the headline text[fn:146].
+the headline text[fn:49].
 
 #+vindex: org-indent-indentation-per-level
 To make more horizontal space, the headlines are shifted by two
@@ -18973,9 +19637,10 @@ use =STARTUP= keyword as follows:
 
 It is possible to use hard spaces to achieve the indentation instead,
 if the bare ASCII file should have the indented look also outside
-Emacs[fn:147].  With Org's support, you have to indent all lines to
-line up with the outline headers.  You would use these
-settings[fn:148]:
+Emacs[fn:50].  With Org's support, you have to indent all lines to
+line up with the outline headers.  You would use these settings[fn::
+~org-adapt-indentation~ can also be set to ='headline-data=, in which
+case only data lines below the headline will be indented.]:
 
 #+begin_src emacs-lisp
 (setq org-adapt-indentation t
@@ -19138,9 +19803,10 @@ manual, but here is a consolidated list for easy 
reference.
 #+cindex: special keywords
 
 In-buffer settings start with =#+=, followed by a keyword, a colon,
-and then a word for each setting.  Org accepts multiple settings on
-the same line.  Org also accepts multiple lines for a keyword.  This
-manual describes these settings throughout.  A summary follows here.
+one or more spaces, and then a word for each setting.  Org accepts
+multiple settings on the same line.  Org also accepts multiple lines
+for a keyword.  This manual describes these settings throughout.  A
+summary follows here.
 
 #+cindex: refresh set-up
 {{{kbd(C-c C-c)}}} activates any changes to the in-buffer settings.
@@ -19246,7 +19912,10 @@ changes.
 
   #+vindex: org-startup-indented
   Dynamic virtual indentation is controlled by the variable
-  ~org-startup-indented~[fn:149].
+  ~org-startup-indented~[fn:: Note that Org Indent mode also sets the
+  ~wrap-prefix~ property, such that Visual Line mode (or purely
+  setting ~word-wrap~) wraps long lines, including headlines,
+  correctly indented.].
 
   | =indent=   | Start with Org Indent mode turned on.  |
   | =noindent= | Start with Org Indent mode turned off. |
@@ -19352,11 +20021,16 @@ changes.
   | =nofnadjust= | Do not renumber and sort automatically.                |
 
   #+vindex: org-hide-block-startup
-  To hide blocks on startup, use these keywords.  The
-  corresponding variable is ~org-hide-block-startup~.
+  #+vindex: org-hide-drawer-startup
+  To hide blocks or drawers on startup, use these keywords.  The
+  corresponding variables are ~org-hide-block-startup~ and
+  ~org-hide-drawer-startup~.
+
+  | =hideblocks=    | Hide all begin/end blocks on startup. |
+  | =nohideblocks=  | Do not hide blocks on startup.        |
+  | =hidedrawers=   | Hide all begin/end blocks on startup. |
+  | =nohidedrawers= | Do not hide blocks on startup.        |
 
-  | =hideblocks=   | Hide all begin/end blocks on startup. |
-  | =nohideblocks= | Do not hide blocks on startup.        |
 
   #+vindex: org-pretty-entities
   The display of entities as UTF-8 characters is governed by the
@@ -19775,6 +20449,7 @@ moves across a special context.
               (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
               (define-key yas/keymap [tab] 'yas/next-field)))
   #+end_src
+
 ** Using Org on a TTY
 :PROPERTIES:
 :DESCRIPTION: Using Org on a tty.
@@ -20045,8 +20720,9 @@ Here is a suggestion for Org Crypt settings in Emacs 
init file:
 (setq org-tags-exclude-from-inheritance '("crypt"))
 
 (setq org-crypt-key nil)
-;; GPG key to use for encryption
-;; Either the Key ID or set to nil to use symmetric encryption.
+;; GPG key to use for encryption.
+;; nil means  use symmetric encryption unconditionally.
+;; "" means use symmetric encryption unless heading sets CRYPTKEY property.
 
 (setq auto-save-default nil)
 ;; Auto-saving does not cooperate with org-crypt.el: so you need to
@@ -20068,6 +20744,10 @@ specifying the respective key as property =CRYPTKEY=, 
e.g.:
   :END:
 #+end_example
 
+Note that =CRYPTKEY= property is only effective when ~org-crypt-key~
+is set to non-nil.  ~nil~ value of ~org-crypt-key~ makes Org use
+symmetric encryption unconditionally.
+
 Excluding the =crypt= tag from inheritance prevents already encrypted
 text from being encrypted again.
 
@@ -20103,7 +20783,7 @@ Tags]]) only for those set in these variables.
 
 #+vindex: org-mobile-directory
 The mobile application needs access to a file directory on
-a server[fn:150] to interact with Emacs.  Pass its location through
+a server[fn:51] to interact with Emacs.  Pass its location through
 the ~org-mobile-directory~ variable.  If you can mount that directory
 locally just set the variable to point to that directory:
 
@@ -20124,10 +20804,12 @@ With a public server, consider encrypting the files.  
Org also
 requires OpenSSL installed on the local computer.  To turn on
 encryption, set the same password in the mobile application and in
 Emacs.  Set the password in the variable
-~org-mobile-use-encryption~[fn:151].  Note that even after the mobile
-application encrypts the file contents, the file name remains visible
-on the file systems of the local computer, the server, and the mobile
-device.
+~org-mobile-use-encryption~[fn:: If Emacs is configured for safe
+storing of passwords, then configure the variable
+~org-mobile-encryption-password~; please read the docstring of that
+variable.].  Note that even after the mobile application encrypts the
+file contents, the file name remains visible on the file systems of
+the local computer, the server, and the mobile device.
 
 *** Pushing to the mobile application
 :PROPERTIES:
@@ -20140,16 +20822,19 @@ The command ~org-mobile-push~ copies files listed in
 ~org-mobile-files~ into the staging area.  Files include agenda files
 (as listed in ~org-agenda-files~).  Customize ~org-mobile-files~ to
 add other files.  File names are staged with paths relative to
-~org-directory~, so all files should be inside this directory[fn:152].
+~org-directory~, so all files should be inside this directory[fn::
+Symbolic links in ~org-directory~ need to have the same name as their
+targets.].
 
 Push creates a special Org file =agendas.org= with custom agenda views
-defined by the user[fn:153].
+defined by the user[fn:52].
 
 Finally, Org writes the file =index.org=, containing links to other
 files.  The mobile application reads this file first from the server
 to determine what other files to download for agendas.  For faster
-downloads, it is expected to only read files whose checksums[fn:154]
-have changed.
+downloads, it is expected to only read files whose checksums[fn::
+Checksums are stored automatically in the file =checksums.dat=.]  have
+changed.
 
 *** Pulling from the mobile application
 :PROPERTIES:
@@ -20165,11 +20850,12 @@ data in an inbox file format, through the following 
steps:
 
 1.
    #+vindex: org-mobile-inbox-for-pull
-   Org moves all entries found in =mobileorg.org=[fn:155] and appends
-   them to the file pointed to by the variable
-   ~org-mobile-inbox-for-pull~.  It should reside neither in the
-   staging area nor on the server.  Each captured entry and each
-   editing event is a top-level entry in the inbox file.
+   Org moves all entries found in =mobileorg.org=[fn:: The file will
+   be empty after this operation.] and appends them to the file
+   pointed to by the variable ~org-mobile-inbox-for-pull~.  It should
+   reside neither in the staging area nor on the server.  Each
+   captured entry and each editing event is a top-level entry in the
+   inbox file.
 
 2.
    #+cindex: @samp{FLAGGED}, tag
@@ -20459,11 +21145,12 @@ of these strategies:
 #+cindex: @LaTeX{}, and Orgtbl mode
 
 To wrap a source table in LaTeX, use the =comment= environment
-provided by =comment.sty=[fn:156].  To activate it, put
-~\usepackage{comment}~ in the document header.  Orgtbl mode inserts
-a radio table skeleton[fn:157] with the command {{{kbd(M-x
-orgtbl-insert-radio-table)}}}, which prompts for a table name.  For
-example, if =salesfigures= is the name, the template inserts:
+provided by =comment.sty=[fn:: https://www.ctan.org/pkg/comment].  To
+activate it, put ~\usepackage{comment}~ in the document header.
+Orgtbl mode inserts a radio table skeleton[fn:53] with the command
+{{{kbd(M-x orgtbl-insert-radio-table)}}}, which prompts for a table
+name.  For example, if =salesfigures= is the name, the template
+inserts:
 
 #+begin_example
 % BEGIN RECEIVE ORGTBL salesfigures
@@ -20480,7 +21167,7 @@ The line =#+ORGTBL: SEND= tells Orgtbl mode to use the 
function
 ~orgtbl-to-latex~ to convert the table to LaTeX format, then insert
 the table at the target (receive) location named =salesfigures=.  Now
 the table is ready for data entry.  It can even use spreadsheet
-features[fn:158]:
+features[fn:54]:
 
 #+begin_example
 % BEGIN RECEIVE ORGTBL salesfigures
@@ -20696,10 +21383,12 @@ Dynamic blocks, like any other block, can be narrowed 
with
 #+vindex: org-agenda-skip-function
 #+vindex: org-agenda-skip-function-global
 Org provides a special hook to further limit items in agenda views:
-~agenda~, ~agenda*~[fn:159], ~todo~, ~alltodo~, ~tags~, ~tags-todo~,
-~tags-tree~.  Specify a custom function that tests inclusion of every
-matched item in the view.  This function can also skip as much as is
-needed.
+~agenda~, ~agenda*~[fn:: The ~agenda*~ view is the same as ~agenda~
+except that it only considers /appointments/, i.e., scheduled and
+deadline items that have a time specification =[h]h:mm= in their
+time-stamps.], ~todo~, ~alltodo~, ~tags~, ~tags-todo~, ~tags-tree~.
+Specify a custom function that tests inclusion of every matched item
+in the view.  This function can also skip as much as is needed.
 
 For a global condition applicable to agenda views, use the
 ~org-agenda-skip-function-global~ variable.  Org uses a global
@@ -20737,11 +21426,15 @@ meaningful string suitable for the agenda view.
 
 #+vindex: org-odd-levels-only
 #+vindex: org-agenda-skip-function
+#+findex: org-agenda-skip-entry-if
+#+findex: org-agenda-skip-subtree-if
 Search for entries with a limit set on levels for the custom search.
 This is a general approach to creating custom searches in Org.  To
-include all levels, use =LEVEL>0=[fn:160].  Then to selectively pick
-the matched entries, use ~org-agenda-skip-function~, which also
-accepts Lisp forms, such as ~org-agenda-skip-entry-if~ and
+include all levels, use =LEVEL>0=[fn:: Note that, for
+~org-odd-levels-only~, a level number corresponds to order in the
+hierarchy, not to the number of stars.].  Then to selectively pick the
+matched entries, use ~org-agenda-skip-function~, which also accepts
+Lisp forms, such as ~org-agenda-skip-entry-if~ and
 ~org-agenda-skip-subtree-if~.  For example:
 
 - =(org-agenda-skip-entry-if 'scheduled)= ::
@@ -20834,6 +21527,17 @@ number.  Here are tips to speed up:
   (setq org-agenda-use-tag-inheritance nil)
   #+end_src
 
+  #+vindex: org-agenda-ignore-properties
+- Disable parsing of some drawer properties:
+
+  #+begin_src emacs-lisp
+  (setq org-agenda-ignore-properties '(effort appt stats category))
+  #+end_src
+
+  The drawer properties you can disable in the agenda are effort
+  estimates (~effort~), appointments (~appt~), statistics (~stats~)
+  and subtree-local categories (~category~).
+
 These options can be applied to selected agenda views.  For more
 details about generation of agenda views, see the docstrings for the
 relevant variables, and this 
[[https://orgmode.org/worg/agenda-optimization.html][dedicated Worg page]] for 
agenda
@@ -21067,13 +21771,13 @@ Call {{{var(FUNC)}}} at each headline selected by 
{{{var(MATCH)}}} in
 
 {{{var(FUNC)}}} is a function or a Lisp form.  With point positioned
 at the beginning of the headline, call the function without arguments.
-Org returns an alist of return values of calls to the function.
+Org returns a list of return values of calls to the function.
 
 To avoid preserving point, Org wraps the call to {{{var(FUNC)}}} in
 ~save-excursion~ form.  After evaluation, Org moves point to the end
 of the line that was just processed.  Search continues from that point
 forward.  This may not always work as expected under some conditions,
-such as if the current sub-tree was removed by a previous archiving
+such as if the current subtree was removed by a previous archiving
 operation.  In such rare circumstances, Org skips the next entry
 entirely when it should not.  To stop Org from such skips, make
 {{{var(FUNC)}}} set the variable ~org-map-continue-from~ to a specific
@@ -21627,308 +22331,147 @@ modify this GNU manual."
 
 * Footnotes
 
-[fn:1] If you do not use Font Lock globally turn it on in Org buffer
-with =(add-hook 'org-mode-hook #'turn-on-font-lock)=.
-
-[fn:2] Please consider subscribing to the mailing list in order to
-minimize the work the mailing list moderators have to do.
-
-[fn:3] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
+[fn:1] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
 and ~org-ctrl-k-protect-subtree~ to configure special behavior of
 {{{kbd(C-a)}}}, {{{kbd(C-e)}}}, and {{{kbd(C-k)}}} in headlines.  Note
 also that clocking only works with headings indented less than 30
 stars.
 
-[fn:4] See, however, the option ~org-cycle-emulate-tab~.
-
-[fn:5] The indirect buffer contains the entire buffer, but is narrowed
+[fn:2] The indirect buffer contains the entire buffer, but is narrowed
 to the current tree.  Editing the indirect buffer also changes the
 original buffer, but without affecting visibility in that buffer.  For
 more information about indirect buffers, see [[info:emacs#Indirect 
Buffers][GNU Emacs Manual]].
 
-[fn:6] When ~org-agenda-inhibit-startup~ is non-~nil~, Org does not
-honor the default visibility state when first opening a file for the
-agenda (see [[*Speeding Up Your Agendas]]).
-
-[fn:7] See also the variable ~org-show-context-detail~ to decide how
-much context is shown around each match.
-
-[fn:8] This depends on the option ~org-remove-highlights-with-change~.
-
-[fn:9] When using =*= as a bullet, lines must be indented so that they
+[fn:3] When using =*= as a bullet, lines must be indented so that they
 are not interpreted as headlines.  Also, when you are hiding leading
 stars to get a clean outline view, plain list items starting with
 a star may be hard to distinguish from true headlines.  In short: even
 though =*= is supported, it may be better to not use it for plain list
 items.
 
-[fn:10] You can filter out any of them by configuring
-~org-plain-list-ordered-item-terminator~.
-
-[fn:11] You can also get =a.=, =A.=, =a)= and =A)= by configuring
+[fn:4] You can also get =a.=, =A.=, =a)= and =A)= by configuring
 ~org-list-allow-alphabetical~.  To minimize confusion with normal
 text, those are limited to one character only.  Beyond that limit,
 bullets automatically become numbers.
 
-[fn:12] If there's a checkbox in the item, the cookie must be put
+[fn:5] If there's a checkbox in the item, the cookie must be put
 /before/ the checkbox.  If you have activated alphabetical lists, you
 can also use counters like =[@b]=.
 
-[fn:13] If you do not want the item to be split, customize the
-variable ~org-M-RET-may-split-line~.
-
-[fn:14] If you want to cycle around items that way, you may customize
-~org-list-use-circular-motion~.
-
-[fn:15] See ~org-list-use-circular-motion~ for a cyclic behavior.
-
-[fn:16] Many desktops intercept {{{kbd(M-TAB)}}} to switch windows.
+[fn:6] Many desktops intercept {{{kbd(M-TAB)}}} to switch windows.
 Use {{{kbd(C-M-i)}}} or {{{kbd(ESC TAB)}}} instead.
 
-[fn:17] To insert a vertical bar into a table field, use =\vert= or,
-inside a word =abc\vert{}def=.
-
-[fn:18] Org understands references typed by the user as =B4=, but it
+[fn:7] Org understands references typed by the user as =B4=, but it
 does not use this syntax when offering a formula for editing.  You can
 customize this behavior using the variable
 ~org-table-use-standard-references~.
 
-[fn:19] The computation time scales as O(N^2) because table
-{{{var(FOO)}}} is parsed for each field to be copied.
-
-[fn:20] The file =constants.el= can supply the values of constants in
+[fn:8] The file =constants.el= can supply the values of constants in
 two different unit systems, =SI= and =cgs=.  Which one is used depends
 on the value of the variable ~constants-unit-system~.  You can use the
 =STARTUP= options =constSI= and =constcgs= to set this value for the
 current buffer.
 
-[fn:21] The printf reformatting is limited in precision because the
+[fn:9] The printf reformatting is limited in precision because the
 value passed to it is converted into an "integer" or "double".  The
 "integer" is limited in size by truncating the signed value to 32
 bits.  The "double" is limited in precision to 64 bits overall which
 leaves approximately 16 significant decimal digits.
 
-[fn:22] Such names must start with an alphabetic character and use
-only alphanumeric/underscore characters.
-
-[fn:23] Plain URIs are recognized only for a well-defined set of
+[fn:10] Plain URIs are recognized only for a well-defined set of
 schemes.  See [[*External Links]].  Unlike URI syntax, they cannot contain
 parenthesis or white spaces, either.  URIs within angle brackets have
 no such limitation.
 
-[fn:24] More accurately, the precise behavior depends on how point
-arrived there---see [[info:elisp#Invisible Text][Invisible Text]].
-
-[fn:25] To insert a link targeting a headline, in-buffer completion
+[fn:11] To insert a link targeting a headline, in-buffer completion
 can be used.  Just type a star followed by a few optional letters into
 the buffer and press {{{kbd(M-TAB)}}}.  All headlines in the current
 buffer are offered as completions.
 
-[fn:26] When targeting a =NAME= keyword, the =CAPTION= keyword is
-mandatory in order to get proper numbering (see [[*Captions]]).
-
-[fn:27] The actual behavior of the search depends on the value of the
+[fn:12] The actual behavior of the search depends on the value of the
 variable ~org-link-search-must-match-exact-headline~.  If its value is
 ~nil~, then a fuzzy text search is done.  If it is ~t~, then only the
 exact headline is matched, ignoring spaces and statistic cookies.  If
 the value is ~query-to-create~, then an exact headline is searched; if
 it is not found, then the user is queried to create it.
 
-[fn:28] If the headline contains a timestamp, it is removed from the
-link, which results in a wrong link---you should avoid putting
-a timestamp in the headline.
-
-[fn:29] The Org Id library must first be loaded, either through
-~org-customize~, by enabling ~id~ in ~org-modules~, or by adding
-=(require 'org-id)= in your Emacs init file.
-
-[fn:30] Note that you do not have to use this command to insert
+[fn:13] Note that you do not have to use this command to insert
 a link.  Links in Org are plain text, and you can type or paste them
 straight into the buffer.  By using this command, the links are
 automatically enclosed in double brackets, and you will be asked for
 the optional descriptive text.
 
-[fn:31] After insertion of a stored link, the link will be removed
+[fn:14] After insertion of a stored link, the link will be removed
 from the list of stored links.  To keep it in the list for later use,
 use a triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
 configure the option ~org-link-keep-stored-after-insertion~.
 
-[fn:32] This works if a function has been defined in the ~:complete~
-property of a link in ~org-link-parameters~.
-
-[fn:33] See the variable ~org-link-use-indirect-buffer-for-internals~.
-
-[fn:34] For backward compatibility, line numbers can also follow a
-single colon.
-
-[fn:35] Of course, you can make a document that contains only long
-lists of TODO items, but this is not required.
-
-[fn:36] Changing the variable ~org-todo-keywords~ only becomes
-effective after restarting Org mode in a buffer.
-
-[fn:37] This is also true for the {{{kbd(t)}}} command in the agenda
-buffer.
-
-[fn:38] All characters are allowed except =@=, =^= and =!=, which have
-a special meaning here.
-
-[fn:39] Check also the variable ~org-fast-tag-selection-include-todo~,
+[fn:15] Check also the variable ~org-fast-tag-selection-include-todo~,
 it allows you to change the TODO state through the tags interface (see
 [[*Setting Tags]]), in case you like to mingle the two concepts.  Note
 that this means you need to come up with unique keys across both sets
 of keywords.
 
-[fn:40] Org mode parses these lines only when Org mode is activated
-after visiting a file.  {{{kbd(C-c C-c)}}} with point in a line
-starting with =#+= is simply restarting Org mode for the current
-buffer.
-
-[fn:41] The corresponding in-buffer setting is: =#+STARTUP: logdone=.
-
-[fn:42] The corresponding in-buffer setting is: =#+STARTUP:
-lognotedone=.
-
-[fn:43] See the variable ~org-log-states-order-reversed~.
-
-[fn:44] Note that the =LOGBOOK= drawer is unfolded when pressing
-{{{kbd(SPC)}}} in the agenda to show an entry---use {{{kbd(C-u
-SPC)}}} to keep it folded here.
-
-[fn:45] It is possible that Org mode records two timestamps when you
+[fn:16] It is possible that Org mode records two timestamps when you
 are using both ~org-log-done~ and state change logging.  However, it
 never prompts for two notes: if you have configured both, the state
 change recording note takes precedence and cancel the closing note.
 
-[fn:46] See also the option ~org-priority-start-cycle-with-default~.
-
-[fn:47] To keep subtasks out of the global TODO list, see the option
-~org-agenda-todo-list-sublevels~.
-
-[fn:48] With the exception of description lists.  But you can allow it
+[fn:17] With the exception of description lists.  But you can allow it
 by modifying ~org-list-automatic-rules~ accordingly.
 
-[fn:49] Set the variable ~org-hierarchical-checkbox-statistics~ if you
-want such cookies to count all checkboxes below the cookie, not just
-those belonging to direct children.
-
-[fn:50] {{{kbd(C-u C-c C-c)}}} on the /first/ item of a list with no
-checkbox adds checkboxes to the rest of the list.
-
-[fn:51] As with all these in-buffer settings, pressing {{{kbd(C-c
-C-c)}}} activates any changes in the line.
-
-[fn:52] This is only true if the search does not involve more complex
-tests including properties (see [[*Property Searches]]).
-
-[fn:53] To extend this default list to all tags used in all agenda
-files (see [[*Agenda Views]]), customize the variable
-~org-complete-tags-always-offer-all-agenda-tags~.
-
-[fn:54] Keys are automatically assigned to tags that have no
-configured keys.
-
-[fn:55] If more than one summary type applies to the same property,
-the parent values are computed according to the first of them.
-
-[fn:56] An age can be defined as a duration, using units defined in
+[fn:18] An age can be defined as a duration, using units defined in
 ~org-duration-units~, e.g., =3d 1h=.  If any value in the column is as
 such, the summary is also expressed as a duration.
 
-[fn:57] Please note that the =COLUMNS= definition must be on a single
-line; it is wrapped here only because of formatting constraints.
-
-[fn:58] Contributed packages are not part of Emacs, but are
-distributed with the main distribution of Org---visit
-[[https://orgmode.org]].
-
-[fn:59] The Org date format is inspired by the standard ISO 8601
+[fn:19] The Org date format is inspired by the standard ISO 8601
 date/time format.  To use an alternative format, see [[*Custom time
 format]].  The day name is optional when you type the date yourself.
 However, any date inserted or modified by Org adds that day name, for
 reading convenience.
 
-[fn:60] When working with the standard diary expression functions, you
+[fn:20] When working with the standard diary expression functions, you
 need to be very careful with the order of the arguments.  That order
 depends evilly on the variable ~calendar-date-style~.  For example, to
-specify a date December 12, 2005, the call might look like
+specify a date December 1, 2005, the call might look like
 =(diary-date 12 1 2005)= or =(diary-date 1 12 2005)= or =(diary-date
 2005 12 1)=, depending on the settings.  This has been the source of
 much confusion.  Org mode users can resort to special versions of
-these functions like ~org-date~ or ~org-anniversary~.  These work just
-like the corresponding ~diary-~ functions, but with stable ISO order
-of arguments (year, month, day) wherever applicable, independent of
-the value of ~calendar-date-style~.
+these functions, namely ~org-date~, ~org-anniversary~, ~org-cyclic, and
+~org-block~.  These work just like the corresponding ~diary-~
+functions, but with stable ISO order of arguments (year, month, day)
+wherever applicable, independent of the value of
+~calendar-date-style~.
 
-[fn:61] See the variable ~org-read-date-prefer-future~.  You may set
+[fn:21] See the variable ~org-read-date-prefer-future~.  You may set
 that variable to the symbol ~time~ to even make a time before now
 shift the date to tomorrow.
 
-[fn:62] If you do not need/want the calendar, configure the variable
-~org-popup-calendar-for-date-prompt~.
-
-[fn:63] You can also use the calendar command {{{kbd(.)}}} to jump to
+[fn:22] You can also use the calendar command {{{kbd(.)}}} to jump to
 today's date, but if you are inserting an hour specification for your
 timestamp, {{{kbd(.)}}} will then insert a dot after the hour.  By contrast,
 {{{kbd(C-.)}}} will always jump to today's date.
 
-[fn:64] If you find this distracting, turn off the display with
-~org-read-date-display-live~.
-
-[fn:65] It will still be listed on that date after it has been marked
+[fn:23] It will still be listed on that date after it has been marked
 as done.  If you do not like this, set the variable
 ~org-agenda-skip-scheduled-if-done~.
 
-[fn:66] The =SCHEDULED= and =DEADLINE= dates are inserted on the line
+[fn:24] The =SCHEDULED= and =DEADLINE= dates are inserted on the line
 right below the headline.  Do not put any text between this line and
 the headline.
 
-[fn:67] Note the corresponding =STARTUP= options =logredeadline=,
-=lognoteredeadline=, and =nologredeadline=.
-
-[fn:68] Note the corresponding =STARTUP= options =logreschedule=,
-=lognotereschedule=, and =nologreschedule=.
-
-[fn:69] Org does not repeat inactive timestamps, however.  See
+[fn:25] Org does not repeat inactive timestamps, however.  See
 [[*Timestamps]].
 
-[fn:70] In fact, the target state is taken from, in this sequence, the
-=REPEAT_TO_STATE= property, the variable ~org-todo-repeat-to-state~ if
-it is a string, the previous TODO state if ~org-todo-repeat-to-state~
-is ~t~, or the first state of the TODO state sequence.
-
-[fn:71] You can change this using the option ~org-log-repeat~, or the
+[fn:26] You can change this using the option ~org-log-repeat~, or the
 =STARTUP= options =logrepeat=, =lognoterepeat=, and =nologrepeat=.
 With =lognoterepeat=, you will also be prompted for a note.
 
-[fn:72] Clocking only works if all headings are indented with less
+[fn:27] Clocking only works if all headings are indented with less
 than 30 stars.  This is a hard-coded limitation of ~lmax~ in
 ~org-clock-sum~.
 
-[fn:73] To resume the clock under the assumption that you have worked
-on this task while outside Emacs, use =(setq org-clock-persist t)=.
-
-[fn:74] To add an effort estimate "on the fly", hook a function doing
-this to ~org-clock-in-prepare-hook~.
-
-[fn:75] The last reset of the task is recorded by the =LAST_REPEAT=
-property.
-
-[fn:76] See also the variable ~org-clock-mode-line-total~.
-
-[fn:77] The corresponding in-buffer setting is: =#+STARTUP:
-lognoteclock-out=.
-
-[fn:78] When using ~:step~, ~untilnow~ starts from the beginning of
-2003, not the beginning of time.
-
-[fn:79] Language terms can be set through the variable
-~org-clock-clocktable-language-setup~.
-
-[fn:80] Note that all parameters must be specified in a single
-line---the line is broken here only to fit it into the manual.
-
-[fn:81] On computers using macOS, idleness is based on actual user
+[fn:28] On computers using macOS, idleness is based on actual user
 idleness, not just Emacs' idle time.  For X11, you can install a
 utility program =x11idle.c=, available in the =org-contrib/=
 repository, or install the xprintidle package and set it to the
@@ -21936,67 +22479,34 @@ variable ~org-clock-x11idle-program-name~ if you are 
running Debian,
 to get the same general treatment of idleness.  On other systems, idle
 time refers to Emacs idle time only.
 
-[fn:82] Please note the pitfalls of summing hierarchical data in
-a flat list (see [[*Using Column View in the Agenda]]).
-
-[fn:83] Note the corresponding =STARTUP= options =logrefile=,
-=lognoterefile=, and =nologrefile=.
-
-[fn:84] Org used to offer four different targets for date/week tree
+[fn:29] Org used to offer four different targets for date/week tree
 capture.  Now, Org automatically translates these to use
 ~file+olp+datetree~, applying the ~:time-prompt~ and ~:tree-type~
 properties.  Please rewrite your date/week-tree targets using
 ~file+olp+datetree~ since the older targets are now deprecated.
 
-[fn:85] A date tree is an outline structure with years on the highest
+[fn:30] A date tree is an outline structure with years on the highest
 level, months or ISO weeks as sublevels and then dates on the lowest
-level.  Tags are allowed in the tree structure.
-
-[fn:86] When the file name is not absolute, Org assumes it is relative
-to ~org-directory~.
+level.
 
-[fn:87] If you need one of these sequences literally, escape the =%=
-with a backslash.
+#+begin_example
+,* 2022
+,** 2022-10 October
+,*** 2022-10-07 Friday
+,*** 2022-10-08 Saturday
+#+end_example
 
-[fn:88] If you define your own link types (see [[*Adding Hyperlink
-Types]]), any property you store with ~org-store-link-props~ can be
-accessed in capture templates in a similar way.
+Tags are allowed in the tree structure.
 
-[fn:89] This is always the other, not the user.  See the variable
+[fn:31] This is always the other, not the user.  See the variable
 ~org-link-from-user-regexp~.
 
-[fn:90] If you move entries or Org files from one directory to
-another, you may want to configure ~org-attach-id-dir~ to contain
-an absolute path.
-
-[fn:91] If the value of that variable is not a list, but a single file
-name, then the list of agenda files in maintained in that external
-file.
-
-[fn:92] When using the dispatcher, pressing {{{kbd(<)}}} before
-selecting a command actually limits the command to the current file,
-and ignores ~org-agenda-files~ until the next dispatcher command.
-
-[fn:93] For backward compatibility, you can also press {{{kbd(1)}}} to
-restrict to the current buffer.
-
-[fn:94] For backward compatibility, you can also press {{{kbd(0)}}} to
-restrict to the current region/subtree.
-
-[fn:95] For backward compatibility, the universal prefix argument
+[fn:32] For backward compatibility, the universal prefix argument
 {{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda.
 This feature is deprecated, use the dedicated TODO list, or a block
 agenda instead (see [[*Block agenda]]).
 
-[fn:96] The variable ~org-anniversary~ used in the example is just
-like ~diary-anniversary~, but the argument order is always according
-to ISO and therefore independent of the value of
-~calendar-date-style~.
-
-[fn:97] You can, however, disable this by setting
-~org-agenda-search-headline-for-time~ variable to a ~nil~ value.
-
-[fn:98] Custom agenda commands can preset a filter by binding one of
+[fn:33] Custom agenda commands can preset a filter by binding one of
 the variables ~org-agenda-tag-filter-preset~,
 ~org-agenda-category-filter-preset~, ~org-agenda-effort-filter-preset~
 or ~org-agenda-regexp-filter-preset~ as an option.  This filter is
@@ -22006,229 +22516,97 @@ property of the entire agenda view---in a block 
agenda, you should
 only set this in the global options section, not in the section of an
 individual block.
 
-[fn:99] Only tags filtering is respected here, effort filtering is
-ignored.
-
-[fn:100] You can also create persistent custom functions through
-~org-agenda-bulk-custom-functions~.
-
-[fn:101] This file is parsed for the agenda when
-~org-agenda-include-diary~ is set.
-
-[fn:102] You can provide a description for a prefix key by inserting
-a cons cell with the prefix and the description.
-
-[fn:103] /Planned/ means here that these entries have some planning
+[fn:34] /Planned/ means here that these entries have some planning
 information attached to them, like a time-stamp, a scheduled or
 a deadline string.  See ~org-agenda-entry-types~ on how to set what
 planning information is taken into account.
 
-[fn:104] For HTML you need to install Hrvoje Nikšić's =htmlize.el=
-as an Emacs package from [[https://elpa.nongnu.org/][NonGNU ELPA]] or from 
[[https://github.com/hniksic/emacs-htmlize][Hrvoje Nikšić's repository]].
-
-[fn:105] To create PDF output, the Ghostscript ps2pdf utility must be
+[fn:35] To create PDF output, the Ghostscript ps2pdf utility must be
 installed on the system.  Selecting a PDF file also creates the
 postscript file.
 
-[fn:106] If you want to store standard views like the weekly agenda or
-the global TODO list as well, you need to define custom commands for
-them in order to be able to specify file names.
-
-[fn:107] Quoting depends on the system you use, please check the FAQ
-for examples.
-
-[fn:108] You can turn this on by default by setting the variable
-~org-pretty-entities~, or on a per-file base with the =STARTUP= option
-=entitiespretty=.
-
-[fn:109] This behavior can be disabled with =-= export setting (see
-[[*Export Settings]]).
-
-[fn:110] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
+[fn:36] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
 system.  Many of the features described here as "LaTeX" are really
 from TeX, but for simplicity I am blurring this distinction.
 
-[fn:111] When MathJax is used, only the environments recognized by
+[fn:37] When MathJax is used, only the environments recognized by
 MathJax are processed.  When dvipng, dvisvgm, or ImageMagick suite is
 used to create images, any LaTeX environment is handled.
 
-[fn:112] These are respectively available at
+[fn:38] These are respectively available at
 [[https://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]]
 and from the ImageMagick suite.  Choose the converter by setting the
 variable ~org-preview-latex-default-process~ accordingly.
 
-[fn:113] Org mode has a method to test if point is inside such
-a fragment, see the documentation of the function
-~org-inside-LaTeX-fragment-p~.
-
-[fn:114] This works automatically for the HTML backend (it requires
+[fn:39] This works automatically for the HTML backend (it requires
 version 1.34 of the =htmlize.el= package, which you need to install).
 Fontified code chunks in LaTeX can be achieved using either the
-[[https://www.ctan.org/pkg/listings][listings]] package or the 
[[https://www.ctan.org/pkg/minted][minted]] package.  Refer to
-~org-latex-listings~ for details.
+[[https://www.ctan.org/pkg/listings][listings]] LaTeX package, 
[[https://www.ctan.org/pkg/minted][minted]] LaTeX package, or by using
+[[https://elpa.gnu.org/packages/engrave-faces.html][engrave-faces]] .  Refer 
to ~org-latex-src-block-backend~ for details.
 
-[fn:115] Source code in code blocks may also be evaluated either
+[fn:40] Source code in code blocks may also be evaluated either
 interactively or on export.  See [[*Working with Source Code]] for more
 information on evaluating code blocks.
 
-[fn:116] Adding =-k= to =-n -r= /keeps/ the labels in the source code
-while using line numbers for the links, which might be useful to
-explain those in an Org mode example code.
-
-[fn:117] You may select a different mode with the variable
-~org-edit-fixed-width-region-mode~.
-
-[fn:118] What Emacs considers to be an image depends on
-~image-file-name-extensions~ and ~image-file-name-regexps~.
-
-[fn:119] The variable ~org-startup-with-inline-images~ can be set
-within a buffer with the =STARTUP= options =inlineimages= and
-=noinlineimages=.
-
-[fn:120] The corresponding in-buffer setting is: =#+STARTUP: fninline=
-or =#+STARTUP: nofninline=.
-
-[fn:121] The corresponding in-buffer options are =#+STARTUP: fnadjust=
-and =#+STARTUP: nofnadjust=.
-
-[fn:122] The variable ~org-export-date-timestamp-format~ defines how
-this timestamp are exported.
-
-[fn:123] For export to LaTeX format---or LaTeX-related formats such as
+[fn:41] For export to LaTeX format---or LaTeX-related formats such as
 Beamer---, the =org-latex-package-alist= variable needs further
 configuration.  See [[LaTeX specific export settings]].
 
-[fn:124] At the moment, some export back-ends do not obey this
+[fn:42] At the moment, some export back-ends do not obey this
 specification.  For example, LaTeX export excludes every unnumbered
 headline from the table of contents.
 
-[fn:125] Note that ~org-link-search-must-match-exact-headline~ is
+[fn:43] Note that ~org-link-search-must-match-exact-headline~ is
 locally bound to non-~nil~.  Therefore, ~org-link-search~ only matches
 headlines and named elements.
 
-[fn:126] Since commas separate the arguments, commas within arguments
+[fn:44] Since commas separate the arguments, commas within arguments
 have to be escaped with the backslash character.  So only those
 backslash characters before a comma need escaping with another
 backslash character.
 
-[fn:127] For a less drastic behavior, consider using a select tag (see
-[[*Export Settings]]) instead.
-
-[fn:128] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
+[fn:45] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
 to make it visible.  The tag serves as a visual aid and has no
 semantic relevance.
 
-[fn:129] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as 
recommended by
-[[https://www.mathjax.org][MathJax]].
-
-[fn:130] Please note that exported formulas are part of an HTML
+[fn:46] Please note that exported formulas are part of an HTML
 document, and that signs such as =<=, =>=, or =&= have special
-meanings.  See 
[[https://docs.mathjax.org/en/latest/tex.html#tex-and-latex-in-html-documents][MathJax
 TeX and LaTeX support]].
-
-[fn:131] See [[https://docs.mathjax.org/en/latest/tex.html#tex-extensions][TeX 
and LaTeX extensions]] in the [[https://docs.mathjax.org][MathJax manual]] to 
learn
-about extensions.
+meanings.  See 
[[https://docs.mathjax.org/en/latest/input/tex/html.html#tex-and-latex-in-html-documents][MathJax
 TeX and LaTeX in HTML documents]].
 
-[fn:132] If the classes on TODO keywords and tags lead to conflicts,
-use the variables ~org-html-todo-kwd-class-prefix~ and
-~org-html-tag-class-prefix~ to make them unique.
-
-[fn:133] This does not allow setting different bibliography compilers
+[fn:47] This does not allow setting different bibliography compilers
 for different files.  However, "smart" LaTeX compilation systems, such
 as latexmk, can select the correct bibliography compiler.
 
-[fn:134] Minted uses an external Python package for code highlighting,
-which requires the flag =-shell-escape= to be added to
-~org-latex-pdf-process~.
-
-[fn:135] See 
[[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document 
Format for Office Applications
-(OpenDocument) Version 1.2]].
-
-[fn:136] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].
-
-[fn:137] See [[https://dlmf.nist.gov/LaTeXML/]].
-
-[fn:138] 
[[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2
 Specification]]
-
-[fn:139] See the =<table:table-template>= element of the
-OpenDocument-v1.2 specification.
-
-[fn:140] See the attributes =table:template-name=,
-=table:use-first-row-styles=, =table:use-last-row-styles=,
-=table:use-first-column-styles=, =table:use-last-column-styles=,
-=table:use-banding-rows-styles=, and =table:use-banding-column-styles=
-of the =<table:table>= element in the OpenDocument-v1.2 specification.
-
-[fn:141] If the publishing directory is the same as the source
-directory, =file.org= is exported as =file.org.org=, so you probably
-do not want to do this.
-
-[fn:142] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used
-to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding.
-
-[fn:143] Actually, the constructs =call_<name>()= and =src_<lang>{}=
+[fn:48] Actually, the constructs =call_<name>()= and =src_<lang>{}=
 are not evaluated when they appear in a keyword (see [[*Summary of
 In-Buffer Settings]]).
 
-[fn:144] For noweb literate programming details, see
-https://www.cs.tufts.edu/~nr/noweb/.
-
-[fn:145] For more information, please refer to the commentary section
-in =org-tempo.el=.
-
-[fn:146] Org Indent mode also sets ~wrap-prefix~ correctly for
+[fn:49] Org Indent mode also sets ~wrap-prefix~ correctly for
 indenting and wrapping long lines of headlines or text.  This minor
 mode also handles Visual Line mode and directly applied settings
 through ~word-wrap~.
 
-[fn:147] This works, but requires extra effort.  Org Indent mode is
+[fn:50] This works, but requires extra effort.  Org Indent mode is
 more convenient for most applications.
 
-[fn:148] ~org-adapt-indentation~ can also be set to ='headline-data=,
-in which case only data lines below the headline will be indented.
-
-[fn:149] Note that Org Indent mode also sets the ~wrap-prefix~
-property, such that Visual Line mode (or purely setting ~word-wrap~)
-wraps long lines, including headlines, correctly indented.
-
-[fn:150] For a server to host files, consider using a WebDAV server,
+[fn:51] For a server to host files, consider using a WebDAV server,
 such as [[https://nextcloud.com][Nextcloud]].  Additional help is at this 
[[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]].
 
-[fn:151] If Emacs is configured for safe storing of passwords, then
-configure the variable ~org-mobile-encryption-password~; please read
-the docstring of that variable.
-
-[fn:152] Symbolic links in ~org-directory~ need to have the same name
-as their targets.
-
-[fn:153] While creating the agendas, Org mode forces =ID= properties
+[fn:52] While creating the agendas, Org mode forces =ID= properties
 on all referenced entries, so that these entries can be uniquely
 identified if Org Mobile flags them for further action.  To avoid
 setting properties configure the variable
 ~org-mobile-force-id-on-agenda-items~ to ~nil~.  Org mode then relies
 on outline paths, assuming they are unique.
 
-[fn:154] Checksums are stored automatically in the file
-=checksums.dat=.
-
-[fn:155] The file will be empty after this operation.
-
-[fn:156] https://www.ctan.org/pkg/comment
-
-[fn:157] By default this works only for LaTeX, HTML, and Texinfo.
+[fn:53] By default this works only for LaTeX, HTML, and Texinfo.
 Configure the variable ~orgtbl-radio-table-templates~ to install
 templates for other modes.
 
-[fn:158] If the =TBLFM= keyword contains an odd number of dollar
+[fn:54] If the =TBLFM= keyword contains an odd number of dollar
 characters, this may cause problems with Font Lock in LaTeX mode.  As
 shown in the example you can fix this by adding an extra line inside
 the =comment= environment that is used to balance the dollar
 expressions.  If you are using AUCTeX with the font-latex library,
 a much better solution is to add the =comment= environment to the
 variable ~LaTeX-verbatim-environments~.
-
-[fn:159] The ~agenda*~ view is the same as ~agenda~ except that it
-only considers /appointments/, i.e., scheduled and deadline items that
-have a time specification =[h]h:mm= in their time-stamps.
-
-[fn:160] Note that, for ~org-odd-levels-only~, a level number
-corresponds to order in the hierarchy, not to the number of stars.
diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi
index 84933a9ca7..37d62c7c41 100644
--- a/doc/misc/rcirc.texi
+++ b/doc/misc/rcirc.texi
@@ -691,11 +691,11 @@ window is showing them), the mode line will now show you 
the abbreviated
 channel or nick name.  Use @kbd{C-c C-@key{SPC}} to switch to these
 buffers.
 
-@cindex rcirc-track-abbrevate-flag
+@cindex rcirc-track-abbreviate-flag
 By default the channel names are abbreviated, set
-@code{rcirc-track-abbrevate-flag} to a non-@code{nil} value. This might be
-interesting if the IRC activities are not tracked in the mode line,
-but somewhere else.
+@code{rcirc-track-abbreviate-flag} to a non-@code{nil} value.  This
+might be interesting if the IRC activities are not tracked in the mode
+line, but somewhere else.
 
 @vindex rcirc-mode-hook
 If you prefer not to load @code{rcirc} immediately, you can delay the
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 09f2d28c2f..cfc77a84ea 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{2022-09-21.15}
+\def\texinfoversion{2022-11-12.22}
 %
 % Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc.
 %
@@ -2544,34 +2544,30 @@ end
   \scriptfont\sffam=\sevensf
 }
 
-%
 
-% The font-changing commands (all called \...fonts) redefine the meanings
-% of \STYLEfont, instead of just \STYLE.  We do this because \STYLE needs
-% to also set the current \fam for math mode.  Our \STYLE (e.g., \rm)
-% commands hardwire \STYLEfont to set the current font.
-%
-% The fonts used for \ifont are for "math italics"  (\itfont is for italics
-% in regular text).  \syfont is also used in math mode only.
-%
-% Each font-changing command also sets the names \lsize (one size lower)
-% and \lllsize (three sizes lower).  These relative commands are used
-% in, e.g., the LaTeX logo and acronyms.
-%
-% This all needs generalizing, badly.
+
+% \defineassignfonts{SIZE} -
+%   Define sequence \assignfontsSIZE, which switches between font sizes
+% by redefining the meanings of \STYLEfont.  (Just \STYLE additionally sets
+% the current \fam for math mode.)
 %
+\def\defineassignfonts#1{%
+  \expandafter\edef\csname assignfonts#1\endcsname{%
+    \let\noexpand\rmfont\csname #1rm\endcsname
+    \let\noexpand\itfont\csname #1it\endcsname
+    \let\noexpand\slfont\csname #1sl\endcsname
+    \let\noexpand\bffont\csname #1bf\endcsname
+    \let\noexpand\ttfont\csname #1tt\endcsname
+    \let\noexpand\smallcaps\csname #1sc\endcsname
+    \let\noexpand\sffont  \csname #1sf\endcsname
+    \let\noexpand\ifont   \csname #1i\endcsname
+    \let\noexpand\syfont  \csname #1sy\endcsname
+    \let\noexpand\ttslfont\csname #1ttsl\endcsname
+  }
+}
 
 \def\assignfonts#1{%
-  \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
-  \expandafter\let\expandafter\itfont\csname #1it\endcsname
-  \expandafter\let\expandafter\slfont\csname #1sl\endcsname
-  \expandafter\let\expandafter\bffont\csname #1bf\endcsname
-  \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
-  \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
-  \expandafter\let\expandafter\sffont  \csname #1sf\endcsname
-  \expandafter\let\expandafter\ifont   \csname #1i\endcsname
-  \expandafter\let\expandafter\syfont  \csname #1sy\endcsname
-  \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
+  \csname assignfonts#1\endcsname
 }
 
 \newif\ifrmisbold
@@ -2595,12 +2591,21 @@ end
    \csname\curfontstyle\endcsname
 }%
 
+% Define the font-changing commands (all called \...fonts).
+% Each font-changing command also sets the names \lsize (one size lower)
+% and \lllsize (three sizes lower).  These relative commands are used
+% in, e.g., the LaTeX logo and acronyms.
+%
+% Note: The fonts used for \ifont are for "math italics"  (\itfont is for
+% italics in regular text).  \syfont is also used in math mode only.
+%
 \def\definefontsetatsize#1#2#3#4#5{%
+  \defineassignfonts{#1}%
 \expandafter\def\csname #1fonts\endcsname{%
   \def\curfontsize{#1}%
   \def\lsize{#2}\def\lllsize{#3}%
   \csname rmisbold#5\endcsname
-  \assignfonts{#1}%
+  \csname assignfonts#1\endcsname
   \resetmathfonts
   \setleading{#4}%
 }}
@@ -2645,9 +2650,16 @@ end
 % Check if we are currently using a typewriter font.  Since all the
 % Computer Modern typewriter fonts have zero interword stretch (and
 % shrink), and it is reasonable to expect all typewriter fonts to have
-% this property, we can check that font parameter.
-%
-\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
+% this property, we can check that font parameter. #1 is what to
+% print if we are indeed using \tt; #2 is what to print otherwise.
+\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
+
+% Same as above, but check for italic font.  Actually this also catches
+% non-italic slanted fonts since it is impossible to distinguish them from
+% italic fonts.  But since this is only used by $ and it uses \sl anyway
+% this is not a problem.
+\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
+
 
 % Check if internal flag is clear, i.e. has not been @set.
 \def\ifflagclear#1#2#3{%
@@ -2655,8 +2667,6 @@ end
   #2\else#3\fi
 }
 
-
-
 {
 \catcode`\'=\active
 \catcode`\`=\active
@@ -2672,33 +2682,28 @@ end
 % lilypond developers report.  xpdf does work with the regular 0x27.
 %
 \def\codequoteright{%
-  \ifmonospace
-    \ifflagclear{txicodequoteundirected}{%
-      \ifflagclear{codequoteundirected}{%
-        '%
-      }{\char'15 }%
-    }{\char'15 }%
-  \else
-    '%
-  \fi
+  \ifusingtt
+      {\ifflagclear{txicodequoteundirected}%
+          {\ifflagclear{codequoteundirected}%
+              {'}%
+              {\char'15 }}%
+          {\char'15 }}%
+      {'}%
 }
-%
+
 % and a similar option for the left quote char vs. a grave accent.
 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
 % the code environments to do likewise.
+% \relax disables Spanish ligatures ?` and !` of \tt font.
 %
 \def\codequoteleft{%
-  \ifmonospace
-    \ifflagclear{txicodequotebacktick}{%
-      \ifflagclear{codequotebacktick}{%
-        % [Knuth] pp. 380,381,391
-        % \relax disables Spanish ligatures ?` and !` of \tt font.
-        \relax`%
-      }{\char'22 }%
-    }{\char'22 }%
-  \else
-    \relax`%
-  \fi
+  \ifusingtt
+      {\ifflagclear{txicodequotebacktick}%
+          {\ifflagclear{codequotebacktick}%
+              {\relax`}%
+              {\char'22 }}%
+          {\char'22 }}%
+      {\relax`}%
 }
 
 % Commands to set the quote options.
@@ -2817,20 +2822,29 @@ end
 \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
 \def\restorehyphenation{\hyphenchar\font = `- }
 
+\newif\iffrenchspacing
+\frenchspacingfalse
+
 % Set sfcode to normal for the chars that usually have another value.
 % Can't use plain's \frenchspacing because it uses the `\x notation, and
 % sometimes \x has an active definition that messes things up.
 %
 \catcode`@=11
   \def\plainfrenchspacing{%
-    \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
-    \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
-    \def\endofsentencespacefactor{1000}% for @. and friends
+    \iffrenchspacing\else
+      \frenchspacingtrue
+      \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
+      \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
+      \def\endofsentencespacefactor{1000}% for @. and friends
+    \fi
   }
   \def\plainnonfrenchspacing{%
-    \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
-    \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
-    \def\endofsentencespacefactor{3000}% for @. and friends
+    \iffrenchspacing
+      \frenchspacingfalse
+       \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
+       \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
+       \def\endofsentencespacefactor{3000}% for @. and friends
+    \fi
   }
 \catcode`@=\other
 \def\endofsentencespacefactor{3000}% default
@@ -3389,8 +3403,8 @@ $$%
 \let\atchar=\@
 
 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
-\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
-\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
+\def\lbracechar{{\ifusingtt{\char123}{\ensuremath\lbrace}}}
+\def\rbracechar{{\ifusingtt{\char125}{\ensuremath\rbrace}}}
 \let\{=\lbracechar
 \let\}=\rbracechar
 
@@ -3537,7 +3551,7 @@ $$%
 
 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
 %
-\def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi}
+\def\pounds{{\ifusingtt{\ecfont\char"BF}{\it\$}}}
 
 % @euro{} comes from a separate font, depending on the current style.
 % We use the free feym* fonts from the eurosym package by Henrik
@@ -3651,18 +3665,17 @@ $$%
   % hopefully nobody will notice/care.
   \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
   \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
-  \ifmonospace
-    % typewriter:
-    \font\thisecfont = #1ctt\ecsize \space at \nominalsize
-  \else
-    \ifx\curfontstyle\bfstylename
-      % bold:
-      \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
-    \else
-      % regular:
-      \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
-    \fi
-  \fi
+  \ifusingtt
+      % typewriter:
+     {\font\thisecfont = #1ctt\ecsize \space at \nominalsize}%
+  % else
+     {\ifx\curfontstyle\bfstylename
+        % bold:
+        \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
+      \else
+        % regular:
+        \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
+      \fi}%
   \thisecfont
 }
 
@@ -3678,7 +3691,10 @@ $$%
 
 % @textdegree - the normal degrees sign.
 %
-\def\textdegree{$^\circ$}
+\def\textdegree{%
+   \ifmmode ^\circ
+   \else {\tcfont \char 176}%
+   \fi}
 
 % Laurent Siebenmann reports \Orb undefined with:
 %  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
@@ -3695,11 +3711,11 @@ $$%
 % only change font for tt for correct kerning and to avoid using
 % \ecfont unless necessary.
 \def\quotedblleft{%
-  \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi
+  \ifusingtt{{\ecfont\char"10}}{{\char"5C}}%
 }
 
 \def\quotedblright{%
-  \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi
+  \ifusingtt{{\ecfont\char"11}}{{\char`\"}}%
 }
 
 
@@ -5257,7 +5273,10 @@ $$%
         \xdef\trimmed{\segment}%
         \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
         \xdef\indexsortkey{\trimmed}%
-        \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
+        \ifx\indexsortkey\empty
+          \message{Empty index sort key near line \the\inputlineno}%
+          \xdef\indexsortkey{ }%
+        \fi
       }\fi
       %
       % Append to \fullindexsortkey.
@@ -6386,6 +6405,16 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \def\Yappendixkeyword{Yappendix}
 \def\Yomitfromtockeyword{Yomitfromtoc}
 %
+%
+% Definitions for @thischapter. These can be overridden in translation
+% files.
+\def\thischapterAppendix{%
+  \putwordAppendix{} \thischapternum: \thischaptername}
+
+\def\thischapterChapter{%
+  \putwordChapter{} \thischapternum: \thischaptername}
+%
+%
 \def\chapmacro#1#2#3{%
   \expandafter\ifx\thisenv\titlepage\else
     \checkenv{}% chapters, etc., should not start inside an environment.
@@ -6408,22 +6437,14 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     \xdef\currentchapterdefs{%
       \gdef\noexpand\thischaptername{\the\toks0}%
       \gdef\noexpand\thischapternum{\appendixletter}%
-      % \noexpand\putwordAppendix avoids expanding indigestible
-      % commands in some of the translations.
-      \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
-                                 \noexpand\thischapternum:
-                                 \noexpand\thischaptername}%
+      \let\noexpand\thischapter\noexpand\thischapterAppendix
     }%
   \else
     \toks0={#1}%
     \xdef\currentchapterdefs{%
       \gdef\noexpand\thischaptername{\the\toks0}%
       \gdef\noexpand\thischapternum{\the\chapno}%
-      % \noexpand\putwordChapter avoids expanding indigestible
-      % commands in some of the translations.
-      \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
-                                 \noexpand\thischapternum:
-                                 \noexpand\thischaptername}%
+      \let\noexpand\thischapter\noexpand\thischapterChapter
     }%
   \fi\fi\fi
   %
@@ -6509,6 +6530,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \def\subsubsecheadingskip{\subsecheadingskip}
 \def\subsubsecheadingbreak{\subsecheadingbreak}
 
+% Definition for @thissection. This can be overridden in translation
+% files.
+\def\thissectionDef{%
+  \putwordSection{} \thissectionnum: \thissectionname}
+%
+
 
 % Print any size, any type, section title.
 %
@@ -6550,11 +6577,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
         \xdef\currentsectiondefs{%
           \gdef\noexpand\thissectionname{\the\toks0}%
           \gdef\noexpand\thissectionnum{#4}%
-          % \noexpand\putwordSection avoids expanding indigestible
-          % commands in some of the translations.
-          \gdef\noexpand\thissection{\noexpand\putwordSection{}
-                                     \noexpand\thissectionnum:
-                                     \noexpand\thissectionname}%
+          \let\noexpand\thissection\noexpand\thissectionDef
         }%
       \fi
     \else
@@ -6563,11 +6586,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
         \xdef\currentsectiondefs{%
           \gdef\noexpand\thissectionname{\the\toks0}%
           \gdef\noexpand\thissectionnum{#4}%
-          % \noexpand\putwordSection avoids expanding indigestible
-          % commands in some of the translations.
-          \gdef\noexpand\thissection{\noexpand\putwordSection{}
-                                     \noexpand\thissectionnum:
-                                     \noexpand\thissectionname}%
+          \let\noexpand\thissection\noexpand\thissectionDef
         }%
       \fi
     \fi\fi\fi
@@ -7107,12 +7126,19 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \startsavinginserts
   \lskip=\leftskip \rskip=\rightskip
   \leftskip=0pt\rightskip=0pt % we want these *outside*.
+  %
+  % Set paragraph width for text inside cartouche.  There are
+  % left and right margins of 3pt each plus two vrules 0.4pt each.
   \cartinner=\hsize \advance\cartinner by-\lskip
   \advance\cartinner by-\rskip
+  \advance\cartinner by -6.8pt
+  %
+  % For drawing top and bottom of cartouche.  Each corner char
+  % adds 6pt and we take off the width of a rule to line up with the
+  % right boundary perfectly.
   \cartouter=\hsize
-  \advance\cartouter by 18.4pt % allow for 3pt kerns on either
-                               % side, and for 6pt waste from
-                               % each corner char, and rule thickness
+  \advance\cartouter by 11.6pt
+  %
   \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
   %
   % If this cartouche directly follows a sectioning command, we need the
@@ -8405,21 +8431,21 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \ifcase\paramno
   % 0
     \expandafter\xdef\csname\the\macname\endcsname{%
-      \bgroup
+      \begingroup
         \noexpand\spaceisspace
         \noexpand\endlineisspace
         \noexpand\expandafter % skip any whitespace after the macro name.
         \expandafter\noexpand\csname\the\macname @@@\endcsname}%
     \expandafter\xdef\csname\the\macname @@@\endcsname{%
-      \egroup
+      \endgroup
       \noexpand\scanmacro{\macrobody}}%
   \or % 1
     \expandafter\xdef\csname\the\macname\endcsname{%
-       \bgroup
+       \begingroup
        \noexpand\braceorline
        \expandafter\noexpand\csname\the\macname @@@\endcsname}%
     \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
-      \egroup
+      \endgroup
       \noexpand\scanmacro{\macrobody}%
       }%
   \else % at most 9
@@ -8430,7 +8456,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
       % @MACNAME@@@ removes braces surrounding the argument list.
       % @MACNAME@@@@ scans the macro body with arguments substituted.
       \expandafter\xdef\csname\the\macname\endcsname{%
-        \bgroup
+        \begingroup
         \noexpand\expandafter  % This \expandafter skip any spaces after the
         \noexpand\macroargctxt % macro before we change the catcode of space.
         \noexpand\expandafter
@@ -8444,7 +8470,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
       \expandafter\xdef
       \expandafter\expandafter
         \csname\the\macname @@@@\endcsname\paramlist{%
-          \egroup\noexpand\scanmacro{\macrobody}}%
+          \endgroup\noexpand\scanmacro{\macrobody}}%
     \else % 10 or more:
       \expandafter\xdef\csname\the\macname\endcsname{%
         \noexpand\getargvals@{\the\macname}{\argl}%
@@ -8887,11 +8913,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
       \xrefprintnodename\printedrefname
       %
       \ifflagclear{txiomitxrefpg}{%
-        % But we always want a comma and a space:
-        ,\space
-        %
+        % We always want a comma
+        ,%
         % output the `page 3'.
-        \turnoffactive \putwordpage\tie\refx{#1-pg}%
+        \turnoffactive \putpageref{#1}%
         % Add a , if xref followed by a space
         \if\space\noexpand\tokenafterxref ,%
         \else\ifx\     \tokenafterxref ,% @TAB
@@ -8907,6 +8932,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \endlink
 \endgroup}
 
+% can be overridden in translation files
+\def\putpageref#1{%
+  \space\putwordpage\tie\refx{#1-pg}}
+
 % Output a cross-manual xref to #1.  Used just above (twice).
 %
 % Only include the text "Section ``foo'' in" if the foo is neither
@@ -9338,13 +9367,6 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \makevalueexpandable
   \ifvmode
     \imagevmodetrue
-  \else \ifx\centersub\centerV
-    % for @center @image, we need a vbox so we can have our vertical space
-    \imagevmodetrue
-    \vbox\bgroup % vbox has better behavior than vtop here
-  \fi\fi
-  %
-  \ifimagevmode
     \medskip
     % Usually we'll have text after the image which will insert
     % \parskip glue, so insert it here too to equalize the space
@@ -9356,14 +9378,17 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     \vtop\bgroup \kern -\capheight \vskip-\parskip
   \fi
   %
-  % Enter horizontal mode so that indentation from an enclosing
-  %  environment such as @quotation is respected.
-  % However, if we're at the top level, we don't want the
-  %  normal paragraph indentation.
-  % On the other hand, if we are in the case of @center @image, we don't
-  %  want to start a paragraph, which will create a hsize-width box and
-  %  eradicate the centering.
-  \ifx\centersub\centerV \else \imageindent \fi
+  \ifx\centersub\centerV
+    % For @center @image, enter vertical mode and add vertical space
+    % Enter an extra \parskip because @center doesn't add space itself.
+    \vbox\bgroup\vskip\parskip\medskip\vskip\parskip
+  \else
+    % Enter horizontal mode so that indentation from an enclosing
+    %  environment such as @quotation is respected.
+    % However, if we're at the top level, we don't want the
+    %  normal paragraph indentation.
+    \imageindent
+  \fi
   %
   % Output the image.
   \ifpdf
@@ -9388,7 +9413,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     \egroup
     \medskip  % space after a standalone image
   \fi
-  \ifx\centersub\centerV \egroup \fi
+  \ifx\centersub\centerV % @center @image
+    \medskip
+    \egroup % close \vbox
+  \fi
 \endgroup}
 
 
@@ -10038,7 +10066,7 @@ directory should work if nowhere else does.}
   \gdefchar^^ae{\v Z}
   \gdefchar^^af{\dotaccent Z}
   %
-  \gdefchar^^b0{\textdegree{}}
+  \gdefchar^^b0{\textdegree}
   \gdefchar^^b1{\ogonek{a}}
   \gdefchar^^b2{\ogonek{ }}
   \gdefchar^^b3{\l}
@@ -10461,7 +10489,7 @@ directory should work if nowhere else does.}
   \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
   \DeclareUnicodeCharacter{00AF}{\={ }}%
   %
-  \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
+  \DeclareUnicodeCharacter{00B0}{\textdegree}
   \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
   \DeclareUnicodeCharacter{00B2}{$^2$}%
   \DeclareUnicodeCharacter{00B3}{$^3$}%
@@ -10965,7 +10993,7 @@ directory should work if nowhere else does.}
   %
   \DeclareUnicodeCharacter{20AC}{\euro{}}%
   %
-  \DeclareUnicodeCharacter{2192}{\expansion{}}%
+  \DeclareUnicodeCharacter{2192}{\arrow}%
   \DeclareUnicodeCharacter{21D2}{\result{}}%
   %
   % Mathematical symbols
@@ -11401,6 +11429,131 @@ directory should work if nowhere else does.}
 \hfuzz = 1pt
 
 
+\message{microtype,}
+
+% protrusion, from Thanh's protcode.tex.
+\def\mtsetprotcode#1{%
+  \rpcode#1`\!=200  \rpcode#1`\,=700  \rpcode#1`\-=700  \rpcode#1`\.=700
+  \rpcode#1`\;=500  \rpcode#1`\:=500  \rpcode#1`\?=200
+  \rpcode#1`\'=700
+  \rpcode#1 34=500  % ''
+  \rpcode#1 123=300 % --
+  \rpcode#1 124=200 % ---
+  \rpcode#1`\)=50   \rpcode#1`\A=50   \rpcode#1`\F=50   \rpcode#1`\K=50
+  \rpcode#1`\L=50   \rpcode#1`\T=50   \rpcode#1`\V=50   \rpcode#1`\W=50
+  \rpcode#1`\X=50   \rpcode#1`\Y=50   \rpcode#1`\k=50   \rpcode#1`\r=50
+  \rpcode#1`\t=50   \rpcode#1`\v=50   \rpcode#1`\w=50   \rpcode#1`\x=50
+  \rpcode#1`\y=50
+  %
+  \lpcode#1`\`=700
+  \lpcode#1 92=500  % ``
+  \lpcode#1`\(=50   \lpcode#1`\A=50   \lpcode#1`\J=50   \lpcode#1`\T=50
+  \lpcode#1`\V=50   \lpcode#1`\W=50   \lpcode#1`\X=50   \lpcode#1`\Y=50
+  \lpcode#1`\v=50   \lpcode#1`\w=50   \lpcode#1`\x=50   \lpcode#1`\y=0
+  %
+  \mtadjustprotcode#1\relax
+}
+
+\newcount\countC
+\def\mtadjustprotcode#1{%
+  \countC=0
+  \loop
+    \ifcase\lpcode#1\countC\else
+      \mtadjustcp\lpcode#1\countC
+    \fi
+    \ifcase\rpcode#1\countC\else
+      \mtadjustcp\rpcode#1\countC
+    \fi
+    \advance\countC 1
+  \ifnum\countC < 256 \repeat
+}
+
+\newcount\countB
+\def\mtadjustcp#1#2#3{%
+  \setbox\boxA=\hbox{%
+    \ifx#2\font\else#2\fi
+    \char#3}%
+  \countB=\wd\boxA
+  \multiply\countB #1#2#3\relax
+  \divide\countB \fontdimen6 #2\relax
+  #1#2#3=\countB\relax
+}
+
+\ifx\XeTeXrevision\thisisundefined
+  \ifx\luatexversion\thisisundefined
+    \ifpdf % pdfTeX
+      \mtsetprotcode\textrm
+      \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
+    \else % TeX
+      \def\mtfontexpand#1{}
+    \fi
+  \else % LuaTeX
+    \mtsetprotcode\textrm
+    \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
+  \fi
+\else % XeTeX
+  \mtsetprotcode\textrm
+  \def\mtfontexpand#1{}
+\fi
+
+
+\newif\ifmicrotype
+
+\def\microtypeON{%
+  \microtypetrue
+  %
+  \ifx\XeTeXrevision\thisisundefined
+    \ifx\luatexversion\thisisundefined
+      \ifpdf % pdfTeX
+        \pdfadjustspacing=2
+        \pdfprotrudechars=2
+      \fi
+    \else % LuaTeX
+      \adjustspacing=2
+      \protrudechars=2
+    \fi
+  \else % XeTeX
+    \XeTeXprotrudechars=2
+  \fi
+  %
+  \mtfontexpand\textrm
+  \mtfontexpand\textsl
+  \mtfontexpand\textbf
+}
+
+\def\microtypeOFF{%
+  \microtypefalse
+  %
+  \ifx\XeTeXrevision\thisisundefined
+    \ifx\luatexversion\thisisundefined
+      \ifpdf % pdfTeX
+        \pdfadjustspacing=0
+        \pdfprotrudechars=0
+      \fi
+    \else % LuaTeX
+      \adjustspacing=0
+      \protrudechars=0
+    \fi
+  \else % XeTeX
+    \XeTeXprotrudechars=0
+  \fi
+}
+
+\microtypeON
+
+\parseargdef\microtype{%
+  \def\txiarg{#1}%
+  \ifx\txiarg\onword
+    \microtypeON
+  \else\ifx\txiarg\offword
+    \microtypeOFF
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @microtype option `\txiarg', must be on|off}%
+  \fi\fi
+}
+
+
 \message{and turning on texinfo input format.}
 
 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
@@ -11420,23 +11573,6 @@ directory should work if nowhere else does.}
 \catcode`\|=\other \def\normalverticalbar{|}
 \catcode`\~=\other \def\normaltilde{~}
 
-% This macro is used to make a character print one way in \tt
-% (where it can probably be output as-is), and another way in other fonts,
-% where something hairier probably needs to be done.
-%
-% #1 is what to print if we are indeed using \tt; #2 is what to print
-% otherwise.  Since all the Computer Modern typewriter fonts have zero
-% interword stretch (and shrink), and it is reasonable to expect all
-% typewriter fonts to have this, we can check that font parameter.
-%
-\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
-
-% Same as above, but check for italic font.  Actually this also catches
-% non-italic slanted fonts since it is impossible to distinguish them from
-% italic fonts.  But since this is only used by $ and it uses \sl anyway
-% this is not a problem.
-\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
-
 % Set catcodes for Texinfo file
 
 % Active characters for printing the wanted glyph.
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 403c0daa67..80874049fa 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -1,9 +1,9 @@
 \input texinfo   @c -*- mode: texinfo; coding: utf-8 -*-
-@setfilename ../../info/tramp.info
+@setfilename ../info/tramp
 @c %**start of header
 @include docstyle.texi
-@c In the Tramp GIT, the version number is auto-frobbed from tramp.el,
-@c and the bug report address is auto-frobbed from configure.ac.
+@c In the Tramp GIT, the version number and the bug report address
+@c are auto-frobbed from configure.ac.
 @include trampver.texi
 @settitle @value{tramp} @value{trampver} User Manual
 @c %**end of header
@@ -3659,9 +3659,9 @@ directory:
 @end group
 @end example
 
-Since Tramp cannot know in advance which share directory is intended
-to use, this expansion can be applied only when a share directory has
-been used already.
+Since @value{tramp} cannot know in advance which share directory is
+intended to use, this expansion can be applied only when a share
+directory has been used already.
 
 The methods @option{adb}, @option{rclone} and @option{sshfs} do not
 support home directory expansion at all.  However, @value{tramp} keeps
@@ -4398,7 +4398,7 @@ specifies the target to be applied for renaming buffer 
file names from
 source via @code{tramp-rename-files}.  @code{source} is a regular
 expressions, which matches a remote file name.  @code{target} must be
 a directory name, which could be remote (including remote directories
-Tramp infers by default, such as @samp{@trampfn{method,user@@host,}}).
+@value{tramp} infers by default, such as @samp{@trampfn{method,user@@host,}}).
 
 @code{target} can contain the patterns @code{%m}, @code{%u} or
 @code{%h}, which are replaced by the method name, user name or host
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi
index 9e1be52cd3..45cc12b239 100644
--- a/doc/misc/trampver.texi
+++ b/doc/misc/trampver.texi
@@ -5,9 +5,8 @@
 @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
-@c tramp.el, and the bug report address is auto-frobbed from
-@c configure.ac.
+@c In the  Tramp GIT, the version number and the bug report address
+@c are auto-frobbed from configure.ac.
 @set trampver 2.6.0-pre
 @set trampurl https://www.gnu.org/software/tramp/
 @set tramp-bug-report-address tramp-devel@@gnu.org
@@ -19,7 +18,12 @@
 @set infodir /usr/local/share/info
 
 @c Formatting of the tramp program name consistent.
+@ifplaintext
+@set tramp Tramp
+@end ifplaintext
+@ifnotplaintext
 @set tramp @sc{Tramp}
+@end ifnotplaintext
 
 @c Some flags which define the remote file name syntax.
 @ifclear unified
diff --git a/doc/misc/transient.texi b/doc/misc/transient.texi
index e5e7cccbe8..2b106bb714 100644
--- a/doc/misc/transient.texi
+++ b/doc/misc/transient.texi
@@ -31,7 +31,7 @@ General Public License for more details.
 @finalout
 @titlepage
 @title Transient User and Developer Manual
-@subtitle for version 0.3.7
+@subtitle for version 0.3.7.50
 @author Jonas Bernoulli
 @page
 @vskip 0pt plus 1filll
@@ -65,7 +65,7 @@ Calling a suffix command usually causes the transient to be 
exited
 but suffix commands can also be configured to not exit the transient.
 
 @noindent
-This manual is for Transient version 0.3.7.
+This manual is for Transient version 0.3.7.50.
 
 @insertcopying
 @end ifnottex
@@ -447,10 +447,10 @@ session.
 Save the value of the active transient persistently across Emacs
 sessions.
 
-@item @kbd{C-x C-k} (@code{transient-save})
+@item @kbd{C-x C-k} (@code{transient-reset})
 @kindex C-x C-k
-@findex transient-save
-Clear the set and saved value of the active transient.
+@findex transient-reset
+Clear the set and saved values of the active transient.
 @end table
 
 @defopt transient-values-file
@@ -911,7 +911,6 @@ means the former.  @xref{Suffix Specifications}.
 @var{SUFFIX} may also be a group in the same form as expected by
 @code{transient-define-prefix}.  @xref{Group Specifications}.
 
-
 @item
 @var{LOC} is a command, a key vector, a key description (a string as
 returned by @code{key-description}), or a list specifying coordinates (the
@@ -1044,6 +1043,18 @@ For example, the scope of the 
@code{magit-branch-configure} transient is
 the branch whose variables are being configured.
 @end defmac
 
+It is possible to define one or more groups independently of a prefix
+definition, which is useful when those groups are to be used by more
+than just one prefix command.
+
+@defmac transient-define-groups name group...
+This macro defines one or more groups of infix and suffix commands
+and stores them in a property of the symbol @var{NAME}.  @var{GROUP} has the
+same form as for @code{transient-define-prefix}.  Subsequently @var{NAME} can
+be used in a @var{GROUP} of @code{transient-define-prefix}, as described in the
+next section.
+@end defmac
+
 @node Binding Suffix and Infix Commands
 @section Binding Suffix and Infix Commands
 
@@ -1139,11 +1150,17 @@ suffixes, which assumes that a predicate like this is 
used:
 
 @item
 The value of @code{:setup-children}, if non-@code{nil}, is a function that 
takes
-two arguments the group object itself and a list of children.
-The children are given as a (potentially empty) list consisting
-of either group or suffix specifications.  It can make arbitrary
-changes to the children including constructing new children from
-scratch.  Also see @code{transient-setup-children}.
+one argument, a potentially list of children, and must return a list
+of children or an empty list.  This can either be used to somehow
+transform the group's children that were defined the normal way, or
+to dynamically create the children from scratch.
+
+The returned children must have the same form as stored in the
+prefix's @code{transient--layout} property, but it is often more convenient
+to use the same form as understood by @code{transient-define-prefix},
+described below.  If you use the latter approach, you can use the
+@code{transient-parse-child} and @code{transient-parse-children} functions to
+transform them from the convenient to the expected form.
 
 @item
 The boolean @code{:pad-keys} argument controls whether keys of all suffixes
@@ -1151,23 +1168,35 @@ contained in a group are right padded, effectively 
aligning the
 descriptions.
 @end itemize
 
-The @var{ELEMENT}s are either all subgroups (vectors), or all suffixes
-(lists) and strings.  (At least currently no group type exists that
-would allow mixing subgroups with commands at the same level, though
-in principle there is nothing that prevents that.)
+The @var{ELEMENT}s are either all subgroups, or all suffixes and strings.
+(At least currently no group type exists that would allow mixing
+subgroups with commands at the same level, though in principle there
+is nothing that prevents that.)
 
 If the @var{ELEMENT}s are not subgroups, then they can be a mixture of lists
-that specify commands and strings.  Strings are inserted verbatim.
-The empty string can be used to insert gaps between suffixes, which is
-particularly useful if the suffixes are outlined as a table.
-
-Variables are supported inside group specifications.  For example in
-place of a direct subgroup specification, a variable can be used whose
-value is a vector that qualifies as a group specification.  Likewise,
-a variable can be used where a suffix specification is expected.
-Lists of group or suffix specifications are also supported.  Indirect
-specifications are resolved when the transient prefix is being
-defined.
+that specify commands and strings.  Strings are inserted verbatim into
+the buffer.  The empty string can be used to insert gaps between
+suffixes, which is particularly useful if the suffixes are outlined as
+a table.
+
+Inside group specifications, including inside contained suffix
+specifications, nothing has to be quoted and quoting anyway is
+invalid.
+
+How symbols are treated, depends on context.  Inside suffix
+specifications they often name functions.  However if they appear in
+a place where a group is expected, then they are treated as indirect
+group specifications. Such a symbol must have an associated group
+specification, created using @code{transient-define-groups}.
+
+Likewise a symbol can appear in a place where a suffix specification
+is expected.  The value of the @code{transient--layout} property of that
+symbol must be a single suffix specification or a list of such
+specifications.  Currently no macro exist that would create such a
+symbol, and this feature should usually not be used.
+
+The value following a keyword, can be explicitly unquoted using @code{,}.
+This feature is experimental and should be avoided as well.
 
 The form of suffix specifications is documented in the next node.
 
@@ -1232,7 +1261,7 @@ Any command will do; it does not need to have an object 
associated
 with it (as would be the case if @code{transient-define-suffix} or
 @code{transient-define-infix} were used to define it).
 
-Anonymous, dynamically defined suffix commands are also support.
+Anonymous, dynamically defined suffix commands are also supported.
 See information about the @code{:setup-children} function in @ref{Group 
Specifications}.
 
 As mentioned above, the object that is associated with a command can
@@ -1515,7 +1544,18 @@ Call the command without exporting variables and stay 
transient.
 @anchor{Pre-commands for Suffixes}
 @subheading Pre-commands for Suffixes
 
-The default for suffixes is @code{transient--do-exit}.
+By default, invoking a suffix causes the transient to be exited.
+
+If you want a different default behavior for a certain transient
+prefix command, then set its @code{:transient-suffix} slot.  The value can be
+a boolean, answering the question "does the transient stay active,
+when a suffix command is invoked?"  @code{t} means that the transient stays
+active, while @code{nil} means that invoking a suffix exits the transient.
+In either case, the exact behavior depends on whether the suffix is
+itself a prefix (i.e., a sub-prefix), an infix or a regular suffix.
+
+The behavior for an individual suffix command can be changed by
+setting its @code{transient} slot to one of the following pre-commands.
 
 @defun transient--do-exit
 Call the command after exporting variables and exit the transient.
@@ -1566,21 +1606,32 @@ be added to @code{transient-predicate-map}.
 @anchor{Pre-commands for Non-Suffixes}
 @subheading Pre-commands for Non-Suffixes
 
-The default for non-suffixes, i.e., commands that are bound in other
-keymaps beside the transient keymap, is @code{transient--do-warn}.  Silently
-ignoring the user-error is also an option, though probably not a good
-one.
+By default, non-suffixes (commands that are bound in other keymaps
+beside the transient keymap) cannot be invoked.  Trying to invoke
+such a command results in a warning and the transient stays active.
 
-If you want to let the user invoke non-suffix commands, then use
-@code{transient--do-stay} as the value of the prefix's 
@code{transient-non-suffix}
-slot.
+If you want a different behavior, then set the @code{:transient-non-suffix}
+slot of the transient prefix command.  The value can be a boolean,
+answering the question, "is it allowed to invoke non-suffix commands?"
+
+If the value is @code{t} or @code{transient--do-stay}, then non-suffixes can be
+invoked, when it is @code{nil} or @code{transient--do-warn} (the default) then 
they
+cannot be invoked.
+
+The only other recommended value is @code{transient--do-leave}.  If that is
+used, then non-suffixes can be invoked, but if one is invoked, then
+that exits the transient.
 
 @defun transient--do-warn
 Call @code{transient-undefined} and stay transient.
 @end defun
 
-@defun transient--do-noop
-Call @code{transient-noop} and stay transient.
+@defun transient--do-stay
+Call the command without exporting variables and stay transient.
+@end defun
+
+@defun transient--do-leave
+Call the command without exporting variables and exit the transient.
 @end defun
 
 @anchor{Special Pre-Commands}
@@ -1810,7 +1861,7 @@ indicates that all remaining arguments are files.
 
 @item
 Classes used for infix commands that represent variables should
-derived from the abstract @code{transient-variables} class.
+derived from the abstract @code{transient-variable} class.
 @end itemize
 
 Magit defines additional classes, which can serve as examples for the
@@ -2045,7 +2096,7 @@ called with no argument and returns a string.
 
 @item
 @code{show-help} A function used to display help for the suffix.  If
-unspecified, the prefix controls how hlep is displayed for its
+unspecified, the prefix controls how help is displayed for its
 suffixes.
 @end itemize
 
diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi
new file mode 100644
index 0000000000..c587d23d74
--- /dev/null
+++ b/doc/misc/use-package.texi
@@ -0,0 +1,2163 @@
+\input texinfo    @c -*- texinfo -*-
+@c %**start of header
+@setfilename ../../info/use-package.info
+@settitle use-package User Manual
+@set USEP_VER 2.4.5
+@set USEP_DIST as distributed with Emacs @value{EMACSVER}
+@include docstyle.texi
+@syncodeindex vr cp
+@syncodeindex fn cp
+@include emacsver.texi
+@c %**end of header
+
+@copying
+This manual is for use-package @value{USEP_VER} @value{USEP_DIST}.
+
+Copyright @copyright{} 2022 Free Software Foundation, Inc.
+
+@quotation
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with the Front-Cover Texts being ``A GNU Manual'',
+and with the Back-Cover Texts as in (a) below.  A copy of the license
+is included in the section entitled ``GNU Free Documentation License''.
+
+(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
+modify this GNU manual.''
+@end quotation
+@end copying
+
+@dircategory Emacs misc features
+@direntry
+* use-package: (use-package). Declarative package configuration for Emacs.
+@end direntry
+
+@finalout
+@titlepage
+@title use-package User Manual
+@subtitle for version USEP_VER
+@author John Wiegley & Stefan Kangas
+@page
+@vskip 0pt plus 1filll
+@insertcopying
+@end titlepage
+
+@contents
+
+@ifnottex
+@node Top
+@top use-package User Manual
+
+The @code{use-package} macro allows you to set up package
+customization in your init file in a declarative way.  It takes care
+of many things for you that would otherwise require a lot of
+repetitive boilerplate code.  It can help with common customization,
+such as binding keys, setting up hooks, customizing user options and
+faces, autoloading, and more.  It also helps you keep Emacs startup
+fast, even when you use many (even hundreds) of packages.
+
+Note that use-package is not a package manager.  Although use-package
+does have the useful capability to interface with the Emacs package
+manager, its primary purpose is help with the configuration and
+loading of packages, not with managing their download, upgrades, and
+installation.
+
+@insertcopying
+
+@menu
+* Basic Concepts::              Basic concepts of use-package.
+* Getting Started::             A gentle introduction to use-package.
+* Loading Packages::            How and when packages are loaded.
+* Configuring Packages::        Package configuration keywords.
+* Installing packages::         Ensuring packages are available.
+* Byte-compiling::              Byte-compiling your init file.
+* Troubleshooting::             What to do when there's trouble.
+
+Appendices
+* Keyword extensions::          Adding new use-package keywords.
+* History::                     History and acknowledgments.
+* GNU Free Documentation License::  The license for this manual.
+
+Index
+* Index::
+@end menu
+@end ifnottex
+
+@c ----------------------------------------------------------------------------
+@node Basic Concepts
+@chapter Basic Concepts
+
+use-package provides the @code{use-package} macro, that simplifies the
+customization and use of packages in Emacs.  It was created for a few
+basic reasons, each of which drove the design.  Understanding these
+reasons may help make some of those decisions clearer:
+
+@cindex reasons for developing use-package
+@enumerate
+@item
+Allow gathering all the configuration details of a package into one
+place, making it easier to copy, disable, or move it elsewhere in the
+init file.
+
+@item
+Reduce duplication and repetitive boilerplate, capturing several
+common practices as mere keywords both easy and intuitive to use.
+
+@item
+Make startup time of Emacs as short as possible, without sacrificing
+the quantity of add-on packages used.
+
+@item
+Ensure that errors encountered during startup disable only the
+package(s) raising the error(s), and as little else as possible,
+leaving Emacs as close to fully functional as possible.
+
+@item
+Allow byte-compiling your init file, so that any warnings or errors
+you see at startup are meaningful.  In this way, even if
+byte-compilation is not used for speed (see item 3 above), it can
+still be used as a sanity check.
+@end enumerate
+
+It is worth noting that use-package is not intended to replace the
+standard customization command @w{@kbd{M-x customize}} (@pxref{Easy
+Customization,,, emacs, GNU Emacs Manual}).  On the contrary, it is
+designed to work together with it, for things that Customize cannot
+do.
+
+@c ----------------------------------------------------------------------------
+@node Getting Started
+@chapter Getting Started
+@cindex quick-start instructions
+
+This chapter provides instructions and examples for quickly getting
+started with use-package.  The first thing you need to do is make sure
+that @file{use-package} itself is loaded.  To do that, put this at the
+top of your init file:
+
+@lisp
+(require 'use-package)
+@end lisp
+
+@cindex declaration
+The above makes the @code{use-macro} available for us in the rest of
+your init file.  In this manual, we say that each call to
+@code{use-macro} is a @dfn{declaration}, to highlight the declarative
+nature of its syntax.
+
+To unconditionally load a package named @samp{foo}, add the following
+declaration to your init file:
+
+@lisp
+(use-package foo)
+@end lisp
+
+@noindent
+This declaration is equivalent to using @code{require} (@pxref{Named
+Features,,, elisp, GNU Emacs Lisp Reference Manual}), with some
+use-package specific error handling added in.  Just like
+@code{require}, it needs the package @samp{foo} to be installed and
+available via your @code{load-path} (@pxref{Installing packages}).
+
+To evaluate some Lisp @emph{before} the @samp{foo} package is loaded,
+use the @code{:init} keyword:
+
+@lisp
+@group
+(use-package foo
+  :init
+  (setq foo-variable t))
+@end group
+@end lisp
+
+Similarly, @code{:config} can be used to execute code @emph{after} a
+package is loaded.  In cases where loading is done lazily
+(@pxref{Loading Packages}), this execution is deferred until after the
+loading actually occurs.  As you might expect, you can use
+@code{:init} and @code{:config} together:
+
+@lisp
+@group
+(use-package foo
+  :init
+  (setq foo-variable t)
+  :config
+  (foo-mode 1))
+@end group
+@end lisp
+
+The above declarations will load the @samp{foo} package
+immediately.  In most cases, this is not necessary or desirable, as
+that will slow down Emacs startup.  Instead, you should try to set
+things up so that packages are only loaded when they are actually
+needed (a.k.a. ``autoloading'').  If you have installed a package from
+@acronym{GNU} @acronym{ELPA} that provides it's own autoloads, it is often
+enough to say:
+
+@lisp
+@group
+(use-package foo
+  :defer t)
+@end group
+@end lisp
+
+@noindent
+This will avoid loading the package.  Now, when you run any autoloaded
+command, the package @samp{foo} is loaded automatically.  (Which
+commands from a package are marked to auto-load by default is the
+decision of the package authors.)
+
+In some cases, you might need or want to provide your own autoloads.
+The more complex example below autoloads the commands
+@code{isearch-moccur} and @code{isearch-all} from the package
+@file{color-moccur.el}, and binds keys both globally and in
+@code{isearch-mode-map}.  When one of these two commands are used, the
+package will be loaded.  At that point, @code{moccur-edit} is also loaded,
+to allow editing of the @code{moccur} buffer.
+
+@lisp
+@group
+(use-package color-moccur
+  :commands (isearch-moccur isearch-all)
+  :bind (("M-s O" . moccur)
+         :map isearch-mode-map
+         ("M-o" . isearch-moccur)
+         ("M-O" . isearch-moccur-all))
+  :init
+  (setq isearch-lazy-highlight t)
+  :config
+  (use-package moccur-edit))
+@end group
+@end lisp
+
+Some packages will suggest ready-made @code{use-package} declarations
+that you can use.  Where possible, it is a good idea to copy them, and
+use that as a starting point.
+
+That should be enough to get you started!
+
+@c ----------------------------------------------------------------------------
+@node Loading Packages
+@chapter Loading Packages
+@cindex loading packages with use-package
+
+Before use-package can load an Emacs Lisp package, it must be
+available in a directory on your @code{load-path}.  When you install
+packages using the built-in @code{install-package} command, it will do
+this automatically for you.  Packages shipped with Emacs (built-in
+packages) are always available.
+
+Some packages have more than one library.  In those cases, you might
+need more than one @code{use-package} declaration to make sure the
+package is properly loaded.  For complex configurations, you might
+also need more than one declaration for a package with the same name.
+
+use-package can interface with @samp{package.el} to install packages
+on Emacs start.  @xref{Installing packages}, for details.
+
+@menu
+* Loading basics::              How and when packages are loaded.
+* Deferring loading::           Loading packages later.
+* Forcing loading::             Loading packages immediately.
+* Conditional loading::         Loading packages conditionally.
+* Loading sequentially::        Loading packages in sequence.
+* Load dependencies::           Don't load without dependencies.
+* Manual installation::         Loading manually installed packages.
+@end menu
+
+@node Loading basics
+@section How and when use-package loads packages
+
+The call to the @code{use-package} macro will load a package either
+immediately, or when the package is first used (via autoloading).  In the
+simplest case, a @code{use-package} declaration loads a package when
+it is evaluated.@footnote{This happens both at run-time and at
+compile-time.  @xref{Byte-compiling}.}  If the declaration is in your
+init file, this happens automatically each time Emacs is started.
+
+For example, the declaration below immediately loads the library
+@code{foo}, just like @code{require} would:
+
+@lisp
+(use-package foo)
+@end lisp
+
+@noindent
+If the library @samp{foo} is not available in your @code{load-path},
+the declaration logs a warning to the @samp{*Messages*} buffer.
+
+@cindex package vs library
+@c So, confusingly, (use-package foo) actually means to use the
+@c _library_ foo.el, not all of the _package_ foo's libraries?
+@c Should this be explicitly explained here?
+Note that a ``package'' is different from an Emacs Lisp ``library''.
+The above declaration tells use-package to load the @emph{library}
+@file{foo.el}, which in the overwhelming majority of cases also
+resides in a @emph{package} named @code{foo}.  But the package
+@code{foo} might also contain a library named @file{foo-extra.el}.  If
+that library is not loaded automatically, you will need a separate
+@code{use-package} declaration to make sure that it is loaded when
+needed.  This manual will often use the terms ``package'' and
+``library'' interchangeably, as this distinction does not usually
+matter, but you should keep it in mind for the cases when it does.
+
+The details of how and when you should load a package might differ
+from one package to another.  When in doubt, refer to the package
+documentation for details.
+
+@node Deferring loading
+@section Deferring package loading
+@cindex deferring loading of package
+
+@cindex autoloading packages
+@cindex loading lazily
+@cindex lazy loading of packages
+In the examples we have seen so far, use-package loads packages every
+time you start Emacs, even if that package is never used.  That will
+make starting Emacs slower.  use-package therefore allows setting
+things up in such a way that packages are only loaded when some of the
+package's commands is first used (either with @kbd{M-x} or via some key
+binding).  This is based on autoloading, a full description of which
+is outside the scope of this manual.  @xref{Autoload,,, elisp, GNU
+Emacs Lisp Reference Manual}, for the full story.
+
+@cindex triggers, for loading packages
+Some @code{use-package} keywords provide autoload @dfn{triggers} that
+cause a package to be loaded when certain events occur.  For example,
+the @code{:hook} keyword sets up a trigger that fires when the
+specified hook is run, and then loads the package automatically.  The
+other trigger keywords, all of which are described later in this
+manual, are @code{:commands}, @code{:bind}, @code{:bind*},
+@code{:bind-keymap}, @code{:bind-keymap*}, @code{:mode}, and
+@code{:interpreter}.
+
+@subheading The @code{:defer} keyword
+
+@findex :defer
+If you did not specify any autoloading keyword, use-package will fall
+back to loading the package immediately (typically when Emacs is
+starting up).  This can be overridden using the @code{:defer} keyword.
+It takes one boolean argument: a non-@code{nil} value means to stop
+this package from being immediately loaded.  Here is an example of
+using @code{:defer} to postpone loading the package @samp{foo}:
+
+@lisp
+@group
+(use-package foo
+  :defer t)
+@end group
+@end lisp
+
+Using @code{:defer t} by itself like this is rarely useful.
+Typically, you would only use it together with a keyword like
+@code{:config} (@pxref{Lisp Configuration}), or @code{:ensure}
+(@pxref{Installing packages}).
+
+@subheading Defer loading until idle for N seconds
+
+@findex :defer@r{, with a numeric argument}
+You can also give a numeric argument @var{n} to @w{@code{:defer}} to
+specify that a package should be loaded (if it hasn't already) after
+Emacs has been idle for @var{n} seconds.  For example, use the
+following to make use-package load @samp{foo} after 30 seconds of idle
+time:
+
+@lisp
+@group
+(use-package foo
+  :defer 30)
+@end group
+@end lisp
+
+@subheading When to use @code{:defer}
+
+When using autoloading keywords, there is no need to also use
+@code{:defer}.  It doesn't hurt to add it in this case, perhaps for
+extra clarity, but it is redundant.
+
+You should use @code{:defer} to force deferred loading, in cases when
+use-package isn't creating any autoloads for you.  For example, you
+might know that some other package will already do something to cause
+your package to load at the appropriate time.  This is usually the
+case when you install a package using @code{package-install}, as
+packages installed in this way normally always have their own
+autoloads already set up.
+
+@subheading Making @w{@code{:defer t}} the default
+
+@cindex defer loading by default
+@cindex lazy loading by default
+@vindex use-package-always-defer
+If you customize the user option @code{use-package-always-defer} to
+non-@code{nil}, the @code{use-package} macro will behave as if
+@w{@code{:defer t}} is always specified.  This can be overridden for
+individual declarations using either @w{@code{:defer nil}} or
+@w{@code{:demand t}} (@pxref{Forcing loading}).
+
+@node Forcing loading
+@section Forcing package to load immediately
+@cindex forcing immediate loading
+
+@findex :demand
+The presence of autoloading trigger keywords can be overridden using
+@code{:demand t}, which forces the package to load immediately.  Thus,
+even if you use an autoloading keyword such as @code{:bind}
+(@pxref{Key bindings}), adding @code{:demand} will force loading to
+occur immediately.  It will also avoid creating an autoload for the
+bound key, as it would be redundant.
+
+If you specify both @w{@code{:demand t}} and @w{@code{:defer t}}, the
+@code{:defer} keyword will take precedence.
+
+@node Conditional loading
+@section Loading packages conditionally
+@cindex conditional loading
+@cindex loading conditions
+
+@findex :if
+@findex :when
+@findex :unless
+The @code{:if}, @code{:when}, and @code{:unless} keywords predicates
+the loading and initialization of packages.  They all accept one
+argument, an Emacs Lisp form that is evaluated at run-time.
+
+If the argument of the @code{:if} keyword evaluates to non-@code{nil},
+the package will be loaded and initialized.  The @code{:when} keyword
+is provided as an alias for @code{:if}.  Finally, the @code{:unless}
+keyword is the inverse of @code{:if}, such that @w{@code{:unless foo}}
+means the same thing as @w{@code{:if (not foo)}}.
+
+For example, if you only want to load @samp{foo} in graphical Emacs
+sessions, you could use the following:
+
+@lisp
+@group
+(use-package foo
+  :if (display-graphic-p))
+@end group
+@end lisp
+
+@subheading Some common use cases
+
+Here are some common cases for conditional loading, and how to achieve
+them.
+
+@c FIXME: Too many redundant examples?  E.g., why do we need both an
+@c example for system-type and window-system? or both of the last 2
+@c examples?
+@itemize
+
+@item
+Operating system
+
+The following example loads a package only on GNU/Linux.  See the
+docstring of @code{system-type} for other valid values.
+
+@lisp
+:if (eq system-type 'gnu/linux)
+@end lisp
+
+@item
+Window system
+
+The example below loads a package only on macOS and X.  See the
+docstring of @code{window-system} for valid values.
+
+@lisp
+:if (memq window-system '(ns x))
+@end lisp
+
+@item
+Installed package
+
+The following example loads a package only when the @samp{foo} package
+is installed.
+
+@lisp
+:if (package-installed-p 'foo)
+@end lisp
+
+@item
+Libraries in @code{load-path}
+
+The example below loads a package only when @file{foo.el} is available
+in your @code{load-path} (for example, if you installed that file
+manually):
+
+@lisp
+:if (locate-library "foo.el")
+@end lisp
+@end itemize
+
+@subheading Making conditional loading affect @code{:preface} and 
@code{:ensure}
+
+@cindex conditional loading before @code{:preface} or @code{:ensure}
+If you need to make a use-package form conditional so that the condition
+occurs before even @code{:ensure} (@pxref{Install package}) or
+@code{:preface} (@pxref{Preface keyword}), use @code{when}
+around the @code{use-package} form itself.  For example:
+
+@lisp
+@group
+(when (memq window-system '(mac ns))
+  (use-package foo
+    :ensure t))
+@end group
+@end lisp
+
+@node Loading sequentially
+@section Loading packages in sequence
+@cindex loading a package after other packages
+
+@findex :after
+Sometimes it only makes sense to configure a package after another one
+has been loaded, because certain variables or functions are not in
+scope until that time.  This can be achieved with the @code{:after}
+keyword, which allows a fairly rich description of the exact
+conditions when loading should occur.  The @code{:after} keyword takes
+as argument either a symbol indicating the package name, a list of
+such symbols, or a list of selectors (see below).
+
+Here is an example of using the @acronym{GNU} @acronym{ELPA} packages
+@file{hydra}, @file{ivy}, and @file{ivy-hydra}.  Note that
+@file{ivy-hydra} will always be loaded last:
+
+@lisp
+(use-package hydra)
+
+(use-package ivy)
+
+@group
+(use-package ivy-hydra
+  :after (ivy hydra))
+@end group
+@end lisp
+
+In this case, because the declarations are evaluated in the order they
+occur, the use of @code{:after} is not strictly necessary.  However,
+if @samp{hydra} and @samp{ivy} were to be autoloaded, using
+@code{:after} guarantees that @samp{ivy-hydra} is not loaded until it
+is actually needed.  By using @code{:after}, the above code will also
+work even if the order of the declaration changes.  This means that
+moving things around in your init file is less likely to break things.
+
+@subheading Using @code{:after} selectors
+
+@findex :all@r{, (with @code{:after})}
+@findex :any@r{, (with @code{:after})}
+@cindex list of selectors, for @code{:after}
+The @code{:after} keyword also accepts a list of selectors.  By
+default, @w{@code{:after (foo bar)}} is the same as @w{@code{:after
+(:all foo bar)}}, meaning that loading of the given package will not happen
+until both @code{foo} and @code{bar} have been loaded.  Here are some
+of the other possibilities:
+
+@verbatim
+:after (foo bar)
+:after (:all foo bar)
+:after (:any foo bar)
+:after (:all (:any foo bar) (:any baz quux))
+:after (:any (:all foo bar) (:all baz quux))
+@end verbatim
+
+When you nest selectors, such as in @w{@code{(:any (:all foo bar)
+(:all baz quux))}}, it means that the package will be loaded when
+either both @code{foo} and @code{bar} have been loaded, or when both
+@code{baz} and @code{quux} have been loaded.
+
+@cindex @code{use-package-always-defer}, with @code{:after}
+Pay attention when setting @code{use-package-always-defer} to a
+non-@code{nil} value, and also using the @code{:after} keyword.  In
+that case, you will need to specify how the declared package is to be
+loaded: for example, by some @code{:bind} (@pxref{Global
+keybindings}).  If you are not using one of the keywords that
+registers autoloads, such as @code{:bind} or @code{:hook}
+(@pxref{Hooks}), and your package manager does not provide autoloads,
+it is possible that your package will never be loaded if you do not
+add @code{:demand t} to those declarations.
+
+@node Load dependencies
+@section Prevent loading if dependencies are missing
+@cindex prevent loading package if dependencies are missing
+
+@findex :requires
+While the @code{:after} keyword delays loading until the dependencies
+are loaded, the somewhat simpler @code{:requires} keyword @emph{never}
+loads the package if the dependencies are not available when the
+@code{use-package} declaration is evaluated.  In this context,
+``available'' means that @code{foo} is available if @w{@code{(featurep
+'foo)}} evaluates to a non-@code{nil} value.  For example:
+
+@lisp
+@group
+(use-package abbrev
+  :requires foo)
+@end group
+@end lisp
+
+@noindent
+This is the same as:
+
+@lisp
+@group
+(use-package abbrev
+  :if (featurep 'foo))
+@end group
+@end lisp
+
+As a convenience, a list of such packages may be specified:
+
+@lisp
+@group
+(use-package abbrev
+  :requires (foo bar baz))
+@end group
+@end lisp
+
+For more complex logic, such as that supported by @code{:after},
+simply use @code{:if} and the appropriate Lisp expression.
+
+@node Manual installation
+@section Manually installed package
+
+When installing packages manually, without Emacs' built-in package
+manager (@file{package.el}), it will obviously not help you set up
+autoloads or add it to your @code{load-path}.  You must do it
+yourself.  However, use-package makes this more convenient.
+
+@menu
+* Load path::                   Using a custom @code{load-path}.
+* Manual autoloads::            Setting up autoloads manually.
+@end menu
+
+@node Load path
+@subsection Setting a custom @code{load-path}
+@cindex custom @code{load-path} for loading a package
+@cindex @code{load-path}, add directories for loading a package
+
+When installing packages manually, you must make sure its libraries
+are available on your @code{load-path}.  @xref{Lisp Libraries,,,
+emacs, GNU Emacs Manual}, for more details about package loading.
+
+@findex :load-path
+The @code{:load-path} keyword provides a convenient way to add
+directories to your load path.  It takes as argument a symbol, a
+function, a string or a list of strings.  If a directory is specified
+as a relative file name, it is expanded relative to
+@code{user-emacs-directory}.
+
+For example:
+
+@lisp
+@group
+(use-package org
+  :load-path "site-lisp/org/lisp/"
+  :commands org-mode)
+@end group
+@end lisp
+
+When using a symbol or a function to provide a dynamically generated
+list of directories, you must inform the byte-compiler of this
+definition, so that the value is available at byte-compilation time.
+This is done by using the special form @code{eval-and-compile} (as
+opposed to @code{eval-when-compile}, @pxref{Eval During Compile,,,
+elisp, GNU Emacs Lisp Reference Manual}).  Furthermore, this value is
+fixed to the value it had during compilation.  If the operation is
+costly, you do not have to repeat it again on each startup.  For
+example:
+
+@lisp
+@group
+(eval-and-compile
+  (defun ess-site-load-path ()
+    (shell-command-to-string "find ~ -path ess/lisp")))
+@end group
+
+@group
+(use-package ess-site
+  :load-path (lambda () (list (ess-site-load-path)))
+  :commands R)
+@end group
+@end lisp
+
+@node Manual autoloads
+@subsection Setting up autoloads manually
+
+Packages often document how to set up its autoloads when it is being
+manually installed.  If it does, follow those instructions.
+Otherwise, you might want to set them up manually.
+
+@cindex autoloads for packages, setting up manually
+@cindex package autoloads, setting up manually
+
+@findex :commands
+@findex :autoload
+To autoload an interactive command, use the @code{:commands} keyword,
+which takes either a symbol or a list of symbols as its argument.  It
+creates autoloads for those commands (which defers loading of the
+module until those commands are used).
+
+The @code{:autoload} keyword takes the same arguments as
+@code{:commands}, but is used to autoload non-interactive functions.
+Here is an example:
+
+@lisp
+@group
+(use-package org-crypt
+  :autoload org-crypt-use-before-save-magic)
+@end group
+@end lisp
+
+@c ----------------------------------------------------------------------------
+@node Configuring Packages
+@chapter Configuring Packages
+@cindex configure packages using @code{use-package}
+@cindex customize package configuration
+
+This chapter describes the various keywords provided by
+@code{use-package} that help you configure packages.
+
+@menu
+* Lisp Configuration::          Using Lisp to configure packages.
+* Key bindings::                Making your own keybindings.
+* Hooks::                       Adding functions to hooks.
+* Modes and interpreters::      Enabling modes automatically.
+* Magic handlers::              Using regexps to enable modes.
+* User options::                Setting user options.
+* Faces::                       Customizing faces.
+* Hiding minor modes::          Tidying up the mode line.
+@end menu
+
+@node Lisp Configuration
+@section Using Lisp code for configuring packages
+@cindex configure package using Lisp forms
+
+The most general way to add customizations are the @code{:preface},
+@code{:init}, and @code{:config} keywords.  They all accept one or
+more Emacs Lisp forms, up to the next keyword, that are evaluated in
+order.  This lets you add arbitrary Lisp code to your
+@code{use-package} declarations.
+
+The only difference between these keywords is when they are evaluated.
+
+@menu
+* Preface keyword::             Evaluate code before anything else.
+* Init keyword::                Evaluate code before loading package.
+* Config keyword::              Evaluate code after loading package.
+* Best practices::              When to use @code{:config}, @code{:init}, and 
@code{:preface}.
+@end menu
+
+@node Preface keyword
+@subsection @code{:preface} is evaluated first
+
+@findex :preface
+The @code{:preface} section is evaluated before anything else, except
+@code{:disabled} and @code{:ensure}.  It can be used to establish
+function and variable definitions that will:
+
+@enumerate
+@item
+Make the byte-compiler happy: it will not complain about functions
+whose definitions are unknown.
+
+@item
+Define functions and variables that will be used in an @code{:if}
+test.
+@end enumerate
+
+Note that whatever is specified within @code{:preface} is evaluated
+both at load time and at byte-compilation time, in order to ensure
+that definitions are seen by both the Lisp evaluator and the
+byte-compiler.  Therefore, you should avoid having any side-effects in
+your @code{:preface} forms, and restrict them to symbol declarations
+and definitions.
+
+@node Init keyword
+@subsection @code{:init} is evaluated before loading package
+
+@findex :init
+The @code{:init} section is evaluated just before the package is
+loaded.  Note that the @code{:init} form is run unconditionally --
+even if the package happens to not exist on your system.  You must
+therefore remember to restrict @code{:init} code to what would succeed
+either way; put the rest in the @code{:config} section.  @code{:init}
+also always happens before package load, whether @code{:config} has
+been deferred or not.
+
+@node Config keyword
+@subsection @code{:config} is evaluated after loading package
+
+@findex :config
+The @code{:config} section is evaluated after the package has been
+loaded.  If the package is loaded immediately, this happens
+immediately after that, but if loading is done lazily (@pxref{Loading
+Packages}), this is deferred until after the package has been loaded.
+
+In general, you should keep @code{:init} forms as simple and quick as
+possible, and put as much as you can get away with into the
+@code{:config} section.  That way, deferred loading can help your
+Emacs start as quickly as possible.
+
+@node Best practices
+@subheading When to use @code{:preface}, @code{:config} and @code{:init}?
+@cindex tips for using @code{:preface}, @code{:config}, @code{:init}
+
+Where possible, it is better to avoid @code{:preface}, @code{:config}
+and @code{:init}.  Instead, prefer autoloading keywords such as
+@code{:bind} (@pxref{Key bindings}), @code{:hook} (@pxref{Hooks}), and
+@code{:mode} (@pxref{Modes and interpreters}), as they will take care
+of setting up autoloads for you without any need for boilerplate code.
+For example, consider the following declaration:
+
+@lisp
+@group
+(use-package foo
+  :init
+  (add-hook 'some-hook 'foo-mode))
+@end group
+@end lisp
+
+@noindent
+This has two problems.  First, it will unconditionally load the
+package @samp{foo} on startup, which will make things slower.  You can
+fix this by adding @w{@code{:defer t}}:
+
+@lisp
+@group
+(use-package foo
+  :defer t
+  :init
+  (add-hook 'some-hook 'foo-mode))
+@end group
+@end lisp
+
+@noindent
+This is better, as @samp{foo} is now only loaded when it is actually
+needed (that is, when the hook @samp{some-hook} is run).
+
+The second problem is that there is a lot of boilerplate that you have
+to write.  In this case, it might not be so bad, but avoiding that was
+what use-package was made to allow.  The better option in this case is
+therefore to use @code{:hook} (@pxref{Hooks}), which also implies
+@w{@code{:defer t}}.  The above is thereby reduced down to:
+
+@lisp
+@group
+(use-package foo
+  :hook some-hook)
+@end group
+@end lisp
+
+Now use-package will set up autoloading for you, and your Emacs
+startup time will not suffer one bit.
+
+@node Key bindings
+@section Key bindings
+
+@cindex binding keys for package commands
+@cindex key bindings for package commands
+One common thing to do when loading a package is to bind keys to
+commands within that module.  Without use-package, this would be done
+using a combination of @code{keymap-local-set},
+@code{keymap-global-set} and various autoloads.  With use-package, you
+can simplify this using the @code{:bind} keyword, as described in this
+section.
+
+@menu
+* Global keybindings::          Bindings you can use anywhere.
+* Binding in keymaps::          Bindings for particular modes.
+* Binding to a keymap::         Binding a key to a keymap.
+* Binding to repeat-maps::      Binding repeating keys.
+* Displaying keybindings::      Displaying personal key bindings.
+@end menu
+
+@node Global keybindings
+@subsection Global keybindings
+@cindex global keybindings
+
+@findex :bind
+To bind keys globally, the @code{:bind} keyword takes as its argument
+either a single cons or a list of conses.  Each cons has the form
+@w{@code{(@var{key} . @var{command})}}, where @var{key} is a string
+indicating the key to bind, and @var{command} is the name of a command
+(a symbol).  The syntax for the keys is similar to the syntax used by
+the @code{kbd} function (see @ref{Init Rebinding,,, emacs, GNU Emacs
+Manual}, for more information).
+
+@subheading Using @code{:bind} with a single cons
+
+Here is an example of using a single cons:
+
+@lisp
+@group
+(use-package ace-jump-mode
+  :bind ("C-." . ace-jump-mode))
+@end group
+@end lisp
+
+@noindent
+This does two things: first, it creates an autoload for the
+@code{ace-jump-mode} command and defers loading of the
+@code{ace-jump-mode} package until you actually use it.  Second, it
+binds the key @code{C-.} to that command globally.
+
+@subheading Using @code{:bind} with a list of conses
+
+Here is an example of using @code{:bind} with a list of conses:
+
+@lisp
+@group
+(use-package hi-lock
+  :bind (("M-o l" . highlight-lines-matching-regexp)
+         ("M-o r" . highlight-regexp)
+         ("M-o w" . highlight-phrase)))
+@end group
+@end lisp
+
+@noindent
+This binds the three key sequences to the corresponding commands.
+
+@subheading Using special keys
+@cindex binding function keys with @code{:bind}
+@cindex @code{:bind}, and function keys
+
+@c FIXME: TAB vs [tab] -- is letter-case important?  In general, these
+@c are two different keys: one is an ASCII character, the other a
+@c function key on GUI frames.
+Inside key strings, special keys like @kbd{TAB} or @kbd{F1}--@kbd{F12}
+have to be written inside angle brackets, e.g., @code{"C-<up>"}.
+@c FIXME: ``Some combinations''? which ones?
+Standalone special keys (and some combinations) can be written in
+square brackets, e.g.@ @code{[tab]} instead of @code{"<tab>"}.
+
+Examples:
+
+@lisp
+@group
+(use-package helm
+  :bind (("M-x" . helm-M-x)
+         ("M-<f5>" . helm-find-files)
+         ([f10] . helm-buffers-list)
+         ([S-f10] . helm-recentf)))
+@end group
+@end lisp
+
+@subheading Remapping commands
+@cindex remapping commands with @code{:bind}
+@cindex @code{:bind}, and remapping of commands
+
+Remapping of commands with @code{:bind} and @code{bind-key} works as
+expected, because when the binding is a vector, it is passed straight
+to @code{define-key}.  @xref{Remapping Commands,,, elisp, GNU Emacs
+Lisp Reference Manual}), for more information about command remapping.
+For example, the following declaration will rebind
+@code{fill-paragraph} (bound to @kbd{M-q} by default) to
+@code{unfill-toggle}:
+
+@lisp
+@group
+(use-package unfill
+  :bind ([remap fill-paragraph] . unfill-toggle))
+@end group
+@end lisp
+
+@c FIXME: Should the below be an Appendix?
+@subheading What @code{:bind} does behind the scenes
+@cindex @code{:bind}, internals
+
+To understand what @code{:bind} does behind the scenes, it might be
+useful to consider an example:
+
+@lisp
+@group
+(use-package ace-jump-mode
+  :bind ("C-." . ace-jump-mode))
+@end group
+@end lisp
+
+@noindent
+This could be expressed in a much more verbose way with the
+@code{:commands} and @code{:init} keywords:
+
+@lisp
+@group
+(use-package ace-jump-mode
+  :commands ace-jump-mode
+  :init
+  (bind-key "C-." 'ace-jump-mode))
+@end group
+@end lisp
+
+@noindent
+Without using even the @code{:commands} keyword, we could also write
+the above like so:
+
+@lisp
+@group
+(use-package ace-jump-mode
+  :defer t
+  :init
+  (autoload 'ace-jump-mode "ace-jump-mode" nil t)
+  (bind-key "C-." 'ace-jump-mode))
+@end group
+@end lisp
+
+Although these three forms are all equivalent, the first form is
+usually the best, as it will save some typing.
+
+@node Binding in keymaps
+@subsection Key bindings in local keymaps
+@cindex local keybindings
+
+@findex :map@r{, inside} :bind
+Slightly different from binding a key to a keymap, is binding a key
+@emph{within} a local keymap that only exists after the package is
+loaded.  @code{use-package} supports this with a @code{:map} modifier,
+taking the local keymap to bind to:
+
+@lisp
+@group
+(use-package helm
+  :bind (:map helm-command-map
+         ("C-c h" . helm-execute-persistent-action)))
+@end group
+@end lisp
+
+@noindent
+The effect of this is to wait until @code{helm} has loaded, and then
+to bind the key sequence @kbd{C-c h} to
+@code{helm-execute-persistent-action} within Helm's local keymap,
+@code{helm-command-map}.
+
+Multiple uses of @code{:map} may be specified.  Any binding occurring
+before the first use of @code{:map} are applied to the global keymap:
+
+@lisp
+@group
+(use-package term
+  :bind (("C-c t" . term)
+         :map term-mode-map
+         ("M-p" . term-send-up)
+         ("M-n" . term-send-down)
+         :map term-raw-map
+         ("M-o" . other-window)
+         ("M-p" . term-send-up)
+         ("M-n" . term-send-down)))
+@end group
+@end lisp
+
+@node Binding to a keymap
+@subsection Binding to keymaps
+@cindex binding keys to keymaps
+
+@findex :bind-keymap
+Normally @code{:bind} expects that commands are functions that will be
+autoloaded from the given package.  However, this does not work if one of
+those commands is actually a keymap, since keymaps are not functions,
+and cannot be autoloaded using the built-in @code{autoload} function.
+
+To handle this case, @code{use-package} offers a special, limited
+variant of @code{:bind} called @code{:bind-keymap}.  The only difference
+is that the ``commands'' bound to by @code{:bind-keymap} must be keymaps
+defined in the package, rather than interactive functions.  This is handled
+behind the scenes by generating custom code that loads the package
+containing the keymap, and then re-executes your keypress after the
+first load, to reinterpret that keypress as a prefix key.
+
+For example:
+
+@lisp
+@group
+(use-package foo
+  :bind-keymap ("C-c p" . foo-command-map))
+@end group
+@end lisp
+
+@node Binding to repeat-maps
+@subsection Binding to repeat-maps
+@cindex keybinding for @code{repeat-mode} keymaps
+
+@findex :repeat-map@r{, inside} :bind
+@cindex @code{repeat-mode} and use-package, using
+A special case of binding within a local keymap is when that keymap is
+used by @code{repeat-mode} (@pxref{Repeating,,, emacs, GNU Emacs
+Manual}).  These keymaps are usually defined specifically for
+this.  Using the @code{:repeat-map} keyword, and passing it a name for
+the map it defines, will bind all the following keys inside that map, and
+(by default) set the @code{repeat-map} property of each bound command
+to that map.
+
+The following example creates a keymap called
+@code{git-gutter+-repeat-map}, makes four bindings in it, then sets
+the @code{repeat-map} property of each bound command
+(@code{git-gutter+-next-hunk}, @code{git-gutter+-previous-hunk},
+@code{git-gutter+-stage-hunks}, and @code{git-gutter+-revert-hunk}) to
+that keymap.
+
+@lisp
+@group
+(use-package git-gutter+
+  :bind
+  (:repeat-map git-gutter+-repeat-map
+   ("n" . git-gutter+-next-hunk)
+   ("p" . git-gutter+-previous-hunk)
+   ("s" . git-gutter+-stage-hunks)
+   ("r" . git-gutter+-revert-hunk)))
+@end group
+@end lisp
+
+@findex :exit@r{, inside} :repeat-map@r{ and} :bind
+@cindex binding commands used at end of repeat series
+Specifying @code{:exit} inside the scope of @code{:repeat-map} will
+prevent the @code{repeat-map} property from being set, so that the command
+can be used from within the repeat map, but after using it the repeat
+map will no longer be available.  This is useful for commands often used
+at the end of a series of repeated commands.  Example:
+
+@lisp
+@group
+(use-package git-gutter+
+  :bind
+  (:repeat-map my/git-gutter+-repeat-map
+   ("n" . git-gutter+-next-hunk)
+   ("p" . git-gutter+-previous-hunk)
+   ("s" . git-gutter+-stage-hunks)
+   ("r" . git-gutter+-revert-hunk)
+   :exit
+   ("c" . magit-commit-create)
+   ("C" . magit-commit)
+   ("b" . magit-blame)))
+@end group
+@end lisp
+
+@findex :continue@r{, inside} :repeat-map@r{ and} :bind
+Specifying @code{:continue} @emph{forces} setting the
+@code{repeat-map} property (just like @emph{not} specifying
+@code{:exit}), so the above snippet is equivalent to:
+
+@lisp
+@group
+(use-package git-gutter+
+  :bind
+  (:repeat-map my/git-gutter+-repeat-map
+   :exit
+   ("c" . magit-commit-create)
+   ("C" . magit-commit)
+   ("b" . magit-blame)
+   :continue
+   ("n" . git-gutter+-next-hunk)
+   ("p" . git-gutter+-previous-hunk)
+   ("s" . git-gutter+-stage-hunks)
+   ("r" . git-gutter+-revert-hunk)))
+@end group
+@end lisp
+
+@node Displaying keybindings
+@subsection Displaying personal keybindings
+@cindex display your keybindings
+
+@findex describe-personal-keybindings
+The @code{:bind} keyword uses the @code{bind-keys} macro from the
+@samp{bind-key.el} library to set up keybindings.  It keeps track of
+all keybindings you make, so that you can display them separately from
+the default keybindings.
+
+Use @w{@kbd{M-x describe-personal-keybindings}} to see all
+keybindings you've set using either the @code{:bind} keyword or the
+@code{bind-keys} macro.
+
+@node Hooks
+@section Hooks
+
+@cindex hooks
+@findex :hook
+The @code{:hook} keyword allows adding functions to hooks.  It takes
+@c FIXME: The actual forms accepted by :hook are different, see below!
+one argument of the form @var{hooks}, specifying one or more functions
+to add to one or more hooks.  For the purposes of @code{:hook}, the
+name of hook variables should always exclude the @samp{-hook} suffix.
+It is appended automatically for you, to save some typing.
+
+For example, consider the following @code{use-package} declaration
+that sets up autoloads for @code{company-mode} from the @samp{company}
+package, and adds @samp{company-mode} to @code{prog-mode-hook}:
+
+@lisp
+@group
+(use-package company
+  :commands company-mode
+  :init
+  (add-hook 'prog-mode-hook #'company-mode))
+@end group
+@end lisp
+
+Using @code{:hook}, this can be simplified to:
+
+@lisp
+@group
+(use-package company
+  :hook (prog-mode . company-mode))
+@end group
+@end lisp
+
+Here, @code{:hook} will automatically set up autoloads for the
+@code{company-mode} command, so there is no need to use
+@code{:commands}.
+
+The @code{:hook} keyword will also assume that the name of the
+function you want to add is the same as the package name with
+@samp{-mode} appended to it.  Taking this into account, you can
+simplify the above to the equivalent:
+
+@lisp
+@group
+(use-package company
+  :hook prog-mode)
+@end group
+@end lisp
+
+@cindex multiple hooks
+You can also provide a list of hooks.  When multiple hooks should be
+applied, the following examples are all equivalent:
+
+@lisp
+@group
+(use-package company
+  :hook (prog-mode text-mode))
+@end group
+
+@group
+(use-package company
+  :hook ((prog-mode text-mode) . company-mode))
+@end group
+
+@group
+(use-package company
+  :hook ((prog-mode . company-mode)
+         (text-mode . company-mode)))
+@end group
+
+@group
+(use-package company
+  :commands company-mode
+  :init
+  (add-hook 'prog-mode-hook #'company-mode)
+  (add-hook 'text-mode-hook #'company-mode))
+@end group
+@end lisp
+
+One common mistake when using @code{:hook} is to forget to omit the
+@samp{-hook} suffix, which, as already explained, is appended
+automatically.  Therefore, the following will not work, as it attempts
+to add a function to non-existent @code{prog-mode-hook-hook}:
+
+@lisp
+@group
+;; DOES NOT WORK
+(use-package ace-jump-mode
+  :hook (prog-mode-hook . ace-jump-mode))
+@end group
+@end lisp
+
+@vindex use-package-hook-name-suffix
+If you do not like this behavior, you can customize the user option
+@code{use-package-hook-name-suffix} to @code{nil}.  The value of this
+variable is @samp{"-hook"} by default.
+
+The use of @code{:hook}, as with @code{:bind}, @code{:mode},
+@code{:interpreter}, etc., causes the functions being hooked to
+implicitly be read as @code{:commands}.  This means that they will
+establish interactive @code{autoload} definitions for that module, if
+not already defined as functions), and so @code{:defer t} is also
+implied by @code{:hook}.
+
+@node Modes and interpreters
+@section Modes and interpreters
+@cindex @code{auto-mode-alist} customization
+@cindex @code{interpreter-mode-alist} customization
+@cindex setting up major modes
+
+@findex :mode
+@findex :interpreter
+Similar to @code{:bind}, you can use @code{:mode} and
+@code{:interpreter} to establish a deferred binding within the
+@code{auto-mode-alist} and @code{interpreter-mode-alist} variables
+(@pxref{Auto Major Mode,,, elisp, GNU Emacs Lisp Reference Manual}).
+The specifier to either keyword can be a cons cell, a list of cons
+cells, or a string or regexp.
+
+The following example reproduces the default @code{ruby-mode}
+configuration, exactly as it is in Emacs out-of-the-box.  That mode is
+enabled automatically when a file whose name matches the regexp
+@code{"\\.rb\\'"} (a file with the @file{.rb} extension), or when the
+first line of the file (known as the ``shebang'') matches the string
+@code{"ruby"}:
+
+@lisp
+@group
+(use-package ruby-mode
+  :mode "\\.rb\\'"
+  :interpreter "ruby")
+@end group
+@end lisp
+
+The default @code{python-mode} configuration can be reproduced using
+the declaration below.  Note that the package that should be loaded
+differs from the mode name in this case, so we must use a cons:
+
+@lisp
+@group
+;; The package is "python" but the mode is "python-mode":
+(use-package python
+  :mode ("\\.py\\'" . python-mode)
+  :interpreter ("python" . python-mode))
+@end group
+@end lisp
+
+Both the @code{:mode} and @code{:interpreter} keywords also accept a
+list of regexps:
+
+@lisp
+@group
+(use-package foo
+  ;; Equivalent to "\\(ba[rz]\\)\\'":
+  :mode ("\\.bar\\'" "\\.baz\\'")
+  ;; Equivalent to "\\(foo[ab]\\)":
+  :interpreter ("fooa" "foob"))
+@end group
+@end lisp
+
+@node Magic handlers
+@section Magic handlers
+@cindex @code{magic-mode-alist} customization
+
+@findex :magic
+@findex :magic-fallback
+Similar to @code{:mode} and @code{:interpreter}, you can also use
+@code{:magic} and @code{:magic-fallback} to cause certain function to
+be run if the beginning of a file matches a given regular expression,
+as if these regular expressions were added to @code{magic-mode-alist}
+and @code{magic-fallback-mode-alist} (@pxref{Auto Major Mode,,, elisp,
+GNU Emacs Lisp Reference Manual}).  The difference between
+@code{:magic} and @code{:magic-fallback}, is that the latter has a
+lower priority than @code{:mode}.
+
+Here is an example:
+
+@lisp
+@group
+(use-package pdf-tools
+  :magic ("%PDF" . pdf-view-mode)
+  :config
+  (pdf-tools-install :no-query))
+@end group
+@end lisp
+
+This registers an autoloaded command for @code{pdf-view-mode}, defers
+loading of @code{pdf-tools}, and runs @code{pdf-view-mode} if the
+beginning of a buffer matches the string @code{"%PDF"}.
+
+@node User options
+@section User options
+@cindex customization of variables
+@cindex variable customizations
+@cindex user options, setting
+
+@findex :custom
+In Emacs, you normally set customizable variables (user options) using
+the @code{M-x customize} interface (@pxref{Easy Customization,,,
+emacs, GNU Emacs Manual}).  We recommend this method for most users.
+However, it is also possible to set them in your @code{use-package}
+declarations by using the @code{:custom} keyword.
+
+@lisp
+@group
+(use-package comint
+  :defer t
+  :custom
+  (comint-buffer-maximum-size 20000 "Increase comint buffer size.")
+  (comint-prompt-read-only t "Make the prompt read only."))
+@end group
+@end lisp
+
+This is better than using @code{setq} in a @code{:config} block, as
+customizable variables might have some code associated with it that
+Emacs will execute when you assign values to them.  (In Emacs 29 and
+later, there is also the new @code{setopt} macro that does this for
+you.)
+
+Note that the values customized using @code{:custom} are @emph{not}
+saved in the standard Emacs @code{custom-file} (@pxref{Saving
+Customizations,,, emacs, GNU Emacs Manual}).  You should therefore set
+each user option using either the @code{:custom} keyword @emph{or}
+@w{@kbd{M-x customize-option}} command; the latter will save
+customized values in the Emacs @code{custom-file}.  Do not use both
+for the same variable, as this risks having conflicting values in your
+use-package declaration and your @code{custom-file}, which can lead to
+problems that are both tricky and tedious to debug.
+
+@node Faces
+@section Faces
+@cindex faces, setting
+@cindex customization of faces
+
+@findex :custom-face
+The @code{:custom-face} keyword allows customization of package's
+faces.  Example:
+
+@lisp
+@group
+(use-package eruby-mode
+  :custom-face
+  (eruby-standard-face ((t (:slant italic)))))
+@end group
+
+@group
+(use-package example
+  :custom-face
+  (example-1-face ((t (:foreground "LightPink"))))
+  (example-2-face ((t (:foreground "LightGreen"))) face-defspec-spec))
+@end group
+
+@group
+(use-package zenburn-theme
+  :preface
+  (setq my/zenburn-colors-alist
+        '((fg . "#DCDCCC") (bg . "#1C1C1C") (cyan . "#93E0E3")))
+  :custom-face
+  (region ((t (:background ,(alist-get my/zenburn-colors-alist 'cyan)))))
+  :config
+  (load-theme 'zenburn t))
+@end group
+@end lisp
+
+@node Hiding minor modes
+@section Hiding minor modes with diminish and delight
+@cindex hiding minor modes
+
+@code{use-package} supports the @file{diminish} and @file{delight}
+packages, both of which make it possible to remove or change minor mode
+strings in your mode-line.  Which one to use is up to you, but you
+should normally only use one or the other -- never both.@footnote{When
+in doubt, you might as well use @file{diminish}.}  To use either of them, you
+must first install the corresponding package from @acronym{GNU} @acronym{ELPA}.
+
+@menu
+* Diminish::                    Hiding minor modes with Diminish.
+* Delight::                     Hiding minor modes with Delight.
+@end menu
+
+@node Diminish
+@subsection Diminish
+
+@findex :diminish
+When diminish@footnote{The @file{diminish} package is installable from
+@acronym{GNU} @acronym{ELPA}.} is installed, you can use the @code{:diminish}
+keyword.  If @file{diminish} is not installed, the @code{:diminish} keyword
+does nothing.
+
+First, add the following declaration to the beginning of your init
+file.
+
+@lisp
+(use-package diminish :ensure t)
+@end lisp
+
+@noindent
+The optional @w{@code{:ensure t}} makes sure the package is installed
+if it isn't already (@pxref{Installing packages}).
+
+The @code{:diminish} keyword takes as its argument either a minor mode
+symbol, a cons of the symbol and its replacement string, or just a
+replacement string, in which case the minor mode symbol is guessed to
+be the package name with @samp{-mode} appended at the end:
+
+@lisp
+@group
+(use-package abbrev
+  :diminish abbrev-mode
+  :config
+  (if (file-exists-p abbrev-file-name)
+      (quietly-read-abbrev-file)))
+@end group
+@end lisp
+
+@node Delight
+@subsection Delight
+
+@findex :delight
+When @file{delight}@footnote{The @file{delight} package is installable from
+@acronym{GNU} @acronym{ELPA}.} is installed, you can use the
+@code{:delight} keyword.  If @file{delight} is not installed, the
+@code{:delight} keyword does nothing.
+
+First, add the following declaration to the beginning of your init
+file.
+
+@lisp
+(use-package delight :ensure t)
+@end lisp
+
+@noindent
+The optional @w{@code{:ensure t}} makes sure the package is installed
+if it isn't already (@pxref{Installing packages}).
+
+The @code{:delight} keyword takes as its argument a minor mode symbol,
+a replacement string, or quoted mode line data (in which case the
+minor mode symbol is assumed to be the package name with @samp{-mode}
+appended at the end), both of these, or several lists of both.
+@xref{Mode Line Data,,, elisp, GNU Emacs Lisp Reference Manual}.  If
+no arguments are provided, the default mode name is hidden completely.
+
+For example, the following hides everything for the @samp{foo-mode}
+minor mode in the @samp{foo} package:
+
+@lisp
+@group
+(use-package foo
+  :delight)
+@end group
+@end lisp
+
+If the mode name doesn't match the package name with @samp{-mode}
+appended, provide a symbol instead.  For example, the following hides
+@code{auto-revert-mode} from the mode line:
+
+@lisp
+@group
+;; Don't show anything for auto-revert-mode, which doesn't match
+;; its package name.
+(use-package autorevert
+  :delight auto-revert-mode)
+@end group
+@end lisp
+
+You can also use arbitrary Lisp code as argument of @code{:delight}.
+For example, to replace @samp{foo-mode} with the value of the current
+buffer:
+
+@lisp
+@group
+(use-package foo
+  :delight '(:eval buffer-file-name))
+@end group
+@end lisp
+
+Here is an example of hiding several built-in minor modes:
+
+@lisp
+@group
+;; Completely hide visual-line-mode and change auto-fill-mode to " AF".
+(use-package emacs
+  :delight
+  (auto-fill-function " AF")
+  (visual-line-mode))
+@end group
+@end lisp
+
+@c ----------------------------------------------------------------------------
+@node Installing packages
+@chapter Installing packages automatically
+
+The standard Emacs package manager is documented in the Emacs manual
+(@pxref{Package Installation,,, emacs, GNU Emacs Manual}).  The
+@code{use-package} macro provides the @code{:ensure} and @code{:pin}
+keywords that interface with that package manager to automatically
+install packages.  This is particularly useful if you use your init
+file on more than one system.
+
+@menu
+* Install package::
+* Pinning packages::
+* Other package managers::
+@end menu
+
+@node Install package
+@section Installing package
+@cindex installing packages from archives
+
+@findex :ensure
+The @code{:ensure} keyword makes use-package ask the Emacs package
+manager to install a package if it is not already present on your
+system.
+
+For example:
+
+@lisp
+@group
+(use-package magit
+  :ensure t)
+@end group
+@end lisp
+
+If you need to install a different package from the one named by
+@code{use-package}, you can use a symbol:
+
+@lisp
+@group
+(use-package tex
+  :ensure auctex)
+@end group
+@end lisp
+
+@vindex use-package-always-ensure
+You can customize the user option @code{use-package-always-ensure} to
+a non-@code{nil} value if you want this behavior to be global for all
+packages:
+
+@lisp
+@group
+(require 'use-package-ensure)
+(setq use-package-always-ensure t)
+@end group
+@end lisp
+
+@noindent
+You can override the above setting for a single package by adding
+@w{@code{:ensure nil}} to its declaration.
+
+@node Pinning packages
+@section Pinning packages using @code{:pin}
+@cindex installing package from specific archive
+@cindex pinning a package to archive
+
+@findex :pin
+use-package can @dfn{pin} a package to a specific archive using the
+@code{:pin} keyword.@footnote{The @code{:pin} keyword has no effect on
+Emacs versions older than 24.4.}  This allows you to mix and match
+packages from different archives.  The primary use-case for this is
+preferring to install packages from @acronym{GNU} @acronym{ELPA} or
+@acronym{NonGNU} @acronym{ELPA} (indicated by @code{gnu} and @code{nongnu},
+respectively), while installing specific packages from third-party
+archives.
+
+For example:
+
+@lisp
+@group
+(use-package company
+  :ensure t
+  :pin gnu)   ; GNU ELPA
+@end group
+@end lisp
+
+@vindex use-package-always-pin
+Unfortunately, the third-party archive @acronym{MELPA} uses a
+versioning scheme based on dates, which means that packages from that
+archive are always preferred.  If you are using that archive, we
+strongly encourage you to customize @code{use-package-always-pin} to
+@code{nongnu}.  This guarantees that you are using a version of that
+package that has been specifically marked for release by its
+developer, and not a development snapshot.
+
+@cindex manual update of packages
+@c FIXME: This needs clarifying.  AFAIK, :ensure does not update packages.
+If you want to manually keep a package updated and ignore upstream
+updates, you can pin it to @samp{manual}.  This will work as long as
+you have not customized a repository to use that name in the
+@code{package-archives} variable.
+
+Example:
+
+@lisp
+@group
+(use-package org
+  :ensure t
+  ;; ignore org-mode from upstream and use a manually installed version
+  :pin manual)
+@end group
+@end lisp
+
+@code{use-package} signals an error if you try to pin a package to an
+archive that is not configured using @code{package-archives} (except
+from the special @samp{manual} archive).
+
+@node Other package managers
+@section Non-standard package managers
+@cindex non-standard package managers
+@cindex package managers, other than @file{package.el}
+@cindex installing using non-standard package managers
+
+By default, use-package assumes that you are using the Emacs built-in
+@file{package.el} package manager.  We expect that most users will
+find that it is capable enough, even for advanced use cases.
+
+@vindex use-package-ensure-function
+However, some users might prefer to use a third-party package manager
+for a specific circumstance or use case.  By setting the user option
+@code{use-package-ensure-function} to the name of a function, you can
+direct @code{:ensure} to use a different package manager for
+installing packages.
+
+For more details, please see the documentation of the package manager
+you are using.  If you run into any bugs, it is often best to report
+them directly to the developers of that package manager.
+
+@c ----------------------------------------------------------------------------
+@node Byte-compiling
+@chapter Byte-compiling your init file
+@cindex byte-compiling your init file
+
+Some users might want to byte-compile their init file to make Emacs
+startup faster.  This is not recommended in most cases, as the
+speed-up is usually too small to be worth it, and it can lead to
+confusion if the byte-compiled files are out-of-date.  If you still
+want to do it, this chapter explains how to do that.
+
+@code{use-package} always loads every library that it can while a file
+is being byte-compiled.  This helps silence spurious warnings about
+unknown variables and functions.
+
+@findex :defines
+@findex :functions
+@cindex silence byte-compilation warnings
+However, there are times when this is just not enough.  For those
+times, use the @code{:defines} and @code{:functions} keywords to
+introduce dummy variable and function declarations solely for the sake
+of silencing byte-compiler warnings.  For example:
+
+@lisp
+@group
+(use-package texinfo
+  :defines texinfo-section-list
+  :commands texinfo-mode
+  :init
+  (add-to-list 'auto-mode-alist '("\\.texi$" . texinfo-mode)))
+@end group
+@end lisp
+
+If you need to silence a missing function warning, you can use
+@code{:functions}:
+
+@lisp
+@group
+(use-package ruby-mode
+  :mode "\\.rb\\'"
+  :interpreter "ruby"
+  :functions inf-ruby-keys
+  :config
+  (defun my-ruby-mode-hook ()
+    (require 'inf-ruby)
+    (inf-ruby-keys))
+  (add-hook 'ruby-mode-hook 'my-ruby-mode-hook))
+@end group
+@end lisp
+
+@findex :no-require
+@cindex prevent a package from loading at compile-time
+@cindex package loading at byte-compilation time, prevent
+Normally, @code{use-package} will load each package at compile time
+before compiling the configuration, to ensure that any necessary
+symbols are in scope to satisfy the byte-compiler.  At times this can
+cause problems, since a package may have special loading requirements,
+and all that you want to use @code{use-package} for is to add a
+configuration to the @code{eval-after-load} hook.  In such cases, use
+the @code{:no-require} keyword:
+
+@lisp
+@group
+(use-package foo
+  :no-require t
+  :config
+  (message "Evaluate this immediately after loading `foo'"))
+@end group
+@end lisp
+
+@c ----------------------------------------------------------------------------
+@node Troubleshooting
+@chapter Troubleshooting
+
+@cindex troubleshooting use-package
+@cindex debugging use-package
+If an error occurs while initializing or configuring a package, this
+will not stop your Emacs from loading.  Instead, @code{use-package}
+captures the error and reports it in a special @file{*Warnings*} popup
+buffer, so that you can debug the situation in an otherwise functional
+Emacs.
+
+If you are having trouble when starting Emacs, you can pass Emacs the
+@samp{--debug-init} command line flag.  @xref{Initial Options,,,
+emacs, GNU Emacs Manual}.  To get even more information when using
+that flag, add the following to your init file (these options are
+documented below):
+
+@lisp
+@group
+(when init-file-debug
+  (setq use-package-verbose t
+        use-package-expand-minimally nil
+        use-package-compute-statistics t
+        debug-on-error t))
+@end group
+@end lisp
+
+@cindex reporting bugs
+@cindex expanding macro, for troubleshooting
+Since @code{use-package} is a macro, the first step when you need to
+dig deeper is usually to see what Emacs Lisp code your declaration
+expands to.  You can either use the command @w{@kbd{M-x
+pp-macroexpand-last-sexp}}, or wrap the use-package declaration in
+@code{macroexpand} and evaluate it.  It is a good idea to include
+their output in any bugs you file for use-package.
+
+@menu
+* Troubleshooting Options::
+* Gathering Statistics::
+* Disabling a package::
+@end menu
+
+@node Troubleshooting Options
+@section Options that help when troubleshooting
+@cindex options for troubleshooting
+@cindex troubleshooting, options that help
+
+@vindex use-package-expand-minimally
+By default, use-package will attempts to catch and report errors that
+occur during expansion of use-package declarations in your init file.
+Customize the user option @code{use-package-expand-minimally} to a
+non-@code{nil} value to disable this checking.
+
+@findex :catch
+This behavior may be overridden locally using the @code{:catch}
+keyword.  If @code{t} or @code{nil}, it enables or disables catching
+errors at load time.  It can also be a function taking two arguments:
+the keyword being processed at the time the error was encountered, and
+the error object (as generated by @code{condition-case}).  For
+example:
+
+@lisp
+@group
+(use-package example
+  ;; Note that errors are never trapped in the preface, since
+  ;; doing so would hide definitions from the byte-compiler.
+  :preface (message "I'm here at byte-compile and load time")
+  :init (message "I'm always here at startup")
+  :config
+  (message "I'm always here after the package is loaded")
+  (error "oops")
+  ;; Don't try to (require 'example), this is just an example!
+  :no-require t
+  :catch (lambda (keyword err)
+           (message (error-message-string err))))
+@end group
+@end lisp
+
+Evaluating the above form will print these messages:
+
+@verbatim
+I'm here at byte-compile and load time
+I'm always here at startup
+Configuring package example...
+I'm always here after the package is loaded
+oops
+@end verbatim
+
+@node Gathering Statistics
+@section Gathering Statistics
+@cindex gathering use-package statistics
+@cindex usage statistics for use-package
+
+@vindex use-package-verbose
+When a package is loaded, and if you have @code{use-package-verbose}
+set to @code{t}, or if the package takes longer than 0.1 seconds to
+load, you will see a message to indicate this loading activity in the
+@code{*Messages*} buffer.  The same will happen for configuration, or
+@code{:config} blocks, that take longer than 0.1 seconds to execute.
+
+@vindex use-package-compute-statistics
+If you'd like to see a summary how many packages you've loaded, what
+stage of initialization they've reached, and how much aggregate time
+they've spent (roughly), you can customize the user option
+@code{use-package-compute-statistics} to a non-@code{nil} value.  Then
+reload your packages, normally by restarting Emacs, to make sure that
+use-package can gather statistics for all your packages.
+
+@cindex use-package-report
+Run the command @kbd{M-x use-package-report} to see the results.  The
+buffer displayed is a tabulated list.  To sort rows based on a
+particular column, move point to it and type @kbd{S}, or click the
+column name at the top of the buffer on graphical displays.
+
+@findex use-package-reset-statistics
+To reset all statistics that use-package has gathered for the current
+Emacs invocation, run the command @kbd{M-x use-package-reset-statistics}.
+
+Note that if you are setting @code{use-package-compute-statistics}
+directly in your init file, and not with @code{customize}, you must do
+this after loading @code{use-package}, but before any
+@code{use-package} forms.
+
+@node Disabling a package
+@section Disabling a package
+@cindex disable package
+
+@findex :disabled
+The @code{:disabled} keyword inhibits loading a package, and all its
+customizations.  It is equivalent to commenting out or deleting the
+definition.
+
+You could use this, for example, to temporarily disable a package that
+you're having difficulties with, or to avoid loading a package that
+you're not currently using.
+
+This example disables the @samp{foo} package:
+
+@lisp
+@group
+(use-package foo
+  :disabled)
+@end group
+@end lisp
+
+When byte-compiling your init file, use-package omits disabled
+declarations from the output entirely, in order to make Emacs startup
+faster.
+
+@c ----------------------------------------------------------------------------
+@node Keyword extensions
+@appendix Keyword extensions
+@cindex keyword extension
+@cindex extending use-package keywords
+
+use-package is based on an extensible framework that makes it easy for
+package authors to add new keywords, or modify the behavior of
+existing keywords.
+
+Some keyword extensions are included with @code{use-package}, and can
+be optionally enabled.
+
+@menu
+* use-package-ensure-system-package::
+* Creating an extension::
+@end menu
+
+@node use-package-ensure-system-package
+@appendixsec :use-package-ensure-system-package
+
+@findex :ensure-system-package
+The @code{:ensure-system-package} keyword allows you to ensure certain
+executables are available on your system alongside your package
+declarations.@footnote{On macOS, your @code{exec-path} might be
+different if you are starting Emacs as a GUI app instead of from a
+shell.  If you find that Emacs on macOS cannot find some executables
+that you know are already installed, you could try the
+@uref{https://github.com/purcell/exec-path-from-shell,@samp{exec-path-from-shell}}
+package.}
+
+To use this extension, add this immediately after loading
+@code{use-package}:
+
+@lisp
+(use-package use-package-ensure-system-package)
+@end lisp
+
+Now you can use the @code{:ensure-system-package} keyword.
+Here's an example usage:
+
+@lisp
+@group
+(use-package foo
+  :ensure-system-package foo)
+@end group
+@end lisp
+
+This will expect a global binary package to exist called @code{foo}.
+If it does not, it will use your system package manager to attempt an
+install of a binary by the same name asynchronously.  This requires
+the @acronym{GNU} @acronym{ELPA} package
+@uref{https://gitlab.com/jabranham/system-packages,@samp{system-packages}},
+so for this to work you must install that first.
+
+One way of making sure it is installed is with @code{use-package}
+together with @code{:ensure}.
+
+@lisp
+@group
+(use-package system-packages
+  :ensure t)
+@end group
+@end lisp
+
+For example, on a Debian GNU/Linux system, this would call
+@samp{apt-get install foo}.
+
+If the package is named differently than the binary, you can use a
+cons in the form of @code{(binary . package-name)}.  For example:
+
+@lisp
+@group
+(use-package foo
+  :ensure-system-package
+  (foocmd . foo))
+@end group
+@end lisp
+
+On a Debian GNU/Linux system, this would call @code{apt install foo}
+if Emacs could not locate the executable @code{foocmd}.@footnote{For
+manual testing, you could use the @code{executable-find} function,
+which is what @samp{system-packages} uses internally.}
+
+@code{:ensure-system-package} can also take a cons where the
+@code{cdr} is a string that will get called by
+@code{(async-shell-command)} to install if it isn't found.  This does
+not depend on any external package.
+
+@lisp
+@group
+(use-package tern
+  :ensure-system-package (tern . "npm i -g tern"))
+@end group
+@end lisp
+
+To install several packages, you can pass in a list of conses:
+
+@lisp
+@group
+(use-package ruby-mode
+  :ensure-system-package
+  ((rubocop     . "gem install rubocop")
+   (ruby-lint   . "gem install ruby-lint")
+   (ripper-tags . "gem install ripper-tags")
+   (pry         . "gem install pry")))
+@end group
+@end lisp
+
+Finally, in case the package dependency does not provide a global
+executable, you can ensure that packages exist by checking the
+presence of a file by providing a string like so:
+
+@lisp
+@group
+(use-package dash-at-point
+  :if (eq system-type 'darwin)
+  :ensure-system-package
+  ("/Applications/Dash.app" . "brew cask install dash"))
+@end group
+@end lisp
+
+@code{:ensure-system-package} will use @code{system-packages-install}
+to install system packages, except where a custom command has been
+specified, in which case it will be executed verbatim by
+@code{async-shell-command}.
+
+The user options @code{system-packages-package-manager} and
+@code{system-packages-use-sudo} are honored, but not for custom
+commands.  Custom commands should include the call to sudo in the
+command if needed.
+
+@node Creating an extension
+@appendixsec How to create an extension keyword
+@cindex extension keywords
+
+This section describes how to create a new keyword.
+
+@enumerate
+@item
+Add the keyword.
+
+The first step is to add your keyword at the right place in
+@code{use-package-keywords}.  This list determines the order in which
+things will happen in the expanded code.  You should never change this
+order, but it gives you a framework within which to decide when your
+keyword should fire.
+
+@item
+Create a normalizer.
+
+The job of the normalizer is take a list of arguments (possibly
+@code{nil}), and turn it into the single argument (which could still
+be a list) that should appear in the final property list used by
+@code{use-package}.
+
+Define a normalizer for your keyword by defining a function named
+after the keyword, for example:
+
+@lisp
+@group
+(defun use-package-normalize/:pin (name-symbol keyword args)
+  (use-package-only-one (symbol-name keyword) args
+    (lambda (label arg)
+      (cond
+       ((stringp arg) arg)
+       ((symbolp arg) (symbol-name arg))
+       (t
+        (use-package-error
+         ":pin wants an archive name (a string)"))))))
+@end group
+@end lisp
+
+@item
+Create a handler.
+
+Once you have a normalizer, you must create a handler for the keyword.
+
+Handlers can affect the handling of keywords in two ways.  First, they
+can modify the @code{state} plist before recursively processing the
+remaining keywords, to influence keywords that pay attention to the
+state (one example is the state keyword @code{:deferred}, not to be
+confused with the @code{use-package} keyword @code{:defer}).  Then,
+once the remaining keywords have been handled and their resulting
+forms returned, the handlers may manipulate, extend, or just ignore
+those forms.
+
+The task of each handler is to return a @emph{list of forms}
+representing code to be inserted.  It does not need to be a
+@code{progn} list, as this is handled automatically in other places.
+Thus it is common to see the idiom of using @code{use-package-concat}
+to add new functionality before or after a code body, so that only the
+minimum code necessary is emitted as the result of a
+@code{use-package} expansion.
+
+This is an example handler:
+
+@lisp
+@group
+(defun use-package-handler/:pin (name-symbol keyword archive-name rest state)
+  (let ((body (use-package-process-keywords name-symbol rest state)))
+    ;; This happens at macro expansion time, not when the expanded code is
+    ;; compiled or evaluated.
+    (if (null archive-name)
+        body
+      (use-package-pin-package name-symbol archive-name)
+      (use-package-concat
+       body
+       `((push '(,name-symbol . ,archive-name)
+               package-pinned-packages))))))
+@end group
+@end lisp
+
+@item
+Test it.
+
+After the keyword has been inserted into @code{use-package-keywords},
+and a normalizer and a handler has been defined, you can now test the
+keyword by seeing how usages of the keyword will expand.  For this,
+use @w{@kbd{M-x pp-macroexpand-last-sexp}} with the cursor set
+immediately after the @code{(use-package @dots{})} expression.
+@end enumerate
+
+@c ----------------------------------------------------------------------------
+@node History
+@appendix History and acknowledgments
+
+use-package was written by John Wiegley.  Its development started in
+2012, and it got merged into Emacs in 2022, in preparation of the
+release of Emacs 29.1.
+
+Dozens of people have contributed to use-package over the years with
+bug reports, documentation and code.  They are too many to list here,
+but we thank them all for their contributions.
+
+This Texinfo manual was written by Stefan Kangas, as a significant
+rewrite of the old use-package manual and @file{README}.
+
+@node GNU Free Documentation License
+@appendix GNU Free Documentation License
+@include doclicense.texi
+
+@node Index
+@unnumbered Index
+@printindex cp
+
+@bye
diff --git a/etc/DEBUG b/etc/DEBUG
index ef9160a209..01c75f8da7 100644
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -1002,6 +1002,28 @@ Address sanitization is incompatible with 
undefined-behavior
 sanitization, unfortunately.  Address sanitization is also
 incompatible with the --with-dumping=unexec option of 'configure'.
 
+*** Address poisoning/unpoisoning
+
+When compiled with address sanitization, Emacs will also try to mark
+dead/free lisp objects as poisoned, forbidding them from being
+accessed without being unpoisoned first.  This adds an extra layer
+of checking with objects in internal free lists, which may otherwise
+evade traditional use-after-free checks. To disable this, add
+'allow_user_poisoning=0' to ASAN_OPTIONS, or build Emacs with
+'-DGC_ASAN_POISON_OBJECTS=0' in CFLAGS.
+
+While using GDB, memory addresses can be inspected by using helper
+functions additionally provided by the ASan library:
+
+  (gdb) call __asan_describe_address(ptr)
+
+To check whether an address range is poisoned or not, use:
+
+  (gdb) call __asan_region_is_poisoned(ptr, 8)
+
+Additional functions can be found in the header
+'sanitizer/asan_interface.h' in your compiler's headers directory.
+
 ** Running Emacs under Valgrind
 
 Valgrind <https://valgrind.org/> is free software that can be useful
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS
index f638d4717a..76439f1d06 100644
--- a/etc/ERC-NEWS
+++ b/etc/ERC-NEWS
@@ -45,13 +45,12 @@ With the overhaul of the services module temporarily 
shelved and the
 transition to SASL-based authentication still underway, users may feel
 left in the lurch to endure yet another release cycle of backtick
 hell.  For some, auth-source may provide a workaround in the form of
-nonstandard server passwords.  See the "Connection" node in the manual
-under the subheading "Password".
+nonstandard server passwords.  See the section titled "auth-source" in
+the Integrations chapter of ERC's manual.
 
-If you require SASL immediately, please participate in ERC development
-by volunteering to try (and give feedback on) edge features, one of
-which is SASL.  All known external offerings, past and present, are
-valiant efforts whose use is nevertheless discouraged.
+** Rudimentary SASL support has arrived.
+A new module, 'erc-sasl', now ships with ERC 5.5.  See the SASL
+section in the manual for details.
 
 ** Username argument for entry-point commands.
 Commands 'erc' and 'erc-tls' now accept a ':user' keyword argument,
@@ -125,6 +124,15 @@ The function 'erc-auto-query' was deemed too difficult to 
reason
 through and has thus been deprecated with no public replacement; it
 has also been removed from the client code path.
 
+The function 'erc-open' now delays running 'erc-mode-hook' members
+until most local session variables have been initialized (minus those
+connection-related ones in erc-backend).  'erc-open' also no longer
+calls 'erc-update-modules', although modules are still activated
+in an identical fashion.
+
+Some groundwork has been laid for what may become a new breed of ERC
+module, namely, "connection-local" (or simply "local") modules.
+
 A few internal variables have been introduced that could just as well
 have been made public, possibly as user options.  Likewise for some
 internal functions.  As always, users needing such functionality
diff --git a/etc/HELLO b/etc/HELLO
index 7bc12063f8..fbe65a451e 100644
--- a/etc/HELLO
+++ b/etc/HELLO
@@ -114,7 +114,7 @@ Thai (ภาษาไทย)      สวัสดีครับ / สวัสดี
 Tibetan (བོད་སྐད་)     བཀྲ་ཤིས་བདེ་ལེགས༎
 Tigrigna (ትግርኛ)        ሰላማት
 Tirhuta (𑒞𑒱𑒩𑒯𑒳𑒞𑒰)      𑒣𑓂𑒩𑒢𑒰𑒧 / 𑒮𑒲𑒞𑒰𑒩𑒰𑒧
-Turkish (Türkçe)       Merhaba
+Turkish (Türkçe)       Esenlikler / Merhaba
 Ukrainian (українська) Вітаю / Добрий день! / Привіт
 Vietnamese (tiếng Việt)        Chào bạn
 Wancho (𞋒𞋀𞋉𞋃𞋕)         𞋂𞋈𞋛
diff --git a/etc/NEWS b/etc/NEWS
index 5a65896d69..af7f1050b7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -6,10 +6,10 @@ See the end of the file for license conditions.
 Please send Emacs bug reports to 'bug-gnu-emacs@gnu.org'.
 If possible, use 'M-x report-emacs-bug'.
 
-This file is about changes in Emacs version 29.
+This file is about changes in Emacs version 30.
 
 See file HISTORY for a list of GNU Emacs versions and release dates.
-See files NEWS.28, NEWS.27, ..., NEWS.18, and NEWS.1-17 for changes
+See files NEWS.29, NEWS.28, ..., NEWS.18, and NEWS.1-17 for changes
 in older Emacs versions.
 
 You can narrow news to a specific version by calling 'view-emacs-news'
@@ -22,4370 +22,88 @@ When you add a new item, use the appropriate mark if you 
are sure it
 applies, and please also update docstrings as needed.
 
 
-* Installation Changes in Emacs 29.1
-
----
-** Ahead-of-time native compilation can now be specified via configure.
-Use '--with-native-compilation=aot' to specify that all the Lisp files
-in the Emacs tree should be natively compiled ahead of time.  (This is
-slow on most machines.)
-
-+++
-** Emacs can be built with built-in support for accessing SQLite databases.
-This uses the popular sqlite3 library, and can be disabled by using
-the '--without-sqlite3' option to the 'configure' script.
-
-+++
-** Support for the WebP image format.
-This support is built by default when the libwebp library is
-available, and includes support for animated WebP images.  To disable
-WebP support, use the '--without-webp' configure flag.  Image
-specifiers can now use ':type webp'.
-
-+++
-** Emacs has been ported to the Haiku operating system.
-The configuration process should automatically detect and build for
-Haiku.  There is also an optional window-system port to Haiku, which
-can be enabled by configuring Emacs with the option '--with-be-app',
-which will require the Haiku Application Kit development headers and a
-C++ compiler to be present on your system.  If Emacs is not built with
-the option '--with-be-app', the resulting Emacs will only run in
-text-mode terminals.
-
-To enable Cairo support, ensure that the Cairo and FreeType
-development files are present on your system, and configure Emacs with
-'--with-be-cairo'.
-
-Unlike X, there is no compile-time option to enable or disable
-double-buffering; it is always enabled.  To disable it, change the
-frame parameter 'inhibit-double-buffering' instead.
-
----
-** Emacs now installs the ".pdmp" file using a unique fingerprint in the name.
-The file is typically installed using a file name akin to
-"...dir/libexec/emacs/29.1/x86_64-pc-linux-gnu/emacs-<fingerprint>.pdmp".
-If a constant file name is required, the file can be renamed to
-"emacs.pdmp", and Emacs will find it during startup anyway.
-
----
-** Emacs now uses XInput 2 for input events.
-If your X server has support and you have the XInput 2 development
-headers installed, Emacs will use the X Input Extension for handling
-input.  If this causes problems, you can configure Emacs with the
-option '--without-xinput2' to disable this support.
-
-'(featurep 'xinput2)' can be used to test for the presence of XInput 2
-support from Lisp programs.
-
----
-** Emacs no longer reduces the size of the Japanese dictionary.
-Building Emacs includes generation of a Japanese dictionary, which is
-used by Japanese input methods.  Previously, the build included a step
-of reducing the size of this dictionary's vocabulary.  This vocabulary
-reduction is now optional, by default off.  If you need the Emacs
-build to include the vocabulary reduction, configure Emacs with the
-option '--with-small-ja-dic'.  In an Emacs source tree already
-configured without that option, you can force the vocabulary reduction
-by saying
-
-    make -C leim generate-ja-dic JA_DIC_NO_REDUCTION_OPTION=''
-
-after deleting "lisp/leim/ja-dic/ja-dic.el".
-
-+++
-** Emacs now supports being built with pure GTK.
-To use this option, make sure the GTK 3 (version 3.22.23 or later) 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.  We do not recommend
-that you use this configuration, unless you are running a window
-system that's supported by GDK other than X.  Running this
-configuration on X is known to have problems, such as undesirable
-frame positioning and various issues with keyboard input of sequences
-such as 'C-;' and 'C-S-u'.
-
----
-** The implementation of overlays has changed.
-Emacs now uses an implementation of overlays that is much more
-efficient than the original one, and should speed up all the
-operations that involve overlays, especially when there are lots of
-them in a buffer.  However, no changes in behavior of overlays should
-be visible on the Lisp or user level, with the exception of better
-performance and the order of overlays returned by functions that don't
-promise any particular order.
-
----
-** 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.
+* Installation Changes in Emacs 30.1
 
 
-* Startup Changes in Emacs 29.1
-
-+++
-** '--batch' and '--script' now adjust the garbage collection levels.
-These switches now set 'gc-cons-percentage' to 1.0 (up from the
-default of 0.1).  This means that batch processes will typically use
-more memory than before, but use less time doing garbage collection.
-Batch jobs that are supposed to run for a long time should adjust the
-limit back down again.
-
-+++
-** Emacs can now be used more easily in an executable script.
-If you start an executable script with
-
-    #!/usr/bin/emacs -x
-
-Emacs will start without reading any init files (like with '--quick'),
-and then execute the rest of the script file as Emacs Lisp.  When it
-reaches the end of the script, Emacs will exit with an exit code from
-the value of the final form.
-
-+++
-** New function 'substitute-quotes'.
-This function works like 'substitute-command-keys' but only
-substitutes quote characters.
-
-+++
-** Emacs now supports setting 'user-emacs-directory' via '--init-directory'.
-
-+++
-** Emacs now has a '--fingerprint' option.
-This will output a string identifying the current Emacs build.
-
-+++
-** New hook 'after-pdump-load-hook'.
-This is run at the end of the Emacs startup process, and is meant to
-be used to reinitialize structures that would normally be done at load
-time.
-
-** Native Compilation
-
-+++
-*** New variable 'inhibit-automatic-native-compilation'.
-If set, Emacs will inhibit native compilation (and won't write
-anything to the eln cache automatically).  The variable is initialized
-from the 'EMACS_INHIBIT_AUTOMATIC_NATIVE_COMPILATION' environment
-variable on Emacs startup.
-
----
-*** New command 'native-compile-prune-cache'.
-This command deletes older eln cache entries (but not the ones for
-the current Emacs version).
-
----
-*** New function 'startup-redirect-eln-cache'.
-This function can be called in your init files to change the
-user-specific directory where Emacs stores the "*.eln" files produced
-by native compilation of Lisp packages Emacs loads.  The default
-eln cache directory is unchanged: it is the "eln-cache" subdirectory
-of 'user-emacs-directory'.
+* Startup Changes in Emacs 30.1
 
 
-* Incompatible changes in Emacs 29.1
-
-+++
-** The image commands have changed key bindings.
-In previous Emacs versions, images have had the '+', '-' and 'r' keys
-bound when point is over an image.  In Emacs 29.1, additional commands
-were added, and this made it more likely that users would trigger the
-image commands by mistake.  To avoid this, all image commands have
-moved to the 'i' keymap, so '+' is now 'i +', '-' is now 'i -', and
-'r' is now 'i r'.  In addition, these commands are now repeating, so
-you can rotate an image twice by saying 'i r r', for instance.
-
-+++
-** Emacs now picks the correct coding system for X input methods.
-Previously, Emacs would use the locale coding system for input
-methods, which could in some circumstances be incorrect, especially
-when the input method chose to fall back to some other coding system.
-
-Now, Emacs automatically detects the coding system used by input
-methods, and uses that to decode input in preference to the value of
-'locale-coding-system'.  This unfortunately means that users who have
-changed the coding system used to decode X keyboard input must adjust
-their customizations to 'locale-coding-system' to the variable
-'x-input-coding-system' instead.
-
-+++
-** Bookmarks no longer include context for encrypted files.
-If you're visiting an encrypted file, setting a bookmark no longer
-includes excerpts from that buffer in the bookmarks file.  This is
-implemented by the new hook 'bookmark-inhibit-context-functions',
-where packages can register a function which returns non-nil for file
-names to be excluded from adding such excerpts.
-
----
-** 'show-paren-mode' is now disabled in 'special-mode' buffers.
-In Emacs versions previous to Emacs 28.1, 'show-paren-mode' defaulted
-off.  In Emacs 28.1, the mode was switched on in all buffers.  In
-Emacs 29.1, this was changed to be switched on in all editing-related
-buffers, but not in buffers that inherit from 'special-mode'.  To get
-back to how things worked in Emacs 28.1, put the following in your
-init file:
-
-    (setopt show-paren-predicate t)
-
-+++
-** Explicitly-set read-only state is preserved when reverting a buffer.
-If you use the 'C-x C-q' command to change the read-only state of the
-buffer and then revert it, Emacs would previously use the file
-permission bits to determine whether the buffer should be read-only
-after reverting the buffer.  Emacs now remembers the decision made in
-'C-x C-q'.
-
----
-** The Gtk selection face is no longer used for the region.
-The combination of a Gtk-controlled background and a foreground color
-controlled by the internal Emacs machinery led to low-contrast faces
-in common default setups.  Emacs now uses the same 'region' face on
-Gtk and non-Gtk setups.
-
-** Dired
-
----
-*** 'w' ('dired-copy-filename-as-kill') has changed behavior.
-If there are several files marked, file names containing space and
-quote characters will be quoted "like this".
-
----
-*** The 'd' command now more consistently skips dot files.
-In previous Emacs versions, commands like 'C-u 10 d' would put the "D"
-mark on the next ten files, no matter whether they were dot files
-(i.e., "." and "..") or not, while marking the next ten lines with the
-mouse (in 'transient-mark-mode') and then hitting 'd' would skip dot
-files.  These now work equivalently.
-
-+++
-** Warning about "eager macro-expansion failure" is changed into an error.
-
----
-** Previously, the X "reverseVideo" value at startup was heeded for all frames.
-This meant that if you had a "reverseVideo" resource on the initial
-display, and then opened up a new frame on a display without any
-explicit "reverseVideo" setting, it would get heeded there, too.  (This
-included terminal frames.)  In Emacs 29, the "reverseVideo" X resource
-is handled like all the other X resources, and set on a per-frame basis.
-
-+++
-** 'E' in 'query-replace' now edits the replacement with exact case.
-Previously, this command did the same as 'e'.
-
----
-** '/ a' in "*Packages*" buffer now limits by archive name(s) instead of 
regexp.
-
-+++
-** Setting the goal columns now also affects '<prior>' and '<next>'.
-Previously, 'C-x C-n' only affected 'next-line' and 'previous-line',
-but it now also affects 'scroll-up-command' and 'scroll-down-command'.
-
----
-** Isearch in "*Help*" and "*info*" now char-folds quote characters by default.
-This means that you can say 'C-s `foo' (GRAVE ACCENT) if the buffer
-contains "‘foo" (LEFT SINGLE QUOTATION MARK) and the like.  These
-quotation characters look somewhat similar in some fonts.  To switch
-this off, disable the new 'isearch-fold-quotes-mode' minor mode.
+* Changes in Emacs 30.1
 
----
-** Sorting commands no longer necessarily change modification status.
-In earlier Emacs versions, commands like 'M-x sort-lines' would always
-change buffer modification status to "modified", whether they changed
-something in the buffer or not.  This has been changed: The buffer is
-marked as modified only if the sorting ended up changing the contents
-of the buffer.
+** X selection requests are now handled much faster and asynchronously.
+This means it should be less necessary to disable the likes of
+`select-active-regions' when Emacs is running over a slow network
+connection.
 
----
-** 'string-lines' handles trailing newlines differently.
-It no longer returns an empty final string if the string ends with a
-newline.
+
+* Editing Changes in Emacs 30.1
 
+
+* Changes in Specialized Modes and Packages in Emacs 30.1
 ---
-** 'TAB' and '<backtab>' are now bound in 'button-map'.
-This means that if point is on a button, 'TAB' will take you to the
-next button, even if the mode has bound it to something else.  This
-also means that 'TAB' on a button in an 'outline-minor-mode' heading
-will move point instead of collapsing the outline.
+** Variable order and truncation can now be configured in gdb-many-window mode.
+The new variable 'gdb-locals-table-row-config' allows users to
+configure the order and max length of various properties in the local
+variables buffer when using 'gdb-many-windows'.
 
----
-** 'Info-default-directory-list' is no longer populated at Emacs startup.
-If you have code in your init file that removes directories from
-'Info-default-directory-list', this will no longer work.
+By default, this variable is set to write the properties in the order:
+name, type and value, where the name and type are truncated to 20
+characters, and the value is truncated according to the value of
+'gdb-locals-value-limit'.
 
----
-** 'C-k' no longer deletes files in 'ido-mode'.
-To get the previous action back, put something like the following in
-your Init file:
+If you want to get back the old behavior, set
+'gdb-locals-table-row-config' to  the value
 
-    (require 'ido)
-    (keymap-set ido-file-completion-map "C-k" #'ido-delete-file-at-head)
+  ((type . 0)(name . 0)(value . ,gdb-locals-value-limit)).
 
----
-** New user option 'term-clear-full-screen-programs'.
-By default, term will now work like most terminals when displaying
-full-screen programs: When they exit, the output is cleared, leaving
-what was displayed in the window before the programs started.  Set
-this user option to nil to revert back to the old behavior.
+** VC
 
 ---
-** 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.1 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).
+*** New user option 'vc-git-shortlog-switches'.
+This is a string or a list of strings that specifies the Git log
+switches for shortlogs, such as the one produced by 'C-x v L'.
+'vc-git-log-switches' is no longer used for shortlogs.
 
----
-** '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.
+** bs
 
 ---
-** 'C-x 8 =' moved to 'C-x 8 = ='.
-You can now use 'C-x 8 =' to insert several characters with macron;
-for example, 'C-x 8 = a' will insert U+0101 LATIN SMALL LETTER A WITH
-MACRON.  To insert a lone macron, type 'C-x 8 = =' instead of the
-previous 'C-x ='.
+*** New user option 'bs-default-action-list'.
+You can now configure how to display the "*buffer-selection*" buffer
+using this new option.  (Or set 'display-buffer-alist' directly.)
 
 ** Eshell
 
-*** Eshell's PATH is now derived from 'exec-path'.
-For consistency with remote connections, Eshell now uses 'exec-path'
-to determine the execution path on the local system, instead of using
-the PATH environment variable directly.
-
----
-*** 'source' and '.' no longer accept the '--help' option.
-This is for compatibility with the shell versions of these commands,
-which don't handle options like '--help' in any special way.
-
-+++
-*** String delimiters in argument predicates/modifiers are more restricted.
-Previously, some argument predicates/modifiers allowed arbitrary
-characters as string delimiters.  To provide more unified behavior
-across all predicates/modifiers, the list of allowed delimiters has
-been restricted to "...", '...', /.../, |...|, (...), [...], <...>,
-and {...}.  See the "(eshell) Argument Predication and Modification"
-node in the Eshell manual for more details.
-
-+++
-*** Eshell pipelines now only pipe stdout by default.
-To pipe both stdout and stderr, use the '|&' operator instead of '|'.
-
-*** New eshell built-in command 'doas'.
-The privilege-escalation program 'doas' has been added to the existing
-'su' and 'sudo' commands from the 'eshell-tramp' module.  The external
-command may still be accessed by using '*doas'.
-
----
-** The 'delete-forward-char' command now deletes by grapheme clusters.
-This command is by default bound to the <Delete> function key
-(a.k.a. <deletechar>).  When invoked without a prefix argument or with
-a positive prefix numeric argument, the command will now delete
-complete grapheme clusters produced by character composition.  For
-example, if point is before an Emoji sequence, pressing <Delete> will
-delete the entire sequence, not just a single character at its
-beginning.
-
 +++
-** 'load-history' does not treat autoloads specially any more.
-An autoload definition appears just as a '(defun . NAME)' and the
-'(t . NAME)' entries are not generated any more.
-
----
-** The Tamil input methods no longer insert Tamil digits.
-The input methods 'tamil-itrans' and 'tamil-inscript' no longer insert
-the Tamil digits, as those digit characters are not used nowadays by
-speakers of the Tamil language.  To get back the previous behavior,
-use the new 'tamil-itrans-digits' and 'tamil-inscript-digits' input
-methods instead.
+*** New splice operator for Eshell dollar expansions.
+Dollar expansions in Eshell now let you splice the elements of the
+expansion in-place using '$@expr'.  This makes it easier to fill lists
+of arguments into a command, such as when defining aliases.  For more
+information, see the "(eshell) Dollars Expansion" node in the Eshell
+manual.
 
 +++
-** New variable 'current-time-list' governing default timestamp form.
-Functions like 'current-time' now yield '(TICKS . HZ)' timestamps if
-this new variable is nil.  The variable defaults to t, which means
-these functions default to timestamps of the forms '(HI LO US PS)',
-'(HI LO US)' or '(HI LO)', which are less regular and less efficient.
-This is part of a long-planned change first documented in Emacs 27.
-Developers are encouraged to test timestamp-related code with this
-variable set to nil, as it will default to nil in a future Emacs
-version and will be removed some time after that.
+*** 'eshell-read-aliases-list' is now an interactive command.
+After manually editing 'eshell-aliases-file', you can use
+'M-x eshell-read-aliases-list' to load the edited aliases.
 
+** Prog Mode
 +++
-** Functions that recreate the "*scratch*" buffer now also initialize it.
-When functions like 'other-buffer' and 'server-execute' recreate
-"*scratch*", they now also insert 'initial-scratch-message' and set
-the major mode according to 'initial-major-mode', like at Emacs
-startup.  Previously, these functions ignored
-'initial-scratch-message' and left "*scratch*" in 'fundamental-mode'.
-
----
-** Naming of Image-Dired thumbnail files has changed.
-Names of thumbnail files generated when 'image-dired-thumbnail-storage'
-is 'image-dired' now always end in ".jpg".  This fixes various issues
-on different platforms, but means that thumbnails generated in Emacs 28
-will not be used in Emacs 29, and vice-versa.  If disk space is an
-issue, consider deleting the 'image-dired-dir' directory after
-upgrading (usually "~/.emacs.d/image-dired/").
-
----
-** The 'rlogin' method in the URL library is now obsolete.
-Emacs will now display a warning if you request a URL like
-"rlogin://foo@example.org".
-
----
-** Setting 'url-gateway-method' to 'rlogin' is now obsolete.
-Emacs will now display a warning when setting it to that value.
-The user options 'url-gateway-rlogin-host',
-'url-gateway-rlogin-parameters', and 'url-gateway-rlogin-user-name'
-are also obsolete.
-
----
-** The user function 'url-irc-function' now takes a 'scheme' argument.
-The user option 'url-irc-function' is now called with a sixth argument
-corresponding to the scheme portion of the target URL.  For example,
-this would be "ircs" for a URL like "ircs://irc.libera.chat".
-
----
-** The linum.el library is now obsolete.
-We recommend using either the built-in 'display-line-numbers-mode', or
-the 'nlinum' package from GNU ELPA instead.  The former has better
-performance, but the latter is closer to a drop-in replacement.
-
-1. To use 'display-line-numbers-mode', add something like this to your
-   Init file:
-
-    (global-display-line-numbers-mode 1)
-    ;; Alternatively, to use it only in programming modes:
-    (add-hook 'prog-mode-hook #'display-line-numbers-mode)
-
-2. To use 'nlinum', add this to your Init file:
-
-    (package-install 'nlinum)
-    (global-nlinum-mode 1)
-    ;; Alternatively, to use it only in programming modes:
-    (add-hook 'prog-mode-hook #'nlinum-mode)
-
-3. To continue using the obsolete package 'linum', add this line to
-   your Init file, in addition to any existing customizations:
-
-    (require 'linum)
-
----
-** The thumbs.el library is now obsolete.
-We recommend using 'M-x image-dired' instead.
-
----
-** The autoarg.el library is now marked obsolete.
-This library provides the 'autoarg-mode' and 'autoarg-kp-mode' minor
-modes to emulate the behavior of the historical editor Twenex Emacs.
-It is believed to no longer be useful.
-
----
-** The quickurl.el library is now obsolete.
-Use 'abbrev', 'skeleton' or 'tempo' instead.
-
----
-** The rlogin.el library, and the 'rsh' command are now obsolete.
-Use something like 'M-x shell RET ssh <host> RET' instead.
-
----
-** The url-about.el library is now obsolete.
-
----
-** The autoload.el library is now obsolete.
-It is superseded by the loaddefs-gen.el library.
-
----
-** The netrc.el library is now obsolete.
-Use the 'auth-source-netrc-parse-all' function in auth-source.el
-instead.
-
----
-** The url-dired.el library is now obsolete.
-
----
-** The fast-lock.el and lazy-lock.el library have been removed.
-They have been obsolete since Emacs 22.1.
-
-The variable 'font-lock-support-mode' is occasionally useful for
-debugging purposes.  It is now a regular variable (instead of a user
-option) and can be set to nil to disable Just-in-time Lock mode.
-
+*** New command 'prog-fill-reindent-defun'
+This command either fills a single paragraph in a defun, such as a
+doc-string, or a comment, or (re)indents the surrounding defun if
+point is not in a comment or a string.  It is by default bound to
+'M-q' in 'prog-mode' and all its descendants.
 
-* Changes in Emacs 29.1
-
-+++
-** New user option 'major-mode-remap-alist' to specify favorite major modes.
-This user option lets you remap the default modes (e.g. 'perl-mode' or
-'latex-mode') to your favorite ones (e.g. 'cperl-mode' or
-'LaTeX-mode') without having to use 'defalias', which can have
-undesirable side effects.
-This applies to all modes specified via 'auto-mode-alist', file-local
-variables, etc.
-
----
-** Emacs now supports Unicode Standard version 15.0.
-
----
-** New user option 'electric-quote-replace-consecutive'.
-
----
-** Emacs is now capable of editing files with very long lines.
-The display of long lines has been optimized, and Emacs should no
-longer choke when a buffer on display contains long lines.  The
-variable 'long-line-threshold' controls whether and when these display
-optimizations are in effect.
-
-A companion variable 'large-hscroll-threshold' controls when another
-set of display optimizations are in effect, which are aimed
-specifically at speeding up display of long lines that are truncated.
-
-If you still experience slowdowns while editing files with long lines,
-this may be due to line truncation, or to one of the enabled minor
-modes, or to the current major mode.  Try turning off line truncation
-with 'C-x x t', or try disabling all known slow minor modes with
-'M-x so-long-minor-mode', or try disabling both known slow minor modes
-and the major mode with 'M-x so-long-mode', or visit the file with
-'M-x find-file-literally' instead of the usual 'C-x C-f'.
-
-Note that the display optimizations in these cases may cause the
-buffer to be occasionally mis-fontified.
-
-The new function 'long-line-optimizations-p' returns non-nil when
-these optimizations are in effect in the current buffer.
-
-+++
-** New command to change the font size globally.
-To increase the font size, type 'C-x C-M-+' or 'C-x C-M-='; to
-decrease it, type 'C-x C-M--'; to restore the font size, type 'C-x
-C-M-0'.  The final key in these commands may be repeated without the
-leading 'C-x' and without the modifiers, e.g. 'C-x C-M-+ C-M-+ C-M-+'
-and 'C-x C-M-+ + +' increase the font size by three steps.  When
-'mouse-wheel-mode' is enabled, 'C-M-wheel-up' and 'C-M-wheel-down' also
-increase and decrease the font size globally.  Additionally, the
-user option 'global-text-scale-adjust-resizes-frames' controls whether
-the frames are resized when the font size is changed.
-
-** New config variable 'syntax-wholeline-max' to reduce the cost of long lines.
-This variable is used by some operations (mostly syntax-propertization
-and font-locking) to treat lines longer than this variable as if they
-were made up of various smaller lines.  This can help reduce the
-slowdowns seen in buffers made of a single long line, but can also
-cause misbehavior in the presence of such long lines (tho most of that
-misbehavior should usually be limited to mis-highlighting).  You can
-recover the previous behavior with:
-
-    (setq syntax-wholeline-max most-positive-fixnum)
-
----
-** New bindings in 'find-function-setup-keys' for 'find-library'.
-When 'find-function-setup-keys' is enabled, 'C-x L' is now bound to
-'find-library', 'C-x 4 L' is now bound to 'find-library-other-window'
-and 'C-x 5 L' is now bound to 'find-library-other-frame'.
-
-+++
-** New key binding after 'M-x' or 'M-X': 'M-X'.
-Emacs allows different completion predicates to be used with 'M-x'
-(i.e., 'execute-extended-command') via the
-'read-extended-command-predicate' user option.  Emacs also has the
-'M-X' (note upper case) command, which only displays commands
-especially relevant to the current buffer.  Emacs now allows toggling
-between these modes while the user is inputting a command by hitting
-'M-X' while in the minibuffer.
-
----
-** Interactively, 'kill-buffer' will now offer to save the buffer if unsaved.
-
----
-** New commands 'duplicate-line' and 'duplicate-dwim'.
-'duplicate-line' duplicates the current line the specified number of times.
-'duplicate-dwim' duplicates the region if it is active.  If not, it
-works like 'duplicate-line'.  An active rectangular region is
-duplicated on its right-hand side.
-
----
-** Files with the ".eld" extension are now visited in 'lisp-data-mode'.
-
-+++
-** 'network-lookup-address-info' can now check numeric IP address validity.
-Specifying 'numeric' as the new optional 'hints' argument makes it
-check if the passed address is a valid IPv4/IPv6 address (without DNS
-traffic).
-
-    (network-lookup-address-info "127.1" 'ipv4 'numeric)
-    => ([127 0 0 1 0])
-
-+++
-** New command 'find-sibling-file'.
-This command jumps to a file considered a "sibling file", which is
-determined according to the new user option 'find-sibling-rules'.
-
-+++
-** New user option 'delete-selection-temporary-region'.
-When non-nil, 'delete-selection-mode' will only delete the temporary
-regions (usually set by mouse-dragging or shift-selection).
-
-+++
-** New user option 'switch-to-prev-buffer-skip-regexp'.
-This should be a regexp or a list of regexps; buffers whose names
-match those regexps will be ignored by 'switch-to-prev-buffer' and
-'switch-to-next-buffer'.
-
-+++
-** New command 'rename-visited-file'.
-This command renames the file visited by the current buffer by moving
-it to a new location, and also makes the buffer visit this new file.
-
-** Menus
-
----
-*** The entries following the buffers in the "Buffers" menu can now be altered.
-Change the 'menu-bar-buffers-menu-command-entries' variable to alter
-the entries that follow the buffer list.
-
----
-** 'delete-process' is now a command.
-When called interactively, it will kill the process running in the
-current buffer (if any).  This can be useful if you have runaway
-output in the current buffer (from a process or a network connection),
-and want to stop it.
-
-+++
-** New command 'restart-emacs'.
-This is like 'save-buffers-kill-emacs', but instead of just killing
-the current Emacs process at the end, it starts a new Emacs process
-(using the same command line arguments as the running Emacs process).
-'kill-emacs' and 'save-buffers-kill-emacs' have also gained new
-optional parameters to restart instead of just killing the current
-process.
-
-+++
-** New user option 'mouse-drag-mode-line-buffer'.
-If non-nil, dragging on the buffer name part of the mode-line will
-drag the buffer's associated file to other programs.  This option is
-currently only available on X, Haiku and Nextstep (GNUstep or macOS).
-
-+++
-** New user option 'mouse-drag-and-drop-region-cross-program'.
-If non-nil, this option allows dragging text in the region from Emacs
-to another program.
-
----
-** New user option 'mouse-drag-and-drop-region-scroll-margin'.
-If non-nil, this option allows scrolling a window while dragging text
-around without a scroll wheel.
-
-+++
-*** The value of 'mouse-drag-copy-region' can now be the symbol 'non-empty'.
-This prevents mouse drag gestures from putting empty strings onto the
-kill ring.
-
-+++
-** New user options 'dnd-indicate-insertion-point' and 'dnd-scroll-margin'.
-These options allow adjusting point and scrolling a window when
-dragging items from another program.
-
-+++
-** The X Direct Save (XDS) protocol is now supported.
-This means dropping an image or file link from programs such as
-Firefox will no longer create a temporary file in a random directory,
-instead asking you where to save the file first.
-
-+++
-** New user option 'record-all-keys'.
-If non-nil, this option will force recording of all input keys,
-including those typed in response to passwords prompt (this was the
-previous behavior).  The default is nil, which inhibits recording of
-passwords.
+* New Modes and Packages in Emacs 30.1
 
-+++
-** New function 'command-query'.
-This function makes its argument command prompt the user for
-confirmation before executing.
-
-+++
-** The 'disabled' property of a command's symbol can now be a list.
-The first element of the list should be the symbol 'query', which will
-cause the command disabled this way prompt the user with a y/n or a
-yes/no question before executing.  The new function 'command-query' is
-a convenient method of making commands disabled in this way.
-
----
-** 'count-words' will now report buffer totals if given a prefix.
-Without a prefix, it will only report the word count for the narrowed
-part of the buffer.
-
-+++
-** 'count-words' will now report sentence count when used interactively.
-
-** New user option 'set-message-functions'.
-It allows selecting more functions for 'set-message-function'
-in addition to the default function that handles messages
-in the active minibuffer.  The most useful are 'inhibit-message'
-that allows specifying a list of messages to inhibit via
-'inhibit-message-regexps', and 'set-multi-message' that
-accumulates recent messages and displays them stacked
-in the echo area.
-
----
-** New user option 'find-library-include-other-files'.
-If set to nil, commands like 'find-library' will only include library
-files in the completion candidates.  The default is t, which preserves
-previous behavior, whereby non-library files could also be included.
-
-+++
-** New command 'sqlite-mode-open-file' for examining an sqlite3 file.
-This uses the new 'sqlite-mode' which allows listing the tables in a
-DB file, and examining and modifying the columns and the contents of
-those tables.
-
----
-** 'write-file' will now copy some file mode bits.
-If the current buffer is visiting a file that is executable, the
-'C-x C-w' command will now make the new file executable, too.
-
-+++
-** New user option 'process-error-pause-time'.
-This determines how long to pause Emacs after a process
-filter/sentinel error has been handled.
-
-+++
-** New faces for font-lock.
-These faces are primarily meant for use with tree-sitter.  They are:
-'font-lock-bracket-face', 'font-lock-delimiter-face',
-'font-lock-escape-face', 'font-lock-number-face',
-'font-lock-misc-punctuation-face', 'font-lock-operator-face',
-'font-lock-property-face', and 'font-lock-punctuation-face'.
-
-+++
-** New face 'variable-pitch-text'.
-This face is like 'variable-pitch' (from which it inherits), but is
-slightly larger, which should help with the visual size differences
-between the default, non-proportional font and proportional fonts when
-mixed.
-
-+++
-** New face 'mode-line-active'.
-This inherits from the 'mode-line' face, but is the face actually used
-on the mode lines (along with 'mode-line-inactive').
-
-+++
-** New face attribute pseudo-value 'reset'.
-This value stands for the value of the corresponding attribute of the
-'default' face.  It can be used to reset attribute values produced by
-inheriting from other faces.
-
-+++
-** New X resource: "borderThickness".
-This controls the thickness of the external borders of the menu bars
-and pop-up menus.
-
-+++
-** New X resource: "inputStyle".
-This controls the style of the pre-edit and status areas of X input
-methods.
-
-+++
-** New X resources: "highlightForeground" and "highlightBackground".
-Only in the Lucid build, this controls colors used for highlighted
-menu item widgets.
-
-+++
-** On X, Emacs now tries to synchronize window resize with the window manager.
-This leads to less flicker and empty areas of a frame being displayed
-when a frame is being resized.  Unfortunately, it does not work on
-some ancient buggy window managers, so if Emacs appears to freeze, but
-is still responsive to input, you can turn it off by setting the X
-resource "synchronizeResize" to "off".
-
-+++
-** On X, Emacs can optionally synchronize display with the graphics hardware.
-When this is enabled by setting the X resource "synchronizeResize" to
-"extended", frame content "tearing" is drastically reduced.  This is
-only supported on the Motif, Lucid, and no-toolkit builds, and
-requires an X compositing manager supporting the extended frame
-synchronization protocol (see
-https://fishsoup.net/misc/wm-spec-synchronization.html).
-
-This behavior can be toggled on and off via the frame parameter
-'use-frame-synchronization'.
-
-+++
-** New frame parameter 'alpha-background' and X resource "alphaBackground".
-This controls the opacity of the text background when running on a
-composited display.
-
-+++
-** New frame parameter 'shaded'.
-With window managers which support this, it controls whether or not a
-frame's contents will be hidden, leaving only the title bar on display.
-
----
-** New user option 'x-gtk-use-native-input'.
-This controls whether or not GTK input methods are used by Emacs,
-instead of XIM input methods.
-
-+++
-** New user option 'use-system-tooltips'.
-This controls whether to use the toolkit tooltips, or Emacs's own
-native implementation of tooltips as small frames.  This option is
-only meaningful if Emacs was built with GTK+, Nextstep, or Haiku
-support, and defaults to t, which makes Emacs use the toolkit
-tooltips.  The existing GTK-specific option
-'x-gtk-use-system-tooltips' is now an alias of this new option.
-
-+++
-** Non-native tooltips are now supported on Nextstep.
-This means Emacs built with GNUstep or built on macOS is now able to
-display different faces and images inside tooltips when the
-'use-system-tooltips' user option is nil.
-
----
-** New minor mode 'pixel-scroll-precision-mode'.
-When enabled, and if your mouse supports it, you can scroll the
-display up or down at pixel resolution, according to what your mouse
-wheel reports.  Unlike 'pixel-scroll-mode', this mode scrolls the
-display pixel-by-pixel, as opposed to only animating line-by-line
-scrolls.
-
-** Terminal Emacs
-
----
-*** Emacs will now use 24-bit colors on terminals that support "Tc" capability.
-This is in addition to previously-supported ways of discovering 24-bit
-color support: either via the "RGB" or "setf24" capabilities, or if
-the 'COLORTERM' environment variable is set to the value "truecolor".
-
-*** Select active regions with xterm selection support.
-On terminals with xterm setSelection support, the active region may be
-saved to the X primary selection, following the
-'select-active-regions' variable.  This support is enabled when
-'tty-select-active-regions' is non-nil.
-
----
-*** New command to set up display of unsupported characters.
-The new command 'standard-display-by-replacement-char' produces Lisp
-code that sets up the 'standard-display-table' to use a replacement
-character for display of characters that the text-mode terminal
-doesn't support.  It is most useful with the Linux console and similar
-terminals, where Emacs has a reliable way of determining which
-characters have glyphs in the font loaded into the terminal's memory.
-
----
-*** New functions to set terminal output buffer size.
-The new functions 'tty--set-output-buffer-size' and
-'tty--output-buffer-size' allow setting and retrieving the output
-buffer size of a terminal device.  The default buffer size is and has
-always been BUFSIZ, which is defined in your system's stdio.h.  When
-you set a buffer size with 'tty--set-output-buffer-size', this also
-prevents Emacs from explicitly flushing the tty output stream, except
-at the end of display update.
-
-** ERT
-
-+++
-*** New ERT variables 'ert-batch-print-length' and 'ert-batch-print-level'.
-These variables will override 'print-length' and 'print-level' when
-printing Lisp values in ERT batch test results.
-
----
-*** Redefining an ERT test in batch mode now signals an error.
-Executing 'ert-deftest' with the same name as an existing test causes
-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.
+
+* Incompatible Lisp Changes in Emacs 30.1
 
-+++
-*** 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
-
-+++
-*** Emacs now has several new methods for inserting Emojis.
-The Emoji commands are under the new 'C-x 8 e' prefix.
-
-+++
-*** New command 'emoji-insert' (bound to 'C-x 8 e e' and 'C-x 8 e i').
-This command guides you through various Emoji categories and
-combinations in a graphical menu system.
-
-+++
-*** New command 'emoji-search' (bound to 'C-x 8 e s').
-This command lets you search for Emojis based on names.
-
-+++
-*** New command 'emoji-list' (bound to 'C-x 8 e l').
-This command lists all Emojis (categorized by themes) in a special
-buffer and lets you choose one of them.
-
----
-*** New command 'emoji-recent' (bound to 'C-x 8 e r').
-This command lets you choose among the Emojis you have recently
-inserted.
-
-+++
-*** New command 'emoji-describe' (bound to 'C-x 8 e d').
-This command will tell you the name of the Emoji at point.  (This
-command also works for non-Emoji characters.)
-
----
-*** New commands 'emoji-zoom-increase' and 'emoji-zoom-decrease'.
-These are bound to 'C-x 8 e +' and 'C-x 8 e -', respectively.  They
-can be used on any character, but are mainly useful for emoji.
-
----
-*** New input method 'emoji'.
-This allows you to enter emoji using short strings, eg ':face_palm:'
-or ':scream:'.
-
-** Help
-
----
-*** Variable values displayed by 'C-h v' in "*Help*" are now font-locked.
-
-+++
-*** New user option 'help-clean-buttons'.
-If non-nil, link buttons in "*Help*" will have any surrounding quotes
-removed.
-
----
-*** 'M-x apropos-variable' output now includes values of variables.
-
-+++
-*** New docstring syntax to indicate that symbols shouldn't be links.
-When displaying docstrings in "*Help*" buffers, strings that are
-"`like-this'" are made into links (if they point to a bound
-function/variable).  This can lead to false positives when talking
-about values that are symbols that happen to have the same names as
-functions/variables.  To inhibit this buttonification, the new
-"\\+`like-this'" syntax can be used.
-
-+++
-*** New user option 'help-window-keep-selected'.
-If non-nil, commands to show the info manual and the source will reuse
-the same window the "*Help*" buffer is shown in.
-
----
-*** Commands like 'C-h f' have changed how they describe menu bindings.
-For instance, previously a command might be described as having the
-following bindings:
-
-    It is bound to <open>, C-x C-f, <menu-bar> <file> <new-file>.
-
-This has been changed to:
-
-    It is bound to <open> and C-x C-f.
-    It can also be invoked from the menu: File → Visit New File...
-
-+++
-*** The 'C-h .' command now accepts a prefix argument.
-'C-u C-h .' would previously inhibit displaying a warning message if
-there's no local help at point.  This has been changed to call
-'button-describe'/'widget-describe' and display button/widget help
-instead.
-
----
-*** New user option 'help-enable-variable-value-editing'.
-If enabled, 'e' on a value in "*Help*" will pop you to a new buffer
-where you can edit the value.  This is not enabled by default, because
-it's easy to make an edit that yields an invalid result.
-
----
-*** 'C-h b' uses outlining by default.
-Set 'describe-bindings-outline' to nil to get the old behavior.
-
----
-*** Jumping to function/variable source now saves mark before moving point.
-Jumping to source from "*Help*" buffer moves the point when the source
-buffer is already open.  Now, the old point is pushed to mark ring.
-
-+++
-*** New key bindings in "*Help*" buffers: 'n' and 'p'.
-These will take you (respectively) to the next and previous "page".
-
----
-*** 'describe-char' now also outputs the name of emoji combinations.
-
-+++
-*** New key binding in "*Help*" buffer: 'I'.
-This will take you to the Emacs Lisp manual entry for the item
-displayed, if any.
-
----
-*** The 'C-h m' ('describe-mode') "*Help*" buffer has been reformatted.
-It now only includes local minor modes at the start, and the global
-minor modes are listed after the major mode.
-
-+++
-*** The user option 'help-window-select' now affects apropos commands.
-The apropos commands will now select the apropos window if
-'help-window-select' is non-nil.
-
----
-*** 'describe-keymap' now considers the symbol at point.
-If the symbol at point is a keymap, 'describe-keymap' suggests it as
-the default candidate.
-
----
-*** New command 'help-quick' displays an overview of common commands.
-The command pops up a buffer at the bottom of the screen with a few
-helpful commands for various tasks.  You can toggle the display using
-'C-h q'.
-
-** Outline Mode
-
-+++
-*** Support for customizing the default visibility state of headings.
-Customize the user option 'outline-default-state' to define what
-headings will be visible after Outline mode is turned on.  When equal
-to a number, the user option 'outline-default-rules' determines the
-visibility of the subtree starting at the corresponding level.  Values
-are provided to control showing a heading subtree depending on whether
-the heading matches a regexp, or on whether its subtree has long lines
-or is itself too long.
-
-** Outline Minor Mode
-
-+++
-*** New user option 'outline-minor-mode-use-buttons'.
-If non-nil, Outline Minor Mode will use buttons to hide/show outlines
-in addition to the ellipsis.  The default is nil, but in 'help-mode'
-it has the value 'insert' that inserts the buttons directly to the
-buffer where you can use 'RET' to cycle outline visibility.  When
-the value is 'in-margins', Outline Minor Mode uses the window margins
-to hide/show outlines.
-
-** Windows
-
-+++
-*** New commands 'split-root-window-below' and 'split-root-window-right'.
-These commands split the root window in two, and are bound to 'C-x w 2'
-and 'C-x w 3', respectively.  A number of other useful window-related
-commands are now available on the 'C-x w' prefix.
-
-+++
-*** New user option 'display-buffer-avoid-small-windows'.
-If non-nil, this should be a window height, a number.  Windows smaller
-than this will be avoided by 'display-buffer', if possible.
-
-+++
-*** New display action 'display-buffer-full-frame'.
-This action removes other windows on the frame when displaying a
-buffer.
-
-+++
-*** 'display-buffer' now can set up the body size of the chosen window.
-For example, a 'display-buffer-alist' entry of
-
-    '(window-width . (body-columns . 40))'
-
-will make the body of the chosen window 40 columns wide.  For the
-height use 'window-height' in combination with 'body-lines'.
-
----
-*** You can customize which window 'scroll-other-window' operates on.
-This is controlled by the new 'other-window-scroll-default' user option.
-
-** Frames
-
-+++
-*** Deleted frames can now be undeleted.
-The 16 most recently deleted frames can be undeleted with 'C-x 5 u' when
-'undelete-frame-mode' is enabled.  Without a prefix argument, undelete
-the most recently deleted frame.  With a numerical prefix argument
-between 1 and 16, where 1 is the most recently deleted frame, undelete
-the corresponding deleted frame.
-
-** Tab Bars and Tab Lines
-
----
-*** New user option 'tab-bar-auto-width' to automatically determine tab width.
-This option is non-nil by default, which resizes tab-bar tabs so that
-their width is evenly distributed across the tab bar.  A companion
-option 'tab-bar-auto-width-max' controls the maximum width of a tab
-before its name on display is truncated.
-
----
-*** '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
-(started by directional formatting control characters such as RLO and
-LRI).  The new command 'highlight-confusing-reorderings' finds and
-highlights segments of buffer text whose reordering for display is
-suspicious and could be malicious.
-
-** Emacs server and client changes
-
-+++
-*** New command-line option '-r'/'--reuse-frame' for emacsclient.
-With this command-line option, Emacs reuses an existing graphical client
-frame if one exists; otherwise it creates a new frame.
-
-+++
-*** New command-line option '-w N'/'--timeout=N' for emacsclient.
-With this command-line option, emacsclient will exit if Emacs does not
-respond within N seconds.  The default is to wait forever.
-
-+++
-*** 'server-stop-automatically' can be used to automatically stop the server.
-The Emacs server will be automatically stopped when certain conditions
-are met.  The conditions are given by the argument, which can be
-'empty', 'delete-frame' or 'kill-terminal'.
-
-** Rcirc
-
-+++
-*** New command 'rcirc-when'.
-
-+++
-*** New user option 'rcirc-cycle-completion-flag'.
-Rcirc will use the default 'completion-at-point' mechanism.  The
-conventional IRC behavior of completing by cycling through the
-available options can be restored by enabling this option.
-
-+++
-*** New user option 'rcirc-bridge-bot-alist'.
-If you are in a channel where a bot is responsible for bridging
-between networks, you can use this variable to make these messages
-appear more native.  For example you might set the option to:
-
-    (setq rcirc-bridge-bot-alist '(("bridge" . "{\\(.+?\\)}[[:space:]]+")))
-
-for messages like
-
-    09:47 <bridge> {john} I am not on IRC
-
-to be reformatted into
-
-    09:47 <john> I am not on IRC
-
----
-*** New formatting commands.
-Most IRC clients (including rcirc) support basic formatting using
-control codes.  Under the 'C-c C-f' prefix a few commands have been
-added to insert these automatically.  For example, if a region is
-active and 'C-c C-f C-b' is invoked, markup is inserted for the region
-to be highlighted bold.
-
-** Imenu
-
-+++
-*** 'imenu' is now bound to 'M-g i' globally.
-
----
-*** New function 'imenu-flush-cache'.
-Use it if you want Imenu to forget the buffer's index alist and
-recreate it anew next time 'imenu' is invoked.
-
-+++
-** Emacs is now capable of abandoning a window's redisplay that takes too long.
-This is controlled by the new variable 'max-redisplay-ticks'.  If that
-variable is set to a non-zero value, display of a window will be
-aborted after that many low-level redisplay operations, thus
-preventing Emacs from becoming wedged when visiting files with very
-long lines.
-
-* Editing Changes in Emacs 29.1
-
-+++
-** 'M-SPC' is now bound to 'cycle-spacing'.
-Formerly it invoked 'just-one-space'.  The actions performed by
-'cycle-spacing' and their order can now be customized via the user
-option 'cycle-spacing-actions'.
-
----
-** 'zap-to-char' and 'zap-up-to-char' are case-sensitive for upper-case chars.
-These commands now behave as case-sensitive for interactive calls when
-they are invoked with an uppercase character, regardless of the
-'case-fold-search' value.
-
----
-** 'scroll-other-window' and 'scroll-other-window-down' now respect remapping.
-These commands (bound to 'C-M-v' and 'C-M-V') used to scroll the other
-windows without looking a customizations in that other window.  These
-functions now check whether they have been rebound in the buffer in
-that other window, and then call the remapped function instead.  In
-addition, these commands now also respect the
-'scroll-error-top-bottom' user option.
-
----
-** Indentation of 'cl-flet' and 'cl-labels' has changed.
-These forms now indent like this:
-
-    (cl-flet ((bla (x)
-                (* x x)))
-      (bla 42))
-
-This change also affects 'cl-macrolet', 'cl-flet*' and
-'cl-symbol-macrolet'.
-
-+++
-** New user option 'translate-upper-case-key-bindings'.
-Set this option to nil to inhibit translating upper case keys to lower
-case keys.
-
-+++
-** New command 'ensure-empty-lines'.
-This command increases (or decreases) the number of empty lines before
-point.
-
----
-** Improved mouse behavior with auto-scrolling modes.
-When clicking inside the 'scroll-margin' or 'hscroll-margin' region,
-point is now moved only when releasing the mouse button.  This no
-longer results in a bogus selection, unless the mouse has been
-effectively dragged.
-
-+++
-** 'kill-ring-max' now defaults to 120.
-
----
-** New user option 'yank-menu-max-items'.
-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
-
-+++
-*** New user option 'show-paren-context-when-offscreen'.
-When non-nil, if the point is in a closing delimiter and the opening
-delimiter is offscreen, shows some context around the opening
-delimiter in the echo area.  The default is nil.
-
-May also be set to the symbols 'overlay' or 'child-frame', in which
-case the context is shown in an overlay or child-frame at the top-left
-of the current window.  The latter option requires a graphical frame.
-On non-graphical frames, the context is shown in the echo area.
-
-** Comint
-
-+++
-*** 'comint-term-environment' is now aware of connection-local variables.
-The user option 'comint-terminfo-terminal' and the variable
-'system-uses-terminfo' can now be set as connection-local variables to
-change the terminal used on a remote host.
-
----
-*** New user option 'comint-delete-old-input'.
-When nil, this prevents comint from deleting the current input when
-inserting previous input using '<mouse-2>'.  The default is t, to
-preserve past behavior.
-
----
-*** New minor mode 'comint-fontify-input-mode'.
-This minor mode is enabled by default in "*shell*" and "*ielm*"
-buffers.  It fontifies input text according to 'shell-mode' or
-'emacs-lisp-mode' font-lock rules.  Customize the user options
-'shell-fontify-input-enable' and 'ielm-fontify-input-enable' to nil if
-you don't want to enable input fontification by default.
-
-** Mwheel
-
----
-*** New user options for alternate wheel events.
-The options 'mouse-wheel-down-alternate-event',
-'mouse-wheel-up-alternate-event', 'mouse-wheel-left-alternate-event',
-and 'mouse-wheel-right-alternate-event' have been added to better
-support systems where two kinds of wheel events can be received.
-
-** Internationalization changes
-
-*** The <Delete> function key now allows deleting the entire composed sequence.
-For the details, see the item about the 'delete-forward-char' command
-above.
-
-*** New user option 'composition-break-at-point'.
-Setting it to a non-nil value temporarily disables automatic
-composition of character sequences at point, and thus makes it easier
-to edit such sequences by allowing point to "enter" the sequence.
-
----
-*** Support for many old scripts and writing systems.
-Emacs now supports and has language-environments and input methods for
-several dozens of old scripts that were used in the past for various
-languages.  For each such script Emacs now has font-selection and
-character composition rules, a language environment, and an input
-method.  The newly-added scripts and the corresponding language
-environments are:
-
-Tai Tham script and the Northern Thai language environment
-Brahmi script and language environment
-Kaithi script and language environment
-Tirhuta script and language environment
-Sharada script and language environment
-Siddham script and language environment
-Syloti Nagri script and language environment
-Modi script and language environment
-Baybayin script and Tagalog language environment
-Hanunoo script and language environment
-Buhid script and language environment
-Tagbanwa script and language environment
-Limbu script and language environment
-Balinese script and language environment
-Javanese script and language environment
-Sundanese script and language environment
-Batak script and language environment
-Rejang script and language environment
-Makasar script and language environment
-Lontara script and language environment
-Hanifi Rohingya script and language environment
-Grantha script and language environment
-Kharoshthi script and language environment
-Lepcha script and language environment
-Meetei Mayek script and language environment
-Adlam script and language environment
-Mende Kikakui script and language environment
-Wancho script and language environment
-Toto script and language environment
-Gothic script and language environment
-Coptic script and language environment
-
----
-*** The "Oriya" language environment was renamed to "Odia".
-This is to follow the change in the official name of the script.  The
-'oriya' input method was also renamed to 'odia'.  However, the old
-name of the language environment and the input method are still
-supported.
-
----
-*** New Greek translation of the Emacs tutorial.
-Type 'C-u C-h t' to select it in case your language setup does not do
-so automatically.
-
----
-*** New Ukrainian translation of the Emacs Tutorial.
-
----
-*** New default phonetic input method for the Tamil language environment.
-The default input method for the Tamil language environment is now
-"tamil-phonetic" which is a customizable phonetic input method.  To
-change the input method's translation rules, customize the user option
-'tamil-translation-rules'.
-
----
-*** New tamil99 input method for the Tamil language.
-This supports the keyboard layout specifically designed for the Tamil
-language.
-
----
-*** New input method 'slovak-qwerty'.
-This is a variant of the 'slovak' input method, which corresponds to
-the QWERTY Slovak keyboards.
-
-
-* Changes in Specialized Modes and Packages in Emacs 29.1
-
-** ecomplete
-
----
-*** New commands 'ecomplete-edit' and 'ecomplete-remove'.
-These allow you to (respectively) edit and bulk-remove entries from
-the ecomplete database.
-
----
-*** New user option 'ecomplete-auto-select'.
-If non-nil and there's only one matching option, auto-select that.
-
----
-*** New user option 'ecomplete-filter-regexp'.
-If non-nil, this user option describes what entries not to add to the
-database stored on disk.
-
-** Auth-Source
-
-+++
-*** New user option 'auth-source-pass-extra-query-keywords'.
-Whether to recognize additional keyword params, like ':max' and
-':require', as well as accept lists of query terms paired with
-applicable keywords.
-
-** Dired
-
-+++
-*** 'dired-guess-shell-command' moved from dired-x to dired.
-This means that 'dired-do-shell-command' will now provide smarter
-defaults without first having to require 'dired-x'.  See the node
-"(emacs) Shell Command Guessing" in the Emacs manual for more details.
-
----
-*** 'dired-clean-up-buffers-too' moved from dired-x to dired.
-This means that Dired now offers to kill buffers visiting files and
-dirs when they are deleted in Dired.  Before, you had to require
-'dired-x' to enable this behavior.  To disable this behavior,
-customize the user option 'dired-clean-up-buffers-too' to nil.  The
-related user option 'dired-clean-confirm-killing-deleted-buffers'
-(which see) has also been moved to 'dired'.
-
-+++
-*** 'dired-do-relsymlink' moved from dired-x to dired.
-The corresponding key 'Y' is now bound by default in Dired.
-
-+++
-*** 'dired-do-relsymlink-regexp' moved from dired-x to dired.
-The corresponding key '% Y' is now bound by default in Dired.
-
----
-*** 'M-G' is now bound to 'dired-goto-subdir'.
-Before, that binding was only available if the dired-x package was
-loaded.
-
-+++
-*** 'dired-info' and 'dired-man' moved from dired-x to dired.
-The 'dired-info' and 'dired-man' commands have been moved from the
-dired-x package to dired.  They have also been renamed to
-'dired-do-info' and 'dired-do-man'; the old command names are obsolete
-aliases.
-
-The keys 'I' ('dired-do-info') and 'N' ('dired-do-man') are now bound
-in Dired mode by default.  The user options 'dired-bind-man' and
-'dired-bind-info' no longer have any effect and are obsolete.
-
-To get the old behavior back and unbind these keys in Dired mode, add
-the following to your Init file:
-
-    (with-eval-after-load 'dired
-      (keymap-set dired-mode-map "N" nil)
-      (keymap-set dired-mode-map "I" nil))
-
----
-*** New command 'dired-do-eww'.
-This command visits the file on the current line with EWW.
-
-** Elisp
-
----
-*** New command 'elisp-eval-region-or-buffer' (bound to 'C-c C-e').
-This command evals the forms in the active region or in the whole buffer.
-
----
-*** New commands 'elisp-byte-compile-file' and 'elisp-byte-compile-buffer'.
-These commands (bound to 'C-c C-f' and 'C-c C-b', respectively)
-byte-compile the visited file and the current buffer, respectively.
-
-** Games
-
----
-*** New user option 'tetris-allow-repetitions'.
-This controls how randomness is implemented (whether to use pure
-randomness as before or whether to use a bag).
-
-** Battery
-
-+++
-*** New user option 'battery-update-functions'.
-This can be used to trigger actions based on the battery status.
-
-** Enriched Mode
-
-+++
-*** New command 'enriched-toggle-markup'.
-This allows you to see the markup in 'enriched-mode' buffers (e.g.,
-the "HELLO" file).
-
-** Shell Script Mode
-
----
-*** New user option 'sh-indent-statement-after-and'.
-This controls how statements like the following are indented:
-
-    foo &&
-        bar
-
-*** New Flymake backend using the ShellCheck program.
-It is enabled by default, but requires that the external "shellcheck"
-command is installed.
-
-** CC Mode
----
-*** C++ Mode now supports most of the new features in the C++20 standard.
-
-** Cperl Mode
-
----
-*** New user option 'cperl-file-style'.
-This option determines the indentation style to be used.  It can also
-be used as a file-local variable.
-
-** Gud
-
----
-*** 'gud-go' is now bound to 'C-c C-v'.
-If given a prefix, it will query the user for an argument to use for
-the run/continue command.
-
----
-*** 'perldb' now recognizes '-E'.
-As of Perl 5.10, 'perl -E 0' behaves like 'perl -e 0' but also activates
-all optional features of the Perl version in use.  'perldb' now uses
-this invocation as its default.
-
-** Customize
-
----
-*** New command 'custom-toggle-hide-all-widgets'.
-This is bound to 'H' and toggles whether to hide or show the widget
-contents.
-
-** Diff mode
-
----
-*** New user option 'diff-whitespace-style'.
-Sets the value of the buffer-local variable 'whitespace-style' in
-'diff-mode' buffers.  By default, this variable is '(face trailing)',
-which preserves behavior from previous Emacs versions.
-
-+++
-*** New user option 'diff-add-log-use-relative-names'.
-If non-nil insert file names in ChangeLog skeletons relative to the
-VC root directory.
-
-** Ispell
-
----
-*** 'ispell-region' and 'ispell-buffer' now push the mark.
-These commands push onto the mark ring the location of the last
-misspelled word where corrections were offered, so that you can then
-skip back to that location with 'C-x C-x'.
-
-** Dabbrev
-
----
-*** New function 'dabbrev-capf' for use on 'completion-at-point-functions'.
-
-+++
-*** New user option 'dabbrev-ignored-buffer-modes'.
-Buffers with major modes in this list will be ignored.  By default,
-this includes "binary" buffers like 'archive-mode' and 'image-mode'.
-
-** Package
-
-+++
-*** New command 'package-update'.
-This command allows you to upgrade packages without using 'M-x
-list-packages'.
-
-+++
-*** New command 'package-update-all'.
-This command allows updating all packages without any queries.
-
-+++
-*** New commands 'package-recompile' and 'package-recompile-all'.
-These commands can be useful if the ".elc" files are out of date
-(invalid byte code and macros).
-
-+++
-*** New DWIM action on 'x' in "*Packages*" buffer.
-If no packages are marked, 'x' will install the package under point if
-it isn't already, and remove it if it is installed.
-
-+++
-*** New command 'package-vc-install'
-Packages can now be installed directly from source by cloning from a
-repository.
-
-+++
-*** New command 'package-vc-install-from-checkout'
-An existing checkout can now be loaded via package.el, by creating a
-symbolic link from the usual package directory to the checkout.
-
-+++
-*** New command 'package-vc-checkout'
-Used to fetch the source of a package by cloning a repository without
-activating the package.
-
-+++
-*** New command 'package-vc-prepare-patch'
-This command allows you to send patches to package maintainers, for
-packages checked out using 'package-vc-install'.
-
-+++
-*** New command 'package-report-bug'
-This command helps you compose an email for sending bug reports to
-package maintainers.
-
-+++
-*** New user option 'package-vc-selected-packages'
-By customizing this user option you can specify specific packages to
-install.
-
-** Emacs Sessions (Desktop)
-
-+++
-*** New user option to load a locked desktop if locking Emacs is not running.
-The option 'desktop-load-locked-desktop' can now be set to the value
-'check-pid', which means to allow loading a locked ".emacs.desktop"
-file if the Emacs process which locked it is no longer running on the
-local machine.  This allows avoiding questions about locked desktop
-files when the Emacs session which locked it crashes, or was otherwise
-interrupted, and didn't exit gracefully.  See the "(emacs) Saving
-Emacs Sessions" node in the Emacs manual for more details.
-
-** Miscellaneous
-
-+++
-*** New command 'scratch-buffer'.
-This command switches to the "*scratch*" buffer.  If "*scratch*" doesn't
-exist, the command creates it first.  You can use this command if you
-inadvertently delete the "*scratch*" buffer.
-
-** Debugging
-
----
-*** 'q' in a "*Backtrace*" buffer no longer clears the buffer.
-Instead it just buries the buffer and switches the mode from
-'debugger-mode' to 'backtrace-mode', since commands like 'e' are no
-longer available after exiting the recursive edit.
-
-+++
-*** New user option 'debug-allow-recursive-debug'.
-This user option controls whether the 'e' (in a "*Backtrace*"
-buffer or while edebugging) and 'C-x C-e' (while edebugging) commands
-lead to a (further) backtrace.  By default, this variable is nil,
-which is a change in behavior from previous Emacs versions.
-
-+++
-*** 'e' in edebug can now take a prefix arg to pretty-print the results.
-When invoked with a prefix argument, as in 'C-u e', this command will
-pop up a new buffer and show the full pretty-printed value there.
-
-+++
-*** 'C-x C-e' now interprets a non-zero prefix arg to pretty-print the results.
-When invoked with a non-zero prefix argument, as in 'C-u C-x C-e',
-this command will pop up a new buffer and show the full pretty-printed
-value there.
-
-+++
-*** You can now generate a backtrace from Lisp errors in redisplay.
-To do this, set the new variable 'backtrace-on-redisplay-error' to a
-non-nil value.  The backtrace will be written to a special buffer
-named "*Redisplay-trace*".  This buffer will not be automatically
-displayed in a window.
-
-** Compile
-
-+++
-*** New user option 'compilation-hidden-output'.
-This can be used to make specific parts of compilation output
-invisible.
-
-+++
-*** The 'compilation-auto-jump-to-first-error' user option has been extended.
-It can now have the additional values 'if-location-known' (which will
-only jump if the location of the first error is known), and
-'first-known' (which will jump to the first known error location).
-
-+++
-*** New user option 'compilation-max-output-line-length'.
-Lines longer than this will have the ends hidden, with a button to
-reveal the hidden text.  This speeds up operations like grepping on
-files that have few newlines.
-
-** Flymake
-
-+++
-*** New user option 'flymake-mode-line-lighter'.
-
-+++
-** New minor mode 'word-wrap-whitespace-mode' for extending 'word-wrap'.
-This mode switches 'word-wrap' on, and breaks on all the whitespace
-characters instead of just 'SPC' and 'TAB'.
-
----
-** New mode, 'emacs-news-mode', for editing the NEWS file.
-This mode adds some highlighting, fixes the 'M-q' command, and has
-commands for doing maintenance of the Emacs NEWS files.  In addition,
-this mode turns on 'outline-minor-mode', and thus displays
-customizable icons (see 'icon-preference') in the margins.  To
-disable these icons, set 'outline-minor-mode-use-buttons' to a
-nil value.
-
----
-** Kmacro
-Kmacros are now OClosures and have a new constructor 'kmacro' which
-uses the 'key-parse' syntax.  It replaces the old 'kmacro-lambda-form'
-(which is now declared obsolete).
-
----
-** savehist.el can now truncate variables that are too long.
-An element of 'savehist-additional-variables' can now be of the form
-'(VARIABLE . MAX-ELTS)', which means to truncate the VARIABLE's value to
-at most MAX-ELTS elements (if the value is a list) before saving the
-value.
-
-** Minibuffer and Completions
-
-+++
-*** New commands for navigating completions from the minibuffer.
-When the minibuffer is the current buffer, typing 'M-<up>' or
-'M-<down>' selects a previous/next completion candidate from the
-"*Completions*" buffer and inserts it to the minibuffer.
-When the user option 'minibuffer-completion-auto-choose' is nil,
-'M-<up>' and 'M-<down>' do the same, but without inserting
-a completion candidate to the minibuffer, then 'M-RET' can be used
-to choose the currently active candidate from the "*Completions*"
-buffer and exit the minibuffer.  With a prefix argument, 'C-u M-RET'
-inserts the currently active candidate to the minibuffer, but doesn't
-exit the minibuffer.  These keys are also available for in-buffer
-completion, but they don't insert candidates automatically, you need
-to type 'M-RET' to insert the selected candidate to the buffer.
-
-+++
-*** The "*Completions*" buffer can now be automatically selected.
-To enable this behavior, customize the user option
-'completion-auto-select' to t, then pressing 'TAB' will switch to the
-"*Completions*" buffer when it pops up that buffer.  If the value is
-'second-tab', then the first 'TAB' will display "*Completions*", and
-the second one will switch to the "*Completions*" buffer.
-
----
-*** New user option 'completion-auto-wrap'.
-When non-nil, the commands 'next-completion' and 'previous-completion'
-automatically wrap around on reaching the beginning or the end of
-the "*Completions*" buffer.
-
-+++
-*** New values for the 'completion-auto-help' user option.
-There are two new values to control the way the "*Completions*" buffer
-behaves after pressing a 'TAB' if completion is not unique.  The value
-'always' updates or shows the "*Completions*" buffer after any attempt
-to complete.  The value 'visual' is like 'always', but only updates
-the completions if they are already visible.  The default value 't'
-always hides the completion buffer after some completion is made.
-
-*** New commands to complete the minibuffer history.
-'minibuffer-complete-history' ('C-x <up>') is like 'minibuffer-complete'
-but completes on the history items instead of the default completion
-table.  'minibuffer-complete-defaults' ('C-x <down>') completes
-on the list of default items.
-
-+++
-*** User option 'minibuffer-eldef-shorten-default' is now obsolete.
-Customize the user option 'minibuffer-default-prompt-format' instead.
-
-+++
-*** New user option 'completions-sort'.
-This option controls the sorting of the completion candidates in
-the "*Completions*" buffer.  Available styles are no sorting,
-alphabetical (the default), or a custom sort function.
-
-+++
-*** New user option 'completions-max-height'.
-This option limits the height of the "*Completions*" buffer.
-
-+++
-*** New user option 'completions-header-format'.
-This is a string to control the heading line to show in the
-"*Completions*" buffer before the list of completions.
-If it contains "%s", that is replaced with the number of completions.
-If nil, the heading line is not shown.
-
-+++
-*** New user option 'completions-highlight-face'.
-When this user option names a face, the current
-candidate in the "*Completions*" buffer is highlighted with that face.
-The nil value disables this highlighting.
-
-+++
-*** Choosing a completion with a prefix argument doesn't exit the minibuffer.
-This means that typing 'C-u RET' on a completion candidate in the
-"*Completions*" buffer inserts the completion to the minibuffer,
-but doesn't exit the minibuffer.
-
-+++
-*** You can now define abbrevs for the fundamental minibuffer modes.
-'minibuffer-mode-abbrev-table' and
-'minibuffer-inactive-mode-abbrev-table' are now defined.
-
-** Isearch and Replace
-
-+++
-*** Changes in how Isearch responds to 'mouse-yank-at-point'.
-If a user does 'C-s' and then uses '<mouse-2>' ('mouse-yank-primary')
-outside the echo area, Emacs will, by default, end the Isearch and
-yank the text at mouse cursor.  But if 'mouse-yank-at-point' is
-non-nil, the text will now be added to the Isearch instead.
-
-+++
-*** Changes for values 'no' and 'no-ding' of 'isearch-wrap-pause'.
-Now with these values the search will wrap around not only on repeating
-with 'C-s C-s', but also after typing a character.
-
-+++
-*** New user option 'char-fold-override'.
-Non-nil means that the default definitions of equivalent characters
-are overridden.
-
-*** New command 'describe-char-fold-equivalences'.
-It displays character equivalences used by 'char-fold-to-regexp'.
-
-+++
-*** New command 'isearch-emoji-by-name'.
-It is bound to 'C-x 8 e RET' during an incremental search.  The
-command accepts the Unicode name of an Emoji (for example, "smiling
-face" or "heart with arrow"), like 'C-x 8 e e', with minibuffer
-completion, and adds the Emoji into the search string.
-
-** Glyphless characters
-
-+++
-*** New minor mode 'glyphless-display-mode'.
-This allows an easy way to toggle seeing all glyphless characters in
-the current buffer.
-
----
-*** The extra slot of 'glyphless-char-display' can now have cons values.
-The extra slot of the 'glyphless-char-display' char-table can now have
-values that are cons cells, specifying separate values for text-mode
-and GUI terminals.
-
-+++
-*** "Replacement character" feature for undisplayable characters on TTYs.
-The 'acronym' method of displaying glyphless characters on text-mode
-frames treats single-character acronyms specially: they are displayed
-without the surrounding [..] "box", thus in effect treating such
-"acronyms" as replacement characters.
-
-** Registers
-
-+++
-*** Buffer names can now be stored in registers.
-For instance, to enable jumping to the "*Messages*" buffer with
-'C-x r j m':
-
-    (set-register ?m '(buffer . "*Messages*"))
-
-** Pixel-fill
-
-+++
-*** This is a new package that deals with filling variable-pitch text.
-
-+++
-*** New function 'pixel-fill-region'.
-This fills the region to be no wider than a specified pixel width.
-
-** Info
-
-+++
-*** 'M-x info-apropos' now takes a prefix argument to search for regexps.
-
----
-*** New command 'Info-goto-node-web' and key binding 'G'.
-This will take you to the gnu.org web server's version of the current
-info node.  This command only works for the Emacs and Emacs Lisp manuals.
-
-** Shortdoc
-
----
-*** New command 'shortdoc-copy-function-as-kill' bound to 'w'.
-It copies the name of the function near point into the kill ring.
-
----
-*** 'N' and 'P' are now bound to 'shortdoc-{next,previous}-section'.
-This is in addition to the old keybindings 'C-c C-n' and 'C-c C-p'.
-
-** VC
-
----
-*** New command 'vc-pull-and-push'.
-This commands first does a "pull" command, and if that is successful,
-do a "push" command afterwards.
-
-+++
-*** 'C-x v b' prefix key is used now for branch commands.
-'vc-print-branch-log' is bound to 'C-x v b l', and new commands are
-'vc-create-branch' ('C-x v b c') and 'vc-switch-branch' ('C-x v b s').
-The VC Directory buffer now uses the prefix 'b' for these branch-related
-commands.
-
-+++
-*** New command '%' ('vc-dir-mark-by-regexp').
-This command marks files based on a regexp.  If given a prefix
-argument, unmark instead.
-
-+++
-*** New command 'C-x v !' ('vc-edit-next-command').
-This prefix command requests editing of the next VC shell command
-before execution.  For example, in a Git repository, you can produce a
-log of more than one branch by typing 'C-x v ! C-x v b l' and then
-appending additional branch names to the 'git log' command.
-
----
-*** 'C-x v v' in a diffs buffer allows to commit only some of the changes.
-This command is intended to allow you to commit only some of the
-changes you have in your working tree.  Begin by creating a buffer
-with the changes against the last commit, e.g. with 'C-x v D'
-('vc-root-diff').  Then edit the diffs to remove the hunks you don't
-want to commit.  Finally, type 'C-x v v' in that diff buffer to commit
-only part of your changes, those whose hunks were left in the buffer.
-
----
-*** 'C-x v v' on an unregistered file will now use the most specific backend.
-Previously, if you had an SVN-covered "~/" directory, and a Git-covered
-directory in "~/foo/bar", using 'C-x v v' on a new, unregistered file
-"~/foo/bar/zot" would register it in the SVN repository in "~/" instead of
-in the Git repository in "~/foo/bar".  This makes this command
-consistent with 'vc-responsible-backend'.
-
----
-*** Log Edit now font locks long Git commit summary lines.
-Writing shorter summary lines avoids truncation in contexts in which
-Git commands display summary lines.  See the two new user options
-'vc-git-log-edit-summary-target-len' and 'vc-git-log-edit-summary-max-len'.
-
----
-*** New 'log-edit-headers-separator' face.
-It is used to style the line that separates the 'log-edit' headers
-from the 'log-edit' summary.
-
----
-*** The function 'vc-read-revision' accepts a new MULTIPLE argument.
-If non-nil, multiple revisions can be queried.  This is done using
-'completing-read-multiple'.
-
----
-*** New function 'vc-read-multiple-revisions'.
-This function invokes 'vc-read-revision' with a non-nil value for
-MULTIPLE.
-
-+++
-*** New command 'vc-prepare-patch'.
-Patches for any version control system can be prepared using VC.  The
-command will query what commits to send and will compose messages for
-your mail user agent.  The behavior of 'vc-prepare-patch' can be
-modified by the user options 'vc-prepare-patches-separately' and
-'vc-default-patch-addressee'.
-
-** Message
-
----
-*** New user option 'mml-attach-file-at-the-end'.
-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
-
----
-*** HTML Mode now supports "text/html" and "image/*" yanking.
-
-** Texinfo Mode
-
----
-*** 'texinfo-mode' now has a specialized 'narrow-to-defun' definition.
-It narrows to the current node.
-
-** EUDC
-
-+++
-*** New user option 'eudc-ignore-options-file' that defaults to 'nil'
-The 'eudc-ignore-options-file' user option can be configured to ignore
-the 'eudc-options-file' (typically "~/.emacs.d/eudc-options").  Most
-users should configure this to 't' and put EUDC configuration in the
-main Emacs initialization file (".emacs" or "~/.emacs.d/init.el").
-
-+++
-*** 'eudc-expansion-overwrites-query' to 'eudc-expansion-save-query-as-kill'.
-'eudc-expansion-overwrites-query' is renamed to
-'eudc-expansion-save-query-as-kill' to reflect the actual behavior of
-the user option.
-
-+++
-*** New command 'eudc-expand-try-all'.
-This command can be used in place of 'eudc-expand-inline'.  It takes a
-prefix argument that causes 'eudc-expand-try-all' to return matches
-from all servers instead of just the matches from the first server to
-return any.  This is useful for example, if one wants to search LDAP
-for a name that happens to match a contact in one's BBDB.
-
-+++
-*** New behavior and default for user option 'eudc-inline-expansion-format'.
-EUDC inline expansion result formatting defaulted to
-
-    '("%s %s <%s>" firstname name email)
-
-Since email address specifications need to comply with RFC 5322 in
-order to be useful in messages, there was a risk to produce syntax
-which was standard with RFC 822, but is marked as obsolete syntax by
-its successor RFC 5322.  Also, the first and last name part was never
-enclosed in double quotes, potentially producing invalid address
-specifications, which may be rejected by a receiving MTA.  Thus, this
-variable can now additionally be set to nil (the new default), or a
-function.  In both cases, the formatted result will be in compliance
-with RFC 5322.  When set to nil, a default format very similar to the
-old default will be produced.  When set to a function, that function
-is called, and the returned values are used to populate the phrase and
-comment parts (see RFC 5322 for definitions).  In both cases, the
-phrase part will be automatically quoted if necessary.
-
-+++
-*** New function 'eudc-capf-complete' with 'message-mode' integration.
-EUDC can now contribute email addresses to 'completion-at-point' by
-adding the new function 'eudc-capf-complete' to
-'completion-at-point-functions' in 'message-mode'.
-
-+++
-*** Additional attributes of query and results in eudcb-macos-contacts.el.
-The EUDC back-end for the macOS Contacts app now provides a wider set
-of attributes to use for queries, and delivers more attributes in
-query results.
-
-+++
-*** New back-end for ecomplete
-A new back-end for ecomplete allows information from that database to
-be queried by EUDC, too.  The attributes present in the EUDC query are
-used to select the entry type in the ecomplete database.
-
-+++
-*** New back-end for mailabbrev
-A new back-end for mailabbrev allows information from that database to
-be queried by EUDC, too.  The attributes email, name, and firstname
-are supported only.
-
-** EWW/SHR
-
-+++
-*** New user option to automatically rename EWW buffers.
-The 'eww-auto-rename-buffer' user option can be configured to rename
-rendered web pages by using their title, URL, or a user-defined
-function which returns a string.  For the first two cases, the length
-of the resulting name is controlled by 'eww-buffer-name-length'.  By
-default, no automatic renaming is performed.
-
-+++
-*** 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),
-display <video> elements with an xwidget.  Note that this is
-experimental; it is known to crash Emacs on some systems, and just
-doesn't work on other systems.  Also see etc/PROBLEMS.
-
-+++
-*** New user option 'eww-url-transformers'.
-These are used to alter an URL before using it.  By default it removes
-the common "utm_" trackers from URLs.
-
-** Find-Dired
-
----
-*** New command 'find-dired-with-command'.
-This enables users to run 'find-dired' with an arbitrary command,
-enabling running commands previously unsupported and also enabling new
-commands to be built on top.
-
-** Gnus
-
-+++
-*** Tool bar changes in Gnus/Message.
-There were previously two styles of tool bars available in Gnus and
-Message, referred to as 'gnus-summary-tool-bar-retro',
-'gnus-group-tool-bar-retro' and 'message-tool-bar-retro', and
-'gnus-summary-tool-bar-gnome', 'gnus-group-tool-bar-gnome' and
-'message-tool-bar-gnome'.  The "retro" tool bars have been removed (as
-well as the icons used), and the "Gnome" tool bars are now the only
-pre-defined toolbars.
-
----
-*** 'gnus-summary-up-thread' and 'gnus-summary-down-thread' bindings removed.
-The 'gnus-summary-down-thread' binding to "M-C-d" was shadowed by
-'gnus-summary-read-document', and these commands are also available on
-"T-u" and "T-d" respectively.
-
----
-*** Gnus now uses a variable-pitch font in the headers by default.
-To get the monospace font back, you can put something like the
-following in your ".gnus" file:
-
-    (set-face-attribute 'gnus-header nil :inherit 'unspecified)
-
----
-*** The default value of 'gnus-treat-fold-headers' is now 'head'.
-
----
-*** New face 'gnus-header'.
-All other 'gnus-header-*' faces inherit from this face now.
-
-+++
-*** New user option 'gnus-treat-emojize-symbols'.
-If non-nil, symbols that have an emoji representation will be
-displayed as emojis.  The default is nil.
-
-+++
-*** New command 'gnus-article-emojize-symbols'.
-This is bound to 'W D e' and will display symbols that have emoji
-representation as emojis.
-
-+++
-*** New mu backend for gnus-search.
-Configuration is very similar to the notmuch and namazu backends.  It
-supports the unified search syntax.
-
----
-*** 'gnus-html-image-cache-ttl' is now a seconds count.
-Formerly it was a pair of numbers '(A B)' that represented 65536*A + B,
-to cater to older Emacs implementations that lacked bignums.
-The older form still works but is undocumented.
-
-** Rmail
-
----
-*** Rmail partial summaries can now be applied one on top of the other.
-You can now narrow the set of messages selected by Rmail summary's
-criteria (recipients, topic, senders, etc.) by making a summary of the
-already summarized messages.  For example, invoking
-'rmail-summary-by-senders', followed by 'rmail-summary-by-topic' will
-produce a summary where both the senders and the topic are according
-to your selection.  The new user option
-'rmail-summary-progressively-narrow' controls whether the stacking of
-the filters is in effect; customize it to a non-nil value to enable
-this feature.
-
----
-*** New Rmail summary: by thread.
-The new command 'rmail-summary-by-thread' produces a summary of
-messages that belong to a single thread of discussion.
-
-** EIEIO
-
-+++
-*** 'slot-value' can now be used to access slots of 'cl-defstruct' objects.
-
-** Align
-
----
-*** Alignment in 'text-mode' has changed.
-Previously, 'M-x align' didn't do anything, and you had to say 'C-u
-M-x align' for it to work.  This has now been changed.  The default
-regexp for 'C-u M-x align-regexp' has also been changed to be easier
-for inexperienced users to use.
-
-** Help
-
----
-*** New mode, 'emacs-news-view-mode', for viewing the NEWS file.
-This mode is used by the 'C-h N' command, and adds buttons to manual
-entries and symbol references.
-
----
-*** New user option 'help-link-key-to-documentation'.
-When this option is non-nil (which is the default), key bindings
-displayed in the "*Help*" buffer will be linked to the documentation
-for the command they are bound to.  This does not affect listings of
-key bindings and functions (such as 'C-h b').
-
-** Info-look
-
----
-*** info-look specs can now be expanded at run time instead of a load time.
-The new ':doc-spec-function' element can be used to compute the
-':doc-spec' element when the user asks for info on that particular
-mode (instead of at load time).
-
-** Ansi-color
-
----
-*** Support for ANSI 256-color and 24-bit colors.
-256-color and 24-bit color codes are now handled by ANSI color
-filters and displayed with the specified color.
-
-** Term-mode
-
----
-*** New user option 'term-bind-function-keys'.
-If non-nil, 'term-mode' will pass the function keys on to the
-underlying shell instead of using the normal Emacs bindings.
-
----
-*** Support for ANSI 256-color and 24-bit colors, italic and other fonts.
-'term-mode' can now display 256-color and 24-bit color codes.  It can
-also handle ANSI codes for faint, italic and blinking text, displaying
-it with new 'term-{faint,italic,slow-blink,fast-blink}' faces.
-
-** Xref
-
-+++
-*** 'project-find-file' and 'project-or-external-find-file' now accept
-a prefix argument which is interpreted to mean "include all files".
-
-+++
-*** New command 'project-list-buffers' bound to 'C-x p C-b'.
-This command displays a list of buffers from the current project.
-
-+++
-*** 'project-kill-buffers' can display the list of buffers to kill.
-Customize the user option 'project-kill-buffers-display-buffer-list'
-to enable the display of the buffer list.
-
-+++
-*** New command 'xref-go-forward'.
-It is bound to 'C-M-,' and jumps to the location where 'xref-go-back'
-('M-,', also known as 'xref-pop-marker-stack') was invoked previously.
-
-+++
-*** 'xref-query-replace-in-results' prompting change.
-This command no longer prompts for FROM when called without prefix
-argument.  This makes the most common case faster: replacing entire
-matches.
-
-+++
-*** New command 'xref-find-references-and-replace' to rename one identifier.
-
----
-*** New variable 'xref-current-item' (renamed from a private version).
-
----
-*** New function 'xref-show-xrefs'.
-
-** File notifications
-
-+++
-*** The new command 'file-notify-rm-all-watches' removes all file 
notifications.
-
-** Sql
-
----
-*** Sql now supports sending of passwords in-process.
-To improve security, if an sql product has ':password-in-comint' set
-to t, a password supplied via the minibuffer will be sent in-process,
-as opposed to via the command-line.
-
-** Image Mode
-
-+++
-*** New command 'image-transform-fit-to-window'.
-This command fits the image to the current window by scaling down or
-up as necessary.  Unlike 'image-transform-fit-both', this does not
-only scale the image down, but up as well.  It is bound to 's w' in
-Image Mode by default.
-
----
-*** New command 'image-mode-wallpaper-set'.
-This command sets the desktop background to the current image.  It is
-bound to 'W' by default.
-
-+++
-*** 'image-transform-fit-to-{height,width}' are now obsolete.
-Use the new command 'image-transform-fit-to-window' instead.
-The keybinding for 'image-transform-fit-to-width' is now 's i'.
-
----
-*** User option 'image-auto-resize' can now be set to 'fit-window'.
-This works like 'image-transform-fit-to-window'.
-
----
-*** New user option 'image-auto-resize-max-scale-percent'.
-The new 'fit-window' option will never scale an image more than this
-much (in percent).  It is nil by default, which means no limit.
-
----
-*** New user option 'image-text-based-formats'.
-This controls whether or not to show a message when opening certain
-image formats saying how to edit it as text.  The default is to show
-this message for SVG and XPM.
-
-+++
-*** New commands: 'image-flip-horizontally' and 'image-flip-vertically'.
-These commands horizontally and vertically flip the image under point,
-and are bound to 'i h' and 'i v', respectively.
-
-+++
-*** New command 'image-transform-set-percent'.
-It allows setting the image size to a percentage of its original size,
-and is bound to 's p' in Image mode.
-
-+++
-*** 'image-transform-original' renamed to 'image-transform-reset-to-original'.
-The old name was confusing, and is now an obsolete function alias.
-
-+++
-*** 'image-transform-reset' renamed to 'image-transform-reset-to-initial'.
-The old name was confusing, and is now an obsolete function alias.
-
-** Images
-
-+++
-*** Users can now add special image conversion functions.
-This is done via 'image-converter-add-handler'.
-
-** Image-Dired
-
-+++
-*** 'image-dired-image-mode' is now based on 'image-mode'.
-This avoids converting images in the background, and makes Image-Dired
-noticeably faster.  New keybindings from 'image-mode' are now
-available in the "*image-dired-display-image*" buffer; press '?' or
-'h' in that buffer to see the full list.
-
----
-*** Navigation and marking commands now work in image display buffer.
-The following new bindings have been added:
-- 'n', 'SPC' => 'image-dired-display-next'
-- 'p', 'DEL' => 'image-dired-display-previous'
-- 'm'        => 'image-dired-mark-thumb-original-file'
-- 'd'        => 'image-dired-flag-thumb-original-file'
-- 'u'        => 'image-dired-unmark-thumb-original-file'
-
----
-*** New command 'image-dired-unmark-all-marks'.
-It removes all marks from all files in the thumbnail and the
-associated Dired buffer, and is bound to 'U' in the thumbnail and
-display buffer.
-
----
-*** New command 'image-dired-do-flagged-delete'.
-It deletes all flagged files, and is bound to 'x' in the thumbnail
-buffer.  It replaces the command 'image-dired-delete-marked', which is
-now an obsolete alias.
-
----
-*** New command 'image-dired-copy-filename-as-kill'.
-It copies the name of the marked or current image to the kill ring,
-and is bound to 'w' in the thumbnail buffer.
-
----
-*** New command 'image-dired-wallpaper-set'.
-This command sets the desktop background to the image at point in the
-thumbnail buffer.  It is bound to 'W' by default.
-
----
-*** 'image-dired-slideshow-start' is now bound to 'S'.
-It is bound in both the thumbnail and display buffer, and no longer
-prompts for a timeout; use a numerical prefix (e.g. 'C-u 8 S') to set
-the timeout.
-
----
-*** New user option 'image-dired-marking-shows-next'.
-If this option is non-nil (the default), marking, unmarking or
-flagging an image in either the thumbnail or display buffer shows the
-next image.
-
----
-*** New face 'image-dired-thumb-flagged'.
-If 'image-dired-thumb-mark' is non-nil (the default), this face is
-used for images that are flagged for deletion in the Dired buffer
-associated with Image-Dired.
-
----
-*** Image information is now shown in the header line of the thumbnail buffer.
-This replaces the message that most navigation commands in the
-thumbnail buffer used to show at the bottom of the screen.
-
----
-*** New specifiers for 'image-dired-display-properties-format'.
-This is used to format the new header line.  The new specifiers are:
-"%d" for the name of the directory that the file is in, "%n" for
-file's number in the thumbnail buffer, and "%s" for the file size.
-
-The default format has been updated to use this.  If you prefer the
-old format, add this to your Init file:
-
-    (setopt image-dired-display-properties-format "%b: %f (%t): %c")
-
----
-*** New faces for the header line of the thumbnail buffer.
-These faces correspond to different parts of the header line, as
-specified in 'image-dired-display-properties-format':
-- 'image-dired-thumb-header-directory-name'
-- 'image-dired-thumb-header-file-name'
-- 'image-dired-thumb-header-file-size'
-- 'image-dired-thumb-header-image-count'
-
----
-*** PDF support.
-Image-Dired now displays thumbnails for PDF files.  Type 'RET' on a
-PDF file in the thumbnail buffer to visit the corresponding PDF.
-
----
-*** Support GraphicsMagick command line tools.
-Support for the GraphicsMagick command line tool ("gm") has been
-added, and is used instead of ImageMagick when it is available.
-
----
-*** Support Thumbnail Managing Standard v0.9.0 (Dec 2020).
-This standard allows sharing generated thumbnails across different
-programs.  Version 0.9.0 adds two larger thumbnail sizes: 512x512 and
-1024x1024 pixels.  See the user option 'image-dired-thumbnail-storage'
-to use it; it is not enabled by default.
-
----
-*** Reduce dependency on external "exiftool" command.
-The 'image-dired-copy-with-exif-file-name' no longer requires an
-external "exiftool" command to be available.  The user options
-'image-dired-cmd-read-exif-data-program' and
-'image-dired-cmd-read-exif-data-options' are now obsolete.
-
----
-*** Support for bookmark.el.
-The command 'bookmark-set' (bound to 'C-x r m') is now supported in
-the thumbnail view, and will create a bookmark that opens the current
-directory in Image-Dired.
-
----
-*** The 'image-dired-slideshow-start' command no longer prompts.
-It no longer inconveniently prompts for a number of images and a
-delay: it runs indefinitely, but stops automatically on any command.
-You can set the delay with a prefix argument, or a negative prefix
-argument to prompt for a delay.  Customize the user option
-'image-dired-slideshow-delay' to change the default from 5 seconds.
-
-+++
-*** 'image-dired-show-all-from-dir-max-files' increased to 1000.
-This user option controls asking for confirmation when starting
-Image-Dired in a directory with many files.  Since Image-Dired creates
-thumbnails in the background in recent versions, this is not as
-important as it used to be.  You can now also customize this option to
-nil to disable this confirmation completely.
-
----
-*** 'image-dired-thumb-size' increased to 128.
-
-+++
-*** 'image-dired-db-file' renamed to 'image-dired-tags-db-file'.
-
----
-*** 'image-dired-display-image-mode' renamed to 'image-dired-image-mode'.
-The corresponding keymap is now named 'image-dired-image-mode-map'.
-
-+++
-*** Some commands have been renamed to be shorter.
-- 'image-dired-display-thumbnail-original-image' has been renamed to
-  'image-dired-display-this'.
-- 'image-dired-display-next-thumbnail-original' has been renamed to
-  'image-dired-display-next'.
-- 'image-dired-display-previous-thumbnail-original' has been renamed
-  to 'image-dired-display-previous'.
-The old names are now obsolete aliases.
-
----
-*** 'image-dired-thumb-{height,width}' are now obsolete.
-Customize 'image-dired-thumb-size' instead, which will set both the
-height and width.
-
----
-*** HTML image gallery generation is now obsolete.
-The 'image-dired-gallery-generate' command and these user options are
-now obsolete: 'image-dired-gallery-thumb-image-root-url',
-'image-dired-gallery-hidden-tags', 'image-dired-gallery-dir',
-'image-dired-gallery-image-root-url'.
-
----
-*** 'image-dired-rotate-thumbnail-{left,right}' are now obsolete.
-Instead, use commands 'image-dired-refresh-thumb' to generate a new
-thumbnail, or 'image-rotate' to rotate the thumbnail without updating
-the thumbnail file.
-
-+++
-*** Some commands and user options are now obsolete.
-Since 'image-dired-display-image-mode' is now based on 'image-mode',
-some commands and user options are no longer needed and are now obsolete:
-'image-dired-cmd-create-temp-image-options',
-'image-dired-cmd-create-temp-image-program',
-'image-dired-display-current-image-full',
-'image-dired-display-current-image-sized',
-'image-dired-display-window-height-correction',
-'image-dired-display-window-width-correction',
-'image-dired-temp-image-file'.
-
-** Dired
-
----
-*** New user option 'dired-omit-lines'.
-This is used by 'dired-omit-mode', and now allows you to hide based on
-other things than just the file names.
-
-+++
-*** New user option 'dired-mouse-drag-files'.
-If non-nil, dragging file names with the mouse in a Dired buffer will
-initiate a drag-and-drop session allowing them to be opened in other
-programs.
-
-+++
-*** New user option 'dired-free-space'.
-Dired will now, by default, include the free space in the first line
-instead of having it on a separate line.  To get the previous behavior
-back, say:
-
-    (setq dired-free-space 'separate)
-
----
-*** New user option 'dired-make-directory-clickable'.
-If non-nil (which is the default), hitting 'RET' or 'mouse-1' on
-the directory components at the directory displayed at the start of
-the buffer will take you to that directory.
-
----
-*** Search and replace in Dired/Wdired supports more regexps.
-For example, the regexp ".*" will match only characters that are part
-of the file name.  Also "^.*$" can be used to match at the beginning
-of the file name and at the end of the file name.  This is used only
-when searching on file names.  In Wdired this can be used when the new
-user option 'wdired-search-replace-filenames' is non-nil (which is the
-default).
-
-** Bookmarks
-
----
-*** 'list-bookmarks' now includes a type column.
-Types are registered via a 'bookmark-handler-type' symbol property on
-the jumping function.
-
-+++
-*** 'bookmark-sort-flag' can now be set to 'last-modified'.
-This will display bookmark list from most recently set to least
-recently set.
-
----
-*** When editing a bookmark annotation, 'C-c C-k' will now cancel.
-It is bound to the new command 'bookmark-edit-annotation-cancel'.
-
----
-*** New user option 'bookmark-fringe-mark'.
-This option controls the bitmap used to indicate bookmarks in the
-fringe (or nil to disable showing this marker).
-
-** Exif
-
----
-*** New function 'exif-field'.
-This is a convenience function to extract the field data from
-'exif-parse-file' and 'exif-parse-buffer'.
-
-** Xwidgets
-
----
-*** New user option 'xwidget-webkit-buffer-name-format'.
-This option controls how xwidget-webkit buffers are named.
-
----
-*** New user option 'xwidget-webkit-cookie-file'.
-This option controls whether the xwidget-webkit buffers save cookies
-set by web pages, and if so, in which file to save them.
-
-+++
-*** New minor mode 'xwidget-webkit-edit-mode'.
-When this mode is enabled, self-inserting characters and other common
-web browser shortcut keys are redefined to send themselves to the
-WebKit widget.
-
-+++
-*** New minor mode 'xwidget-webkit-isearch-mode'.
-This mode acts similarly to incremental search, and allows searching
-the contents of a WebKit widget.  In xwidget-webkit mode, it is bound
-to 'C-s' and 'C-r'.
-
-+++
-*** New command 'xwidget-webkit-browse-history'.
-This command displays a buffer containing the page load history of
-the current WebKit widget, and allows you to navigate it.
-
----
-*** On X, the WebKit inspector is now available inside xwidgets.
-To access the inspector, right click on the widget and select "Inspect
-Element".
-
----
-*** "Open in New Window" in a WebKit widget's context menu now works.
-The newly created buffer will be displayed via 'display-buffer', which
-can be customized through the usual mechanism of 'display-buffer-alist'
-and friends.
-
-** Tramp
-
-+++
-*** New connection methods "docker", "podman" and "kubernetes".
-They allow accessing environments provided by Docker and similar
-programs.
-
----
-*** Tramp supports abbreviating remote home directories now.
-When calling 'abbreviate-file-name' on a Tramp file name, the result
-will abbreviate the user's home directory, for example by abbreviating
-"/ssh:user@host:/home/user" to "/ssh:user@host:~".
-
-+++
-*** New user option 'tramp-use-scp-direct-remote-copying'.
-When set to non-nil, Tramp does not copy files between two remote
-hosts via a local copy in its temporary directory, but lets the 'scp'
-command do this job.
-
-+++
-*** Proper password prompts for methods "doas", "sudo" and "sudoedit".
-The password prompts for these methods reflect now the credentials of
-the user requesting such a connection, and not of the user who is the
-target.  This has always been needed, just the password prompt and the
-related 'auth-sources' entry were wrong.
-
-+++
-*** New user option 'tramp-completion-use-cache'.
-During user and host name completion in the minibuffer, results from
-Tramp's connection cache are taken into account.  This can be disabled
-by setting the user option 'tramp-completion-use-cache' to nil.
-
-** Browse URL
-
----
-*** New user option 'browse-url-default-scheme'.
-This user option decides which URL scheme that 'browse-url' and
-related functions will use by default.  For example, you could
-customize this to "https" to always prefer HTTPS URLs.
-
----
-*** New user option 'browse-url-irc-function'.
-This option specifies a function for opening irc:// links.  It
-defaults to the new function 'browse-url-irc'.
-
----
-*** New function 'browse-url-irc'.
-This multipurpose autoloaded function can be used for opening irc://
-and ircs:// URLS by any caller that passes a URL string as an initial
-arg.
-
----
-*** Support for the Netscape web browser has been removed.
-This support has been obsolete since Emacs 25.1.  The final version of
-the Netscape web browser was released in February, 2008.
-
----
-*** Support for the Galeon web browser has been removed.
-This support has been obsolete since Emacs 25.1.  The final version of
-the Galeon web browser was released in September, 2008.
-
----
-*** Support for the Mozilla web browser is now obsolete.
-Note that this historical web browser is different from Mozilla
-Firefox; it is its predecessor.
-
-** Python Mode
-
-+++
-*** Project shells and a new user option 'python-shell-dedicated'.
-When called with a prefix argument, 'run-python' now offers the choice
-of creating a shell dedicated to the current project.  This shell runs
-in the project root directory and is shared among all project buffers.
-
-Without a prefix argument, the kind of shell (buffer-dedicated,
-project-dedicated or global) is specified by the new
-'python-shell-dedicated' user option.
-
-** Ruby Mode
-
----
-*** New user option 'ruby-toggle-block-space-before-parameters'.
-
-** Eshell
-
-+++
-*** New feature to easily bypass Eshell's own pipelining.
-Prefixing '|', '<' or '>' with an asterisk, i.e. '*|', '*<' or '*>',
-will cause the whole command to be passed to the operating system
-shell.  This is particularly useful to bypass Eshell's own pipelining
-support for pipelines which will move a lot of data.  See section
-"Running Shell Pipelines Natively" in the Eshell manual, node
-"(eshell) Input/Output".
-
-+++
-*** New module to help supplying absolute file names to remote commands.
-After enabling the new 'eshell-elecslash' module, typing a forward
-slash as the first character of a command line argument will
-automatically insert the Tramp prefix.  The automatic insertion
-applies only when 'default-directory' is remote and the command is a
-Lisp function.  This frees you from having to keep track of whether
-commands are Lisp function or external when supplying absolute file
-name arguments.  See the "(eshell) Electric forward slash" node in the
-Eshell manual for details.
-
-+++
-*** Improved support for redirection operators in Eshell.
-Eshell now supports a wider variety of redirection operators.  For
-example, you can now redirect both stdout and stderr via '&>' or
-duplicate one output handle to another via 'NEW-FD>&OLD-FD'.  For more
-information, see the "(eshell) Redirection" node in the Eshell manual.
-
-+++
-*** Double-quoting an Eshell expansion now treats the result as a single 
string.
-If an Eshell expansion like '$FOO' is surrounded by double quotes, the
-result will always be a single string, no matter the type that would
-otherwise be returned.
-
-+++
-*** Concatenating Eshell expansions now works more similarly to other shells.
-When concatenating an Eshell expansion that returns a list, "adjacent"
-elements of each operand are now concatenated together,
-e.g. '$(list "a" "b")c' returns '("a" "bc")'.  See the "(eshell)
-Expansion" node in the Eshell manual for more details.
-
-+++
-*** Eshell subcommands with multiline numeric output return lists of numbers.
-If every line of the output of an Eshell subcommand like '${COMMAND}'
-is numeric, the result will be a list of numbers (or a single number
-if only one line of output).  Previously, this only converted numbers
-when there was a single line of output.
-
----
-*** Built-in Eshell commands now follow POSIX/GNU argument syntax conventions.
-Built-in commands in Eshell now accept command-line options with
-values passed as a single token, such as '-oVALUE' or
-'--option=VALUE'.  New commands can take advantage of this with the
-'eshell-eval-using-options' macro.  See "Defining new built-in
-commands" in the "(eshell) Built-ins" node of the Eshell manual.
-
----
-*** Eshell globs ending with '/' now match only directories.
-Additionally, globs ending with '**/' or '***/' no longer raise an
-error, and now expand to all directories recursively (following
-symlinks in the latter case).
-
-+++
-*** Lisp forms in Eshell now treat a 'nil' result as a failed exit status.
-When executing a command that looks like '(lisp form)', Eshell will
-set the exit status (available in the '$?' variable) to 2.  This
-allows commands like that to be used as conditionals.  To change this
-behavior, customize the new 'eshell-lisp-form-nil-is-failure' option.
-
-** Shell
-
----
-*** New user option 'shell-kill-buffer-on-exit'.
-Enabling this will automatically kill a "*shell*" buffer as soon as
-the shell session terminates.
-
----
-*** New minor mode 'shell-highlight-undef-mode'.
-Customize 'shell-highlight-undef-enable' to t if you want to enable
-this minor mode in "*shell*" buffers.  It will highlight undefined
-commands with a warning face as you type.
-
-** Calc
-
-+++
-*** New user option 'calc-kill-line-numbering'.
-Set it to nil to exclude line numbering from kills and copies.
-
-** Hierarchy
-
-+++
-*** Tree Display can delay computation of children.
-'hierarchy-add-tree' and 'hierarchy-add-trees' have an optional
-argument which allows tree-widget display to be activated and computed
-only when the user expands the node.
-
-** Miscellaneous
-
----
-*** New user option 'webjump-use-internal-browser'.
-When non-nil, WebJump will use an internal browser to open web pages,
-instead of the default external browser.
-
-+++
-*** New user option 'font-lock-ignore'.
-This option provides a mechanism to selectively disable font-lock
-keyword-driven fontifications.
-
----
-*** New user option 'auto-save-visited-predicate'.
-This user option is a predicate function which is called by
-'auto-save-visited-mode' to decide whether or not to save a buffer.
-You can use it to automatically save only specific buffers, for
-example buffers using a particular mode or in some directory.
-
----
-*** New user option 'remote-file-name-inhibit-auto-save-visited'.
-If this user option is non-nil, 'auto-save-visited-mode' will not
-auto-save remote buffers.  The default is nil.
-
-+++
-*** New package vtable.el for formatting tabular data.
-This package allows formatting data using variable-pitch fonts.
-The resulting tables can display text in variable pitch fonts, text
-using fonts of different sizes, and images.  See the "(vtable) Top"
-manual for more details.
-
----
-*** New minor mode 'elide-head-mode'.
-Enabling this minor mode turns on hiding header material, like
-'elide-head' does; disabling it shows the header.  The commands
-'elide-head' and 'elide-head-show' are now obsolete.
-
-*** New package ansi-osc.el.
-Support for OSC ("Operating System Command") escape sequences has been
-extracted from comint.el in order to provide interpretation of OSC
-sequences in compilation buffers.
-
-Adding the new function 'ansi-osc-compilation-filter' to
-'compilation-filter-hook' enables interpretation of OSC escape
-sequences in compilation buffers.  By default, all sequences are
-filtered out.
-
-The list of handlers (already covering OSC 7 and 8) has been extended
-with a handler for OSC 2, the command to set a window title.
-
-+++
-*** New user option 'project-vc-include-untracked'.
-If non-nil, files untracked by a VCS are considered to be part of
-the project by a VC project based on that VCS.
-
----
-*** 'recentf-mode' now uses abbreviated file names by default.
-This means that e.g. "/home/foo/bar" is now displayed as "~/bar".
-Customize the user option 'recentf-filename-handlers' to nil to get
-back the old behavior.
-
----
-*** New command 'recentf-open'.
-This command prompts for a recently opened file in the minibuffer, and
-visits it.
-
----
-*** 'ffap-machine-at-point' no longer pings hosts by default.
-It will now simply look at a hostname to determine if it is valid,
-instead of also trying to ping it.  Customize the user option
-'ffap-machine-p-known' to 'ping' to get the old behavior back.
-
----
-*** The 'run-dig' command is now obsolete; use 'dig' instead.
-
----
-*** Some 'bib-mode' commands and variables have been renamed.
-To respect Emacs naming conventions, the variable 'unread-bib-file'
-has been renamed to 'bib-unread-file'.  The following commands have
-also been renamed:
-    'addbib'           to  'bib-add'
-    'return-key-bib'   to  'bib-return-key'
-    'mark-bib'         to  'bib-mark'
-    'unread-bib'       to  'bib-unread'
-
----
-*** proced.el shows system processes of remote hosts.
-When 'default-directory' is remote, and 'proced' is invoked with a
-negative argument like 'C-u - proced', the system processes of that
-remote host are shown.  Alternatively, the user option
-'proced-show-remote-processes' can be set to non-nil.
-'proced-signal-function' has been marked obsolete.
-
----
-*** 'outlineify-sticky' command is renamed to 'allout-outlinify-sticky'.
-The old name is still available as an obsolete function alias.
-
----
-*** The url-irc library now understands ircs:// links.
-
----
-*** New command 'world-clock-copy-time-as-kill' for 'M-x world-clock'.
-It copies the current line into the kill ring.
-
----
-*** 'edit-abbrevs' now uses font-locking.
-The new face 'abbrev-table-name' is used to display the abbrev table
-name.
-
-
-* New Modes and Packages in Emacs 29.1
-
-+++
-** Eglot: Emacs Client for the Language Server Protocol.
-Emacs now comes with the Eglot package, which enhances various Emacs
-features, such as completion, documentation, error detection, etc.,
-based on data provided by language servers using the Language Server
-Protocol (LSP).
-
-+++
-** New commands 'image-crop' and 'image-cut.
-These commands allow interactively cropping/cutting the image at
-point.  The commands are bound to keys 'i c' and 'i x' (respectively)
-in the local keymap over images.  They rely on external programs, by
-default "convert" from ImageMagick, to do the actual cropping/eliding
-of the image file.
-
----
-** New package 'wallpaper'.
-This package provides the command 'wallpaper-set', which sets the
-desktop background image.  Depending on the system and the desktop,
-this may require an external program (such as "swaybg", "gm",
-"display" or "xloadimage").  If so, a suitable command should be
-detected automatically in most cases.  It can also be customized
-manually if needed, using the new user options 'wallpaper-command' and
-'wallpaper-command-args'.
-
-+++
-** New package 'oclosure'.
-Allows the creation of "functions with slots" or "function objects"
-via the macros 'oclosure-define' and 'oclosure-lambda'.
-
-+++
-*** New generic function 'oclosure-interactive-form'.
-Used by 'interactive-form' when called on an OClosure.
-This allows specific OClosure types to compute their interactive specs
-on demand rather than precompute them when created.
-
----
-** New theme 'leuven-dark'.
-This is a dark version of the 'leuven' theme.
-
-+++
-** New mode 'erts-mode'.
-This mode is used to edit files geared towards testing actions in
-Emacs buffers, like indentation and the like.  The new ert function
-'ert-test-erts-file' is used to parse these files.
-
----
-** New mode 'js-json-mode'.
-This is a lightweight variant of 'js-mode' that is used by default
-when visiting JSON files.
-
-
-** New mode 'ts-mode'.
-A major mode based on the tree-sitter library for editing programs
-in the TypeScript language.  It includes support for font-locking,
-indentation, and navigation.
-
-** New mode 'c-ts-mode'.
-A major mode based on the tree-sitter library for editing programs
-in the C language.  It includes support for font-locking,
-indentation, Imenu, which-func, and navigation.
-
-** New mode 'c++-ts-mode'.
-A major mode based on the tree-sitter library for editing programs
-in the C++ language.  It includes support for font-locking,
-indentation, Imenu, which-func, and navigation.
-
-** New mode 'java-ts-mode'.
-A major mode based on the tree-sitter library for editing programs
-in the Java language.  It includes support for font-locking,
-indentation, Imenu, which-func, and navigation.
-
-** New mode 'css-ts-mode'.
-A major mode based on the tree-sitter library for editing programs
-in the CSS language.  It includes support for font-locking,
-indentation, Imenu, which-func, and navigation.
-
-** New mode 'json-ts-mode'.
-A major mode based on the tree-sitter library for editing programs
-in the JSON language.  It includes support for font-locking,
-indentation, Imenu, which-func, and navigation.
-
-
-* Incompatible Lisp Changes in Emacs 29.1
-
-+++
-** 'format-prompt' now uses 'substitute-command-keys'.
-This means that both the prompt and 'minibuffer-default-prompt-format'
-will have key definitions and single quotes handled specially.
-
----
-** 'find-image' now uses 'create-image'.
-This means that images found through 'find-image' also have
-auto-scaling applied.  (This only makes a difference on HiDPI
-displays.)
-
-+++
-** Changes to "raw" in-memory xbm images are specified.
-Some years back Emacs gained the ability to scale images, and you
-could then specify ':width' and ':height' when using 'create-image' on all
-image types -- except xbm images, because this format already used the
-':width' and ':height' arguments to specify the width/height of the "raw"
-in-memory format.  This meant that if you used these specifications
-on, for instance, xbm files, Emacs would refuse to display them.  This
-has been changed, and ':width'/':height' now works as with all other image
-formats, and the way to specify the width/height of the "raw"
-in-memory format is now by using ':data-width' and ':data-height'.
-
-+++
-** "loaddefs.el" generation has been reimplemented.
-The various "loaddefs.el" files in the Emacs tree (which contain
-information about autoloads, built-in packages and package prefixes)
-used to be generated by functions in autoloads.el.  These are now
-generated by loaddefs-gen.el instead.  This leads to functionally
-equivalent "loaddef.el" files, but they do not use exactly the same
-syntax, so using 'M-x update-file-autoloads' no longer works.  (This
-didn't work well in most files in the past, either, but it will now
-signal an error in any file.)
-
-In addition, files are scanned in a slightly different way.
-Previously, ';;;###' specs inside a top-level form (i.e., something
-like '(when ... ;;;### ...)' would be ignored.  They are now parsed as
-normal.
-
----
-** Themes have special autoload cookies.
-All built-in themes are scraped for ';;;###theme-autoload' cookies
-that are loaded along with the regular auto-loaded code.
-
-+++
-** 'buffer-modified-p' has been extended.
-This function was previously documented to return only nil or t.  This
-has been changed to nil/'autosaved'/non-nil.  The new 'autosaved'
-value means that the buffer is modified, but that it hasn't been
-modified since the time of last auto-save.
-
----
-** 'with-silent-modifications' also restores buffer autosave status.
-'with-silent-modifications' is a macro meant to be used by the font
-locking machinery to allow applying text properties without changing
-the modification status of the buffer.  However, it didn't restore the
-buffer autosave status, so applying font locking to a modified buffer
-that had already been auto-saved would trigger another auto-saving.
-This is no longer the case.
-
----
-** 'prin1' doesn't always escape "." and "?" in symbols any more.
-Previously, symbols like 'foo.bar' would be printed by 'prin1' as
-"foo\.bar".  This now prints as "foo.bar" instead.  The Emacs Lisp
-reader interprets these strings as referring to the same symbol, so
-this is virtually always backwards-compatible, but there may
-theoretically be code out there that expects a specific printed
-representation.
-
-The same is the case with the "?" character: The 'foo?' symbol is now
-printed as "foo?" instead of "foo\?".
-
-If the "." and "?" characters are the first character in the symbol,
-they will still be escaped, so the '.foo' symbol is still printed as
-"\.foo" and the '?bar' symbol is still printed as "\?bar".
-
-+++
-** Remapping 'mode-line' no longer works as expected.
-'mode-line' is now the parent face of the new 'mode-line-active' face,
-and remapping parent of basic faces does not work reliably.
-Instead of remapping 'mode-line', you have to remap 'mode-line-active'.
-
-+++
-** 'make-process' has been extended to support ptys when ':stderr' is set.
-Previously, setting ':stderr' to a non-nil value would force the
-process's connection to use pipes.  Now, Emacs will use a pty for
-stdin and stdout if requested no matter the value of ':stderr'.
-
----
-** User option 'mail-source-ignore-errors' is now obsolete.
-The whole mechanism for prompting users to continue in case of
-mail-source errors has been removed, so this option is no longer
-needed.
-
-** Fonts
-
----
-*** Emacs now supports 'medium' fonts.
-Emacs previously didn't distinguish between the 'regular'/'normal'
-weight and the 'medium' weight, but it now also supports the (heavier)
-'medium' weight.  However, this means that if you previously specified
-a weight of 'normal' and the font doesn't have this weight, Emacs
-won't find the font spec.  In these cases, replacing ":weight 'normal"
-with ":weight 'medium" should fix the issue.
-
----
-** Keymap descriptions have changed.
-'help--describe-command', 'C-h b' and associated functions that output
-keymap descriptions have changed.  In particular, prefix commands are
-not output at all, and instead of "??" for closures/functions,
-"[closure]"/"[lambda]" is output.
-
----
-** 'downcase' details have changed slightly.
-In certain locales, changing the case of an ASCII-range character may
-turn it into a multibyte character, most notably with "I" in Turkish
-(the lowercase is "ı", 0x0131).  Previously, 'downcase' on a unibyte
-string was buggy, and would mistakenly just return the lower byte of
-this, 0x31 (the digit "1").  'downcase' on a unibyte string has now
-been changed to downcase such characters as if they were ASCII.  To
-get proper locale-dependent downcasing, the string has to be converted
-to multibyte first.  (This goes for the other case-changing functions,
-too.)
-
----
-** Functions in 'tramp-foreign-file-name-handler-alist' have changed.
-Functions to determine which Tramp file name handler to use are now
-passed a file name in dissected form (via 'tramp-dissect-file-name')
-instead of in string form.
-
----
-** 'def' indentation changes.
-In 'emacs-lisp-mode', forms with a symbol with a name that start with
-"def" have been automatically indented as if they were 'defun'-like
-forms, for instance:
-
-    (defzot 1
-      2 3)
-
-This heuristic has now been removed, and all functions/macros that
-want to be indented this way have to be marked with
-
-    (declare (indent defun))
-
-or the like.  If the function/macro definition itself can't be
-changed, the indentation can also be adjusted by saying something
-like:
-
-    (put 'defzot 'lisp-indent-function 'defun)
-
----
-** The 'inhibit-changing-match-data' variable is now obsolete.
-Instead, functions like 'string-match' and 'looking-at' now take an
-optional INHIBIT-MODIFY argument.
-
----
-** 'gnus-define-keys' is now obsolete.
-Use 'define-keymap' instead.
-
----
-** MozRepl has been removed from js.el.
-MozRepl was removed from Firefox in 2017, so this code doesn't work
-with recent versions of Firefox.
-
----
-** The function 'image-dired-get-exif-data' is now obsolete.
-Use 'exif-parse-file' and 'exif-field' instead.
-
----
-** 'insert-directory' alternatives should not change the free disk space line.
-This change is now applied in 'dired-insert-directory'.
-
----
-** 'compilation-last-buffer' is (finally) declared obsolete.
-It's been obsolete since Emacs-22.1, actually.
-
----
-** Calling 'lsh' now elicits a byte-compiler warning.
-'lsh' behaves in somewhat surprising and platform-dependent ways for
-negative arguments, and is generally slower than 'ash', which should be
-used instead.  This warning can be suppressed by surrounding calls to
-'lsh' with the construct '(with-suppressed-warnings ((suspicious lsh)) ...)',
-but switching to 'ash' is generally much preferable.
-
----
-** Some functions and variables obsolete since Emacs 24 have been removed:
-'Buffer-menu-buffer+size-width', 'Electric-buffer-menu-mode',
-'Info-edit-map', 'allout-abbreviate-flattened-numbering',
-'allout-exposure-change-hook', 'allout-mode-deactivate-hook',
-'allout-structure-added-hook', 'allout-structure-deleted-hook',
-'allout-structure-shifted-hook', 'ansi-color-unfontify-region',
-'archive-extract-hooks', 'auth-source-forget-user-or-password',
-'auth-source-hide-passwords', 'auth-source-user-or-password',
-'automatic-hscrolling', 'automount-dir-prefix', 'bibtex-complete',
-'bibtex-entry-field-alist', 'buffer-has-markers-at',
-'buffer-substring-filters', 'byte-compile-disable-print-circle',
-'c-prepare-bug-report-hooks', 'cfengine-mode-abbrevs',
-'change-log-acknowledgement', 'chart-map',
-'checkdoc-comment-style-hooks', 'comint--unquote&expand-filename',
-'comint-dynamic-complete', 'comint-dynamic-complete-as-filename',
-'comint-dynamic-simple-complete', 'comint-unquote-filename',
-'command-history-map', 'compilation-parse-errors-function',
-'completion-annotate-function', 'condition-case-no-debug',
-'count-lines-region', 'crisp-mode-modeline-string',
-'custom-print-functions', 'custom-print-functions',
-'cvs-string-prefix-p', 'data-debug-map', 'deferred-action-function',
-'deferred-action-list', 'dired-pop-to-buffer', 'dired-shrink-to-fit',
-'dired-sort-set-modeline', 'dired-x-submit-report',
-'display-buffer-function',
-'ediff-choose-window-setup-function-automatically',
-'eieio-defgeneric', 'eieio-defmethod', 'emacs-lock-from-exiting',
-'erc-complete-word', 'erc-dcc-chat-filter-hook',
-'eshell-add-to-window-buffer-names', 'eshell-cmpl-suffix-list',
-'eshell-for', 'eshell-remove-from-window-buffer-names',
-'eshell-status-in-modeline', 'filesets-cache-fill-content-hooks',
-'font-list-limit', 'font-lock-maximum-size',
-'font-lock-reference-face', 'gnus-carpal',
-'gnus-debug-exclude-variables', 'gnus-debug-files',
-'gnus-local-domain', 'gnus-outgoing-message-group',
-'gnus-registry-user-format-function-M', 'gnus-secondary-servers',
-'gnus-subscribe-newsgroup-hooks', 'gud-inhibit-global-bindings',
-'hangul-input-method-inactivate', 'hfy-post-html-hooks',
-'image-extension-data', 'image-library-alist',
-'inactivate-current-input-method-function', 'inactivate-input-method',
-'inhibit-first-line-modes-regexps',
-'inhibit-first-line-modes-suffixes', 'input-method-inactivate-hook',
-'intdos', 'javascript-generic-mode', 'javascript-generic-mode-hook',
-'latex-string-prefix-p', 'macro-declaration-function' (function),
-'macro-declaration-function' (variable), 'mail-complete-function',
-'mail-completion-at-point-function',
-'mail-mailer-swallows-blank-line', 'mail-sent-via', 'make-register',
-'makefile-complete', 'menu-bar-kill-ring-save',
-'meta-complete-symbol', 'meta-mode-map',
-'mh-kill-folder-suppress-prompt-hooks',
-'minibuffer-completing-symbol',
-'minibuffer-local-filename-must-match-map', 'mode25', 'mode4350',
-'mpc-string-prefix-p', 'msb-after-load-hooks',
-'nndiary-request-accept-article-hooks',
-'nndiary-request-create-group-hooks',
-'nndiary-request-update-info-hooks', 'nnimap-split-rule',
-'nntp-authinfo-file', 'ns-alternatives-map',
-'ns-store-cut-buffer-internal', 'package-menu-view-commentary',
-'pascal-last-completions', 'pascal-show-completions',
-'pascal-toggle-completions', 'pcomplete-arg-quote-list',
-'pcomplete-quote-argument', 'prolog-char-quote-workaround',
-'python-buffer', 'python-guess-indent', 'python-indent',
-'python-info-ppss-comment-or-string-p', 'python-info-ppss-context',
-'python-info-ppss-context-type', 'python-preoutput-result',
-'python-proc', 'python-send-receive', 'python-send-string',
-'python-use-skeletons', 'quail-inactivate', 'quail-inactivate-hook',
-'query-replace-interactive', 'rcirc-activity-hooks',
-'rcirc-print-hooks', 'rcirc-receive-message-hooks',
-'rcirc-sentinel-hooks', 'read-filename-at-point', 'redraw-modeline',
-'reftex-index-map', 'reftex-index-phrases-map',
-'reftex-select-bib-map', 'reftex-select-label-map', 'reftex-toc-map',
-'register-name-alist', 'register-value', 'report-emacs-bug-info',
-'report-emacs-bug-pretest-address',
-'rmail-default-dont-reply-to-names', 'rmail-dont-reply-to',
-'rmail-dont-reply-to-names', 'robin-inactivate',
-'robin-inactivate-hook', 'rst-block-face', 'rst-comment-face',
-'rst-definition-face', 'rst-directive-face', 'rst-emphasis1-face',
-'rst-emphasis2-face', 'rst-external-face', 'rst-literal-face',
-'rst-reference-face', 'semantic-change-hooks',
-'semantic-edits-delete-change-hooks',
-'semantic-edits-new-change-hooks',
-'semantic-edits-reparse-change-hooks', 'semantic-grammar-map',
-'semantic-grammar-syntax-table', 'semantic-lex-reset-hooks',
-'semanticdb-elisp-sym-function-arglist',
-'semanticdb-save-database-hooks', 'set-face-underline-p',
-'set-register-value', 'sh-maybe-here-document', 'speedbar-key-map',
-'speedbar-syntax-table', 'starttls-any-program-available',
-'strokes-modeline-string', 'strokes-report-bug',
-'term-default-bg-color', 'term-default-fg-color',
-'tex-string-prefix-p', 'timeclock-modeline-display',
-'timeclock-modeline-display', 'timeclock-update-modeline',
-'toggle-emacs-lock', 'tooltip-use-echo-area', 'turn-on-cwarn-mode',
-'turn-on-iimage-mode', 'ucs-input-inactivate', 'ucs-insert',
-'url-recreate-url-attributes', 'user-variable-p',
-'vc-string-prefix-p', 'vc-toggle-read-only', 'view-return-to-alist',
-'view-return-to-alist-update', 'w32-default-color-map' (function),
-'which-func-mode' (function), 'window-system-version',
-'winner-mode-leave-hook', 'x-cut-buffer-or-selection-value'.
-
----
-** Some functions and variables obsolete since Emacs 23 have been removed:
-'find-emacs-lisp-shadows', 'newsticker-cache-filename',
-'process-filter-multibyte-p', 'redisplay-end-trigger-functions',
-'set-process-filter-multibyte', 'set-window-redisplay-end-trigger',
-'unify-8859-on-decoding-mode', 'unify-8859-on-encoding-mode',
-'vc-arch-command', 'window-redisplay-end-trigger', 'x-selection'.
-
----
-** Some functions and variables obsolete since Emacs 21 or 22 have been 
removed:
-'c-toggle-auto-state', 'find-file-not-found-hooks',
-'ls-lisp-dired-ignore-case', 'query-replace-regexp-eval'.
-
-+++
-** New generic function 'function-documentation'.
-Can dynamically generate a raw docstring depending on the type of
-a function.
-Used mainly for docstrings of OClosures.
-
-+++
-** 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.
-
-+++
-** The 'clone-indirect-buffer-hook' is now run by 'make-indirect-buffer'.
-It was previously only run by 'clone-indirect-buffer' and
-'clone-indirect-buffer-other-window'.  Since 'make-indirect-buffer' is
-called by both of these, the hook is now run by all 3 of these
-functions.
-
----
-** '?\' at the end of a line now signals an error.
-Previously, it produced a nonsense value, -1, that was never intended.
-
----
-** Some libraries obsolete since Emacs 24.1 and 24.3 have been removed:
-abbrevlist.el, assoc.el, complete.el, cust-print.el,
-erc-hecomplete.el, mailpost.el, mouse-sel.el, old-emacs-lock.el,
-patcomp.el, pc-mode.el, pc-select.el, s-region.el, and sregex.el.
-
-+++
-** Many seldom-used generalized variables have been made obsolete.
-Emacs has a number of rather obscure generalized variables defined,
-that, for instance, allowed you to say things like:
-
-    (setf (point-min) 4)
-
-These never caught on and have been made obsolete.  The form above,
-for instance, is the same as saying
-
-    (narrow-to-region 4 (point-max))
-
-The following generalized variables have been made obsolete:
-'buffer-file-name', 'buffer-local-value', 'buffer-modified-p',
-'buffer-name', 'buffer-string', 'buffer-substring', 'current-buffer',
-'current-column', 'current-global-map', 'current-input-mode',
-'current-local-map', 'current-window-configuration',
-'default-file-modes', 'documentation-property', 'eq', 'frame-height',
-'frame-width', 'frame-visible-p', 'global-key-binding',
-'local-key-binding', 'mark', 'mark-marker', 'marker-position',
-'mouse-position', 'point', 'point-marker', 'point-max', 'point-min',
-'read-mouse-position', 'screen-height', 'screen-width',
-'selected-frame', 'selected-screen', 'selected-window',
-'standard-case-table', 'syntax-table', 'visited-file-modtime',
-'window-height', 'window-width', and 'x-get-secondary-selection'.
-
-
-* Lisp Changes in Emacs 29.1
-
-+++
-** Interpreted closures are "safe for space".
-As was already the case for byte-compiled closures, instead of capturing
-the whole current lexical environment, interpreted closures now only
-capture the part of the environment that they need.
-The previous behavior could occasionally lead to memory leaks or
-to problems where a printed closure would not be 'read'able because
-of an un'read'able value in an unrelated lexical variable.
-
-+++
-** New accessor function 'file-attribute-file-identifier'.
-It returns the list of the inode number and device identifier
-retrieved by 'file-attributes'.  This value can be used to identify a
-file uniquely.  The device identifier can be a single number or (for
-remote files) a cons of 2 numbers.
-
-+++
-** New macro 'while-let'.
-This is like 'when-let', but repeats until a binding form is nil.
-
-+++
-** New function 'make-obsolete-generalized-variable'.
-This can be used to mark setters used by 'setf' as obsolete, and the
-byte-compiler will then warn about using them.
-
-+++
-** New functions 'pos-eol' and 'pos-bol'.
-These are like 'line-end-position' and 'line-beginning-position'
-(respectively), but ignore fields (and are more efficient).
-
-+++
-** New function 'compiled-function-p'.
-This returns non-nil if its argument is either a built-in, or a
-byte-compiled, or a natively-compiled function object, or a function
-loaded from a dynamic module.
-
----
-** 'deactivate-mark' can have new value 'dont-save'.
-This value means that Emacs should deactivate the mark as usual, but
-without setting the primary selection, if 'select-active-regions' is
-enabled.
-
-+++
-** New 'declare' form 'interactive-args'.
-This can be used to specify what forms to put into 'command-history'
-when executing commands interactively.
-
-+++
-** The FORM arg of 'time-convert' is mandatory.
-'time-convert' can still be called without it, as before, but the
-compiler now emits a warning about this deprecated usage.
-
-+++
-** Emacs now supports user-customizable and themable icons.
-These can be used for buttons in buffers and the like.  See the
-"(elisp) Icons" and "(emacs) Icons" nodes in the manuals for details.
-
-+++
-** New arguments MESSAGE and TIMEOUT of 'set-transient-map'.
-MESSAGE specifies a message to display after activating the transient
-map, including a special formatting spec to list available keys.
-TIMEOUT is the idle time after which to deactivate the transient map.
-The default timeout value can be defined by the new variable
-'set-transient-map-timeout'.
-
-** Connection-local variables
-
-+++
-*** Some connection-local variables are now user options.
-The variables 'connection-local-profile-alist' and
-'connection-local-criteria-alist' are now user options, in order to
-make it more convenient to inspect and modify them.
-
-+++
-*** New function 'connection-local-update-profile-variables'.
-This function allows to modify the settings of an existing
-connection-local profile.
-
-+++
-*** New macro 'with-connection-local-application-variables'.
-This macro works like 'with-connection-local-variables', but it allows
-to use another application but 'tramp'.  This is useful when running
-code in a buffer where Tramp has already set some connection-local
-variables.
-
-+++
-*** New macro 'setq-connection-local'.
-This allows dynamically setting variable values for a particular
-connection within the body of 'with-connection-local-{application-}variables'.
-See the "(elisp) Connection Local Variables" node in the Lisp
-Reference manual for more information.
-
-+++
-** 'plist-get', 'plist-put' and 'plist-member' are no longer limited to 'eq'.
-These function now take an optional comparison predicate argument.
-
-+++
-** 'read-multiple-choice' can now use long-form answers.
-
-+++
-** 'M-c' in 'read-regexp' now toggles case folding.
-
-+++
-** 'completing-read' now allows a function as its REQUIRE-MATCH argument.
-This function is called to see whether what the user has typed in is a
-match.  This is also available from functions that call
-'completing-read', like 'read-file-name'.
-
-+++
-** 'posn-col-row' can now give position data based on windows.
-Previously, it reported data only based on the frame.
-
-+++
-** 'file-expand-wildcards' can now also take a regexp as PATTERN argument.
-
----
-** vc-mtn (the backend for Monotone) has been made obsolete.
-
-+++
-** 'gui-set-selection' can now specify different values for different data 
types.
-If DATA is a string, then its text properties are searched for values
-for each specific data type while the selection is being converted.
-
----
-** New eldoc function 'elisp-eldoc-var-docstring-with-value'.
-This function includes the current value of the variable in eldoc display
-and can be used as a more detailed alternative to 'elisp-eldoc-var-docstring'.
-
-+++
-** 'save-some-buffers' can now be extended to save other things.
-Traditionally, 'save-some-buffers' saved buffers, and also saved
-abbrevs.  This has been generalized via the
-'save-some-buffers-functions' variable, and packages can now register
-things to be saved.
-
-+++
-** New function 'string-equal-ignore-case'.
-This compares strings ignoring case differences.
-
-** 'symbol-file' can now report natively-compiled ".eln" files.
-If Emacs was built with native-compilation enabled, Lisp programs can
-now call 'symbol-file' with the new optional 3rd argument non-nil to
-request the name of the ".eln" file which defined a given symbol.
-
-+++
-** New macro 'with-memoization' provides a very primitive form of memoization.
-
-+++
-** 'max-char' can now report the maximum codepoint according to Unicode.
-When called with a new optional argument UNICODE non-nil, 'max-char'
-will now report the maximum valid codepoint defined by the Unicode
-Standard.
-
-** seq
-
-+++
-** New function 'seq-split'.
-This returns a list of sub-sequences of the specified sequence.
-
-+++
-** New function 'seq-remove-at-position'.
-This function returns a copy of the specified sequence where the
-element at a given (zero-based) index got removed.
-
-+++
-** New function 'seq-positions'.
-This returns a list of the (zero-based) indices of elements matching a
-given predicate in the specified sequence.
-
-+++
-** New function 'seq-keep'.
-This is like 'seq-map', but removes all nil results from the returned
-list.
-
-** Themes
-
----
-*** New hooks 'enable-theme-functions' and 'disable-theme-functions'.
-These are run after enabling and disabling a theme, respectively.
-
----
-*** Themes can now be made obsolete.
-Using 'make-obsolete' on a theme is now supported.  This will make
-'load-theme' issue a warning when loading the theme.
-
-+++
-** New hook 'display-monitors-changed-functions'.
-It is called whenever the configuration of different monitors on a
-display changes.
-
-+++
-** 'prin1' and 'prin1-to-string' now take an optional OVERRIDES parameter.
-This parameter can be used to override values of print-related settings.
-
-+++
-** New minor mode 'header-line-indent-mode'.
-This is meant to be used in modes that have a header line that should
-be kept aligned with the buffer contents when the user switches
-'display-line-numbers-mode' on or off.
-
-+++
-** New minor mode 'lost-selection-mode'.
-This minor mode makes Emacs deactivate the mark in all buffers when
-the primary selection is obtained by another program.
-
----
-** On X, Emacs will try to preserve selection ownership when a frame is 
deleted.
-This means that if you make Emacs the owner of a selection, such as by
-selecting some text into the clipboard or primary selection, and then
-delete the current frame, you will still be able to insert the
-contents of that selection into other programs as long as another
-frame is open on the same display.  This behavior can be disabled by
-setting the user option 'x-auto-preserve-selections' to nil.
-
-+++
-** New predicate 'char-uppercase-p'.
-This returns non-nil if its argument its an uppercase character.
-
-** Byte compilation
-
----
-*** Byte compilation will now warn about some quoting mistakes in docstrings.
-When writing code snippets that contains the "'" character (APOSTROPHE),
-that quote character has to be escaped to avoid Emacs displaying it as
-"’" (LEFT SINGLE QUOTATION MARK), which would make code examples like
-
-    (setq foo '(1 2 3))
-
-invalid.  Emacs will now warn during byte compilation if it seems
-something like that, and also warn about when using RIGHT/LEFT SINGLE
-QUOTATION MARK directly.  In both these cases, if these characters
-should really be present in the docstring, they should be quoted with
-"\=".
-
----
-*** Byte compilation will now warn about some malformed 'defcustom' types.
-It's very common to write 'defcustom' types on the form:
-
-    :type '(choice (const :tag "foo" 'bar))
-
-I.e., double-quoting the 'bar', which is almost never the correct
-value.  The byte compiler will now issue a warning if it encounters
-these forms.
-
-+++
-** 'restore-buffer-modified-p' can now alter buffer auto-save state.
-With a FLAG value of 'autosaved', it will mark the buffer as having
-been auto-saved since the time of last modification.
-
----
-** New minor mode 'isearch-fold-quotes-mode'.
-This sets up 'search-default-mode' so that quote characters are
-char-folded into each other.  It is used, by default, in "*Help*" and
-"*info*" buffers.
-
-+++
-** New macro 'buffer-local-set-state'.
-This is a helper macro to be used by minor modes that wish to restore
-buffer-local variables back to their original states when the mode is
-switched off.
-
----
-** New macro 'with-buffer-unmodified-if-unchanged'.
-If the buffer is marked as unmodified, and code does modifications
-that, in total, means that the buffer is identical to the buffer
-before, mark the buffer as unmodified again.
-
----
-** New function 'malloc-trim'.
-This function allows returning unused memory back to the operating
-system, and is mainly meant as a debugging tool.  It is currently
-available only when Emacs was built with glibc as the C library.
-
----
-** 'x-show-tip' no longer hard-codes a timeout default.
-The new 'x-show-tooltip-timeout' variable allows the user to alter
-this for packages that don't use 'tooltip-show', but instead call the
-lower level function directly.
-
----
-** New function 'current-cpu-time'.
-It gives access to the CPU time used by the Emacs process, for
-example for benchmarking purposes.
-
----
-** New function 'string-edit'.
-This is meant to be used when the user has to edit a (potentially)
-long string.  It pops you to a new buffer where you can edit the
-string, and a callback is called when the user types 'C-c C-c'.
-
-+++
-** New function 'read-string-from-buffer'.
-This is a modal version of 'string-edit', and can be used as an
-alternative to 'read-string'.
-
-+++
-** The return value of 'clear-message-function' is not ignored anymore.
-If the function returns 'dont-clear-message', then the message is not
-cleared, with the assumption that the function cleared it itself.
-
-+++
-** The local variable section now supports defining fallback modes.
-This was previously only available when using a property line (i.e.,
-putting the modes on the first line of a file).
-
-+++
-** New function 'flush-standard-output'.
-This enables you to display incomplete lines from batch-based Emacs
-scripts.
-
-+++
-** New convenience function 'buttonize-region'.
-This works like 'buttonize', but for a region instead of a string.
-
-+++
-** 'macroexp-let2*' can omit TEST arg and use single-var bindings.
-
-+++
-** New macro-writing macros, 'cl-with-gensyms' and 'cl-once-only'.
-See the "(cl) Macro-Writing Macros" manual section for descriptions.
-
-+++
-** New variable 'last-event-device' and new function 'device-class'.
-On X Windows, 'last-event-device' specifies the input extension device
-from which the last input event originated, and 'device-class' can be
-used to determine the type of an input device.
-
-+++
-** 'track-mouse' can be a new value 'drag-source'.
-This means the same as 'dropping', but modifies the mouse position
-list in reported motion events if there is no frame underneath the
-mouse pointer.
-
-+++
-** New functions for dragging items from Emacs to other programs.
-The new functions 'x-begin-drag', 'dnd-begin-file-drag',
-'dnd-begin-drag-files', and 'dnd-direct-save' allow dragging contents
-(such as files and text) from Emacs to other programs.
-
----
-** New function 'ietf-drums-parse-date-string'.
-This function parses RFC5322 (and RFC822) date strings, and should be
-used instead of 'parse-time-string' when parsing data that's standards
-compliant.
-
-+++
-** New macro 'setopt'.
-This is like 'setq', but is meant to be used for user options instead
-of plain variables, and
-uses 'custom-set'/'set-default' to set them.
-
-+++
-** New utility predicate 'mode-line-window-selected-p'.
-This is meant to be used from ':eval' mode line constructs to create
-different mode line looks for selected and unselected windows.
-
-+++
-** New variable 'messages-buffer-name'.
-This variable (defaulting to "*Messages*") allows packages to override
-where messages are logged.
-
-+++
-** New function 'readablep'.
-This function says whether an object can be written out and then
-read back by the Emacs Lisp reader.
-
-+++
-** New variable 'print-unreadable-function'.
-This variable allows changing how Emacs prints unreadable objects.
-
----
-** The user option 'polling-period' now accepts floating point values.
-This means Emacs can now poll for input during Lisp execution more
-frequently than once in a second.
-
----
-** New function 'bidi-string-strip-control-characters'.
-This utility function is meant for displaying strings when it's
-essential that there's no bidirectional context.
-
----
-** The Gnus range functions have been moved to a new library, range.el.
-All the old names have been made obsolete.
-
-+++
-** New function 'function-alias-p'.
-This predicate says whether an object is a function alias, and if it
-is, the alias chain is returned.
-
-+++
-** 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 the command '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
-property.
-
-+++
-** New function 'add-display-text-property'.
-This is like 'put-text-property', but works on the 'display' text
-property.
-
-+++
-** New 'min-width' 'display' property.
-This allows setting a minimum display width for a region of text.
-
-+++
-** New 'cursor-face' text property.
-This uses 'cursor-face' instead of the default face when cursor is on or
-near the character and 'cursor-face-highlight-mode' is enabled.  The
-user option 'cursor-face-highlight-nonselected-window' is similar to
-'highlight-nonselected-windows', but for this property.
-
-+++
-** New event type 'touch-end'.
-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 performs 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.
-
-+++
-** New hook 'x-pre-popup-menu-hook'.
-This hook is run before 'x-popup-menu' is about to display a
-deck-of-cards menu on screen.
-
----
-** New hook 'post-select-region-hook'.
-This hook is run immediately after 'select-active-regions' causes the
-region to be set as the primary selection.
-
-+++
-** New function 'buffer-match-p'.
-Check if a buffer satisfies some condition.  Some examples for
-conditions can be regular expressions that match a buffer name, a
-cons-cell like '(major-mode . shell-mode)' that matches any buffer
-where 'major-mode' is 'shell-mode' or a combined with a condition like
-'(and "\\`\\*.+\\*\\'" (major-mode . special-mode))'.
-
-+++
-** New function 'match-buffers'.
-Use 'buffer-match-p' to gather a list of buffers that match a
-condition.
-
----
-** New optional arguments 'text-face' and 'default-face' for 'tooltip-show'.
-They allow changing the faces used for the tooltip text and frame
-colors of the resulting tooltip frame from the default 'tooltip' face.
-
-** Text security and suspiciousness
-
-+++
-*** New library textsec.el.
-This library contains a number of checks for whether a string is
-"suspicious".  This usually means that the string contains characters
-that have glyphs that can be confused with other, more commonly used
-glyphs, or contain bidirectional (or other) formatting characters that
-may be used to confuse a user.
-
-+++
-*** New user option 'textsec-check'.
-If non-nil (which is the default), Emacs packages that are vulnerable
-to attackers trying to confuse the users will use the textsec library
-to mark suspicious text.  For instance shr/eww will mark suspicious
-URLs and links, Gnus will mark suspicious From addresses, and
-Message mode will query the user if the user is sending mail to a
-suspicious address.  If this variable is nil, these checks aren't
-performed.
-
-+++
-*** New function 'textsec-suspicious-p'.
-This is the main function Emacs applications should be using to check
-whether a string is suspicious.  It heeds the 'textsec-check' user
-option.
-
-** Keymaps and key definitions
-
-+++
-*** 'where-is-internal' can now filter events marked as non key events.
-If a command maps to a key binding like '[some-event]', and 'some-event'
-has a symbol plist containing a non-nil 'non-key-event' property, then
-that binding is ignored by 'where-is-internal'.
-
-+++
-*** New functions for defining and manipulating keystrokes.
-These all take the syntax defined by 'key-valid-p'.  None of the older
-functions have been deprecated or altered, but they are now
-de-emphasized in the documentation.
-
-+++
-*** Use 'keymap-set' instead of 'define-key'.
-
-+++
-*** Use 'keymap-global-set' instead of 'global-set-key'.
-
-+++
-*** Use 'keymap-local-set' instead of 'local-set-key'.
-
-+++
-*** Use 'keymap-global-unset' instead of 'global-unset-key'.
-
-+++
-*** Use 'keymap-local-unset' instead of 'local-unset-key'.
-
-+++
-*** Use 'keymap-substitute' instead of 'substitute-key-definition'.
-
-+++
-*** Use 'keymap-set-after' instead of 'define-key-after'.
-
-+++
-*** Use 'keymap-lookup' instead of 'lookup-keymap' and 'key-binding'.
-
-+++
-*** Use 'keymap-local-lookup' instead of 'local-key-binding'.
-
-+++
-*** Use 'keymap-global-lookup' instead of 'global-key-binding'.
-
-+++
-*** 'define-key' now takes an optional REMOVE argument.
-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
-something usable even if the syntax of the argument isn't completely
-correct.  The 'key-valid-p' predicate does a stricter check of the
-syntax.
-
----
-*** New function 'key-parse'.
-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
-\\`C-k') in a docstring or when calling 'substitute-command-keys',
-which will use the same face as a command substitution.  This should
-be used only when a key sequence has no corresponding command, for
-example when it is read directly with 'read-key-sequence'.  It must be
-a valid key sequence according to 'key-valid-p'.
-
-+++
-** New function 'file-name-split'.
-This returns a list of all the components of a file name.
-
-+++
-** New function 'file-name-parent-directory'.
-This returns the parent directory of a file name.
-
-+++
-** New macro 'with-undo-amalgamate'.
-It records a particular sequence of operations as a single undo step.
-
-+++
-** New command 'yank-media'.
-This command supports yanking non-plain-text media like images and
-HTML from other applications into Emacs.  It is only supported in
-modes that have registered support for it, and only on capable
-platforms.
-
-+++
-** New command 'yank-media-types'.
-This command lets you examine all data in the current selection and
-the clipboard, and insert it into the buffer.
-
-+++
-** New variable 'yank-transform-functions'.
-This variable allows the user to alter the string to be inserted.
-
----
-** New command 'yank-in-context'.
-This command tries to preserve string/comment syntax when yanking.
-
----
-** New function 'minibuffer-lazy-highlight-setup'.
-This function allows setting up the minibuffer so that lazy
-highlighting of its content is applied in the original window.
-
-+++
-** New text property 'inhibit-isearch'.
-If set, 'isearch' will skip these areas, which can be useful (for
-instance) when covering huge amounts of data (that has no meaningful
-searchable data, like image data) with a 'display' text property.
-
-+++
-** 'insert-image' now takes an INHIBIT-ISEARCH optional parameter.
-It marks the image with the 'inhibit-isearch' text property, which
-inhibits 'isearch' matching the STRING parameter.
-
----
-** New variable 'replace-regexp-function'.
-Function to call to convert the entered FROM string to an Emacs
-regexp in 'query-replace' and similar commands.  It can be used to
-implement a different regexp syntax for search/replace.
-
----
-** New variables to customize defaults of FROM for 'query-replace*' commands.
-The new variable 'query-replace-read-from-default' can be set to a
-function that returns the default value of FROM when 'query-replace'
-prompts for a string to be replaced.  An example of such a function is
-'find-tag-default'.
-
-The new variable 'query-replace-read-from-regexp-default' can be set
-to a function (such as 'find-tag-default-as-regexp') that returns the
-default value of FROM when 'query-replace-regexp' prompts for a regexp
-whose matches are to be replaced.  If these variables are nil (which
-is the default), 'query-replace' and 'query-replace-regexp' take the
-default value from the previous FROM-TO pair.
-
----
-** New user option 'pp-use-max-width'.
-If non-nil, 'pp' will attempt to limit the line length when formatting
-long lists and vectors.
-
----
-** New function 'pp-emacs-lisp-code'.
-'pp' formats general Lisp sexps.  This function does much the same,
-but applies formatting rules appropriate for Emacs Lisp code.
-
-+++
-** New function 'file-has-changed-p'.
-This convenience function is useful when writing code that parses
-files at run-time, and allows Lisp programs to re-parse files only
-when they have changed.
-
-+++
-** 'abbreviate-file-name' now respects magic file name handlers.
-
----
-** New function 'font-has-char-p'.
-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.
-
-+++
-** 'window-body-width' and 'window-body-height' can use remapped faces.
-Specifying 'remap' as the PIXELWISE argument now checks if the default
-face was remapped, and if so, uses the remapped face to determine the
-character width/height.
-
-+++
-** 'set-window-vscroll' now accepts a new argument PRESERVE-VSCROLL-P.
-This means the vscroll will not be reset when set on a window that is
-"frozen" due to a mini-window being resized.
-
-** XDG support
-
----
-*** New function 'xdg-state-home'.
-It returns the new 'XDG_STATE_HOME' environment variable.  It should
-point to a file name that "contains state data that should persist
-between (application) restarts, but that is not important or portable
-enough to the user that it should be stored in $XDG_DATA_HOME".
-(This variable was introduced in the XDG Base Directory Specification
-version 0.8 released on May 8, 2021.)
-
----
-*** New function 'xdg-current-desktop'.
-It returns a list of strings, corresponding to the colon-separated
-list of names in the 'XDG_CURRENT_DESKTOP' environment variable, which
-identify the current desktop environment.
-(This variable was introduced in XDG Desktop Entry Specification
-version 1.2.)
-
----
-*** New function 'xdg-session-type'.
-It returns the 'XDG_SESSION_TYPE' environment variable.  (This is not
-part of any official standard; see the man page pam_systemd(8) for
-more information.)
-
-+++
-** New macro 'with-delayed-message'.
-This macro is like 'progn', but will output the specified message if
-the body takes longer to execute than the specified timeout.
-
----
-** New function 'funcall-with-delayed-message'.
-This function is like 'funcall', but will output the specified message
-if the function takes longer to execute than the specified timeout.
-
-** Locale
-
----
-*** New variable 'current-locale-environment'.
-This holds the value of the previous call to 'set-locale-environment'.
-
----
-*** New macro 'with-locale-environment'.
-This macro can be used to change the locale temporarily while
-executing code.
-
-** table.el
-
----
-*** New user option 'table-latex-environment'.
-This allows switching between "table" and "tabular".
-
-** Tabulated List Mode
-
-+++
-*** A column can now be set to an image descriptor.
-The 'tabulated-list-entries' variable now supports using an image
-descriptor, which means to insert an image in that column instead of
-text.  See the documentation string of that variable for details.
-
-+++
-** ':keys' in 'menu-item' can now be a function.
-If so, it is called whenever the menu is computed, and can be used to
-calculate the keys dynamically.
-
-+++
-** New major mode 'clean-mode'.
-This is a new major mode meant for debugging.  It kills absolutely all
-local variables and removes overlays and text properties.
-
-+++
-** 'kill-all-local-variables' can now kill all local variables.
-If given the new optional KILL-PERMANENT argument, also kill permanent
-local variables.
-
-+++
-** Third 'mapconcat' argument SEPARATOR is now optional.
-An explicit nil always meant the empty string, now it can be left out.
-
-+++
-** New function 'define-keymap'.
-This function allows defining a number of keystrokes with one form.
-
-+++
-** New macro 'defvar-keymap'.
-This macro allows defining keymap variables more conveniently.
-
-** 'defvar-keymap' can specify 'repeat-mode' behavior for the keymap.
-Use ':repeat t' to have all bindings be repeatable or for more
-advanced usage:
-
-    ':repeat (:enter (commands ...) :exit (commands ...))'
-
----
-** 'kbd' can now be used in built-in, preloaded libraries.
-It no longer depends on edmacro.el and cl-lib.el.
-
-+++
-** New function 'image-at-point-p'.
-This function returns t if point is on a valid image, and nil
-otherwise.
-
-+++
-** New function 'buffer-text-pixel-size'.
-This is similar to 'window-text-pixel-size', but can be used when the
-buffer isn't displayed.
-
-+++
-** New function 'string-pixel-width'.
-This returns the width of a string in pixels.  This can be useful when
-dealing with variable pitch fonts and glyphs that have widths that
-aren't integer multiples of the default font.
-
-+++
-** New function 'string-glyph-split'.
-This function splits a string into a list of strings representing
-separate glyphs.  This takes into account combining characters and
-grapheme clusters.
-
----
-** 'lookup-key' is more permissive when searching for extended menu items.
-In Emacs 28.1, the behavior of 'lookup-key' was changed: when looking
-for a menu item '[menu-bar Foo-Bar]', first try to find an exact
-match, then look for the lowercased '[menu-bar foo-bar]'.
-
-This has been extended, so that when looking for a menu item with a
-symbol containing spaces, as in '[menu-bar Foo\ Bar]', first look for
-an exact match, then the lowercased '[menu-bar foo\ bar]' and finally
-'[menu-bar foo-bar]'.  This further improves backwards-compatibility
-when converting menus to use 'easy-menu-define'.
-
-** xwidgets
-
-+++
-*** The function 'make-xwidget' now accepts an optional RELATED argument.
-This argument is used as another widget for the newly created WebKit
-widget to share settings and subprocesses with.  It must be another
-WebKit widget.
-
-+++
-*** New function 'xwidget-perform-lispy-event'.
-This function allows you to send events to xwidgets.  Usually, some
-equivalent of the event will be sent, but there is no guarantee of
-what the widget will actually receive.
-
-On GTK+, only key and function key events are implemented.
-
-+++
-*** New function 'xwidget-webkit-load-html'.
-This function is used to load HTML text into WebKit xwidgets
-directly, in contrast to creating a temporary file to hold the
-markup, and passing the URI of the file as an argument to
-'xwidget-webkit-goto-uri'.
-
-+++
-*** New functions for performing searches on WebKit xwidgets.
-Some new functions, such as 'xwidget-webkit-search', have been added
-for performing searches on WebKit xwidgets.
-
-+++
-*** New function 'xwidget-webkit-back-forward-list'.
-This function returns the history of page-loads in a WebKit xwidget.
-
-+++
-*** New function 'xwidget-webkit-estimated-load-progress'.
-This function returns the estimated progress of page loading in a
-WebKit xwidget.
-
-+++
-*** New function 'xwidget-webkit-stop-loading'.
-This function terminates all data transfer during page loads in a
-WebKit xwidget.
-
-+++
-*** 'load-changed' xwidget events are now more detailed.
-In particular, they can now have different arguments based on the
-state of the WebKit widget.  'load-finished' is sent when a load has
-completed, 'load-started' when a load first starts, 'load-redirected'
-after a redirect, and 'load-committed' when the WebKit widget first
-commits to the load.
-
-+++
-*** New event type 'xwidget-display-event'.
-These events are sent whenever an xwidget requests that Emacs display
-another xwidget.  The only arguments to this event are the xwidget
-that should be displayed, and the xwidget that asked to display it.
-
-+++
-*** New function 'xwidget-webkit-set-cookie-storage-file'.
-This function is used to control where and if an xwidget stores
-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.
-
-+++
-** 'encode-time' now also accepts a 6-element list with just time and date.
-'(encode-time (list SECOND MINUTE HOUR DAY MONTH YEAR))' is now short for
-'(encode-time (list SECOND MINUTE HOUR DAY MONTH YEAR nil -1 nil))'.
-
-+++
-** '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.
-
-+++
-** 'format-seconds' now allows suppressing zero-value trailing elements.
-The new "%x" non-printing control character will suppress zero-value
-elements that appear after "%x".
-
-+++
-** 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.
-
-+++
-** The ':underline' face attribute now accepts a new property.
-The property ':position' now specifies the position of the underline
-when used as part of a property list specification for the
-':underline' attribute.
-
-+++
-** 'defalias' records a more precise history of definitions.
-This is recorded in the 'function-history' symbol property.
-
----
-** New hook 'save-place-after-find-file-hook'.
-This is called at the end of 'save-place-find-file-hook'.
-
----
-** 'indian-tml-base-table' no longer translates digits.
-Use 'indian-tml-base-digits-table' if you want digits translation.
-
----
-** 'indian-tml-itrans-v5-hash' no longer translates digits.
-Use 'indian-tml-itrans-digits-v5-hash' if you want digits
-translation.
-
-+++
-** 'shell-quote-argument' has a new optional parameter POSIX.
-This is useful when quoting shell arguments for a remote shell
-invocation.  Such shells are POSIX conformant by default.
-
-+++
-** 'make-process' can set connection type independently for input and output.
-When calling 'make-process', communication via pty can be enabled
-selectively for just input or output by passing a cons cell for
-':connection-type', e.g. '(pipe . pty)'.  When examining a process
-later, you can determine whether a particular stream for a process
-uses a pty by passing one of 'stdin', 'stdout', or 'stderr' as the
-second argument to 'process-tty-name'.
-
-+++
-** 'signal-process' now consults the list 'signal-process-functions'.
-This is to determine which function has to be called in order to
-deliver the signal.  This allows Tramp to send the signal to remote
-asynchronous processes.  The hitherto existing implementation has been
-moved to 'internal-default-signal-process'.
-
-+++
-** 'list-system-processes' now returns remote process IDs.
-This happens only when the current buffer's 'default-directory' is
-remote.  In order to preserve the old behavior, apply
-
-    (let ((default-directory temporary-file-directory))
-      (list-system-processes))
-
-+++
-** 'process-attributes' expects a remote process ID now.
-When current buffer's 'default-directory' is remote, the PID argument
-of 'process-attributes' is regarded as a remote process ID.  In order
-to preserve the old behavior, apply
-
-    (let ((default-directory temporary-file-directory))
-      (process-attributes pid))
-
-+++
-** New functions 'take' and 'ntake'.
-'(take N LIST)' returns the first N elements of LIST; 'ntake' does
-the same but works by modifying LIST destructively.
-
----
-** 'string-split' is now an alias for 'split-string'.
-
-+++
-** 'format-spec' now accepts functions in the replacement.
-The function is called only when used in the format string.  This is
-useful to avoid side-effects such as prompting, when the value is not
-actually being used for anything.
-
-+++
-** The variable 'max-specpdl-size' has been made obsolete.
-Now 'max-lisp-eval-depth' alone is used for limiting Lisp recursion
-and stack usage.  'max-specpdl-size' is still present as a plain
-variable for compatibility but its limiting powers have been taken away.
+
+* Lisp Changes in Emacs 30.1
 
 
-* Changes in Emacs 29.1 on Non-Free Operating Systems
-
-** MS-Windows
-
----
-*** Emacs now supports double-buffering on MS-Windows to reduce display 
flicker.
-(This was supported on Free systems since Emacs 26.1.)
-
-To disable double-buffering (e.g., if it causes display problems), set
-the frame parameter 'inhibit-double-buffering' to a non-nil value.
-You can do that either by adding
-
-    '(inhibit-double-buffering . t)
-
-to 'default-frame-alist', or by modifying the frame parameters of the
-selected frame by evaluating
-
-    (modify-frame-parameters nil '((inhibit-double-buffering . t)))
-
-+++
-*** Emacs now supports system dark mode.
-On Windows 10 (version 1809 and higher) and Windows 11, Emacs will now
-follow the system's dark mode: GUI frames use the appropriate light or
-dark title bar and scroll bars, based on the user's Windows-wide color
-settings.
-
----
-*** Emacs now uses native image APIs to display some image formats.
-On Windows 2000 and later, Emacs now defaults to using the native
-image APIs for displaying the BMP, GIF, JPEG, PNG, and TIFF images.
-This means Emacs on MS-Windows needs no longer use external image
-support libraries to display those images.  Other image types -- XPM,
-SVG, and WEBP -- still need support libraries for Emacs to be able to
-display them.
-
-The use of native image APIs is controlled by the variable
-'w32-use-native-image-API', whose value now defaults to t on systems
-where those APIs are available.
-
-+++
-*** Emacs now supports display of BMP images using native image APIs.
-When 'w32-use-native-image-API' is non-nil, Emacs on MS-Windows now
-has built-in support for displaying BMP images.
-
-** Cygwin
-
----
-*** 'process-attributes' is now implemented.
+* Changes in Emacs 30.1 on Non-Free Operating Systems
 
 
 ----------------------------------------------------------------------
@@ -4409,5 +127,5 @@ Local variables:
 coding: utf-8
 mode: outline
 mode: emacs-news
-paragraph-separate: "[         ]"
+paragraph-separate: "[  ]"
 end:
diff --git a/etc/NEWS.19 b/etc/NEWS.19
index d21cd8187f..25f803d6e2 100644
--- a/etc/NEWS.19
+++ b/etc/NEWS.19
@@ -1111,7 +1111,7 @@ function definition, variable, or property.
 
 ** Font Lock mode
 
-*** Supports Scheme, TCL and Help modes
+*** Supports Scheme, Tcl and Help modes
 
 For example, to automatically turn on Font Lock mode in the *Help*
 buffer, put:
@@ -1735,7 +1735,7 @@ projects to define project-specific structures.  It also 
enables the
 use of etags and TAGS files for languages not supported by etags.
 
 The Emacs manual section on Tags contains explanations and examples
-for Emacs's DEFVAR, VHDL, Cobol, PostScript and TCL.
+for Emacs's DEFVAR, VHDL, Cobol, PostScript and Tcl.
 
 ** Various mode-specific commands that used to be bound to C-c LETTER
 have been moved.
diff --git a/etc/NEWS.22 b/etc/NEWS.22
index b4ecbe7039..bf172b4cc9 100644
--- a/etc/NEWS.22
+++ b/etc/NEWS.22
@@ -1993,7 +1993,7 @@ It is a modern replacement for 'zone-mode', which is now 
obsolete.
 ** 'cfengine-mode' is a major mode for editing GNU Cfengine
 configuration files.
 
-** The TCL package tcl-mode.el was replaced by tcl.el.
+** The Tcl package tcl-mode.el was replaced by tcl.el.
 This was actually done in Emacs-21.1, and was not documented.
 
 * Changes in Specialized Modes and Packages in Emacs 22.1:
diff --git a/etc/NEWS.24 b/etc/NEWS.24
index 8ef479ac0a..31e48f9aca 100644
--- a/etc/NEWS.24
+++ b/etc/NEWS.24
@@ -704,7 +704,7 @@ related to that keyword.
 
 *** The format of 'archive-contents' files, generated by package
 repositories, has changed to allow a new (fifth) element in the data
-vectors, containing an associative list with extra properties.
+vectors, containing an association list with extra properties.
 (For example, 'describe-package' uses the ':url' extra property to
 display a "Homepage" header.)
 
diff --git a/etc/NEWS b/etc/NEWS.29
similarity index 92%
copy from etc/NEWS
copy to etc/NEWS.29
index 5a65896d69..017fd850b4 100644
--- a/etc/NEWS
+++ b/etc/NEWS.29
@@ -30,6 +30,44 @@ Use '--with-native-compilation=aot' to specify that all the 
Lisp files
 in the Emacs tree should be natively compiled ahead of time.  (This is
 slow on most machines.)
 
++++
+** Emacs can be built with the tree-sitter parsing library.
+This library, together with grammar libraries, provides incremental
+parsing capabilities for several popular programming languages and
+other formatted files.  Emacs built with this library offers major
+modes, described elsewhere in this file, that are based on the
+tree-sitter's parsers.  If you have the tree-sitter library
+installed, the configure script will automatically include it in the
+build; use '--without-tree-sitter' at configure time to disable that.
+
+Emacs modes based on the tree-sitter library require an additional
+grammar library for each mode.  These grammar libraries provide the
+tree-sitter library with language-specific lexical analysis and
+parsing capabilities, and are developed separately from the
+tree-sitter library itself.  If you don't have a grammar library
+required by some Emacs major mode, and your distro doesn't provide it
+as an installable package, you can compile and install such a library
+yourself.  Many libraries can be downloaded from the tree-sitter site:
+
+    https://github.com/tree-sitter
+
+To compile such a library, compile the files "scanner.c" and "parser.c"
+(sometimes named "scanner.cc" and "parser.cc") in the "src" subdirectory
+of the library's source tree using the C or C++ compiler, then link
+these two files into a shared library named "libtree-sitter-LANG.so",
+where LANG is the name of the language supported by the grammar as it
+is expected by the Emacs major mode (for example, "c" for 'c-ts-mode',
+"cpp" for 'c++-ts-mode', "python" for 'python-ts-mode', etc.).  Then place
+the shared library you've built in the same directory where you keep
+the other shared libraries used by Emacs, or in the "tree-sitter"
+subdirectory of your 'user-emacs-directory', or in a directory
+mentioned in the variable 'treesit-extra-load-path'.
+
+You only need to install language grammar libraries required by the
+Emacs modes you will use, as Emacs loads these libraries only when the
+corresponding mode is turned on in some buffer for the first time in
+an Emacs session.
+
 +++
 ** Emacs can be built with built-in support for accessing SQLite databases.
 This uses the popular sqlite3 library, and can be disabled by using
@@ -105,16 +143,6 @@ configuration on X is known to have problems, such as 
undesirable
 frame positioning and various issues with keyboard input of sequences
 such as 'C-;' and 'C-S-u'.
 
----
-** The implementation of overlays has changed.
-Emacs now uses an implementation of overlays that is much more
-efficient than the original one, and should speed up all the
-operations that involve overlays, especially when there are lots of
-them in a buffer.  However, no changes in behavior of overlays should
-be visible on the Lisp or user level, with the exception of better
-performance and the order of overlays returned by functions that don't
-promise any particular order.
-
 ---
 ** The docstrings of preloaded files are not in "etc/DOC" any more.
 Instead, they're fetched as needed from the corresponding ".elc" file,
@@ -142,11 +170,6 @@ and then execute the rest of the script file as Emacs 
Lisp.  When it
 reaches the end of the script, Emacs will exit with an exit code from
 the value of the final form.
 
-+++
-** New function 'substitute-quotes'.
-This function works like 'substitute-command-keys' but only
-substitutes quote characters.
-
 +++
 ** Emacs now supports setting 'user-emacs-directory' via '--init-directory'.
 
@@ -371,11 +394,6 @@ node in the Eshell manual for more details.
 *** Eshell pipelines now only pipe stdout by default.
 To pipe both stdout and stderr, use the '|&' operator instead of '|'.
 
-*** New eshell built-in command 'doas'.
-The privilege-escalation program 'doas' has been added to the existing
-'su' and 'sudo' commands from the 'eshell-tramp' module.  The external
-command may still be accessed by using '*doas'.
-
 ---
 ** The 'delete-forward-char' command now deletes by grapheme clusters.
 This command is by default bound to the <Delete> function key
@@ -440,7 +458,7 @@ The user options 'url-gateway-rlogin-host',
 are also obsolete.
 
 ---
-** The user function 'url-irc-function' now takes a 'scheme' argument.
+** The user function 'url-irc-function' now takes a SCHEME argument.
 The user option 'url-irc-function' is now called with a sixth argument
 corresponding to the scheme portion of the target URL.  For example,
 this would be "ircs" for a URL like "ircs://irc.libera.chat".
@@ -504,7 +522,7 @@ instead.
 ** The url-dired.el library is now obsolete.
 
 ---
-** The fast-lock.el and lazy-lock.el library have been removed.
+** The fast-lock.el and lazy-lock.el libraries have been removed.
 They have been obsolete since Emacs 22.1.
 
 The variable 'font-lock-support-mode' is occasionally useful for
@@ -1039,6 +1057,9 @@ The command pops up a buffer at the bottom of the screen 
with a few
 helpful commands for various tasks.  You can toggle the display using
 'C-h q'.
 
+** Emacs 29.1 comes with Org v9.6.
+See the file ORG-NEWS for user-visible changes in Org.
+
 ** Outline Mode
 
 +++
@@ -1390,10 +1411,15 @@ language.
 This is a variant of the 'slovak' input method, which corresponds to
 the QWERTY Slovak keyboards.
 
+---
+*** New input method 'cyrillic-chuvash'.
+This input method is based on the russian-computer, and is intended
+for the Chuvash language written in the Cyrillic script.
+
 
 * Changes in Specialized Modes and Packages in Emacs 29.1
 
-** ecomplete
+** Ecomplete
 
 ---
 *** New commands 'ecomplete-edit' and 'ecomplete-remove'.
@@ -1415,7 +1441,8 @@ database stored on disk.
 *** New user option 'auth-source-pass-extra-query-keywords'.
 Whether to recognize additional keyword params, like ':max' and
 ':require', as well as accept lists of query terms paired with
-applicable keywords.
+applicable keywords.  This disables most known behavioral quirks
+unique to auth-source-pass, such as wildcard subdomain matching.
 
 ** Dired
 
@@ -1514,6 +1541,7 @@ It is enabled by default, but requires that the external 
"shellcheck"
 command is installed.
 
 ** CC Mode
+
 ---
 *** C++ Mode now supports most of the new features in the C++20 standard.
 
@@ -1597,32 +1625,32 @@ If no packages are marked, 'x' will install the package 
under point if
 it isn't already, and remove it if it is installed.
 
 +++
-*** New command 'package-vc-install'
+*** New command 'package-vc-install'.
 Packages can now be installed directly from source by cloning from a
 repository.
 
 +++
-*** New command 'package-vc-install-from-checkout'
+*** New command 'package-vc-install-from-checkout'.
 An existing checkout can now be loaded via package.el, by creating a
 symbolic link from the usual package directory to the checkout.
 
 +++
-*** New command 'package-vc-checkout'
+*** New command 'package-vc-checkout'.
 Used to fetch the source of a package by cloning a repository without
 activating the package.
 
 +++
-*** New command 'package-vc-prepare-patch'
+*** New command 'package-vc-prepare-patch'.
 This command allows you to send patches to package maintainers, for
 packages checked out using 'package-vc-install'.
 
 +++
-*** New command 'package-report-bug'
+*** New command 'package-report-bug'.
 This command helps you compose an email for sending bug reports to
 package maintainers.
 
 +++
-*** New user option 'package-vc-selected-packages'
+*** New user option 'package-vc-selected-packages'.
 By customizing this user option you can specify specific packages to
 install.
 
@@ -1767,7 +1795,7 @@ There are two new values to control the way the 
"*Completions*" buffer
 behaves after pressing a 'TAB' if completion is not unique.  The value
 'always' updates or shows the "*Completions*" buffer after any attempt
 to complete.  The value 'visual' is like 'always', but only updates
-the completions if they are already visible.  The default value 't'
+the completions if they are already visible.  The default value t
 always hides the completion buffer after some completion is made.
 
 *** New commands to complete the minibuffer history.
@@ -2001,11 +2029,31 @@ It narrows to the current node.
 ** EUDC
 
 +++
-*** New user option 'eudc-ignore-options-file' that defaults to 'nil'
+*** Deprecations planned for next release.
+After Emacs 29.1, some aspects of EUDC will be deprecated.  The goal
+of these deprecations is to simplify EUDC server configuration by
+making 'eudc-server-hotlist' the only place to add servers.  There
+will not be a need to set the server using the 'eudc-set-server'
+command.  Instead, the 'eudc-server-hotlist' user option should be
+customized to have an entry for the server.  The plan is to obsolete
+the 'eudc-hotlist' package since Customize is sufficient for changing
+'eudc-server-hotlist'.  How the 'eudc-server' user option works in this
+context is to-be-determined; it can't be removed, because that would
+break compatibility, but it may become synchronized with
+'eudc-server-hotlist' so that 'eudc-server' is always equal to '(car
+eudc-server-hotlist)'.  The first entry in 'eudc-server-hotlist' is the
+first server tried by 'eudc-expand-try-all'.  The hotlist
+simplification will allow 'eudc-query-form' to show a drop down of
+possible servers, instead of requiring a call to 'eudc-set-server'
+like it does in this release.  The default value of
+'eudc-ignore-options-file' will be changed from nil to t.
+
++++
+*** New user option 'eudc-ignore-options-file' that defaults to nil.
 The 'eudc-ignore-options-file' user option can be configured to ignore
 the 'eudc-options-file' (typically "~/.emacs.d/eudc-options").  Most
-users should configure this to 't' and put EUDC configuration in the
-main Emacs initialization file (".emacs" or "~/.emacs.d/init.el").
+users should configure this to t and put EUDC configuration in the
+main Emacs initialization file ("~/.emacs" or "~/.emacs.d/init.el").
 
 +++
 *** 'eudc-expansion-overwrites-query' to 'eudc-expansion-save-query-as-kill'.
@@ -2054,15 +2102,15 @@ of attributes to use for queries, and delivers more 
attributes in
 query results.
 
 +++
-*** New back-end for ecomplete
+*** New back-end for ecomplete.
 A new back-end for ecomplete allows information from that database to
 be queried by EUDC, too.  The attributes present in the EUDC query are
 used to select the entry type in the ecomplete database.
 
 +++
-*** New back-end for mailabbrev
+*** New back-end for mailabbrev.
 A new back-end for mailabbrev allows information from that database to
-be queried by EUDC, too.  The attributes email, name, and firstname
+be queried by EUDC, too.  The attributes 'email', 'name', and 'firstname'
 are supported only.
 
 ** EWW/SHR
@@ -2228,11 +2276,13 @@ underlying shell instead of using the normal Emacs 
bindings.
 also handle ANSI codes for faint, italic and blinking text, displaying
 it with new 'term-{faint,italic,slow-blink,fast-blink}' faces.
 
-** Xref
+** Project
 
 +++
-*** 'project-find-file' and 'project-or-external-find-file' now accept
-a prefix argument which is interpreted to mean "include all files".
+*** 'project-find-file' and 'project-or-external-find-file' can include all.
+The commands 'project-find-file' and 'project-or-external-find-file'
+now accept a prefix argument, which is interpreted to mean "include
+all files".
 
 +++
 *** New command 'project-list-buffers' bound to 'C-x p C-b'.
@@ -2243,6 +2293,15 @@ This command displays a list of buffers from the current 
project.
 Customize the user option 'project-kill-buffers-display-buffer-list'
 to enable the display of the buffer list.
 
+*** New user option 'project-vc-extra-root-markers'.
+Use it to add detection of nested projects (inside a VCS repository),
+or projects outside of VCS repositories.
+
+As a consequence, the 'VC project backend' is formally renamed to
+'VC-aware project backend'.
+
+** Xref
+
 +++
 *** New command 'xref-go-forward'.
 It is bound to 'C-M-,' and jumps to the location where 'xref-go-back'
@@ -2658,13 +2717,13 @@ customize this to "https" to always prefer HTTPS URLs.
 
 ---
 *** New user option 'browse-url-irc-function'.
-This option specifies a function for opening irc:// links.  It
+This option specifies a function for opening "irc://" links.  It
 defaults to the new function 'browse-url-irc'.
 
 ---
 *** New function 'browse-url-irc'.
-This multipurpose autoloaded function can be used for opening irc://
-and ircs:// URLS by any caller that passes a URL string as an initial
+This multipurpose autoloaded function can be used for opening "irc://"
+and "ircs://" URLS by any caller that passes a URL string as an initial
 arg.
 
 ---
@@ -2699,6 +2758,9 @@ project-dedicated or global) is specified by the new
 ---
 *** New user option 'ruby-toggle-block-space-before-parameters'.
 
+---
+*** Support for endless methods.
+
 ** Eshell
 
 +++
@@ -2728,6 +2790,12 @@ example, you can now redirect both stdout and stderr via 
'&>' or
 duplicate one output handle to another via 'NEW-FD>&OLD-FD'.  For more
 information, see the "(eshell) Redirection" node in the Eshell manual.
 
++++
+*** New eshell built-in command 'doas'.
+The privilege-escalation program 'doas' has been added to the existing
+'su' and 'sudo' commands from the 'eshell-tramp' module.  The external
+command may still be accessed by using '*doas'.
+
 +++
 *** Double-quoting an Eshell expansion now treats the result as a single 
string.
 If an Eshell expansion like '$FOO' is surrounded by double quotes, the
@@ -2763,11 +2831,12 @@ error, and now expand to all directories recursively 
(following
 symlinks in the latter case).
 
 +++
-*** Lisp forms in Eshell now treat a 'nil' result as a failed exit status.
-When executing a command that looks like '(lisp form)', Eshell will
-set the exit status (available in the '$?' variable) to 2.  This
-allows commands like that to be used as conditionals.  To change this
-behavior, customize the new 'eshell-lisp-form-nil-is-failure' option.
+*** Lisp forms in Eshell now treat a nil result as a failed exit status.
+When executing a command that looks like '(lisp form)' and returns
+nil, Eshell will set the exit status (available in the '$?'
+variable) to 2.  This allows commands like that to be used in
+conditionals.  To change this behavior, customize the new
+'eshell-lisp-form-nil-is-failure' user option.
 
 ** Shell
 
@@ -2796,6 +2865,22 @@ Set it to nil to exclude line numbering from kills and 
copies.
 argument which allows tree-widget display to be activated and computed
 only when the user expands the node.
 
+** Proced
+
+---
+*** proced.el shows system processes of remote hosts.
+When 'default-directory' is remote, and 'proced' is invoked with a
+negative argument like 'C-u - proced', the system processes of that
+remote host are shown.  Alternatively, the user option
+'proced-show-remote-processes' can be set to non-nil.
+'proced-signal-function' has been marked obsolete.
+
+---
+*** Proced can now optionally show process details in color.
+New user option 'proced-enable-color-flag' enables coloring of Proced
+buffers.  This option is disabled by default; customize it to a
+non-nil value to enable colors.
+
 ** Miscellaneous
 
 ---
@@ -2881,20 +2966,12 @@ also been renamed:
     'mark-bib'         to  'bib-mark'
     'unread-bib'       to  'bib-unread'
 
----
-*** proced.el shows system processes of remote hosts.
-When 'default-directory' is remote, and 'proced' is invoked with a
-negative argument like 'C-u - proced', the system processes of that
-remote host are shown.  Alternatively, the user option
-'proced-show-remote-processes' can be set to non-nil.
-'proced-signal-function' has been marked obsolete.
-
 ---
 *** 'outlineify-sticky' command is renamed to 'allout-outlinify-sticky'.
 The old name is still available as an obsolete function alias.
 
 ---
-*** The url-irc library now understands ircs:// links.
+*** The url-irc library now understands "ircs://" links.
 
 ---
 *** New command 'world-clock-copy-time-as-kill' for 'M-x world-clock'.
@@ -2905,6 +2982,11 @@ It copies the current line into the kill ring.
 The new face 'abbrev-table-name' is used to display the abbrev table
 name.
 
+---
+*** New key binding 'O' in 'M-x list-buffers'.
+This key is now bound to 'Buffer-menu-view-other-window', which will
+view this line's buffer in View mode in another window.
+
 
 * New Modes and Packages in Emacs 29.1
 
@@ -2916,7 +2998,14 @@ based on data provided by language servers using the 
Language Server
 Protocol (LSP).
 
 +++
-** New commands 'image-crop' and 'image-cut.
+*** use-package: Declarative package configuration.
+use-package is shipped with Emacs.  It provides the 'use-package'
+macro, which allows you to isolate package configuration in your init
+file in a way that is declarative, tidy, and performance-oriented.
+See the new Info manual "(use-package) Top" for more.
+
++++
+** New commands 'image-crop' and 'image-cut'.
 These commands allow interactively cropping/cutting the image at
 point.  The commands are bound to keys 'i c' and 'i x' (respectively)
 in the local keymap over images.  They rely on external programs, by
@@ -2955,49 +3044,161 @@ Emacs buffers, like indentation and the like.  The new 
ert function
 'ert-test-erts-file' is used to parse these files.
 
 ---
-** New mode 'js-json-mode'.
+** New major mode 'js-json-mode'.
 This is a lightweight variant of 'js-mode' that is used by default
 when visiting JSON files.
 
-
-** New mode 'ts-mode'.
-A major mode based on the tree-sitter library for editing programs
-in the TypeScript language.  It includes support for font-locking,
-indentation, and navigation.
-
-** New mode 'c-ts-mode'.
+** New major mode 'csharp-mode'.
+A major mode based on CC Mode for editing programs in the C# language.
+This mode is auto-enabled for files with the ".cs" extension.
+
+** New major modes based on the tree-sitter library.
+These new major modes are available if Emacs was built with the
+tree-sitter library.  They provide support for font-locking,
+indentation, and navigation by defuns based on parsing the buffer text
+by a tree-sitter parser.  Some major modes also offer support for
+Imenu and 'which-func'.
+
+Where major modes already exist in Emacs for editing certain kinds of
+files, the new modes based on tree-sitter are for now entirely
+optional, and you must turn them on manually, or customize
+'auto-mode-alist' to turn them on automatically.
+
+Each major mode based on tree-sitter needs a language grammar library,
+usually named "libtree-sitter-LANG.so" ("libtree-sitter-LANG.dll" on
+MS-Windows), where LANG is the corresponding language name.  Emacs
+looks for these libraries in the following places:
+
+ . in the directories mentioned in the list 'treesit-extra-load-path'
+ . in the "tree-sitter" subdirectory of your 'user-emacs-directory'
+   (by default, "~/.emacs.d/tree-sitter")
+ . in the standard system directories where other shared libraries are
+   usually installed
+
+We recommend to install these libraries in one of the standard system
+locations (the last place in the above list).
+
+If a language grammar library required by a mode is not found in any
+of the above places, the mode will signal an error when you try to
+turn it on.
+
+*** New major mode 'typescript-ts-mode'.
 A major mode based on the tree-sitter library for editing programs
-in the C language.  It includes support for font-locking,
-indentation, Imenu, which-func, and navigation.
+in the TypeScript language.  This mode is auto-enabled for files with
+the ".ts" extension.
 
-** New mode 'c++-ts-mode'.
+*** New major mode 'tsx-ts-mode'.
 A major mode based on the tree-sitter library for editing programs
-in the C++ language.  It includes support for font-locking,
-indentation, Imenu, which-func, and navigation.
-
-** New mode 'java-ts-mode'.
-A major mode based on the tree-sitter library for editing programs
-in the Java language.  It includes support for font-locking,
-indentation, Imenu, which-func, and navigation.
-
-** New mode 'css-ts-mode'.
-A major mode based on the tree-sitter library for editing programs
-in the CSS language.  It includes support for font-locking,
-indentation, Imenu, which-func, and navigation.
-
-** New mode 'json-ts-mode'.
-A major mode based on the tree-sitter library for editing programs
-in the JSON language.  It includes support for font-locking,
-indentation, Imenu, which-func, and navigation.
+in the TypeScript language, with support for TSX.  This mode is
+auto-enabled for files with the ".tsx" extension.
+
+*** New major mode 'c-ts-mode'.
+An optional major mode based on the tree-sitter library for editing
+programs in the C language.
+
+*** New major mode 'c++-ts-mode'.
+An optional major mode based on the tree-sitter library for editing
+programs in the C++ language.
+
+*** New major mode 'java-ts-mode'.
+An optional major mode based on the tree-sitter library for editing
+programs in the Java language.
+
+*** New major mode 'python-ts-mode'.
+An optional major mode based on the tree-sitter library for editing
+programs in the Python language.
+
+*** New major mode 'css-ts-mode'.
+An optional major mode based on the tree-sitter library for editing
+CSS (Cascading Style Sheets).
+
+*** New major mode 'json-ts-mode'.
+An optional major mode based on the tree-sitter library for editing
+programs in the JSON language.
+
+*** New major mode 'csharp-ts-mode'.
+An optional major mode based on the tree-sitter library for editing
+programs in the C# language.
+
+*** New major mode 'bash-ts-mode'.
+Am optional major mode based on the tree-sitter library for editing
+Bash shell scripts.
+
+*** New major mode 'dockerfile-ts-mode'.
+A major mode based on the tree-sitter library for editing
+Dockerfiles.  This mode is auto-enabled for files which are named
+"Dockerfile", have the "Dockerfile." prefix, or have the ".dockerfile"
+extension.
+
+*** New major mode 'cmake-ts-mode'.
+A major mode based on the tree-sitter library for editing CMake files.
+It is auto-enabled for files whose name is "CMakeLists.txt" or whose
+extension is ".cmake".
+
+*** New major mode 'toml-ts-mode'.
+A major mode based on the tree-sitter library for editing files
+written in TOML, a format for writing configuration files.  It is
+auto-enabled for files with the ".toml" extension.
+
+*** New major mode 'go-ts-mode'.
+A major mode based on the tree-sitter library for editing programs in
+the Go language.  It is auto-enabled for files with the ".go" extension.
+
+*** New major mode 'go-mod-ts-mode'.
+A major mode based on the tree-sitter library for editing "go.mod"
+files.  It is auto-enabled for files which are named "go.mod".
+
+*** New major mode 'yaml-ts-mode'.
+A major mode based on the tree-sitter library for editing files
+written in YAML.  It is auto-enabled for files with the ".yaml" or
+".yml" extensions.
+
+*** New major mode 'rust-ts-mode'.
+A major mode based on the tree-sitter library for editing programs in
+the Rust language.  It is auto-enabled for files with the ".rs" extension.
 
 
 * Incompatible Lisp Changes in Emacs 29.1
 
++++
+** The implementation of overlays has changed.
+Emacs now uses an implementation of overlays that is much more
+efficient than the original one, and should speed up all the
+operations that involve overlays, especially when there are lots of
+them in a buffer.
+
+As result of this, some minor incompatibilities in behavior could be
+observed, as described below.  Except those minor incompatibilities,
+no other changes in behavior of overlays should be visible on the Lisp
+or user level, with the exception of better performance and the order
+of overlays returned by functions that don't promise any particular
+order.
+
+*** The function 'overlay-recenter' is now a no-op.
+This function does nothing, and in particular has no effect on the
+value returned by 'overlay-lists'.  The purpose of 'overlay-recenter'
+was to allow more efficient lookup of overlays around certain buffer
+position; however with the new implementation the lookup of overlays
+is efficient regardless of their position, and there's no longer any
+need to "optimize" the lookup, nor any notion of "center" of the
+overlays.
+
+*** The function 'overlay-lists' returns one unified list of overlays.
+This function used to return a cons of two lists, one with overlays
+before the "center" position, the other after that "center".  It now
+returns a list whose 'car' is the list of all the buffer overlays, and
+whose 'cdr' is always nil.
+
 +++
 ** 'format-prompt' now uses 'substitute-command-keys'.
 This means that both the prompt and 'minibuffer-default-prompt-format'
 will have key definitions and single quotes handled specially.
 
++++
+** New function 'substitute-quotes'.
+This function works like 'substitute-command-keys' but only
+substitutes quote characters.
+
 ---
 ** 'find-image' now uses 'create-image'.
 This means that images found through 'find-image' also have
@@ -3650,7 +3851,7 @@ If the function returns 'dont-clear-message', then the 
message is not
 cleared, with the assumption that the function cleared it itself.
 
 +++
-** The local variable section now supports defining fallback modes.
+** The local variables section now supports defining fallback modes.
 This was previously only available when using a property line (i.e.,
 putting the modes on the first line of a file).
 
@@ -3697,8 +3898,7 @@ compliant.
 +++
 ** New macro 'setopt'.
 This is like 'setq', but is meant to be used for user options instead
-of plain variables, and
-uses 'custom-set'/'set-default' to set them.
+of plain variables, and uses 'custom-set'/'set-default' to set them.
 
 +++
 ** New utility predicate 'mode-line-window-selected-p'.
@@ -4301,22 +4501,17 @@ asynchronous processes.  The hitherto existing 
implementation has been
 moved to 'internal-default-signal-process'.
 
 +++
-** 'list-system-processes' now returns remote process IDs.
+** Some system information functions honor remote systems now.
+'list-system-processes' returns remote process IDs.
+'memory-info' returns memory information of remote systems.
+'process-attributes' expects a remote process ID.
 This happens only when the current buffer's 'default-directory' is
-remote.  In order to preserve the old behavior, apply
+remote.  In order to preserve the old behavior, bind
+'default-directory' to a local directory, like
 
     (let ((default-directory temporary-file-directory))
       (list-system-processes))
 
-+++
-** 'process-attributes' expects a remote process ID now.
-When current buffer's 'default-directory' is remote, the PID argument
-of 'process-attributes' is regarded as a remote process ID.  In order
-to preserve the old behavior, apply
-
-    (let ((default-directory temporary-file-directory))
-      (process-attributes pid))
-
 +++
 ** New functions 'take' and 'ntake'.
 '(take N LIST)' returns the first N elements of LIST; 'ntake' does
@@ -4337,6 +4532,23 @@ Now 'max-lisp-eval-depth' alone is used for limiting 
Lisp recursion
 and stack usage.  'max-specpdl-size' is still present as a plain
 variable for compatibility but its limiting powers have been taken away.
 
+** New function 'external-completion-table'.
+This function returns a completion table designed to ease
+communication between Emacs's completion facilities and external tools
+offering completion services, particularly tools whose full working
+set is too big to transfer to Emacs every time a completion is
+needed.  The table uses new 'external' completion style exclusively
+and cannot work with regular styles such as 'basic' or 'flex'.
+
++++
+** Magic file name handlers for 'make-directory-internal' are no longer needed.
+Instead, Emacs uses the already-existing 'make-directory' handlers.
+
++++
+** '(make-directory DIR t)' returns non-nil if DIR already exists.
+This can let a caller know whether it created DIR.  Formerly,
+'make-directory's return value was unspecified.
+
 
 * Changes in Emacs 29.1 on Non-Free Operating Systems
 
@@ -4409,5 +4621,5 @@ Local variables:
 coding: utf-8
 mode: outline
 mode: emacs-news
-paragraph-separate: "[         ]"
+paragraph-separate: "[  ]"
 end:
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 3b6ab2e2ad..67889c0b10 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -11,6 +11,742 @@ See the end of the file for license conditions.
 
 Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
+* Version 9.6
+
+** Important announcements and breaking changes
+*** =python-mode.el (MELPA)= support in =ob-python.el= is deprecated
+
+We no longer aim to support third-party =python-mode.el= implementation of 
Python REPL.
+Only the built-in =python.el= will be supported from now on.
+
+We still keep the old, partially broken, code in =ob-python.el= for
+the time being.  It will be removed in the next release.
+
+See https://orgmode.org/list/87r0yk7bx8.fsf@localhost for more details.
+
+*** Element cache is enabled by default and work for headings
+
+The old element cache code has been refactored.  Emacs does not hang
+anymore when the cache is enabled.
+
+When cache is enabled, ~org-element-at-point~ for headings is
+guaranteed to return valid =:parent= property.  The highest-level
+headings contain new =org-data= element as their parent.
+
+The new =org-data= element provides properties from top-level property
+drawer, buffer-global category, and =:path= property containing file
+path for file Org buffers.
+
+The new cache still need to be tested extensively.  Please, report any
+warning coming from element cache.  If you see warnings regularly, it
+would be helpful to set ~org-element--cache-self-verify~ to
+='backtrace= and provide the backtrace to Org mailing list.
+
+*** Element cache persists across Emacs sessions
+
+The cache state is saved between Emacs sessions.  Enabled by default.
+
+The cache persistence can be controlled via
+~org-element-cache-persistent~.
+
+*** Users experiencing performance issues can use new folding backend
+
+The old folding backend used in Org is poorly scalable when the file
+size increases beyond few Mbs.  The symptoms usually include slow
+cursor motion, especially in long-running Emacs sessions.
+
+A new optimized folding backend is now available, and enabled by
+default.  To disable it, put the following to the Emacs config *before*
+loading Org:
+
+#+begin_src emacs-lisp
+(setq org-fold-core-style 'overlays)
+#+end_src
+
+Even more performance optimization can be enabled by customizing
+=org-fold-core--optimise-for-huge-buffers=.  However, this option may
+be dangerous.  Please, read the variable docstring carefully to
+understand the possible consequences.
+
+When =org-fold-core-style= is set to =text-properties=, several new
+features will become available and several notable changes will happen
+to the Org behavior.  The new features and changes are listed below.
+
+**** Hidden parts of the links can now be searched and revealed during isearch
+
+In the past, hidden parts of the links could not be searched using
+isearch (=C-s=).  Now, they are searchable by default.  The hidden
+match is also revealed temporarily during isearch.
+
+To restore the old behavior add the following core to your Emacs
+config:
+
+#+begin_src emacs-lisp
+(defun org-hidden-link-ignore-isearch ()
+  "Do not match hidden parts of links during isearch."
+  (org-fold-core-set-folding-spec-property 'org-link :isearch-open nil)
+  (org-fold-core-set-folding-spec-property 'org-link :isearch-ignore t))
+(add-hook 'org-mode-hook #'org-hidden-link-ignore-isearch)
+#+end_src
+
+See docstring of =org-fold-core--specs= to see more details about
+=:isearch-open= and =:isearch-ignore= properties.
+
+**** =org-catch-invisible-edits= now works for hidden parts of the links and 
for emphasis markers
+
+In the past, user could edit invisible parts of the links and emphasis 
markers.  Now, the editing is respecting the value of 
=org-catch-invisible-edits=.
+
+Note that hidden parts of sub-/super-scripts are still not handled.
+
+**** Breaking structure of folded elements automatically reveals the folded 
text
+
+In the past, the user could be left with unfoldable text after breaking the 
org structure.
+
+For example, if
+
+#+begin_src org
+:DRAWER:
+like this
+:END:
+#+end_src
+
+is folded and then edited into
+
+#+begin_src org
+DRAWER:
+like this
+:END:
+#+end_src
+The hidden text would not be revealed.
+
+Now, breaking structure of drawers, blocks, and headings automatically
+reveals the folded text.
+
+**** Folding state of the drawers is now preserved when cycling headline 
visibility
+
+In the past drawers were folded every time a headline is unfolded.
+
+Now, it is not the case anymore.  The drawer folding state is
+preserved.  The initial folding state of all the drawers in buffer is
+set according to the startup visibility settings.
+
+To restore the old behavior, add the following code to Emacs config:
+
+#+begin_src emacs-lisp
+(add-hook 'org-cycle-hook #'org-cycle-hide-drawers)
+#+end_src
+
+Note that old behavior may cause performance issues when cycling
+headline visibility in large buffers.
+
+**** =outline-*= functions may no longer work correctly in Org mode
+
+The new folding backend breaks some of the =outline-*= functions that
+rely on the details of visibility state implementation in
+=outline.el=.  The old Org folding backend was compatible with the
+=outline.el= folding, but it is not the case anymore with the new
+backend.  From now on, using =outline-*= functions is strongly
+discouraged when working with Org files.
+
+*** HTML export uses MathJax 3+ instead of MathJax 2
+
+Org now uses MathJax 3 by default instead of MathJax 2.  During HTML
+exports, Org automatically converts all legacy MathJax 2 options to
+the corresponding MathJax 3+ options, except for the ~path~ option in
+which now /must/ point to a file containing MathJax version 3 or
+later.  The new Org does /not/ work with the legacy MathJax 2.
+
+Further, if you need to use a non-default ~font~ or ~linebreaks~ (now
+~overflow~), then the ~path~ must point to MathJax 4 or later.
+
+See the updated ~org-html-mathjax-options~ for more details.
+
+MathJax 3, a ground-up rewrite of MathJax 2 came out in 2019.  The new
+version brings modularity, better and faster rendering, improved LaTeX
+support, and more.
+
+For more information about new features, see:
+
+https://docs.mathjax.org/en/latest/upgrading/whats-new-3.0.html
+https://docs.mathjax.org/en/latest/upgrading/whats-new-3.1.html
+https://docs.mathjax.org/en/latest/upgrading/whats-new-3.2.html
+
+MathJax 3 comes with useful extensions.  For instance, you can typeset
+calculus with the ~physics~ extension or chemistry with the ~mhchem~
+extension, like in LaTeX.
+
+Note that the Org manual does not discuss loading of MathJax
+extensions via ~+HTML_MATHJAX~ anymore.  It has never worked anyway.
+To actually load extensions, consult the official documentation:
+
+https://docs.mathjax.org/en/latest/input/tex/extensions.html
+
+Lastly, MathJax 3 changed the default JavaScript content delivery
+network (CDN) provider from CloudFlare to jsDelivr.  You can find the
+new terms of service, including the privacy policy, at
+https://www.jsdelivr.com/terms.
+
+*** List references in source block variable assignments are now proper lists
+
+List representation of named lists is now converted to a simple list
+as promised by the manual section [[info:org#Environment of a Code 
Block][org#Environment of a Code Block]].
+Previously, it was converted to a list of lists.
+
+Before:
+
+#+begin_src org
+,#+NAME: example-list
+- simple
+  - not
+  - nested
+- list
+
+,#+BEGIN_SRC emacs-lisp :var x=example-list :results value
+(format "%S" x)
+,#+END_SRC
+
+,#+RESULTS:
+: (("simple" (unordered ("not") ("nested"))) ("list"))
+#+end_src
+
+After:
+
+#+begin_src org
+,#+BEGIN_SRC emacs-lisp :var x=example-list :results value
+(format "%S" x)
+,#+END_SRC
+
+,#+RESULTS:
+: ("simple" "list")
+#+end_src
+
+** New features
+*** Clock table can now produce quarterly reports
+
+=:step= clock table parameter can now be set to =quarter=.
+*** Publishing now supports links to encrypted Org files
+
+Links to other published Org files are automatically converted to the
+corresponding html links.  Now, this feature is also available when
+links point to encrypted Org files, like
+=[[file:foo.org.gpg::Heading]]=.
+
+*** Interactive commands now support escaping text inside comment blocks
+
+~org-edit-special~ and ~org-insert-structure-template~ now handle
+comment blocks.
+
+See [[*New command ~org-edit-comment-block~ to edit comment block at
+point]].
+
+*** New customization option =org-property-separators=
+A new alist variable to control how properties are combined.
+
+If a property is specified multiple times with a =+=, like
+
+#+begin_src org
+:PROPERTIES:
+:EXPORT_FILE_NAME: some/path
+:EXPORT_FILE_NAME+: to/file
+:END:
+#+end_src
+
+the old behavior was to always combine them with a single space
+(=some/path to/file=).  For the new variable, the car of each item in
+the alist should be either a list of property names or a regular
+expression, while the cdr should be the separator to use when
+combining that property.
+
+The default value for the separator is a single space, if none of the
+provided items in the alist match a given property.
+
+For example, in order to combine =EXPORT_FILE_NAME= properties with a
+forward slash =/=, one can use
+
+#+begin_src emacs-lisp
+(setq org-property-separators '((("EXPORT_FILE_NAME") . "/")))
+#+end_src
+
+The example above would then produce the property value
+=some/path/to/file=.
+
+*** New library =org-persist.el= implements variable persistence across Emacs 
sessions
+
+The library stores variable data in ~org-persist-directory~ (set to XDG
+cache dir by default).
+
+The entry points are ~org-persist-register~, ~org-persist-unregister~,
+~org-persist-read~, and ~org-persist-read-all~.  Storing circular
+structures is supported.  Storing references between different
+variables is also supported (see =:inherit= key in
+~org-persist-register~).
+
+The library permits storing buffer-local variables.  Such variables
+are linked to the buffer text, file =inode=, and file path.
+
+*** New =:options= attribute when exporting tables to LaTeX
+
+The =:options= attribute allows adding an optional argument with a
+list of various table options (between brackets in LaTeX export),
+since certain tabular environments, such as longtblr of the
+tabularray LaTeX package, provides this structure.
+
+*** New =:compact= attribute when exporting lists to Texinfo
+
+The =:compact= attribute allows exporting multiple description list
+items to one =@item= command and one or more =@itemx= commands.  This
+feature can also be enabled for all description lists in a file using
+the =compact-itemx= export option, or globally using the
+~org-texinfo-compact-itemx~ variable.
+
+*** New shorthands recognized when exporting to Texinfo
+
+Items in a description list that begin with =Function:=, =Variable:=
+or certain related prefixes are converted using Texinfo definition
+commands.
+*** New =:noweb-prefix= babel header argument
+
+=:noweb-prefix= can be set to =no= to prevent the prefix characters
+from being repeated when expanding a multiline noweb reference.
+
+*** New =:noweb= babel header argument value =strip-tangle=
+
+=:noweb= can be set to =strip-tangle= to strip the noweb syntax references
+before tangling.
+
+*** New LaTeX source block backend using =engraved-faces-latex=
+
+When ~org-latex-src-block-backend~ is set to ~engraved~,
+=engrave-faces-latex= from 
[[http://elpa.gnu.org/packages/engrave-faces.html][engrave-faces]] is used to 
transcode source
+blocks to LaTeX. This requires the =fvextra=, =float=, and (by
+default, but not necessarily) =tcolorbox= LaTeX packages be
+installed. It uses Emacs' font-lock information, and so tends to
+produce results superior to Minted or Listings.
+*** Support for =#+include=-ing URLs
+
+=#+include: FILE= will now accept URLs as the file.
+*** Structure templates now respect case used in ~org-structure-template-alist~
+
+The block type in ~org-structure-template-alist~ is not case-sensitive.
+When the block type starts from the upper case, structure template
+will now insert =#+BEGIN_TYPE=.  Previously, lower-case =#+begin_type= was 
inserted unconditionally.
+*** New ox-latex tabbing support for tables.
+
+Latex tables can now be exported to the latex tabbing environment
+tabbing environment]].
+This is done by adding =#+ATTR_LATEX: :mode tabbing= at the top
+of the table.
+The default column width is set to 1/n times the latex textwidth,
+where n is the number of columns.
+This behavior can be changed by supplying a =:align= parameter.
+
+The tabbing environment can be useful when generating simple tables which
+can be span multiple pages and when table cells are allowed to overflow.
+*** Support for =nocite= citations and sub-bibliographies in the "csl" export 
processor
+
+The "csl" citation export processor now supports =nocite= style
+citations that add items to the printed bibliography without visible
+references in the text. Using the key =*= in a nocite citation, for
+instance,
+
+#+begin_src org
+[cite/n:@*]
+#+end_src
+
+includes all available items in the printed bibliography.
+
+The "csl" export processor now also supports sub-bibliographies that
+show only a subset of the references based on some criterion.  For
+example,
+
+#+begin_src org
+#+print_bibliography: :type book :keyword ai
+#+end_src
+
+prints a sub-bibliography containing the book entries with =ai= among
+their keywords.
+*** New =:filetitle= option for clock table
+
+The =:filetitle= option for clock tables can be set to ~t~ to show org
+file title (set by =#+title:=) in the File column instead of the
+file name.  For example:
+
+#+begin_src org
+,#+BEGIN: clocktable :scope agenda :maxlevel 2 :block thisweek :filetitle t
+#+end_src
+
+If a file does not have a title, the table will show the file name
+instead.
+*** New =org-md-toplevel-hlevel= variable for Markdown export
+
+The =org-md-toplevel-hlevel= customization variable sets the heading
+level used for top level headings, much like how
+=org-html-toplevel-hlevel= sets the heading level used for top level
+headings in HTML export.
+*** Babel: new syntax to pass the contents of a src block as argument
+
+Use the header argument =:var x=code-block[]= or
+: #+CALL: fn(x=code-block[])
+to pass the contents of a named code block as a string argument.
+*** New property =ORG-IMAGE-ACTUAL-WIDTH= for overriding global 
~org-image-actual-width~
+
+The new property =ORG-IMAGE-ACTUAL-WIDTH= can override the global
+variable ~org-image-actual-width~ value for inline images display width.
+
+*** Outline cycling can now include inline image visibility
+
+New ~org-cycle-hook~ function ~org-cycle-display-inline-images~ for
+auto-displaying inline images in the visible parts of the subtree.
+This behavior is controlled by new custom option
+~org-cycle-inline-images-display~.
+
+*** New ~org-babel-tangle-finished-hook~ hook run at the very end of 
~org-babel-tangle~
+
+This provides a proper counterpart to ~org-babel-pre-tangle-hook~, as
+~org-babel-post-tangle-hook~ is run
+per-tangle-destination. ~org-babel-tangle-finished-hook~ is just run
+once after the post tangle hooks.
+
+*** New =:backend= header argument for clojure code blocks
+
+The =:backend= header argument on clojure code blocks can override the
+value of ~org-babel-clojure-backend~. For example:
+
+#+begin_src clojure :backend babashka
+(range 2)
+#+end_src
+
+*** New =:results discard= header argument
+
+Unlike =:results none=, the return value of code blocks called with
+=:results discard= header argument is always ~nil~.  Org does not
+attempt to analyze the results and simply returns nil.  This can be
+useful when the code block is used for side effects only but generates
+large outputs that may be slow to analyze for Org.
+
+*** Add Capture template hook properties
+
+Capture templates can now attach template specific hooks via the
+following properties: ~:hook~, ~:prepare-finalize~,
+~:before-finalize~, ~:after-finalize~.  These nullary functions run
+prior to their global counterparts for the selected template.
+
+** New options
+*** A new option for custom setting ~org-refile-use-outline-path~ to show 
document title in refile targets
+
+Setting ~org-refile-use-outline-path~ to ~'title~ will show title
+instead of the file name in refile targets.  If the document do not have
+a title, the filename will be used, similar to ~'file~ option.
+
+*** A new option for custom setting ~org-agenda-show-outline-path~ to show 
document title
+
+Setting ~org-agenda-show-outline-path~ to ~'title~ will show title
+instead of the file name at the beginning of the outline.  The title of
+the document can be set by special keyword =#+title:=.
+
+*** New custom settings =org-icalendar-scheduled-summary-prefix= and 
=org-icalendar-deadline-summary-prefix=
+
+These settings allow users to define prefixes for exported summary
+lines in ICS exports.  The customization can be used to disable
+the prefixes completely or make them a little bit more verbose
+(e.g. "Deadline: " instead of the default "DL: ").
+
+The same settings can also be applied via corresponding exporter
+options:
+=:icalendar-scheduled-summary-prefix=,
+=:icalendar-deadline-summary-prefix=
+
+*** A new custom setting =org-hide-drawer-startup= to control initial folding 
state of drawers
+
+Previously, all the drawers were always folded when opening an Org
+file.  This only had an effect on the drawers outside folded
+headlines.  The drawers inside folded headlines were re-folded because
+=org-cycle-hide-drawers= was present inside =org-cycle-hook=.
+
+With the new folding backend, running =org-cycle-hide-drawers= is no
+longer needed if all the drawers are truly folded on startup: [[*Folding
+state of the drawers is now preserved when cycling headline
+visibility]].  However, this has an unwanted effect when a user does
+not want the drawers to be folded (see 
[[https://orgmode.org/list/m2r14f407q.fsf@ntnu.no][this bug report]]).
+
+The new custom setting gives more control over initial folding state
+of the drawers.  When set to =nil= (default is =t=), the drawers are
+not folded on startup.
+
+The folding state can also be controlled on per-file basis using
+=STARTUP= keyword:
+
+: #+startup: hidedrawers
+: #+startup: nohidedrawers
+
+*** New custom setting ~org-icalendar-force-alarm~
+
+The new setting, when set to non-nil, makes Org create alarm at the
+event time when the alarm time is set to 0.  The default value is
+nil -- do not create alarms at the event time.
+
+*** New special value ~'attach~ for src block =:dir= option
+
+Passing the symbol ~attach~ or string ="'attach"= (with quotes) to the =:dir=
+option of a src block is now equivalent to =:dir (org-attach-dir) :mkdir yes=
+and any file results with a path descended from the attachment directory will
+use =attachment:= style links instead of the standard =file:= link type.
+
+** New functions and changes in function arguments
+*** New function ~org-get-title~ to get =#+TITLE:= property from buffers
+
+A function to collect the document title from the org-mode buffer.
+
+*** ~org-fold-show-entry~ does not fold drawers by default anymore
+
+~org-fold-show-entry~ now accepts an optional argument HIDE-DRAWERS.
+When the argument is non-nil, the function folds all the drawers
+inside entry.  This was the default previously.
+
+Now, ~org-fold-show-entry~ does not fold drawers by default.
+
+*** New command ~org-edit-comment-block~ to edit comment block at point
+
+As the contents of comments blocks is not parsed as Org markup, the
+headlines and keywords inside should be escaped, similar to src
+blocks, example blocks, and export blocks.  This in inconvenient to do
+manually and ~org-edit-special~ is usually advised to edit text in
+such kind of blocks.
+
+Now, comment block editing is also supported via this new function.
+
+*** New function ~org-element-cache-map~ for quick mapping across Org elements
+
+When element cache is enabled, the new function provides the best
+possible performance to map across large Org buffers.
+
+It is recommended to provide =:next-re= and =:fail-re= parameters for
+best speed.
+
+Diagnostic information about execution speed can be provided according
+to ~org-element--cache-map-statistics~ and
+~org-element--cache-map-statistics-threshold~.
+
+~org-scan-tags~ and tag views in agenda utilize the new function.
+*** New function ~org-element-at-point-no-context~
+
+This function is like ~org-element-at-point~, but it does not try to
+update the cache and does not guarantee correct =:parent= properties
+for =headline= elements.
+
+This function is faster than ~org-element-at-point~ when used together
+with frequent buffer edits.
+*** Various Org API functions now use cache and accept Org elements as 
optional arguments
+
+~org-in-archived-heading-p~, ~org-in-commented-heading-p~,
+~org-up-heading-safe~, ~org-end-of-subtree~, ~org-goto-first-child~,
+~org-back-to-heading~, ~org-entry-get-with-inheritance~, and
+~org-narrow-to-subtree~ all accept Org element as an extra optional
+argument.
+
+~org-get-tags~ now accepts Org element or buffer position as first
+argument.
+
+*** New function ~org-texinfo-kbd-macro~
+
+This function is intended for us in the definition of a ~kbd~ macro in
+files that are exported to Texinfo.
+
+*** =org-at-heading-p= now recognizes optional argument. Its meaning is 
inverted.
+
+=org-at-heading-p= now returns t by default on headings inside folds.
+Passing optional argument will produce the old behavior.
+
+*** =org-babel-execute:plantuml= can output ASCII graphs in the buffer
+
+Previously, executing PlantUML src blocks always exported to a file.  Now, if
+:results is set to a value which does not include "file", no file will be
+exported and an ASCII graph will be inserted below the src block.
+
+** Removed or renamed functions and variables
+*** =org-plantump-executable-args= is renamed and applies to jar as well
+
+The new variable name is =org-plantuml-args=.  It now applies to both
+jar PlantUML file and executable.
+*** Default values and interpretations of ~org-time-stamp-formats~ and 
~org-time-stamp-custom-formats~ are changed
+
+Leading =<= and trailing =>= in the default values of
+~org-time-stamp-formats~ and ~org-time-stamp-custom-formats~ are
+stripped.
+
+The Org functions that are using these variables also ignore leading
+and trailing brackets (=<...>= and =[...]=, if present).
+
+This change makes the Org code more consistent and also makes the
+docstring for ~org-time-stamp-custom-formats~ accurate.
+
+No changes on the user side are needed if
+~org-time-stamp-custom-formats~ was customized.
+*** ~org-timestamp-format~ is renamed to ~org-format-timestamp~
+
+The old function name is similar to other ~org-time-stamp-format~
+function.  The new name emphasizes that ~org-format-timestamp~ works
+on =timestamp= objects.
+
+*** Updated argument list in ~org-time-stamp-format~
+
+New =custom= argument in ~org-time-stamp-format~ makes the function
+use ~org-time-stamp-custom-formats~ instead of
+~org-time-stamp-formats~ to determine the format.
+
+Optional argument =long= is renamed to =with-time=, emphasizing that it refers 
to time stamp format with time specification.
+
+Optional argument =inactive= can now have a value =no-brackets= to
+return format string with brackets stripped.
+
+** Miscellaneous
+*** SQL Babel ~:dbconnection~ parameter can be mixed with other SQL Babel 
parameters
+
+Before you could either specify SQL parameters like ~:dbhost~,
+~:dbuser~, ~:database~, etc or a ~:dbconnection~ parameter which looks
+up all other parameters from the ~sql-connection-alist~ variable.  Now
+it's possible to specify a ~:dbconnection~ and additionally other
+parameters that will add or overwrite the parameters coming from
+~sql-connection-alist~.
+
+E.g. if you have a connection in your ~sql-connection-alist~ to a
+server that has many databases, you don't need an entry for every
+database but instead can just specify ~:database~ next to your
+~:dbconnection~ parameter.
+
+*** Post-processing code blocks can return an empty list
+
+When the result of a regular code block is nil, then that was already
+treated as an empty list.  Now that is also the case for code blocks
+that post-process the result of another block.
+
+*** Styles are customizable in ~biblatex~ citation processor
+
+It is now possible to add new styles or modify old ones in ~biblatex~
+citation processor.  See ~org-cite-biblatex-styles~ for more
+information.
+
+*** Citation processors can declare styles dynamically
+
+When a citation processor is registered, it is now possible to set
+~:cite-styles~ key to a function, which will be called whenever the
+list of styles is required.
+
+*** Org also searches for CSL style files in default directory
+
+When CSL style file name is relative, Org first looks into
+default-directory before trying ~org-cite-csl-styles-dir~.
+
+*** Users can add checkers to the linting process
+
+The function ~org-lint-add-checker~ allows one to add personal checks
+when calling ~org-lint~.   See its docstring for more information.
+
+*** New =transparent-image-converter= property for =dvipng=
+
+The =dvipng= option in ~org-preview-latex-process-alist~ has a new
+property =transparent-image-converter= which is used instead of
+=image-converter= when producing transparent images.
+
+*** =:tangle-mode= now accepts more permissions formats
+
+Previously =:tangle-mode (identity #o755)= was the only reasonable way
+to set the file mode. ~org-babel-interpret-file-mode~ has been
+introduced which will accept three new formats:
++ Short octals, e.g. =:tangle-mode o755=
++ ls-style, e.g. =:tangle-mode rwxrw-rw-=
++ chmod-style, e.g. =:tangle-mode u+x=
+
+Chmod-style permissions are based on the new variable
+~org-babel-tangle-default-file-mode~.
+
+*** A new custom setting =org-agenda-clock-report-header= to add a header to 
org agenda clock report
+
+*** ~org-latex-listings~ has been replaced with ~org-latex-src-block-backend~
+
+~org-latex-listings~ has been renamed to better reflect the current
+purpose of the variable.  The replacement variable
+~org-latex-src-block-backend~ acts in exactly the same way, however it
+accepts =listings= and =verbatim= in place of =t= and =nil= (which
+still work, but are no longer listed as valid options).
+
+*** ~org-link-parameters~ has a new ~:insert-description~ parameter
+
+The value of ~:insert-description~ is used as the initial input when
+prompting for a link description.  It can be a string (used as-is) or
+a function (called with the same arguments as
+~org-make-link-description-function~ to return a string to use).
+
+An example of a such function for =info:= links is
+~org-info-description-as-command~.  To access a manual section outside
+of Org, description may be pasted to shell prompt or evaluated within
+Emacs using =M-:= (wrapped into parenthesis).  For example,
+description of the =info:org#Tags= link is =info "(org) Tags"=.  To
+restore earlier behavior add to your Emacs init file the following:
+#+begin_src elisp :results silent :eval never-export
+  (with-eval-after-load 'ol-info
+    (org-link-set-parameters "info" :insert-description nil))
+#+end_src
+
+*** New list of languages for LaTeX export: ~org-latex-language-alist~
+
+~org-latex-language-alist~ unifies into a single list the old language
+lists for the =babel= and =polyglossia= LaTeX packages:
+~org-latex-babel-language-alist~ and
+~org-latex-polyglossia-language-alist~, respectively, which are
+declared obsolete.
+
+This new list captures the current state of art regarding language
+support in LaTeX.  The new =babel= syntax for loading languages via
+=ini= files and the new command =\babelprovide= (see:
+https://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf)
+are also supported.
+*** Texinfo exports include LaTeX
+
+With the new customization option ~org-texinfo-with-latex~ set to (its
+default value) ~'detect~, if the system runs Texinfo 6.8 (3 July 2021)
+or newer, Org will export all LaTeX fragments and environments using
+Texinfo ~@math~ and ~@displaymath~ commands respectively.
+*** More flexible ~org-attach-id-to-path-function-list~
+
+List entries may return nil if they are unable to handle the passed
+ID.  So, responsibility is passed to the next item in the list.
+Default entries ~org-attach-id-uuid-folder-format~ and
+~org-attach-id-ts-folder-format~ now return nil for too short IDs.
+Earlier an obscure error has been thrown.
+
+After the change, error text suggests adjusting
+~org-attach-id-to-path-function-list~ value.  The
+~org-attach-dir-from-id~ function is adapted to ignore nil values and
+to take first non-nil value instead of the value returned by first
+~org-attach-id-to-path-function-list~ item.
+
+New policy allows mixing different ID styles while keeping subfolder
+layout suited best for each one.  For example, one can use the
+following snippet to allow multiple different ID formats in Org files.
+
+#+begin_src emacs-lisp
+(setq org-attach-id-to-path-function-list
+      '(;; When ID looks like an UUIDs or Org internal ID, use
+        ;; `org-attach-id-uuid-folder-format'.
+        (lambda (id)
+          (and (or (org-uuidgen-p id)
+                  (string-match-p "[0-9a-z]\\{12\\}" id))
+              (org-attach-id-uuid-folder-format id)))
+        ;; When ID looks like a timestap-based ID. Group by year-month
+        ;; folders.
+        (lambda (id)
+          (and (string-match-p "[0-9]\\{8\\}T[0-9]\\{6\\}\.[0-9]\\{6\\}" id)
+               (org-attach-id-ts-folder-format id)))
+        ;; Any other ID goes into "important" folder.
+        (lambda (id) (format "important/%s/%s" (substring id 0 1) id))
+        ;; Fallback to detect existing attachments for old defaults.
+        ;; All the above functions, even when return non-nil, would
+        ;; point to non-existing folders.
+        org-attach-id-uuid-folder-format
+        org-attach-id-ts-folder-format))
+#+end_src
+
 * Version 9.5
 
 ** Important announcements and breaking changes
@@ -1466,6 +2202,7 @@ the headline to use for making the table of contents.
 ,* Another section
 ,#+TOC: headlines 1 :target "#TargetSection"
 #+end_example
+
 ** New functions
 *** ~org-dynamic-block-insert-dblock~
 
@@ -1756,6 +2493,7 @@ CIDER version which has not =sesman= integrated, only has
 (dissoc Clojure 'JVM)
 (conj clojurists "stardiviner")
 #+end_src
+
 *** Add ~:results link~ support for Babel
 
 With this output format, create a link to the file specified in
@@ -1774,14 +2512,17 @@ wget -c 
"https://ben.akrin.com/crackzor/crackzor_1.0.c.gz";
 #+begin_src js :session "*Javascript REPL*"
 console.log("stardiviner")
 #+end_src
+
 *** Add ~:session~ support of ob-js for Indium
 #+begin_src js :session "*JS REPL*"
 console.log("stardiviner")
 #+end_src
+
 *** Add ~:session~ support of ob-js for skewer-mode
 #+begin_src js :session "*skewer-repl*"
 console.log("stardiviner")
 #+end_src
+
 *** Add support for links to LaTeX equations in HTML export
 Use MathJax links when enabled (by ~org-html-with-latex~), otherwise
 add a label to the rendered equation.
@@ -1868,6 +2609,7 @@ you should expect to see something like:
 #+BEGIN_EXAMPLE
   ,#+STARTUP: shrink
 #+END_EXAMPLE
+
 *** Allow to filter by tags/property when capturing colview
 
 You can now use =:match= to filter entries using a todo/tags/properties
@@ -2250,6 +2992,7 @@ To use =vertica= in an sql =SRC_BLK= set the =:engine= 
like this:
   SELECT * FROM nodes;
   ,#+END_SRC
 #+END_EXAMPLE
+
 **** C++: New header ~:namespaces~
 
 The new ~:namespaces~ export option can be used to specify namespaces
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 2169ed0f80..f114049985 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -1227,6 +1227,20 @@ you should use an Emacs input method instead.
 
 * X runtime problems
 
+** X security problems
+
+*** Emacs faces trouble when running as an untrusted client.
+
+When Emacs is running as an untrusted client under X servers with the
+Security extension, it is unable to use some window manager features
+but reports them to the window manager anyway.  This can lead to
+constant prompting by the window manager about Emacs being
+unresponsive.  To resolve the problem, place:
+
+  (setq x-detect-server-trust t)
+
+in your early-init.el.
+
 ** X keyboard problems
 
 *** `x-focus-frame' fails to activate the frame.
@@ -1698,8 +1712,8 @@ which can be carried out at the same time:
 
 7) If selecting text with the mouse is slow, the main culprit is
    likely `select-active-regions', coupled with a program monitoring
-   the clipboard on the X server you are connected to.  Try turning
-   that off.
+   the clipboard or primary selection on the X server you are
+   connected to.  Try turning that off.
 
    However, over networks with moderate to high latency, with no
    clipboard monitor running, the bottleneck is likely to be
@@ -1709,6 +1723,12 @@ which can be carried out at the same time:
    cause Emacs features that relies on accurate mouse position
    reporting to stop working reliably.
 
+8) If creating or resizing frames is slow, turn off
+   `frame-resize-pixelwise' (this will not take effect until you
+   create a new frame); then, enable `x-lax-frame-positioning'.  This
+   means frame placement will be less accurate, but makes frame
+   creation, movement, and resize visibly faster.
+
 *** Emacs gives the error, Couldn't find per display information.
 
 This can result if the X server runs out of memory because Emacs uses
diff --git a/etc/org/README b/etc/org/README
index aac788d3c6..af15f95ab0 100644
--- a/etc/org/README
+++ b/etc/org/README
@@ -21,7 +21,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.
 
 Author: Jambunathan K <kjambunathan at gmail dot com>
 Keywords: outlines, hypermedia, calendar, wp
-Homepage: https://orgmode.org
+URL: https://orgmode.org
 
 Commentary:
 
diff --git a/etc/publicsuffix.txt b/etc/publicsuffix.txt
index 025cf47274..60d72fd0d5 100644
--- a/etc/publicsuffix.txt
+++ b/etc/publicsuffix.txt
@@ -7171,7 +7171,7 @@ org.zw
 
 // newGTLDs
 
-// List of new gTLDs imported from 
https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 
2022-10-29T15:16:24Z
+// List of new gTLDs imported from 
https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 
2022-11-29T15:14:18Z
 // This list is auto-generated, don't edit it manually.
 // aaa : 2015-02-26 American Automobile Association, Inc.
 aaa
@@ -7221,9 +7221,6 @@ aco
 // actor : 2013-12-12 Dog Beach, LLC
 actor
 
-// adac : 2015-07-16 Allgemeiner Deutscher Automobil-Club e.V. (ADAC)
-adac
-
 // ads : 2014-12-04 Charleston Road Registry Inc.
 ads
 
@@ -8511,7 +8508,7 @@ hisamitsu
 // hitachi : 2014-10-31 Hitachi, Ltd.
 hitachi
 
-// hiv : 2014-03-13 UNR Corp.
+// hiv : 2014-03-13 Internet Naming Company LLC
 hiv
 
 // hkt : 2015-05-14 PCCW-HKT DataCom Services Limited
@@ -8715,7 +8712,7 @@ jpmorgan
 // jprs : 2014-09-18 Japan Registry Services Co., Ltd.
 jprs
 
-// juegos : 2014-03-20 UNR Corp.
+// juegos : 2014-03-20 Internet Naming Company LLC
 juegos
 
 // juniper : 2015-07-30 JUNIPER NETWORKS, INC.
@@ -9441,7 +9438,7 @@ promo
 // properties : 2013-12-05 Binky Moon, LLC
 properties
 
-// property : 2014-05-22 UNR Corp.
+// property : 2014-05-22 Internet Naming Company LLC
 property
 
 // protection : 2015-04-23 XYZ.COM LLC
@@ -9717,7 +9714,7 @@ sew
 // sex : 2014-11-13 ICM Registry SX LLC
 sex
 
-// sexy : 2013-09-11 UNR Corp.
+// sexy : 2013-09-11 Internet Naming Company LLC
 sexy
 
 // sfr : 2015-08-13 Societe Francaise du Radiotelephone - SFR
@@ -10065,7 +10062,7 @@ travelers
 // travelersinsurance : 2015-03-26 Travelers TLD, LLC
 travelersinsurance
 
-// trust : 2014-10-16 UNR Corp.
+// trust : 2014-10-16 Internet Naming Company LLC
 trust
 
 // trv : 2015-03-26 Travelers TLD, LLC
@@ -10658,6 +10655,10 @@ graphox.us
 // Submitted by Craig Jellick <domains@acorn.io>
 *.on-acorn.io
 
+// ActiveTrail: https://www.activetrail.biz/
+// Submitted by Ofer Kalaora <postmaster@activetrail.com>
+activetrail.biz
+
 // Adobe : https://www.adobe.com/
 // Submitted by Ian Boston <boston@adobe.com> and Lars Trieloff 
<trieloff@adobe.com>
 adobeaemcloud.com
@@ -10702,6 +10703,10 @@ altervista.org
 // Submitted by Cyril <admin@alwaysdata.com>
 alwaysdata.net
 
+// Amaze Software : https://amaze.co
+// Submitted by Domain Admin <domainadmin@amaze.co>
+myamaze.net
+
 // Amazon : https://www.amazon.com/
 // Submitted by AWS Security <psl-maintainers@amazon.com>
 // Subsections of Amazon/subsidiaries will appear until "concludes" tag
@@ -11178,8 +11183,11 @@ cloudcontrolapp.com
 
 // Cloudflare, Inc. : https://www.cloudflare.com/
 // Submitted by Cloudflare Team <publicsuffixlist@cloudflare.com>
-pages.dev
+cf-ipfs.com
+cloudflare-ipfs.com
 trycloudflare.com
+pages.dev
+r2.dev
 workers.dev
 
 // Clovyr : https://clovyr.io
@@ -12447,7 +12455,6 @@ herokussl.com
 // Hibernating Rhinos
 // Submitted by Oren Eini <oren@ravendb.net>
 ravendb.cloud
-myravendb.com
 ravendb.community
 ravendb.me
 development.run
@@ -13809,6 +13816,8 @@ direct.quickconnect.to
 // Tabit Technologies Ltd. : https://tabit.cloud/
 // Submitted by Oren Agiv <oren@tabit.cloud>
 tabitorder.co.il
+mytabit.co.il
+mytabit.com
 
 // TAIFUN Software AG : http://taifun-software.de
 // Submitted by Bjoern Henke <dev-server@taifun-software.de>
@@ -13841,10 +13850,6 @@ telebit.app
 telebit.io
 *.telebit.xyz
 
-// The Gwiddle Foundation : https://gwiddlefoundation.org.uk
-// Submitted by Joshua Bayfield <joshua.bayfield@gwiddlefoundation.org.uk>
-gwiddle.co.uk
-
 // Thingdust AG : https://thingdust.com/
 // Submitted by Adrian Imboden <adi@thingdust.com>
 *.firenet.ch
@@ -13879,10 +13884,6 @@ pages.torproject.net
 bloxcms.com
 townnews-staging.com
 
-// TradableBits: https://tradablebits.com
-// Submitted by Dmitry Khrisanov dmitry@tradablebits.com
-tbits.me
-
 // TrafficPlex GmbH : https://www.trafficplex.de/
 // Submitted by Phillipp Röll <phillipp.roell@trafficplex.de>
 12hp.at
diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex
index 9462df8574..654d76ced8 100644
--- a/etc/refcards/orgcard.tex
+++ b/etc/refcards/orgcard.tex
@@ -1,5 +1,5 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{9.5.5}
+\def\orgversionnumber{9.6}
 \def\versionyear{2021}          % latest update
 \input emacsver.tex
 
diff --git a/etc/refcards/ru-refcard.tex b/etc/refcards/ru-refcard.tex
index 40af641468..50a22891a6 100644
--- a/etc/refcards/ru-refcard.tex
+++ b/etc/refcards/ru-refcard.tex
@@ -40,7 +40,7 @@
 \newlength{\ColThreeWidth}
 \setlength{\ColThreeWidth}{25mm}
 
-\newcommand{\versionemacs}[0]{29} % version of Emacs this is for
+\newcommand{\versionemacs}[0]{30} % version of Emacs this is for
 \newcommand{\cyear}[0]{2022}       % copyright year
 
 \newcommand\shortcopyrightnotice[0]{\vskip 1ex plus 2 fill
diff --git a/lib-src/ChangeLog.1 b/lib-src/ChangeLog.1
index 0829f50a56..c5988072e9 100644
--- a/lib-src/ChangeLog.1
+++ b/lib-src/ChangeLog.1
@@ -3661,7 +3661,7 @@
 2004-05-07  Thien-Thi Nguyen  <ttn@gnu.org>
 
        * b2m.c (GOOD, BAD): Delete macros.  Throughout,
-       replace w/ `EXIT_SUCCESS' and `EXIT_FAILURE', respectively.
+       replace with `EXIT_SUCCESS' and `EXIT_FAILURE', respectively.
        (main): Use `EXIT_SUCCESS' or `EXIT_FAILURE' for return value.
 
        * etags.c: Likewise.
diff --git a/lib-src/be_resources.cc b/lib-src/be_resources.cc
index 414f91a192..ece573a85a 100644
--- a/lib-src/be_resources.cc
+++ b/lib-src/be_resources.cc
@@ -71,9 +71,11 @@ be_perror (status_t code, char *arg)
        }
     }
   else
-    {
-      abort ();
-    }
+    abort ();
+
+  fprintf (stderr, "Setting resources failed on the `src/Emacs' binary.\n"
+          "This may result in the installed `Emacs' binary not launching\n"
+          " from the tracker, but is inconsequential during packaging.\n");
 }
 
 int
@@ -111,19 +113,19 @@ main (int argc, char **argv)
   if (code != B_OK)
     {
       be_perror (code, argv[2]);
-      return EXIT_FAILURE;
+      return 0;
     }
   code = info.SetTo (&file);
   if (code != B_OK)
     {
       be_perror (code, argv[2]);
-      return EXIT_FAILURE;
+      return 0;
     }
   code = info.SetAppFlags (B_EXCLUSIVE_LAUNCH | B_ARGV_ONLY);
   if (code != B_OK)
     {
       be_perror (code, argv[2]);
-      return EXIT_FAILURE;
+      return 0;
     }
 
   icon = BTranslationUtils::GetBitmapFile (argv[1], NULL);
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index ee124ea135..af488128ba 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -568,6 +568,7 @@ decode_options (int argc, char **argv)
         case 't':
          tty = true;
          create_frame = true;
+         reuse_frame = false;
           break;
 
         case 'c':
@@ -576,7 +577,8 @@ decode_options (int argc, char **argv)
 
        case 'r':
          create_frame = true;
-         reuse_frame = true;
+         if (!tty)
+           reuse_frame = true;
          break;
 
        case 'p':
@@ -689,7 +691,7 @@ The following OPTIONS are accepted:\n\
                        Set the parameters of a new frame\n\
 -e, --eval             Evaluate the FILE arguments as ELisp expressions\n\
 -n, --no-wait          Don't wait for the server to return\n\
--w, --timeout          Seconds to wait before timing out\n\
+-w, --timeout=SECONDS  Seconds to wait before timing out\n\
 -q, --quiet            Don't display messages on success\n\
 -u, --suppress-output   Don't display return values from the server\n\
 -d DISPLAY, --display=DISPLAY\n\
diff --git a/lib-src/etags.c b/lib-src/etags.c
index ed8a218464..280b5b9df2 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -375,7 +375,7 @@ static void just_read_file (FILE *);
 
 static language *get_language_from_langname (const char *);
 static void readline (linebuffer *, FILE *);
-static ptrdiff_t readline_internal (linebuffer *, FILE *, char const *);
+static ptrdiff_t readline_internal (linebuffer *, FILE *, char const *, const 
bool);
 static bool nocase_tail (const char *);
 static void get_tag (char *, char **);
 static void get_lispy_tag (char *);
@@ -399,7 +399,12 @@ static void free_fdesc (fdesc *);
 static void pfnote (char *, bool, char *, ptrdiff_t, intmax_t, intmax_t);
 static void invalidate_nodes (fdesc *, node **);
 static void put_entries (node *);
+static void cleanup_tags_file (char const * const, char const * const);
 
+#if !MSDOS && !defined (DOS_NT)
+static char *escape_shell_arg_string (char *);
+#endif
+static void do_move_file (const char *, const char *);
 static char *concat (const char *, const char *, const char *);
 static char *skip_spaces (char *);
 static char *skip_non_spaces (char *);
@@ -774,7 +779,7 @@ static const char Rust_help [] =
 
 /* Can't do the `SCM' or `scm' prefix with a version number. */
 static const char *Scheme_suffixes [] =
-  { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
+  { "oak", "rkt", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
 static const char Scheme_help [] =
 "In Scheme code, tags include anything defined with 'def' or with a\n\
 construct whose name starts with 'def'.  They also include\n\
@@ -1332,7 +1337,7 @@ main (int argc, char **argv)
                  if (parsing_stdin)
                    fatal ("cannot parse standard input "
                           "AND read file names from it");
-                 while (readline_internal (&filename_lb, stdin, "-") > 0)
+                 while (readline_internal (&filename_lb, stdin, "-", false) > 
0)
                    process_file_name (filename_lb.buffer, lang);
                }
              else
@@ -1380,9 +1385,6 @@ main (int argc, char **argv)
   /* From here on, we are in (CTAGS && !cxref_style) */
   if (update)
     {
-      char *cmd =
-       xmalloc (strlen (tagfile) + whatlen_max +
-                sizeof "mv..OTAGS;grep -Fv '\t\t' OTAGS >;rm OTAGS");
       for (i = 0; i < current_arg; ++i)
        {
          switch (argbuffer[i].arg_type)
@@ -1393,17 +1395,8 @@ main (int argc, char **argv)
            default:
              continue;         /* the for loop */
            }
-         char *z = stpcpy (cmd, "mv ");
-         z = stpcpy (z, tagfile);
-         z = stpcpy (z, " OTAGS;grep -Fv '\t");
-         z = stpcpy (z, argbuffer[i].what);
-         z = stpcpy (z, "\t' OTAGS >");
-         z = stpcpy (z, tagfile);
-         strcpy (z, ";rm OTAGS");
-         if (system (cmd) != EXIT_SUCCESS)
-           fatal ("failed to execute shell command");
+          cleanup_tags_file (tagfile, argbuffer[i].what);
        }
-      free (cmd);
       append_to_tagfile = true;
     }
 
@@ -1423,7 +1416,7 @@ main (int argc, char **argv)
           setenv ("LC_COLLATE", "C", 1);
           setenv ("LC_ALL", "C", 1); */
        char *cmd = xmalloc (8 * strlen (tagfile) + sizeof "sort -u -o '' ''");
-#if defined WINDOWSNT || defined MSDOS
+#if defined WINDOWSNT || MSDOS
        /* Quote "like this".  No need to escape the quotes in the file name,
           since it is not allowed in file names on these systems.  */
        char *z = stpcpy (cmd, "sort -u -o \"");
@@ -1448,6 +1441,51 @@ main (int argc, char **argv)
   return EXIT_SUCCESS;
 }
 
+/*
+ * Equivalent to: mv tags OTAGS;grep -Fv ' filename ' OTAGS >tags;rm OTAGS
+ */
+static void
+cleanup_tags_file (const char* tagfile, const char* match_file_name)
+{
+  FILE *otags_f = fopen ("OTAGS", "wb");
+  FILE *tag_f = fopen (tagfile, "rb");
+
+  if (otags_f == NULL)
+    pfatal ("OTAGS");
+
+  if (tag_f == NULL)
+    pfatal (tagfile);
+
+  int buf_len = strlen (match_file_name) + sizeof ("\t\t ") + 1;
+  char *buf = xmalloc (buf_len);
+  snprintf (buf, buf_len, "\t%s\t", match_file_name);
+
+  linebuffer line;
+  linebuffer_init (&line);
+  while (readline_internal (&line, tag_f, tagfile, true) > 0)
+    {
+      if (ferror (tag_f))
+        pfatal (tagfile);
+
+      if (strstr (line.buffer, buf) == NULL)
+        {
+          fprintf (otags_f, "%s\n", line.buffer);
+          if (ferror (tag_f))
+            pfatal (tagfile);
+        }
+    }
+  free (buf);
+  free (line.buffer);
+
+  if (fclose (otags_f) == EOF)
+    pfatal ("OTAGS");
+
+  if (fclose (tag_f) == EOF)
+    pfatal (tagfile);
+
+  do_move_file ("OTAGS", tagfile);
+  return;
+}
 
 /*
  * Return a compressor given the file name.  If EXTPTR is non-zero,
@@ -1678,13 +1716,23 @@ process_file_name (char *file, language *lang)
       else
        {
 #if MSDOS || defined (DOS_NT)
-         char *cmd1 = concat (compr->command, " \"", real_name);
-         char *cmd = concat (cmd1, "\" > ", tmp_name);
+         int buf_len =
+           strlen (compr->command)
+           + strlen (" \"\" > \"\"") + strlen (real_name)
+           + strlen (tmp_name) + 1;
+         char *cmd = xmalloc (buf_len);
+         snprintf (cmd, buf_len, "%s \"%s\" > \"%s\"",
+                   compr->command, real_name, tmp_name);
 #else
-         char *cmd1 = concat (compr->command, " '", real_name);
-         char *cmd = concat (cmd1, "' > ", tmp_name);
+         char *new_real_name = escape_shell_arg_string (real_name);
+         char *new_tmp_name = escape_shell_arg_string (tmp_name);
+         int buf_len =
+           strlen (compr->command) + strlen ("  > ") + strlen (new_real_name)
+           + strlen (new_tmp_name) + 1;
+         char *cmd = xmalloc (buf_len);
+         snprintf (cmd, buf_len, "%s %s > %s",
+                   compr->command, new_real_name, new_tmp_name);
 #endif
-         free (cmd1);
          inf = (system (cmd) == -1
                 ? NULL
                 : fopen (tmp_name, "r" FOPEN_BINARY));
@@ -1831,7 +1879,7 @@ find_entries (FILE *inf)
 
   /* Else look for sharp-bang as the first two characters. */
   if (parser == NULL
-      && readline_internal (&lb, inf, infilename) > 0
+      && readline_internal (&lb, inf, infilename, false) > 0
       && lb.len >= 2
       && lb.buffer[0] == '#'
       && lb.buffer[1] == '!')
@@ -6878,7 +6926,7 @@ analyze_regex (char *regex_arg)
        if (regexfp == NULL)
          pfatal (regexfile);
        linebuffer_init (&regexbuf);
-       while (readline_internal (&regexbuf, regexfp, regexfile) > 0)
+       while (readline_internal (&regexbuf, regexfp, regexfile, false) > 0)
          analyze_regex (regexbuf.buffer);
        free (regexbuf.buffer);
        if (fclose (regexfp) != 0)
@@ -7226,11 +7274,13 @@ get_lispy_tag (register char *bp)
 
 /*
  * Read a line of text from `stream' into `lbp', excluding the
- * newline or CR-NL, if any.  Return the number of characters read from
- * `stream', which is the length of the line including the newline.
+ * newline or CR-NL (if `leave_cr` is false), if any.  Return the
+ * number of characters read from `stream', which is the length
+ * of the line including the newline.
  *
- * On DOS or Windows we do not count the CR character, if any before the
- * NL, in the returned length; this mirrors the behavior of Emacs on those
+ * On DOS or Windows, if `leave_cr` is false, we do not count the
+ * CR character, if any before the NL, in the returned length;
+ * this mirrors the behavior of Emacs on those
  * platforms (for text files, it translates CR-NL to NL as it reads in the
  * file).
  *
@@ -7238,7 +7288,8 @@ get_lispy_tag (register char *bp)
  * appended to `filebuf'.
  */
 static ptrdiff_t
-readline_internal (linebuffer *lbp, FILE *stream, char const *filename)
+readline_internal (linebuffer *lbp, FILE *stream, char const *filename,
+                  const bool leave_cr)
 {
   char *buffer = lbp->buffer;
   char *p = lbp->buffer;
@@ -7268,19 +7319,19 @@ readline_internal (linebuffer *lbp, FILE *stream, char 
const *filename)
          break;
        }
       if (c == '\n')
-       {
-         if (p > buffer && p[-1] == '\r')
-           {
-             p -= 1;
-             chars_deleted = 2;
-           }
-         else
-           {
-             chars_deleted = 1;
-           }
-         *p = '\0';
-         break;
-       }
+        {
+          if (!leave_cr && p > buffer && p[-1] == '\r')
+            {
+              p -= 1;
+              chars_deleted = 2;
+            }
+          else
+            {
+              chars_deleted = 1;
+            }
+          *p = '\0';
+          break;
+        }
       *p++ = c;
     }
   lbp->len = p - buffer;
@@ -7311,7 +7362,7 @@ static void
 readline (linebuffer *lbp, FILE *stream)
 {
   linecharno = charno;         /* update global char number of line start */
-  ptrdiff_t result = readline_internal (lbp, stream, infilename);
+  ptrdiff_t result = readline_internal (lbp, stream, infilename, false);
   lineno += 1;                 /* increment global line number */
   charno += result;            /* increment global char number */
 
@@ -7669,6 +7720,97 @@ etags_mktmp (void)
   return templt;
 }
 
+#if !MSDOS && !defined (DOS_NT)
+/*
+ * Add single quotes around a string, and escape any single quotes.
+ * Return a newly-allocated string.
+ *
+ * For example:
+ * escape_shell_arg_string ("test.txt")  => "'test.txt'"
+ * escape_shell_arg_string ("'test.txt") => "''\''test.txt'"
+ */
+static char *
+escape_shell_arg_string (char *str)
+{
+  char *p = str;
+  int need_space = 2;          /* ' at begin and end */
+
+  while (*p != '\0')
+    {
+      if (*p == '\'')
+       need_space += 4;        /* ' to '\'', length is 4 */
+      else
+       need_space++;
+
+      p++;
+    }
+
+  char *new_str = xnew (need_space + 1, char);
+  new_str[0] = '\'';
+  new_str[need_space-1] = '\'';
+
+  int i = 1;                   /* skip first byte */
+  p = str;
+  while (*p != '\0')
+    {
+      new_str[i] = *p;
+      if (*p == '\'')
+       {
+         new_str[i+1] = '\\';
+         new_str[i+2] = '\'';
+         new_str[i+3] = '\'';
+         i += 3;
+       }
+
+      i++;
+      p++;
+    }
+
+  new_str[need_space] = '\0';
+  return new_str;
+}
+#endif
+
+static void
+do_move_file (const char *src_file, const char *dst_file)
+{
+  if (rename (src_file, dst_file) == 0)
+    return;
+
+  FILE *src_f = fopen (src_file, "rb");
+  FILE *dst_f = fopen (dst_file, "wb");
+
+  if (src_f == NULL)
+    pfatal (src_file);
+
+  if (dst_f == NULL)
+    pfatal (dst_file);
+
+  int c;
+  while ((c = fgetc (src_f)) != EOF)
+    {
+      if (ferror (src_f))
+        pfatal (src_file);
+
+      if (ferror (dst_f))
+        pfatal (dst_file);
+
+      if (fputc (c, dst_f) == EOF)
+        pfatal ("cannot write");
+    }
+
+  if (fclose (src_f) == EOF)
+    pfatal (src_file);
+
+  if (fclose (dst_f) == EOF)
+    pfatal (dst_file);
+
+  if (unlink (src_file) == -1)
+    pfatal ("unlink error");
+
+  return;
+}
+
 /* Return a newly allocated string containing the file name of FILE
    relative to the absolute directory DIR (which should end with a slash). */
 static char *
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index ee21abc723..e0d5f0c6b8 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -138,15 +138,6 @@ getlogin (void)
   return NULL;
 }
 
-char *
-cuserid (char * s)
-{
-  char * name = getlogin ();
-  if (s)
-    return strcpy (s, name ? name : "");
-  return name;
-}
-
 unsigned
 getuid (void)
 {
diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h
index 2cd2b1d107..ff85beeaa6 100644
--- a/lib-src/ntlib.h
+++ b/lib-src/ntlib.h
@@ -33,7 +33,6 @@ unsigned sleep (unsigned seconds);
 char *getwd (char *dir);
 int getppid (void);
 char * getlogin (void);
-char * cuserid (char * s);
 unsigned getegid (void);
 unsigned getgid (void);
 int setuid (unsigned uid);
diff --git a/lib-src/seccomp-filter.c b/lib-src/seccomp-filter.c
index 7e54b878a2..69b56aed5c 100644
--- a/lib-src/seccomp-filter.c
+++ b/lib-src/seccomp-filter.c
@@ -342,6 +342,8 @@ main (int argc, char **argv)
   RULE (SCMP_ACT_ALLOW, SCMP_SYS (eventfd2));
   RULE (SCMP_ACT_ALLOW, SCMP_SYS (wait4));
   RULE (SCMP_ACT_ALLOW, SCMP_SYS (poll));
+  RULE (SCMP_ACT_ALLOW, SCMP_SYS (pidfd_open),
+       SCMP_A1_32 (SCMP_CMP_EQ, 0));
 
   /* Don't allow creating sockets (network access would be extremely
      dangerous), but also don't crash.  */
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index 8c3d7f7cf8..870a663505 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -47,6 +47,7 @@
 #else
 # define __canonicalize_file_name canonicalize_file_name
 # define __realpath realpath
+# define __strdup strdup
 # include "pathmax.h"
 # define __faccessat faccessat
 # if defined _WIN32 && !defined __CYGWIN__
@@ -179,27 +180,16 @@ get_path_max (void)
   return path_max < 0 ? 1024 : path_max <= IDX_MAX ? path_max : IDX_MAX;
 }
 
-/* Act like __realpath (see below), with an additional argument
-   rname_buf that can be used as temporary storage.
-
-   If GCC_LINT is defined, do not inline this function with GCC 10.1
-   and later, to avoid creating a pointer to the stack that GCC
-   -Wreturn-local-addr incorrectly complains about.  See:
-   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644
-   Although the noinline attribute can hurt performance a bit, no better way
-   to pacify GCC is known; even an explicit #pragma does not pacify GCC.
-   When the GCC bug is fixed this workaround should be limited to the
-   broken GCC versions.  */
-# if __GNUC_PREREQ (10, 1)
-#  if defined GCC_LINT || defined lint
-__attribute__ ((__noinline__))
-#  elif __OPTIMIZE__ && !__NO_INLINE__
-#   define GCC_BOGUS_WRETURN_LOCAL_ADDR
-#  endif
-# endif
+/* Scratch buffers used by realpath_stk and managed by __realpath.  */
+struct realpath_bufs
+{
+  struct scratch_buffer rname;
+  struct scratch_buffer extra;
+  struct scratch_buffer link;
+};
+
 static char *
-realpath_stk (const char *name, char *resolved,
-              struct scratch_buffer *rname_buf)
+realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
 {
   char *dest;
   char const *start;
@@ -224,12 +214,7 @@ realpath_stk (const char *name, char *resolved,
       return NULL;
     }
 
-  struct scratch_buffer extra_buffer, link_buffer;
-  scratch_buffer_init (&extra_buffer);
-  scratch_buffer_init (&link_buffer);
-  scratch_buffer_init (rname_buf);
-  char *rname_on_stack = rname_buf->data;
-  char *rname = rname_on_stack;
+  char *rname = bufs->rname.data;
   bool end_in_extra_buffer = false;
   bool failed = true;
 
@@ -239,16 +224,16 @@ realpath_stk (const char *name, char *resolved,
 
   if (!IS_ABSOLUTE_FILE_NAME (name))
     {
-      while (!__getcwd (rname, rname_buf->length))
+      while (!__getcwd (bufs->rname.data, bufs->rname.length))
         {
           if (errno != ERANGE)
             {
               dest = rname;
               goto error;
             }
-          if (!scratch_buffer_grow (rname_buf))
-            goto error_nomem;
-          rname = rname_buf->data;
+          if (!scratch_buffer_grow (&bufs->rname))
+            return NULL;
+          rname = bufs->rname.data;
         }
       dest = __rawmemchr (rname, '\0');
       start = name;
@@ -302,13 +287,13 @@ realpath_stk (const char *name, char *resolved,
           if (!ISSLASH (dest[-1]))
             *dest++ = '/';
 
-          while (rname + rname_buf->length - dest
+          while (rname + bufs->rname.length - dest
                  < startlen + sizeof dir_suffix)
             {
               idx_t dest_offset = dest - rname;
-              if (!scratch_buffer_grow_preserve (rname_buf))
-                goto error_nomem;
-              rname = rname_buf->data;
+              if (!scratch_buffer_grow_preserve (&bufs->rname))
+                return NULL;
+              rname = bufs->rname.data;
               dest = rname + dest_offset;
             }
 
@@ -319,13 +304,13 @@ realpath_stk (const char *name, char *resolved,
           ssize_t n;
           while (true)
             {
-              buf = link_buffer.data;
-              idx_t bufsize = link_buffer.length;
+              buf = bufs->link.data;
+              idx_t bufsize = bufs->link.length;
               n = __readlink (rname, buf, bufsize - 1);
               if (n < bufsize - 1)
                 break;
-              if (!scratch_buffer_grow (&link_buffer))
-                goto error_nomem;
+              if (!scratch_buffer_grow (&bufs->link))
+                return NULL;
             }
           if (0 <= n)
             {
@@ -337,7 +322,7 @@ realpath_stk (const char *name, char *resolved,
 
               buf[n] = '\0';
 
-              char *extra_buf = extra_buffer.data;
+              char *extra_buf = bufs->extra.data;
               idx_t end_idx IF_LINT (= 0);
               if (end_in_extra_buffer)
                 end_idx = end - extra_buf;
@@ -345,13 +330,13 @@ realpath_stk (const char *name, char *resolved,
               if (INT_ADD_OVERFLOW (len, n))
                 {
                   __set_errno (ENOMEM);
-                  goto error_nomem;
+                  return NULL;
                 }
-              while (extra_buffer.length <= len + n)
+              while (bufs->extra.length <= len + n)
                 {
-                  if (!scratch_buffer_grow_preserve (&extra_buffer))
-                    goto error_nomem;
-                  extra_buf = extra_buffer.data;
+                  if (!scratch_buffer_grow_preserve (&bufs->extra))
+                    return NULL;
+                  extra_buf = bufs->extra.data;
                 }
               if (end_in_extra_buffer)
                 end = extra_buf + end_idx;
@@ -403,20 +388,30 @@ realpath_stk (const char *name, char *resolved,
 
 error:
   *dest++ = '\0';
-  if (resolved != NULL && dest - rname <= get_path_max ())
-    rname = strcpy (resolved, rname);
-
-error_nomem:
-  scratch_buffer_free (&extra_buffer);
-  scratch_buffer_free (&link_buffer);
-
-  if (failed || rname == resolved)
+  if (resolved != NULL)
+    {
+      /* Copy the full result on success or partial result if failure was due
+         to the path not existing or not being accessible.  */
+      if ((!failed || errno == ENOENT || errno == EACCES)
+          && dest - rname <= get_path_max ())
+        {
+          strcpy (resolved, rname);
+          if (failed)
+            return NULL;
+          else
+            return resolved;
+        }
+      if (!failed)
+        __set_errno (ENAMETOOLONG);
+      return NULL;
+    }
+  else
     {
-      scratch_buffer_free (rname_buf);
-      return failed ? NULL : resolved;
+      if (failed)
+        return NULL;
+      else
+        return __strdup (bufs->rname.data);
     }
-
-  return scratch_buffer_dupfree (rname_buf, dest - rname);
 }
 
 /* Return the canonical absolute name of file NAME.  A canonical name
@@ -433,12 +428,15 @@ error_nomem:
 char *
 __realpath (const char *name, char *resolved)
 {
-  #ifdef GCC_BOGUS_WRETURN_LOCAL_ADDR
-   #warning "GCC might issue a bogus -Wreturn-local-addr warning here."
-   #warning "See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644>."
-  #endif
-  struct scratch_buffer rname_buffer;
-  return realpath_stk (name, resolved, &rname_buffer);
+  struct realpath_bufs bufs;
+  scratch_buffer_init (&bufs.rname);
+  scratch_buffer_init (&bufs.extra);
+  scratch_buffer_init (&bufs.link);
+  char *result = realpath_stk (name, resolved, &bufs);
+  scratch_buffer_free (&bufs.link);
+  scratch_buffer_free (&bufs.extra);
+  scratch_buffer_free (&bufs.rname);
+  return result;
 }
 libc_hidden_def (__realpath)
 versioned_symbol (libc, __realpath, realpath, GLIBC_2_3);
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
deleted file mode 100644
index ad0bfd170c..0000000000
--- a/lib/explicit_bzero.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Erasure of sensitive data, generic implementation.
-   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
-   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.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-/* An assembler implementation of explicit_bzero can be created as an
-   assembler alias of an optimized bzero implementation.
-   Architecture-specific implementations also need to define
-   __explicit_bzero_chk.  */
-
-#if !_LIBC
-# include <config.h>
-#endif
-
-/* memset_s need this define */
-#if HAVE_MEMSET_S
-# define __STDC_WANT_LIB_EXT1__ 1
-#endif
-
-#include <string.h>
-
-#if defined _WIN32 && !defined __CYGWIN__
-# define  WIN32_LEAN_AND_MEAN
-# include <windows.h>
-#endif
-
-#if _LIBC
-/* glibc-internal users use __explicit_bzero_chk, and explicit_bzero
-   redirects to that.  */
-# undef explicit_bzero
-#endif
-
-/* Set LEN bytes of S to 0.  The compiler will not delete a call to
-   this function, even if S is dead after the call.  */
-void
-explicit_bzero (void *s, size_t len)
-{
-#if defined _WIN32 && !defined __CYGWIN__
-  (void) SecureZeroMemory (s, len);
-#elif HAVE_EXPLICIT_MEMSET
-  explicit_memset (s, '\0', len);
-#elif HAVE_MEMSET_S
-  (void) memset_s (s, len, '\0', len);
-#elif defined __GNUC__ && !defined __clang__
-  memset (s, '\0', len);
-  /* Compiler barrier.  */
-  asm volatile ("" ::: "memory");
-#elif defined __clang__
-  memset (s, '\0', len);
-  /* Compiler barrier.  */
-  /* With asm ("" ::: "memory") LLVM analyzes uses of 's' and finds that the
-     whole thing is dead and eliminates it.  Use 'g' to work around this
-     problem.  See <https://bugs.llvm.org/show_bug.cgi?id=15495#c11>.  */
-  __asm__ volatile ("" : : "g"(s) : "memory");
-#else
-  /* Invoke memset through a volatile function pointer.  This defeats compiler
-     optimizations.  */
-  void * (* const volatile volatile_memset) (void *, int, size_t) = memset;
-  (void) volatile_memset (s, '\0', len);
-#endif
-}
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 04644bdabe..fcbf5bde2d 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -93,7 +93,6 @@
 #  dup2 \
 #  environ \
 #  execinfo \
-#  explicit_bzero \
 #  faccessat \
 #  fchmodat \
 #  fcntl \
@@ -126,6 +125,7 @@
 #  memmem-simple \
 #  mempcpy \
 #  memrchr \
+#  memset_explicit \
 #  minmax \
 #  mkostemp \
 #  mktime \
@@ -222,6 +222,8 @@ DEFS = @DEFS@
 DESLIB = @DESLIB@
 DOCMISC_W32 = @DOCMISC_W32@
 DUMPING = @DUMPING@
+DYNAMIC_LIB_SECONDARY_SUFFIX = @DYNAMIC_LIB_SECONDARY_SUFFIX@
+DYNAMIC_LIB_SUFFIX = @DYNAMIC_LIB_SUFFIX@
 DYNLIB_OBJ = @DYNLIB_OBJ@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -262,7 +264,6 @@ GL_COND_OBJ_DIRFD_CONDITION = @GL_COND_OBJ_DIRFD_CONDITION@
 GL_COND_OBJ_DUP2_CONDITION = @GL_COND_OBJ_DUP2_CONDITION@
 GL_COND_OBJ_EUIDACCESS_CONDITION = @GL_COND_OBJ_EUIDACCESS_CONDITION@
 GL_COND_OBJ_EXECINFO_CONDITION = @GL_COND_OBJ_EXECINFO_CONDITION@
-GL_COND_OBJ_EXPLICIT_BZERO_CONDITION = @GL_COND_OBJ_EXPLICIT_BZERO_CONDITION@
 GL_COND_OBJ_FACCESSAT_CONDITION = @GL_COND_OBJ_FACCESSAT_CONDITION@
 GL_COND_OBJ_FCHMODAT_CONDITION = @GL_COND_OBJ_FCHMODAT_CONDITION@
 GL_COND_OBJ_FCNTL_CONDITION = @GL_COND_OBJ_FCNTL_CONDITION@
@@ -284,6 +285,7 @@ GL_COND_OBJ_LCHMOD_CONDITION = 
@GL_COND_OBJ_LCHMOD_CONDITION@
 GL_COND_OBJ_LSTAT_CONDITION = @GL_COND_OBJ_LSTAT_CONDITION@
 GL_COND_OBJ_MEMPCPY_CONDITION = @GL_COND_OBJ_MEMPCPY_CONDITION@
 GL_COND_OBJ_MEMRCHR_CONDITION = @GL_COND_OBJ_MEMRCHR_CONDITION@
+GL_COND_OBJ_MEMSET_EXPLICIT_CONDITION = @GL_COND_OBJ_MEMSET_EXPLICIT_CONDITION@
 GL_COND_OBJ_MINI_GMP_GNULIB_CONDITION = @GL_COND_OBJ_MINI_GMP_GNULIB_CONDITION@
 GL_COND_OBJ_MKOSTEMP_CONDITION = @GL_COND_OBJ_MKOSTEMP_CONDITION@
 GL_COND_OBJ_NANOSLEEP_CONDITION = @GL_COND_OBJ_NANOSLEEP_CONDITION@
@@ -483,6 +485,7 @@ GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@
 GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@
 GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@
 GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@
+GL_GNULIB_MEMSET_EXPLICIT = @GL_GNULIB_MEMSET_EXPLICIT@
 GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@
 GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@
 GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@
@@ -747,6 +750,7 @@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
 HAVE_MBSLEN = @HAVE_MBSLEN@
 HAVE_MBTOWC = @HAVE_MBTOWC@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
+HAVE_MEMSET_EXPLICIT = @HAVE_MEMSET_EXPLICIT@
 HAVE_MKDIRAT = @HAVE_MKDIRAT@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_MKFIFO = @HAVE_MKFIFO@
@@ -953,6 +957,7 @@ MKDIR_P = @MKDIR_P@
 MODULES_OBJ = @MODULES_OBJ@
 MODULES_SECONDARY_SUFFIX = @MODULES_SECONDARY_SUFFIX@
 MODULES_SUFFIX = @MODULES_SUFFIX@
+NATIVE_COMPILATION_AOT = @NATIVE_COMPILATION_AOT@
 NEXT_ASSERT_H = @NEXT_ASSERT_H@
 NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@
 NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@
@@ -1218,6 +1223,8 @@ TERMCAP_OBJ = @TERMCAP_OBJ@
 TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
 TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@
 TOOLKIT_LIBW = @TOOLKIT_LIBW@
+TREE_SITTER_CFLAGS = @TREE_SITTER_CFLAGS@
+TREE_SITTER_LIBS = @TREE_SITTER_LIBS@
 UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@
 UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@
 UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
@@ -1309,23 +1316,22 @@ 
gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31_CONDITION = @gl_GNULIB_ENABLE
 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_8444034ea779b88768865bb60b4fb8c9_CONDITION = 
@gl_GNULIB_ENABLED_8444034ea779b88768865bb60b4fb8c9_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_fd38c7e463b54744b77b98aeafb4fa7c_CONDITION = 
@gl_GNULIB_ENABLED_fd38c7e463b54744b77b98aeafb4fa7c_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_stdckdint_CONDITION = @gl_GNULIB_ENABLED_stdckdint_CONDITION@
 gl_GNULIB_ENABLED_strtoll_CONDITION = @gl_GNULIB_ENABLED_strtoll_CONDITION@
 gl_GNULIB_ENABLED_utimens_CONDITION = @gl_GNULIB_ENABLED_utimens_CONDITION@
 gl_LIBOBJDEPS = @gl_LIBOBJDEPS@
@@ -1770,43 +1776,6 @@ endif
 endif
 ## end   gnulib module dup2
 
-## begin gnulib module dynarray
-ifeq (,$(OMIT_GNULIB_MODULE_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_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_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
-       $(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
-
-endif
-EXTRA_DIST += dynarray.h malloc/dynarray-skeleton.c malloc/dynarray.h
-
-EXTRA_libgnu_a_SOURCES += malloc/dynarray-skeleton.c
-
-endif
-## end   gnulib module dynarray
-
 ## begin gnulib module eloop-threshold
 ifeq (,$(OMIT_GNULIB_MODULE_eloop-threshold))
 
@@ -1890,16 +1859,6 @@ EXTRA_DIST += execinfo.in.h
 endif
 ## end   gnulib module execinfo
 
-## begin gnulib module explicit_bzero
-ifeq (,$(OMIT_GNULIB_MODULE_explicit_bzero))
-
-ifneq (,$(GL_COND_OBJ_EXPLICIT_BZERO_CONDITION))
-libgnu_a_SOURCES += explicit_bzero.c
-endif
-
-endif
-## end   gnulib module explicit_bzero
-
 ## begin gnulib module faccessat
 ifeq (,$(OMIT_GNULIB_MODULE_faccessat))
 
@@ -2251,6 +2210,68 @@ EXTRA_DIST += $(top_srcdir)/build-aux/gitlog-to-changelog
 endif
 ## end   gnulib module gitlog-to-changelog
 
+## begin gnulib module glibc-internal/dynarray
+ifeq (,$(OMIT_GNULIB_MODULE_glibc-internal/dynarray))
+
+ifneq (,$(gl_GNULIB_ENABLED_fd38c7e463b54744b77b98aeafb4fa7c_CONDITION))
+BUILT_SOURCES += malloc/dynarray.gl.h malloc/dynarray-skeleton.gl.h
+
+malloc/dynarray.gl.h: malloc/dynarray.h
+       $(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_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
+       $(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
+
+endif
+EXTRA_DIST += dynarray.h malloc/dynarray-skeleton.c malloc/dynarray.h
+
+EXTRA_libgnu_a_SOURCES += malloc/dynarray-skeleton.c
+
+endif
+## end   gnulib module glibc-internal/dynarray
+
+## begin gnulib module glibc-internal/scratch_buffer
+ifeq (,$(OMIT_GNULIB_MODULE_glibc-internal/scratch_buffer))
+
+ifneq (,$(gl_GNULIB_ENABLED_8444034ea779b88768865bb60b4fb8c9_CONDITION))
+BUILT_SOURCES += malloc/scratch_buffer.gl.h
+
+malloc/scratch_buffer.gl.h: malloc/scratch_buffer.h
+       $(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
+       $(AM_V_at)mv $@-t $@
+MOSTLYCLEANFILES += malloc/scratch_buffer.gl.h malloc/scratch_buffer.gl.h-t
+
+libgnu_a_SOURCES += malloc/scratch_buffer_grow.c                 
malloc/scratch_buffer_grow_preserve.c                 
malloc/scratch_buffer_set_array_size.c
+
+endif
+EXTRA_DIST += malloc/scratch_buffer.h scratch_buffer.h
+
+endif
+## end   gnulib module glibc-internal/scratch_buffer
+
 ## begin gnulib module group-member
 ifeq (,$(OMIT_GNULIB_MODULE_group-member))
 
@@ -2507,6 +2528,16 @@ endif
 endif
 ## end   gnulib module memrchr
 
+## begin gnulib module memset_explicit
+ifeq (,$(OMIT_GNULIB_MODULE_memset_explicit))
+
+ifneq (,$(GL_COND_OBJ_MEMSET_EXPLICIT_CONDITION))
+libgnu_a_SOURCES += memset_explicit.c
+endif
+
+endif
+## end   gnulib module memset_explicit
+
 ## begin gnulib module minmax
 ifeq (,$(OMIT_GNULIB_MODULE_minmax))
 
@@ -2736,31 +2767,6 @@ EXTRA_DIST += root-uid.h
 endif
 ## end   gnulib module root-uid
 
-## begin gnulib module scratch_buffer
-ifeq (,$(OMIT_GNULIB_MODULE_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_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
-       $(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
-
-endif
-EXTRA_DIST += malloc/scratch_buffer.h scratch_buffer.h
-
-endif
-## end   gnulib module scratch_buffer
-
 ## begin gnulib module sig2str
 ifeq (,$(OMIT_GNULIB_MODULE_sig2str))
 
@@ -2916,7 +2922,6 @@ endif
 ## begin gnulib module stdckdint
 ifeq (,$(OMIT_GNULIB_MODULE_stdckdint))
 
-ifneq (,$(gl_GNULIB_ENABLED_stdckdint_CONDITION))
 BUILT_SOURCES += $(STDCKDINT_H)
 
 # We need the following in order to create <stdckdint.h> when the system
@@ -2932,7 +2937,6 @@ stdckdint.h: $(top_builddir)/config.status
 endif
 MOSTLYCLEANFILES += stdckdint.h stdckdint.h-t
 
-endif
 EXTRA_DIST += intprops-internal.h stdckdint.in.h
 
 endif
@@ -3360,6 +3364,7 @@ string.h: string.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \
              -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \
              -e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \
+             -e 
's/@''GNULIB_MEMSET_EXPLICIT''@/$(GL_GNULIB_MEMSET_EXPLICIT)/g' \
              -e 's/@''GNULIB_RAWMEMCHR''@/$(GL_GNULIB_RAWMEMCHR)/g' \
              -e 's/@''GNULIB_STPCPY''@/$(GL_GNULIB_STPCPY)/g' \
              -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \
@@ -3391,6 +3396,7 @@ string.h: string.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
+             -e 's|@''HAVE_MEMSET_EXPLICIT''@|$(HAVE_MEMSET_EXPLICIT)|g' \
              -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \
              -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
              -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
diff --git a/lib/malloc/scratch_buffer.h b/lib/malloc/scratch_buffer.h
index e4c5c8a85d..a9bdcadec2 100644
--- a/lib/malloc/scratch_buffer.h
+++ b/lib/malloc/scratch_buffer.h
@@ -132,20 +132,4 @@ scratch_buffer_set_array_size (struct scratch_buffer 
*buffer,
                         (buffer, nelem, size));
 }
 
-/* Return a copy of *BUFFER's first SIZE bytes as a heap-allocated block,
-   deallocating *BUFFER if it was heap-allocated.  SIZE must be at
-   most *BUFFER's size.  Return NULL (setting errno) on memory
-   exhaustion.  */
-void *__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer,
-                                     size_t size);
-libc_hidden_proto (__libc_scratch_buffer_dupfree)
-
-/* Alias for __libc_scratch_dupfree.  */
-static __always_inline void *
-scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size)
-{
-  void *r = __libc_scratch_buffer_dupfree (buffer, size);
-  return __glibc_likely (r != NULL) ? r : NULL;
-}
-
 #endif /* _SCRATCH_BUFFER_H */
diff --git a/lib/memset_explicit.c b/lib/memset_explicit.c
new file mode 100644
index 0000000000..eabeb3ec2b
--- /dev/null
+++ b/lib/memset_explicit.c
@@ -0,0 +1,55 @@
+/* Erase sensitive data from memory.
+   Copyright 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
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file 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 program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* memset_s need this define */
+#if HAVE_MEMSET_S
+# define __STDC_WANT_LIB_EXT1__ 1
+#endif
+
+#include <string.h>
+
+/* Set S's bytes to C, where S has LEN bytes.  The compiler will not
+   optimize effects away, even if S is dead after the call.  */
+void *
+memset_explicit (void *s, int c, size_t len)
+{
+#if HAVE_EXPLICIT_MEMSET
+  return explicit_memset (s, c, len);
+#elif HAVE_MEMSET_S
+  (void) memset_s (s, len, c, len);
+  return s;
+#elif defined __GNUC__ && !defined __clang__
+  memset (s, c, len);
+  /* Compiler barrier.  */
+  __asm__ volatile ("" ::: "memory");
+  return s;
+#elif defined __clang__
+  memset (s, c, len);
+  /* Compiler barrier.  */
+  /* With asm ("" ::: "memory") LLVM analyzes uses of 's' and finds that the
+     whole thing is dead and eliminates it.  Use 'g' to work around this
+     problem.  See <https://bugs.llvm.org/show_bug.cgi?id=15495#c11>.  */
+  __asm__ volatile ("" : : "g"(s) : "memory");
+  return s;
+#else
+  /* Invoke memset through a volatile function pointer.  This defeats compiler
+     optimizations.  */
+  void * (* const volatile volatile_memset) (void *, int, size_t) = memset;
+  return volatile_memset (s, c, len);
+#endif
+}
diff --git a/lib/scratch_buffer.h b/lib/scratch_buffer.h
index f4fe5e8d34..c0aa21630f 100644
--- a/lib/scratch_buffer.h
+++ b/lib/scratch_buffer.h
@@ -98,20 +98,10 @@ extern bool scratch_buffer_set_array_size (struct 
scratch_buffer *buffer,
                                            size_t nelem, size_t size);
 #endif
 
-/* Return a copy of *BUFFER's first SIZE bytes as a heap-allocated block,
-   deallocating *BUFFER if it was heap-allocated.  SIZE must be at
-   most *BUFFER's size.  Return NULL (setting errno) on memory
-   exhaustion.  */
-#if 0
-extern void *scratch_buffer_dupfree (struct scratch_buffer *buffer,
-                                     size_t size);
-#endif
-
 
 /* The implementation is imported from glibc.  */
 
 /* Avoid possible conflicts with symbols exported by the GNU libc.  */
-#define __libc_scratch_buffer_dupfree gl_scratch_buffer_dupfree
 #define __libc_scratch_buffer_grow gl_scratch_buffer_grow
 #define __libc_scratch_buffer_grow_preserve gl_scratch_buffer_grow_preserve
 #define __libc_scratch_buffer_set_array_size gl_scratch_buffer_set_array_size
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 6b0088e328..b661196ea5 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -20,9 +20,8 @@
 #ifndef STAT_TIME_H
 #define STAT_TIME_H 1
 
-#include "intprops.h"
-
 #include <errno.h>
+#include <stdckdint.h>
 #include <stddef.h>
 #include <sys/stat.h>
 #include <time.h>
@@ -232,7 +231,7 @@ stat_time_normalize (int result, _GL_UNUSED struct stat *st)
           /* Overflow is possible, as Solaris 11 stat can yield
              tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000.
              INT_ADD_WRAPV is OK, since time_t is signed on Solaris.  */
-          if (INT_ADD_WRAPV (q, ts->tv_sec, &ts->tv_sec))
+          if (ckd_add (&ts->tv_sec, q, ts->tv_sec))
             {
               errno = EOVERFLOW;
               return -1;
diff --git a/lib/string.in.h b/lib/string.in.h
index e56f6db0c9..21356914e2 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -347,6 +347,23 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
 # endif
 #endif
 
+/* Overwrite a block of memory.  The compiler will not optimize
+   effects away, even if the block is dead after the call.  */
+#if @GNULIB_MEMSET_EXPLICIT@
+# if ! @HAVE_MEMSET_EXPLICIT@
+_GL_FUNCDECL_SYS (memset_explicit, void *,
+                  (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t 
__n));
+_GL_CXXALIASWARN (memset_explicit);
+#elif defined GNULIB_POSIXCHECK
+# undef memset_explicit
+# if HAVE_RAW_DECL_MEMSET_EXPLICIT
+_GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - "
+                 "use gnulib module memset_explicit for portability");
+# endif
+#endif
+
 /* Find the first occurrence of C in S.  More efficient than
    memchr(S,C,N), at the expense of undefined behavior if C does not
    occur within N bytes.  */
diff --git a/lib/verify.h b/lib/verify.h
index 99af802993..5225a8e616 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -37,7 +37,7 @@
           && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__)))
 #  define _GL_HAVE__STATIC_ASSERT 1
 # endif
-# if (202000 <= __STDC_VERSION__ \
+# if (202311 <= __STDC_VERSION__ \
       || (!defined __STRICT_ANSI__ && 9 <= __GNUC__))
 #  define _GL_HAVE__STATIC_ASSERT1 1
 # endif
diff --git a/lisp/ChangeLog.10 b/lisp/ChangeLog.10
index de73fe7f0a..7c080ea496 100644
--- a/lisp/ChangeLog.10
+++ b/lisp/ChangeLog.10
@@ -4788,7 +4788,7 @@
 2003-03-10  Thien-Thi Nguyen  <ttn@gnu.org>
 
        * progmodes/scheme.el (scheme-mode-syntax-table):
-       Construct w/o using `with-syntax-table'.
+       Construct without using `with-syntax-table'.
 
 2003-03-10  John Paul Wallington  <jpw@gnu.org>
 
diff --git a/lisp/ChangeLog.11 b/lisp/ChangeLog.11
index 53a83c638c..f16191e8b7 100644
--- a/lisp/ChangeLog.11
+++ b/lisp/ChangeLog.11
@@ -212,7 +212,7 @@
 2004-12-27  Richard M. Stallman  <rms@gnu.org>
 
        * files.el (buffer-save-without-query): New var (buffer-local).
-       (save-some-buffers): Save those buffers first, w/o asking.
+       (save-some-buffers): Save those buffers first, without asking.
 
        * files.el (insert-directory-ls-version): New variable.
        (insert-directory): When ls returns an error, test the version
@@ -491,7 +491,7 @@
        instead of `direction'.  Update callers.  When `del-count' is
        non-nil, delete that many characters, otherwise `count' characters
        backwards.  Insert the newly-replaced string `count' times.
-       (zone-fret): Handle chars w/ width greater than one.
+       (zone-fret): Handle chars with width greater than one.
        (zone-fall-through-ws): No longer take window width `ww'.
        Update callers.  Add handling for `char-width' greater than one.
        (zone-pgm-drip): Update var holding window-end position every cycle.
@@ -3584,7 +3584,8 @@
        * startup.el (fancy-splash-tail, normal-splash-screen):
        Update copyright year.
 
-       * shadowfile.el (shadowfile-unload-hook): Set as variable w/ add-hook.
+       * shadowfile.el (shadowfile-unload-hook): Set as variable with
+       add-hook.
 
        * server.el (server-unload-hook): Set as a variable with add-hook.
 
@@ -8939,7 +8940,7 @@
        (compilation-skip-visited, compilation-context-lines):
        Declare :version when added to Emacs.
        (compilation-error-regexp-alist-alist): Extend caml and irix.
-       (compilation-setup): Fix if font-locked w/o font-lock-defaults.
+       (compilation-setup): Fix if font-locked without font-lock-defaults.
        (compilation-mode-font-lock-keywords): Temporarily undo line as
        function patch, which wasn't ready.
 
diff --git a/lisp/ChangeLog.12 b/lisp/ChangeLog.12
index 0796965a9b..ec58ffc173 100644
--- a/lisp/ChangeLog.12
+++ b/lisp/ChangeLog.12
@@ -24499,8 +24499,9 @@
        is updated.
 
        * whitespace.el (whitespace-buffer-leading-cleanup):
-       Simplify w/ skip-chars-forward.
-       (whitespace-buffer-trailing-cleanup): Simplify w/ skip-chars-backward.
+       Simplify with skip-chars-forward.
+       (whitespace-buffer-trailing-cleanup): Simplify with
+       skip-chars-backward.
 
        * mail/rmail.el (rmail-only-expunge): Fix paren error.
        Unconditionally try to leave point at the same old place.
@@ -31346,7 +31347,7 @@
 
        * facemenu.el (list-colors-print): Print #RRGGBB in default face.
        Remove 1 space before #RRGGBB to not truncate it on terminal
-       windows w/o fringes.  Remove 1 space between bg and fg examples
+       windows without fringes.  Remove 1 space between bg and fg examples
        to get more space.
        (list-colors-duplicates): Replace `and' with `if' for `boundp' to
        avoid byte-compile warnings.
diff --git a/lisp/ChangeLog.14 b/lisp/ChangeLog.14
index 8d8c611778..eae47fe198 100644
--- a/lisp/ChangeLog.14
+++ b/lisp/ChangeLog.14
@@ -20218,7 +20218,7 @@
 2008-02-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * doc-view.el (doc-view-display): Change file arg to buffer arg, so it
-       works also for buffers w/o buffer-file-name.  Update callers.
+       works also for buffers without buffer-file-name.  Update callers.
        (doc-view-clone-buffer-hook): New fun.
        (doc-view-mode): Use it for indirect clones.  Mark the overlays with
        the `doc-view' property so they can be recognized.
diff --git a/lisp/ChangeLog.15 b/lisp/ChangeLog.15
index 8a21c291e7..ac1befac1e 100644
--- a/lisp/ChangeLog.15
+++ b/lisp/ChangeLog.15
@@ -10320,7 +10320,7 @@
        * bs.el, expand.el, ido.el, image-dired.el, lpr.el, pcomplete.el,
        * skeleton.el, term.el, time.el, wid-edit.el, woman.el,
        * calc/calc-graph.el, calc/calc-help.el, calc/calc-incom.el,
-       * calc/calc.el, emacs-lisp/cl-extra.el, emacs-lips/cl-loaddefs.el,
+       * calc/calc.el, emacs-lisp/cl-extra.el, emacs-lisp/cl-loaddefs.el,
        * emulation/cua-rect.el, emulation/viper-ex.el, eshell/esh-test.el,
        * eshell/eshell.el, gnus/gnus-uu.el, gnus/nndoc.el, gnus/nnrss.el,
        * gnus/rfc2047.el, gnus/utf7.el, international/utf-7.el,
diff --git a/lisp/ChangeLog.16 b/lisp/ChangeLog.16
index 7b57c014d2..ef230bf9ed 100644
--- a/lisp/ChangeLog.16
+++ b/lisp/ChangeLog.16
@@ -4866,12 +4866,13 @@
 2012-10-12  Fabián Ezequiel Gallina  <fgallina@cuca>
 
        * progmodes/python.el (python-mode-map):
-       Replace subtitute-key-definition with proper command remapping.
+       Replace substitute-key-definition with proper command remapping.
        (python-nav--up-list): Fix behavior for blocks on the same level.
 
 2012-10-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * help-fns.el (describe-function-1): Handle autoloads w/o docstrings.
+       * help-fns.el (describe-function-1): Handle autoloads without
+       docstrings.
 
        * emacs-lisp/bytecomp.el (byte-compile-eval): Adjust to long-ago
        changes to the format of load-history.
@@ -24324,7 +24325,7 @@
        Pass nil for `after-find-file-from-revert-buffer'.
 
        * saveplace.el (save-place-find-file-hook): Use new variable
-       `rever-buffer-in-progress-p', not `after-find-file-from-revert-buffer'.
+       `revert-buffer-in-progress-p', not `after-find-file-from-revert-buffer'.
 
 2011-04-06  Glenn Morris  <rgm@gnu.org>
 
diff --git a/lisp/ChangeLog.17 b/lisp/ChangeLog.17
index c494f43896..57620513e3 100644
--- a/lisp/ChangeLog.17
+++ b/lisp/ChangeLog.17
@@ -25522,7 +25522,7 @@
 
        * textmodes/ispell.el (ispell-add-per-file-word-list):
        Fix `flyspell-correct-word-before-point' error when accepting
-       words and `coment-padding' is an integer by using
+       words and `comment-padding' is an integer by using
        `comment-normalize-vars' (Bug #14214).
 
 2013-04-17  Fabián Ezequiel Gallina  <fgallina@gnu.org>
diff --git a/lisp/ChangeLog.3 b/lisp/ChangeLog.3
index e23226b844..46089685a3 100644
--- a/lisp/ChangeLog.3
+++ b/lisp/ChangeLog.3
@@ -4172,7 +4172,8 @@
        (next-matching-history-element): Likewise.
        (minibuffer-history-search-history): New variable.
 
-       * simple.el (read-expression-map): New keymap, w/ lisp-complete-symbol.
+       * simple.el (read-expression-map): New keymap, with
+       lisp-complete-symbol.
        (eval-expression, edit-and-eval-command): Use read-expression-map.
        (repeat-complex-command): Likewise.
 
diff --git a/lisp/ChangeLog.4 b/lisp/ChangeLog.4
index ea0502975e..ddea2a4e2f 100644
--- a/lisp/ChangeLog.4
+++ b/lisp/ChangeLog.4
@@ -7238,7 +7238,8 @@
        * ispell.el (ispell-menu-map): Add missing quote in defalias.
        (ispell-window-configuration): Initialize to nil.
 
-       * vc-hooks.el (vc-rcs-status): Make work buffer's name start w/ space.
+       * vc-hooks.el (vc-rcs-status): Make work buffer's name start with
+       space.
 
        * simple.el (completion-setup-function): Insert the mouse help message
        only if non-nil `window-system'.
diff --git a/lisp/ChangeLog.6 b/lisp/ChangeLog.6
index 27d522aaf2..8e07e5c36a 100644
--- a/lisp/ChangeLog.6
+++ b/lisp/ChangeLog.6
@@ -1915,7 +1915,7 @@
        * menu-bar.el (menu-bar-tools-menu): Delete ediff-doc and
        eregistry items.
 
-       * help.el (describe-mode): Handle minor mode w/o mode line indicator.
+       * help.el (describe-mode): Handle minor mode without mode line 
indicator.
 
        * bibtex.el (bibtex-version): Variable deleted.
        (bibtex-submit-bug-report): Don't use that.
diff --git a/lisp/ChangeLog.7 b/lisp/ChangeLog.7
index 3220832454..91b8d47422 100644
--- a/lisp/ChangeLog.7
+++ b/lisp/ChangeLog.7
@@ -1175,7 +1175,7 @@
        (speedbar-supported-extension-expressions): Add more extensions.
        (speedbar-add-supported-extension)
        (speedbar-add-ignored-path-regexp): Made interactive.
-       (speedbar-update-flag): Nil w/ no window system.
+       (speedbar-update-flag): Nil with no window system.
        (speedbar-file-key-map): Move some key bindings from
        `speedbar-key-map' to this map.
        (speedbar-make-specialized-keymap): New function.
@@ -4223,7 +4223,8 @@
        Do the right thing when nil is specified as criterion for activeness.
        Fix string used to report an invalid item.
 
-       * tmm.el (tmm-get-keymap): Handle new format menu item w/o cache.
+       * tmm.el (tmm-get-keymap): Handle new format menu item without
+       cache.
        (tmm-prompt): If reach an empty menu, get an error.
 
 1998-04-20  Per Starbäck  <starback@update.uu.se>
diff --git a/lisp/ChangeLog.8 b/lisp/ChangeLog.8
index a14d682192..3b6205bc60 100644
--- a/lisp/ChangeLog.8
+++ b/lisp/ChangeLog.8
@@ -117,7 +117,7 @@
        overlays if they interfere.
        (compilation-find-file): Make intangible overlays tangible.
 
-       * progmodes/hideshow.el: Generally, synch w/ maintainer
+       * progmodes/hideshow.el: Generally, synch with maintainer
        version 5.9.
 
        (hs-show-hidden-short-form): Delete var; hard-code uses as `t'.
@@ -6715,7 +6715,7 @@
 
        * speedbar.el (speedbar-item-info-file-helper): Add optional arg
        of the file whose info we want to display.
-       (speedbar-easymenu-definition-trailer) Fix list issue w/ customize.
+       (speedbar-easymenu-definition-trailer) Fix list issue with customize.
        (speedbar-add-mode-functions-list) Improve doc.
        (speedbar-line-token) New function.
        (speedbar-dired) Fix order of directories in -shown-directories.
@@ -9800,8 +9800,8 @@
 1998-08-27  Richard Stallman  <rms@gnu.org>
 
        * calendar/cal-tex.el (cal-tex-cursor-filofax-daily): Don't use oddp.
-       * calendar/appt.el (appt-check): Start the appt-mode-string w/ space.
-       Clear appt-mode-string if we don't put something in it.
+       * calendar/appt.el (appt-check): Start the appt-mode-string with
+       space.  Clear appt-mode-string if we don't put something in it.
 
 1998-08-27  Dave Love  <fx@gnu.org>
 
@@ -9979,7 +9979,8 @@
        (speedbar-mode): Set buffer to read only.
        (speedbar-temp-buffer-show-function): For Emacs don't call hook
        with arguments.
-       (speedbar-stealthy-updates): Do all updates w/ the buffer writable.
+       (speedbar-stealthy-updates): Do all updates with the buffer
+       writable.
 
 1998-08-19  Dan Nicolaescu  <done@ece.arizona.edu>
 
diff --git a/lisp/ChangeLog.9 b/lisp/ChangeLog.9
index 469d0970f8..be6ba962cf 100644
--- a/lisp/ChangeLog.9
+++ b/lisp/ChangeLog.9
@@ -1418,13 +1418,13 @@
 2001-08-28  Thien-Thi Nguyen  <ttn@gnu.org>
 
        * progmodes/hideshow.el: Update first-line description.
-       Sync comments w/ maintainer version 5.31.
+       Sync comments with maintainer version 5.31.
 
        (hs-isearch-open): Default value now `code'.
        Fix docstring to use "code blocks" vs "comment blocks",
        as opposed to "block" vs "comment".
        (hs-flag-region): Accept `hs-isearch-open' value
-       of `block' as synonymous w/ `code'.
+       of `block' as synonymous with `code'.
        (hs-hide-block-at-point): For code blocks, pass `code'
        to `hs-flag-region' instead of `block'.
 
@@ -11483,7 +11483,7 @@
 2000-09-23  Thien-Thi Nguyen  <ttn@gnu.org>
 
        * progmodes/hideshow.el: Update author email address.
-       Generally, sync w/ maintainer version 5.22.
+       Generally, sync with maintainer version 5.22.
        (hs-hide-all-non-comment-function): New var.
        (hs-hide-hook, hs-show-hook, hs-minor-mode): Update docstrings.
        (hs-hide-all): Use `hs-hide-all-non-comment-function'.
@@ -17879,7 +17879,7 @@
        (speedbar-make-button): Call `speedbar-insert-image-button-maybe'.
        (speedbar-directory-buttons): Update path search/expansion.
        (speedbar-make-tag-line): Pay attention to
-       `speedbar-indentation-width'.  Use more care w/ invisible
+       `speedbar-indentation-width'.  Use more care with invisible
        properties.
        (speedbar-change-expand-button-char):
        Call `speedbar-insert-image-button-maybe'.
diff --git a/lisp/ansi-osc.el b/lisp/ansi-osc.el
index a8523fc9dc..23d0363865 100644
--- a/lisp/ansi-osc.el
+++ b/lisp/ansi-osc.el
@@ -7,18 +7,20 @@
 ;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: processes, terminals, services
 
-;; 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:
 
@@ -108,7 +110,7 @@ list that is the value of `ansi-osc-handlers'."
   "Update `default-directory' from OSC 7 escape sequences.
 
 This function is intended to be included as an element of the
-the list that is the value of `ansi-osc-handlers'.  You should arrange
+list that is the value of `ansi-osc-handlers'.  You should arrange
 for your shell to print the appropriate escape sequence at each prompt,
 such as with the following command:
 
diff --git a/lisp/apropos.el b/lisp/apropos.el
index a731926f45..89f1f150a1 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -496,7 +496,7 @@ Intended as a value for `revert-buffer-function'."
               outline-level (lambda () 1)
               outline-minor-mode-cycle t
               outline-minor-mode-highlight t
-              outline-minor-mode-use-buttons t))
+              outline-minor-mode-use-buttons 'insert))
 
 (defvar apropos-multi-type t
   "If non-nil, this apropos query concerns multiple types.
diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index dc274843e1..fbb6944e26 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -55,12 +55,13 @@
   :type 'string
   :version "27.1")
 
-(defcustom auth-source-pass-extra-query-keywords t
+(defcustom auth-source-pass-extra-query-keywords nil
   "Whether to consider additional keywords when performing a query.
 Specifically, when the value is t, recognize the `:max' and
 `:require' keywords and accept lists of query parameters for
-certain keywords, such as `:host' and `:user'.  Also, wrap all
-returned secrets in a function and forgo any further results
+certain keywords, such as `:host' and `:user'.  Beyond that, wrap
+all returned secrets in a function and don't bother considering
+subdomains when matching hosts.  Also, forgo any further results
 filtering unless given an applicable `:require' argument.  When
 this option is nil, do none of that, and enact the narrowing
 behavior described toward the bottom of the Info node `(auth) The
@@ -110,12 +111,12 @@ HOSTS can be a string or a list of strings."
 (defun auth-source-pass--match-regexp (s)
   (rx-to-string ; autoloaded
    `(: (or bot "/")
-       (or (: (? (group-n 20 (+ (not (in ?\  ?/ ?@ ,s)))) "@")
-              (group-n 10 (+ (not (in ?\  ?/ ?@ ,s))))
-              (? ,s (group-n 30 (+ (not (in ?\  ?/ ,s))))))
-           (: (group-n 11 (+ (not (in ?\  ?/ ?@ ,s))))
-              (? ,s (group-n 31 (+ (not (in ?\  ?/ ,s)))))
-              (? "/" (group-n 21 (+ (not (in ?\  ?/ ,s)))))))
+       (or (: (? (group-n 20 (+ (not (in ?/ ,s)))) "@")     ; user prefix
+              (group-n 10 (+ (not (in ?/ ?@ ,s))))          ; host
+              (? ,s (group-n 30 (+ (not (in ?\s ?/ ,s)))))) ; port
+           (: (group-n 11 (+ (not (in ?/ ?@ ,s))))          ; host
+              (? ,s (group-n 31 (+ (not (in ?\s ?/ ,s)))))  ; port
+              (? "/" (group-n 21 (+ (not (in ?/ ,s)))))))   ; user suffix
        eot)
    'no-group))
 
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index e3d66c04bc..1ed3f693ab 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -718,7 +718,7 @@ system.")
                           (string-equal
                            (file-name-nondirectory file)
                            (file-name-nondirectory buffer-file-name)))
-                     ;; A buffer w/o a file, like dired.
+                     ;; A buffer without a file, like dired.
                      (null buffer-file-name))
                 (auto-revert-notify-rm-watch)
                 ;; Restart the timer if it wasn't running.
@@ -739,7 +739,7 @@ system.")
                               (string-equal
                                (file-name-nondirectory file1)
                                (file-name-nondirectory buffer-file-name)))))
-                   ;; A buffer w/o a file, like dired.
+                   ;; A buffer without a file, like dired.
                    (and (null buffer-file-name)
                         (memq action '(created renamed deleted))))
               ;; Mark buffer modified.
diff --git a/lisp/bindings.el b/lisp/bindings.el
index c1ad5f7520..a3f51ebb31 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -670,6 +670,8 @@ or not."
   "Return the value of symbol VAR if it is bound, else nil.
 Note that if `lexical-binding' is in effect, this function isn't
 meaningful if it refers to a lexically bound variable."
+  (unless (symbolp var)
+    (signal 'wrong-type-argument (list 'symbolp var)))
   `(and (boundp (quote ,var)) ,var))
 
 ;; Use mode-line-mode-menu for local minor-modes only.
diff --git a/lisp/bs.el b/lisp/bs.el
index 1fd31fb3b8..d6df89138d 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -157,15 +157,15 @@ HEADER         : String for header for first line or a 
function
                  which calculates column title.
 MINIMUM-LENGTH : Minimum width of column (number or name of function).
                  The function must return a positive integer.
-MAXIMUM-LENGTH : Maximum width of column (number or name of function)
-                 (currently ignored).
+MAXIMUM-LENGTH : Ignored.
 ALIGNMENT      : Alignment of column (`left', `right', `middle').
 FUN-OR-STRING  : Name of a function for calculating the value or a
                  string for a constant value.
 
-The function gets as parameter the buffer where we have started
-buffer selection and the list of all buffers to show.  The function must
-return a string representing the column's value."
+Functions for HEADER and MINIMUM-LENGTH are called with no arguments.
+FUN-OR-STRING gets as argument the buffer where we have started
+buffer selection and the list of all buffers to show.  The function
+must return a string representing the column's value."
   :group 'bs-appearance
   :type '(repeat sexp))
 
@@ -321,7 +321,7 @@ Must be a string used in `bs-configurations' for naming a 
configuration."
   :group 'bs-appearance
   :type 'string)
 
-(defcustom bs-string-show-normally  " "
+(defcustom bs-string-show-normally " "
   "String added in column 1 indicating an unmarked buffer."
   :group 'bs-appearance
   :type 'string)
@@ -384,12 +384,12 @@ don't highlight."
   "Define a new function for buffer sorting in Buffer Selection Menu.
 NAME specifies the sort order defined by function FUN.
 A value of nil for FUN means don't sort the buffer list.  Otherwise the
-functions must have two parameters - the buffers to compare.
+function must have two arguments - the buffers to compare.
 REGEXP-FOR-SORTING is a regular expression which describes the
 column title to highlight.
 FACE is a face used to fontify the sorted column title.  A value of nil means
 don't highlight.
-The new sort aspect will be inserted into list `bs-sort-functions'."
+The new sort aspect will be inserted into the list `bs-sort-functions'."
   (let ((tuple (assoc name bs-sort-functions)))
     (if tuple
         (setcdr tuple (list fun regexp-for-sorting face))
@@ -420,9 +420,6 @@ naming a sort behavior.  Default is \"by nothing\" which 
means no sorting."
 Non-nil means to show all buffers.  Otherwise show buffers
 defined by current configuration `bs-current-configuration'.")
 
-(defvar bs--window-config-coming-from nil
-  "Window configuration before starting Buffer Selection Menu.")
-
 (defvar bs--intern-show-never "^ \\|\\*buffer-selection\\*"
   "Regular expression specifying which buffers never to show.
 A buffer whose name matches this regular expression will never be
@@ -491,6 +488,23 @@ Used internally, only.")
   "<mouse-2>" #'bs-mouse-select
   "<mouse-3>" #'bs-mouse-select-other-frame)
 
+(defcustom bs-default-action-list '((display-buffer-reuse-window
+                                    display-buffer-below-selected)
+                                   (reusable-frames . nil)
+                                   (window-height . window-min-height))
+  "Default action list for showing the '*bs-selection*' buffer.
+
+This list will be passed to `pop-to-buffer' as its ACTION argument.
+It should be a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is
+an action function or a list of action functions and ALIST is an
+action alist.  Each such action function should accept two
+arguments: a buffer to display and an alist of the same form as
+ALIST.  See `display-buffer' for details."
+  :type display-buffer--action-custom-type
+  :risky t
+  :version "30.1"
+  :group 'bs)
+
 ;; ----------------------------------------------------------------------
 ;; Functions
 ;; ----------------------------------------------------------------------
@@ -501,8 +515,8 @@ LIST is a list of buffers to test for appearance in Buffer 
Selection Menu.
 The result list depends on the global variables `bs-dont-show-regexp',
 `bs-must-show-regexp', `bs-dont-show-function', `bs-must-show-function'
 and `bs-buffer-sort-function'.
-If SORT-DESCRIPTION isn't nil the list will be sorted by
-a special function.  SORT-DESCRIPTION is an element of `bs-sort-functions'."
+If SORT-DESCRIPTION isn't nil the list will be sorted by a special
+function.  SORT-DESCRIPTION is an element of `bs-sort-functions'."
   (setq sort-description (or sort-description bs--current-sort-function)
        list (or list (buffer-list)))
   (let ((result nil))
@@ -568,9 +582,9 @@ SORT-DESCRIPTION is an element of `bs-sort-functions'."
     (beginning-of-line)))
 
 (defun bs--goto-current-buffer ()
-  "Goto line which represents the current buffer;
-actually the line which begins with character in `bs-string-current' or
-`bs-string-current-marked'."
+  "Go to line which represents the current buffer.
+Actually, it goes to the line which begins with the character
+in `bs-string-current' or `bs-string-current-marked'."
   (let ((regexp (concat "^"
                        (regexp-quote bs-string-current)
                        "\\|^"
@@ -590,21 +604,6 @@ actually the line which begins with character in 
`bs-string-current' or
     (format "Show buffer by configuration %S"
            bs-current-configuration)))
 
-(defun bs--track-window-changes (frame)
-  "Track window changes to refresh the buffer list.
-Used from `window-size-change-functions'."
-  (let ((win (get-buffer-window "*buffer-selection*" frame)))
-    (when win
-      (with-selected-window win
-       (bs--set-window-height)))))
-
-(defun bs--remove-hooks ()
-  "Remove `bs--track-window-changes' and auxiliary hooks."
-  (remove-hook 'window-size-change-functions 'bs--track-window-changes)
-  ;; Remove itself
-  (remove-hook 'kill-buffer-hook 'bs--remove-hooks t)
-  (remove-hook 'change-major-mode-hook 'bs--remove-hooks t))
-
 (put 'bs-mode 'mode-class 'special)
 
 (define-derived-mode bs-mode nil "Buffer-Selection-Menu"
@@ -663,25 +662,13 @@ apply it.
   (setq-local font-lock-defaults '(bs-mode-font-lock-keywords t))
   (setq-local font-lock-verbose nil)
   (setq-local font-lock-global-modes '(not bs-mode))
-  (setq-local revert-buffer-function 'bs-refresh)
-  (add-hook 'window-size-change-functions 'bs--track-window-changes)
-  (add-hook 'kill-buffer-hook 'bs--remove-hooks nil t)
-  (add-hook 'change-major-mode-hook 'bs--remove-hooks nil t))
-
-(defun bs--restore-window-config ()
-  "Restore window configuration on the current frame."
-  (when bs--window-config-coming-from
-    (let ((frame (selected-frame)))
-      (unwind-protect
-          (set-window-configuration bs--window-config-coming-from)
-       (select-frame frame)))
-    (setq bs--window-config-coming-from nil)))
+  (setq-local revert-buffer-function 'bs-refresh))
 
 (defun bs-kill ()
   "Let buffer disappear and reset window configuration."
   (interactive)
   (bury-buffer (current-buffer))
-  (bs--restore-window-config))
+  (quit-window))
 
 (defun bs-abort ()
   "Ding and leave Buffer Selection Menu without a selection."
@@ -705,7 +692,9 @@ Arguments are IGNORED (for `revert-buffer')."
 (defun bs--set-window-height ()
   "Change the height of the selected window to suit the current buffer list."
   (unless (one-window-p t)
-    (fit-window-to-buffer (selected-window) bs-max-window-height)))
+    (fit-window-to-buffer (selected-window) bs-max-window-height nil nil nil
+                         ;; preserve-size
+                         t)))
 
 (defun bs--current-buffer ()
   "Return buffer on current line.
@@ -742,7 +731,7 @@ Leave Buffer Selection Menu."
   (interactive)
   (let ((buffer (bs--current-buffer)))
     (bury-buffer (current-buffer))
-    (bs--restore-window-config)
+    (quit-window)
     (switch-to-buffer buffer)
     (when bs--marked-buffers
       ;; Some marked buffers for selection
@@ -765,7 +754,7 @@ Leave Buffer Selection Menu."
   (interactive)
   (let ((buffer (bs--current-buffer)))
     (bury-buffer (current-buffer))
-    (bs--restore-window-config)
+    (quit-window)
     (switch-to-buffer-other-window buffer)))
 
 (defun bs-tmp-select-other-window ()
@@ -781,7 +770,7 @@ Leave Buffer Selection Menu."
   (interactive)
   (let ((buffer (bs--current-buffer)))
     (bury-buffer (current-buffer))
-    (bs--restore-window-config)
+    (quit-window)
     (switch-to-buffer-other-frame buffer)))
 
 (defun bs-mouse-select-other-frame (event)
@@ -847,9 +836,8 @@ See `visit-tags-table'."
 
 (defun bs-set-current-buffer-to-show-always (&optional not-to-show-p)
   "Toggle status of buffer on line to `always shown'.
-NOT-TO-SHOW-P: prefix argument.
-With no prefix argument the buffer on current line is marked to show
-always.  Otherwise it is marked to show never."
+With prefix argument NOT-TO-SHOW-P, the buffer on current line
+is marked to never show instead."
   (interactive "P")
   (if not-to-show-p
       (bs-set-current-buffer-to-show-never)
@@ -1166,7 +1154,18 @@ Select buffer *buffer-selection* and display buffers 
according to current
 configuration `bs-current-configuration'.  Set window height, fontify buffer
 and move point to current buffer."
   (setq bs-current-list list)
-  (switch-to-buffer (get-buffer-create "*buffer-selection*"))
+  (let* ((window-combination-limit 'window-size)
+        (bs-buf (get-buffer-create "*buffer-selection*"))
+        (bs-win (progn
+                  (pop-to-buffer bs-buf bs-default-action-list)
+                  (selected-window))))
+    ;; Delete other windows showing *buffer-selection*.
+    ;; Done after pop-to-buffer, instead of just calling delete-windows-on,
+    ;; to allow display-buffer-reuse(-mode)?-window to be used in ALIST.
+    (dolist (w (get-buffer-window-list bs-buf 'not t))
+      (unless (eq w bs-win)
+       (with-demoted-errors "Error deleting window: %S"
+         (delete-window w)))))
   (bs-mode)
   (let* ((inhibit-read-only t)
         (map-fun (lambda (entry)
@@ -1247,8 +1246,6 @@ by buffer configuration `bs-cycle-configuration-name'."
                                        bs--cycle-list)))
              (next (car tuple))
              (cycle-list (cdr tuple)))
-        ;; We don't want the frame iconified if the only window in the frame
-        ;; happens to be dedicated.
         (bury-buffer (current-buffer))
        (switch-to-buffer next nil t)
        (setq bs--cycle-list (append (cdr cycle-list)
@@ -1349,11 +1346,11 @@ ALL-BUFFERS is the list of buffers appearing in Buffer 
Selection Menu."
               'help-echo "mouse-2: select this buffer, mouse-3: select in 
other frame"
               'mouse-face 'highlight))
 
-(defun bs--get-mode-name (start-buffer _all-buffers)
+(defun bs--get-mode-name (_start-buffer _all-buffers)
   "Return the name of mode of current buffer for Buffer Selection Menu.
 START-BUFFER is the buffer where we started buffer selection.
 ALL-BUFFERS is the list of buffers appearing in Buffer Selection Menu."
-  (format-mode-line mode-name nil nil start-buffer))
+  (format-mode-line mode-name nil nil nil))
 
 (defun bs--get-file-name (_start-buffer _all-buffers)
   "Return string for column `File' in Buffer Selection Menu.
@@ -1438,26 +1435,13 @@ for buffer selection."
       ;; Only when not in buffer *buffer-selection*
       ;; we have to set the buffer we started the command
       (setq bs--buffer-coming-from (current-buffer)))
-    (let ((liste (bs-buffer-list))
-         (active-window (get-window-with-predicate
-                         (lambda (w)
-                           (string= (buffer-name (window-buffer w))
-                                    "*buffer-selection*"))
-                         nil (selected-frame))))
-      (if active-window
-         (select-window active-window)
-       (bs--restore-window-config)
-       (setq bs--window-config-coming-from (current-window-configuration))
-       (when (> (window-height) 7)
-          ;; Errors would mess with the window configuration (bug#10882).
-          (ignore-errors (select-window (split-window-below)))))
-      (bs-show-in-buffer liste)
-      (bs-message-without-log "%s" (bs--current-config-message)))))
+    (bs-show-in-buffer (bs-buffer-list))
+    (bs-message-without-log "%s" (bs--current-config-message))))
 
 (defun bs--configuration-name-for-prefix-arg (prefix)
   "Convert prefix argument PREFIX to a name of a buffer configuration.
 If PREFIX is nil return `bs-default-configuration'.
-If PREFIX is an integer return PREFIX element of `bs-configurations'.
+If PREFIX is an integer return PREFIXth element of `bs-configurations'.
 Otherwise return `bs-alternative-configuration'."
   (cond ;; usually activation
    ((null prefix)
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index aa5f70edf2..448a5395c0 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -24,8 +24,8 @@
 ;;; Commentary:
 
 ;; The Buffer Menu is used to view, edit, delete, or change attributes
-;; of buffers.  The entry points are C-x C-b (`list-buffers') and
-;; M-x buffer-menu.
+;; of buffers.  The entry points are `C-x C-b' (`list-buffers') and
+;; `M-x buffer-menu'.
 
 ;;; Code:
 
@@ -107,6 +107,9 @@ The value should be a function of one argument; it will be
 called with the buffer.  If this function returns non-nil,
 then the buffer will be displayed in the buffer list.")
 
+(defvar-local Buffer-menu-buffer-list nil
+  "The current list of buffers or function to return buffers.")
+
 (defvar-keymap Buffer-menu-mode-map
   :doc "Local keymap for `Buffer-menu-mode' buffers."
   :parent tabulated-list-mode-map
@@ -135,6 +138,7 @@ then the buffer will be displayed in the buffer list.")
   "%"           #'Buffer-menu-toggle-read-only
   "b"           #'Buffer-menu-bury
   "V"           #'Buffer-menu-view
+  "O"           #'Buffer-menu-view-other-window
   "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
@@ -208,26 +212,25 @@ See `buffer-menu' for a description of its contents.
 In Buffer Menu mode, the following commands are defined:
 \\<Buffer-menu-mode-map>
 \\[quit-window]    Remove the Buffer Menu from the display.
-\\[Buffer-menu-this-window]  Select current line's buffer in place of the 
buffer menu.
+\\[Buffer-menu-this-window]    Select current line's buffer in place of the 
buffer menu.
 \\[Buffer-menu-other-window]    Select that buffer in another window,
      so the Buffer Menu remains visible in its window.
-\\[Buffer-menu-view]    Select current line's buffer, in View mode.
-\\[Buffer-menu-view-other-window]  Select that buffer in
-     another window, in `view-mode'.
+\\[Buffer-menu-view]    Select current line's buffer, in `view-mode'.
+\\[Buffer-menu-view-other-window]    Select that buffer in another window, in 
`view-mode'.
 \\[Buffer-menu-switch-other-window]  Make another window display that buffer.
 \\[Buffer-menu-mark]    Mark current line's buffer to be displayed.
 \\[Buffer-menu-select]    Select current line's buffer.
-     Also show buffers marked with m, in other windows.
+     Also show buffers marked with \"m\", in other windows.
 \\[Buffer-menu-1-window]    Select that buffer in full-frame window.
 \\[Buffer-menu-2-window]    Select that buffer in one window, together with the
      buffer selected before this one in another window.
 \\[Buffer-menu-isearch-buffers]    Incremental search in the marked buffers.
 \\[Buffer-menu-isearch-buffers-regexp]  Isearch for regexp in the marked 
buffers.
-\\[Buffer-menu-multi-occur] Show lines matching regexp in the marked buffers.
+\\[Buffer-menu-multi-occur]    Show lines matching regexp in the marked 
buffers.
 \\[Buffer-menu-visit-tags-table]    `visit-tags-table' this buffer.
 \\[Buffer-menu-not-modified]    Clear modified-flag on that buffer.
 \\[Buffer-menu-save]    Mark that buffer to be saved, and move down.
-\\[Buffer-menu-delete]  Mark that buffer to be deleted, and move down.
+\\[Buffer-menu-delete]    Mark that buffer to be deleted, and move down.
 \\[Buffer-menu-delete-backwards]  Mark that buffer to be deleted, and move up.
 \\[Buffer-menu-execute]    Delete or save marked buffers.
 \\[Buffer-menu-unmark]    Remove all marks from current line.
@@ -628,8 +631,10 @@ This behaves like invoking \\[read-only-mode] in that 
buffer."
 This is called by `buffer-menu' and others as a subroutine.
 
 If FILES-ONLY is non-nil, show only file-visiting buffers.
-If BUFFER-LIST is non-nil, it should be a list of buffers; it
-means list those buffers and no others.
+If BUFFER-LIST is non-nil, it should be either a list of buffers
+or a function that returns a list of buffers; it means
+list those buffers and no others.
+See more at `Buffer-menu-buffer-list'.
 If FILTER-PREDICATE is non-nil, it should be a function
 that filters out buffers from the list of buffers.
 See more at `Buffer-menu-filter-predicate'."
@@ -639,6 +644,7 @@ See more at `Buffer-menu-filter-predicate'."
       (Buffer-menu-mode)
       (setq Buffer-menu-files-only
            (and files-only (>= (prefix-numeric-value files-only) 0)))
+      (setq Buffer-menu-buffer-list buffer-list)
       (setq Buffer-menu-filter-predicate filter-predicate)
       (list-buffers--refresh buffer-list old-buffer)
       (tabulated-list-print))
@@ -665,9 +671,16 @@ See more at `Buffer-menu-filter-predicate'."
                               Buffer-menu-filter-predicate))
        entries name-width)
     ;; Collect info for each buffer we're interested in.
-    (dolist (buffer (or buffer-list
-                       (buffer-list (if Buffer-menu-use-frame-buffer-list
-                                        (selected-frame)))))
+    (dolist (buffer (cond
+                     ((functionp buffer-list)
+                      (funcall buffer-list))
+                     (buffer-list)
+                     ((functionp Buffer-menu-buffer-list)
+                      (funcall Buffer-menu-buffer-list))
+                     (Buffer-menu-buffer-list)
+                     (t (buffer-list
+                         (if Buffer-menu-use-frame-buffer-list
+                             (selected-frame))))))
       (with-current-buffer buffer
        (let* ((name (buffer-name))
               (file buffer-file-name))
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index c8405c7d1a..cc1f5085a7 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -317,30 +317,35 @@ If you change this, be sure to set `math-units-table' to 
nil to ensure
 that the combined units table will be rebuilt.")
 
 (defvar math-unit-prefixes
-  '( ( ?Y  (^ 10 24)  "Yotta"  )
-     ( ?Z  (^ 10 21)  "Zetta"  )
-     ( ?E  (^ 10 18)  "Exa"    )
-     ( ?P  (^ 10 15)  "Peta"   )
-     ( ?T  (^ 10 12)  "Tera"   )
-     ( ?G  (^ 10 9)   "Giga"   )
-     ( ?M  (^ 10 6)   "Mega"   )
-     ( ?k  (^ 10 3)   "Kilo"   )
-     ( ?K  (^ 10 3)   "Kilo"   )
-     ( ?h  (^ 10 2)   "Hecto"  )
-     ( ?H  (^ 10 2)   "Hecto"  )
-     ( ?D  (^ 10 1)   "Deka"   )
+  '( ( ?Q  (^ 10 30)  "quetta"  )
+     ( ?R  (^ 10 27)  "ronna"  )
+     ( ?Y  (^ 10 24)  "yotta"  )
+     ( ?Z  (^ 10 21)  "zetta"  )
+     ( ?E  (^ 10 18)  "exa"    )
+     ( ?P  (^ 10 15)  "peta"   )
+     ( ?T  (^ 10 12)  "tera"   )
+     ( ?G  (^ 10 9)   "giga"   )
+     ( ?M  (^ 10 6)   "mega"   )
+     ( ?k  (^ 10 3)   "kilo"   )
+     ( ?K  (^ 10 3)   "kilo"   )
+     ( ?h  (^ 10 2)   "hecto"  )
+     ( ?H  (^ 10 2)   "hecto"  )
+     ( ?D  (^ 10 1)   "deka"   )
      ( 0   (^ 10 0)    nil     )
-     ( ?d  (^ 10 -1)  "Deci"   )
-     ( ?c  (^ 10 -2)  "Centi"  )
-     ( ?m  (^ 10 -3)  "Milli"  )
-     ( ?u  (^ 10 -6)  "Micro"  )
-     ( ?μ  (^ 10 -6)  "Micro"  )
-     ( ?n  (^ 10 -9)  "Nano"   )
-     ( ?p  (^ 10 -12) "Pico"   )
-     ( ?f  (^ 10 -15) "Femto"  )
-     ( ?a  (^ 10 -18) "Atto"   )
+     ( ?d  (^ 10 -1)  "deci"   )
+     ( ?c  (^ 10 -2)  "centi"  )
+     ( ?m  (^ 10 -3)  "milli"  )
+     ( ?u  (^ 10 -6)  "micro"  )
+     ( ?μ  (^ 10 -6)  "micro"  )
+     ( ?n  (^ 10 -9)  "nano"   )
+     ( ?p  (^ 10 -12) "pico"   )
+     ( ?f  (^ 10 -15) "femto"  )
+     ( ?a  (^ 10 -18) "atto"   )
      ( ?z  (^ 10 -21) "zepto"  )
-     ( ?y  (^ 10 -24) "yocto"  )))
+     ( ?y  (^ 10 -24) "yocto"  )
+     ( ?r  (^ 10 -27) "ronto"  )
+     ( ?q  (^ 10 -30) "quecto"  )
+     ))
 
 (defvar math-standard-units-systems
   '( ( base  nil )
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index cf54293989..5575740040 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -1641,9 +1641,11 @@ enumeration, given as a Lisp time value -- used for test 
purposes."
                        entry-main)
          ;; regular sexp entry
          (icalendar--dmsg "diary-sexp %s" entry-main)
-         (let ((p1 (substring entry-main (match-beginning 1) (match-end 1)))
-               (p2 (substring entry-main (match-beginning 2) (match-end 2)))
-               (now (or start (current-time))))
+         (let* ((entry-main (substring entry-main 2))
+                (res (read-from-string entry-main))
+                (p1 (prin1-to-string (car res)))
+                (p2 (substring entry-main (cdr res)))
+                (now (or start (current-time))))
            (delete nil
                    (mapcar
                     (lambda (offset)
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index 5e08413a96..c8470e08cb 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -1578,7 +1578,7 @@ Optional PARENT and COLOR as specified with
   c-mode (token &optional parent color)
   "Return an UML string describing TOKEN for C and C++.
 Optional PARENT and COLOR as specified with
-`semantic-abbreviate-tag-default'."
+`semantic-format-tag-abbreviate-default'."
   ;; If we have special template things, append.
   (concat  (semantic-format-tag-uml-prototype-default token parent color)
           (semantic-c-template-string token parent color)))
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index 00fe081acb..1f372804dc 100644
--- a/lisp/cedet/semantic/complete.el
+++ b/lisp/cedet/semantic/complete.el
@@ -1731,7 +1731,7 @@ Display mechanism using tooltip for a list of possible 
completions.")
       ;; Add any tail info.
       (setq msg (concat msg msg-tail))
       ;; Display tooltip.
-      (when (not (eq msg ""))
+      (when (not (equal msg ""))
        (semantic-displayer-tooltip-show msg)))))
 
 ;;; Compatibility
diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el
index ff62f53d3c..08e03bf715 100644
--- a/lisp/cedet/semantic/db.el
+++ b/lisp/cedet/semantic/db.el
@@ -351,7 +351,7 @@ Note: This index will not be saved in a persistent file.")
           ;; the tables without using the accessor.
           :accessor semanticdb-get-database-tables
           :protection :protected
-          :documentation "List of `semantic-db-table' objects."))
+           :documentation "List of `semanticdb-table' objects."))
   "Database of file tables.")
 
 (cl-defmethod semanticdb-full-filename ((obj semanticdb-table))
diff --git a/lisp/cedet/semantic/decorate/include.el 
b/lisp/cedet/semantic/decorate/include.el
index fe510c371e..26785298e6 100644
--- a/lisp/cedet/semantic/decorate/include.el
+++ b/lisp/cedet/semantic/decorate/include.el
@@ -790,9 +790,7 @@ any decorated referring includes.")
     ;; This is a hack.  Add in something better?
     (semanticdb-notify-references
      table (lambda (tab _me)
-            (semantic-decoration-unparsed-include-refrence-reset tab)
-            ))
-    ))
+            (semantic-decoration-unparsed-include-reference-reset tab)))))
 
 (cl-defmethod semanticdb-partial-synchronize ((cache 
semantic-decoration-unparsed-include-cache)
                                           new-tags)
@@ -805,7 +803,7 @@ any decorated referring includes.")
   "Synchronize a CACHE with some NEW-TAGS."
   (semantic-reset cache))
 
-(defun semantic-decoration-unparsed-include-refrence-reset (table)
+(defun semantic-decoration-unparsed-include-reference-reset (table)
   "Refresh any highlighting in buffers referred to by TABLE.
 If TABLE is not in a buffer, do nothing."
   ;; This cache removal may seem odd in that we are "creating one", but
@@ -835,6 +833,8 @@ If TABLE is not in a buffer, do nothing."
        (semantic-decorate-add-decorations allinc)
        ))))
 
+(define-obsolete-function-alias 
'semantic-decoration-unparsed-include-refrence-reset
+  #'semantic-decoration-unparsed-include-reference-reset "30.1")
 
 (provide 'semantic/decorate/include)
 
diff --git a/lisp/cedet/semantic/format.el b/lisp/cedet/semantic/format.el
index 80e7f1117a..3d9476d685 100644
--- a/lisp/cedet/semantic/format.el
+++ b/lisp/cedet/semantic/format.el
@@ -123,7 +123,7 @@ See that variable for details on adding new types."
 
 (defun semantic--format-colorize-merge-text (precoloredtext face-class)
   "Apply onto PRECOLOREDTEXT a color associated with FACE-CLASS.
-FACE-CLASS is a tag type found in `semantic-formatface-alist'.
+FACE-CLASS is a tag type found in `semantic-format-face-alist'.
 See that variable for details on adding new types."
   (let ((face (cdr-safe (assoc face-class semantic-format-face-alist)))
        (newtext (concat precoloredtext)))
diff --git a/lisp/cedet/semantic/grm-wy-boot.el 
b/lisp/cedet/semantic/grm-wy-boot.el
index 7fff36a3d0..376fab89c2 100644
--- a/lisp/cedet/semantic/grm-wy-boot.el
+++ b/lisp/cedet/semantic/grm-wy-boot.el
@@ -396,12 +396,12 @@
              (let
                  ((s $1))
                (if
-                    (string-match "^{[\^M\n     ]*" s)
+                   (string-match "^{[
\n       ]*" s)
                    (setq s
                          (substring s
                                     (match-end 0))))
                (if
-                    (string-match "[\^M\n       ]*}$" s)
+                   (string-match "[
\n       ]*}$" s)
                    (setq s
                          (substring s 0
                                     (match-beginning 0))))
diff --git a/lisp/cedet/semantic/ia.el b/lisp/cedet/semantic/ia.el
index 2172085d6b..da884b9d16 100644
--- a/lisp/cedet/semantic/ia.el
+++ b/lisp/cedet/semantic/ia.el
@@ -457,7 +457,7 @@ parts of the parent classes are displayed."
   ;; it.  The simple `semanticdb-find-tag-by-...' are simple, and
   ;; you need to pass it the exact name you want.
   ;;
-  ;; The analyzer function `semantic-analyze-tag-name' will take
+  ;; The analyzer function `semantic-analyze-find-tag' will take
   ;; more complex names, such as the cpp symbol foo::bar::baz,
   ;; and break it up, and dive through the namespaces.
   (let ((class (semantic-analyze-find-tag typename)))
diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el
index e53dd9104a..8ab115d717 100644
--- a/lisp/cedet/semantic/idle.el
+++ b/lisp/cedet/semantic/idle.el
@@ -347,7 +347,7 @@ Returns t if all processing succeeded."
   "Core handler for idle work processing of long running tasks.
 Visits Semantic controlled buffers, and makes sure all needed
 include files have been parsed, and that the typecache is up to date.
-Uses `semantic-idle-work-for-on-buffer' to do the work."
+Uses `semantic-idle-work-for-one-buffer' to do the work."
   (let*
       ((errbuf nil)
        (interrupted
diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el
index b66e5c19cb..390c13ec98 100644
--- a/lisp/cedet/semantic/lex-spp.el
+++ b/lisp/cedet/semantic/lex-spp.el
@@ -1256,7 +1256,7 @@ DOC is the documentation for the analyzer.
 REGEXP is a regular expression for the analyzer to match.
 See `define-lex-regex-analyzer' for more on regexp.
 TOKIDX is an index into REGEXP for which a new lexical token
-of type `spp-macro-include' is to be created.
+of type `spp-system-include' is to be created.
 VALFORM are forms that return the name of the thing being included, and the
 type of include.  The return value should be of the form:
   (NAME . TYPE)
diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el
index b3c9e96538..264b202771 100644
--- a/lisp/cedet/semantic/lex.el
+++ b/lisp/cedet/semantic/lex.el
@@ -1436,9 +1436,9 @@ Return either a paren token or a semantic list token 
depending on
 
 (define-lex semantic-comment-lexer
   "A simple lexical analyzer that handles comments.
-This lexer will only return comment tokens.  It is the default lexer
-used by `semantic-find-doc-snarf-comment' to snarf up the comment at
-point."
+This lexer will only return comment tokens.  It is the default
+lexer used by `semantic-doc-snarf-comment-for-tag' to snarf up
+the comment at point."
   semantic-lex-ignore-whitespace
   semantic-lex-ignore-newline
   semantic-lex-comments
diff --git a/lisp/cedet/semantic/sort.el b/lisp/cedet/semantic/sort.el
index 756b949c0d..e02abe9876 100644
--- a/lisp/cedet/semantic/sort.el
+++ b/lisp/cedet/semantic/sort.el
@@ -474,7 +474,7 @@ The default behavior, if not overridden with
 the name of TAG.
 
 If this function is overridden, use
-`semantic-tag-external-member-children-p-default' to also
+`semantic-tag-external-member-children-default' to also
 include the default behavior, and merely extend your own."
   )
 
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index 16bbacc428..2ad95fb5a0 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -388,7 +388,8 @@ Each element is a cons cell of the form (LINE . FILENAME).")
             :type list
             :documentation
             "The list of tags with hits in them.
-Use the `semantic-symref-hit-tags' method to get this list.")
+Use the `semantic-symref-hit-to-tag-via-buffer' method to get
+this list.")
    )
   "The results from a symbol reference search.")
 
diff --git a/lisp/comint.el b/lisp/comint.el
index 93b97cb22b..7ba423e65d 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -78,7 +78,7 @@
 ;;
 ;; Not bound by default in comint-mode (some are in shell mode)
 ;; comint-run                          Run a program under comint-mode
-;; comint-send-invisible               Read a line w/o echo, and send to proc
+;; comint-send-invisible               Read a line without echo, and send to 
proc
 ;; comint-dynamic-complete-filename    Complete filename at point.
 ;; comint-dynamic-list-filename-completions List completions in help buffer.
 ;; comint-replace-by-expanded-filename Expand and complete filename at point;
@@ -384,7 +384,7 @@ This variable is buffer-local."
    "\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?"
    ;; "[[:alpha:]]" used to be "for", which fails to match non-English.
    "\\(?: [[:alpha:]]+ .+\\)?[[:blank:]]*[::៖][[:space:]]*\\'"
-   ;; The ccrypt encryption dialogue doesn't end with a colon, so
+   ;; The ccrypt encryption dialog doesn't end with a colon, so
    ;; treat it specially.
    "\\|^Enter encryption key: (repeat) *\\'"
    ;; openssh-8.6p1 format: "(user@host) Password:".
@@ -4121,9 +4121,15 @@ function called, or nil, if no function was called (if 
BEG = END)."
         (save-restriction
           (let ((beg2 beg1)
                 (end2 end1))
-            (when (= beg2 beg)
+            (when (and (= beg2 beg)
+                       (> beg2 (point-min))
+                       (eq is-output
+                           (eq (get-text-property (1- beg2) 'field) 'output)))
               (setq beg2 (field-beginning beg2)))
-            (when (= end2 end)
+            (when (and (= end2 end)
+                       (< end2 (point-max))
+                       (eq is-output
+                           (eq (get-text-property (1+ end2) 'field) 'output)))
               (setq end2 (field-end end2)))
             ;; Narrow to the whole field surrounding the region
             (narrow-to-region beg2 end2))
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 00ee9504c2..65eb066a55 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -903,9 +903,9 @@ This also shows the saved values in the buffer."
 (defun custom-reset-standard-save-and-update ()
   "Save settings and redraw after erasing customizations."
   (when (or (and custom-reset-standard-variables-list
-                (not (eq custom-reset-standard-variables-list  '(t))))
+                (not (equal custom-reset-standard-variables-list  '(t))))
            (and custom-reset-standard-faces-list
-                (not (eq custom-reset-standard-faces-list '(t)))))
+                (not (equal custom-reset-standard-faces-list '(t)))))
     ;; Save settings to file.
     (custom-save-all)
     ;; Set state of and redraw variables.
@@ -1073,7 +1073,7 @@ plain variables.  This means that `setopt' will execute 
any
   ;; Check that the type is correct.
   (when-let ((type (get variable 'custom-type)))
     (unless (widget-apply (widget-convert type) :match value)
-      (user-error "Value `%S' does not match type %s" value type)))
+      (warn "Value `%S' does not match type %s" value type)))
   (put variable 'custom-check-value (list value))
   (funcall (or (get variable 'custom-set) #'set-default) variable value))
 
@@ -1238,7 +1238,7 @@ Show the buffer in another window, but don't select it."
     (unless (eq symbol basevar)
       (message "`%s' is an alias for `%s'" symbol basevar))))
 
-(defvar customize-changed-options-previous-release "28.1"
+(defvar customize-changed-options-previous-release "29.1"
   "Version for `customize-changed' to refer back to by default.")
 
 ;; Packages will update this variable, so make it available.
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 7fad031add..f105f29244 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -77,8 +77,9 @@ into help buttons that call `describe-text-category' or
                                            (prin1-to-string (nth 0 b) t)))))
     (let ((key (nth 0 elt))
          (value (nth 1 elt)))
-      (insert (propertize (format "  %-20s " key)
-                         'face 'help-argument-name))
+      (insert (format "  %-20s "
+                      (propertize (symbol-name key)
+                                  'face 'help-argument-name)))
       (cond ((eq key 'category)
             (insert-text-button
              (symbol-name value)
@@ -365,7 +366,7 @@ This function is semi-obsolete.  Use 
`get-char-code-property'."
 ;; description is added to the category name as a tooltip
 (defsubst describe-char-categories (category-set)
   (let ((mnemonics (category-set-mnemonics category-set)))
-    (unless (eq mnemonics "")
+    (unless (equal mnemonics "")
       (list (mapconcat
             (lambda (x)
               (let* ((c (category-docstring x))
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 5e1745069f..7499e590a0 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1,7 +1,6 @@
 ;;; dired-aux.el --- less commonly used parts of dired -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1985-1986, 1992, 1994, 1998, 2000-2022 Free Software
-;; Foundation, Inc.
+;; Copyright (C) 1985-2022 Free Software Foundation, Inc.
 
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>.
 ;; Maintainer: emacs-devel@gnu.org
@@ -25,7 +24,7 @@
 
 ;;; Commentary:
 
-;; The parts of dired mode not normally used.  This is a space-saving hack
+;; The parts of Dired mode not normally used.  This is a space-saving hack
 ;; to avoid having to load a large mode when all that's wanted are a few
 ;; functions.
 
@@ -37,8 +36,6 @@
 ;;; Code:
 
 (require 'cl-lib)
-;; We need macros in dired.el to compile properly,
-;; and we call subroutines in it too.
 (require 'dired)
 
 (defvar dired-create-files-failures nil
@@ -135,7 +132,7 @@ substituted, and will be passed through normally to the 
shell.
 
 %s
 
-\(Press ^ to %s markers below these occurrences.)
+(Press ^ to %s markers below these occurrences.)
 "
    "`"
    (string (aref command (car char-positions)))
@@ -298,7 +295,7 @@ With prefix arg, prompt for argument SWITCHES which is 
options for `diff'."
 
 ;;;###autoload
 (defun dired-compare-directories (dir2 predicate)
-  "Mark files with different file attributes in two dired buffers.
+  "Mark files with different file attributes in two Dired buffers.
 Compare file attributes of files in the current directory
 with file attributes in directory DIR2 using PREDICATE on pairs of files
 with the same name.  Mark files for which PREDICATE returns non-nil.
@@ -312,8 +309,8 @@ PREDICATE is a Lisp expression that can refer to the 
following variables:
     fa1, fa2       - list of file attributes
                      returned by function `file-attributes'
 
-    where 1 refers to attribute of file in the current dired buffer
-    and 2 to attribute of file in second dired buffer.
+    where 1 refers to attribute of file in the current Dired buffer
+    and 2 to attribute of file in second Dired buffer.
 
 Examples of PREDICATE:
 
@@ -489,7 +486,8 @@ List has a form of (file-name full-file-name 
(attribute-list))."
 (defun dired-do-chmod (&optional arg)
   "Change the mode of the marked (or next ARG) files.
 Both octal numeric modes like `644' and symbolic modes like `g+w'
-are supported.  Type M-n to pull the file attributes of the file
+are supported.  Type \\<minibuffer-local-completion-map>\
+\\[next-history-element] to pull the file attributes of the file
 at point into the minibuffer.
 
 See Info node `(coreutils)File permissions' for more information.
@@ -538,7 +536,8 @@ has no effect on MS-Windows."
 ;;;###autoload
 (defun dired-do-chgrp (&optional arg)
   "Change the group of the marked (or next ARG) files.
-Type M-n to pull the file attributes of the file at point
+Type \\<minibuffer-local-completion-map>\\[next-history-element] \
+to pull the file attributes of the file at point
 into the minibuffer."
   (interactive "P")
   (if (and (memq system-type '(ms-dos windows-nt))
@@ -549,7 +548,8 @@ into the minibuffer."
 ;;;###autoload
 (defun dired-do-chown (&optional arg)
   "Change the owner of the marked (or next ARG) files.
-Type M-n to pull the file attributes of the file at point
+Type \\<minibuffer-local-completion-map>\\[next-history-element] \
+to pull the file attributes of the file at point
 into the minibuffer."
   (interactive "P")
   (if (and (memq system-type '(ms-dos windows-nt))
@@ -561,7 +561,8 @@ into the minibuffer."
 (defun dired-do-touch (&optional arg)
   "Change the timestamp of the marked (or next ARG) files.
 This calls touch.
-Type M-n to pull the file attributes of the file at point
+Type Type \\<minibuffer-local-completion-map>\\[next-history-element] \
+to pull the file attributes of the file at point
 into the minibuffer."
   (interactive "P")
   (dired-do-chxxx "Timestamp" dired-touch-program 'touch arg))
@@ -761,7 +762,7 @@ with a prefix argument."
 (defvar dired-aux-files)
 
 (defun dired-minibuffer-default-add-shell-commands ()
-  "Return a list of all commands associated with current dired files.
+  "Return a list of all commands associated with current Dired files.
 This function is used to add all related commands retrieved by `mailcap'
 to the end of the list of defaults just after the default value."
   (interactive)
@@ -774,7 +775,7 @@ to the end of the list of defaults just after the default 
value."
 
 ;; This is an extra function so that you can redefine it, e.g., to use gmhist.
 (defun dired-read-shell-command (prompt arg files)
-  "Read a dired shell command.
+  "Read a Dired shell command.
 PROMPT should be a format string with one \"%s\" format sequence,
 which is replaced by the value returned by `dired-mark-prompt',
 with ARG and FILES as its arguments.  FILES should be a list of
@@ -921,11 +922,11 @@ Also see the `dired-confirm-shell-command' variable."
 
 ;; Might use {,} for bash or csh:
 (defvar dired-mark-prefix ""
-  "Prepended to marked files in dired shell commands.")
+  "Prepended to marked files in Dired shell commands.")
 (defvar dired-mark-postfix ""
-  "Appended to marked files in dired shell commands.")
+  "Appended to marked files in Dired shell commands.")
 (defvar dired-mark-separator " "
-  "Separates marked files in dired shell commands.")
+  "Separates marked files in Dired shell commands.")
 
 (defun dired-shell-stuff-it (command file-list on-each &optional _raw-arg)
   ;; "Make up a shell command line from COMMAND and FILE-LIST.
@@ -1336,7 +1337,7 @@ See `dired-guess-shell-alist-user'."
 (defun dired-kill-line (&optional arg)
   "Kill the current line (not the files).
 With a prefix argument, kill that many lines starting with the current line.
-\(A negative argument kills backward.)"
+(A negative argument kills backward.)"
   (interactive "P")
   (setq arg (prefix-numeric-value arg))
   (let (buffer-read-only file)
@@ -1844,7 +1845,7 @@ See Info node `(emacs)Subdir switches' for more details."
     (message "Redisplaying...done")))
 
 (defun dired-reset-subdir-switches ()
-  "Set `dired-switches-alist' to nil and revert dired buffer."
+  "Set `dired-switches-alist' to nil and revert Dired buffer."
   (interactive)
   (setq dired-switches-alist nil)
   (revert-buffer))
@@ -1880,7 +1881,7 @@ See Info node `(emacs)Subdir switches' for more details."
 (defvar dired-omit-localp)
 
 (defun dired-add-entry (filename &optional marker-char relative)
-  "Add a new dired entry for FILENAME.
+  "Add a new Dired entry for FILENAME.
 Optionally mark it with MARKER-CHAR (a character, else uses
 `dired-marker-char').  Note that this adds the entry `out of order'
 if files are sorted by time, etc.
@@ -2008,7 +2009,7 @@ files matching `dired-omit-regexp'."
 
 ;;;###autoload
 (defun dired-remove-file (file)
-  "Remove entry FILE on each dired buffer.
+  "Remove entry FILE on each Dired buffer.
 Note this doesn't delete FILE in the file system.
 See `dired-delete-file' in case you wish that."
   (dired-fun-in-all-buffers
@@ -2107,7 +2108,7 @@ option are non-nil, renaming a directory named `old_name' 
to
 `new_name' does not exists already, it will be created and
 `old_name' be moved into it.  If only `new_name' (without the
 trailing /) is given or this option or
-`dired-create-destination-dirs' is `nil', `old_name' will be
+`dired-create-destination-dirs' is nil, `old_name' will be
 renamed to `new_name'."
   :type '(choice
           (const :tag
@@ -3077,7 +3078,7 @@ Type \\`SPC' or \\`y' to %s one file, \\`DEL' or \\`n' to 
skip to next,
 ;;;###autoload
 (defun dired-maybe-insert-subdir (dirname &optional
                                          switches no-error-if-not-dir-p)
-  "Insert this subdirectory into the same dired buffer.
+  "Insert this subdirectory into the same Dired buffer.
 If it is already present, just move to it (type \\[dired-do-redisplay] to 
refresh),
   else inserts it at its natural place (as `ls -lR' would have done).
 With a prefix arg, you may edit the ls switches used for this listing.
@@ -3427,7 +3428,7 @@ Lower levels are unaffected."
 
 ;;;###autoload
 (defun dired-tree-up (arg)
-  "Go up ARG levels in the dired tree."
+  "Go up ARG levels in the Dired tree."
   (interactive "p")
   (let ((dir (dired-current-directory)))
     (while (>= arg 1)
@@ -3439,7 +3440,7 @@ Lower levels are unaffected."
 
 ;;;###autoload
 (defun dired-tree-down ()
-  "Go down in the dired tree."
+  "Go down in the Dired tree."
   (interactive)
   (let ((dir (dired-current-directory)) ; has slash
        pos case-fold-search)           ; filenames are case sensitive
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index a7e1df3622..898dfffef6 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -755,7 +755,8 @@ for speeding up processing.")
                  ((eq head 'list) (cdr form))
                  ((memq head
                         ;; FIXME: Replace this list with a function property?
-                        '( length safe-length cons lambda
+                        '( lambda internal-make-closure
+                           length safe-length cons
                            string unibyte-string make-string concat
                            format format-message
                            substring substring-no-properties string-replace
@@ -1297,11 +1298,8 @@ See Info node `(elisp) Integer Basics'."
       (if else
           `(progn ,condition ,@else)
         condition))
-     ;; (if X nil t) -> (not X)
-     ((and (eq then nil) (eq else '(t)))
-      `(not ,condition))
-     ;; (if X t [nil]) -> (not (not X))
-     ((and (eq then t) (or (null else) (eq else '(nil))))
+     ;; (if X t) -> (not (not X))
+     ((and (eq then t) (null else))
       `(not ,(byte-opt--negate condition)))
      ;; (if VAR VAR X...) -> (or VAR (progn X...))
      ((and (symbolp condition) (eq condition then))
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index a33808ab92..b5e887db83 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -632,7 +632,7 @@ enabled."
 (defmacro with-suppressed-warnings (warnings &rest body)
   "Like `progn', but prevents compiler WARNINGS in BODY.
 
-WARNINGS is an associative list where the first element of each
+WARNINGS is an association list where the first element of each
 item is a warning type, and the rest of the elements in each item
 are symbols they apply to.  For instance, if you want to suppress
 byte compilation warnings about the two obsolete functions `foo'
@@ -653,7 +653,8 @@ types.  The types that can be suppressed with this macro are
 `suspicious'.
 
 For the `mapcar' case, only the `mapcar' function can be used in
-the symbol list.  For `suspicious', only `set-buffer' and `lsh' can be used."
+the symbol list.  For `suspicious', only `set-buffer', `lsh' and `eq'
+can be used."
   ;; Note: during compilation, this definition is overridden by the one in
   ;; byte-compile-initial-macro-environment.
   (declare (debug (sexp body)) (indent 1))
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index f176e769bf..7571b4d409 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -5487,6 +5487,83 @@ and corresponding effects."
            (eval form)
          form)))
 
+;; Check for (in)comparable constant values in calls to `eq', `memq' etc.
+
+(defun bytecomp--dodgy-eq-arg-p (x number-ok)
+  "Whether X is a bad argument to `eq' (or `eql' if NUMBER-OK is non-nil)."
+  (pcase x
+    ((or `(quote ,(pred consp)) `(function (lambda . ,_))) t)
+    ((or (pred consp) (pred symbolp)) nil)
+    ((pred integerp)
+     (not (or (<= -536870912 x 536870911) number-ok)))
+    ((pred floatp) (not number-ok))
+    (_ t)))
+
+(defun bytecomp--value-type-description (x)
+  (cond
+    ((proper-list-p x) "list")
+    ((recordp x) "record")
+    (t (symbol-name (type-of x)))))
+
+(defun bytecomp--arg-type-description (x)
+  (pcase x
+    (`(function (lambda . ,_)) "function")
+    (`(quote . ,val) (bytecomp--value-type-description val))
+    (_ (bytecomp--value-type-description x))))
+
+(defun bytecomp--warn-dodgy-eq-arg (form type parenthesis)
+  (macroexp-warn-and-return
+   (format "`%s' called with literal %s that may never match (%s)"
+           (car form) type parenthesis)
+   form '(suspicious eq) t))
+
+(defun bytecomp--check-eq-args (form &optional a b &rest _ignore)
+  (let* ((number-ok (eq (car form) 'eql))
+         (bad-arg (cond ((bytecomp--dodgy-eq-arg-p a number-ok) 1)
+                        ((bytecomp--dodgy-eq-arg-p b number-ok) 2))))
+    (if bad-arg
+        (bytecomp--warn-dodgy-eq-arg
+         form
+         (bytecomp--arg-type-description (nth bad-arg form))
+         (format "arg %d" bad-arg))
+      form)))
+
+(put 'eq  'compiler-macro #'bytecomp--check-eq-args)
+(put 'eql 'compiler-macro #'bytecomp--check-eq-args)
+
+(defun bytecomp--check-memq-args (form &optional elem list &rest _ignore)
+  (let* ((fn (car form))
+         (number-ok (eq fn 'memql)))
+    (cond
+     ((bytecomp--dodgy-eq-arg-p elem number-ok)
+      (bytecomp--warn-dodgy-eq-arg
+       form (bytecomp--arg-type-description elem) "arg 1"))
+     ((and (consp list) (eq (car list) 'quote)
+           (proper-list-p (cadr list)))
+      (named-let loop ((elts (cadr list)) (i 1))
+        (if elts
+            (let* ((elt (car elts))
+                   (x (cond ((eq fn 'assq) (car-safe elt))
+                            ((eq fn 'rassq) (cdr-safe elt))
+                            (t elt))))
+              (if (or (symbolp x)
+                      (and (integerp x)
+                           (or (<= -536870912 x 536870911) number-ok))
+                      (and (floatp x) number-ok))
+                  (loop (cdr elts) (1+ i))
+                (bytecomp--warn-dodgy-eq-arg
+                 form (bytecomp--value-type-description x)
+                 (format "element %d of arg 2" i))))
+          form)))
+     (t form))))
+
+(put 'memq  'compiler-macro #'bytecomp--check-memq-args)
+(put 'memql 'compiler-macro #'bytecomp--check-memq-args)
+(put 'assq  'compiler-macro #'bytecomp--check-memq-args)
+(put 'rassq 'compiler-macro #'bytecomp--check-memq-args)
+(put 'remq  'compiler-macro #'bytecomp--check-memq-args)
+(put 'delq  'compiler-macro #'bytecomp--check-memq-args)
+
 (provide 'byte-compile)
 (provide 'bytecomp)
 
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el
index 9ff893b75b..16c2c34740 100644
--- a/lisp/emacs-lisp/chart.el
+++ b/lisp/emacs-lisp/chart.el
@@ -35,7 +35,7 @@
 ;; anything encapsulated in a nice eieio object.
 ;;
 ;;   Current example apps for chart can be accessed via these commands:
-;; `chart-file-count'     - count files w/ matching extensions
+;; `chart-file-count'     - count files with matching extensions
 ;; `chart-space-usage'    - display space used by files/directories
 ;; `chart-emacs-storage'  - Emacs storage units used/free (garbage-collect)
 ;; `chart-emacs-lists'    - length of Emacs lists
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 3bddb93b64..26d87a3622 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -22,28 +22,35 @@
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
-;;
+
 ;;   The Emacs Lisp manual has a nice chapter on how to write
 ;; documentation strings.  Many stylistic suggestions are fairly
 ;; deterministic and easy to check for syntactically, but also easy
 ;; to forget.  The main checkdoc engine will perform the stylistic
 ;; checks needed to make sure these styles are remembered.
 ;;
-;; There are three ways to use checkdoc:
-;;   1) Use `flymake-mode'.
+;; There are four ways to use checkdoc:
+;;
+;;   1) Use `flymake-mode'.  Type `M-x flymake-mode' in any Emacs Lisp
+;;      buffer; the checkdoc back-end is enabled by default.
+;;
 ;;   2) Periodically use `checkdoc' or `checkdoc-current-buffer'.
-;;      `checkdoc' is a more interactive version of
-;;      `checkdoc-current-buffer'
+;;      The `checkdoc' command is a more interactive version of
+;;      `checkdoc-current-buffer'.
+;;
 ;;   3) Use `checkdoc-minor-mode' to automatically check your
 ;;      documentation whenever you evaluate Lisp code with C-M-x
 ;;      or [menu-bar emacs-lisp eval-buffer].  Additional key-bindings
 ;;      are also provided under C-c ? KEY
 ;;        (add-hook 'emacs-lisp-mode-hook 'checkdoc-minor-mode)
 ;;
+;;   4) Use `checkdoc-ispell' to spellcheck docstrings interactively.
+;;
 ;; Using `checkdoc':
 ;;
-;;   The commands `checkdoc' and `checkdoc-ispell' are the top-level
-;; entry points to all of the different checks that are available.  It
+;;   Most users will probably use checkdoc through `flymake'.  The
+;; commands `checkdoc' and `checkdoc-ispell' are the top-level entry
+;; points to all of the different checks that are available.  It
 ;; breaks examination of your Lisp file into four sections (comments,
 ;; documentation, messages, and spacing) and indicates its current
 ;; state in a status buffer.
@@ -66,7 +73,7 @@
 ;; interface offers several options, including the ability to skip to
 ;; the next error, or back up to previous errors.  Auto-fixing is
 ;; turned off at this stage, but you can use the `f' or `F' key to fix
-;; a given error (if the fix is available.)
+;; a given error (if the fix is available).
 ;;
 ;; Auto-fixing:
 ;;
@@ -99,6 +106,7 @@
 ;; install into Ispell on the fly, but only if Ispell is not already
 ;; running.  Use `ispell-kill-ispell' to make checkdoc restart it with
 ;; these words enabled.
+;;   See also the `flyspell-prog-mode' minor mode.
 ;;
 ;; Checking parameters:
 ;;
@@ -176,6 +184,7 @@
   "Support for doc string checking in Emacs Lisp."
   :prefix "checkdoc"
   :group 'lisp
+  :link '(emacs-commentary-link "checkdoc.el")
   :version "20.3")
 
 (defcustom checkdoc-minor-mode-string " CDoc"
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 66b214554e..60b01051a3 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -552,7 +552,7 @@ too large if positive or too small if negative)."
                        ,new)))))
   (seq-subseq seq start end))
 
-;;; This isn't a defalias because autoloading defalises doesn't work
+;;; This isn't a defalias because autoloading defaliases doesn't work
 ;;; very well.
 
 ;;;###autoload
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 43a2ed9205..95e78ceab6 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2052,7 +2052,8 @@ info node `(cl) Function Bindings' for details.
     (dolist (binding bindings)
       (let ((var (make-symbol (format "--cl-%s--" (car binding))))
             (args-and-body (cdr binding)))
-        (if (and (= (length args-and-body) 1) (symbolp (car args-and-body)))
+        (if (and (= (length args-and-body) 1)
+                 (macroexp-copyable-p (car args-and-body)))
             ;; Optimize (cl-flet ((fun var)) body).
             (setq var (car args-and-body))
           (push (list var (if (= (length args-and-body) 1)
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 1ca0785998..94cf61f752 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -4029,8 +4029,11 @@ display a message."
                              :command (list
                                        (expand-file-name invocation-name
                                                          invocation-directory)
-                                       "-no-comp-spawn" "--batch" "-l"
-                                       temp-file)
+                                       "-no-comp-spawn" "--batch"
+                                       "--eval"
+                                       ;; Suppress Abort dialogs on MS-Windows
+                                       "(setq w32-disable-abort-dialog t)"
+                                       "-l" temp-file)
                              :sentinel
                              (lambda (process _event)
                                (run-hook-with-args
@@ -4139,7 +4142,6 @@ the deferred compilation mechanism."
                      comp-ctxt
                      (comp-ctxt-output comp-ctxt)
                      (file-exists-p (comp-ctxt-output comp-ctxt)))
-            (message "Deleting %s" (comp-ctxt-output comp-ctxt))
             (delete-file (comp-ctxt-output comp-ctxt))))))))
 
 (defun native-compile-async-skip-p (file load selector)
@@ -4357,7 +4359,9 @@ of (commands) to run simultaneously."
   (interactive)
   (unless (featurep 'native-compile)
     (user-error "This Emacs isn't built with native-compile support"))
-  (dolist (dir native-comp-eln-load-path)
+  ;; The last item in native-comp-eln-load-path is assumed to be a system
+  ;; directory, so don't try to delete anything there (bug#59658).
+  (dolist (dir (butlast native-comp-eln-load-path))
     ;; If a directory is non absolute it is assumed to be relative to
     ;; `invocation-directory'.
     (setq dir (expand-file-name dir invocation-directory))
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index 41e3a197af..2a45c1ab1c 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -390,10 +390,13 @@ ITEM defines an item as in `easy-menu-define'."
     (let ((key (easy-menu-intern name)))
       (cons key
             (and (not remove)
-                 (cons 'menu-item
-                       (cons label
-                             (and name
-                                  (cons command prop)))))))))
+                 (if (and (stringp label)
+                          (seq-every-p (lambda (c) (char-equal c ?-)) label))
+                     menu-bar-separator
+                   (cons 'menu-item
+                         (cons label
+                               (and name
+                                    (cons command prop))))))))))
 
 (defun easy-menu-define-key (menu key item &optional before)
   "Add binding in MENU for KEY => ITEM.  Similar to `define-key-after'.
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index c25ade22d6..67cbe62538 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -673,8 +673,11 @@ Bound dynamically.  This is a list of (PREFIX . MESSAGE) 
pairs.")
 
 To be used within ERT tests.  MESSAGE-FORM should evaluate to a
 string that will be displayed together with the test result if
-the test fails.  PREFIX-FORM should evaluate to a string as well
-and is displayed in front of the value of MESSAGE-FORM."
+the test fails.  MESSAGE-FORM can also evaluate to a function; in
+this case, it will be called when displaying the info.
+
+PREFIX-FORM should evaluate to a string as well and is displayed
+in front of the value of MESSAGE-FORM."
   (declare (debug ((form &rest [sexp form]) body))
           (indent 1))
   `(let ((ert--infos (cons (cons ,prefix-form ,message-form) ert--infos)))
@@ -1352,6 +1355,8 @@ RESULT must be an `ert-test-result-with-condition'."
             (end nil))
         (unwind-protect
             (progn
+              (when (functionp message)
+                (setq message (funcall message)))
               (insert message "\n")
               (setq end (point-marker))
               (goto-char begin)
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index 11251d7a96..48bc0269f3 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -417,9 +417,9 @@ The return value is the last VAL in the list.
   (lambda (do key alist &optional default remove testfn)
     (macroexp-let2 macroexp-copyable-p k key
       (gv-letplace (getter setter) alist
-        (macroexp-let2 nil p `(if (and ,testfn (not (eq ,testfn 'eq)))
-                                  (assoc ,k ,getter ,testfn)
-                                (assq ,k ,getter))
+        (macroexp-let2 nil p (if (member testfn '(nil 'eq #'eq))
+                                 `(assq ,k ,getter)
+                               `(assoc ,k ,getter ,testfn))
           (funcall do (if (null default) `(cdr ,p)
                         `(if ,p (cdr ,p) ,default))
                    (lambda (v)
diff --git a/lisp/emacs-lisp/icons.el b/lisp/emacs-lisp/icons.el
index 86c4483030..8ba6d97ea0 100644
--- a/lisp/emacs-lisp/icons.el
+++ b/lisp/emacs-lisp/icons.el
@@ -202,6 +202,10 @@ present if the icon is represented by an image."
                       (list :height (if (eq height 'line)
                                         (window-default-line-height)
                                       height)))
+                  (if-let ((width (plist-get keywords :width)))
+                      (list :width (if (eq width 'font)
+                                       (default-font-width)
+                                     width)))
                   '(:scale 1)
                   (if-let ((rotation (plist-get keywords :rotation)))
                       (list :rotation rotation))
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 7e39a77aed..bf87915818 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -514,7 +514,7 @@ This will generate compile-time constants from BINDINGS."
           (0 font-lock-builtin-face))
          ;; ELisp and CLisp `&' keywords as types.
          (,(lambda (bound) (lisp-mode--search-key "&" bound))
-          (0 font-lock-builtin-face))
+          (0 font-lock-type-face))
          ;; ELisp regexp grouping constructs
          (,(lambda (bound)
              (catch 'found
@@ -567,7 +567,7 @@ This will generate compile-time constants from BINDINGS."
           (0 font-lock-builtin-face))
          ;; ELisp and CLisp `&' keywords as types.
          (,(lambda (bound) (lisp-mode--search-key "&" bound))
-          (0 font-lock-builtin-face))
+          (0 font-lock-type-face))
          ;; ELisp regexp grouping constructs
          ;; This is too general -- rms.
          ;; A user complained that he has functions whose names start with `do'
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index ecc5f7e47b..2dd04174f5 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -108,21 +108,26 @@ scanning for autoloads and will be in the `load-path'."
   (let* ((name (file-relative-name file (file-name-directory outfile)))
          (names '())
          (dir (file-name-directory outfile)))
-    ;; If `name' has directory components, only keep the
-    ;; last few that are really needed.
-    (while name
-      (setq name (directory-file-name name))
-      (push (file-name-nondirectory name) names)
-      (setq name (file-name-directory name)))
-    (while (not name)
-      (cond
-       ((null (cdr names)) (setq name (car names)))
-       ((file-exists-p (expand-file-name "subdirs.el" dir))
-        ;; FIXME: here we only check the existence of subdirs.el,
-        ;; without checking its content.  This makes it generate wrong load
-        ;; names for cases like lisp/term which is not added to load-path.
-        (setq dir (expand-file-name (pop names) dir)))
-       (t (setq name (mapconcat #'identity names "/")))))
+    ;; If `name' lives inside an ancestor directory of OUTFILE, only
+    ;; keep the last few leading directories that are really needed.
+    ;; (It will always live in an ancestor directory of OUTFILE on
+    ;; Posix systems, but on DOS/Windows it could not be, if FILE and
+    ;; OUTFILE are on different drives.)
+    (when (not (file-name-absolute-p name))
+      (while name
+        (setq name (directory-file-name name))
+        (push (file-name-nondirectory name) names)
+        (setq name (file-name-directory name)))
+      (while (not name)
+        (cond
+         ((null (cdr names)) (setq name (car names)))
+         ((file-exists-p (expand-file-name "subdirs.el" dir))
+          ;; FIXME: here we only check the existence of subdirs.el,
+          ;; without checking its content.  This makes it generate
+          ;; wrong load names for cases like lisp/term which is not
+          ;; added to load-path.
+          (setq dir (expand-file-name (pop names) dir)))
+         (t (setq name (mapconcat #'identity names "/"))))))
     (if (string-match "\\.elc?\\(\\.\\|\\'\\)" name)
         (substring name 0 (match-beginning 0))
       name)))
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index f4df40249d..8953e5fd01 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -486,7 +486,7 @@ Assumes the caller has bound `macroexpand-all-environment'."
                          (setq form (macroexp--compiler-macro handler newform))
                          (if (eq newform form)
                              newform
-                           (macroexp--expand-all newform)))
+                           (macroexp--expand-all form)))
                      (macroexp--expand-all newform))))))
             (_ form))))
     (pop byte-compile-form-stack)))
diff --git a/lisp/emacs-lisp/multisession.el b/lisp/emacs-lisp/multisession.el
index 9d6e8c0d88..78d4137317 100644
--- a/lisp/emacs-lisp/multisession.el
+++ b/lisp/emacs-lisp/multisession.el
@@ -447,8 +447,9 @@ storage method to list."
   (let* ((object (or
                   ;; If the multisession variable already exists, use
                   ;; it (so that we update it).
-                  (and (intern-soft (cdr id))
-                       (bound-and-true-p (intern (cdr id))))
+                  (if-let (sym (intern-soft (cdr id)))
+                      (and (boundp sym) (symbol-value sym))
+                    nil)
                   ;; Create a new object.
                   (make-multisession
                    :package (car id)
diff --git a/lisp/emacs-lisp/oclosure.el b/lisp/emacs-lisp/oclosure.el
index a17fdb7e35..46bb02f5fb 100644
--- a/lisp/emacs-lisp/oclosure.el
+++ b/lisp/emacs-lisp/oclosure.el
@@ -4,18 +4,20 @@
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 
-;; 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 <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index a999596785..8f0eedd2f8 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -5,18 +5,20 @@
 ;; Author: Philip Kaludercic <philipk@posteo.net>
 ;; Keywords: tools
 
-;; 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:
 
@@ -48,6 +50,7 @@
 (eval-when-compile (require 'rx))
 (eval-when-compile (require 'inline))
 (eval-when-compile (require 'map))
+(eval-when-compile (require 'cl-lib))
 (require 'package)
 (require 'lisp-mnt)
 (require 'vc)
@@ -284,28 +287,48 @@ asynchronously."
            finally return "unknown"))
 
 (defun package-vc--version (pkg)
-  "Return the version number for the source package PKG."
+  "Return the version number for the VC package PKG."
   (cl-assert (package-vc-p pkg))
   (if-let ((main-file (package-vc--main-file pkg)))
       (with-temp-buffer
         (insert-file-contents main-file)
         (package-strip-rcs-id
          (or (lm-header "package-version")
-             (lm-header "version"))))
+             (lm-header "version")
+             "0")))
     "0"))
 
 (defun package-vc--main-file (pkg-desc)
   "Return the name of the main file for PKG-DESC."
   (cl-assert (package-vc-p pkg-desc))
-  (let ((pkg-spec (package-vc--desc->spec pkg-desc))
-        (name (symbol-name (package-desc-name pkg-desc))))
-    (or (plist-get pkg-spec :main-file)
-        (expand-file-name
-         (concat name ".el")
-         (file-name-concat
-          (or (package-desc-dir pkg-desc)
-              (expand-file-name name package-user-dir))
-          (plist-get pkg-spec :lisp-dir))))))
+  (let* ((pkg-spec (package-vc--desc->spec pkg-desc))
+         (name (symbol-name (package-desc-name pkg-desc)))
+         (directory (file-name-concat
+                     (or (package-desc-dir pkg-desc)
+                         (expand-file-name name package-user-dir))
+                     (plist-get pkg-spec :lisp-dir)))
+         (file (or (plist-get pkg-spec :main-file)
+                   (expand-file-name
+                    (concat name ".el")
+                    directory))))
+    (if (file-exists-p file) file
+      ;; The following heuristic is only necessary when fetching a
+      ;; repository with URL that would break the above assumptions.
+      ;; Concrete example: https://github.com/sachac/waveform-el does
+      ;; not have a file waveform-el.el, but a file waveform.el, so we
+      ;; try and find the closest match.
+      (let ((distance most-positive-fixnum) (best nil))
+        (dolist (alt (directory-files directory t "\\.el\\'" t))
+          (let ((sd (string-distance file alt)))
+            (when (and (not (string-match-p (rx (or (: "-autoloads.el")
+                                                    (: "-pkg.el"))
+                                                eos)
+                                            alt))
+                       (< sd distance))
+              (when (< sd distance)
+                (setq distance (string-distance file alt)
+                      best alt)))))
+        best))))
 
 (defun package-vc--generate-description-file (pkg-desc pkg-file)
   "Generate a package description file for PKG-DESC and write it to PKG-FILE."
@@ -334,7 +357,7 @@ asynchronously."
          (nconc
           (list 'define-package
                 (symbol-name name)
-                (cons 'vc (package-vc--version pkg-desc))
+                (package-vc--version pkg-desc)
                 (package-desc-summary pkg-desc)
                 (let ((requires (package-desc-reqs pkg-desc)))
                   (list 'quote
@@ -344,6 +367,7 @@ asynchronously."
                            (list (car elt)
                                  (package-version-join (cadr elt))))
                          requires))))
+          (list :kind 'vc)
           (package--alist-to-plist-args
            (package-desc-extras pkg-desc))))
         "\n")
@@ -386,7 +410,7 @@ otherwise it's assumed to be an Info file."
   "Prepare PKG-DESC that is already checked-out in PKG-DIR.
 This includes downloading missing dependencies, generating
 autoloads, generating a package description file (used to
-identify a package as a source package later on), building
+identify a package as a VC package later on), building
 documentation and marking the package as installed."
   ;; Remove any previous instance of PKG-DESC from `package-alist'
   (let ((pkgs (assq (package-desc-name pkg-desc) package-alist)))
@@ -463,10 +487,11 @@ documentation and marking the package as installed."
   (package--save-selected-packages
    (cons (package-desc-name pkg-desc)
          package-selected-packages))
+  (package--quickstart-maybe-refresh)
 
   ;; Confirm that the installation was successful
   (let ((main-file (package-vc--main-file pkg-desc)))
-    (message "Source package `%s' installed (Version %s, Revision %S)."
+    (message "VC package `%s' installed (Version %s, Revision %S)."
              (package-desc-name pkg-desc)
              (lm-with-file main-file
                (package-strip-rcs-id
@@ -522,7 +547,7 @@ checkout.  This overrides the `:branch' attribute in 
PKG-SPEC."
                (pkg-dir (expand-file-name dirname package-user-dir)))
     (setf (package-desc-dir pkg-desc) pkg-dir)
     (when (file-exists-p pkg-dir)
-      (if (yes-or-no-p "Overwrite previous checkout?")
+      (if (yes-or-no-p (format "Overwrite previous checkout for package `%s'?" 
name))
           (package--delete-directory pkg-dir)
         (error "There already exists a checkout for %s" name)))
     (package-vc--clone pkg-desc pkg-spec pkg-dir rev)
@@ -533,11 +558,11 @@ checkout.  This overrides the `:branch' attribute in 
PKG-SPEC."
     (package-vc--unpack-1 pkg-desc pkg-dir)))
 
 (defun package-vc--read-package-name (prompt &optional allow-url installed)
-  "Query the user for a source package and return a name with PROMPT.
+  "Query the user for a VC package and return a name with PROMPT.
 If the optional argument ALLOW-URL is non-nil, the user is also
 allowed to specify a non-package name.  If the optional argument
 INSTALLED is non-nil, the selection will be filtered down to
-source packages that have already been installed."
+VC packages that have already been installed."
   (package-vc--archives-initialize)
   (completing-read prompt (if installed package-alist package-archive-contents)
                    (if installed
@@ -553,9 +578,9 @@ source packages that have already been installed."
                    (not allow-url)))
 
 (defun package-vc--read-package-desc (prompt &optional installed)
-  "Query the user for a source package and return a description with PROMPT.
+  "Query the user for a VC package and return a description with PROMPT.
 If the optional argument INSTALLED is non-nil, the selection will
-be filtered down to source packages that have already been
+be filtered down to VC packages that have already been
 installed, and the package description will be that of an
 installed package."
   (cadr (assoc (package-vc--read-package-name prompt nil installed)
@@ -575,7 +600,7 @@ installed package."
 ;;;###autoload
 (defun package-vc-update (pkg-desc)
   "Attempt to update the package PKG-DESC."
-  (interactive (list (package-vc--read-package-desc "Update source package: " 
t)))
+  (interactive (list (package-vc--read-package-desc "Update VC package: " t)))
   ;; HACK: To run `package-vc--unpack-1' after checking out the new
   ;; revision, we insert a hook into `vc-post-command-functions', and
   ;; remove it right after it ran.  To avoid running the hook multiple
@@ -659,8 +684,8 @@ Optional argument BACKEND specifies the VC backend to use 
for cloning
 the package's repository; this is only possible if NAME-OR-URL is a URL,
 a string.  If BACKEND is omitted or nil, the function
 uses `package-vc-heuristic-alist' to guess the backend.
-Note that by default, a source package will be prioritized over a
-regular package, but it will not remove a source package."
+Note that by default, a VC package will be prioritized over a
+regular package, but it will not remove a VC package."
   (interactive
    (progn
      ;; Initialize the package system to get the list of package
@@ -707,11 +732,11 @@ regular package, but it will not remove a source package."
 (defun package-vc-checkout (pkg-desc directory &optional rev)
   "Clone the sources for PKG-DESC into DIRECTORY and visit that directory.
 Unlike `package-vc-install', this does not yet set up the package
-for use with Emacs; use `package-vc-link-directory' for setting
-the package up after this function finishes.
-Optional argument REV means to clone a specific version of the
-package; it defaults to the last version available from the
-package's repository.  If REV has the special value
+for use with Emacs; use `package-vc-install-from-checkout' for
+setting the package up after this function finishes.  Optional
+argument REV means to clone a specific version of the package; it
+defaults to the last version available from the package's
+repository.  If REV has the special value
 `:last-release' (interactively, the prefix argument), that stands
 for the last released version of the package."
   (interactive
@@ -750,10 +775,15 @@ name from the base name of DIR."
   (package-vc--archives-initialize)
   (let* ((name (or name (file-name-base (directory-file-name dir))))
          (pkg-dir (expand-file-name name package-user-dir)))
+    (when (file-exists-p pkg-dir)
+      (if (yes-or-no-p (format "Overwrite previous checkout for package `%s'?" 
name))
+          (package--delete-directory pkg-dir)
+        (error "There already exists a checkout for %s" name)))
     (make-symbolic-link (expand-file-name dir) pkg-dir)
     (package-vc--unpack-1
      (package-desc-create
       :name (intern name)
+      :dir pkg-dir
       :kind 'vc)
      (file-name-as-directory pkg-dir))))
 
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index c1545a2870..1cc978923e 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -458,7 +458,7 @@ synchronously."
 (defvar package--default-summary "No description available.")
 
 (define-inline package-vc-p (pkg-desc)
-  "Return non-nil if PKG-DESC is a source package."
+  "Return non-nil if PKG-DESC is a VC package."
   (inline-letevals (pkg-desc)
     (inline-quote (eq (package-desc-kind ,pkg-desc) 'vc))))
 
@@ -483,9 +483,7 @@ synchronously."
                                (if (eq 'quote (car requirements))
                                    (nth 1 requirements)
                                  requirements)))
-                 (kind (if (eq (car-safe version-string) 'vc)
-                           'vc
-                         (plist-get rest-plist :kind)))
+                 (kind (plist-get rest-plist :kind))
                  (archive (plist-get rest-plist :archive))
                  (extras (let (alist)
                            (while rest-plist
@@ -911,7 +909,7 @@ correspond to previously loaded files."
                            (let ((v1 (package-desc-version p1))
                                  (v2 (package-desc-version p2)))
                              (or
-                              ;; Prefer source packages.
+                              ;; Prefer VC packages.
                               (package-vc-p p1)
                               (package-vc-p p2)
                               ;; Prefer builtin packages.
@@ -1951,8 +1949,10 @@ SEEN is used internally to detect infinite recursion."
               (if (eq next-pkg 'emacs)
                   (error "This package requires Emacs version %s"
                          (package-version-join next-version))
-                (error "Package `%s-%s' is unavailable"
-                       next-pkg (package-version-join next-version))))))
+                (error (if (not next-version)
+                           (format "Package `%s' is unavailable" next-pkg)
+                         (format "Package `%s' (version %s) is unavailable"
+                                 next-pkg (package-version-join 
next-version))))))))
           (setq packages
                 (package-compute-transaction (cons found packages)
                                              (package-desc-reqs found)
@@ -2698,7 +2698,10 @@ Helper function for `describe-package'."
          (signed (if desc (package-desc-signed desc)))
          (maintainer (cdr (assoc :maintainer extras)))
          (authors (cdr (assoc :authors extras)))
-         (news (and-let* ((file (expand-file-name "news" pkg-dir))
+         (news (and-let* (pkg-dir
+                          ((not built-in))
+                          (file (expand-file-name "news" pkg-dir))
+                          ((file-regular-p file))
                           ((file-readable-p file)))
                  file)))
     (when (string= status "avail-obso")
@@ -3109,7 +3112,7 @@ package PKG-DESC, add one.  The alist is keyed with 
PKG-DESC."
   "If non-nil, include packages that don't have a version in `list-packages'.")
 
 (defvar package-list-unsigned nil
-  "If non-nil, mention in the list which packages were installed w/o 
signature.")
+  "If non-nil, mention in the list which packages were installed without 
signature.")
 
 (defvar package--emacs-version-list (version-to-list emacs-version)
   "The value of variable `emacs-version' as a list.")
@@ -4551,7 +4554,7 @@ will be signaled in that case."
       (user-error "Package `%s' has no explicit maintainer" name))
      ((and (not (progn
                   (require 'ietf-drums)
-                  (ietf-drums-parse-address maint)))
+                  (ietf-drums-parse-address (cdr maint))))
            (null no-error))
       (user-error "Package `%s' has no maintainer address" name))
      ((not (null maint))
@@ -4559,6 +4562,7 @@ will be signaled in that case."
         (package--print-email-button maint)
         (string-trim (substring-no-properties (buffer-string))))))))
 
+;;;###autoload
 (defun package-report-bug (desc)
   "Prepare a message to send to the maintainers of a package.
 DESC must be a `package-desc' object."
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index ec51146484..f2a0dc5483 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -1152,7 +1152,12 @@ For extending the `rx' notation in FORM, use `rx-define' 
or `rx-let-eval'."
 
 (defun rx--to-expr (form)
   "Translate the rx-expression FORM to a Lisp expression yielding a regexp."
-  (let* ((rx--delayed-evaluation t)
+  (let* ((rx--local-definitions
+          ;; Retrieve local definitions from the macroexpansion environment.
+          ;; (It's unclear whether the previous value of 
`rx--local-definitions'
+          ;; should be included, and if so, in which order.)
+          (cdr (assq :rx-locals macroexpand-all-environment)))
+         (rx--delayed-evaluation t)
          (elems (car (rx--translate form)))
          (args nil))
     ;; Merge adjacent strings.
@@ -1282,12 +1287,7 @@ Additional constructs can be defined using `rx-define' 
and `rx-let',
 which see.
 
 \(fn REGEXPS...)"
-  ;; Retrieve local definitions from the macroexpansion environment.
-  ;; (It's unclear whether the previous value of `rx--local-definitions'
-  ;; should be included, and if so, in which order.)
-  (let ((rx--local-definitions
-         (cdr (assq :rx-locals macroexpand-all-environment))))
-    (rx--to-expr (cons 'seq regexps))))
+  (rx--to-expr (cons 'seq regexps)))
 
 (defun rx--make-binding (name tail)
   "Make a definitions entry out of TAIL.
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index 8328324715..6704db3cc5 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -251,18 +251,17 @@ A FUNC form can have any number of `:no-eval' (or 
`:no-value'),
    :eval (string-glyph-decompose "Å"))
   "Predicates for Strings"
   (string-equal
-   :eval (string-equal "foo" "foo"))
+   :eval (string-equal "abc" "abc")
+   :eval (string-equal "abc" "ABC"))
   (string-equal-ignore-case
    :eval (string-equal-ignore-case "foo" "FOO"))
-  (eq
-   :eval (eq "foo" "foo"))
-  (eql
-   :eval (eql "foo" "foo"))
   (equal
    :eval (equal "foo" "foo"))
   (cl-equalp
    :eval (cl-equalp "Foo" "foo"))
   (stringp
+   :eval (stringp "a")
+   :eval (stringp 'a)
    :eval "(stringp ?a)")
   (string-empty-p
    :no-manual t
@@ -271,16 +270,16 @@ A FUNC form can have any number of `:no-eval' (or 
`:no-value'),
    :no-manual t
    :eval (string-blank-p " \n"))
   (string-lessp
-   :eval (string-lessp "foo" "bar")
+   :eval (string-lessp "abc" "def")
    :eval (string-lessp "pic4.png" "pic32.png")
-   :eval (string-lessp "1.1" "1 2"))
+   :eval (string-lessp "1.1" "1.2"))
   (string-greaterp
    :eval (string-greaterp "foo" "bar"))
   (string-version-lessp
    :eval (string-version-lessp "pic4.png" "pic32.png")
-   :eval (string-version-lessp "1.1" "1 2"))
+   :eval (string-version-lessp "1.9.3" "1.10.2"))
   (string-collate-lessp
-   :eval (string-collate-lessp "1.1" "1 2"))
+   :eval (string-collate-lessp "abc" "abd"))
   (string-prefix-p
    :eval (string-prefix-p "foo" "foobar"))
   (string-suffix-p
@@ -297,7 +296,8 @@ A FUNC form can have any number of `:no-eval' (or 
`:no-value'),
   "Converting Strings"
   (string-to-number
    :eval (string-to-number "42")
-   :eval (string-to-number "deadbeef" 16))
+   :eval (string-to-number "deadbeef" 16)
+   :eval (string-to-number "2.5e+03"))
   (number-to-string
    :eval (number-to-string 42))
   "Data About Strings"
@@ -627,8 +627,7 @@ A FUNC form can have any number of `:no-eval' (or 
`:no-value'),
   (nconc
    :eval (nconc (list 1) (list 2 3 4)))
   (delq
-   :eval (delq 2 (list 1 2 3 4))
-   :eval (delq "a" (list "a" "b" "c" "d")))
+   :eval (delq 'a (list 'a 'b 'c 'd)))
   (delete
    :eval (delete 2 (list 1 2 3 4))
    :eval (delete "a" (list "a" "b" "c" "d")))
@@ -670,29 +669,25 @@ A FUNC form can have any number of `:no-eval' (or 
`:no-value'),
    :eval (nlistp '(1 . 2)))
   "Finding Elements"
   (memq
-   :eval (memq 2 '(1 2 3))
-   :eval (memq 2.0 '(1.0 2.0 3.0))
-   :eval (memq "b" '("a" "b" "c")))
+   :eval (memq 'b '(a b c)))
+  (memql
+   :eval (memql 2.0 '(1.0 2.0 3.0)))
   (member
    :eval (member 2 '(1 2 3))
    :eval (member "b" '("a" "b" "c")))
   (remq
-   :eval (remq 2 '(1 2 3 2 4 2))
-   :eval (remq "b" '("a" "b" "c")))
-  (memql
-   :eval (memql 2.0 '(1.0 2.0 3.0)))
+   :eval (remq 'b '(a b c)))
   (member-ignore-case
    :eval (member-ignore-case "foo" '("bar" "Foo" "zot")))
   "Association Lists"
   (assoc
-   :eval (assoc 'b '((a 1) (b 2))))
+   :eval (assoc "b" '(("a" . 1) ("b" . 2))))
   (rassoc
-   :eval (rassoc '2 '((a . 1) (b . 2))))
+   :eval (rassoc "b" '((1 . "a") (2 . "b"))))
   (assq
-   :eval (assq 'b '((a 1) (b 2)))
-   :eval (assq "a" '(("a" 1) ("b" 2))))
+   :eval (assq 'b '((a . 1) (b . 2))))
   (rassq
-   :eval (rassq '2 '((a . 1) (b . 2))))
+   :eval (rassq 'b '((1 . a) (2 . b))))
   (assoc-string
    :eval (assoc-string "foo" '(("a" 1) (foo 2))))
   (alist-get
@@ -725,6 +720,88 @@ A FUNC form can have any number of `:no-eval' (or 
`:no-value'),
   (safe-length
    :eval (safe-length '(a b c))))
 
+(define-short-documentation-group symbol
+  "Making symbols"
+  (intern
+   :eval (intern "abc"))
+  (intern-soft
+   :eval (intern-soft "Phooey!"))
+  (make-symbol
+   :eval (make-symbol "abc"))
+  "Comparing symbols"
+  (eq
+   :eval (eq 'abc 'abc)
+   :eval (eq 'abc 'abd))
+  (eql
+   :eval (eql 'abc 'abc))
+  (equal
+   :eval (equal 'abc 'abc))
+  "Name"
+  (symbol-name
+   :eval (symbol-name 'abc)))
+
+(define-short-documentation-group comparison
+  "General-purpose"
+  (eq
+   :eval (eq 'a 'a)
+   :eval "(eq ?A ?A)"
+   :eval (let ((x (list 'a "b" '(c) 4 5.0)))
+           (eq x x)))
+  (eql
+   :eval (eql 2 2)
+   :eval (eql 2.0 2.0)
+   :eval (eql 2.0 2))
+  (equal
+   :eval (equal "abc" "abc")
+   :eval (equal 2.0 2.0)
+   :eval (equal 2.0 2)
+   :eval (equal '(a "b" (c) 4.0) '(a "b" (c) 4.0)))
+  (cl-equalp
+   :eval (cl-equalp 2 2.0)
+   :eval (cl-equalp "ABC" "abc"))
+  "Numeric"
+  (=
+   :args (number &rest numbers)
+   :eval (= 2 2)
+   :eval (= 2.0 2.0)
+   :eval (= 2.0 2)
+   :eval (= 4 4 4 4))
+  (/=
+   :eval (/= 4 4))
+  (<
+   :args (number &rest numbers)
+   :eval (< 4 4)
+   :eval (< 1 2 3))
+  (<=
+   :args (number &rest numbers)
+   :eval (<= 4 4)
+   :eval (<= 1 2 2 3))
+  (>
+   :args (number &rest numbers)
+   :eval (> 4 4)
+   :eval (> 3 2 1))
+  (>=
+   :args (number &rest numbers)
+   :eval (>= 4 4)
+   :eval (>= 3 2 2 1))
+  "String"
+  (string-equal
+   :eval (string-equal "abc" "abc")
+   :eval (string-equal "abc" "ABC"))
+  (string-equal-ignore-case
+   :eval (string-equal-ignore-case "abc" "ABC"))
+  (string-lessp
+   :eval (string-lessp "abc" "abd")
+   :eval (string-lessp "abc" "abc")
+   :eval (string-lessp "pic4.png" "pic32.png"))
+  (string-greaterp
+   :eval (string-greaterp "abd" "abc")
+   :eval (string-greaterp "abc" "abc"))
+  (string-version-lessp
+   :eval (string-version-lessp "pic4.png" "pic32.png")
+   :eval (string-version-lessp "1.9.3" "1.10.2"))
+  (string-collate-lessp
+   :eval (string-collate-lessp "abc" "abd")))
 
 (define-short-documentation-group vector
   "Making Vectors"
@@ -1131,13 +1208,10 @@ A FUNC form can have any number of `:no-eval' (or 
`:no-value'),
    :args (number &rest numbers)
    :eval (= 4 4)
    :eval (= 4.0 4.0)
-   :eval (= 4 5 6 7))
-  (eq
-   :eval (eq 4 4)
-   :eval (eq 4.0 4.0))
+   :eval (= 4 4.0)
+   :eval (= 4 4 4 4))
   (eql
    :eval (eql 4 4)
-   :eval (eql 4 "4")
    :eval (eql 4.0 4.0))
   (/=
    :eval (/= 4 4))
@@ -1148,15 +1222,15 @@ A FUNC form can have any number of `:no-eval' (or 
`:no-value'),
   (<=
    :args (number &rest numbers)
    :eval (<= 4 4)
-   :eval (<= 1 2 3))
+   :eval (<= 1 2 2 3))
   (>
    :args (number &rest numbers)
    :eval (> 4 4)
-   :eval (> 1 2 3))
+   :eval (> 3 2 1))
   (>=
    :args (number &rest numbers)
    :eval (>= 4 4)
-   :eval (>= 1 2 3))
+   :eval (>= 3 2 2 1))
   (zerop
    :eval (zerop 0))
   (cl-plusp
@@ -1440,14 +1514,16 @@ function's documentation in the Info manual"))
                do
                (cl-case type
                  (:eval
+                  (insert "  ")
                   (if (stringp value)
-                      (insert "  " value "\n")
-                    (insert "  ")
-                    (prin1 value (current-buffer))
-                    (insert "\n")
-                    (insert "    " double-arrow " ")
-                    (prin1 (eval value) (current-buffer))
-                    (insert "\n")))
+                      (insert value)
+                    (prin1 value (current-buffer)))
+                  (insert "\n    " double-arrow " ")
+                  (let ((expr (if (stringp value)
+                                  (car (read-from-string value))
+                                value)))
+                    (prin1 (eval expr) (current-buffer)))
+                    (insert "\n"))
                  (:no-eval*
                   (if (stringp value)
                       (insert "  " value "\n")
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 18087bc937..4896f4c293 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -370,7 +370,8 @@ this defaults to the current buffer."
                                                    (min end (point-max)))))
       (if (not (setq disp (get-text-property sub-start 'display object)))
           ;; No old properties in this range.
-          (put-text-property sub-start sub-end 'display (list prop value))
+          (put-text-property sub-start sub-end 'display (list prop value)
+                             object)
         ;; We have old properties.
         (let ((vector nil))
           ;; Make disp into a list.
@@ -390,7 +391,7 @@ this defaults to the current buffer."
           (when vector
             (setq disp (seq-into disp 'vector)))
           ;; Finally update the range.
-          (put-text-property sub-start sub-end 'display disp)))
+          (put-text-property sub-start sub-end 'display disp object)))
       (setq sub-start sub-end))))
 
 ;;;###autoload
@@ -398,7 +399,7 @@ this defaults to the current buffer."
   "Query the user for a process and return the process object."
   ;; Currently supports only the PROCESS argument.
   ;; Must either return a list containing a process, or signal an error.
-  ;; (Returning `nil' would mean the current buffer's process.)
+  ;; (Returning nil would mean the current buffer's process.)
   (unless (fboundp 'process-list)
     (error "Asynchronous subprocesses are not supported on this system"))
   ;; Local function to return cons of a complete-able name, and the
diff --git a/lisp/emacs-lisp/tabulated-list.el 
b/lisp/emacs-lisp/tabulated-list.el
index 206c10a773..595dc9b29d 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -263,8 +263,6 @@ Populated by `tabulated-list-init-header'.")
   'header-line-indent--line-number-width "29.1")
 (define-obsolete-function-alias 'tabulated-list-watch-line-number-width
   'header-line-indent--watch-line-number-width "29.1")
-(define-obsolete-function-alias 'tabulated-list-watch-line-number-width
-  'header-line-indent--watch-line-number-width "29.1")
 (define-obsolete-function-alias 'tabulated-list-window-scroll-function
   'header-line-indent--window-scroll-function "29.1")
 
diff --git a/lisp/emacs-lock.el b/lisp/emacs-lock.el
index 1818e22a92..3c8b81e94d 100644
--- a/lisp/emacs-lock.el
+++ b/lisp/emacs-lock.el
@@ -165,13 +165,14 @@ Return a value appropriate for 
`kill-buffer-query-functions' (which see)."
     (message "Buffer %S is locked and cannot be killed" (buffer-name))
     nil))
 
-(defun emacs-lock--set-mode (mode arg)
+(defun emacs-lock--set-mode (mode arg prefix)
   "Setter function for `emacs-lock-mode'."
   (setq emacs-lock-mode
         (cond ((memq arg '(all exit kill))
                ;; explicit locking mode arg, use it
                arg)
-              ((and (eq arg current-prefix-arg) (consp current-prefix-arg))
+              ;; kludgy, but commit 2a4b0da28c converts arg to number
+              ((and (eq arg 4) (equal prefix '(4)))
                ;; called with C-u M-x emacs-lock-mode, so ask the user
                (intern (completing-read
                         (format-prompt "Locking mode"
@@ -214,7 +215,7 @@ some major modes from being locked under some 
circumstances."
   :group 'emacs-lock
   :variable (emacs-lock-mode .
                              (lambda (mode)
-                               (emacs-lock--set-mode mode arg)))
+                               (emacs-lock--set-mode mode arg 
current-prefix-arg)))
   (when emacs-lock-mode
     (setq emacs-lock--old-mode emacs-lock-mode)
     (setq emacs-lock--try-unlocking
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 26793989d0..3b3caaf3e3 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -194,9 +194,9 @@
                           viper-delete-backward-char
                           viper-join-lines
                           viper-delete-char))
-      (memq (viper-event-key last-command-event)
-           '(up down left right (meta f) (meta b)
-                (control n) (control p) (control f) (control b)))))
+      (member (viper-event-key last-command-event)
+             '(up down left right (meta f) (meta b)
+               (control n) (control p) (control f) (control b)))))
 
 (defsubst viper-insert-state-pre-command-sentinel ()
   (or (viper-preserve-cursor-color)
diff --git a/lisp/epa-ks.el b/lisp/epa-ks.el
index 4c539b56a3..bb64b61b8f 100644
--- a/lisp/epa-ks.el
+++ b/lisp/epa-ks.el
@@ -109,7 +109,7 @@ When all keys have been selected, use 
\\[epa-ks-do-key-to-fetch] to
 actually import the keys.
 
 When called interactively, `epa-ks-mark-key-to-fetch' will always
-add a \"F\" tag.  Non-interactivly the tag must be specified by
+add a \"F\" tag.  Non-interactively the tag must be specified by
 setting the TAG parameter."
   (interactive (list "F"))
   (if (region-active-p)
diff --git a/lisp/epg.el b/lisp/epg.el
index ceeb269b07..527ebfcc2b 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -482,7 +482,7 @@ callback data (if any)."
              (format "      skipped new keys: %d\n"
                      (epg-import-result-not-imported import-result)))
          (if (> (epg-import-result-no-user-id import-result) 0)
-             (format "          w/o user IDs: %d\n"
+             (format "          without user IDs: %d\n"
                      (epg-import-result-no-user-id import-result)))
          (if (> (epg-import-result-imported import-result) 0)
              (concat (format "              imported: %d"
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 15fd6ac50f..43c5faad63 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -205,7 +205,8 @@
 ;;;; Variables and options
 
 (defvar-local erc-session-password nil
-  "The password used for the current session.")
+  "The password used for the current session.
+This should be a string or a function returning a string.")
 
 (defvar erc-server-responses (make-hash-table :test #'equal)
   "Hash table mapping server responses to their handler hooks.")
@@ -311,8 +312,13 @@ current IRC process is still alive.")
 (make-obsolete-variable 'erc-server-reconnecting
                         "see `erc--server-reconnecting'" "29.1")
 
-(defvar-local erc--server-reconnecting nil
-  "Non-nil when reconnecting.")
+(defvar erc--server-reconnecting nil
+  "An alist of buffer-local vars and their values when reconnecting.
+This is for the benefit of local modules and `erc-mode-hook'
+members so they can access buffer-local data from the previous
+session when reconnecting.  Once `erc-reuse-buffers' is retired
+and fully removed, modules can switch to leveraging the
+`permanent-local' property instead.")
 
 (defvar-local erc-server-timed-out nil
   "Non-nil if the IRC server failed to respond to a ping.")
@@ -638,6 +644,10 @@ The current buffer is given by BUFFER."
   (let ((p (plist-put parameters :nowait t)))
     (apply #'open-network-stream name buffer host service p)))
 
+(cl-defmethod erc--register-connection ()
+  "Perform opening IRC protocol exchange with server."
+  (erc-login))
+
 (defvar erc--server-connect-dumb-ipv6-regexp
   ;; Not for validation (gives false positives).
   (rx bot "[" (group (+ (any xdigit digit ":.")) (? "%" (+ alnum))) "]" eot))
@@ -664,7 +674,6 @@ TLS (see `erc-session-client-certificate' for more 
details)."
       (setq erc-server-process process)
       (setq erc-server-quitting nil)
       (setq erc-server-reconnecting nil
-            erc--server-reconnecting nil
             erc--server-reconnect-timer nil)
       (setq erc-server-timed-out nil)
       (setq erc-server-banned nil)
@@ -693,7 +702,7 @@ TLS (see `erc-session-client-certificate' for more 
details)."
         ;; waiting for a non-blocking connect - keep the user informed
         (erc-display-message nil nil buffer "Opening connection..\n")
       (message "%s...done" msg)
-      (erc-login)) ))
+      (erc--register-connection))))
 
 (defun erc-server-reconnect ()
   "Reestablish the current IRC connection.
@@ -706,11 +715,11 @@ Make sure you are in an ERC buffer when running this."
     (with-current-buffer buffer
       (erc-update-mode-line)
       (erc-set-active-buffer (current-buffer))
-      (setq erc--server-reconnecting t)
       (setq erc-server-last-sent-time 0)
       (setq erc-server-lines-sent 0)
       (let ((erc-server-connect-function (or erc-session-connector
-                                             #'erc-open-network-stream)))
+                                             #'erc-open-network-stream))
+            (erc--server-reconnecting (buffer-local-variables)))
         (erc-open erc-session-server erc-session-port erc-server-current-nick
                   erc-session-user-full-name t erc-session-password
                   nil nil nil erc-session-client-certificate
@@ -824,8 +833,7 @@ When `erc-server-reconnect-attempts' is a number, increment
         (if (not reconnect-p)
             ;; terminate, do not reconnect
             (progn
-              (setq erc--server-reconnecting nil
-                    erc--server-reconnect-timer nil)
+              (setq erc--server-reconnect-timer nil)
               (erc-display-message nil 'error (current-buffer)
                                    'terminated ?e event)
               (set-buffer-modified-p nil))
@@ -894,7 +902,7 @@ Conditionally try to reconnect and take appropriate action."
                   cproc (process-status cproc) event erc-server-quitting))
         (if (string-match "^open" event)
             ;; newly opened connection (no wait)
-            (erc-login)
+            (erc--register-connection)
           ;; assume event is 'failed
           (erc-with-all-buffers-of-server cproc nil
                                           (setq erc-server-connected nil))
@@ -1619,7 +1627,7 @@ add things to `%s' instead."
         (cl-pushnew (erc-server-buffer) bufs)
         (erc-set-current-nick nn)
         ;; Rename session, possibly rename server buf and all targets
-        (when (erc-network)
+        (when erc-server-connected
           (erc-networks--id-reload erc-networks--id proc parsed))
         (erc-update-mode-line)
         (setq erc-nick-change-attempt-count 0)
@@ -1629,6 +1637,8 @@ add things to `%s' instead."
          'NICK-you ?n nick ?N nn)
         (run-hook-with-args 'erc-nick-changed-functions nn nick))
        (t
+        (when erc-server-connected
+          (erc-networks--id-reload erc-networks--id proc parsed))
         (erc-handle-user-status-change 'nick (list nick login host) (list nn))
         (erc-display-message parsed 'notice bufs 'NICK ?n nick
                              ?u login ?h host ?N nn))))))
@@ -2255,6 +2265,8 @@ See `erc-display-server-message'." nil
 
 (define-erc-response-handler (433)
   "Login-time \"nick in use\"." nil
+  (when erc-server-connected
+    (erc-networks--id-reload erc-networks--id proc parsed))
   (erc-nickname-in-use (cadr (erc-response.command-args parsed))
                        "already in use"))
 
@@ -2323,6 +2335,15 @@ See `erc-display-server-message'." nil
     (erc-display-message parsed 'notice 'active 's671
                          ?n nick ?a securemsg)))
 
+(define-erc-response-handler (900)
+  "Handle a \"RPL_LOGGEDIN\" server command.
+Some servers don't consider this SASL-specific but rather just an
+indication of a server-side state change from logged-out to
+logged-in." nil
+  ;; Whenever ERC starts caring about user accounts, it should record
+  ;; the session as being logged here.
+  (erc-display-message parsed 'notice proc (erc-response.contents parsed)))
+
 (define-erc-response-handler (431 445 446 451 462 463 464 481 483 484 485
                                   491 501 502)
   ;; 431 - No nickname given
diff --git a/lisp/erc/erc-common.el b/lisp/erc/erc-common.el
index 23a1933798..da75d50d61 100644
--- a/lisp/erc/erc-common.el
+++ b/lisp/erc/erc-common.el
@@ -88,6 +88,66 @@
   (contents "" :type string)
   (tags '() :type list))
 
+;; TODO move goodies modules here after 29 is released.
+(defconst erc--features-to-modules
+  '((erc-pcomplete completion pcomplete)
+    (erc-capab capab-identify)
+    (erc-join autojoin)
+    (erc-page page ctcp-page)
+    (erc-sound sound ctcp-sound)
+    (erc-stamp stamp timestamp)
+    (erc-services services nickserv))
+  "Migration alist mapping a library feature to module names.
+Keys need not be unique: a library may define more than one
+module.  Sometimes a module's downcased alias will be its
+canonical name.")
+
+(defconst erc--modules-to-features
+  (let (pairs)
+    (pcase-dolist (`(,feature . ,names) erc--features-to-modules)
+      (dolist (name names)
+        (push (cons name feature) pairs)))
+    (nreverse pairs))
+  "Migration alist mapping a module's name to its home library feature.")
+
+(defconst erc--module-name-migrations
+  (let (pairs)
+    (pcase-dolist (`(,_ ,canonical . ,rest) erc--features-to-modules)
+      (dolist (obsolete rest)
+        (push (cons obsolete canonical) pairs)))
+    pairs)
+  "Association list of obsolete module names to canonical names.")
+
+(defun erc--normalize-module-symbol (symbol)
+  "Return preferred SYMBOL for `erc-modules'."
+  (setq symbol (intern (downcase (symbol-name symbol))))
+  (or (cdr (assq symbol erc--module-name-migrations)) symbol))
+
+(defun erc--assemble-toggle (localp name ablsym mode val body)
+  (let ((arg (make-symbol "arg")))
+    `(defun ,ablsym ,(if localp `(&optional ,arg) '())
+       ,(concat
+         (if val "Enable" "Disable")
+         " ERC " (symbol-name name) " mode."
+         (when localp
+           (concat "\nWhen called interactively,"
+                   " do so in all buffers for the current connection.")))
+       (interactive ,@(when localp '("p")))
+       ,@(if localp
+             `((when (derived-mode-p 'erc-mode)
+                 (if ,arg
+                     (erc-with-all-buffers-of-server erc-server-process nil
+                       (,ablsym))
+                   (setq ,mode ,val)
+                   ,@body)))
+           `(,(if val
+                  `(cl-pushnew ',(erc--normalize-module-symbol name)
+                               erc-modules)
+                `(setq erc-modules (delq ',(erc--normalize-module-symbol name)
+                                         erc-modules)))
+             (setq ,mode ,val)
+             ,@body)))))
+
 (defmacro define-erc-module (name alias doc enable-body disable-body
                                   &optional local-p)
   "Define a new minor mode using ERC conventions.
@@ -103,6 +163,13 @@ This will define a minor mode called erc-NAME-mode, 
possibly
 an alias erc-ALIAS-mode, as well as the helper functions
 erc-NAME-enable, and erc-NAME-disable.
 
+With LOCAL-P, these helpers take on an optional argument that,
+when non-nil, causes them to act on all buffers of a connection.
+This feature is mainly intended for interactive use and does not
+carry over to their respective minor-mode toggles.  Beware that
+for global modules, these helpers and toggles all mutate
+`erc-modules'.
+
 Example:
 
   ;;;###autoload(autoload \\='erc-replace-mode \"erc-replace\")
@@ -133,20 +200,8 @@ if ARG is omitted or nil.
          (if ,mode
              (,enable)
            (,disable)))
-       (defun ,enable ()
-         ,(format "Enable ERC %S mode."
-                  name)
-         (interactive)
-         (add-to-list 'erc-modules (quote ,name))
-         (setq ,mode t)
-         ,@enable-body)
-       (defun ,disable ()
-         ,(format "Disable ERC %S mode."
-                  name)
-         (interactive)
-         (setq erc-modules (delq (quote ,name) erc-modules))
-         (setq ,mode nil)
-         ,@disable-body)
+       ,(erc--assemble-toggle local-p name enable mode t enable-body)
+       ,(erc--assemble-toggle local-p name disable mode nil disable-body)
        ,(when (and alias (not (eq name alias)))
           `(defalias
              ',(intern
@@ -247,17 +302,11 @@ nil."
 (defun erc-downcase (string)
   "Return a downcased copy of STRING with properties.
 Use the CASEMAPPING ISUPPORT parameter to determine the style."
-  (let* ((mapping (erc--get-isupport-entry 'CASEMAPPING 'single))
-         (inhibit-read-only t))
-    (if (equal mapping "ascii")
-        (downcase string)
-      (with-temp-buffer
-        (insert string)
-        (translate-region (point-min) (point-max)
-                          (if (equal mapping "rfc1459-strict")
-                              erc--casemapping-rfc1459-strict
-                            erc--casemapping-rfc1459))
-        (buffer-string)))))
+  (with-case-table (pcase (erc--get-isupport-entry 'CASEMAPPING 'single)
+                     ("ascii" ascii-case-table)
+                     ("rfc1459-strict" erc--casemapping-rfc1459-strict)
+                     (_ erc--casemapping-rfc1459))
+    (downcase string)))
 
 (define-inline erc-get-channel-user (nick)
   "Find NICK in the current buffer's `erc-channel-users' hash table."
diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
index d23703394b..77625398ab 100644
--- a/lisp/erc/erc-compat.el
+++ b/lisp/erc/erc-compat.el
@@ -176,12 +176,12 @@ If START or END is negative, it counts from the end."
 ;; This hard codes `auth-source-pass-port-separator' to ":"
 (defun erc-compat--29-auth-source-pass--retrieve-parsed (seen e port-number-p)
   (when (string-match (rx (or bot "/")
-                          (or (: (? (group-n 20 (+ (not (in " /@")))) "@")
-                                 (group-n 10 (+ (not (in " /:@"))))
+                          (or (: (? (group-n 20 (+ (not (in "/:")))) "@")
+                                 (group-n 10 (+ (not (in "/:@"))))
                                  (? ":" (group-n 30 (+ (not (in " /:"))))))
-                              (: (group-n 11 (+ (not (in " /:@"))))
+                              (: (group-n 11 (+ (not (in "/:@"))))
                                  (? ":" (group-n 31 (+ (not (in " /:")))))
-                                 (? "/" (group-n 21 (+ (not (in " /:")))))))
+                                 (? "/" (group-n 21 (+ (not (in "/:")))))))
                           eot)
                       e)
     (puthash e `( :host ,(or (match-string 10 e) (match-string 11 e))
@@ -252,8 +252,18 @@ If START or END is negative, it counts from the end."
   ;; From `auth-source-pass-search'
   (cl-assert (and host (not (eq host t)))
              t "Invalid password-store search: %s %s")
-  (erc-compat--29-auth-source-pass--build-result-many
-   host user port require max))
+  (let ((rv (erc-compat--29-auth-source-pass--build-result-many
+             host user port require max)))
+    (if (and (fboundp 'auth-source--obfuscate)
+             (fboundp 'auth-source--deobfuscate))
+        (let (out)
+          (dolist (e rv out)
+            (when-let* ((s (plist-get e :secret))
+                        (v (auth-source--obfuscate s)))
+              (setf (plist-get e :secret)
+                    (byte-compile (lambda () (auth-source--deobfuscate v)))))
+            (push e out)))
+      rv)))
 
 (defun erc-compat--29-auth-source-pass-backend-parse (entry)
   (when (eq entry 'password-store)
@@ -273,6 +283,89 @@ If START or END is negative, it counts from the end."
     auth-source-backend-parser-functions))
 
 
+;;;; SASL
+
+(declare-function sasl-step-data "sasl" (step))
+(declare-function sasl-error "sasl" (datum))
+(declare-function sasl-client-property "sasl" (client property))
+(declare-function sasl-client-set-property "sasl" (client property value))
+(declare-function sasl-mechanism-name "sasl" (mechanism))
+(declare-function sasl-client-name "sasl" (client))
+(declare-function sasl-client-mechanism "sasl" (client))
+(declare-function sasl-read-passphrase "sasl" (prompt))
+(declare-function sasl-unique-id "sasl" nil)
+(declare-function decode-hex-string "hex-util" (string))
+(declare-function rfc2104-hash "rfc2104" (hash block-length hash-length
+                                               key text))
+(declare-function sasl-scram--client-first-message-bare "sasl-scram-rfc"
+                  (client))
+(declare-function cl-mapcar "cl-lib" (cl-func cl-x &rest cl-rest))
+
+(defun erc-compat--29-sasl-scram-construct-gs2-header (client)
+  (let ((authzid (sasl-client-property client 'authenticator-name)))
+    (concat "n," (and authzid "a=") authzid ",")))
+
+(defun erc-compat--29-sasl-scram-client-first-message (client _step)
+  (let ((c-nonce (sasl-unique-id)))
+    (sasl-client-set-property client 'c-nonce c-nonce))
+  (concat (erc-compat--29-sasl-scram-construct-gs2-header client)
+          (sasl-scram--client-first-message-bare client)))
+
+(defun erc-compat--29-sasl-scram--client-final-message
+    (hash-fun block-length hash-length client step)
+  (unless (string-match
+           "^r=\\([^,]+\\),s=\\([^,]+\\),i=\\([0-9]+\\)\\(?:$\\|,\\)"
+           (sasl-step-data step))
+    (sasl-error "Unexpected server response"))
+  (let* ((hmac-fun
+          (lambda (text key)
+            (decode-hex-string
+             (rfc2104-hash hash-fun block-length hash-length key text))))
+         (step-data (sasl-step-data step))
+         (nonce (match-string 1 step-data))
+         (salt-base64 (match-string 2 step-data))
+         (iteration-count (string-to-number (match-string 3 step-data)))
+         (c-nonce (sasl-client-property client 'c-nonce))
+         (cbind-input
+          (if (string-prefix-p c-nonce nonce)
+              (erc-compat--29-sasl-scram-construct-gs2-header client) ; *1
+            (sasl-error "Invalid nonce from server")))
+         (client-final-message-without-proof
+          (concat "c=" (base64-encode-string cbind-input t) "," ; *2
+                  "r=" nonce))
+         (password
+          (sasl-read-passphrase
+           (format "%s passphrase for %s: "
+                   (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 (let ((digest (concat salt (string 0 0 0 1)))
+                                (xored nil))
+                            (dotimes (_i iteration-count xored)
+                              (setq digest (funcall hmac-fun digest password))
+                              (setq xored (if (null 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)))
+         (auth-message (concat "n=" (sasl-client-name client)
+                               ",r=" c-nonce "," step-data
+                               "," client-final-message-without-proof))
+         (client-signature (funcall hmac-fun
+                                    (encode-coding-string auth-message 'utf-8)
+                                    stored-key))
+         (client-proof (funcall string-xor client-key client-signature))
+         (client-final-message
+          (concat client-final-message-without-proof ","
+                  "p=" (base64-encode-string client-proof t)))) ; *3
+    (sasl-client-set-property client 'auth-message auth-message)
+    (sasl-client-set-property client 'salted-password salted-password)
+    client-final-message))
+
+
 ;;;; Misc 29.1
 
 (defmacro erc-compat--with-memoization (table &rest forms)
@@ -298,8 +391,11 @@ If START or END is negative, it counts from the end."
 
 (cond ((fboundp 'browse-url-irc)) ; 29
       ((boundp 'browse-url-default-handlers) ; 28
-       (cl-pushnew '("\\`irc6?s?://" . erc-compat--29-browse-url-irc)
-                   browse-url-default-handlers))
+       (setf (alist-get "\\`irc6?s?://" browse-url-default-handlers
+                        nil nil (lambda (a _)
+                                  (and (stringp a)
+                                       (string-match-p a "irc://localhost"))))
+             #'erc-compat--29-browse-url-irc))
       ((boundp 'browse-url-browser-function) ; 27
        (require 'browse-url)
        (let ((existing browse-url-browser-function))
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index 59b5f01f23..1af83b58ba 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -31,6 +31,7 @@
 
 ;;; Imenu support
 
+(eval-when-compile (require 'cl-lib))
 (require 'erc-common)
 
 (defvar erc-controls-highlight-regexp)
diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el
index b3e5fcf1a3..2e2d093011 100644
--- a/lisp/erc/erc-networks.el
+++ b/lisp/erc/erc-networks.el
@@ -60,6 +60,7 @@
 (declare-function erc-buffer-filter "erc" (predicate &optional proc))
 (declare-function erc-current-nick "erc" nil)
 (declare-function erc-display-error-notice "erc" (parsed string))
+(declare-function erc-display-message "erc" (parsed type buffer msg &rest 
args))
 (declare-function erc-error "erc" (&rest args))
 (declare-function erc-get-buffer "erc" (target &optional proc))
 (declare-function erc-server-buffer "erc" nil)
@@ -826,12 +827,11 @@ respectively.  The separator is given by 
`erc-networks--id-sep'."
 
 ;; For now, please use this instead of `erc-networks--id-fixed-p'.
 (cl-defgeneric erc-networks--id-given (net-id)
-  "Return the preassigned identifier for a network presence, if any.
-This may have originated from an `:id' arg to entry-point commands
-`erc-tls' or `erc'.")
+  "Return the preassigned identifier for a network context, if any.
+When non-nil, assume NET-ID originated from an `:id' argument to
+entry-point commands `erc-tls' or `erc'.")
 
-(cl-defmethod erc-networks--id-given ((_ erc-networks--id))
-  nil)
+(cl-defmethod erc-networks--id-given (_) nil) ; _ may be nil
 
 (cl-defmethod erc-networks--id-given ((nid erc-networks--id-fixed))
   (erc-networks--id-symbol nid))
@@ -866,22 +866,15 @@ This may have originated from an `:id' arg to entry-point 
commands
   ((_ symbol) &context (erc-obsolete-var erc-reuse-buffers null))
   (erc-networks--id-fixed-create (intern (buffer-name))))
 
-(cl-defgeneric erc-networks--id-on-connect (net-id)
-  "Update NET-ID `erc-networks--id' after connection params known.
-This is typically during or just after MOTD.")
-
-(cl-defmethod erc-networks--id-on-connect ((_ erc-networks--id))
-  nil)
-
-(cl-defmethod erc-networks--id-on-connect ((id erc-networks--id-qualifying))
-  (erc-networks--id-qualifying-update id (erc-networks--id-qualifying-create)))
-
 (cl-defgeneric erc-networks--id-equal-p (self other)
-  "Return non-nil when two network identities exhibit underlying equality.
-SELF and OTHER are `erc-networks--id' struct instances.  This
-should normally be used only for ID recovery or merging, after
-which no two identities should be `equal' (timestamps aside) that
-aren't also `eq'.")
+  "Return non-nil when two network IDs exhibit underlying equality.
+Expect SELF and OTHER to be `erc-networks--id' struct instances
+and that this will only be called for ID recovery or merging,
+after which no two identities should be `equal' (timestamps
+aside) that aren't also `eq'.")
+
+(cl-defmethod erc-networks--id-equal-p ((_ null) (_ erc-networks--id)) nil)
+(cl-defmethod erc-networks--id-equal-p ((_ erc-networks--id) (_ null)) nil)
 
 (cl-defmethod erc-networks--id-equal-p ((self erc-networks--id)
                                         (other erc-networks--id))
@@ -1104,7 +1097,8 @@ matching that of the dying buffer."
                                   (erc--target-symbol erc--target))))))))
        ((not (cdr others))))
     (with-current-buffer (car others)
-      (rename-buffer (erc--target-string target)))))
+      (unless (get-buffer (erc--target-string target))
+        (rename-buffer (erc--target-string target))))))
 
 (defun erc-networks-shrink-ids-and-buffer-names ()
   "Recompute network IDs and buffer names, ignoring the current buffer.
@@ -1195,19 +1189,20 @@ rename them with <n> suffixes going from newest to 
oldest."
                  (erc--target-string target)))
          placeholder)
     ;; If we don't exist, claim name temporarily while renaming others
-    (when-let* (namesakes
-                (ex (get-buffer name))
-                ((not (memq ex existing)))
-                (temp-name (generate-new-buffer-name (format "*%s*" name))))
-      (setq existing (remq ex existing))
-      (with-current-buffer ex
-        (rename-buffer temp-name)
-        (setq placeholder (get-buffer-create name))
-        (rename-buffer name 'unique)))
+    (when-let* ((ex (get-buffer name))
+                ((not (memq ex existing))))
+      (if namesakes ; if namesakes is nonempty, it contains ex
+          (with-current-buffer ex
+            (let ((temp-name (generate-new-buffer-name (format "*%s*" name))))
+              (rename-buffer temp-name)
+              (setq placeholder (get-buffer-create name))
+              (rename-buffer name 'unique)))
+        ;; Here, ex must be a server buffer or a non-ERC buffer
+        (setq name (erc-networks--construct-target-buffer-name target))))
     (unless (with-suppressed-warnings ((obsolete erc-reuse-buffers))
               erc-reuse-buffers)
       (when (string-suffix-p ">" name)
-        (setq name (substring name 0 -3))))
+        (setq name (string-trim-right name (rx "<" (+ digit) ">")))))
     (dolist (ex (erc-networks--id-sort-buffers existing))
       (with-current-buffer ex
         (rename-buffer name 'unique)))
@@ -1268,24 +1263,45 @@ given by the `RPL_ISUPPORT' NETWORK parameter."
                return name)
       (and-let* ((vanity (erc--get-isupport-entry 'NETWORK 'single))
                  ((intern vanity))))
+      (erc-networks--id-given erc-networks--id)
       erc-networks--name-missing-sentinel))
 
-(defun erc-networks--set-name (_proc parsed)
+(defvar erc-networks--allow-unknown-network nil
+  "Whether to ignore a failure in identifying the network.
+If you need this as a user option, please say so via \\[erc-bug].
+Otherwise, expect it to vanish at any time.") ; Bug#59976
+
+(defun erc-networks--set-name (proc parsed)
   "Set `erc-network' to the value returned by `erc-networks--determine'.
-Signal an error when the network cannot be determined."
+Print an error message when the network cannot be determined before
+shutting down the connection."
   ;; Always update (possibly clobber) current value, if any.
-  (let ((name (erc-networks--determine)))
-    (when (eq name erc-networks--name-missing-sentinel)
-      ;; This can happen theoretically, e.g., if you're editing some
-      ;; settings interactively on a proxy service that impersonates IRC
-      ;; but aren't being proxied through to a real network.  The
+  (pcase (setq erc-network (erc-networks--determine))
+    ((and (pred (eq (erc-networks--id-given erc-networks--id)))
+          (let m (format "Couldn't determine network. Using given ID `%s'."
+                         erc-network)))
+     (erc-display-message parsed 'notice nil m)
+     nil)
+    ((and
+      (guard (eq erc-network erc-networks--name-missing-sentinel))
+      ;; This can happen theoretically, e.g., when adjusting settings
+      ;; on a proxy service that partially impersonates IRC but isn't
+      ;; currently conveying anything through to a real network.  The
       ;; service may send a 422 but no NETWORK param (or *any* 005s).
-      (let ((m (concat "Failed to determine network. Please set entry for "
-                       erc-server-announced-name " in `erc-networks-alist'.")))
-        (erc-display-error-notice parsed m)
-        (erc-error "Failed to determine network"))) ; beep
-    (setq erc-network name))
-  nil)
+      (let m (concat "Failed to determine network.  Please set entry for \""
+                     erc-server-announced-name "\" in `erc-networks-alist'"
+                     " or consider calling `erc-tls' with the keyword `:id'."
+                     "  See Info:\"(erc) Network Identifier\" for more.")))
+     (require 'info)
+     (erc-display-error-notice parsed m)
+     (if erc-networks--allow-unknown-network
+         (progn
+           (erc-display-error-notice
+            parsed (format "Continuing anyway with network set to `%s'."
+                           erc-network))
+           nil)
+       (delete-process proc)
+       'error))))
 
 ;; This lives here in this file because all the other "on connect"
 ;; MOTD stuff ended up here (but perhaps that needs to change).
@@ -1295,11 +1311,12 @@ Signal an error when the network cannot be determined."
 Copy source (prefix) from MOTD-ish message as a last resort."
   ;; The 004 handler never ran; see 2004-03-10 Diane Murray in change log
   (unless erc-server-announced-name
-    (erc-display-error-notice parsed "Failed to determine server name.")
+    (setq erc-server-announced-name (erc-response.sender parsed))
     (erc-display-error-notice
-     parsed (concat "If this was unexpected, consider reporting it via "
-                    (substitute-command-keys "\\[erc-bug]") "."))
-    (setq erc-server-announced-name (erc-response.sender parsed)))
+     parsed (concat "Failed to determine server name. Using \""
+                    erc-server-announced-name "\" instead."
+                    "  If this was unexpected, consider reporting it via "
+                    (substitute-command-keys "\\[erc-bug]") ".")))
   nil)
 
 (defun erc-unset-network-name (_nick _ip _reason)
@@ -1382,7 +1399,8 @@ considered as well because server buffers are often 
killed."
   (let* ((identity erc-networks--id)
          (buffer (current-buffer))
          (f (lambda ()
-              (unless (or (eq (current-buffer) buffer)
+              (unless (or (not erc-networks--id)
+                          (eq (current-buffer) buffer)
                           (eq erc-networks--id identity))
                 (if (erc-networks--id-equal-p identity erc-networks--id)
                     (throw 'buffer erc-networks--id)
@@ -1397,16 +1415,17 @@ considered as well because server buffers are often 
killed."
 ;; server buffer, whereas `erc-networks--rename-server-buffer' can run
 ;; mid-session, after an identity's core components have changed.
 
-(defun erc-networks--init-identity (_proc _parsed)
+(defun erc-networks--init-identity (proc parsed)
   "Update identity with real network name."
   ;; Initialize identity for real now that we know the network
   (cl-assert erc-network)
-  (unless (erc-networks--id-symbol erc-networks--id) ; unless just reconnected
-    (erc-networks--id-on-connect erc-networks--id))
-  ;; Find duplicate identities or other conflicting ones and act
-  ;; accordingly.
-  (erc-networks--update-server-identity)
-  ;;
+  (if erc-networks--id
+      (erc-networks--id-reload erc-networks--id proc parsed)
+    (setq erc-networks--id (erc-networks--id-create nil))
+    ;; Find duplicate identities or other conflicting ones and act
+    ;; accordingly.
+    (erc-networks--update-server-identity)
+    (erc-networks--rename-server-buffer proc parsed))
   nil)
 
 (defun erc-networks--rename-server-buffer (new-proc &optional _parsed)
@@ -1474,8 +1493,7 @@ This must run before `erc-server-connected' is set."
   ;; For now, retain compatibility with erc-server-NNN-functions.
   (or (erc-networks--ensure-announced proc parsed)
       (erc-networks--set-name proc parsed)
-      (erc-networks--init-identity proc parsed)
-      (erc-networks--rename-server-buffer proc parsed)))
+      (erc-networks--init-identity proc parsed)))
 
 (define-erc-module networks nil
   "Provide data about IRC networks."
diff --git a/lisp/erc/erc-sasl.el b/lisp/erc/erc-sasl.el
new file mode 100644
index 0000000000..78d02a4638
--- /dev/null
+++ b/lisp/erc/erc-sasl.el
@@ -0,0 +1,449 @@
+;;; erc-sasl.el --- SASL for ERC -*- 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/>.
+
+;;; Commentary:
+
+;; This "non-IRCv3" implementation resembles others that have surfaced
+;; over the years, the first possibly being from Joseph Gay:
+;;
+;; https://lists.gnu.org/archive/html/erc-discuss/2012-02/msg00001.html
+;;
+;; See options and Info manual for usage.
+;;
+;; TODO:
+;;
+;; - Find a way to obfuscate the password in memory (via something
+;;   like `auth-source--obfuscate'); it's currently visible in
+;;   backtraces.
+;;
+;; - Implement a proxy mechanism that chooses the strongest available
+;;   mechanism for you.  Requires CAP 3.2 (see bug#49860).
+;;
+;; - Integrate with whatever solution ERC eventually settles on to
+;;   handle user options for different network contexts.  At the
+;;   moment, this does its own thing for stashing and restoring
+;;   session options, but ERC should make abstractions available for
+;;   all local modules to use, possibly based on connection-local
+;;   variables.
+
+;;; Code:
+(require 'erc)
+(require 'rx)
+(require 'sasl)
+(require 'sasl-scram-rfc)
+(require 'sasl-scram-sha256 nil t) ; not present in Emacs 27
+
+(defgroup erc-sasl nil
+  "SASL for ERC."
+  :group 'erc
+  :package-version '(ERC . "5.4.1")) ; FIXME increment on next release
+
+(defcustom erc-sasl-mechanism 'plain
+  "SASL mechanism to connect with.
+Note that any value other than nil or `external' likely requires
+`erc-sasl-user' and `erc-sasl-password'."
+  :type '(choice (const plain)
+                 (const external)
+                 (const scram-sha-1)
+                 (const scram-sha-256)
+                 (const scram-sha-512)
+                 (const ecdsa-nist256p-challenge)))
+
+(defcustom erc-sasl-user :user
+  "Account username to send when authenticating.
+This is also referred to as the authentication identity or
+\"authcid\".  A value of `:user' or `:nick' indicates that the
+corresponding connection parameter on file should be used.  These
+are most often derived from arguments provided to the `erc' and
+`erc-tls' entry points.  In the case of `:nick', a downcased
+version is used."
+  :type '(choice string (const :user) (const :nick)))
+
+(defcustom erc-sasl-password :password
+  "Optional account password to send when authenticating.
+When `erc-sasl-auth-source-function' is a function, ERC will
+attempt an auth-source query and prompt for input if it fails.
+Otherwise, when the value is a nonempty string, ERC will use it
+unconditionally for most mechanisms.  Likewise with `:password',
+except ERC will instead use the \"session password\" on file, if
+any, which often originates from the entry-point commands `erc'
+or `erc-tls'.  As with auth-source, ERC will prompt for input as
+a fallback.
+
+Note that, with `:password', ERC will forgo sending a traditional
+server password via the IRC \"PASS\" command.  Also, when
+`erc-sasl-mechanism' is set to `ecdsa-nist256p-challenge', this
+option should hold the file name of the key."
+  :type '(choice (const nil) (const :password) string symbol))
+
+(defcustom erc-sasl-auth-source-function nil
+  "Function to query auth-source for an SASL password.
+If provided, this function should expect to be called with any
+number of keyword params known to `auth-source-search', even
+though ERC itself only specifies `:user' paired with a
+\"resolved\" `erc-sasl-user' value.  When calling this function,
+ERC binds all options defined in this library, such as
+`erc-sasl-password', to their values from entry-point invocation.
+In return, ERC expects a string to send as the SASL password, or
+nil, in which case, ERC will prompt the for input.  See info
+node `(erc) auth-source' for details on ERC's auth-source
+integration."
+  :type '(choice (function-item erc-sasl-auth-source-password-as-host)
+                 (function-item erc-auth-source-search)
+                 (const nil)
+                 function))
+
+(defcustom erc-sasl-authzid nil
+  "SASL authorization identity, likely unneeded for everyday use."
+  :type '(choice (const nil) string))
+
+
+;; Analogous to what erc-backend does to persist opening params.
+(defvar-local erc-sasl--options nil)
+
+;; Session-local (server buffer) SASL subproto state
+(defvar-local erc-sasl--state nil)
+
+(cl-defstruct erc-sasl--state
+  "Holder for client object and subproto state."
+  (client nil :type vector)
+  (step nil :type vector)
+  (pending nil :type string))
+
+(defun erc-sasl--get-user ()
+  (pcase (alist-get 'user erc-sasl--options)
+    (:user erc-session-username)
+    (:nick (erc-downcase (erc-current-nick)))
+    (v v)))
+
+(defun erc-sasl-auth-source-password-as-host (&rest plist)
+  "Call `erc-auth-source-search' with `erc-sasl-password' as `:host'.
+But only do so when it's a string or a non-nil symbol, unless
+that symbol is `:password', in which case, use a non-nil
+`erc-session-password' instead.  Otherwise, just defer to
+`erc-auth-source-search' to pick a suitable `:host'.  Expect
+PLIST to contain keyword params known to `auth-source-search'."
+  (when erc-sasl-password
+    (when-let ((host (if (eq :password erc-sasl-password)
+                         (and (not (functionp erc-session-password))
+                              erc-session-password)
+                       erc-sasl-password)))
+      (setq plist `(,@plist :host ,(format "%s" host)))))
+  (apply #'erc-auth-source-search plist))
+
+(defun erc-sasl--read-password (prompt)
+  "Return configured option or server password.
+If necessary, pass PROMPT to `read-passwd'."
+  (if-let ((found (pcase (alist-get 'password erc-sasl--options)
+                    ((guard (alist-get 'authfn erc-sasl--options))
+                     (let-alist erc-sasl--options
+                       (let ((erc-sasl-user .user)
+                             (erc-sasl-password .password)
+                             (erc-sasl-mechanism .mechanism)
+                             (erc-sasl-authzid .authzid)
+                             (erc-sasl-auth-source-function .authfn))
+                         (funcall .authfn :user (erc-sasl--get-user)))))
+                    (:password erc-session-password)
+                    ((and (pred stringp) v) (unless (string-empty-p v) v)))))
+      (copy-sequence (erc--unfun found))
+    (read-passwd prompt)))
+
+(defun erc-sasl--plain-response (client steps)
+  (let ((sasl-read-passphrase #'erc-sasl--read-password))
+    (sasl-plain-response client steps)))
+
+(declare-function erc-compat--29-sasl-scram--client-final-message "erc-compat"
+                  (hash-fun block-length hash-length client step))
+
+(defun erc-sasl--scram-sha-hack-client-final-message (&rest args)
+  ;; In the future (29+), we'll hopefully be able to call
+  ;; `sasl-scram--client-final-message' directly
+  (require 'erc-compat)
+  (let ((sasl-read-passphrase #'erc-sasl--read-password))
+    (apply #'erc-compat--29-sasl-scram--client-final-message args)))
+
+(defun erc-sasl--scram-sha-1-client-final-message (client step)
+  (erc-sasl--scram-sha-hack-client-final-message 'sha1 64 20 client step))
+
+(defun erc-sasl--scram-sha-256-client-final-message (client step)
+  (erc-sasl--scram-sha-hack-client-final-message 'sasl-scram-sha256 64 32
+                                                 client step))
+
+(defun erc-sasl--scram-sha512 (object &optional start end binary)
+  (secure-hash 'sha512 object start end binary))
+
+(defun erc-sasl--scram-sha-512-client-final-message (client step)
+  (erc-sasl--scram-sha-hack-client-final-message #'erc-sasl--scram-sha512
+                                                 128 64 client step))
+
+(defun erc-sasl--scram-sha-512-authenticate-server (client step)
+  (sasl-scram--authenticate-server #'erc-sasl--scram-sha512
+                                   128 64 client step))
+
+(defun erc-sasl--ecdsa-first (client _step)
+  "Return CLIENT name."
+  (sasl-client-name client))
+
+;; FIXME do this with gnutls somehow
+(defun erc-sasl--ecdsa-sign (client step)
+  "Return signed challenge for CLIENT and current STEP."
+  (let ((challenge (sasl-step-data step)))
+    (with-temp-buffer
+      (set-buffer-multibyte nil)
+      (insert challenge)
+      (call-process-region (point-min) (point-max)
+                           "openssl" 'delete t nil "pkeyutl" "-inkey"
+                           (sasl-client-property client 'ecdsa-keyfile)
+                           "-sign")
+      (buffer-string))))
+
+(pcase-dolist
+    (`(,name . ,steps)
+     '(("PLAIN"
+        erc-sasl--plain-response)
+       ("EXTERNAL"
+        ignore)
+       ("SCRAM-SHA-1"
+        erc-compat--29-sasl-scram-client-first-message
+        erc-sasl--scram-sha-1-client-final-message
+        sasl-scram-sha-1-authenticate-server)
+       ("SCRAM-SHA-256"
+        erc-compat--29-sasl-scram-client-first-message
+        erc-sasl--scram-sha-256-client-final-message
+        sasl-scram-sha-256-authenticate-server)
+       ("SCRAM-SHA-512"
+        erc-compat--29-sasl-scram-client-first-message
+        erc-sasl--scram-sha-512-client-final-message
+        erc-sasl--scram-sha-512-authenticate-server)
+       ("ECDSA-NIST256P-CHALLENGE"
+        erc-sasl--ecdsa-first
+        erc-sasl--ecdsa-sign)))
+  (let ((feature (intern (concat "erc-sasl-" (downcase name)))))
+    (put feature 'sasl-mechanism (sasl-make-mechanism name steps))
+    (provide feature)))
+
+(cl-defgeneric erc-sasl--create-client (mechanism)
+  "Create and return a new SASL client object for MECHANISM."
+  (let ((sasl-mechanism-alist (copy-sequence sasl-mechanism-alist))
+        (sasl-mechanisms sasl-mechanisms)
+        (name (upcase (symbol-name mechanism)))
+        (feature (intern-soft (concat "erc-sasl-" (symbol-name mechanism))))
+        client)
+    (when feature
+      (setf (alist-get name sasl-mechanism-alist nil nil #'equal) `(,feature))
+      (cl-pushnew name sasl-mechanisms :test #'equal)
+      (setq client (sasl-make-client (sasl-find-mechanism (list name))
+                                     (erc-sasl--get-user)
+                                     "N/A" "N/A"))
+      (sasl-client-set-property client 'authenticator-name
+                                (alist-get 'authzid erc-sasl--options))
+      client)))
+
+(cl-defmethod erc-sasl--create-client ((_ (eql plain)))
+  "Create and return a new PLAIN client object."
+  ;; https://tools.ietf.org/html/rfc4616#section-2.
+  (let* ((sans (remq (assoc "PLAIN" sasl-mechanism-alist)
+                     sasl-mechanism-alist))
+         (sasl-mechanism-alist (cons '("PLAIN" erc-sasl-plain) sans))
+         (authc (erc-sasl--get-user))
+         (port (if (numberp erc-session-port)
+                   (number-to-string erc-session-port)
+                 "0"))
+         ;; In most cases, `erc-server-announced-name' won't be known.
+         (host (or erc-server-announced-name erc-session-server))
+         (mech (sasl-find-mechanism '("PLAIN")))
+         (client (sasl-make-client mech authc port host)))
+    (sasl-client-set-property client 'authenticator-name
+                              (alist-get 'authzid erc-sasl--options))
+    client))
+
+(cl-defmethod erc-sasl--create-client ((_ (eql scram-sha-256)))
+  "Create and return a new SCRAM-SHA-256 client."
+  (when (featurep 'sasl-scram-sha256)
+    (cl-call-next-method)))
+
+(cl-defmethod erc-sasl--create-client ((_ (eql scram-sha-512)))
+  "Create and return a new SCRAM-SHA-512 client."
+  (when (featurep 'sasl-scram-sha256)
+    (cl-call-next-method)))
+
+(cl-defmethod erc-sasl--create-client ((_ (eql ecdsa-nist256p-challenge)))
+  "Create and return a new ECDSA-NIST256P-CHALLENGE client."
+  (let ((keyfile (cdr (assq 'password erc-sasl--options))))
+    ;; Better to signal usage errors now than inside a process filter.
+    (cond ((or (not (stringp keyfile)) (not (file-readable-p keyfile)))
+           (erc-display-error-notice
+            nil "`erc-sasl-password' not accessible as a file")
+           nil)
+          ((not (executable-find "openssl"))
+           (erc-display-error-notice nil "Could not find openssl program")
+           nil)
+          (t
+           (let ((client (cl-call-next-method)))
+             (sasl-client-set-property client 'ecdsa-keyfile keyfile)
+             client)))))
+
+;; This stands alone because it's also used by bug#49860.
+(defun erc-sasl--init ()
+  (setq erc-sasl--state (make-erc-sasl--state))
+  ;; If the previous attempt failed during registration, this may be
+  ;; non-nil and contain erroneous values, but how can we detect that?
+  ;; What if the server dropped the connection for some other reason?
+  (setq erc-sasl--options
+        (or (and erc--server-reconnecting
+                 (alist-get 'erc-sasl--options erc--server-reconnecting))
+            `((user . ,erc-sasl-user)
+              (password . ,erc-sasl-password)
+              (mechanism . ,erc-sasl-mechanism)
+              (authfn . ,erc-sasl-auth-source-function)
+              (authzid . ,erc-sasl-authzid)))))
+
+(defun erc-sasl--mechanism-offered-p (offered)
+  "Return non-nil when OFFERED appears among a list of mechanisms."
+  (string-match-p (rx-to-string
+                   `(: (| bot ",")
+                       ,(symbol-name (alist-get 'mechanism erc-sasl--options))
+                       (| eot ",")))
+                  (downcase offered)))
+
+(erc-define-catalog
+ 'english
+ '((s902 . "ERR_NICKLOCKED nick %n unavailable: %s")
+   (s904 . "ERR_SASLFAIL (authentication failed) %s")
+   (s905 . "ERR SASLTOOLONG (credentials too long) %s")
+   (s906 . "ERR_SASLABORTED (authentication aborted) %s")
+   (s907 . "ERR_SASLALREADY (already authenticated) %s")
+   (s908 . "RPL_SASLMECHS (unsupported mechanism: %m) %s")))
+
+(define-erc-module sasl nil
+  "Non-IRCv3 SASL support for ERC.
+This doesn't solicit or validate a suite of supported mechanisms."
+  ;; See bug#49860 for a CAP 3.2-aware WIP implementation.
+  ((unless erc--target
+     (erc-sasl--init)
+     (let* ((mech (alist-get 'mechanism erc-sasl--options))
+            (client (erc-sasl--create-client mech)))
+       (unless client
+         (erc-display-error-notice
+          nil (format "Unknown or unsupported SASL mechanism: %s" mech))
+         (erc-error "Unknown or unsupported SASL mechanism: %s" mech))
+       (setf (erc-sasl--state-client erc-sasl--state) client))))
+  ((kill-local-variable 'erc-sasl--state)
+   (kill-local-variable 'erc-sasl--options))
+  'local)
+
+(define-erc-response-handler (AUTHENTICATE)
+  "Begin or resume an SASL session." nil
+  (if-let* ((response (car (erc-response.command-args parsed)))
+            ((= 400 (length response))))
+      (cl-callf (lambda (s) (concat s response))
+          (erc-sasl--state-pending erc-sasl--state))
+    (cl-assert response t)
+    (when (string= "+" response)
+      (setq response ""))
+    (setf response (base64-decode-string
+                    (concat (erc-sasl--state-pending erc-sasl--state)
+                            response))
+          (erc-sasl--state-pending erc-sasl--state) nil)
+    (let ((client (erc-sasl--state-client erc-sasl--state))
+          (step (erc-sasl--state-step erc-sasl--state))
+          data)
+      (when step
+        (sasl-step-set-data step response))
+      (setq step (setf (erc-sasl--state-step erc-sasl--state)
+                       (sasl-next-step client step))
+            data (sasl-step-data step))
+      (when (string= data "")
+        (setq data nil))
+      (when data
+        (setq data (erc--unfun (base64-encode-string data t))))
+      (erc-server-send (concat "AUTHENTICATE " (or data "+"))))))
+
+(defun erc-sasl--destroy (proc)
+  (run-hook-with-args 'erc-quit-hook proc)
+  (delete-process proc)
+  (erc-error "Disconnected from %s; please review SASL settings" proc))
+
+(define-erc-response-handler (902)
+  "Handle an ERR_NICKLOCKED response." nil
+  (erc-display-message parsed '(notice error) 'active 's902
+                       ?n (car (erc-response.command-args parsed))
+                       ?s (erc-response.contents parsed))
+  (erc-sasl--destroy proc))
+
+(define-erc-response-handler (903)
+  "Handle a RPL_SASLSUCCESS response." nil
+  (when erc-sasl-mode
+    (unless erc-server-connected
+      (erc-server-send "CAP END")))
+  (erc-display-message parsed 'notice proc (erc-response.contents parsed)))
+
+(define-erc-response-handler (907)
+  "Handle a RPL_SASLALREADY response." nil
+  (erc-display-message parsed '(notice error) 'active 's907
+                       ?s (erc-response.contents parsed)))
+
+(define-erc-response-handler (904 905 906)
+  "Handle various SASL-related error responses." nil
+  (erc-display-message parsed '(notice error) 'active
+                       (intern (format "s%s" (erc-response.command parsed)))
+                       ?s (erc-response.contents parsed))
+  (erc-sasl--destroy proc))
+
+(define-erc-response-handler (908)
+  "Handle a RPL_SASLALREADY response." nil
+  (erc-display-message parsed '(notice error) 'active 's908
+                       ?m (alist-get 'mechanism erc-sasl--options)
+                       ?s (string-join (cdr (erc-response.command-args parsed))
+                                       " "))
+  (erc-sasl--destroy proc))
+
+(defvar erc-sasl--send-cap-ls nil
+  "Whether to send an opening \"CAP LS\" command.
+This is an escape hatch for picky servers.  If you need it turned
+into a user option, please let ERC know via \\[erc-bug].
+Otherwise, expect it to disappear in subsequent versions.")
+
+(cl-defmethod erc--register-connection (&context (erc-sasl-mode (eql t)))
+  "Send speculative CAP and pipelined AUTHENTICATE and hope for the best."
+  (if-let* ((c (erc-sasl--state-client erc-sasl--state))
+            (m (sasl-mechanism-name (sasl-client-mechanism c))))
+      (progn
+        (erc-server-send (if erc-sasl--send-cap-ls "CAP LS" "CAP REQ :sasl"))
+        (let ((erc-session-password
+               (and erc-session-password
+                    (not (eq :password (alist-get 'password 
erc-sasl--options)))
+                    erc-session-password))
+              (erc-session-username
+               ;; The username may contain a colon or a space
+               (if (eq :user (alist-get 'user erc-sasl--options))
+                   (erc-current-nick)
+                 erc-session-username)))
+          (erc-login))
+        (when erc-sasl--send-cap-ls
+          (erc-server-send "CAP REQ :sasl"))
+        (erc-server-send (format "AUTHENTICATE %s" m)))
+    (erc-sasl--destroy erc-server-process)))
+
+(provide 'erc-sasl)
+;;; erc-sasl.el ends here
+;;
+;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
+;; End:
diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el
index fe9cb5b5f1..c2d91ca9d6 100644
--- a/lisp/erc/erc-services.el
+++ b/lisp/erc/erc-services.el
@@ -180,7 +180,7 @@ Called with a subset of keyword parameters known to
 `auth-source-search' and relevant to authenticating to nickname
 services.  In return, ERC expects a string to send as the
 password, or nil, to fall through to the next method, such as
-prompting.  See info node `(erc) Connecting' for details."
+prompting.  See info node `(erc) auth-source' for details."
   :package-version '(ERC . "5.4.1") ; FIXME update when publishing to ELPA
   :type '(choice (const erc-auth-source-search)
                  (const nil)
@@ -455,7 +455,7 @@ it returns nil."
                   (read-passwd
                    (format "NickServ password for %s on %s (RET to cancel): "
                            nick nid)))))
-       ((not (string-empty-p ret))))
+       ((not (string-empty-p (erc--unfun ret)))))
     ret))
 
 (defvar erc-auto-discard-away)
@@ -477,7 +477,8 @@ Returns t if the message could be sent, nil otherwise."
          (msgtype (or (erc-nickserv-alist-ident-command nil nickserv-info)
                       "PRIVMSG")))
     (erc-message msgtype
-                 (concat nickserv " " identify-word " " nick password))))
+                 (concat nickserv " " identify-word " " nick
+                         (erc--unfun password)))))
 
 (defun erc-nickserv-call-identify-function (nickname)
   "Call `erc-nickserv-identify' with NICKNAME."
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 2312246e3e..6cfc39c4bd 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -219,7 +219,7 @@ parameters and authentication."
 This variable only exists for legacy reasons.  It's not customizable and
 is limited to a single server password.  Users looking for similar
 functionality should consider auth-source instead.  See info
-node `(auth) Top' and info node `(erc) Connecting'.")
+node `(auth) Top' and info node `(erc) auth-source'.")
 
 (make-obsolete-variable 'erc-password "use auth-source instead" "29.1")
 
@@ -407,15 +407,27 @@ erc-channel-user struct.")
   "Hash table of users on the current server.
 It associates nicknames with `erc-server-user' struct instances.")
 
-(defconst erc--casemapping-rfc1459
-  (make-translation-table
-   '((?\[ . ?\{) (?\] . ?\}) (?\\ . ?\|) (?~  . ?^))
-   (mapcar (lambda (c) (cons c (+ c 32))) "ABCDEFGHIJKLMNOPQRSTUVWXYZ")))
-
 (defconst erc--casemapping-rfc1459-strict
-  (make-translation-table
-   '((?\[ . ?\{) (?\] . ?\}) (?\\ . ?\|))
-   (mapcar (lambda (c) (cons c (+ c 32))) "ABCDEFGHIJKLMNOPQRSTUVWXYZ")))
+  (let ((tbl (copy-sequence ascii-case-table))
+        (cup (copy-sequence (char-table-extra-slot ascii-case-table 0))))
+    (set-char-table-extra-slot tbl 0 cup)
+    (set-char-table-extra-slot tbl 1 nil)
+    (set-char-table-extra-slot tbl 2 nil)
+    (pcase-dolist (`(,uc . ,lc) '((?\[ . ?\{) (?\] . ?\}) (?\\ . ?\|)))
+      (aset tbl uc lc)
+      (aset tbl lc lc)
+      (aset cup uc uc))
+    tbl))
+
+(defconst erc--casemapping-rfc1459
+  (let ((tbl (copy-sequence erc--casemapping-rfc1459-strict))
+        (cup (copy-sequence (char-table-extra-slot
+                             erc--casemapping-rfc1459-strict 0))))
+    (set-char-table-extra-slot tbl 0 cup)
+    (aset tbl ?~ ?^)
+    (aset tbl ?^ ?^)
+    (aset cup ?~ ?~)
+    tbl))
 
 (defun erc-add-server-user (nick user)
   "This function is for internal use only.
@@ -1607,11 +1619,12 @@ same manner."
     (if (and (with-suppressed-warnings ((obsolete erc-reuse-buffers))
                erc-reuse-buffers)
              id)
-        (progn
-          (when-let* ((buf (get-buffer (symbol-name id)))
+        (let ((string (symbol-name (erc-networks--id-symbol
+                                    (erc-networks--id-create id)))))
+          (when-let* ((buf (get-buffer string))
                       ((erc-server-process-alive buf)))
-            (user-error  "Session with ID %S already exists" id))
-          (symbol-name id))
+            (user-error  "Session with ID %S already exists" string))
+          string)
       (generate-new-buffer-name (if (and server port)
                                     (if (with-suppressed-warnings
                                             ((obsolete erc-reuse-buffers))
@@ -1791,10 +1804,7 @@ buffer rather than a server buffer.")
   "Migrate old names of ERC modules to new ones."
   ;; modify `transforms' to specify what needs to be changed
   ;; each item is in the format '(old . new)
-  (let ((transforms '((pcomplete . completion))))
-    (delete-dups
-     (mapcar (lambda (m) (or (cdr (assoc m transforms)) m))
-             mods))))
+  (delete-dups (mapcar #'erc--normalize-module-symbol mods)))
 
 (defcustom erc-modules '(netsplit fill button match track completion readonly
                                   networks ring autojoin noncommands 
irccontrols
@@ -1813,9 +1823,16 @@ removed from the list will be disabled."
            (dolist (module erc-modules)
              (unless (member module val)
                (let ((f (intern-soft (format "erc-%s-mode" module))))
-                 (when (and (fboundp f) (boundp f) (symbol-value f))
-                   (message "Disabling `erc-%s'" module)
-                   (funcall f 0))))))
+                 (when (and (fboundp f) (boundp f))
+                   (when (symbol-value f)
+                     (message "Disabling `erc-%s'" module)
+                     (funcall f 0))
+                   (unless (or (custom-variable-p f)
+                               (not (fboundp 'erc-buffer-filter)))
+                     (erc-buffer-filter (lambda ()
+                                          (when (symbol-value f)
+                                            (funcall f 0))
+                                          (kill-local-variable f)))))))))
          (set sym val)
          ;; this test is for the case where erc hasn't been loaded yet
          (when (fboundp 'erc-update-modules)
@@ -1856,6 +1873,7 @@ removed from the list will be disabled."
     (const :tag "readonly: Make displayed lines read-only" readonly)
     (const :tag "replace: Replace text in messages" replace)
     (const :tag "ring: Enable an input history" ring)
+    (const :tag "sasl: Enable SASL authentication" sasl)
     (const :tag "scrolltobottom: Scroll to the bottom of the buffer"
            scrolltobottom)
     (const :tag "services: Identify to Nickserv (IRC Services) automatically"
@@ -1873,27 +1891,23 @@ removed from the list will be disabled."
   :group 'erc)
 
 (defun erc-update-modules ()
-  "Run this to enable erc-foo-mode for all modules in `erc-modules'."
-  (let (req)
-    (dolist (mod erc-modules)
-      (setq req (concat "erc-" (symbol-name mod)))
-      (cond
-       ;; yuck. perhaps we should bring the filenames into sync?
-       ((string= req "erc-capab-identify")
-        (setq req "erc-capab"))
-       ((string= req "erc-completion")
-        (setq req "erc-pcomplete"))
-       ((string= req "erc-pcomplete")
-        (setq mod 'completion))
-       ((string= req "erc-autojoin")
-        (setq req "erc-join")))
-      (condition-case nil
-          (require (intern req))
-        (error nil))
-      (let ((sym (intern-soft (concat "erc-" (symbol-name mod) "-mode"))))
-        (if (fboundp sym)
-            (funcall sym 1)
-          (error "`%s' is not a known ERC module" mod))))))
+  "Enable minor mode for every module in `erc-modules'.
+Except ignore all local modules, which were introduced in ERC 5.5."
+  (erc--update-modules)
+  nil)
+
+(defun erc--update-modules ()
+  (let (local-modes)
+    (dolist (module erc-modules local-modes)
+      (require (or (alist-get module erc--modules-to-features)
+                   (intern (concat "erc-" (symbol-name module))))
+               nil 'noerror) ; some modules don't have a corresponding feature
+      (let ((mode (intern-soft (concat "erc-" (symbol-name module) "-mode"))))
+        (unless (and mode (fboundp mode))
+          (error "`%s' is not a known ERC module" module))
+        (if (custom-variable-p mode)
+            (funcall mode 1)
+          (push mode local-modes))))))
 
 (defun erc-setup-buffer (buffer)
   "Consults `erc-join-buffer' to find out how to display `BUFFER'."
@@ -1924,6 +1938,24 @@ removed from the list will be disabled."
          (display-buffer buffer)
        (switch-to-buffer buffer)))))
 
+(defun erc--merge-local-modes (new-modes old-vars)
+  "Return a cons of two lists, each containing local-module modes.
+In the first, put modes to be enabled in a new ERC buffer by
+calling their associated functions.  In the second, put modes to
+be marked as disabled by setting their associated variables to
+nil."
+  (if old-vars
+      (let ((out (list (reverse new-modes))))
+        (pcase-dolist (`(,k . ,v) old-vars)
+          (when (and (string-prefix-p "erc-" (symbol-name k))
+                     (string-suffix-p "-mode" (symbol-name k)))
+            (if v
+                (cl-pushnew k (car out))
+              (setf (car out) (delq k (car out)))
+              (cl-pushnew k (cdr out)))))
+        (cons (nreverse (car out)) (nreverse (cdr out))))
+    (list new-modes)))
+
 (defun erc-open (&optional server port nick full-name
                            connect passwd tgt-list channel process
                            client-certificate user id)
@@ -1951,18 +1983,25 @@ Returns the buffer for the given server or channel."
   (let* ((target (and channel (erc--target-from-string channel)))
          (buffer (erc-get-buffer-create server port nil target id))
          (old-buffer (current-buffer))
-         old-point
+         (old-vars (and target (buffer-local-variables)))
+         (old-recon-count erc-server-reconnect-count)
+         (old-point nil)
+         (delayed-modules nil)
          (continued-session (and erc--server-reconnecting
                                  (with-suppressed-warnings
                                      ((obsolete erc-reuse-buffers))
                                    erc-reuse-buffers))))
     (when connect (run-hook-with-args 'erc-before-connect server port nick))
-    (erc-update-modules)
     (set-buffer buffer)
     (setq old-point (point))
-    (let ((old-recon-count erc-server-reconnect-count))
-      (erc-mode)
-      (setq erc-server-reconnect-count old-recon-count))
+    (setq delayed-modules
+          (erc--merge-local-modes (erc--update-modules)
+                                  (or erc--server-reconnecting old-vars)))
+
+    (delay-mode-hooks (erc-mode))
+
+    (setq erc-server-reconnect-count old-recon-count)
+
     (when (setq erc-server-connected (not connect))
       (setq erc-server-announced-name
             (buffer-local-value 'erc-server-announced-name old-buffer)))
@@ -2017,14 +2056,23 @@ Returns the buffer for the given server or channel."
     (setq erc-default-nicks (if (consp erc-nick) erc-nick (list erc-nick)))
     ;; client certificate (only useful if connecting over TLS)
     (setq erc-session-client-certificate client-certificate)
-    (setq erc-networks--id (if connect
-                               (erc-networks--id-create id)
-                             (buffer-local-value 'erc-networks--id
-                                                 old-buffer)))
+    (setq erc-networks--id
+          (if connect
+              (or (and erc--server-reconnecting
+                       (alist-get 'erc-networks--id erc--server-reconnecting))
+                  (and id (erc-networks--id-create id)))
+            (buffer-local-value 'erc-networks--id old-buffer)))
     ;; debug output buffer
     (setq erc-dbuf
           (when erc-log-p
             (get-buffer-create (concat "*ERC-DEBUG: " server "*"))))
+
+    (erc-determine-parameters server port nick full-name user passwd)
+
+    (save-excursion (run-mode-hooks))
+    (dolist (mod (car delayed-modules)) (funcall mod +1))
+    (dolist (var (cdr delayed-modules)) (set var nil))
+
     ;; set up prompt
     (unless continued-session
       (goto-char (point-max))
@@ -2036,8 +2084,6 @@ Returns the buffer for the given server or channel."
       (erc-display-prompt)
       (goto-char (point-max)))
 
-    (erc-determine-parameters server port nick full-name user passwd)
-
     ;; Saving log file on exit
     (run-hook-with-args 'erc-connect-pre-hook buffer)
 
@@ -2180,9 +2226,7 @@ then the server and full-name will be set to those values,
 whereas `erc-compute-port' and `erc-compute-nick' will be invoked
 for the values of the other parameters.
 
-When present, ID should be an opaque object used to identify the
-connection unequivocally.  This is rarely needed and not available
-interactively."
+See `erc-tls' for the meaning of ID."
   (interactive (erc-select-read-args))
   (erc-open server port nick full-name t password nil nil nil nil user id))
 
@@ -2209,6 +2253,7 @@ Non-interactively, it takes the keyword arguments
    (server (erc-compute-server))
    (port   (erc-compute-port))
    (nick   (erc-compute-nick))
+   (user   (erc-compute-user))
    password
    (full-name (erc-compute-full-name))
    client-certificate
@@ -2237,11 +2282,11 @@ Example usage:
              \\='(\"/home/bandali/my-cert.key\"
                \"/home/bandali/my-cert.crt\"))
 
-When present, ID should be an opaque object for identifying the
-connection unequivocally.  (In most cases, this would be a string or a
-symbol composed of letters from the Latin alphabet.)  This option is
-generally unneeded, however.  See info node `(erc) Connecting' for use
-cases.  Not available interactively."
+When present, ID should be a symbol or a string to use for naming
+the server buffer and identifying the connection unequivocally.
+See info node `(erc) Network Identifier' for details.  Like USER
+and CLIENT-CERTIFICATE, this parameter cannot be specified
+interactively."
   (interactive (let ((erc-default-port erc-default-port-tls))
                 (erc-select-read-args)))
   (let ((erc-server-connect-function 'erc-open-tls-stream))
@@ -2277,7 +2322,7 @@ message instead, to make debugging easier."
 (defvar erc-debug-irc-protocol-time-format "%FT%T.%6N%z "
   "Timestamp format string for protocol logger.")
 
-(defconst erc-debug-irc-protocol-version "1"
+(defconst erc-debug-irc-protocol-version "2"
   "Protocol log format version number.
 This exists to help tooling track changes to the format.
 
@@ -2288,7 +2333,10 @@ interpreted as email-style headers.  Folding is not 
supported.  A second
 double CRLF, if present, signals the end of a log.  Session resumption
 is not supported.  Logger lines must adhere to the following format:
 TIMESTAMP PEER-NAME FLOW-INDICATOR IRC-MESSAGE CRLF.  Outgoing messages
-are indicated with a >> and incoming with a <<.")
+are indicated with a >> and incoming with a <<.
+
+In version 2, certain outgoing passwords are replaced by a string
+of ten question marks.")
 
 (defvar erc-debug-irc-protocol nil
   "If non-nil, log all IRC protocol traffic to the buffer \"*erc-protocol*\".
@@ -2302,6 +2350,23 @@ but you won't see it.
 WARNING: Do not set this variable directly!  Instead, use the
 function `erc-toggle-debug-irc-protocol' to toggle its value.")
 
+(defvar erc--debug-irc-protocol-mask-secrets t
+  "Whether to hide secrets in a debug log.
+They are still visible on screen but are replaced by question
+marks when yanked.")
+
+(defun erc--mask-secrets (string)
+  (when-let* ((eot (length string))
+              (beg (text-property-any 0 eot 'erc-secret t string))
+              (end (text-property-not-all beg eot 'erc-secret t string))
+              (sec (substring string beg end)))
+    (setq string (concat (substring string 0 beg)
+                         (make-string 10 ??)
+                         (substring string end eot)))
+    (put-text-property beg (+ 10 beg) 'face 'erc-inverse-face string)
+    (put-text-property beg (+ 10 beg) 'display sec string))
+  string)
+
 (defun erc-log-irc-protocol (string &optional outbound)
   "Append STRING to the buffer *erc-protocol*.
 
@@ -2327,6 +2392,8 @@ workaround."
                       (format "%s:%s" erc-session-server erc-session-port))))
           (ts (when erc-debug-irc-protocol-time-format
                 (format-time-string erc-debug-irc-protocol-time-format))))
+      (when (and outbound erc--debug-irc-protocol-mask-secrets)
+        (setq string (erc--mask-secrets string)))
       (with-current-buffer (get-buffer-create "*erc-protocol*")
         (save-excursion
           (goto-char (point-max))
@@ -3156,7 +3223,7 @@ if any.  In return, ERC expects a string to send as the 
server
 password, or nil, to skip the \"PASS\" command completely.  An
 explicit `:password' argument to entry-point commands `erc' and
 `erc-tls' also inhibits lookup, as does setting this option to
-nil.  See info node `(erc) Connecting' for details."
+nil.  See info node `(erc) auth-source' for details."
   :package-version '(ERC . "5.4.1") ; FIXME update when publishing to ELPA
   :group 'erc
   :type '(choice (const erc-auth-source-search)
@@ -3171,7 +3238,7 @@ channel.  In return, ERC expects a string to use as the 
channel
 \"key\", or nil to just join the channel normally.  Setting the
 option itself to nil tells ERC to always forgo consulting
 auth-source for channel keys.  For more information, see info
-node `(erc) Connecting'."
+node `(erc) auth-source'."
   :package-version '(ERC . "5.4.1") ; FIXME update when publishing to ELPA
   :group 'erc
   :type '(choice (const erc-auth-source-search)
@@ -3179,7 +3246,8 @@ node `(erc) Connecting'."
                  function))
 
 (defun erc--auth-source-determine-params-defaults ()
-  (let* ((net (and-let* ((esid (erc-networks--id-symbol erc-networks--id))
+  (let* ((net (and-let* ((erc-networks--id)
+                         (esid (erc-networks--id-symbol erc-networks--id))
                          ((symbol-name esid)))))
          (localp (and erc--target (erc--target-channel-local-p erc--target)))
          (hosts (if localp
@@ -3251,9 +3319,8 @@ the one with host foo would win."
       (setq plist (plist-put plist :max 5000))) ; `auth-source-netrc-parse'
     (unless (plist-get defaults :require)
       (setq plist (plist-put plist :require '(:secret))))
-    (when-let* ((sorted (sort (apply #'auth-source-search plist) test))
-                (secret (plist-get (car sorted) :secret)))
-      (if (functionp secret) (funcall secret) secret))))
+    (when-let* ((sorted (sort (apply #'auth-source-search plist) test)))
+      (plist-get (car sorted) :secret))))
 
 (defun erc-auth-source-search (&rest plist)
   "Call `auth-source-search', possibly with keyword params in PLIST."
@@ -3274,7 +3341,8 @@ Without SECRET, consult auth-source, possibly passing 
SERVER as the
     (setq secret (apply erc-auth-source-join-function
                         `(,@(and server (list :host server)) :user ,channel))))
   (erc-log (format "cmd: JOIN: %s" channel))
-  (erc-server-send (concat "JOIN " channel (and secret (concat " " secret)))))
+  (erc-server-send (concat "JOIN " channel
+                           (and secret (concat " " (erc--unfun secret))))))
 
 (defun erc--valid-local-channel-p (channel)
   "Non-nil when channel is server-local on a network that allows them."
@@ -3831,10 +3899,8 @@ the message given by REASON."
       (with-suppressed-warnings ((obsolete erc-server-reconnecting)
                                  (obsolete erc-reuse-buffers))
         (if erc-reuse-buffers
-            (progn (cl-assert (not erc--server-reconnecting))
-                   (cl-assert (not erc-server-reconnecting)))
-          (setq erc--server-reconnecting nil
-                erc-server-reconnecting nil)))))
+            (cl-assert (not erc-server-reconnecting))
+          (setq erc-server-reconnecting nil)))))
   t)
 
 (defun erc-cmd-RECONNECT (&rest args)
@@ -5904,7 +5970,13 @@ strings over to the next call."
   (with-current-buffer (if (buffer-live-p (erc-server-buffer))
                            (erc-server-buffer)
                          (current-buffer))
-    (setq erc-server-current-nick nick)))
+    (unless (equal erc-server-current-nick nick)
+      (setq erc-server-current-nick nick)
+      ;; This seems sensible but may well be superfluous.  Should
+      ;; really prove that it's actually needed via test scenario.
+      (when erc-server-connected
+        (erc-networks--id-reload erc-networks--id)))
+    nick))
 
 (defun erc-current-nick ()
   "Return the current nickname."
@@ -5937,18 +6009,17 @@ See also `erc-downcase'."
   (and (erc--target-channel-p erc--target)
        (erc-get-channel-user (erc-current-nick)) t))
 
-;; This function happens to return nil in channel buffers previously
-;; parted or those from which a user had been kicked.  While this
-;; "works" for detecting whether a channel is currently subscribed to,
-;; new code should consider using
+;; While `erc-default-target' happens to return nil in channel buffers
+;; you've parted or from which you've been kicked, using it to detect
+;; whether a channel is currently joined may become unreliable in the
+;; future.  For now, new code should consider using
 ;;
 ;;   (erc-get-channel-user (erc-current-nick))
 ;;
-;; instead.  For retrieving a target regardless of subscription or
-;; connection status, use replacements based on `erc--target'.
-;; (Coming soon.)
-;;
-;; TODO deprecate this
+;; and expect a nicer option eventually.  For retrieving a target
+;; regardless of subscription or connection status, use replacements
+;; based on `erc--target' instead.  See also `erc--default-target'.
+
 (defun erc-default-target ()
   "Return the current default target (as a character string) or nil if none."
   (let ((tgt (car erc-default-recipients)))
@@ -6306,6 +6377,15 @@ user input."
 
 ;; authentication
 
+(defun erc--unfun (maybe-fn)
+  "Return MAYBE-FN or whatever it returns."
+  (let ((s (if (functionp maybe-fn) (funcall maybe-fn) maybe-fn)))
+    (when (and erc-debug-irc-protocol
+               erc--debug-irc-protocol-mask-secrets
+               (stringp s))
+      (put-text-property 0 (length s) 'erc-secret t s))
+    s))
+
 (defun erc-login ()
   "Perform user authentication at the IRC server."
   (erc-log (format "login: nick: %s, user: %s %s %s :%s"
@@ -6315,7 +6395,7 @@ user input."
                    erc-session-server
                    erc-session-user-full-name))
   (if erc-session-password
-      (erc-server-send (concat "PASS :" erc-session-password))
+      (erc-server-send (concat "PASS :" (erc--unfun erc-session-password)))
     (message "Logging in without password"))
   (erc-server-send (format "NICK %s" (erc-current-nick)))
   (erc-server-send
@@ -6386,6 +6466,8 @@ non-nil value is found.
 When `erc-auth-source-server-function' is non-nil, call it with NICK for
 the user field and use whatever it returns as the server password."
   (or password (and erc-auth-source-server-function
+                    (not erc--server-reconnecting)
+                    (not erc--target)
                     (funcall erc-auth-source-server-function :user nick))))
 
 (defun erc-compute-full-name (&optional full-name)
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el
index 9ad218d598..9b75c7a123 100644
--- a/lisp/eshell/em-alias.el
+++ b/lisp/eshell/em-alias.el
@@ -183,7 +183,9 @@ file named by `eshell-aliases-file'.")
   (pcomplete-here (eshell-alias-completions pcomplete-stub)))
 
 (defun eshell-read-aliases-list ()
-  "Read in an aliases list from `eshell-aliases-file'."
+  "Read in an aliases list from `eshell-aliases-file'.
+This is useful after manually editing the contents of the file."
+  (interactive)
   (let ((file eshell-aliases-file))
     (when (file-readable-p file)
       (setq eshell-command-aliases-list
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index ac82e3f225..2c721eb9e3 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -342,17 +342,23 @@ to writing a completion function."
        (setq pos (1+ pos))))
     (setq posns (cdr posns))
     (cl-assert (= (length args) (length posns)))
-    (let ((a args)
-         (i 0)
-         l)
+    (let ((a args) (i 0) new-start)
       (while a
-       (if (and (consp (car a))
-                (eq (caar a) 'eshell-operator))
-           (setq l i))
-       (setq a (cdr a) i (1+ i)))
-      (and l
-          (setq args (nthcdr (1+ l) args)
-                posns (nthcdr (1+ l) posns))))
+        ;; Remove any top-level `eshell-splice-args' sigils.  These
+        ;; are meant to be rewritten and can't actually be called.
+        (when (and (consp (car a))
+                   (eq (caar a) 'eshell-splice-args))
+          (setcar a (cadar a)))
+        ;; If there's an unreplaced `eshell-operator' sigil, consider
+        ;; the token after it the new start of our arguments.
+        (when (and (consp (car a))
+                   (eq (caar a) 'eshell-operator))
+          (setq new-start i))
+        (setq a (cdr a)
+              i (1+ i)))
+      (when new-start
+       (setq args (nthcdr (1+ new-start) args)
+             posns (nthcdr (1+ new-start) posns))))
     (cl-assert (= (length args) (length posns)))
     (when (and args (eq (char-syntax (char-before end)) ? )
               (not (eq (char-before (1- end)) ?\\)))
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index 4b5e4dd53e..3f7ec618a3 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -786,10 +786,14 @@ external command."
 
 (defun eshell-complete-host-reference ()
   "If there is a host reference, complete it."
-  (let ((arg (pcomplete-actual-arg))
-       index)
-    (when (setq index (string-match "@[a-z.]*\\'" arg))
-      (setq pcomplete-stub (substring arg (1+ index))
+  (let ((arg (pcomplete-actual-arg)))
+    (when (string-match
+           (rx ;; Match an "@", but not immediately following a "$".
+               (or string-start (not "$")) "@"
+               (group (* (any "a-z.")))
+               string-end)
+           arg)
+      (setq pcomplete-stub (substring arg (match-beginning 1))
            pcomplete-last-completion-raw t)
       (throw 'pcomplete-completions (pcomplete-read-host-names)))))
 
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index f87cc2f20a..8712119671 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -146,9 +146,10 @@ If POS is nil, the location of point is checked."
 When each function on this hook is called, point will be at the
 current position within the argument list.  The function should either
 return nil, meaning that it did no argument parsing, or it should
-return the result of the parse as a sexp.  It is also responsible for
-moving the point forward to reflect the amount of input text that was
-parsed.
+return the result of the parse as a sexp.  If the function did do
+argument parsing, but the result was nothing at all, it should return
+`eshell-empty-token'.  The function is also responsible for moving the
+point forward to reflect the amount of input text that was parsed.
 
 If the hook determines that it has reached the end of an argument, it
 should call `eshell-finish-arg' to complete processing of the current
@@ -237,13 +238,53 @@ convert the result to a number as well."
         (eshell-convert-to-number result)
       result)))
 
+(defun eshell-concat-groups (quoted &rest args)
+  "Concatenate groups of arguments in ARGS and return the result.
+QUOTED is passed to `eshell-concat' (which see) and, if non-nil,
+allows values to be converted to numbers where appropriate.
+
+ARGS should be a list of lists of arguments, such as that
+produced by `eshell-prepare-slice'.  \"Adjacent\" values of
+consecutive arguments will be passed to `eshell-concat'.  For
+example, if ARGS is
+
+  ((list a) (list b) (list c d e) (list f g)),
+
+then the result will be:
+
+  ((eshell-concat QUOTED a b c)
+   d
+   (eshell-concat QUOTED e f)
+   g)."
+  (let (result current-arg)
+    (dolist (arg args)
+      (when arg
+        (push (car arg) current-arg)
+        (when (length> arg 1)
+          (push (apply #'eshell-concat quoted (nreverse current-arg))
+                result)
+          (dolist (inner (butlast (cdr arg)))
+            (push inner result))
+          (setq current-arg (list (car (last arg)))))))
+    (when current-arg
+      (push (apply #'eshell-concat quoted (nreverse current-arg))
+            result))
+    (nreverse result)))
+
 (defun eshell-resolve-current-argument ()
   "If there are pending modifications to be made, make them now."
   (when eshell-current-argument
     (when eshell-arg-listified
-      (setq eshell-current-argument
-            (append (list 'eshell-concat eshell-current-quoted)
-                    eshell-current-argument))
+      (if-let ((grouped-terms (eshell-prepare-splice
+                               eshell-current-argument)))
+          (setq eshell-current-argument
+                `(eshell-splice-args
+                  (eshell-concat-groups ,eshell-current-quoted
+                                        ,@grouped-terms)))
+        ;; If no terms are spliced, use a simpler command form.
+        (setq eshell-current-argument
+              (append (list 'eshell-concat eshell-current-quoted)
+                      eshell-current-argument)))
       (setq eshell-arg-listified nil))
     (while eshell-current-modifiers
       (setq eshell-current-argument
@@ -260,7 +301,8 @@ argument list in place of the value of the current 
argument."
         (setq eshell-current-argument (car arguments))
       (cl-assert (and (not eshell-arg-listified)
                       (not eshell-current-modifiers)))
-      (setq eshell-current-argument (cons 'eshell-flatten-args arguments))))
+      (setq eshell-current-argument
+            (cons 'eshell-splice-immediately arguments))))
   (throw 'eshell-arg-done t))
 
 (defun eshell-quote-argument (string)
@@ -301,7 +343,8 @@ Point is left at the end of the arguments."
                                 (buffer-substring here (point-max))))
                      (when arg
                        (nconc args
-                              (if (eq (car-safe arg) 'eshell-flatten-args)
+                              (if (eq (car-safe arg)
+                                      'eshell-splice-immediately)
                                   (cdr arg)
                                 (list arg))))))))
               (throw 'eshell-incomplete (if (listp delim)
@@ -325,13 +368,14 @@ Point is left at the end of the arguments."
                   (prog1
                       (char-to-string (char-after))
                     (forward-char)))))
-         (if (not eshell-current-argument)
-             (setq eshell-current-argument result)
-           (unless eshell-arg-listified
-             (setq eshell-current-argument
-                   (list eshell-current-argument)
-                   eshell-arg-listified t))
-           (nconc eshell-current-argument (list result))))))
+          (unless (eq result 'eshell-empty-token)
+            (if (not eshell-current-argument)
+                (setq eshell-current-argument result)
+              (unless eshell-arg-listified
+                (setq eshell-current-argument
+                      (list eshell-current-argument)
+                      eshell-arg-listified t))
+              (nconc eshell-current-argument (list result)))))))
     (when (and outer eshell-current-argument)
       (add-text-properties arg-begin (1+ arg-begin)
                           '(arg-begin t rear-nonsticky
@@ -346,6 +390,10 @@ Point is left at the end of the arguments."
   "A stub function that generates an error if a floating operator is found."
   (error "Unhandled operator in input text"))
 
+(defsubst eshell-splice-args (&rest _args)
+  "A stub function that generates an error if a floating splice is found."
+  (error "Splice operator is not permitted in this context"))
+
 (defsubst eshell-looking-at-backslash-return (pos)
   "Test whether a backslash-return sequence occurs at POS."
   (and (eq (char-after pos) ?\\)
@@ -375,15 +423,24 @@ after are both returned."
     (when (eshell-looking-at-backslash-return (point))
        (throw 'eshell-incomplete ?\\))
     (forward-char 2) ; Move one char past the backslash.
-    ;; If the char is in a quote, backslash only has special meaning
-    ;; if it is escaping a special char.
-    (if eshell-current-quoted
-        (if (memq (char-before) eshell-special-chars-inside-quoting)
-            (list 'eshell-escape-arg (char-to-string (char-before)))
-          (concat "\\" (char-to-string (char-before))))
-      (if (memq (char-before) eshell-special-chars-outside-quoting)
-          (list 'eshell-escape-arg (char-to-string (char-before)))
-        (char-to-string (char-before))))))
+    (let ((special-chars (if eshell-current-quoted
+                             eshell-special-chars-inside-quoting
+                           eshell-special-chars-outside-quoting)))
+      (cond
+       ;; Escaped newlines are extra-special: they expand to an empty
+       ;; token to allow for continuing Eshell commands across
+       ;; multiple lines.
+       ((eq (char-before) ?\n)
+        'eshell-empty-token)
+       ((memq (char-before) special-chars)
+        (list 'eshell-escape-arg (char-to-string (char-before))))
+       ;; If the char is in a quote, backslash only has special
+       ;; meaning if it is escaping a special char.  Otherwise, the
+       ;; result is the literal string "\c".
+       (eshell-current-quoted
+        (concat "\\" (char-to-string (char-before))))
+       (t
+        (char-to-string (char-before)))))))
 
 (defun eshell-parse-literal-quote ()
   "Parse a literally quoted string.  Nothing has special meaning!"
@@ -489,5 +546,32 @@ If the form has no `type', the syntax is parsed as if 
`type' were
                   (char-to-string (char-after)))))
         (goto-char end)))))))
 
+(defun eshell-prepare-splice (args)
+  "Prepare a list of ARGS for splicing, if any arg requested a splice.
+This looks for `eshell-splice-args' as the CAR of each argument,
+and if found, returns a grouped list like:
+
+  ((list arg-1) (list arg-2) spliced-arg-3 ...)
+
+This allows callers of this function to build the final spliced
+list by concatenating each element together, e.g. with (apply
+#'append grouped-list).
+
+If no argument requested a splice, return nil."
+  (let* ((splicep nil)
+         ;; Group each arg like ((list arg-1) (list arg-2) ...),
+         ;; splicing in `eshell-splice-args' args.  This lets us
+         ;; apply spliced args correctly elsewhere.
+         (grouped-args
+          (mapcar (lambda (i)
+                    (if (eq (car-safe i) 'eshell-splice-args)
+                        (progn
+                          (setq splicep t)
+                          (cadr i))
+                      `(list ,i)))
+                  args)))
+    (when splicep
+      grouped-args)))
+
 (provide 'esh-arg)
 ;;; esh-arg.el ends here
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index 4a41bbe8fa..1fb8499112 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -480,11 +480,16 @@ hooks should be run before and after the command."
   (let ((sym (if eshell-in-pipeline-p
                 'eshell-named-command*
               'eshell-named-command))
-       (cmd (car terms))
-       (args (cdr terms)))
-    (if args
-       (list sym cmd `(list ,@(cdr terms)))
-      (list sym cmd))))
+        (grouped-terms (eshell-prepare-splice terms)))
+    (cond
+     (grouped-terms
+      `(let ((terms (nconc ,@grouped-terms)))
+         (,sym (car terms) (cdr terms))))
+     ;; If no terms are spliced, use a simpler command form.
+     ((cdr terms)
+      (list sym (car terms) `(list ,@(cdr terms))))
+     (t
+      (list sym (car terms))))))
 
 (defvar eshell-command-body)
 (defvar eshell-test-body)
diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el
index f52b70fe7a..551317d833 100644
--- a/lisp/eshell/esh-opt.el
+++ b/lisp/eshell/esh-opt.el
@@ -132,7 +132,7 @@ This code doesn't really need to be macro expanded 
everywhere."
                       (setq args (eshell--process-args name args options))
                       nil))))
              (when usage-msg
-               (error "%s" usage-msg))))))
+               (user-error "%s" usage-msg))))))
     (if ext-command
         (throw 'eshell-external
                (eshell-external-command ext-command orig-args))
@@ -237,7 +237,7 @@ remaining characters in SWITCH to be processed later as 
further short
 options.
 
 If no matching handler is found, and an :external command is defined
-(and available), it will be called; otherwise, an error will be
+\(and available), it will be called; otherwise, an error will be
 triggered to say that the switch is unrecognized."
   (let ((switch (eshell--split-switch switch kind))
         (opts options)
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index 0ec11e8a0b..aceca28bef 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -362,9 +362,13 @@ Prepend remote identification of `default-directory', if 
any."
   "Convert each element of ARGS into a string value."
   (mapcar #'eshell-stringify args))
 
+(defsubst eshell-list-to-string (list)
+  "Convert LIST into a single string separated by spaces."
+  (mapconcat #'eshell-stringify list " "))
+
 (defsubst eshell-flatten-and-stringify (&rest args)
   "Flatten and stringify all of the ARGS into a single string."
-  (mapconcat #'eshell-stringify (flatten-tree args) " "))
+  (eshell-list-to-string (flatten-tree args)))
 
 (defsubst eshell-directory-files (regexp &optional directory)
   "Return a list of files in the given DIRECTORY matching REGEXP."
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index 57ea42f493..61e9af01a4 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -86,6 +86,13 @@
 ;; Returns the length of the value of $EXPR.  This could also be
 ;; done using the `length' Lisp function.
 ;;
+;;   $@EXPR
+;;
+;; Splices the value of $EXPR in-place into the current list of
+;; arguments.  This is analogous to the `,@' token in Elisp
+;; backquotes, and works as if the user typed '$EXPR[0] $EXPR[1]
+;; ... $EXPR[N]'.
+;;
 ;; There are also a few special variables defined by Eshell.  '$$' is
 ;; the value of the last command (t or nil, in the case of an external
 ;; command).  This makes it possible to chain results:
@@ -320,10 +327,9 @@ copied (a.k.a. \"exported\") to the environment of created 
subprocesses."
   "Parse a variable interpolation.
 This function is explicit for adding to `eshell-parse-argument-hook'."
   (when (and (eq (char-after) ?$)
-            (/= (1+ (point)) (point-max)))
+             (/= (1+ (point)) (point-max)))
     (forward-char)
-    (list 'eshell-escape-arg
-         (eshell-parse-variable))))
+    (eshell-parse-variable)))
 
 (defun eshell/define (var-alias definition)
   "Define a VAR-ALIAS using DEFINITION."
@@ -453,6 +459,8 @@ Its purpose is to call `eshell-parse-variable-ref', and 
then to
 process any indices that come after the variable reference."
   (let* ((get-len (when (eq (char-after) ?#)
                    (forward-char) t))
+         (splice (when (eq (char-after) ?@)
+                   (forward-char) t))
         value indices)
     (setq value (eshell-parse-variable-ref get-len)
          indices (and (not (eobp))
@@ -464,7 +472,13 @@ process any indices that come after the variable 
reference."
     (when get-len
       (setq value `(length ,value)))
     (when eshell-current-quoted
-      (setq value `(eshell-stringify ,value)))
+      (if splice
+          (setq value `(eshell-list-to-string ,value)
+                splice nil)
+        (setq value `(eshell-stringify ,value))))
+    (setq value `(eshell-escape-arg ,value))
+    (when splice
+      (setq value `(eshell-splice-args ,value)))
     value))
 
 (defun eshell-parse-variable-ref (&optional modifier-p)
@@ -751,12 +765,13 @@ For example, to retrieve the second element of a user's 
record in
 
 (defun eshell-complete-variable-reference ()
   "If there is a variable reference, complete it."
-  (let ((arg (pcomplete-actual-arg)) index)
-    (when (setq index
-               (string-match
-                (concat "\\$\\(" eshell-variable-name-regexp
-                        "\\)?\\'") arg))
-      (setq pcomplete-stub (substring arg (1+ index)))
+  (let ((arg (pcomplete-actual-arg)))
+    (when (string-match
+           (rx "$" (? (or "#" "@"))
+               (? (group (regexp eshell-variable-name-regexp)))
+               string-end)
+           arg)
+      (setq pcomplete-stub (substring arg (match-beginning 1)))
       (throw 'pcomplete-completions (eshell-variables-list)))))
 
 (defun eshell-variables-list ()
diff --git a/lisp/external-completion.el b/lisp/external-completion.el
new file mode 100644
index 0000000000..e1c3d76314
--- /dev/null
+++ b/lisp/external-completion.el
@@ -0,0 +1,176 @@
+;;; external-completion.el --- Let external tools control completion style  
-*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
+
+;; Version: 0.1
+;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
+;; Maintainer: João Távora <joaotavora@gmail.com>
+;; Keywords:
+
+;; 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:
+
+;; Written by Stefan Monnier circa 2016.  Variants of this code have
+;; been working stably in SLY and other packages for a long time.
+
+;; The `external' completion style is used with a "programmable
+;; completion" table that gathers completions from an external tool
+;; such as a shell utility, an inferior process, an http server.
+
+;; The table and external tool are fully in control of the matching of
+;; the pattern string to the potential candidates of completion.  When
+;; `external' is in use, the usual styles configured by the user or
+;; other in `completion-styles' are ignored.
+;;
+;; This compromise is for speed: all other styles need the full data
+;; set to be available in Emacs' addressing space, which is often slow
+;; if not completely unfeasible.
+;;
+;; To make use of the `external' style the function
+;; `external-completion-table' should be used.  See its docstring.
+
+;;; Code:
+(require 'cl-lib)
+
+(add-to-list 'completion-styles-alist
+             '(external
+               external-completion--try-completion
+               external-completion--all-completions
+               "Ad-hoc completion style provided by the completion table."))
+
+(defun external-completion-table (category lookup
+                                           &optional metadata
+                                           try-completion-function)
+  "Make completion table using the `external' completion style.
+
+The `external' style is particularly useful when the caller
+interfaces with an external tool that provides completions.  This
+may be a shell utility, an inferior process, an http server, etc.
+Given a pattern string, the external tool matches it to an
+arbitrarily large set of candidates.  Since the full set doesn't
+need to be transferred to Emacs's address space, this often
+results in much faster overall experience, at the expense of the
+convenience of offered by other completion styles.
+
+CATEGORY is a symbol uniquely naming the external tool.  This
+function links CATEGORY to the style `external', by modifying
+`completion-category-defaults', overriding any styles normally
+set in `completion-styles'.
+
+LOOKUP is a function taking a string PATTERN and a number
+POINT. The function should contact the tool and return a list of
+strings representing the completions for PATTERN given that POINT
+is the location of point within it.  LOOKUP decides if PATTERN is
+interpreted as a substring, a regular expression, or any other
+type of matching method.  The strings returned may be propertized
+with `completions-common-part' to illustrate the specific method
+used.  LOOKUP may ignore POINT if it doesn't meaningfully alter
+the results.
+
+LOOKUP is a synchronous blocking function.  Since it contacts an
+external tool, it's possible that it takes significant time to
+return results.  To maintain Emacs's responsiveness, LOOKUP
+should detect pending user input using `while-no-input' or
+`sit-for' (which see).  In those cases, LOOKUP should attempt to
+cancel the request (if possible) and immediately return any
+non-list.
+
+METADATA is an alist of additional properties such as
+`cycle-sort-function' to associate with CATEGORY.  This means
+that the caller may still retain control the sorting of the
+candidates while the tool controls the matching.
+
+Optional TRY-COMPLETION-FUNCTION helps some frontends partially
+or fully expand PATTERN before finishing the completion
+operation.  If supplied, it is a function taking a (PATTERN POINT
+ALL-COMPLETIONS), where PATTERN and POINT are as described above
+and ALL-COMPLETIONS are gathered by LOOKUP for these
+arguments (this function ensures LOOKUP isn't called more than
+needed).  If you know the matching method that the external tool
+using, TRY-COMPLETION-FUNCTION may return a cons
+cell (EXPANDED-PATTERN . NEW-POINT).  For example, if the tool is
+completing by prefix, one could call `try-completion' to find the
+largest common prefix in ALL-COMPLETIONS and then return that as
+EXPANDED-PATTERN."
+  (let ((probe (alist-get category completion-category-defaults)))
+    (if probe
+        (cl-assert (equal '(external) (alist-get 'styles probe))
+                   nil "Category `%s' must only use `external' style" category)
+        (push `(,category (styles external))
+              completion-category-defaults)))
+  (let ((cache (make-hash-table :test #'equal)))
+    (cl-flet ((lookup-internal (string point)
+                (let* ((key (cons string point))
+                       (probe (gethash key cache 'external--notfound)))
+                  (if (eq probe 'external--notfound)
+                      (puthash key (funcall lookup string point) cache)
+                    probe))))
+      (lambda (string pred action)
+        (pcase action
+          (`metadata
+           `(metadata (category . ,category) . ,metadata))
+          ;; Note: the `--tryc' `--allc' suffixes are made akward on
+          ;; purpose, so it's easy to pick them apart from the jungle
+          ;; of combinations of "try" and "all" and "completion" that
+          ;; inhabit Emacs's completion logic.
+          (`(external-completion--tryc . ,point)
+           ;; FIXME: Obey `pred'?  Pass it to `try-completion-function'?
+           `(external-completion--tryc
+             . ,(if try-completion-function
+                    (funcall try-completion-function
+                             string
+                             point
+                             (lookup-internal string point))
+                  (cons string point))))
+          (`(external-completion--allc . ,point)
+           (let ((all (lookup-internal string point)))
+             `(external-completion--allc
+               . ,(if pred (cl-remove-if-not pred all) all))))
+          (`(boundaries . ,_) nil)
+          (_method
+           (let ((all (lookup-internal string (length string))))
+             ;; This branch might be taken:
+             ;;
+             ;; * when users work around
+             ;;   `completion-category-defaults' (via
+             ;;   `completion-category-overrides') and access this
+             ;;   table with another completion style.  We assume
+             ;;   these users know what they are doing, but it might
+             ;;   not work very well, as this whatever is in `all'
+             ;;   very often doesn't equate the full set of candidates
+             ;;   (many tools cap to sth like 100-1000 results).
+             ;;
+             ;; * when `_method' is nil or `lambda' which some
+             ;;   frontends will invoke.  Here, `all' should be
+             ;;   sufficient information for `complete-with-action' to
+             ;;   do the job correctly.
+             (complete-with-action action all string pred))))))))
+
+(defun external-completion--call (op string table pred point)
+  (when (functionp table)
+    (let ((res (funcall table string pred (cons op point))))
+      (when (eq op (car-safe res))
+        (cdr res)))))
+
+(defun external-completion--try-completion (string table pred point)
+  (external-completion--call 'external-completion--tryc string table pred 
point))
+
+(defun external-completion--all-completions (string table pred point)
+  (external-completion--call 'external-completion--allc string table pred 
point))
+
+(provide 'external-completion)
+;;; external-completion.el ends here
diff --git a/lisp/files.el b/lisp/files.el
index b947451369..f352d3a9a7 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1533,7 +1533,7 @@ in all cases, since that is the standard symbol for byte."
   (let ((power (if (or (null flavor) (eq flavor 'iec))
                   1024.0
                 1000.0))
-       (prefixes '("" "k" "M" "G" "T" "P" "E" "Z" "Y")))
+       (prefixes '("" "k" "M" "G" "T" "P" "E" "Z" "Y" "R" "Q")))
     (while (and (>= file-size power) (cdr prefixes))
       (setq file-size (/ file-size power)
            prefixes (cdr prefixes)))
@@ -2308,7 +2308,8 @@ it returns nil or exits non-locally."
   "Warn if an attempt to open file of SIZE bytes may run out of memory."
   (when (and (numberp size) (not (zerop size))
             (integerp out-of-memory-warning-percentage))
-    (let ((meminfo (memory-info)))
+    (let* ((default-directory temporary-file-directory)
+           (meminfo (memory-info)))
       (when (consp meminfo)
        (let ((total-free-memory (float (+ (nth 1 meminfo) (nth 3 meminfo)))))
          (when (> (/ size 1024)
@@ -6192,18 +6193,17 @@ instance of such commands."
       (rename-buffer (generate-new-buffer-name base-name))
       (force-mode-line-update))))
 
-(defun files--ensure-directory (dir)
-  "Make directory DIR if it is not already a directory.  Return nil."
+(defun files--ensure-directory (mkdir dir)
+  "Use function MKDIR to make directory DIR if it is not already a directory.
+Return non-nil if DIR is already a directory."
   (condition-case err
-      (make-directory-internal dir)
+      (funcall mkdir dir)
     (error
-     (unless (file-directory-p dir)
-       (signal (car err) (cdr err))))))
+     (or (file-directory-p dir)
+        (signal (car err) (cdr err))))))
 
 (defun make-directory (dir &optional parents)
   "Create the directory DIR and optionally any nonexistent parent dirs.
-If DIR already exists as a directory, signal an error, unless
-PARENTS is non-nil.
 
 Interactively, the default choice of directory to create is the
 current buffer's default directory.  That is useful when you have
@@ -6213,8 +6213,9 @@ Noninteractively, the second (optional) argument PARENTS, 
if
 non-nil, says whether to create parent directories that don't
 exist.  Interactively, this happens by default.
 
-If creating the directory or directories fail, an error will be
-raised."
+Return non-nil if PARENTS is non-nil and DIR already exists as a
+directory, and nil if DIR did not already exist but was created.
+Signal an error if unsuccessful."
   (interactive
    (list (read-file-name "Make directory: " default-directory default-directory
                         nil nil)
@@ -6222,25 +6223,32 @@ raised."
   ;; If default-directory is a remote directory,
   ;; make sure we find its make-directory handler.
   (setq dir (expand-file-name dir))
-  (let ((handler (find-file-name-handler dir 'make-directory)))
-    (if handler
-       (funcall handler 'make-directory dir parents)
-      (if (not parents)
-         (make-directory-internal dir)
-       (let ((dir (directory-file-name (expand-file-name dir)))
-             create-list parent)
-         (while (progn
-                  (setq parent (directory-file-name
-                                (file-name-directory dir)))
-                  (condition-case ()
-                      (files--ensure-directory dir)
-                    (file-missing
-                     ;; Do not loop if root does not exist (Bug#2309).
-                     (not (string= dir parent)))))
-           (setq create-list (cons dir create-list)
-                 dir parent))
-         (dolist (dir create-list)
-            (files--ensure-directory dir)))))))
+  (let ((mkdir (if-let ((handler (find-file-name-handler dir 'make-directory)))
+                  #'(lambda (dir)
+                      ;; Use 'ignore' since the handler might be designed for
+                      ;; Emacs 28-, so it might return an (undocumented)
+                      ;; non-nil value, whereas the Emacs 29+ convention is
+                      ;; to return nil here.
+                      (ignore (funcall handler 'make-directory dir)))
+                 #'make-directory-internal)))
+    (if (not parents)
+        (funcall mkdir dir)
+      (let ((dir (directory-file-name (expand-file-name dir)))
+            already-dir create-list parent)
+        (while (progn
+                 (setq parent (directory-file-name
+                               (file-name-directory dir)))
+                 (condition-case ()
+                     (ignore (setq already-dir
+                                   (files--ensure-directory mkdir dir)))
+                   (error
+                    ;; Do not loop if root does not exist (Bug#2309).
+                    (not (string= dir parent)))))
+          (setq create-list (cons dir create-list)
+                dir parent))
+        (dolist (dir create-list)
+          (setq already-dir (files--ensure-directory mkdir dir)))
+        already-dir))))
 
 (defun make-empty-file (filename &optional parents)
   "Create an empty file FILENAME.
@@ -6434,7 +6442,7 @@ into NEWNAME instead."
   ;; copy-directory handler.
   (let ((handler (or (find-file-name-handler directory 'copy-directory)
                     (find-file-name-handler newname 'copy-directory)))
-       (follow parents))
+       follow)
     (if handler
        (funcall handler 'copy-directory directory
                  newname keep-time parents copy-contents)
@@ -6454,19 +6462,24 @@ into NEWNAME instead."
                                    t)
              (make-symbolic-link target newname t)))
         ;; Else proceed to copy as a regular directory
-        (cond ((not (directory-name-p newname))
+       ;; first by creating the destination directory if needed,
+       ;; preparing to follow any symlink to a directory we did not create.
+       (setq follow
+           (if (not (directory-name-p newname))
               ;; If NEWNAME is not a directory name, create it;
               ;; that is where we will copy the files of DIRECTORY.
-              (make-directory newname parents))
+              (make-directory newname parents)
              ;; NEWNAME is a directory name.  If COPY-CONTENTS is non-nil,
              ;; create NEWNAME if it is not already a directory;
              ;; otherwise, create NEWNAME/[DIRECTORY-BASENAME].
-             ((if copy-contents
-                  (or parents (not (file-directory-p newname)))
+             (unless copy-contents
                 (setq newname (concat newname
                                       (file-name-nondirectory directory))))
-              (make-directory (directory-file-name newname) parents))
-             (t (setq follow t)))
+             (condition-case err
+                 (make-directory (directory-file-name newname) parents)
+               (error
+                (or (file-directory-p newname)
+                    (signal (car err) (cdr err)))))))
 
         ;; Copy recursively.
         (dolist (file
@@ -7440,7 +7453,7 @@ The \"sibling\" file is defined by the 
`find-sibling-rules' variable."
                           relatives nil t nil nil (car relatives))))))))
 
 (defun find-sibling-file-search (file &optional rules)
-  "Return a list of FILE's \"siblings\"
+  "Return a list of FILE's \"siblings\".
 RULES should be a list on the form defined by `find-sibling-rules' (which
 see), and if nil, defaults to `find-sibling-rules'."
   (let ((results nil))
@@ -8496,7 +8509,7 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
           (unless (file-directory-p trash-dir)
             (make-directory trash-dir t))
           ;; Ensure that the trashed file-name is unique.
-          (if (file-exists-p new-fn)
+          (if (file-attributes new-fn)
               (let ((version-control t)
                     (backup-directory-alist nil))
                 (setq new-fn (car (find-backup-file-name new-fn)))))
@@ -8566,13 +8579,14 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
 
               ;; Make a .trashinfo file.  Use O_EXCL, as per trash-spec 1.0.
               (let* ((files-base (file-name-nondirectory fn))
-                      (is-directory (file-directory-p fn))
+                      (is-directory (and (file-directory-p fn)
+                                        (not (file-symlink-p fn))))
                       (overwrite nil)
                       info-fn)
                  ;; We're checking further down whether the info file
                  ;; exists, but the file name may exist in the trash
                  ;; directory even if there is no info file for it.
-                 (when (file-exists-p
+                 (when (file-attributes
                         (file-name-concat trash-files-dir files-base))
                    (setq overwrite t
                          files-base (file-name-nondirectory
@@ -8596,10 +8610,27 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
                    (setq files-base (substring (file-name-nondirectory info-fn)
                                                 0 (- (length ".trashinfo"))))
                    (write-region nil nil info-fn nil 'quiet info-fn)))
-                ;; Finally, try to move the file to the trashcan.
+                ;; Finally, try to move the item to the trashcan.  If
+                 ;; it's a file, just move it.  Things are more
+                 ;; complicated for directories.  If the target
+                 ;; directory already exists (due to uniquification)
+                 ;; and the trash directory is in a different
+                 ;; filesystem, rename-file will error out, even when
+                 ;; 'overwrite' is non-nil.  Rather than worry about
+                 ;; whether we're crossing filesystems, just check if
+                 ;; we've moving a directory and the target directory
+                 ;; already exists.  That handles both the
+                 ;; same-filesystem and cross-filesystem cases.
                 (let ((delete-by-moving-to-trash nil)
                       (new-fn (file-name-concat trash-files-dir files-base)))
-                  (rename-file fn new-fn overwrite)))))))))
+                   (if (or (not is-directory)
+                           (not (file-attributes new-fn)))
+                       (rename-file fn new-fn overwrite)
+                     (copy-directory fn
+                                     (file-name-as-directory new-fn)
+                                     t nil t)
+                     (delete-directory fn t))))))))))
+
 
 
 (defsubst file-attribute-type (attributes)
diff --git a/lisp/frame.el b/lisp/frame.el
index 400f8a44ee..e4cd2cd8ae 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1188,7 +1188,7 @@ e.g. (mapc \\='frame-set-background-mode (frame-list))."
 
 (defvar inhibit-frame-set-background-mode nil)
 
-(defun frame--current-backround-mode (frame)
+(defun frame--current-background-mode (frame)
   (let* ((frame-default-bg-mode (frame-terminal-default-bg-mode frame))
          (bg-color (frame-parameter frame 'background-color))
          (tty-type (tty-type frame))
@@ -1218,7 +1218,7 @@ If optional arg KEEP-FACE-SPECS is non-nil, don't 
recalculate
 face specs for the new background mode."
   (unless inhibit-frame-set-background-mode
     (let* ((bg-mode
-           (frame--current-backround-mode frame))
+           (frame--current-background-mode frame))
           (display-type
            (cond ((null (window-system frame))
                   (if (tty-display-color-p frame) 'color 'mono))
@@ -1297,7 +1297,7 @@ the `background-mode' terminal parameter."
 ;;   :global t
 ;;   :group 'faces
 ;;   (when (eq dark-mode
-;;             (eq 'light (frame--current-backround-mode (selected-frame))))
+;;             (eq 'light (frame--current-background-mode (selected-frame))))
 ;;     ;; FIXME: Change the face's SPEC instead?
 ;;     (set-face-attribute 'default nil
 ;;                         :foreground (face-attribute 'default :background)
@@ -3105,6 +3105,9 @@ If FRAME isn't maximized, show the title bar."
    frame 'undecorated
    (eq (alist-get 'fullscreen (frame-parameters frame)) 'maximized)))
 
+(define-obsolete-function-alias 'frame--current-backround-mode
+  #'frame--current-background-mode "30.1")
+
 (provide 'frame)
 
 ;;; frame.el ends here
diff --git a/lisp/gnus/ChangeLog.2 b/lisp/gnus/ChangeLog.2
index fd5fa0542f..4ac69b575f 100644
--- a/lisp/gnus/ChangeLog.2
+++ b/lisp/gnus/ChangeLog.2
@@ -10070,7 +10070,7 @@
        * gnus-group.el (gnus-group-delete-group): Nix the entry in
        gnus-cache-active-hashtb.
 
-       * gnus-agent.el (gnus-agent-mark-unread-afer-downloaded): New variable.
+       * gnus-agent.el (gnus-agent-mark-unread-after-downloaded): New variable.
        (gnus-agent-summary-fetch-group): Use it.
 
        * gnus-msg.el (gnus-debug-files): New variable.
diff --git a/lisp/gnus/ChangeLog.3 b/lisp/gnus/ChangeLog.3
index c55d6225e3..8c1073dc8d 100644
--- a/lisp/gnus/ChangeLog.3
+++ b/lisp/gnus/ChangeLog.3
@@ -6032,7 +6032,7 @@
        Make `default' the default, for compatibility with open-network-stream.
        Handle the no-parameter case exactly as open-network-stream, with no
        additional stream processing.  Search plists using plist-get.
-       Explicitly add :end-of-commend parameter if it is missing.
+       Explicitly add :end-of-comment parameter if it is missing.
        (proto-stream-open-default): Rename from
        proto-stream-open-network-only.  Return 'default as the type.
        (proto-stream-open-starttls): Rename from proto-stream-open-network.
@@ -22675,7 +22675,8 @@
        * nnspool.el (nnspool-spool-directory): Use news-directory instead
        of news-path.
 
-       * spam-stat.el (spam-stat-unload-hook): Set as a variable w/ add-hook.
+       * spam-stat.el (spam-stat-unload-hook): Set as a variable with
+       add-hook.
 
        * spam.el: Delete duplicate `provide'.
        (spam-unload-hook): Set as a variable with add-hook.
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el
index 449b73163f..13c9c0130e 100644
--- a/lisp/gnus/gnus-cache.el
+++ b/lisp/gnus/gnus-cache.el
@@ -137,7 +137,7 @@ it's not cached."
              ;; If possible, remove group's cache subdirectory.
              (condition-case nil
                  ;; FIXME: we can detect the error type and warn the user
-                 ;; of any inconsistencies (articles w/o nov entries?).
+                 ;; of any inconsistencies (articles without nov entries?).
                  ;; for now, just be conservative...delete only if safe -- sj
                  (delete-directory (file-name-directory overview-file))
                (error))))
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index 1bffdf3513..f3665c3f1a 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -603,7 +603,7 @@ is searched."
     (when file
       (switch-to-buffer (find-file file))
       (goto-char (org-find-entry-with-id (gnus-icalendar-event:uid event)))
-      (org-show-entry))))
+      (org-fold-show-entry))))
 
 
 (defun gnus-icalendar--update-org-event (event reply-status &optional org-file)
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 5589908764..e7d11b597b 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -2909,7 +2909,7 @@ Consider adding this function to 
`message-header-setup-hook'"
   "C-c C-f s"    #'message-change-subject
   ;;
   "C-c C-f x"    #'message-cross-post-followup-to
-  ;; prefix+message-cross-post-followup-to = same w/o cross-post
+  ;; prefix+message-cross-post-followup-to = same without cross-post
   "C-c C-f t"    #'message-reduce-to-to-cc
   "C-c C-f a"    #'message-add-archive-header
   ;; mark inserted text
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index ebd0adf2e2..dc86fe6db9 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -1484,10 +1484,12 @@ Ask for type, description or disposition according to
          (setq disposition (mml-minibuffer-read-disposition type nil file)))
        (mml-attach-file file type description disposition)))))
 
-(defun mml-attach-buffer (buffer &optional type description disposition)
+(defun mml-attach-buffer (buffer &optional type description disposition 
filename)
   "Attach a buffer to the outgoing MIME message.
 BUFFER is the name of the buffer to attach.  See
-`mml-attach-file' for details of operation."
+`mml-attach-file' regarding TYPE, DESCRIPTION and DISPOSITION.
+FILENAME is a suggested file name for the attachment should a
+recipient wish to save a copy separate from the message."
   (interactive
    (let* ((buffer (read-buffer "Attach buffer: "))
          (type (mml-minibuffer-read-type buffer "text/plain"))
@@ -1497,9 +1499,10 @@ BUFFER is the name of the buffer to attach.  See
   ;; If in the message header, attach at the end and leave point unchanged.
   (let ((head (unless (message-in-body-p) (point))))
     (if head (goto-char (point-max)))
-    (mml-insert-empty-tag 'part 'type type 'buffer buffer
-                         'disposition disposition
-                         'description description)
+    (apply #'mml-insert-empty-tag
+           'part 'type type 'buffer buffer
+          'disposition disposition 'description description
+           (and filename `(filename ,filename)))
     ;; When using Mail mode, make sure it does the mime encoding
     ;; when you send the message.
     (or (eq mail-user-agent 'message-user-agent)
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index 4d1ecbf864..3fb87f3a71 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -296,7 +296,7 @@ This variable is set by `nnmaildir-request-article'.")
      (if (file-attributes file) (delete-file file))))
 (defun nnmaildir--mkdir (dir)
   (or (file-exists-p (file-name-as-directory dir))
-      (make-directory-internal (directory-file-name dir))))
+      (make-directory (directory-file-name dir))))
 (defun nnmaildir--mkfile (file)
   (write-region "" nil file nil 'no-message))
 (defun nnmaildir--delete-dir-files (dir ls)
@@ -670,7 +670,7 @@ This variable is set by `nnmaildir-request-article'.")
 (defun nnmaildir-open-server (server-string &optional defs)
   (let ((server (alist-get server-string nnmaildir--servers
                           nil nil #'equal))
-       dir size x)
+       dir size x prefix)
     (catch 'return
       (if server
          (and (nnmaildir--srv-groups server)
@@ -710,20 +710,11 @@ This variable is set by `nnmaildir-request-article'.")
           (car x)
           (setf (nnmaildir--srv-gnm server) t)
           (require 'nnmail))
-      (setq x (assq 'target-prefix defs))
-      (if x
-         (progn
-           (setq x (cadr x)
-                 x (eval x t)) ;FIXME: Why `eval'?
-           (setf (nnmaildir--srv-target-prefix server) x))
-       (setq x (assq 'create-directory defs))
-       (if x
-           (progn
-             (setq x (cadr x)
-                   x (eval x t) ;FIXME: Why `eval'?
-                   x (file-name-as-directory x))
-             (setf (nnmaildir--srv-target-prefix server) x))
-         (setf (nnmaildir--srv-target-prefix server) "")))
+      (setf prefix (cl-second (assq 'target-prefix defs))
+            (nnmaildir--srv-target-prefix server)
+            (if prefix
+                (eval prefix t)
+              ""))
       (setf (nnmaildir--srv-groups server)
            (gnus-make-hashtable size))
       (setq nnmaildir--cur-server server)
diff --git a/lisp/help.el b/lisp/help.el
index f956111a52..b709062cb2 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -747,14 +747,15 @@ or a buffer name."
           (setq-local outline-level (lambda () 1))
           (setq-local outline-minor-mode-cycle t
                       outline-minor-mode-highlight t
-                      outline-minor-mode-use-buttons 'insert)
+                      outline-minor-mode-use-buttons 'insert
+                      ;; Hide the longest body.
+                      outline-default-state 1
+                      outline-default-rules
+                      '((match-regexp . "Key translations")))
           (outline-minor-mode 1)
           (save-excursion
             (goto-char (point-min))
             (let ((inhibit-read-only t))
-              ;; Hide the longest body.
-              (when (re-search-forward "Key translations" nil t)
-               (outline-hide-subtree))
               ;; Hide ^Ls.
               (while (search-forward "\n\f\n" nil t)
                (put-text-property (1+ (match-beginning 0)) (1- (match-end 0))
@@ -860,11 +861,13 @@ in the selected window."
         (mouse-msg (if (or (memq 'click modifiers) (memq 'down modifiers)
                            (memq 'drag modifiers))
                         " at that spot" ""))
+         (click-pos (event-end event))
          ;; Use `posn-set-point' to handle the case when a menu item
          ;; is selected from the context menu that should describe KEY
          ;; at the position of mouse click that opened the context menu.
-         ;; When no mouse was involved, don't use `posn-set-point'.
-         (defn (if buffer
+         ;; When no mouse was involved, or the event doesn't provide a
+         ;; valid position, don't use `posn-set-point'.
+         (defn (if (or buffer (not (consp click-pos)))
                    (key-binding key t)
                  (save-excursion (posn-set-point (event-end event))
                                  (key-binding key t)))))
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 6b5cccec51..adffef4325 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1336,10 +1336,12 @@ against '/a/b'.  For a buffer not associated with a 
file, this
 matches against the value of `default-directory' in that buffer."
   ( :description "directory name"
     :reader (read-from-minibuffer "Filter by directory name (regex): "))
-  (if-let ((it (with-current-buffer buf (ibuffer-buffer-file-name))))
-      (when-let ((dirname (file-name-directory it)))
-        (string-match qualifier dirname))
-    (when default-directory (string-match qualifier default-directory))))
+  (with-current-buffer buf
+    (if-let* ((filename (ibuffer-buffer-file-name))
+              (dirname (file-name-directory filename)))
+        (string-match qualifier dirname)
+      (when default-directory
+        (string-match qualifier default-directory)))))
 
 ;;;###autoload (autoload 'ibuffer-filter-by-size-gt  "ibuf-ext")
 (define-ibuffer-filter size-gt
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index ef710d582d..983931c20c 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -416,7 +416,6 @@ if that doesn't produce a completion match."
                 icomplete-scroll (not (null icomplete-vertical-mode))
                 completion-styles '(flex)
                 completion-flex-nospace nil
-                completion-category-defaults nil
                 completion-ignore-case t
                 read-buffer-completion-ignore-case t
                 read-file-name-completion-ignore-case t)))
diff --git a/lisp/ido.el b/lisp/ido.el
index 77e4dd447d..92b4370cb4 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -2435,7 +2435,7 @@ If cursor is not at the end of the user input, move to 
end of input."
                                 filename))
              (ido-record-command method dirname)
              (ido-record-work-directory dirname)
-             (make-directory-internal dirname)
+             (make-directory dirname)
              (funcall method dirname))
             (t
              ;; put make-directory command on history
diff --git a/lisp/info.el b/lisp/info.el
index 8860a664bd..05ad27e180 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3329,6 +3329,13 @@ If FILE is nil, check the current Info file."
     (or node (error "No index"))
     (Info-goto-node node)))
 
+(defun info--ensure-not-in-directory-node ()
+  (if (equal (downcase (file-name-nondirectory Info-current-file))
+             "dir")
+      (error (substitute-command-keys
+              (concat "The Info directory node has no index; "
+                      "type \\[Info-menu] to select a manual")))))
+
 ;;;###autoload
 (defun Info-index (topic)
   "Look up a string TOPIC in the index for this manual and go to that entry.
@@ -3342,15 +3349,13 @@ Give an empty topic name to go to the Index node 
itself."
          (Info-complete-menu-buffer (clone-buffer))
          (Info-complete-nodes (Info-index-nodes))
          (Info-history-list nil))
-      (if (equal Info-current-file "dir")
-         (error "The Info directory node has no index; use m to select a 
manual"))
+      (info--ensure-not-in-directory-node)
       (unwind-protect
          (with-current-buffer Info-complete-menu-buffer
            (Info-goto-index)
            (completing-read "Index topic: " #'Info-complete-menu-item))
        (kill-buffer Info-complete-menu-buffer)))))
-  (if (equal Info-current-file "dir")
-      (error "The Info directory node has no index; use m to select a manual"))
+  (info--ensure-not-in-directory-node)
   ;; Strip leading colon in topic; index format does not allow them.
   (if (and (stringp topic)
           (> (length topic) 0)
@@ -3533,8 +3538,7 @@ search results."
          (Info-complete-menu-buffer (clone-buffer))
          (Info-complete-nodes (Info-index-nodes))
          (Info-history-list nil))
-      (if (equal Info-current-file "dir")
-         (error "The Info directory node has no index; use m to select a 
manual"))
+      (info--ensure-not-in-directory-node)
       (unwind-protect
          (with-current-buffer Info-complete-menu-buffer
            (Info-goto-index)
diff --git a/lisp/international/ogonek.el b/lisp/international/ogonek.el
index ac9a213ec7..216d2fd0f2 100644
--- a/lisp/international/ogonek.el
+++ b/lisp/international/ogonek.el
@@ -214,7 +214,7 @@ The functions come in the following groups.
  is stored in the constant `ogonek-name-encoding-alist'.
 
  The `ogonek' functions refer to five variables in which the suggested
- answers to dialogue questions are stored.  The variables and their
+ answers to dialog questions are stored.  The variables and their
  default values are:
 
    ogonek-from-encoding           iso8859-2
@@ -266,7 +266,7 @@ The functions come in the following groups.
   (switch-to-buffer " *ogonek-how*")
   (goto-char (point-min)))
 
-;; ---- Variables keeping the suggested answers to dialogue questions -----
+;; ---- Variables keeping the suggested answers to dialog questions -----
 (defvar ogonek-encoding-choices
   (cons 'choice
        (mapcar (lambda (x) (list 'const (car x)))
diff --git a/lisp/international/ucs-normalize.el 
b/lisp/international/ucs-normalize.el
index bc32b4f073..b6545faf80 100644
--- a/lisp/international/ucs-normalize.el
+++ b/lisp/international/ucs-normalize.el
@@ -531,6 +531,7 @@ COMPOSITION-PREDICATE will be used to compose region."
 ;; 
--------------------------------------------------------------------------------
 
 (defmacro ucs-normalize-string (ucs-normalize-region)
+  "Normalize string STR using the function UCS-NORMALIZE-REGION."
   `(with-temp-buffer
      (insert str)
      (,ucs-normalize-region (point-min) (point-max))
diff --git a/lisp/isearch.el b/lisp/isearch.el
index bc3697deb0..6a17d18c45 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -4435,7 +4435,7 @@ CASE-FOLD: The value of `isearch-case-fold' to use for 
lazy
 highlighting.
 LAX-WHITESPACE: The value of `isearch-lax-whitespace' and
 `isearch-regexp-lax-whitespace' to use for lazy highlighting."
-  (if (not highlight)
+  (if (or (not highlight) (minibufferp))
       #'ignore
     (let ((unwind (make-symbol "minibuffer-lazy-highlight--unwind"))
           (after-change (make-symbol 
"minibuffer-lazy-highlight--after-change"))
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 90833e1c1d..2d562610b3 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -4,7 +4,7 @@
 
 ;; Author: João Távora <joaotavora@gmail.com>
 ;; Keywords: processes, languages, extensions
-;; Version: 1.0.15
+;; Version: 1.0.16
 ;; Package-Requires: ((emacs "25.2"))
 
 ;; This is a GNU ELPA :core package.  Avoid functionality that is not
@@ -548,11 +548,26 @@ With optional CLEANUP, kill any associated buffers."
         (delete-process proc)
         (funcall (jsonrpc--on-shutdown connection) connection)))))
 
-(defun jsonrpc--process-filter (proc string)
+(defvar jsonrpc--in-process-filter nil
+  "Non-nil if inside `jsonrpc--process-filter'.")
+
+(cl-defun jsonrpc--process-filter (proc string)
   "Called when new data STRING has arrived for PROC."
+  (when jsonrpc--in-process-filter
+    ;; Problematic recursive process filters may happen if
+    ;; `jsonrpc--connection-receive', called by us, eventually calls
+    ;; client code which calls `process-send-string' (which see) to,
+    ;; say send a follow-up message.  If that happens to writes enough
+    ;; bytes for pending output to be received, we will lose JSONRPC
+    ;; messages.  In that case, remove recursiveness by re-scheduling
+    ;; ourselves to run from within a timer as soon as possible
+    ;; (bug#60088)
+    (run-at-time 0 nil #'jsonrpc--process-filter proc string)
+    (cl-return-from jsonrpc--process-filter))
   (when (buffer-live-p (process-buffer proc))
     (with-current-buffer (process-buffer proc)
       (let* ((inhibit-read-only t)
+             (jsonrpc--in-process-filter t)
              (connection (process-get proc 'jsonrpc-connection))
              (expected-bytes (jsonrpc--expected-bytes connection)))
         ;; Insert the text, advancing the process marker.
diff --git a/lisp/keymap.el b/lisp/keymap.el
index eaeba96644..b355f68aa2 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -147,7 +147,7 @@ in KEYMAP as NEWDEF those keys that are defined as OLDDEF 
in OLDMAP.
 If you don't specify OLDMAP, you can usually get the same results
 in a cleaner way with command remapping, like this:
   (define-key KEYMAP [remap OLDDEF] NEWDEF)
-\n(fn OLDDEF NEWDEF KEYMAP &optional OLDMAP)"
+\n(fn KEYMAP OLDDEF NEWDEF &optional OLDMAP)"
   ;; Don't document PREFIX in the doc string because we don't want to
   ;; advertise it.  It's meant for recursive calls only.  Here's its
   ;; meaning
diff --git a/lisp/language/european.el b/lisp/language/european.el
index 937215074b..18b72bd3b2 100644
--- a/lisp/language/european.el
+++ b/lisp/language/european.el
@@ -585,7 +585,7 @@ and it selects the Spanish tutorial."))
             (nonascii-translation . iso-8859-9)
             (unibyte-display . iso-latin-5)
             (input-method . "turkish-postfix")
-            (sample-text . "Turkish (Türkçe)   Merhaba")
+            (sample-text . "Turkish (Türkçe)   Esenlikler / Merhaba")
             (setup-function . turkish-case-conversion-enable)
             (exit-function . turkish-case-conversion-disable)
             (documentation . "Support for Turkish.
diff --git a/lisp/language/indian.el b/lisp/language/indian.el
index 4994cfdc7a..f70f7fcce1 100644
--- a/lisp/language/indian.el
+++ b/lisp/language/indian.el
@@ -552,24 +552,40 @@ environment."))
    char-script-table))
 
 ;; Brahmi composition rules
-(let ((consonant     "[\U00011013-\U00011034]")
-      (non-consonant "[^\U00011013-\U00011034\U00011046\U0001107F]")
-      (vowel         "[\U00011038-\U00011045]")
-      (numeral       "[\U00011052-\U00011065]")
-      (multiplier    "[\U00011064\U00011065]")
-      (virama        "\U00011046")
-      (number-joiner "\U0001107F"))
+(let ((consonant            "[\x11013-\x11037\x11075]")
+      (independent-vowel    "[\x11005-\x11012\x11071\x11072]")
+      (vowel                "[\x11038-\x11045\x11073\x11074]")
+      (nasal                "[\x11000\x11001]")
+      (virama               "\x11046")
+      (jivhamuliya          "\x11003")
+      (upadhmaniya          "\x11004")
+      (ka-kha               "[\x11013\x11014]")
+      (pa-pha               "[\x11027\x11028]")
+      (number-joiner        "\x1107F")
+      (numeral              "[\x11052-\x11065]")
+      (multiplier           "[\x11064\x11065]"))
   (set-char-table-range composition-function-table
-                       '(#x11046 . #x11046)
+                        '(#x11046 . #x11046)
                         (list (vector
-                               ;; Consonant conjuncts
-                               (concat consonant "\\(?:" virama consonant 
"\\)+"
-                                       vowel "?")
+                               ;; Consonant based syllables
+                               (concat consonant "\\(?:" virama consonant
+                                       "\\)*\\(?:" virama "\\|" vowel "*"
+                                       nasal "?\\)")
                                1 'font-shape-gstring)
                               (vector
-                               ;; Vowelless consonants
-                               (concat consonant virama non-consonant)
+                               ;; Vowel based syllables
+                               (concat independent-vowel virama "?" vowel "?" 
nasal "?")
                                1 'font-shape-gstring)))
+  (set-char-table-range composition-function-table
+                        '(#x11003 . #x11004)
+                        (list (vector
+                               ;; Velar fricative
+                               (concat jivhamuliya ka-kha "?")
+                               0 'font-shape-gstring)
+                              (vector
+                               ;; Bilabial fricative
+                               (concat upadhmaniya pa-pha "?")
+                               0 'font-shape-gstring)))
   (set-char-table-range composition-function-table
                         '(#x1107F . #x1107F)
                         (list (vector
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index 3f36cfbba5..2639c5cceb 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -1028,7 +1028,8 @@ Like (documentation-property SYMBOL PROPERTY RAW) but 
handle errors.
 (autoload 'apropos "apropos" "\
 Show all meaningful Lisp symbols whose names match PATTERN.
 Symbols are shown if they are defined as functions, variables, or
-faces, or if they have nonempty property lists.
+faces, or if they have nonempty property lists, or if they are
+known keywords.
 
 PATTERN can be a word, a list of words (separated by spaces),
 or a regexp (using some regexp special characters).  If it is a word,
@@ -1943,6 +1944,85 @@ Major mode for editing BibTeX style files.
 (register-definition-prefixes "bibtex-style" '("bibtex-style-"))
 
 
+;;; Generated autoloads from use-package/bind-key.el
+
+(push (purecopy '(bind-key 2 4 1)) package--builtin-versions)
+(autoload 'bind-key "bind-key" "\
+Bind KEY-NAME to COMMAND in KEYMAP (`global-map' if not passed).
+
+KEY-NAME may be a vector, in which case it is passed straight to
+`define-key'.  Or it may be a string to be interpreted as
+spelled-out keystrokes, e.g., \"C-c C-z\".  See the documentation
+of `edmacro-mode' for details.
+
+COMMAND must be an interactive function or lambda form.
+
+KEYMAP, if present, should be a keymap variable or symbol.
+For example:
+
+  (bind-key \"M-h\" #\\='some-interactive-function my-mode-map)
+
+  (bind-key \"M-h\" #\\='some-interactive-function \\='my-mode-map)
+
+If PREDICATE is non-nil, it is a form evaluated to determine when
+a key should be bound. It must return non-nil in such cases.
+Emacs can evaluate this form at any time that it does redisplay
+or operates on menu data structures, so you should write it so it
+can safely be called at any time.
+
+(fn KEY-NAME COMMAND &optional KEYMAP PREDICATE)" nil t)
+(autoload 'unbind-key "bind-key" "\
+Unbind the given KEY-NAME, within the KEYMAP (if specified).
+See `bind-key' for more details.
+
+(fn KEY-NAME &optional KEYMAP)" nil t)
+(autoload 'bind-key* "bind-key" "\
+Similar to `bind-key', but overrides any mode-specific bindings.
+
+(fn KEY-NAME COMMAND &optional PREDICATE)" nil t)
+(autoload 'bind-keys "bind-key" "\
+Bind multiple keys at once.
+
+Accepts keyword arguments:
+:map MAP               - a keymap into which the keybindings should be
+                         added
+:prefix KEY            - prefix key for these bindings
+:prefix-map MAP        - name of the prefix map that should be created
+                         for these bindings
+:prefix-docstring STR  - docstring for the prefix-map variable
+:menu-name NAME        - optional menu string for prefix map
+:repeat-docstring STR  - docstring for the repeat-map variable
+:repeat-map MAP        - name of the repeat map that should be created
+                         for these bindings. If specified, the
+                         `repeat-map' property of each command bound
+                         (within the scope of the `:repeat-map' keyword)
+                         is set to this map.
+:exit BINDINGS         - Within the scope of `:repeat-map' will bind the
+                         key in the repeat map, but will not set the
+                         `repeat-map' property of the bound command.
+:continue BINDINGS     - Within the scope of `:repeat-map' forces the
+                         same behavior as if no special keyword had
+                         been used (that is, the command is bound, and
+                         it's `repeat-map' property set)
+:filter FORM           - optional form to determine when bindings apply
+
+The rest of the arguments are conses of keybinding string and a
+function symbol (unquoted).
+
+(fn &rest ARGS)" nil t)
+(autoload 'bind-keys* "bind-key" "\
+Bind multiple keys at once, in `override-global-map'.
+Accepts the same keyword arguments as `bind-keys' (which see).
+
+This binds keys in such a way that bindings are not overridden by
+other modes.  See `override-global-mode'.
+
+(fn &rest ARGS)" nil t)
+(autoload 'describe-personal-keybindings "bind-key" "\
+Display all the personal keybindings defined by `bind-key'." t)
+(register-definition-prefixes "bind-key" '("bind-key" "override-global-m" 
"personal-keybindings"))
+
+
 ;;; Generated autoloads from emacs-lisp/bindat.el
 
 (register-definition-prefixes "bindat" '("bindat-"))
@@ -2308,7 +2388,7 @@ This is used by the `browse-url-at-point', 
`browse-url-at-mouse', and
 Also see `browse-url-secondary-browser-function' and
 `browse-url-handlers'.")
 (custom-autoload 'browse-url-browser-function "browse-url" t)
-(defvar browse-url-default-handlers '(("\\`mailto:"; . browse-url--mailto) 
("\\`man:" . browse-url--man) (browse-url--non-html-file-url-p . 
browse-url-emacs)) "\
+(defvar browse-url-default-handlers '(("\\`mailto:"; . browse-url--mailto) 
("\\`man:" . browse-url--man) ("\\`irc6?s?://" . browse-url--irc) 
(browse-url--non-html-file-url-p . browse-url-emacs)) "\
 Like `browse-url-handlers' but populated by Emacs and packages.
 
 Emacs and external packages capable of browsing certain URLs
@@ -2544,6 +2624,11 @@ When called non-interactively, optional second argument 
NEW-WINDOW is
 used instead of `browse-url-new-window-flag'.
 
 (fn URL &optional NEW-BUFFER)" t)
+(autoload 'browse-url-irc "browse-url" "\
+Call `url-irc' directly after parsing URL.
+This function is a fit for options like `gnus-button-alist'.
+
+(fn URL &rest _)")
 (autoload 'browse-url-mail "browse-url" "\
 Open a new mail message buffer within Emacs for the RFC 2368 URL.
 Default to using the mailto: URL around or before point as the
@@ -2833,6 +2918,25 @@ and corresponding effects.
 (register-definition-prefixes "semantic/bovine/c" '("semantic"))
 
 
+;;; Generated autoloads from progmodes/c-ts-mode.el
+
+(autoload 'c-ts-base-mode "c-ts-mode" "\
+Major mode for editing C, powered by tree-sitter.
+
+\\{c-ts-mode-map}
+
+(fn)" t)
+(autoload 'c-ts-mode "c-ts-mode" "\
+Major mode for editing C, powered by tree-sitter.
+
+(fn)" t)
+(autoload 'c++-ts-mode "c-ts-mode" "\
+Major mode for editing C++, powered by tree-sitter.
+
+(fn)" t)
+(register-definition-prefixes "c-ts-mode" '("c-ts-mode-"))
+
+
 ;;; Generated autoloads from calendar/cal-bahai.el
 
 (register-definition-prefixes "cal-bahai" '("calendar-bahai-" "diary-bahai-" 
"holiday-bahai"))
@@ -4525,6 +4629,16 @@ For use inside Lisp programs, see also 
`c-macro-expansion'.
 (register-definition-prefixes "cmacexp" '("c-macro-"))
 
 
+;;; Generated autoloads from progmodes/cmake-ts-mode.el
+
+(add-to-list 'auto-mode-alist '("\\(?:CMakeLists\\.txt\\|\\.cmake\\)$" . 
cmake-ts-mode))
+(autoload 'cmake-ts-mode "cmake-ts-mode" "\
+Major mode for editing CMake files, powered by tree-sitter.
+
+(fn)" t)
+(register-definition-prefixes "cmake-ts-mode" '("cmake-ts-mode-"))
+
+
 ;;; Generated autoloads from cmuscheme.el
 
 (autoload 'run-scheme "cmuscheme" "\
@@ -5498,8 +5612,50 @@ with empty strings removed.
 (register-definition-prefixes "semantic/symref/cscope" 
'("semantic-symref-cscope--line-re"))
 
 
+;;; Generated autoloads from progmodes/csharp-mode.el
+
+(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
+(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
+(autoload 'csharp-mode "csharp-mode" "\
+Major mode for editing Csharp code.
+
+Key bindings:
+\\{csharp-mode-map}
+
+(fn)" t)
+(autoload 'csharp-ts-mode "csharp-mode" "\
+Major mode for editing C# code.
+
+(fn)" t)
+(register-definition-prefixes "csharp-mode" '("codedoc-font-lock-" "csharp-"))
+
+
 ;;; Generated autoloads from textmodes/css-mode.el
 
+(autoload 'css-ts-mode "css-mode" "\
+Major mode to edit Cascading Style Sheets (CSS).
+\\<css-ts-mode-map>
+
+This mode provides syntax highlighting, indentation, completion,
+and documentation lookup for CSS, based on the tree-sitter
+library.
+
+Use `\\[completion-at-point]' to complete CSS properties,
+property values, pseudo-elements, pseudo-classes, at-rules,
+bang-rules, and HTML tags, classes and IDs.  Completion
+candidates for HTML class names and IDs are found by looking
+through open HTML mode buffers.
+
+Use `\\[info-lookup-symbol]' to look up documentation of CSS
+properties, at-rules, pseudo-classes, and pseudo-elements on the
+Mozilla Developer Network (MDN).
+
+Use `\\[fill-paragraph]' to reformat CSS declaration blocks.  It
+can also be used to fill comments.
+
+\\{css-mode-map}
+
+(fn)" t)
 (autoload 'css-mode "css-mode" "\
 Major mode to edit Cascading Style Sheets (CSS).
 \\<css-mode-map>
@@ -7832,6 +7988,16 @@ it is disabled.
 (register-definition-prefixes "doc-view" '("doc-view-"))
 
 
+;;; Generated autoloads from progmodes/dockerfile-ts-mode.el
+
+(add-to-list 'auto-mode-alist 
'("\\(?:Dockerfile\\(?:\\..*\\)?\\|\\.[Dd]ockerfile\\)\\'" . 
dockerfile-ts-mode))
+(autoload 'dockerfile-ts-mode "dockerfile-ts-mode" "\
+Major mode for editing Dockerfiles, powered by tree-sitter.
+
+(fn)" t)
+(register-definition-prefixes "dockerfile-ts-mode" '("dockerfile-ts-mode--"))
+
+
 ;;; Generated autoloads from play/doctor.el
 
 (autoload 'doctor "doctor" "\
@@ -10003,13 +10169,16 @@ symbol composed of letters from the Latin alphabet.)  
This option is
 generally unneeded, however.  See info node `(erc) Connecting' for use
 cases.  Not available interactively.
 
-(fn &key (SERVER (erc-compute-server)) (PORT (erc-compute-port)) (NICK 
(erc-compute-nick)) (USER (erc-compute-user)) PASSWORD (FULL-NAME 
(erc-compute-full-name)) CLIENT-CERTIFICATE ID)" t)
+(fn &key (SERVER (erc-compute-server)) (PORT (erc-compute-port \\='ircs-u)) 
(NICK (erc-compute-nick)) (USER (erc-compute-user)) PASSWORD (FULL-NAME 
(erc-compute-full-name)) CLIENT-CERTIFICATE ID)" t)
 (autoload 'erc-handle-irc-url "erc" "\
-Use ERC to IRC on HOST:PORT in CHANNEL as USER with PASSWORD.
+Use ERC to IRC on HOST:PORT in CHANNEL.
 If ERC is already connected to HOST:PORT, simply /join CHANNEL.
-Otherwise, connect to HOST:PORT as USER and /join CHANNEL.
+Otherwise, connect to HOST:PORT as NICK and /join CHANNEL.
+
+Beginning with ERC 5.5, new connections require human intervention.
+Customize `erc-url-connect-function' to override this.
 
-(fn HOST PORT CHANNEL USER PASSWORD)")
+(fn HOST PORT CHANNEL NICK PASSWORD &optional SCHEME)")
 (register-definition-prefixes "erc" '("erc-"))
 
 
@@ -10155,6 +10324,11 @@ Interactively select a server to connect to using 
`erc-server-alist'." t)
 (register-definition-prefixes "erc-ring" '("erc-"))
 
 
+;;; Generated autoloads from erc/erc-sasl.el
+
+(register-definition-prefixes "erc-sasl" '("erc-sasl-"))
+
+
 ;;; Generated autoloads from erc/erc-services.el
 
 (register-definition-prefixes "erc-services" '("erc-"))
@@ -10222,7 +10396,7 @@ is run.  If a macro (possibly with side effects) is to 
be tested,
 it has to be wrapped in `(eval (quote ...))'.
 
 If NAME is already defined as a test and Emacs is running
-in batch mode, an error is signalled.
+in batch mode, an error is signaled.
 
 (fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] [:tags \\='(TAG...)] 
BODY...)" nil t)
 (function-put 'ert-deftest 'doc-string-elt 3)
@@ -10649,6 +10823,8 @@ for \\[find-tag] (which see)." t)
 (autoload 'ethio-sera-to-fidel-buffer "ethio-util" "\
 Convert the current buffer from SERA to FIDEL.
 
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
 The variable `ethio-primary-language' specifies the primary
 language and `ethio-secondary-language' specifies the secondary.
 
@@ -10666,6 +10842,8 @@ See also the descriptions of the variables
 (autoload 'ethio-sera-to-fidel-region "ethio-util" "\
 Convert the characters in region from SERA to FIDEL.
 
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
 The variable `ethio-primary-language' specifies the primary
 language and `ethio-secondary-language' specifies the secondary.
 
@@ -10681,13 +10859,17 @@ See also the descriptions of the variables
 
 (fn BEGIN END &optional SECONDARY FORCE)" t)
 (autoload 'ethio-sera-to-fidel-marker "ethio-util" "\
-Convert the regions surrounded by \"<sera>\" and \"</sera>\" from SERA to 
FIDEL.
+Convert regions surrounded by \"<sera>\" and \"</sera>\" from SERA to FIDEL.
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
 Assume that each region begins with `ethio-primary-language'.
 The markers \"<sera>\" and \"</sera>\" themselves are not deleted.
 
 (fn &optional FORCE)" t)
 (autoload 'ethio-fidel-to-sera-buffer "ethio-util" "\
-Replace all the FIDEL characters in the current buffer to the SERA format.
+Convert all the FIDEL characters in the current buffer to the SERA format.
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
 The variable `ethio-primary-language' specifies the primary
 language and `ethio-secondary-language' specifies the secondary.
 
@@ -10704,8 +10886,10 @@ See also the descriptions of the variables
 
 (fn &optional SECONDARY FORCE)" t)
 (autoload 'ethio-fidel-to-sera-region "ethio-util" "\
-Replace all the FIDEL characters in the region to the SERA format.
+Convert all the FIDEL characters in the region to the SERA format.
 
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
 The variable `ethio-primary-language' specifies the primary
 language and `ethio-secondary-language' specifies the secondary.
 
@@ -10723,11 +10907,14 @@ See also the descriptions of the variables
 (fn BEGIN END &optional SECONDARY FORCE)" t)
 (autoload 'ethio-fidel-to-sera-marker "ethio-util" "\
 Convert the regions surrounded by \"<sera>\" and \"</sera>\" from FIDEL to 
SERA.
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
 The markers \"<sera>\" and \"</sera>\" themselves are not deleted.
 
 (fn &optional FORCE)" t)
 (autoload 'ethio-modify-vowel "ethio-util" "\
-Modify the vowel of the FIDEL that is under the cursor." t)
+Modify the vowel of the FIDEL that is under the cursor.
+FIDEL is the Amharic/Ethiopic alphabet." t)
 (autoload 'ethio-replace-space "ethio-util" "\
 Replace ASCII spaces with Ethiopic word separators in the region.
 
@@ -10747,11 +10934,13 @@ This function is deprecated.
 
 (fn ARG)" t)
 (autoload 'ethio-fidel-to-tex-buffer "ethio-util" "\
-Convert each fidel characters in the current buffer into a fidel-tex command." 
t)
+Convert each FIDEL characters in the current buffer into a fidel-tex command.
+FIDEL is the Amharic/Ethiopic alphabet." t)
 (autoload 'ethio-tex-to-fidel-buffer "ethio-util" "\
-Convert fidel-tex commands in the current buffer into fidel chars." t)
+Convert fidel-tex commands in the current buffer into FIDEL chars.
+FIDEL is the Amharic/Ethiopic alphabet." t)
 (autoload 'ethio-fidel-to-java-buffer "ethio-util" "\
-Convert Ethiopic characters into the Java escape sequences.
+Convert Ethiopic characters in the buffer into the Java escape sequences.
 
 Each escape sequence is of the form \\uXXXX, where XXXX is the
 character's codepoint (in hex) in Unicode.
@@ -10759,11 +10948,31 @@ character's codepoint (in hex) in Unicode.
 If `ethio-java-save-lowercase' is non-nil, use [0-9a-f].
 Otherwise, [0-9A-F].")
 (autoload 'ethio-java-to-fidel-buffer "ethio-util" "\
-Convert the Java escape sequences into corresponding Ethiopic characters.")
+Convert the Java escape sequences in the buffer into Ethiopic characters.")
 (autoload 'ethio-find-file "ethio-util" "\
-Transliterate file content into Ethiopic depending on filename suffix.")
+Transliterate file content into Ethiopic depending on filename suffix.
+If the file-name extension is \".sera\", convert from SERA to FIDEL.
+If the file-name extension is \".html\", convert regions enclosed
+by \"<sera>..</sera>\" from SERA to FIDEL.
+If the file-name extension is \".tex\", convert fidel-tex commands
+to FIDEL characters.
+If the file-name extension is \".java\", convert Java escape sequences
+to FIDEL characters.
+
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.")
 (autoload 'ethio-write-file "ethio-util" "\
-Transliterate Ethiopic characters in ASCII depending on the file extension.")
+Transliterate Ethiopic characters to ASCII depending on the file extension.
+If the file-name extension is \".sera\", convert from FIDEL to SERA.
+If the file-name extension is \".html\", convert FIDEL characters to
+SERA regions enclosed by \"<sera>..</sera>\".
+If the file-name extension is \".tex\", convert FIDEL characters
+to fidel-tex commands.
+If the file-name extension is \".java\", convert FIDEL characters to
+Java escape sequences.
+
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.")
 (autoload 'ethio-insert-ethio-space "ethio-util" "\
 Insert the Ethiopic word delimiter (the colon-like character).
 With ARG, insert that many delimiters.
@@ -11169,6 +11378,12 @@ This is used only in conjunction with 
`expand-add-abbrevs'." t)
 (register-definition-prefixes "srecode/expandproto" '("srecode-"))
 
 
+;;; Generated autoloads from external-completion.el
+
+(push (purecopy '(external-completion 0 1)) package--builtin-versions)
+(register-definition-prefixes "external-completion" '("external-completion-"))
+
+
 ;;; Generated autoloads from cedet/srecode/extract.el
 
 (register-definition-prefixes "srecode/extract" '("srecode-extract"))
@@ -11352,7 +11567,11 @@ that have an explicit `:height' setting.  The two 
exceptions to
 this are the `default' and `header-line' faces: they will both be
 scaled even if they have an explicit `:height' setting.
 
-See also the related command `global-text-scale-adjust'.
+See also the related command `global-text-scale-adjust'.  Unlike
+that command, which scales the font size with a increment,
+`text-scale-adjust' scales the font size with a factor,
+`text-scale-mode-step'.  With a small `text-scale-mode-step'
+factor, the two commands behave similarly.
 
 (fn INC)" t)
  (define-key global-map [pinch] 'text-scale-pinch)
@@ -11389,7 +11608,10 @@ The variable `global-text-scale-adjust-resizes-frames' 
controls
 whether the frames are resized to keep the same number of lines
 and characters per line when the font size is adjusted.
 
-See also the related command `text-scale-adjust'.
+See also the related command `text-scale-adjust'.  Unlike that
+command, which scales the font size with a factor,
+`global-text-scale-adjust' scales the font size with an
+increment.
 
 (fn INCREMENT)" t)
 (autoload 'buffer-face-mode "face-remap" "\
@@ -14149,10 +14371,14 @@ Use \\[describe-mode] for more info.
 ;;; Generated autoloads from net/goto-addr.el
 
 (autoload 'goto-address-at-point "goto-addr" "\
-Send to the e-mail address or load the URL at point.
-Send mail to address at point.  See documentation for
-`goto-address-find-address-at-point'.  If no address is found
-there, then load the URL at or before point.
+Compose a new message to the e-mail address or open URL at point.
+
+Compose message to address at point.  See documentation for
+`goto-address-find-address-at-point'.
+
+If no e-mail address is found at point, open the URL at or before
+point using `browse-url'.  With a prefix argument, open the URL
+using `browse-url-secondary-browser-function' instead.
 
 (fn &optional EVENT)" t)
 (autoload 'goto-address "goto-addr" "\
@@ -15536,7 +15762,7 @@ START, END and COMMENT-START are regular expressions.  
A block is
 defined as text surrounded by START and END.
 
 As a special case, START may be a list of the form (COMPLEX-START
-MDATA-SELECTOR), where COMPLEX-START is a regexp w/ multiple parts and
+MDATA-SELECTOR), where COMPLEX-START is a regexp with multiple parts and
 MDATA-SELECTOR an integer that specifies which sub-match is the proper
 place to adjust point, before calling `hs-forward-sexp-func'.  Point
 is adjusted to the beginning of the specified match.  For example,
@@ -18306,6 +18532,15 @@ If non-nil, second arg INITIAL-INPUT is a string to 
insert before reading.
 (register-definition-prefixes "semantic/wisent/java-tags" '("semantic-" 
"wisent-java-parse-error"))
 
 
+;;; Generated autoloads from progmodes/java-ts-mode.el
+
+(autoload 'java-ts-mode "java-ts-mode" "\
+Major mode for editing Java, powered by tree-sitter.
+
+(fn)" t)
+(register-definition-prefixes "java-ts-mode" '("java-ts-mode-"))
+
+
 ;;; Generated autoloads from cedet/semantic/wisent/javascript.el
 
 (register-definition-prefixes "semantic/wisent/javascript" '("semantic-" 
"wisent-javascript-jv-expand-tag"))
@@ -18332,9 +18567,22 @@ by `jka-compr-install'.")
 ;;; Generated autoloads from progmodes/js.el
 
 (push (purecopy '(js 9)) package--builtin-versions)
+(autoload 'js-base-mode "js" "\
+Generic major mode for editing JavaScript.
+
+This mode is intended to be inherited by concrete major modes.
+Currently there are `js-mode' and `js-ts-mode'.
+
+(fn)" t)
 (autoload 'js-mode "js" "\
 Major mode for editing JavaScript.
 
+(fn)" t)
+(autoload 'js-ts-mode "js" "\
+Major mode for editing JavaScript.
+
+\\<js-ts-mode-map>
+
 (fn)" t)
 (autoload 'js-json-mode "js" "\
 
@@ -18365,6 +18613,15 @@ one of the aforementioned options instead of using 
this mode.
 (register-definition-prefixes "json" '("json-"))
 
 
+;;; Generated autoloads from progmodes/json-ts-mode.el
+
+(autoload 'json-ts-mode "json-ts-mode" "\
+Major mode for editing JSON, powered by tree-sitter.
+
+(fn)" t)
+(register-definition-prefixes "json-ts-mode" '("json-ts-"))
+
+
 ;;; Generated autoloads from jsonrpc.el
 
 (push (purecopy '(jsonrpc 1 0 15)) package--builtin-versions)
@@ -21892,6 +22149,11 @@ ARG is the prefix argument received when calling 
interactively the function.
 (register-definition-prefixes "oc-biblatex" '("org-cite-biblatex-"))
 
 
+;;; Generated autoloads from org/oc-bibtex.el
+
+(register-definition-prefixes "oc-bibtex" '("org-cite-bibtex-export-"))
+
+
 ;;; Generated autoloads from org/oc-csl.el
 
 (register-definition-prefixes "oc-csl" '("org-cite-csl-"))
@@ -22050,7 +22312,7 @@ Coloring:
 
 ;;; Generated autoloads from org/org.el
 
-(push (purecopy '(org 9 5 5)) package--builtin-versions)
+(push (purecopy '(org 9 6)) package--builtin-versions)
 (autoload 'org-babel-do-load-languages "org" "\
 Load the languages defined in `org-babel-load-languages'.
 
@@ -22097,63 +22359,6 @@ The following commands are available:
 \\{org-mode-map}
 
 (fn)" t)
-(autoload 'org-cycle "org" "\
-TAB-action and visibility cycling for Org mode.
-
-This is the command invoked in Org mode by the `TAB' key.  Its main
-purpose is outline visibility cycling, but it also invokes other actions
-in special contexts.
-
-When this function is called with a `\\[universal-argument]' prefix, rotate 
the entire
-buffer through 3 states (global cycling)
-  1. OVERVIEW: Show only top-level headlines.
-  2. CONTENTS: Show all headlines of all levels, but no body text.
-  3. SHOW ALL: Show everything.
-
-With a `\\[universal-argument] \\[universal-argument]' prefix argument, switch 
to the startup visibility,
-determined by the variable `org-startup-folded', and by any VISIBILITY
-properties in the buffer.
-
-With a `\\[universal-argument] \\[universal-argument] \\[universal-argument]' 
prefix argument, show the entire buffer, including
-any drawers.
-
-When inside a table, re-align the table and move to the next field.
-
-When point is at the beginning of a headline, rotate the subtree started
-by this line through 3 different states (local cycling)
-  1. FOLDED:   Only the main headline is shown.
-  2. CHILDREN: The main headline and the direct children are shown.
-               From this state, you can move to one of the children
-               and zoom in further.
-  3. SUBTREE:  Show the entire subtree, including body text.
-If there is no subtree, switch directly from CHILDREN to FOLDED.
-
-When point is at the beginning of an empty headline and the variable
-`org-cycle-level-after-item/entry-creation' is set, cycle the level
-of the headline by demoting and promoting it to likely levels.  This
-speeds up creation document structure by pressing `TAB' once or several
-times right after creating a new headline.
-
-When there is a numeric prefix, go up to a heading with level ARG, do
-a `show-subtree' and return to the previous cursor position.  If ARG
-is negative, go up that many levels.
-
-When point is not at the beginning of a headline, execute the global
-binding for `TAB', which is re-indenting the line.  See the option
-`org-cycle-emulate-tab' for details.
-
-As a special case, if point is at the very beginning of the buffer, if
-there is no headline there, and if the variable `org-cycle-global-at-bob'
-is non-nil, this function acts as if called with prefix argument 
(`\\[universal-argument] TAB',
-same as `S-TAB') also when called without prefix argument.
-
-(fn &optional ARG)" t)
-(autoload 'org-global-cycle "org" "\
-Cycle the global visibility.  For details see `org-cycle'.
-With `\\[universal-argument]' prefix ARG, switch to startup visibility.
-With a numeric prefix, show all headlines up to that level.
-
-(fn &optional ARG)" t)
 (autoload 'org-run-like-in-org-mode "org" "\
 Run a command, pretending that the current buffer is in Org mode.
 This will temporarily bind local variables that are typically bound in
@@ -22442,7 +22647,7 @@ Set restriction lock for agenda to current subtree or 
file.
 When in a restricted subtree, remove it.
 
 The restriction will span over the entire file if TYPE is `file',
-or if type is \\='(4), or if the cursor is before the first headline
+or if TYPE is (4), or if the cursor is before the first headline
 in the file.  Otherwise, only apply the restriction to the current
 subtree.
 
@@ -22468,7 +22673,7 @@ argument: an entry from `org-agenda-get-day-entries'.
 FILTER can also be an alist with the car of each cell being
 either `headline' or `category'.  For example:
 
-  \\='((headline \"IMPORTANT\")
+   ((headline \"IMPORTANT\")
     (category \"Work\"))
 
 will only add headlines containing IMPORTANT or headlines
@@ -22555,7 +22760,7 @@ Set `org-capture-templates' to be similar to 
`org-remember-templates'." t)
 
 ;;; Generated autoloads from org/org-compat.el
 
-(register-definition-prefixes "org-compat" '("org-"))
+(register-definition-prefixes "org-compat" '("org-" "outline-"))
 
 
 ;;; Generated autoloads from org/org-crypt.el
@@ -22575,7 +22780,69 @@ Add a hook to automatically encrypt entries before a 
file is saved to disk.")
 
 ;;; Generated autoloads from org/org-ctags.el
 
-(register-definition-prefixes "org-ctags" '("org-ctags-"))
+(register-definition-prefixes "org-ctags" '("org-"))
+
+
+;;; Generated autoloads from org/org-cycle.el
+
+(autoload 'org-cycle "org-cycle" "\
+TAB-action and visibility cycling for Org mode.
+
+This is the command invoked in Org mode by the `TAB' key.  Its main
+purpose is outline visibility cycling, but it also invokes other actions
+in special contexts.
+
+When this function is called with a `\\[universal-argument]' prefix, rotate 
the entire
+buffer through 3 states (global cycling)
+  1. OVERVIEW: Show only top-level headlines.
+  2. CONTENTS: Show all headlines of all levels, but no body text.
+  3. SHOW ALL: Show everything.
+
+With a `\\[universal-argument] \\[universal-argument]' prefix argument, switch 
to the startup visibility,
+determined by the variable `org-startup-folded', and by any VISIBILITY
+properties in the buffer.
+
+With a `\\[universal-argument] \\[universal-argument] \\[universal-argument]' 
prefix argument, show the entire buffer, including
+any drawers.
+
+When inside a table, re-align the table and move to the next field.
+
+When point is at the beginning of a headline, rotate the subtree started
+by this line through 3 different states (local cycling)
+  1. FOLDED:   Only the main headline is shown.
+  2. CHILDREN: The main headline and the direct children are shown.
+               From this state, you can move to one of the children
+               and zoom in further.
+  3. SUBTREE:  Show the entire subtree, including body text.
+If there is no subtree, switch directly from CHILDREN to FOLDED.
+
+When point is at the beginning of an empty headline and the variable
+`org-cycle-level-after-item/entry-creation' is set, cycle the level
+of the headline by demoting and promoting it to likely levels.  This
+speeds up creation document structure by pressing `TAB' once or several
+times right after creating a new headline.
+
+When there is a numeric prefix, go up to a heading with level ARG, do
+a `show-subtree' and return to the previous cursor position.  If ARG
+is negative, go up that many levels.
+
+When point is not at the beginning of a headline, execute the global
+binding for `TAB', which is re-indenting the line.  See the option
+`org-cycle-emulate-tab' for details.
+
+As a special case, if point is at the very beginning of the buffer, if
+there is no headline there, and if the variable `org-cycle-global-at-bob'
+is non-nil, this function acts as if called with prefix argument 
(`\\[universal-argument] TAB',
+same as `S-TAB') also when called without prefix argument.
+
+(fn &optional ARG)" t)
+(autoload 'org-cycle-global "org-cycle" "\
+Cycle the global visibility.  For details see `org-cycle'.
+With `\\[universal-argument]' prefix ARG, switch to startup visibility.
+With a numeric prefix, show all headlines up to that level.
+
+(fn &optional ARG)" t)
+(register-definition-prefixes "org-cycle" '("org-cycle-"))
 
 
 ;;; Generated autoloads from org/org-datetree.el
@@ -22608,6 +22875,16 @@ Add a hook to automatically encrypt entries before a 
file is saved to disk.")
 (register-definition-prefixes "org-feed" '("org-feed-"))
 
 
+;;; Generated autoloads from org/org-fold.el
+
+(register-definition-prefixes "org-fold" '("org-fold-"))
+
+
+;;; Generated autoloads from org/org-fold-core.el
+
+(register-definition-prefixes "org-fold-core" '("org-fold-core-"))
+
+
 ;;; Generated autoloads from org/org-footnote.el
 
 (register-definition-prefixes "org-footnote" '("org-footnote-"))
@@ -22670,7 +22947,7 @@ Add a hook to automatically encrypt entries before a 
file is saved to disk.")
 
 ;;; Generated autoloads from org/org-mouse.el
 
-(register-definition-prefixes "org-mouse" '("org-mouse-"))
+(register-definition-prefixes "org-mouse" '("org-"))
 
 
 ;;; Generated autoloads from org/org-num.el
@@ -22683,6 +22960,11 @@ Add a hook to automatically encrypt entries before a 
file is saved to disk.")
 (register-definition-prefixes "org-pcomplete" '("org-" "pcomplete/org-mode/"))
 
 
+;;; Generated autoloads from org/org-persist.el
+
+(register-definition-prefixes "org-persist" '("org-persist-"))
+
+
 ;;; Generated autoloads from org/org-plot.el
 
 (register-definition-prefixes "org-plot" '("org-"))
@@ -22690,7 +22972,7 @@ Add a hook to automatically encrypt entries before a 
file is saved to disk.")
 
 ;;; Generated autoloads from org/org-protocol.el
 
-(register-definition-prefixes "org-protocol" '("org-protocol-"))
+(register-definition-prefixes "org-protocol" '("org-"))
 
 
 ;;; Generated autoloads from org/org-refile.el
@@ -22777,12 +23059,19 @@ The mode's hook is called both when the mode is 
enabled and when
 it is disabled.
 
 (fn &optional ARG)" t)
+(autoload 'outline-search-level "outline" "\
+Search for the next text property `outline-level'.
+The arguments are the same as in `outline-search-text-property',
+except the hard-coded property name `outline-level'.
+This function is intended to be used in `outline-search-function'.
+
+(fn &optional BOUND MOVE BACKWARD LOOKING-AT)")
 (register-definition-prefixes "outline" '("outline-"))
 
 
 ;;; Generated autoloads from org/ox.el
 
-(register-definition-prefixes "ox" '("org-export-"))
+(register-definition-prefixes "ox" '("org-"))
 
 
 ;;; Generated autoloads from org/ox-ascii.el
@@ -22904,7 +23193,7 @@ Return PDF file's name.
 
 ;;; Generated autoloads from org/ox-latex.el
 
-(register-definition-prefixes "ox-latex" '("org-latex-"))
+(register-definition-prefixes "ox-latex" '("org-"))
 
 
 ;;; Generated autoloads from org/ox-man.el
@@ -23115,6 +23404,8 @@ Location of the file used to speed up activation of 
packages at startup." :type
 
 ;;; Generated autoloads from emacs-lisp/package-vc.el
 
+(autoload 'package-vc-install-selected-packages "package-vc" "\
+Ensure packages specified in `package-vc-selected-packages' are installed." t)
 (defvar package-vc-selected-packages 'nil "\
 List of packages that must be installed.
 Each member of the list is of the form (NAME . SPEC), where NAME
@@ -23122,42 +23413,82 @@ is a symbol designating the package and SPEC is one 
of:
 
 - nil, if any package version can be installed;
 - a version string, if that specific revision is to be installed;
-- a property list of the form described in
-  `package-vc-archive-spec-alist', giving a package
-  specification.
+- a property list, describing a package specification.  Valid
+  key/value pairs are
+
+   `:url' (string)
+      The URL of the repository used to fetch the package source.
+
+   `:branch' (string)
+      If given, the name of the branch to checkout after cloning the directory.
+
+   `:lisp-dir' (string)
+      The repository-relative name of the directory to use for loading the Lisp
+      sources.  If not given, the value defaults to the root directory
+      of the repository.
+
+   `:main-file' (string)
+      The main file of the project, relevant to gather package metadata.
+      If not given, the assumed default is the package name with \".el\"
+      appended to it.
+
+   `:vc-backend' (symbol)
+      A symbol of the VC backend to use for cloning the package.  The
+      value ought to be a member of `vc-handled-backends'.  If omitted,
+      `vc-clone' will fall back onto the archive default or on
+      `package-vc-default-backend'.
+
+  All other keys are ignored.
 
 This user option differs from `package-selected-packages' in that
-it is meant to be specified manually.  You can also use the
-function `package-vc-selected-packages' to apply the changes.")
+it is meant to be specified manually.  If you want to install all
+the packages in the list, you cal also use
+`package-vc-install-selected-packages'.
+
+Note that this option will not override an existing source
+package installation or revert the checked out revision.")
 (custom-autoload 'package-vc-selected-packages "package-vc" nil)
+(autoload 'package-vc-update-all "package-vc" "\
+Attempt to update all installed VC packages." t)
+(autoload 'package-vc-update "package-vc" "\
+Attempt to update the package PKG-DESC.
+
+(fn PKG-DESC)" t)
 (autoload 'package-vc-install "package-vc" "\
-Fetch a package NAME-OR-URL and set it up for using with Emacs.
-If NAME-OR-URL is a URL, download the package from the repository
-at that URL; the function will try to guess the name of the package
-from the URL.  Otherwise NAME-OR-URL should be a symbol whose name
-is the package name, and the URL for the package will be taken from
-the package's metadata.
+Fetch a PACKAGE and set it up for using with Emacs.
+
+If PACKAGE is a string containing an URL, download the package
+from the repository at that URL; the function will try to guess
+the name of the package from the URL.  This can be overridden by
+passing the optional argument NAME.  If PACKAGE is a cons-cell,
+it should have the form (NAME . SPEC), where NAME is a symbol
+indicating the package name and SPEC is a plist as described in
+`package-vc-selected-packages'.  Otherwise PACKAGE should be a
+symbol whose name is the package name, and the URL for the
+package will be taken from the package's metadata.
+
 By default, this function installs the last version of the package
 available from its repository, but if REV is given and non-nil, it
 specifies the revision to install.  If REV has the special value
 `:last-release' (interactively, the prefix argument), that stands
 for the last released version of the package.
-When calling from Lisp, optional argument NAME overrides the package
-name as deduced from NAME-OR-URL.
+
 Optional argument BACKEND specifies the VC backend to use for cloning
 the package's repository; this is only possible if NAME-OR-URL is a URL,
 a string.  If BACKEND is omitted or nil, the function
-uses `package-vc--guess-backend' to guess the backend.
+uses `package-vc-heuristic-alist' to guess the backend.
+Note that by default, a VC package will be prioritized over a
+regular package, but it will not remove a VC package.
 
-(fn NAME-OR-URL &optional NAME REV BACKEND)" t)
+(fn PACKAGE &optional NAME REV BACKEND)" t)
 (autoload 'package-vc-checkout "package-vc" "\
 Clone the sources for PKG-DESC into DIRECTORY and visit that directory.
 Unlike `package-vc-install', this does not yet set up the package
-for use with Emacs; use `package-vc-link-directory' for setting
-the package up after this function finishes.
-Optional argument REV means to clone a specific version of the
-package; it defaults to the last version available from the
-package's repository.  If REV has the special value
+for use with Emacs; use `package-vc-install-from-checkout' for
+setting the package up after this function finishes.  Optional
+argument REV means to clone a specific version of the package; it
+defaults to the last version available from the package's
+repository.  If REV has the special value
 `:last-release' (interactively, the prefix argument), that stands
 for the last released version of the package.
 
@@ -23171,20 +23502,26 @@ for the NAME of the package to set up.  Otherwise 
infer the package
 name from the base name of DIR.
 
 (fn DIR NAME)" t)
-(autoload 'package-vc-refresh "package-vc" "\
-Refresh the installation for package given by PKG-DESC.
-Interactively, prompt for the name of the package to refresh.
+(autoload 'package-vc-rebuild "package-vc" "\
+Rebuild the installation for package given by PKG-DESC.
+Rebuilding an installation means scraping for new autoload
+cookies, re-compiling Emacs Lisp files, building and installing
+any documentation, downloading any missing dependencies.  This
+command does not fetch new revisions from a remote server.  That
+is the responsibility of `package-vc-update'.  Interactively,
+prompt for the name of the package to rebuild.
 
 (fn PKG-DESC)" t)
 (autoload 'package-vc-prepare-patch "package-vc" "\
 Send patch for REVISIONS to maintainer of the package PKG using SUBJECT.
-SUBJECT and REVISIONS are passed on to `vc-prepare-patch', which see.
-PKG must be a package description.
-Interactively, prompt for PKG, SUBJECT, and REVISIONS.  However,
-if the current buffer has marked commit log entries, REVISIONS
-are the tags of the marked entries, see `log-view-get-marked'.
-
-(fn PKG SUBJECT REVISIONS)" t)
+The function uses `vc-prepare-patch', passing SUBJECT and
+REVISIONS directly.  PKG-DESC must be a package description.
+Interactively, prompt for PKG-DESC, SUBJECT, and REVISIONS.  When
+invoked with a numerical prefix argument, use the last N
+revisions.  When invoked interactively in a Log View buffer with
+marked revisions, use those.
+
+(fn PKG-DESC SUBJECT REVISIONS)" t)
 (register-definition-prefixes "package-vc" '("package-vc-"))
 
 
@@ -24740,7 +25077,7 @@ Open profile FILENAME.
 
 ;;; Generated autoloads from progmodes/project.el
 
-(push (purecopy '(project 0 8 3)) package--builtin-versions)
+(push (purecopy '(project 0 9 3)) package--builtin-versions)
 (autoload 'project-current "project" "\
 Return the project instance in DIRECTORY, defaulting to `default-directory'.
 
@@ -24752,14 +25089,14 @@ project instance.
 
 The \"transient\" project instance is a special kind of value
 which denotes a project rooted in that directory and includes all
-the files under the directory except for those that should be
-ignored (per `project-ignores').
+the files under the directory except for those that match entries
+in `vc-directory-exclusion-list' or `grep-find-ignored-files'.
 
 See the doc string of `project-find-functions' for the general form
 of the project instance object.
 
 (fn &optional MAYBE-PROMPT DIRECTORY)")
-(defvar project-prefix-map (let ((map (make-sparse-keymap))) (define-key map 
"!" 'project-shell-command) (define-key map "&" 'project-async-shell-command) 
(define-key map "f" 'project-find-file) (define-key map "F" 
'project-or-external-find-file) (define-key map "b" 'project-switch-to-buffer) 
(define-key map "s" 'project-shell) (define-key map "d" 'project-find-dir) 
(define-key map "D" 'project-dired) (define-key map "v" 'project-vc-dir) 
(define-key map "c" 'project-compile) (define-key  [...]
+(defvar project-prefix-map (let ((map (make-sparse-keymap))) (define-key map 
"!" 'project-shell-command) (define-key map "&" 'project-async-shell-command) 
(define-key map "f" 'project-find-file) (define-key map "F" 
'project-or-external-find-file) (define-key map "b" 'project-switch-to-buffer) 
(define-key map "s" 'project-shell) (define-key map "d" 'project-find-dir) 
(define-key map "D" 'project-dired) (define-key map "v" 'project-vc-dir) 
(define-key map "c" 'project-compile) (define-key  [...]
 Keymap for project commands.")
  (define-key ctl-x-map "p" project-prefix-map)
 (autoload 'project-other-window-command "project" "\
@@ -24899,6 +25236,15 @@ which see for how it is determined where the buffer 
will be
 displayed.
 
 (fn BUFFER-OR-NAME)" t)
+(autoload 'project-list-buffers "project" "\
+Display a list of project buffers.
+The list is displayed in a buffer named \"*Buffer List*\".
+
+By default, all project buffers are listed except those whose names
+start with a space (which are for internal use).  With prefix argument
+ARG, show only buffers that are visiting files.
+
+(fn &optional ARG)" t)
 (autoload 'project-kill-buffers "project" "\
 Kill the buffers belonging to the current project.
 Two buffers belong to the same project if their project
@@ -25282,11 +25628,25 @@ asking.
 Sort Python imports in the current buffer." t)
 (autoload 'python-fix-imports "python" "\
 Add missing imports and remove unused ones from the current buffer." t)
+(autoload 'python-base-mode "python" "\
+Generic major mode for editing Python files.
+
+This is a generic major mode intended to be inherited by
+concrete implementations.  Currently there are two concrete
+implementations: `python-mode' and `python-ts-mode'.
+
+(fn)" t)
 (autoload 'python-mode "python" "\
 Major mode for editing Python files.
 
 \\{python-mode-map}
 
+(fn)" t)
+(autoload 'python-ts-mode "python" "\
+Major mode for editing Python files, using tree-sitter library.
+
+\\{python-ts-mode-map}
+
 (fn)" t)
 (register-definition-prefixes "python" '("inferior-python-mode" "python-" 
"run-python-internal"))
 
@@ -26661,6 +27021,13 @@ If prefix argument REVERSE is non-nil, sorts in 
reverse order.
 
 (autoload 'rmail-summary "rmailsum" "\
 Display a summary of all messages, one line per message." t)
+(autoload 'rmail-summary-by-thread "rmailsum" "\
+Display a summary of messages in the same discussion thread as MSGNUM.
+Interactively, prompt for MSGNUM, defaulting to the current message.
+Threads are based on the \"Subject\", \"References\" and \"In-reply-to\"
+headers of the messages.
+
+(fn &optional MSGNUM)" t)
 (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.
@@ -27856,29 +28223,17 @@ With ARG non-nil, silently save all file-visiting 
buffers, then kill.
 If emacsclient was started with a list of filenames to edit, then
 only these files will be asked to be saved.
 
+When running Emacs as a daemon and with
+`server-stop-automatically' (which see) set to `kill-terminal' or
+`delete-frame', this function may call `save-buffers-kill-emacs'
+if there are no other active clients.
+
 (fn ARG)")
 (autoload 'server-stop-automatically "server" "\
-Automatically stop server as specified by ARG.
-
-If ARG is the symbol `empty', stop the server when it has no
-remaining clients, no remaining unsaved file-visiting buffers,
-and no running processes with a `query-on-exit' flag.
+Automatically stop the Emacs server as specified by VALUE.
+This sets the variable `server-stop-automatically' (which see).
 
-If ARG is the symbol `delete-frame', ask the user when the last
-frame is deleted whether each unsaved file-visiting buffer must
-be saved and each running process with a `query-on-exit' flag
-can be stopped, and if so, stop the server itself.
-
-If ARG is the symbol `kill-terminal', ask the user when the
-terminal is killed with \\[save-buffers-kill-terminal] whether each unsaved 
file-visiting
-buffer must be saved and each running process with a `query-on-exit'
-flag can be stopped, and if so, stop the server itself.
-
-Any other value of ARG will cause this function to signal an error.
-
-This function is meant to be called from the user init file.
-
-(fn ARG)")
+(fn VALUE)")
 (register-definition-prefixes "server" '("server-"))
 
 
@@ -27990,6 +28345,14 @@ To work around that, do:
 ;;; Generated autoloads from progmodes/sh-script.el
 
 (put 'sh-shell 'safe-local-variable 'symbolp)
+(autoload 'sh-base-mode "sh-script" "\
+Generic major mode for editing shell scripts.
+
+This is a generic major mode intended to be inherited by concrete
+implementations.  Currently there are two: `sh-mode' and
+`bash-ts-mode'.
+
+(fn)" t)
 (autoload 'sh-mode "sh-script" "\
 Major mode for editing shell scripts.
 This mode works for many shells, since they all have roughly the same syntax,
@@ -28044,6 +28407,12 @@ with your script for an edit-interpret-debug cycle.
 
 (fn)" t)
 (defalias 'shell-script-mode 'sh-mode)
+(autoload 'bash-ts-mode "sh-script" "\
+Major mode for editing Bash shell scripts.
+This mode automatically falls back to `sh-mode' if the buffer is
+not written in Bash or sh.
+
+(fn)" t)
 (register-definition-prefixes "sh-script" '("sh-"))
 
 
@@ -32188,14 +32557,13 @@ It must be supported by libarchive(3).")
 List of suffixes which indicate a compressed file.
 It must be supported by libarchive(3).")
 (defmacro tramp-archive-autoload-file-name-regexp nil "\
-Regular expression matching archive file names." `(rx bos (group (+ nonl) "." 
,(cons '| tramp-archive-suffixes) (32 "." ,(cons '| 
tramp-archive-compression-suffixes))) (group "/" (* nonl)) eos))
-(autoload 'tramp-archive-file-name-handler "tramp-archive")
+Regular expression matching archive file names." (if (<= emacs-major-version 
26) '(concat "\\`" "\\(" ".+" "\\." (regexp-opt tramp-archive-suffixes) "\\(?:" 
"\\." (regexp-opt tramp-archive-compression-suffixes) "\\)*" "\\)" "\\(" "/" 
".*" "\\)" "\\'") `(rx bos (group (+ nonl) "." (| ,@tramp-archive-suffixes) (32 
"." (| ,@tramp-archive-compression-suffixes))) (group "/" (* nonl)) eos)))
 (defun tramp-archive-autoload-file-name-handler (operation &rest args) "\
 Load Tramp archive file name handler, and perform OPERATION." (defvar 
tramp-archive-autoload) (let ((default-directory temporary-file-directory) 
(tramp-archive-autoload tramp-archive-enabled)) (apply 
#'tramp-autoload-file-name-handler operation args)))
-(defun tramp-register-archive-file-name-handler nil "\
-Add archive file name handler to `file-name-handler-alist'." (when (and 
tramp-archive-enabled (not (rassq #'tramp-archive-file-name-handler 
file-name-handler-alist))) (add-to-list 'file-name-handler-alist (cons 
(tramp-archive-autoload-file-name-regexp) 
#'tramp-archive-autoload-file-name-handler)) (put 
#'tramp-archive-autoload-file-name-handler 'safe-magic t)))
-(add-hook 'after-init-hook #'tramp-register-archive-file-name-handler)
-(add-hook 'tramp-archive-unload-hook (lambda nil (remove-hook 'after-init-hook 
#'tramp-register-archive-file-name-handler)))
+(defun tramp-register-archive-autoload-file-name-handler nil "\
+Add archive file name handler to `file-name-handler-alist'." (when (and 
tramp-archive-enabled (not (rassq 'tramp-archive-file-name-handler 
file-name-handler-alist))) (add-to-list 'file-name-handler-alist (cons 
(tramp-archive-autoload-file-name-regexp) 
#'tramp-archive-autoload-file-name-handler)) (put 
#'tramp-archive-autoload-file-name-handler 'safe-magic t)))
+(add-hook 'after-init-hook #'tramp-register-archive-autoload-file-name-handler)
+(add-hook 'tramp-archive-unload-hook (lambda nil (remove-hook 'after-init-hook 
#'tramp-register-archive-autoload-file-name-handler)))
 (register-definition-prefixes "tramp-archive" '("tramp-" 
"with-parsed-tramp-archive-file-name"))
 
 
@@ -32383,6 +32751,11 @@ See info node `(transient)Modifying Existing 
Transients'.
 (register-definition-prefixes "tree-widget" '("tree-widget-"))
 
 
+;;; Generated autoloads from treesit.el
+
+(register-definition-prefixes "treesit" '("treesit-"))
+
+
 ;;; Generated autoloads from tutorial.el
 
 (autoload 'help-with-tutorial "tutorial" "\
@@ -32594,6 +32967,25 @@ FRAC should be the inverse of the fractional value; 
for example, a value of
 (register-definition-prefixes "type-break" '("type-break-"))
 
 
+;;; Generated autoloads from progmodes/typescript-ts-mode.el
+
+(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
+(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
+(autoload 'typescript-ts-base-mode "typescript-ts-mode" "\
+Major mode for editing TypeScript.
+
+(fn)" t)
+(autoload 'typescript-ts-mode "typescript-ts-mode" "\
+Major mode for editing TypeScript.
+
+(fn)" t)
+(autoload 'tsx-ts-mode "typescript-ts-mode" "\
+Major mode for editing TypeScript.
+
+(fn)" t)
+(register-definition-prefixes "typescript-ts-mode" '("typescript-ts-mode-"))
+
+
 ;;; Generated autoloads from international/ucs-normalize.el
 
 (autoload 'string-glyph-compose "ucs-normalize" "\
@@ -32989,6 +33381,9 @@ Insert the data retrieved from URL literally in the 
current buffer.
 
 
 (fn URL)")
+(defconst url-ircs-default-port 6697 "\
+Default port for IRCS connections.")
+(defalias 'url-ircs 'url-irc)
 (register-definition-prefixes "url-irc" '("url-irc-"))
 
 
@@ -33314,6 +33709,195 @@ is \"www.fsf.co.uk\".
 (register-definition-prefixes "url-vars" '("url-"))
 
 
+;;; Generated autoloads from use-package/use-package.el
+
+(push (purecopy '(use-package 2 4 4)) package--builtin-versions)
+
+
+;;; Generated autoloads from use-package/use-package-bind-key.el
+
+(autoload 'use-package-autoload-keymap "use-package-bind-key" "\
+Load PACKAGE and bind key sequence invoking this function to KEYMAP-SYMBOL.
+Then simulate pressing the same key sequence a again, so that the
+next key pressed is routed to the newly loaded keymap.
+
+This function supports use-package's :bind-keymap keyword.  It
+works by binding the given key sequence to an invocation of this
+function for a particular keymap.  The keymap is expected to be
+defined by the package.  In this way, loading the package is
+deferred until the prefix key sequence is pressed.
+
+(fn KEYMAP-SYMBOL PACKAGE OVERRIDE)")
+(autoload 'use-package-normalize-binder "use-package-bind-key" "\
+
+
+(fn NAME KEYWORD ARGS)")
+(defalias 'use-package-normalize/:bind 'use-package-normalize-binder)
+(defalias 'use-package-normalize/:bind* 'use-package-normalize-binder)
+(defalias 'use-package-autoloads/:bind 'use-package-autoloads-mode)
+(defalias 'use-package-autoloads/:bind* 'use-package-autoloads-mode)
+(autoload 'use-package-handler/:bind "use-package-bind-key" "\
+
+
+(fn NAME KEYWORD ARGS REST STATE &optional BIND-MACRO)")
+(defalias 'use-package-normalize/:bind-keymap 'use-package-normalize-binder)
+(defalias 'use-package-normalize/:bind-keymap* 'use-package-normalize-binder)
+(autoload 'use-package-handler/:bind-keymap "use-package-bind-key" "\
+
+
+(fn NAME KEYWORD ARGS REST STATE &optional OVERRIDE)")
+(autoload 'use-package-handler/:bind-keymap* "use-package-bind-key" "\
+
+
+(fn NAME KEYWORD ARG REST STATE)")
+(register-definition-prefixes "use-package-bind-key" 
'("use-package-handler/:bind*"))
+
+
+;;; Generated autoloads from use-package/use-package-core.el
+
+(autoload 'use-package "use-package-core" "\
+Declare an Emacs package by specifying a group of configuration options.
+
+For the full documentation, see Info node `(use-package) top'.
+Usage:
+
+  (use-package package-name
+     [:keyword [option]]...)
+
+:init            Code to run before PACKAGE-NAME has been loaded.
+:config          Code to run after PACKAGE-NAME has been loaded.  Note that
+                 if loading is deferred for any reason, this code does not
+                 execute until the lazy load has occurred.
+:preface         Code to be run before everything except `:disabled'; this
+                 can be used to define functions for use in `:if', or that
+                 should be seen by the byte-compiler.
+
+:mode            Form to be added to `auto-mode-alist'.
+:magic           Form to be added to `magic-mode-alist'.
+:magic-fallback  Form to be added to `magic-fallback-mode-alist'.
+:interpreter     Form to be added to `interpreter-mode-alist'.
+
+:commands        Define autoloads for commands that will be defined by the
+                 package.  This is useful if the package is being lazily
+                 loaded, and you wish to conditionally call functions in your
+                 `:init' block that are defined in the package.
+:autoload        Similar to :commands, but it for no-interactive one.
+:hook            Specify hook(s) to attach this package to.
+
+:bind            Bind keys, and define autoloads for the bound commands.
+:bind*           Bind keys, and define autoloads for the bound commands,
+                 *overriding all minor mode bindings*.
+:bind-keymap     Bind a key prefix to an auto-loaded keymap defined in the
+                 package.  This is like `:bind', but for keymaps.
+:bind-keymap*    Like `:bind-keymap', but overrides all minor mode bindings
+
+:defer           Defer loading of a package -- this is implied when using
+                 `:commands', `:bind', `:bind*', `:mode', `:magic', `:hook',
+                 `:magic-fallback', or `:interpreter'.  This can be an integer,
+                 to force loading after N seconds of idle time, if the package
+                 has not already been loaded.
+:demand          Prevent the automatic deferred loading introduced by 
constructs
+                 such as `:bind' (see `:defer' for the complete list).
+
+:after           Delay the effect of the use-package declaration
+                 until after the named libraries have loaded.
+                 Before they have been loaded, no other keyword
+                 has any effect at all, and once they have been
+                 loaded it is as if `:after' was not specified.
+
+:if EXPR         Initialize and load only if EXPR evaluates to a non-nil value.
+:disabled        The package is ignored completely if this keyword is present.
+:defines         Declare certain variables to silence the byte-compiler.
+:functions       Declare certain functions to silence the byte-compiler.
+:load-path       Add to the `load-path' before attempting to load the package.
+:diminish        Support for diminish.el (if installed).
+:delight         Support for delight.el (if installed).
+:custom          Call `Custom-set' or `set-default' with each variable
+                 definition without modifying the Emacs `custom-file'.
+                 (compare with `custom-set-variables').
+:custom-face     Call `custom-set-faces' with each face definition.
+:ensure          Loads the package using package.el if necessary.
+:pin             Pin the package to an archive.
+
+(fn NAME &rest ARGS)" nil t)
+(function-put 'use-package 'lisp-indent-function 'defun)
+(register-definition-prefixes "use-package-core" '("use-package-"))
+
+
+;;; Generated autoloads from use-package/use-package-delight.el
+
+(autoload 'use-package-normalize/:delight "use-package-delight" "\
+Normalize arguments to delight.
+
+(fn NAME KEYWORD ARGS)")
+(autoload 'use-package-handler/:delight "use-package-delight" "\
+
+
+(fn NAME KEYWORD ARGS REST STATE)")
+(register-definition-prefixes "use-package-delight" 
'("use-package-normalize-delight"))
+
+
+;;; Generated autoloads from use-package/use-package-diminish.el
+
+(autoload 'use-package-normalize/:diminish "use-package-diminish" "\
+
+
+(fn NAME KEYWORD ARGS)")
+(autoload 'use-package-handler/:diminish "use-package-diminish" "\
+
+
+(fn NAME KEYWORD ARG REST STATE)")
+(register-definition-prefixes "use-package-diminish" 
'("use-package-normalize-diminish"))
+
+
+;;; Generated autoloads from use-package/use-package-ensure.el
+
+(autoload 'use-package-normalize/:ensure "use-package-ensure" "\
+
+
+(fn NAME KEYWORD ARGS)")
+(autoload 'use-package-handler/:ensure "use-package-ensure" "\
+
+
+(fn NAME KEYWORD ENSURE REST STATE)")
+(register-definition-prefixes "use-package-ensure" '("use-package-"))
+
+
+;;; Generated autoloads from use-package/use-package-ensure-system-package.el
+
+(push (purecopy '(use-package-ensure-system-package 0 2)) 
package--builtin-versions)
+(autoload 'use-package-normalize/:ensure-system-package 
"use-package-ensure-system-package" "\
+Turn ARGS into a list of conses of the form (PACKAGE-NAME . INSTALL-COMMAND).
+
+(fn NAME-SYMBOL KEYWORD ARGS)")
+(autoload 'use-package-handler/:ensure-system-package 
"use-package-ensure-system-package" "\
+Execute the handler for `:ensure-system-package' keyword in `use-package'.
+
+(fn NAME KEYWORD ARG REST STATE)")
+(register-definition-prefixes "use-package-ensure-system-package" 
'("use-package-ensure-system-package-"))
+
+
+;;; Generated autoloads from use-package/use-package-jump.el
+
+(autoload 'use-package-jump-to-package-form "use-package-jump" "\
+Attempt to find and jump to the `use-package' form that loaded PACKAGE.
+This will only find the form if that form actually required
+PACKAGE.  If PACKAGE was previously required then this function
+will jump to the file that originally required PACKAGE instead.
+
+(fn PACKAGE)" t)
+(register-definition-prefixes "use-package-jump" '("use-package-find-require"))
+
+
+;;; Generated autoloads from use-package/use-package-lint.el
+
+(autoload 'use-package-lint "use-package-lint" "\
+Check for errors in `use-package' declarations.
+For example, if the module's `:if' condition is met, but even
+with the specified `:load-path' the module cannot be found." t)
+(register-definition-prefixes "use-package-lint" 
'("use-package-lint-declaration"))
+
+
 ;;; Generated autoloads from userlock.el
 
 (put 'create-lockfiles 'safe-local-variable 'booleanp)
@@ -33792,16 +34376,17 @@ log entries should be gathered.
 Request editing the next VC shell command before execution.
 This is a prefix command.  It affects only a VC command executed
 immediately after this one." t)
+ (put 'vc-prepare-patches-separately 'safe-local-variable 'booleanp)
 (autoload 'vc-prepare-patch "vc" "\
 Compose an Email sending patches for REVISIONS to ADDRESSEE.
-If `vc-prepare-patches-separately' is nil, SUBJECT will be used
-as the default subject for the message (and it will be prompted
-for when called interactively).  Otherwise a separate message
-will be composed for each revision, with SUBJECT derived from the
-invidividual commits.
-
-When invoked interactively in a Log View buffer with marked
-revisions, those revisions will be used.
+If `vc-prepare-patches-separately' is nil, use SUBJECT as the
+default subject for the message, or prompt a subject when invoked
+interactively.  Otherwise compose a separate message for each
+revision, with SUBJECT derived from each revision subject.
+When invoked with a numerical prefix argument, use the last N
+revisions.
+When invoked interactively in a Log View buffer with
+marked revisions, use those these.
 
 (fn ADDRESSEE SUBJECT REVISIONS)" t)
 (register-definition-prefixes "vc" '("vc-" "with-vc-properties"))
@@ -36143,7 +36728,7 @@ If LIMIT is non-nil, then do not consider characters 
beyond LIMIT.
 
 ;;; Generated autoloads from progmodes/xref.el
 
-(push (purecopy '(xref 1 5 1)) package--builtin-versions)
+(push (purecopy '(xref 1 6 0)) package--builtin-versions)
 (autoload 'xref-find-backend "xref")
 (define-obsolete-function-alias 'xref-pop-marker-stack #'xref-go-back "29.1")
 (autoload 'xref-go-back "xref" "\
diff --git a/lisp/leim/quail/cyrillic.el b/lisp/leim/quail/cyrillic.el
index 9f85bc1823..1ebbea8eb0 100644
--- a/lisp/leim/quail/cyrillic.el
+++ b/lisp/leim/quail/cyrillic.el
@@ -1712,6 +1712,138 @@ as follows.
  ("/T" ?Ө)
  ("/Y" ?Ү))
 
+
+;; Chuvash layout based on russian-computer.
+(quail-define-package
+ "cyrillic-chuvash" "Chuvash" "CV" t
+ "Input method for cyrillic Chuvash with a postfix modifier.
+
+  А* -> Ӑ
+  а* -> ӑ
+  Е* -> Ӗ
+  Е* -> ӗ
+  С* -> Ҫ
+  с* -> ҫ
+  У* -> Ӳ
+  у* -> ӳ
+
+Doubling the postfix separates the letter and postfix
+"
+       nil t nil nil nil nil nil nil nil nil t)
+
+(quail-define-rules
+       ("1" ?1)
+       ("2" ?2)
+       ("3" ?3)
+       ("4" ?4)
+       ("5" ?5)
+       ("6" ?6)
+       ("7" ?7)
+       ("8" ?8)
+       ("9" ?9)
+       ("0" ?0)
+       ("-" ?-)
+       ("=" ?=)
+       ("|" ?/)
+       ("`" ?ё)
+       ("q" ?й)
+       ("w" ?ц)
+       ("e" ?у)
+       ("r" ?к)
+       ("t" ?е)
+       ("y" ?н)
+       ("u" ?г)
+       ("i" ?ш)
+       ("o" ?щ)
+       ("p" ?з)
+       ("[" ?х)
+       ("]" ?ъ)
+       ("a" ?ф)
+       ("s" ?ы)
+       ("d" ?в)
+       ("f" ?а)
+       ("g" ?п)
+       ("h" ?р)
+       ("j" ?о)
+       ("k" ?л)
+       ("l" ?д)
+       (";" ?ж)
+       ("'" ?э)
+       ("\\" ?\\)
+       ("z" ?я)
+       ("x" ?ч)
+       ("c" ?с)
+       ("v" ?м)
+       ("b" ?и)
+       ("n" ?т)
+       ("m" ?ь)
+       ("," ?б)
+       ("." ?ю)
+       ("/" ?.)
+       ("!" ?!)
+       ("@" ?\")
+       ("#" ?№)
+       ("$" ?\;)
+       ("%" ?%)
+       ("^" ?:)
+       ("&" ??)
+       ("*" ?*)
+       ("(" ?\()
+       (")" ?\))
+       ("_" ?_)
+       ("+" ?+)
+       ("~" ?Ё)
+       ("Q" ?Й)
+       ("W" ?Ц)
+       ("E" ?У)
+       ("R" ?К)
+       ("T" ?Е)
+       ("Y" ?Н)
+       ("U" ?Г)
+       ("I" ?Ш)
+       ("O" ?Щ)
+       ("P" ?З)
+       ("{" ?Х)
+       ("}" ?Ъ)
+       ("A" ?Ф)
+       ("S" ?Ы)
+       ("D" ?В)
+       ("F" ?А)
+       ("G" ?П)
+       ("H" ?Р)
+       ("J" ?О)
+       ("K" ?Л)
+       ("L" ?Д)
+       (":" ?Ж)
+       ("\"" ?Э)
+       ("|" ?|)
+       ("Z" ?Я)
+       ("X" ?Ч)
+       ("C" ?С)
+       ("V" ?М)
+       ("B" ?И)
+       ("N" ?Т)
+       ("M" ?Ь)
+       ("<" ?Б)
+       (">" ?Ю)
+       ("?" ?,)
+       ("F*" ?Ӑ)
+       ("f*" ?ӑ)
+       ("T*" ?Ӗ)
+       ("t*" ?ӗ)
+       ("C*" ?Ҫ)
+       ("c*" ?ҫ)
+       ("E*" ?Ӳ)
+       ("e*" ?ӳ)
+       ("F**" ["А*"])
+       ("f**" ["а*"])
+       ("T**" ["Е*"])
+       ("t**" ["е*"])
+       ("C**" ["С*"])
+       ("c**" ["с*"])
+       ("E**" ["У*"])
+       ("e**" ["у*"]))
+
 ;; Local Variables:
 ;; coding: utf-8
 ;; End:
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index b30c32aaff..d63e05f5fa 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -80,9 +80,14 @@ commands consecutively.  Filled by
 
 (defvar rmail-summary-message-parents-vector nil
   "Vector that holds a list of indices of parents for each message.
-Message A is parent to message B if the id of A appear in the
-References or In-reply-to fields of B, or if A is the first
-message with the same subject as B.  First element is ignored.")
+Message A is parent of message B if the id of A appears in the
+\"References\" or \"In-reply-to\" fields of B, or if A is the first
+message with the same \"Subject\" as B.  First element is ignored.")
+
+(defvar rmail-summary-message-descendants-vector nil
+  "Vector that holds the direct descendants of each message.
+This is the antipode of `rmail-summary-message-parents-vector'.
+First element is ignored.")
 
 (defvar rmail-summary-font-lock-keywords
   '(("^ *[0-9]+D.*" . font-lock-string-face)                   ; Deleted.
@@ -318,11 +323,13 @@ message with the same subject as B.  First element is 
ignored.")
 (defun rmail-summary-fill-message-ids-hash-table ()
   "Fill `rmail-summary-message-ids-hash-table'."
   (with-current-buffer rmail-buffer
-    (setq rmail-summary-message-ids-hash-table (make-hash-table :test 'equal 
:size 1024))
+    (setq rmail-summary-message-ids-hash-table
+          (make-hash-table :test 'equal :size 1024))
     (let ((msgnum 1))
       (while (<= msgnum rmail-total-messages)
        (let ((id (rmail-get-header "Message-ID" msgnum)))
-         (puthash id (cons (cons id msgnum) (gethash id 
rmail-summary-message-ids-hash-table))
+         (puthash id (cons (cons id msgnum)
+                            (gethash id rmail-summary-message-ids-hash-table))
                   rmail-summary-message-ids-hash-table))
        (setq msgnum (1+ msgnum))))))
 
@@ -331,14 +338,18 @@ message with the same subject as B.  First element is 
ignored.")
     (if header
        (split-string header "[ \f\t\n\r\v,;]+"))))
 
-(defun rmail-summary-fill-message-parents-vector ()
-  "Fill `rmail-summary-message-parents-vector'."
+(defun rmail-summary-fill-message-parents-and-descs-vectors ()
+  "Fill parents and descendats vectors for messages.
+This populates `rmail-summary-message-parents-vector'
+and `rmail-summary-message-descendants-vector'."
   (with-current-buffer rmail-buffer
     (rmail-summary-fill-message-ids-hash-table)
     (setq rmail-summary-subjects-hash-table
           (make-hash-table :test 'equal :size 1024))
     (setq rmail-summary-message-parents-vector
           (make-vector (1+ rmail-total-messages) nil))
+    (setq rmail-summary-message-descendants-vector
+          (make-vector (1+ rmail-total-messages) nil))
     (let ((msgnum 1))
       (while (<= msgnum rmail-total-messages)
        (let* ((parents nil)
@@ -346,18 +357,27 @@ message with the same subject as B.  First element is 
ignored.")
               (subj-cell (gethash subject rmail-summary-subjects-hash-table))
               (subj-par (assoc subject subj-cell))
               (refs (rmail-summary--split-header-field "References" msgnum))
-              (reply-to (rmail-summary--split-header-field "In-reply-to"
+              (reply-tos (rmail-summary--split-header-field "In-reply-to"
                                                             msgnum)))
          (if subj-par
-             (setq parents (cons (cdr subj-par) parents))
+             (progn
+               (setq parents (cons (cdr subj-par) nil))
+               (aset rmail-summary-message-descendants-vector (cdr subj-par)
+                     (cons msgnum
+                            (aref rmail-summary-message-descendants-vector
+                                  (cdr subj-par)))))
            (puthash subject (cons (cons subject msgnum) subj-cell)
                     rmail-summary-subjects-hash-table))
-         (dolist (id (append refs reply-to))
+         (dolist (id (append refs reply-tos))
            (let ((ent
                    (assoc id
                           (gethash id rmail-summary-message-ids-hash-table))))
-             (if ent
-                 (setq parents (cons (cdr ent) parents)))))
+             (when ent
+               (setq parents (cons (cdr ent) parents))
+               (aset rmail-summary-message-descendants-vector (cdr ent)
+                     (cons msgnum
+                            (aref rmail-summary-message-descendants-vector
+                                  (cdr ent)))))))
          (aset rmail-summary-message-parents-vector msgnum parents)
          (setq msgnum (1+ msgnum)))))))
 
@@ -387,20 +407,6 @@ the messages that are displayed."
   (interactive)
   (rmail-new-summary "All" '(rmail-summary) nil))
 
-(defun rmail-summary-direct-descendants (msgnum encountered-msgs)
-  "Find all direct descendants of MSGNUM, ignoring ENCOUNTERED-MSGS.
-Assumes `rmail-summary-message-parents-vector' is filled.  Ignores messages
-already ticked in ENCOUNTERED-MSGS."
-  (let (desc
-       (msg 1))
-    (while (<= msg rmail-total-messages)
-      (when (and
-            (not (aref encountered-msgs msg))
-            (memq msgnum (aref rmail-summary-message-parents-vector msg)))
-       (setq desc (cons msg desc)))
-      (setq msg (1+ msg)))
-    desc))
-
 (defun rmail-summary--walk-thread-message-recursively (msgnum encountered-msgs)
   "Add parents and descendants of message MSGNUM to ENCOUNTERED-MSGS, 
recursively."
   (unless (aref encountered-msgs msgnum)
@@ -412,7 +418,7 @@ already ticked in ENCOUNTERED-MSGS."
       (mapc walk-thread-msg
             (aref rmail-summary-message-parents-vector msgnum))
       (mapc walk-thread-msg
-            (rmail-summary-direct-descendants msgnum encountered-msgs)))))
+            (aref rmail-summary-message-descendants-vector msgnum)))))
 
 ;;;###autoload
 (defun rmail-summary-by-thread (&optional msgnum)
@@ -430,7 +436,7 @@ headers of the messages."
     (unless (and rmail-summary-message-parents-vector
                 (= (length rmail-summary-message-parents-vector)
                    (1+ rmail-total-messages)))
-      (rmail-summary-fill-message-parents-vector))
+      (rmail-summary-fill-message-parents-and-descs-vectors))
     (let ((enc-msgs (make-bool-vector (1+ rmail-total-messages) nil)))
       (rmail-summary--walk-thread-message-recursively msgnum enc-msgs)
       (rmail-new-summary (format "thread containing message %d" msgnum)
diff --git a/lisp/mh-e/mh-identity.el b/lisp/mh-e/mh-identity.el
index bcdf91299b..2507c67746 100644
--- a/lisp/mh-e/mh-identity.el
+++ b/lisp/mh-e/mh-identity.el
@@ -141,7 +141,7 @@ See `mh-identity-list'."
            (cons '("None")
                  (mapcar #'list (mapcar #'car mh-identity-list)))
            nil t default nil default))
-    (if (eq identity "None")
+    (if (equal identity "None")
         nil
       identity)))
 
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 6bb0fa3ae9..6e42296e7b 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1326,9 +1326,9 @@ pair of a group title string and a list of group 
candidate strings."
   :version "28.1")
 
 (defface completions-group-separator
-  '((t :inherit shadow :underline t))
+  '((t :inherit shadow :strike-through t))
   "Face used for the separator lines between the candidate groups."
-  :version "29.1")
+  :version "28.1")
 
 (defun completion--cycle-threshold (metadata)
   (let* ((cat (completion-metadata-get metadata 'category))
@@ -2025,8 +2025,8 @@ Runs of equal candidate strings are eliminated.  
GROUP-FUN is a
           (window (get-buffer-window (current-buffer) 0))
           (wwidth (if window (1- (window-width window)) 79))
           (columns (min
-                    ;; At least 2 columns; at least 2 spaces between columns.
-                    (max 2 (/ wwidth (+ 2 length)))
+                    ;; At least 2 spaces between columns.
+                    (max 1 (/ wwidth (+ 2 length)))
                     ;; Don't allocate more columns than we can fill.
                     ;; Windows can't show less than 3 lines anyway.
                     (max 1 (/ (length strings) 2))))
diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index f515cc8aac..81b699c020 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -275,6 +275,7 @@ To test this function, evaluate:
         have-scrolled
         window-last-row
         col window-last-col
+         switch-frame-p
         (scroll-col-delta 0)
         ;; be conservative about allowing horizontal scrolling
         (col-scrolling-p (mouse-drag-should-do-col-scrolling)))
@@ -286,15 +287,21 @@ To test this function, evaluate:
       (setq track-mouse 'drag-dragging)
       (while (progn
               (setq event (read--potential-mouse-event)
-                    end (event-end event)
-                    row (cdr (posn-col-row end))
-                    col (car (posn-col-row end)))
-              (or (mouse-movement-p event)
-                  (eq (car-safe event) 'switch-frame)))
+                     switch-frame-p (eq (car-safe event) 'switch-frame))
+               ;; We want to skip switch-frame events and treat then
+               ;; as moves over a different window.  These events have
+               ;; no position spec, so all the posn-* accessor
+               ;; functions are likely to barf if passed such an
+               ;; event.
+               (or switch-frame-p
+                   (setq end (event-end event)
+                        row (cdr (posn-col-row end))
+                        col (car (posn-col-row end))))
+              (or (mouse-movement-p event) switch-frame-p))
        ;; Scroll if see if we're on the edge.
        ;; FIXME: should handle mouse-in-other window.
        (cond
-        ((not (eq start-window (posn-window end)))
+        ((or switch-frame-p (not (eq start-window (posn-window end))))
          t) ; wait for return to original window
         ((<= row 0) (mouse-drag-repeatedly-safe-scroll -1 0))
         ((>= row window-last-row) (mouse-drag-repeatedly-safe-scroll 1 0))
diff --git a/lisp/mouse.el b/lisp/mouse.el
index f72ab4fc64..095d30a285 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -105,6 +105,15 @@ point at the click position."
   :type 'boolean
   :version "22.1")
 
+(defcustom mouse-1-double-click-prefer-symbols nil
+  "If non-nil, double-clicking Mouse-1 attempts to select the symbol at click.
+
+If nil, the default, double-clicking Mouse-1 on a word-constituent
+character will select only the word at click location, which could
+select fewer characters than the symbol at click."
+  :type 'boolean
+  :version "30.1")
+
 (defcustom mouse-drag-and-drop-region-scroll-margin nil
   "If non-nil, the scroll margin inside a window when dragging text.
 If the mouse moves this many lines close to the top or bottom of
@@ -1800,10 +1809,17 @@ The region will be defined with mark and point."
 ;; Commands to handle xterm-style multiple clicks.
 (defun mouse-skip-word (dir)
   "Skip over word, over whitespace, or over identical punctuation.
+If `mouse-1-double-click-prefer-symbols' is non-nil, skip over symbol.
 If DIR is positive skip forward; if negative, skip backward."
   (let* ((char (following-char))
-        (syntax (char-to-string (char-syntax char))))
-    (cond ((string= syntax "w")
+        (syntax (char-to-string (char-syntax char)))
+         sym)
+    (cond ((and mouse-1-double-click-prefer-symbols
+                (setq sym (bounds-of-thing-at-point 'symbol)))
+           (goto-char (if (< dir 0)
+                          (car sym)
+                        (cdr sym))))
+          ((string= syntax "w")
           ;; Here, we can't use skip-syntax-forward/backward because
           ;; they don't pay attention to word-separating-categories,
           ;; and thus they will skip over a true word boundary.  So,
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index d6d0fb9a25..9781ebf863 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -218,7 +218,7 @@
 ;; ange-ftp-smart-gateway and ange-ftp-smart-gateway-port.
 ;;
 ;; Otherwise, if there is an alternate ftp program that implements proxy in
-;; a transparent way (i.e. w/o specifying the proxy host), that will
+;; a transparent way (i.e. without specifying the proxy host), that will
 ;; connect you directly to the desired destination host:
 ;; Set ange-ftp-gateway-ftp-program-name to that program's name.
 ;; Set ange-ftp-local-host-regexp to a value as stated earlier on.
@@ -4498,6 +4498,25 @@ NEWNAME should be the name to give the new compressed or 
uncompressed file.")
 (put 'process-file 'ange-ftp 'ange-ftp-process-file)
 (put 'start-file-process 'ange-ftp 'ignore)
 (put 'shell-command 'ange-ftp 'ange-ftp-shell-command)
+
+;; Do not execute system information functions.
+(put 'file-system-info 'ange-ftp 'ignore)
+(put 'list-system-processes 'ange-ftp 'ignore)
+(put 'memory-info 'ange-ftp 'ignore)
+(put 'process-attributes 'ange-ftp 'ignore)
+
+;; There aren't ACLs.  `file-selinux-context' shall return '(nil nil
+;; nil nil) if the file is nonexistent, so we let the default file
+;; name handler do the job.
+(put 'file-acl 'ange-ftp 'ignore)
+;; (put 'file-selinux-context 'ange-ftp 'ignore)
+(put 'set-file-acl 'ange-ftp 'ignore)
+(put 'set-file-selinux-context 'ange-ftp 'ignore)
+
+;; There aren't file notifications.
+(put 'file-notify-add-watch 'ange-ftp 'ignore)
+(put 'file-notify-rm-watch 'ange-ftp 'ignore)
+(put 'file-notify-valid-p 'ange-ftp 'ignore)
 
 ;;; Define ways of getting at unmodified Emacs primitives,
 ;;; turning off our handler.
diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el
index 86cf98004b..5b850b258c 100644
--- a/lisp/net/goto-addr.el
+++ b/lisp/net/goto-addr.el
@@ -222,25 +222,28 @@ and `goto-address-fontify-p'."
 
 ;;;###autoload
 (defun goto-address-at-point (&optional event)
-  "Send to the e-mail address or load the URL at point.
-Send mail to address at point.  See documentation for
-`goto-address-find-address-at-point'.  If no address is found
-there, then load the URL at or before point."
+  "Compose a new message to the e-mail address or open URL at point.
+
+Compose message to address at point.  See documentation for
+`goto-address-find-address-at-point'.
+
+If no e-mail address is found at point, open the URL at or before
+point using `browse-url'.  With a prefix argument, open the URL
+using `browse-url-secondary-browser-function' instead."
   (interactive (list last-input-event))
   (save-excursion
     (if event (posn-set-point (event-end event)))
     (let ((address (save-excursion (goto-address-find-address-at-point))))
       (if (and address
-              (save-excursion
-                (goto-char (previous-single-char-property-change
-                            (point) 'goto-address nil
-                            (line-beginning-position)))
-                (not (looking-at goto-address-url-regexp))))
-         (compose-mail address)
-       (let ((url (browse-url-url-at-point)))
-         (if url
-             (browse-url url)
-           (error "No e-mail address or URL found")))))))
+               (save-excursion
+                 (goto-char (previous-single-char-property-change
+                             (point) 'goto-address nil
+                             (line-beginning-position)))
+                 (not (looking-at goto-address-url-regexp))))
+          (compose-mail address)
+        (if-let ((url (browse-url-url-at-point)))
+            (browse-url-button-open-url url)
+          (error "No e-mail address or URL found"))))))
 
 (defun goto-address-find-address-at-point ()
   "Find e-mail address around or before point.
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 29957a62d0..81a572250a 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -1396,10 +1396,10 @@ inserted."
   (interactive "P")
   (rcirc-format "\^_" replace))
 
-(defun rcirc-format-strike-trough (replace)
-  "Insert strike-trough formatting.
+(defun rcirc-format-strike-through (replace)
+  "Insert strike-through formatting.
 If REPLACE is non-nil or a prefix argument is given, any prior
-formatting will be replaced before the strike-trough formatting
+formatting will be replaced before the strike-through formatting
 is inserted."
   (interactive "P")
   (rcirc-format "\^^" replace))
@@ -1421,7 +1421,7 @@ inserted."
   "C-c C-f C-b" #'rcirc-format-bold
   "C-c C-f C-i" #'rcirc-format-italic
   "C-c C-f C-u" #'rcirc-format-underline
-  "C-c C-f C-s" #'rcirc-format-strike-trough
+  "C-c C-f C-s" #'rcirc-format-strike-through
   "C-c C-f C-f" #'rcirc-format-fixed-width
   "C-c C-f C-t" #'rcirc-format-fixed-width ;as in AucTeX
   "C-c C-f C-d" #'rcirc-unformat
@@ -1807,7 +1807,7 @@ extracted."
   "C-c C-f C-b" #'rcirc-format-bold
   "C-c C-f C-i" #'rcirc-format-italic
   "C-c C-f C-u" #'rcirc-format-underline
-  "C-c C-f C-s" #'rcirc-format-strike-trough
+  "C-c C-f C-s" #'rcirc-format-strike-through
   "C-c C-f C-f" #'rcirc-format-fixed-width
   "C-c C-f C-t" #'rcirc-format-fixed-width ;as in AucTeX
   "C-c C-f C-d" #'rcirc-unformat
@@ -2371,9 +2371,11 @@ This function does not alter the INPUT string."
   "C-c C-@"   #'rcirc-next-active-buffer
   "C-c C-SPC" #'rcirc-next-active-buffer)
 
-(defcustom rcirc-track-abbrevate-flag t
+(define-obsolete-variable-alias 'rcirc-track-abbrevate-flag
+  'rcirc-track-abbreviate-flag "30.1")
+(defcustom rcirc-track-abbreviate-flag t
   "Non-nil means `rcirc-track-minor-mode' should abbreviate names."
-  :version "28.1"
+  :version "30.1"
   :type 'boolean)
 
 ;;;###autoload
@@ -2559,7 +2561,7 @@ activity.  Only run if the buffer is not visible and
     (funcall rcirc-channel-filter
              (replace-regexp-in-string
               "@.*?\\'" ""
-              (or (and rcirc-track-abbrevate-flag
+              (or (and rcirc-track-abbreviate-flag
                        rcirc-short-buffer-name)
                   (buffer-name))))))
 
@@ -4002,6 +4004,9 @@ PROCESS is the process object for the current connection."
                      (string-equal (downcase (car setting)) parameter))
            return (cadr setting)))
 
+(define-obsolete-function-alias 'rcirc-format-strike-trough
+  'rcirc-format-strike-through "30.1")
+
 (provide 'rcirc)
 
 ;;; rcirc.el ends here
diff --git a/lisp/net/sasl-scram-rfc.el b/lisp/net/sasl-scram-rfc.el
index ee52ed6e07..f7a2e42541 100644
--- a/lisp/net/sasl-scram-rfc.el
+++ b/lisp/net/sasl-scram-rfc.el
@@ -45,14 +45,21 @@
 
 ;;; Generic for SCRAM-*
 
+(defvar sasl-scram-gs2-header-function 'sasl-scram-construct-gs2-header
+  "Function to create GS2 header.
+See https://www.rfc-editor.org/rfc/rfc5801#section-4.";)
+
+(defun sasl-scram-construct-gs2-header (client)
+  ;; The "n," means the client doesn't support channel binding, and
+  ;; the trailing comma is included as per RFC 5801.
+  (let ((authzid (sasl-client-property client 'authenticator-name)))
+    (concat "n," (and authzid "a=") authzid ",")))
+
 (defun sasl-scram-client-first-message (client _step)
   (let ((c-nonce (sasl-unique-id)))
     (sasl-client-set-property client 'c-nonce c-nonce))
   (concat
-   ;; n = client doesn't support channel binding
-   "n,"
-   ;; TODO: where would we get authorization id from?
-   ","
+   (funcall sasl-scram-gs2-header-function client)
    (sasl-scram--client-first-message-bare client)))
 
 (defun sasl-scram--client-first-message-bare (client)
@@ -77,11 +84,11 @@
 
         (c-nonce (sasl-client-property client 'c-nonce))
         ;; no channel binding, no authorization id
-        (cbind-input "n,,"))
+         (cbind-input (funcall sasl-scram-gs2-header-function client)))
     (unless (string-prefix-p c-nonce nonce)
       (sasl-error "Invalid nonce from server"))
     (let* ((client-final-message-without-proof
-           (concat "c=" (base64-encode-string cbind-input) ","
+            (concat "c=" (base64-encode-string cbind-input t) ","
                    "r=" nonce))
           (password
            ;; TODO: either apply saslprep or disallow non-ASCII characters
@@ -113,7 +120,7 @@
           (client-proof (funcall string-xor client-key client-signature))
           (client-final-message
            (concat client-final-message-without-proof ","
-                   "p=" (base64-encode-string client-proof))))
+                    "p=" (base64-encode-string client-proof t))))
       (sasl-client-set-property client 'auth-message auth-message)
       (sasl-client-set-property client 'salted-password salted-password)
       client-final-message)))
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 49cbf526ec..90020fbb1b 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -168,6 +168,7 @@ It is used for TCP/IP devices."
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
     (make-process . tramp-adb-handle-make-process)
     (make-symbolic-link . tramp-handle-make-symbolic-link)
+    (memory-info . tramp-handle-memory-info)
     (process-attributes . tramp-handle-process-attributes)
     (process-file . tramp-adb-handle-process-file)
     (rename-file . tramp-adb-handle-rename-file)
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 0a8c574d84..49b0c0bb6b 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -215,11 +215,18 @@ It must be supported by libarchive(3).")
 ;; In older Emacs (prior 27.1), `tramp-archive-autoload-file-name-regexp'
 ;; is not autoloaded.  So we cannot expect it to be known in
 ;; tramp-loaddefs.el.  But it exists, when tramp-archive.el is loaded.
+;; We must wrap it into `eval-when-compile'.  Otherwise, there could
+;; be an "Eager macro-expansion failure" when unloading/reloading Tramp.
 ;;;###tramp-autoload
 (defconst tramp-archive-file-name-regexp
-  (ignore-errors (tramp-archive-autoload-file-name-regexp))
+  (eval-when-compile (ignore-errors (tramp-archive-autoload-file-name-regexp)))
   "Regular expression matching archive file names.")
 
+;; The value above is nil for Emacs 26.  Set it now.
+(if (<= emacs-major-version 26)
+    (setq tramp-archive-file-name-regexp
+         (ignore-errors (tramp-archive-autoload-file-name-regexp))))
+
 ;;;###tramp-autoload
 (defconst tramp-archive-method "archive"
   "Method name for archives in GVFS.")
@@ -297,6 +304,7 @@ It must be supported by libarchive(3).")
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
     (make-process . ignore)
     (make-symbolic-link . tramp-archive-handle-not-implemented)
+    (memory-info . ignore)
     (process-attributes . ignore)
     (process-file . ignore)
     (rename-file . tramp-archive-handle-not-implemented)
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index 0973258157..249b3fcd4d 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -219,6 +219,7 @@ If NAME doesn't belong to an encrypted remote directory, 
return nil."
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
     (make-process . ignore)
     (make-symbolic-link . tramp-handle-make-symbolic-link)
+    (memory-info . ignore)
     (process-attributes . ignore)
     (process-file . ignore)
     (rename-file . tramp-crypt-handle-rename-file)
@@ -317,7 +318,7 @@ connection if a previous connection has died for some 
reason."
       (process-put p 'vector vec)
       (set-process-query-on-exit-flag p nil)))
 
-  ;; The following operations must be performed w/o
+  ;; The following operations must be performed without
   ;; `tramp-crypt-file-name-handler'.
   (let* (tramp-crypt-enabled
         ;; Don't check for a proper method.
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 477f8fb3fd..da7641774f 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -690,7 +690,7 @@ It has been changed in GVFS 1.14.")
     ("gvfs-set-attribute" . "set"))
   "List of cons cells, mapping \"gvfs-<command>\" to \"gio <command>\".")
 
-;; <http://www.pygtk.org/docs/pygobject/gio-constants.html>
+;; <https://www.pygtk.org/docs/pygobject/gio-constants.html>
 (eval-and-compile
   (defconst tramp-gvfs-file-attributes
     '("name"
@@ -813,6 +813,7 @@ It has been changed in GVFS 1.14.")
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
     (make-process . ignore)
     (make-symbolic-link . tramp-handle-make-symbolic-link)
+    (memory-info . ignore)
     (process-attributes . ignore)
     (process-file . ignore)
     (rename-file . tramp-gvfs-handle-rename-file)
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index 9e379da8c1..8e583cc402 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -133,6 +133,7 @@
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
     (make-process . ignore)
     (make-symbolic-link . tramp-handle-make-symbolic-link)
+    (memory-info . ignore)
     (process-attributes . ignore)
     (process-file . ignore)
     (rename-file . tramp-rclone-handle-rename-file)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index cfecd32aba..6087f16431 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1103,6 +1103,7 @@ Format specifiers \"%s\" are replaced before the script 
is used.")
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
     (make-process . tramp-sh-handle-make-process)
     (make-symbolic-link . tramp-sh-handle-make-symbolic-link)
+    (memory-info . tramp-handle-memory-info)
     (process-attributes . tramp-handle-process-attributes)
     (process-file . tramp-sh-handle-process-file)
     (rename-file . tramp-sh-handle-rename-file)
@@ -3430,6 +3431,7 @@ implementation will be used."
             (signal (car err) (cdr err)))))
 
       ;; Impossible to copy.  Trigger `file-missing' error.
+      (delete-file tmpfile)
       (setq tmpfile nil))))
 
 (defun tramp-sh-handle-write-region
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index e55f6bb6ee..cd73b9b8ec 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -279,11 +279,12 @@ See `tramp-actions-before-shell' for more info.")
     (lock-file . tramp-handle-lock-file)
     (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
     (make-directory . tramp-smb-handle-make-directory)
-    (make-directory-internal . tramp-smb-handle-make-directory-internal)
+    (make-directory-internal . ignore)
     (make-lock-file-name . tramp-handle-make-lock-file-name)
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
     (make-process . ignore)
     (make-symbolic-link . tramp-smb-handle-make-symbolic-link)
+    (memory-info . ignore)
     (process-attributes . ignore)
     (process-file . tramp-smb-handle-process-file)
     (rename-file . tramp-smb-handle-rename-file)
@@ -1185,12 +1186,21 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
        (make-directory ldir parents))
       ;; Just do it.
       (when (file-directory-p ldir)
-       (make-directory-internal dir))
+       (tramp-smb-send-command
+        v (if (tramp-smb-get-cifs-capabilities v)
+              (format "posix_mkdir %s %o"
+                      (tramp-smb-shell-quote-localname v) (default-file-modes))
+            (format "mkdir %s" (tramp-smb-shell-quote-localname v))))
+       ;; We must also flush the cache of the directory, because
+       ;; `file-attributes' reads the values from there.
+       (tramp-flush-file-properties v localname))
       (unless (file-directory-p dir)
        (tramp-error v 'file-error "Couldn't make directory %s" dir)))))
 
+;; This is not used anymore.
 (defun tramp-smb-handle-make-directory-internal (directory)
   "Like `make-directory-internal' for Tramp files."
+  (declare (obsolete nil "29.1"))
   (setq directory (directory-file-name (expand-file-name directory)))
   (unless (file-name-absolute-p directory)
     (setq directory (expand-file-name directory default-directory)))
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index 3c67fa6ea2..44c55041ff 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -139,6 +139,7 @@
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
     (make-process . tramp-handle-make-process)
     (make-symbolic-link . tramp-handle-make-symbolic-link)
+    (memory-info . tramp-handle-memory-info)
     (process-attributes . tramp-handle-process-attributes)
     (process-file . tramp-sshfs-handle-process-file)
     (rename-file . tramp-sshfs-handle-rename-file)
@@ -214,7 +215,8 @@ arguments to pass to the OPERATION."
    (with-parsed-tramp-file-name default-directory nil
      (with-tramp-connection-property (tramp-get-process v) "remote-path"
        (with-temp-buffer
-        (process-file "getconf" nil t nil "PATH")
+         (let (process-file-side-effects)
+          (process-file "getconf" nil t nil "PATH"))
         (split-string
          (progn
            ;; Read the expression.
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index bc8739c4d6..fcc27dd834 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -129,6 +129,7 @@ See `tramp-actions-before-shell' for more info.")
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
     (make-process . ignore)
     (make-symbolic-link . tramp-sudoedit-handle-make-symbolic-link)
+    (memory-info . ignore)
     (process-attributes . ignore)
     (process-file . ignore)
     (rename-file . tramp-sudoedit-handle-rename-file)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e9f30bea7b..ca8963fbf5 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2605,12 +2605,14 @@ Must be handled by the callers."
              file-selinux-context file-symlink-p file-truename
              file-writable-p find-backup-file-name get-file-buffer
              insert-directory insert-file-contents load
-             make-directory make-directory-internal set-file-acl
-             set-file-modes set-file-selinux-context set-file-times
+             make-directory set-file-acl set-file-modes
+             set-file-selinux-context set-file-times
              substitute-in-file-name unhandled-file-name-directory
              vc-registered
              ;; Emacs 27+ only.
              file-system-info
+             ;; Emacs 28- only.
+             make-directory-internal
              ;; Emacs 28+ only.
              file-locked-p lock-file make-lock-file-name unlock-file
              ;; Emacs 29+ only.
@@ -2656,7 +2658,7 @@ Must be handled by the callers."
              ;; Emacs 27+ only.
              exec-path make-process
              ;; Emacs 29+ only.
-              list-system-processes process-attributes))
+              list-system-processes memory-info process-attributes))
     default-directory)
    ;; PROC.
    ((member operation '(file-notify-rm-watch file-notify-valid-p))
@@ -2949,7 +2951,7 @@ They are completed by \"M-x TAB\" only if the current 
buffer is remote."
   (tramp-tramp-file-p (tramp-get-default-directory buffer)))
 
 (defun tramp-connectable-p (vec-or-filename)
-  "Check, whether it is possible to connect the remote host w/o side-effects.
+  "Check if it is possible to connect the remote host without side-effects.
 This is true, if either the remote host is already connected, or if we are
 not in completion mode."
   (let ((tramp-verbose 0)
@@ -3999,7 +4001,7 @@ Let-bind it when necessary.")
    ((not (file-exists-p file1)) nil)
    ((not (file-exists-p file2)) t)
    ;; Tramp reads and writes timestamps on second level.  So we round
-   ;; the timestamps to seconds w/o fractions.
+   ;; the timestamps to seconds without fractions.
    ;; `time-convert' has been introduced with Emacs 27.1.
    ((fboundp 'time-convert)
     (time-less-p
@@ -4884,6 +4886,84 @@ support symbolic links."
    (tramp-dissect-file-name (expand-file-name linkname)) 'file-error
    "make-symbolic-link not supported"))
 
+(defun tramp-handle-memory-info ()
+  "Like `memory-info' for Tramp files."
+  (let ((result '(0 0 0 0))
+        process-file-side-effects)
+    (with-temp-buffer
+      (cond
+       ;; GNU/Linux.
+       ((zerop (process-file "cat" nil '(t) nil "/proc/meminfo"))
+        (goto-char (point-min))
+        (when
+            (re-search-forward
+             (rx bol "MemTotal:" (* space) (group (+ digit)) (* space) "kB" 
eol)
+             nil 'noerror)
+          (setcar (nthcdr 0 result) (string-to-number (match-string 1))))
+        (goto-char (point-min))
+        (when
+            (re-search-forward
+             (rx bol "MemFree:" (* space) (group (+ digit)) (* space) "kB" eol)
+             nil 'noerror)
+          (setcar (nthcdr 1 result) (string-to-number (match-string 1))))
+        (goto-char (point-min))
+        (when
+            (re-search-forward
+             (rx bol "SwapTotal:" (* space) (group (+ digit)) (* space) "kB" 
eol)
+             nil 'noerror)
+          (setcar (nthcdr 2 result) (string-to-number (match-string 1))))
+        (goto-char (point-min))
+        (when
+            (re-search-forward
+             (rx bol "SwapFree:" (* space) (group (+ digit)) (* space) "kB" 
eol)
+             nil 'noerror)
+          (setcar (nthcdr 3 result) (string-to-number (match-string 1)))))
+
+       ;; BSD.
+       ;; 
https://raw.githubusercontent.com/ocochard/myscripts/master/FreeBSD/freebsd-memory.sh
+       ((zerop (process-file "sysctl" nil '(t) nil "-a"))
+        (goto-char (point-min))
+        (when
+            (re-search-forward
+             (rx bol "hw.pagesize:" (* space) (group (+ digit)) eol)
+             nil 'noerror)
+          (let ((pagesize (string-to-number (match-string 1))))
+            (goto-char (point-min))
+            (when
+                (re-search-forward
+                 (rx bol "vm.stats.vm.v_page_count:" (* space)
+                     (group (+ digit)) eol)
+                 nil 'noerror)
+              (setcar
+               (nthcdr 0 result)
+               (/ (* (string-to-number (match-string 1)) pagesize) 1024)))
+            (goto-char (point-min))
+            (when
+                (re-search-forward
+                 (rx bol "vm.stats.vm.v_free_count:" (* space)
+                     (group (+ digit)) eol)
+                 nil 'noerror)
+              (setcar
+               (nthcdr 1 result)
+               (/ (* (string-to-number (match-string 1)) pagesize) 1024)))))
+        (erase-buffer)
+        (when (zerop (process-file "swapctl" nil '(t) nil "-sk"))
+          (goto-char (point-min))
+          (when
+              (re-search-forward
+               (rx bol "Total:" (* space)
+                   (group (+ digit)) (* space) (group (+ digit)) eol)
+               nil 'noerror)
+            (setcar (nthcdr 2 result) (string-to-number (match-string 1)))
+            (setcar
+             (nthcdr 3 result)
+             (- (string-to-number (match-string 1))
+                (string-to-number (match-string 2)))))))))
+
+    ;; Return result.
+    (unless (equal result '(0 0 0 0))
+      result)))
+
 (defun tramp-handle-process-attributes (pid)
   "Like `process-attributes' for Tramp files."
   (catch 'result
diff --git a/lisp/obsolete/rfc2368.el b/lisp/obsolete/rfc2368.el
index 5e7320a793..0a75296e7d 100644
--- a/lisp/obsolete/rfc2368.el
+++ b/lisp/obsolete/rfc2368.el
@@ -27,7 +27,7 @@
 ;;
 ;;   -repeat after me: "the colon is not part of the header name..."
 ;;   -if w3 becomes part of emacs, then it may make sense to have this
-;;    file depend on w3 -- the maintainer of w3 says merging w/ Emacs
+;;    file depend on w3 -- the maintainer of w3 says merging with Emacs
 ;;    is planned!
 ;;
 ;; historical note:
@@ -36,8 +36,8 @@
 ;;
 ;; acknowledgments:
 ;;
-;;   the functions that deal w/ unhexifying in this file were basically
-;; taken from w3 -- i hope to replace them w/ something else soon OR
+;;   the functions that deal with unhexifying in this file were basically
+;; taken from w3 -- i hope to replace them with something else soon OR
 ;; perhaps if w3 becomes a part of emacs soon, use the functions from w3.
 
 ;;; History:
@@ -85,9 +85,9 @@
 
 (defun rfc2368-parse-mailto-url (mailto-url)
   "Parse MAILTO-URL, and return an alist of header-name, header-value pairs.
-MAILTO-URL should be a RFC 2368 (mailto) compliant url.  A cons cell w/ a
+MAILTO-URL should be a RFC 2368 (mailto) compliant url.  A cons cell with a
 key of `Body' is a special case and is considered a header for this purpose.
-The returned alist is intended for use w/ the `compose-mail' interface.
+The returned alist is intended for use with the `compose-mail' interface.
 Note: make sure MAILTO-URL has been \"unhtmlized\" (e.g., &amp; -> &), before
 calling this function."
   (let ((case-fold-search t)
@@ -114,7 +114,7 @@ calling this function."
                          (rfc2368-unhexify-string header-value))))
                     (split-string query "&"))))
 
-         ;; deal w/ multiple 'To' recipients
+         ;; deal with multiple 'To' recipients
          (if prequery
              (progn
                (setq prequery (rfc2368-unhexify-string prequery))
diff --git a/lisp/org/ChangeLog.1 b/lisp/org/ChangeLog.1
index 1491a4645a..4f51c6a1eb 100644
--- a/lisp/org/ChangeLog.1
+++ b/lisp/org/ChangeLog.1
@@ -1867,7 +1867,7 @@
 
        * org.el: Use
        `org-define-obsolete-{function,variable}-alias´instead of
-       `define-obsolate{function,variable}-alias´.
+       `define-obsolete-{function,variable}-alias´.
 
        * org-compat.el (user-error): Defalias to `error´ for Emacsen that
        don't have it.
@@ -23889,7 +23889,7 @@
 2010-11-11  Eric Schulte  <schulte.eric@gmail.com>
 
        * ob-sqlite.el (org-babel-sqlite-expand-vars): Now inserts string
-       arguments w/o quotes.
+       arguments without quotes.
 
 2010-11-11  Bernt Hansen  <bernt@norang.ca>
 
@@ -23909,7 +23909,7 @@
 2010-11-11  Eric Schulte  <schulte.eric@gmail.com>
 
        * ob-lob.el (org-babel-lob-one-liner-regexp): Fix error in lob
-       regexp -- it wasn't matching lob lines w/o indices.
+       regexp -- it wasn't matching lob lines without indices.
 
 2010-11-11  Eric Schulte  <schulte.eric@gmail.com>
 
diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el
index 2be5e28dc8..74309a0e97 100644
--- a/lisp/org/ob-C.el
+++ b/lisp/org/ob-C.el
@@ -4,9 +4,9 @@
 
 ;; Author: Eric Schulte
 ;;      Thierry Banel
-;; Maintainer: Thierry Banel
+;; Maintainer: Thierry Banel <tbanelwebmin@free.fr>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -33,6 +33,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cc-mode)
 (require 'ob)
 (require 'org-macs)
@@ -182,7 +185,7 @@ or `org-babel-execute:C++' or `org-babel-execute:D'."
        (setq results (org-remove-indentation results))
        (org-babel-reassemble-table
         (org-babel-result-cond (cdr (assq :result-params params))
-          (org-babel-read results t)
+          results
           (let ((tmp-file (org-babel-temp-file "c-")))
             (with-temp-file tmp-file (insert results))
             (org-babel-import-elisp-from-file tmp-file)))
diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el
index 93d1d34229..b7f96a179a 100644
--- a/lisp/org/ob-R.el
+++ b/lisp/org/ob-R.el
@@ -4,9 +4,9 @@
 
 ;; Author: Eric Schulte
 ;;     Dan Davison
-;; Maintainer: Jeremie Juste
+;; Maintainer: Jeremie Juste <jeremiejuste@gmail.com>
 ;; Keywords: literate programming, reproducible research, R, statistics
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -29,6 +29,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ob)
 
@@ -40,13 +43,6 @@
 (declare-function ess-wait-for-process "ext:ess-inf"
                  (&optional proc sec-prompt wait force-redisplay))
 
-;; FIXME: Temporary declaration to silence the byte-compiler
-(defvar user-inject-src-param)
-(defvar ess-eval-visibly-tmp)
-(defvar ess-eval-visibly)
-(defvar ess-inject-source)
-(defvar user-inject-src-param)
-
 (defconst org-babel-header-args:R
   '((width              . :any)
     (height             . :any)
@@ -245,11 +241,11 @@ This function is called by `org-babel-execute-src-block'."
 (defun org-babel-R-assign-elisp (name value colnames-p rownames-p)
   "Construct R code assigning the elisp VALUE to a variable named NAME."
   (if (listp value)
-      (let* ((lengths (mapcar 'length (cl-remove-if-not 'sequencep value)))
+      (let* ((lengths (mapcar 'length (cl-remove-if-not 'listp value)))
             (max (if lengths (apply 'max lengths) 0))
             (min (if lengths (apply 'min lengths) 0)))
         ;; Ensure VALUE has an orgtbl structure (depth of at least 2).
-        (unless (listp (car value)) (setq value (list value)))
+        (unless (listp (car value)) (setq value (mapcar 'list value)))
        (let ((file (orgtbl-to-tsv value '(:fmt org-babel-R-quote-tsv-field)))
              (header (if (or (eq (nth 1 value) 'hline) colnames-p)
                          "TRUE" "FALSE"))
@@ -385,7 +381,7 @@ Has four %s escapes to be filled in:
   (if session
       (if async
           (ob-session-async-org-babel-R-evaluate-session
-           session body result-type result-params column-names-p row-names-p)
+           session body result-type column-names-p row-names-p)
         (org-babel-R-evaluate-session
          session body result-type result-params column-names-p row-names-p))
     (org-babel-R-evaluate-external-process
@@ -486,7 +482,7 @@ Insert hline if column names in output have been requested."
 (defconst ob-session-async-R-indicator "'ob_comint_async_R_%s_%s'")
 
 (defun ob-session-async-org-babel-R-evaluate-session
-    (session body result-type _ column-names-p row-names-p)
+    (session body result-type column-names-p row-names-p)
   "Asynchronously evaluate BODY in SESSION.
 Returns a placeholder string for insertion, to later be replaced
 by `org-babel-comint-async-filter'."
@@ -525,7 +521,8 @@ by `org-babel-comint-async-filter'."
     (output
      (let ((uuid (md5 (number-to-string (random 100000000))))
            (ess-local-process-name
-            (process-name (get-buffer-process session))))
+            (process-name (get-buffer-process session)))
+           (ess-eval-visibly-p nil))
        (with-temp-buffer
          (insert (format ob-session-async-R-indicator
                         "start" uuid))
@@ -534,13 +531,7 @@ by `org-babel-comint-async-filter'."
          (insert "\n")
          (insert (format ob-session-async-R-indicator
                         "end" uuid))
-         (setq ess-eval-visibly-tmp ess-eval-visibly)
-         (setq user-inject-src-param ess-inject-source)
-         (setq ess-eval-visibly nil)
-         (setq ess-inject-source 'function-and-buffer)
-         (ess-eval-buffer nil))
-       (setq ess-eval-visibly ess-eval-visibly-tmp)
-       (setq ess-inject-source user-inject-src-param)
+         (ess-eval-buffer nil ))
        uuid))))
 
 (defun ob-session-async-R-value-callback (params tmp-file)
diff --git a/lisp/org/ob-awk.el b/lisp/org/ob-awk.el
index 1d5a6f24eb..1db9c6b00c 100644
--- a/lisp/org/ob-awk.el
+++ b/lisp/org/ob-awk.el
@@ -5,7 +5,7 @@
 ;; Author: Eric Schulte
 ;; Maintainer: Tyler Smith <tyler@plantarum.ca>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -32,6 +32,10 @@
 ;;          which will be passed to the awk process through STDIN
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-compat)
 
@@ -51,7 +55,7 @@
 (defun org-babel-execute:awk (body params)
   "Execute a block of Awk code with org-babel.
 This function is called by `org-babel-execute-src-block'."
-  (message "executing Awk source code block")
+  (message "Executing Awk source code block")
   (let* ((result-params (cdr (assq :result-params params)))
          (cmd-line (cdr (assq :cmd-line params)))
          (in-file (cdr (assq :in-file params)))
diff --git a/lisp/org/ob-calc.el b/lisp/org/ob-calc.el
index 9cf16a04c3..2d52da3441 100644
--- a/lisp/org/ob-calc.el
+++ b/lisp/org/ob-calc.el
@@ -5,7 +5,7 @@
 ;; Author: Eric Schulte
 ;; Maintainer: Tom Gillespie <tgbugs@gmail.com>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -27,6 +27,10 @@
 ;; Org-Babel support for evaluating calc code
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 (require 'calc)
diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el
index 5a44b64875..b045b4e6e5 100644
--- a/lisp/org/ob-clojure.el
+++ b/lisp/org/ob-clojure.el
@@ -3,10 +3,10 @@
 ;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Joel Boehland, Eric Schulte, Oleh Krehel, Frederick Giasson
-;; Maintainer: Bastien Guerry <bzg@gnu.org>
+;; Maintainer: Daniel Kraus <daniel@kraus.my>
 ;;
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -25,23 +25,30 @@
 
 ;;; Commentary:
 
-;; Support for evaluating clojure code
+;; Support for evaluating Clojure code
 
 ;; Requirements:
 
-;; - clojure (at least 1.2.0)
+;; - Clojure (at least 1.2.0)
 ;; - clojure-mode
-;; - inf-clojure, cider or SLIME
+;; - inf-clojure, Cider, SLIME, babashka or nbb
 
 ;; For clojure-mode, see https://github.com/clojure-emacs/clojure-mode
-;; For cider, see https://github.com/clojure-emacs/cider
-;; For inf-clojure, see https://github.com/clojure-emacs/cider
+;; For inf-clojure, see https://github.com/clojure-emacs/inf-clojure
+;; For Cider, see https://github.com/clojure-emacs/cider
+;; For SLIME, see https://slime.common-lisp.dev
+;; For babashka, see https://github.com/babashka/babashka
+;; For nbb, see https://github.com/babashka/nbb
 
-;; For SLIME, the best way to install these components is by following
+;; For SLIME, the best way to install its components is by following
 ;; the directions as set out by Phil Hagelberg (Technomancy) on the
 ;; web page: https://technomancy.us/126
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (declare-function cider-current-connection "ext:cider-client" (&optional type))
@@ -62,17 +69,29 @@
 (add-to-list 'org-babel-tangle-lang-exts '("clojurescript" . "cljs"))
 
 (defvar org-babel-default-header-args:clojure '())
-(defvar org-babel-header-args:clojure '((ns . :any) (package . :any)))
+(defvar org-babel-header-args:clojure
+  '((ns . :any)
+    (package . :any)
+    (backend . ((inf-clojure cider slime babashka nbb)))))
 (defvar org-babel-default-header-args:clojurescript '())
 (defvar org-babel-header-args:clojurescript '((package . :any)))
 
-(defcustom org-babel-clojure-backend nil
+(defcustom org-babel-clojure-backend (cond
+                                      ((executable-find "bb") 'babashka)
+                                      ((executable-find "nbb") 'nbb)
+                                      ((featurep 'cider) 'cider)
+                                      ((featurep 'inf-clojure) 'inf-clojure)
+                                      ((featurep 'slime) 'slime)
+                                     (t nil))
   "Backend used to evaluate Clojure code blocks."
   :group 'org-babel
+  :package-version '(Org . "9.6")
   :type '(choice
          (const :tag "inf-clojure" inf-clojure)
          (const :tag "cider" cider)
          (const :tag "slime" slime)
+         (const :tag "babashka" babashka)
+         (const :tag "nbb" nbb)
          (const :tag "Not configured yet" nil)))
 
 (defcustom org-babel-clojure-default-ns "user"
@@ -80,9 +99,28 @@
   :type 'string
   :group 'org-babel)
 
+(defcustom ob-clojure-babashka-command (executable-find "bb")
+  "Path to the babashka executable."
+  :type '(choice file (const nil))
+  :group 'org-babel
+  :package-version '(Org . "9.6"))
+
+(defcustom ob-clojure-nbb-command (executable-find "nbb")
+  "Path to the nbb executable."
+  :type '(choice file (const nil))
+  :group 'org-babel
+  :package-version '(Org . "9.6"))
+
 (defun org-babel-expand-body:clojure (body params)
   "Expand BODY according to PARAMS, return the expanded body."
   (let* ((vars (org-babel--get-vars params))
+         (backend-override (cdr (assq :backend params)))
+         (org-babel-clojure-backend
+          (cond
+           (backend-override (intern backend-override))
+           (org-babel-clojure-backend org-babel-clojure-backend)
+           (t (user-error "You need to customize `org-babel-clojure-backend'
+or set the `:backend' header argument"))))
         (ns (or (cdr (assq :ns params))
                 (if (eq org-babel-clojure-backend 'cider)
                     (or cider-buffer-ns
@@ -104,7 +142,7 @@
                   (format "(let [%s]\n%s)"
                           (mapconcat
                            (lambda (var)
-                             (format "%S %S" (car var) (cdr var)))
+                             (format "%S '%S" (car var) (cdr var)))
                            vars
                            "\n      ")
                           body))))))
@@ -210,8 +248,10 @@
                                "value")))
                result0)))
       (ob-clojure-string-or-list
+       ;; Filter out s-expressions that return nil (string "nil"
+       ;; from nrepl eval) or comment forms (actual nil from nrepl)
        (reverse (delete "" (mapcar (lambda (r)
-                                    (replace-regexp-in-string "nil" "" r))
+                                    (replace-regexp-in-string "nil" "" (or r 
"")))
                                   result0)))))))
 
 (defun ob-clojure-eval-with-slime (expanded params)
@@ -225,25 +265,43 @@
        ,(buffer-substring-no-properties (point-min) (point-max)))
      (cdr (assq :package params)))))
 
+(defun ob-clojure-eval-with-babashka (bb expanded)
+  "Evaluate EXPANDED code block using BB (babashka or nbb)."
+  (let ((script-file (org-babel-temp-file "clojure-bb-script-" ".clj")))
+    (with-temp-file script-file
+      (insert expanded))
+    (org-babel-eval
+     (format "%s %s" bb (org-babel-process-file-name script-file))
+     "")))
+
 (defun org-babel-execute:clojure (body params)
-  "Execute a block of Clojure code with Babel."
-  (unless org-babel-clojure-backend
-    (user-error "You need to customize org-babel-clojure-backend"))
-  (let* ((expanded (org-babel-expand-body:clojure body params))
-        (result-params (cdr (assq :result-params params)))
-        result)
-    (setq result
-         (cond
-          ((eq org-babel-clojure-backend 'inf-clojure)
-           (ob-clojure-eval-with-inf-clojure expanded params))
-          ((eq org-babel-clojure-backend 'cider)
-           (ob-clojure-eval-with-cider expanded params))
-          ((eq org-babel-clojure-backend 'slime)
-           (ob-clojure-eval-with-slime expanded params))))
-    (org-babel-result-cond result-params
-      result
-      (condition-case nil (org-babel-script-escape result)
-       (error result)))))
+  "Execute the BODY block of Clojure code with PARAMS using Babel."
+  (let* ((backend-override (cdr (assq :backend params)))
+         (org-babel-clojure-backend
+          (cond
+           (backend-override (intern backend-override))
+           (org-babel-clojure-backend org-babel-clojure-backend)
+           (t (user-error "You need to customize `org-babel-clojure-backend'
+or set the `:backend' header argument")))))
+    (let* ((expanded (org-babel-expand-body:clojure body params))
+          (result-params (cdr (assq :result-params params)))
+          result)
+      (setq result
+           (cond
+            ((eq org-babel-clojure-backend 'inf-clojure)
+             (ob-clojure-eval-with-inf-clojure expanded params))
+             ((eq org-babel-clojure-backend 'babashka)
+             (ob-clojure-eval-with-babashka ob-clojure-babashka-command 
expanded))
+             ((eq org-babel-clojure-backend 'nbb)
+             (ob-clojure-eval-with-babashka ob-clojure-nbb-command expanded))
+            ((eq org-babel-clojure-backend 'cider)
+             (ob-clojure-eval-with-cider expanded params))
+            ((eq org-babel-clojure-backend 'slime)
+             (ob-clojure-eval-with-slime expanded params))))
+      (org-babel-result-cond result-params
+        result
+        (condition-case nil (org-babel-script-escape result)
+         (error result))))))
 
 (defun org-babel-execute:clojurescript (body params)
   "Evaluate BODY with PARAMS as ClojureScript code."
diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el
index c99d6a8ba7..064ba94464 100644
--- a/lisp/org/ob-comint.el
+++ b/lisp/org/ob-comint.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, comint
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -30,6 +30,10 @@
 ;; org-babel at large.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob-core)
 (require 'org-compat)
 (require 'comint)
@@ -70,11 +74,26 @@ or user `keyboard-quit' during execution of body."
   (let ((buffer (nth 0 meta))
        (eoe-indicator (nth 1 meta))
        (remove-echo (nth 2 meta))
-       (full-body (nth 3 meta)))
+       (full-body (nth 3 meta))
+        (org-babel-comint-prompt-separator
+         "org-babel-comint-prompt-separator"))
     `(org-babel-comint-in-buffer ,buffer
        (let* ((string-buffer "")
              (comint-output-filter-functions
-              (cons (lambda (text) (setq string-buffer (concat string-buffer 
text)))
+              (cons (lambda (text)
+                       (setq string-buffer
+                             (concat
+                              string-buffer
+                              ;; Upon concatenation, the prompt may no
+                              ;; longer match `comint-prompt-regexp'.
+                              ;; In particular, when the regexp has ^
+                              ;; and the output does not contain
+                              ;; trailing newline.  Use more reliable
+                              ;; match to split the output later.
+                              (replace-regexp-in-string
+                               comint-prompt-regexp
+                               ,org-babel-comint-prompt-separator
+                               text))))
                     comint-output-filter-functions))
              dangling-text)
         ;; got located, and save dangling text
@@ -98,6 +117,14 @@ or user `keyboard-quit' during execution of body."
         (goto-char (process-mark (get-buffer-process (current-buffer))))
         (insert dangling-text)
 
+         ;; Replace partially supplied input lines.
+         ;; This is needed when output filter spits partial lines that
+         ;; do not include a full prompt at a time.
+         (setq string-buffer
+               (replace-regexp-in-string
+                comint-prompt-regexp
+                ,org-babel-comint-prompt-separator
+                string-buffer))
         ;; remove echo'd FULL-BODY from input
         (when (and ,remove-echo ,full-body
                    (string-match
@@ -105,7 +132,9 @@ or user `keyboard-quit' during execution of body."
                      "\n" "[\r\n]+" (regexp-quote (or ,full-body "")))
                     string-buffer))
           (setq string-buffer (substring string-buffer (match-end 0))))
-        (split-string string-buffer comint-prompt-regexp)))))
+         (delete "" (split-string
+                     string-buffer
+                     ,org-babel-comint-prompt-separator))))))
 
 (defun org-babel-comint-input-command (buffer cmd)
   "Pass CMD to BUFFER.
@@ -124,9 +153,7 @@ statement (not large blocks of code)."
     (while (progn
              (goto-char comint-last-input-end)
              (not (and (re-search-forward comint-prompt-regexp nil t)
-                       (goto-char (match-beginning 0))
-                       (string= (face-name (face-at-point))
-                                "comint-highlight-prompt"))))
+                     (goto-char (match-beginning 0)))))
       (accept-process-output (get-buffer-process buffer)))))
 
 (defun org-babel-comint-eval-invisibly-and-wait-for-file
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index 41b7a2a971..f69538f78c 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -5,7 +5,7 @@
 ;; Authors: Eric Schulte
 ;;     Dan Davison
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -23,10 +23,16 @@
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ob-eval)
 (require 'org-macs)
+(require 'org-fold)
 (require 'org-compat)
+(require 'org-cycle)
 
 (defconst org-babel-exeext
   (if (memq system-type '(windows-nt cygwin))
@@ -40,6 +46,7 @@
 (defvar org-src-preserve-indentation)
 (defvar org-babel-tangle-uncomment-comments)
 
+(declare-function org-attach-dir "org-attach" (&optional 
create-if-not-exists-p no-fs-check))
 (declare-function org-at-item-p "org-list" ())
 (declare-function org-at-table-p "org" (&optional table-type))
 (declare-function org-babel-lob-execute-maybe "ob-lob" ())
@@ -50,10 +57,11 @@
 (declare-function org-babel-ref-split-args "ob-ref" (arg-string))
 (declare-function org-babel-tangle-comment-links "ob-tangle" (&optional info))
 (declare-function org-current-level "org" ())
-(declare-function org-cycle "org" (&optional arg))
+(declare-function org-cycle "org-cycle" (&optional arg))
 (declare-function org-edit-src-code "org-src" (&optional code 
edit-buffer-name))
 (declare-function org-edit-src-exit "org-src"  ())
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
+(declare-function org-element-at-point-no-context "org-element" (&optional 
pom))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-normalize-string "org-element" (s))
 (declare-function org-element-property "org-element" (property element))
@@ -68,13 +76,14 @@
 (declare-function org-list-struct "org-list" ())
 (declare-function org-list-to-generic "org-list" (LIST PARAMS))
 (declare-function org-list-to-lisp "org-list" (&optional delete))
+(declare-function org-list-to-org "org-list" (list &optional params))
 (declare-function org-macro-escape-arguments "org-macro" (&rest args))
 (declare-function org-mark-ring-push "org" (&optional pos buffer))
-(declare-function org-narrow-to-subtree "org" ())
+(declare-function org-narrow-to-subtree "org" (&optional element))
 (declare-function org-next-block "org" (arg &optional backward block-regexp))
 (declare-function org-open-at-point "org" (&optional in-emacs 
reference-buffer))
 (declare-function org-previous-block "org" (arg &optional block-regexp))
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-fold-show-context "org-fold" (&optional key))
 (declare-function org-src-coderef-format "org-src" (&optional element))
 (declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
 (declare-function org-src-get-lang-mode "org-src" (lang))
@@ -136,7 +145,7 @@ used."
   :type 'string
   :safe (lambda (v)
          (and (stringp v)
-              (string-equal-ignore-case "RESULTS" v))))
+              (org-string-equal-ignore-case "RESULTS" v))))
 
 (defcustom org-babel-noweb-wrap-start "<<"
   "String used to begin a noweb reference in a code block.
@@ -331,7 +340,7 @@ then run `org-babel-execute-src-block'."
 This includes header arguments, language and name, and is largely
 a window into the `org-babel-get-src-block-info' function."
   (interactive)
-  (let ((info (org-babel-get-src-block-info 'light))
+  (let ((info (org-babel-get-src-block-info 'no-eval))
        (full (lambda (it) (> (length it) 0)))
        (printf (lambda (fmt &rest args) (princ (apply #'format fmt args)))))
     (when info
@@ -406,16 +415,17 @@ then run `org-babel-switch-to-session'."
     (mkdirp    . ((yes no)))
     (no-expand)
     (noeval)
-    (noweb     . ((yes no tangle no-export strip-export)))
+    (noweb     . ((yes no tangle strip-tangle no-export strip-export)))
     (noweb-ref . :any)
     (noweb-sep  . :any)
+    (noweb-prefix . ((no yes)))
     (output-dir . :any)
     (padline   . ((yes no)))
     (post       . :any)
     (prologue   . :any)
     (results   . ((file list vector table scalar verbatim)
                   (raw html latex org code pp drawer link graphics)
-                  (replace silent none append prepend)
+                  (replace silent none discard append prepend)
                   (output value)))
     (rownames  . ((no yes)))
     (sep       . :any)
@@ -434,8 +444,8 @@ specific header arguments as well.")
 
 (defconst org-babel-safe-header-args
   '(:cache :colnames :comments :exports :epilogue :hlines :noeval
-          :noweb :noweb-ref :noweb-sep :padline :prologue :rownames
-          :sep :session :tangle :wrap
+          :noweb :noweb-ref :noweb-sep :noweb-prefix :padline
+           :prologue :rownames :sep :session :tangle :wrap
           (:eval . ("never" "query"))
           (:results . (lambda (str) (not (string-match "file" str)))))
   "A list of safe header arguments for babel source blocks.
@@ -476,12 +486,14 @@ For the format of SAFE-LIST, see 
`org-babel-safe-header-args'."
 This is a list in which each element is an alist.  Each key
 corresponds to a header argument, and each value to that header's
 value.  The value can either be a string or a closure that
-evaluates to a string.  The closure is evaluated when the source
-block is being evaluated (e.g. during execution or export), with
-point at the source block.  It is not possible to use an
-arbitrary function symbol (e.g. `some-func'), since org uses
-lexical binding.  To achieve the same functionality, call the
-function within a closure (e.g. (lambda () (some-func))).
+evaluates to a string.
+
+A closure is evaluated when the source block is being
+evaluated (e.g. during execution or export), with point at the
+source block.  It is not possible to use an arbitrary function
+symbol (e.g. `some-func'), since org uses lexical binding.  To
+achieve the same functionality, call the function within a
+closure (e.g. (lambda () (some-func))).
 
 To understand how closures can be used as default header
 arguments, imagine you'd like to set the file name output of a
@@ -498,7 +510,16 @@ this with:
 
 Because the closure is evaluated with point at the source block,
 the call to `org-element-at-point' above will always retrieve
-information about the current source block.")
+information about the current source block.
+
+Some header arguments can be provided multiple times for a source
+block.  An example of such a header argument is :var.  This
+functionality is also supported for default header arguments by
+providing the header argument multiple times in the alist.  For
+example:
+
+ ((:var . \"foo=\\\"bar\\\"\")
+  (:var . \"bar=\\\"foo\\\"\"))")
 
 (put 'org-babel-default-header-args 'safe-local-variable
      (org-babel-header-args-safe-fn org-babel-safe-header-args))
@@ -620,10 +641,10 @@ the list of header arguments."
         (push elem lst)))
     (reverse lst)))
 
-(defun org-babel-get-src-block-info (&optional light datum)
+(defun org-babel-get-src-block-info (&optional no-eval datum)
   "Extract information from a source block or inline source block.
 
-When optional argument LIGHT is non-nil, Babel does not resolve
+When optional argument NO-EVAL is non-nil, Babel does not resolve
 remote variable references; a process which could likely result
 in the execution of other code blocks, and do not evaluate Lisp
 values in parameters.
@@ -657,9 +678,9 @@ a list with the following pattern:
                       ;; properties applicable to its location within
                       ;; the document.
                       (org-with-point-at (org-element-property :begin datum)
-                        (org-babel-params-from-properties lang light))
+                        (org-babel-params-from-properties lang no-eval))
                       (mapcar (lambda (h)
-                                (org-babel-parse-header-arguments h light))
+                                (org-babel-parse-header-arguments h no-eval))
                               (cons (org-element-property :parameters datum)
                                     (org-element-property :header datum)))))
               (or (org-element-property :switches datum) "")
@@ -667,7 +688,7 @@ a list with the following pattern:
               (org-element-property (if inline :begin :post-affiliated)
                                     datum)
               (and (not inline) (org-src-coderef-format datum)))))
-       (unless light
+       (unless no-eval
          (setf (nth 2 info) (org-babel-process-params (nth 2 info))))
        (setf (nth 2 info) (org-babel-generate-file-param name (nth 2 info)))
        info))))
@@ -694,8 +715,8 @@ a list with the following pattern:
                 ; and `org-babel-read'
 
 ;;;###autoload
-(defun org-babel-execute-src-block (&optional arg info params)
-  "Execute the current source code block.
+(defun org-babel-execute-src-block (&optional arg info params executor-type)
+  "Execute the current source code block and return the result.
 Insert the results of execution into the buffer.  Source code
 execution and the collection and formatting of results can be
 controlled through a variety of header arguments.
@@ -708,13 +729,33 @@ Optionally supply a value for INFO in the form returned by
 
 Optionally supply a value for PARAMS which will be merged with
 the header arguments specified at the front of the source code
-block."
+block.
+
+EXECUTOR-TYPE is the type of the org element responsible for the
+execution of the source block.  If not provided then informed
+guess will be made."
   (interactive)
   (let* ((org-babel-current-src-block-location
-         (or org-babel-current-src-block-location
-             (nth 5 info)
-             (org-babel-where-is-src-block-head)))
-        (info (if info (copy-tree info) (org-babel-get-src-block-info))))
+          (or org-babel-current-src-block-location
+              (nth 5 info)
+              (org-babel-where-is-src-block-head)))
+         (info (if info (copy-tree info) (org-babel-get-src-block-info)))
+         (executor-type
+          (or executor-type
+              ;; If `executor-type' is unset, then we will make an
+              ;; informed guess.
+              (pcase (and
+                      ;; When executing virtual src block, no location
+                      ;; is known.
+                      org-babel-current-src-block-location
+                      (char-after org-babel-current-src-block-location))
+                (?s 'inline-src-block)
+                (?c 'inline-babel-call)
+                (?# (pcase (char-after (+ 2 
org-babel-current-src-block-location))
+                      (?b 'src-block)
+                      (?c 'call-block)
+                      (_ 'unknown)))
+                (_ 'unknown)))))
     ;; Merge PARAMS with INFO before considering source block
     ;; evaluation since both could disagree.
     (cl-callf org-babel-merge-params (nth 2 info) params)
@@ -733,7 +774,8 @@ block."
            (forward-line)
            (skip-chars-forward " \t")
            (let ((result (org-babel-read-result)))
-             (message (replace-regexp-in-string "%" "%%" (format "%S" result)))
+             (message (format "Cached: %s"
+                               (replace-regexp-in-string "%" "%%" (format "%S" 
result))))
              result)))
         ((org-babel-confirm-evaluate info)
          (let* ((lang (nth 0 info))
@@ -751,57 +793,67 @@ block."
                       (make-directory d 'parents)
                       d))))
                 (cmd (intern (concat "org-babel-execute:" lang)))
-                result)
+                result exec-start-time)
            (unless (fboundp cmd)
              (error "No org-babel-execute function for %s!" lang))
-           (message "executing %s code block%s..."
+           (message "Executing %s %s %s..."
                     (capitalize lang)
+                     (pcase executor-type
+                       ('src-block "code block")
+                       ('inline-src-block "inline code block")
+                       ('babel-call "call")
+                       ('inline-babel-call "inline call")
+                       (e (symbol-name e)))
                     (let ((name (nth 4 info)))
-                      (if name (format " (%s)" name) "")))
-           (if (member "none" result-params)
-               (progn (funcall cmd body params)
-                      (message "result silenced"))
-             (setq result
-                   (let ((r (funcall cmd body params)))
-                     (if (and (eq (cdr (assq :result-type params)) 'value)
-                              (or (member "vector" result-params)
-                                  (member "table" result-params))
-                              (not (listp r)))
-                         (list (list r))
-                       r)))
-             (let ((file (and (member "file" result-params)
-                              (cdr (assq :file params)))))
-               ;; If non-empty result and :file then write to :file.
-               (when file
-                 ;; If `:results' are special types like `link' or
-                 ;; `graphics', don't write result to `:file'.  Only
-                 ;; insert a link to `:file'.
-                 (when (and result
-                            (not (or (member "link" result-params)
-                                     (member "graphics" result-params))))
-                   (with-temp-file file
-                     (insert (org-babel-format-result
-                              result
-                              (cdr (assq :sep params)))))
-                   ;; Set file permissions if header argument
-                   ;; `:file-mode' is provided.
-                   (when (assq :file-mode params)
-                     (set-file-modes file (cdr (assq :file-mode params)))))
-                 (setq result file))
-               ;; Possibly perform post process provided its
-               ;; appropriate.  Dynamically bind "*this*" to the
-               ;; actual results of the block.
-               (let ((post (cdr (assq :post params))))
-                 (when post
-                   (let ((*this* (if (not file) result
-                                   (org-babel-result-to-file
-                                    file
-                                    (org-babel--file-desc params result)))))
-                     (setq result (org-babel-ref-resolve post))
-                     (when file
-                       (setq result-params (remove "file" result-params))))))
-               (org-babel-insert-result
-                result result-params info new-hash lang)))
+                      (if name
+                           (format "(%s)" name)
+                         (format "at position %S" (nth 5 info)))))
+           (setq exec-start-time (current-time)
+                  result
+                 (let ((r (save-current-buffer (funcall cmd body params))))
+                   (if (and (eq (cdr (assq :result-type params)) 'value)
+                            (or (member "vector" result-params)
+                                (member "table" result-params))
+                            (not (listp r)))
+                       (list (list r))
+                     r)))
+           (let ((file (and (member "file" result-params)
+                            (cdr (assq :file params)))))
+             ;; If non-empty result and :file then write to :file.
+             (when file
+               ;; If `:results' are special types like `link' or
+               ;; `graphics', don't write result to `:file'.  Only
+               ;; insert a link to `:file'.
+               (when (and result
+                          (not (or (member "link" result-params)
+                                 (member "graphics" result-params))))
+                 (with-temp-file file
+                   (insert (org-babel-format-result
+                            result
+                            (cdr (assq :sep params)))))
+                 ;; Set file permissions if header argument
+                 ;; `:file-mode' is provided.
+                 (when (assq :file-mode params)
+                   (set-file-modes file (cdr (assq :file-mode params)))))
+               (setq result file))
+             ;; Possibly perform post process provided its
+             ;; appropriate.  Dynamically bind "*this*" to the
+             ;; actual results of the block.
+             (let ((post (cdr (assq :post params))))
+               (when post
+                 (let ((*this* (if (not file) result
+                                 (org-babel-result-to-file
+                                  file
+                                  (org-babel--file-desc params result)
+                                   'attachment))))
+                   (setq result (org-babel-ref-resolve post))
+                   (when file
+                     (setq result-params (remove "file" result-params))))))
+             (if (member "none" result-params)
+                 (message "result silenced")
+               (org-babel-insert-result
+                result result-params info new-hash lang
+                 (time-subtract (current-time) exec-start-time))))
            (run-hooks 'org-babel-after-execute-hook)
            result)))))))
 
@@ -886,7 +938,7 @@ arguments and pop open the results in a preview buffer."
 (defun org-babel-insert-header-arg (&optional header-arg value)
   "Insert a header argument selecting from lists of common args and values."
   (interactive)
-  (let* ((info (org-babel-get-src-block-info 'light))
+  (let* ((info (org-babel-get-src-block-info 'no-eval))
         (lang (car info))
         (begin (nth 5 info))
         (lang-headers (intern (concat "org-babel-header-args:" lang)))
@@ -943,7 +995,7 @@ arguments and pop open the results in a preview buffer."
     (insert (concat header " " (or arg "")))
     (cons header arg)))
 
-(add-hook 'org-tab-first-hook 'org-babel-header-arg-expand)
+(add-hook 'org-cycle-tab-first-hook 'org-babel-header-arg-expand)
 
 ;;;###autoload
 (defun org-babel-load-in-session (&optional _arg info)
@@ -1083,7 +1135,7 @@ code block, otherwise return nil.  With optional prefix 
argument
 RE-RUN the source-code block is evaluated even if results already
 exist."
   (interactive "P")
-  (pcase (org-babel-get-src-block-info 'light)
+  (pcase (org-babel-get-src-block-info 'no-eval)
     (`(,_ ,_ ,arguments ,_ ,_ ,start ,_)
      (save-excursion
        ;; Go to the results, if there aren't any then run the block.
@@ -1293,7 +1345,7 @@ CONTEXT specifies the context of evaluation.  It can be 
`:eval',
                (lambda (a b) (string< (car a) (car b)))))
     (let* ((rm (lambda (lst)
                 (dolist (p '("replace" "silent" "none"
-                             "append" "prepend"))
+                             "discard" "append" "prepend"))
                   (setq lst (remove p lst)))
                 lst))
           (norm (lambda (arg)
@@ -1301,8 +1353,8 @@ CONTEXT specifies the context of evaluation.  It can be 
`:eval',
                                (copy-sequence (cdr arg))
                              (cdr arg))))
                     (when (and v (not (and (sequencep v)
-                                           (not (consp v))
-                                           (= (length v) 0))))
+                                         (not (consp v))
+                                         (= (length v) 0))))
                       (cond
                        ((and (listp v) ; lists are sorted
                              (member (car arg) '(:result-params)))
@@ -1330,10 +1382,10 @@ CONTEXT specifies the context of evaluation.  It can be 
`:eval',
                          (mapconcat
                           #'identity
                           (delq nil (mapcar (lambda (arg)
-                                              (let ((normalized (funcall norm 
arg)))
-                                                (when normalized
-                                                  (format "%S" normalized))))
-                                            (nth 2 info))) ":")
+                                            (let ((normalized (funcall norm 
arg)))
+                                              (when normalized
+                                                (format "%S" normalized))))
+                                          (nth 2 info))) ":")
                          expanded))
              (hash (sha1 it)))
         (when (called-interactively-p 'interactive) (message hash))
@@ -1467,7 +1519,7 @@ portions of results lines."
        (push ov org-babel-hide-result-overlays)))))
 
 ;; org-tab-after-check-for-cycling-hook
-(add-hook 'org-tab-first-hook #'org-babel-hide-result-toggle-maybe)
+(add-hook 'org-cycle-tab-first-hook #'org-babel-hide-result-toggle-maybe)
 ;; Remove overlays when changing major mode
 (add-hook 'org-mode-hook
          (lambda () (add-hook 'change-major-mode-hook
@@ -1766,7 +1818,8 @@ its current beginning instead.
 Return the point at the beginning of the current source block.
 Specifically at the beginning of the #+BEGIN_SRC line.  Also set
 match-data relatively to `org-babel-src-block-regexp', which see.
-If the point is not on a source block then return nil."
+If the point is not on a source block or within blank lines after an
+src block, then return nil."
   (let ((element (or src-block (org-element-at-point))))
     (when (eq (org-element-type element) 'src-block)
       (let ((end (org-element-property :end element)))
@@ -1815,7 +1868,7 @@ If the point is not on a source block then return nil."
   (let ((point (org-babel-find-named-block name)))
     (if point
         ;; Taken from `org-open-at-point'.
-        (progn (org-mark-ring-push) (goto-char point) (org-show-context))
+        (progn (org-mark-ring-push) (goto-char point) (org-fold-show-context))
       (message "source-code block `%s' not found in this buffer" name))))
 
 (defun org-babel-find-named-block (name)
@@ -1855,7 +1908,7 @@ to `org-babel-named-src-block-regexp'."
   (let ((point (org-babel-find-named-result name)))
     (if point
         ;; taken from `org-open-at-point'
-        (progn (goto-char point) (org-show-context))
+        (progn (goto-char point) (org-fold-show-context))
       (message "result `%s' not found in this buffer" name))))
 
 (defun org-babel-find-named-result (name)
@@ -1918,48 +1971,53 @@ With optional prefix argument ARG, jump backward ARG 
many source blocks."
 When called from inside of a code block the current block is
 split.  When called from outside of a code block a new code block
 is created.  In both cases if the region is demarcated and if the
-region is not active then the point is demarcated."
+region is not active then the point is demarcated.
+
+When called within blank lines after a code block, create a new code
+block of the same language with the previous."
   (interactive "P")
-  (let* ((info (org-babel-get-src-block-info 'light))
+  (let* ((info (org-babel-get-src-block-info 'no-eval))
         (start (org-babel-where-is-src-block-head))
+         ;; `start' will be nil when within space lines after src block.
         (block (and start (match-string 0)))
         (headers (and start (match-string 4)))
         (stars (concat (make-string (or (org-current-level) 1) ?*) " "))
         (upper-case-p (and block
                            (let (case-fold-search)
                              (string-match-p "#\\+BEGIN_SRC" block)))))
-    (if info
+    (if (and info start) ;; At src block, but not within blank lines after it.
         (mapc
          (lambda (place)
            (save-excursion
              (goto-char place)
              (let ((lang (nth 0 info))
-                   (indent (make-string (current-indentation) ?\s)))
+                   (indent (make-string (org-current-text-indentation) ?\s)))
               (when (string-match "^[[:space:]]*$"
                                    (buffer-substring (line-beginning-position)
                                                      (line-end-position)))
                  (delete-region (line-beginning-position) (line-end-position)))
                (insert (concat
-                       (if (looking-at "^") "" "\n")
-                       indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")
-                       (if arg stars indent) "\n"
-                       indent (if upper-case-p "#+BEGIN_SRC " "#+begin_src ")
-                       lang
-                       (if (> (length headers) 1)
+                       (if (looking-at "^") "" "\n")
+                       indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")
+                       (if arg stars indent) "\n"
+                       indent (if upper-case-p "#+BEGIN_SRC " "#+begin_src ")
+                       lang
+                       (if (> (length headers) 1)
                            (concat " " headers) headers)
-                       (if (looking-at "[\n\r]")
+                       (if (looking-at "[\n\r]")
                            ""
                          (concat "\n" (make-string (current-column) ? )))))))
           (move-end-of-line 2))
          (sort (if (org-region-active-p) (list (mark) (point)) (list (point))) 
#'>))
       (let ((start (point))
-           (lang (completing-read
-                  "Lang: "
-                  (mapcar #'symbol-name
-                          (delete-dups
-                           (append (mapcar #'car org-babel-load-languages)
-                                   (mapcar (lambda (el) (intern (car el)))
-                                           org-src-lang-modes))))))
+           (lang (or (car info) ; Reuse language from previous block.
+                      (completing-read
+                      "Lang: "
+                      (mapcar #'symbol-name
+                              (delete-dups
+                               (append (mapcar #'car org-babel-load-languages)
+                                       (mapcar (lambda (el) (intern (car el)))
+                                               org-src-lang-modes)))))))
            (body (delete-and-extract-region
                   (if (org-region-active-p) (mark) (point)) (point))))
        (insert (concat (if (looking-at "^") "" "\n")
@@ -2054,8 +2112,11 @@ to HASH."
         ((or `inline-babel-call `inline-src-block)
          ;; Results for inline objects are located right after them.
          ;; There is no RESULTS line to insert either.
-         (let ((limit (org-element-property
-                       :contents-end (org-element-property :parent context))))
+         (let ((limit (pcase (org-element-type (org-element-property :parent 
context))
+                         (`section (org-element-property
+                                   :end (org-element-property :parent 
context)))
+                         (_ (org-element-property
+                            :contents-end (org-element-property :parent 
context))))))
            (goto-char (org-element-property :end context))
            (skip-chars-forward " \t\n" limit)
            (throw :found
@@ -2088,8 +2149,11 @@ to HASH."
             ;; No possible anonymous results at the very end of
             ;; buffer or outside CONTEXT parent.
             ((eq (point)
-                 (or (org-element-property
-                      :contents-end (org-element-property :parent context))
+                 (or (pcase (org-element-type (org-element-property :parent 
context))
+                        ((or `section `org-data) (org-element-property
+                                                 :end (org-element-property 
:parent context)))
+                        (_ (org-element-property
+                           :contents-end (org-element-property :parent 
context))))
                      (point-max))))
             ;; Check if next element is an anonymous result below
             ;; the current block.
@@ -2132,7 +2196,7 @@ Return nil if ELEMENT cannot be read."
        (or (org-babel--string-to-number v) v)))
      (`table (org-babel-read-table))
      (`plain-list (org-babel-read-list))
-     (`example-block
+     ((or `example-block `src-block)
       (let ((v (org-element-property :value element)))
        (if (or org-src-preserve-indentation
                (org-element-property :preserve-indent element))
@@ -2175,8 +2239,15 @@ Return nil if ELEMENT cannot be read."
           (org-table-to-lisp)))
 
 (defun org-babel-read-list ()
-  "Read the list at point into emacs-lisp."
-  (mapcar (lambda (el) (org-babel-read el 'inhibit-lisp-eval))
+  "Read the list at point into emacs-lisp.
+
+Return the list of strings representing top level items:
+
+   (item1 item2 ...)
+
+Only consider top level items.  See Info node
+`(org)Environment of a Code Block'."
+  (mapcar (lambda (el) (org-babel-read (car el) 'inhibit-lisp-eval))
          (cdr (org-list-to-lisp))))
 
 (defvar org-link-types-re)
@@ -2206,7 +2277,7 @@ If the path of the link is a file path it is expanded 
using
       ;; scalar result
       (funcall echo-res result))))
 
-(defun org-babel-insert-result (result &optional result-params info hash lang)
+(defun org-babel-insert-result (result &optional result-params info hash lang 
exec-time)
   "Insert RESULT into the current buffer.
 
 By default RESULT is inserted after the end of the current source
@@ -2214,7 +2285,8 @@ block.  The RESULT of an inline source block usually will 
be
 wrapped inside a `results' macro and placed on the same line as
 the inline source block.  The macro is stripped upon export.
 Multiline and non-scalar RESULTS from inline source blocks are
-not allowed.  With optional argument RESULT-PARAMS controls
+not allowed.  When EXEC-TIME is provided it may be included in a
+generated message.  With optional argument RESULT-PARAMS controls
 insertion of results in the Org mode file.  RESULT-PARAMS can
 take the following values:
 
@@ -2287,11 +2359,14 @@ INFO may provide the values of these header arguments 
(in the
   (cond ((stringp result)
         (setq result (org-no-properties result))
         (when (member "file" result-params)
-          (setq result (org-babel-result-to-file
-                        result
-                        (org-babel--file-desc (nth 2 info) result)))))
+          (setq result
+                 (org-babel-result-to-file
+                 result
+                 (org-babel--file-desc (nth 2 info) result)
+                  'attachment))))
        ((listp result))
        (t (setq result (format "%S" result))))
+
   (if (and result-params (member "silent" result-params))
       (progn (message (replace-regexp-in-string "%" "%%" (format "%S" result)))
             result)
@@ -2302,8 +2377,8 @@ INFO may provide the values of these header arguments (in 
the
       (when inline
        (let ((warning
               (or (and (member "table" result-params) "`:results table'")
-                  (and (listp result) "list result")
-                  (and (string-match-p "\n." result) "multiline result")
+                  (and result (listp result) "list result")
+                  (and result (string-match-p "\n." result) "multiline result")
                   (and (member "list" result-params) "`:results list'"))))
          (when warning
            (user-error "Inline error: %s cannot be used" warning))))
@@ -2385,7 +2460,7 @@ INFO may provide the values of these header arguments (in 
the
                   ((member "list" result-params)
                    (insert
                     (org-trim
-                     (org-list-to-generic
+                     (org-list-to-org
                       (cons 'unordered
                             (mapcar
                              (lambda (e)
@@ -2434,7 +2509,7 @@ INFO may provide the values of these header arguments (in 
the
                       ;; Escape contents from "export" wrap.  Wrap
                       ;; inline results within an export snippet with
                       ;; appropriate value.
-                      ((string-equal-ignore-case type "export")
+                      ((org-string-equal-ignore-case type "export")
                        (let ((backend (pcase split
                                         (`(,_) "none")
                                         (`(,_ ,b . ,_) b))))
@@ -2445,14 +2520,14 @@ INFO may provide the values of these header arguments 
(in the
                                           backend) "@@)}}}")))
                       ;; Escape contents from "example" wrap.  Mark
                       ;; inline results as verbatim.
-                      ((string-equal-ignore-case type "example")
+                      ((org-string-equal-ignore-case type "example")
                        (funcall wrap
                                 opening-line closing-line
                                 nil nil
                                 "{{{results(=" "=)}}}"))
                       ;; Escape contents from "src" wrap.  Mark
                       ;; inline results as inline source code.
-                      ((string-equal-ignore-case type "src")
+                      ((org-string-equal-ignore-case type "src")
                        (let ((inline-open
                               (pcase split
                                 (`(,_)
@@ -2516,12 +2591,19 @@ INFO may provide the values of these header arguments 
(in the
                           (not (and (listp result)
                                     (member "append" result-params))))
                  (indent-rigidly beg end indent))
-               (if (null result)
-                   (if (member "value" result-params)
-                       (message "Code block returned no value.")
-                     (message "Code block produced no output."))
-                 (message "Code block evaluation complete.")))
-           (set-marker end nil)
+                (let ((time-info
+                       ;; Only show the time when something other than
+                       ;; 0s will be shown, i.e. check if the time is at
+                       ;; least half of the displayed precision.
+                       (if (and exec-time (> (float-time exec-time) 0.05))
+                           (format " (took %.1fs)" (float-time exec-time))
+                         "")))
+                  (if (null result)
+                      (if (member "value" result-params)
+                          (message "Code block returned no value%s." time-info)
+                        (message "Code block produced no output%s." time-info))
+                    (message "Code block evaluation complete%s." time-info))))
+           (when end (set-marker end nil))
            (when outside-scope (narrow-to-region visible-beg visible-end))
            (set-marker visible-beg nil)
            (set-marker visible-end nil)))))))
@@ -2594,27 +2676,51 @@ in the buffer."
                 (line-beginning-position 2))
             (point))))))
 
-(defun org-babel-result-to-file (result &optional description)
+(defun org-babel-result-to-file (result &optional description type)
   "Convert RESULT into an Org link with optional DESCRIPTION.
 If the `default-directory' is different from the containing
-file's directory then expand relative links."
+file's directory then expand relative links.
+
+If the optional TYPE is passed as `attachment' and the path is a
+descendant of the DEFAULT-DIRECTORY, the generated link will be
+specified as an an \"attachment:\" style link."
   (when (stringp result)
-    (let ((same-directory?
-          (and (buffer-file-name (buffer-base-buffer))
-               (not (string= (expand-file-name default-directory)
-                             (expand-file-name
-                              (file-name-directory
-                               (buffer-file-name (buffer-base-buffer)))))))))
-      (format "[[file:%s]%s]"
-             (if (and default-directory
-                      (buffer-file-name (buffer-base-buffer)) same-directory?)
-                 (if (eq org-link-file-path-type 'adaptive)
-                     (file-relative-name
-                      (expand-file-name result default-directory)
-                      (file-name-directory
-                       (buffer-file-name (buffer-base-buffer))))
-                   (expand-file-name result default-directory))
-               result)
+    (let* ((result-file-name (expand-file-name result))
+           (base-file-name (buffer-file-name (buffer-base-buffer)))
+           (base-directory (and buffer-file-name
+                                (file-name-directory base-file-name)))
+           (same-directory?
+           (and base-file-name
+                (not (string= (expand-file-name default-directory)
+                              (expand-file-name
+                               base-directory)))))
+           (request-attachment (eq type 'attachment))
+           (attach-dir (let* ((default-directory base-directory)
+                              (dir (org-attach-dir nil t)))
+                         (when dir
+                           (expand-file-name dir))))
+           (in-attach-dir (and request-attachment
+                               attach-dir
+                               (string-prefix-p
+                                attach-dir
+                                result-file-name))))
+      (format "[[%s:%s]%s]"
+              (pcase type
+                ((and 'attachment (guard in-attach-dir)) "attachment")
+                (_ "file"))
+              (if (and request-attachment in-attach-dir)
+                  (file-relative-name
+                   result-file-name
+                   (file-name-as-directory attach-dir))
+               (if (and default-directory
+                        base-file-name same-directory?)
+                   (if (eq org-link-file-path-type 'adaptive)
+                       (file-relative-name
+                        result-file-name
+                         (file-name-directory
+                         base-file-name))
+                     result-file-name)
+                 result))
              (if description (concat "[" description "]") "")))))
 
 (defun org-babel-examplify-region (beg end &optional results-switches inline)
@@ -2653,7 +2759,7 @@ file's directory then expand relative links."
     (unless (eq (org-element-type element) 'src-block)
       (error "Not in a source block"))
     (goto-char (org-babel-where-is-src-block-head element))
-    (let* ((ind (current-indentation))
+    (let* ((ind (org-current-text-indentation))
           (body-start (line-beginning-position 2))
           (body (org-element-normalize-string
                  (if (or org-src-preserve-indentation
@@ -2710,6 +2816,11 @@ parameters when merging lists."
        (pcase pair
          (`(:var . ,value)
           (let ((name (cond
+                        ;; Default header arguments can accept lambda
+                        ;; functions.  We uniquely identify the var
+                        ;; according to the full string contents of
+                        ;; the lambda function.
+                       ((functionp value) value)
                        ((listp value) (car value))
                        ((string-match "^\\([^= \f\t\n\r\v]+\\)[ \t]*=" value)
                         (intern (match-string 1 value)))
@@ -2745,10 +2856,17 @@ parameters when merging lists."
           (setq exports (funcall merge
                                  exports-exclusive-groups
                                  exports
-                                 (split-string
+                                  (split-string
                                    (cond ((and value (functionp value)) 
(funcall value))
                                          (value value)
                                          (t ""))))))
+          ((or '(:dir . attach) '(:dir . "'attach"))
+           (unless (org-attach-dir nil t)
+             (error "No attachment directory for element (add :ID: or :DIR: 
property)"))
+           (setq params (append
+                         `((:dir . ,(org-attach-dir nil t))
+                           (:mkdirp . "yes"))
+                         (assq-delete-all :dir (assq-delete-all :mkdir 
params)))))
          ;; Regular keywords: any value overwrites the previous one.
          (_ (setq params (cons pair (assq-delete-all (car pair) params)))))))
     ;; Handle `:var' and clear out colnames and rownames for replaced
@@ -2776,12 +2894,17 @@ parameters when merging lists."
   "Check if PARAMS require expansion in CONTEXT.
 CONTEXT may be one of :tangle, :export or :eval."
   (let ((allowed-values (cl-case context
-                         (:tangle '("yes" "tangle" "no-export" "strip-export"))
-                         (:eval   '("yes" "no-export" "strip-export" "eval"))
-                         (:export '("yes")))))
+                         (:tangle '("yes" "tangle" "no-export" "strip-export" 
"strip-tangle"))
+                         (:eval   '("yes" "no-export" "strip-export" "eval" 
"strip-tangle"))
+                         (:export '("yes" "strip-tangle")))))
     (cl-some (lambda (v) (member v allowed-values))
             (split-string (or (cdr (assq :noweb params)) "")))))
 
+(defvar org-babel-expand-noweb-references--cache nil
+  "Noweb reference cache used during expansion.")
+(defvar org-babel-expand-noweb-references--cache-buffer nil
+  "Cons (BUFFER . MODIFIED-TICK) for cached noweb references.
+See `org-babel-expand-noweb-references--cache'.")
 (defun org-babel-expand-noweb-references (&optional info parent-buffer)
   "Expand Noweb references in the body of the current source code block.
 
@@ -2813,110 +2936,143 @@ would set the value of argument \"a\" equal to \"9\". 
 Note that
 these arguments are not evaluated in the current source-code
 block but are passed literally to the \"example-block\"."
   (let* ((parent-buffer (or parent-buffer (current-buffer)))
-        (info (or info (org-babel-get-src-block-info 'light)))
+        (info (or info (org-babel-get-src-block-info 'no-eval)))
          (lang (nth 0 info))
          (body (nth 1 info))
         (comment (string= "noweb" (cdr (assq :comments (nth 2 info)))))
+         (noweb-prefix (let ((v (assq :noweb-prefix (nth 2 info))))
+                         (or (not v)
+                             (and (org-not-nil (cdr v))
+                                  (not (equal (cdr v) "no"))))))
         (noweb-re (format "\\(.*?\\)\\(%s\\)"
                           (with-current-buffer parent-buffer
-                            (org-babel-noweb-wrap))))
-        (cache nil)
-        (c-wrap
-         (lambda (s)
-           ;; Comment string S, according to LANG mode.  Return new
-           ;; string.
-           (unless org-babel-tangle-uncomment-comments
-             (with-temp-buffer
-               (funcall (org-src-get-lang-mode lang))
-               (comment-region (point)
-                               (progn (insert s) (point)))
-               (org-trim (buffer-string))))))
-        (expand-body
-         (lambda (i)
-           ;; Expand body of code represented by block info I.
-           (let ((b (if (org-babel-noweb-p (nth 2 i) :eval)
-                        (org-babel-expand-noweb-references i)
-                      (nth 1 i))))
-             (if (not comment) b
-               (let ((cs (org-babel-tangle-comment-links i)))
-                 (concat (funcall c-wrap (car cs)) "\n"
-                         b "\n"
-                         (funcall c-wrap (cadr cs))))))))
-        (expand-references
-         (lambda (ref cache)
-           (pcase (gethash ref cache)
-             (`(,last . ,previous)
-              ;; Ignore separator for last block.
-              (let ((strings (list (funcall expand-body last))))
-                (dolist (i previous)
-                  (let ((parameters (nth 2 i)))
-                    ;; Since we're operating in reverse order, first
-                    ;; push separator, then body.
-                    (push (or (cdr (assq :noweb-sep parameters)) "\n")
-                          strings)
-                    (push (funcall expand-body i) strings)))
-                (mapconcat #'identity strings "")))
-             ;; Raise an error about missing reference, or return the
-             ;; empty string.
-             ((guard (or org-babel-noweb-error-all-langs
-                         (member lang org-babel-noweb-error-langs)))
-              (error "Cannot resolve %s (see `org-babel-noweb-error-langs')"
-                     (org-babel-noweb-wrap ref)))
-             (_ "")))))
-    (replace-regexp-in-string
-     noweb-re
-     (lambda (m)
-       (with-current-buffer parent-buffer
-        (save-match-data
-          (let* ((prefix (match-string 1 m))
-                 (id (match-string 3 m))
-                 (evaluate (string-match-p "(.*)" id))
-                 (expansion
-                  (cond
-                   (evaluate
-                    ;; Evaluation can potentially modify the buffer
-                    ;; and invalidate the cache: reset it.
-                    (setq cache nil)
-                    (let ((raw (org-babel-ref-resolve id)))
-                      (if (stringp raw) raw (format "%S" raw))))
-                   ;; Return the contents of headlines literally.
-                   ((org-babel-ref-goto-headline-id id)
-                    (org-babel-ref-headline-body))
-                   ;; Look for a source block named SOURCE-NAME.  If
-                   ;; found, assume it is unique; do not look after
-                   ;; `:noweb-ref' header argument.
-                   ((org-with-point-at 1
-                      (let ((r (org-babel-named-src-block-regexp-for-name id)))
-                        (and (re-search-forward r nil t)
-                             (not (org-in-commented-heading-p))
-                             (funcall expand-body
-                                      (org-babel-get-src-block-info t))))))
-                   ;; Retrieve from the Library of Babel.
-                   ((nth 2 (assoc-string id org-babel-library-of-babel)))
-                   ;; All Noweb references were cached in a previous
-                   ;; run.  Extract the information from the cache.
-                   ((hash-table-p cache)
-                    (funcall expand-references id cache))
-                   ;; Though luck.  We go into the long process of
-                   ;; checking each source block and expand those
-                   ;; with a matching Noweb reference.  Since we're
-                   ;; going to visit all source blocks in the
-                   ;; document, cache information about them as well.
-                   (t
-                    (setq cache (make-hash-table :test #'equal))
-                    (org-with-wide-buffer
-                     (org-babel-map-src-blocks nil
-                       (if (org-in-commented-heading-p)
-                           (org-forward-heading-same-level nil t)
-                         (let* ((info (org-babel-get-src-block-info t))
-                                (ref (cdr (assq :noweb-ref (nth 2 info)))))
-                           (push info (gethash ref cache))))))
-                    (funcall expand-references id cache)))))
-            ;; Interpose PREFIX between every line.
-            (mapconcat #'identity
-                       (split-string expansion "[\n\r]")
-                       (concat "\n" prefix))))))
-     body t t 2)))
+                            (org-babel-noweb-wrap)))))
+    (unless (equal (cons parent-buffer
+                         (with-current-buffer parent-buffer
+                           (buffer-chars-modified-tick)))
+                   org-babel-expand-noweb-references--cache-buffer)
+      (setq org-babel-expand-noweb-references--cache nil
+            org-babel-expand-noweb-references--cache-buffer
+            (cons parent-buffer
+                  (with-current-buffer parent-buffer
+                    (buffer-chars-modified-tick)))))
+    (cl-macrolet ((c-wrap
+                  (s)
+                  ;; Comment string S, according to LANG mode.  Return new
+                  ;; string.
+                  `(unless org-babel-tangle-uncomment-comments
+                     (with-temp-buffer
+                       (funcall (org-src-get-lang-mode lang))
+                       (comment-region (point)
+                                       (progn (insert ,s) (point)))
+                       (org-trim (buffer-string)))))
+                 (expand-body
+                  (i)
+                  ;; Expand body of code represented by block info I.
+                  `(let ((b (if (org-babel-noweb-p (nth 2 ,i) :eval)
+                                (org-babel-expand-noweb-references ,i)
+                              (nth 1 ,i))))
+                     (if (not comment) b
+                       (let ((cs (org-babel-tangle-comment-links ,i)))
+                         (concat (c-wrap (car cs)) "\n"
+                                 b "\n"
+                                 (c-wrap (cadr cs)))))))
+                 (expand-references
+                  (ref)
+                  `(pcase (gethash ,ref 
org-babel-expand-noweb-references--cache)
+                     (`(,last . ,previous)
+                      ;; Ignore separator for last block.
+                      (let ((strings (list (expand-body last))))
+                        (dolist (i previous)
+                          (let ((parameters (nth 2 i)))
+                            ;; Since we're operating in reverse order, first
+                            ;; push separator, then body.
+                            (push (or (cdr (assq :noweb-sep parameters)) "\n")
+                                  strings)
+                            (push (expand-body i) strings)))
+                        (mapconcat #'identity strings "")))
+                     ;; Raise an error about missing reference, or return the
+                     ;; empty string.
+                     ((guard (or org-babel-noweb-error-all-langs
+                                 (member lang org-babel-noweb-error-langs)))
+                      (error "Cannot resolve %s (see 
`org-babel-noweb-error-langs')"
+                             (org-babel-noweb-wrap ,ref)))
+                     (_ ""))))
+      (replace-regexp-in-string
+       noweb-re
+       (lambda (m)
+         (with-current-buffer parent-buffer
+          (save-match-data
+            (let* ((prefix (match-string 1 m))
+                   (id (match-string 3 m))
+                   (evaluate (string-match-p "(.*)" id))
+                   (expansion
+                    (cond
+                     (evaluate
+                       (prog1
+                          (let ((raw (org-babel-ref-resolve id)))
+                            (if (stringp raw) raw (format "%S" raw)))
+                         ;; Evaluation can potentially modify the buffer
+                        ;; and invalidate the cache: reset it.
+                         (unless (equal 
org-babel-expand-noweb-references--cache-buffer
+                                        (cons parent-buffer
+                                              (buffer-chars-modified-tick)))
+                          (setq org-babel-expand-noweb-references--cache nil
+                                 
org-babel-expand-noweb-references--cache-buffer
+                                 (cons parent-buffer
+                                       (with-current-buffer parent-buffer
+                                         (buffer-chars-modified-tick)))))))
+                      ;; Already cached.
+                      ((and (hash-table-p 
org-babel-expand-noweb-references--cache)
+                            (gethash id 
org-babel-expand-noweb-references--cache))
+                       (expand-references id))
+                     ;; Return the contents of headlines literally.
+                     ((org-babel-ref-goto-headline-id id)
+                      (org-babel-ref-headline-body))
+                     ;; Look for a source block named SOURCE-NAME.  If
+                     ;; found, assume it is unique; do not look after
+                     ;; `:noweb-ref' header argument.
+                     ((org-with-point-at 1
+                        (let ((r (org-babel-named-src-block-regexp-for-name 
id)))
+                          (and (re-search-forward r nil t)
+                               (not (org-in-commented-heading-p))
+                                (let ((info (org-babel-get-src-block-info t)))
+                                  (unless (hash-table-p 
org-babel-expand-noweb-references--cache)
+                                    (setq 
org-babel-expand-noweb-references--cache (make-hash-table :test #'equal)))
+                                  (push info (gethash id  
org-babel-expand-noweb-references--cache))
+                                 (expand-body info))))))
+                     ;; Retrieve from the Library of Babel.
+                     ((nth 2 (assoc-string id org-babel-library-of-babel)))
+                     ;; All Noweb references were cached in a previous
+                     ;; run.  Yet, ID is not in cache (see the above
+                     ;; condition).  Process missing reference in
+                     ;; `expand-references'.
+                     ((and (hash-table-p 
org-babel-expand-noweb-references--cache)
+                            (gethash 'buffer-processed 
org-babel-expand-noweb-references--cache))
+                      (expand-references id))
+                     ;; Though luck.  We go into the long process of
+                     ;; checking each source block and expand those
+                     ;; with a matching Noweb reference.  Since we're
+                     ;; going to visit all source blocks in the
+                     ;; document, cache information about them as well.
+                     (t
+                      (setq org-babel-expand-noweb-references--cache 
(make-hash-table :test #'equal))
+                      (org-with-wide-buffer
+                       (org-babel-map-src-blocks nil
+                         (if (org-in-commented-heading-p)
+                             (org-forward-heading-same-level nil t)
+                           (let* ((info (org-babel-get-src-block-info t))
+                                  (ref (cdr (assq :noweb-ref (nth 2 info)))))
+                             (push info (gethash ref 
org-babel-expand-noweb-references--cache))))))
+                       (puthash 'buffer-processed t 
org-babel-expand-noweb-references--cache)
+                      (expand-references id)))))
+              ;; Interpose PREFIX between every line.
+               (if noweb-prefix
+                  (mapconcat #'identity
+                             (split-string expansion "[\n\r]")
+                             (concat "\n" prefix))
+                 expansion)))))
+       body t t 2))))
 
 (defun org-babel--script-escape-inner (str)
   (let (in-single in-double backslash out)
@@ -2988,7 +3144,7 @@ block but are passed literally to the \"example-block\"."
     (error "`org-babel-script-escape' expects a string"))
   (let ((escaped
         (cond
-         ((and (> (length str) 2)
+         ((and (>= (length str) 2)
                (or (and (string-equal "[" (substring str 0 1))
                         (string-equal "]" (substring str -1)))
                    (and (string-equal "{" (substring str 0 1))
@@ -3023,8 +3179,20 @@ situations in which is it not appropriate."
        ((and (not inhibit-lisp-eval)
              (or (memq (string-to-char cell) '(?\( ?' ?` ?\[))
                  (string= cell "*this*")))
-        (eval (read cell) t))
-       ((eq (string-to-char cell) ?\") (read cell))
+         ;; Prevent arbitrary function calls.
+         (if (and (memq (string-to-char cell) '(?\( ?`))
+                  (not (org-babel-confirm-evaluate
+                      ;; See `org-babel-get-src-block-info'.
+                      (list "emacs-lisp" (format "%S" cell)
+                            '((:eval . yes)) nil (format "%S" cell)
+                            nil nil))))
+             ;; Not allowed.
+             (user-error "Evaluation of elisp code %S aborted." cell)
+          (eval (read cell) t)))
+       ((save-match-data
+           (and (string-match "^[[:space:]]*\"\\(.*\\)\"[[:space:]]*$" cell)
+                (not (string-match "[^\\]\"" (match-string 1 cell)))))
+         (read cell))
        (t (org-no-properties cell))))
 
 (defun org-babel--string-to-number (string)
@@ -3069,7 +3237,7 @@ If the table is trivial, then return it as a scalar."
 (defun org-babel-string-read (cell)
   "Strip nested \"s from around strings."
   (org-babel-read (or (and (stringp cell)
-                           (string-match "\"\\(.+\\)\"" cell)
+                           (string-match 
"^[[:space:]]*\"\\(.+\\)\"[[:space:]]*$" cell)
                            (match-string 1 cell))
                       cell) t))
 
@@ -3093,16 +3261,25 @@ additionally processed by `shell-quote-argument'."
   (let ((f (org-babel-local-file-name (expand-file-name name))))
     (if no-quote-p f (shell-quote-argument f))))
 
-(defvar org-babel-temporary-directory)
-(unless (or noninteractive (boundp 'org-babel-temporary-directory))
-  (defvar org-babel-temporary-directory
-    (or (and (boundp 'org-babel-temporary-directory)
-            (file-exists-p org-babel-temporary-directory)
-            org-babel-temporary-directory)
-       (make-temp-file "babel-" t))
-    "Directory to hold temporary files created to execute code blocks.
+(defvar org-babel-temporary-directory
+  (unless noninteractive
+    (make-temp-file "babel-" t))
+  "Directory to hold temporary files created to execute code blocks.
+Used by `org-babel-temp-file'.  This directory will be removed on
+Emacs shutdown.")
+
+(defvar org-babel-temporary-stable-directory
+  (unless noninteractive
+    (let (dir)
+      (while (or (not dir) (file-exists-p dir))
+        (setq dir (expand-file-name
+                   (format "babel-stable-%d" (random 1000))
+                   (temporary-file-directory))))
+      (make-directory dir)
+      dir))
+  "Directory to hold temporary files created to execute code blocks.
 Used by `org-babel-temp-file'.  This directory will be removed on
-Emacs shutdown."))
+Emacs shutdown.")
 
 (defcustom org-babel-remote-temporary-directory "/tmp/"
   "Directory to hold temporary files on remote hosts."
@@ -3114,14 +3291,14 @@ Emacs shutdown."))
   (declare (indent 1) (debug t))
   (org-with-gensyms (params)
     `(let ((,params ,result-params))
-       (unless (member "none" ,params)
-        (if (or (member "scalar" ,params)
-                (member "verbatim" ,params)
-                (member "html" ,params)
-                (member "code" ,params)
-                (member "pp" ,params)
-                (member "file" ,params)
-                (and (or (member "output" ,params)
+       (unless (member "discard" ,params)
+         (if (or (member "scalar" ,params)
+                (member "verbatim" ,params)
+                (member "html" ,params)
+                (member "code" ,params)
+                (member "pp" ,params)
+                (member "file" ,params)
+                (and (or (member "output" ,params)
                          (member "raw"    ,params)
                          (member "org"    ,params)
                          (member "drawer" ,params))
@@ -3129,27 +3306,50 @@ Emacs shutdown."))
             ,scalar-form
           ,@table-forms)))))
 
+(defmacro org-babel-temp-directory ()
+  "Return temporary directory suitable for `default-directory'."
+  `(if (file-remote-p default-directory)
+       (concat (file-remote-p default-directory)
+              org-babel-remote-temporary-directory)
+     (or (and org-babel-temporary-directory
+             (file-exists-p org-babel-temporary-directory)
+             org-babel-temporary-directory)
+        temporary-file-directory)))
+
 (defun org-babel-temp-file (prefix &optional suffix)
   "Create a temporary file in the `org-babel-temporary-directory'.
 Passes PREFIX and SUFFIX directly to `make-temp-file' with the
 value of `temporary-file-directory' temporarily set to the value
 of `org-babel-temporary-directory'."
-  (if (file-remote-p default-directory)
-      (let ((prefix
-             (concat (file-remote-p default-directory)
-                     (expand-file-name
-                     prefix org-babel-remote-temporary-directory))))
-        (make-temp-file prefix nil suffix))
-    (let ((temporary-file-directory
-          (or (and (boundp 'org-babel-temporary-directory)
-                   (file-exists-p org-babel-temporary-directory)
-                   org-babel-temporary-directory)
-              temporary-file-directory)))
-      (make-temp-file prefix nil suffix))))
+  (make-temp-file
+   (concat (file-name-as-directory (org-babel-temp-directory)) prefix)
+   nil
+   suffix))
+
+(defmacro org-babel-temp-stable-directory ()
+  "Return temporary stable directory."
+  `(let ((org-babel-temporary-directory org-babel-temporary-stable-directory))
+     (org-babel-temp-directory)))
+
+(defun org-babel-temp-stable-file (data prefix &optional suffix)
+  "Create a temporary file in the 
`org-babel-remove-temporary-stable-directory'.
+The file name is stable with respect to DATA.  The file name is
+constructed like the following: PREFIXDATAhashSUFFIX."
+  (let ((path
+         (format
+          "%s%s%s%s"
+          (file-name-as-directory (org-babel-temp-stable-directory))
+          prefix
+          (sxhash data)
+          (or suffix ""))))
+    ;; Create file.
+    (with-temp-file path)
+    ;; Return it.
+    path))
 
 (defun org-babel-remove-temporary-directory ()
   "Remove `org-babel-temporary-directory' on Emacs shutdown."
-  (when (and (boundp 'org-babel-temporary-directory)
+  (when (and org-babel-temporary-directory
             (file-exists-p org-babel-temporary-directory))
     ;; taken from `delete-directory' in files.el
     (condition-case nil
@@ -3166,11 +3366,19 @@ of `org-babel-temporary-directory'."
          (delete-directory org-babel-temporary-directory))
       (error
        (message "Failed to remove temporary Org-babel directory %s"
-               (if (boundp 'org-babel-temporary-directory)
-                   org-babel-temporary-directory
-                 "[directory not defined]"))))))
+               (or org-babel-temporary-directory
+                   "[directory not defined]"))))))
+
+(defun org-babel-remove-temporary-stable-directory ()
+  "Remove `org-babel-temporary-stable-directory' and on Emacs shutdown."
+  (when (and org-babel-temporary-stable-directory
+            (file-exists-p org-babel-temporary-stable-directory))
+    (let ((org-babel-temporary-directory
+           org-babel-temporary-stable-directory))
+      (org-babel-remove-temporary-directory))))
 
 (add-hook 'kill-emacs-hook #'org-babel-remove-temporary-directory)
+(add-hook 'kill-emacs-hook #'org-babel-remove-temporary-stable-directory)
 
 (defun org-babel-one-header-arg-safe-p (pair safe-list)
   "Determine if the PAIR is a safe babel header arg according to SAFE-LIST.
diff --git a/lisp/org/ob-css.el b/lisp/org/ob-css.el
index 51efbb7d94..c132cb2c77 100644
--- a/lisp/org/ob-css.el
+++ b/lisp/org/ob-css.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -27,6 +27,10 @@
 ;; CSS from Org files.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-default-header-args:css '())
diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el
index 20b5ce1fdb..1f82aea6be 100644
--- a/lisp/org/ob-ditaa.el
+++ b/lisp/org/ob-ditaa.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -36,6 +36,10 @@
 ;; 4) there are no variables (at least for now)
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-compat)
 
diff --git a/lisp/org/ob-dot.el b/lisp/org/ob-dot.el
index b82a079b4c..2d2003bf53 100644
--- a/lisp/org/ob-dot.el
+++ b/lisp/org/ob-dot.el
@@ -3,9 +3,9 @@
 ;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
-;; Maintainer: Justin Abrahms
+;; Maintainer: Justin Abrahms <justin@abrah.ms>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -39,6 +39,10 @@
 ;; 4) there are no variables (at least for now)
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-default-header-args:dot
diff --git a/lisp/org/ob-emacs-lisp.el b/lisp/org/ob-emacs-lisp.el
index 730eff69e8..b8e6ef2985 100644
--- a/lisp/org/ob-emacs-lisp.el
+++ b/lisp/org/ob-emacs-lisp.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -27,6 +27,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob-core)
 
 (declare-function org-babel--get-vars "ob" (params))
@@ -55,7 +58,7 @@ by `org-edit-src-code'.")
       (format "(let (%s)\n%s\n)"
              (mapconcat
               (lambda (var)
-                (format "%S" (print `(,(car var) ',(cdr var)))))
+                (format "%S" `(,(car var) ',(cdr var))))
               vars "\n      ")
              body))))
 
diff --git a/lisp/org/ob-eshell.el b/lisp/org/ob-eshell.el
index 135deb4a4b..937db69dc5 100644
--- a/lisp/org/ob-eshell.el
+++ b/lisp/org/ob-eshell.el
@@ -4,7 +4,7 @@
 
 ;; Author: stardiviner <numbchild@gmail.com>
 ;; Maintainer: stardiviner <numbchild@gmail.com>
-;; Homepage: https://github.com/stardiviner/ob-eshell
+;; URL: https://github.com/stardiviner/ob-eshell
 ;; Keywords: literate programming, reproducible research
 
 ;; This file is part of GNU Emacs.
@@ -27,6 +27,10 @@
 ;; Org Babel support for evaluating Eshell source code.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'eshell)
 
diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el
index be1ba54912..f57566079d 100644
--- a/lisp/org/ob-eval.el
+++ b/lisp/org/ob-eval.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, comint
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -27,7 +27,11 @@
 ;; shell commands.
 
 ;;; Code:
+
 (require 'org-macs)
+(org-assert-version)
+
+(eval-when-compile (require 'subr-x))  ; For `string-empty-p', Emacs < 29
 
 (defvar org-babel-error-buffer-name "*Org-Babel Error Output*")
 (declare-function org-babel-temp-file "ob-core" (prefix &optional suffix))
@@ -37,36 +41,45 @@
   (let ((buf (get-buffer-create org-babel-error-buffer-name)))
     (with-current-buffer buf
       (goto-char (point-max))
-      (save-excursion (insert stderr)))
+      (save-excursion
+        (unless (bolp) (insert "\n"))
+        (insert stderr)
+        (insert (format "[ Babel evaluation exited with code %S ]" 
exit-code))))
     (display-buffer buf))
   (message "Babel evaluation exited with code %S" exit-code))
 
 (defun org-babel-eval (command query)
   "Run COMMAND on QUERY.
+Return standard output produced by COMMAND.  If COMMAND exits
+with a non-zero code or produces error output, show it with
+`org-babel-eval-error-notify'.
+
 Writes QUERY into a temp-buffer that is processed with
-`org-babel--shell-command-on-region'.  If COMMAND succeeds then return
-its results, otherwise display STDERR with
-`org-babel-eval-error-notify'."
+`org-babel--shell-command-on-region'."
   (let ((error-buffer (get-buffer-create " *Org-Babel Error*")) exit-code)
     (with-current-buffer error-buffer (erase-buffer))
     (with-temp-buffer
       (insert query)
       (setq exit-code
-           (org-babel--shell-command-on-region
-            command error-buffer))
-      (if (or (not (numberp exit-code)) (> exit-code 0))
-         (progn
-           (with-current-buffer error-buffer
-             (org-babel-eval-error-notify exit-code (buffer-string)))
-           (save-excursion
-             (when (get-buffer org-babel-error-buffer-name)
-               (with-current-buffer org-babel-error-buffer-name
-                 (unless (derived-mode-p 'compilation-mode)
-                   (compilation-mode))
-                 ;; Compilation-mode enforces read-only, but Babel expects the 
buffer modifiable.
-                 (setq buffer-read-only nil))))
-           nil)
-       (buffer-string)))))
+            (org-babel--shell-command-on-region
+             command error-buffer))
+      (let ((stderr (with-current-buffer error-buffer (buffer-string))))
+        (if (or (not (numberp exit-code))
+                (> exit-code 0)
+                (not (string-empty-p stderr)))
+            (progn
+              (org-babel-eval-error-notify exit-code stderr)
+              (save-excursion
+                (when (get-buffer org-babel-error-buffer-name)
+                  (with-current-buffer org-babel-error-buffer-name
+                    (unless (derived-mode-p 'compilation-mode)
+                      (compilation-mode))
+                    ;; Compilation-mode enforces read-only, but
+                    ;; Babel expects the buffer modifiable.
+                    (setq buffer-read-only nil))))
+              ;; Return output, if any.
+              (buffer-string))
+          (buffer-string))))))
 
 (defun org-babel-eval-read-file (file)
   "Return the contents of FILE as a string."
@@ -146,7 +159,8 @@ This buffer is named by `org-babel-error-buffer-name'."
   "Return system `shell-file-name', defaulting to /bin/sh.
 Unfortunately, `executable-find' does not support file name
 handlers.  Therefore, we could use it in the local case only."
-  ;; FIXME: This is generic enough that it should probably be in emacs, not 
org-mode
+  ;; FIXME: Since Emacs 27, `executable-find' accepts optional second
+  ;; argument supporting remote hosts.
   (cond ((and (not (file-remote-p default-directory))
              (executable-find shell-file-name))
         shell-file-name)
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el
index d41c40c8da..60f2a93158 100644
--- a/lisp/org/ob-exp.el
+++ b/lisp/org/ob-exp.el
@@ -5,7 +5,7 @@
 ;; Authors: Eric Schulte
 ;;     Dan Davison
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -23,17 +23,24 @@
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob-core)
 
-(declare-function org-babel-lob-get-info "ob-lob" (&optional datum))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-babel-lob-get-info "ob-lob" (&optional datum no-eval))
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-escape-code-in-string "org-src" (s))
-(declare-function org-export-copy-buffer "ox" ())
-(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
-(declare-function org-in-archived-heading-p "org" (&optional no-inheritance))
+(declare-function org-export-copy-buffer "ox"
+                  (&optional buffer drop-visibility
+                             drop-narrowing drop-contents
+                             drop-locals))
+(declare-function org-in-commented-heading-p "org" (&optional no-inheritance 
element))
+(declare-function org-in-archived-heading-p "org" (&optional no-inheritance 
element))
 
 (defvar org-src-preserve-indentation)
 
@@ -66,7 +73,7 @@ point is at the beginning of the Babel block."
        (when source (goto-char source))
        ,@body))))
 
-(defun org-babel-exp-src-block ()
+(defun org-babel-exp-src-block (&optional element)
   "Process source block for export.
 Depending on the \":export\" header argument, replace the source
 code block like this:
@@ -81,10 +88,12 @@ results - just like none only the block is run on export 
ensuring
 
 none ---- do not display either code or results upon export
 
+Optional argument ELEMENT must contain source block element at point.
+
 Assume point is at block opening line."
   (interactive)
   (save-excursion
-    (let* ((info (org-babel-get-src-block-info))
+    (let* ((info (org-babel-get-src-block-info nil element))
           (lang (nth 0 info))
           (raw-params (nth 2 info))
           hash)
@@ -137,7 +146,8 @@ this template."
            ;; Get a pristine copy of current buffer so Babel
            ;; references are properly resolved and source block
            ;; context is preserved.
-           (org-babel-exp-reference-buffer (org-export-copy-buffer)))
+           (org-babel-exp-reference-buffer (org-export-copy-buffer))
+            element)
        (unwind-protect
            (save-excursion
              ;; First attach to every source block their original
@@ -157,133 +167,167 @@ this template."
              ;; Evaluate from top to bottom every Babel block
              ;; encountered.
              (goto-char (point-min))
-             (while (re-search-forward regexp nil t)
-               (unless (save-match-data (or (org-in-commented-heading-p)
-                                            (org-in-archived-heading-p)))
-                 (let* ((object? (match-end 1))
-                        (element (save-match-data
-                                   (if object? (org-element-context)
-                                     ;; No deep inspection if we're
-                                     ;; just looking for an element.
-                                     (org-element-at-point))))
-                        (type
-                         (pcase (org-element-type element)
-                           ;; Discard block elements if we're looking
-                           ;; for inline objects.  False results
-                           ;; happen when, e.g., "call_" syntax is
-                           ;; located within affiliated keywords:
-                           ;;
-                           ;; #+name: call_src
-                           ;; #+begin_src ...
-                           ((and (or `babel-call `src-block) (guard object?))
-                            nil)
-                           (type type)))
-                        (begin
-                         (copy-marker (org-element-property :begin element)))
-                        (end
-                         (copy-marker
-                          (save-excursion
-                            (goto-char (org-element-property :end element))
-                            (skip-chars-backward " \r\t\n")
-                            (point)))))
-                   (pcase type
-                     (`inline-src-block
-                      (let* ((info
-                              (org-babel-get-src-block-info nil element))
-                             (params (nth 2 info)))
-                        (setf (nth 1 info)
-                              (if (and (cdr (assq :noweb params))
-                                       (string= "yes"
-                                                (cdr (assq :noweb params))))
-                                  (org-babel-expand-noweb-references
-                                   info org-babel-exp-reference-buffer)
-                                (nth 1 info)))
-                        (goto-char begin)
-                        (let ((replacement
-                               (org-babel-exp-do-export info 'inline)))
-                          (if (equal replacement "")
-                              ;; Replacement code is empty: remove
-                              ;; inline source block, including extra
-                              ;; white space that might have been
-                              ;; created when inserting results.
-                              (delete-region begin
-                                             (progn (goto-char end)
-                                                    (skip-chars-forward " \t")
-                                                    (point)))
-                            ;; Otherwise: remove inline source block
-                            ;; but preserve following white spaces.
-                            ;; Then insert value.
-                            (delete-region begin end)
-                            (insert replacement)))))
-                     ((or `babel-call `inline-babel-call)
-                       (org-babel-exp-do-export
-                        (or (org-babel-lob-get-info element)
-                            (user-error "Unknown Babel reference: %s"
-                                        (org-element-property :call element)))
-                        'lob)
-                      (let ((rep
-                             (org-fill-template
-                              org-babel-exp-call-line-template
-                              `(("line"  .
-                                 ,(org-element-property :value element))))))
-                        ;; If replacement is empty, completely remove
-                        ;; the object/element, including any extra
-                        ;; white space that might have been created
-                        ;; when including results.
-                        (if (equal rep "")
-                            (delete-region
-                             begin
-                             (progn (goto-char end)
-                                    (if (not (eq type 'babel-call))
-                                        (progn (skip-chars-forward " \t")
-                                               (point))
-                                      (skip-chars-forward " \r\t\n")
-                                      (line-beginning-position))))
-                          ;; Otherwise, preserve trailing
-                          ;; spaces/newlines and then, insert
-                          ;; replacement string.
+              ;; We are about to do a large number of changes in
+              ;; buffer, but we do not care about folding in this
+              ;; buffer.
+              (org-fold-core-ignore-modifications
+               (while (re-search-forward regexp nil t)
+                  (setq element (org-element-at-point))
+                 (unless (save-match-data
+                            (or (org-in-commented-heading-p nil element)
+                               (org-in-archived-heading-p nil element)))
+                   (let* ((object? (match-end 1))
+                          (element (save-match-data
+                                     (if object?
+                                          (org-element-context element)
+                                       ;; No deep inspection if we're
+                                       ;; just looking for an element.
+                                        element)))
+                          (type
+                           (pcase (org-element-type element)
+                             ;; Discard block elements if we're looking
+                             ;; for inline objects.  False results
+                             ;; happen when, e.g., "call_" syntax is
+                             ;; located within affiliated keywords:
+                             ;;
+                             ;; #+name: call_src
+                             ;; #+begin_src ...
+                             ((and (or `babel-call `src-block) (guard object?))
+                              nil)
+                             (type type)))
+                          (begin
+                           (copy-marker (org-element-property :begin element)))
+                          (end
+                           (copy-marker
+                            (save-excursion
+                              (goto-char (org-element-property :end element))
+                              (skip-chars-backward " \r\t\n")
+                              (point)))))
+                     (pcase type
+                       (`inline-src-block
+                        (let* ((info
+                                (org-babel-get-src-block-info nil element))
+                               (params (nth 2 info)))
+                          (setf (nth 1 info)
+                                (if (and (cdr (assq :noweb params))
+                                         (string= "yes"
+                                                  (cdr (assq :noweb params))))
+                                    (org-babel-expand-noweb-references
+                                     info org-babel-exp-reference-buffer)
+                                  (nth 1 info)))
                           (goto-char begin)
-                          (delete-region begin end)
-                          (insert rep))))
-                     (`src-block
-                      (let ((match-start (copy-marker (match-beginning 0)))
-                            (ind (current-indentation)))
-                        ;; Take care of matched block: compute
-                        ;; replacement string.  In particular, a nil
-                        ;; REPLACEMENT means the block is left as-is
-                        ;; while an empty string removes the block.
-                        (let ((replacement
-                               (progn (goto-char match-start)
-                                      (org-babel-exp-src-block))))
-                          (cond ((not replacement) (goto-char end))
-                                ((equal replacement "")
-                                 (goto-char end)
-                                 (skip-chars-forward " \r\t\n")
-                                 (beginning-of-line)
-                                 (delete-region begin (point)))
-                                (t
-                                 (goto-char match-start)
-                                 (delete-region (point)
-                                                (save-excursion
-                                                  (goto-char end)
-                                                  (line-end-position)))
-                                 (insert replacement)
-                                 (if (or org-src-preserve-indentation
-                                         (org-element-property
-                                          :preserve-indent element))
-                                     ;; Indent only code block
-                                     ;; markers.
-                                     (save-excursion
-                                       (skip-chars-backward " \r\t\n")
-                                       (indent-line-to ind)
-                                       (goto-char match-start)
-                                       (indent-line-to ind))
-                                   ;; Indent everything.
-                                   (indent-rigidly
-                                    match-start (point) ind)))))
-                        (set-marker match-start nil))))
-                   (set-marker begin nil)
-                   (set-marker end nil)))))
+                          (let ((replacement
+                                 (org-babel-exp-do-export info 'inline)))
+                            (if (equal replacement "")
+                                ;; Replacement code is empty: remove
+                                ;; inline source block, including extra
+                                ;; white space that might have been
+                                ;; created when inserting results.
+                                (delete-region begin
+                                               (progn (goto-char end)
+                                                      (skip-chars-forward " 
\t")
+                                                      (point)))
+                              ;; Otherwise: remove inline source block
+                              ;; but preserve following white spaces.
+                              ;; Then insert value.
+                               (unless (string= replacement
+                                                (buffer-substring begin end))
+                                (delete-region begin end)
+                                (insert replacement))))))
+                       ((or `babel-call `inline-babel-call)
+                         (org-babel-exp-do-export
+                          (or (org-babel-lob-get-info element)
+                              (user-error "Unknown Babel reference: %s"
+                                          (org-element-property :call 
element)))
+                          'lob)
+                        (let ((rep
+                               (org-fill-template
+                                org-babel-exp-call-line-template
+                                `(("line"  .
+                                   ,(org-element-property :value element))))))
+                          ;; If replacement is empty, completely remove
+                          ;; the object/element, including any extra
+                          ;; white space that might have been created
+                          ;; when including results.
+                          (if (equal rep "")
+                              (delete-region
+                               begin
+                               (progn (goto-char end)
+                                      (if (not (eq type 'babel-call))
+                                          (progn (skip-chars-forward " \t")
+                                                 (point))
+                                        (skip-chars-forward " \r\t\n")
+                                        (line-beginning-position))))
+                            ;; Otherwise, preserve trailing
+                            ;; spaces/newlines and then, insert
+                            ;; replacement string.
+                            (goto-char begin)
+                            (delete-region begin end)
+                            (insert rep))))
+                       (`src-block
+                        (let ((match-start (copy-marker (match-beginning 0)))
+                              (ind (org-current-text-indentation)))
+                          ;; Take care of matched block: compute
+                          ;; replacement string.  In particular, a nil
+                          ;; REPLACEMENT means the block is left as-is
+                          ;; while an empty string removes the block.
+                          (let ((replacement
+                                 (progn (goto-char match-start)
+                                        (org-babel-exp-src-block element))))
+                            (cond ((not replacement) (goto-char end))
+                                  ((equal replacement "")
+                                   (goto-char end)
+                                   (skip-chars-forward " \r\t\n")
+                                   (beginning-of-line)
+                                   (delete-region begin (point)))
+                                  (t
+                                   (if (or org-src-preserve-indentation
+                                           (org-element-property
+                                            :preserve-indent element))
+                                       ;; Indent only code block
+                                       ;; markers.
+                                       (with-temp-buffer
+                                          ;; Do not use tabs for block
+                                          ;; indentation.
+                                          (when (fboundp 'indent-tabs-mode)
+                                            (indent-tabs-mode -1)
+                                            ;; FIXME: Emacs 26
+                                            ;; compatibility.
+                                            (setq-local indent-tabs-mode nil))
+                                          (insert replacement)
+                                         (skip-chars-backward " \r\t\n")
+                                         (indent-line-to ind)
+                                         (goto-char 1)
+                                         (indent-line-to ind)
+                                          (setq replacement (buffer-string)))
+                                     ;; Indent everything.
+                                      (with-temp-buffer
+                                        ;; Do not use tabs for block
+                                        ;; indentation.
+                                        (when (fboundp 'indent-tabs-mode)
+                                          (indent-tabs-mode -1)
+                                          ;; FIXME: Emacs 26
+                                          ;; compatibility.
+                                          (setq-local indent-tabs-mode nil))
+                                        (insert replacement)
+                                       (indent-rigidly
+                                        1 (point) ind)
+                                        (setq replacement (buffer-string))))
+                                   (goto-char match-start)
+                                    (let ((rend (save-excursion
+                                                 (goto-char end)
+                                                 (line-end-position))))
+                                      (if (string-equal replacement
+                                                        (buffer-substring 
match-start rend))
+                                          (goto-char rend)
+                                       (delete-region match-start
+                                                      (save-excursion
+                                                        (goto-char end)
+                                                        (line-end-position)))
+                                       (insert replacement))))))
+                          (set-marker match-start nil))))
+                     (set-marker begin nil)
+                     (set-marker end nil))))))
          (kill-buffer org-babel-exp-reference-buffer)
           (remove-text-properties (point-min) (point-max)
                                   '(org-reference nil)))))))
@@ -306,7 +350,7 @@ The function respects the value of the :exports header 
argument."
        (org-babel-exp-code info type)))))
 
 (defcustom org-babel-exp-code-template
-  "#+BEGIN_SRC %lang%switches%flags\n%body\n#+END_SRC"
+  "#+begin_src %lang%switches%flags\n%body\n#+end_src"
   "Template used to export the body of code blocks.
 This template may be customized to include additional information
 such as the code block name, or the values of particular header
@@ -323,7 +367,8 @@ In addition to the keys mentioned above, every header 
argument
 defined for the code block may be used as a key and will be
 replaced with its value."
   :group 'org-babel
-  :type 'string)
+  :type 'string
+  :package-version '(Org . "9.6"))
 
 (defcustom org-babel-exp-inline-code-template
   "src_%lang[%switches%flags]{%body}"
diff --git a/lisp/org/ob-forth.el b/lisp/org/ob-forth.el
index 53088b0706..a67d3384f6 100644
--- a/lisp/org/ob-forth.el
+++ b/lisp/org/ob-forth.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, forth
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -32,6 +32,10 @@
 ;; `forth-mode' which is distributed with gforth (in gforth.el).
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 
diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el
index 9c49aa887c..ad84314fcf 100644
--- a/lisp/org/ob-fortran.el
+++ b/lisp/org/ob-fortran.el
@@ -5,7 +5,7 @@
 ;; Authors: Sergey Litvinov
 ;;       Eric Schulte
 ;; Keywords: literate programming, reproducible research, fortran
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -27,6 +27,10 @@
 ;; Org-Babel support for evaluating fortran code.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 (require 'cc-mode)
diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el
index 895738822d..59913e70fc 100644
--- a/lisp/org/ob-gnuplot.el
+++ b/lisp/org/ob-gnuplot.el
@@ -5,7 +5,7 @@
 ;; Author: Eric Schulte
 ;; Maintainer: Ihor Radchenko <yantar92@gmail.com>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -39,6 +39,10 @@
 ;; - gnuplot-mode :: you can search the web for the latest active one.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 
@@ -94,12 +98,15 @@ code."
               (let* ((first  (car val))
                      (tablep (or (listp first) (symbolp first))))
                 (if tablep val (mapcar 'list val)))
-              (org-babel-temp-file "gnuplot-") params)
+               ;; Make temporary file name stable with respect to data.
+               ;; If we do not do it, :cache argument becomes useless.
+               (org-babel-temp-stable-file (cons val params) "gnuplot-")
+               params)
            (if (and (stringp val)
                     (file-remote-p val)  ;; check if val is a remote file
                     (file-exists-p val)) ;; call to file-exists-p is slow, 
maybe remove it
                (let* ((local-name (concat ;; create a unique filename to avoid 
multiple downloads
-                                   org-babel-temporary-directory
+                                   (org-babel-temp-directory)
                                    "/gnuplot/"
                                    (file-remote-p val 'host)
                                    (org-babel-local-file-name val))))
@@ -135,8 +142,7 @@ code."
            (timefmt (cdr (assq :timefmt params)))
            (time-ind (or (cdr (assq :timeind params))
                          (when timefmt 1)))
-          (directory (and (buffer-file-name)
-                          (file-name-directory (buffer-file-name))))
+          (directory default-directory)
           (add-to-body (lambda (text) (setq body (concat text "\n" body)))))
       ;; append header argument settings to body
       (when missing (funcall add-to-body (format "set datafile missing '%s'" 
missing)))
diff --git a/lisp/org/ob-groovy.el b/lisp/org/ob-groovy.el
index e0e2f2cd2e..f1689ef12d 100644
--- a/lisp/org/ob-groovy.el
+++ b/lisp/org/ob-groovy.el
@@ -2,10 +2,10 @@
 
 ;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
-;; Author: Miro Bezjak
-;; Maintainer: Palak Mathur
+;; Author: Miro Bezjak <bezjak.miro@gmail.com>
+;; Maintainer: Palak Mathur <palakmathur@gmail.com>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -31,6 +31,10 @@
 ;;   https://github.com/russel/Emacs-Groovy-Mode
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-tangle-lang-exts) ;; Autoloaded
@@ -48,7 +52,7 @@ parameters may be used, like groovy -v"
 (defun org-babel-execute:groovy (body params)
   "Execute a block of Groovy code with org-babel.
 This function is called by `org-babel-execute-src-block'."
-  (message "executing Groovy source code block")
+  (message "Executing Groovy source code block")
   (let* ((processed-params (org-babel-process-params params))
          (session (org-babel-groovy-initiate-session (nth 0 processed-params)))
          (result-params (nth 2 processed-params))
diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el
index 45f70fa878..095286c79a 100644
--- a/lisp/org/ob-haskell.el
+++ b/lisp/org/ob-haskell.el
@@ -5,7 +5,7 @@
 ;; Author: Eric Schulte
 ;; Maintainer: Lawrence Bottorff <borgauf@gmail.com>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -39,6 +39,10 @@
 ;; - (optionally) lhs2tex: https://people.cs.uu.nl/andres/lhs2tex/
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 (require 'comint)
@@ -132,7 +136,7 @@ a parameter, such as \"ghc -v\"."
         (comint-preoutput-filter-functions
          (cons 'ansi-color-filter-apply comint-preoutput-filter-functions))
          (raw (org-babel-comint-with-output
-                 (session org-babel-haskell-eoe t full-body)
+                 (session org-babel-haskell-eoe nil full-body)
                 (insert (org-trim full-body))
                 (comint-send-input nil t)
                 (insert org-babel-haskell-eoe)
@@ -146,7 +150,7 @@ a parameter, such as \"ghc -v\"."
               (`output (mapconcat #'identity (reverse results) "\n"))
               (`value (car results)))))
        (org-babel-result-cond (cdr (assq :result-params params))
-        result (org-babel-script-escape result)))
+        result (when result (org-babel-script-escape result))))
      (org-babel-pick-name (cdr (assq :colname-names params))
                          (cdr (assq :colname-names params)))
      (org-babel-pick-name (cdr (assq :rowname-names params))
diff --git a/lisp/org/ob-java.el b/lisp/org/ob-java.el
index 0f6faf446f..59bd487880 100644
--- a/lisp/org/ob-java.el
+++ b/lisp/org/ob-java.el
@@ -6,7 +6,7 @@
 ;;          Dan Davison
 ;; Maintainer: Ian Martins <ianxm@jhu.edu>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -28,6 +28,10 @@
 ;; Org-Babel support for evaluating java source code.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-tangle-lang-exts)
@@ -49,7 +53,13 @@ directory, so we keep that as the default behavior.
 
 [1] https://orgmode.org/manual/Results-of-Evaluation.html";)
 
-(defconst org-babel-header-args:java '((imports . :any))
+(defconst org-babel-header-args:java
+  '((dir       . :any)
+    (classname . :any)
+    (imports   . :any)
+    (cmpflag   . :any)
+    (cmdline   . :any)
+    (cmdarg    . :any))
   "Java-specific header arguments.")
 
 (defcustom org-babel-java-command "java"
@@ -184,13 +194,10 @@ replaced in this string.")
          (packagename (if (string-match-p "\\." fullclassname)
                           (file-name-base fullclassname)))
          ;; the base dir that contains the top level package dir
-         (basedir (file-name-as-directory (if run-from-temp
-                                              (if (file-remote-p 
default-directory)
-                                                  (concat
-                                                   (file-remote-p 
default-directory)
-                                                   
org-babel-remote-temporary-directory)
-                                                org-babel-temporary-directory)
-                                            default-directory)))
+         (basedir (file-name-as-directory
+                   (if run-from-temp
+                       (org-babel-temp-directory)
+                     default-directory)))
          ;; the dir to write the source file
          (packagedir (if (and (not run-from-temp) packagename)
                          (file-name-as-directory
diff --git a/lisp/org/ob-js.el b/lisp/org/ob-js.el
index 4bb379b0b8..04eb77bd4a 100644
--- a/lisp/org/ob-js.el
+++ b/lisp/org/ob-js.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, js
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -38,6 +38,10 @@
 ;;   configuration instructions
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (declare-function run-mozilla "ext:moz" (arg))
diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el
index de69f25fc3..314d24596f 100644
--- a/lisp/org/ob-julia.el
+++ b/lisp/org/ob-julia.el
@@ -4,7 +4,7 @@
 ;; Authors: G. Jay Kerns
 ;; Maintainer: Pedro Bruel <pedro.bruel@gmail.com>
 ;; Keywords: literate programming, reproducible research, scientific computing
-;; Homepage: https://github.com/phrb/ob-julia
+;; URL: https://github.com/phrb/ob-julia
 
 ;; This file is part of GNU Emacs.
 
@@ -31,6 +31,10 @@
 ;; Julia packages.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ob)
 
diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el
index 7253803af9..332ace765b 100644
--- a/lisp/org/ob-latex.el
+++ b/lisp/org/ob-latex.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -30,6 +30,10 @@
 ;; be created directly form the latex source code.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 
@@ -37,6 +41,9 @@
 (declare-function org-latex-compile "ox-latex" (texfile &optional snippet))
 (declare-function org-latex-guess-inputenc "ox-latex" (header))
 (declare-function org-splice-latex-header "org" (tpl def-pkg pkg snippets-p 
&optional extra))
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
 
 (defvar org-babel-tangle-lang-exts)
 (add-to-list 'org-babel-tangle-lang-exts '("latex" . "tex"))
@@ -61,7 +68,6 @@
     (pdfpng       . :any)
     (pdfwidth     . :any)
     (headers      . :any)
-    (packages     . :any)
     (buffer       . ((yes no))))
   "LaTeX-specific header arguments.")
 
@@ -104,10 +110,17 @@ exporting the literal LaTeX source."
   :type 'function)
 
 (defcustom org-babel-latex-pdf-svg-process
-  "inkscape --pdf-poppler %f -T -l -o %O"
+  "inkscape \
+--pdf-poppler \
+--export-area-drawing \
+--export-text-to-path \
+--export-plain-svg \
+--export-filename=%O \
+%f"
   "Command to convert a PDF file to an SVG file."
   :group 'org-babel
-  :type 'string)
+  :type 'string
+  :package-version '(Org . "9.6"))
 
 (defcustom org-babel-latex-htlatex-packages
   '("[usenames]{color}" "{tikz}" "{color}" "{listings}" "{amsmath}")
diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el
index f1ea803ba3..d8016641ce 100644
--- a/lisp/org/ob-lilypond.el
+++ b/lisp/org/ob-lilypond.el
@@ -4,7 +4,7 @@
 
 ;; Author: Martyn Jago
 ;; Keywords: babel language, literate programming
-;; Homepage: 
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
+;; URL: 
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
 
 ;; This file is part of GNU Emacs.
 
@@ -32,9 +32,13 @@
 ;; This depends on epstopdf --- See https://www.ctan.org/pkg/epstopdf.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
-(declare-function org-show-all "org" (&optional types))
+(declare-function org-fold-show-all "org-fold" (&optional types))
 
 ;; FIXME: Doesn't this rather belong in lilypond-mode.el?
 (defalias 'lilypond-mode 'LilyPond-mode)
@@ -108,7 +112,7 @@ you can leave the string empty on this case."
   :package-version '(Org . "8.2.7")
   :set
   (lambda (symbol value)
-    (set symbol value)
+    (set-default-toplevel-value symbol value)
     (setq
      org-babel-lilypond-ly-command   (nth 0 value)
      org-babel-lilypond-pdf-command  (nth 1 value)
@@ -280,7 +284,7 @@ LINE is the erroneous line."
     (setq case-fold-search nil)
     (if (search-forward line nil t)
         (progn
-          (org-show-all)
+          (org-fold-show-all)
           (set-mark (point))
           (goto-char (- (point) (length line))))
       (goto-char temp))))
diff --git a/lisp/org/ob-lisp.el b/lisp/org/ob-lisp.el
index f9d5fed0c8..d3ed569ecd 100644
--- a/lisp/org/ob-lisp.el
+++ b/lisp/org/ob-lisp.el
@@ -6,7 +6,7 @@
 ;;      Eric Schulte
 ;;      David T. O'Toole <dto@gnu.org>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -36,6 +36,10 @@
 ;; - https://common-lisp.net/project/slime/
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 
diff --git a/lisp/org/ob-lob.el b/lisp/org/ob-lob.el
index eecb5c402a..fb27997555 100644
--- a/lisp/org/ob-lob.el
+++ b/lisp/org/ob-lob.el
@@ -5,7 +5,7 @@
 ;; Authors: Eric Schulte
 ;;      Dan Davison
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -23,12 +23,16 @@
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ob-core)
 (require 'ob-table)
 
 (declare-function org-babel-ref-split-args "ob-ref" (arg-string))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
@@ -50,7 +54,7 @@ should not be inherited from a source block.")
   (interactive "fFile: ")
   (let ((lob-ingest-count 0))
     (org-babel-map-src-blocks file
-      (let* ((info (org-babel-get-src-block-info 'light))
+      (let* ((info (org-babel-get-src-block-info 'no-eval))
             (source-name (nth 4 info)))
        (when source-name
          (setf (nth 1 info)
@@ -74,9 +78,10 @@ should not be inherited from a source block.")
 Detect if this is context for a Library Of Babel source block and
 if so then run the appropriate source block from the Library."
   (interactive)
-  (let ((info (org-babel-lob-get-info)))
+  (let* ((datum (org-element-context))
+         (info (org-babel-lob-get-info datum)))
     (when info
-      (org-babel-execute-src-block nil info)
+      (org-babel-execute-src-block nil info nil (org-element-type datum))
       t)))
 
 (defun org-babel-lob--src-info (ref)
@@ -114,11 +119,16 @@ after REF in the Library of Babel."
            (cdr (assoc-string ref org-babel-library-of-babel))))))))
 
 ;;;###autoload
-(defun org-babel-lob-get-info (&optional datum)
+(defun org-babel-lob-get-info (&optional datum no-eval)
   "Return internal representation for Library of Babel function call.
 
 Consider DATUM, when provided, or element at point otherwise.
 
+When optional argument NO-EVAL is non-nil, Babel does not resolve
+remote variable references; a process which could likely result
+in the execution of other code blocks, and do not evaluate Lisp
+values in parameters.
+
 Return nil when not on an appropriate location.  Otherwise return
 a list compatible with `org-babel-get-src-block-info', which
 see."
@@ -139,16 +149,16 @@ see."
                        org-babel-default-lob-header-args
                        (append
                         (org-with-point-at begin
-                          (org-babel-params-from-properties language))
+                          (org-babel-params-from-properties language no-eval))
                         (list
                          (org-babel-parse-header-arguments
-                          (org-element-property :inside-header context))
+                          (org-element-property :inside-header context) 
no-eval)
                          (let ((args (org-element-property :arguments 
context)))
                            (and args
                                 (mapcar (lambda (ref) (cons :var ref))
                                         (org-babel-ref-split-args args))))
                          (org-babel-parse-header-arguments
-                          (org-element-property :end-header context)))))
+                          (org-element-property :end-header context) 
no-eval))))
                 nil
                 (org-element-property :name context)
                 begin
diff --git a/lisp/org/ob-lua.el b/lisp/org/ob-lua.el
index b6e78fb7fd..52aa0599ae 100644
--- a/lisp/org/ob-lua.el
+++ b/lisp/org/ob-lua.el
@@ -4,7 +4,7 @@
 
 ;; Authors: Dieter Schoen
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -35,6 +35,10 @@
 ;; However, sessions are not yet working.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 (require 'cl-lib)
@@ -395,7 +399,7 @@ fd:close()"
         (org-babel-lua-table-or-string results)))))
 
 (defun org-babel-lua-read-string (string)
-  "Strip \\=' characters from around Lua string."
+  "Strip single quotes from around Lua string."
   (org-unbracket-string "'" "'" string))
 
 (provide 'ob-lua)
diff --git a/lisp/org/ob-makefile.el b/lisp/org/ob-makefile.el
index 142e760ea2..194fcdb01b 100644
--- a/lisp/org/ob-makefile.el
+++ b/lisp/org/ob-makefile.el
@@ -5,7 +5,7 @@
 ;; Author: Eric Schulte
 ;;        Thomas S. Dye
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -27,6 +27,10 @@
 ;; This file exists solely for tangling a Makefile from Org files.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-default-header-args:makefile '())
diff --git a/lisp/org/ob-matlab.el b/lisp/org/ob-matlab.el
index f50da0ea43..8e4d02b2a8 100644
--- a/lisp/org/ob-matlab.el
+++ b/lisp/org/ob-matlab.el
@@ -4,7 +4,7 @@
 
 ;; Author: Dan Davison
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -35,6 +35,10 @@
 ;; https://matlab-emacs.sourceforge.net/
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'ob-octave)
 
diff --git a/lisp/org/ob-maxima.el b/lisp/org/ob-maxima.el
index 6bc3427eaf..e3dfbb6684 100644
--- a/lisp/org/ob-maxima.el
+++ b/lisp/org/ob-maxima.el
@@ -5,7 +5,7 @@
 ;; Author: Eric S Fraga
 ;;     Eric Schulte
 ;; Keywords: literate programming, reproducible research, maxima
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -31,6 +31,10 @@
 ;; 2) we are adding the "cmdline" header argument
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-tangle-lang-exts)
@@ -72,13 +76,16 @@
 (defun org-babel-execute:maxima (body params)
   "Execute a block of Maxima entries with org-babel.
 This function is called by `org-babel-execute-src-block'."
-  (message "executing Maxima source code block")
+  (message "Executing Maxima source code block")
   (let ((result-params (split-string (or (cdr (assq :results params)) "")))
        (result
         (let* ((cmdline (or (cdr (assq :cmdline params)) ""))
                (in-file (org-babel-temp-file "maxima-" ".max"))
-               (cmd (format "%s --very-quiet -r 'batchload(%S)$' %s"
-                            org-babel-maxima-command in-file cmdline)))
+               (cmd (format "%s --very-quiet -r %s %s"
+                            org-babel-maxima-command
+                             (shell-quote-argument
+                              (format "batchload(%S)$" in-file))
+                             cmdline)))
           (with-temp-file in-file (insert (org-babel-maxima-expand body 
params)))
           (message cmd)
            ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' "
diff --git a/lisp/org/ob-ocaml.el b/lisp/org/ob-ocaml.el
index 80df79581f..804551ba57 100644
--- a/lisp/org/ob-ocaml.el
+++ b/lisp/org/ob-ocaml.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -35,6 +35,10 @@
 ;; - tuareg-mode :: https://elpa.nongnu.org/nongnu/tuareg.html
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'comint)
 (require 'org-macs)
diff --git a/lisp/org/ob-octave.el b/lisp/org/ob-octave.el
index 9be8f5ad3e..8953b67513 100644
--- a/lisp/org/ob-octave.el
+++ b/lisp/org/ob-octave.el
@@ -4,7 +4,7 @@
 
 ;; Author: Dan Davison
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -29,6 +29,10 @@
 ;; octave-mode.el and octave-inf.el come with GNU emacs
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 
@@ -57,7 +61,7 @@ delete('%s')
 ")
 (defvar org-babel-octave-wrapper-method
   "%s
-if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); 
fclose(fid);
+if ischar(ans), fid = fopen('%s', 'w'); fdisp(fid, ans); fclose(fid);
 else, dlmwrite('%s', ans, '\\t')
 end")
 
@@ -87,7 +91,7 @@ end")
                                 (list
                                  "set (0, \"defaultfigurevisible\", \"off\");"
                                  full-body
-                                 (format "print -dpng %s" gfx-file))
+                                 (format "print -dpng %S\nans=%S" gfx-file 
gfx-file))
                                 "\n")
                    full-body)
                  result-type matlabp)))
diff --git a/lisp/org/ob-org.el b/lisp/org/ob-org.el
index 965b0984ec..df7f85d080 100644
--- a/lisp/org/ob-org.el
+++ b/lisp/org/ob-org.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -27,6 +27,10 @@
 ;; contents of the code block are returned in a raw result.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (declare-function org-export-string-as "ox"
diff --git a/lisp/org/ob-perl.el b/lisp/org/ob-perl.el
index f01feaf294..5762642b78 100644
--- a/lisp/org/ob-perl.el
+++ b/lisp/org/ob-perl.el
@@ -4,9 +4,9 @@
 
 ;; Authors: Dan Davison
 ;;      Eric Schulte
-;; Maintainer: Corwin Brust
+;; Maintainer: Corwin Brust <corwin@bru.st>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -28,6 +28,10 @@
 ;; Org-Babel support for evaluating perl source code.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-tangle-lang-exts)
diff --git a/lisp/org/ob-plantuml.el b/lisp/org/ob-plantuml.el
index 7a495e8e7f..e95db50cd5 100644
--- a/lisp/org/ob-plantuml.el
+++ b/lisp/org/ob-plantuml.el
@@ -4,7 +4,7 @@
 
 ;; Author: Zhang Weize
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -34,6 +34,10 @@
 ;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file (when 
exec mode is `jar')
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-default-header-args:plantuml
@@ -65,8 +69,8 @@ You can also configure extra arguments via 
`org-plantuml-executable-args'."
   :package-version '(Org . "9.4")
   :type 'string)
 
-(defcustom org-plantuml-executable-args (list "-headless")
-  "The arguments passed to plantuml executable when executing PlantUML."
+(defcustom org-plantuml-args (list "-headless")
+  "The arguments passed to plantuml when executing PlantUML."
   :group 'org-babel
   :package-version '(Org . "9.4")
   :type '(repeat string))
@@ -109,21 +113,25 @@ If BODY does not contain @startXXX ... @endXXX clauses, 
@startuml
 (defun org-babel-execute:plantuml (body params)
   "Execute a block of plantuml code with org-babel.
 This function is called by `org-babel-execute-src-block'."
-  (let* ((out-file (or (cdr (assq :file params))
-                      (error "PlantUML requires a \":file\" header argument")))
+  (let* ((do-export (member "file" (cdr (assq :result-params params))))
+         (out-file (if do-export
+                       (or (cdr (assq :file params))
+                           (error "No :file provided but :results set to file. 
For plain text output, set :results to verbatim"))
+                    (org-babel-temp-file "plantuml-" ".txt")))
         (cmdline (cdr (assq :cmdline params)))
         (in-file (org-babel-temp-file "plantuml-"))
         (java (or (cdr (assq :java params)) ""))
         (executable (cond ((eq org-plantuml-exec-mode 'plantuml) 
org-plantuml-executable-path)
                           (t "java")))
-        (executable-args (cond ((eq org-plantuml-exec-mode 'plantuml) 
org-plantuml-executable-args)
+        (executable-args (cond ((eq org-plantuml-exec-mode 'plantuml) 
org-plantuml-args)
                                ((string= "" org-plantuml-jar-path)
                                 (error "`org-plantuml-jar-path' is not set"))
                                ((not (file-exists-p org-plantuml-jar-path))
                                 (error "Could not find plantuml.jar at %s" 
org-plantuml-jar-path))
-                               (t (list java
-                                        "-jar"
-                                        (shell-quote-argument 
(expand-file-name org-plantuml-jar-path))))))
+                               (t `(,java
+                                    "-jar"
+                                    ,(shell-quote-argument (expand-file-name 
org-plantuml-jar-path))
+                                     ,@org-plantuml-args))))
         (full-body (org-babel-plantuml-make-body body params))
         (cmd (mapconcat #'identity
                         (append
@@ -154,7 +162,10 @@ This function is called by `org-babel-execute-src-block'."
     (if (and (string= (file-name-extension out-file) "svg")
              org-babel-plantuml-svg-text-to-path)
         (org-babel-eval (format "inkscape %s -T -l %s" out-file out-file) ""))
-    nil)) ;; signal that output has already been written to file
+    (unless do-export (with-temp-buffer
+                        (insert-file-contents out-file)
+                        (buffer-substring-no-properties
+                         (point-min) (point-max))))))
 
 (defun org-babel-prep-session:plantuml (_session _params)
   "Return an error because plantuml does not support sessions."
diff --git a/lisp/org/ob-processing.el b/lisp/org/ob-processing.el
index f961a99076..644006b9ce 100644
--- a/lisp/org/ob-processing.el
+++ b/lisp/org/ob-processing.el
@@ -3,8 +3,9 @@
 ;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
 
 ;; Author: Jarmo Hurri (adapted from ob-asymptote.el written by Eric Schulte)
+;; Maintainer: Jarmo Hurri <jarmo.hurri@iki.fi>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -50,6 +51,10 @@
 ;; - Processing.js module :: https://processingjs.org/
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'sha1)
 
@@ -88,7 +93,7 @@
          ;; make-temp-file is repeated until no hyphen is in the
          ;; name; also sketch dir name must be the same as the
          ;; basename of the sketch file.
-         (let* ((temporary-file-directory org-babel-temporary-directory)
+         (let* ((temporary-file-directory (org-babel-temp-directory))
                 (sketch-dir
                  (let (sketch-dir-candidate)
                    (while
diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el
index 3e9049e73f..1829ab149a 100644
--- a/lisp/org/ob-python.el
+++ b/lisp/org/ob-python.el
@@ -6,7 +6,7 @@
 ;;      Dan Davison
 ;; Maintainer: Jack Kamm <jackkamm@gmail.com>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -28,12 +28,16 @@
 ;; Org-Babel support for evaluating python source code.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 (require 'python)
 
 (declare-function py-shell "ext:python-mode" (&rest args))
-(declare-function py-toggle-shells "ext:python-mode" (arg))
+(declare-function py-choose-shell "ext:python-mode" (&optional shell))
 (declare-function py-shell-send-string "ext:python-mode" (strg &optional 
process))
 
 (defvar org-babel-tangle-lang-exts)
@@ -178,9 +182,10 @@ Emacs-lisp table, otherwise return the results as a 
string."
        (substring name 1 (- (length name) 1))
       name)))
 
-(defvar py-default-interpreter)
 (defvar py-which-bufname)
 (defvar python-shell-buffer-name)
+(defvar-local org-babel-python--initialized nil
+  "Flag used to mark that python session has been initialized.")
 (defun org-babel-python-initiate-session-by-key (&optional session)
   "Initiate a python session.
 If there is not a current inferior-process-buffer in SESSION
@@ -198,14 +203,20 @@ then create.  Return the initialized session."
        (let ((python-shell-buffer-name
               (org-babel-python-without-earmuffs py-buffer)))
          (run-python cmd)
-         (sleep-for 0 10)))
+          (with-current-buffer py-buffer
+            (add-hook
+             'python-shell-first-prompt-hook
+             (lambda ()
+               (setq-local org-babel-python--initialized t)
+               (message "I am running!!!"))
+             nil 'local))))
        ((and (eq 'python-mode org-babel-python-mode)
             (fboundp 'py-shell)) ; python-mode.el
        (require 'python-mode)
        ;; Make sure that py-which-bufname is initialized, as otherwise
        ;; it will be overwritten the first time a Python buffer is
        ;; created.
-       (py-toggle-shells py-default-interpreter)
+       (py-choose-shell)
        ;; `py-shell' creates a buffer whose name is the value of
        ;; `py-which-bufname' with '*'s at the beginning and end
        (let* ((bufname (if (and py-buffer (buffer-live-p py-buffer))
@@ -217,6 +228,15 @@ then create.  Return the initialized session."
          (py-shell nil nil t org-babel-python-command py-buffer nil nil t 
nil)))
        (t
        (error "No function available for running an inferior Python")))
+      ;; Wait until Python initializes.
+      (if (eq 'python org-babel-python-mode) ; python.el
+          ;; This is more reliable compared to
+          ;; `org-babel-comint-wait-for-output' as python may emit
+          ;; multiple prompts during initialization.
+          (with-current-buffer py-buffer
+            (while (not org-babel-python--initialized)
+              (org-babel-comint-wait-for-output py-buffer)))
+        (org-babel-comint-wait-for-output py-buffer))
       (setq org-babel-python-buffers
            (cons (cons session py-buffer)
                  (assq-delete-all session org-babel-python-buffers)))
diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el
index 21076b67b2..2bba2071ee 100644
--- a/lisp/org/ob-ref.el
+++ b/lisp/org/ob-ref.el
@@ -5,7 +5,7 @@
 ;; Authors: Eric Schulte
 ;;      Dan Davison
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -49,12 +49,16 @@
 ;;  #+end_src
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob-core)
 (require 'org-macs)
 (require 'cl-lib)
 
-(declare-function org-babel-lob-get-info "ob-lob" (&optional datum))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-babel-lob-get-info "ob-lob" (&optional datum no-eval))
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-end-of-meta-data "org" (&optional full))
@@ -62,8 +66,8 @@
 (declare-function org-id-find-id-file "org-id" (id))
 (declare-function org-id-find-id-in-file "org-id" (id file &optional markerp))
 (declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
-(declare-function org-narrow-to-subtree "org" ())
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-narrow-to-subtree "org" (&optional element))
+(declare-function org-fold-show-context "org-fold" (&optional key))
 
 (defvar org-babel-update-intermediate nil
   "Update the in-buffer results of code blocks executed to resolve 
references.")
@@ -104,7 +108,7 @@ Emacs Lisp representation of the value of the variable."
          (pop-to-buffer-same-window (marker-buffer m))
          (goto-char m)
          (move-marker m nil)
-         (org-show-context)
+         (org-fold-show-context)
          t))))
 
 (defun org-babel-ref-headline-body ()
@@ -124,12 +128,14 @@ Emacs Lisp representation of the value of the variable."
       (save-excursion
        (let ((case-fold-search t)
              args new-refere new-header-args new-referent split-file split-ref
-             index)
+             index contents)
          ;; if ref is indexed grab the indices -- beware nested indices
-         (when (and (string-match "\\[\\([^\\[]+\\)\\]$" ref)
+         (when (and (string-match "\\[\\([^\\[]*\\)\\]$" ref)
                     (let ((str (substring ref 0 (match-beginning 0))))
                       (= (cl-count ?\( str) (cl-count ?\) str))))
-           (setq index (match-string 1 ref))
+            (if (> (length (match-string 1 ref)) 0)
+               (setq index (match-string 1 ref))
+              (setq contents t))
            (setq ref (substring ref 0 (match-beginning 0))))
          ;; assign any arguments to pass to source block
          (when (string-match
@@ -153,7 +159,7 @@ Emacs Lisp representation of the value of the variable."
            (setq ref split-ref))
          (org-with-wide-buffer
           (goto-char (point-min))
-          (let* ((params (append args '((:results . "silent"))))
+          (let* ((params (append args '((:results . "none"))))
                  (regexp (org-babel-named-data-regexp-for-name ref))
                  (result
                   (catch :found
@@ -171,7 +177,7 @@ Emacs Lisp representation of the value of the variable."
                                (throw :found
                                       (org-babel-execute-src-block
                                        nil (org-babel-lob-get-info e) params)))
-                              (`src-block
+                              ((and `src-block (guard (not contents)))
                                (throw :found
                                       (org-babel-execute-src-block
                                        nil nil
@@ -193,7 +199,7 @@ Emacs Lisp representation of the value of the variable."
                                (org-babel-execute-src-block nil info params))))
                     (error "Reference `%s' not found in this buffer" ref))))
             (cond
-             ((symbolp result) (format "%S" result))
+             ((and result (symbolp result)) (format "%S" result))
              ((and index (listp result))
               (org-babel-ref-index-list index result))
              (t result)))))))))
diff --git a/lisp/org/ob-ruby.el b/lisp/org/ob-ruby.el
index d35b55ca59..6ece63b4dc 100644
--- a/lisp/org/ob-ruby.el
+++ b/lisp/org/ob-ruby.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -36,6 +36,10 @@
 ;;   https://github.com/eschulte/rinari/raw/master/util/inf-ruby.el
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 
diff --git a/lisp/org/ob-sass.el b/lisp/org/ob-sass.el
index c0f63a9b66..400f9b326e 100644
--- a/lisp/org/ob-sass.el
+++ b/lisp/org/ob-sass.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -38,6 +38,10 @@
 ;; - sass-mode :: https://github.com/nex3/haml/blob/master/extra/sass-mode.el
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-default-header-args:sass '())
diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index 72d2e029e1..cfeb1a0adc 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -5,7 +5,7 @@
 ;; Authors: Eric Schulte
 ;;         Michael Gauland
 ;; Keywords: literate programming, reproducible research, scheme
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -38,6 +38,10 @@
 ;;   ELPA.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'geiser nil t)
 (require 'geiser-impl nil t)
@@ -52,9 +56,12 @@
 (defvar geiser-repl-window-allow-split)        ; Defined in geiser-repl.el
 
 (declare-function run-geiser "ext:geiser-repl" (impl))
+(declare-function geiser "ext:geiser-repl" (impl))
 (declare-function geiser-mode "ext:geiser-mode" ())
 (declare-function geiser-eval-region "ext:geiser-mode"
                   (start end &optional and-go raw nomsg))
+(declare-function geiser-eval-region/wait "ext:geiser-mode"
+                  (start end &optional timeout))
 (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
 (declare-function geiser-eval--retort-output "ext:geiser-eval" (ret))
 (declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret 
prefix))
@@ -114,7 +121,10 @@
   (let ((buffer (org-babel-scheme-get-session-buffer name)))
     (or buffer
        (progn
-         (run-geiser impl)
+          (if (fboundp 'geiser)
+              (geiser impl)
+            ;; Obsolete since Geiser 0.26.
+           (run-geiser impl))
          (when name
            (rename-buffer name t)
            (org-babel-scheme-set-session-buffer name (current-buffer)))
@@ -176,7 +186,13 @@ is true; otherwise returns the last value."
          (setq geiser-impl--implementation nil)
          (let ((geiser-debug-jump-to-debug-p nil)
                (geiser-debug-show-debug-p nil))
-           (let ((ret (geiser-eval-region (point-min) (point-max))))
+            ;; `geiser-eval-region/wait' was introduced to await the
+            ;; result of async evaluation in geiser version 0.22.
+           (let ((ret (funcall (if (fboundp 'geiser-eval-region/wait)
+                                    #'geiser-eval-region/wait
+                                  #'geiser-eval-region)
+                                (point-min)
+                                (point-max))))
              (setq result (if output
                               (or (geiser-eval--retort-output ret)
                                   "Geiser Interpreter produced no output")
diff --git a/lisp/org/ob-screen.el b/lisp/org/ob-screen.el
index 1fc1a34fdf..294a40cbfe 100644
--- a/lisp/org/ob-screen.el
+++ b/lisp/org/ob-screen.el
@@ -3,9 +3,9 @@
 ;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Benjamin Andresen
-;; Maintainer: Ken Mankoff
+;; Maintainer: Ken Mankoff <mankoff@gmail.com>
 ;; Keywords: literate programming, interactive shell
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -34,6 +34,10 @@
 ;; M-x org-babel-screen-test RET
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-screen-location "screen"
diff --git a/lisp/org/ob-sed.el b/lisp/org/ob-sed.el
index 02c2a01742..f9ea2ac0cb 100644
--- a/lisp/org/ob-sed.el
+++ b/lisp/org/ob-sed.el
@@ -35,11 +35,15 @@
 ;; In addition to the normal header arguments, ob-sed also provides
 ;; :cmd-line and :in-file. :cmd-line allows one to pass other flags to
 ;; the sed command like the "--in-place" flag which makes sed edit the
-;; file pass to it instead of outputting to standard out or to a
+;; file passed to it instead of outputting to standard out or to a
 ;; different file. :in-file is a header arguments that allows one to
 ;; tell Org Babel which file the sed script to act on.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (defvar org-babel-sed-command "sed"
@@ -61,7 +65,7 @@
 BODY is the source inside a sed source block and PARAMS is an
 association list over the source block configurations.  This
 function is called by `org-babel-execute-src-block'."
-  (message "executing sed source code block")
+  (message "Executing sed source code block")
   (let* ((result-params (cdr (assq :result-params params)))
          (cmd-line (cdr (assq :cmd-line params)))
          (in-file (cdr (assq :in-file params)))
diff --git a/lisp/org/ob-shell.el b/lisp/org/ob-shell.el
index c25941a44d..d38d2d3353 100644
--- a/lisp/org/ob-shell.el
+++ b/lisp/org/ob-shell.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -26,6 +26,10 @@
 ;; Org-Babel support for evaluating shell source code.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'org-macs)
 (require 'shell)
@@ -42,6 +46,28 @@
 (defvar org-babel-default-header-args:shell '())
 (defvar org-babel-shell-names)
 
+(defconst org-babel-shell-set-prompt-commands
+  '(;; Fish has no PS2 equivalent.
+    ("fish" . "function fish_prompt\n\techo \"%s\"\nend")
+    ;; prompt2 is like PS2 in POSIX shells.
+    ("csh" . "set prompt=\"%s\"\nset prompt2=\"\"")
+    ;; PowerShell, similar to fish, does not have PS2 equivalent.
+    ("posh" . "function prompt { \"%s\" }")
+    ;; PROMPT_COMMAND can override PS1 settings.  Disable it.
+    ;; Disable PS2 to avoid garbage in multi-line inputs.
+    (t . "PROMPT_COMMAND=;PS1=\"%s\";PS2="))
+  "Alist assigning shells with their prompt setting command.
+
+Each element of the alist associates a shell type from
+`org-babel-shell-names' with a template used to create a command to
+change the default prompt.  The template is an argument to `format'
+that will be called with a single additional argument: prompt string.
+
+The fallback association template is defined in (t . \"template\")
+alist element.")
+
+(defvar org-babel-prompt-command)
+
 (defun org-babel-shell-initialize ()
   "Define execution functions associated to shell names.
 This function has to be called whenever `org-babel-shell-names'
@@ -51,7 +77,10 @@ is modified outside the Customize interface."
     (eval `(defun ,(intern (concat "org-babel-execute:" name))
               (body params)
             ,(format "Execute a block of %s commands with Babel." name)
-            (let ((shell-file-name ,name))
+            (let ((shell-file-name ,name)
+                   (org-babel-prompt-command
+                    (or (alist-get ,name org-babel-shell-set-prompt-commands)
+                        (alist-get t org-babel-shell-set-prompt-commands))))
               (org-babel-execute:shell body params))))
     (eval `(defalias ',(intern (concat "org-babel-variable-assignments:" name))
             'org-babel-variable-assignments:shell
@@ -68,7 +97,7 @@ outside the Customize interface."
   :group 'org-babel
   :type '(repeat (string :tag "Shell name: "))
   :set (lambda (symbol value)
-        (set-default symbol value)
+        (set-default-toplevel-value symbol value)
         (org-babel-shell-initialize)))
 
 (defcustom org-babel-shell-results-defaults-to-output t
@@ -206,6 +235,13 @@ var of the same value."
       (mapconcat echo-var var "\n"))
      (t (funcall echo-var var)))))
 
+(defvar org-babel-sh-eoe-indicator "echo 'org_babel_sh_eoe'"
+  "String to indicate that evaluation has completed.")
+(defvar org-babel-sh-eoe-output "org_babel_sh_eoe"
+  "String to indicate that evaluation has completed.")
+(defvar org-babel-sh-prompt "org_babel_sh_prompt> "
+  "String to set prompt in session shell.")
+
 (defun org-babel-sh-initiate-session (&optional session _params)
   "Initiate a session named SESSION according to PARAMS."
   (when (and session (not (string= session "none")))
@@ -213,17 +249,20 @@ var of the same value."
       (or (org-babel-comint-buffer-livep session)
           (progn
            (shell session)
+            ;; Set unique prompt for easier analysis of the output.
+            (org-babel-comint-wait-for-output (current-buffer))
+            (org-babel-comint-input-command
+             (current-buffer)
+             (format org-babel-prompt-command org-babel-sh-prompt))
+            (setq-local comint-prompt-regexp
+                        (concat "^" (regexp-quote org-babel-sh-prompt)
+                                " *"))
            ;; Needed for Emacs 23 since the marker is initially
            ;; undefined and the filter functions try to use it without
            ;; checking.
            (set-marker comint-last-output-start (point))
            (get-buffer (current-buffer)))))))
 
-(defvar org-babel-sh-eoe-indicator "echo 'org_babel_sh_eoe'"
-  "String to indicate that evaluation has completed.")
-(defvar org-babel-sh-eoe-output "org_babel_sh_eoe"
-  "String to indicate that evaluation has completed.")
-
 (defun org-babel-sh-evaluate (session body &optional params stdin cmdline)
   "Pass BODY to the Shell process in BUFFER.
 If RESULT-TYPE equals `output' then return a list of the outputs
@@ -249,32 +288,30 @@ return the value of the last statement in BODY."
              (set-file-modes script-file #o755)
              (with-temp-file stdin-file (insert (or stdin "")))
              (with-temp-buffer
-               (call-process-shell-command
-                (concat (if shebang script-file
-                          (format "%s %s" shell-file-name script-file))
-                        (and cmdline (concat " " cmdline)))
-                stdin-file
-                (current-buffer))
+                (with-connection-local-variables
+                 (apply #'process-file
+                        (if shebang (file-local-name script-file)
+                          shell-file-name)
+                       stdin-file
+                        (current-buffer)
+                        nil
+                        (if shebang (when cmdline (list cmdline))
+                          (list shell-command-switch
+                                (concat (file-local-name script-file)  " " 
cmdline)))))
                (buffer-string))))
           (session                     ; session evaluation
            (mapconcat
             #'org-babel-sh-strip-weird-long-prompt
             (mapcar
              #'org-trim
-             (butlast
+             (butlast ; Remove eoe indicator
               (org-babel-comint-with-output
                   (session org-babel-sh-eoe-output t body)
-                (dolist (line (append (split-string (org-trim body) "\n")
-                                      (list org-babel-sh-eoe-indicator)))
-                  (insert line)
-                  (comint-send-input nil t)
-                  (while (save-excursion
-                           (goto-char comint-last-input-end)
-                           (not (re-search-forward
-                                 comint-prompt-regexp nil t)))
-                    (accept-process-output
-                     (get-buffer-process (current-buffer))))))
-              2))
+                 (insert (org-trim body) "\n"
+                         org-babel-sh-eoe-indicator)
+                (comint-send-input nil t))
+               ;; Remove `org-babel-sh-eoe-indicator' output line.
+              1))
             "\n"))
           ;; External shell script, with or without a predefined
           ;; shebang.
@@ -288,7 +325,7 @@ return the value of the last statement in BODY."
              (set-file-modes script-file #o755)
              (org-babel-eval script-file "")))
           (t (org-babel-eval shell-file-name (org-trim body))))))
-    (when value-is-exit-status
+    (when (and results value-is-exit-status)
       (setq results (car (reverse (split-string results "\n" t)))))
     (when results
       (let ((result-params (cdr (assq :result-params params))))
diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el
index 5f7c0de000..9f4fa1d786 100644
--- a/lisp/org/ob-sql.el
+++ b/lisp/org/ob-sql.el
@@ -3,8 +3,9 @@
 ;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
+;; Maintainer: Daniel Kraus <daniel@kraus.my>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -69,6 +70,10 @@
 ;;
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 
 (declare-function org-table-import "org-table" (file arg))
@@ -218,18 +223,18 @@ then look for the parameter into the corresponding 
connection
 defined in `sql-connection-alist', otherwise look into PARAMS.
 See `sql-connection-alist' (part of SQL mode) for how to define
 database connections."
-  (if (assq :dbconnection params)
-      (let* ((dbconnection (cdr (assq :dbconnection params)))
-             (name-mapping '((:dbhost . sql-server)
-                             (:dbport . sql-port)
-                             (:dbuser . sql-user)
-                             (:dbpassword . sql-password)
-                             (:dbinstance . sql-dbinstance)
-                             (:database . sql-database)))
-             (mapped-name (cdr (assq name name-mapping))))
-        (cadr (assq mapped-name
-                    (cdr (assoc dbconnection sql-connection-alist)))))
-    (cdr (assq name params))))
+  (or (cdr (assq name params))
+      (and (assq :dbconnection params)
+           (let* ((dbconnection (cdr (assq :dbconnection params)))
+                  (name-mapping '((:dbhost . sql-server)
+                                  (:dbport . sql-port)
+                                  (:dbuser . sql-user)
+                                  (:dbpassword . sql-password)
+                                  (:dbinstance . sql-dbinstance)
+                                  (:database . sql-database)))
+                  (mapped-name (cdr (assq name name-mapping))))
+             (cadr (assq mapped-name
+                         (cdr (assoc dbconnection sql-connection-alist))))))))
 
 (defun org-babel-execute:sql (body params)
   "Execute a block of Sql code with Babel.
diff --git a/lisp/org/ob-sqlite.el b/lisp/org/ob-sqlite.el
index aeda6faaa3..f22f9883f1 100644
--- a/lisp/org/ob-sqlite.el
+++ b/lisp/org/ob-sqlite.el
@@ -3,9 +3,9 @@
 ;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
-;; Maintainer: Nick Savage
+;; Maintainer: Nick Savage <nick@nicksavage.ca>
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -27,6 +27,10 @@
 ;; Org-Babel support for evaluating sqlite source code.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob)
 (require 'ob-sql)
 
diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el
index f6729e0ece..e14117cd3b 100644
--- a/lisp/org/ob-table.el
+++ b/lisp/org/ob-table.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -53,6 +53,10 @@
 ;; are optional.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ob-core)
 (require 'org-macs)
 
@@ -108,44 +112,43 @@ as shown in the example below.
               ;; ensure that all cells prefixed with $'s are strings
               (cons (car var)
                     (delq nil (mapcar
-                               (lambda (el)
-                                 (if (eq '$ el)
-                                     (prog1 nil (setq quote t))
-                                   (prog1
-                                       (cond
-                                        (quote (format "\"%s\"" el))
-                                        ((stringp el) (org-no-properties el))
-                                        (t el))
-                                     (setq quote nil))))
-                               (cdr var)))))
+                             (lambda (el)
+                               (if (eq '$ el)
+                                   (prog1 nil (setq quote t))
+                                 (prog1
+                                     (cond
+                                      (quote (format "\"%s\"" el))
+                                      ((stringp el) (org-no-properties el))
+                                      (t el))
+                                   (setq quote nil))))
+                             (cdr var)))))
             variables)))
       (unless (stringp source-block)
        (setq source-block (symbol-name source-block)))
-      (let ((result
-             (if (and source-block (> (length source-block) 0))
-                 (let ((params
-                        ;; FIXME: Why `eval'?!?!?
-                        (eval `(org-babel-parse-header-arguments
-                                (concat
-                                 ":var results="
-                                 ,source-block
-                                 "[" ,header-args "]"
-                                 "("
-                                 (mapconcat
-                                  (lambda (var-spec)
-                                    (if (> (length (cdr var-spec)) 1)
-                                        (format "%S='%S"
-                                                (car var-spec)
-                                                (mapcar #'read (cdr var-spec)))
-                                      (format "%S=%s"
-                                              (car var-spec) (cadr var-spec))))
-                                  ',variables ", ")
-                                 ")")))))
-                   (org-babel-execute-src-block
-                    nil (list "emacs-lisp" "results" params)
-                    '((:results . "silent"))))
-               "")))
-        (org-trim (if (stringp result) result (format "%S" result)))))))
+      `(let ((result
+              (if ,(and source-block (> (length source-block) 0))
+                  (let ((params
+                         ',(org-babel-parse-header-arguments
+                            (concat
+                             ":var results="
+                             source-block
+                             "[" header-args "]"
+                             "("
+                             (mapconcat
+                              (lambda (var-spec)
+                                (if (> (length (cdr var-spec)) 1)
+                                    (format "%S='%S"
+                                            (car var-spec)
+                                            (mapcar #'read (cdr var-spec)))
+                                  (format "%S=%s"
+                                          (car var-spec) (cadr var-spec))))
+                              variables ", ")
+                             ")"))))
+                    (org-babel-execute-src-block
+                     nil (list "emacs-lisp" "results" params)
+                     '((:results . "silent"))))
+                "")))
+         (org-trim (if (stringp result) result (format "%S" result)))))))
 
 (provide 'ob-table)
 
diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el
index d9814a7aa6..bd17bda32b 100644
--- a/lisp/org/ob-tangle.el
+++ b/lisp/org/ob-tangle.el
@@ -4,7 +4,7 @@
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -27,6 +27,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org-src)
 (require 'org-macs)
@@ -37,7 +40,10 @@
 (declare-function org-babel-update-block-body "ob-core" (new-body))
 (declare-function org-back-to-heading "org" (&optional invisible-ok))
 (declare-function org-before-first-heading-p "org" ())
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element--cache-active-p "org-element" ())
+(declare-function org-element-lineage "org-element" (datum &optional types 
with-self))
+(declare-function org-element-property "org-element" (property element))
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-heading-components "org" ())
 (declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
@@ -45,6 +51,11 @@
 (declare-function outline-previous-heading "outline" ())
 (defvar org-id-link-to-org-use-id) ; Dynamically scoped
 
+(defgroup org-babel-tangle nil
+  "Options for extracting source code from code blocks."
+  :tag "Org Babel Tangle"
+  :group 'org-babel)
+
 (defcustom org-babel-tangle-lang-exts
   '(("emacs-lisp" . "el")
     ("elisp" . "el"))
@@ -67,22 +78,29 @@ then the name of the language is used."
 
 (defcustom org-babel-post-tangle-hook nil
   "Hook run in code files tangled by `org-babel-tangle'."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'hook)
 
 (defcustom org-babel-pre-tangle-hook '(save-buffer)
-  "Hook run at the beginning of `org-babel-tangle'."
-  :group 'org-babel
+  "Hook run at the beginning of `org-babel-tangle' in the original buffer."
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'hook)
 
 (defcustom org-babel-tangle-body-hook nil
   "Hook run over the contents of each code block body."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'hook)
 
+(defcustom org-babel-tangle-finished-hook nil
+  "Hook run at the very end of `org-babel-tangle' in the original buffer.
+In this way, it is the counterpart to `org-babel-pre-tangle-hook'."
+  :group 'org-babel-tangle
+  :package-version '(Org . "9.6")
+  :type 'hook)
+
 (defcustom org-babel-tangle-comment-format-beg "[[%link][%source-name]]"
   "Format of inserted comments in tangled code files.
 The following format strings can be used to insert special
@@ -99,7 +117,7 @@ non-nil value.
 
 Whether or not comments are inserted during tangling is
 controlled by the :comments header argument."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'string)
 
@@ -119,7 +137,7 @@ non-nil value.
 
 Whether or not comments are inserted during tangling is
 controlled by the :comments header argument."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'string)
 
@@ -128,7 +146,7 @@ controlled by the :comments header argument."
 of tangle comments.  Use `org-babel-tangle-comment-format-beg'
 and `org-babel-tangle-comment-format-end' to customize the format
 of tangled comments."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :type 'boolean)
 
 (defcustom org-babel-process-comment-text 'org-remove-indentation
@@ -136,10 +154,18 @@ of tangled comments."
 inserted as comments in tangled source-code files.  The function
 should take a single string argument and return a string
 result.  The default value is `org-remove-indentation'."
-  :group 'org-babel
+  :group 'org-babel-tangle
   :version "24.1"
   :type 'function)
 
+(defcustom org-babel-tangle-default-file-mode #o544
+  "The default mode used for tangled files, as an integer.
+The default value 356 correspands to the octal #o544, which is
+read-write permissions for the user, read-only for everyone else."
+  :group 'org-babel-tangle
+  :package-version '(Org . "9.6")
+  :type 'integer)
+
 (defun org-babel-find-file-noselect-refresh (file)
   "Find file ensuring that the latest changes on disk are
 represented in the file."
@@ -177,7 +203,7 @@ export file for all source blocks.
 Optional argument LANG-RE can be used to limit the exported
 source code blocks by languages matching a regular expression.
 
-Return a list whose CAR is the tangled file name."
+Return list of the tangled file names."
   (interactive "fFile to tangle: \nP")
   (let* ((visited (find-buffer-visiting file))
          (buffer (or visited (find-file-noselect file))))
@@ -199,7 +225,7 @@ Return a list whose CAR is the tangled file name."
 (defun org-babel-tangle (&optional arg target-file lang-re)
   "Write code blocks to source-specific files.
 Extract the bodies of all source code blocks from the current
-file into their own source-specific files.
+file into their own source-specific files.  Return the list of files.
 With one universal prefix argument, only tangle the block at point.
 When two universal prefix arguments, only tangle blocks for the
 tangle file of the block at point.
@@ -225,7 +251,7 @@ matching a regular expression."
               org-babel-default-header-args))
            (tangle-file
             (when (equal arg '(16))
-              (or (cdr (assq :tangle (nth 2 (org-babel-get-src-block-info 
'light))))
+              (or (cdr (assq :tangle (nth 2 (org-babel-get-src-block-info 
'no-eval))))
                   (user-error "Point is not in a source code block"))))
            path-collector)
        (mapc ;; map over file-names
@@ -254,7 +280,7 @@ matching a regular expression."
                        (when she-bang
                          (unless tangle-mode (setq tangle-mode #o755)))
                        (when tangle-mode
-                         (add-to-list 'modes tangle-mode))
+                         (add-to-list 'modes (org-babel-interpret-file-mode 
tangle-mode)))
                        ;; Possibly create the parent directories for file.
                        (let ((m (funcall get-spec :mkdirp)))
                          (and m fnd (not (string= m "no"))
@@ -271,11 +297,24 @@ matching a regular expression."
                    lspecs)
                   (when make-dir
                     (make-directory fnd 'parents))
-                   ;; erase previous file
-                   (when (file-exists-p file-name)
-                     (delete-file file-name))
-                  (write-region nil nil file-name)
-                  (mapc (lambda (mode) (set-file-modes file-name mode)) modes)
+                   (unless
+                       (and (file-exists-p file-name)
+                            (let ((tangle-buf (current-buffer)))
+                              (with-temp-buffer
+                                (insert-file-contents file-name)
+                                (and
+                                 (equal (buffer-size)
+                                        (buffer-size tangle-buf))
+                                 (= 0
+                                    (let (case-fold-search)
+                                      (compare-buffer-substrings
+                                       nil nil nil
+                                       tangle-buf nil nil)))))))
+                     ;; erase previous file
+                     (when (file-exists-p file-name)
+                       (delete-file file-name))
+                    (write-region nil nil file-name)
+                    (mapc (lambda (mode) (set-file-modes file-name mode)) 
modes))
                    (push file-name path-collector))))))
         (if (equal arg '(4))
             (org-babel-tangle-single-block 1 t)
@@ -295,8 +334,39 @@ matching a regular expression."
             (org-babel-with-temp-filebuffer file
               (run-hooks 'org-babel-post-tangle-hook)))
           path-collector))
+        (run-hooks 'org-babel-tangle-finished-hook)
        path-collector))))
 
+(defun org-babel-interpret-file-mode (mode)
+  "Determine the integer representation of a file MODE specification.
+The following forms are currently recognized:
+- an integer (returned without modification)
+- \"o755\" (chmod style octal)
+- \"rwxrw-r--\" (ls style specification)
+- \"a=rw,u+x\" (chmod style) *
+
+* The interpretation of these forms relies on `file-modes-symbolic-to-number',
+  and uses `org-babel-tangle-default-file-mode' as the base mode."
+  (cond
+   ((integerp mode)
+    (if (string-match-p "^[0-7][0-7][0-7]$" (format "%o" mode))
+        mode
+      (user-error "%1$o is not a valid file mode octal. \
+Did you give the decimal value %1$d by mistake?" mode)))
+   ((not (stringp mode))
+    (error "File mode %S not recognized as a valid format." mode))
+   ((string-match-p "^o0?[0-7][0-7][0-7]$" mode)
+    (string-to-number (replace-regexp-in-string "^o" "" mode) 8))
+   ((string-match-p 
"^[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\(,[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\)*$" 
mode)
+    ;; Match regexp taken from `file-modes-symbolic-to-number'.
+    (file-modes-symbolic-to-number mode org-babel-tangle-default-file-mode))
+   ((string-match-p "^[r-][w-][xs-][r-][w-][xs-][r-][w-][x-]$" mode)
+    (file-modes-symbolic-to-number (concat  "u=" (substring mode 0 3)
+                                            ",g=" (substring mode 3 6)
+                                            ",o=" (substring mode 6 9))
+                                   0))
+   (t (error "File mode %S not recognized as a valid format. See 
`org-babel-interpret-file-mode'." mode))))
+
 (defun org-babel-tangle-clean ()
   "Remove comments inserted by `org-babel-tangle'.
 Call this function inside of a source-code file generated by
@@ -387,14 +457,16 @@ code blocks by target file."
   (let ((counter 0) last-heading-pos blocks)
     (org-babel-map-src-blocks (buffer-file-name)
       (let ((current-heading-pos
-            (org-with-wide-buffer
-             (org-with-limited-levels (outline-previous-heading)))))
+             (if (org-element--cache-active-p)
+                 (or (org-element-property :begin (org-element-lineage 
(org-element-at-point) '(headline) t)) 1)
+              (org-with-wide-buffer
+               (org-with-limited-levels (outline-previous-heading))))))
        (if (eq last-heading-pos current-heading-pos) (cl-incf counter)
          (setq counter 1)
          (setq last-heading-pos current-heading-pos)))
       (unless (or (org-in-commented-heading-p)
                  (org-in-archived-heading-p))
-       (let* ((info (org-babel-get-src-block-info 'light))
+       (let* ((info (org-babel-get-src-block-info 'no-eval))
               (src-lang (nth 0 info))
               (src-tfile (cdr (assq :tangle (nth 2 info)))))
          (unless (or (string= src-tfile "no")
@@ -413,6 +485,33 @@ code blocks by target file."
     (mapcar (lambda (b) (cons (car b) (nreverse (cdr b))))
            (nreverse blocks))))
 
+(defun org-babel-tangle--unbracketed-link (params)
+  "Get a raw link to the src block at point, without brackets.
+
+The PARAMS are the 3rd element of the info for the same src block."
+  (unless (string= "no" (cdr (assq :comments params)))
+    (save-match-data
+      (let* (;; The created link is transient.  Using ID is not necessary,
+             ;; but could have side-effects if used.  An ID property may
+             ;; be added to existing entries thus creating unexpected file
+             ;; modifications.
+             (org-id-link-to-org-use-id nil)
+             (l (org-no-properties
+                 (cl-letf (((symbol-function 'org-store-link-functions)
+                            (lambda () nil)))
+                   (org-store-link nil))))
+             (bare (and (string-match org-link-bracket-re l)
+                        (match-string 1 l))))
+        (when bare
+          (if (and org-babel-tangle-use-relative-file-links
+                   (string-match org-link-types-re bare)
+                   (string= (match-string 1 bare) "file"))
+              (concat "file:"
+                      (file-relative-name (substring bare (match-end 0))
+                                          (file-name-directory
+                                           (cdr (assq :tangle params)))))
+            bare))))))
+
 (defun org-babel-tangle-single-block (block-counter &optional only-this-block)
   "Collect the tangled source for current block.
 Return the list of block attributes needed by
@@ -429,16 +528,7 @@ non-nil, return the full association list to be used by
         (extra (nth 3 info))
          (coderef (nth 6 info))
         (cref-regexp (org-src-coderef-regexp coderef))
-        (link (let* (
-                      ;; The created link is transient.  Using ID is
-                      ;; not necessary, but could have side-effects if
-                      ;; used.  An ID property may be added to
-                      ;; existing entries thus creating unexpected file
-                      ;; modifications.
-                      (org-id-link-to-org-use-id nil)
-                      (l (org-no-properties (org-store-link nil))))
-                 (and (string-match org-link-bracket-re l)
-                      (match-string 1 l))))
+        (link (org-babel-tangle--unbracketed-link params))
         (source-name
          (or (nth 4 info)
              (format "%s:%d"
@@ -451,7 +541,9 @@ non-nil, return the full association list to be used by
         (body
          ;; Run the tangle-body-hook.
           (let ((body (if (org-babel-noweb-p params :tangle)
-                         (org-babel-expand-noweb-references info)
+                          (if (string= "strip-tangle" (cdr (assq :noweb (nth 2 
info))))
+                            (replace-regexp-in-string (org-babel-noweb-wrap) 
"" (nth 1 info))
+                           (org-babel-expand-noweb-references info))
                        (nth 1 info))))
            (with-temp-buffer
              (insert
@@ -486,19 +578,13 @@ non-nil, return the full association list to be used by
                         (match-end 0)
                       (point-min))))
              (point)))))
+         (src-tfile (cdr (assq :tangle params)))
         (result
          (list start-line
                (if org-babel-tangle-use-relative-file-links
                    (file-relative-name file)
                  file)
-               (if (and org-babel-tangle-use-relative-file-links
-                        (string-match org-link-types-re link)
-                        (string= (match-string 1 link) "file"))
-                   (concat "file:"
-                           (file-relative-name (substring link (match-end 0))
-                                               (file-name-directory
-                                                (cdr (assq :tangle params)))))
-                 link)
+               link
                source-name
                params
                (if org-src-preserve-indentation
@@ -506,8 +592,7 @@ non-nil, return the full association list to be used by
                  (org-trim (org-remove-indentation body)))
                comment)))
     (if only-this-block
-        (let* ((src-tfile (cdr (assq :tangle (nth 4 result))))
-               (file-name (org-babel-effective-tangled-filename
+        (let* ((file-name (org-babel-effective-tangled-filename
                            (nth 1 result) src-lang src-tfile)))
           (list (cons file-name (list (cons src-lang result)))))
       result)))
@@ -516,19 +601,13 @@ non-nil, return the full association list to be used by
   "Return a list of begin and end link comments for the code block at point.
 INFO, when non nil, is the source block information, as returned
 by `org-babel-get-src-block-info'."
-  (let ((link-data (pcase (or info (org-babel-get-src-block-info 'light))
-                    (`(,_ ,_ ,_ ,_ ,name ,start ,_)
+  (let ((link-data (pcase (or info (org-babel-get-src-block-info 'no-eval))
+                    (`(,_ ,_ ,params ,_ ,name ,start ,_)
                      `(("start-line" . ,(org-with-point-at start
                                           (number-to-string
                                            (line-number-at-pos))))
                        ("file" . ,(buffer-file-name))
-                       ("link" . ,(let (;; The created link is transient.  
Using ID is
-                                         ;; not necessary, but could have 
side-effects if
-                                         ;; used.  An ID property may be added 
to
-                                         ;; existing entries thus creating 
unexpected file
-                                         ;; modifications.
-                                         (org-id-link-to-org-use-id nil))
-                                     (org-no-properties (org-store-link nil))))
+                       ("link" . ,(org-babel-tangle--unbracketed-link params))
                        ("source-name" . ,name))))))
     (list (org-fill-template org-babel-tangle-comment-format-beg link-data)
          (org-fill-template org-babel-tangle-comment-format-end link-data))))
diff --git a/lisp/org/ob.el b/lisp/org/ob.el
index 785eccf964..83fc5b23e1 100644
--- a/lisp/org/ob.el
+++ b/lisp/org/ob.el
@@ -4,7 +4,7 @@
 
 ;; Authors: Eric Schulte
 ;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -22,6 +22,10 @@
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org-macs)
 (require 'org-compat)
 (require 'org-keys)
diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el
index 398d2e2d3f..3ef7a37e3b 100644
--- a/lisp/org/oc-basic.el
+++ b/lisp/org/oc-basic.el
@@ -66,6 +66,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'bibtex)
 (require 'json)
 (require 'map)
@@ -222,6 +225,10 @@ Return a hash table with citation references as keys and 
fields alist as values.
   (let ((entries (make-hash-table :test #'equal))
         (bibtex-sort-ignore-string-entries t))
     (bibtex-set-dialect dialect t)
+    ;; Throw an error if bibliography is malformed.
+    (unless (bibtex-validate)
+      (user-error "Malformed bibliography at %S"
+                  (or (buffer-file-name) (current-buffer))))
     (bibtex-map-entries
      (lambda (key &rest _)
        ;; Normalize entries: field names are turned into symbols
@@ -237,7 +244,11 @@ Return a hash table with citation references as keys and 
fields alist as values.
                       (cons
                        (intern (downcase field))
                        (replace-regexp-in-string "[ \t\n]+" " " value)))))
-                 (bibtex-parse-entry t))
+                 ;; Parse, substituting the @string replacements.
+                 ;; See Emacs bug#56475 discussion.
+                 (let ((bibtex-string-files `(,(buffer-file-name)))
+                       (bibtex-expand-strings t))
+                   (bibtex-parse-entry t)))
                 entries)))
     entries))
 
@@ -266,21 +277,26 @@ Optional argument INFO is the export state, as a property 
list."
             (when (or (org-file-has-changed-p file)
                       (not (gethash file org-cite-basic--file-id-cache)))
               (insert-file-contents file)
+              (set-visited-file-name file t)
               (puthash file (org-buffer-hash) org-cite-basic--file-id-cache))
-           (let* ((file-id (cons file (gethash file 
org-cite-basic--file-id-cache)))
-                   (entries
-                    (or (cdr (assoc file-id 
org-cite-basic--bibliography-cache))
-                        (let ((table
-                               (pcase (file-name-extension file)
-                                 ("json" (org-cite-basic--parse-json))
-                                 ("bib" (org-cite-basic--parse-bibtex 
'biblatex))
-                                 ("bibtex" (org-cite-basic--parse-bibtex 
'BibTeX))
-                                 (ext
-                                  (user-error "Unknown bibliography extension: 
%S"
-                                              ext)))))
-                          (push (cons file-id table) 
org-cite-basic--bibliography-cache)
-                          table))))
-              (push (cons file entries) results)))))
+            (condition-case nil
+                (unwind-protect
+                   (let* ((file-id (cons file (gethash file 
org-cite-basic--file-id-cache)))
+                           (entries
+                            (or (cdr (assoc file-id 
org-cite-basic--bibliography-cache))
+                                (let ((table
+                                       (pcase (file-name-extension file)
+                                         ("json" (org-cite-basic--parse-json))
+                                         ("bib" (org-cite-basic--parse-bibtex 
'biblatex))
+                                         ("bibtex" 
(org-cite-basic--parse-bibtex 'BibTeX))
+                                         (ext
+                                          (user-error "Unknown bibliography 
extension: %S"
+                                                      ext)))))
+                                  (push (cons file-id table) 
org-cite-basic--bibliography-cache)
+                                  table))))
+                      (push (cons file entries) results))
+                  (set-visited-file-name nil t))
+              (error (setq org-cite-basic--file-id-cache nil))))))
       (when info (plist-put info :cite-basic/bibliography results))
       results)))
 
@@ -333,6 +349,20 @@ non-nil."
         (org-export-raw-string value)
       value)))
 
+(defun org-cite-basic--shorten-names (names)
+  "Return a list of family names from a list of full NAMES.
+
+To better accomomodate corporate names, this will only shorten
+personal names of the form \"family, given\"."
+  (when (stringp names)
+    (mapconcat
+     (lambda (name)
+       (if (eq 1 (length name))
+           (cdr (split-string name))
+         (car (split-string name ", "))))
+     (split-string names " and ")
+     ", ")))
+
 (defun org-cite-basic--number-to-suffix (n)
   "Compute suffix associated to number N.
 This is used for disambiguation."
@@ -349,6 +379,17 @@ This is used for disambiguation."
                         ((= n 27) (throw :complete (cons 0 (cons 0 result))))
                         (t nil))))))))
 
+(defun org-cite-basic--get-author (entry-or-key &optional info raw)
+  "Return author associated to ENTRY-OR-KEY.
+
+ENTRY-OR-KEY, INFO and RAW arguments are the same arguments as
+used in `org-cite-basic--get-field', which see.
+
+Author is obtained from the \"author\" field, if available, or
+from the \"editor\" field otherwise."
+  (or (org-cite-basic--get-field 'author entry-or-key info raw)
+      (org-cite-basic--get-field 'editor entry-or-key info raw)))
+
 (defun org-cite-basic--get-year (entry-or-key info &optional no-suffix)
   "Return year associated to ENTRY-OR-KEY.
 
@@ -372,7 +413,7 @@ necessary, unless optional argument NO-SUFFIX is non-nil."
   ;; KEY-SUFFIX-ALIST is an association (KEY . SUFFIX), where KEY is
   ;; the cite key, as a string, and SUFFIX is the generated suffix
   ;; string, or the empty string.
-  (let* ((author (org-cite-basic--get-field 'author entry-or-key info 'raw))
+  (let* ((author (org-cite-basic--get-author entry-or-key info 'raw))
          (year
           (or (org-cite-basic--get-field 'year entry-or-key info 'raw)
               (let ((date
@@ -408,7 +449,7 @@ necessary, unless optional argument NO-SUFFIX is non-nil."
   "Format ENTRY according to STYLE string.
 ENTRY is an alist, as returned by `org-cite-basic--get-entry'.
 Optional argument INFO is the export state, as a property list."
-  (let ((author (org-cite-basic--get-field 'author entry info))
+  (let ((author (org-cite-basic--get-author entry info))
         (title (org-cite-basic--get-field 'title entry info))
         (from
          (or (org-cite-basic--get-field 'publisher entry info)
@@ -419,7 +460,8 @@ Optional argument INFO is the export state, as a property 
list."
       ("plain"
        (let ((year (org-cite-basic--get-year entry info 'no-suffix)))
          (org-cite-concat
-          author ". " title (and from (list ", " from)) ", " year ".")))
+          (org-cite-basic--shorten-names author) ". "
+          title (and from (list ", " from)) ", " year ".")))
       ("numeric"
        (let ((n (org-cite-basic--key-number (cdr (assq 'id entry)) info))
              (year (org-cite-basic--get-year entry info 'no-suffix)))
@@ -460,13 +502,15 @@ substitutes for the unknown key.  Finally, it may be the 
symbol
         (_
          (lambda ()
            (interactive)
-           (goto-char beg)
-           (delete-region beg end)
-           (insert "@"
-                   (if (= 1 (length suggestions))
-                       (car suggestions)
-                     (completing-read "Did you mean: "
-                                      suggestions nil t)))))))
+           (save-excursion
+             (goto-char beg)
+             (delete-region beg end)
+             (insert
+              "@"
+              (if (= 1 (length suggestions))
+                  (car suggestions)
+                (completing-read "Did you mean: "
+                                 suggestions nil t))))))))
     (put-text-property beg end 'keymap km)))
 
 (defun org-cite-basic-activate (citation)
@@ -536,7 +580,7 @@ INFO is the export state, as a property list."
                      (suffix (org-element-property :suffix ref)))
                  (funcall format-ref
                           prefix
-                          (org-cite-basic--get-field 'author k info)
+                          (org-cite-basic--get-author k info)
                           (org-cite-basic--get-year k info)
                           suffix)))
              (org-cite-get-references citation)
@@ -575,7 +619,7 @@ INFO is the export state as a property list."
 INFO is the export state, as a property list."
   (and field
        (lambda (a b)
-         (org-string-collate-lessp
+         (string-collate-lessp
           (org-cite-basic--get-field field a info 'raw)
           (org-cite-basic--get-field field b info 'raw)
           nil t))))
@@ -608,7 +652,7 @@ export communication channel, as a property list."
          (org-export-data
           (mapconcat
            (lambda (key)
-             (let ((author (org-cite-basic--get-field 'author key info)))
+             (let ((author (org-cite-basic--get-author key info)))
                (if caps (capitalize author) author)))
            (org-cite-get-references citation t)
            org-cite-basic-author-year-separator)
@@ -669,15 +713,17 @@ KEYS is the list of cited keys, as strings.  STYLE is the 
expected bibliography
 style, as a string.  BACKEND is the export back-end, as a symbol.  INFO is the
 export state, as a property list."
   (mapconcat
-   (lambda (k)
-     (let ((entry (org-cite-basic--get-entry k info)))
-       (org-export-data
-        (org-cite-make-paragraph
-         (and (org-export-derived-backend-p backend 'latex)
-              (org-export-raw-string "\\noindent\n"))
-         (org-cite-basic--print-entry entry style info))
-        info)))
-   (org-cite-basic--sort-keys keys info)
+   (lambda (entry)
+     (org-export-data
+      (org-cite-make-paragraph
+       (and (org-export-derived-backend-p backend 'latex)
+            (org-export-raw-string "\\noindent\n"))
+       (org-cite-basic--print-entry entry style info))
+      info))
+   (delq nil
+         (mapcar
+          (lambda (k) (org-cite-basic--get-entry k info))
+          (org-cite-basic--sort-keys keys info)))
    "\n"))
 
 
@@ -750,7 +796,7 @@ Return nil if there are no bibliography files or no 
entries."
                        (list :cite-basic/bibliography entries)))
                (completion
                 (concat
-                 (let ((author (org-cite-basic--get-field 'author entry nil 
'raw)))
+                 (let ((author (org-cite-basic--get-author entry nil 'raw)))
                    (if author
                        (truncate-string-to-width
                         (replace-regexp-in-string " and " "; " author)
diff --git a/lisp/org/oc-biblatex.el b/lisp/org/oc-biblatex.el
index 174725b424..e8f677b7a0 100644
--- a/lisp/org/oc-biblatex.el
+++ b/lisp/org/oc-biblatex.el
@@ -41,7 +41,7 @@
 ;;
 ;; - author (a), including caps (c), full (f) and caps-full (cf) variants,
 ;; - locators (l), including bare (b), caps (c) and bare-caps (bc) variants,
-;; - noauthor (na),
+;; - noauthor (na), including bare (b) variant,
 ;; - nocite (n),
 ;; - text (t), including caps (c) variant,
 ;; - default style, including bare (b), caps (c) and bare-caps (bc) variants.
@@ -62,12 +62,16 @@
 ;;    #+print_bibliography: :keyword abc,xyz :title "Primary Sources"
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'map)
 (require 'org-macs)
 (require 'oc)
 
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-export-data "org-export" (data info))
-(declare-function org-export-get-next-element "org-export" (blob info 
&optional n))
 
 
 ;;; Customization
@@ -82,6 +86,100 @@ If \"biblatex\" package is already required in the 
document, e.g., through
           (const :tag "No option" nil))
   :safe #'string-or-null-p)
 
+(defcustom org-cite-biblatex-styles
+  '(("author"   "caps"      "Citeauthor*" nil         nil)
+    ("author"   "full"      "citeauthor"  nil         nil)
+    ("author"   "caps-full" "Citeauthor"  nil         nil)
+    ("author"   nil         "citeauthor*" nil         nil)
+    ("locators" "bare"      "notecite"    nil         nil)
+    ("locators" "caps"      "Pnotecite"   nil         nil)
+    ("locators" "bare-caps" "Notecite"    nil         nil)
+    ("locators" nil         "pnotecite"   nil         nil)
+    ("noauthor" "bare"      "cite*"       nil         nil)
+    ("noauthor" nil         "autocite*"   nil         nil)
+    ("nocite"   nil         "nocite"      nil         t)
+    ("text"     "caps"      "Textcite"    "Textcites" nil)
+    ("text"     nil         "textcite"    "textcites" nil)
+    (nil        "bare"      "cite"        "cites"     nil)
+    (nil        "caps"      "Autocite"    "Autocites" nil)
+    (nil        "bare-caps" "Cite"        "Cites"     nil)
+    (nil        nil         "autocite"    "autocites" nil))
+  "List of styles and variants, with associated BibLaTeX commands.
+
+Each style follows the pattern
+
+  (NAME VARIANT COMMAND MULTI-COMMAND NO-OPTION)
+
+where:
+
+  NAME is the name of the style, as a string, or nil.  The nil
+  style is the default style.  As such, it must have an entry in
+  the list.
+
+  VARIANT is the name of the style variant, as a string or nil.
+  The nil variant is the default variant for the current style.
+  As such, each style name must be associated to a nil variant.
+
+  COMMAND is the LaTeX command to use, as a string.  It should
+  not contain the leading backslash character.
+
+  MULTI-COMMAND is the LaTeX command to use when a multi-cite
+  command is appropriate.  When nil, the style is deemed
+  inappropriate for multi-cites.  The command should not contain
+  the leading backslash character.
+
+  NO-OPTION is a boolean.  When non-nil, no optional argument
+  should be added to the LaTeX command.
+
+Each NAME-VARIANT pair should be unique in the list.
+
+It is also possible to provide shortcuts for style and variant
+names.  See `org-cite-biblatex-style-shortcuts'."
+  :group 'org-cite
+  :package-version '(Org . "9.6")
+  :type '(repeat
+          (list :tag "Style/variant combination"
+                ;; Name part.
+                (choice :tag "Style"
+                        (string :tag "Name")
+                        (const :tag "Default style" nil))
+                ;; Variant part.
+                (choice :tag "Variant"
+                        (string :tag "Name")
+                        (const :tag "Default variant" nil))
+                ;; Command part.
+                (string :tag "Command name")
+                (choice :tag "Multicite command"
+                        (string :tag "Command name")
+                        (const :tag "No multicite support" nil))
+                (choice :tag "Skip optional arguments"
+                        (const :tag "Yes" t)
+                        (const :tag "No" nil)))))
+
+(defcustom org-cite-biblatex-style-shortcuts
+  '(("a"  . "author")
+    ("b"  . "bare")
+    ("bc" . "bare-caps")
+    ("c"  . "caps")
+    ("cf" . "caps-full")
+    ("f"  . "full")
+    ("l"  . "locators")
+    ("n"  . "nocite")
+    ("na" . "noauthor")
+    ("t"  . "text"))
+  "List of shortcuts associated to style or variant names.
+
+Each entry is a pair (NAME . STYLE-NAME) where NAME is the name
+of the shortcut, as a string, and STYLE-NAME is the name of
+a style in `org-cite-biblatex-styles'."
+  :group 'org-cite
+  :package-version '(Org . "9.6")
+  :type '(repeat
+          (cons :tag "Shortcut"
+                (string :tag "Name")
+                (string :tag "Full name")))
+  :safe t)
+
 
 ;;; Internal functions
 (defun org-cite-biblatex--package-options (initial style)
@@ -166,21 +264,51 @@ INFO is the export state, as a property list."
                        (org-cite-get-references citation)
                        ""))))
 
-(defun org-cite-biblatex--command (citation info base &optional multi no-opt)
-  "Return biblatex command using BASE name for CITATION object.
+(defun org-cite-biblatex--command (citation info name &optional multi no-opt)
+  "Return BibLaTeX command NAME for CITATION object.
 
 INFO is the export state, as a property list.
 
-When optional argument MULTI is non-nil, generate a \"multicite\" command when
-appropriate.  When optional argument NO-OPT is non-nil, do not add optional
-arguments to the command."
-  (format "\\%s%s"
-          base
-          (if (and multi (org-cite-biblatex--multicite-p citation))
-              (concat "s" (org-cite-biblatex--multi-arguments citation info))
+When optional argument MULTI is non-nil, use it as a multicite
+command name when appropriate.  When optional argument NO-OPT is
+non-nil, do not add optional arguments to the command."
+  (if (and multi (org-cite-biblatex--multicite-p citation))
+      (format "\\%s%s" multi (org-cite-biblatex--multi-arguments citation 
info))
+    (format "\\%s%s"
+            name
             (org-cite-biblatex--atomic-arguments
              (org-cite-get-references citation) info no-opt))))
 
+(defun org-cite-biblatex--expand-shortcuts (style)
+  "Return STYLE pair with shortcuts expanded."
+  (pcase style
+    (`(,style . ,variant)
+     (cons (or (alist-get style org-cite-biblatex-style-shortcuts
+                          nil nil #'equal)
+               style)
+           (or (alist-get variant org-cite-biblatex-style-shortcuts
+                          nil nil #'equal)
+               variant)))
+    (_ (error "This should not happen"))))
+
+(defun org-cite-biblatex-list-styles ()
+  "List styles and variants supported in `biblatex' citation processor.
+The output format is appropriate as a value for `:cite-styles' keyword
+in `org-cite-register-processor', which see."
+  (let ((shortcuts (make-hash-table :test #'equal))
+        (variants (make-hash-table :test #'equal)))
+    (pcase-dolist (`(,name . ,full-name) org-cite-biblatex-style-shortcuts)
+      (push name (gethash full-name shortcuts)))
+    (pcase-dolist (`(,name ,variant . ,_) org-cite-biblatex-styles)
+      (unless (null variant) (push variant (gethash name variants))))
+    (map-apply (lambda (style-name variants)
+                 (cons (cons (or style-name "nil")
+                             (gethash style-name shortcuts))
+                       (mapcar (lambda (v)
+                                 (cons v (gethash v shortcuts)))
+                               variants)))
+               variants)))
+
 
 ;;; Export capability
 (defun org-cite-biblatex-export-bibliography (_keys _files _style props &rest 
_)
@@ -210,41 +338,42 @@ PROPS is the local properties of the bibliography, as a 
property list."
   "Export CITATION object.
 STYLE is the citation style, as a pair of either strings or nil.
 INFO is the export state, as a property list."
-  (apply
-   #'org-cite-biblatex--command citation info
-   (pcase style
-     ;; "author" style.
-     (`(,(or "author" "a") . ,variant)
-      (pcase variant
-        ((or "caps" "c")            '("Citeauthor*"))
-        ((or "full" "f")            '("citeauthor"))
-        ((or "caps-full" "cf")      '("Citeauthor"))
-        (_                          '("citeauthor*"))))
-     ;; "locators" style.
-     (`(,(or "locators" "l") . ,variant)
-      (pcase variant
-        ((or "bare" "b")            '("notecite"))
-        ((or "caps" "c")            '("Pnotecite"))
-        ((or "bare-caps" "bc")      '("Notecite"))
-        (_                          '("pnotecite"))))
-     ;; "noauthor" style.
-     (`(,(or "noauthor" "na") . ,_) '("autocite*"))
-     ;; "nocite" style.
-     (`(,(or "nocite" "n") . ,_)    '("nocite" nil t))
-     ;; "text" style.
-     (`(,(or "text" "t") . ,variant)
-      (pcase variant
-        ((or "caps" "c")            '("Textcite" t))
-        (_                          '("textcite" t))))
-     ;; Default "nil" style.
-     (`(,_ . ,variant)
-      (pcase variant
-        ((or "bare" "b")            '("cite" t))
-        ((or "caps" "c")            '("Autocite" t))
-        ((or "bare-caps" "bc")      '("Cite" t))
-        (_                          '("autocite" t))))
-     ;; This should not happen.
-     (_ (error "Invalid style: %S" style)))))
+  (pcase-let* ((`(,name . ,variant) (org-cite-biblatex--expand-shortcuts 
style))
+               (candidates nil)
+               (style-match-flag nil))
+    (catch :match
+      ;; Walk `org-cite-biblatex-styles' and prioritize matching
+      ;; candidates.  At the end of the process, the optimal candidate
+      ;; should appear in front of CANDIDATES.
+      (dolist (style org-cite-biblatex-styles)
+        (pcase style
+          ;; A matching style-variant pair trumps anything else.
+          ;; Return it.
+          (`(,(pred (equal name)) ,(pred (equal variant)) . ,_)
+           (throw :match (setq candidates (list style))))
+          ;; nil-nil style-variant is the fallback value.  Consider it
+          ;; only if nothing else matches.
+          (`(nil nil . ,_)
+           (unless candidates (push style candidates)))
+          ;; A matching style with default variant trumps a matching
+          ;; variant without the adequate style.  Ensure the former
+          ;; appears first in the list.
+          (`(,(pred (equal name)) nil . ,_)
+           (push style candidates)
+           (setq style-match-flag t))
+          (`(nil ,(pred (equal variant)) . ,_)
+           (unless style-match-flag (push style candidates)))
+          ;; Discard anything else.
+          (_ nil))))
+    (apply
+     #'org-cite-biblatex--command citation info
+     (pcase (seq-elt candidates 0) ;; `seq-first' is not available in Emacs 26.
+       (`(,_ ,_ . ,command-parameters) command-parameters)
+       ('nil
+        (user-error
+         "Missing default style or variant in `org-cite-biblatex-styles'"))
+       (other
+        (user-error "Invalid entry %S in `org-cite-biblatex-styles'" 
other))))))
 
 (defun org-cite-biblatex-prepare-preamble (output _keys files style &rest _)
   "Prepare document preamble for \"biblatex\" usage.
@@ -301,13 +430,7 @@ to the document, and set styles."
   :export-bibliography #'org-cite-biblatex-export-bibliography
   :export-citation #'org-cite-biblatex-export-citation
   :export-finalizer #'org-cite-biblatex-prepare-preamble
-  :cite-styles
-  '((("author" "a") ("caps" "c") ("full" "f") ("caps-full" "cf"))
-    (("locators" "l") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))
-    (("noauthor" "na"))
-    (("nocite" "n"))
-    (("text" "t") ("caps" "c"))
-    (("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))))
+  :cite-styles #'org-cite-biblatex-list-styles)
 
 (provide 'oc-biblatex)
 ;;; oc-biblatex.el ends here
diff --git a/lisp/org/oc-bibtex.el b/lisp/org/oc-bibtex.el
new file mode 100644
index 0000000000..4d2297a829
--- /dev/null
+++ b/lisp/org/oc-bibtex.el
@@ -0,0 +1,87 @@
+;;; oc-bibtex.el --- Vanilla citation processor for LaTeX -*- lexical-binding: 
t; -*-
+
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
+
+;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This library registers the `bibtex' citation processor, which
+;; provides the "export" capability for citations.  It doesn't require
+;; any LaTeX package.
+;;
+;; It supports the following citation styles:
+;;
+;; - nocite (n),
+;; - default.
+;;
+;; Only suffixes are supported.  Prefixes are ignored.
+;;
+;; Bibliography should consist of ".bib" files only.
+
+;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'oc)
+
+(declare-function org-element-property "org-element" (property element))
+
+(declare-function org-export-data "org-export" (data info))
+
+
+;;; Export capability
+(defun org-cite-bibtex-export-bibliography (_keys files style &rest _)
+  "Print references from bibliography FILES.
+FILES is a list of absolute file names.  STYLE is the bibliography style, as
+a string or nil."
+  (concat (and style (format "\\bibliographystyle{%s}\n" style))
+          (format "\\bibliography{%s}"
+                  (mapconcat #'file-name-sans-extension
+                             files
+                             ","))))
+
+(defun org-cite-bibtex-export-citation (citation style _ info)
+  "Export CITATION object.
+STYLE is the citation style, as a pair of strings or nil.  INFO is the export
+state, as a property list."
+  (let ((references (org-cite-get-references citation)))
+    (format "\\%s%s{%s}"
+            (pcase style
+              (`(,(or "nocite" "n") . ,_) "nocite")
+              (_ "cite"))
+            (let ((suffix (cdr (org-cite-main-affixes citation))))
+              (if suffix
+                  (format "[%s]" (org-trim (org-export-data suffix info)))
+                ""))
+            (mapconcat (lambda (r) (org-element-property :key r))
+                       references
+                       ","))))
+
+
+;;; Register `bibtex' processor
+(org-cite-register-processor 'bibtex
+  :export-bibliography #'org-cite-bibtex-export-bibliography
+  :export-citation #'org-cite-bibtex-export-citation
+  :cite-styles
+  '((("nocite" "n"))
+    (("nil"))))
+
+(provide 'oc-bibtex)
+;;; oc-bibtex.el ends here
diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el
index 82a9b8afce..1ccb74e925 100644
--- a/lisp/org/oc-csl.el
+++ b/lisp/org/oc-csl.el
@@ -3,6 +3,7 @@
 ;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;; Maintainer: András Simonyi <andras.simonyi@gmail.com>
 
 ;; This file is part of GNU Emacs.
 
@@ -56,11 +57,21 @@
 
 ;; The library supports the following citation styles:
 ;;
-;; - author (a), including caps (c), full (f), and caps-full (cf) variants,
+;; - author (a), including bare (b), caps (c), bare-caps (bc), full (f),
+;;   caps-full (cf), and bare-caps-full (bcf) variants,
 ;; - noauthor (na), including bare (b), caps (c) and bare-caps (bc) variants,
+;; - nocite (n),
 ;; - year (y), including a bare (b) variant,
-;; - text (t). including caps (c), full (f), and caps-full (cf) variants,
+;; - text (t), including caps (c), full (f), and caps-full (cf) variants,
+;; - title (ti), including a bare (b) variant,
+;; - locators (l), including a bare (b) variant,
+;; - bibentry (b), including a bare (b) variant,
 ;; - default style, including bare (b), caps (c) and bare-caps (bc) variants.
+;;
+;; Using "*" as a key in a nocite citation includes all available
+;; items in the printed bibliography.  The "bibentry" citation style,
+;; similarly to biblatex's \fullcite, creates a citation which is
+;; similar to the bibliography entry.
 
 ;; CSL styles recognize "locator" in citation references' suffix.  For example,
 ;; in the citation
@@ -85,11 +96,27 @@
 ;; The part of the suffix before the locator is appended to reference's prefix.
 ;; If no locator term is used, but a number is present, then "page" is assumed.
 
+;; Filtered sub-bibliographies can be printed by passing filtering
+;; options to the "print_bibliography" keywords.  E.g.,
+;;
+;;    #+print_bibliography: :type book keyword: emacs
+;;
+;; If you need to use a key multiple times, you can separate its
+;; values with commas, but without any space in-between:
+;;
+;;    #+print_bibliography: :keyword abc,xyz :type article
+
 ;; This library was heavily inspired by and borrows from András Simonyi's
 ;; Citeproc Org (<https://github.com/andras-simonyi/citeproc-org>) library.
 ;; Many thanks to him!
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'cl-lib)
+(require 'map)
 (require 'bibtex)
 (require 'json)
 (require 'oc)
@@ -102,9 +129,11 @@
 (declare-function citeproc-create "ext:citeproc")
 (declare-function citeproc-citation-create "ext:citeproc")
 (declare-function citeproc-append-citations "ext:citeproc")
+(declare-function citeproc-add-uncited "ext:citeproc")
 (declare-function citeproc-render-citations "ext:citeproc")
 (declare-function citeproc-render-bib "ext:citeproc")
 (declare-function citeproc-hash-itemgetter-from-any "ext:citeproc")
+(declare-function citeproc-add-subbib-filters "ext:citeproc")
 
 (declare-function org-element-interpret-data "org-element" (data))
 (declare-function org-element-map "org-element" (data types fun &optional info 
first-match no-recursion with-affiliated))
@@ -133,13 +162,15 @@ If nil then only the fallback en-US locale will be 
available."
 
 (defcustom org-cite-csl-styles-dir nil
   "Directory of CSL style files.
-When non-nil, relative style file names are expanded relatively to this
-directory.  This variable is ignored when style file is absolute."
+
+Relative style file names are expanded according to document's
+default directory.  If it fails and the variable is non-nil, Org
+looks for style files in this directory, too."
   :group 'org-cite
   :package-version '(Org . "9.5")
   :type '(choice
           (directory :tag "Styles directory")
-          (const :tag "Use absolute file names" nil))
+          (const :tag "No central directory for style files" nil))
   ;; It's not obvious to me that arbitrary locations are safe.
 ;;;  :safe #'string-or-null-p
   )
@@ -293,6 +324,12 @@ INFO is the export state, as a property list."
    (citeproc-proc-style
     (org-cite-csl--processor info))))
 
+(defun org-cite-csl--nocite-p (citation info)
+  "Non-nil when CITATION object's style is nocite.
+INFO is the export state, as a property list."
+  (member (car (org-cite-citation-style citation info))
+          '("nocite" "n")))
+
 (defun org-cite-csl--create-structure-params (citation info)
   "Return citeproc structure creation params for CITATION object.
 STYLE is the citation style, as a string or nil. INFO is the export state, as
@@ -302,9 +339,13 @@ a property list."
       ;; "author" style.
       (`(,(or "author" "a") . ,variant)
        (pcase variant
+        ((or "bare" "b") '(:mode author-only :suppress-affixes t))
         ((or "caps" "c") '(:mode author-only :capitalize-first t))
         ((or "full" "f") '(:mode author-only :ignore-et-al t))
+        ((or "bare-caps" "bc") '(:mode author-only :suppress-affixes t 
:capitalize-first t))
+        ((or "bare-full" "bf") '(:mode author-only :suppress-affixes t 
:ignore-et-al t))
         ((or "caps-full" "cf") '(:mode author-only :capitalize-first t 
:ignore-et-al t))
+        ((or "bare-caps-full" "bcf") '(:mode author-only :suppress-affixes t 
:capitalize-first t :ignore-et-al t))
         (_ '(:mode author-only))))
       ;; "noauthor" style.
       (`(,(or "noauthor" "na") . ,variant)
@@ -319,6 +360,21 @@ a property list."
        (pcase variant
         ((or "bare" "b") '(:mode year-only :suppress-affixes t))
         (_ '(:mode year-only))))
+      ;; "bibentry" style.
+      (`(,(or "bibentry" "b") . ,variant)
+       (pcase variant
+        ((or "bare" "b") '(:mode bib-entry :suppress-affixes t))
+        (_ '(:mode bib-entry))))
+      ;; "locators" style.
+      (`(,(or "locators" "l") . ,variant)
+       (pcase variant
+        ((or "bare" "b") '(:mode locator-only :suppress-affixes t))
+        (_ '(:mode locator-only))))
+      ;; "title" style.
+      (`(,(or "title" "ti") . ,variant)
+       (pcase variant
+        ((or "bare" "b") '(:mode title-only :suppress-affixes t))
+        (_ '(:mode title-only))))
       ;; "text" style.
       (`(,(or "text" "t") . ,variant)
        (pcase variant
@@ -365,15 +421,21 @@ corresponding to one of the output formats supported by 
Citeproc: `html',
 
 INFO is the export state, as a property list.
 
-When file name is relative, expand it according to `org-cite-csl-styles-dir',
-or raise an error if the variable is unset."
+When file name is relative, look for it in buffer's default
+directory, failing that in `org-cite-csl-styles-dir' if non-nil.
+Raise an error if no style file can be found."
   (pcase (org-cite-bibliography-style info)
     ('nil org-cite-csl--fallback-style-file)
     ((and (pred file-name-absolute-p) file) file)
-    ((and (guard org-cite-csl-styles-dir) file)
+    ((and (pred file-exists-p) file) (expand-file-name file))
+    ((and (guard org-cite-csl-styles-dir)
+          (pred (lambda (f)
+                  (file-exists-p
+                   (expand-file-name f org-cite-csl-styles-dir))))
+          file)
      (expand-file-name file org-cite-csl-styles-dir))
     (other
-     (user-error "Cannot handle relative style file name: %S" other))))
+     (user-error "CSL style file not found: %S" other))))
 
 (defun org-cite-csl--locale-getter ()
   "Return a locale getter.
@@ -522,20 +584,91 @@ INFO is the export state, as a property list.
 Return an alist (CITATION . OUTPUT) where CITATION object has been rendered as
 OUTPUT using Citeproc."
   (or (plist-get info :cite-citeproc-rendered-citations)
-      (let* ((citations (org-cite-list-citations info))
-             (processor (org-cite-csl--processor info))
-             (structures
-              (mapcar (lambda (c) (org-cite-csl--create-structure c info))
-                      citations)))
-        (citeproc-append-citations structures processor)
-        (let* ((rendered
-                (citeproc-render-citations
-                 processor
-                 (org-cite-csl--output-format info)
-                 (org-cite-csl--no-citelinks-p info)))
-               (result (seq-mapn #'cons citations rendered)))
-          (plist-put info :cite-citeproc-rendered-citations result)
-          result))))
+      (let ((citations (org-cite-list-citations info))
+           (processor (org-cite-csl--processor info))
+           normal-citations nocite-ids)
+       (dolist (citation citations)
+         (if (org-cite-csl--nocite-p citation info)
+             (setq nocite-ids (append (org-cite-get-references citation t) 
nocite-ids))
+           (push citation normal-citations)))
+       (let ((structures
+              (mapcar (lambda (c) (org-cite-csl--create-structure c info))
+                      (nreverse normal-citations))))
+         (citeproc-append-citations structures processor))
+       (when nocite-ids
+         (citeproc-add-uncited nocite-ids processor))
+        ;; All bibliographies have to be rendered in order to have
+        ;; correct citation numbers even if there are several
+        ;; sub-bibliograhies.
+        (org-cite-csl--rendered-bibliographies info)
+       (let (result
+             (rendered (citeproc-render-citations
+                        processor
+                        (org-cite-csl--output-format info)
+                        (org-cite-csl--no-citelinks-p info))))
+         (dolist (citation citations)
+           (push (cons citation
+                       (if (org-cite-csl--nocite-p citation info) "" (pop 
rendered)))
+                 result))
+         (setq result (nreverse result))
+         (plist-put info :cite-citeproc-rendered-citations result)
+         result))))
+
+(defun org-cite-csl--bibliography-filter (bib-props)
+  "Return the sub-bibliography filter corresponding to bibliography properties.
+
+BIB-PROPS should be a plist representing the properties
+associated with a \"print_bibliography\" keyword, as returned by
+`org-cite-bibliography-properties'."
+  (let (result
+       (remove-keyword-colon (lambda (x) (intern (substring (symbol-name x) 
1)))))
+    (map-do
+     (lambda (key value)
+       (pcase key
+         ((or :keyword :notkeyword :nottype :notcsltype :filter)
+          (dolist (v (split-string value ","))
+           (push (cons  (funcall remove-keyword-colon key) v) result)))
+         ((or :type :csltype)
+          (if (string-match-p "," value)
+              (user-error "The \"%s\" print_bibliography option does not 
support comma-separated values" key)
+            (push (cons (funcall remove-keyword-colon key) value) result)))))
+     bib-props)
+    result))
+
+(defun org-cite-csl--rendered-bibliographies (info)
+  "Return the rendered bibliographies.
+
+INFO is the export state, as a property list.
+
+Return an (OUTPUTS PARAMETERS) list where OUTPUTS is an alist
+of (BIB-PROPS . OUTPUT) pairs where each key is a property list
+of a \"print_bibliography\" keyword and the corresponding OUTPUT
+value is the bibliography as rendered by Citeproc."
+  (or (plist-get info :cite-citeproc-rendered-bibliographies)
+      (let (bib-plists bib-filters)
+        ;; Collect bibliography property lists and the corresponding
+        ;; Citeproc sub-bib filters.
+       (org-element-map (plist-get info :parse-tree) 'keyword
+          (lambda (keyword)
+            (when (equal "PRINT_BIBLIOGRAPHY" (org-element-property :key 
keyword))
+              (let ((bib-plist (org-cite-bibliography-properties keyword)))
+                (push bib-plist bib-plists)
+                (push (org-cite-csl--bibliography-filter bib-plist) 
bib-filters)))))
+        (setq bib-filters (nreverse bib-filters)
+              bib-plists (nreverse bib-plists))
+        ;; Render and return all bibliographies.
+        (let ((processor (org-cite-csl--processor info)))
+          (citeproc-add-subbib-filters bib-filters processor)
+          (pcase-let* ((format (org-cite-csl--output-format info))
+                       (`(,rendered-bibs . ,parameters)
+                        (citeproc-render-bib
+                         (org-cite-csl--processor info)
+                         format
+                         (org-cite-csl--no-citelinks-p info)))
+                       (outputs (cl-mapcar #'cons bib-plists rendered-bibs))
+                       (result (list outputs parameters)))
+            (plist-put info :cite-citeproc-rendered-bibliographies result)
+            result)))))
 
 
 ;;; Export capability
@@ -550,16 +683,13 @@ INFO is the export state, as a property list."
       ;; process.
       (org-cite-parse-objects output))))
 
-(defun org-cite-csl-render-bibliography (_keys _files _style _props _backend 
info)
+(defun org-cite-csl-render-bibliography (_keys _files _style props _backend 
info)
   "Export bibliography.
 INFO is the export state, as a property list."
   (org-cite-csl--barf-without-citeproc)
-  (pcase-let* ((format (org-cite-csl--output-format info))
-               (`(,output . ,parameters)
-                (citeproc-render-bib
-                 (org-cite-csl--processor info)
-                 format
-                 (org-cite-csl--no-citelinks-p info))))
+  (pcase-let*  ((format (org-cite-csl--output-format info))
+               (`(,outputs ,parameters) (org-cite-csl--rendered-bibliographies 
info))
+               (output (cdr (assoc props outputs))))
     (pcase format
       ('html
        (concat
@@ -621,11 +751,15 @@ property list."
   :export-bibliography #'org-cite-csl-render-bibliography
   :export-finalizer #'org-cite-csl-finalizer
   :cite-styles
-  '((("author" "a") ("full" "f") ("caps" "c") ("caps-full" "cf"))
+  '((("author" "a") ("bare" "b") ("caps" "c") ("full" "f") ("bare-caps" "bc") 
("caps-full" "cf") ("bare-caps-full" "bcf"))
     (("noauthor" "na") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))
     (("year" "y") ("bare" "b"))
     (("text" "t") ("caps" "c") ("full" "f") ("caps-full" "cf"))
-    (("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))))
+    (("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))
+    (("nocite" "n"))
+    (("title" "ti") ("bare" "b"))
+    (("bibentry" "b") ("bare" "b"))
+    (("locators" "l") ("bare" "b"))))
 
 (provide 'oc-csl)
 ;;; oc-csl.el ends here
diff --git a/lisp/org/oc-natbib.el b/lisp/org/oc-natbib.el
index 2193a070eb..00c069e157 100644
--- a/lisp/org/oc-natbib.el
+++ b/lisp/org/oc-natbib.el
@@ -42,6 +42,10 @@
 ;; Bibliography accepts any style supported by "natbib" package.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'oc)
 
 (declare-function org-element-property "org-element" (property element))
diff --git a/lisp/org/oc.el b/lisp/org/oc.el
index c4cd0268c7..43eb86224f 100644
--- a/lisp/org/oc.el
+++ b/lisp/org/oc.el
@@ -61,6 +61,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org-compat)
 (require 'org-macs)
 (require 'seq)
@@ -323,12 +326,6 @@ place note numbers according to rules defined in 
`org-cite-note-rules'."
 See `org-cite-register-processor' for more information about
 processors.")
 
-(defun org-cite--get-processor (name)
-  "Return citation processor named after symbol NAME.
-Return nil if no such processor is found."
-  (seq-find (lambda (p) (eq name (org-cite-processor-name p)))
-           org-cite--processors))
-
 (defun org-cite-register-processor (name &rest body)
   "Mark citation processor NAME as available.
 
@@ -415,14 +412,30 @@ optional keys can be set:
     The \"nil\" style denotes the processor fall-back style.  It
     should have a corresponding entry in the value.
 
+    The value can also be a function.  It will be called without
+    any argument and should return a list structured as the above.
+
 Return a non-nil value on a successful operation."
   (declare (indent 1))
   (unless (and name (symbolp name))
     (error "Invalid processor name: %S" name))
-  (when (org-cite--get-processor name)
-    (org-cite-unregister-processor name))
-  (push (apply #'org-cite--make-processor :name name body)
-       org-cite--processors))
+  (setq org-cite--processors
+        (cons (apply #'org-cite--make-processor :name name body)
+              (seq-remove (lambda (p) (eq name (org-cite-processor-name p)))
+                          org-cite--processors))))
+
+(defun org-cite-try-load-processor (name)
+  "Try loading citation processor NAME if unavailable.
+NAME is a symbol.  When the NAME processor is unregistered, try
+loading \"oc-NAME\" library beforehand, then cross fingers."
+  (unless (org-cite-get-processor name)
+    (require (intern (format "oc-%s" name)) nil t)))
+
+(defun org-cite-get-processor (name)
+  "Return citation processor named after symbol NAME.
+Return nil if no such processor is found."
+  (seq-find (lambda (p) (eq name (org-cite-processor-name p)))
+           org-cite--processors))
 
 (defun org-cite-unregister-processor (name)
   "Unregister citation processor NAME.
@@ -430,7 +443,7 @@ NAME is a symbol.  Raise an error if processor is not 
registered.
 Return a non-nil value on a successful operation."
   (unless (and name (symbolp name))
     (error "Invalid processor name: %S" name))
-  (pcase (org-cite--get-processor name)
+  (pcase (org-cite-get-processor name)
     ('nil (error "Processor %S not registered" name))
     (processor
      (setq org-cite--processors (delete processor org-cite--processors))))
@@ -440,7 +453,7 @@ Return a non-nil value on a successful operation."
   "Return non-nil if PROCESSOR is able to handle CAPABILITY.
 PROCESSOR is the name of a cite processor, as a symbol.  CAPABILITY is
 `activate', `export', `follow', or `insert'."
-  (let ((p (org-cite--get-processor processor)))
+  (let ((p (org-cite-get-processor processor)))
     (pcase capability
       ((guard (not p)) nil)             ;undefined processor
       ('activate (functionp (org-cite-processor-activate p)))
@@ -673,7 +686,10 @@ strings."
   (let ((collection
          (seq-mapcat
           (lambda (name)
-            (org-cite-processor-cite-styles (org-cite--get-processor name)))
+            (pcase (org-cite-processor-cite-styles
+                    (org-cite-get-processor name))
+              ((and (pred functionp) f) (funcall f))
+              (static-data static-data)))
           (or processors
               (mapcar (pcase-lambda (`(,_ . (,name . ,_))) name)
                       org-cite-export-processors))))
@@ -789,6 +805,39 @@ INFO is a plist used as a communication channel."
       (cons (org-not-nil (car global))
             (or (cdr local) (cdr global)))))))
 
+(defun org-cite-read-processor-declaration (s)
+  "Read processor declaration from string S.
+
+Return (NAME BIBLIOGRAPHY-STYLE CITATION-STYLE) triplet, when
+NAME is the processor name, as a symbol, and both
+BIBLIOGRAPHY-STYLE and CITATION-STYLE are strings or nil.  Those
+strings may contain spaces if they are enclosed within double
+quotes.
+
+String S is expected to contain between 1 and 3 tokens.  The
+function raises an error when it contains too few or too many
+tokens.  Spurious spaces are ignored."
+  (with-temp-buffer
+    (save-excursion (insert s))
+    (let ((result (list (read (current-buffer)))))
+      (dotimes (_ 2)
+        (skip-chars-forward " \t")
+        (cond
+         ((eobp) (push nil result))
+         ((char-equal ?\" (char-after))
+          (push (org-not-nil (read (current-buffer)))
+                result))
+         (t
+          (let ((origin (point)))
+            (skip-chars-forward "^ \t")
+            (push (org-not-nil (buffer-substring origin (point)))
+                  result)))))
+      (skip-chars-forward " \t")
+      (unless (eobp)
+        (error "Trailing garbage following cite export processor declaration 
%S"
+               s))
+      (nreverse result))))
+
 (defun org-cite-bibliography-style (info)
   "Return expected bibliography style.
 INFO is a plist used as a communication channel."
@@ -1177,7 +1226,7 @@ from the processor set in `org-cite-activate-processor'."
          (activate
           (or (and name
                    (org-cite-processor-has-capability-p name 'activate)
-                   (org-cite-processor-activate (org-cite--get-processor 
name)))
+                   (org-cite-processor-activate (org-cite-get-processor name)))
               #'org-cite-fontify-default)))
     (when (re-search-forward org-element-citation-prefix-re limit t)
       (let ((cite (org-with-point-at (match-beginning 0)
@@ -1204,40 +1253,22 @@ INFO is the communication channel, as a plist.  It is 
modified by side-effect."
 
 Export processor is stored as a triplet, or nil.
 
-When non-nil, it is defined as (NAME BIBLIOGRAPHY-STYLE CITATION-STYLE) where
-NAME is a symbol, whereas BIBLIOGRAPHY-STYLE and CITATION-STYLE are strings,
-or nil.
+When non-nil, it is defined as (NAME BIBLIOGRAPHY-STYLE
+CITATION-STYLE) where NAME is a symbol, whereas
+BIBLIOGRAPHY-STYLE and CITATION-STYLE are strings, or nil.
 
-INFO is the communication channel, as a plist.  It is modified by side-effect."
+INFO is the communication channel, as a plist.  It is modified by
+side-effect."
   (let* ((err
           (lambda (s)
-            (user-error "Invalid cite export processor definition: %S" s)))
+            (user-error "Invalid cite export processor declaration: %S" s)))
          (processor
           (pcase (plist-get info :cite-export)
             ((or "" `nil) nil)
             ;; Value is a string.  It comes from a "cite_export"
-            ;; keyword.  It may contain between 1 and 3 tokens, the
-            ;; first one being a symbol and the other (optional) two,
-            ;; strings.
+            ;; keyword.
             ((and (pred stringp) s)
-             (with-temp-buffer
-               (save-excursion (insert s))
-               (let ((result (list (read (current-buffer)))))
-                 (dotimes (_ 2)
-                   (skip-chars-forward " \t")
-                   (cond
-                    ((eobp) (push nil result))
-                    ((char-equal ?\" (char-after))
-                     (condition-case _
-                         (push (org-not-nil (read (current-buffer))) result)
-                       (error (funcall err s))))
-                    (t
-                     (let ((origin (point)))
-                       (skip-chars-forward "^ \t")
-                       (push (org-not-nil (buffer-substring origin (point)))
-                             result)))))
-                 (unless (eobp) (funcall err s))
-                 (nreverse result))))
+             (org-cite-read-processor-declaration s))
             ;; Value is an alist.  It must come from
             ;; `org-cite-export-processors' variable.  Find the most
             ;; appropriate processor according to current export
@@ -1274,8 +1305,9 @@ INFO is the communication channel, as a plist.  It is 
modified by side-effect."
     (pcase processor
       ('nil nil)
       (`(,name . ,_)
+       (org-cite-try-load-processor name)
        (cond
-        ((not (org-cite--get-processor name))
+        ((not (org-cite-get-processor name))
          (user-error "Unknown processor %S" name))
         ((not (org-cite-processor-has-capability-p name 'export))
          (user-error "Processor %S is unable to handle citation export" 
name)))))
@@ -1288,7 +1320,7 @@ selected citation processor."
   (pcase (plist-get info :cite-export)
     ('nil nil)
     (`(,p ,_ ,_)
-     (funcall (org-cite-processor-export-citation (org-cite--get-processor p))
+     (funcall (org-cite-processor-export-citation (org-cite-get-processor p))
              citation
               (org-cite-citation-style citation info)
               (plist-get info :back-end)
@@ -1304,7 +1336,7 @@ used as a communication channel."
     (`(,p ,_ ,_)
      (let ((export-bibilography
             (org-cite-processor-export-bibliography
-             (org-cite--get-processor p))))
+             (org-cite-get-processor p))))
        (when export-bibilography
          (funcall export-bibilography
                  (org-cite-list-keys info)
@@ -1405,7 +1437,7 @@ channel, as a property list."
     ('nil output)
     (`(,p ,_ ,_)
      (let ((finalizer
-            (org-cite-processor-export-finalizer (org-cite--get-processor p))))
+            (org-cite-processor-export-finalizer (org-cite-get-processor p))))
        (if (not finalizer)
            output
          (funcall finalizer
@@ -1423,16 +1455,17 @@ channel, as a property list."
   "Follow citation or citation-reference DATUM.
 Following is done according to the processor set in 
`org-cite-follow-processor'.
 ARG is the prefix argument received when calling `org-open-at-point', or nil."
+  (unless org-cite-follow-processor
+    (user-error "No processor set to follow citations"))
+  (org-cite-try-load-processor org-cite-follow-processor)
   (let ((name org-cite-follow-processor))
     (cond
-     ((null name)
-      (user-error "No processor set to follow citations"))
-     ((not (org-cite--get-processor name))
+     ((not (org-cite-get-processor name))
       (user-error "Unknown processor %S" name))
      ((not (org-cite-processor-has-capability-p name 'follow))
       (user-error "Processor %S cannot follow citations" name))
      (t
-      (let ((follow (org-cite-processor-follow (org-cite--get-processor 
name))))
+      (let ((follow (org-cite-processor-follow (org-cite-get-processor name))))
         (funcall follow datum arg))))))
 
 
@@ -1474,8 +1507,15 @@ CONTEXT is the element or object at point, as returned 
by `org-element-context'.
                        (not (looking-at-p "\\*+ END[ \t]*$")))
                      (let ((case-fold-search nil))
                        (looking-at org-complex-heading-regexp))))
-              (match-beginning 4)
-              (>= (point) (match-beginning 4))
+              (>= (point) (or
+                           ;; Real heading.
+                           (match-beginning 4)
+                           ;; If no heading, end of priority.
+                           (match-end 3)
+                           ;; ... end of todo keyword.
+                           (match-end 2)
+                           ;; ... after stars.
+                           (1+ (match-end 1))))
               (or (not (match-beginning 5))
                   (< (point) (match-beginning 5))))))
      ;; White spaces after an object or blank lines after an element
@@ -1492,7 +1532,7 @@ CONTEXT is the element or object at point, as returned by 
`org-element-context'.
      ;; unaffected.
      ((eq type 'item)
       (> (point) (+ (org-element-property :begin context)
-                    (current-indentation)
+                    (org-current-text-indentation)
                     (if (org-element-property :checkbox context)
                         5 1))))
      ;; Other elements are invalid.
@@ -1537,38 +1577,42 @@ Citation keys are strings without the leading \"@\"."
 (defun org-cite-make-insert-processor (select-key select-style)
   "Build a function appropriate as an insert processor.
 
-SELECT-KEY is a function called with one argument.  When it is nil, the 
function
-should return a citation key as a string, or nil.  Otherwise, the function
-should return a list of such keys, or nil.  The keys should not have any 
leading
-\"@\" character.
+SELECT-KEY is a function called with one argument.  When it is
+nil, the function should return a citation key as a string, or
+nil.  Otherwise, the function should return a list of such keys,
+or nil.  The keys should not have any leading \"@\" character.
 
-SELECT-STYLE is a function called with one argument, the citation object being
-edited or constructed so far.  It should return a style string, or nil.
+SELECT-STYLE is a function called with one argument, the citation
+object being edited or constructed so far.  It should return
+a style string, or nil.
 
-The return value is a function of two arguments: CONTEXT and ARG.  CONTEXT is
-either a citation reference, a citation object, or nil.  ARG is a prefix
-argument.
+The return value is a function of two arguments: CONTEXT and ARG.
+CONTEXT is either a citation reference, a citation object, or
+nil.  ARG is a prefix argument.
 
-The generated function inserts or edit a citation at point.  More specifically,
+The generated function inserts or edits a citation at point.
+More specifically,
 
   On a citation reference:
 
-    - on the prefix or right before the \"@\" character, insert a new reference
-      before the current one,
+    - on the prefix or right before the \"@\" character, insert
+      a new reference before the current one,
     - on the suffix, insert it after the reference,
     - otherwise, update the cite key, preserving both affixes.
 
-    When ARG is non-nil, remove the reference, possibly removing the whole
-    citation if it contains a single reference.
+    When ARG is non-nil, remove the reference, possibly removing
+    the whole citation if it contains a single reference.
 
   On a citation object:
 
     - on the style part, offer to update it,
-    - on the global prefix, add a new reference before the first one,
-    - on the global suffix, add a new reference after the last one,
+    - on the global prefix, add a new reference before the first
+      one,
+    - on the global suffix, add a new reference after the last
+      one.
 
-  Elsewhere, insert a citation at point.  When ARG is non-nil, offer to 
complete
-  style in addition to references."
+  Elsewhere, insert a citation at point.  When ARG is non-nil,
+  offer to complete style in addition to references."
   (unless (and (functionp select-key) (functionp select-style))
     (error "Wrong argument type(s)"))
   (lambda (context arg)
@@ -1589,7 +1633,7 @@ The generated function inserts or edit a citation at 
point.  More specifically,
            (if (>= style-end (point))
                ;; On style part, edit the style.
                (let ((style-start (+ 5 begin))
-                     (style (funcall select-style)))
+                     (style (funcall select-style context)))
                  (unless style (user-error "Aborted"))
                  (org-with-point-at style-start
                    (delete-region style-start style-end)
@@ -1640,17 +1684,18 @@ The generated function inserts or edit a citation at 
point.  More specifically,
 Insertion is done according to the processor set in 
`org-cite-insert-processor'.
 ARG is the prefix argument received when calling interactively the function."
   (interactive "P")
+  (unless org-cite-insert-processor
+    (user-error "No processor set to insert citations"))
+  (org-cite-try-load-processor org-cite-insert-processor)
   (let ((name org-cite-insert-processor))
     (cond
-     ((null name)
-      (user-error "No processor set to insert citations"))
-     ((not (org-cite--get-processor name))
+     ((not (org-cite-get-processor name))
       (user-error "Unknown processor %S" name))
      ((not (org-cite-processor-has-capability-p name 'insert))
       (user-error "Processor %S cannot insert citations" name))
      (t
       (let ((context (org-element-context))
-            (insert (org-cite-processor-insert (org-cite--get-processor 
name))))
+            (insert (org-cite-processor-insert (org-cite-get-processor name))))
         (cond
          ((memq (org-element-type context) '(citation citation-reference))
           (funcall insert context arg))
diff --git a/lisp/org/ol-bbdb.el b/lisp/org/ol-bbdb.el
index ffca438480..ec1d755e82 100644
--- a/lisp/org/ol-bbdb.el
+++ b/lisp/org/ol-bbdb.el
@@ -5,7 +5,7 @@
 ;; Authors: Carsten Dominik <carsten.dominik@gmail.com>
 ;;       Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -93,6 +93,9 @@
 ;;
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org-compat)
 (require 'org-macs)
@@ -132,7 +135,7 @@
 
 (defgroup org-bbdb-anniversaries nil
   "Customizations for including anniversaries from BBDB into Agenda."
-  :group 'org-bbdb)
+  :group 'org-agenda)
 
 (defcustom org-bbdb-default-anniversary-format "birthday"
   "Default anniversary class."
diff --git a/lisp/org/ol-bibtex.el b/lisp/org/ol-bibtex.el
index 81b99167b8..313b1cde88 100644
--- a/lisp/org/ol-bibtex.el
+++ b/lisp/org/ol-bibtex.el
@@ -107,6 +107,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'bibtex)
 (require 'cl-lib)
 (require 'org-compat)
@@ -133,9 +136,10 @@
 (declare-function org-heading-components "org" ())
 (declare-function org-insert-heading "org" (&optional arg invisible-ok top))
 (declare-function org-map-entries "org" (func &optional match scope &rest 
skip))
-(declare-function org-narrow-to-subtree "org" ())
+(declare-function org-narrow-to-subtree "org" (&optional element))
 (declare-function org-set-property "org" (property value))
 (declare-function org-toggle-tag "org" (tag &optional onoff))
+(declare-function org-indent-region "org" (start end))
 
 (declare-function org-search-view "org-agenda" (&optional todo-only string 
edit-at))
 
@@ -232,6 +236,11 @@
 (defvar org-bibtex-entries nil
   "List to hold parsed bibtex entries.")
 
+(defgroup org-bibtex nil
+  "Options for translating between Org headlines and BibTeX entries."
+  :tag "Org BibTeX"
+  :group 'org)
+
 (defcustom org-bibtex-autogen-keys nil
   "Set to a truth value to use `bibtex-generate-autokey' to generate keys."
   :group 'org-bibtex
@@ -344,14 +353,20 @@ and `org-tags-exclude-from-inheritance'."
                                               (upcase property)))))))
     (when it (org-trim it))))
 
-(defun org-bibtex-put (property value)
-  (let ((prop (upcase (if (keywordp property)
-                          (substring (symbol-name property) 1)
-                        property))))
-    (org-set-property
-     (concat (unless (string= org-bibtex-key-property prop) org-bibtex-prefix)
-            prop)
-     value)))
+(defun org-bibtex-put (property value &optional insert-raw)
+  "Set PROPERTY of headline at point to VALUE.
+The PROPERTY will be prefixed with `org-bibtex-prefix' when necessary.
+With non-nil optional argument INSERT-RAW, insert node property string
+at point."
+  (let* ((prop (upcase (if (keywordp property)
+                           (substring (symbol-name property) 1)
+                         property)))
+         (prop (concat (unless (string= org-bibtex-key-property prop)
+                         org-bibtex-prefix)
+                      prop)))
+    (if insert-raw
+        (insert (format ":%s: %s\n" prop value))
+      (org-set-property prop value))))
 
 (defun org-bibtex-headline ()
   "Return a bibtex entry of the given headline as a string."
@@ -703,10 +718,12 @@ Return the number of saved entries."
   (interactive "fFile: ")
   (org-bibtex-read-buffer (find-file-noselect file 'nowarn 'rawfile)))
 
-(defun org-bibtex-write ()
-  "Insert a heading built from the first element of `org-bibtex-entries'."
+(defun org-bibtex-write (&optional noindent)
+  "Insert a heading built from the first element of `org-bibtex-entries'.
+When optional argument NOINDENT is non-nil, do not indent the properties
+drawer."
   (interactive)
-  (when (= (length org-bibtex-entries) 0)
+  (unless org-bibtex-entries
     (error "No entries in `org-bibtex-entries'"))
   (let* ((entry (pop org-bibtex-entries))
         (org-special-properties nil) ; avoids errors with `org-entry-put'
@@ -714,14 +731,16 @@ Return the number of saved entries."
         (togtag (lambda (tag) (org-toggle-tag tag 'on))))
     (org-insert-heading)
     (insert (funcall org-bibtex-headline-format-function entry))
-    (org-bibtex-put "TITLE" (funcall val :title))
+    (insert "\n:PROPERTIES:\n")
+    (org-bibtex-put "TITLE" (funcall val :title) 'insert)
     (org-bibtex-put org-bibtex-type-property-name
-                   (downcase (funcall val :type)))
+                   (downcase (funcall val :type))
+                    'insert)
     (dolist (pair entry)
       (pcase (car pair)
        (:title    nil)
        (:type     nil)
-       (:key      (org-bibtex-put org-bibtex-key-property (cdr pair)))
+       (:key      (org-bibtex-put org-bibtex-key-property (cdr pair) 'insert))
        (:keywords (if org-bibtex-tags-are-keywords
                       (dolist (kw (split-string (cdr pair) ", *"))
                         (funcall
@@ -729,9 +748,14 @@ Return the number of saved entries."
                          (replace-regexp-in-string
                           "[^[:alnum:]_@#%]" ""
                           (replace-regexp-in-string "[ \t]+" "_" kw))))
-                    (org-bibtex-put (car pair) (cdr pair))))
-       (_ (org-bibtex-put (car pair) (cdr pair)))))
-    (mapc togtag org-bibtex-tags)))
+                    (org-bibtex-put (car pair) (cdr pair) 'insert)))
+       (_ (org-bibtex-put (car pair) (cdr pair) 'insert))))
+    (insert ":END:\n")
+    (mapc togtag org-bibtex-tags)
+    (unless noindent
+      (org-indent-region
+       (save-excursion (org-back-to-heading t) (point))
+       (point)))))
 
 (defun org-bibtex-yank ()
   "If kill ring holds a bibtex entry yank it as an Org headline."
@@ -745,10 +769,12 @@ Return the number of saved entries."
 (defun org-bibtex-import-from-file (file)
   "Read bibtex entries from FILE and insert as Org headlines after point."
   (interactive "fFile: ")
-  (dotimes (_ (org-bibtex-read-file file))
-    (save-excursion (org-bibtex-write))
-    (re-search-forward org-property-end-re)
-    (open-line 1) (forward-char 1)))
+  (let ((pos (point)))
+    (dotimes (_ (org-bibtex-read-file file))
+      (save-excursion (org-bibtex-write 'noindent))
+      (re-search-forward org-property-end-re)
+      (insert "\n"))
+    (org-indent-region pos (point))))
 
 (defun org-bibtex-export-to-kill-ring ()
   "Export current headline to kill ring as bibtex entry."
diff --git a/lisp/org/ol-docview.el b/lisp/org/ol-docview.el
index 6ea224c76c..7dbeb0ada5 100644
--- a/lisp/org/ol-docview.el
+++ b/lisp/org/ol-docview.el
@@ -4,7 +4,7 @@
 
 ;; Author: Jan Böcker <jan.boecker at jboecker dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -42,6 +42,8 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
 
 (require 'doc-view)
 (require 'ol)
@@ -75,7 +77,9 @@
                   (string-to-number (match-string 2 link)))))
     ;; Let Org mode open the file (in-emacs = 1) to ensure
     ;; org-link-frame-setup is respected.
-    (org-open-file path 1)
+    (if (file-exists-p path)
+        (org-open-file path 1)
+      (error "No such file: %s" path))
     (when page (doc-view-goto-page page))))
 
 (defun org-docview-store-link ()
diff --git a/lisp/org/ol-doi.el b/lisp/org/ol-doi.el
index 56239f65d4..93be1d90ab 100644
--- a/lisp/org/ol-doi.el
+++ b/lisp/org/ol-doi.el
@@ -26,6 +26,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ol)
 
 (defcustom org-link-doi-server-url "https://doi.org/";
diff --git a/lisp/org/ol-eshell.el b/lisp/org/ol-eshell.el
index 1ca2aa2b28..3be63601dd 100644
--- a/lisp/org/ol-eshell.el
+++ b/lisp/org/ol-eshell.el
@@ -23,6 +23,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'eshell)
 (require 'esh-mode)
 (require 'ol)
@@ -46,7 +49,11 @@ 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 eshell-buffer-name display-comint-buffer-action)
+        (pop-to-buffer
+         eshell-buffer-name
+         (if (boundp 'display-comint-buffer-action) ; Emacs >= 29
+             display-comint-buffer-action
+           '(display-buffer-same-window (inhibit-same-window))))
       (eshell))
     (goto-char (point-max))
     (eshell-kill-input)
diff --git a/lisp/org/ol-eww.el b/lisp/org/ol-eww.el
index d1bb519510..c3992fa076 100644
--- a/lisp/org/ol-eww.el
+++ b/lisp/org/ol-eww.el
@@ -4,7 +4,7 @@
 
 ;; Author: Marco Wahl <marcowahlsoft>a<gmailcom>
 ;; Keywords: link, eww
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -44,14 +44,14 @@
 
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ol)
 (require 'cl-lib)
 (require 'eww)
 
-;; For Emacsen < 25.
-(defvar eww-current-title)
-(defvar eww-current-url)
-
 
 ;; Store Org link in Eww mode buffer
 (org-link-set-parameters "eww"
@@ -67,14 +67,10 @@
   (when (eq major-mode 'eww-mode)
     (org-link-store-props
      :type "eww"
-     :link (if (< emacs-major-version 25)
-              eww-current-url
-            (eww-current-url))
+     :link (eww-current-url)
      :url (url-view-url t)
-     :description (if (< emacs-major-version 25)
-                     (or eww-current-title eww-current-url)
-                   (or (plist-get eww-data :title)
-                       (eww-current-url))))))
+     :description (or (plist-get eww-data :title)
+                      (eww-current-url)))))
 
 
 ;; Some auxiliary functions concerning links in Eww buffers
diff --git a/lisp/org/ol-gnus.el b/lisp/org/ol-gnus.el
index 3a3857fbf9..185218ab77 100644
--- a/lisp/org/ol-gnus.el
+++ b/lisp/org/ol-gnus.el
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;;         Tassilo Horn <tassilo at member dot fsf dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -31,6 +31,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'gnus-sum)
 (require 'gnus-util)
 (require 'nnheader)
@@ -71,7 +74,7 @@ negates this setting for the duration of the command."
 
 (defcustom org-gnus-no-server nil
   "Should Gnus be started using `gnus-no-server'?"
-  :group 'org-gnus
+  :group 'org-link-follow
   :version "24.4"
   :package-version '(Org . "8.0")
   :type 'boolean)
diff --git a/lisp/org/ol-info.el b/lisp/org/ol-info.el
index 3730ff5ad4..d332b2837b 100644
--- a/lisp/org/ol-info.el
+++ b/lisp/org/ol-info.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -30,6 +30,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ol)
 
 ;; Declare external functions and variables
@@ -43,7 +46,8 @@
 (org-link-set-parameters "info"
                         :follow #'org-info-open
                         :export #'org-info-export
-                        :store #'org-info-store-link)
+                        :store #'org-info-store-link
+                         :insert-description #'org-info-description-as-command)
 
 ;; Implementation
 (defun org-info-store-link ()
@@ -63,24 +67,65 @@
   "Follow an Info file and node link specified by PATH."
   (org-info-follow-link path))
 
+(defun org-info--link-file-node (path)
+  "Extract file name and node from info link PATH.
+
+Return cons consisting of file name and node name or \"Top\" if node
+part is not specified.  Components may be separated by \":\" or by \"#\".
+File may be a virtual one, see `Info-virtual-files'."
+  (if (not path)
+      '("dir" . "Top")
+    (string-match "\\`\\([^#:]*\\)\\(?:[#:]:?\\(.*\\)\\)?\\'" path)
+    (let* ((node (match-string 2 path))
+           ;; Do not reorder, `org-trim' modifies match.
+           (file (org-trim (match-string 1 path))))
+      (cons
+       (if (org-string-nw-p file) file "dir")
+       (if (org-string-nw-p node) (org-trim node) "Top")))))
+
+(defun org-info-description-as-command (link desc)
+  "Info link description that can be pasted as command.
+
+For the following LINK
+
+    \"info:elisp#Non-ASCII in Strings\"
+
+the result is
+
+    info \"(elisp) Non-ASCII in Strings\"
+
+that may be executed as shell command or evaluated by
+\\[eval-expression] (wrapped with parenthesis) to read the manual
+in Emacs.
+
+Calling convention is similar to `org-link-make-description-function'.
+DESC has higher priority and returned when it is not nil or empty string.
+If LINK is not an info link then DESC is returned."
+  (let* ((prefix "info:")
+         (need-file-node (and (not (org-string-nw-p desc))
+                              (string-prefix-p prefix link))))
+    (pcase (and need-file-node
+                (org-info--link-file-node (org-unbracket-string prefix "" 
link)))
+      ;; Unlike (info "dir"), "info dir" shell command opens "(coreutils)dir 
invocation".
+      (`("dir" . "Top") "info \"(dir)\"")
+      (`(,file . "Top") (format "info %s" file))
+      (`(,file . ,node) (format "info \"(%s) %s\"" file node))
+      (_ desc))))
 
 (defun org-info-follow-link (name)
   "Follow an Info file and node link specified by NAME."
-  (if (or (string-match "\\(.*\\)\\(?:#\\|::\\)\\(.*\\)" name)
-          (string-match "\\(.*\\)" name))
-      (let ((filename (match-string 1 name))
-           (nodename-or-index (or (match-string 2 name) "Top")))
-       (require 'info)
-       ;; If nodename-or-index is invalid node name, then look it up
-       ;; in the index.
-       (condition-case nil
-           (Info-find-node filename nodename-or-index)
-         (user-error (Info-find-node filename "Top")
-                     (condition-case nil
-                         (Info-index nodename-or-index)
-                       (user-error "Could not find '%s' node or index entry"
-                                   nodename-or-index)))))
-    (user-error "Could not open: %s" name)))
+  (pcase-let ((`(,filename . ,nodename-or-index)
+              (org-info--link-file-node name)))
+    (require 'info)
+    ;; If nodename-or-index is invalid node name, then look it up
+    ;; in the index.
+    (condition-case nil
+        (Info-find-node filename nodename-or-index)
+      (user-error (Info-find-node filename "Top")
+                  (condition-case nil
+                      (Info-index nodename-or-index)
+                    (user-error "Could not find '%s' node or index entry"
+                                nodename-or-index))))))
 
 (defconst org-info-emacs-documents
   '("ada-mode" "auth" "autotype" "bovine" "calc" "ccmode" "cl" "dbus" "dired-x"
@@ -95,7 +140,8 @@
 Taken from <https://www.gnu.org/software/emacs/manual/html_mono/.>")
 
 (defconst org-info-other-documents
-  '(("libc" . "https://www.gnu.org/software/libc/manual/html_mono/libc.html";)
+  '(("dir" . "https://www.gnu.org/manual/manual.html";) ; index
+    ("libc" . "https://www.gnu.org/software/libc/manual/html_mono/libc.html";)
     ("make" . "https://www.gnu.org/software/make/manual/make.html";))
   "Alist of documents generated from Texinfo source.
 When converting info links to HTML, links to any one of these manuals are
@@ -129,9 +175,7 @@ See `org-info-emacs-documents' and 
`org-info-other-documents' for details."
 (defun org-info-export (path desc format)
   "Export an info link.
 See `org-link-parameters' for details about PATH, DESC and FORMAT."
-  (let* ((parts (split-string path "#\\|::"))
-        (manual (car parts))
-        (node (or (nth 1 parts) "Top")))
+  (pcase-let ((`(,manual . ,node) (org-info--link-file-node path)))
     (pcase format
       (`html
        (format "<a href=\"%s#%s\">%s</a>"
diff --git a/lisp/org/ol-irc.el b/lisp/org/ol-irc.el
index e36c44ff70..25d11ca13e 100644
--- a/lisp/org/ol-irc.el
+++ b/lisp/org/ol-irc.el
@@ -48,6 +48,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ol)
 
 (declare-function erc-buffer-filter "erc" (predicate &optional proc))
diff --git a/lisp/org/ol-man.el b/lisp/org/ol-man.el
index beed216acf..a85ed9badf 100644
--- a/lisp/org/ol-man.el
+++ b/lisp/org/ol-man.el
@@ -4,7 +4,7 @@
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Maintainer: Bastien Guerry <bzg@gnu.org>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -24,6 +24,9 @@
 ;;
 ;;; Commentary:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ol)
 
 (org-link-set-parameters "man"
@@ -43,12 +46,22 @@ If PATH contains extra ::STRING which will use `occur' to 
search
 matched strings in man buffer."
   (string-match "\\(.*?\\)\\(?:::\\(.*\\)\\)?$" path)
   (let* ((command (match-string 1 path))
-        (search (match-string 2 path)))
-    (funcall org-man-command command)
+         (search (match-string 2 path))
+         (buffer (funcall org-man-command command)))
     (when search
-      (with-current-buffer (concat "*Man " command "*")
-       (goto-char (point-min))
-       (search-forward search)))))
+      (with-current-buffer buffer
+        (goto-char (point-min))
+        (unless (search-forward search nil t)
+          (let ((process (get-buffer-process buffer)))
+            (while (process-live-p process)
+              (accept-process-output process)))
+          (goto-char (point-min))
+          (search-forward search))
+        (forward-line -1)
+        (let ((point (point)))
+          (let ((window (get-buffer-window buffer)))
+            (set-window-point window point)
+            (set-window-start window point)))))))
 
 (defun org-man-store-link ()
   "Store a link to a README file."
diff --git a/lisp/org/ol-mhe.el b/lisp/org/ol-mhe.el
index 49104d392a..8bd8aa6bfd 100644
--- a/lisp/org/ol-mhe.el
+++ b/lisp/org/ol-mhe.el
@@ -4,7 +4,7 @@
 
 ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -30,6 +30,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org-macs)
 (require 'ol)
 
diff --git a/lisp/org/ol-rmail.el b/lisp/org/ol-rmail.el
index 8a28d720bb..4d6f82c9b4 100644
--- a/lisp/org/ol-rmail.el
+++ b/lisp/org/ol-rmail.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -30,6 +30,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ol)
 
 ;; Declare external functions and variables
diff --git a/lisp/org/ol-w3m.el b/lisp/org/ol-w3m.el
index 80d6811a5c..7bd241080b 100644
--- a/lisp/org/ol-w3m.el
+++ b/lisp/org/ol-w3m.el
@@ -4,7 +4,7 @@
 
 ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 
@@ -41,6 +41,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ol)
 
 (defvar w3m-current-url)
diff --git a/lisp/org/ol.el b/lisp/org/ol.el
index 108f031cde..3ae8f88755 100644
--- a/lisp/org/ol.el
+++ b/lisp/org/ol.el
@@ -27,8 +27,12 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org-compat)
 (require 'org-macs)
+(require 'org-fold)
 
 (defvar clean-buffer-list-kill-buffer-names)
 (defvar org-agenda-buffer-name)
@@ -38,7 +42,6 @@
 (defvar org-inhibit-startup)
 (defvar org-outline-regexp-bol)
 (defvar org-src-source-file-name)
-(defvar org-time-stamp-formats)
 (defvar org-ts-regexp)
 
 (declare-function calendar-cursor-to-date "calendar" (&optional error event))
@@ -47,7 +50,7 @@
 (declare-function org-back-to-heading "org" (&optional invisible-ok))
 (declare-function org-before-first-heading-p "org" ())
 (declare-function org-do-occur "org" (regexp &optional cleanup))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-cache-refresh "org-element" (pos))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-lineage "org-element" (datum &optional types 
with-self))
@@ -66,10 +69,10 @@
 (declare-function org-mode "org" ())
 (declare-function org-occur "org" (regexp &optional keep-previous callback))
 (declare-function org-open-file "org" (path &optional in-emacs line search))
-(declare-function org-overview "org" ())
+(declare-function org-cycle-overview "org-cycle" ())
 (declare-function org-restart-font-lock "org" ())
 (declare-function org-run-like-in-org-mode "org" (cmd))
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-fold-show-context "org-fold" (&optional key))
 (declare-function org-src-coderef-format "org-src" (&optional element))
 (declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
 (declare-function org-src-edit-buffer-p "org-src" (&optional buffer))
@@ -140,6 +143,19 @@ link.
   Function that inserts a link with completion.  The function
   takes one optional prefix argument.
 
+`:insert-description'
+
+  String or function used as a default when prompting users for a
+  link's description.  A string is used as-is, a function is
+  called with two arguments: the link location (a string such as
+  \"~/foobar\", \"id:some-org-id\" or \"https://www.foo.com\";)
+  and the description generated by `org-insert-link'.  It should
+  return the description to use (this reflects the behavior of
+  `org-link-make-description-function').  If it returns nil, no
+  default description is used, but no error is thrown (from the
+  user's perspective, this is equivalent to a default description
+  of \"\").
+
 `:display'
 
   Value for `invisible' text property on the hidden parts of the
@@ -199,7 +215,9 @@ You can interactively set the value of this variable by 
calling
 This function must take two parameters: the first one is the
 link, the second one is the description generated by
 `org-insert-link'.  The function should return the description to
-use."
+use.  If it returns nil, no default description is used, but no
+error is thrown (from the user’s perspective, this is equivalent
+to a default description of \"\")."
   :group 'org-link
   :type '(choice (const nil) (function))
   :safe #'null)
@@ -604,6 +622,22 @@ exact and fuzzy text search.")
 (defvar org-link--search-failed nil
   "Non-nil when last link search failed.")
 
+
+(defvar-local org-link--link-folding-spec '(org-link
+                                            (:global t)
+                                            (:ellipsis . nil)
+                                            (:isearch-open . t)
+                                            (:fragile . 
org-link--reveal-maybe))
+  "Folding spec used to hide invisible parts of links.")
+
+(defvar-local org-link--description-folding-spec '(org-link-description
+                                                   (:global t)
+                                                   (:ellipsis . nil)
+                                                   (:visible . t)
+                                                   (:isearch-open . nil)
+                                                   (:fragile . 
org-link--reveal-maybe))
+  "Folding spec used to reveal link description.")
+
 
 ;;; Internal Functions
 
@@ -700,7 +734,7 @@ followed by another \"%[A-F0-9]{2}\" group."
                (make-indirect-buffer (current-buffer)
                                      indirect-buffer-name
                                      'clone))))
-      (with-current-buffer indirect-buffer (org-overview))
+      (with-current-buffer indirect-buffer (org-cycle-overview))
       indirect-buffer))))
 
 (defun org-link--search-radio-target (target)
@@ -718,7 +752,7 @@ White spaces are not significant."
        (let ((object (org-element-context)))
          (when (eq (org-element-type object) 'radio-target)
            (goto-char (org-element-property :begin object))
-           (org-show-context 'link-search)
+           (org-fold-show-context 'link-search)
            (throw :radio-match nil))))
       (goto-char origin)
       (user-error "No match for radio target: %s" target))))
@@ -761,6 +795,13 @@ syntax around the string."
                   (t nil))))
     string))
 
+(defun org-link--reveal-maybe (region _)
+  "Reveal folded link in REGION when needed.
+This function is intended to be used as :fragile property of a folding
+spec."
+  (org-with-point-at (car region)
+    (not (org-in-regexp org-link-any-re))))
+
 
 ;;; Public API
 
@@ -975,7 +1016,9 @@ LINK is escaped with backslashes for inclusion in buffer."
                (replace-regexp-in-string "]\\'"
                                          (concat "\\&" zero-width-space)
                                          (org-trim description))))))
-    (if (not (org-string-nw-p link)) description
+    (if (not (org-string-nw-p link))
+        (or description
+            (error "Empty link"))
       (format "[[%s]%s]"
              (org-link-escape link)
              (if description (format "[%s]" description) "")))))
@@ -1257,7 +1300,7 @@ of matched result, which is either `dedicated' or 
`fuzzy'."
        (error "No match for fuzzy expression: %s" normalized)))
     ;; Disclose surroundings of match, if appropriate.
     (when (and (derived-mode-p 'org-mode) (not stealth))
-      (org-show-context 'link-search))
+      (org-fold-show-context 'link-search))
     type))
 
 (defun org-link-heading-search-string (&optional string)
@@ -1322,7 +1365,7 @@ PATH is the sexp to evaluate, as a string."
               (string-match-p org-link-elisp-skip-confirm-regexp path))
          (not org-link-elisp-confirm-function)
          (funcall org-link-elisp-confirm-function
-                  (format "Execute %S as Elisp? "
+                  (format "Execute %s as Elisp? "
                           (org-add-props path nil 'face 'org-warning))))
       (message "%s => %s" path
               (if (eq ?\( (string-to-char path))
@@ -1377,7 +1420,7 @@ PATH is the command to execute, as a string."
               (string-match-p org-link-shell-skip-confirm-regexp path))
          (not org-link-shell-confirm-function)
          (funcall org-link-shell-confirm-function
-                  (format "Execute %S in shell? "
+                  (format "Execute %s in shell? "
                           (org-add-props path nil 'face 'org-warning))))
       (let ((buf (generate-new-buffer "*Org Shell Output*")))
        (message "Executing %s" path)
@@ -1430,7 +1473,7 @@ is non-nil, move backward."
            (`nil nil)
            (link
             (goto-char (org-element-property :begin link))
-            (when (org-invisible-p) (org-show-context))
+            (when (org-invisible-p) (org-fold-show-context 'link-search))
             (throw :found t)))))
       (goto-char pos)
       (setq org-link--search-failed t)
@@ -1443,14 +1486,18 @@ If the link is in hidden text, expose it."
   (interactive)
   (org-next-link t))
 
+(defun org-link-descriptive-ensure ()
+  "Toggle the literal or descriptive display of links in current buffer if 
needed."
+  (org-fold-core-set-folding-spec-property
+   (car org-link--link-folding-spec)
+   :visible (not org-link-descriptive)))
+
 ;;;###autoload
 (defun org-toggle-link-display ()
-  "Toggle the literal or descriptive display of links."
+  "Toggle the literal or descriptive display of links in current buffer."
   (interactive)
-  (if org-link-descriptive (remove-from-invisibility-spec '(org-link))
-    (add-to-invisibility-spec '(org-link)))
-  (org-restart-font-lock)
-  (setq org-link-descriptive (not org-link-descriptive)))
+  (setq org-link-descriptive (not org-link-descriptive))
+  (org-link-descriptive-ensure))
 
 ;;;###autoload
 (defun org-store-link (arg &optional interactive?)
@@ -1519,10 +1566,8 @@ non-nil."
                  t))))
        (setq link (plist-get org-store-link-plist :link))
         ;; If store function actually set `:description' property, use
-        ;; it, even if it is nil.  Otherwise, fallback to link value.
-       (setq desc (if (plist-member org-store-link-plist :description)
-                       (plist-get org-store-link-plist :description)
-                    link)))
+        ;; it, even if it is nil.  Otherwise, fallback to nil (ask user).
+       (setq desc (plist-get org-store-link-plist :description)))
 
        ;; Store a link from a remote editing buffer.
        ((org-src-edit-buffer-p)
@@ -1563,7 +1608,7 @@ non-nil."
           (t (setq link nil)))))
 
        ;; We are in the agenda, link to referenced location
-       ((equal (bound-and-true-p org-agenda-buffer-name) (buffer-name))
+       ((eq major-mode 'org-agenda-mode)
        (let ((m (or (get-text-property (point) 'org-hd-marker)
                     (get-text-property (point) 'org-marker))))
          (when m
@@ -1574,10 +1619,8 @@ non-nil."
        (let ((cd (calendar-cursor-to-date)))
          (setq link
                (format-time-string
-                (car org-time-stamp-formats)
-                (apply 'encode-time
-                       (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)
-                             nil nil nil))))
+                 (org-time-stamp-format)
+                (org-encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd))))
          (org-link-store-props :type "calendar" :date cd)))
 
        ((eq major-mode 'image-mode)
@@ -1592,7 +1635,7 @@ non-nil."
          (setq file (if file
                         (abbreviate-file-name
                          (expand-file-name (dired-get-filename nil t)))
-                      ;; otherwise, no file so use current directory.
+                      ;; Otherwise, no file so use current directory.
                       default-directory))
          (setq cpltxt (concat "file:" file)
                link cpltxt)))
@@ -1605,24 +1648,23 @@ non-nil."
 
        ((and (buffer-file-name (buffer-base-buffer)) (derived-mode-p 
'org-mode))
        (org-with-limited-levels
-         (cond
-         ;; Store a link using the target at point.
+        (setq custom-id (org-entry-get nil "CUSTOM_ID"))
+        (cond
+         ;; Store a link using the target at point
          ((org-in-regexp "[^<]<<\\([^<>]+\\)>>[^>]" 1)
-          (setq cpltxt
+          (setq link
                 (concat "file:"
                         (abbreviate-file-name
                          (buffer-file-name (buffer-base-buffer)))
                         "::" (match-string 1))
-                link cpltxt))
-          ;; Store a link using the CUSTOM_ID property.
-          ((setq custom-id (org-entry-get nil "CUSTOM_ID"))
-           (setq cpltxt
-                (concat "file:"
-                        (abbreviate-file-name
-                         (buffer-file-name (buffer-base-buffer)))
-                        "::#" custom-id)
-                link cpltxt))
-          ;; Store a link using (and perhaps creating) the ID property.
+                 ;; Target may be shortened when link is inserted.
+                 ;; Avoid [[target][file:~/org/test.org::target]]
+                 ;; links.  Maybe the case of identical target and
+                 ;; description should be handled by `org-insert-link'.
+                 cpltxt nil
+                 desc nil
+                 ;; Do not append #CUSTOM_ID link below.
+                 custom-id nil))
          ((and (featurep 'org-id)
                (or (eq org-id-link-to-org-use-id t)
                    (and interactive?
@@ -1631,13 +1673,12 @@ non-nil."
                                      'create-if-interactive-and-no-custom-id)
                                  (not custom-id))))
                    (and org-id-link-to-org-use-id (org-entry-get nil "ID"))))
+          ;; Store a link using the ID at point
           (setq link (condition-case nil
                          (prog1 (org-id-store-link)
-                           (setq desc (or (plist-get org-store-link-plist
-                                                     :description)
-                                          "")))
+                           (setq desc (plist-get org-store-link-plist 
:description)))
                        (error
-                        ;; Probably before first headline, link only to file.
+                        ;; Probably before first headline, link only to file
                         (concat "file:"
                                 (abbreviate-file-name
                                  (buffer-file-name (buffer-base-buffer))))))))
@@ -1697,8 +1738,7 @@ non-nil."
 
       ;; We're done setting link and desc, clean up
       (when (consp link) (setq cpltxt (car link) link (cdr link)))
-      (setq link (or link cpltxt)
-           desc (or desc cpltxt))
+      (setq link (or link cpltxt))
       (cond ((not desc))
            ((equal desc "NONE") (setq desc nil))
            (t (setq desc (org-link-display-format desc))))
@@ -1728,6 +1768,9 @@ The history can be used to select a link previously 
stored with
 press `RET' at the prompt), the link defaults to the most recently
 stored link.  As `SPC' triggers completion in the minibuffer, you need to
 use `M-SPC' or `C-q SPC' to force the insertion of a space character.
+Completion candidates include link descriptions.
+
+If there is a link under cursor then edit it.
 
 You will also be prompted for a description, and if one is given, it will
 be displayed in the buffer instead of the link.
@@ -1753,11 +1796,14 @@ prefix negates `org-link-keep-stored-after-insertion'.
 If the LINK-LOCATION parameter is non-nil, this value will be used as
 the link location instead of reading one interactively.
 
-If the DESCRIPTION parameter is non-nil, this value will be used as the
-default description.  Otherwise, if `org-link-make-description-function'
-is non-nil, this function will be called with the link target, and the
-result will be the default link description.  When called non-interactively,
-don't allow to edit the default description."
+If the DESCRIPTION parameter is non-nil, this value will be used
+as the default description.  If not, and the chosen link type has
+a non-nil `:insert-description' parameter, that is used to
+generate a description as described in `org-link-parameters'
+docstring.  Otherwise, if `org-link-make-description-function' is
+non-nil, this function will be called with the link target, and
+the result will be the default link description.  When called
+non-interactively, don't allow to edit the default description."
   (interactive "P")
   (let* ((wcf (current-window-configuration))
         (origbuf (current-buffer))
@@ -1767,7 +1813,10 @@ don't allow to edit the default description."
         (desc region)
         (link link-location)
         (abbrevs org-link-abbrev-alist-local)
-        entry all-prefixes auto-desc)
+        (all-prefixes (append (mapcar #'car abbrevs)
+                              (mapcar #'car org-link-abbrev-alist)
+                              (org-link-types)))
+         entry)
     (cond
      (link-location)                 ; specified by arg, just use it.
      ((org-in-regexp org-link-bracket-re 1)
@@ -1808,9 +1857,6 @@ Use TAB to complete link prefixes, then RET for 
type-specific completion support
          (unless (pos-visible-in-window-p (point-max))
            (org-fit-window-to-buffer))
          (and (window-live-p cw) (select-window cw))))
-      (setq all-prefixes (append (mapcar #'car abbrevs)
-                                (mapcar #'car org-link-abbrev-alist)
-                                (org-link-types)))
       (unwind-protect
          ;; Fake a link history, containing the stored links.
          (let ((org-link--history
@@ -1821,15 +1867,19 @@ Use TAB to complete link prefixes, then RET for 
type-specific completion support
                   "Link: "
                   (append
                    (mapcar (lambda (x) (concat x ":")) all-prefixes)
-                   (mapcar #'car org-stored-links))
+                   (mapcar #'car org-stored-links)
+                    ;; Allow description completion.  Avoid "nil" option
+                    ;; in the case of `completing-read-default' and
+                    ;; an error in `ido-completing-read' when some links
+                    ;; have no description.
+                    (delq nil (mapcar 'cadr org-stored-links)))
                   nil nil nil
                   'org-link--history
                   (caar org-stored-links)))
            (unless (org-string-nw-p link) (user-error "No link selected"))
            (dolist (l org-stored-links)
              (when (equal link (cadr l))
-               (setq link (car l))
-               (setq auto-desc t)))
+               (setq link (car l))))
            (when (or (member link all-prefixes)
                      (and (equal ":" (substring link -1))
                           (member (substring link 0 -1) all-prefixes)
@@ -1906,21 +1956,40 @@ Use TAB to complete link prefixes, then RET for 
type-specific completion support
          (when (equal desc origpath)
            (setq desc path)))))
 
-    (unless auto-desc
-      (let ((initial-input
-            (cond
-             (description)
-             ((not org-link-make-description-function) desc)
-             (t (condition-case nil
-                    (funcall org-link-make-description-function link desc)
-                  (error
-                   (message "Can't get link description from %S"
-                            (symbol-name org-link-make-description-function))
-                   (sit-for 2)
-                   nil))))))
-       (setq desc (if (called-interactively-p 'any)
-                      (read-string "Description: " initial-input)
-                    initial-input))))
+    (let* ((type
+            (cond
+             ((and all-prefixes
+                   (string-match (rx-to-string `(: string-start (submatch (or 
,@all-prefixes)) ":")) link))
+              (match-string 1 link))
+             ((file-name-absolute-p link) "file")
+             ((string-match "\\`\\.\\.?/" link) "file")))
+           (initial-input
+            (cond
+             (description)
+             (desc)
+             ((org-link-get-parameter type :insert-description)
+              (let ((def (org-link-get-parameter type :insert-description)))
+                (condition-case nil
+                    (cond
+                     ((stringp def) def)
+                     ((functionp def)
+                      (funcall def link desc)))
+                  (error
+                   (message "Can't get link description from org link 
parameter `:insert-description': %S"
+                            def)
+                   (sit-for 2)
+                   nil))))
+             (org-link-make-description-function
+              (condition-case nil
+                  (funcall org-link-make-description-function link desc)
+                (error
+                 (message "Can't get link description from %S"
+                          org-link-make-description-function)
+                 (sit-for 2)
+                 nil))))))
+      (setq desc (if (called-interactively-p 'any)
+                     (read-string "Description: " initial-input)
+                   initial-input)))
 
     (unless (org-string-nw-p desc) (setq desc nil))
     (when remove (apply #'delete-region remove))
@@ -1989,6 +2058,10 @@ Also refresh fontification if needed."
                  (cl-pushnew (org-element-property :value obj) rtn
                              :test #'equal))))
            rtn))))
+    (setq targets
+          (sort targets
+                (lambda (a b)
+                  (> (length a) (length b)))))
     (setq org-target-link-regexp
          (and targets
               (concat before-re
@@ -2012,7 +2085,8 @@ Also refresh fontification if needed."
                                    (list old-regexp org-target-link-regexp)
                                    "\\|")
                                   after-re)))))
-       (when (featurep 'org-element)
+       (when (and (featurep 'org-element)
+                   (not (bound-and-true-p org-mode-loading)))
          (org-with-point-at 1
            (while (re-search-forward regexp nil t)
              (org-element-cache-refresh (match-beginning 1))))))
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index e43950f13a..eda2489384 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -45,8 +45,12 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ol)
+(require 'org-fold-core)
 (require 'org)
 (require 'org-macs)
 (require 'org-refile)
@@ -76,6 +80,11 @@
 (declare-function org-columns-quit              "org-colview" ())
 (declare-function diary-date-display-form       "diary-lib"  (&optional type))
 (declare-function org-mobile-write-agenda-for-mobile "org-mobile" (file))
+(declare-function org-element-property "org-element" (property element))
+(declare-function org-element--cache-active-p "org-element"
+                  (&optional called-from-cache-change-func-p))
+(declare-function org-element-lineage "org-element"
+                  (datum &optional types with-self))
 (declare-function org-habit-insert-consistency-graphs
                  "org-habit" (&optional line))
 (declare-function org-is-habit-p "org-habit" (&optional pom))
@@ -127,13 +136,18 @@ name and week number or the separator lines."
   :group 'org-agenda
   :type 'boolean)
 
-(defcustom org-agenda-block-separator ?=
+(defcustom org-agenda-block-separator
+  (if (and (display-graphic-p)
+           (char-displayable-p ?─))
+      ?─
+    ?=)
   "The separator between blocks in the agenda.
 If this is a string, it will be used as the separator, with a newline added.
 If it is a character, it will be repeated to fill the window width.
 If nil the separator is disabled.  In `org-agenda-custom-commands' this
 addresses the separator between the current and the previous block."
   :group 'org-agenda
+  :package-version '(Org . "9.6")
   :type '(choice
          (const :tag "Disabled" nil)
          (character)
@@ -458,10 +472,11 @@ agenda dispatcher `\\[org-agenda]'.  Each entry is a list 
like this:
 
 key      The key (one or more characters as a string) to be associated
          with the command.
-desc     A description of the command, when omitted or nil, a default
+desc     A description of the command.  When omitted or nil, a default
          description is built using MATCH.
 type     The command type, any of the following symbols:
           agenda      The daily/weekly agenda.
+          agenda*     Appointments for current week/day.
           todo        Entries with a specific TODO keyword, in all agenda 
files.
           search      Entries containing search words entry or headline.
           tags        Tags/Property/TODO match in all agenda files.
@@ -469,6 +484,8 @@ type     The command type, any of the following symbols:
           todo-tree   Sparse tree of specific TODO keyword in *current* file.
           tags-tree   Sparse tree with all tags matches in *current* file.
           occur-tree  Occur sparse tree for *current* file.
+          alltodo     The global TODO list.
+          stuck       Stuck projects.
           ...         A user-defined function.
 match    What to search for:
           - a single keyword for TODO keyword searches
@@ -482,7 +499,7 @@ settings  A list of option settings, similar to that in a 
let form, so like
 files     A list of files to write the produced agenda buffer to with
           the command `org-store-agenda-views'.
           If a file name ends in \".html\", an HTML version of the buffer
-          is written out.  If it ends in \".ps\", a postscript version is
+          is written out.  If it ends in \".ps\", a PostScript version is
           produced.  Otherwise, only the plain text is written to the file.
 
 You can also define a set of commands, to create a composite agenda buffer.
@@ -494,9 +511,9 @@ where
 
 desc   A description string to be displayed in the dispatcher menu.
 cmd    An agenda command, similar to the above.  However, tree commands
-       are not allowed, but instead you can get agenda and global todo list.
-       So valid commands for a set are:
+       are not allowed.  Valid commands for a set are:
        (agenda \"\" settings)
+       (agenda* \"\" settings)
        (alltodo \"\" settings)
        (stuck \"\" settings)
        (todo \"match\" settings files)
@@ -516,7 +533,9 @@ should provide a description for the prefix, like
    \\='((\"h\" . \"HOME + Name tag searches\") ; describe prefix \"h\"
      (\"hl\" tags \"+HOME+Lisa\")
      (\"hp\" tags \"+HOME+Peter\")
-     (\"hk\" tags \"+HOME+Kim\")))"
+     (\"hk\" tags \"+HOME+Kim\")))
+
+See also Info node `(org) Custom Agenda Views'."
   :group 'org-agenda-custom-commands
   :type `(repeat
          (choice :value ("x" "Describe command here" tags "" nil)
@@ -595,13 +614,17 @@ you can then use it to define a custom command."
   '("+LEVEL=2/-DONE" ("TODO" "NEXT" "NEXTACTION") nil "")
   "How to identify stuck projects.
 This is a list of four items:
+
 1. A tags/todo/property matcher string that is used to identify a project.
-   See the manual for a description of tag and property searches.
-   The entire tree below a headline matched by this is considered one project.
+   See Info node `(org) Matching tags and properties' for a
+   description of tag and property searches.  The entire tree
+   below a headline matched by this is considered one project.
+
 2. A list of TODO keywords identifying non-stuck projects.
    If the project subtree contains any headline with one of these todo
    keywords, the project is considered to be not stuck.  If you specify
    \"*\" as a keyword, any TODO keyword will mark the project unstuck.
+
 3. A list of tags identifying non-stuck projects.
    If the project subtree contains any headline with one of these tags,
    the project is considered to be not stuck.  If you specify \"*\" as
@@ -609,6 +632,7 @@ This is a list of four items:
    the explicit presence of a tag somewhere in the subtree, inherited
    tags do not count here.  If inherited tags make a project not stuck,
    use \"-TAG\" in the tags part of the matcher under (1.) above.
+
 4. An arbitrary regular expression matching non-stuck projects.
 
 If the project turns out to be not stuck, search continues also in the
@@ -1044,9 +1068,16 @@ current item's tree, in an indirect buffer."
   :type 'boolean)
 
 (defcustom org-agenda-show-outline-path t
-  "Non-nil means show outline path in echo area after line motion."
+  "Non-nil means show outline path in echo area after line motion.
+
+If set to `title', show outline path with prepended document
+title.  Fallback to file name is no title is present."
   :group 'org-agenda-startup
-  :type 'boolean)
+  :type '(choice
+         (const :tag "Don't show outline path in agenda view." nil)
+         (const :tag "Show outline path with prepended file name." t)
+         (const :tag "Show outline path with prepended document title." title))
+  :package-version '(Org . "9.6"))
 
 (defcustom org-agenda-start-with-entry-text-mode nil
   "The initial value of entry-text-mode in a newly created agenda window."
@@ -1216,6 +1247,17 @@ For example, 9:30am would become 09:30 rather than  
9:30."
   :version "24.1"
   :type 'boolean)
 
+(defcustom org-agenda-clock-report-header nil
+  "Header inserted before the table in Org agenda clock report mode.
+
+See Info node `(org) Agenda Commands' for more details."
+  :group 'org-agenda
+  :type '(choice
+          (string :tag "Header")
+          (const :tag "No header" nil))
+  :safe #'stringp
+  :package-version '(Org . "9.6"))
+
 (defun org-agenda-time-of-day-to-ampm (time)
   "Convert TIME of a string like \"13:45\" to an AM/PM style time string."
   (let* ((hour-number (string-to-number (substring time 0 -3)))
@@ -1516,11 +1558,12 @@ the variable `org-agenda-time-grid'."
   :type 'boolean)
 
 (defcustom org-agenda-time-grid
-  '((daily today require-timed)
-    (800 1000 1200 1400 1600 1800 2000)
-    "......"
-    "----------------")
-
+  (let ((graphical (and (display-graphic-p)
+                        (char-displayable-p ?┄))))
+    `((daily today require-timed)
+      (800 1000 1200 1400 1600 1800 2000)
+      ,(if graphical " ┄┄┄┄┄ " "......")
+      ,(if graphical "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄" "----------------")))
   "The settings for time grid for agenda display.
 This is a list of four items.  The first item is again a list.  It contains
 symbols specifying conditions when the grid should be displayed:
@@ -1540,6 +1583,7 @@ times that have a grid line.
 The fourth item is a string placed after the grid times.  This
 will align with agenda items."
   :group 'org-agenda-time-grid
+  :package-version '(Org . "9.6")
   :type
   '(list
     (set :greedy t :tag "Grid Display Options"
@@ -1561,10 +1605,14 @@ will align with agenda items."
   :type 'boolean)
 
 (defcustom org-agenda-current-time-string
-  "now - - - - - - - - - - - - - - - - - - - - - - - - -"
+  (if (and (display-graphic-p)
+           (char-displayable-p ?←)
+           (char-displayable-p ?─))
+      "← now ───────────────────────────────────────────────"
+    "now - - - - - - - - - - - - - - - - - - - - - - - - -")
   "The string for the current time marker in the agenda."
   :group 'org-agenda-time-grid
-  :version "24.1"
+  :package-version '(Org . "9.6")
   :type 'string)
 
 (defgroup org-agenda-sorting nil
@@ -1614,8 +1662,9 @@ alpha-up           Sort headlines alphabetically.
 alpha-down         Sort headlines alphabetically, reversed.
 
 The different possibilities will be tried in sequence, and testing stops
-if one comparison returns a \"not-equal\".  For example, the default
-    `(time-up category-keep priority-down)'
+if one comparison returns a \"not-equal\".  For example,
+  (setq org-agenda-sorting-strategy
+        \\='(time-up category-keep priority-down))
 means: Pull out all entries having a specified time of day and sort them,
 in order to make a time schedule for the current day the first thing in the
 agenda listing for the day.  Of the entries without a time indication, keep
@@ -2078,10 +2127,11 @@ the lower-case version of all tags."
 
 (defcustom org-agenda-bulk-custom-functions nil
   "Alist of characters and custom functions for bulk actions.
-For example, this value makes those two functions available:
+For example, this makes those two functions available:
 
-  \\='((?R set-category)
-    (?C bulk-cut))
+  (setq org-agenda-bulk-custom-functions
+        \\='((?R set-category)
+          (?C bulk-cut)))
 
 With selected entries in an agenda buffer, `B R' will call
 the custom function `set-category' on the selected entries.
@@ -2092,7 +2142,8 @@ used for each call to your bulk custom function.  The 
argument
 collecting function will be run once and should return a list of
 arguments to pass to the bulk function.  For example:
 
-  \\='((?R set-category get-category))
+  (setq org-agenda-bulk-custom-functions
+        \\='((?R set-category get-category)))
 
 Now, `B R' will call the custom `get-category' which would prompt
 the user once for a category.  That category is then passed as an
@@ -2111,7 +2162,7 @@ argument to `set-category' for each entry it's called 
against."
 If STRING is non-nil, the text property will be fetched from position 0
 in that string.  If STRING is nil, it will be fetched from the beginning
 of the current line."
-  (declare (debug t))
+  (declare (debug t) (indent 1))
   (org-with-gensyms (marker)
     `(let ((,marker (get-text-property (if ,string 0 (line-beginning-position))
                                       'org-hd-marker ,string)))
@@ -2158,7 +2209,17 @@ string that it returns."
 (org-remap org-agenda-mode-map 'move-end-of-line 'org-agenda-end-of-line)
 
 (defvar org-agenda-menu) ; defined later in this file.
-(defvar org-agenda-restrict nil)
+(defvar org-agenda-restrict nil
+  "Non-nil means agenda restriction is active.
+This is an internal flag indicating either temporary or extended
+agenda restriction.  Specifically, it is set to t if the agenda
+is restricted to an entire file, and is set to the corresponding
+buffer if the agenda is restricted to a part of a file, e.g. a
+region or a substree.  In the latter case,
+`org-agenda-restrict-begin' and `org-agenda-restrict-end' are set
+to the beginning and the end of the part.
+
+See also `org-agenda-set-restriction-lock'.")
 (defvar org-agenda-follow-mode nil)
 (defvar org-agenda-entry-text-mode nil)
 (defvar org-agenda-clockreport-mode nil)
@@ -2237,6 +2298,7 @@ When nil, `q' will kill the single agenda buffer."
     org-agenda-top-headline-filter
     org-agenda-regexp-filter
     org-agenda-effort-filter
+    org-agenda-filters-preset
     org-agenda-markers
     org-agenda-last-search-view-search-was-boolean
     org-agenda-last-indirect-buffer
@@ -2312,7 +2374,8 @@ The following commands are available:
          org-agenda-show-log org-agenda-start-with-log-mode
          org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode))
   (add-to-invisibility-spec '(org-filtered))
-  (add-to-invisibility-spec '(org-link))
+  (org-fold-core-initialize `(,org-link--description-folding-spec
+                              ,org-link--link-folding-spec))
   (easy-menu-change
    '("Agenda") "Agenda Files"
    (append
@@ -2688,10 +2751,15 @@ that have been changed along."
 
 ;;; Agenda dispatch
 
-(defvar org-agenda-restrict-begin (make-marker))
-(defvar org-agenda-restrict-end (make-marker))
-(defvar org-agenda-last-dispatch-buffer nil)
-(defvar org-agenda-overriding-restriction nil)
+(defvar org-agenda-restrict-begin (make-marker)
+  "Internal variable used to mark the restriction beginning.
+It is only relevant when `org-agenda-restrict' is a buffer.")
+(defvar org-agenda-restrict-end (make-marker)
+  "Internal variable used to mark the restriction end.
+It is only relevant when `org-agenda-restrict' is a buffer.")
+(defvar org-agenda-overriding-restriction nil
+  "Non-nil means extended agenda restriction is active.
+This is an internal flag set by `org-agenda-set-restriction-lock'.")
 
 (defcustom org-agenda-custom-commands-contexts nil
   "Alist of custom agenda keys and contextual rules.
@@ -2700,7 +2768,8 @@ For example, if you have a custom agenda command \"p\" 
and you
 want this command to be accessible only from plain text files,
 use this:
 
-   \\='((\"p\" ((in-file . \"\\\\.txt\\\\'\"))))
+  (setq org-agenda-custom-commands-contexts
+        \\='((\"p\" ((in-file . \"\\\\.txt\\\\'\")))))
 
 Here are the available contexts definitions:
 
@@ -2718,7 +2787,8 @@ accessible if there is at least one valid check.
 You can also bind a key to another agenda custom command
 depending on contextual rules.
 
-    \\='((\"p\" \"q\" ((in-file . \"\\\\.txt\\\\'\"))))
+  (setq org-agenda-custom-commands-contexts
+        \\='((\"p\" \"q\" ((in-file . \"\\\\.txt\\\\'\")))))
 
 Here it means: in .txt files, use \"p\" as the key for the
 agenda command otherwise associated with \"q\".  (The command
@@ -2887,12 +2957,6 @@ Pressing `<' twice means to restrict to the current 
subtree or region
        (setq org-agenda-restrict nil)
        (move-marker org-agenda-restrict-begin nil)
        (move-marker org-agenda-restrict-end nil))
-      ;; Delete old local properties
-      (put 'org-agenda-redo-command 'org-lprops nil)
-      ;; Delete previously set last-arguments
-      (put 'org-agenda-redo-command 'last-args nil)
-      ;; Remember where this call originated
-      (setq org-agenda-last-dispatch-buffer (current-buffer))
       (unless org-keys
        (setq ans (org-agenda-get-restriction-and-command prefix-descriptions)
              org-keys (car ans)
@@ -2918,12 +2982,12 @@ Pressing `<' twice means to restrict to the current 
subtree or region
            (move-marker org-agenda-restrict-begin (point))
            (move-marker org-agenda-restrict-end
                         (progn (org-end-of-subtree t)))))
-        ((and (eq restriction 'buffer)
-              (or (< 1 (point-min))
-                  (< (point-max) (1+ (buffer-size)))))
-         (setq org-agenda-restrict (current-buffer))
-         (move-marker org-agenda-restrict-begin (point-min))
-         (move-marker org-agenda-restrict-end (point-max)))))
+        ((eq restriction 'buffer)
+          (if (not (buffer-narrowed-p))
+              (setq org-agenda-restrict t)
+            (setq org-agenda-restrict (current-buffer))
+           (move-marker org-agenda-restrict-begin (point-min))
+           (move-marker org-agenda-restrict-end (point-max))))))
 
       ;; For example the todo list should not need it (but does...)
       (cond
@@ -2939,30 +3003,29 @@ Pressing `<' twice means to restrict to the current 
subtree or region
                (setq org-agenda-buffer-name
                      (or (and (stringp org-match) (format "*Org 
Agenda(%s:%s)*" org-keys org-match))
                          (format "*Org Agenda(%s)*" org-keys))))
-             (put 'org-agenda-redo-command 'org-lprops lprops)
              (cl-progv
                  (mapcar #'car lprops)
                  (mapcar (lambda (binding) (eval (cadr binding) t)) lprops)
                (pcase type
                  (`agenda
-                  (org-agenda-list current-prefix-arg))
+                  (org-agenda-list arg))
                  (`agenda*
-                  (org-agenda-list current-prefix-arg nil nil t))
+                  (org-agenda-list arg nil nil t))
                  (`alltodo
-                  (org-todo-list current-prefix-arg))
+                  (org-todo-list arg))
                  (`search
-                  (org-search-view current-prefix-arg org-match nil))
+                  (org-search-view arg org-match nil))
                  (`stuck
-                  (org-agenda-list-stuck-projects current-prefix-arg))
+                  (org-agenda-list-stuck-projects arg))
                  (`tags
-                  (org-tags-view current-prefix-arg org-match))
+                  (org-tags-view arg org-match))
                  (`tags-todo
                   (org-tags-view '(4) org-match))
                  (`todo
                   (org-todo-list org-match))
                  (`tags-tree
                   (org-check-for-org-mode)
-                  (org-match-sparse-tree current-prefix-arg org-match))
+                  (org-match-sparse-tree arg org-match))
                  (`todo-tree
                   (org-check-for-org-mode)
                   (org-occur (concat "^" org-outline-regexp "[ \t]*"
@@ -2974,7 +3037,10 @@ Pressing `<' twice means to restrict to the current 
subtree or region
                   (funcall type org-match))
                  ;; FIXME: Will signal an error since it's not `functionp'!
                  ((pred fboundp) (funcall type org-match))
-                 (_ (user-error "Invalid custom agenda command type %s" 
type)))))
+                 (_ (user-error "Invalid custom agenda command type %s" 
type))))
+              (let ((inhibit-read-only t))
+               (add-text-properties (point-min) (point-max)
+                                    `(org-lprops ,lprops))))
          (org-agenda-run-series (nth 1 entry) (cddr entry))))
        ((equal org-keys "C")
        (setq org-agenda-custom-commands org-agenda-custom-commands-orig)
@@ -3252,14 +3318,6 @@ s   Search for keywords                 M   Like m, but 
only TODO entries
 (defvar org-agenda-overriding-arguments nil)
 (defvar org-agenda-overriding-cmd-arguments nil)
 
-(defun org-let (list &rest body) ;FIXME: So many kittens are suffering here.
-  (declare (indent 1) (obsolete cl-progv "2021"))
-  (eval (cons 'let (cons list body))))
-
-(defun org-let2 (list1 list2 &rest body) ;FIXME: Where did our karma go?
-  (declare (indent 2) (obsolete cl-progv "2021"))
-  (eval (cons 'let (cons list1 (list (cons 'let (cons list2 body)))))))
-
 (defun org-agenda-run-series (name series)
   "Run agenda NAME as a SERIES of agenda commands."
   (let* ((gprops (nth 1 series))
@@ -3706,10 +3764,10 @@ removed from the entry content.  Currently only 
`planning' is allowed here."
             ;; find and remove min common indentation
             (goto-char (point-min))
             (untabify (point-min) (point-max))
-            (setq ind (current-indentation))
+            (setq ind (org-current-text-indentation))
             (while (not (eobp))
               (unless (looking-at "[ \t]*$")
-                (setq ind (min ind (current-indentation))))
+                (setq ind (min ind (org-current-text-indentation))))
               (beginning-of-line 2))
             (goto-char (point-min))
             (while (not (eobp))
@@ -3766,6 +3824,10 @@ the entire agenda view.  In a block agenda, it will not 
work reliably to
 define a filter for one of the individual blocks.  You need to set it in
 the global options and expect it to be applied to the entire view.")
 
+(defvar org-agenda-filters-preset nil
+  "Alist of filter types and associated preset of filters.
+This variable is local in `org-agenda' buffers.  See `org-agenda-local-vars'.")
+
 (defconst org-agenda-filter-variables
   '((category . org-agenda-category-filter)
     (tag . org-agenda-tag-filter)
@@ -3776,7 +3838,7 @@ the global options and expect it to be applied to the 
entire view.")
   "Is any filter active?"
   (cl-some (lambda (x)
             (or (symbol-value (cdr x))
-                (get :preset-filter x)))
+                 (assoc-default (car x) org-agenda-filters-preset)))
           org-agenda-filter-variables))
 
 (defvar org-agenda-category-filter-preset nil
@@ -3885,10 +3947,6 @@ FILTER-ALIST is an alist of filters we need to apply when
                            (cat . ,org-agenda-category-filter))))))
     (if (org-agenda-use-sticky-p)
        (progn
-         (put 'org-agenda-tag-filter :preset-filter nil)
-         (put 'org-agenda-category-filter :preset-filter nil)
-         (put 'org-agenda-regexp-filter :preset-filter nil)
-         (put 'org-agenda-effort-filter :preset-filter nil)
          ;; Popup existing buffer
          (org-agenda-prepare-window (get-buffer org-agenda-buffer-name)
                                     filter-alist)
@@ -3896,14 +3954,6 @@ FILTER-ALIST is an alist of filters we need to apply when
          (or org-agenda-multi (org-agenda-fit-window-to-buffer))
          (throw 'exit "Sticky Agenda buffer, use `r' to refresh"))
       (setq org-todo-keywords-for-agenda nil)
-      (put 'org-agenda-tag-filter :preset-filter
-          org-agenda-tag-filter-preset)
-      (put 'org-agenda-category-filter :preset-filter
-          org-agenda-category-filter-preset)
-      (put 'org-agenda-regexp-filter :preset-filter
-          org-agenda-regexp-filter-preset)
-      (put 'org-agenda-effort-filter :preset-filter
-          org-agenda-effort-filter-preset)
       (if org-agenda-multi
          (progn
            (setq buffer-read-only nil)
@@ -3913,7 +3963,7 @@ FILTER-ALIST is an alist of filters we need to apply when
              (insert "\n"
                      (if (stringp org-agenda-block-separator)
                          org-agenda-block-separator
-                       (make-string (window-width) org-agenda-block-separator))
+                       (make-string (window-max-chars-per-line) 
org-agenda-block-separator))
                      "\n"))
            (narrow-to-region (point) (point-max)))
        (setq org-done-keywords-for-agenda nil)
@@ -3928,7 +3978,12 @@ FILTER-ALIST is an alist of filters we need to apply when
        (setq org-agenda-buffer (current-buffer))
        (setq org-agenda-contributing-files nil)
        (setq org-agenda-columns-active nil)
-       (org-agenda-prepare-buffers (org-agenda-files nil 'ifmode))
+        (setq org-agenda-filters-preset
+              `((tag . ,org-agenda-tag-filter-preset)
+                (category . ,org-agenda-category-filter-preset)
+                (regexp . ,org-agenda-regexp-filter-preset)
+                (effort . ,org-agenda-effort-filter-preset)))
+        (org-agenda-prepare-buffers (org-agenda-files nil 'ifmode))
        (setq org-todo-keywords-for-agenda
              (org-uniquify org-todo-keywords-for-agenda))
        (setq org-done-keywords-for-agenda
@@ -3998,24 +4053,24 @@ agenda display, configure `org-agenda-finalize-hook'."
           org-agenda-top-headline-filter))
        (when org-agenda-tag-filter
          (org-agenda-filter-apply org-agenda-tag-filter 'tag t))
-       (when (get 'org-agenda-tag-filter :preset-filter)
+       (when (assoc-default 'tag org-agenda-filters-preset)
          (org-agenda-filter-apply
-          (get 'org-agenda-tag-filter :preset-filter) 'tag t))
+          (assoc-default 'tag org-agenda-filters-preset) 'tag t))
        (when org-agenda-category-filter
          (org-agenda-filter-apply org-agenda-category-filter 'category))
-       (when (get 'org-agenda-category-filter :preset-filter)
+       (when (assoc-default 'category org-agenda-filters-preset)
          (org-agenda-filter-apply
-          (get 'org-agenda-category-filter :preset-filter) 'category))
+          (assoc-default 'category org-agenda-filters-preset) 'category))
        (when org-agenda-regexp-filter
          (org-agenda-filter-apply org-agenda-regexp-filter 'regexp))
-       (when (get 'org-agenda-regexp-filter :preset-filter)
+       (when (assoc-default 'regexp org-agenda-filters-preset)
          (org-agenda-filter-apply
-          (get 'org-agenda-regexp-filter :preset-filter) 'regexp))
+          (assoc-default 'regexp org-agenda-filters-preset) 'regexp))
        (when org-agenda-effort-filter
          (org-agenda-filter-apply org-agenda-effort-filter 'effort))
-       (when (get 'org-agenda-effort-filter :preset-filter)
+       (when (assoc-default 'effort org-agenda-filters-preset)
          (org-agenda-filter-apply
-          (get 'org-agenda-effort-filter :preset-filter) 'effort))
+          (assoc-default 'effort org-agenda-filters-preset) 'effort))
        (add-hook 'kill-buffer-hook #'org-agenda-reset-markers 'append 'local))
       (run-hooks 'org-agenda-finalize-hook))))
 
@@ -4157,34 +4212,46 @@ to t."
 If this function returns nil, the current match should not be skipped.
 Otherwise, the function must return a position from where the search
 should be continued.
-This may also be a Lisp form, it will be evaluated.
-Never set this variable using `setq' or so, because then it will apply
-to all future agenda commands.  If you do want a global skipping condition,
-use the option `org-agenda-skip-function-global' instead.
-The correct usage for `org-agenda-skip-function' is to bind it with
-`let' to scope it dynamically into the agenda-constructing command.
+
+This may also be a Lisp form that will be evaluated.  Useful
+forms include `org-agenda-skip-entry-if' and
+`org-agenda-skip-subtree-if'.  See the Info node `(org) Special
+Agenda Views' for more details and examples.
+
+Never set this variable using `setq' or similar, because then it
+will apply to all future agenda commands.  If you want a global
+skipping condition, use the option `org-agenda-skip-function-global'
+instead.
+
+The correct way to use `org-agenda-skip-function' is to bind it with `let'
+to scope it dynamically into the agenda-constructing command.
 A good way to set it is through options in `org-agenda-custom-commands'.")
 
-(defun org-agenda-skip ()
+(defun org-agenda-skip (&optional element)
   "Throw to `:skip' in places that should be skipped.
 Also moves point to the end of the skipped region, so that search can
-continue from there."
-  (let ((p (line-beginning-position)) to)
-    (when (or
-          (save-excursion (goto-char p) (looking-at comment-start-skip))
-          (and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
-               (or (and (get-text-property p :org-archived)
-                        (org-end-of-subtree t))
-                   (and (member org-archive-tag org-file-tags)
-                        (goto-char (point-max)))))
-          (and org-agenda-skip-comment-trees
-               (get-text-property p :org-comment)
-               (org-end-of-subtree t))
-          (and (setq to (or (org-agenda-skip-eval 
org-agenda-skip-function-global)
-                            (org-agenda-skip-eval org-agenda-skip-function)))
-               (goto-char to))
-          (org-in-src-block-p t))
-      (throw :skip t))))
+continue from there.
+
+Optional argument ELEMENT contains element at point."
+  (when (or
+         (if element
+             (eq (org-element-type element) 'comment)
+          (save-excursion
+             (goto-char (line-beginning-position))
+             (looking-at comment-start-skip)))
+        (and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
+             (or (and (save-match-data (org-in-archived-heading-p nil element))
+                      (org-end-of-subtree t element))
+                 (and (member org-archive-tag org-file-tags)
+                      (goto-char (point-max)))))
+        (and org-agenda-skip-comment-trees
+              (org-in-commented-heading-p nil element)
+             (org-end-of-subtree t element))
+         (let ((to (or (org-agenda-skip-eval org-agenda-skip-function-global)
+                      (org-agenda-skip-eval org-agenda-skip-function))))
+           (and to (goto-char to)))
+        (org-in-src-block-p t element))
+    (throw :skip t)))
 
 (defun org-agenda-skip-eval (form)
   "If FORM is a function or a list, call (or eval) it and return the result.
@@ -4212,8 +4279,8 @@ Marker is at point, or at POS if non-nil.  Org mode keeps 
a list
 of these markers and resets them when they are no longer in use."
   (let ((m (copy-marker (or pos (point)) t)))
     (setq org-agenda-last-marker-time (float-time))
-    (if org-agenda-buffer
-       (with-current-buffer org-agenda-buffer
+    (if (and org-agenda-buffer (buffer-live-p org-agenda-buffer))
+        (with-current-buffer org-agenda-buffer
          (push m org-agenda-markers))
       (push m org-agenda-markers))
     m))
@@ -4354,6 +4421,9 @@ items if they have an hour specification like [h]h:mm."
                      (- sd (+ (if (< d 0) 7 0) d)))))
           (day-numbers (list start))
           (day-cnt 0)
+           ;; FIXME: This may cause confusion when users are trying to
+           ;; debug agenda.  The debugger will not trigger without
+           ;; redisplay.
           (inhibit-redisplay (not debug-on-error))
           (org-agenda-show-log-scoped org-agenda-show-log)
           s rtn rtnall file date d start-pos end-pos todayp ;; e
@@ -4471,6 +4541,10 @@ items if they have an hour specification like [h]h:mm."
          (setq p (plist-put p :tend clocktable-end))
          (setq p (plist-put p :scope 'agenda))
          (setq tbl (apply #'org-clock-get-clocktable p))
+          (when org-agenda-clock-report-header
+            (insert (propertize org-agenda-clock-report-header 'face 
'org-agenda-structure))
+            (unless (string-suffix-p "\n" org-agenda-clock-report-header)
+              (insert "\n")))
          (insert tbl)))
       (goto-char (point-min))
       (or org-agenda-multi (org-agenda-fit-window-to-buffer))
@@ -4929,7 +5003,7 @@ to search again: (0)[ALL]"))
            (let ((n 0))
               (dolist (k kwds)
                 (let ((s (format "(%d)%s" (cl-incf n) k)))
-                  (when (> (+ (current-column) (string-width s) 1) 
(window-width))
+                  (when (> (+ (current-column) (string-width s) 1) 
(window-max-chars-per-line))
                     (insert "\n                     "))
                   (insert " " s))))
            (insert "\n"))
@@ -5066,12 +5140,18 @@ bind it in the options section.")
 
 (defun org-agenda-skip-entry-if (&rest conditions)
   "Skip entry if any of CONDITIONS is true.
-See `org-agenda-skip-if' for details."
+See `org-agenda-skip-if' for details about CONDITIONS.
+
+This function can be put into `org-agenda-skip-function' for the
+duration of a command."
   (org-agenda-skip-if nil conditions))
 
 (defun org-agenda-skip-subtree-if (&rest conditions)
   "Skip subtree if any of CONDITIONS is true.
-See `org-agenda-skip-if' for details."
+See `org-agenda-skip-if' for details about CONDITIONS.
+
+This function can be put into `org-agenda-skip-function' for the
+duration of a command."
   (org-agenda-skip-if t conditions))
 
 (defun org-agenda-skip-if (subtree conditions)
@@ -5093,8 +5173,8 @@ notregexp     Check if regexp does not match.
 todo          Check if TODO keyword matches
 nottodo       Check if TODO keyword does not match
 
-The regexp is taken from the conditions list, it must come right after
-the `regexp' or `notregexp' element.
+The regexp is taken from the conditions list, and must come right
+after the `regexp' or `notregexp' element.
 
 `todo' and `nottodo' accept as an argument a list of todo
 keywords, which may include \"*\" to match any todo keyword.
@@ -5553,7 +5633,8 @@ and the timestamp type relevant for the sorting strategy 
in
                          (t org-not-done-regexp))))
         marker priority category level tags todo-state
         ts-date ts-date-type ts-date-pair
-        ee txt beg end inherited-tags todo-state-end-pos)
+        ee txt beg end inherited-tags todo-state-end-pos
+         effort effort-minutes)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
@@ -5572,6 +5653,9 @@ and the timestamp type relevant for the sorting strategy 
in
        (goto-char (match-beginning 2))
        (setq marker (org-agenda-new-marker (match-beginning 0))
              category (org-get-category)
+              effort (save-match-data (or (get-text-property (point) 'effort)
+                                          (org-entry-get (point) 
org-effort-property)))
+              effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort)))
              ts-date-pair (org-agenda-entry-get-agenda-timestamp (point))
              ts-date (car ts-date-pair)
              ts-date-type (cdr ts-date-pair)
@@ -5585,11 +5669,16 @@ and the timestamp type relevant for the sorting 
strategy in
                           (memq 'todo org-agenda-use-tag-inheritance))))
              tags (org-get-tags nil (not inherited-tags))
              level (make-string (org-reduced-level (org-outline-level)) ? )
-             txt (org-agenda-format-item "" txt level category tags t)
+             txt (org-agenda-format-item ""
+                                (org-add-props txt nil
+                                  'effort effort
+                                  'effort-minutes effort-minutes)
+                                level category tags t)
              priority (1+ (org-get-priority txt)))
        (org-add-props txt props
          'org-marker marker 'org-hd-marker marker
          'priority priority
+          'effort effort 'effort-minutes effort-minutes
          'level level
          'ts-date ts-date
          'type (concat "todo" ts-date-type) 'todo-state todo-state)
@@ -5713,8 +5802,8 @@ displayed in agenda view."
           (regexp-quote
            (substring
             (format-time-string
-             (car org-time-stamp-formats)
-             (encode-time      ; DATE bound by calendar
+             (org-time-stamp-format)
+             (org-encode-time  ; DATE bound by calendar
               0 0 0 (nth 1 date) (car date) (nth 2 date)))
             1 11))
           "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)"
@@ -5735,7 +5824,7 @@ displayed in agenda view."
                         (org-at-clock-log-p))
                     (not (org-at-timestamp-p 'agenda)))
            (throw :skip nil))
-         (org-agenda-skip))
+         (org-agenda-skip (org-element-at-point)))
        (let* ((pos (match-beginning 0))
               (repeat (match-string 1))
               (sexp-entry (match-string 3))
@@ -5793,6 +5882,8 @@ displayed in agenda view."
                       (assq (point) deadline-position-alist))
              (throw :skip nil))
            (let* ((category (org-get-category pos))
+                   (effort (org-entry-get pos org-effort-property))
+                   (effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort))))
                   (inherited-tags
                    (or (eq org-agenda-show-inherited-tags 'always)
                        (and (consp org-agenda-show-inherited-tags)
@@ -5811,7 +5902,10 @@ displayed in agenda view."
                   (item
                    (org-agenda-format-item
                     (and inactive? org-agenda-inactive-leader)
-                    head level category tags time-stamp org-ts-regexp habit?)))
+                     (org-add-props head nil
+                       'effort effort
+                       'effort-minutes effort-minutes)
+                     level category tags time-stamp org-ts-regexp habit?)))
              (org-add-props item props
                'priority (if habit?
                              (org-habit-get-priority (org-habit-parse-todo))
@@ -5820,6 +5914,7 @@ displayed in agenda view."
                'org-hd-marker (org-agenda-new-marker)
                'date date
                'level level
+                'effort effort 'effort-minutes effort-minutes
                'ts-date (if repeat (org-agenda--timestamp-to-absolute repeat)
                           current)
                'todo-state todo-state
@@ -5843,24 +5938,38 @@ displayed in agenda view."
         ;; FIXME: Is this `entry' binding intended to be dynamic,
          ;; so as to "hide" any current binding for it?
         marker category extra level ee txt tags entry
-        result beg b sexp sexp-entry todo-state warntime inherited-tags)
+        result beg b sexp sexp-entry todo-state warntime inherited-tags
+         effort effort-minutes)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
-       (org-agenda-skip)
+        ;; We do not run `org-agenda-skip' right away because every single sexp
+        ;; in the buffer is matched here, unlike day-specific search
+        ;; in ordinary timestamps.  Most of the sexps will not match
+        ;; the agenda day and it is quicker to run `org-agenda-skip' only for
+        ;; matching sexps later on.
        (setq beg (match-beginning 0))
        (goto-char (1- (match-end 0)))
        (setq b (point))
        (forward-sexp 1)
        (setq sexp (buffer-substring b (point)))
        (setq sexp-entry (if (looking-at "[ \t]*\\(\\S-.*\\)")
-                            (org-trim (match-string 1))
+                             (buffer-substring
+                              (match-beginning 1)
+                              (save-excursion
+                                (goto-char (match-end 1))
+                                (skip-chars-backward "[:blank:]")
+                                (point)))
                           ""))
        (setq result (org-diary-sexp-entry sexp sexp-entry date))
        (when result
+          ;; Only check if entry should be skipped on matching sexps.
+          (org-agenda-skip (org-element-at-point))
          (setq marker (org-agenda-new-marker beg)
                level (make-string (org-reduced-level (org-outline-level)) ? )
                category (org-get-category beg)
+                effort (save-match-data (or (get-text-property (point) 'effort)
+                                            (org-entry-get (point) 
org-effort-property)))
                inherited-tags
                (or (eq org-agenda-show-inherited-tags 'always)
                    (and (listp org-agenda-show-inherited-tags)
@@ -5872,6 +5981,7 @@ displayed in agenda view."
                todo-state (org-get-todo-state)
                warntime (get-text-property (point) 'org-appt-warntime)
                extra nil)
+          (setq effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort))))
 
          (dolist (r (if (stringp result)
                         (list result)
@@ -5883,9 +5993,14 @@ displayed in agenda view."
            (if (string-match "\\S-" r)
                (setq txt r)
              (setq txt "SEXP entry returned empty string"))
-           (setq txt (org-agenda-format-item extra txt level category tags 
'time))
+           (setq txt (org-agenda-format-item extra
+                                    (org-add-props txt nil
+                                      'effort effort
+                                      'effort-minutes effort-minutes)
+                                    level category tags 'time))
            (org-add-props txt props 'org-marker marker
                           'date date 'todo-state todo-state
+                           'effort effort 'effort-minutes effort-minutes
                           'level level 'type "sexp" 'warntime warntime)
            (push txt ee)))))
     (nreverse ee)))
@@ -5970,13 +6085,14 @@ then those holidays will be skipped."
                  (regexp-quote
                   (substring
                    (format-time-string
-                    (car org-time-stamp-formats)
-                    (encode-time  ; DATE bound by calendar
+                    (org-time-stamp-format)
+                    (org-encode-time  ; DATE bound by calendar
                      0 0 0 (nth 1 date) (car date) (nth 2 date)))
                    1 11))))
         (org-agenda-search-headline-for-time nil)
         marker hdmarker priority category level tags closedp type
-        statep clockp state ee txt extra timestr rest clocked inherited-tags)
+        statep clockp state ee txt extra timestr rest clocked inherited-tags
+         effort effort-minutes)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
@@ -5987,7 +6103,10 @@ then those holidays will be skipped."
              clockp (not (or closedp statep))
              state (and statep (match-string 2))
              category (org-get-category (match-beginning 0))
-              timestr (buffer-substring (match-beginning 0) 
(line-end-position)))
+             timestr (buffer-substring (match-beginning 0) (line-end-position))
+              effort (save-match-data (or (get-text-property (point) 'effort)
+                                          (org-entry-get (point) 
org-effort-property))))
+        (setq effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort))))
        (when (string-match "\\]" timestr)
          ;; substring should only run to end of time stamp
          (setq rest (substring timestr (match-end 0))
@@ -6034,7 +6153,10 @@ then those holidays will be skipped."
                        (closedp "Closed:    ")
                        (statep (concat "State:     (" state ")"))
                        (t (concat "Clocked:   (" clocked  ")")))
-                      txt level category tags timestr)))
+                       (org-add-props txt nil
+                         'effort effort
+                         'effort-minutes effort-minutes)
+                      level category tags timestr)))
          (setq type (cond (closedp "closed")
                           (statep "state")
                           (t "clock")))
@@ -6042,6 +6164,7 @@ then those holidays will be skipped."
          (org-add-props txt props
            'org-marker marker 'org-hd-marker hdmarker 'face 'org-agenda-done
            'priority priority 'level level
+            'effort effort 'effort-minutes effort-minutes
            'type type 'date date
            'undone-face 'org-warning 'done-face 'org-agenda-done)
          (push txt ee))
@@ -6151,8 +6274,8 @@ See also the user option 
`org-agenda-clock-consistency-checks'."
       (throw 'exit t))
     ;; We have a shorter gap.
     ;; Now we have to get the minute of the day when these times are
-    (let* ((t1dec (org-decode-time t1))
-          (t2dec (org-decode-time t2))
+    (let* ((t1dec (decode-time t1))
+          (t2dec (decode-time t2))
           ;; compute the minute on the day
           (min1 (+ (nth 1 t1dec) (* 60 (nth 2 t1dec))))
           (min2 (+ (nth 1 t2dec) (* 60 (nth 2 t2dec)))))
@@ -6190,137 +6313,313 @@ specification like [h]h:mm."
         (current (calendar-absolute-from-gregorian date))
         deadline-items)
     (goto-char (point-min))
-    (while (re-search-forward regexp nil t)
-      (catch :skip
-       (unless (save-match-data (org-at-planning-p)) (throw :skip nil))
-       (org-agenda-skip)
-       (let* ((s (match-string 1))
-              (pos (1- (match-beginning 1)))
-              (todo-state (save-match-data (org-get-todo-state)))
-              (done? (member todo-state org-done-keywords))
-               (sexp? (string-prefix-p "%%" s))
-              ;; DEADLINE is the deadline date for the entry.  It is
-              ;; either the base date or the last repeat, according
-              ;; to `org-agenda-prefer-last-repeat'.
-              (deadline
-               (cond
-                (sexp? (org-agenda--timestamp-to-absolute s current))
-                ((or (eq org-agenda-prefer-last-repeat t)
-                     (member todo-state org-agenda-prefer-last-repeat))
-                 (org-agenda--timestamp-to-absolute
-                  s today 'past (current-buffer) pos))
-                (t (org-agenda--timestamp-to-absolute s))))
-              ;; REPEAT is the future repeat closest from CURRENT,
-              ;; according to `org-agenda-show-future-repeats'. If
-              ;; the latter is nil, or if the time stamp has no
-              ;; repeat part, default to DEADLINE.
-              (repeat
-               (cond
-                (sexp? deadline)
-                ((<= current today) deadline)
-                ((not org-agenda-show-future-repeats) deadline)
-                (t
-                 (let ((base (if (eq org-agenda-show-future-repeats 'next)
-                                 (1+ today)
-                               current)))
+    (if (org-element--cache-active-p)
+        (org-element-cache-map
+         (lambda (el)
+           (when (and (org-element-property :deadline el)
+                      (or (not with-hour)
+                          (org-element-property
+                           :hour-start
+                           (org-element-property :deadline el))
+                          (org-element-property
+                           :hour-end
+                           (org-element-property :deadline el))))
+             (goto-char (org-element-property :contents-begin el))
+             (catch :skip
+              (org-agenda-skip el)
+              (let* ((s (substring (org-element-property
+                                     :raw-value
+                                     (org-element-property :deadline el))
+                                    1 -1))
+                     (pos (save-excursion
+                             (goto-char (org-element-property :contents-begin 
el))
+                             ;; We intentionally leave NOERROR
+                             ;; argument in `re-search-forward' nil.  If
+                             ;; the search fails here, something went
+                             ;; wrong and we are looking at
+                             ;; non-matching headline.
+                             (re-search-forward regexp (line-end-position))
+                             (1- (match-beginning 1))))
+                     (todo-state (org-element-property :todo-keyword el))
+                     (done? (eq 'done (org-element-property :todo-type el)))
+                      (sexp? (eq 'diary
+                                 (org-element-property
+                                  :type (org-element-property :deadline el))))
+                     ;; DEADLINE is the deadline date for the entry.  It is
+                     ;; either the base date or the last repeat, according
+                     ;; to `org-agenda-prefer-last-repeat'.
+                     (deadline
+                      (cond
+                       (sexp? (org-agenda--timestamp-to-absolute s current))
+                       ((or (eq org-agenda-prefer-last-repeat t)
+                            (member todo-state org-agenda-prefer-last-repeat))
+                        (org-agenda--timestamp-to-absolute
+                         s today 'past (current-buffer) pos))
+                       (t (org-agenda--timestamp-to-absolute s))))
+                     ;; REPEAT is the future repeat closest from CURRENT,
+                     ;; according to `org-agenda-show-future-repeats'. If
+                     ;; the latter is nil, or if the time stamp has no
+                     ;; repeat part, default to DEADLINE.
+                     (repeat
+                      (cond
+                       (sexp? deadline)
+                       ((<= current today) deadline)
+                       ((not org-agenda-show-future-repeats) deadline)
+                       (t
+                        (let ((base (if (eq org-agenda-show-future-repeats 
'next)
+                                        (1+ today)
+                                      current)))
+                          (org-agenda--timestamp-to-absolute
+                           s base 'future (current-buffer) pos)))))
+                     (diff (- deadline current))
+                     (suppress-prewarning
+                      (let ((scheduled
+                             (and 
org-agenda-skip-deadline-prewarning-if-scheduled
+                                   (org-element-property
+                                    :raw-value
+                                    (org-element-property :scheduled el)))))
+                        (cond
+                         ((not scheduled) nil)
+                         ;; The current item has a scheduled date, so
+                         ;; evaluate its prewarning lead time.
+                         ((integerp 
org-agenda-skip-deadline-prewarning-if-scheduled)
+                          ;; Use global prewarning-restart lead time.
+                          org-agenda-skip-deadline-prewarning-if-scheduled)
+                         ((eq org-agenda-skip-deadline-prewarning-if-scheduled
+                              'pre-scheduled)
+                          ;; Set pre-warning to no earlier than SCHEDULED.
+                          (min (- deadline
+                                  (org-agenda--timestamp-to-absolute 
scheduled))
+                               org-deadline-warning-days))
+                         ;; Set pre-warning to deadline.
+                         (t 0))))
+                     (wdays (or suppress-prewarning (org-get-wdays s))))
+                (cond
+                 ;; Only display deadlines at their base date, at future
+                 ;; repeat occurrences or in today agenda.
+                 ((= current deadline) nil)
+                 ((= current repeat) nil)
+                 ((not today?) (throw :skip nil))
+                 ;; Upcoming deadline: display within warning period WDAYS.
+                 ((> deadline current) (when (> diff wdays) (throw :skip nil)))
+                 ;; Overdue deadline: warn about it for
+                 ;; `org-deadline-past-days' duration.
+                 (t (when (< org-deadline-past-days (- diff)) (throw :skip 
nil))))
+                ;; Possibly skip done tasks.
+                (when (and done?
+                           (or org-agenda-skip-deadline-if-done
+                               (/= deadline current)))
+                  (throw :skip nil))
+                (save-excursion
+                   (goto-char (org-element-property :begin el))
+                  (let* ((category (org-get-category))
+                          (effort (save-match-data (or (get-text-property 
(point) 'effort)
+                                                       (org-element-property 
(intern (concat ":" (upcase org-effort-property))) el))))
+                          (effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort))))
+                         (level (make-string (org-element-property :level el)
+                                             ?\s))
+                         (head (save-excursion
+                                  (goto-char (org-element-property :begin el))
+                                  (re-search-forward org-outline-regexp-bol)
+                                  (buffer-substring-no-properties (point) 
(line-end-position))))
+                         (inherited-tags
+                          (or (eq org-agenda-show-inherited-tags 'always)
+                              (and (listp org-agenda-show-inherited-tags)
+                                   (memq 'agenda 
org-agenda-show-inherited-tags))
+                              (and (eq org-agenda-show-inherited-tags t)
+                                   (or (eq org-agenda-use-tag-inheritance t)
+                                       (memq 'agenda
+                                             
org-agenda-use-tag-inheritance)))))
+                         (tags (org-get-tags el (not inherited-tags)))
+                         (time
+                          (cond
+                           ;; No time of day designation if it is only
+                           ;; a reminder.
+                           ((and (/= current deadline) (/= current repeat)) 
nil)
+                           ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
+                            (concat (substring s (match-beginning 1)) " "))
+                           (t 'time)))
+                         (item
+                          (org-agenda-format-item
+                           ;; Insert appropriate suffixes before deadlines.
+                           ;; Those only apply to today agenda.
+                           (pcase-let ((`(,now ,future ,past)
+                                        org-agenda-deadline-leaders))
+                             (cond
+                              ((and today? (< deadline today)) (format past (- 
diff)))
+                              ((and today? (> deadline today)) (format future 
diff))
+                              (t now)))
+                           (org-add-props head nil
+                              'effort effort
+                              'effort-minutes effort-minutes)
+                            level category tags time))
+                         (face (org-agenda-deadline-face
+                                (- 1 (/ (float diff) (max wdays 1)))))
+                         (upcoming? (and today? (> deadline today)))
+                         (warntime (get-text-property (point) 
'org-appt-warntime)))
+                    (org-add-props item props
+                      'org-marker (org-agenda-new-marker pos)
+                      'org-hd-marker (org-agenda-new-marker 
(line-beginning-position))
+                      'warntime warntime
+                      'level level
+                       'effort effort 'effort-minutes effort-minutes
+                      'ts-date deadline
+                      'priority
+                      ;; Adjust priority to today reminders about deadlines.
+                      ;; Overdue deadlines get the highest priority
+                      ;; increase, then imminent deadlines and eventually
+                      ;; more distant deadlines.
+                      (let ((adjust (if today? (- diff) 0)))
+                        (+ adjust (org-get-priority item)))
+                      'todo-state todo-state
+                      'type (if upcoming? "upcoming-deadline" "deadline")
+                      'date (if upcoming? date deadline)
+                      'face (if done? 'org-agenda-done face)
+                      'undone-face face
+                      'done-face 'org-agenda-done)
+                    (push item deadline-items)))))))
+         :next-re regexp
+         :fail-re regexp
+         :narrow t)
+      (while (re-search-forward regexp nil t)
+        (catch :skip
+         (unless (save-match-data (org-at-planning-p)) (throw :skip nil))
+         (org-agenda-skip)
+         (let* ((s (match-string 1))
+                (pos (1- (match-beginning 1)))
+                (todo-state (save-match-data (org-get-todo-state)))
+                (done? (member todo-state org-done-keywords))
+                 (sexp? (string-prefix-p "%%" s))
+                ;; DEADLINE is the deadline date for the entry.  It is
+                ;; either the base date or the last repeat, according
+                ;; to `org-agenda-prefer-last-repeat'.
+                (deadline
+                 (cond
+                  (sexp? (org-agenda--timestamp-to-absolute s current))
+                  ((or (eq org-agenda-prefer-last-repeat t)
+                       (member todo-state org-agenda-prefer-last-repeat))
                    (org-agenda--timestamp-to-absolute
-                    s base 'future (current-buffer) pos)))))
-              (diff (- deadline current))
-              (suppress-prewarning
-               (let ((scheduled
-                      (and org-agenda-skip-deadline-prewarning-if-scheduled
-                           (org-entry-get nil "SCHEDULED"))))
+                    s today 'past (current-buffer) pos))
+                  (t (org-agenda--timestamp-to-absolute s))))
+                ;; REPEAT is the future repeat closest from CURRENT,
+                ;; according to `org-agenda-show-future-repeats'. If
+                ;; the latter is nil, or if the time stamp has no
+                ;; repeat part, default to DEADLINE.
+                (repeat
                  (cond
-                  ((not scheduled) nil)
-                  ;; The current item has a scheduled date, so
-                  ;; evaluate its prewarning lead time.
-                  ((integerp org-agenda-skip-deadline-prewarning-if-scheduled)
-                   ;; Use global prewarning-restart lead time.
-                   org-agenda-skip-deadline-prewarning-if-scheduled)
-                  ((eq org-agenda-skip-deadline-prewarning-if-scheduled
-                       'pre-scheduled)
-                   ;; Set pre-warning to no earlier than SCHEDULED.
-                   (min (- deadline
-                           (org-agenda--timestamp-to-absolute scheduled))
-                        org-deadline-warning-days))
-                  ;; Set pre-warning to deadline.
-                  (t 0))))
-              (wdays (or suppress-prewarning (org-get-wdays s))))
-         (cond
-          ;; Only display deadlines at their base date, at future
-          ;; repeat occurrences or in today agenda.
-          ((= current deadline) nil)
-          ((= current repeat) nil)
-          ((not today?) (throw :skip nil))
-          ;; Upcoming deadline: display within warning period WDAYS.
-          ((> deadline current) (when (> diff wdays) (throw :skip nil)))
-          ;; Overdue deadline: warn about it for
-          ;; `org-deadline-past-days' duration.
-          (t (when (< org-deadline-past-days (- diff)) (throw :skip nil))))
-         ;; Possibly skip done tasks.
-         (when (and done?
-                    (or org-agenda-skip-deadline-if-done
-                        (/= deadline current)))
-           (throw :skip nil))
-         (save-excursion
-           (re-search-backward "^\\*+[ \t]+" nil t)
-           (goto-char (match-end 0))
-           (let* ((category (org-get-category))
-                  (level (make-string (org-reduced-level (org-outline-level))
-                                      ?\s))
-                  (head (buffer-substring (point) (line-end-position)))
-                  (inherited-tags
-                   (or (eq org-agenda-show-inherited-tags 'always)
-                       (and (listp org-agenda-show-inherited-tags)
-                            (memq 'agenda org-agenda-show-inherited-tags))
-                       (and (eq org-agenda-show-inherited-tags t)
-                            (or (eq org-agenda-use-tag-inheritance t)
-                                (memq 'agenda
-                                      org-agenda-use-tag-inheritance)))))
-                  (tags (org-get-tags nil (not inherited-tags)))
-                  (time
+                  (sexp? deadline)
+                  ((<= current today) deadline)
+                  ((not org-agenda-show-future-repeats) deadline)
+                  (t
+                   (let ((base (if (eq org-agenda-show-future-repeats 'next)
+                                   (1+ today)
+                                 current)))
+                     (org-agenda--timestamp-to-absolute
+                      s base 'future (current-buffer) pos)))))
+                (diff (- deadline current))
+                (suppress-prewarning
+                 (let ((scheduled
+                        (and org-agenda-skip-deadline-prewarning-if-scheduled
+                             (org-entry-get nil "SCHEDULED"))))
                    (cond
-                    ;; No time of day designation if it is only
-                    ;; a reminder.
-                    ((and (/= current deadline) (/= current repeat)) nil)
-                    ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
-                     (concat (substring s (match-beginning 1)) " "))
-                    (t 'time)))
-                  (item
-                   (org-agenda-format-item
-                    ;; Insert appropriate suffixes before deadlines.
-                    ;; Those only apply to today agenda.
-                    (pcase-let ((`(,now ,future ,past)
-                                 org-agenda-deadline-leaders))
-                      (cond
-                       ((and today? (< deadline today)) (format past (- diff)))
-                       ((and today? (> deadline today)) (format future diff))
-                       (t now)))
-                    head level category tags time))
-                  (face (org-agenda-deadline-face
-                         (- 1 (/ (float diff) (max wdays 1)))))
-                  (upcoming? (and today? (> deadline today)))
-                  (warntime (get-text-property (point) 'org-appt-warntime)))
-             (org-add-props item props
-               'org-marker (org-agenda-new-marker pos)
-               'org-hd-marker (org-agenda-new-marker (line-beginning-position))
-               'warntime warntime
-               'level level
-               'ts-date deadline
-               'priority
-               ;; Adjust priority to today reminders about deadlines.
-               ;; Overdue deadlines get the highest priority
-               ;; increase, then imminent deadlines and eventually
-               ;; more distant deadlines.
-               (let ((adjust (if today? (- diff) 0)))
-                 (+ adjust (org-get-priority item)))
-               'todo-state todo-state
-               'type (if upcoming? "upcoming-deadline" "deadline")
-               'date (if upcoming? date deadline)
-               'face (if done? 'org-agenda-done face)
-               'undone-face face
-               'done-face 'org-agenda-done)
-             (push item deadline-items))))))
+                    ((not scheduled) nil)
+                    ;; The current item has a scheduled date, so
+                    ;; evaluate its prewarning lead time.
+                    ((integerp 
org-agenda-skip-deadline-prewarning-if-scheduled)
+                     ;; Use global prewarning-restart lead time.
+                     org-agenda-skip-deadline-prewarning-if-scheduled)
+                    ((eq org-agenda-skip-deadline-prewarning-if-scheduled
+                         'pre-scheduled)
+                     ;; Set pre-warning to no earlier than SCHEDULED.
+                     (min (- deadline
+                             (org-agenda--timestamp-to-absolute scheduled))
+                          org-deadline-warning-days))
+                    ;; Set pre-warning to deadline.
+                    (t 0))))
+                (wdays (or suppress-prewarning (org-get-wdays s))))
+           (cond
+            ;; Only display deadlines at their base date, at future
+            ;; repeat occurrences or in today agenda.
+            ((= current deadline) nil)
+            ((= current repeat) nil)
+            ((not today?) (throw :skip nil))
+            ;; Upcoming deadline: display within warning period WDAYS.
+            ((> deadline current) (when (> diff wdays) (throw :skip nil)))
+            ;; Overdue deadline: warn about it for
+            ;; `org-deadline-past-days' duration.
+            (t (when (< org-deadline-past-days (- diff)) (throw :skip nil))))
+           ;; Possibly skip done tasks.
+           (when (and done?
+                      (or org-agenda-skip-deadline-if-done
+                          (/= deadline current)))
+             (throw :skip nil))
+           (save-excursion
+             (re-search-backward "^\\*+[ \t]+" nil t)
+             (goto-char (match-end 0))
+             (let* ((category (org-get-category))
+                     (effort (save-match-data (or (get-text-property (point) 
'effort)
+                                                  (org-entry-get (point) 
org-effort-property))))
+                     (effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort))))
+                    (level (make-string (org-reduced-level (org-outline-level))
+                                        ?\s))
+                    (head (buffer-substring-no-properties
+                            (point) (line-end-position)))
+                    (inherited-tags
+                     (or (eq org-agenda-show-inherited-tags 'always)
+                         (and (listp org-agenda-show-inherited-tags)
+                              (memq 'agenda org-agenda-show-inherited-tags))
+                         (and (eq org-agenda-show-inherited-tags t)
+                              (or (eq org-agenda-use-tag-inheritance t)
+                                  (memq 'agenda
+                                        org-agenda-use-tag-inheritance)))))
+                    (tags (org-get-tags nil (not inherited-tags)))
+                    (time
+                     (cond
+                      ;; No time of day designation if it is only
+                      ;; a reminder.
+                      ((and (/= current deadline) (/= current repeat)) nil)
+                      ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
+                       (concat (substring s (match-beginning 1)) " "))
+                      (t 'time)))
+                    (item
+                     (org-agenda-format-item
+                      ;; Insert appropriate suffixes before deadlines.
+                      ;; Those only apply to today agenda.
+                      (pcase-let ((`(,now ,future ,past)
+                                   org-agenda-deadline-leaders))
+                        (cond
+                         ((and today? (< deadline today)) (format past (- 
diff)))
+                         ((and today? (> deadline today)) (format future diff))
+                         (t now)))
+                      (org-add-props head nil
+                         'effort effort
+                         'effort-minutes effort-minutes)
+                       level category tags time))
+                    (face (org-agenda-deadline-face
+                           (- 1 (/ (float diff) (max wdays 1)))))
+                    (upcoming? (and today? (> deadline today)))
+                    (warntime (get-text-property (point) 'org-appt-warntime)))
+               (org-add-props item props
+                 'org-marker (org-agenda-new-marker pos)
+                 'org-hd-marker (org-agenda-new-marker 
(line-beginning-position))
+                 'warntime warntime
+                 'level level
+                  'effort effort 'effort-minutes effort-minutes
+                 'ts-date deadline
+                 'priority
+                 ;; Adjust priority to today reminders about deadlines.
+                 ;; Overdue deadlines get the highest priority
+                 ;; increase, then imminent deadlines and eventually
+                 ;; more distant deadlines.
+                 (let ((adjust (if today? (- diff) 0)))
+                   (+ adjust (org-get-priority item)))
+                 'todo-state todo-state
+                 'type (if upcoming? "upcoming-deadline" "deadline")
+                 'date (if upcoming? date deadline)
+                 'face (if done? 'org-agenda-done face)
+                 'undone-face face
+                 'done-face 'org-agenda-done)
+               (push item deadline-items)))))))
     (nreverse deadline-items)))
 
 (defun org-agenda-deadline-face (fraction)
@@ -6355,181 +6654,404 @@ scheduled items with an hour specification like 
[h]h:mm."
                  deadlines))
         scheduled-items)
     (goto-char (point-min))
-    (while (re-search-forward regexp nil t)
-      (catch :skip
-       (unless (save-match-data (org-at-planning-p)) (throw :skip nil))
-       (org-agenda-skip)
-       (let* ((s (match-string 1))
-              (pos (1- (match-beginning 1)))
-              (todo-state (save-match-data (org-get-todo-state)))
-              (donep (member todo-state org-done-keywords))
-              (sexp? (string-prefix-p "%%" s))
-              ;; SCHEDULE is the scheduled date for the entry.  It is
-              ;; either the bare date or the last repeat, according
-              ;; to `org-agenda-prefer-last-repeat'.
-              (schedule
-               (cond
-                (sexp? (org-agenda--timestamp-to-absolute s current))
-                ((or (eq org-agenda-prefer-last-repeat t)
-                     (member todo-state org-agenda-prefer-last-repeat))
-                 (org-agenda--timestamp-to-absolute
-                  s today 'past (current-buffer) pos))
-                (t (org-agenda--timestamp-to-absolute s))))
-              ;; REPEAT is the future repeat closest from CURRENT,
-              ;; according to `org-agenda-show-future-repeats'. If
-              ;; the latter is nil, or if the time stamp has no
-              ;; repeat part, default to SCHEDULE.
-              (repeat
-               (cond
-                (sexp? schedule)
-                ((<= current today) schedule)
-                ((not org-agenda-show-future-repeats) schedule)
-                (t
-                 (let ((base (if (eq org-agenda-show-future-repeats 'next)
-                                 (1+ today)
-                               current)))
+    (if (org-element--cache-active-p)
+        (org-element-cache-map
+         (lambda (el)
+           (when (and (org-element-property :scheduled el)
+                      (or (not with-hour)
+                          (org-element-property
+                           :hour-start
+                           (org-element-property :scheduled el))
+                          (org-element-property
+                           :hour-end
+                           (org-element-property :scheduled el))))
+             (goto-char (org-element-property :contents-begin el))
+             (catch :skip
+               (org-agenda-skip el)
+               (let* ((s (substring (org-element-property
+                                     :raw-value
+                                     (org-element-property :scheduled el))
+                                    1 -1))
+                      (pos (save-excursion
+                             (goto-char (org-element-property :contents-begin 
el))
+                             ;; We intentionally leave NOERROR
+                             ;; argument in `re-search-forward' nil.  If
+                             ;; the search fails here, something went
+                             ;; wrong and we are looking at
+                             ;; non-matching headline.
+                             (re-search-forward regexp (line-end-position))
+                             (1- (match-beginning 1))))
+                      (todo-state (org-element-property :todo-keyword el))
+                     (donep (eq 'done (org-element-property :todo-type el)))
+                     (sexp? (eq 'diary
+                                 (org-element-property
+                                  :type (org-element-property :scheduled el))))
+                     ;; SCHEDULE is the scheduled date for the entry.  It is
+                     ;; either the bare date or the last repeat, according
+                     ;; to `org-agenda-prefer-last-repeat'.
+                     (schedule
+                      (cond
+                       (sexp? (org-agenda--timestamp-to-absolute s current))
+                       ((or (eq org-agenda-prefer-last-repeat t)
+                            (member todo-state org-agenda-prefer-last-repeat))
+                        (org-agenda--timestamp-to-absolute
+                         s today 'past (current-buffer) pos))
+                       (t (org-agenda--timestamp-to-absolute s))))
+                     ;; REPEAT is the future repeat closest from CURRENT,
+                     ;; according to `org-agenda-show-future-repeats'. If
+                     ;; the latter is nil, or if the time stamp has no
+                     ;; repeat part, default to SCHEDULE.
+                     (repeat
+                      (cond
+                       (sexp? schedule)
+                       ((<= current today) schedule)
+                       ((not org-agenda-show-future-repeats) schedule)
+                       (t
+                        (let ((base (if (eq org-agenda-show-future-repeats 
'next)
+                                        (1+ today)
+                                      current)))
+                          (org-agenda--timestamp-to-absolute
+                           s base 'future (current-buffer) pos)))))
+                     (diff (- current schedule))
+                     (warntime (get-text-property (point) 'org-appt-warntime))
+                     (pastschedp (< schedule today))
+                     (futureschedp (> schedule today))
+                     (habitp (and (fboundp 'org-is-habit-p)
+                                   (string= "habit" (org-element-property 
:STYLE el))))
+                     (suppress-delay
+                      (let ((deadline (and 
org-agenda-skip-scheduled-delay-if-deadline
+                                            (org-element-property
+                                             :raw-value
+                                             (org-element-property :deadline 
el)))))
+                        (cond
+                         ((not deadline) nil)
+                         ;; The current item has a deadline date, so
+                         ;; evaluate its delay time.
+                         ((integerp 
org-agenda-skip-scheduled-delay-if-deadline)
+                          ;; Use global delay time.
+                          (- org-agenda-skip-scheduled-delay-if-deadline))
+                         ((eq org-agenda-skip-scheduled-delay-if-deadline
+                              'post-deadline)
+                          ;; Set delay to no later than DEADLINE.
+                          (min (- schedule
+                                  (org-agenda--timestamp-to-absolute deadline))
+                               org-scheduled-delay-days))
+                         (t 0))))
+                     (ddays
+                      (cond
+                       ;; Nullify delay when a repeater triggered already
+                       ;; and the delay is of the form --Xd.
+                       ((and (string-match-p "--[0-9]+[hdwmy]" s)
+                             (> schedule (org-agenda--timestamp-to-absolute 
s)))
+                        0)
+                       (suppress-delay
+                        (let ((org-scheduled-delay-days suppress-delay))
+                          (org-get-wdays s t t)))
+                       (t (org-get-wdays s t)))))
+                ;; Display scheduled items at base date (SCHEDULE), today if
+                ;; scheduled before the current date, and at any repeat past
+                ;; today.  However, skip delayed items and items that have
+                ;; been displayed for more than `org-scheduled-past-days'.
+                (unless (and todayp
+                             habitp
+                             (bound-and-true-p org-habit-show-all-today))
+                  (when (or (and (> ddays 0) (< diff ddays))
+                            (> diff (or (and habitp 
org-habit-scheduled-past-days)
+                                        org-scheduled-past-days))
+                            (> schedule current)
+                            (and (/= current schedule)
+                                 (/= current today)
+                                 (/= current repeat)))
+                    (throw :skip nil)))
+                ;; Possibly skip done tasks.
+                (when (and donep
+                           (or org-agenda-skip-scheduled-if-done
+                               (/= schedule current)))
+                  (throw :skip nil))
+                ;; Skip entry if it already appears as a deadline, per
+                ;; `org-agenda-skip-scheduled-if-deadline-is-shown'.  This
+                ;; doesn't apply to habits.
+                (when (pcase org-agenda-skip-scheduled-if-deadline-is-shown
+                        ((guard
+                          (or (not (memq (line-beginning-position 0) 
deadline-pos))
+                              habitp))
+                         nil)
+                        (`repeated-after-deadline
+                         (let ((deadline (time-to-days
+                                           (when (org-element-property 
:deadline el)
+                                             (org-time-string-to-time
+                                              (org-element-property :deadline 
el))))))
+                           (and (<= schedule deadline) (> current deadline))))
+                        (`not-today pastschedp)
+                        (`t t)
+                        (_ nil))
+                  (throw :skip nil))
+                ;; Skip habits if `org-habit-show-habits' is nil, or if we
+                ;; only show them for today.  Also skip done habits.
+                (when (and habitp
+                           (or donep
+                               (not (bound-and-true-p org-habit-show-habits))
+                               (and (not todayp)
+                                    (bound-and-true-p
+                                     org-habit-show-habits-only-for-today))))
+                  (throw :skip nil))
+                (save-excursion
+                   (goto-char (org-element-property :begin el))
+                  (let* ((category (org-get-category))
+                          (effort (save-match-data
+                                    (or (get-text-property (point) 'effort)
+                                        (org-element-property (intern (concat 
":" (upcase org-effort-property))) el))))
+                          (effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort))))
+                         (inherited-tags
+                          (or (eq org-agenda-show-inherited-tags 'always)
+                              (and (listp org-agenda-show-inherited-tags)
+                                   (memq 'agenda 
org-agenda-show-inherited-tags))
+                              (and (eq org-agenda-show-inherited-tags t)
+                                   (or (eq org-agenda-use-tag-inheritance t)
+                                       (memq 'agenda
+                                             
org-agenda-use-tag-inheritance)))))
+                         (tags (org-get-tags el (not inherited-tags)))
+                         (level (make-string (org-element-property :level el)
+                                             ?\s))
+                         (head (save-excursion
+                                  (goto-char (org-element-property :begin el))
+                                  (re-search-forward org-outline-regexp-bol)
+                                  (buffer-substring (point) 
(line-end-position))))
+                         (time
+                          (cond
+                           ;; No time of day designation if it is only a
+                           ;; reminder, except for habits, which always show
+                           ;; the time of day.  Habits are an exception
+                           ;; because if there is a time of day, that is
+                           ;; interpreted to mean they should usually happen
+                           ;; then, even if doing the habit was missed.
+                           ((and
+                             (not habitp)
+                             (/= current schedule)
+                             (/= current repeat))
+                            nil)
+                           ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
+                            (concat (substring s (match-beginning 1)) " "))
+                           (t 'time)))
+                         (item
+                          (org-agenda-format-item
+                           (pcase-let ((`(,first ,past) 
org-agenda-scheduled-leaders))
+                             ;; Show a reminder of a past scheduled today.
+                             (if (and todayp pastschedp)
+                                 (format past diff)
+                               first))
+                           (org-add-props head nil
+                              'effort effort
+                              'effort-minutes effort-minutes)
+                            level category tags time nil habitp))
+                         (face (cond ((and (not habitp) pastschedp)
+                                      'org-scheduled-previously)
+                                     ((and habitp futureschedp)
+                                      'org-agenda-done)
+                                     (todayp 'org-scheduled-today)
+                                     (t 'org-scheduled)))
+                         (habitp (and habitp (org-habit-parse-todo 
(org-element-property :begin el)))))
+                    (org-add-props item props
+                      'undone-face face
+                      'face (if donep 'org-agenda-done face)
+                      'org-marker (org-agenda-new-marker pos)
+                      'org-hd-marker (org-agenda-new-marker 
(line-beginning-position))
+                      'type (if pastschedp "past-scheduled" "scheduled")
+                      'date (if pastschedp schedule date)
+                      'ts-date schedule
+                      'warntime warntime
+                      'level level
+                       'effort effort 'effort-minutes effort-minutes
+                      'priority (if habitp (org-habit-get-priority habitp)
+                                  (+ 99 diff (org-get-priority item)))
+                      'org-habit-p habitp
+                      'todo-state todo-state)
+                    (push item scheduled-items)))))))
+         :next-re regexp
+         :fail-re regexp
+         :narrow t)
+      (while (re-search-forward regexp nil t)
+        (catch :skip
+         (unless (save-match-data (org-at-planning-p)) (throw :skip nil))
+         (org-agenda-skip)
+         (let* ((s (match-string 1))
+                (pos (1- (match-beginning 1)))
+                (todo-state (save-match-data (org-get-todo-state)))
+                (donep (member todo-state org-done-keywords))
+                (sexp? (string-prefix-p "%%" s))
+                ;; SCHEDULE is the scheduled date for the entry.  It is
+                ;; either the bare date or the last repeat, according
+                ;; to `org-agenda-prefer-last-repeat'.
+                (schedule
+                 (cond
+                  (sexp? (org-agenda--timestamp-to-absolute s current))
+                  ((or (eq org-agenda-prefer-last-repeat t)
+                       (member todo-state org-agenda-prefer-last-repeat))
                    (org-agenda--timestamp-to-absolute
-                    s base 'future (current-buffer) pos)))))
-              (diff (- current schedule))
-              (warntime (get-text-property (point) 'org-appt-warntime))
-              (pastschedp (< schedule today))
-              (futureschedp (> schedule today))
-              (habitp (and (fboundp 'org-is-habit-p) (org-is-habit-p)))
-              (suppress-delay
-               (let ((deadline (and org-agenda-skip-scheduled-delay-if-deadline
-                                    (org-entry-get nil "DEADLINE"))))
+                    s today 'past (current-buffer) pos))
+                  (t (org-agenda--timestamp-to-absolute s))))
+                ;; REPEAT is the future repeat closest from CURRENT,
+                ;; according to `org-agenda-show-future-repeats'. If
+                ;; the latter is nil, or if the time stamp has no
+                ;; repeat part, default to SCHEDULE.
+                (repeat
                  (cond
-                  ((not deadline) nil)
-                  ;; The current item has a deadline date, so
-                  ;; evaluate its delay time.
-                  ((integerp org-agenda-skip-scheduled-delay-if-deadline)
-                   ;; Use global delay time.
-                   (- org-agenda-skip-scheduled-delay-if-deadline))
-                  ((eq org-agenda-skip-scheduled-delay-if-deadline
-                       'post-deadline)
-                   ;; Set delay to no later than DEADLINE.
-                   (min (- schedule
-                           (org-agenda--timestamp-to-absolute deadline))
-                        org-scheduled-delay-days))
-                  (t 0))))
-              (ddays
-               (cond
-                ;; Nullify delay when a repeater triggered already
-                ;; and the delay is of the form --Xd.
-                ((and (string-match-p "--[0-9]+[hdwmy]" s)
-                      (> schedule (org-agenda--timestamp-to-absolute s)))
-                 0)
-                (suppress-delay
-                 (let ((org-scheduled-delay-days suppress-delay))
-                   (org-get-wdays s t t)))
-                (t (org-get-wdays s t)))))
-         ;; Display scheduled items at base date (SCHEDULE), today if
-         ;; scheduled before the current date, and at any repeat past
-         ;; today.  However, skip delayed items and items that have
-         ;; been displayed for more than `org-scheduled-past-days'.
-         (unless (and todayp
-                      habitp
-                      (bound-and-true-p org-habit-show-all-today))
-           (when (or (and (> ddays 0) (< diff ddays))
-                     (> diff (or (and habitp org-habit-scheduled-past-days)
-                                 org-scheduled-past-days))
-                     (> schedule current)
-                     (and (/= current schedule)
-                          (/= current today)
-                          (/= current repeat)))
-             (throw :skip nil)))
-         ;; Possibly skip done tasks.
-         (when (and donep
-                    (or org-agenda-skip-scheduled-if-done
-                        (/= schedule current)))
-           (throw :skip nil))
-         ;; Skip entry if it already appears as a deadline, per
-         ;; `org-agenda-skip-scheduled-if-deadline-is-shown'.  This
-         ;; doesn't apply to habits.
-         (when (pcase org-agenda-skip-scheduled-if-deadline-is-shown
-                 ((guard
-                   (or (not (memq (line-beginning-position 0) deadline-pos))
-                       habitp))
-                  nil)
-                 (`repeated-after-deadline
-                  (let ((deadline (time-to-days
-                                   (org-get-deadline-time (point)))))
-                    (and (<= schedule deadline) (> current deadline))))
-                 (`not-today pastschedp)
-                 (`t t)
-                 (_ nil))
-           (throw :skip nil))
-         ;; Skip habits if `org-habit-show-habits' is nil, or if we
-         ;; only show them for today.  Also skip done habits.
-         (when (and habitp
-                    (or donep
-                        (not (bound-and-true-p org-habit-show-habits))
-                        (and (not todayp)
-                             (bound-and-true-p
-                              org-habit-show-habits-only-for-today))))
-           (throw :skip nil))
-         (save-excursion
-           (re-search-backward "^\\*+[ \t]+" nil t)
-           (goto-char (match-end 0))
-           (let* ((category (org-get-category))
-                  (inherited-tags
-                   (or (eq org-agenda-show-inherited-tags 'always)
-                       (and (listp org-agenda-show-inherited-tags)
-                            (memq 'agenda org-agenda-show-inherited-tags))
-                       (and (eq org-agenda-show-inherited-tags t)
-                            (or (eq org-agenda-use-tag-inheritance t)
-                                (memq 'agenda
-                                      org-agenda-use-tag-inheritance)))))
-                  (tags (org-get-tags nil (not inherited-tags)))
-                  (level (make-string (org-reduced-level (org-outline-level))
-                                      ?\s))
-                  (head (buffer-substring (point) (line-end-position)))
-                  (time
+                  (sexp? schedule)
+                  ((<= current today) schedule)
+                  ((not org-agenda-show-future-repeats) schedule)
+                  (t
+                   (let ((base (if (eq org-agenda-show-future-repeats 'next)
+                                   (1+ today)
+                                 current)))
+                     (org-agenda--timestamp-to-absolute
+                      s base 'future (current-buffer) pos)))))
+                (diff (- current schedule))
+                (warntime (get-text-property (point) 'org-appt-warntime))
+                (pastschedp (< schedule today))
+                (futureschedp (> schedule today))
+                (habitp (and (fboundp 'org-is-habit-p) (org-is-habit-p)))
+                (suppress-delay
+                 (let ((deadline (and 
org-agenda-skip-scheduled-delay-if-deadline
+                                      (org-entry-get nil "DEADLINE"))))
                    (cond
-                    ;; No time of day designation if it is only a
-                    ;; reminder, except for habits, which always show
-                    ;; the time of day.  Habits are an exception
-                    ;; because if there is a time of day, that is
-                    ;; interpreted to mean they should usually happen
-                    ;; then, even if doing the habit was missed.
-                    ((and
-                      (not habitp)
-                      (/= current schedule)
-                      (/= current repeat))
-                     nil)
-                    ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
-                     (concat (substring s (match-beginning 1)) " "))
-                    (t 'time)))
-                  (item
-                   (org-agenda-format-item
-                    (pcase-let ((`(,first ,past) org-agenda-scheduled-leaders))
-                      ;; Show a reminder of a past scheduled today.
-                      (if (and todayp pastschedp)
-                          (format past diff)
-                        first))
-                    head level category tags time nil habitp))
-                  (face (cond ((and (not habitp) pastschedp)
-                               'org-scheduled-previously)
-                              ((and habitp futureschedp)
-                               'org-agenda-done)
-                              (todayp 'org-scheduled-today)
-                              (t 'org-scheduled)))
-                  (habitp (and habitp (org-habit-parse-todo))))
-             (org-add-props item props
-               'undone-face face
-               'face (if donep 'org-agenda-done face)
-               'org-marker (org-agenda-new-marker pos)
-               'org-hd-marker (org-agenda-new-marker (line-beginning-position))
-               'type (if pastschedp "past-scheduled" "scheduled")
-               'date (if pastschedp schedule date)
-               'ts-date schedule
-               'warntime warntime
-               'level level
-               'priority (if habitp (org-habit-get-priority habitp)
-                           (+ 99 diff (org-get-priority item)))
-               'org-habit-p habitp
-               'todo-state todo-state)
-             (push item scheduled-items))))))
+                    ((not deadline) nil)
+                    ;; The current item has a deadline date, so
+                    ;; evaluate its delay time.
+                    ((integerp org-agenda-skip-scheduled-delay-if-deadline)
+                     ;; Use global delay time.
+                     (- org-agenda-skip-scheduled-delay-if-deadline))
+                    ((eq org-agenda-skip-scheduled-delay-if-deadline
+                         'post-deadline)
+                     ;; Set delay to no later than DEADLINE.
+                     (min (- schedule
+                             (org-agenda--timestamp-to-absolute deadline))
+                          org-scheduled-delay-days))
+                    (t 0))))
+                (ddays
+                 (cond
+                  ;; Nullify delay when a repeater triggered already
+                  ;; and the delay is of the form --Xd.
+                  ((and (string-match-p "--[0-9]+[hdwmy]" s)
+                        (> schedule (org-agenda--timestamp-to-absolute s)))
+                   0)
+                  (suppress-delay
+                   (let ((org-scheduled-delay-days suppress-delay))
+                     (org-get-wdays s t t)))
+                  (t (org-get-wdays s t)))))
+           ;; Display scheduled items at base date (SCHEDULE), today if
+           ;; scheduled before the current date, and at any repeat past
+           ;; today.  However, skip delayed items and items that have
+           ;; been displayed for more than `org-scheduled-past-days'.
+           (unless (and todayp
+                        habitp
+                        (bound-and-true-p org-habit-show-all-today))
+             (when (or (and (> ddays 0) (< diff ddays))
+                       (> diff (or (and habitp org-habit-scheduled-past-days)
+                                   org-scheduled-past-days))
+                       (> schedule current)
+                       (and (/= current schedule)
+                            (/= current today)
+                            (/= current repeat)))
+               (throw :skip nil)))
+           ;; Possibly skip done tasks.
+           (when (and donep
+                      (or org-agenda-skip-scheduled-if-done
+                          (/= schedule current)))
+             (throw :skip nil))
+           ;; Skip entry if it already appears as a deadline, per
+           ;; `org-agenda-skip-scheduled-if-deadline-is-shown'.  This
+           ;; doesn't apply to habits.
+           (when (pcase org-agenda-skip-scheduled-if-deadline-is-shown
+                   ((guard
+                     (or (not (memq (line-beginning-position 0) deadline-pos))
+                         habitp))
+                    nil)
+                   (`repeated-after-deadline
+                    (let ((deadline (time-to-days
+                                     (org-get-deadline-time (point)))))
+                      (and (<= schedule deadline) (> current deadline))))
+                   (`not-today pastschedp)
+                   (`t t)
+                   (_ nil))
+             (throw :skip nil))
+           ;; Skip habits if `org-habit-show-habits' is nil, or if we
+           ;; only show them for today.  Also skip done habits.
+           (when (and habitp
+                      (or donep
+                          (not (bound-and-true-p org-habit-show-habits))
+                          (and (not todayp)
+                               (bound-and-true-p
+                                org-habit-show-habits-only-for-today))))
+             (throw :skip nil))
+           (save-excursion
+             (re-search-backward "^\\*+[ \t]+" nil t)
+             (goto-char (match-end 0))
+             (let* ((category (org-get-category))
+                     (effort (save-match-data (or (get-text-property (point) 
'effort)
+                                                  (org-entry-get (point) 
org-effort-property))))
+                     (effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort))))
+                    (inherited-tags
+                     (or (eq org-agenda-show-inherited-tags 'always)
+                         (and (listp org-agenda-show-inherited-tags)
+                              (memq 'agenda org-agenda-show-inherited-tags))
+                         (and (eq org-agenda-show-inherited-tags t)
+                              (or (eq org-agenda-use-tag-inheritance t)
+                                  (memq 'agenda
+                                        org-agenda-use-tag-inheritance)))))
+                    (tags (org-get-tags nil (not inherited-tags)))
+                    (level (make-string (org-reduced-level (org-outline-level))
+                                        ?\s))
+                    (head (buffer-substring (point) (line-end-position)))
+                    (time
+                     (cond
+                      ;; No time of day designation if it is only a
+                      ;; reminder, except for habits, which always show
+                      ;; the time of day.  Habits are an exception
+                      ;; because if there is a time of day, that is
+                      ;; interpreted to mean they should usually happen
+                      ;; then, even if doing the habit was missed.
+                      ((and
+                        (not habitp)
+                        (/= current schedule)
+                        (/= current repeat))
+                       nil)
+                      ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
+                       (concat (substring s (match-beginning 1)) " "))
+                      (t 'time)))
+                    (item
+                     (org-agenda-format-item
+                      (pcase-let ((`(,first ,past) 
org-agenda-scheduled-leaders))
+                        ;; Show a reminder of a past scheduled today.
+                        (if (and todayp pastschedp)
+                            (format past diff)
+                          first))
+                      (org-add-props head nil
+                         'effort effort
+                         'effort-minutes effort-minutes)
+                       level category tags time nil habitp))
+                    (face (cond ((and (not habitp) pastschedp)
+                                 'org-scheduled-previously)
+                                ((and habitp futureschedp)
+                                 'org-agenda-done)
+                                (todayp 'org-scheduled-today)
+                                (t 'org-scheduled)))
+                    (habitp (and habitp (org-habit-parse-todo))))
+               (org-add-props item props
+                 'undone-face face
+                 'face (if donep 'org-agenda-done face)
+                 'org-marker (org-agenda-new-marker pos)
+                 'org-hd-marker (org-agenda-new-marker 
(line-beginning-position))
+                 'type (if pastschedp "past-scheduled" "scheduled")
+                 'date (if pastschedp schedule date)
+                 'ts-date schedule
+                 'warntime warntime
+                 'level level
+                  'effort effort 'effort-minutes effort-minutes
+                 'priority (if habitp (org-habit-get-priority habitp)
+                             (+ 99 diff (org-get-priority item)))
+                 'org-habit-p habitp
+                 'todo-state todo-state)
+               (push item scheduled-items)))))))
     (nreverse scheduled-items)))
 
 (defun org-agenda-get-blocks ()
@@ -6546,7 +7068,8 @@ scheduled items with an hour specification like [h]h:mm."
         (regexp org-tr-regexp)
         (d0 (calendar-absolute-from-gregorian date))
         marker hdmarker ee txt d1 d2 s1 s2 category
-        level todo-state tags pos head donep inherited-tags)
+        level todo-state tags pos head donep inherited-tags
+         effort effort-minutes)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
@@ -6586,6 +7109,9 @@ scheduled items with an hour specification like [h]h:mm."
                (throw :skip t))
              (setq marker (org-agenda-new-marker (point))
                    category (org-get-category))
+              (setq effort (save-match-data (or (get-text-property (point) 
'effort)
+                                                (org-entry-get (point) 
org-effort-property))))
+              (setq effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort))))
              (if (not (re-search-backward org-outline-regexp-bol nil t))
                  (throw :skip nil)
                (goto-char (match-beginning 0))
@@ -6613,7 +7139,10 @@ scheduled items with an hour specification like [h]h:mm."
                              (nth (if (= d1 d2) 0 1)
                                   org-agenda-timerange-leaders)
                              (1+ (- d0 d1)) (1+ (- d2 d1)))
-                            head level category tags
+                            (org-add-props head nil
+                               'effort effort
+                               'effort-minutes effort-minutes)
+                             level category tags
                             (save-match-data
                               (let ((hhmm1 (and (string-match org-ts-regexp1 
s1)
                                                 (match-string 6 s1)))
@@ -6632,6 +7161,7 @@ scheduled items with an hour specification like [h]h:mm."
                'org-marker marker 'org-hd-marker hdmarker
                'type "block" 'date date
                'level level
+                'effort effort 'effort-minutes effort-minutes
                'todo-state todo-state
                'priority (org-get-priority txt))
              (push txt ee))))
@@ -6920,6 +7450,7 @@ TODAYP is t when the current agenda view is on today."
 
 (defun org-compile-prefix-format (key)
   "Compile the prefix format into a Lisp form that can be evaluated.
+KEY is the agenda type (see `org-agenda-prefix-format').
 The resulting form and associated variable bindings is returned
 and stored in the variable `org-prefix-format-compiled'."
   (setq org-prefix-has-time nil
@@ -7403,7 +7934,7 @@ Argument ARG is the prefix argument."
 When in a restricted subtree, remove it.
 
 The restriction will span over the entire file if TYPE is `file',
-or if type is \\='(4), or if the cursor is before the first headline
+or if TYPE is (4), or if the cursor is before the first headline
 in the file.  Otherwise, only apply the restriction to the current
 subtree."
   (interactive "P")
@@ -7439,7 +7970,7 @@ subtree."
          (message "Locking agenda restriction to subtree"))
       (put 'org-agenda-files 'org-restrict
           (list (buffer-file-name (buffer-base-buffer))))
-      (setq org-agenda-restrict nil)
+      (setq org-agenda-restrict t)
       (setq org-agenda-overriding-restriction 'file)
       (move-marker org-agenda-restrict-begin nil)
       (move-marker org-agenda-restrict-end nil)
@@ -7593,19 +8124,19 @@ in the agenda."
                                     org-agenda-buffer-name))
         (org-agenda-keep-modes t)
         (tag-filter org-agenda-tag-filter)
-        (tag-preset (get 'org-agenda-tag-filter :preset-filter))
+        (tag-preset (assoc-default 'tag org-agenda-filters-preset))
         (top-hl-filter org-agenda-top-headline-filter)
         (cat-filter org-agenda-category-filter)
-        (cat-preset (get 'org-agenda-category-filter :preset-filter))
+        (cat-preset (assoc-default 'category org-agenda-filters-preset))
         (re-filter org-agenda-regexp-filter)
-        (re-preset (get 'org-agenda-regexp-filter :preset-filter))
+        (re-preset (assoc-default 'regexp org-agenda-filters-preset))
         (effort-filter org-agenda-effort-filter)
-        (effort-preset (get 'org-agenda-effort-filter :preset-filter))
+        (effort-preset (assoc-default 'effort org-agenda-filters-preset))
         (org-agenda-tag-filter-while-redo (or tag-filter tag-preset))
         (cols org-agenda-columns-active)
         (line (org-current-line))
         (window-line (- line (org-current-line (window-start))))
-        (lprops (get 'org-agenda-redo-command 'org-lprops))
+        (lprops (get-text-property p 'org-lprops))
         (redo-cmd (get-text-property p 'org-redo-cmd))
         (last-args (get-text-property p 'org-last-args))
         (org-agenda-overriding-cmd (get-text-property p 'org-series-cmd))
@@ -7616,10 +8147,6 @@ in the agenda."
                  ((stringp last-args)
                   last-args))))
         (series-redo-cmd (get-text-property p 'org-series-redo-cmd)))
-    (put 'org-agenda-tag-filter :preset-filter nil)
-    (put 'org-agenda-category-filter :preset-filter nil)
-    (put 'org-agenda-regexp-filter :preset-filter nil)
-    (put 'org-agenda-effort-filter :preset-filter nil)
     (and cols (org-columns-quit))
     (message "Rebuilding agenda buffer...")
     (if series-redo-cmd
@@ -7627,7 +8154,9 @@ in the agenda."
       (cl-progv
          (mapcar #'car lprops)
          (mapcar (lambda (binding) (eval (cadr binding) t)) lprops)
-       (eval redo-cmd t)))
+       (eval redo-cmd t))
+      (let ((inhibit-read-only t))
+       (add-text-properties (point-min) (point-max) `(org-lprops ,lprops))))
     (setq org-agenda-undo-list nil
          org-agenda-pending-undo-list nil
          org-agenda-tag-filter tag-filter
@@ -7636,10 +8165,6 @@ in the agenda."
          org-agenda-effort-filter effort-filter
          org-agenda-top-headline-filter top-hl-filter)
     (message "Rebuilding agenda buffer...done")
-    (put 'org-agenda-tag-filter :preset-filter tag-preset)
-    (put 'org-agenda-category-filter :preset-filter cat-preset)
-    (put 'org-agenda-regexp-filter :preset-filter re-preset)
-    (put 'org-agenda-effort-filter :preset-filter effort-preset)
     (let ((tag (or tag-filter tag-preset))
          (cat (or cat-filter cat-preset))
          (effort (or effort-filter effort-preset))
@@ -8035,7 +8560,7 @@ also press `-' or `+' to switch between filtering and 
excluding."
          (org-agenda-filter-apply org-agenda-tag-filter 'tag expand))))
      ((eq char ?\\)
       (org-agenda-filter-show-all-tag)
-      (when (get 'org-agenda-tag-filter :preset-filter)
+      (when (assoc-default 'tag org-agenda-filters-preset)
        (org-agenda-filter-apply org-agenda-tag-filter 'tag expand)))
      ((eq char ?.)
       (setq org-agenda-tag-filter
@@ -8108,7 +8633,7 @@ grouptags."
      ((eq type 'tag)
       (setq filter
            (delete-dups
-            (append (get 'org-agenda-tag-filter :preset-filter)
+            (append (assoc-default 'tag org-agenda-filters-preset)
                     filter)))
       (dolist (x filter)
        (let ((op (string-to-char x)))
@@ -8120,7 +8645,7 @@ grouptags."
      ((eq type 'category)
       (setq filter
            (delete-dups
-            (append (get 'org-agenda-category-filter :preset-filter)
+            (append (assoc-default 'category org-agenda-filters-preset)
                     filter)))
       (dolist (x filter)
        (if (equal "-" (substring x 0 1))
@@ -8131,7 +8656,7 @@ grouptags."
      ((eq type 'regexp)
       (setq filter
            (delete-dups
-            (append (get 'org-agenda-regexp-filter :preset-filter)
+            (append (assoc-default 'regexp org-agenda-filters-preset)
                     filter)))
       (dolist (x filter)
        (if (equal "-" (substring x 0 1))
@@ -8142,7 +8667,7 @@ grouptags."
      ((eq type 'effort)
       (setq filter
            (delete-dups
-            (append (get 'org-agenda-effort-filter :preset-filter)
+            (append (assoc-default 'effort org-agenda-filters-preset)
                     filter)))
       (dolist (x filter)
        (push (org-agenda-filter-effort-form x) f))))
@@ -8343,7 +8868,16 @@ Negative selection means regexp must not match for 
selection of an entry."
   (set var (concat (symbol-value var) string)))
 
 (defun org-agenda-goto-date (date)
-  "Jump to DATE in agenda."
+  "Jump to DATE in the agenda buffer.
+
+When called interactively, prompt for the date.
+When called from Lisp, DATE should be a date as returned by
+`org-read-date'.
+
+See also:
+ `org-agenda-earlier'    (\\[org-agenda-earlier])
+ `org-agenda-later'      (\\[org-agenda-later])
+ `org-agenda-goto-today' (\\[org-agenda-goto-today])"
   (interactive
    (list
     (let ((org-read-date-prefer-future org-agenda-jump-prefer-future))
@@ -8375,7 +8909,12 @@ Negative selection means regexp must not match for 
selection of an entry."
            org-agenda-this-buffer-is-sticky org-agenda-sticky))))
 
 (defun org-agenda-goto-today ()
-  "Go to today."
+  "Go to today's date in the agenda buffer.
+
+See also:
+ `org-agenda-later'     (\\[org-agenda-later])
+ `org-agenda-earlier'   (\\[org-agenda-earlier])
+ `org-agenda-goto-date' (\\[org-agenda-goto-date])"
   (interactive)
   (org-agenda-check-type t 'agenda)
   (let* ((args (get-text-property (min (1- (point-max)) (point)) 
'org-last-args))
@@ -8434,8 +8973,13 @@ When optional argument BACKWARD is set, go backward."
               (message "No %s block" (if backward "previous" "further")))))))
 
 (defun org-agenda-later (arg)
-  "Go forward in time by the current span.
-With prefix ARG, go forward that many times the current span."
+  "Go forward in time by the current span in the agenda buffer.
+With prefix ARG, go forward that many times the current span.
+
+See also:
+ `org-agenda-earlier'    (\\[org-agenda-earlier])
+ `org-agenda-goto-today' (\\[org-agenda-goto-today])
+ `org-agenda-goto-date'  (\\[org-agenda-goto-date])"
   (interactive "p")
   (org-agenda-check-type t 'agenda)
   (let* ((wstart (window-start))
@@ -8476,8 +9020,13 @@ With prefix ARG, go forward that many times the current 
span."
     (set-window-start nil wstart)))
 
 (defun org-agenda-earlier (arg)
-  "Go backward in time by the current span.
-With prefix ARG, go backward that many times the current span."
+  "Go backward in time by the current span in the agenda buffer.
+With prefix ARG, go backward that many times the current span.
+
+See also:
+ `org-agenda-later'      (\\[org-agenda-later])
+ `org-agenda-goto-today' (\\[org-agenda-goto-today])
+ `org-agenda-goto-date'  (\\[org-agenda-goto-date])"
   (interactive "p")
   (org-agenda-later (- arg)))
 
@@ -8811,13 +9360,13 @@ When called with a prefix argument, include all archive 
files as well."
               (t ""))
              (if (org-agenda-filter-any) " " "")
              (if (or org-agenda-category-filter
-                     (get 'org-agenda-category-filter :preset-filter))
+                     (assoc-default 'category org-agenda-filters-preset))
                  '(:eval (propertize
                           (concat "["
                                   (mapconcat
                                     #'identity
                                    (append
-                                    (get 'org-agenda-category-filter 
:preset-filter)
+                                     (assoc-default 'category 
org-agenda-filters-preset)
                                     org-agenda-category-filter)
                                    "")
                                   "]")
@@ -8825,36 +9374,36 @@ When called with a prefix argument, include all archive 
files as well."
                            'help-echo "Category used in filtering"))
                 "")
              (if (or org-agenda-tag-filter
-                     (get 'org-agenda-tag-filter :preset-filter))
+                     (assoc-default 'tag org-agenda-filters-preset))
                  '(:eval (propertize
                           (concat (mapconcat
                                    #'identity
                                    (append
-                                    (get 'org-agenda-tag-filter :preset-filter)
+                                    (assoc-default 'tag 
org-agenda-filters-preset)
                                     org-agenda-tag-filter)
                                    ""))
                           'face 'org-agenda-filter-tags
                           'help-echo "Tags used in filtering"))
                "")
              (if (or org-agenda-effort-filter
-                     (get 'org-agenda-effort-filter :preset-filter))
+                     (assoc-default 'effort org-agenda-filters-preset))
                  '(:eval (propertize
                           (concat (mapconcat
                                    #'identity
                                    (append
-                                    (get 'org-agenda-effort-filter 
:preset-filter)
+                                    (assoc-default 'effort 
org-agenda-filters-preset)
                                     org-agenda-effort-filter)
                                    ""))
                           'face 'org-agenda-filter-effort
                           'help-echo "Effort conditions used in filtering"))
                "")
              (if (or org-agenda-regexp-filter
-                     (get 'org-agenda-regexp-filter :preset-filter))
+                     (assoc-default 'regexp org-agenda-filters-preset))
                  '(:eval (propertize
                           (concat (mapconcat
                                    (lambda (x) (concat (substring x 0 1) "/" 
(substring x 1) "/"))
                                    (append
-                                    (get 'org-agenda-regexp-filter 
:preset-filter)
+                                    (assoc-default 'regexp 
org-agenda-filters-preset)
                                     org-agenda-regexp-filter)
                                    ""))
                           'face 'org-agenda-filter-regexp
@@ -8918,7 +9467,7 @@ When called with a prefix argument, include all archive 
files as well."
               (org-agenda-tree-to-indirect-buffer nil)
             (org-agenda-show)))
       (and org-agenda-show-outline-path
-          (org-with-point-at m (org-display-outline-path t))))))
+          (org-with-point-at m (org-display-outline-path 
org-agenda-show-outline-path))))))
 
 (defun org-agenda-show-tags ()
   "Show the tags applicable to the current item."
@@ -8942,7 +9491,7 @@ When called with a prefix argument, include all archive 
files as well."
     (push-mark)
     (goto-char pos)
     (when (derived-mode-p 'org-mode)
-      (org-show-context 'agenda)
+      (org-fold-show-context 'agenda)
       (recenter (/ (window-height) 2))
       (org-back-to-heading t)
       (let ((case-fold-search nil))
@@ -8975,8 +9524,8 @@ deletes the agenda entry and don't move to the next 
entry."
       (while (< (point) mend)
         (let ((ov (make-overlay (point) (line-end-position))))
          (if (not (or all
-                      (and match (looking-at-p match))
-                      (eq level (org-get-at-bol 'level))))
+                    (and match (looking-at-p match))
+                    (eq level (org-get-at-bol 'level))))
              (org-agenda-next-item 1)
            (overlay-put ov 'face 'region)
            (if (or arg force-arg) (funcall cmd arg) (funcall cmd))
@@ -9031,8 +9580,8 @@ Pass ARG, FORCE-ARG, DELETE and BODY to 
`org-agenda-do-in-region'."
                (prog2
                    (org-agenda-tree-to-indirect-buffer nil)
                    (not (y-or-n-p
-                         (format "Delete entry with %d lines in buffer \"%s\"? 
"
-                                 n (buffer-name buffer))))
+                       (format "Delete entry with %d lines in buffer \"%s\"? "
+                               n (buffer-name buffer))))
                  (kill-buffer org-last-indirect-buffer))
                (error "Abort"))
             (set-window-configuration win-conf))))
@@ -9234,7 +9783,7 @@ displayed Org file fills the frame."
       (widen)
       (goto-char pos)
       (when (derived-mode-p 'org-mode)
-       (org-show-context 'agenda)
+       (org-fold-show-context 'agenda)
        (run-hooks 'org-agenda-after-show-hook)))))
 
 (defun org-agenda-goto-mouse (ev)
@@ -9250,7 +9799,7 @@ if it was hidden in the outline."
   (interactive "P")
   (let ((win (selected-window)))
     (org-agenda-goto t)
-    (when full-entry (org-show-entry))
+    (when full-entry (org-fold-show-entry 'hide-drawers))
     (select-window win)))
 
 (defvar org-agenda-show-window nil)
@@ -9269,12 +9818,12 @@ fold drawers."
          (select-window org-agenda-show-window)
          (ignore-errors (scroll-up)))
       (org-agenda-goto t)
-      (org-show-entry)
+      (org-fold-show-entry 'hide-drawers)
       (if arg (org-cycle-hide-drawers 'children)
        (org-with-wide-buffer
         (narrow-to-region (org-entry-beginning-position)
                           (org-entry-end-position))
-        (org-show-all '(drawers))))
+        (org-fold-show-all '(drawers))))
       (setq org-agenda-show-window (selected-window)))
     (select-window win)))
 
@@ -9305,7 +9854,7 @@ if it was hidden in the outline."
     (set-window-start (selected-window) (line-beginning-position))
     (cond
      ((= more 0)
-      (org-flag-subtree t)
+      (org-fold-subtree t)
       (save-excursion
        (org-back-to-heading)
        (run-hook-with-args 'org-cycle-hook 'folded))
@@ -9313,20 +9862,20 @@ if it was hidden in the outline."
      ((and (called-interactively-p 'any) (= more 1))
       (message "Remote: show with default settings"))
      ((= more 2)
-      (outline-show-entry)
-      (org-show-children)
+      (org-fold-show-entry 'hide-drawers)
+      (org-fold-show-children)
       (save-excursion
        (org-back-to-heading)
        (run-hook-with-args 'org-cycle-hook 'children))
       (message "Remote: CHILDREN"))
      ((= more 3)
-      (outline-show-subtree)
+      (org-fold-show-subtree)
       (save-excursion
        (org-back-to-heading)
        (run-hook-with-args 'org-cycle-hook 'subtree))
       (message "Remote: SUBTREE"))
      ((> more 3)
-      (outline-show-subtree)
+      (org-fold-show-subtree)
       (message "Remote: SUBTREE AND ALL DRAWERS")))
     (select-window win)))
 
@@ -9458,7 +10007,7 @@ the same tree node, and the headline of the tree node in 
the Org file."
        (with-current-buffer buffer
         (widen)
         (goto-char pos)
-        (org-show-context 'agenda)
+        (org-fold-show-context 'agenda)
         (let ((current-prefix-arg arg))
           (call-interactively 'org-todo)
            ;; Make sure that log is recorded in current undo.
@@ -9499,11 +10048,11 @@ the same tree node, and the headline of the tree node 
in the Org file."
     (with-current-buffer buffer
       (widen)
       (goto-char pos)
-      (org-show-context 'agenda)
+      (org-fold-show-context 'agenda)
       (org-add-note))))
 
 (defun org-agenda-change-all-lines (newhead hdmarker
-                                           &optional fixface just-this)
+                                           &optional fixface just-this)
   "Change all lines in the agenda buffer which match HDMARKER.
 The new content of the line will be NEWHEAD (as modified by
 `org-agenda-format-item').  HDMARKER is checked with
@@ -9517,7 +10066,8 @@ If FORCE-TAGS is non-nil, the car of it returns the new 
tags."
         (org-agenda-buffer (current-buffer))
         (thetags (with-current-buffer (marker-buffer hdmarker)
                    (org-get-tags hdmarker)))
-        props m undone-face done-face finish new dotime level cat tags) ;; pl
+        props m undone-face done-face finish new dotime level cat tags
+         effort effort-minutes) ;; pl
     (save-excursion
       (goto-char (point-max))
       (beginning-of-line 1)
@@ -9531,6 +10081,8 @@ If FORCE-TAGS is non-nil, the car of it returns the new 
tags."
                cat (org-agenda-get-category)
                level (org-get-at-bol 'level)
                tags thetags
+                effort (org-get-at-bol 'effort)
+                effort-minutes (org-get-at-bol 'effort-minutes)
                new
                (let ((org-prefix-format-compiled
                       (or (get-text-property (min (1- (point-max)) (point)) 
'format)
@@ -9538,7 +10090,11 @@ If FORCE-TAGS is non-nil, the car of it returns the new 
tags."
                      (extra (org-get-at-bol 'extra)))
                  (with-current-buffer (marker-buffer hdmarker)
                    (org-with-wide-buffer
-                    (org-agenda-format-item extra newhead level cat tags 
dotime))))
+                    (org-agenda-format-item extra
+                                   (org-add-props newhead nil
+                                     'effort effort
+                                     'effort-minutes effort-minutes)
+                                   level cat tags dotime))))
                 ;; pl (text-property-any (line-beginning-position)
                 ;;                       (line-end-position) 'org-heading t)
                undone-face (org-get-at-bol 'undone-face)
@@ -9579,34 +10135,35 @@ When optional argument LINE is non-nil, align tags 
only on the
 current line."
   (let ((inhibit-read-only t)
        (org-agenda-tags-column (if (eq 'auto org-agenda-tags-column)
-                                   (- (window-text-width))
-                                 org-agenda-tags-column))
+                         (- (window-max-chars-per-line))
+                       org-agenda-tags-column))
        (end (and line (line-end-position)))
        l c)
-    (save-excursion
-      (goto-char (if line (line-beginning-position) (point-min)))
-      (while (re-search-forward org-tag-group-re end t)
-       (add-text-properties
-        (match-beginning 1) (match-end 1)
-        (list 'face (delq nil (let ((prop (get-text-property
+    (org-fold-core-ignore-modifications
+      (save-excursion
+        (goto-char (if line (line-beginning-position) (point-min)))
+        (while (re-search-forward org-tag-group-re end t)
+         (add-text-properties
+          (match-beginning 1) (match-end 1)
+          (list 'face (delq nil (let ((prop (get-text-property
                                            (match-beginning 1) 'face)))
-                                (or (listp prop) (setq prop (list prop)))
-                                (if (memq 'org-tag prop)
+                                (or (listp prop) (setq prop (list prop)))
+                                (if (memq 'org-tag prop)
                                     prop
                                   (cons 'org-tag prop))))))
-       (setq l (string-width (match-string 1))
-             c (if (< org-agenda-tags-column 0)
-                   (- (abs org-agenda-tags-column) l)
-                 org-agenda-tags-column))
-       (goto-char (match-beginning 1))
-       (delete-region (save-excursion (skip-chars-backward " \t") (point))
-                      (point))
-       (insert (org-add-props
-                   (make-string (max 1 (- c (current-column))) ?\s)
-                   (plist-put (copy-sequence (text-properties-at (point)))
-                              'face nil))))
-      (goto-char (point-min))
-      (org-font-lock-add-tag-faces (point-max)))))
+         (setq l (string-width (match-string 1))
+               c (if (< org-agenda-tags-column 0)
+                     (- (abs org-agenda-tags-column) l)
+                   org-agenda-tags-column))
+         (goto-char (match-beginning 1))
+         (delete-region (save-excursion (skip-chars-backward " \t") (point))
+                        (point))
+         (insert (org-add-props
+                     (make-string (max 1 (- c (current-column))) ?\s)
+                     (plist-put (copy-sequence (text-properties-at (point)))
+                                'face nil))))
+        (goto-char (point-min))
+        (org-font-lock-add-tag-faces (point-max))))))
 
 (defun org-agenda-priority-up ()
   "Increase the priority of line at point, also in Org file."
@@ -9643,7 +10200,7 @@ When called programmatically, FORCE-DIRECTION can be 
`set', `up',
       (with-current-buffer buffer
        (widen)
        (goto-char pos)
-       (org-show-context 'agenda)
+       (org-fold-show-context 'agenda)
        (org-priority force-direction)
        (end-of-line 1)
        (setq newhead (org-get-heading)))
@@ -9667,7 +10224,7 @@ When called programmatically, FORCE-DIRECTION can be 
`set', `up',
        (with-current-buffer buffer
          (widen)
          (goto-char pos)
-         (org-show-context 'agenda)
+         (org-fold-show-context 'agenda)
          (if tag
              (org-toggle-tag tag onoff)
            (call-interactively #'org-set-tags-command))
@@ -9692,7 +10249,7 @@ When called programmatically, FORCE-DIRECTION can be 
`set', `up',
        (with-current-buffer buffer
         (widen)
         (goto-char pos)
-        (org-show-context 'agenda)
+        (org-fold-show-context 'agenda)
         (call-interactively 'org-set-property))))))
 
 (defun org-agenda-set-effort ()
@@ -9711,7 +10268,7 @@ When called programmatically, FORCE-DIRECTION can be 
`set', `up',
        (with-current-buffer buffer
         (widen)
         (goto-char pos)
-        (org-show-context 'agenda)
+        (org-fold-show-context 'agenda)
         (call-interactively 'org-set-effort)
         (end-of-line 1)
         (setq newhead (org-get-heading)))
@@ -9733,7 +10290,7 @@ When called programmatically, FORCE-DIRECTION can be 
`set', `up',
        (with-current-buffer buffer
         (widen)
         (goto-char pos)
-        (org-show-context 'agenda)
+        (org-fold-show-context 'agenda)
         (call-interactively 'org-toggle-archive-tag)
         (end-of-line 1)
         (setq newhead (org-get-heading)))
@@ -9849,10 +10406,7 @@ When called programmatically, FORCE-DIRECTION can be 
`set', `up',
                                  (line-end-position)
                                  '(display nil))
          (org-move-to-column
-           (- (if (fboundp 'window-font-width)
-                  (/ (window-width nil t) (window-font-width))
-                ;; Fall back to pre-9.3.3 behavior on Emacs <25.
-                (window-width))
+           (- (window-max-chars-per-line)
               (length stamp))
            t)
           (add-text-properties
@@ -9944,7 +10498,7 @@ ARG is passed through to `org-deadline'."
         (with-current-buffer (marker-buffer marker)
          (widen)
          (goto-char pos)
-         (org-show-context 'agenda)
+         (org-fold-show-context 'agenda)
          (org-clock-in arg)
          (setq newhead (org-get-heading)))
        (org-agenda-change-all-lines newhead hdmarker))
@@ -10033,7 +10587,7 @@ buffer, display it in another window."
        (find-file-noselect org-agenda-diary-file))
       (require 'org-datetree)
       (org-datetree-find-date-create d1)
-      (org-reveal t))
+      (org-fold-reveal t))
      (t (user-error "Invalid selection character `%c'" char)))))
 
 (defcustom org-agenda-insert-diary-strategy 'date-tree
@@ -10075,7 +10629,7 @@ the resulting entry will not be shown.  When TEXT is 
empty, switch to
       (anniversary
        (or (re-search-forward "^\\*[ \t]+Anniversaries" nil t)
           (progn
-            (or (org-at-heading-p t)
+            (or (org-at-heading-p)
                 (progn
                   (outline-next-heading)
                   (insert "* Anniversaries\n\n")
@@ -10135,7 +10689,7 @@ the resulting entry will not be shown.  When TEXT is 
empty, switch to
          (message "%s entry added to %s"
                   (capitalize (symbol-name type))
                   (abbreviate-file-name org-agenda-diary-file)))
-      (org-reveal t)
+      (org-fold-reveal t)
       (message "Please finish entry here"))))
 
 (defun org-agenda-insert-diary-as-top-level (text)
@@ -10173,7 +10727,7 @@ a timestamp can be added there."
     (unless (bolp) (insert "\n"))
     (unless (looking-at-p "^[ \t]*$") (save-excursion (insert "\n")))
     (when org-adapt-indentation (indent-to-column col)))
-  (org-show-set-visibility 'lineage))
+  (org-fold-show-set-visibility 'lineage))
 
 (defun org-agenda-diary-entry ()
   "Make a diary entry, like the `i' command from the calendar.
@@ -10626,8 +11180,8 @@ The prefix arg is passed through to the command if 
possible."
                     (ignore-errors
                       (let* ((date (calendar-gregorian-from-absolute
                                     (+ (org-today) distance)))
-                             (time (encode-time 0 0 0 (nth 1 date) (nth 0 date)
-                                                (nth 2 date))))
+                             (time (org-encode-time
+                                     0 0 0 (nth 1 date) (nth 0 date) (nth 2 
date))))
                         (org-agenda-schedule nil time))))))))
 
        (?f
@@ -10701,10 +11255,10 @@ current HH:MM time."
      (,org-agenda-category-filter category)
      (,org-agenda-regexp-filter regexp)
      (,org-agenda-effort-filter effort)
-     (,(get 'org-agenda-tag-filter :preset-filter) tag)
-     (,(get 'org-agenda-category-filter :preset-filter) category)
-     (,(get 'org-agenda-effort-filter :preset-filter) effort)
-     (,(get 'org-agenda-regexp-filter :preset-filter) regexp))))
+     (,(assoc-default 'tag org-agenda-filters-preset) tag)
+     (,(assoc-default 'category org-agenda-filters-preset) category)
+     (,(assoc-default 'effort org-agenda-filters-preset) effort)
+     (,(assoc-default 'regexp org-agenda-filters-preset) regexp))))
 
 (defun org-agenda-drag-line-forward (arg &optional backward)
   "Drag an agenda line forward by ARG lines.
@@ -10806,7 +11360,7 @@ argument: an entry from `org-agenda-get-day-entries'.
 FILTER can also be an alist with the car of each cell being
 either `headline' or `category'.  For example:
 
-  \\='((headline \"IMPORTANT\")
+   ((headline \"IMPORTANT\")
     (category \"Work\"))
 
 will only add headlines containing IMPORTANT or headlines
diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el
index c490e4b48f..d08afa457a 100644
--- a/lisp/org/org-archive.el
+++ b/lisp/org/org-archive.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -28,6 +28,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org)
 (require 'cl-lib)
 
@@ -35,6 +38,9 @@
 (declare-function org-datetree-find-date-create "org-datetree" (date &optional 
keep-restriction))
 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
 
+;; From org-element.el
+(defvar org-element--cache-avoid-synchronous-headline-re-parsing)
+
 (defcustom org-archive-default-command 'org-archive-subtree
   "The default archiving command."
   :group 'org-archive
@@ -233,7 +239,7 @@ direct children of this heading."
             (tr-org-odd-levels-only org-odd-levels-only)
             (this-buffer (current-buffer))
             (time (format-time-string
-                   (substring (cdr org-time-stamp-formats) 1 -1)))
+                    (org-time-stamp-format 'with-time 'no-brackets)))
             (file (abbreviate-file-name
                    (or (buffer-file-name (buffer-base-buffer))
                        (error "No file associated to buffer"))))
@@ -253,7 +259,9 @@ direct children of this heading."
              (if (local-variable-p 'org-odd-levels-only (current-buffer))
                  org-odd-levels-only
                tr-org-odd-levels-only))
-            level datetree-date datetree-subheading-p)
+            level datetree-date datetree-subheading-p
+             ;; Suppress on-the-fly headline updates.
+             (org-element--cache-avoid-synchronous-headline-re-parsing t))
        (when (string-match "\\`datetree/\\(\\**\\)" heading)
          ;; "datetree/" corresponds to 3 levels of headings.
          (let ((nsub (length (match-string 1 heading))))
@@ -319,7 +327,7 @@ direct children of this heading."
                  (org-todo-regexp tr-org-todo-regexp)
                  (org-todo-line-regexp tr-org-todo-line-regexp))
              (goto-char (point-min))
-             (org-show-all '(headings blocks))
+             (org-fold-show-all '(headings blocks))
              (if (and heading (not (and datetree-date (not 
datetree-subheading-p))))
                  (progn
                    (if (re-search-forward
@@ -334,7 +342,7 @@ direct children of this heading."
                      (insert (if datetree-date "" "\n") heading "\n")
                      (end-of-line 0))
                    ;; Make the subtree visible
-                   (outline-show-subtree)
+                   (org-fold-show-subtree)
                    (if org-archive-reversed-order
                        (progn
                          (org-back-to-heading t)
@@ -412,7 +420,7 @@ direct children of this heading."
                 (if (eq this-buffer buffer)
                     (concat "under heading: " heading)
                   (concat "in file: " (abbreviate-file-name afile)))))))
-    (org-reveal)
+    (org-fold-reveal)
     (if (looking-at "^[ \t]*$")
        (outline-next-visible-heading 1))))
 
@@ -448,6 +456,8 @@ Archiving time is retained in the ARCHIVE_TIME node 
property."
        (setq leader (match-string 0)
              level (funcall outline-level))
        (setq pos (point-marker))
+        ;; Advance POS upon insertion in front of it.
+        (set-marker-insertion-type pos t)
        (condition-case nil
            (outline-up-heading 1 t)
          (error (setq e (point-max)) (goto-char (point-min))))
@@ -480,15 +490,15 @@ Archiving time is retained in the ARCHIVE_TIME node 
property."
        (org-set-property
         "ARCHIVE_TIME"
         (format-time-string
-         (substring (cdr org-time-stamp-formats) 1 -1)))
+          (org-time-stamp-format 'with-time 'no-brackets)))
        (outline-up-heading 1 t)
-       (org-flag-subtree t)
+       (org-fold-subtree t)
        (org-cycle-show-empty-lines 'folded)
        (when org-provide-todo-statistics
          ;; Update TODO statistics of parent.
          (org-update-parent-todo-statistics))
        (goto-char pos)))
-    (org-reveal)
+    (org-fold-reveal)
     (if (looking-at "^[ \t]*$")
        (outline-next-visible-heading 1))))
 
@@ -597,7 +607,7 @@ the children that do not contain any open TODO items."
        (save-excursion
          (org-back-to-heading t)
          (setq set (org-toggle-tag org-archive-tag))
-         (when set (org-flag-subtree t)))
+         (when set (org-fold-subtree t)))
        (and set (beginning-of-line 1))
        (message "Subtree %s" (if set "archived" "unarchived"))))))
 
diff --git a/lisp/org/org-attach-git.el b/lisp/org/org-attach-git.el
index ddb2ee97a0..95a2359c3b 100644
--- a/lisp/org/org-attach-git.el
+++ b/lisp/org/org-attach-git.el
@@ -29,6 +29,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org-attach)
 (require 'vc-git)
 
@@ -43,7 +46,8 @@
 
 (defcustom org-attach-git-annex-auto-get 'ask
   "Confirmation preference for automatically getting annex files.
-If \\='ask, prompt using `y-or-n-p'.  If t, always get.  If nil, never get."
+If this is the symbol `ask', prompt using `y-or-n-p'.
+If t, always get.  If nil, never get."
   :group 'org-attach
   :package-version '(Org . "9.0")
   :version "26.1"
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el
index 36c21b7021..41f3a568c0 100644
--- a/lisp/org/org-attach.el
+++ b/lisp/org/org-attach.el
@@ -34,6 +34,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org)
 (require 'ol)
@@ -123,8 +126,8 @@ lns   create a symbol link.  Note that this is not supported
 
 Enabling inheritance for `org-attach' implies two things.  First,
 that attachment links will look through all parent headings until
-it finds the linked attachment.  Second, that running org-attach
-inside a node without attachments will make org-attach operate on
+it finds the linked attachment.  Second, that running `org-attach'
+inside a node without attachments will make `org-attach' operate on
 the first parent heading it finds with an attachment.
 
 Selective means to respect the inheritance setting in
@@ -136,7 +139,10 @@ Selective means to respect the inheritance setting in
          (const :tag "Respect org-use-property-inheritance" selective)))
 
 (defcustom org-attach-store-link-p nil
-  "Non-nil means store a link to a file when attaching it."
+  "Non-nil means store a link to a file when attaching it.
+When t, store the link to original file location.
+When `file', store link to the attached file location.
+When `attached', store attach: link to the attached file."
   :group 'org-attach
   :version "24.1"
   :type '(choice
@@ -160,28 +166,57 @@ When set to `query', ask the user instead."
   "Translate an UUID ID into a folder-path.
 Default format for how Org translates ID properties to a path for
 attachments.  Useful if ID is generated with UUID."
-  (format "%s/%s"
-         (substring id 0 2)
-         (substring id 2)))
+  (and (< 2 (length id))
+       (format "%s/%s"
+               (substring id 0 2)
+               (substring id 2))))
 
 (defun org-attach-id-ts-folder-format (id)
   "Translate an ID based on a timestamp to a folder-path.
 Useful way of translation if ID is generated based on ISO8601
 timestamp.  Splits the attachment folder hierarchy into
 year-month, the rest."
-  (format "%s/%s"
-         (substring id 0 6)
-         (substring id 6)))
-
-(defcustom org-attach-id-to-path-function-list 
'(org-attach-id-uuid-folder-format
-                                                org-attach-id-ts-folder-format)
-  "List of functions parsing an ID string into a folder-path.
-The first function in this list defines the preferred function
-which will be used when creating new attachment folders.  All
-functions of this list will be tried when looking for existing
-attachment folders based on ID."
+  (and (< 6 (length id))
+       (format "%s/%s"
+               (substring id 0 6)
+               (substring id 6))))
+
+(defun org-attach-id-fallback-folder-format (id)
+  "Return \"__/X/ID\" folder path as a dumb fallback.
+X is the first character in the ID string.
+
+This function may be appended to `org-attach-id-path-function-list' to
+provide a fallback for non-standard ID values that other functions in
+`org-attach-id-path-function-list' are unable to handle.  For example,
+when the ID is too short for `org-attach-id-ts-folder-format'.
+
+However, we recommend to define a more specific function spreading
+entries over multiple folders.  This function may create a large
+number of entries in a single folder, which may cause issues on some
+systems."
+  (format "__/%s/%s" (substring id 0 1) id))
+
+(defcustom org-attach-id-to-path-function-list
+  '(org-attach-id-uuid-folder-format
+    org-attach-id-ts-folder-format
+    org-attach-id-fallback-folder-format)
+  "List of functions used to derive attachment path from an ID string.
+The functions are called with a single ID argument until the return
+value is an existing folder.  If no folder has been created yet for
+the given ID, then the first non-nil value defines the attachment
+dir to be created.
+
+Usually, the ID format passed to the functions is defined by
+`org-id-method'.  It is advised that the first function in the list do
+not generate all the attachment dirs inside the same parent dir.  Some
+file systems may have performance issues in such scenario.
+
+Care should be taken when customizing this variable.  Previously
+created attachment folders might not be correctly mapped upon removing
+functions from the list.  Then, Org will not be able to detect the
+existing attachments."
   :group 'org-attach
-  :package-version '(Org . "9.3")
+  :package-version '(Org . "9.6")
   :type '(repeat (function :tag "Function with ID as input")))
 
 (defvar org-attach-after-change-hook nil
@@ -314,16 +349,17 @@ Shows a list of commands and prompts for another key to 
execute a command."
                             (concat (mapcar #'caar org-attach-commands)))))
            (message msg)
            (while (and (setq c (read-char-exclusive))
-                       (memq c '(14 16 22 134217846)))
+                        (memq c '(?\C-n ?\C-p ?\C-v ?\M-v)))
              (org-scroll c t)))
          (and (get-buffer "*Org Attach*") (kill-buffer "*Org Attach*"))))
       (let ((command (cl-some (lambda (entry)
                                (and (memq c (nth 0 entry)) (nth 1 entry)))
                              org-attach-commands)))
-       (if (commandp command t)
-           (call-interactively command)
+       (if (commandp command)
+           (command-execute command)
          (error "No such attachment command: %c" c))))))
 
+;;;###autoload
 (defun org-attach-dir (&optional create-if-not-exists-p no-fs-check)
   "Return the directory associated with the current outline node.
 First check for DIR property, then ID property.
@@ -335,7 +371,7 @@ will be invoked to access the directory for the current 
entry.
 Note that this method returns the directory as declared by ID or
 DIR even if the directory doesn't exist in the filesystem.
 
-If CREATE-IF-NOT-EXIST-P is non-nil, `org-attach-dir-get-create'
+If CREATE-IF-NOT-EXISTS-P is non-nil, `org-attach-dir-get-create'
 is run.  If NO-FS-CHECK is non-nil, the function returns the path
 to the attachment even if it has not yet been initialized in the
 filesystem.
@@ -353,7 +389,7 @@ If no attachment directory can be derived, return nil."
       (org-attach-check-absolute-path attach-dir))
      ((setq id (org-entry-get nil "ID" org-attach-use-inheritance))
       (org-attach-check-absolute-path nil)
-      (setq attach-dir (org-attach-dir-from-id id 'try-all))))
+      (setq attach-dir (org-attach-dir-from-id id 'existing))))
     (if no-fs-check
        attach-dir
       (when (and attach-dir (file-directory-p attach-dir))
@@ -374,38 +410,40 @@ If the attachment by some reason cannot be created an 
error will be raised."
          (setq answer (read-char-exclusive)))
        (cond
         ((or (eq org-attach-preferred-new-method 'id) (eq answer ?1))
-         (setq attach-dir (org-attach-dir-from-id (org-id-get nil t))))
+         (let ((id (org-id-get nil t)))
+           (or (setq attach-dir (org-attach-dir-from-id id))
+               (error "Failed to get folder for id %s, \
+adjust `org-attach-id-to-path-function-list'"
+                       id))))
         ((or (eq org-attach-preferred-new-method 'dir) (eq answer ?2))
          (setq attach-dir (org-attach-set-directory)))
         ((eq org-attach-preferred-new-method 'nil)
-         (error "No existing directory. DIR or ID property has to be 
explicitly created")))))
+         (error "No existing directory.  DIR or ID property has to be 
explicitly created")))))
     (unless attach-dir
       (error "No attachment directory is associated with the current node"))
     (unless (file-directory-p attach-dir)
       (make-directory attach-dir t))
     attach-dir))
 
-(defun org-attach-dir-from-id (id  &optional try-all)
+(defun org-attach-dir-from-id (id  &optional existing)
   "Return a folder path based on `org-attach-id-dir' and ID.
-If TRY-ALL is non-nil, try all id-to-path functions in
-`org-attach-id-to-path-function-list' and return the first path
-that exist in the filesystem, or the first one if none exist.
-Otherwise only use the first function in that list."
-  (let ((attach-dir-preferred (expand-file-name
-                              (funcall (car 
org-attach-id-to-path-function-list) id)
-                              (expand-file-name org-attach-id-dir))))
-    (if try-all
-       (let ((attach-dir attach-dir-preferred)
-             (fun-list (cdr org-attach-id-to-path-function-list)))
-         (while (and fun-list (not (file-directory-p attach-dir)))
-           (setq attach-dir (expand-file-name
-                             (funcall (car fun-list) id)
-                             (expand-file-name org-attach-id-dir)))
-           (setq fun-list (cdr fun-list)))
-         (if (file-directory-p attach-dir)
-             attach-dir
-           attach-dir-preferred))
-      attach-dir-preferred)))
+Try id-to-path functions in `org-attach-id-to-path-function-list'
+ignoring nils.  If EXISTING is non-nil, then return the first path
+found in the filesystem.  Otherwise return the first non-nil value."
+  (let ((fun-list org-attach-id-to-path-function-list)
+        (base-dir (expand-file-name org-attach-id-dir))
+        preferred first)
+    (while (and fun-list
+                (not preferred))
+      (let* ((name (funcall (car fun-list) id))
+             (candidate (and name (expand-file-name name base-dir))))
+        (setq fun-list (cdr fun-list))
+        (when candidate
+          (if (or (not existing) (file-directory-p candidate))
+              (setq preferred candidate)
+            (unless first
+              (setq first candidate))))))
+    (or preferred first)))
 
 (defun org-attach-check-absolute-path (dir)
   "Check if we have enough information to root the attachment directory.
@@ -483,8 +521,11 @@ DIR-property exists (that is different from the unset 
one)."
   (org-attach-tag 'off))
 
 (defun org-attach-url (url)
+  "Attach URL."
   (interactive "MURL of the file to attach: \n")
-  (let ((org-attach-method 'url))
+  (let ((org-attach-method 'url)
+        (org-safe-remote-resources ; Assume safety if in an interactive 
session.
+         (if noninteractive org-safe-remote-resources '(""))))
     (org-attach-attach url)))
 
 (defun org-attach-buffer (buffer-name)
@@ -503,7 +544,7 @@ if it would overwrite an existing filename."
 
 (defun org-attach-attach (file &optional visit-dir method)
   "Move/copy/link FILE into the attachment directory of the current outline 
node.
-If VISIT-DIR is non-nil, visit the directory with dired.
+If VISIT-DIR is non-nil, visit the directory with `dired'.
 METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
 `org-attach-method'."
   (interactive
@@ -516,15 +557,24 @@ METHOD may be `cp', `mv', `ln', `lns' or `url' default 
taken from
     current-prefix-arg
     nil))
   (setq method (or method org-attach-method))
+  (when (file-directory-p file)
+    (setq file (directory-file-name file)))
   (let ((basename (file-name-nondirectory file)))
     (let* ((attach-dir (org-attach-dir 'get-create))
            (attach-file (expand-file-name basename attach-dir)))
       (cond
        ((eq method 'mv) (rename-file file attach-file))
-       ((eq method 'cp) (copy-file file attach-file))
+       ((eq method 'cp)
+        (if (file-directory-p file)
+            (copy-directory file attach-file nil nil t)
+          (copy-file file attach-file)))
        ((eq method 'ln) (add-name-to-file file attach-file))
-       ((eq method 'lns) (make-symbolic-link file attach-file))
-       ((eq method 'url) (url-copy-file file attach-file)))
+       ((eq method 'lns) (make-symbolic-link file attach-file 1))
+       ((eq method 'url)
+        (if (org--should-fetch-remote-resource-p file)
+            (url-copy-file file attach-file)
+          (error "The remote resource %S is considered unsafe, and will not be 
downloaded."
+                 file))))
       (run-hook-with-args 'org-attach-after-change-hook attach-dir)
       (org-attach-tag)
       (cond ((eq org-attach-store-link-p 'attached)
@@ -574,27 +624,27 @@ The attachment is created as an Emacs buffer."
     (find-file (expand-file-name file attach-dir))
     (message "New attachment %s" file)))
 
-(defun org-attach-delete-one (&optional file)
-  "Delete a single attachment."
+(defun org-attach-delete-one (&optional attachment)
+  "Delete a single ATTACHMENT."
   (interactive)
   (let* ((attach-dir (org-attach-dir))
         (files (org-attach-file-list attach-dir))
-        (file (or file
+        (attachment (or attachment
                   (completing-read
                    "Delete attachment: "
                    (mapcar (lambda (f)
                              (list (file-name-nondirectory f)))
                            files)))))
-    (setq file (expand-file-name file attach-dir))
-    (unless (file-exists-p file)
-      (error "No such attachment: %s" file))
-    (delete-file file)
+    (setq attachment (expand-file-name attachment attach-dir))
+    (unless (file-exists-p attachment)
+      (error "No such attachment: %s" attachment))
+    (delete-file attachment)
     (run-hook-with-args 'org-attach-after-change-hook attach-dir)))
 
 (defun org-attach-delete-all (&optional force)
   "Delete all attachments from the current outline node.
 This actually deletes the entire attachment directory.
-A safer way is to open the directory in dired and delete from there.
+A safer way is to open the directory in `dired' and delete from there.
 
 With prefix argument FORCE, directory will be recursively deleted
 with no prompts."
@@ -629,12 +679,12 @@ empty attachment directories."
                      t))
           (delete-directory attach-dir))))))
 
-(defun org-attach-file-list (dir)
-  "Return a list of files in the attachment directory.
+(defun org-attach-file-list (directory)
+  "Return a list of files in the attachment DIRECTORY.
 This ignores files ending in \"~\"."
   (delq nil
        (mapcar (lambda (x) (if (string-match "^\\.\\.?\\'" x) nil x))
-               (directory-files dir nil "[^~]\\'"))))
+               (directory-files directory nil "[^~]\\'"))))
 
 (defun org-attach-reveal ()
   "Show the attachment directory of the current outline node.
@@ -645,7 +695,7 @@ exist yet.  Respects `org-attach-preferred-new-method'."
   (org-open-file (org-attach-dir-get-create)))
 
 (defun org-attach-reveal-in-emacs ()
-  "Show the attachment directory of the current outline node in dired.
+  "Show the attachment directory of the current outline node in `dired'.
 Will create an attachment and folder if it doesn't exist yet.
 Respects `org-attach-preferred-new-method'."
   (interactive)
@@ -749,14 +799,14 @@ This function is called by `org-archive-hook'.  The option
 
 ;;;###autoload
 (defun org-attach-dired-to-subtree (files)
-  "Attach FILES marked or current file in dired to subtree in other window.
+  "Attach FILES marked or current file in `dired' to subtree in other window.
 Takes the method given in `org-attach-method' for the attach action.
-Precondition: Point must be in a dired buffer.
+Precondition: Point must be in a `dired' buffer.
 Idea taken from `gnus-dired-attach'."
   (interactive
    (list (dired-get-marked-files)))
   (unless (eq major-mode 'dired-mode)
-    (user-error "This command must be triggered in a dired buffer"))
+    (user-error "This command must be triggered in a `dired' buffer"))
   (let ((start-win (selected-window))
         (other-win
          (get-window-with-predicate
@@ -776,7 +826,7 @@ Idea taken from `gnus-dired-attach'."
 
 
 (add-hook 'org-archive-hook 'org-attach-archive-delete-maybe)
-(add-hook 'org-export-before-parsing-hook 'org-attach-expand-links)
+(add-hook 'org-export-before-parsing-functions 'org-attach-expand-links)
 
 (provide 'org-attach)
 
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index abf4f9610e..b26afeb036 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -47,6 +47,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org)
 (require 'org-refile)
@@ -57,7 +60,7 @@
 (declare-function org-datetree-find-date-create "org-datetree" (date &optional 
keep-restriction))
 (declare-function org-datetree-find-month-create (d &optional 
keep-restriction))
 (declare-function org-decrypt-entry "org-crypt" ())
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-lineage "org-element" (datum &optional types 
with-self))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-encrypt-entry "org-crypt" ())
@@ -83,7 +86,7 @@
 (defvar org-table-hlines)
 
 (defvar org-capture-clock-was-started nil
-  "Internal flag, noting if the clock was started.")
+  "Internal flag, keeping marker to the started clock.")
 
 (defvar org-capture-last-stored-marker (make-marker)
   "Marker pointing to the entry most recently stored with `org-capture'.")
@@ -294,6 +297,21 @@ properties are:
 
  :no-save            Do not save the target file after finishing the capture.
 
+ :hook               A nullary function or list of nullary functions run before
+                     `org-capture-mode-hook' when the template is selected.
+
+ :prepare-finalize   A nullary function or list of nullary functions run before
+                     `org-capture-prepare-finalize-hook'
+                     when the template is selected.
+
+ :before-finalize    A nullary function or list of nullary functions run before
+                     `org-capture-before-finalize-hook'
+                     when the template is selected.
+
+ :after-finalize     A nullary function or list of nullary functions run before
+                     `org-capture-after-finalize-hook'
+                     when the template is selected.
+
 The template defines the text to be inserted.  Often this is an
 Org mode entry (so the first line should start with a star) that
 will be filed as a child of the target headline.  It can also be
@@ -309,6 +327,8 @@ be replaced with content and expanded:
               introduced with %[pathname] are expanded this way.
               Since this happens after expanding non-interactive
               %-escapes, those can be used to fill the expression.
+              The evaluation happens with Org mode set as major mode
+              in a temporary buffer.
   %<...>      The result of `format-time-string' on the ... format
               specification.
   %t          Time stamp, date only.  The time stamp is the current
@@ -373,8 +393,8 @@ calendar                |  %:type %:date
 When you need to insert a literal percent sign in the template,
 you can escape ambiguous cases with a backward slash, e.g., \\%i."
   :group 'org-capture
-  :package-version '(Org . "9.5")
-  :set (lambda (s v) (set s (org-capture-upgrade-templates v)))
+  :package-version '(Org . "9.6")
+  :set (lambda (s v) (set-default-toplevel-value s 
(org-capture-upgrade-templates v)))
   :type
   (let ((file-variants '(choice :tag "Filename       "
                                (file :tag "Literal")
@@ -558,7 +578,8 @@ For example, if you have a capture template \"c\" and you 
want
 this template to be accessible only from `message-mode' buffers,
 use this:
 
-   \\='((\"c\" ((in-mode . \"message-mode\"))))
+  (setq org-capture-templates-contexts
+        \\='((\"c\" ((in-mode . \"message-mode\")))))
 
 Here are the available contexts definitions:
 
@@ -576,7 +597,8 @@ accessible if there is at least one valid check.
 You can also bind a key to another capture template depending on
 contextual rules.
 
-    \\='((\"c\" \"d\" ((in-mode . \"message-mode\"))))
+  (setq org-capture-templates-contexts
+        \\='((\"c\" \"d\" ((in-mode . \"message-mode\")))))
 
 Here it means: in `message-mode buffers', use \"c\" as the
 key for the capture template otherwise associated with \"d\".
@@ -712,7 +734,8 @@ of the day at point (if any) or the current HH:MM time."
                  (org-capture-put :interrupted-clock
                                   (copy-marker org-clock-marker)))
                (org-clock-in)
-               (setq-local org-capture-clock-was-started t))
+               (setq-local org-capture-clock-was-started
+                            (copy-marker org-clock-marker)))
            (error "Could not start the clock in this capture buffer")))
        (when (org-capture-get :immediate-finish)
          (org-capture-finalize))))))))
@@ -733,6 +756,17 @@ of the day at point (if any) or the current HH:MM time."
        (format "* Template function %S not found" f)))
      (_ "* Invalid capture template"))))
 
+(defun org-capture--run-template-functions (keyword &optional local)
+  "Run functions associated with KEYWORD on template's plist.
+For valid values of KEYWORD see `org-capture-templates'.
+If LOCAL is non-nil use the buffer-local value of `org-capture-plist'."
+  ;; Used in place of `run-hooks' because these functions have no associated 
symbol.
+  ;; They are stored directly on `org-capture-plist'.
+  (let ((value (org-capture-get keyword local)))
+    (if (functionp value)
+        (funcall value)
+      (mapc #'funcall value))))
+
 (defun org-capture-finalize (&optional stay-with-capture)
   "Finalize the capture process.
 With prefix argument STAY-WITH-CAPTURE, jump to the location of the
@@ -744,6 +778,7 @@ captured item after finalizing."
               (buffer-base-buffer (current-buffer)))
     (error "This does not seem to be a capture buffer for Org mode"))
 
+  (org-capture--run-template-functions :prepare-finalize 'local)
   (run-hooks 'org-capture-prepare-finalize-hook)
 
   ;; Update `org-capture-plist' with the buffer-local value.  Since
@@ -753,10 +788,7 @@ captured item after finalizing."
 
   ;; Did we start the clock in this capture buffer?
   (when (and org-capture-clock-was-started
-            org-clock-marker
-            (eq (marker-buffer org-clock-marker) (buffer-base-buffer))
-            (>= org-clock-marker (point-min))
-            (< org-clock-marker (point-max)))
+            (equal org-clock-marker org-capture-clock-was-started))
     ;; Looks like the clock we started is still running.
     (if org-capture-clock-keep
        ;; User may have completed clocked heading from the template.
@@ -816,6 +848,7 @@ captured item after finalizing."
       ;; the indirect buffer has been killed.
       (org-capture-store-last-position)
 
+      (org-capture--run-template-functions :before-finalize 'local)
       ;; Run the hook
       (run-hooks 'org-capture-before-finalize-hook))
 
@@ -864,6 +897,9 @@ captured item after finalizing."
       ;; Restore the window configuration before capture
       (set-window-configuration return-wconf))
 
+    ;; Do not use the local arg to `org-capture--run-template-functions' here.
+    ;; The buffer-local value has been stored on `org-capture-plist'.
+    (org-capture--run-template-functions :after-finalize)
     (run-hooks 'org-capture-after-finalize-hook)
     ;; Special cases
     (cond
@@ -1050,9 +1086,10 @@ Store them in the capture property list."
                       prompt-time
                     ;; Use 00:00 when no time is given for another
                     ;; date than today?
-                    (apply #'encode-time 0 0
-                           org-extend-today-until
-                           (cl-cdddr (decode-time prompt-time)))))
+                    (org-encode-time
+                     (apply #'list
+                            0 0 org-extend-today-until
+                            (cl-cdddr (decode-time prompt-time))))))
                 (time-to-days prompt-time)))
              (t
               ;; Current date, possibly corrected for late night
@@ -1129,7 +1166,7 @@ may have been stored before."
   (org-switch-to-buffer-other-window
    (org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE"))
   (widen)
-  (org-show-all)
+  (org-fold-show-all)
   (goto-char (org-capture-get :pos))
   (setq-local outline-level 'org-outline-level)
   (pcase (org-capture-get :type)
@@ -1139,6 +1176,7 @@ may have been stored before."
     (`item (org-capture-place-item))
     (`checkitem (org-capture-place-item)))
   (setq-local org-capture-current-plist org-capture-plist)
+  (org-capture--run-template-functions :hook 'local)
   (org-capture-mode 1))
 
 (defun org-capture-place-entry ()
@@ -1171,8 +1209,11 @@ may have been stored before."
       (goto-char (point-min))
       (unless (org-at-heading-p) (outline-next-heading)))
      ;; Otherwise, insert as a top-level entry at the end of the file.
-     (t (goto-char (point-max))))
-    (let ((origin (point)))
+     (t (goto-char (point-max))
+        ;; Make sure that last point is not folded.
+        (org-fold-core-cycle-over-indirect-buffers
+          (org-fold-region (max 1 (1- (point-max))) (point-max) nil))))
+    (let ((origin (point-marker)))
       (unless (bolp) (insert "\n"))
       (org-capture-empty-lines-before)
       (let ((beg (point)))
@@ -1237,7 +1278,7 @@ may have been stored before."
                                     (point))
                                   beg)))))))
     ;; Insert template.
-    (let ((origin (point)))
+    (let ((origin (point-marker)))
       (unless (bolp) (insert "\n"))
       ;; When a new list is created, always obey to `:empty-lines' and
       ;; friends.
@@ -1264,7 +1305,7 @@ may have been stored before."
        (when item
          (let ((i (save-excursion
                     (goto-char (org-element-property :post-affiliated item))
-                    (current-indentation))))
+                    (org-current-text-indentation))))
            (save-excursion
              (goto-char beg)
              (save-excursion
@@ -1338,7 +1379,7 @@ may have been stored before."
       ;; No table found.  Create it with an empty header.
       (goto-char end)
       (unless (bolp) (insert "\n"))
-      (let ((origin (point)))
+      (let ((origin (point-marker)))
        (insert "|   |\n|---|\n")
        (narrow-to-region origin (point))))
     ;; In the current table, find the appropriate location for TEXT.
@@ -1367,7 +1408,7 @@ may have been stored before."
      (t
       (goto-char (org-table-end))))
     ;; Insert text and position point according to template.
-    (let ((origin (point)))
+    (let ((origin (point-marker)))
       (unless (bolp) (insert "\n"))
       (let ((beg (point))
            (end (save-excursion
@@ -1399,7 +1440,7 @@ Of course, if exact position has been required, just put 
it there."
    (t
     ;; Beginning or end of file.
     (goto-char (if (org-capture-get :prepend) (point-min) (point-max)))))
-  (let ((origin (point)))
+  (let ((origin (point-marker)))
     (unless (bolp) (insert "\n"))
     (org-capture-empty-lines-before)
     (org-capture-position-for-last-stored (point))
@@ -1569,14 +1610,16 @@ Lisp programs can force the template by setting KEYS to 
a string."
   "Fill a TEMPLATE and return the filled template as a string.
 The template may still contain \"%?\" for cursor positioning.
 INITIAL content and/or ANNOTATION may be specified, but will be overridden
-by their respective `org-store-link-plist' properties if present."
+by their respective `org-store-link-plist' properties if present.
+
+Expansion occurs in a temporary Org mode buffer."
   (let* ((template (or template (org-capture-get :template)))
         (buffer (org-capture-get :buffer))
         (file (buffer-file-name (or (buffer-base-buffer buffer) buffer)))
         (time (let* ((c (or (org-capture-get :default-time) (current-time)))
                      (d (decode-time c)))
                 (if (< (nth 2 d) org-extend-today-until)
-                    (encode-time 0 59 23 (1- (nth 3 d)) (nth 4 d) (nth 5 d))
+                    (org-encode-time 0 59 23 (1- (nth 3 d)) (nth 4 d) (nth 5 
d))
                   c)))
         (v-t (format-time-string (org-time-stamp-format nil) time))
         (v-T (format-time-string (org-time-stamp-format t) time))
@@ -1642,6 +1685,7 @@ by their respective `org-store-link-plist' properties if 
present."
       (setq buffer-file-name nil)
       (setq mark-active nil)
       (insert template)
+      (org-mode)
       (goto-char (point-min))
       ;; %[] insert contents of a file.
       (save-excursion
@@ -1817,12 +1861,7 @@ by their respective `org-store-link-plist' properties if 
present."
                     (setq org-capture--prompt-history
                           (gethash prompt org-capture--prompt-history-table))
                      (push (org-completing-read
-                            ;; `format-prompt' is new in Emacs 28.1.
-                            (if (fboundp 'format-prompt)
-                                (format-prompt (or prompt "Enter string") 
default)
-                              (concat (or prompt "Enter string")
-                                      (and default (format " [%s]" default))
-                                      ": "))
+                            (org-format-prompt (or prompt "Enter string") 
default)
                            completions
                            nil nil nil 'org-capture--prompt-history default)
                           strings)
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 42de0a0cf9..02cddddb30 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -28,6 +28,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org)
 
@@ -35,6 +38,8 @@
 (declare-function notifications-notify "notifications" (&rest params))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
+(declare-function org-element--cache-active-p "org-element" ())
+(defvar org-element-use-cache)
 (declare-function org-inlinetask-at-task-p "org-inlinetask" ())
 (declare-function org-inlinetask-goto-beginning "org-inlinetask" ())
 (declare-function org-inlinetask-goto-end "org-inlinetask" ())
@@ -50,7 +55,6 @@
 (defvar org-frame-title-format-backup nil)
 (defvar org-state)
 (defvar org-link-bracket-re)
-(defvar org-time-stamp-formats)
 
 (defgroup org-clock nil
   "Options concerning clocking working time in Org mode."
@@ -321,6 +325,7 @@ string as argument."
    :link nil
    :narrow '40!
    :indent t
+   :filetitle nil
    :hidefiles nil
    :formula nil
    :timestamp nil
@@ -329,7 +334,7 @@ string as argument."
    :formatter nil)
   "Default properties for clock tables."
   :group 'org-clock
-  :version "24.1"
+  :package-version '(Org . "9.6")
   :type 'plist)
 
 (defcustom org-clock-clocktable-formatter 'org-clocktable-write-default
@@ -439,8 +444,8 @@ This uses the same format as `frame-title-format', which 
see."
 you can do \"~$ sudo apt-get install xprintidle\" if you are using
 a Debian-based distribution.
 
-Alternatively, can find x11idle.c in the org-contrib repository at
-https://git.sr.ht/~bzg/org-contrib";
+Alternatively, can find x11idle.c in
+https://orgmode.org/worg/code/scripts/x11idle.c";
   :group 'org-clock
   :version "24.4"
   :package-version '(Org . "8.0")
@@ -489,7 +494,7 @@ This variable only has effect if set with \\[customize]."
          (if value
              (add-hook 'kill-emacs-query-functions 
#'org-clock-kill-emacs-query)
            (remove-hook 'kill-emacs-query-functions 
#'org-clock-kill-emacs-query))
-         (set symbol value))
+         (set-default-toplevel-value symbol value))
   :type 'boolean
   :package-version '(Org . "9.5"))
 
@@ -694,7 +699,10 @@ pointing to it."
                        org-odd-levels-only)
                       (length prefix))))))
       (when (and cat task)
-       (insert (format "[%c] %-12s  %s\n" i cat task))
+        (if (string-match-p "[[:print:]]" (make-string 1 i))
+           (insert (format "[%c] %-12s  %s\n" i cat task))
+          ;; Avoid non-printable characters.
+          (insert (format "[N/A] %-12s  %s\n" cat task)))
        (cons i marker)))))
 
 (defvar org-clock-task-overrun nil
@@ -767,7 +775,7 @@ The time returned includes the time spent on this task in
 previous clocking intervals."
   (let ((currently-clocked-time
         (floor (org-time-convert-to-integer
-                (org-time-since org-clock-start-time))
+                (time-since org-clock-start-time))
                60)))
     (+ currently-clocked-time (or org-clock-total-time 0))))
 
@@ -997,7 +1005,7 @@ CLOCK is a cons cell of the form (MARKER START-TIME)."
         (org-clock-clock-out clock fail-quietly))
        ((org-is-active-clock clock) nil)
        (t (org-clock-clock-in clock t))))
-      ((pred (org-time-less-p nil))
+      ((pred (time-less-p nil))
        (error "RESOLVE-TO must refer to a time in the past"))
       (_
        (when restart (error "RESTART is not valid here"))
@@ -1030,7 +1038,7 @@ CLOCK is a cons cell of the form (MARKER START-TIME)."
               (let ((element (org-element-at-point)))
                 (when (eq (org-element-type element) 'drawer)
                   (when (> (org-element-property :end element) (car clock))
-                    (org-hide-drawer-toggle 'off nil element))
+                    (org-fold-hide-drawer-toggle 'off nil element))
                   (throw 'exit nil)))))))))))
 
 (defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly)
@@ -1094,12 +1102,12 @@ to be CLOCKED OUT."))))
                                                ?j ?J ?i ?q ?t ?T)))
                                (or (ding) t)))
                  (setq char-pressed
-                       (read-char (concat (funcall prompt-fn clock)
-                                          " [jkKtTgGSscCiq]? ")
-                                  nil 45)))
+                       (read-char-exclusive (concat (funcall prompt-fn clock)
+                                                    " [jkKtTgGSscCiq]? ")
+                                            nil 45)))
                (and (not (memq char-pressed '(?i ?q))) char-pressed)))))
         (default
-          (floor (org-time-convert-to-integer (org-time-since last-valid))
+          (floor (org-time-convert-to-integer (time-since last-valid))
                  60))
         (keep
          (or (and (memq ch '(?k ?K))
@@ -1107,14 +1115,14 @@ to be CLOCKED OUT."))))
              (and (memq ch '(?t ?T))
                   (floor
                    (/ (float-time
-                       (org-time-subtract (org-read-date t t) last-valid))
+                       (time-subtract (org-read-date t t) last-valid))
                       60)))))
         (gotback
          (and (memq ch '(?g ?G))
               (read-number "Got back how many minutes ago: " default)))
         (subtractp (memq ch '(?s ?S)))
-        (barely-started-p (org-time-less-p
-                           (org-time-subtract last-valid (cdr clock))
+        (barely-started-p (time-less-p
+                           (time-subtract last-valid (cdr clock))
                            45))
         (start-over (and subtractp barely-started-p)))
     (cond
@@ -1141,9 +1149,9 @@ to be CLOCKED OUT."))))
                   (and gotback (= gotback default)))
               'now)
              (keep
-              (org-time-add last-valid (* 60 keep)))
+              (time-add last-valid (* 60 keep)))
              (gotback
-              (org-time-since (* 60 gotback)))
+              (time-since (* 60 gotback)))
              (t
               (error "Unexpected, please report this as a bug")))
        (and gotback last-valid)
@@ -1173,7 +1181,7 @@ If `only-dangling-p' is non-nil, only ask to resolve 
dangling
                         (format
                          "Dangling clock started %d mins ago"
                          (floor (org-time-convert-to-integer
-                                 (org-time-since (cdr clock)))
+                                 (time-since (cdr clock)))
                                 60))))
                   (or last-valid
                       (cdr clock)))))))))))
@@ -1190,8 +1198,10 @@ If `only-dangling-p' is non-nil, only ask to resolve 
dangling
   (string-to-number (shell-command-to-string "ioreg -c IOHIDSystem | perl -ane 
'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle; last}'")))
 
 (defvar org-x11idle-exists-p
-  ;; Check that x11idle exists
-  (and (eq window-system 'x)
+  ;; Check that x11idle exists.  But don't do that on DOS/Windows,
+  ;; since the command definitely does NOT exist there, and invoking
+  ;; COMMAND.COM on MS-Windows is a bad idea -- it hangs.
+  (and (null (memq system-type '(windows-nt ms-dos)))
        (eq 0 (call-process-shell-command
               (format "command -v %s" org-clock-x11idle-program-name)))
        ;; Check that x11idle can retrieve the idle time
@@ -1224,9 +1234,11 @@ so long."
             org-clock-marker (marker-buffer org-clock-marker))
     (let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
           (org-clock-user-idle-start
-           (org-time-since org-clock-user-idle-seconds))
+           (time-since org-clock-user-idle-seconds))
           (org-clock-resolving-clocks-due-to-idleness t))
-      (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
+      (when (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
+          (cancel-timer org-clock-idle-timer)
+          (setq org-clock-idle-timer nil)
          (org-clock-resolve
           (cons org-clock-marker
                 org-clock-start-time)
@@ -1235,7 +1247,10 @@ so long."
                     (/ (float-time
                         (time-since org-clock-user-idle-start))
                        60)))
-          org-clock-user-idle-start)))))
+          org-clock-user-idle-start)
+          (when (and (org-clocking-p) (not org-clock-idle-timer))
+            (setq org-clock-idle-timer
+                 (run-with-timer 60 60 #'org-resolve-clocks-if-idle)))))))
 
 (defvar org-clock-current-task nil "Task currently clocked in.")
 (defvar org-clock-out-time nil) ; store the time of the last clock-out
@@ -1262,7 +1277,8 @@ time as the start time.  See `org-clock-continuously' to 
make this
 the default behavior."
   (interactive "P")
   (setq org-clock-notification-was-shown nil)
-  (org-refresh-effort-properties)
+  (unless org-element-use-cache
+    (org-refresh-effort-properties))
   (catch 'abort
     (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness)
                             (org-clocking-p)))
@@ -1316,7 +1332,7 @@ the default behavior."
       ;; Clock in at which position?
       (setq target-pos
            (if (and (eobp) (not (org-at-heading-p)))
-                (line-beginning-position 0)
+               (org-with-wide-buffer (line-beginning-position 0))
              (point)))
       (save-excursion
        (when (and selected-task (marker-buffer selected-task))
@@ -1340,8 +1356,8 @@ the default behavior."
                  (when newstate (org-todo newstate))))
               ((and org-clock-in-switch-to-state
                     (not (looking-at (concat org-outline-regexp "[ \t]*"
-                                             org-clock-in-switch-to-state
-                                             "\\>"))))
+                                           org-clock-in-switch-to-state
+                                           "\\>"))))
                (org-todo org-clock-in-switch-to-state)))
         (setq org-clock-heading (org-clock--mode-line-heading))
         (org-clock-find-position org-clock-in-resume)
@@ -1367,14 +1383,14 @@ the default behavior."
           (sit-for 2)
           (throw 'abort nil))
          (t
-          (insert-before-markers "\n")
+          (insert-before-markers-and-inherit "\n")
           (backward-char 1)
           (when (and (save-excursion
                        (end-of-line 0)
                        (org-in-item-p)))
             (beginning-of-line 1)
             (indent-line-to (max 0 (- (current-indentation) 2))))
-          (insert org-clock-string " ")
+          (insert-and-inherit org-clock-string " ")
           (setq org-clock-effort (org-entry-get (point) org-effort-property))
           (setq org-clock-total-time (org-clock-sum-current-item
                                       (org-clock-get-sum-start)))
@@ -1385,7 +1401,7 @@ the default behavior."
                           (format
                            "You stopped another clock %d mins ago; start this 
one from then? "
                            (/ (org-time-convert-to-integer
-                               (org-time-subtract
+                               (time-subtract
                                 (org-current-time org-clock-rounding-minutes t)
                                 leftover))
                               60)))
@@ -1514,7 +1530,7 @@ The time is always returned as UTC."
             (day (nth 3 dt)))
        (if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day)))
        (setf (nth 2 dt) org-extend-today-until)
-       (apply #'encode-time 0 0 (nthcdr 2 dt))))
+       (org-encode-time (apply #'list 0 0 (nthcdr 2 dt)))))
      ((or (equal cmt "all")
          (and (or (not cmt) (equal cmt "auto"))
               (not lr)))
@@ -1575,19 +1591,23 @@ line and position cursor in that line."
                      count (1+ count))))))
        (cond
         ((null positions)
-         ;; Skip planning line and property drawer, if any.
-         (org-end-of-meta-data)
-         (unless (bolp) (insert "\n"))
-         ;; Create a new drawer if necessary.
-         (when (and org-clock-into-drawer
-                    (or (not (wholenump org-clock-into-drawer))
-                        (< org-clock-into-drawer 2)))
-           (let ((beg (point)))
-             (insert ":" drawer ":\n:END:\n")
-             (org-indent-region beg (point))
-             (org-flag-region
-              (line-end-position -1) (1- (point)) t 'outline)
-             (forward-line -1))))
+          (org-fold-core-ignore-modifications
+           ;; Skip planning line and property drawer, if any.
+           (org-end-of-meta-data)
+           (unless (bolp) (insert-and-inherit "\n"))
+           ;; Create a new drawer if necessary.
+           (when (and org-clock-into-drawer
+                      (or (not (wholenump org-clock-into-drawer))
+                          (< org-clock-into-drawer 2)))
+             (let ((beg (point)))
+               (insert-and-inherit ":" drawer ":\n:END:\n")
+               (org-indent-region beg (point))
+                (if (eq org-fold-core-style 'text-properties)
+                   (org-fold-region
+                    (line-end-position -1) (1- (point)) t 'drawer)
+                  (org-fold-region
+                  (line-end-position -1) (1- (point)) t 'outline))
+               (forward-line -1)))))
         ;; When a clock drawer needs to be created because of the
         ;; number of clock items or simply if it is missing, collect
         ;; all clocks in the section and wrap them within the drawer.
@@ -1596,28 +1616,29 @@ line and position cursor in that line."
            drawer)
          ;; Skip planning line and property drawer, if any.
          (org-end-of-meta-data)
-         (let ((beg (point)))
-           (insert
-            (mapconcat
-             (lambda (p)
-               (save-excursion
-                 (goto-char p)
-                 (org-trim (delete-and-extract-region
-                            (save-excursion (skip-chars-backward " \r\t\n")
-                                            (line-beginning-position 2))
-                            (line-beginning-position 2)))))
-             positions "\n")
-            "\n:END:\n")
-           (let ((end (point-marker)))
-             (goto-char beg)
-             (save-excursion (insert ":" drawer ":\n"))
-             (org-flag-region (line-end-position) (1- end) t 'outline)
-             (org-indent-region (point) end)
-             (forward-line)
-             (unless org-log-states-order-reversed
-               (goto-char end)
-               (beginning-of-line -1))
-             (set-marker end nil))))
+          (org-fold-core-ignore-modifications
+           (let ((beg (point)))
+             (insert-and-inherit
+              (mapconcat
+               (lambda (p)
+                 (save-excursion
+                   (goto-char p)
+                   (org-trim (delete-and-extract-region
+                              (save-excursion (skip-chars-backward " \r\t\n")
+                                              (line-beginning-position 2))
+                              (line-beginning-position 2)))))
+               positions "\n")
+              "\n:END:\n")
+             (let ((end (point-marker)))
+               (goto-char beg)
+               (save-excursion (insert-and-inherit ":" drawer ":\n"))
+               (org-fold-region (line-end-position) (1- end) t 'outline)
+               (org-indent-region (point) end)
+               (forward-line)
+               (unless org-log-states-order-reversed
+                 (goto-char end)
+                 (beginning-of-line -1))
+               (set-marker end nil)))))
         (org-log-states-order-reversed (goto-char (car (last positions))))
         (t (goto-char (car positions))))))))
 
@@ -1665,25 +1686,26 @@ to, overriding the existing value of 
`org-clock-out-switch-to-state'."
              (setq ts (match-string 2))
            (if fail-quietly (throw 'exit nil) (error "Clock start time is 
gone")))
          (goto-char (match-end 0))
-          (delete-region (point) (line-end-position))
-         (insert "--")
-         (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
-         (setq s (org-time-convert-to-integer
-                  (time-subtract
-                   (org-time-string-to-time te)
-                   (org-time-string-to-time ts)))
-               h (floor s 3600)
-               m (floor (mod s 3600) 60))
-         (insert " => " (format "%2d:%02d" h m))
-         (move-marker org-clock-marker nil)
-         (move-marker org-clock-hd-marker nil)
-         ;; Possibly remove zero time clocks.
-          (when (and org-clock-out-remove-zero-time-clocks
-                    (= 0 h m))
-            (setq remove t)
-           (delete-region (line-beginning-position)
-                          (line-beginning-position 2)))
-          (org-clock-remove-empty-clock-drawer)
+         (delete-region (point) (line-end-position))
+          (org-fold-core-ignore-modifications
+            (insert-and-inherit "--")
+            (setq te (org-insert-time-stamp (or at-time now) 'with-hm 
'inactive))
+            (setq s (org-time-convert-to-integer
+                    (time-subtract
+                     (org-time-string-to-time te)
+                     (org-time-string-to-time ts)))
+                 h (floor s 3600)
+                 m (floor (mod s 3600) 60))
+            (insert-and-inherit " => " (format "%2d:%02d" h m))
+            (move-marker org-clock-marker nil)
+            (move-marker org-clock-hd-marker nil)
+            ;; Possibly remove zero time clocks.
+            (when (and org-clock-out-remove-zero-time-clocks
+                      (= 0 h m))
+              (setq remove t)
+              (delete-region (line-beginning-position)
+                            (line-beginning-position 2)))
+            (org-clock-remove-empty-clock-drawer))
          (when org-clock-mode-line-timer
            (cancel-timer org-clock-mode-line-timer)
            (setq org-clock-mode-line-timer nil))
@@ -1705,9 +1727,11 @@ to, overriding the existing value of 
`org-clock-out-switch-to-state'."
                                           (match-string 2))))
                    (when newstate (org-todo newstate))))
                 ((and org-clock-out-switch-to-state
-                      (not (looking-at (concat org-outline-regexp "[ \t]*"
-                                               org-clock-out-switch-to-state
-                                               "\\>"))))
+                      (not (looking-at
+                           (concat
+                            org-outline-regexp "[ \t]*"
+                           org-clock-out-switch-to-state
+                           "\\>"))))
                  (org-todo org-clock-out-switch-to-state))))))
          (force-mode-line-update)
          (message (if remove
@@ -1837,10 +1861,10 @@ With prefix arg SELECT, offer recently clocked tasks 
for selection."
     (pop-to-buffer-same-window (marker-buffer m))
     (if (or (< m (point-min)) (> m (point-max))) (widen))
     (goto-char m)
-    (org-show-entry)
+    (org-fold-show-entry)
     (org-back-to-heading t)
     (recenter org-clock-goto-before-context)
-    (org-reveal)
+    (org-fold-reveal)
     (if recent
        (message "No running clock, this is the most recently clocked task"))
     (run-hooks 'org-clock-goto-hook)))
@@ -1898,65 +1922,66 @@ PROPNAME lets you set a custom text property instead of 
:org-clock-minutes."
       (save-excursion
        (goto-char (point-max))
        (while (re-search-backward re nil t)
-         (cond
-          ((match-end 2)
-           ;; Two time stamps.
-           (let* ((ts (float-time
-                       (apply #'encode-time
-                              (save-match-data
-                                (org-parse-time-string (match-string 2))))))
-                  (te (float-time
-                       (apply #'encode-time
-                              (org-parse-time-string (match-string 3)))))
-                  (dt (- (if tend (min te tend) te)
-                         (if tstart (max ts tstart) ts))))
-             (when (> dt 0) (cl-incf t1 (floor dt 60)))))
-          ((match-end 4)
-           ;; A naked time.
-           (setq t1 (+ t1 (string-to-number (match-string 5))
-                       (* 60 (string-to-number (match-string 4))))))
-          (t    ;A headline
-           ;; Add the currently clocking item time to the total.
-           (when (and org-clock-report-include-clocking-task
-                      (eq (org-clocking-buffer) (current-buffer))
-                      (eq (marker-position org-clock-hd-marker) (point))
-                      tstart
-                      tend
-                      (>= (float-time org-clock-start-time) tstart)
-                      (<= (float-time org-clock-start-time) tend))
-             (let ((time (floor (org-time-convert-to-integer
-                                 (org-time-since org-clock-start-time))
-                                60)))
-               (setq t1 (+ t1 time))))
-           (let* ((headline-forced
-                   (get-text-property (point)
-                                      :org-clock-force-headline-inclusion))
-                  (headline-included
-                   (or (null headline-filter)
-                       (save-excursion
-                         (save-match-data (funcall headline-filter))))))
-             (setq level (- (match-end 1) (match-beginning 1)))
-             (when (>= level lmax)
-               (setq ltimes (vconcat ltimes (make-vector lmax 0)) lmax (* 2 
lmax)))
-             (when (or (> t1 0) (> (aref ltimes level) 0))
-               (when (or headline-included headline-forced)
-                 (if headline-included
-                     (cl-loop for l from 0 to level do
-                              (aset ltimes l (+ (aref ltimes l) t1))))
-                 (setq time (aref ltimes level))
-                 (goto-char (match-beginning 0))
-                  (put-text-property (point) (line-end-position)
-                                    (or propname :org-clock-minutes) time)
-                 (when headline-filter
-                   (save-excursion
-                     (save-match-data
-                       (while (org-up-heading-safe)
-                         (put-text-property
-                          (point) (line-end-position)
-                          :org-clock-force-headline-inclusion t))))))
-               (setq t1 0)
-               (cl-loop for l from level to (1- lmax) do
-                        (aset ltimes l 0)))))))
+          (let ((element-type
+                 (org-element-type
+                  (save-match-data
+                    (org-element-at-point)))))
+           (cond
+            ((and (eq element-type 'clock) (match-end 2))
+             ;; Two time stamps.
+             (let* ((ss (match-string 2))
+                    (se (match-string 3))
+                    (ts (org-time-string-to-seconds ss))
+                    (te (org-time-string-to-seconds se))
+                    (dt (- (if tend (min te tend) te)
+                           (if tstart (max ts tstart) ts))))
+               (when (> dt 0) (cl-incf t1 (floor dt 60)))))
+            ((match-end 4)
+             ;; A naked time.
+             (setq t1 (+ t1 (string-to-number (match-string 5))
+                         (* 60 (string-to-number (match-string 4))))))
+            ((memq element-type '(headline inlinetask)) ;A headline
+             ;; Add the currently clocking item time to the total.
+             (when (and org-clock-report-include-clocking-task
+                        (eq (org-clocking-buffer) (current-buffer))
+                        (eq (marker-position org-clock-hd-marker) (point))
+                        tstart
+                        tend
+                        (>= (float-time org-clock-start-time) tstart)
+                        (<= (float-time org-clock-start-time) tend))
+               (let ((time (floor (org-time-convert-to-integer
+                                   (time-since org-clock-start-time))
+                                  60)))
+                 (setq t1 (+ t1 time))))
+             (let* ((headline-forced
+                     (get-text-property (point)
+                                        :org-clock-force-headline-inclusion))
+                    (headline-included
+                     (or (null headline-filter)
+                         (save-excursion
+                           (save-match-data (funcall headline-filter))))))
+               (setq level (- (match-end 1) (match-beginning 1)))
+               (when (>= level lmax)
+                 (setq ltimes (vconcat ltimes (make-vector lmax 0)) lmax (* 2 
lmax)))
+               (when (or (> t1 0) (> (aref ltimes level) 0))
+                 (when (or headline-included headline-forced)
+                   (if headline-included
+                       (cl-loop for l from 0 to level do
+                                (aset ltimes l (+ (aref ltimes l) t1))))
+                   (setq time (aref ltimes level))
+                   (goto-char (match-beginning 0))
+                    (put-text-property (point) (line-end-position)
+                                      (or propname :org-clock-minutes) time)
+                   (when headline-filter
+                     (save-excursion
+                       (save-match-data
+                         (while (org-up-heading-safe)
+                           (put-text-property
+                            (point) (line-end-position)
+                            :org-clock-force-headline-inclusion t))))))
+                 (setq t1 0)
+                 (cl-loop for l from level to (1- lmax) do
+                          (aset ltimes l 0))))))))
        (setq org-clock-file-total-minutes (aref ltimes 0))))))
 
 (defun org-clock-sum-current-item (&optional tstart)
@@ -2109,7 +2134,7 @@ fontified, and then returned."
     (org-mode)
     (org-create-dblock props)
     (org-update-dblock)
-    (org-font-lock-ensure)
+    (font-lock-ensure)
     (forward-line 2)
     (buffer-substring (point) (progn
                                (re-search-forward "^[ \t]*#\\+END" nil t)
@@ -2123,10 +2148,12 @@ If point is inside an existing clocktable block, update 
it.
 Otherwise, insert a new one.
 
 The new table inherits its properties from the variable
-`org-clock-clocktable-default-properties'.  The scope of the
-clocktable, when not specified in the previous variable, is
-`subtree' when the function is called from within a subtree, and
-`file' elsewhere.
+`org-clock-clocktable-default-properties'.
+
+The scope of the clocktable, when not specified in the previous
+variable, is `subtree' of the current heading when the function is
+called from inside heading, and `file' elsewhere (before the first
+heading).
 
 When called with a prefix argument, move to the first clock table
 in the buffer and update it."
@@ -2134,7 +2161,7 @@ in the buffer and update it."
   (org-clock-remove-overlays)
   (when arg
     (org-find-dblock "clocktable")
-    (org-show-entry))
+    (org-fold-show-entry))
   (pcase (org-in-clocktable-p)
     (`nil
      (org-create-dblock
@@ -2342,16 +2369,16 @@ have priority."
     (let* ((start (pcase key
                    (`interactive (org-read-date nil t nil "Range start? "))
                    (`untilnow nil)
-                   (_ (encode-time 0 m h d month y))))
+                   (_ (org-encode-time 0 m h d month y))))
           (end (pcase key
                  (`interactive (org-read-date nil t nil "Range end? "))
                  (`untilnow (current-time))
-                 (_ (encode-time 0
-                                 m ;; (or m1 m)
-                                 (or h1 h)
-                                 (or d1 d)
-                                 (or month1 month)
-                                 (or y1 y)))))
+                 (_ (org-encode-time 0
+                                      m ;; (or m1 m)
+                                      (or h1 h)
+                                      (or d1 d)
+                                      (or month1 month)
+                                      (or y1 y)))))
           (text
            (pcase key
              ((or `day `today) (format-time-string "%A, %B %d, %Y" start))
@@ -2364,7 +2391,7 @@ have priority."
              (`interactive "(Range interactively set)")
              (`untilnow "now"))))
       (if (not as-strings) (list start end text)
-       (let ((f (cdr org-time-stamp-formats)))
+       (let ((f (org-time-stamp-format 'with-time)))
          (list (and start (format-time-string f start))
                (format-time-string f end)
                text))))))
@@ -2419,14 +2446,14 @@ the currently selected interval size."
          (cond
           (d (setq ins (format-time-string
                         "%Y-%m-%d"
-                        (encode-time 0 0 0 (+ d n) nil y)))) ;; m
+                        (org-encode-time 0 0 0 (+ d n) nil y)))) ;; m
           ((and wp (string-match "w\\|W" wp) mw (> (length wp) 0))
            (require 'cal-iso)
            (setq date (calendar-gregorian-from-absolute
                        (calendar-iso-to-absolute (list (+ mw n) 1 y))))
            (setq ins (format-time-string
                       "%G-W%V"
-                      (encode-time 0 0 0 (nth 1 date) (car date) (nth 2 
date)))))
+                      (org-encode-time 0 0 0 (nth 1 date) (car date) (nth 2 
date)))))
           ((and wp (string-match "q\\|Q" wp) mw (> (length wp) 0))
            (require 'cal-iso)
                                        ; if the 4th + 1 quarter is requested 
we flip to the 1st quarter of the next year
@@ -2443,11 +2470,11 @@ the currently selected interval size."
                        (calendar-iso-to-absolute (org-quarter-to-date (+ mw n) 
y))))
            (setq ins (format-time-string
                       (concat (number-to-string y) "-Q" (number-to-string (+ 
mw n)))
-                      (encode-time 0 0 0 (nth 1 date) (car date) (nth 2 
date)))))
+                      (org-encode-time 0 0 0 (nth 1 date) (car date) (nth 2 
date)))))
           (mw
            (setq ins (format-time-string
                       "%Y-%m"
-                      (encode-time 0 0 0 1 (+ mw n) y))))
+                      (org-encode-time 0 0 0 1 (+ mw n) y))))
           (y
            (setq ins (number-to-string (+ y n))))))
         (t (user-error "Cannot shift clocktable block")))
@@ -2574,6 +2601,7 @@ from the dynamic block definition."
         (emph (plist-get params :emphasize))
         (compact? (plist-get params :compact))
         (narrow (or (plist-get params :narrow) (and compact? '40!)))
+        (filetitle (plist-get params :filetitle))
         (level? (and (not compact?) (plist-get params :level)))
         (timestamp (plist-get params :timestamp))
         (tags (plist-get params :tags))
@@ -2713,7 +2741,10 @@ from the dynamic block definition."
                             (if (eq formula '%) " %s |" "")
                             "\n")
 
-                    (file-name-nondirectory file-name)
+                     (if filetitle
+                         (or (org-get-title file-name)
+                             (file-name-nondirectory file-name))
+                       (file-name-nondirectory file-name))
                     (if level?    "| " "") ;level column, maybe
                     (if timestamp "| " "") ;timestamp column, maybe
                     (if tags      "| " "") ;tags column, maybe
@@ -2819,6 +2850,7 @@ a number of clock tables."
             (`semimonth "Semimonthly report starting on: ")
             (`month "Monthly report starting on: ")
             (`year "Annual report starting on: ")
+            (`quarter "Quarterly report starting on: ")
             (_ (user-error "Unknown `:step' specification: %S" step))))
          (week-start (or (plist-get params :wstart) 1))
          (month-start (or (plist-get params :mstart) 1))
@@ -2835,7 +2867,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)))
-              (encode-time 0 0 org-extend-today-until d m y)))
+               (org-encode-time 0 0 org-extend-today-until d m y)))
             (timestamp
             (seconds-to-time
              (org-matcher-time (or timestamp
@@ -2845,7 +2877,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)))
-              (encode-time 0 0 org-extend-today-until d m y)))
+               (org-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"))
@@ -2857,20 +2889,22 @@ a number of clock tables."
       ;; Compute NEXT, which is the end of the current clock table,
       ;; according to step.
       (let* ((next
-              (apply #'encode-time
-                     (pcase-let
-                         ((`(,_ ,_ ,_ ,d ,m ,y ,dow . ,_) (decode-time start)))
-                       (pcase step
-                         (`day (list 0 0 org-extend-today-until (1+ d) m y))
-                         (`week
-                          (let ((offset (if (= dow week-start) 7
-                                          (mod (- week-start dow) 7))))
-                            (list 0 0 org-extend-today-until (+ d offset) m 
y)))
-                         (`semimonth (list 0 0 0
-                                           (if (< d 16) 16 1)
-                                           (if (< d 16) m (1+ m)) y))
-                         (`month (list 0 0 0 month-start (1+ m) y))
-                         (`year (list 0 0 org-extend-today-until 1 1 (1+ 
y)))))))
+              ;; In Emacs-27 and Emacs-28 `encode-time' does not support 6 
elements
+              ;; list argument so `org-encode-time' can not be outside of 
`pcase'.
+              (pcase-let
+                  ((`(,_ ,_ ,_ ,d ,m ,y ,dow . ,_) (decode-time start)))
+                (pcase step
+                  (`day (org-encode-time 0 0 org-extend-today-until (1+ d) m 
y))
+                  (`week
+                   (let ((offset (if (= dow week-start) 7
+                                   (mod (- week-start dow) 7))))
+                     (org-encode-time 0 0 org-extend-today-until (+ d offset) 
m y)))
+                  (`semimonth (org-encode-time 0 0 0
+                                               (if (< d 16) 16 1)
+                                               (if (< d 16) m (1+ m)) y))
+                  (`month (org-encode-time 0 0 0 month-start (1+ m) y))
+                  (`quarter (org-encode-time 0 0 0 month-start (+ 3 m) y))
+                  (`year (org-encode-time 0 0 org-extend-today-until 1 1 (1+ 
y))))))
              (table-begin (line-beginning-position 0))
             (step-time
               ;; Write clock table between START and NEXT.
@@ -3015,42 +3049,58 @@ PROPERTIES: The list properties specified in the 
`:properties' parameter
   "If this is a CLOCK line, update it and return t.
 Otherwise, return nil."
   (interactive)
-  (save-excursion
-    (beginning-of-line 1)
-    (skip-chars-forward " \t")
-    (when (looking-at org-clock-string)
-      (let ((re (concat "[ \t]*" org-clock-string
-                       " *[[<]\\([^]>]+\\)[]>]\\(-+[[<]\\([^]>]+\\)[]>]"
-                       "\\([ \t]*=>.*\\)?\\)?"))
-           ts te h m s neg)
-       (cond
-        ((not (looking-at re))
-         nil)
-        ((not (match-end 2))
-         (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
-                    (> org-clock-marker (point))
-                     (<= org-clock-marker (line-end-position)))
-           ;; The clock is running here
-           (setq org-clock-start-time
-                 (org-time-string-to-time (match-string 1)))
-           (org-clock-update-mode-line)))
-        (t
-         (and (match-end 4) (delete-region (match-beginning 4) (match-end 4)))
-         (end-of-line 1)
-         (setq ts (match-string 1)
-               te (match-string 3))
-         (setq s (- (float-time
-                     (apply #'encode-time (org-parse-time-string te)))
-                    (float-time
-                     (apply #'encode-time (org-parse-time-string ts))))
-               neg (< s 0)
-               s (abs s)
-               h (floor (/ s 3600))
-               s (- s (* 3600 h))
-               m (floor (/ s 60))
-               s (- s (* 60 s)))
-         (insert " => " (format (if neg "-%d:%02d" "%2d:%02d") h m))
-         t))))))
+  (let ((origin (point))) ;; `save-excursion' may not work when deleting.
+    (save-excursion
+      (beginning-of-line 1)
+      (skip-chars-forward " \t")
+      (when (looking-at org-clock-string)
+        (let ((re (concat "[ \t]*" org-clock-string
+                         " *[[<]\\([^]>]+\\)[]>]\\(-+[[<]\\([^]>]+\\)[]>]"
+                         "\\([ \t]*=>.*\\)?\\)?"))
+             ts te h m s neg)
+          (cond
+          ((not (looking-at re))
+           nil)
+          ((not (match-end 2))
+           (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
+                      (> org-clock-marker (point))
+                       (<= org-clock-marker (line-end-position)))
+             ;; The clock is running here
+             (setq org-clock-start-time
+                   (org-time-string-to-time (match-string 1)))
+             (org-clock-update-mode-line)))
+          (t
+            ;; Prevent recursive call from `org-timestamp-change'.
+            (cl-letf (((symbol-function 'org-clock-update-time-maybe) 
#'ignore))
+              ;; Update timestamps.
+              (save-excursion
+                (goto-char (match-beginning 1)) ; opening timestamp
+                (save-match-data (org-timestamp-change 0 'day)))
+              ;; Refresh match data.
+              (looking-at re)
+              (save-excursion
+                (goto-char (match-beginning 3)) ; closing timestamp
+                (save-match-data (org-timestamp-change 0 'day))))
+            ;; Refresh match data.
+            (looking-at re)
+            (and (match-end 4) (delete-region (match-beginning 4) (match-end 
4)))
+            (end-of-line 1)
+            (setq ts (match-string 1)
+                  te (match-string 3))
+            (setq s (- (org-time-string-to-seconds te)
+                      (org-time-string-to-seconds ts))
+                  neg (< s 0)
+                  s (abs s)
+                  h (floor (/ s 3600))
+                  s (- s (* 3600 h))
+                  m (floor (/ s 60))
+                  s (- s (* 60 s)))
+           (insert " => " (format (if neg "-%d:%02d" "%2d:%02d") h m))
+           t)))))
+    ;; Move back to initial position, but never beyond updated
+    ;; clock.
+    (unless (< (point) origin)
+      (goto-char origin))))
 
 (defun org-clock-save ()
   "Persist various clock-related data to disk.
@@ -3119,7 +3169,7 @@ The details of what will be saved are regulated by the 
variable
             (let ((org-clock-in-resume 'auto-restart)
                   (org-clock-auto-clock-resolution nil))
               (org-clock-in)
-              (when (org-invisible-p) (org-show-context))))))
+              (when (org-invisible-p) (org-fold-show-context))))))
        (_ nil)))))
 
 (defun org-clock-kill-emacs-query ()
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 829fcbbe3f..20bf2b7e9c 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -28,6 +28,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org)
 
@@ -159,8 +162,8 @@ See `org-columns-summary-types' for details.")
 (defun org-columns-content ()
   "Switch to contents view while in columns view."
   (interactive)
-  (org-overview)
-  (org-content))
+  (org-cycle-overview)
+  (org-cycle-content))
 
 (org-defkey org-columns-map "c"        #'org-columns-content)
 (org-defkey org-columns-map "o"        #'org-overview)
@@ -377,7 +380,8 @@ This is needed to later remove this relative remapping.")
 COLUMNS is an alist (SPEC VALUE DISPLAYED).  Optional argument
 DATELINE is non-nil when the face used should be
 `org-agenda-column-dateline'."
-  (when (ignore-errors (require 'face-remap))
+  (when (and (ignore-errors (require 'face-remap))
+             org-columns-header-line-remap)
     (setq org-columns-header-line-remap
          (face-remap-add-relative 'header-line '(:inherit default))))
   (save-excursion
@@ -512,9 +516,9 @@ for the duration of the command.")
 (defun org-columns-remove-overlays ()
   "Remove all currently active column overlays."
   (interactive)
-  (when (and (fboundp 'face-remap-remove-relative)
-            org-columns-header-line-remap)
-    (face-remap-remove-relative org-columns-header-line-remap))
+  (when org-columns-header-line-remap
+    (face-remap-remove-relative org-columns-header-line-remap)
+    (setq org-columns-header-line-remap nil))
   (when org-columns-overlays
     (when (local-variable-p 'org-previous-header-line-format)
       (setq header-line-format org-previous-header-line-format)
@@ -556,7 +560,7 @@ for the duration of the command.")
 
 (defun org-columns-check-computed ()
   "Throw an error if current column value is computed."
-  (let ((spec (nth (current-column) org-columns-current-fmt-compiled)))
+  (let ((spec (nth (org-current-text-column) 
org-columns-current-fmt-compiled)))
     (and
      (nth 3 spec)
      (assoc spec (get-text-property (line-beginning-position) 'org-summaries))
@@ -697,9 +701,9 @@ FUN is a function called with no argument."
   (let ((hide-body (and (/= (line-end-position) (point-max))
                        (save-excursion
                          (move-beginning-of-line 2)
-                         (org-at-heading-p t)))))
+                         (org-at-heading-p)))))
     (unwind-protect (funcall fun)
-      (when hide-body (outline-hide-entry)))))
+      (when hide-body (org-fold-hide-entry)))))
 
 (defun org-columns-previous-allowed-value ()
   "Switch to the previous allowed value for this column."
@@ -712,7 +716,8 @@ When PREVIOUS is set, go to the previous value.  When NTH is
 an integer, select that value."
   (interactive)
   (org-columns-check-computed)
-  (let* ((column (current-column))
+  (let* ((column (org-current-text-column))
+         (visible-column (current-column))
         (key (get-char-property (point) 'org-columns-key))
         (value (get-char-property (point) 'org-columns-value))
         (pom (or (get-text-property (line-beginning-position) 'org-hd-marker)
@@ -762,7 +767,7 @@ an integer, select that value."
        ;; the right place on the current line.
        (let ((org-columns-inhibit-recalculation)) (org-columns-redo))
        (org-columns-update key)
-       (org-move-to-column column))))))
+       (org-move-to-column visible-column))))))
 
 (defun org-colview-construct-allowed-dates (s)
   "Construct a list of three dates around the date in S.
@@ -772,9 +777,8 @@ around it."
   (when (and s (string-match (concat "^" org-ts-regexp3 "$") s))
     (let* ((time (org-parse-time-string s 'nodefaults))
           (active (equal (string-to-char s) ?<))
-          (fmt (funcall (if (nth 1 time) 'cdr 'car) org-time-stamp-formats))
+          (fmt (org-time-stamp-format (nth 1 time) (not active)))
           time-before time-after)
-      (unless active (setq fmt (concat "[" (substring fmt 1 -1) "]")))
       (setf (car time) (or (car time) 0))
       (setf (nth 1 time) (or (nth 1 time) 0))
       (setf (nth 2 time) (or (nth 2 time) 0))
@@ -782,7 +786,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 (org-encode-time x)))
              (list time-before time time-after)))))
 
 (defun org-columns-open-link (&optional arg)
@@ -924,14 +928,14 @@ details."
     (if spec
        (progn (setcar spec (car new))
               (setcdr spec (cdr new)))
-      (push new (nthcdr (current-column) org-columns-current-fmt-compiled)))
+      (push new (nthcdr (org-current-text-column) 
org-columns-current-fmt-compiled)))
     (org-columns-store-format)
     (org-columns-redo)))
 
 (defun org-columns-delete ()
   "Delete the column at point from columns view."
   (interactive)
-  (let ((spec (nth (current-column) org-columns-current-fmt-compiled)))
+  (let ((spec (nth (org-current-text-column) 
org-columns-current-fmt-compiled)))
     (when (y-or-n-p (format "Are you sure you want to remove column %S? "
                            (nth 1 spec)))
       (setq org-columns-current-fmt-compiled
@@ -941,18 +945,18 @@ details."
       ;; updating it may prove counter-intuitive.  See comments in
       ;; `org-columns-move-right' for details.
       (let ((org-columns-inhibit-recalculation t)) (org-columns-redo))
-      (when (>= (current-column) (length org-columns-current-fmt-compiled))
+      (when (>= (org-current-text-column) (length 
org-columns-current-fmt-compiled))
        (backward-char)))))
 
 (defun org-columns-edit-attributes ()
   "Edit the attributes of the current column."
   (interactive)
-  (org-columns-new (nth (current-column) org-columns-current-fmt-compiled)))
+  (org-columns-new (nth (org-current-text-column) 
org-columns-current-fmt-compiled)))
 
 (defun org-columns-widen (arg)
   "Make the column wider by ARG characters."
   (interactive "p")
-  (let* ((n (current-column))
+  (let* ((n (org-current-text-column))
         (entry (nth n org-columns-current-fmt-compiled))
         (width (aref org-columns-current-maxwidths n)))
     (setq width (max 1 (+ width arg)))
@@ -968,7 +972,7 @@ details."
 (defun org-columns-move-right ()
   "Swap this column with the one to the right."
   (interactive)
-  (let* ((n (current-column))
+  (let* ((n (org-current-text-column))
         (cell (nthcdr n org-columns-current-fmt-compiled))
         e)
     (when (>= n (1- (length org-columns-current-fmt-compiled)))
@@ -992,7 +996,7 @@ details."
 (defun org-columns-move-left ()
   "Swap this column with the one to the left."
   (interactive)
-  (let* ((n (current-column)))
+  (let* ((n (org-current-text-column)))
     (when (= n 0)
       (error "Cannot shift this column further to the left"))
     (backward-char 1)
@@ -1024,7 +1028,7 @@ the current buffer."
              ;; No COLUMNS keyword in the buffer.  Insert one at the
              ;; beginning, right before the first heading, if any.
              (goto-char (point-min))
-             (unless (org-at-heading-p t) (outline-next-heading))
+             (unless (org-at-heading-p) (outline-next-heading))
              (let ((inhibit-read-only t))
                (insert-before-markers "#+COLUMNS: " fmt "\n"))))
          (setq-local org-columns-default-format fmt))))))
@@ -1038,7 +1042,7 @@ the current buffer."
        (let ((key (overlay-get ov 'org-columns-key)))
         (when (and key (equal key p) (overlay-start ov))
           (goto-char (overlay-start ov))
-          (let* ((spec (nth (current-column) org-columns-current-fmt-compiled))
+          (let* ((spec (nth (org-current-text-column) 
org-columns-current-fmt-compiled))
                  (value
                   (or (cdr (assoc spec
                                   (get-text-property (line-beginning-position)
@@ -1048,7 +1052,7 @@ the current buffer."
               (let ((displayed (org-columns--displayed-value spec value))
                     (format (overlay-get ov 'org-columns-format))
                     (width
-                     (aref org-columns-current-maxwidths (current-column))))
+                     (aref org-columns-current-maxwidths 
(org-current-text-column))))
                 (overlay-put ov 'org-columns-value value)
                 (overlay-put ov 'org-columns-value-modified displayed)
                 (overlay-put ov
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index 15f0daa91a..483f8844c3 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -29,9 +29,17 @@
 
 ;;; Code:
 
+
 (require 'cl-lib)
+(require 'seq)
 (require 'org-macs)
 
+(eval-when-compile (require 'subr-x))  ; Emacs < 28
+
+;; We rely on org-compat when generating Org version.  Checking Org
+;; version here will interfere with Org build process.
+;; (org-assert-version)
+
 (declare-function org-agenda-diary-entry "org-agenda")
 (declare-function org-agenda-maybe-redo "org-agenda" ())
 (declare-function org-agenda-set-restriction-lock "org-agenda" (&optional 
type))
@@ -40,7 +48,9 @@
 (declare-function org-align-tags "org" (&optional all))
 (declare-function org-at-heading-p "org" (&optional ignored))
 (declare-function org-at-table.el-p "org-table" ())
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
+(declare-function org-element-at-point-no-context "org-element" (&optional 
pom))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-lineage "org-element" (blob &optional types 
with-self))
 (declare-function org-element-type "org-element" (element))
@@ -48,18 +58,29 @@
 (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
 (declare-function org-get-heading "org" (&optional no-tags no-todo no-priority 
no-comment))
 (declare-function org-get-tags "org" (&optional pos local))
-(declare-function org-hide-block-toggle "org" (&optional force no-error 
element))
+(declare-function org-fold-hide-block-toggle "org-fold" (&optional force 
no-error element))
 (declare-function org-link-display-format "ol" (s))
 (declare-function org-link-set-parameters "ol" (type &rest rest))
 (declare-function org-log-into-drawer "org" ())
 (declare-function org-make-tag-string "org" (tags))
+(declare-function org-next-visible-heading "org" (arg))
 (declare-function org-reduced-level "org" (l))
 (declare-function org-return "org" (&optional indent arg interactive))
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-fold-show-context "org-fold" (&optional key))
 (declare-function org-table-end "org-table" (&optional table-type))
 (declare-function outline-next-heading "outline" ())
 (declare-function speedbar-line-directory "speedbar" (&optional depth))
 (declare-function table--at-cell-p "table" (position &optional object 
at-column))
+(declare-function org-fold-folded-p "org-fold" (&optional pos spec-or-alias))
+(declare-function org-fold-hide-sublevels "org-fold" (levels))
+(declare-function org-fold-hide-subtree "org-fold" ())
+(declare-function org-fold-region "org-fold" (from to flag &optional spec))
+(declare-function org-fold-show-all "org-fold" (&optional types))
+(declare-function org-fold-show-children "org-fold" (&optional level))
+(declare-function org-fold-show-entry "org-fold" (&optional hide-drawers))
+;; `org-string-equal-ignore-case' is in _this_ file but isn't at the
+;; top-level.
+(declare-function org-string-equal-ignore-case "org-compat" (string1 string2))
 
 (defvar calendar-mode-map)
 (defvar org-complex-heading-regexp)
@@ -70,6 +91,7 @@
 (defvar org-table-dataline-regexp)
 (defvar org-table-tab-recognizes-table.el)
 (defvar org-table1-hline-regexp)
+(defvar org-fold-core-style)
 
 
 ;;; Emacs < 29 compatibility
@@ -99,10 +121,39 @@ the symbol of the calling function, for example."
       (when (not (equal attr cachedattr))
         (puthash sym attr org-file-has-changed-p--hash-table)))))
 
+(if (fboundp 'string-equal-ignore-case)
+    (defalias 'org-string-equal-ignore-case #'string-equal-ignore-case)
+  ;; From Emacs subr.el.
+  (defun org-string-equal-ignore-case (string1 string2)
+    "Like `string-equal', but case-insensitive.
+Upper-case and lower-case letters are treated as equal.
+Unibyte strings are converted to multibyte for comparison."
+    (eq t (compare-strings string1 0 nil string2 0 nil t))))
 
 
 ;;; Emacs < 28.1 compatibility
 
+(if (fboundp 'file-name-concat)
+    (defalias 'org-file-name-concat #'file-name-concat)
+  (defun org-file-name-concat (directory &rest components)
+    "Append COMPONENTS to DIRECTORY and return the resulting string.
+
+Elements in COMPONENTS must be a string or nil.
+DIRECTORY or the non-final elements in COMPONENTS may or may not end
+with a slash -- if they don't end with a slash, a slash will be
+inserted before contatenating."
+    (save-match-data
+      (mapconcat
+       #'identity
+       (delq nil
+             (mapcar
+              (lambda (str)
+                (when (and str (not (seq-empty-p str))
+                           (string-match "\\(.+\\)/?" str))
+                  (match-string 1 str)))
+              (cons directory components)))
+       "/"))))
+
 (if (fboundp 'directory-empty-p)
     (defalias 'org-directory-empty-p #'directory-empty-p)
   (defun org-directory-empty-p (dir)
@@ -110,9 +161,47 @@ the symbol of the calling function, for example."
     (and (file-directory-p dir)
          (null (directory-files dir nil directory-files-no-dot-files-regexp 
t)))))
 
+(if (fboundp 'string-clean-whitespace)
+    (defalias 'org-string-clean-whitespace #'string-clean-whitespace)
+  ;; From Emacs subr-x.el.
+  (defun org-string-clean-whitespace (string)
+    "Clean up whitespace in STRING.
+All sequences of whitespaces in STRING are collapsed into a
+single space character, and leading/trailing whitespace is
+removed."
+    (let ((blank "[[:blank:]\r\n]+"))
+      (string-trim (replace-regexp-in-string blank " " string t t)
+                   blank blank))))
+
+(if (fboundp 'format-prompt)
+    (defalias 'org-format-prompt #'format-prompt)
+  ;; From Emacs minibuffer.el, inlining
+  ;; `minibuffer-default-prompt-format' value and replacing `length<'
+  ;; (both new in Emacs 28.1).
+  (defun org-format-prompt (prompt default &rest format-args)
+    "Compatibility substitute for `format-prompt'."
+    (concat
+     (if (null format-args)
+         prompt
+       (apply #'format prompt format-args))
+     (and default
+          (or (not (stringp default))
+              (> (length default) 0))
+          (format " (default %s)"
+                  (if (consp default)
+                      (car default)
+                    default)))
+     ": ")))
+
 
 ;;; Emacs < 27.1 compatibility
 
+(unless (fboundp 'combine-change-calls)
+  ;; A stub when `combine-change-calls' was not yet there.
+  (defmacro combine-change-calls (_beg _end &rest body)
+    (declare (debug (form form def-body)) (indent 2))
+    `(progn ,@body)))
+
 (if (version< emacs-version "27.1")
     (defsubst org-replace-buffer-contents (source &optional _max-secs 
_max-costs)
       (replace-buffer-contents source))
@@ -189,6 +278,16 @@ extension beyond end of line was not controllable."
 (define-obsolete-function-alias 'org-babel-edit-distance 'org-string-distance
   "9.5")
 
+(unless (fboundp 'with-connection-local-variables)
+  ;; Added in Emacs 27: commit:21f54feee8, 2019-03-09.
+  ;; Redefining it using the old function `with-connection-local-profiles'.
+  (defmacro with-connection-local-variables (&rest body)
+    "Apply connection-local variables according to `default-directory'.
+Execute BODY, and unwind connection-local variables."
+    (declare (debug t))
+    `(with-connection-local-profiles (connection-local-get-profiles nil)
+       ,@body)))
+
 
 ;;; Emacs < 26.1 compatibility
 
@@ -214,70 +313,6 @@ This is a floating point number if the size is too large 
for an integer."
     (nth 7 attributes)))
 
 
-;;; Emacs < 25.1 compatibility
-
-(when (< emacs-major-version 25)
-  (defalias 'outline-hide-entry 'hide-entry)
-  (defalias 'outline-hide-sublevels 'hide-sublevels)
-  (defalias 'outline-hide-subtree 'hide-subtree)
-  (defalias 'outline-show-branches 'show-branches)
-  (defalias 'outline-show-children 'show-children)
-  (defalias 'outline-show-entry 'show-entry)
-  (defalias 'outline-show-subtree 'show-subtree)
-  (defalias 'xref-find-definitions 'find-tag)
-  (defalias 'format-message 'format)
-  (defalias 'gui-get-selection 'x-get-selection))
-
-(unless (fboundp 'directory-name-p)
-  (defun directory-name-p (name)
-    "Return non-nil if NAME ends with a directory separator character."
-    (let ((len (length name))
-         (lastc ?.))
-      (if (> len 0)
-         (setq lastc (aref name (1- len))))
-      (or (= lastc ?/)
-         (and (memq system-type '(windows-nt ms-dos))
-              (= lastc ?\\))))))
-
-;; `string-collate-lessp' is new in Emacs 25.
-(if (fboundp 'string-collate-lessp)
-    (defalias 'org-string-collate-lessp
-      'string-collate-lessp)
-  (defun org-string-collate-lessp (s1 s2 &optional _ _)
-    "Return non-nil if STRING1 is less than STRING2 in lexicographic order.
-Case is significant."
-    (string< s1 s2)))
-
-;; The time- functions below translate nil to 'current-time' and
-;; accept an integer as of Emacs 25.  'decode-time' and
-;; 'format-time-string' accept nil on Emacs 24 but don't accept an
-;; integer until Emacs 25.
-(if (< emacs-major-version 25)
-    (let ((convert
-           (lambda (time)
-             (cond ((not time) (current-time))
-                   ((numberp time) (seconds-to-time time))
-                   (t time)))))
-      (defun org-decode-time (&optional time)
-        (decode-time (funcall convert time)))
-      (defun org-format-time-string (format-string &optional time universal)
-        (format-time-string format-string (funcall convert time) universal))
-      (defun org-time-add (a b)
-        (time-add (funcall convert a) (funcall convert b)))
-      (defun org-time-subtract (a b)
-        (time-subtract (funcall convert a) (funcall convert b)))
-      (defun org-time-since (time)
-        (time-since (funcall convert time)))
-      (defun org-time-less-p (t1 t2)
-        (time-less-p (funcall convert t1) (funcall convert t2))))
-  (defalias 'org-decode-time 'decode-time)
-  (defalias 'org-format-time-string 'format-time-string)
-  (defalias 'org-time-add 'time-add)
-  (defalias 'org-time-subtract 'time-subtract)
-  (defalias 'org-time-since 'time-since)
-  (defalias 'org-time-less-p 'time-less-p))
-
-
 ;;; Obsolete aliases (remove them after the next major release).
 
 ;;;; XEmacs compatibility, now removed.
@@ -298,6 +333,11 @@ Case is significant."
 (define-obsolete-function-alias 'org-select-frame-set-input-focus 
'select-frame-set-input-focus "9.0")
 (define-obsolete-function-alias 'org-file-remote-p 'file-remote-p "9.2")
 
+(define-obsolete-function-alias 'org-show-context 'org-fold-show-context "9.6")
+(define-obsolete-function-alias 'org-show-entry 'org-fold-show-entry "9.6")
+(define-obsolete-function-alias 'org-show-children 'org-fold-show-children 
"9.6")
+
+
 (defmacro org-re (s)
   "Replace posix classes in regular expression S."
   (declare (debug (form))
@@ -322,6 +362,14 @@ Counting starts at 1."
                "use cl-subseq (note the 0-based counting)."
                "9.0")
 
+;;;; Functions available since Emacs 25.1
+(define-obsolete-function-alias 'org-string-collate-lessp 
'string-collate-lessp "9.6")
+(define-obsolete-function-alias 'org-decode-time 'decode-time "9.6")
+(define-obsolete-function-alias 'org-format-time-string 'format-time-string 
"9.6")
+(define-obsolete-function-alias 'org-time-add 'time-add "9.6")
+(define-obsolete-function-alias 'org-time-subtract 'time-subtract "9.6")
+(define-obsolete-function-alias 'org-time-since 'time-since "9.6")
+(define-obsolete-function-alias 'org-time-less-p 'time-less-p "9.6")
 
 ;;;; Functions available since Emacs 24.3
 (define-obsolete-function-alias 'org-buffer-narrowed-p 'buffer-narrowed-p 
"9.0")
@@ -336,12 +384,20 @@ Counting starts at 1."
 (define-obsolete-function-alias 'org-string-match-p 'string-match-p "9.0")
 
 ;;;; Functions and variables from previous releases now obsolete.
+(define-obsolete-function-alias 'org-timestamp-format
+  'org-format-timestamp "Org 9.6")
+(define-obsolete-variable-alias 'org-export-before-processing-hook
+  'org-export-before-processing-functions "Org 9.6")
+(define-obsolete-variable-alias 'org-export-before-parsing-hook
+  'org-export-before-parsing-functions "Org 9.6")
 (define-obsolete-function-alias 'org-element-remove-indentation
   'org-remove-indentation "9.0")
 (define-obsolete-variable-alias 'org-latex-create-formula-image-program
   'org-preview-latex-default-process "9.0")
 (define-obsolete-variable-alias 'org-latex-preview-ltxpng-directory
   'org-preview-latex-image-directory "9.0")
+(define-obsolete-variable-alias 'org-latex-listings
+  'org-latex-src-block-backend "9.6")
 (define-obsolete-function-alias 'org-table-p 'org-at-table-p "9.0")
 (define-obsolete-function-alias 'org-on-heading-p 'org-at-heading-p "9.0")
 (define-obsolete-function-alias 'org-at-regexp-p 'org-in-regexp "8.3")
@@ -399,6 +455,80 @@ Counting starts at 1."
 (define-obsolete-function-alias 'org-remove-latex-fragment-image-overlays
   'org-clear-latex-preview "9.3")
 
+(define-obsolete-function-alias 'org-hide-archived-subtrees
+  'org-fold-hide-archived-subtrees "9.6")
+
+(define-obsolete-function-alias 'org-flag-region
+  'org-fold-region "9.6")
+
+(define-obsolete-function-alias 'org-flag-subtree
+  'org-fold-subtree "9.6")
+
+(define-obsolete-function-alias 'org-hide-entry
+  'org-fold-hide-entry "9.6")
+
+(define-obsolete-function-alias 'org-show-subtree
+  'org-fold-show-subtree "9.6")
+
+(define-obsolete-function-alias 'org--hide-wrapper-toggle
+  'org-fold--hide-wrapper-toggle "9.6")
+
+(define-obsolete-function-alias 'org-hide-block-toggle
+  'org-fold-hide-block-toggle "9.6")
+
+(define-obsolete-function-alias 'org-hide-drawer-toggle
+  'org-fold-hide-drawer-toggle "9.6")
+
+(define-obsolete-function-alias 'org--hide-drawers
+  'org-fold--hide-drawers "9.6")
+
+(define-obsolete-function-alias 'org-hide-block-all
+  'org-fold-hide-block-all "9.6")
+
+(define-obsolete-function-alias 'org-hide-drawer-all
+  'org-fold-hide-drawer-all "9.6")
+
+(define-obsolete-function-alias 'org-show-all
+  'org-fold-show-all "9.6")
+
+(define-obsolete-function-alias 'org-set-startup-visibility
+  'org-cycle-set-startup-visibility "9.6")
+
+(define-obsolete-function-alias 'org-show-set-visibility
+  'org-fold-show-set-visibility "9.6")
+
+(define-obsolete-function-alias 'org-check-before-invisible-edit
+  'org-fold-check-before-invisible-edit "9.6")
+
+(define-obsolete-function-alias 'org-flag-above-first-heading
+  'org-fold-flag-above-first-heading "9.6")
+
+(define-obsolete-function-alias 'org-show-branches-buffer
+  'org-fold-show-branches-buffer "9.6")
+
+(define-obsolete-function-alias 'org-show-siblings
+  'org-fold-show-siblings "9.6")
+
+(define-obsolete-function-alias 'org-show-hidden-entry
+  'org-fold-show-hidden-entry "9.6")
+
+(define-obsolete-function-alias 'org-flag-heading
+  'org-fold-heading "9.6")
+
+(define-obsolete-function-alias 'org-set-startup-visibility
+  'org-cycle-set-startup-visibility "9.6")
+
+(define-obsolete-function-alias 'org-set-visibility-according-to-property
+  'org-cycle-set-visibility-according-to-property "9.6")
+
+(define-obsolete-variable-alias 'org-scroll-position-to-restore
+  'org-cycle-scroll-position-to-restore "9.6")
+(define-obsolete-function-alias 'org-optimize-window-after-visibility-change
+  'org-cycle-optimize-window-after-visibility-change "9.6")
+
+(define-obsolete-function-alias 'org-force-cycle-archived
+  'org-cycle-force-archived "9.6")
+
 (define-obsolete-variable-alias 'org-attach-directory
   'org-attach-id-dir "9.3")
 (make-obsolete 'org-attach-store-link "No longer used" "9.4")
@@ -406,6 +536,17 @@ Counting starts at 1."
 
 (define-obsolete-function-alias 'org-file-url-p 'org-url-p "9.5")
 
+(define-obsolete-variable-alias 'org-show-context-detail
+  'org-fold-show-context-detail "9.6")
+
+(define-obsolete-variable-alias 'org-catch-invisible-edits
+  'org-fold-catch-invisible-edits "9.6")
+
+(define-obsolete-variable-alias 'org-reveal-start-hook
+  'org-fold-reveal-start-hook "9.6")
+(define-obsolete-function-alias 'org-file-url-p 'org-url-p "9.6")
+(define-obsolete-variable-alias 'org-plantuml-executable-args 
'org-plantuml-args
+  "Org 9.6")
 (defun org-in-fixed-width-region-p ()
   "Non-nil if point in a fixed-width region."
   (save-match-data
@@ -414,6 +555,19 @@ Counting starts at 1."
                "use `org-element' library"
                "9.0")
 
+;; FIXME: Unused; obsoleted; to be removed.
+(defun org-let (list &rest body) ;FIXME: So many kittens are suffering here.
+  (declare (indent 1) (obsolete cl-progv "2021"))
+  (eval (cons 'let (cons list body))))
+
+;; FIXME: Unused; obsoleted; to be removed.
+(defun org-let2 (list1 list2 &rest body) ;FIXME: Where did our karma go?
+  (declare (indent 2) (obsolete cl-progv "2021"))
+  (eval (cons 'let (cons list1 (list (cons 'let (cons list2 body)))))))
+
+(make-obsolete 'org-let "to be removed" "9.6")
+(make-obsolete 'org-let2 "to be removed" "9.6")
+
 (defun org-compatible-face (inherits specs)
   "Make a compatible face specification.
 If INHERITS is an existing face and if the Emacs version supports
@@ -682,7 +836,7 @@ use of this function is for the stuck project list."
 (defun org-show-block-all ()
   "Unfold all blocks in the current buffer."
   (interactive)
-  (remove-overlays nil nil 'invisible 'org-hide-block))
+  (org-fold-show-all '(blocks)))
 
 (make-obsolete 'org-show-block-all
               "use `org-show-all' instead."
@@ -725,7 +879,7 @@ When optional argument ELEMENT is a parsed drawer, as 
returned by
 When buffer positions BEG and END are provided, hide or show that
 region as a drawer without further ado."
   (declare (obsolete "use `org-hide-drawer-toggle' instead." "9.4"))
-  (if (and beg end) (org-flag-region beg end flag 'outline)
+  (if (and beg end) (org-fold-region beg end flag (if (eq org-fold-core-style 
'text-properties) 'drawer 'outline))
     (let ((drawer
           (or element
               (and (save-excursion
@@ -734,12 +888,12 @@ region as a drawer without further ado."
                    (org-element-at-point)))))
       (when (memq (org-element-type drawer) '(drawer property-drawer))
        (let ((post (org-element-property :post-affiliated drawer)))
-         (org-flag-region
+         (org-fold-region
           (save-excursion (goto-char post) (line-end-position))
           (save-excursion (goto-char (org-element-property :end drawer))
                           (skip-chars-backward " \t\n")
                           (line-end-position))
-          flag 'outline)
+          flag (if (eq org-fold-core-style 'text-properties) 'drawer 'outline))
          ;; When the drawer is hidden away, make sure point lies in
          ;; a visible part of the buffer.
          (when (invisible-p (max (1- (point)) (point-min)))
@@ -751,7 +905,7 @@ Unlike to `org-hide-block-toggle', this function does not 
throw
 an error.  Return a non-nil value when toggling is successful."
   (declare (obsolete "use `org-hide-block-toggle' instead." "9.4"))
   (interactive)
-  (org-hide-block-toggle nil t))
+  (org-fold-hide-block-toggle nil t))
 
 (defun org-hide-block-toggle-all ()
   "Toggle the visibility of all blocks in the current buffer."
@@ -767,7 +921,7 @@ an error.  Return a non-nil value when toggling is 
successful."
        (save-excursion
          (save-match-data
             (goto-char (match-beginning 0))
-            (org-hide-block-toggle)))))))
+            (org-fold-hide-block-toggle)))))))
 
 (defun org-return-indent ()
   "Goto next table row or insert a newline and indent.
@@ -807,6 +961,159 @@ context.  See the individual commands for more 
information."
 
 (define-obsolete-function-alias 'org-get-last-sibling 
'org-get-previous-sibling "9.4")
 
+(define-obsolete-function-alias 'org-publish-cache-ctime-of-src
+  'org-publish-cache-mtime-of-src "9.6")
+
+(define-obsolete-function-alias 'org-truely-invisible-p
+  'org-truly-invisible-p "9.6"
+  "Compatibility alias for legacy misspelling of `org-truly-invisible-p'.")
+
+
+(defconst org-latex-babel-language-alist
+  '(("af" . "afrikaans")
+    ("bg" . "bulgarian")
+    ("ca" . "catalan")
+    ("cs" . "czech")
+    ("cy" . "welsh")
+    ("da" . "danish")
+    ("de" . "germanb")
+    ("de-at" . "naustrian")
+    ("de-de" . "ngerman")
+    ("el" . "greek")
+    ("en" . "english")
+    ("en-au" . "australian")
+    ("en-ca" . "canadian")
+    ("en-gb" . "british")
+    ("en-ie" . "irish")
+    ("en-nz" . "newzealand")
+    ("en-us" . "american")
+    ("es" . "spanish")
+    ("et" . "estonian")
+    ("eu" . "basque")
+    ("fi" . "finnish")
+    ("fr" . "french")
+    ("fr-ca" . "canadien")
+    ("gl" . "galician")
+    ("hr" . "croatian")
+    ("hu" . "hungarian")
+    ("id" . "indonesian")
+    ("is" . "icelandic")
+    ("it" . "italian")
+    ("la" . "latin")
+    ("ms" . "malay")
+    ("nl" . "dutch")
+    ("nb" . "norsk")
+    ("nn" . "nynorsk")
+    ("no" . "norsk")
+    ("pl" . "polish")
+    ("pt" . "portuguese")
+    ("pt-br" . "brazilian")
+    ("ro" . "romanian")
+    ("ru" . "russian")
+    ("sa" . "sanskrit")
+    ("sb" . "uppersorbian")
+    ("sk" . "slovak")
+    ("sl" . "slovene")
+    ("sq" . "albanian")
+    ("sr" . "serbian")
+    ("sv" . "swedish")
+    ("ta" . "tamil")
+    ("tr" . "turkish")
+    ("uk" . "ukrainian"))
+  "Alist between language code and corresponding Babel option.")
+
+(defconst org-latex-polyglossia-language-alist
+  '(("am" "amharic")
+    ("ar" "arabic")
+    ("ast" "asturian")
+    ("bg" "bulgarian")
+    ("bn" "bengali")
+    ("bo" "tibetan")
+    ("br" "breton")
+    ("ca" "catalan")
+    ("cop" "coptic")
+    ("cs" "czech")
+    ("cy" "welsh")
+    ("da" "danish")
+    ("de" "german" "german")
+    ("de-at" "german" "austrian")
+    ("de-de" "german" "german")
+    ("dsb" "lsorbian")
+    ("dv" "divehi")
+    ("el" "greek")
+    ("en" "english" "usmax")
+    ("en-au" "english" "australian")
+    ("en-gb" "english" "uk")
+    ("en-nz" "english" "newzealand")
+    ("en-us" "english" "usmax")
+    ("eo" "esperanto")
+    ("es" "spanish")
+    ("et" "estonian")
+    ("eu" "basque")
+    ("fa" "farsi")
+    ("fi" "finnish")
+    ("fr" "french")
+    ("fu" "friulan")
+    ("ga" "irish")
+    ("gd" "scottish")
+    ("gl" "galician")
+    ("he" "hebrew")
+    ("hi" "hindi")
+    ("hr" "croatian")
+    ("hsb" "usorbian")
+    ("hu" "magyar")
+    ("hy" "armenian")
+    ("ia" "interlingua")
+    ("id" "bahasai")
+    ("is" "icelandic")
+    ("it" "italian")
+    ("kn" "kannada")
+    ("la" "latin" "modern")
+    ("la-classic" "latin" "classic")
+    ("la-medieval" "latin" "medieval")
+    ("la-modern" "latin" "modern")
+    ("lo" "lao")
+    ("lt" "lithuanian")
+    ("lv" "latvian")
+    ("ml" "malayalam")
+    ("mr" "maranthi")
+    ("nb" "norsk")
+    ("nko" "nko")
+    ("nl" "dutch")
+    ("nn" "nynorsk")
+    ("no" "norsk")
+    ("oc" "occitan")
+    ("pl" "polish")
+    ("pms" "piedmontese")
+    ("pt" "portuges")
+    ("pt-br" "brazilian")
+    ("rm" "romansh")
+    ("ro" "romanian")
+    ("ru" "russian")
+    ("sa" "sanskrit")
+    ("se" "samin")
+    ("sk" "slovak")
+    ("sl" "slovenian")
+    ("sq" "albanian")
+    ("sr" "serbian")
+    ("sv" "swedish")
+    ("syr" "syriac")
+    ("ta" "tamil")
+    ("te" "telugu")
+    ("th" "thai")
+    ("tk" "turkmen")
+    ("tr" "turkish")
+    ("uk" "ukrainian")
+    ("ur" "urdu")
+    ("vi" "vietnamese"))
+  "Alist between language code and corresponding Polyglossia option.")
+
+(make-obsolete-variable 'org-latex-babel-language-alist
+                        "set `org-latex-language-alist' instead." "9.6")
+
+(make-obsolete-variable 'org-latex-polyglossia-language-alist
+                        "set `org-latex-language-alist' instead." "9.6")
+
 ;;;; Obsolete link types
 
 (eval-after-load 'ol
@@ -815,6 +1122,8 @@ context.  See the individual commands for more 
information."
      (org-link-set-parameters "file+sys"))) ;since Org 9.0
 
 
+
+
 
 ;;; Miscellaneous functions
 
@@ -831,12 +1140,6 @@ context.  See the individual commands for more 
information."
         ((and (eq window-system 'w32) (fboundp 'w32-get-clipboard-data))
          (w32-get-clipboard-data))))
 
-;; `set-transient-map' is only in Emacs >= 24.4
-(defalias 'org-set-transient-map
-  (if (fboundp 'set-transient-map)
-      'set-transient-map
-    'set-temporary-overlay-map))
-
 
 ;;; Region compatibility
 
@@ -888,13 +1191,6 @@ Pass COLUMN and FORCE to `move-to-column'."
                           string)
   (apply 'kill-new string args))
 
-;; `font-lock-ensure' is only available from 24.4.50 on
-(defalias 'org-font-lock-ensure
-  (if (fboundp 'font-lock-ensure)
-      #'font-lock-ensure
-    (lambda (&optional _beg _end)
-      (with-no-warnings (font-lock-fontify-buffer)))))
-
 ;; `file-local-name' was added in Emacs 26.1.
 (defalias 'org-babel-local-file-name
   (if (fboundp 'file-local-name)
@@ -921,37 +1217,8 @@ Pass COLUMN and FORCE to `move-to-column'."
            (defun org-release () "N/A")
            (defun org-git-version () "N/A !!check installation!!"))))))
 
-
-
-;;; Functions for Emacs < 24.4 compatibility
-
-(defun org-define-error (name message)
-  "Define NAME as a new error signal.
-MESSAGE is a string that will be output to the echo area if such
-an error is signaled without being caught by a `condition-case'.
-Implements `define-error' for older emacsen."
-  (if (fboundp 'define-error) (define-error name message)
-    (put name 'error-conditions
-         (copy-sequence (cons name (get 'error 'error-conditions))))))
-
-(unless (fboundp 'string-equal-ignore-case)
-  ;; From Emacs subr.el.
-  (defun string-equal-ignore-case (string1 string2)
-    "Like `string-equal', but case-insensitive.
-Upper-case and lower-case letters are treated as equal.
-Unibyte strings are converted to multibyte for comparison."
-    (eq t (compare-strings string1 0 nil string2 0 nil t))))
-
-(unless (fboundp 'string-suffix-p)
-  ;; From Emacs subr.el.
-  (defun string-suffix-p (suffix string  &optional ignore-case)
-    "Return non-nil if SUFFIX is a suffix of STRING.
-If IGNORE-CASE is non-nil, the comparison is done without paying
-attention to case differences."
-    (let ((start-pos (- (length string) (length suffix))))
-      (and (>= start-pos 0)
-           (eq t (compare-strings suffix nil nil
-                                  string start-pos nil ignore-case))))))
+(define-obsolete-function-alias 'org-define-error #'define-error "9.6")
+(define-obsolete-function-alias 'org-without-partial-completion 'progn "9.6")
 
 
 ;;; Integration with and fixes for other packages
@@ -964,7 +1231,6 @@ attention to case differences."
 (defcustom org-imenu-depth 2
   "The maximum level for Imenu access to Org headlines.
 This also applied for speedbar access."
-  :group 'org-imenu-and-speedbar
   :type 'integer)
 
 ;;;; Imenu
@@ -1004,7 +1270,7 @@ This also applied for speedbar access."
      (add-hook 'imenu-after-jump-hook
               (lambda ()
                 (when (derived-mode-p 'org-mode)
-                  (org-show-context 'org-goto))))
+                  (org-fold-show-context 'org-goto))))
      (add-hook 'org-mode-hook
               (lambda ()
                 (setq imenu-create-index-function 'org-imenu-get-tree)))))
@@ -1069,7 +1335,7 @@ To get rid of the restriction, use 
`\\[org-agenda-remove-restriction-lock]'."
      (define-key speedbar-file-key-map ">" 'org-agenda-remove-restriction-lock)
      (define-key speedbar-file-key-map "\C-c\C-x>" 
'org-agenda-remove-restriction-lock)
      (add-hook 'speedbar-visiting-tag-hook
-              (lambda () (and (derived-mode-p 'org-mode) (org-show-context 
'org-goto))))))
+              (lambda () (and (derived-mode-p 'org-mode) 
(org-fold-show-context 'org-goto))))))
 
 ;;;; Add Log
 
@@ -1117,8 +1383,8 @@ ELEMENT is the element at point."
           (or (not (match-beginning 5))
               (< (point) (match-beginning 5)))
            ;; Ignore checks in code, verbatim and others.
-           (org--flyspell-object-check-p (org-element-at-point)))
-    (let* ((element (org-element-at-point))
+           (org--flyspell-object-check-p (org-element-at-point-no-context)))
+    (let* ((element (org-element-at-point-no-context))
           (post-affiliated (org-element-property :post-affiliated element)))
       (cond
        ;; Ignore checks in all affiliated keywords but captions.
@@ -1133,7 +1399,7 @@ ELEMENT is the element at point."
          (and log
               (let ((drawer (org-element-lineage element '(drawer))))
                 (and drawer
-                     (string-equal-ignore-case
+                     (org-string-equal-ignore-case
                       log (org-element-property :drawer-name drawer))))))
        nil)
        (t
@@ -1175,16 +1441,16 @@ ELEMENT is the element at point."
 
 ;;;; Bookmark
 
-(defun org-bookmark-jump-unhide ()
+(defun org-bookmark-jump-unhide (&rest _)
   "Unhide the current position, to show the bookmark location."
   (and (derived-mode-p 'org-mode)
        (or (org-invisible-p)
           (save-excursion (goto-char (max (point-min) (1- (point))))
                           (org-invisible-p)))
-       (org-show-context 'bookmark-jump)))
+       (org-fold-show-context 'bookmark-jump)))
 
 ;; Make `bookmark-jump' shows the jump location if it was hidden.
-(add-hook 'bookmark-after-jump-hook 'org-bookmark-jump-unhide)
+(add-hook 'bookmark-after-jump-hook #'org-bookmark-jump-unhide)
 
 ;;;; Calendar
 
@@ -1237,42 +1503,29 @@ key."
 ;;;; Saveplace
 
 ;; Make sure saveplace shows the location if it was hidden
-(eval-after-load 'saveplace
-  '(defadvice save-place-find-file-hook (after org-make-visible activate)
-     "Make the position visible."
-     (org-bookmark-jump-unhide)))
+(advice-add 'save-place-find-file-hook :after #'org-bookmark-jump-unhide)
 
 ;;;; Ecb
 
 ;; Make sure ecb shows the location if it was hidden
-(eval-after-load 'ecb
-  '(defadvice ecb-method-clicked (after esf/org-show-context activate)
-     "Make hierarchy visible when jumping into location from ECB tree buffer."
-     (when (derived-mode-p 'org-mode)
-       (org-show-context))))
+(advice-add 'ecb-method-clicked :after #'org--ecb-show-context)
+(defun org--ecb-show-context (&rest _)
+  "Make hierarchy visible when jumping into location from ECB tree buffer."
+  (when (derived-mode-p 'org-mode)
+    (org-fold-show-context)))
 
 ;;;; Simple
 
-(defun org-mark-jump-unhide ()
+(defun org-mark-jump-unhide (&rest _)
   "Make the point visible with `org-show-context' after jumping to the mark."
   (when (and (derived-mode-p 'org-mode)
             (org-invisible-p))
-    (org-show-context 'mark-goto)))
+    (org-fold-show-context 'mark-goto)))
 
-(eval-after-load 'simple
-  '(defadvice pop-to-mark-command (after org-make-visible activate)
-     "Make the point visible with `org-show-context'."
-     (org-mark-jump-unhide)))
+(advice-add 'pop-to-mark-command :after #'org-mark-jump-unhide)
 
-(eval-after-load 'simple
-  '(defadvice exchange-point-and-mark (after org-make-visible activate)
-     "Make the point visible with `org-show-context'."
-     (org-mark-jump-unhide)))
-
-(eval-after-load 'simple
-  '(defadvice pop-global-mark (after org-make-visible activate)
-     "Make the point visible with `org-show-context'."
-     (org-mark-jump-unhide)))
+(advice-add 'exchange-point-and-mark :after #'org-mark-jump-unhide)
+(advice-add 'pop-global-mark :after #'org-mark-jump-unhide)
 
 ;;;; Session
 
@@ -1281,11 +1534,82 @@ key."
 (eval-after-load 'session
   '(add-to-list 'session-globals-exclude 'org-mark-ring))
 
+;;;; outline-mode
+
+;; Folding in outline-mode is not compatible with org-mode folding
+;; anymore. Working around to avoid breakage of external packages
+;; assuming the compatibility.
+(define-advice outline-flag-region (:around (oldfun from to flag &rest extra) 
fix-for-org-fold)
+  "Run `org-fold-region' when in org-mode."
+  (if (derived-mode-p 'org-mode)
+      (org-fold-region (max from (point-min)) (min to (point-max)) flag 
'headline)
+    ;; Apply EXTRA to avoid breakages if advised function definition
+    ;; changes.
+    (apply oldfun from to flag extra)))
+
+(define-advice outline-next-visible-heading (:around (oldfun arg &rest extra) 
fix-for-org-fold)
+  "Run `org-next-visible-heading' when in org-mode."
+  (if (derived-mode-p 'org-mode)
+      (org-next-visible-heading arg)
+    ;; Apply EXTRA to avoid breakages if advised function definition
+    ;; changes.
+    (apply oldfun arg extra)))
+
+(define-advice outline-back-to-heading (:around (oldfun &optional invisible-ok 
&rest extra) fix-for-org-fold)
+  "Run `org-back-to-heading' when in org-mode."
+  (if (derived-mode-p 'org-mode)
+      (progn
+        (beginning-of-line)
+        (or (org-at-heading-p (not invisible-ok))
+            (let (found)
+             (save-excursion
+               (while (not found)
+                 (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
+                                         nil t)
+                      (signal 'outline-before-first-heading nil))
+                 (setq found (and (or invisible-ok (not (org-fold-folded-p)))
+                                  (point)))))
+             (goto-char found)
+             found)))
+    ;; Apply EXTRA to avoid breakages if advised function definition
+    ;; changes.
+    (apply oldfun invisible-ok extra)))
+
+(define-advice outline-on-heading-p (:around (oldfun &optional invisible-ok 
&rest extra) fix-for-org-fold)
+  "Run `org-at-heading-p' when in org-mode."
+  (if (derived-mode-p 'org-mode)
+      (org-at-heading-p (not invisible-ok))
+    ;; Apply EXTRA to avoid breakages if advised function definition
+    ;; changes.
+    (apply oldfun invisible-ok extra)))
+
+(define-advice outline-hide-sublevels (:around (oldfun levels &rest extra) 
fix-for-org-fold)
+  "Run `org-fold-hide-sublevels' when in org-mode."
+  (if (derived-mode-p 'org-mode)
+      (org-fold-hide-sublevels levels)
+    ;; Apply EXTRA to avoid breakages if advised function definition
+    ;; changes.
+    (apply oldfun levels extra)))
+
+(define-advice outline-toggle-children (:around (oldfun &rest extra) 
fix-for-org-fold)
+  "Run `org-fold-hide-sublevels' when in org-mode."
+  (if (derived-mode-p 'org-mode)
+      (save-excursion
+        (org-back-to-heading)
+        (if (not (org-fold-folded-p (line-end-position)))
+            (org-fold-hide-subtree)
+          (org-fold-show-children)
+          (org-fold-show-entry 'hide-drawers)))
+    ;; Apply EXTRA to avoid breakages if advised function definition
+    ;; changes.
+    (apply oldfun extra)))
+
+;; TODO: outline-headers-as-kill
+
 ;;;; Speed commands
 
 (make-obsolete-variable 'org-speed-commands-user
                         "configure `org-speed-commands' instead." "9.5")
-
 (provide 'org-compat)
 
 ;; Local variables:
diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el
index 41813cb184..0d2ce593d7 100644
--- a/lisp/org/org-crypt.el
+++ b/lisp/org/org-crypt.el
@@ -54,6 +54,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org-macs)
 (require 'org-compat)
 
@@ -73,7 +76,7 @@
 (declare-function org-end-of-meta-data "org" (&optional full))
 (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
 (declare-function org-entry-get "org" (pom property &optional inherit 
literal-nil))
-(declare-function org-flag-subtree "org" (flag))
+(declare-function org-fold-subtree "org-fold" (flag))
 (declare-function org-make-tags-matcher "org" (match))
 (declare-function org-previous-visible-heading "org" (arg))
 (declare-function org-scan-tags "org" (action matcher todo-only &optional 
start-level))
@@ -196,8 +199,9 @@ See `org-crypt-disable-auto-save'."
 Assume `epg-context' is set."
   (and org-crypt-key
        (or (epg-list-keys epg-context
-                         (or (org-entry-get nil "CRYPTKEY" 'selective)
-                             org-crypt-key))
+                         (pcase (org-entry-get nil "CRYPTKEY" 'selective 
'literal-nil)
+                            ("nil" "")
+                            (key (or key org-crypt-key ""))))
           (bound-and-true-p epa-file-encrypt-to)
           (progn
             (message "No crypt key set, using symmetric encryption.")
@@ -243,7 +247,7 @@ Assume `epg-context' is set."
              (error (error-message-string err)))))
         (when folded-heading
           (goto-char folded-heading)
-          (org-flag-subtree t))
+          (org-fold-subtree t))
         nil)))))
 
 ;;;###autoload
@@ -280,7 +284,7 @@ Assume `epg-context' is set."
                             'org-crypt-text encrypted-text))
         (when folded-heading
           (goto-char folded-heading)
-          (org-flag-subtree t))
+          (org-fold-subtree t))
         nil)))
     (_ nil)))
 
@@ -313,7 +317,7 @@ Assume `epg-context' is set."
    'org-mode-hook
    (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t))))
 
-(add-hook 'org-reveal-start-hook 'org-decrypt-entry)
+(add-hook 'org-fold-reveal-start-hook 'org-decrypt-entry)
 
 (provide 'org-crypt)
 
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el
index b1ee32ab33..cba99fca21 100644
--- a/lisp/org/org-ctags.el
+++ b/lisp/org/org-ctags.el
@@ -135,6 +135,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (eval-when-compile (require 'cl-lib))
 (require 'org)
 
@@ -155,7 +158,6 @@ See the ctags documentation for more information.")
 (defcustom org-ctags-path-to-ctags
   (if (executable-find "ctags-exuberant") "ctags-exuberant" "ctags")
   "Name of the ctags executable file."
-  :group 'org-ctags
   :version "24.1"
   :type 'file)
 
@@ -164,7 +166,6 @@ See the ctags documentation for more information.")
     org-ctags-ask-rebuild-tags-file-then-find-tag
     org-ctags-ask-append-topic)
   "List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS by ORG-CTAGS."
-  :group 'org-ctags
   :version "24.1"
   :type 'hook
   :options '(org-ctags-find-tag
@@ -186,7 +187,6 @@ Created as a local variable in each buffer.")
   "Text to insert when creating a new org file via opening a hyperlink.
 The following patterns are replaced in the string:
     `%t' - replaced with the capitalized title of the hyperlink"
-  :group 'org-ctags
   :version "24.1"
   :type 'string)
 
@@ -205,7 +205,8 @@ The following patterns are replaced in the string:
                   (visit-tags-table tags-filename))))))
 
 
-(defadvice visit-tags-table (after org-ctags-load-tag-list activate compile)
+(advice-add 'visit-tags-table :after #'org--ctags-load-tag-list)
+(defun org--ctags-load-tag-list (&rest _)
   (when (and org-ctags-enabled-p tags-file-name)
     (setq-local org-ctags-tag-list
                (org-ctags-all-tags-in-current-tags-table))))
@@ -227,7 +228,7 @@ If the tag is found, return a list containing the filename, 
line number, and
 buffer position where the tag is found."
   (interactive "sTag: ")
   (unless tags-file-name
-    (call-interactively (visit-tags-table)))
+    (call-interactively #'visit-tags-table))
   (save-excursion
     (visit-tags-table-buffer 'same)
     (when tags-file-name
@@ -254,7 +255,7 @@ Return the list."
   (interactive)
   (let ((taglist nil))
     (unless tags-file-name
-      (call-interactively (visit-tags-table)))
+      (call-interactively #'visit-tags-table))
     (save-excursion
       (visit-tags-table-buffer 'same)
       (with-current-buffer (get-file-buffer tags-file-name)
@@ -293,8 +294,9 @@ The new topic will be titled NAME (or TITLE if supplied)."
 ;;;; Misc interoperability with etags system =================================
 
 
-(defadvice xref-find-definitions
-    (before org-ctags-set-org-mark-before-finding-tag activate compile)
+(advice-add 'xref-find-definitions :before
+            #'org--ctags-set-org-mark-before-finding-tag)
+(defun org--ctags-set-org-mark-before-finding-tag (&rest _)
   "Before trying to find a tag, save our current position on org mark ring."
   (save-excursion
     (when (and (derived-mode-p 'org-mode) org-ctags-enabled-p)
@@ -435,7 +437,7 @@ to append a new topic."
 Like ORG-CTAGS-FIND-TAG, but calls the external ctags program first,
 to rebuild (update) the TAGS file."
   (unless tags-file-name
-    (call-interactively (visit-tags-table)))
+    (call-interactively #'visit-tags-table))
   (when (buffer-file-name)
     (org-ctags-create-tags))
   (org-ctags-find-tag name))
@@ -508,10 +510,7 @@ Uses `ido-mode' if available.
 If the user enters a string that does not match an existing tag, create
 a new topic."
   (interactive)
-  (let* ((completing-read-fn (if (fboundp 'ido-completing-read)
-                                 'ido-completing-read
-                               'completing-read))
-         (tag (funcall completing-read-fn "Topic: " org-ctags-tag-list
+  (let* ((tag (ido-completing-read "Topic: " org-ctags-tag-list
                        nil 'confirm nil 'org-ctags-find-tag-history)))
     (when tag
       (cond
diff --git a/lisp/org/org-cycle.el b/lisp/org/org-cycle.el
new file mode 100644
index 0000000000..9531ac4c8c
--- /dev/null
+++ b/lisp/org/org-cycle.el
@@ -0,0 +1,817 @@
+;;; org-cycle.el --- Visibility cycling of Org entries -*- lexical-binding: t; 
-*-
+;;
+;; Copyright (C) 2020-2020 Free Software Foundation, Inc.
+;;
+;; Maintainer: Ihor Radchenko <yantar92 at gmail dot com>
+;; Keywords: folding, visibility cycling, invisible text
+;; URL: https://orgmode.org
+;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+
+;; This file contains code controlling global folding state in buffer
+;; and TAB-cycling.
+
+;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'org-macs)
+(require 'org-fold)
+
+(declare-function org-element-type "org-element" (element))
+(declare-function org-element-property "org-element" (property element))
+(declare-function org-element-lineage "org-element" (datum &optional types 
with-self))
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
+(declare-function org-display-inline-images "org" (&optional include-linked 
refresh beg end))
+(declare-function org-get-tags "org" (&optional pos local fontify))
+(declare-function org-subtree-end-visible-p "org" ())
+(declare-function org-narrow-to-subtree "org" (&optional element))
+(declare-function org-next-visible-heading "org" (arg))
+(declare-function org-at-property-p "org" ())
+(declare-function org-re-property "org" (property &optional literal allow-null 
value))
+(declare-function org-remove-inline-images "org" (&optional beg end))
+(declare-function org-item-beginning-re "org" ())
+(declare-function org-at-heading-p "org" (&optional invisible-not-ok))
+(declare-function org-at-item-p "org" ())
+(declare-function org-before-first-heading-p "org" ())
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
+(declare-function org-entry-end-position "org" ())
+(declare-function org-try-cdlatex-tab "org" ())
+(declare-function org-cycle-level "org" ())
+(declare-function org-table-next-field "org-table" ())
+(declare-function org-table-justify-field-maybe "org-table" (&optional new))
+(declare-function org-inlinetask-at-task-p "org-inlinetask" ())
+(declare-function org-inlinetask-toggle-visibility "org-inlinetask" ())
+(declare-function org-list-get-all-items "org-list" (item struct prevs))
+(declare-function org-list-get-bottom-point "org-list" (struct))
+(declare-function org-list-prevs-alist "org-list" (struct))
+(declare-function org-list-set-item-visibility "org-list" (item struct view))
+(declare-function org-list-search-forward "org-list" (regexp &optional bound 
noerror))
+(declare-function org-list-has-child-p "org-list" (item struct))
+(declare-function org-list-get-item-end-before-blank "org-list" (item struct))
+(declare-function org-list-struct "org-list" ())
+(declare-function org-cycle-item-indentation "org-list" ())
+
+(declare-function outline-previous-heading "outline" ())
+(declare-function outline-next-heading "outline" ())
+(declare-function outline-end-of-heading "outline" ())
+(declare-function outline-up-heading "outline" (arg &optional invisible-ok))
+
+(defvar org-drawer-regexp)
+(defvar org-odd-levels-only)
+(defvar org-startup-folded)
+(defvar org-archive-tag)
+(defvar org-cycle-include-plain-lists)
+(defvar org-outline-regexp-bol)
+
+(defvar-local org-cycle-global-status nil)
+(put 'org-cycle-global-status 'org-state t)
+(defvar-local org-cycle-subtree-status nil)
+(put 'org-cycle-subtree-status 'org-state t)
+
+;;;; Customization:
+
+
+(defgroup org-cycle nil
+  "Options concerning visibility cycling in Org mode."
+  :tag "Org Cycle"
+  :group 'org-structure)
+
+(defcustom org-cycle-skip-children-state-if-no-children t
+  "Non-nil means skip CHILDREN state in entries that don't have any."
+  :group 'org-cycle
+  :type 'boolean)
+
+(defcustom org-cycle-max-level nil
+  "Maximum level which should still be subject to visibility cycling.
+Levels higher than this will, for cycling, be treated as text, not a headline.
+When `org-odd-levels-only' is set, a value of N in this variable actually
+means 2N-1 stars as the limiting headline.
+When nil, cycle all levels.
+Note that the limiting level of cycling is also influenced by
+`org-inlinetask-min-level'.  When `org-cycle-max-level' is not set but
+`org-inlinetask-min-level' is, cycling will be limited to levels one less
+than its value."
+  :group 'org-cycle
+  :type '(choice
+         (const :tag "No limit" nil)
+         (integer :tag "Maximum level")))
+
+(defcustom org-cycle-hide-block-startup nil
+  "Non-nil means entering Org mode will fold all blocks.
+This can also be set in on a per-file basis with
+
+#+STARTUP: hideblocks
+#+STARTUP: nohideblocks"
+  :group 'org-startup
+  :group 'org-cycle
+  :type 'boolean)
+
+(defcustom org-cycle-hide-drawer-startup t
+  "Non-nil means entering Org mode will fold all drawers.
+This can also be set in on a per-file basis with
+
+#+STARTUP: hidedrawers
+#+STARTUP: nohidedrawers"
+  :group 'org-startup
+  :group 'org-cycle
+  :type 'boolean)
+
+(defcustom org-cycle-global-at-bob nil
+  "Cycle globally if cursor is at beginning of buffer and not at a headline.
+
+This makes it possible to do global cycling without having to use `S-TAB'
+or `\\[universal-argument] TAB'.  For this special case to work, the first \
+line of the buffer
+must not be a headline -- it may be empty or some other text.
+
+When used in this way, `org-cycle-hook' is disabled temporarily to make
+sure the cursor stays at the beginning of the buffer.
+
+When this option is nil, don't do anything special at the beginning of
+the buffer."
+  :group 'org-cycle
+  :type 'boolean)
+
+(defcustom org-cycle-level-after-item/entry-creation t
+  "Non-nil means cycle entry level or item indentation in new empty entries.
+
+When the cursor is at the end of an empty headline, i.e., with only stars
+and maybe a TODO keyword, TAB will then switch the entry to become a child,
+and then all possible ancestor states, before returning to the original state.
+This makes data entry extremely fast:  M-RET to create a new headline,
+on TAB to make it a child, two or more tabs to make it a (grand-)uncle.
+
+When the cursor is at the end of an empty plain list item, one TAB will
+make it a subitem, two or more tabs will back up to make this an item
+higher up in the item hierarchy."
+  :group 'org-cycle
+  :type 'boolean)
+
+(defcustom org-cycle-emulate-tab t
+  "Where should `org-cycle' emulate TAB.
+nil         Never
+white       Only in completely white lines
+whitestart  Only at the beginning of lines, before the first non-white char
+t           Everywhere except in headlines
+exc-hl-bol  Everywhere except at the start of a headline
+If TAB is used in a place where it does not emulate TAB, the current subtree
+visibility is cycled."
+  :group 'org-cycle
+  :type '(choice (const :tag "Never" nil)
+                (const :tag "Only in completely white lines" white)
+                (const :tag "Before first char in a line" whitestart)
+                (const :tag "Everywhere except in headlines" t)
+                (const :tag "Everywhere except at bol in headlines" 
exc-hl-bol)))
+
+(defcustom org-cycle-separator-lines 2
+  "Number of empty lines needed to keep an empty line between collapsed trees.
+If you leave an empty line between the end of a subtree and the following
+headline, this empty line is hidden when the subtree is folded.
+Org mode will leave (exactly) one empty line visible if the number of
+empty lines is equal or larger to the number given in this variable.
+So the default 2 means at least 2 empty lines after the end of a subtree
+are needed to produce free space between a collapsed subtree and the
+following headline.
+
+If the number is negative, and the number of empty lines is at least -N,
+all empty lines are shown.
+
+Special case: when 0, never leave empty lines in collapsed view."
+  :group 'org-cycle
+  :type 'integer)
+(put 'org-cycle-separator-lines 'safe-local-variable 'integerp)
+
+(defcustom org-cycle-pre-hook nil
+  "Hook that is run before visibility cycling is happening.
+The function(s) in this hook must accept a single argument which indicates
+the new state that will be set right after running this hook.  The
+argument is a symbol.  Before a global state change, it can have the values
+`overview', `content', or `all'.  Before a local state change, it can have
+the values `folded', `children', or `subtree'."
+  :group 'org-cycle
+  :type 'hook)
+
+(defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
+                            org-cycle-show-empty-lines
+                            org-cycle-optimize-window-after-visibility-change
+                            org-cycle-display-inline-images)
+  "Hook that is run after `org-cycle' has changed the buffer visibility.
+The function(s) in this hook must accept a single argument which indicates
+the new state that was set by the most recent `org-cycle' command.  The
+argument is a symbol.  After a global state change, it can have the values
+`overview', `contents', or `all'.  After a local state change, it can have
+the values `folded', `children', or `subtree'."
+  :group 'org-cycle
+  :package-version '(Org . "9.4")
+  :type 'hook)
+
+(defcustom org-cycle-open-archived-trees nil
+  "Non-nil means `org-cycle' will open archived trees.
+An archived tree is a tree marked with the tag ARCHIVE.
+When nil, archived trees will stay folded.  You can still open them with
+normal outline commands like `show-all', but not with the cycling commands."
+  :group 'org-archive
+  :group 'org-cycle
+  :type 'boolean)
+
+(defcustom org-cycle-inline-images-display nil
+  "Non-nil means auto display inline images under subtree when cycling."
+  :group 'org-startup
+  :group 'org-cycle
+  :package-version '(Org . "9.6")
+  :type 'boolean)
+
+(defvar org-cycle-tab-first-hook nil
+  "Hook for functions to attach themselves to TAB.
+See `org-ctrl-c-ctrl-c-hook' for more information.
+This hook runs as the first action when TAB is pressed, even before
+`org-cycle' messes around with the `outline-regexp' to cater for
+inline tasks and plain list item folding.
+If any function in this hook returns t, any other actions that
+would have been caused by TAB (such as table field motion or visibility
+cycling) will not occur.")
+
+;;;; Implementation:
+
+(defun org-cycle-hide-drawers (state)
+  "Re-hide all drawers after a visibility state change.
+STATE should be one of the symbols listed in the docstring of
+`org-cycle-hook'."
+  (when (derived-mode-p 'org-mode)
+    (cond ((not (memq state '(overview folded contents)))
+           (let* ((global? (eq state 'all))
+                  (beg (if global? (point-min) (line-beginning-position)))
+                  (end (cond (global? (point-max))
+                             ((eq state 'children) (org-entry-end-position))
+                             (t (save-excursion (org-end-of-subtree t t))))))
+             (org-fold--hide-drawers beg end)))
+          ((memq state '(overview contents))
+           ;; Hide drawers before first heading.
+           (let ((beg (point-min))
+                 (end (save-excursion
+                        (goto-char (point-min))
+                        (if (org-before-first-heading-p)
+                            (org-entry-end-position)
+                          (point-min)))))
+             (when (< beg end)
+               (org-fold--hide-drawers beg end)))))))
+
+;;;###autoload
+(defun org-cycle (&optional arg)
+  "TAB-action and visibility cycling for Org mode.
+
+This is the command invoked in Org mode by the `TAB' key.  Its main
+purpose is outline visibility cycling, but it also invokes other actions
+in special contexts.
+
+When this function is called with a `\\[universal-argument]' prefix, rotate \
+the entire
+buffer through 3 states (global cycling)
+  1. OVERVIEW: Show only top-level headlines.
+  2. CONTENTS: Show all headlines of all levels, but no body text.
+  3. SHOW ALL: Show everything.
+
+With a `\\[universal-argument] \\[universal-argument]' prefix argument, \
+switch to the startup visibility,
+determined by the variable `org-startup-folded', and by any VISIBILITY
+properties in the buffer.
+
+With a `\\[universal-argument] \\[universal-argument] \
+\\[universal-argument]' prefix argument, show the entire buffer, including
+any drawers.
+
+When inside a table, re-align the table and move to the next field.
+
+When point is at the beginning of a headline, rotate the subtree started
+by this line through 3 different states (local cycling)
+  1. FOLDED:   Only the main headline is shown.
+  2. CHILDREN: The main headline and the direct children are shown.
+               From this state, you can move to one of the children
+               and zoom in further.
+  3. SUBTREE:  Show the entire subtree, including body text.
+If there is no subtree, switch directly from CHILDREN to FOLDED.
+
+When point is at the beginning of an empty headline and the variable
+`org-cycle-level-after-item/entry-creation' is set, cycle the level
+of the headline by demoting and promoting it to likely levels.  This
+speeds up creation document structure by pressing `TAB' once or several
+times right after creating a new headline.
+
+When there is a numeric prefix, go up to a heading with level ARG, do
+a `show-subtree' and return to the previous cursor position.  If ARG
+is negative, go up that many levels.
+
+When point is not at the beginning of a headline, execute the global
+binding for `TAB', which is re-indenting the line.  See the option
+`org-cycle-emulate-tab' for details.
+
+As a special case, if point is at the very beginning of the buffer, if
+there is no headline there, and if the variable `org-cycle-global-at-bob'
+is non-nil, this function acts as if called with prefix argument \
+\(`\\[universal-argument] TAB',
+same as `S-TAB') also when called without prefix argument."
+  (interactive "P")
+  (org-load-modules-maybe)
+  (unless (or (run-hook-with-args-until-success 'org-cycle-tab-first-hook)
+             (and org-cycle-level-after-item/entry-creation
+                  (or (org-cycle-level)
+                      (org-cycle-item-indentation))))
+    (let* ((limit-level
+           (or org-cycle-max-level
+               (and (boundp 'org-inlinetask-min-level)
+                    org-inlinetask-min-level
+                    (1- org-inlinetask-min-level))))
+          (nstars
+           (and limit-level
+                (if org-odd-levels-only
+                    (1- (* 2 limit-level))
+                  limit-level)))
+          (org-outline-regexp
+           (format "\\*%s " (if nstars (format "\\{1,%d\\}" nstars) "+"))))
+      (cond
+       ((equal arg '(16))
+       (setq last-command 'dummy)
+       (org-cycle-set-startup-visibility)
+       (org-unlogged-message "Startup visibility, plus VISIBILITY properties"))
+       ((equal arg '(64))
+       (org-fold-show-all)
+       (org-unlogged-message "Entire buffer visible, including drawers"))
+       ((equal arg '(4)) (org-cycle-internal-global))
+       ;; Show-subtree, ARG levels up from here.
+       ((integerp arg)
+       (save-excursion
+         (org-back-to-heading)
+         (outline-up-heading (if (< arg 0) (- arg)
+                               (- (funcall outline-level) arg)))
+         (org-fold-show-subtree)))
+       ;; Global cycling at BOB: delegate to `org-cycle-internal-global'.
+       ((and org-cycle-global-at-bob
+            (bobp)
+            (not (looking-at org-outline-regexp)))
+       (let ((org-cycle-hook
+              (remq 'org-cycle-optimize-window-after-visibility-change
+                    org-cycle-hook)))
+         (org-cycle-internal-global)))
+       ;; Try CDLaTeX TAB completion.
+       ((org-try-cdlatex-tab))
+       ;; Inline task: delegate to `org-inlinetask-toggle-visibility'.
+       ((and (featurep 'org-inlinetask)
+            (org-inlinetask-at-task-p)
+            (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
+       (org-inlinetask-toggle-visibility))
+       (t
+       (let ((pos (point))
+             (element (org-element-at-point)))
+         (cond
+          ;; Try toggling visibility for block at point.
+          ((org-fold-hide-block-toggle nil t element))
+          ;; Try toggling visibility for drawer at point.
+          ((org-fold-hide-drawer-toggle nil t element))
+          ;; Table: enter it or move to the next field.
+          ((and (org-match-line "[ \t]*[|+]")
+                (org-element-lineage element '(table) t))
+           (if (and (eq 'table (org-element-type element))
+                    (eq 'table.el (org-element-property :type element)))
+               (message (substitute-command-keys "\\<org-mode-map>\
+Use `\\[org-edit-special]' to edit table.el tables"))
+             (org-table-justify-field-maybe)
+             (call-interactively #'org-table-next-field)))
+          ((run-hook-with-args-until-success
+            'org-tab-after-check-for-table-hook))
+          ;; At an item/headline: delegate to `org-cycle-internal-local'.
+          ((and (or (and org-cycle-include-plain-lists
+                         (let ((item (org-element-lineage element
+                                                          '(item plain-list)
+                                                          t)))
+                           (and item
+                                (= (line-beginning-position)
+                                   (org-element-property :post-affiliated
+                                                         item)))))
+                    (org-match-line org-outline-regexp))
+                (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
+           (org-cycle-internal-local))
+          ;; From there: TAB emulation and template completion.
+          (buffer-read-only (org-back-to-heading))
+          ((run-hook-with-args-until-success
+            'org-tab-after-check-for-cycling-hook))
+          ((run-hook-with-args-until-success
+            'org-tab-before-tab-emulation-hook))
+          ((and (eq org-cycle-emulate-tab 'exc-hl-bol)
+                (or (not (bolp))
+                    (not (looking-at org-outline-regexp))))
+           (call-interactively (global-key-binding (kbd "TAB"))))
+          ((or (eq org-cycle-emulate-tab t)
+               (and (memq org-cycle-emulate-tab '(white whitestart))
+                    (save-excursion (beginning-of-line 1) (looking-at "[ 
\t]*"))
+                    (or (and (eq org-cycle-emulate-tab 'white)
+                             (= (match-end 0) (line-end-position)))
+                        (and (eq org-cycle-emulate-tab 'whitestart)
+                             (>= (match-end 0) pos)))))
+           (call-interactively (global-key-binding (kbd "TAB"))))
+          (t
+           (save-excursion
+             (org-back-to-heading)
+             (org-cycle))))))))))
+
+(defun org-cycle-force-archived ()
+  "Cycle subtree even if it is archived."
+  (interactive)
+  (setq this-command 'org-cycle)
+  (let ((org-cycle-open-archived-trees t))
+    (call-interactively 'org-cycle)))
+
+(defun org-cycle-internal-global ()
+  "Do the global cycling action."
+  ;; Hack to avoid display of messages for .org  attachments in Gnus
+  (let ((ga (string-match-p "\\*fontification" (buffer-name))))
+    (cond
+     ((and (eq last-command this-command)
+          (eq org-cycle-global-status 'overview))
+      ;; We just created the overview - now do table of contents
+      ;; This can be slow in very large buffers, so indicate action
+      (run-hook-with-args 'org-cycle-pre-hook 'contents)
+      (unless ga (org-unlogged-message "CONTENTS..."))
+      (org-cycle-content)
+      (unless ga (org-unlogged-message "CONTENTS...done"))
+      (setq org-cycle-global-status 'contents)
+      (run-hook-with-args 'org-cycle-hook 'contents))
+
+     ((and (eq last-command this-command)
+          (eq org-cycle-global-status 'contents))
+      ;; We just showed the table of contents - now show everything
+      (run-hook-with-args 'org-cycle-pre-hook 'all)
+      (org-fold-show-all '(headings blocks))
+      (unless ga (org-unlogged-message "SHOW ALL"))
+      (setq org-cycle-global-status 'all)
+      (run-hook-with-args 'org-cycle-hook 'all))
+
+     (t
+      ;; Default action: go to overview
+      (run-hook-with-args 'org-cycle-pre-hook 'overview)
+      (org-cycle-overview)
+      (unless ga (org-unlogged-message "OVERVIEW"))
+      (setq org-cycle-global-status 'overview)
+      (run-hook-with-args 'org-cycle-hook 'overview)))))
+
+(defun org-cycle-internal-local ()
+  "Do the local cycling action."
+  (let ((goal-column 0) eoh eol eos has-children children-skipped struct)
+    ;; First, determine end of headline (EOH), end of subtree or item
+    ;; (EOS), and if item or heading has children (HAS-CHILDREN).
+    (save-excursion
+      (if (org-at-item-p)
+         (progn
+           (beginning-of-line)
+           (setq struct (org-list-struct))
+           (setq eoh (line-end-position))
+           (setq eos (org-list-get-item-end-before-blank (point) struct))
+           (setq has-children (org-list-has-child-p (point) struct)))
+       (org-back-to-heading)
+       (setq eoh (save-excursion (outline-end-of-heading) (point)))
+       (setq eos (save-excursion
+                   (org-end-of-subtree t t)
+                   (unless (eobp) (forward-char -1))
+                   (point)))
+       (setq has-children
+             (or
+              (save-excursion
+                (let ((level (funcall outline-level)))
+                  (outline-next-heading)
+                  (and (org-at-heading-p)
+                       (> (funcall outline-level) level))))
+              (and (eq org-cycle-include-plain-lists 'integrate)
+                   (save-excursion
+                     (org-list-search-forward (org-item-beginning-re) eos 
t))))))
+      ;; Determine end invisible part of buffer (EOL)
+      (beginning-of-line 2)
+      (if (eq org-fold-core-style 'text-properties)
+          (while (and (not (eobp))             ;this is like `next-line'
+                     (org-fold-folded-p (1- (point))))
+           (goto-char (org-fold-next-visibility-change nil nil t))
+           (and (eolp) (beginning-of-line 2)))
+        (while (and (not (eobp))               ;this is like `next-line'
+                   (get-char-property (1- (point)) 'invisible))
+         (goto-char (next-single-char-property-change (point) 'invisible))
+         (and (eolp) (beginning-of-line 2))))
+      (setq eol (point)))
+    ;; Find out what to do next and set `this-command'
+    (cond
+     ((= eos eoh)
+      ;; Nothing is hidden behind this heading
+      (unless (org-before-first-heading-p)
+       (run-hook-with-args 'org-cycle-pre-hook 'empty))
+      (org-unlogged-message "EMPTY ENTRY")
+      (setq org-cycle-subtree-status nil)
+      (save-excursion
+       (goto-char eos)
+        (org-with-limited-levels
+        (outline-next-heading))
+       (when (org-invisible-p) (org-fold-heading nil))))
+     ((and (or (>= eol eos)
+              (save-excursion (goto-char eol) (skip-chars-forward "[:space:]" 
eos) (= (point) eos)))
+          (or has-children
+              (not (setq children-skipped
+                       org-cycle-skip-children-state-if-no-children))))
+      ;; Entire subtree is hidden in one line: children view
+      (unless (org-before-first-heading-p)
+        (org-with-limited-levels
+        (run-hook-with-args 'org-cycle-pre-hook 'children)))
+      (if (org-at-item-p)
+         (org-list-set-item-visibility (line-beginning-position) struct 
'children)
+       (org-fold-show-entry)
+       (org-with-limited-levels (org-fold-show-children))
+       (org-fold-show-set-visibility 'tree)
+       ;; Fold every list in subtree to top-level items.
+       (when (eq org-cycle-include-plain-lists 'integrate)
+         (save-excursion
+           (org-back-to-heading)
+           (while (org-list-search-forward (org-item-beginning-re) eos t)
+             (beginning-of-line 1)
+             (let* ((struct (org-list-struct))
+                    (prevs (org-list-prevs-alist struct))
+                    (end (org-list-get-bottom-point struct)))
+               (dolist (e (org-list-get-all-items (point) struct prevs))
+                 (org-list-set-item-visibility e struct 'folded))
+               (goto-char (if (< end eos) end eos)))))))
+      (org-unlogged-message "CHILDREN")
+      (save-excursion
+       (goto-char eos)
+        (org-with-limited-levels
+        (outline-next-heading))
+       (when (and
+               ;; Subtree does not end at the end of visible section of the
+               ;; buffer.
+               (< (point) (point-max))
+               (org-invisible-p))
+          ;; Reveal the following heading line.
+          (org-fold-heading nil)))
+      (setq org-cycle-subtree-status 'children)
+      (unless (org-before-first-heading-p)
+       (run-hook-with-args 'org-cycle-hook 'children)))
+     ((or children-skipped
+         (and (eq last-command this-command)
+              (eq org-cycle-subtree-status 'children)))
+      ;; We just showed the children, or no children are there,
+      ;; now show everything.
+      (unless (org-before-first-heading-p)
+       (run-hook-with-args 'org-pre-cycle-hook 'subtree))
+      (org-fold-region eoh eos nil 'outline)
+      (org-unlogged-message
+       (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE"))
+      (setq org-cycle-subtree-status 'subtree)
+      (unless (org-before-first-heading-p)
+       (run-hook-with-args 'org-cycle-hook 'subtree)))
+     (t
+      ;; Default action: hide the subtree.
+      (run-hook-with-args 'org-cycle-pre-hook 'folded)
+      (org-fold-region eoh eos t 'outline)
+      (org-unlogged-message "FOLDED")
+      (setq org-cycle-subtree-status 'folded)
+      (unless (org-before-first-heading-p)
+       (run-hook-with-args 'org-cycle-hook 'folded))))))
+
+;;;###autoload
+(defun org-cycle-global (&optional arg)
+  "Cycle the global visibility.  For details see `org-cycle'.
+With `\\[universal-argument]' prefix ARG, switch to startup visibility.
+With a numeric prefix, show all headlines up to that level."
+  (interactive "P")
+  (cond
+   ((integerp arg)
+    (org-cycle-content arg)
+    (setq org-cycle-global-status 'contents))
+   ((equal arg '(4))
+    (org-cycle-set-startup-visibility)
+    (org-unlogged-message "Startup visibility, plus VISIBILITY properties."))
+   (t
+    (org-cycle '(4)))))
+
+(defun org-cycle-set-startup-visibility ()
+  "Set the visibility required by startup options and properties."
+  (cond
+   ((eq org-startup-folded t)
+    (org-cycle-overview))
+   ((eq org-startup-folded 'content)
+    (org-cycle-content))
+   ((eq org-startup-folded 'show2levels)
+    (org-cycle-content 2))
+   ((eq org-startup-folded 'show3levels)
+    (org-cycle-content 3))
+   ((eq org-startup-folded 'show4levels)
+    (org-cycle-content 4))
+   ((eq org-startup-folded 'show5levels)
+    (org-cycle-content 5))
+   ((or (eq org-startup-folded 'showeverything)
+       (eq org-startup-folded nil))
+    (org-fold-show-all)))
+  (unless (eq org-startup-folded 'showeverything)
+    (when org-cycle-hide-block-startup (org-fold-hide-block-all))
+    (org-cycle-set-visibility-according-to-property)
+    (org-cycle-hide-archived-subtrees 'all)
+    (when org-cycle-hide-drawer-startup (org-cycle-hide-drawers 'all))
+    (org-cycle-show-empty-lines t)))
+
+(defun org-cycle-set-visibility-according-to-property ()
+  "Switch subtree visibility according to VISIBILITY property."
+  (interactive)
+  (let ((regexp (org-re-property "VISIBILITY")))
+    (org-with-point-at 1
+      (while (re-search-forward regexp nil t)
+       (let ((state (match-string 3)))
+         (if (not (org-at-property-p)) (outline-next-heading)
+           (save-excursion
+             (org-back-to-heading t)
+             (org-fold-subtree t)
+             (pcase state
+               ("folded"
+                (org-fold-subtree t))
+               ("children"
+                (org-fold-show-hidden-entry)
+                (org-fold-show-children))
+               ("content"
+                (save-excursion
+                  (save-restriction
+                    (org-narrow-to-subtree)
+                    (org-cycle-content))))
+               ((or "all" "showall")
+                (org-fold-show-subtree))
+               (_ nil)))
+           (org-end-of-subtree)))))))
+
+(defun org-cycle-overview ()
+  "Switch to overview mode, showing only top-level headlines."
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    ;; Hide top-level drawer.
+    (save-restriction
+      (narrow-to-region (point-min) (or (re-search-forward 
org-outline-regexp-bol nil t) (point-max)))
+      (org-fold-hide-drawer-all))
+    (goto-char (point-min))
+    (when (re-search-forward org-outline-regexp-bol nil t)
+      (let* ((last (line-end-position))
+             (level (- (match-end 0) (match-beginning 0) 1))
+             (regexp (format "^\\*\\{1,%d\\} " level)))
+        (while (re-search-forward regexp nil :move)
+          (org-fold-region last (line-end-position 0) t 'outline)
+          (setq last (line-end-position))
+          (setq level (- (match-end 0) (match-beginning 0) 1))
+          (setq regexp (format "^\\*\\{1,%d\\} " level)))
+        (org-fold-region last (point) t 'outline)))))
+
+(defun org-cycle-content (&optional arg)
+  "Show all headlines in the buffer, like a table of contents.
+With numerical argument N, show content up to level N."
+  (interactive "p")
+  (org-fold-show-all '(headings))
+  (save-excursion
+    (goto-char (point-min))
+    ;; Hide top-level drawer.
+    (save-restriction
+      (narrow-to-region (point-min) (or (re-search-forward 
org-outline-regexp-bol nil t) (point-max)))
+      (org-fold-hide-drawer-all))
+    (goto-char (point-max))
+    (let ((regexp (if (and (wholenump arg) (> arg 0))
+                      (format "^\\*\\{1,%d\\} " arg)
+                    "^\\*+ "))
+          (last (point)))
+      (while (re-search-backward regexp nil t)
+        (org-fold-region (line-end-position) last t 'outline)
+        (setq last (line-end-position 0))))))
+
+(defvar org-cycle-scroll-position-to-restore nil
+  "Temporarily store scroll position to restore.")
+(defun org-cycle-optimize-window-after-visibility-change (state)
+  "Adjust the window after a change in outline visibility.
+This function is the default value of the hook `org-cycle-hook'."
+  (when (get-buffer-window (current-buffer))
+    (let ((repeat (eq last-command this-command)))
+      (unless repeat
+       (setq org-cycle-scroll-position-to-restore nil))
+      (cond
+       ((eq state 'content)  nil)
+       ((eq state 'all)      nil)
+       ((and org-cycle-scroll-position-to-restore repeat
+            (eq state 'folded))
+       (set-window-start nil org-cycle-scroll-position-to-restore))
+       ((eq state 'folded) nil)
+       ((eq state 'children)
+       (setq org-cycle-scroll-position-to-restore (window-start))
+       (or (org-subtree-end-visible-p) (recenter 1)))
+       ((eq state 'subtree)
+        (unless repeat
+         (setq org-cycle-scroll-position-to-restore (window-start)))
+        (or (org-subtree-end-visible-p) (recenter 1)))))))
+
+(defun org-cycle-show-empty-lines (state)
+  "Show empty lines above all visible headlines.
+The region to be covered depends on STATE when called through
+`org-cycle-hook'.  Lisp program can use t for STATE to get the
+entire buffer covered.  Note that an empty line is only shown if there
+are at least `org-cycle-separator-lines' empty lines before the headline."
+  (when (/= org-cycle-separator-lines 0)
+    (save-excursion
+      (let* ((n (abs org-cycle-separator-lines))
+             (re (cond
+                  ((= n 1) "\\(\n[ \t]*\n\\*+\\) ")
+                  ((= n 2) "^[ \t]*\\(\n[ \t]*\n\\*+\\) ")
+                  (t (let ((ns (number-to-string (- n 2))))
+                       (concat "^\\(?:[ \t]*\n\\)\\{" ns "," ns "\\}"
+                               "[ \t]*\\(\n[ \t]*\n\\*+\\) ")))))
+             beg end)
+        (cond
+         ((memq state '(overview contents t))
+          (setq beg (point-min) end (point-max)))
+         ((memq state '(children folded))
+          (setq beg (point)
+                end (progn (org-end-of-subtree t t)
+                           (line-beginning-position 2)))))
+        (when beg
+          (goto-char beg)
+          (while (re-search-forward re end t)
+            (unless (org-invisible-p (match-end 1))
+              (let ((e (match-end 1))
+                    (b (if (>= org-cycle-separator-lines 0)
+                           (match-beginning 1)
+                         (save-excursion
+                           (goto-char (match-beginning 0))
+                           (skip-chars-backward " \t\n")
+                           (line-end-position)))))
+                (org-fold-region b e nil 'outline))))))))
+  ;; Never hide empty lines at the end of the file.
+  (save-excursion
+    (goto-char (point-max))
+    (outline-previous-heading)
+    (outline-end-of-heading)
+    (when (and (looking-at "[ \t\n]+")
+               (= (match-end 0) (point-max)))
+      (org-fold-region (point) (match-end 0) nil 'outline))))
+
+(defun org-cycle-hide-archived-subtrees (state)
+  "Re-hide all archived subtrees after a visibility state change.
+STATE should be one of the symbols listed in the docstring of
+`org-cycle-hook'."
+  (when (and (not org-cycle-open-archived-trees)
+             (not (memq state '(overview folded))))
+    (let ((globalp (memq state '(contents all))))
+      (if globalp
+          (org-fold-hide-archived-subtrees (point-min) (point-max))
+        (org-fold-hide-archived-subtrees
+         (point)
+         (save-excursion
+           (org-end-of-subtree t))))
+      (when (and (not globalp)
+                 (member org-archive-tag
+                         (org-get-tags nil 'local)))
+       (message "%s" (substitute-command-keys
+                      "Subtree is archived and stays closed.  Use \
+`\\[org-cycle-force-archived]' to cycle it anyway."))))))
+
+(defun org-cycle-display-inline-images (state)
+  "Auto display inline images under subtree when cycling.
+It works when `org-cycle-inline-images-display' is non-nil."
+  (when org-cycle-inline-images-display
+    (pcase state
+      ('children
+       (org-with-wide-buffer
+        (org-narrow-to-subtree)
+        ;; If has nested headlines, beg,end only from parent headline
+        ;; to first child headline which reference to upper
+        ;; let-binding `org-next-visible-heading'.
+        (org-display-inline-images
+         nil nil
+         (point-min) (progn (org-next-visible-heading 1) (point)))))
+      ('subtree
+       (org-with-wide-buffer
+        (org-narrow-to-subtree)
+        ;; If has nested headlines, also inline display images under all 
sub-headlines.
+        (org-display-inline-images nil nil (point-min) (point-max))))
+      ('folded
+       (org-with-wide-buffer
+        (org-narrow-to-subtree)
+        (if (numberp (point-max))
+            (org-remove-inline-images (point-min) (point-max))
+          (ignore)))))))
+
+(provide 'org-cycle)
+
+;;; org-cycle.el ends here
diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el
index 30f5f99aea..fb4df3cbe8 100644
--- a/lisp/org/org-datetree.el
+++ b/lisp/org/org-datetree.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -30,6 +30,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org)
 
 (defvar org-datetree-base-level 1
@@ -137,7 +140,7 @@ will be built under the headline at point."
     (let* ((year (calendar-extract-year d))
           (month (calendar-extract-month d))
           (day (calendar-extract-day d))
-          (time (encode-time 0 0 0 day month year))
+          (time (org-encode-time 0 0 0 day month year))
           (iso-date (calendar-iso-from-absolute
                      (calendar-absolute-from-gregorian d)))
           (weekyear (nth 2 iso-date))
@@ -185,8 +188,7 @@ inserted into the buffer."
 
 (defun org-datetree-insert-line (year &optional month day text)
   (delete-region (save-excursion (skip-chars-backward " \t\n") (point)) 
(point))
-  (when (assq 'heading org-blank-before-new-entry)
-    (insert "\n"))
+  (when (org--blank-before-heading-p) (insert "\n"))
   (insert "\n" (make-string org-datetree-base-level ?*) " \n")
   (backward-char)
   (when month (org-do-demote))
@@ -197,14 +199,14 @@ inserted into the buffer."
     (when month
       (insert
        (if day
-          (format-time-string "-%m-%d %A" (encode-time 0 0 0 day month year))
-        (format-time-string "-%m %B" (encode-time 0 0 0 1 month year))))))
+          (format-time-string "-%m-%d %A" (org-encode-time 0 0 0 day month 
year))
+        (format-time-string "-%m %B" (org-encode-time 0 0 0 1 month year))))))
   (when (and day org-datetree-add-timestamp)
     (save-excursion
       (insert "\n")
       (org-indent-line)
       (org-insert-time-stamp
-       (encode-time 0 0 0 day month year)
+       (org-encode-time 0 0 0 day month year)
        nil
        (eq org-datetree-add-timestamp 'inactive))))
   (beginning-of-line))
diff --git a/lisp/org/org-duration.el b/lisp/org/org-duration.el
index 6d55ba8840..6d6b8b5cf1 100644
--- a/lisp/org/org-duration.el
+++ b/lisp/org/org-duration.el
@@ -51,6 +51,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org-macs)
 
@@ -98,7 +101,7 @@ sure to call the following command:
   :version "26.1"
   :package-version '(Org . "9.1")
   :set (lambda (var val)
-         (set-default var val)
+         (set-default-toplevel-value var val)
          ;; Avoid recursive load at startup.
         (when (featurep 'org-duration)
            (org-duration-set-regexps)))
@@ -284,30 +287,31 @@ translated into 0.0.
 
 Return value as a float.  Raise an error if duration format is
 not recognized."
-  (cond
-   ((equal duration "") 0.0)
-   ((numberp duration) (float duration))
-   ((string-match-p org-duration--h:mm-re duration)
-    (pcase-let ((`(,hours ,minutes ,seconds)
-                (mapcar #'string-to-number (split-string duration ":"))))
-      (+ (/ (or seconds 0) 60.0) minutes (* 60 hours))))
-   ((string-match-p org-duration--full-re duration)
-    (let ((minutes 0)
-         (s 0))
-      (while (string-match org-duration--unit-re duration s)
-       (setq s (match-end 0))
-       (let ((value (string-to-number (match-string 1 duration)))
-             (unit (match-string 2 duration)))
-         (cl-incf minutes (* value (org-duration--modifier unit canonical)))))
-      (float minutes)))
-   ((string-match org-duration--mixed-re duration)
-    (let ((units-part (match-string 1 duration))
-         (hms-part (match-string 2 duration)))
-      (+ (org-duration-to-minutes units-part)
-        (org-duration-to-minutes hms-part))))
-   ((string-match-p "\\`[0-9]+\\(\\.[0-9]*\\)?\\'" duration)
-    (float (string-to-number duration)))
-   (t (error "Invalid duration format: %S" duration))))
+  (save-match-data
+    (cond
+     ((equal duration "") 0.0)
+     ((numberp duration) (float duration))
+     ((string-match-p org-duration--h:mm-re duration)
+      (pcase-let ((`(,hours ,minutes ,seconds)
+                  (mapcar #'string-to-number (split-string duration ":"))))
+        (+ (/ (or seconds 0) 60.0) minutes (* 60 hours))))
+     ((string-match-p org-duration--full-re duration)
+      (let ((minutes 0)
+           (s 0))
+        (while (string-match org-duration--unit-re duration s)
+         (setq s (match-end 0))
+         (let ((value (string-to-number (match-string 1 duration)))
+               (unit (match-string 2 duration)))
+           (cl-incf minutes (* value (org-duration--modifier unit 
canonical)))))
+        (float minutes)))
+     ((string-match org-duration--mixed-re duration)
+      (let ((units-part (match-string 1 duration))
+           (hms-part (match-string 2 duration)))
+        (+ (org-duration-to-minutes units-part)
+          (org-duration-to-minutes hms-part))))
+     ((string-match-p "\\`[0-9]+\\(\\.[0-9]*\\)?\\'" duration)
+      (float (string-to-number duration)))
+     (t (error "Invalid duration format: %S" duration)))))
 
 ;;;###autoload
 (defun org-duration-from-minutes (minutes &optional fmt canonical)
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index 474a93577a..71c242ea65 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -58,54 +58,45 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'avl-tree)
+(require 'ring)
 (require 'cl-lib)
 (require 'ol)
 (require 'org)
+(require 'org-persist)
 (require 'org-compat)
 (require 'org-entities)
 (require 'org-footnote)
 (require 'org-list)
 (require 'org-macs)
 (require 'org-table)
+(require 'org-fold-core)
 
 (declare-function org-at-heading-p "org" (&optional _))
-(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
 (declare-function org-escape-code-in-string "org-src" (s))
 (declare-function org-macro-escape-arguments "org-macro" (&rest args))
 (declare-function org-macro-extract-arguments "org-macro" (s))
 (declare-function org-reduced-level "org" (l))
 (declare-function org-unescape-code-in-string "org-src" (s))
+(declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
 (declare-function outline-next-heading "outline" ())
 (declare-function outline-previous-heading "outline" ())
 
-(defvar org-archive-tag)
-(defvar org-clock-line-re)
-(defvar org-closed-string)
-(defvar org-comment-string)
 (defvar org-complex-heading-regexp)
-(defvar org-dblock-start-re)
-(defvar org-deadline-string)
 (defvar org-done-keywords)
-(defvar org-drawer-regexp)
 (defvar org-edit-src-content-indentation)
-(defvar org-emph-re)
-(defvar org-emphasis-regexp-components)
-(defvar org-keyword-time-not-clock-regexp)
 (defvar org-match-substring-regexp)
 (defvar org-odd-levels-only)
-(defvar org-outline-regexp-bol)
-(defvar org-planning-line-re)
 (defvar org-property-drawer-re)
 (defvar org-property-format)
 (defvar org-property-re)
-(defvar org-scheduled-string)
 (defvar org-src-preserve-indentation)
 (defvar org-tags-column)
-(defvar org-time-stamp-formats)
 (defvar org-todo-regexp)
 (defvar org-ts-regexp-both)
-(defvar org-verbatim-re)
 
 
 ;;; Definitions And Rules
@@ -117,6 +108,9 @@
 ;; `org-element-update-syntax' builds proper syntax regexps according
 ;; to current setup.
 
+(defconst org-element-archive-tag "ARCHIVE"
+  "Tag marking a substree as archived.")
+
 (defconst org-element-citation-key-re
   (rx "@" (group (one-or-more (any word "-.:?!`'/*@+|(){}<>&_^$#%~"))))
   "Regexp matching a citation key.
@@ -130,6 +124,66 @@ Key is located in match group 1.")
   "Regexp matching a citation prefix.
 Style, if any, is located in match group 1.")
 
+(defconst org-element-clock-line-re
+  (rx-to-string
+   `(seq
+     line-start (0+ (or ?\t ?\s))
+     "CLOCK: "
+     (regexp ,org-ts-regexp-inactive)
+     (opt "--"
+          (regexp ,org-ts-regexp-inactive)
+          (1+ (or ?\t ?\s)) "=>" (1+ (or ?\t ?\s))
+          (1+ digit) ":" digit digit)
+     (0+ (or ?\t ?\s))
+     line-end))
+  "Regexp matching a clock line.")
+
+(defconst org-element-comment-string "COMMENT"
+  "String marker for commented headlines.")
+
+(defconst org-element-closed-keyword "CLOSED:"
+  "Keyword used to close TODO entries.")
+
+(defconst org-element-deadline-keyword "DEADLINE:"
+  "Keyword used to mark deadline entries.")
+
+(defconst org-element-scheduled-keyword "SCHEDULED:"
+  "Keyword used to mark scheduled entries.")
+
+(defconst org-element-planning-keywords-re
+  (regexp-opt (list org-element-closed-keyword
+                    org-element-deadline-keyword
+                    org-element-scheduled-keyword))
+  "Regexp matching any planning line keyword.")
+
+(defconst org-element-planning-line-re
+  (rx-to-string
+   `(seq line-start (0+ (any ?\s ?\t))
+         (group (regexp ,org-element-planning-keywords-re))))
+  "Regexp matching a planning line.")
+
+(defconst org-element-drawer-re
+  (rx line-start (0+ (any ?\s ?\t))
+      ":" (group (1+ (any ?- ?_ word))) ":"
+      (0+ (any ?\s ?\t)) line-end)
+  "Regexp matching opening or closing line of a drawer.
+Drawer's name is located in match group 1.")
+
+(defconst org-element-dynamic-block-open-re
+  (rx line-start (0+ (any ?\s ?\t))
+      "#+BEGIN:" (0+ (any ?\s ?\t))
+      (group (1+ word))
+      (opt
+       (1+ (any ?\s ?\t))
+       (group (1+ nonl))))
+  "Regexp matching the opening line of a dynamic block.
+Dynamic block's name is located in match group 1.
+Parameters are in match group 2.")
+
+(defconst org-element-headline-re
+  (rx line-start (1+ "*") " ")
+  "Regexp matching a headline.")
+
 (defvar org-element-paragraph-separate nil
   "Regexp to separate paragraphs in an Org buffer.
 In the case of lines starting with \"#\" and \":\", this regexp
@@ -174,7 +228,7 @@ specially in `org-element--object-lex'.")
                ;; LaTeX environments.
                "\\\\begin{\\([A-Za-z0-9*]+\\)}" "\\|"
                ;; Clock lines.
-               "CLOCK:" "\\|"
+               org-element-clock-line-re "\\|"
                ;; Lists.
                (let ((term (pcase org-plain-list-ordered-item-terminator
                              (?\) ")") (?. "\\.") (_ "[.)]")))
@@ -190,9 +244,7 @@ specially in `org-element--object-lex'.")
                      "\\(?:[_^][-{(*+.,[:alnum:]]\\)"
                      ;; Bold, code, italic, strike-through, underline
                      ;; and verbatim.
-                     (concat "[*~=+_/]"
-                             (format "[^%s]"
-                                     (nth 2 org-emphasis-regexp-components)))
+                      (rx (or "*" "~" "=" "+" "_" "/") (not space))
                      ;; Plain links.
                      (concat "\\<" link-types ":")
                      ;; Objects starting with "[": citations,
@@ -245,7 +297,7 @@ specially in `org-element--object-lex'.")
 (defconst org-element-greater-elements
   '(center-block drawer dynamic-block footnote-definition headline inlinetask
                 item plain-list property-drawer quote-block section
-                special-block table)
+                special-block table org-data)
   "List of recursive element types aka Greater Elements.")
 
 (defconst org-element-all-objects
@@ -550,7 +602,8 @@ Return parent element."
     ;; Link every child to PARENT. If PARENT is nil, it is a secondary
     ;; string: parent is the list itself.
     (dolist (child children)
-      (org-element-put-property child :parent (or parent children)))
+      (when child
+        (org-element-put-property child :parent (or parent children))))
     ;; Add CHILDREN at the end of PARENT contents.
     (when parent
       (apply #'org-element-set-contents
@@ -606,11 +659,19 @@ Parse tree is modified by side effect."
     ;; Set appropriate :parent property.
     (org-element-put-property element :parent parent)))
 
+(defconst org-element--cache-element-properties
+  '(:cached
+    :org-element--cache-sync-key)
+  "List of element properties used internally by cache.")
+
 (defun org-element-set-element (old new)
   "Replace element or object OLD with element or object NEW.
 The function takes care of setting `:parent' property for NEW."
   ;; Ensure OLD and NEW have the same parent.
   (org-element-put-property new :parent (org-element-property :parent old))
+  (dolist (p org-element--cache-element-properties)
+    (when (org-element-property p old)
+      (org-element-put-property new p (org-element-property p old))))
   (if (or (memq (org-element-type old) '(plain-text nil))
          (memq (org-element-type new) '(plain-text nil)))
       ;; We cannot replace OLD with NEW since one of them is not an
@@ -647,7 +708,21 @@ is cleared and contents are removed in the process."
        (`plain-text (substring-no-properties datum))
        (`nil (copy-sequence datum))
        (_
-        (list type (plist-put (copy-sequence (nth 1 datum)) :parent nil)))))))
+         (let ((element-copy (list type (plist-put (copy-sequence (nth 1 
datum)) :parent nil))))
+           ;; We cannot simply return the copies property list.  When
+           ;; DATUM is i.e. a headline, it's property list (`:title'
+           ;; in case of headline) can contain parsed objects.  The
+           ;; objects will contain `:parent' property set to the DATUM
+           ;; itself.  When copied, these inner `:parent' property
+           ;; values will contain incorrect object decoupled from
+           ;; DATUM.  Changes to the DATUM copy will not longer be
+           ;; reflected in the `:parent' properties.  So, we need to
+           ;; reassign inner `:parent' properties to the DATUM copy
+           ;; explicitly.
+           (org-element-map element-copy (cons 'plain-text 
org-element-all-objects)
+             (lambda (obj) (when (equal datum (org-element-property :parent 
obj))
+                        (org-element-put-property obj :parent element-copy))))
+           element-copy))))))
 
 
 
@@ -758,8 +833,10 @@ Assume point is at beginning of drawer."
        (org-element-paragraph-parser limit affiliated)
       (save-excursion
        (let* ((drawer-end-line (match-beginning 0))
-              (name (progn (looking-at org-drawer-regexp)
-                           (match-string-no-properties 1)))
+              (name
+                (progn
+                  (looking-at org-element-drawer-re)
+                 (match-string-no-properties 1)))
               (begin (car affiliated))
               (post-affiliated (point))
               ;; Empty drawers have no contents.
@@ -814,9 +891,10 @@ Assume point is at beginning of dynamic block."
        (org-element-paragraph-parser limit affiliated)
       (let ((block-end-line (match-beginning 0)))
        (save-excursion
-         (let* ((name (progn (looking-at org-dblock-start-re)
-                             (match-string-no-properties 1)))
-                (arguments (match-string-no-properties 3))
+         (let* ((name (progn
+                         (looking-at org-element-dynamic-block-open-re)
+                        (match-string-no-properties 1)))
+                (arguments (match-string-no-properties 2))
                 (begin (car affiliated))
                 (post-affiliated (point))
                 ;; Empty blocks have no contents.
@@ -854,7 +932,7 @@ CONTENTS is the contents of the element."
 ;;;; Footnote Definition
 
 (defconst org-element--footnote-separator
-  (concat org-outline-regexp-bol "\\|"
+  (concat org-element-headline-re "\\|"
          org-footnote-definition-re "\\|"
          "^\\([ \t]*\n\\)\\{2,\\}")
   "Regexp used as a footnote definition separator.")
@@ -938,24 +1016,40 @@ CONTENTS is the contents of the footnote-definition."
            (if (= pre-blank 0) (concat " " (org-trim contents))
              (concat (make-string pre-blank ?\n) contents)))))
 
-
 ;;;; Headline
 
-(defun org-element--get-node-properties ()
-  "Return node properties associated to headline at point.
+(defun org-element--get-node-properties (&optional at-point-p?)
+  "Return node properties for headline or property drawer at point.
 Upcase property names.  It avoids confusion between properties
 obtained through property drawer and default properties from the
-parser (e.g. `:end' and :END:).  Return value is a plist."
+parser (e.g. `:end' and :END:).  Return value is a plist.
+
+When AT-POINT-P? is nil, assume that point as at a headline.  Otherwise
+parse properties for property drawer at point."
   (save-excursion
-    (forward-line)
-    (when (looking-at-p org-planning-line-re) (forward-line))
+    (unless at-point-p?
+      (forward-line)
+      (when (looking-at-p org-element-planning-line-re) (forward-line)))
     (when (looking-at org-property-drawer-re)
       (forward-line)
       (let ((end (match-end 0)) properties)
        (while (< (line-end-position) end)
          (looking-at org-property-re)
-         (push (match-string-no-properties 3) properties)
-         (push (intern (concat ":" (upcase (match-string 2)))) properties)
+          (let* ((property-name (concat ":" (upcase (match-string 2))))
+                 (property-name-symbol (intern property-name))
+                 (property-value (match-string-no-properties 3)))
+            (cond
+             ((and (plist-member properties property-name-symbol)
+                   (string-match-p "\\+$" property-name))
+              (let ((val (plist-get properties property-name-symbol)))
+                (if (listp val)
+                    (setq properties
+                          (plist-put properties
+                                     property-name-symbol
+                                     (append (plist-get properties 
property-name-symbol)
+                                             (list property-value))))
+                  (plist-put properties property-name-symbol (list val 
property-value)))))
+             (t (setq properties (plist-put properties property-name-symbol 
property-value)))))
          (forward-line))
        properties))))
 
@@ -963,21 +1057,21 @@ parser (e.g. `:end' and :END:).  Return value is a 
plist."
   "Return time properties associated to headline at point.
 Return value is a plist."
   (save-excursion
-    (when (progn (forward-line) (looking-at org-planning-line-re))
-      (let ((end (line-end-position)) plist)
-       (while (re-search-forward org-keyword-time-not-clock-regexp end t)
-         (goto-char (match-end 1))
+    (when (progn (forward-line) (looking-at org-element-planning-line-re))
+      (let ((end (line-end-position))
+            plist)
+       (while (re-search-forward org-element-planning-keywords-re end t)
          (skip-chars-forward " \t")
-         (let ((keyword (match-string 1))
+         (let ((keyword (match-string 0))
                (time (org-element-timestamp-parser)))
-           (cond ((equal keyword org-scheduled-string)
+           (cond ((equal keyword org-element-scheduled-keyword)
                   (setq plist (plist-put plist :scheduled time)))
-                 ((equal keyword org-deadline-string)
+                 ((equal keyword org-element-deadline-keyword)
                   (setq plist (plist-put plist :deadline time)))
                  (t (setq plist (plist-put plist :closed time))))))
        plist))))
 
-(defun org-element-headline-parser (limit &optional raw-secondary-p)
+(defun org-element-headline-parser (&optional _ raw-secondary-p)
   "Parse a headline.
 
 Return a list whose CAR is `headline' and CDR is a plist
@@ -992,16 +1086,15 @@ The plist also contains any property set in the property 
drawer,
 with its name in upper cases and colons added at the
 beginning (e.g., `:CUSTOM_ID').
 
-LIMIT is a buffer position bounding the search.
-
 When RAW-SECONDARY-P is non-nil, headline's title will not be
 parsed as a secondary string, but as a plain string instead.
 
 Assume point is at beginning of the headline."
   (save-excursion
     (let* ((begin (point))
-          (level (prog1 (org-reduced-level (skip-chars-forward "*"))
-                   (skip-chars-forward " \t")))
+           (true-level (prog1 (skip-chars-forward "*")
+                         (skip-chars-forward " \t")))
+          (level (org-reduced-level true-level))
           (todo (and org-todo-regexp
                      (let (case-fold-search) (looking-at (concat 
org-todo-regexp " ")))
                      (progn (goto-char (match-end 0))
@@ -1013,8 +1106,11 @@ Assume point is at beginning of the headline."
                          (progn (goto-char (match-end 0))
                                 (aref (match-string 0) 2))))
           (commentedp
-           (and (let (case-fold-search) (looking-at org-comment-string))
-                (goto-char (match-end 0))))
+           (and (let ((case-fold-search nil))
+                   (looking-at org-element-comment-string))
+                (goto-char (match-end 0))
+                 (when (looking-at-p "\\(?:[ \t]\\|$\\)")
+                   (point))))
           (title-start (prog1 (point)
                           (unless (or todo priority commentedp)
                             ;; Headline like "* :tag:"
@@ -1028,12 +1124,18 @@ Assume point is at beginning of the headline."
           (title-end (point))
           (raw-value (org-trim
                       (buffer-substring-no-properties title-start title-end)))
-          (archivedp (member org-archive-tag tags))
+          (archivedp (member org-element-archive-tag tags))
           (footnote-section-p (and org-footnote-section
                                    (string= org-footnote-section raw-value)))
           (standard-props (org-element--get-node-properties))
           (time-props (org-element--get-time-properties))
-          (end (min (save-excursion (org-end-of-subtree t t)) limit))
+          (end
+            (save-excursion
+              (let ((re (rx-to-string
+                         `(seq line-start (** 1 ,true-level "*") " "))))
+                (if (re-search-forward re nil t)
+                    (line-beginning-position)
+                  (point-max)))))
           (contents-begin (save-excursion
                             (forward-line)
                             (skip-chars-forward " \r\t\n" end)
@@ -1041,7 +1143,24 @@ Assume point is at beginning of the headline."
           (contents-end (and contents-begin
                              (progn (goto-char end)
                                     (skip-chars-backward " \r\t\n")
-                                    (line-beginning-position 2)))))
+                                    (line-beginning-position 2))))
+           (robust-begin (and contents-begin
+                              (progn (goto-char contents-begin)
+                                     (when (looking-at-p 
org-element-planning-line-re)
+                                       (forward-line))
+                                     (when (looking-at org-property-drawer-re)
+                                       (goto-char (match-end 0)))
+                                     ;; If there is :pre-blank, we
+                                     ;; need to be careful about
+                                     ;; robust beginning.
+                                     (max (if (< (+ 2 contents-begin) 
contents-end)
+                                              (+ 2 contents-begin)
+                                            0)
+                                          (point)))))
+           (robust-end (and robust-begin
+                            (when (> (- contents-end 2) robust-begin)
+                              (- contents-end 2)))))
+      (unless robust-end (setq robust-begin nil))
       (let ((headline
             (list 'headline
                   (nconc
@@ -1053,6 +1172,8 @@ Assume point is at beginning of the headline."
                            (1- (count-lines begin contents-begin)))
                          :contents-begin contents-begin
                          :contents-end contents-end
+                          :robust-begin robust-begin
+                          :robust-end robust-end
                          :level level
                          :priority priority
                          :tags tags
@@ -1099,7 +1220,7 @@ CONTENTS is the contents of the element."
          (concat (make-string (if org-odd-levels-only (1- (* level 2)) level)
                               ?*)
                  (and todo (concat " " todo))
-                 (and commentedp (concat " " org-comment-string))
+                 (and commentedp (concat " " org-element-comment-string))
                  (and priority (format " [#%c]" priority))
                  " "
                  (if (and org-footnote-section
@@ -1125,6 +1246,89 @@ CONTENTS is the contents of the element."
      (make-string (1+ pre-blank) ?\n)
      contents)))
 
+;;;; org-data
+
+(defun org-element--get-global-node-properties ()
+  "Return node properties associated with the whole Org buffer.
+Upcase property names.  It avoids confusion between properties
+obtained through property drawer and default properties from the
+parser (e.g. `:end' and :END:).  Return value is a plist."
+  (org-with-wide-buffer
+   (goto-char (point-min))
+   (while (and (org-at-comment-p) (bolp)) (forward-line))
+   (org-element--get-node-properties t)))
+
+
+(defvar org-element-org-data-parser--recurse nil)
+(defun org-element-org-data-parser (&optional _)
+  "Parse org-data."
+  (org-with-wide-buffer
+   (let* ((begin 1)
+          (contents-begin (progn
+                            (goto-char 1)
+                            (org-skip-whitespace)
+                            (beginning-of-line)
+                            (point)))
+         (end (point-max))
+         (pos-before-blank (progn (goto-char (point-max))
+                                   (skip-chars-backward " \r\t\n")
+                                   (line-beginning-position 2)))
+          (robust-end (when (> (- pos-before-blank 2) contents-begin)
+                        (- pos-before-blank 2)))
+          (robust-begin (when (and robust-end
+                                   (< (+ 2 contents-begin) pos-before-blank))
+                          (or
+                           (org-with-wide-buffer
+                            (goto-char (point-min))
+                            (while (and (org-at-comment-p) (bolp)) 
(forward-line))
+                            (when (looking-at org-property-drawer-re)
+                              (goto-char (match-end 0))
+                              (skip-chars-backward " \t")
+                              (min robust-end (point))))
+                           (+ 2 contents-begin))))
+          (category (cond ((null org-category)
+                          (when (org-with-base-buffer nil
+                                   buffer-file-name)
+                            (file-name-sans-extension
+                             (file-name-nondirectory
+                               (org-with-base-buffer nil
+                                 buffer-file-name)))))
+                         ((symbolp org-category) (symbol-name org-category))
+                         (t org-category)))
+          (category (catch 'buffer-category
+                      (unless org-element-org-data-parser--recurse
+                        (org-with-point-at end
+                          ;; Avoid recursive calls from
+                          ;; `org-element-at-point-no-context'.
+                          (let ((org-element-org-data-parser--recurse t))
+                           (while (re-search-backward "^[ \t]*#\\+CATEGORY:" 
(point-min) t)
+                              (org-element-with-disabled-cache
+                               (let ((element 
(org-element-at-point-no-context)))
+                                 (when (eq (org-element-type element) 'keyword)
+                                   (throw 'buffer-category
+                                          (org-element-property :value 
element)))))))))
+                     category))
+          (properties (org-element--get-global-node-properties)))
+     (unless (plist-get properties :CATEGORY)
+       (setq properties (plist-put properties :CATEGORY category)))
+     (list 'org-data
+           (nconc
+            (list :begin begin
+                  :contents-begin contents-begin
+                  :contents-end pos-before-blank
+                  :end end
+                  :robust-begin robust-begin
+                  :robust-end robust-end
+                  :post-blank (count-lines pos-before-blank end)
+                  :post-affiliated begin
+                  :path (buffer-file-name)
+                  :mode 'org-data)
+            properties)))))
+
+(defun org-element-org-data-interpreter (_ contents)
+  "Interpret ORG-DATA element as Org syntax.
+CONTENTS is the contents of the element."
+  contents)
 
 ;;;; Inlinetask
 
@@ -1173,7 +1377,7 @@ Assume point is at beginning of the inline task."
                       (buffer-substring-no-properties title-start title-end)))
           (task-end (save-excursion
                       (end-of-line)
-                      (and (re-search-forward org-outline-regexp-bol limit t)
+                      (and (re-search-forward org-element-headline-re limit t)
                            (looking-at-p "[ \t]*END[ \t]*$")
                            (line-beginning-position))))
           (standard-props (and task-end (org-element--get-node-properties)))
@@ -1394,7 +1598,12 @@ CONTENTS is the contents of the element."
   (let ((case-fold-search t)
        (top-ind limit)
        (item-re (org-item-re))
-       (inlinetask-re (and (featurep 'org-inlinetask) "^\\*+ "))
+       (inlinetask-re (and (featurep 'org-inlinetask)
+                            (boundp 'org-inlinetask-min-level)
+                            (boundp 'org-inlinetask-max-level)
+                            (format "^\\*\\{%d,%d\\}+ "
+                                    org-inlinetask-min-level
+                                    org-inlinetask-max-level)))
        items struct)
     (save-excursion
       (catch :exit
@@ -1413,7 +1622,7 @@ CONTENTS is the contents of the element."
           ;; At a new item: end previous sibling.
           ((looking-at item-re)
            (let ((ind (save-excursion (skip-chars-forward " \t")
-                                      (current-column))))
+                                      (org-current-text-column))))
              (setq top-ind (min top-ind ind))
              (while (and items (<= ind (nth 1 (car items))))
                (let ((item (pop items)))
@@ -1447,7 +1656,7 @@ CONTENTS is the contents of the element."
           (t
            (let ((ind (save-excursion
                         (skip-chars-forward " \t")
-                        (current-column)))
+                        (org-current-text-column)))
                  (end (save-excursion
                         (skip-chars-backward " \r\t\n")
                         (line-beginning-position 2))))
@@ -1463,7 +1672,7 @@ CONTENTS is the contents of the element."
                   (re-search-forward
                    (format "^[ \t]*#\\+END%s[ \t]*$" (match-string 1))
                    limit t)))
-            ((and (looking-at org-drawer-regexp)
+            ((and (looking-at org-element-drawer-re)
                   (re-search-forward "^[ \t]*:END:[ \t]*$" limit t))))
            (forward-line))))))))
 
@@ -1619,16 +1828,22 @@ containing `:begin', `:end', `:contents-begin', 
`contents-end',
   (save-excursion
     ;; Beginning of section is the beginning of the first non-blank
     ;; line after previous headline.
-    (let ((begin (point))
-         (end (progn (org-with-limited-levels (outline-next-heading))
-                     (point)))
-         (pos-before-blank (progn (skip-chars-backward " \r\t\n")
-                                  (line-beginning-position 2))))
+    (let* ((begin (point))
+          (end (progn (org-with-limited-levels (outline-next-heading))
+                      (point)))
+          (pos-before-blank (progn (skip-chars-backward " \r\t\n")
+                                   (line-beginning-position 2)))
+           (robust-end (when (> (- pos-before-blank 2) begin)
+                         (- pos-before-blank 2)))
+           (robust-begin (when robust-end begin))
+           )
       (list 'section
            (list :begin begin
                  :end end
                  :contents-begin begin
                  :contents-end pos-before-blank
+                  :robust-begin robust-begin
+                  :robust-end robust-end
                  :post-blank (count-lines pos-before-blank end)
                  :post-affiliated begin)))))
 
@@ -1649,13 +1864,15 @@ keyword and CDR is a plist of affiliated keywords along 
with
 their value.
 
 Return a list whose CAR is `special-block' and CDR is a plist
-containing `:type', `:begin', `:end', `:contents-begin',
-`:contents-end', `:post-blank' and `:post-affiliated' keywords.
+containing `:type', `:parameters', `:begin', `:end',
+`:contents-begin', `:contents-end', `:post-blank' and
+`:post-affiliated' keywords.
 
 Assume point is at the beginning of the block."
   (let* ((case-fold-search t)
-        (type (progn (looking-at "[ \t]*#\\+BEGIN_\\(\\S-+\\)")
-                     (match-string-no-properties 1))))
+        (type (progn (looking-at "[ \t]*#\\+BEGIN_\\(\\S-+\\)[ \t]*\\(.*\\)[ 
\t]*$")
+                     (match-string-no-properties 1)))
+        (parameters (match-string-no-properties 2)))
     (if (not (save-excursion
               (re-search-forward
                (format "^[ \t]*#\\+END_%s[ \t]*$" (regexp-quote type))
@@ -1679,6 +1896,8 @@ Assume point is at the beginning of the block."
            (list 'special-block
                  (nconc
                   (list :type type
+                        :parameters (and (org-string-nw-p parameters)
+                                         (org-trim parameters))
                         :begin begin
                         :end end
                         :contents-begin contents-begin
@@ -1690,8 +1909,11 @@ Assume point is at the beginning of the block."
 (defun org-element-special-block-interpreter (special-block contents)
   "Interpret SPECIAL-BLOCK element as Org syntax.
 CONTENTS is the contents of the element."
-  (let ((block-type (org-element-property :type special-block)))
-    (format "#+begin_%s\n%s#+end_%s" block-type contents block-type)))
+  (let ((block-type (org-element-property :type special-block))
+        (parameters (org-element-property :parameters special-block)))
+    (format "#+begin_%s%s\n%s#+end_%s" block-type
+            (if parameters (concat " " parameters) "")
+            (or contents "") block-type)))
 
 
 
@@ -2347,7 +2569,7 @@ Assume point is at the beginning of the paragraph."
                       ((not (and (re-search-forward
                                   org-element-paragraph-separate limit 'move)
                                  (progn (beginning-of-line) t))))
-                      ((looking-at org-drawer-regexp)
+                      ((looking-at org-element-drawer-re)
                        (save-excursion
                          (re-search-forward "^[ \t]*:END:[ \t]*$" limit t)))
                       ((looking-at "[ \t]*#\\+BEGIN_\\(\\S-+\\)")
@@ -2412,14 +2634,14 @@ containing `:closed', `:deadline', `:scheduled', 
`:begin',
           (end (point))
           closed deadline scheduled)
       (goto-char begin)
-      (while (re-search-forward org-keyword-time-not-clock-regexp end t)
-       (goto-char (match-end 1))
+      (while (re-search-forward org-element-planning-keywords-re end t)
        (skip-chars-forward " \t" end)
-       (let ((keyword (match-string 1))
+       (let ((keyword (match-string 0))
              (time (org-element-timestamp-parser)))
-         (cond ((equal keyword org-closed-string) (setq closed time))
-               ((equal keyword org-deadline-string) (setq deadline time))
-               (t (setq scheduled time)))))
+         (cond
+           ((equal keyword org-element-closed-keyword) (setq closed time))
+          ((equal keyword org-element-deadline-keyword) (setq deadline time))
+          (t (setq scheduled time)))))
       (list 'planning
            (list :closed closed
                  :deadline deadline
@@ -2436,15 +2658,15 @@ containing `:closed', `:deadline', `:scheduled', 
`:begin',
    (delq nil
         (list (let ((deadline (org-element-property :deadline planning)))
                 (when deadline
-                  (concat org-deadline-string " "
+                  (concat org-element-deadline-keyword " "
                           (org-element-timestamp-interpreter deadline nil))))
               (let ((scheduled (org-element-property :scheduled planning)))
                 (when scheduled
-                  (concat org-scheduled-string " "
+                  (concat org-element-scheduled-keyword " "
                           (org-element-timestamp-interpreter scheduled nil))))
               (let ((closed (org-element-property :closed planning)))
                 (when closed
-                  (concat org-closed-string " "
+                  (concat org-element-closed-keyword " "
                           (org-element-timestamp-interpreter closed nil))))))
    " "))
 
@@ -2739,6 +2961,50 @@ CONTENTS is verse block contents."
 
 ;;;; Bold
 
+(defun org-element--parse-generic-emphasis (mark type)
+  "Parse emphasis object at point, if any.
+
+MARK is the delimiter string used.  TYPE is a symbol among
+`bold', `code', `italic', `strike-through', `underline', and
+`verbatim'.
+
+Assume point is at first MARK."
+  (save-excursion
+    (let ((origin (point)))
+      (unless (bolp) (forward-char -1))
+      (let ((opening-re
+             (rx-to-string
+              `(seq (or line-start (any space ?- ?\( ?' ?\" ?\{))
+                    ,mark
+                    (not space)))))
+        (when (looking-at opening-re)
+          (goto-char (1+ origin))
+          (let ((closing-re
+                 (rx-to-string
+                  `(seq
+                    (not space)
+                    (group ,mark)
+                    (or (any space ?- ?. ?, ?\; ?: ?! ?? ?' ?\" ?\) ?\} ?\\ 
?\[)
+                        line-end)))))
+            (when (re-search-forward closing-re nil t)
+              (let ((closing (match-end 1)))
+                (goto-char closing)
+                (let* ((post-blank (skip-chars-forward " \t"))
+                       (contents-begin (1+ origin))
+                       (contents-end (1- closing)))
+                  (list type
+                        (append
+                         (list :begin origin
+                               :end (point)
+                               :post-blank post-blank)
+                         (if (memq type '(code verbatim))
+                             (list :value
+                                   (and (memq type '(code verbatim))
+                                        (buffer-substring
+                                         contents-begin contents-end)))
+                           (list :contents-begin contents-begin
+                                 :contents-end contents-end)))))))))))))
+
 (defun org-element-bold-parser ()
   "Parse bold object at point, if any.
 
@@ -2748,21 +3014,7 @@ is a plist with `:begin', `:end', `:contents-begin' and
 nil.
 
 Assume point is at the first star marker."
-  (save-excursion
-    (unless (bolp) (backward-char 1))
-    (when (looking-at org-emph-re)
-      (let ((begin (match-beginning 2))
-           (contents-begin (match-beginning 4))
-           (contents-end (match-end 4))
-           (post-blank (progn (goto-char (match-end 2))
-                              (skip-chars-forward " \t")))
-           (end (point)))
-       (list 'bold
-             (list :begin begin
-                   :end end
-                   :contents-begin contents-begin
-                   :contents-end contents-end
-                   :post-blank post-blank))))))
+  (org-element--parse-generic-emphasis "*" 'bold))
 
 (defun org-element-bold-interpreter (_ contents)
   "Interpret bold object as Org syntax.
@@ -2903,19 +3155,7 @@ is a plist with `:value', `:begin', `:end' and 
`:post-blank'
 keywords.  Otherwise, return nil.
 
 Assume point is at the first tilde marker."
-  (save-excursion
-    (unless (bolp) (backward-char 1))
-    (when (looking-at org-verbatim-re)
-      (let ((begin (match-beginning 2))
-           (value (match-string-no-properties 4))
-           (post-blank (progn (goto-char (match-end 2))
-                              (skip-chars-forward " \t")))
-           (end (point)))
-       (list 'code
-             (list :value value
-                   :begin begin
-                   :end end
-                   :post-blank post-blank))))))
+  (org-element--parse-generic-emphasis "~" 'code))
 
 (defun org-element-code-interpreter (code _)
   "Interpret CODE object as Org syntax."
@@ -2980,8 +3220,9 @@ Assume point is at the beginning of the snippet."
       (when (and (looking-at "@@\\([-A-Za-z0-9]+\\):")
                 (setq contents-end
                       (save-match-data (goto-char (match-end 0))
-                                       (re-search-forward "@@" nil t)
-                                       (match-beginning 0))))
+                                        (when
+                                           (re-search-forward "@@" nil t)
+                                         (match-beginning 0)))))
        (let* ((begin (match-beginning 0))
               (back-end (match-string-no-properties 1))
               (value (buffer-substring-no-properties
@@ -3149,21 +3390,7 @@ cdr is a plist with `:begin', `:end', `:contents-begin' 
and
 nil.
 
 Assume point is at the first slash marker."
-  (save-excursion
-    (unless (bolp) (backward-char 1))
-    (when (looking-at org-emph-re)
-      (let ((begin (match-beginning 2))
-           (contents-begin (match-beginning 4))
-           (contents-end (match-end 4))
-           (post-blank (progn (goto-char (match-end 2))
-                              (skip-chars-forward " \t")))
-           (end (point)))
-       (list 'italic
-             (list :begin begin
-                   :end end
-                   :contents-begin contents-begin
-                   :contents-end contents-end
-                   :post-blank post-blank))))))
+  (org-element--parse-generic-emphasis "/" 'italic))
 
 (defun org-element-italic-interpreter (_ contents)
   "Interpret italic object as Org syntax.
@@ -3271,7 +3498,7 @@ Assume point is at the beginning of the link."
        (setq path (match-string-no-properties 1))
        (setq contents-begin (match-beginning 1))
        (setq contents-end (match-end 1)))
-       ;; Type 2: Standard link, i.e. [[https://orgmode.org][homepage]]
+       ;; Type 2: Standard link, i.e. [[https://orgmode.org][website]]
        ((looking-at org-link-bracket-re)
        (setq format 'bracket)
        (setq contents-begin (match-beginning 2))
@@ -3529,21 +3756,7 @@ When at a strike-through object, return a list whose car 
is
 Otherwise, return nil.
 
 Assume point is at the first plus sign marker."
-  (save-excursion
-    (unless (bolp) (backward-char 1))
-    (when (looking-at org-emph-re)
-      (let ((begin (match-beginning 2))
-           (contents-begin (match-beginning 4))
-           (contents-end (match-end 4))
-           (post-blank (progn (goto-char (match-end 2))
-                              (skip-chars-forward " \t")))
-           (end (point)))
-       (list 'strike-through
-             (list :begin begin
-                   :end end
-                   :contents-begin contents-begin
-                   :contents-end contents-end
-                   :post-blank post-blank))))))
+  (org-element--parse-generic-emphasis "+" 'strike-through))
 
 (defun org-element-strike-through-interpreter (_ contents)
   "Interpret strike-through object as Org syntax.
@@ -3709,7 +3922,9 @@ Assume point is at the beginning of the timestamp."
             (activep (eq (char-after) ?<))
             (raw-value
              (progn
-               (looking-at 
"\\([<[]\\(%%\\)?.*?\\)[]>]\\(?:--\\([<[].*?[]>]\\)\\)?")
+               (looking-at (concat "\\([<[]\\(%%\\)?.*?\\)[]>]\\(?:--\\("
+                                    org-ts-regexp-both
+                                    "\\)\\)?"))
                (match-string-no-properties 0)))
             (date-start (match-string-no-properties 1))
             (date-end (match-string 3))
@@ -3817,8 +4032,7 @@ Assume point is at the beginning of the timestamp."
          ;; the repeater string, if any.
          (lambda (time activep &optional with-time-p hour-end minute-end)
            (let ((ts (format-time-string
-                      (funcall (if with-time-p #'cdr #'car)
-                               org-time-stamp-formats)
+                       (org-time-stamp-format with-time-p)
                       time)))
              (when (and hour-end minute-end)
                (string-match "[012]?[0-9]:[0-5][0-9]" ts)
@@ -3847,12 +4061,12 @@ Assume point is at the beginning of the timestamp."
                                     (/= minute-start minute-end)))))
         (funcall
          build-ts-string
-         (encode-time 0
-                      (or minute-start 0)
-                      (or hour-start 0)
-                      (org-element-property :day-start timestamp)
-                      (org-element-property :month-start timestamp)
-                      (org-element-property :year-start timestamp))
+         (org-encode-time 0
+                           (or minute-start 0)
+                           (or hour-start 0)
+                           (org-element-property :day-start timestamp)
+                           (org-element-property :month-start timestamp)
+                           (org-element-property :year-start timestamp))
          (eq type 'active)
          (and hour-start minute-start)
          (and time-range-p hour-end)
@@ -3864,7 +4078,7 @@ Assume point is at the beginning of the timestamp."
             (hour-end (org-element-property :hour-end timestamp)))
         (concat
          (funcall
-          build-ts-string (encode-time
+          build-ts-string (org-encode-time
                            0
                            (or minute-start 0)
                            (or hour-start 0)
@@ -3875,12 +4089,13 @@ Assume point is at the beginning of the timestamp."
           (and hour-start minute-start))
          "--"
          (funcall build-ts-string
-                  (encode-time 0
-                               (or minute-end 0)
-                               (or hour-end 0)
-                               (org-element-property :day-end timestamp)
-                               (org-element-property :month-end timestamp)
-                               (org-element-property :year-end timestamp))
+                  (org-encode-time
+                    0
+                    (or minute-end 0)
+                    (or hour-end 0)
+                    (org-element-property :day-end timestamp)
+                    (org-element-property :month-end timestamp)
+                    (org-element-property :year-end timestamp))
                   (eq type 'active-range)
                   (and hour-end minute-end)))))
       (_ (org-element-property :raw-value timestamp)))))
@@ -3897,21 +4112,7 @@ When at an underline object, return a list whose car is
 Otherwise, return nil.
 
 Assume point is at the first underscore marker."
-  (save-excursion
-    (unless (bolp) (backward-char 1))
-    (when (looking-at org-emph-re)
-      (let ((begin (match-beginning 2))
-           (contents-begin (match-beginning 4))
-           (contents-end (match-end 4))
-           (post-blank (progn (goto-char (match-end 2))
-                              (skip-chars-forward " \t")))
-           (end (point)))
-       (list 'underline
-             (list :begin begin
-                   :end end
-                   :contents-begin contents-begin
-                   :contents-end contents-end
-                   :post-blank post-blank))))))
+  (org-element--parse-generic-emphasis "_" 'underline))
 
 (defun org-element-underline-interpreter (_ contents)
   "Interpret underline object as Org syntax.
@@ -3929,19 +4130,7 @@ and cdr is a plist with `:value', `:begin', `:end' and
 `:post-blank' keywords.  Otherwise, return nil.
 
 Assume point is at the first equal sign marker."
-  (save-excursion
-    (unless (bolp) (backward-char 1))
-    (when (looking-at org-verbatim-re)
-      (let ((begin (match-beginning 2))
-           (value (match-string-no-properties 4))
-           (post-blank (progn (goto-char (match-end 2))
-                              (skip-chars-forward " \t")))
-           (end (point)))
-       (list 'verbatim
-             (list :value value
-                   :begin begin
-                   :end end
-                   :post-blank post-blank))))))
+  (org-element--parse-generic-emphasis "=" 'verbatim))
 
 (defun org-element-verbatim-interpreter (verbatim _)
   "Interpret VERBATIM object as Org syntax."
@@ -3955,7 +4144,8 @@ Assume point is at the first equal sign marker."
 ;; It returns the Lisp representation of the element starting at
 ;; point.
 
-(defun org-element--current-element (limit &optional granularity mode 
structure)
+(defvar org-element--cache-sync-requests); Declared later
+(defun org-element--current-element (limit &optional granularity mode 
structure add-to-cache)
   "Parse the element starting at point.
 
 Return value is a list like (TYPE PROPS) where TYPE is the type
@@ -3980,157 +4170,200 @@ Optional argument MODE, when non-nil, can be either
 If STRUCTURE isn't provided but MODE is set to `item', it will be
 computed.
 
+Optional argument ADD-TO-CACHE, when non-nil, and when cache is active,
+will also add current element to cache if it is not yet there.  Use
+this argument with care, as validity of the element in parse tree is
+not checked.
+
 This function assumes point is always at the beginning of the
 element it has to parse."
-  (save-excursion
-    (let ((case-fold-search t)
-         ;; Determine if parsing depth allows for secondary strings
-         ;; parsing.  It only applies to elements referenced in
-         ;; `org-element-secondary-value-alist'.
-         (raw-secondary-p (and granularity (not (eq granularity 'object)))))
-      (cond
-       ;; Item.
-       ((eq mode 'item)
-       (org-element-item-parser limit structure raw-secondary-p))
-       ;; Table Row.
-       ((eq mode 'table-row) (org-element-table-row-parser limit))
-       ;; Node Property.
-       ((eq mode 'node-property) (org-element-node-property-parser limit))
-       ;; Headline.
-       ((org-with-limited-levels (org-at-heading-p))
-        (org-element-headline-parser limit raw-secondary-p))
-       ;; Sections (must be checked after headline).
-       ((eq mode 'section) (org-element-section-parser limit))
-       ((eq mode 'first-section)
-       (org-element-section-parser
-        (or (save-excursion (org-with-limited-levels (outline-next-heading)))
-            limit)))
-       ;; Comments.
-       ((looking-at "^[ \t]*#\\(?: \\|$\\)")
-       (org-element-comment-parser limit))
-       ;; Planning.
-       ((and (eq mode 'planning)
-            (eq ?* (char-after (line-beginning-position 0)))
-            (looking-at org-planning-line-re))
-       (org-element-planning-parser limit))
-       ;; Property drawer.
-       ((and (pcase mode
-              (`planning (eq ?* (char-after (line-beginning-position 0))))
-              ((or `property-drawer `top-comment)
-               (save-excursion
-                 (beginning-of-line 0)
-                 (not (looking-at "[[:blank:]]*$"))))
-              (_ nil))
-            (looking-at org-property-drawer-re))
-       (org-element-property-drawer-parser limit))
-       ;; When not at bol, point is at the beginning of an item or
-       ;; a footnote definition: next item is always a paragraph.
-       ((not (bolp)) (org-element-paragraph-parser limit (list (point))))
-       ;; Clock.
-       ((looking-at org-clock-line-re) (org-element-clock-parser limit))
-       ;; Inlinetask.
-       ((looking-at "^\\*+ ")
-       (org-element-inlinetask-parser limit raw-secondary-p))
-       ;; From there, elements can have affiliated keywords.
-       (t (let ((affiliated (org-element--collect-affiliated-keywords
-                            limit (memq granularity '(nil object)))))
-           (cond
-            ;; Jumping over affiliated keywords put point off-limits.
-            ;; Parse them as regular keywords.
-            ((and (cdr affiliated) (>= (point) limit))
-             (goto-char (car affiliated))
-             (org-element-keyword-parser limit nil))
-            ;; LaTeX Environment.
-            ((looking-at org-element--latex-begin-environment)
-             (org-element-latex-environment-parser limit affiliated))
-            ;; Drawer.
-            ((looking-at org-drawer-regexp)
-             (org-element-drawer-parser limit affiliated))
-            ;; Fixed Width
-            ((looking-at "[ \t]*:\\( \\|$\\)")
-             (org-element-fixed-width-parser limit affiliated))
-            ;; Inline Comments, Blocks, Babel Calls, Dynamic Blocks and
-            ;; Keywords.
-            ((looking-at "[ \t]*#\\+")
-             (goto-char (match-end 0))
-             (cond
-              ((looking-at "BEGIN_\\(\\S-+\\)")
-               (beginning-of-line)
-               (funcall (pcase (upcase (match-string 1))
-                          ("CENTER"  #'org-element-center-block-parser)
-                          ("COMMENT" #'org-element-comment-block-parser)
-                          ("EXAMPLE" #'org-element-example-block-parser)
-                          ("EXPORT"  #'org-element-export-block-parser)
-                          ("QUOTE"   #'org-element-quote-block-parser)
-                          ("SRC"     #'org-element-src-block-parser)
-                          ("VERSE"   #'org-element-verse-block-parser)
-                          (_         #'org-element-special-block-parser))
-                        limit
-                        affiliated))
-              ((looking-at "CALL:")
-               (beginning-of-line)
-               (org-element-babel-call-parser limit affiliated))
-              ((looking-at "BEGIN:? ")
-               (beginning-of-line)
-               (org-element-dynamic-block-parser limit affiliated))
-              ((looking-at "\\S-+:")
-               (beginning-of-line)
-               (org-element-keyword-parser limit affiliated))
-              (t
-               (beginning-of-line)
-               (org-element-paragraph-parser limit affiliated))))
-            ;; Footnote Definition.
-            ((looking-at org-footnote-definition-re)
-             (org-element-footnote-definition-parser limit affiliated))
-            ;; Horizontal Rule.
-            ((looking-at "[ \t]*-\\{5,\\}[ \t]*$")
-             (org-element-horizontal-rule-parser limit affiliated))
-            ;; Diary Sexp.
-            ((looking-at "%%(")
-             (org-element-diary-sexp-parser limit affiliated))
-            ;; Table.
-            ((or (looking-at "[ \t]*|")
-                 ;; There is no strict definition of a table.el
-                 ;; table.  Try to prevent false positive while being
-                 ;; quick.
-                 (let ((rule-regexp
-                        (rx (zero-or-more (any " \t"))
-                            "+"
-                            (one-or-more (one-or-more "-") "+")
-                            (zero-or-more (any " \t"))
-                            eol))
-                       (non-table.el-line
-                        (rx bol
-                            (zero-or-more (any " \t"))
-                            (or eol (not (any "+| \t")))))
-                       (next (line-beginning-position 2)))
-                   ;; Start with a full rule.
-                   (and
-                    (looking-at rule-regexp)
-                    (< next limit)     ;no room for a table.el table
+  (let* ((element (and (not (buffer-narrowed-p))
+                       (org-element--cache-active-p)
+                       (not org-element--cache-sync-requests)
+                       (org-element--cache-find (point) t)))
+         (element (progn (while (and element
+                                     (not (and (eq (point) 
(org-element-property :begin element))
+                                               (eq mode (org-element-property 
:mode element)))))
+                           (setq element (org-element-property :parent 
element)))
+                         element))
+         (old-element element)
+         (element (when
+                      (pcase (org-element-property :granularity element)
+                        (`nil t)
+                        (`object t)
+                        (`element (not (memq granularity '(nil object))))
+                        (`greater-element (not (memq granularity '(nil object 
element))))
+                        (`headline (eq granularity 'headline)))
+                    element)))
+    (if element
+        element
+      (save-excursion
+        (let ((case-fold-search t)
+             ;; Determine if parsing depth allows for secondary strings
+             ;; parsing.  It only applies to elements referenced in
+             ;; `org-element-secondary-value-alist'.
+             (raw-secondary-p (and granularity (not (eq granularity 'object))))
+              result)
+          (setq
+           result
+           (cond
+            ;; Item.
+            ((eq mode 'item)
+            (org-element-item-parser limit structure raw-secondary-p))
+            ;; Table Row.
+            ((eq mode 'table-row) (org-element-table-row-parser limit))
+            ;; Node Property.
+            ((eq mode 'node-property) (org-element-node-property-parser limit))
+            ;; Headline.
+            ((org-with-limited-levels (looking-at-p org-outline-regexp-bol))
+             (org-element-headline-parser limit raw-secondary-p))
+            ;; Sections (must be checked after headline).
+            ((eq mode 'section) (org-element-section-parser limit))
+            ((eq mode 'first-section)
+            (org-element-section-parser
+             (or (save-excursion (org-with-limited-levels 
(outline-next-heading)))
+                 limit)))
+            ;; Comments.
+            ((looking-at "^[ \t]*#\\(?: \\|$\\)")
+            (org-element-comment-parser limit))
+            ;; Planning.
+            ((and (eq mode 'planning)
+                 (eq ?* (char-after (line-beginning-position 0)))
+                 (looking-at org-element-planning-line-re))
+            (org-element-planning-parser limit))
+            ;; Property drawer.
+            ((and (pcase mode
+                   (`planning (eq ?* (char-after (line-beginning-position 0))))
+                   ((or `property-drawer `top-comment)
                     (save-excursion
-                      (end-of-line)
-                      (cond
-                       ;; Must end with a full rule.
-                       ((not (re-search-forward non-table.el-line limit 'move))
-                        (if (bolp) (forward-line -1) (beginning-of-line))
-                        (looking-at rule-regexp))
-                       ;; Ignore pseudo-tables with a single
-                       ;; rule.
-                       ((= next (line-beginning-position))
-                        nil)
-                       ;; Must end with a full rule.
-                       (t
-                        (forward-line -1)
-                        (looking-at rule-regexp)))))))
-             (org-element-table-parser limit affiliated))
-            ;; List.
-            ((looking-at (org-item-re))
-             (org-element-plain-list-parser
-              limit affiliated
-              (or structure (org-element--list-struct limit))))
-            ;; Default element: Paragraph.
-            (t (org-element-paragraph-parser limit affiliated)))))))))
+                      (beginning-of-line 0)
+                      (not (looking-at "[[:blank:]]*$"))))
+                   (_ nil))
+                 (looking-at org-property-drawer-re))
+            (org-element-property-drawer-parser limit))
+            ;; When not at bol, point is at the beginning of an item or
+            ;; a footnote definition: next item is always a paragraph.
+            ((not (bolp)) (org-element-paragraph-parser limit (list (point))))
+            ;; Clock.
+            ((looking-at org-element-clock-line-re)
+             (org-element-clock-parser limit))
+            ;; Inlinetask.
+            ((looking-at "^\\*+ ")
+            (org-element-inlinetask-parser limit raw-secondary-p))
+            ;; From there, elements can have affiliated keywords.
+            (t (let ((affiliated (org-element--collect-affiliated-keywords
+                                 limit (memq granularity '(nil object)))))
+                (cond
+                 ;; Jumping over affiliated keywords put point off-limits.
+                 ;; Parse them as regular keywords.
+                 ((and (cdr affiliated) (>= (point) limit))
+                  (goto-char (car affiliated))
+                  (org-element-keyword-parser limit nil))
+                 ;; LaTeX Environment.
+                 ((looking-at org-element--latex-begin-environment)
+                  (org-element-latex-environment-parser limit affiliated))
+                 ;; Drawer.
+                 ((looking-at org-element-drawer-re)
+                  (org-element-drawer-parser limit affiliated))
+                 ;; Fixed Width
+                 ((looking-at "[ \t]*:\\( \\|$\\)")
+                  (org-element-fixed-width-parser limit affiliated))
+                 ;; Inline Comments, Blocks, Babel Calls, Dynamic Blocks and
+                 ;; Keywords.
+                 ((looking-at "[ \t]*#\\+")
+                  (goto-char (match-end 0))
+                  (cond
+                   ((looking-at "BEGIN_\\(\\S-+\\)")
+                    (beginning-of-line)
+                    (funcall (pcase (upcase (match-string 1))
+                               ("CENTER"  #'org-element-center-block-parser)
+                               ("COMMENT" #'org-element-comment-block-parser)
+                               ("EXAMPLE" #'org-element-example-block-parser)
+                               ("EXPORT"  #'org-element-export-block-parser)
+                               ("QUOTE"   #'org-element-quote-block-parser)
+                               ("SRC"     #'org-element-src-block-parser)
+                               ("VERSE"   #'org-element-verse-block-parser)
+                               (_         #'org-element-special-block-parser))
+                             limit
+                             affiliated))
+                   ((looking-at "CALL:")
+                    (beginning-of-line)
+                    (org-element-babel-call-parser limit affiliated))
+                   ((save-excursion
+                       (beginning-of-line)
+                       (looking-at org-element-dynamic-block-open-re))
+                    (beginning-of-line)
+                    (org-element-dynamic-block-parser limit affiliated))
+                   ((looking-at "\\S-+:")
+                    (beginning-of-line)
+                    (org-element-keyword-parser limit affiliated))
+                   (t
+                    (beginning-of-line)
+                    (org-element-paragraph-parser limit affiliated))))
+                 ;; Footnote Definition.
+                 ((looking-at org-footnote-definition-re)
+                  (org-element-footnote-definition-parser limit affiliated))
+                 ;; Horizontal Rule.
+                 ((looking-at "[ \t]*-\\{5,\\}[ \t]*$")
+                  (org-element-horizontal-rule-parser limit affiliated))
+                 ;; Diary Sexp.
+                 ((looking-at "%%(")
+                  (org-element-diary-sexp-parser limit affiliated))
+                 ;; Table.
+                 ((or (looking-at "[ \t]*|")
+                      ;; There is no strict definition of a table.el
+                      ;; table.  Try to prevent false positive while being
+                      ;; quick.
+                      (let ((rule-regexp
+                             (rx (zero-or-more (any " \t"))
+                                 "+"
+                                 (one-or-more (one-or-more "-") "+")
+                                 (zero-or-more (any " \t"))
+                                 eol))
+                            (non-table.el-line
+                             (rx bol
+                                 (zero-or-more (any " \t"))
+                                 (or eol (not (any "+| \t")))))
+                            (next (line-beginning-position 2)))
+                        ;; Start with a full rule.
+                        (and
+                         (looking-at rule-regexp)
+                         (< next limit) ;no room for a table.el table
+                         (save-excursion
+                           (end-of-line)
+                           (cond
+                            ;; Must end with a full rule.
+                            ((not (re-search-forward non-table.el-line limit 
'move))
+                             (if (bolp) (forward-line -1) (beginning-of-line))
+                             (looking-at rule-regexp))
+                            ;; Ignore pseudo-tables with a single
+                            ;; rule.
+                            ((= next (line-beginning-position))
+                             nil)
+                            ;; Must end with a full rule.
+                            (t
+                             (forward-line -1)
+                             (looking-at rule-regexp)))))))
+                  (org-element-table-parser limit affiliated))
+                 ;; List.
+                 ((looking-at (org-item-re))
+                  (org-element-plain-list-parser
+                   limit affiliated
+                   (or structure (org-element--list-struct limit))))
+                 ;; Default element: Paragraph.
+                 (t (org-element-paragraph-parser limit affiliated)))))))
+          (when result
+            (org-element-put-property result :mode mode)
+            (org-element-put-property result :granularity granularity))
+          (when (and (not (buffer-narrowed-p))
+                     (org-element--cache-active-p)
+                     (not org-element--cache-sync-requests)
+                     add-to-cache)
+            (if (not old-element)
+                (setq result (org-element--cache-put result))
+              (org-element-set-element old-element result)
+              (setq result old-element)))
+          result)))))
 
 
 ;; Most elements can have affiliated keywords.  When looking for an
@@ -4271,12 +4504,14 @@ or objects within the parse tree.
 This function assumes that current major mode is `org-mode'."
   (save-excursion
     (goto-char (point-min))
-    (org-skip-whitespace)
-    (org-element--parse-elements
-     (line-beginning-position) (point-max)
-     ;; Start in `first-section' mode so text before the first
-     ;; headline belongs to a section.
-     'first-section nil granularity visible-only (list 'org-data nil))))
+    (let ((org-data (org-element-org-data-parser))
+          (gc-cons-threshold #x40000000))
+      (org-skip-whitespace)
+      (org-element--parse-elements
+       (line-beginning-position) (point-max)
+       ;; Start in `first-section' mode so text before the first
+       ;; headline belongs to a section.
+       'first-section nil granularity visible-only org-data))))
 
 (defun org-element-parse-secondary-string (string restriction &optional parent)
   "Recursively parse objects in STRING and return structure.
@@ -4312,12 +4547,13 @@ If STRING is the empty string or nil, return nil."
     (data types fun &optional info first-match no-recursion with-affiliated)
   "Map a function on selected elements or objects.
 
-DATA is a parse tree, an element, an object, a string, or a list
-of such constructs.  TYPES is a symbol or list of symbols of
-elements or objects types (see `org-element-all-elements' and
-`org-element-all-objects' for a complete list of types).  FUN is
-the function called on the matching element or object.  It has to
-accept one argument: the element or object itself.
+DATA is a parse tree (for example, returned by
+`org-element-parse-buffer'), an element, an object, a string, or a
+list of such constructs.  TYPES is a symbol or list of symbols of
+elements or object types (see `org-element-all-elements' and
+`org-element-all-objects' for a complete list of types).  FUN is the
+function called on the matching element or object.  It has to accept
+one argument: the element or object itself.
 
 When optional argument INFO is non-nil, it should be a plist
 holding export options.  In that case, parts of the parse tree
@@ -4345,6 +4581,7 @@ Assuming TREE is a variable containing an Org buffer 
parse tree,
 the following example will return a flat list of all `src-block'
 and `example-block' elements in it:
 
+  (setq tree (org-element-parse-buffer))
   (org-element-map tree \\='(example-block src-block) #\\='identity)
 
 The following snippet will find the first headline with a level
@@ -4492,6 +4729,8 @@ located inside the current one."
       (pcase type
        (`headline 'section)
        ((and (guard (eq mode 'first-section)) `section) 'top-comment)
+        ((and (guard (eq mode 'org-data)) `org-data) 'first-section)
+        ((and (guard (not mode)) `org-data) 'first-section)
        (`inlinetask 'planning)
        (`plain-list 'item)
        (`property-drawer 'node-property)
@@ -4536,8 +4775,20 @@ Elements are accumulated into ACC."
              (when (and (eolp) (not (eobp))) (forward-char)))
          ;; Find current element's type and parse it accordingly to
          ;; its category.
-         (let* ((element (org-element--current-element
-                          end granularity mode structure))
+         (let* ((element (org-element-copy
+                           ;; `org-element--current-element' may return cached
+                           ;; elements.  Below code reassigns
+                           ;; `:parent' property of the element and
+                           ;; may interfere with cache
+                           ;; synchronization if parent element is not
+                           ;; yet in cache.  Moreover, the returned
+                           ;; structure may be altered by caller code
+                           ;; arbitrarily.  Hence, we return a copy of
+                           ;; the potentially cached element to make
+                           ;; potential modifications safe for element
+                           ;; cache.
+                           (org-element--current-element
+                           end granularity mode structure)))
                 (type (org-element-type element))
                 (cbeg (org-element-property :contents-begin element)))
            (goto-char (org-element-property :end element))
@@ -4571,6 +4822,7 @@ Elements are accumulated into ACC."
            ;; Update mode.
            (setq mode (org-element--next-mode mode type nil)))))
       ;; Return result.
+      (org-element-put-property acc :granularity granularity)
       (apply #'org-element-set-contents acc (nreverse elements)))))
 
 (defun org-element--object-lex (restriction)
@@ -4989,17 +5241,20 @@ indentation removed from its contents."
 
 ;;; Cache
 ;;
-;; Implement a caching mechanism for `org-element-at-point' and
-;; `org-element-context', which see.
+;; Implement a caching mechanism for `org-element-at-point', 
`org-element-context', and for
+;; fast mapping across Org elements in `org-element-cache-map', which see.
 ;;
-;; A single public function is provided: `org-element-cache-reset'.
+;; When cache is enabled, the elements returned by `org-element-at-point' and
+;; `org-element-context' are returned by reference.  Altering these elements 
will
+;; also alter their cache representation.  The same is true for
+;; elements passed to mapping function in `org-element-cache-map'.
 ;;
-;; Cache is disabled by default for now because it sometimes triggers
-;; freezes, but it can be enabled globally with
-;; `org-element-use-cache'.  `org-element-cache-sync-idle-time',
-;; `org-element-cache-sync-duration' and
-;; `org-element-cache-sync-break' can be tweaked to control caching
-;; behavior.
+;; Public functions are: `org-element-cache-reset', 
`org-element-cache-refresh', and
+;; `org-element-cache-map'.
+;;
+;; Cache can be controlled using `org-element-use-cache' and 
`org-element-cache-persistent'.
+;;  `org-element-cache-sync-idle-time', `org-element-cache-sync-duration' and
+;; `org-element-cache-sync-break' can be tweaked to control caching behavior.
 ;;
 ;; Internally, parsed elements are stored in an AVL tree,
 ;; `org-element--cache'.  This tree is updated lazily: whenever
@@ -5031,14 +5286,21 @@ indentation removed from its contents."
 ;; associated to a key, obtained with `org-element--cache-key'.  This
 ;; mechanism is robust enough to preserve total order among elements
 ;; even when the tree is only partially synchronized.
+;;
+;; The cache code debuggin is fairly complex because cache request
+;; state is often hard to reproduce.  An extensive diagnostics
+;; functionality is built into the cache code to assist hunting bugs.
+;; See `org-element--cache-self-verify', 
`org-element--cache-self-verify-frequency',
+;; `org-element--cache-diagnostics', `org-element--cache-diagnostics-level',
+;; `org-element--cache-diagnostics-ring-size', 
`org-element--cache-map-statistics',
+;; `org-element--cache-map-statistics-threshold'.
 
+;;;###autoload
+(defvar org-element-use-cache t
+  "Non-nil when Org parser should cache its results.")
 
-(defvar org-element-use-cache nil
-  "Non-nil when Org parser should cache its results.
-
-WARNING: for the time being, using cache sometimes triggers
-freezes.  Therefore, it is disabled by default.  Activate it if
-you want to help debugging the issue.")
+(defvar org-element-cache-persistent t
+  "Non-nil when cache should persist between Emacs sessions.")
 
 (defvar org-element-cache-sync-idle-time 0.6
   "Length, in seconds, of idle time before syncing cache.")
@@ -5053,16 +5315,93 @@ seconds.")
   "Duration, as a time value, of the pause between synchronizations.
 See `org-element-cache-sync-duration' for more information.")
 
+(defvar org-element--cache-self-verify t
+  "Activate extra consistency checks for the cache.
+
+This may cause serious performance degradation depending on the value
+of `org-element--cache-self-verify-frequency'.
+
+When set to symbol `backtrace', record and display backtrace log if
+any inconsistency is detected.")
+
+(defvar org-element--cache-self-verify-frequency 0.03
+  "Frequency of cache element verification.
+
+This number is a probability to check an element requested from cache
+to be correct.  Setting this to a value less than 0.0001 is useless.")
+
+(defvar org-element--cache-diagnostics nil
+  "Print detailed diagnostics of cache processing.")
+
+(defvar org-element--cache-map-statistics nil
+  "Print statistics for `org-element-cache-map'.")
+
+(defvar org-element--cache-map-statistics-threshold 0.1
+  "Time threshold in seconds to log statistics for `org-element-cache-map'.")
+
+(defvar org-element--cache-diagnostics-level 2
+  "Detail level of the diagnostics.")
+
+(defvar-local org-element--cache-diagnostics-ring nil
+  "Ring containing last `org-element--cache-diagnostics-ring-size'
+cache process log entries.")
+
+(defvar org-element--cache-diagnostics-ring-size 5000
+  "Size of `org-element--cache-diagnostics-ring'.")
 
 ;;;; Data Structure
 
-(defvar org-element--cache nil
+(defvar-local org-element--cache nil
   "AVL tree used to cache elements.
 Each node of the tree contains an element.  Comparison is done
 with `org-element--cache-compare'.  This cache is used in
 `org-element-at-point'.")
 
-(defvar org-element--cache-sync-requests nil
+(defvar-local org-element--headline-cache nil
+  "AVL tree used to cache headline and inlinetask elements.
+Each node of the tree contains an element.  Comparison is done
+with `org-element--cache-compare'.  This cache is used in
+`org-element-cache-map'.")
+
+(defconst org-element--cache-hash-size 16
+  "Cache size for recent cached calls to `org-element--cache-find'.
+
+This extra caching is based on the following paper:
+Pugh [Information Processing Letters] (1990) Slow optimally balanced
+ search strategies vs. cached fast uniformly balanced search
+ strategies.  http://dx.doi.org/10.1016/0020-0190(90)90130-P
+
+Also, see `org-element--cache-hash-left' and `org-element--cache-hash-right'.")
+(defvar-local org-element--cache-hash-left nil
+  "Cached elements from `org-element--cache' for fast O(1) lookup.
+When non-nil, it should be a vector representing POS arguments of
+`org-element--cache-find' called with nil SIDE argument.
+Also, see `org-element--cache-hash-size'.")
+(defvar-local org-element--cache-hash-right nil
+  "Cached elements from `org-element--cache' for fast O(1) lookup.
+When non-nil, it should be a vector representing POS arguments of
+`org-element--cache-find' called with non-nil, non-`both' SIDE argument.
+Also, see `org-element--cache-hash-size'.")
+
+(defvar org-element--cache-hash-statistics '(0 . 0)
+  "Cons cell storing how Org makes use of `org-element--cache-find' caching.
+The car is the number of successful uses and cdr is the total calls to
+`org-element--cache-find'.")
+(defvar org-element--cache-hash-nocache 0
+  "Number of calls to `org-element--cache-has' with `both' SIDE argument.
+These calls are not cached by hash.  See `org-element--cache-hash-size'.")
+
+(defvar-local org-element--cache-size 0
+  "Size of the `org-element--cache'.
+
+Storing value is variable is faster because `avl-tree-size' is O(N).")
+
+(defvar-local org-element--headline-cache-size 0
+  "Size of the `org-element--headline-cache'.
+
+Storing value is variable is faster because `avl-tree-size' is O(N).")
+
+(defvar-local org-element--cache-sync-requests nil
   "List of pending synchronization requests.
 
 A request is a vector with the following pattern:
@@ -5079,7 +5418,10 @@ During phase 0, NEXT is the key of the first element to 
be
 removed, BEG and END is buffer position delimiting the
 modifications.  Elements starting between them (inclusive) are
 removed.  So are elements whose parent is removed.  PARENT, when
-non-nil, is the parent of the first element to be removed.
+non-nil, is the common parent of all the elements between BEG and END.
+
+It is guaranteed that only a single phase 0 request exists at any
+moment of time.  If it does, it must be the first request in the list.
 
 During phase 1, NEXT is the key of the next known element in
 cache and BEG its beginning position.  Parse buffer between that
@@ -5088,18 +5430,115 @@ the next element.  Set PARENT to the element 
containing NEXT.
 
 During phase 2, NEXT is the key of the next element to shift in
 the parse tree.  All elements starting from this one have their
-properties relatives to buffer positions shifted by integer
+properties relative to buffer positions shifted by integer
 OFFSET and, if they belong to element PARENT, are adopted by it.
 
-PHASE specifies the phase number, as an integer.")
+PHASE specifies the phase number, as an integer.
+
+For any synchronization request, all the later requests in the cache
+must not start at or before END.  See `org-element--cache-submit-request'.")
 
-(defvar org-element--cache-sync-timer nil
+(defvar-local org-element--cache-sync-timer nil
   "Timer used for cache synchronization.")
 
-(defvar org-element--cache-sync-keys nil
-  "Hash table used to store keys during synchronization.
+(defvar-local org-element--cache-sync-keys-value nil
+  "Id value used to identify keys during synchronization.
 See `org-element--cache-key' for more information.")
 
+(defvar-local org-element--cache-change-tic nil
+  "Last `buffer-chars-modified-tick' for registered changes.")
+
+(defvar-local org-element--cache-last-buffer-size nil
+  "Last value of `buffer-size' for registered changes.")
+
+(defvar org-element--cache-non-modifying-commands
+  '(org-agenda
+    org-agenda-redo
+    org-sparse-tree
+    org-occur
+    org-columns
+    org-columns-redo
+    org-columns-new
+    org-columns-delete
+    org-columns-compute
+    org-columns-insert-dblock
+    org-agenda-columns
+    org-ctrl-c-ctrl-c)
+  "List of commands that are not expected to change the cache state.
+
+This variable is used to determine when re-parsing buffer is not going
+to slow down the command.
+
+If the commands end up modifying the cache, the worst case scenario is
+performance drop.  So, advicing these commands is safe.  Yet, it is
+better to remove the commands advised in such a way from this list.")
+
+(defmacro org-element--request-key (request)
+  "Get NEXT part of a `org-element--cache-sync-requests' REQUEST."
+  `(aref ,request 0))
+
+(defmacro org-element--request-beg (request)
+  "Get BEG part of a `org-element--cache-sync-requests' REQUEST."
+  `(aref ,request 1))
+
+(defmacro org-element--request-end (request)
+  "Get END part of a `org-element--cache-sync-requests' REQUEST."
+  `(aref ,request 2))
+
+(defmacro org-element--request-offset (request)
+  "Get OFFSET part of a `org-element--cache-sync-requests' REQUEST."
+  `(aref ,request 3))
+
+(defmacro org-element--request-parent (request)
+  "Get PARENT part of a `org-element--cache-sync-requests' REQUEST."
+  `(aref ,request 4))
+
+(defmacro org-element--request-phase (request)
+  "Get PHASE part of a `org-element--cache-sync-requests' REQUEST."
+  `(aref ,request 5))
+
+(defmacro org-element--format-element (element)
+  "Format ELEMENT for printing in diagnostics."
+  `(let ((print-length 50)
+         (print-level 5))
+     (prin1-to-string ,element)))
+
+(defmacro org-element--cache-log-message (format-string &rest args)
+  "Add a new log message for org-element-cache."
+  `(when (or org-element--cache-diagnostics
+             (eq org-element--cache-self-verify 'backtrace))
+     (let* ((format-string (concat (format "org-element-cache diagnostics(%s): 
"
+                                           (buffer-name (current-buffer)))
+                                   ,format-string))
+            (format-string (funcall #'format format-string ,@args)))
+       (if org-element--cache-diagnostics
+           (display-warning 'org-element-cache format-string)
+         (unless org-element--cache-diagnostics-ring
+           (setq org-element--cache-diagnostics-ring
+                 (make-ring org-element--cache-diagnostics-ring-size)))
+         (ring-insert org-element--cache-diagnostics-ring format-string)))))
+
+(defmacro org-element--cache-warn (format-string &rest args)
+  "Raise warning for org-element-cache."
+  `(let* ((format-string (funcall #'format ,format-string ,@args))
+          (format-string
+           (if (or (not org-element--cache-diagnostics-ring)
+                   (not (eq 'backtrace org-element--cache-self-verify)))
+               format-string
+             (prog1
+                 (concat (format "Warning(%s): "
+                                 (buffer-name (current-buffer)))
+                         format-string
+                         "\nBacktrace:\n  "
+                         (mapconcat #'identity
+                                    (ring-elements 
org-element--cache-diagnostics-ring)
+                                    "\n  "))
+               (setq org-element--cache-diagnostics-ring nil)))))
+     (if (and (boundp 'org-batch-test) org-batch-test)
+         (error "%s" (concat "org-element--cache: " format-string))
+       (display-warning 'org-element-cache
+                        (concat "org-element--cache: " format-string)))))
+
 (defsubst org-element--cache-key (element)
   "Return a unique key for ELEMENT in cache tree.
 
@@ -5109,16 +5548,19 @@ Comparison is done with `org-element--cache-key-less-p'.
 When no synchronization is taking place, a key is simply the
 beginning position of the element, or that position plus one in
 the case of an first item (respectively row) in
-a list (respectively a table).
+a list (respectively a table).  They key of a section is its beginning
+position minus one.
 
 During a synchronization, the key is the one the element had when
 the cache was synchronized for the last time.  Elements added to
 cache during the synchronization get a new key generated with
 `org-element--cache-generate-key'.
 
-Such keys are stored in `org-element--cache-sync-keys'.  The hash
-table is cleared once the synchronization is complete."
-  (or (gethash element org-element--cache-sync-keys)
+Such keys are stored inside the element property
+`:org-element--cache-sync-key'.  The property is a cons containing
+current `org-element--cache-sync-keys-value' and the element key."
+  (or (when (eq org-element--cache-sync-keys-value (car (org-element-property 
:org-element--cache-sync-key element)))
+        (cdr (org-element-property :org-element--cache-sync-key element)))
       (let* ((begin (org-element-property :begin element))
             ;; Increase beginning position of items (respectively
             ;; table rows) by one, so the first item can get
@@ -5126,10 +5568,20 @@ table is cleared once the synchronization is complete."
             ;; table).
             (key (if (memq (org-element-type element) '(item table-row))
                      (1+ begin)
-                   begin)))
-       (if org-element--cache-sync-requests
-           (puthash element key org-element--cache-sync-keys)
-         key))))
+                    ;; Decrease beginning position of sections by one,
+                    ;; so that the first element of the section get
+                    ;; different key from the parent section.
+                    (if (eq (org-element-type element) 'section)
+                        (1- begin)
+                      (if (eq (org-element-type element) 'org-data)
+                          (- begin 2)
+                       begin)))))
+        (when org-element--cache-sync-requests
+         (org-element-put-property
+           element
+           :org-element--cache-sync-key
+           (cons org-element--cache-sync-keys-value key)))
+        key)))
 
 (defun org-element--cache-generate-key (lower upper)
   "Generate a key between LOWER and UPPER.
@@ -5204,7 +5656,11 @@ lesser than UPPER, per `org-element--cache-key-less-p'."
 (defsubst org-element--cache-key-less-p (a b)
   "Non-nil if key A is less than key B.
 A and B are either integers or lists of integers, as returned by
-`org-element--cache-key'."
+`org-element--cache-key'.
+
+Note that it is not reliable to compare buffer position with the cache
+keys.  They keys may be larger compared to actual element :begin
+position."
   (if (integerp a) (if (integerp b) (< a b) (<= a (car b)))
     (if (integerp b) (< (car a) b)
       (catch 'exit
@@ -5222,22 +5678,70 @@ A and B are either integers or lists of integers, as 
returned by
 
 (defun org-element--cache-compare (a b)
   "Non-nil when element A is located before element B."
-  (org-element--cache-key-less-p (org-element--cache-key a)
-                                (org-element--cache-key b)))
+  (org-element--cache-key-less-p (org-element--cache-key a) 
(org-element--cache-key b)))
 
 (defsubst org-element--cache-root ()
-  "Return root value in cache.
+  "Return root value in `org-element--cache' .
 This function assumes `org-element--cache' is a valid AVL tree."
   (avl-tree--node-left (avl-tree--dummyroot org-element--cache)))
 
+(defsubst org-element--headline-cache-root ()
+  "Return root value in `org-element--headline-cache' .
+This function assumes `org-element--headline-cache' is a valid AVL tree."
+  (avl-tree--node-left (avl-tree--dummyroot org-element--headline-cache)))
 
 ;;;; Tools
 
-(defsubst org-element--cache-active-p ()
+;; FIXME: Ideally, this should be inlined to avoid overheads, but
+;; inlined functions should be declared before the code that uses them
+;; and some code above does use `org-element--cache-active-p'.  Moving this
+;; declaration on top would require restructuring the whole cache
+;; section.
+(defun org-element--cache-active-p (&optional called-from-cache-change-func-p)
   "Non-nil when cache is active in current buffer."
-  (and org-element-use-cache
-       org-element--cache
-       (derived-mode-p 'org-mode)))
+  (org-with-base-buffer nil
+    (and org-element-use-cache
+         org-element--cache
+         (or called-from-cache-change-func-p
+             (eq org-element--cache-change-tic (buffer-chars-modified-tick))
+             (and
+              ;; org-num-mode calls some Org structure analysis functions
+              ;; that can trigger cache update in the middle of changes.  See
+              ;; `org-num--verify' calling `org-num--skip-value' calling
+              ;; `org-entry-get' that uses cache.
+              ;; Forcefully disable cache when called from inside a
+              ;; modification hook, where `inhibit-modification-hooks' is set
+              ;; to t.
+              (not inhibit-modification-hooks)
+              ;; `combine-change-calls' sets `after-change-functions' to
+              ;; nil.  We need not to use cache inside
+              ;; `combine-change-calls' because the buffer is potentially
+              ;; changed without notice (the change will be registered
+              ;; after exiting the `combine-change-calls' body though).
+              (catch :inhibited
+                (org-fold-core-cycle-over-indirect-buffers
+                  (unless (memq #'org-element--cache-after-change 
after-change-functions)
+                    (throw :inhibited nil)))
+                t))))))
+
+;; FIXME: Remove after we establish that hashing is effective.
+(defun org-element-cache-hash-show-statistics ()
+  "Display efficiency of O(1) query cache for `org-element--cache-find'.
+
+This extra caching is based on the following paper:
+Pugh [Information Processing Letters] (1990) Slow optimally balanced
+ search strategies vs. cached fast uniformly balanced search
+ strategies.  http://dx.doi.org/10.1016/0020-0190(90)90130-P
+
+Also, see `org-element--cache-size'."
+  (interactive)
+  (message "%.2f%% of cache searches hashed, %.2f%% non-hashable."
+          (* 100
+             (/ (float (car org-element--cache-hash-statistics))
+                (cdr org-element--cache-hash-statistics)))
+          (* 100
+             (/ (float org-element--cache-hash-nocache)
+                (cdr org-element--cache-hash-statistics)))))
 
 (defun org-element--cache-find (pos &optional side)
   "Find element in cache starting at POS or before.
@@ -5252,75 +5756,156 @@ after POS.
 
 The function can only find elements in the synchronized part of
 the cache."
-  (let ((limit (and org-element--cache-sync-requests
-                   (aref (car org-element--cache-sync-requests) 0)))
-       (node (org-element--cache-root))
-       lower upper)
-    (while node
-      (let* ((element (avl-tree--node-data node))
-            (begin (org-element-property :begin element)))
-       (cond
-        ((and limit
-              (not (org-element--cache-key-less-p
-                    (org-element--cache-key element) limit)))
-         (setq node (avl-tree--node-left node)))
-        ((> begin pos)
-         (setq upper element
-               node (avl-tree--node-left node)))
-        ((< begin pos)
-         (setq lower element
-               node (avl-tree--node-right node)))
-        ;; We found an element in cache starting at POS.  If `side'
-        ;; is `both' we also want the next one in order to generate
-        ;; a key in-between.
-        ;;
-        ;; If the element is the first row or item in a table or
-        ;; a plain list, we always return the table or the plain
-        ;; list.
-        ;;
-        ;; In any other case, we return the element found.
-        ((eq side 'both)
-         (setq lower element)
-         (setq node (avl-tree--node-right node)))
-        ((and (memq (org-element-type element) '(item table-row))
-              (let ((parent (org-element-property :parent element)))
-                (and (= (org-element-property :begin element)
-                        (org-element-property :contents-begin parent))
-                     (setq node nil
-                           lower parent
-                           upper parent)))))
-        (t
-         (setq node nil
-               lower element
-               upper element)))))
-    (pcase side
-      (`both (cons lower upper))
-      (`nil lower)
-      (_ upper))))
+  (org-with-base-buffer nil
+    (let* ((limit (and org-element--cache-sync-requests
+                       (org-element--request-key (car 
org-element--cache-sync-requests))))
+          (node (org-element--cache-root))
+           (hash-pos (unless (eq side 'both)
+                       (mod (org-knuth-hash pos)
+                            org-element--cache-hash-size)))
+           (hashed (if (not side)
+                       (aref org-element--cache-hash-left hash-pos)
+                     (unless (eq side 'both)
+                       (aref org-element--cache-hash-right hash-pos))))
+          lower upper)
+      ;; `org-element--cache-key-less-p' does not accept markers.
+      (when (markerp pos) (setq pos (marker-position pos)))
+      (cl-incf (cdr org-element--cache-hash-statistics))
+      (when (eq side 'both) (cl-incf org-element--cache-hash-nocache))
+      (if (and hashed (not (eq side 'both))
+               (or (not limit)
+                   ;; Limit can be a list key.
+                   (org-element--cache-key-less-p
+                    (org-element--cache-key hashed)
+                    limit))
+               (= pos (org-element-property :begin hashed))
+               ;; We cannot rely on element :begin for elements with
+               ;; children starting at the same pos.
+               (not (memq (org-element-type hashed)
+                        '(section org-data table)))
+               (org-element-property :cached hashed))
+          (progn
+            (cl-incf (car org-element--cache-hash-statistics))
+            hashed)
+        (while node
+          (let* ((element (avl-tree--node-data node))
+                (begin (org-element-property :begin element)))
+           (cond
+            ((and limit
+                  (not (org-element--cache-key-less-p
+                      (org-element--cache-key element) limit)))
+             (setq node (avl-tree--node-left node)))
+            ((> begin pos)
+             (setq upper element
+                   node (avl-tree--node-left node)))
+            ((or (< begin pos)
+                  ;; If the element is section or org-data, we also need
+                  ;; to check the following element.
+                  (memq (org-element-type element) '(section org-data)))
+             (setq lower element
+                   node (avl-tree--node-right node)))
+            ;; We found an element in cache starting at POS.  If `side'
+            ;; is `both' we also want the next one in order to generate
+            ;; a key in-between.
+            ;;
+            ;; If the element is the first row or item in a table or
+            ;; a plain list, we always return the table or the plain
+            ;; list.
+            ;;
+            ;; In any other case, we return the element found.
+            ((eq side 'both)
+             (setq lower element)
+             (setq node (avl-tree--node-right node)))
+            ((and (memq (org-element-type element) '(item table-row))
+                  (let ((parent (org-element-property :parent element)))
+                    (and (= (org-element-property :begin element)
+                            (org-element-property :contents-begin parent))
+                         (setq node nil
+                               lower parent
+                               upper parent)))))
+            (t
+             (setq node nil
+                   lower element
+                   upper element)))))
+        (if (not side)
+            (aset org-element--cache-hash-left hash-pos lower)
+          (unless (eq side 'both)
+            (aset org-element--cache-hash-right hash-pos lower)))
+        (pcase side
+          (`both (cons lower upper))
+          (`nil lower)
+          (_ upper))))))
 
 (defun org-element--cache-put (element)
   "Store ELEMENT in current buffer's cache, if allowed."
-  (when (org-element--cache-active-p)
-    (when org-element--cache-sync-requests
-      ;; During synchronization, first build an appropriate key for
-      ;; the new element so `avl-tree-enter' can insert it at the
-      ;; right spot in the cache.
-      (let ((keys (org-element--cache-find
-                  (org-element-property :begin element) 'both)))
-       (puthash element
-                (org-element--cache-generate-key
-                 (and (car keys) (org-element--cache-key (car keys)))
-                 (cond ((cdr keys) (org-element--cache-key (cdr keys)))
-                       (org-element--cache-sync-requests
-                        (aref (car org-element--cache-sync-requests) 0))))
-                org-element--cache-sync-keys)))
-    (avl-tree-enter org-element--cache element)))
+  (org-with-base-buffer nil
+    (when (org-element--cache-active-p)
+      (when org-element--cache-sync-requests
+        ;; During synchronization, first build an appropriate key for
+        ;; the new element so `avl-tree-enter' can insert it at the
+        ;; right spot in the cache.
+        (let* ((keys (org-element--cache-find
+                     (org-element-property :begin element) 'both))
+               (new-key (org-element--cache-generate-key
+                        (and (car keys) (org-element--cache-key (car keys)))
+                        (cond ((cdr keys) (org-element--cache-key (cdr keys)))
+                              (org-element--cache-sync-requests
+                               (org-element--request-key (car 
org-element--cache-sync-requests)))))))
+          (org-element-put-property
+           element
+           :org-element--cache-sync-key
+           (cons org-element--cache-sync-keys-value new-key))))
+      (when (>= org-element--cache-diagnostics-level 2)
+        (org-element--cache-log-message
+         "Added new element with %S key: %S"
+         (org-element-property :org-element--cache-sync-key element)
+         (org-element--format-element element)))
+      (org-element-put-property element :cached t)
+      (when (memq (org-element-type element) '(headline inlinetask))
+        (cl-incf org-element--headline-cache-size)
+        (avl-tree-enter org-element--headline-cache element))
+      (cl-incf org-element--cache-size)
+      (avl-tree-enter org-element--cache element))))
 
 (defsubst org-element--cache-remove (element)
   "Remove ELEMENT from cache.
 Assume ELEMENT belongs to cache and that a cache is active."
-  (avl-tree-delete org-element--cache element))
-
+  (org-with-base-buffer nil
+    (org-element-put-property element :cached nil)
+    (cl-decf org-element--cache-size)
+    ;; Invalidate contents of parent.
+    (when (and (org-element-property :parent element)
+               (org-element-contents (org-element-property :parent element)))
+      (org-element-set-contents (org-element-property :parent element) nil))
+    (when (memq (org-element-type element) '(headline inlinetask))
+      (cl-decf org-element--headline-cache-size)
+      (avl-tree-delete org-element--headline-cache element))
+    (org-element--cache-log-message
+     "Decreasing cache size to %S"
+     org-element--cache-size)
+    (when (< org-element--cache-size 0)
+      (org-element--cache-warn
+       "Cache grew to negative size in %S when deleting %S at %S.  Cache key: 
%S.
+If this warning appears regularly, please report the warning text to Org mode 
mailing list (M-x org-submit-bug-report)."
+       (org-element-type element)
+       (current-buffer)
+       (org-element-property :begin element)
+       (org-element-property :org-element--cache-sync-key element))
+      (org-element-cache-reset)
+      (throw 'quit nil))
+    (or (avl-tree-delete org-element--cache element)
+        (progn
+          ;; This should not happen, but if it is, would be better to know
+          ;; where it happens.
+          (org-element--cache-warn
+           "Failed to delete %S element in %S at %S. The element cache key was 
%S.
+If this warning appears regularly, please report the warning text to Org mode 
mailing list (M-x org-submit-bug-report)."
+           (org-element-type element)
+           (current-buffer)
+           (org-element-property :begin element)
+           (org-element-property :org-element--cache-sync-key element))
+          (org-element-cache-reset)
+          (throw 'quit nil)))))
 
 ;;;; Synchronization
 
@@ -5331,7 +5916,7 @@ Assume ELEMENT belongs to cache and that a cache is 
active."
   (setq org-element--cache-sync-timer
        (run-with-idle-timer
         (let ((idle (current-idle-time)))
-          (if idle (org-time-add idle org-element-cache-sync-break)
+          (if idle (time-add idle org-element-cache-sync-break)
             org-element-cache-sync-idle-time))
         nil
         #'org-element--cache-sync
@@ -5342,7 +5927,7 @@ Assume ELEMENT belongs to cache and that a cache is 
active."
 TIME-LIMIT is a time value or nil."
   (and time-limit
        (or (input-pending-p)
-          (org-time-less-p time-limit nil))))
+          (time-less-p time-limit nil))))
 
 (defsubst org-element--cache-shift-positions (element offset &optional props)
   "Shift ELEMENT properties relative to buffer positions by OFFSET.
@@ -5359,17 +5944,34 @@ Properties are modified by side-effect."
     ;; shifting it more than once.
     (when (and (or (not props) (memq :structure props))
               (eq (org-element-type element) 'plain-list)
-              (not (eq (org-element-type (plist-get properties :parent))
-                       'item)))
+              (not (eq (org-element-type (plist-get properties :parent)) 
'item)))
       (dolist (item (plist-get properties :structure))
        (cl-incf (car item) offset)
        (cl-incf (nth 6 item) offset)))
-    (dolist (key '(:begin :contents-begin :contents-end :end :post-affiliated))
+    (dolist (key '( :begin :contents-begin :contents-end :end
+                    :post-affiliated :robust-begin :robust-end))
       (let ((value (and (or (not props) (memq key props))
                        (plist-get properties key))))
        (and value (plist-put properties key (+ offset value)))))))
 
-(defun org-element--cache-sync (buffer &optional threshold future-change)
+(defvar org-element--cache-interrupt-C-g t
+  "When non-nil, allow the user to abort `org-element--cache-sync'.
+The execution is aborted upon pressing `\\[keyboard-quit]'
+`org-element--cache-interrupt-C-g-max-count' times.")
+(defvar org-element--cache-interrupt-C-g-max-count 5
+  "`\\[keyboard-quit]' count to interrupt `org-element--cache-sync'.
+See `org-element--cache-interrupt-C-g'.")
+(defvar org-element--cache-interrupt-C-g-count 0
+  "Current number of `org-element--cache-sync' calls.
+See `org-element--cache-interrupt-C-g'.")
+
+(defvar org-element--cache-change-warning nil
+  "Non-nil when a sensitive line is about to be changed.
+It is a symbol among nil, t, or a number representing smallest level of
+modified headline.  The level considers headline levels both before
+and after the modification.")
+
+(defun org-element--cache-sync (buffer &optional threshold future-change 
offset)
   "Synchronize cache with recent modification in BUFFER.
 
 When optional argument THRESHOLD is non-nil, do the
@@ -5379,46 +5981,88 @@ then exit.  Otherwise, synchronize cache for as long as
 state.
 
 FUTURE-CHANGE, when non-nil, is a buffer position where changes
-not registered yet in the cache are going to happen.  It is used
-in `org-element--cache-submit-request', where cache is partially
-updated before current modification are actually submitted."
+not registered yet in the cache are going to happen.  OFFSET is the
+change offset.  It is used in `org-element--cache-submit-request',
+where cache is partially updated before current modification are
+actually submitted."
   (when (buffer-live-p buffer)
-    (with-current-buffer buffer
-      (let ((inhibit-quit t) request next)
-       (when org-element--cache-sync-timer
-         (cancel-timer org-element--cache-sync-timer))
-       (catch 'interrupt
-         (while org-element--cache-sync-requests
-           (setq request (car org-element--cache-sync-requests)
-                 next (nth 1 org-element--cache-sync-requests))
-           (org-element--cache-process-request
-            request
-            (and next (aref next 0))
-            threshold
-            (and (not threshold)
-                 (org-time-add nil
-                               org-element-cache-sync-duration))
-            future-change)
-           ;; Request processed.  Merge current and next offsets and
-           ;; transfer ending position.
-           (when next
-             (cl-incf (aref next 3) (aref request 3))
-             (aset next 2 (aref request 2)))
-           (setq org-element--cache-sync-requests
-                 (cdr org-element--cache-sync-requests))))
-       ;; If more requests are awaiting, set idle timer accordingly.
-       ;; Otherwise, reset keys.
-       (if org-element--cache-sync-requests
-           (org-element--cache-set-timer buffer)
-         (clrhash org-element--cache-sync-keys))))))
+    (org-with-base-buffer buffer
+      ;; Do not sync when, for example, in the middle of
+      ;; `combine-change-calls'.  See the commentary inside
+      ;; `org-element--cache-active-p'.
+      (when (and org-element--cache-sync-requests 
(org-element--cache-active-p))
+        ;; Check if the buffer have been changed outside visibility of
+        ;; `org-element--cache-before-change' and 
`org-element--cache-after-change'.
+        (if (/= org-element--cache-last-buffer-size (buffer-size))
+            (progn
+              (org-element--cache-warn
+               "Unregistered buffer modifications detected (%S != %S). 
Resetting.
+If this warning appears regularly, please report the warning text to Org mode 
mailing list (M-x org-submit-bug-report).
+The buffer is: %s\n Current command: %S\n Backtrace:\n%S"
+               org-element--cache-last-buffer-size
+               (buffer-size)
+               (buffer-name (current-buffer))
+               this-command
+               (when (and (fboundp 'backtrace-get-frames)
+                          (fboundp 'backtrace-to-string))
+                 (backtrace-to-string (backtrace-get-frames 'backtrace))))
+              (org-element-cache-reset))
+          (let ((inhibit-quit t) request next)
+            (setq org-element--cache-interrupt-C-g-count 0)
+           (when org-element--cache-sync-timer
+             (cancel-timer org-element--cache-sync-timer))
+            (let ((time-limit (time-add nil org-element-cache-sync-duration)))
+             (catch 'org-element--cache-interrupt
+                (when org-element--cache-sync-requests
+                  (org-element--cache-log-message "Syncing down to %S-%S" (or 
future-change threshold) threshold))
+               (while org-element--cache-sync-requests
+                 (setq request (car org-element--cache-sync-requests)
+                       next (nth 1 org-element--cache-sync-requests))
+                 (org-element--cache-process-request
+                  request
+                  (when next (org-element--request-key next))
+                  threshold
+                  (unless threshold time-limit)
+                  future-change
+                   offset)
+                  ;; Re-assign current and next requests.  It could have
+                  ;; been altered during phase 1.
+                  (setq request (car org-element--cache-sync-requests)
+                       next (nth 1 org-element--cache-sync-requests))
+                 ;; Request processed.  Merge current and next offsets and
+                 ;; transfer ending position.
+                 (when next
+                    ;; The following requests can only be either phase 1
+                    ;; or phase 2 requests.  We need to let them know
+                    ;; that additional shifting happened ahead of them.
+                   (cl-incf (org-element--request-offset next) 
(org-element--request-offset request))
+                    (org-element--cache-log-message
+                     "Updating next request offset to %S: %s"
+                     (org-element--request-offset next)
+                     (let ((print-length 10) (print-level 3)) (prin1-to-string 
next)))
+                    ;; FIXME: END part of the request only matters for
+                    ;; phase 0 requests.  However, the only possible
+                    ;; phase 0 request must be the first request in the
+                    ;; list all the time.  END position should be
+                    ;; unused.
+                    (setf (org-element--request-end next) 
(org-element--request-end request)))
+                 (setq org-element--cache-sync-requests
+                       (cdr org-element--cache-sync-requests)))))
+           ;; If more requests are awaiting, set idle timer accordingly.
+           ;; Otherwise, reset keys.
+           (if org-element--cache-sync-requests
+               (org-element--cache-set-timer buffer)
+              (setq org-element--cache-change-warning nil)
+              (setq org-element--cache-sync-keys-value (1+ 
org-element--cache-sync-keys-value)))))))))
 
 (defun org-element--cache-process-request
-    (request next threshold time-limit future-change)
+    (request next-request-key threshold time-limit future-change offset)
   "Process synchronization REQUEST for all entries before NEXT.
 
 REQUEST is a vector, built by `org-element--cache-submit-request'.
 
-NEXT is a cache key, as returned by `org-element--cache-key'.
+NEXT-REQUEST-KEY is a cache key of the next request, as returned by
+`org-element--cache-key'.
 
 When non-nil, THRESHOLD is a buffer position.  Synchronization
 stops as soon as a shifted element begins after it.
@@ -5426,180 +6070,373 @@ stops as soon as a shifted element begins after it.
 When non-nil, TIME-LIMIT is a time value.  Synchronization stops
 after this time or when Emacs exits idle state.
 
-When non-nil, FUTURE-CHANGE is a buffer position where changes
-not registered yet in the cache are going to happen.  See
-`org-element--cache-submit-request' for more information.
-
-Throw `interrupt' if the process stops before completing the
-request."
-  (catch 'quit
-    (when (= (aref request 5) 0)
-      ;; Phase 0.
-      ;;
-      ;; Delete all elements starting after BEG, but not after buffer
-      ;; position END or past element with key NEXT.  Also delete
-      ;; elements contained within a previously removed element
-      ;; (stored in `last-container').
-      ;;
-      ;; At each iteration, we start again at tree root since
-      ;; a deletion modifies structure of the balanced tree.
-      (catch 'end-phase
-        (while t
-         (when (org-element--cache-interrupt-p time-limit)
-           (throw 'interrupt nil))
-         ;; Find first element in cache with key BEG or after it.
-         (let ((beg (aref request 0))
-               (end (aref request 2))
-               (node (org-element--cache-root))
-               data data-key last-container)
-           (while node
-             (let* ((element (avl-tree--node-data node))
-                    (key (org-element--cache-key element)))
-               (cond
-                ((org-element--cache-key-less-p key beg)
-                 (setq node (avl-tree--node-right node)))
-                ((org-element--cache-key-less-p beg key)
-                 (setq data element
-                       data-key key
-                       node (avl-tree--node-left node)))
-                (t (setq data element
-                         data-key key
-                         node nil)))))
-           (if data
-               (let ((pos (org-element-property :begin data)))
-                 (if (if (or (not next)
-                             (org-element--cache-key-less-p data-key next))
-                         (<= pos end)
-                       (and last-container
-                            (let ((up data))
-                              (while (and up (not (eq up last-container)))
-                                (setq up (org-element-property :parent up)))
-                              up)))
-                     (progn (when (and (not last-container)
-                                       (> (org-element-property :end data)
-                                          end))
-                              (setq last-container data))
-                            (org-element--cache-remove data))
-                   (aset request 0 data-key)
-                   (aset request 1 pos)
-                   (aset request 5 1)
-                   (throw 'end-phase nil)))
-             ;; No element starting after modifications left in
-             ;; cache: further processing is futile.
-             (throw 'quit t))))))
-    (when (= (aref request 5) 1)
-      ;; Phase 1.
-      ;;
-      ;; Phase 0 left a hole in the cache.  Some elements after it
-      ;; could have parents within.  For example, in the following
-      ;; buffer:
-      ;;
-      ;;   - item
-      ;;
-      ;;
-      ;;     Paragraph1
-      ;;
-      ;;     Paragraph2
-      ;;
-      ;; if we remove a blank line between "item" and "Paragraph1",
-      ;; everything down to "Paragraph2" is removed from cache.  But
-      ;; the paragraph now belongs to the list, and its `:parent'
-      ;; property no longer is accurate.
+When non-nil, FUTURE-CHANGE is a buffer position where changes not
+registered yet in the cache are going to happen.  OFFSET is the
+changed text length.  See `org-element--cache-submit-request' for more
+information.
+
+Throw `org-element--cache-interrupt' if the process stops before
+completing the request."
+  (org-with-base-buffer nil
+    (org-element--cache-log-message
+     "org-element-cache: Processing request %s up to %S-%S, next: %S"
+     (let ((print-length 10) (print-level 3)) (prin1-to-string request))
+     future-change
+     threshold
+     next-request-key)
+    (catch 'org-element--cache-quit
+      (when (= (org-element--request-phase request) 0)
+        ;; Phase 0.
+        ;;
+        ;; Delete all elements starting after beginning of the element
+        ;; with request key NEXT, but not after buffer position END.
+        ;;
+        ;; At each iteration, we start again at tree root since
+        ;; a deletion modifies structure of the balanced tree.
+        (org-element--cache-log-message "Phase 0")
+        (catch 'org-element--cache-end-phase
+          (let ((deletion-count 0))
+            (while t
+             (when (org-element--cache-interrupt-p time-limit)
+                (org-element--cache-log-message "Interrupt: time limit")
+               (throw 'org-element--cache-interrupt nil))
+             (let ((request-key (org-element--request-key request))
+                   (end (org-element--request-end request))
+                   (node (org-element--cache-root))
+                   data data-key)
+               ;; Find first element in cache with key REQUEST-KEY or
+               ;; after it.
+               (while node
+                 (let* ((element (avl-tree--node-data node))
+                        (key (org-element--cache-key element)))
+                   (cond
+                    ((org-element--cache-key-less-p key request-key)
+                     (setq node (avl-tree--node-right node)))
+                    ((org-element--cache-key-less-p request-key key)
+                     (setq data element
+                           data-key key
+                           node (avl-tree--node-left node)))
+                    (t (setq data element
+                             data-key key
+                             node nil)))))
+               (if data
+                    ;; We found first element in cache starting at or
+                    ;; after REQUEST-KEY.
+                   (let ((pos (org-element-property :begin data)))
+                      ;; FIXME: Maybe simply (< pos end)?
+                     (if (<= pos end)
+                          (progn
+                            (org-element--cache-log-message "removing %S::%S"
+                                                 (org-element-property 
:org-element--cache-sync-key data)
+                                                 (org-element--format-element 
data))
+                            (cl-incf deletion-count)
+                            (org-element--cache-remove data)
+                            (when (and (> (log org-element--cache-size 2) 10)
+                                       (> deletion-count
+                                          (/ org-element--cache-size (log 
org-element--cache-size 2))))
+                              (org-element--cache-log-message "Removed 
%S>N/LogN(=%S/%S) elements.  Resetting cache to prevent performance degradation"
+                                                   deletion-count
+                                                   org-element--cache-size
+                                                   (log 
org-element--cache-size 2))
+                              (org-element-cache-reset)
+                              (throw 'org-element--cache-quit t)))
+                        ;; Done deleting everything starting before END.
+                        ;; DATA-KEY is the first known element after END.
+                        ;; Move on to phase 1.
+                        (org-element--cache-log-message
+                         "found element after %S: %S::%S"
+                         end
+                         (org-element-property :org-element--cache-sync-key 
data)
+                         (org-element--format-element data))
+                        (setf (org-element--request-key request) data-key)
+                        (setf (org-element--request-beg request) pos)
+                        (setf (org-element--request-phase request) 1)
+                       (throw 'org-element--cache-end-phase nil)))
+                 ;; No element starting after modifications left in
+                 ;; cache: further processing is futile.
+                  (org-element--cache-log-message
+                   "Phase 0 deleted all elements in cache after %S!"
+                   request-key)
+                 (throw 'org-element--cache-quit t)))))))
+      (when (= (org-element--request-phase request) 1)
+        ;; Phase 1.
+        ;;
+        ;; Phase 0 left a hole in the cache.  Some elements after it
+        ;; could have parents within.  For example, in the following
+        ;; buffer:
+        ;;
+        ;;   - item
+        ;;
+        ;;
+        ;;     Paragraph1
+        ;;
+        ;;     Paragraph2
+        ;;
+        ;; if we remove a blank line between "item" and "Paragraph1",
+        ;; everything down to "Paragraph2" is removed from cache.  But
+        ;; the paragraph now belongs to the list, and its `:parent'
+        ;; property no longer is accurate.
+        ;;
+        ;; Therefore we need to parse again elements in the hole, or at
+        ;; least in its last section, so that we can re-parent
+        ;; subsequent elements, during phase 2.
+        ;;
+        ;; Note that we only need to get the parent from the first
+        ;; element in cache after the hole.
+        ;;
+        ;; When next key is lesser or equal to the current one, current
+        ;; request is inside a to-be-shifted part of the cache.  It is
+        ;; fine because the order of elements will not be altered by
+        ;; shifting.  However, we cannot know the real position of the
+        ;; unshifted NEXT element in the current request.  So, we need
+        ;; to sort the request list according to keys and re-start
+        ;; processing from the new leftmost request.
+        (org-element--cache-log-message "Phase 1")
+        (let ((key (org-element--request-key request)))
+         (when (and next-request-key (not (org-element--cache-key-less-p key 
next-request-key)))
+            ;; In theory, the only case when requests are not
+            ;; ordered is when key of the next request is either the
+            ;; same with current key or it is a key for a removed
+            ;; element. Either way, we can simply merge the two
+            ;; requests.
+           (let ((next-request (nth 1 org-element--cache-sync-requests)))
+              (org-element--cache-log-message "Phase 1: Unorderered requests. 
Merging: %S\n%S\n"
+                                   (let ((print-length 10) (print-level 3)) 
(prin1-to-string request))
+                                   (let ((print-length 10) (print-level 3)) 
(prin1-to-string next-request)))
+             (setf (org-element--request-key next-request) key)
+              (setf (org-element--request-beg next-request) 
(org-element--request-beg request))
+             (setf (org-element--request-phase next-request) 1)
+              (throw 'org-element--cache-quit t))))
+        ;; Next element will start at its beginning position plus
+        ;; offset, since it hasn't been shifted yet.  Therefore, LIMIT
+        ;; contains the real beginning position of the first element to
+        ;; shift and re-parent.
+        (let ((limit (+ (org-element--request-beg request) 
(org-element--request-offset request)))
+              cached-before)
+         (cond ((and threshold (> limit threshold))
+                 (org-element--cache-log-message "Interrupt: position %S after 
threshold %S" limit threshold)
+                 (throw 'org-element--cache-interrupt nil))
+               ((and future-change (>= limit future-change))
+                ;; Changes happened around this element and they will
+                ;; trigger another phase 1 request.  Skip re-parenting
+                ;; and simply proceed with shifting (phase 2) to make
+                ;; sure that followup phase 0 request for the recent
+                ;; changes can operate on the correctly shifted cache.
+                 (org-element--cache-log-message "position %S after future 
change %S" limit future-change)
+                 (setf (org-element--request-parent request) nil)
+                 (setf (org-element--request-phase request) 2))
+               (t
+                 (when future-change
+                   ;; Changes happened, but not yet registered after
+                   ;; this element.  However, we a not yet safe to look
+                   ;; at the buffer and parse elements in the cache gap.
+                   ;; Some of the parents to be added to cache may end
+                   ;; after the changes.  Parsing this parents will
+                   ;; assign the :end correct value for cache state
+                   ;; after future-change.  Then, when the future change
+                   ;; is going to be processed, such parent boundary
+                   ;; will be altered unnecessarily.  To avoid this,
+                   ;; we alter the new parents by -OFFSET.
+                   ;; For now, just save last known cached element and
+                   ;; then check all the parents below.
+                   (setq cached-before (org-element--cache-find (1- limit) 
nil)))
+                 ;; No relevant changes happened after submitting this
+                 ;; request.  We are safe to look at the actual Org
+                 ;; buffer and calculate the new parent.
+                (let ((parent (org-element--parse-to (1- limit) nil 
time-limit)))
+                   (when future-change
+                     ;; Check all the newly added parents to not
+                     ;; intersect with future change.
+                     (let ((up parent))
+                       (while (and up
+                                   (or (not cached-before)
+                                       (> (org-element-property :begin up)
+                                          (org-element-property :begin 
cached-before))))
+                         (when (> (org-element-property :end up) future-change)
+                           ;; Offset future cache request.
+                           (org-element--cache-shift-positions
+                            up (- offset)
+                            (if (and (org-element-property :robust-begin up)
+                                     (org-element-property :robust-end up))
+                                '(:contents-end :end :robust-end)
+                              '(:contents-end :end))))
+                         (setq up (org-element-property :parent up)))))
+                   (org-element--cache-log-message
+                    "New parent at %S: %S::%S"
+                    limit
+                    (org-element-property :org-element--cache-sync-key parent)
+                    (org-element--format-element parent))
+                   (setf (org-element--request-parent request) parent)
+                  (setf (org-element--request-phase request) 2))))))
+      ;; Phase 2.
       ;;
-      ;; Therefore we need to parse again elements in the hole, or at
-      ;; least in its last section, so that we can re-parent
-      ;; subsequent elements, during phase 2.
+      ;; Shift all elements starting from key START, but before NEXT, by
+      ;; OFFSET, and re-parent them when appropriate.
       ;;
-      ;; Note that we only need to get the parent from the first
-      ;; element in cache after the hole.
+      ;; Elements are modified by side-effect so the tree structure
+      ;; remains intact.
       ;;
-      ;; When next key is lesser or equal to the current one, delegate
-      ;; phase 1 processing to next request in order to preserve key
-      ;; order among requests.
-      (let ((key (aref request 0)))
-       (when (and next (not (org-element--cache-key-less-p key next)))
-         (let ((next-request (nth 1 org-element--cache-sync-requests)))
-           (aset next-request 0 key)
-           (aset next-request 1 (aref request 1))
-           (aset next-request 5 1))
-         (throw 'quit t)))
-      ;; Next element will start at its beginning position plus
-      ;; offset, since it hasn't been shifted yet.  Therefore, LIMIT
-      ;; contains the real beginning position of the first element to
-      ;; shift and re-parent.
-      (let ((limit (+ (aref request 1) (aref request 3))))
-       (cond ((and threshold (> limit threshold)) (throw 'interrupt nil))
-             ((and future-change (>= limit future-change))
-              ;; Changes are going to happen around this element and
-              ;; they will trigger another phase 1 request.  Skip the
-              ;; current one.
-              (aset request 5 2))
-             (t
-              (let ((parent (org-element--parse-to limit t time-limit)))
-                (aset request 4 parent)
-                (aset request 5 2))))))
-    ;; Phase 2.
-    ;;
-    ;; Shift all elements starting from key START, but before NEXT, by
-    ;; OFFSET, and re-parent them when appropriate.
-    ;;
-    ;; Elements are modified by side-effect so the tree structure
-    ;; remains intact.
-    ;;
-    ;; Once THRESHOLD, if any, is reached, or once there is an input
-    ;; pending, exit.  Before leaving, the current synchronization
-    ;; request is updated.
-    (let ((start (aref request 0))
-         (offset (aref request 3))
-         (parent (aref request 4))
-         (node (org-element--cache-root))
-         (stack (list nil))
-         (leftp t)
-         exit-flag)
-      ;; No re-parenting nor shifting planned: request is over.
-      (when (and (not parent) (zerop offset)) (throw 'quit t))
-      (while node
-       (let* ((data (avl-tree--node-data node))
-              (key (org-element--cache-key data)))
-         (if (and leftp (avl-tree--node-left node)
-                  (not (org-element--cache-key-less-p key start)))
-             (progn (push node stack)
-                    (setq node (avl-tree--node-left node)))
-           (unless (org-element--cache-key-less-p key start)
-             ;; We reached NEXT.  Request is complete.
-             (when (equal key next) (throw 'quit t))
-             ;; Handle interruption request.  Update current request.
-             (when (or exit-flag (org-element--cache-interrupt-p time-limit))
-               (aset request 0 key)
-               (aset request 4 parent)
-               (throw 'interrupt nil))
-             ;; Shift element.
-             (unless (zerop offset)
-               (org-element--cache-shift-positions data offset))
-             (let ((begin (org-element-property :begin data)))
-               ;; Update PARENT and re-parent DATA, only when
-               ;; necessary.  Propagate new structures for lists.
-               (while (and parent
-                           (<= (org-element-property :end parent) begin))
-                 (setq parent (org-element-property :parent parent)))
-               (cond ((and (not parent) (zerop offset)) (throw 'quit nil))
-                     ((and parent
-                           (let ((p (org-element-property :parent data)))
-                             (or (not p)
-                                 (< (org-element-property :begin p)
-                                    (org-element-property :begin parent)))))
-                      (org-element-put-property data :parent parent)
-                      (let ((s (org-element-property :structure parent)))
-                        (when (and s (org-element-property :structure data))
-                          (org-element-put-property data :structure s)))))
-               ;; Cache is up-to-date past THRESHOLD.  Request
-               ;; interruption.
-               (when (and threshold (> begin threshold)) (setq exit-flag t))))
-           (setq node (if (setq leftp (avl-tree--node-right node))
-                          (avl-tree--node-right node)
-                        (pop stack))))))
-      ;; We reached end of tree: synchronization complete.
-      t)))
+      ;; Once THRESHOLD, if any, is reached, or once there is an input
+      ;; pending, exit.  Before leaving, the current synchronization
+      ;; request is updated.
+      (org-element--cache-log-message "Phase 2")
+      (let ((start (org-element--request-key request))
+           (offset (org-element--request-offset request))
+           (parent (org-element--request-parent request))
+           (node (org-element--cache-root))
+           (stack (list nil))
+           (leftp t)
+           exit-flag continue-flag)
+        ;; No re-parenting nor shifting planned: request is over.
+        (when (and (not parent) (zerop offset))
+          (org-element--cache-log-message "Empty offset. Request completed.")
+          (throw 'org-element--cache-quit t))
+        (while node
+         (let* ((data (avl-tree--node-data node))
+                (key (org-element--cache-key data)))
+            ;; Traverse the cache tree.  Ignore all the elements before
+            ;; START.  Note that `avl-tree-stack' would not bypass the
+            ;; elements before START and thus would have been less
+            ;; efficient.
+           (if (and leftp (avl-tree--node-left node)
+                    (not (org-element--cache-key-less-p key start)))
+               (progn (push node stack)
+                      (setq node (avl-tree--node-left node)))
+              ;; Shift and re-parent when current node starts at or
+              ;; after START, but before NEXT.
+             (unless (org-element--cache-key-less-p key start)
+               ;; We reached NEXT.  Request is complete.
+               (when (and next-request-key
+                           (not (org-element--cache-key-less-p key 
next-request-key)))
+                  (org-element--cache-log-message "Reached next request.")
+                  (let ((next-request (nth 1 
org-element--cache-sync-requests)))
+                    (unless (and (org-element-property :cached 
(org-element--request-parent next-request))
+                                 (org-element-property :begin 
(org-element--request-parent next-request))
+                                 parent
+                                 (> (org-element-property :begin 
(org-element--request-parent next-request))
+                                    (org-element-property :begin parent)))
+                      (setf (org-element--request-parent next-request) 
parent)))
+                  (throw 'org-element--cache-quit t))
+               ;; Handle interruption request.  Update current request.
+               (when (or exit-flag (org-element--cache-interrupt-p time-limit))
+                  (org-element--cache-log-message "Interrupt: %s" (if 
exit-flag "threshold" "time limit"))
+                  (setf (org-element--request-key request) key)
+                  (setf (org-element--request-parent request) parent)
+                  (throw 'org-element--cache-interrupt nil))
+               ;; Shift element.
+               (unless (zerop offset)
+                  (when (>= org-element--cache-diagnostics-level 3)
+                    (org-element--cache-log-message "Shifting positions (𝝙%S) 
in %S::%S"
+                                         offset
+                                         (org-element-property 
:org-element--cache-sync-key data)
+                                         (org-element--format-element data)))
+                 (org-element--cache-shift-positions data offset))
+               (let ((begin (org-element-property :begin data)))
+                 ;; Update PARENT and re-parent DATA, only when
+                 ;; necessary.  Propagate new structures for lists.
+                 (while (and parent
+                             (<= (org-element-property :end parent) begin))
+                   (setq parent (org-element-property :parent parent)))
+                 (cond ((and (not parent) (zerop offset)) (throw 
'org-element--cache-quit nil))
+                        ;; Consider scenario when DATA lays within
+                        ;; sensitive lines of PARENT that was found
+                        ;; during phase 2.  For example:
+                        ;;
+                        ;; #+ begin_quote
+                        ;; Paragraph
+                        ;; #+end_quote
+                        ;;
+                        ;; In the above source block, remove space in
+                        ;; the first line will trigger re-parenting of
+                        ;; the paragraph and "#+end_quote" that is also
+                        ;; considered paragraph before the modification.
+                        ;; However, the paragraph element stored in
+                        ;; cache must be deleted instead.
+                        ((and parent
+                              (or (not (memq (org-element-type parent) 
org-element-greater-elements))
+                                  (and (org-element-property :contents-begin 
parent)
+                                       (< (org-element-property :begin data) 
(org-element-property :contents-begin parent)))
+                                  (and (org-element-property :contents-end 
parent)
+                                       (>= (org-element-property :begin data) 
(org-element-property :contents-end parent)))
+                                  (> (org-element-property :end data) 
(org-element-property :end parent))
+                                  (and (org-element-property :contents-end 
data)
+                                       (> (org-element-property :contents-end 
data) (org-element-property :contents-end parent)))))
+                         (org-element--cache-log-message "org-element-cache: 
Removing obsolete element with key %S::%S"
+                                              (org-element-property 
:org-element--cache-sync-key data)
+                                              (org-element--format-element 
data))
+                         (org-element--cache-remove data)
+                         ;; We altered the tree structure.  The tree
+                         ;; traversal needs to be restarted.
+                         (setf (org-element--request-key request) key)
+                         (setf (org-element--request-parent request) parent)
+                         ;; Restart tree traversal.
+                         (setq node (org-element--cache-root)
+                              stack (list nil)
+                              leftp t
+                               begin -1
+                               continue-flag t))
+                       ((and parent
+                              (not (eq parent data))
+                             (let ((p (org-element-property :parent data)))
+                               (or (not p)
+                                   (< (org-element-property :begin p)
+                                      (org-element-property :begin parent))
+                                    (unless (eq p parent)
+                                      (not (org-element-property :cached p))
+                                      ;; (not (avl-tree-member-p 
org-element--cache p))
+                                      ))))
+                         (org-element--cache-log-message
+                          "Updating parent in %S\n Old parent: %S\n New 
parent: %S"
+                          (org-element--format-element data)
+                          (org-element--format-element (org-element-property 
:parent data))
+                          (org-element--format-element parent))
+                         (when (and (eq 'org-data (org-element-type parent))
+                                    (not (eq 'headline (org-element-type 
data))))
+                           ;; FIXME: This check is here to see whether
+                           ;; such error happens within
+                           ;; `org-element--cache-process-request' or somewhere
+                           ;; else.
+                           (org-element--cache-warn
+                            "Added org-data parent to non-headline element: %S
+If this warning appears regularly, please report the warning text to Org mode 
mailing list (M-x org-submit-bug-report)."
+                            data)
+                           (org-element-cache-reset)
+                           (throw 'org-element--cache-quit t))
+                        (org-element-put-property data :parent parent)
+                        (let ((s (org-element-property :structure parent)))
+                          (when (and s (org-element-property :structure data))
+                            (org-element-put-property data :structure s)))))
+                 ;; Cache is up-to-date past THRESHOLD.  Request
+                 ;; interruption.
+                 (when (and threshold (> begin threshold))
+                    (org-element--cache-log-message "Reached threshold %S: %S"
+                                         threshold
+                                         (org-element--format-element data))
+                    (setq exit-flag t))))
+              (if continue-flag
+                  (setq continue-flag nil)
+               (setq node (if (setq leftp (avl-tree--node-right node))
+                              (avl-tree--node-right node)
+                            (pop stack)))))))
+        ;; We reached end of tree: synchronization complete.
+        t))
+    (org-element--cache-log-message
+     "org-element-cache: Finished process. The cache size is %S. The remaining 
sync requests: %S"
+     org-element--cache-size
+     (let ((print-level 2)) (prin1-to-string 
org-element--cache-sync-requests)))))
+
+(defsubst org-element--open-end-p (element)
+  "Check if ELEMENT in current buffer contains extra blank lines after
+it and does not have closing term.
+
+Examples of such elements are: section, headline, org-data,
+and footnote-definition."
+  (and (org-element-property :contents-end element)
+       (= (org-element-property :contents-end element)
+          (save-excursion
+            (goto-char (org-element-property :end element))
+            (skip-chars-backward " \r\n\t")
+            (line-beginning-position 2)))))
 
 (defun org-element--parse-to (pos &optional syncp time-limit)
   "Parse elements in current section, down to POS.
@@ -5611,129 +6448,216 @@ POS.
 When optional argument SYNCP is non-nil, return the parent of the
 element containing POS instead.  In that case, it is also
 possible to provide TIME-LIMIT, which is a time value specifying
-when the parsing should stop.  The function throws `interrupt' if
-the process stopped before finding the expected result."
+when the parsing should stop.  The function throws
+`org-element--cache-interrupt' if the process stopped before finding
+the expected result."
   (catch 'exit
-    (org-with-wide-buffer
-     (goto-char pos)
-     (let* ((cached (and (org-element--cache-active-p)
-                        (org-element--cache-find pos nil)))
-            (begin (org-element-property :begin cached))
-            element next mode)
-       (cond
-        ;; Nothing in cache before point: start parsing from first
-        ;; element following headline above, or first element in
-        ;; buffer.
-        ((not cached)
-         (if (org-with-limited-levels (outline-previous-heading))
-             (progn
-              (setq mode 'planning)
-              (forward-line))
-          (setq mode 'top-comment))
-         (skip-chars-forward " \r\t\n")
-         (beginning-of-line))
-        ;; Cache returned exact match: return it.
-        ((= pos begin)
-        (throw 'exit (if syncp (org-element-property :parent cached) cached)))
-        ;; There's a headline between cached value and POS: cached
-        ;; value is invalid.  Start parsing from first element
-        ;; following the headline.
-        ((re-search-backward
-          (org-with-limited-levels org-outline-regexp-bol) begin t)
-         (forward-line)
-         (skip-chars-forward " \r\t\n")
-         (beginning-of-line)
-        (setq mode 'planning))
-        ;; Check if CACHED or any of its ancestors contain point.
-        ;;
-        ;; If there is such an element, we inspect it in order to know
-        ;; if we return it or if we need to parse its contents.
-        ;; Otherwise, we just start parsing from current location,
-        ;; which is right after the top-most element containing
-        ;; CACHED.
-        ;;
-        ;; As a special case, if POS is at the end of the buffer, we
-        ;; want to return the innermost element ending there.
-        ;;
-        ;; Also, if we find an ancestor and discover that we need to
-        ;; parse its contents, make sure we don't start from
-        ;; `:contents-begin', as we would otherwise go past CACHED
-        ;; again.  Instead, in that situation, we will resume parsing
-        ;; from NEXT, which is located after CACHED or its higher
-        ;; ancestor not containing point.
-        (t
-         (let ((up cached)
-               (pos (if (= (point-max) pos) (1- pos) pos)))
-           (goto-char (or (org-element-property :contents-begin cached) begin))
-           (while (let ((end (org-element-property :end up)))
-                    (and (<= end pos)
-                         (goto-char end)
-                         (setq up (org-element-property :parent up)))))
-           (cond ((not up))
-                 ((eobp) (setq element up))
-                 (t (setq element up next (point)))))))
-       ;; Parse successively each element until we reach POS.
-       (let ((end (or (org-element-property :end element)
-                     (save-excursion
-                       (org-with-limited-levels (outline-next-heading))
-                       (point))))
-            (parent element))
-        (while t
-          (when syncp
-            (cond ((= (point) pos) (throw 'exit parent))
-                  ((org-element--cache-interrupt-p time-limit)
-                   (throw 'interrupt nil))))
-          (unless element
-            (setq element (org-element--current-element
-                           end 'element mode
-                           (org-element-property :structure parent)))
-            (org-element-put-property element :parent parent)
-            (org-element--cache-put element))
-          (let ((elem-end (org-element-property :end element))
-                (type (org-element-type element)))
-            (cond
-             ;; Skip any element ending before point.  Also skip
-             ;; element ending at point (unless it is also the end of
-             ;; buffer) since we're sure that another element begins
-             ;; after it.
-             ((and (<= elem-end pos) (/= (point-max) elem-end))
-              (goto-char elem-end)
-              (setq mode (org-element--next-mode mode type nil)))
-             ;; A non-greater element contains point: return it.
-             ((not (memq type org-element-greater-elements))
-              (throw 'exit element))
-             ;; Otherwise, we have to decide if ELEMENT really
-             ;; contains POS.  In that case we start parsing from
-             ;; contents' beginning.
-             ;;
-             ;; If POS is at contents' beginning but it is also at
-             ;; the beginning of the first item in a list or a table.
-             ;; In that case, we need to create an anchor for that
-             ;; list or table, so return it.
-             ;;
-             ;; Also, if POS is at the end of the buffer, no element
-             ;; can start after it, but more than one may end there.
-             ;; Arbitrarily, we choose to return the innermost of
-             ;; such elements.
-             ((let ((cbeg (org-element-property :contents-begin element))
-                    (cend (org-element-property :contents-end element)))
-                (when (or syncp
-                          (and cbeg cend
-                               (or (< cbeg pos)
-                                   (and (= cbeg pos)
-                                        (not (memq type '(plain-list table)))))
-                               (or (> cend pos)
-                                   (and (= cend pos) (= (point-max) pos)))))
-                  (goto-char (or next cbeg))
-                  (setq next nil
-                        mode (org-element--next-mode mode type t)
-                        parent element
-                        end cend))))
-             ;; Otherwise, return ELEMENT as it is the smallest
-             ;; element containing POS.
-             (t (throw 'exit element))))
-          (setq element nil)))))))
-
+    (save-match-data
+      (org-with-base-buffer nil
+        (org-with-wide-buffer
+         (goto-char pos)
+         (save-excursion
+           (end-of-line)
+           (skip-chars-backward " \r\t\n")
+           ;; Within blank lines at the beginning of buffer, return nil.
+           (when (bobp) (throw 'exit nil)))
+         (let* ((cached (and (org-element--cache-active-p)
+                            (org-element--cache-find pos nil)))
+                (mode (org-element-property :mode cached))
+                element next)
+           (cond
+            ;; Nothing in cache before point: start parsing from first
+            ;; element in buffer down to POS or from the beginning of the
+            ;; file.
+            ((and (not cached) (org-element--cache-active-p))
+             (setq element (org-element-org-data-parser))
+             (unless (org-element-property :begin element)
+               (org-element--cache-warn "Error parsing org-data. Got 
%S\nPlease report to Org mode mailing list (M-x org-submit-bug-report)." 
element))
+             (org-element--cache-log-message
+              "Nothing in cache. Adding org-data: %S"
+              (org-element--format-element element))
+             (org-element--cache-put element)
+             (goto-char (org-element-property :contents-begin element))
+            (setq mode 'org-data))
+            ;; Nothing in cache before point because cache is not active.
+            ;; Parse from previous heading to avoid re-parsing the whole
+            ;; buffer above.  This comes at the cost of not calculating
+            ;; `:parent' property for headings.
+            ((not cached)
+             (if (org-with-limited-levels (outline-previous-heading))
+                 (progn
+                   (setq element (org-element-headline-parser nil 'fast))
+                  (setq mode 'planning)
+                  (forward-line))
+               (setq element (org-element-org-data-parser))
+              (setq mode 'org-data))
+             (org-skip-whitespace)
+             (beginning-of-line))
+            ;; Check if CACHED or any of its ancestors contain point.
+            ;;
+            ;; If there is such an element, we inspect it in order to know
+            ;; if we return it or if we need to parse its contents.
+            ;; Otherwise, we just start parsing from location, which is
+            ;; right after the top-most element containing CACHED but
+            ;; still before POS.
+            ;;
+            ;; As a special case, if POS is at the end of the buffer, we
+            ;; want to return the innermost element ending there.
+            ;;
+            ;; Also, if we find an ancestor and discover that we need to
+            ;; parse its contents, make sure we don't start from
+            ;; `:contents-begin', as we would otherwise go past CACHED
+            ;; again.  Instead, in that situation, we will resume parsing
+            ;; from NEXT, which is located after CACHED or its higher
+            ;; ancestor not containing point.
+            (t
+             (let ((up cached)
+                   (pos (if (= (point-max) pos) (1- pos) pos)))
+               (while (and up (<= (org-element-property :end up) pos))
+                 (goto-char (org-element-property :end up))
+                 (setq element up
+                       mode (org-element--next-mode (org-element-property 
:mode element) (org-element-type element) nil)
+                       up (org-element-property :parent up)
+                       next (point)))
+               (when up (setq element up)))))
+           ;; Parse successively each element until we reach POS.
+           (let ((end (or (org-element-property :end element) (point-max)))
+                (parent (org-element-property :parent element)))
+             (while t
+              (when (org-element--cache-interrupt-p time-limit)
+                 (throw 'org-element--cache-interrupt nil))
+               (when (and inhibit-quit org-element--cache-interrupt-C-g 
quit-flag)
+                 (when quit-flag
+                  (cl-incf org-element--cache-interrupt-C-g-count)
+                   (setq quit-flag nil))
+                 (when (>= org-element--cache-interrupt-C-g-count
+                           org-element--cache-interrupt-C-g-max-count)
+                   (setq quit-flag t)
+                   (setq org-element--cache-interrupt-C-g-count 0)
+                   (org-element-cache-reset)
+                   (error "org-element: Parsing aborted by user.  Cache has 
been cleared.
+If you observe Emacs hangs frequently, please report this to Org mode mailing 
list (M-x org-submit-bug-report)."))
+                 (message (substitute-command-keys
+                           "`org-element--parse-buffer': Suppressed 
`\\[keyboard-quit]'.  Press `\\[keyboard-quit]' %d more times to force 
interruption.")
+                          (- org-element--cache-interrupt-C-g-max-count
+                             org-element--cache-interrupt-C-g-count)))
+              (unless element
+                 ;; Do not try to parse within blank at EOB.
+                 (unless (save-excursion
+                           (org-skip-whitespace)
+                           (eobp))
+                   (org-element-with-disabled-cache
+                     (setq element (org-element--current-element
+                                   end 'element mode
+                                   (org-element-property :structure parent)))))
+                 ;; Make sure that we return referenced element in cache
+                 ;; that can be altered directly.
+                 (if element
+                     (setq element (or (org-element--cache-put element) 
element))
+                   ;; Nothing to parse (i.e. empty file).
+                   (throw 'exit parent))
+                 (unless (or (not (org-element--cache-active-p)) parent)
+                   (org-element--cache-warn
+                    "Got empty parent while parsing. Please report it to Org 
mode mailing list (M-x org-submit-bug-report).\n Backtrace:\n%S"
+                    (when (and (fboundp 'backtrace-get-frames)
+                               (fboundp 'backtrace-to-string))
+                      (backtrace-to-string (backtrace-get-frames 'backtrace))
+                      (org-element-cache-reset)
+                      (error "org-element--cache: Emergency exit"))))
+                (org-element-put-property element :parent parent))
+              (let ((elem-end (org-element-property :end element))
+                    (type (org-element-type element)))
+                (cond
+                 ;; Skip any element ending before point.  Also skip
+                 ;; element ending at point (unless it is also the end of
+                 ;; buffer) since we're sure that another element begins
+                 ;; after it.
+                 ((and (<= elem-end pos) (/= (point-max) elem-end))
+                   ;; Avoid parsing headline siblings above.
+                   (goto-char elem-end)
+                   (when (eq type 'headline)
+                     (save-match-data
+                       (unless (when (and (/= 1 (org-element-property :level 
element))
+                                          (re-search-forward
+                                           (rx-to-string
+                                            `(and bol (repeat 1 ,(1- (let 
((level (org-element-property :level element)))
+                                                                       (if 
org-odd-levels-only (1- (* level 2)) level)))
+                                                              "*")
+                                                  " "))
+                                           pos t))
+                                 (beginning-of-line)
+                                 t)
+                         ;; There are headings with lower level than
+                         ;; ELEMENT between ELEM-END and POS.  Siblings
+                         ;; may exist though.  Parse starting from the
+                         ;; last sibling or from ELEM-END if there are
+                         ;; no other siblings.
+                         (goto-char pos)
+                         (unless
+                             (re-search-backward
+                              (rx-to-string
+                               `(and bol (repeat ,(let ((level 
(org-element-property :level element)))
+                                                    (if org-odd-levels-only 
(1- (* level 2)) level))
+                                                 "*")
+                                     " "))
+                              elem-end t)
+                           ;; Roll-back to normal parsing.
+                           (goto-char elem-end)))))
+                  (setq mode (org-element--next-mode mode type nil)))
+                 ;; A non-greater element contains point: return it.
+                 ((not (memq type org-element-greater-elements))
+                  (throw 'exit (if syncp parent element)))
+                 ;; Otherwise, we have to decide if ELEMENT really
+                 ;; contains POS.  In that case we start parsing from
+                 ;; contents' beginning.
+                 ;;
+                 ;; If POS is at contents' beginning but it is also at
+                 ;; the beginning of the first item in a list or a table.
+                 ;; In that case, we need to create an anchor for that
+                 ;; list or table, so return it.
+                 ;;
+                 ;; Also, if POS is at the end of the buffer, no element
+                 ;; can start after it, but more than one may end there.
+                 ;; Arbitrarily, we choose to return the innermost of
+                 ;; such elements.
+                 ((let ((cbeg (org-element-property :contents-begin element))
+                        (cend (org-element-property :contents-end element)))
+                    (when (and cbeg cend
+                               (or (< cbeg pos)
+                                   (and (= cbeg pos)
+                                        (not (memq type '(plain-list table)))))
+                               (or (> cend pos)
+                                    ;; When we are at cend or within blank
+                                    ;; lines after, it is a special case:
+                                    ;; 1. At the end of buffer we return
+                                    ;; the innermost element.
+                                    ;; 2. At cend of element with return
+                                    ;; that element.
+                                    ;; 3. At the end of element, we would
+                                    ;; return in the earlier cond form.
+                                    ;; 4. Within blank lines after cend,
+                                    ;; when element does not have a
+                                    ;; closing keyword, we return that
+                                    ;; outermost element, unless the
+                                    ;; outermost element is a non-empty
+                                    ;; headline.  In the latter case, we
+                                    ;; return the outermost element inside
+                                    ;; the headline section.
+                                   (and (org-element--open-end-p element)
+                                         (or (= (org-element-property :end 
element) (point-max))
+                                             (and (>= pos 
(org-element-property :contents-end element))
+                                                  (memq (org-element-type 
element) '(org-data section headline)))))))
+                      (goto-char (or next cbeg))
+                      (setq mode (if next mode (org-element--next-mode mode 
type t))
+                             next nil
+                            parent element
+                            end (if (org-element--open-end-p element)
+                                     (org-element-property :end element)
+                                   (org-element-property :contents-end 
element))))))
+                 ;; Otherwise, return ELEMENT as it is the smallest
+                 ;; element containing POS.
+                 (t (throw 'exit (if syncp parent element)))))
+              (setq element nil)))))))))
 
 ;;;; Staging Buffer Changes
 
@@ -5742,8 +6666,9 @@ the process stopped before finding the expected result."
    "^\\*+ " "\\|"
    "\\\\end{[A-Za-z0-9*]+}[ \t]*$" "\\|"
    "^[ \t]*\\(?:"
-   "#\\+\\(?:BEGIN[:_]\\|END\\(?:_\\|:?[ \t]*$\\)\\)" "\\|"
-   "\\\\begin{[A-Za-z0-9*]+}" "\\|"
+   "#\\+END\\(?:_\\|:?[ \t]*$\\)" "\\|"
+   org-list-full-item-re "\\|"
+   ":\\(?: \\|$\\)" "\\|"
    ":\\(?:\\w\\|[-_]\\)+:[ \t]*$"
    "\\)")
   "Regexp matching a sensitive line, structure wise.
@@ -5752,67 +6677,133 @@ latex-environment boundary.  When such a line is 
modified,
 structure changes in the document may propagate in the whole
 section, possibly making cache invalid.")
 
-(defvar org-element--cache-change-warning nil
-  "Non-nil when a sensitive line is about to be changed.
-It is a symbol among nil, t and `headline'.")
-
 (defun org-element--cache-before-change (beg end)
-  "Request extension of area going to be modified if needed.
+  "Detect modifications in sensitive parts of Org buffer.
 BEG and END are the beginning and end of the range of changed
-text.  See `before-change-functions' for more information."
-  (when (org-element--cache-active-p)
-    (org-with-wide-buffer
-     (goto-char beg)
-     (beginning-of-line)
-     (let ((bottom (save-excursion (goto-char end) (line-end-position))))
-       (setq org-element--cache-change-warning
-            (save-match-data
-              (if (and (org-with-limited-levels (org-at-heading-p))
-                       (= (line-end-position) bottom))
-                  'headline
-                (let ((case-fold-search t))
-                  (re-search-forward
-                   org-element--cache-sensitive-re bottom t)))))))))
+text.  See `before-change-functions' for more information.
+
+The function returns the new value of `org-element--cache-change-warning'."
+  (org-with-base-buffer nil
+    (when (org-element--cache-active-p t)
+      (org-with-wide-buffer
+       (setq org-element--cache-change-tic (buffer-chars-modified-tick))
+       (setq org-element--cache-last-buffer-size (buffer-size))
+       (goto-char beg)
+       (beginning-of-line)
+       (let ((bottom (save-excursion
+                       (goto-char end)
+                       (if (and (bolp)
+                                ;; When beg == end, still extent to eol.
+                                (> (point) beg))
+                           ;; FIXME: Potential pitfall.
+                           ;; We are appending to an element end.
+                           ;; Unless the last inserted char is not
+                           ;; newline, the next element is not broken
+                           ;; and does not need to be purged from the
+                           ;; cache.
+                           end
+                         (line-end-position)))))
+         (prog1
+             ;; Use the worst change warning to not miss important edits.
+             ;; This function is called before edit and after edit by
+             ;; `org-element--cache-after-change'.  Before the edit, we still
+             ;; want to use the old value if it comes from previous
+             ;; not yet processed edit (they may be merged by
+             ;; `org-element--cache-submit-request').  After the edit, we want 
to
+             ;; look if there was a sensitive removed during edit.
+             ;; FIXME: This is not the most efficient way and we now
+             ;; have to delete more elements than needed in some
+             ;; cases.  A better approach may be storing the warning
+             ;; in the modification request itself.
+             (let ((org-element--cache-change-warning-before 
org-element--cache-change-warning)
+                   (org-element--cache-change-warning-after))
+               (setq org-element--cache-change-warning-after
+                    (save-match-data
+                       (let ((case-fold-search t))
+                         (when (re-search-forward
+                               org-element--cache-sensitive-re bottom t)
+                           (goto-char beg)
+                           (beginning-of-line)
+                           (let (min-level)
+                             (cl-loop while (re-search-forward
+                                             (rx-to-string
+                                              (if (and min-level
+                                                       (> min-level 1))
+                                                  `(and bol (repeat 1 ,(1- 
min-level) "*") " ")
+                                                `(and bol (+ "*") " ")))
+                                             bottom t)
+                                      do (setq min-level (1- (length 
(match-string 0))))
+                                      until (= min-level 1))
+                             (goto-char beg)
+                             (beginning-of-line)
+                             (or (and min-level (org-reduced-level min-level))
+                                 (when (looking-at-p "^[ \t]*#\\+CATEGORY:")
+                                   'org-data)
+                                 t))))))
+               (setq org-element--cache-change-warning
+                     (cond
+                      ((and (numberp org-element--cache-change-warning-before)
+                            (numberp org-element--cache-change-warning-after))
+                       (min org-element--cache-change-warning-after
+                            org-element--cache-change-warning-before))
+                      ((numberp org-element--cache-change-warning-before)
+                       org-element--cache-change-warning-before)
+                      ((numberp org-element--cache-change-warning-after)
+                       org-element--cache-change-warning-after)
+                      (t (or org-element--cache-change-warning-after
+                             org-element--cache-change-warning-before)))))
+           (org-element--cache-log-message
+            "%S is about to modify text: warning %S"
+            this-command
+            org-element--cache-change-warning)))))))
 
 (defun org-element--cache-after-change (beg end pre)
   "Update buffer modifications for current buffer.
 BEG and END are the beginning and end of the range of changed
 text, and the length in bytes of the pre-change text replaced by
 that range.  See `after-change-functions' for more information."
-  (when (org-element--cache-active-p)
-    (org-with-wide-buffer
-     (goto-char beg)
-     (beginning-of-line)
-     (save-match-data
-       (let ((top (point))
-            (bottom (save-excursion (goto-char end) (line-end-position))))
-        ;; Determine if modified area needs to be extended, according
-        ;; to both previous and current state.  We make a special
-        ;; case for headline editing: if a headline is modified but
-        ;; not removed, do not extend.
-        (when (pcase org-element--cache-change-warning
-                (`t t)
-                (`headline
-                 (not (and (org-with-limited-levels (org-at-heading-p))
-                           (= (line-end-position) bottom))))
-                (_
-                 (let ((case-fold-search t))
-                   (re-search-forward
-                    org-element--cache-sensitive-re bottom t))))
-          ;; Effectively extend modified area.
-          (org-with-limited-levels
-           (setq top (progn (goto-char top)
-                            (when (outline-previous-heading) (forward-line))
-                            (point)))
-           (setq bottom (progn (goto-char bottom)
-                               (if (outline-next-heading) (1- (point))
-                                 (point))))))
-        ;; Store synchronization request.
-        (let ((offset (- end beg pre)))
-          (org-element--cache-submit-request top (- bottom offset) offset)))))
-    ;; Activate a timer to process the request during idle time.
-    (org-element--cache-set-timer (current-buffer))))
-
+  (org-with-base-buffer nil
+    (when (org-element--cache-active-p t)
+      (when (not (eq org-element--cache-change-tic 
(buffer-chars-modified-tick)))
+        (org-element--cache-log-message "After change")
+        (setq org-element--cache-change-warning 
(org-element--cache-before-change beg end))
+        ;; If beg is right after spaces in front of an element, we
+        ;; risk affecting previous element, so move beg to bol, making
+        ;; sure that we capture preceding element.
+        (setq beg (save-excursion
+                    (goto-char beg)
+                    (cl-incf pre (- beg (line-beginning-position)))
+                    (line-beginning-position)))
+        ;; Store synchronization request.
+        (let ((offset (- end beg pre)))
+          (save-match-data
+            (org-element--cache-submit-request beg (- end offset) offset)))
+        ;; Activate a timer to process the request during idle time.
+        (org-element--cache-set-timer (current-buffer))))))
+
+(defun org-element--cache-setup-change-functions ()
+  "Setup `before-change-functions' and `after-change-functions'."
+  (when (and (derived-mode-p 'org-mode) org-element-use-cache)
+    (add-hook 'before-change-functions
+             #'org-element--cache-before-change nil t)
+    ;; Run `org-element--cache-after-change' early to handle cases
+    ;; when other `after-change-functions' require element cache.
+    (add-hook 'after-change-functions
+             #'org-element--cache-after-change -1 t)))
+
+(defvar org-element--cache-avoid-synchronous-headline-re-parsing nil
+  "This variable controls how buffer changes are handled by the cache.
+
+By default (when this variable is nil), cache re-parses modified
+headlines immediately after modification preserving all the unaffected
+elements inside the headline.
+
+The default behavior works best when users types inside Org buffer of
+when buffer modifications are mixed with cache requests.  However,
+large automated edits inserting/deleting many headlines are somewhat
+slower by default (as in `org-archive-subtree').  Let-binding this
+variable to non-nil will reduce cache latency after every singular edit
+(`after-change-functions') at the cost of slower cache queries.")
 (defun org-element--cache-for-removal (beg end offset)
   "Return first element to remove from cache.
 
@@ -5823,43 +6814,158 @@ Returned element is usually the first element in cache 
containing
 any position between BEG and END.  As an exception, greater
 elements around the changes that are robust to contents
 modifications are preserved and updated according to the
-changes."
+changes.  In the latter case, the returned element is the outermost
+non-robust element affected by the changes.  Note that the returned
+element may end before END position in which case some cached element
+starting after the returned may still be affected by the changes.
+
+Also, when there are no elements in cache before BEG, return first
+known element in cache (it may start after END)."
   (let* ((elements (org-element--cache-find (1- beg) 'both))
         (before (car elements))
         (after (cdr elements)))
     (if (not before) after
+      ;; If BEFORE is a keyword, it may need to be removed to become
+      ;; an affiliated keyword.
+      (when (eq 'keyword (org-element-type before))
+        (let ((prev before))
+          (while (eq 'keyword (org-element-type prev))
+            (setq before prev
+                  beg (org-element-property :begin prev))
+            (setq prev (org-element--cache-find (1- (org-element-property 
:begin before)))))))
       (let ((up before)
            (robust-flag t))
        (while up
          (if (let ((type (org-element-type up)))
-               (and (or (memq type '(center-block dynamic-block quote-block
-                                                  special-block))
-                        ;; Drawers named "PROPERTIES" are probably
-                        ;; a properties drawer being edited.  Force
-                        ;; parsing to check if editing is over.
-                        (and (eq type 'drawer)
-                             (not (string=
-                                   (org-element-property :drawer-name up)
-                                   "PROPERTIES"))))
-                    (let ((cbeg (org-element-property :contents-begin up)))
-                      (and cbeg
-                           (<= cbeg beg)
-                           (> (org-element-property :contents-end up) end)))))
+                (or (and (memq type '( center-block dynamic-block
+                                       quote-block special-block
+                                       drawer))
+                         (or (not (eq type 'drawer))
+                             (not (string= "PROPERTIES" (org-element-property 
:drawer-name up))))
+                         ;; Sensitive change.  This is
+                         ;; unconditionally non-robust change.
+                         (not org-element--cache-change-warning)
+                        (let ((cbeg (org-element-property :contents-begin up))
+                               (cend (org-element-property :contents-end up)))
+                          (and cbeg
+                                (<= cbeg beg)
+                               (or (> cend end)
+                                    (and (= cend end)
+                                         (= (+ end offset) (point-max)))))))
+                    (and (memq type '(headline section org-data))
+                        (let ((rbeg (org-element-property :robust-begin up))
+                               (rend (org-element-property :robust-end up)))
+                          (and rbeg rend
+                                (<= rbeg beg)
+                                (or (> rend end)
+                                    (and (= rend end)
+                                         (= (+ end offset) (point-max))))))
+                         (pcase type
+                           ;; Sensitive change in section.  Need to
+                           ;; re-parse.
+                           (`section (not org-element--cache-change-warning))
+                           ;; Headline might be inserted.  This is non-robust
+                           ;; change when `up' is a `headline' or `section'
+                           ;; with `>' level compared to the inserted headline.
+                           ;;
+                           ;; Also, planning info/property drawer
+                           ;; could have been inserted.  It is not
+                           ;; robust change then.
+                           (`headline
+                            (and
+                             (or (not (numberp 
org-element--cache-change-warning))
+                                 (> org-element--cache-change-warning
+                                    (org-element-property :level up)))
+                             (org-with-point-at (org-element-property 
:contents-begin up)
+                               (unless
+                                   (save-match-data
+                                     (when (looking-at-p 
org-element-planning-line-re)
+                                       (forward-line))
+                                     (when (looking-at org-property-drawer-re)
+                                       (< beg (match-end 0))))
+                                 'robust))))
+                           (`org-data (and (not (eq 
org-element--cache-change-warning 'org-data))
+                                           ;; Property drawer could
+                                           ;; have been inserted.  It
+                                           ;; is not robust change
+                                           ;; then.
+                                           (org-with-wide-buffer
+                                            (goto-char (point-min))
+                                            (while (and (org-at-comment-p) 
(bolp)) (forward-line))
+                                            ;; Should not see property
+                                            ;; drawer within changed
+                                            ;; region.
+                                            (save-match-data
+                                              (or (not (looking-at 
org-property-drawer-re))
+                                                  (> beg (match-end 0)))))))
+                           (_ 'robust)))))
              ;; UP is a robust greater element containing changes.
              ;; We only need to extend its ending boundaries.
-             (org-element--cache-shift-positions
-              up offset '(:contents-end :end))
-           (setq before up)
-           (when robust-flag (setq robust-flag nil)))
+              (progn
+               (org-element--cache-shift-positions
+                 up offset
+                 (if (and (org-element-property :robust-begin up)
+                          (org-element-property :robust-end up))
+                     '(:contents-end :end :robust-end)
+                   '(:contents-end :end)))
+                (org-element--cache-log-message
+                 "Shifting end positions of robust parent: %S"
+                 (org-element--format-element up)))
+            (unless (or
+                     ;; UP is non-robust.  Yet, if UP is headline, flagging
+                     ;; everything inside for removal may be to
+                     ;; costly.  Instead, we should better re-parse only the
+                     ;; headline itself when possible.  If a headline is still
+                     ;; starting from old :begin position, we do not care that
+                     ;; its boundaries could have extended to shrunk - we
+                     ;; will re-parent and shift them anyway.
+                     (and (eq 'headline (org-element-type up))
+                          (not 
org-element--cache-avoid-synchronous-headline-re-parsing)
+                          ;; The change is not inside headline.  Not
+                          ;; updating here.
+                          (not (<= beg (org-element-property :begin up)))
+                          (not (> end (org-element-property :end up)))
+                          (let ((current (org-with-point-at 
(org-element-property :begin up)
+                                           (org-element-with-disabled-cache
+                                             (and (looking-at-p 
org-element-headline-re)
+                                                  
(org-element-headline-parser))))))
+                            (when (eq 'headline (org-element-type current))
+                              (org-element--cache-log-message
+                               "Found non-robust headline that can be updated 
individually: %S"
+                               (org-element--format-element current))
+                              (org-element-set-element up current)
+                              t)))
+                     ;; If UP is org-data, the situation is similar to
+                     ;; headline case.  We just need to re-parse the
+                     ;; org-data itself, unless the change is made
+                     ;; within blank lines at BOB (that could
+                     ;; potentially alter first-section).
+                     (when (and (eq 'org-data (org-element-type up))
+                                (>= beg (org-element-property :contents-begin 
up)))
+                       (org-element-set-element up (org-with-point-at 1 
(org-element-org-data-parser)))
+                       (org-element--cache-log-message
+                        "Found non-robust change invalidating org-data. 
Re-parsing: %S"
+                        (org-element--format-element up))
+                       t))
+              (org-element--cache-log-message
+               "Found non-robust element: %S"
+               (org-element--format-element up))
+              (setq before up)
+             (when robust-flag (setq robust-flag nil))))
+          (unless (or (org-element-property :parent up)
+                      (eq 'org-data (org-element-type up)))
+            (org-element--cache-warn "Got element without parent. Please 
report it to Org mode mailing list (M-x org-submit-bug-report).\n%S" up)
+            (org-element-cache-reset)
+            (error "org-element--cache: Emergency exit"))
          (setq up (org-element-property :parent up)))
-       ;; We're at top level element containing ELEMENT: if it's
-       ;; altered by buffer modifications, it is first element in
-       ;; cache to be removed.  Otherwise, that first element is the
-       ;; following one.
-       ;;
-       ;; As a special case, do not remove BEFORE if it is a robust
-       ;; container for current changes.
-       (if (or (< (org-element-property :end before) beg) robust-flag) after
+        ;; We're at top level element containing ELEMENT: if it's
+        ;; altered by buffer modifications, it is first element in
+        ;; cache to be removed.  Otherwise, that first element is the
+        ;; following one.
+        ;;
+        ;; As a special case, do not remove BEFORE if it is a robust
+        ;; container for current changes.
+        (if (or (< (org-element-property :end before) beg) robust-flag) after
          before)))))
 
 (defun org-element--cache-submit-request (beg end offset)
@@ -5867,91 +6973,339 @@ changes."
 BEG and END are buffer positions delimiting the minimal area
 where cache data should be removed.  OFFSET is the size of the
 change, as an integer."
-  (let ((next (car org-element--cache-sync-requests))
-       delete-to delete-from)
-    (if (and next
-            (zerop (aref next 5))
-            (> (setq delete-to (+ (aref next 2) (aref next 3))) end)
-            (<= (setq delete-from (aref next 1)) end))
-       ;; Current changes can be merged with first sync request: we
-       ;; can save a partial cache synchronization.
-       (progn
-         (cl-incf (aref next 3) offset)
-         ;; If last change happened within area to be removed, extend
-         ;; boundaries of robust parents, if any.  Otherwise, find
-         ;; first element to remove and update request accordingly.
-         (if (> beg delete-from)
-             (let ((up (aref next 4)))
-               (while up
-                 (org-element--cache-shift-positions
-                  up offset '(:contents-end :end))
-                 (setq up (org-element-property :parent up))))
-           (let ((first (org-element--cache-for-removal beg delete-to offset)))
-             (when first
-               (aset next 0 (org-element--cache-key first))
-               (aset next 1 (org-element-property :begin first))
-               (aset next 4 (org-element-property :parent first))))))
-      ;; Ensure cache is correct up to END.  Also make sure that NEXT,
-      ;; if any, is no longer a 0-phase request, thus ensuring that
-      ;; phases are properly ordered.  We need to provide OFFSET as
-      ;; optional parameter since current modifications are not known
-      ;; yet to the otherwise correct part of the cache (i.e, before
-      ;; the first request).
-      (when next (org-element--cache-sync (current-buffer) end beg))
-      (let ((first (org-element--cache-for-removal beg end offset)))
-       (if first
-           (push (let ((beg (org-element-property :begin first))
-                       (key (org-element--cache-key first)))
-                   (cond
-                    ;; When changes happen before the first known
-                    ;; element, re-parent and shift the rest of the
-                    ;; cache.
-                    ((> beg end) (vector key beg nil offset nil 1))
-                    ;; Otherwise, we find the first non robust
-                    ;; element containing END.  All elements between
-                    ;; FIRST and this one are to be removed.
-                    ((let ((first-end (org-element-property :end first)))
-                       (and (> first-end end)
-                            (vector key beg first-end offset first 0))))
-                    (t
-                     (let* ((element (org-element--cache-find end))
-                            (end (org-element-property :end element))
-                            (up element))
-                       (while (and (setq up (org-element-property :parent up))
-                                   (>= (org-element-property :begin up) beg))
-                         (setq end (org-element-property :end up)
-                               element up))
-                       (vector key beg end offset element 0)))))
-                 org-element--cache-sync-requests)
-         ;; No element to remove.  No need to re-parent either.
-         ;; Simply shift additional elements, if any, by OFFSET.
-         (when org-element--cache-sync-requests
-           (cl-incf (aref (car org-element--cache-sync-requests) 3)
-                    offset)))))))
-
+  (org-element--cache-log-message
+   "Submitting new synchronization request for [%S..%S]𝝙%S"
+   beg end offset)
+  (org-with-base-buffer nil
+    (let ((next (car org-element--cache-sync-requests))
+         delete-to delete-from)
+      (if (and next
+               ;; First existing sync request is in phase 0.
+              (= 0 (org-element--request-phase next))
+               ;; Current changes intersect with the first sync request.
+              (> (setq delete-to (+ (org-element--request-end next)
+                                     (org-element--request-offset next)))
+                  end)
+              (<= (setq delete-from (org-element--request-beg next))
+                  end))
+         ;; Current changes can be merged with first sync request: we
+         ;; can save a partial cache synchronization.
+         (progn
+            (org-element--cache-log-message "Found another phase 0 request 
intersecting with current")
+            ;; Update OFFSET of the existing request.
+           (cl-incf (org-element--request-offset next) offset)
+           ;; If last change happened within area to be removed, extend
+           ;; boundaries of robust parents, if any.  Otherwise, find
+           ;; first element to remove and update request accordingly.
+           (if (> beg delete-from)
+                ;; The current modification is completely inside NEXT.
+                ;; We already added the current OFFSET to the NEXT
+                ;; request.  However, the robust elements around
+                ;; modifications also need to be shifted.  Moreover, the
+                ;; new modification may also have non-nil
+                ;; `org-element--cache-change-warning'.  In the latter case, we
+                ;; also need to update the request.
+                (let ((first (org-element--cache-for-removal delete-from end 
offset) ; Shift as needed.
+                             ))
+                  (org-element--cache-log-message
+                   "Current request is inside next. Candidate parent: %S"
+                   (org-element--format-element first))
+                  (when
+                      ;; Non-robust element is now before NEXT.  Need to
+                      ;; update.
+                      (and first
+                           (org-element--cache-key-less-p
+                            (org-element--cache-key first)
+                            (org-element--request-key next)))
+                    (org-element--cache-log-message
+                     "Current request is inside next. New parent: %S"
+                     (org-element--format-element first))
+                    (setf (org-element--request-key next)
+                          (org-element--cache-key first))
+                    (setf (org-element--request-beg next)
+                          (org-element-property :begin first))
+                    (setf (org-element--request-end next)
+                          (max (org-element-property :end first)
+                               (org-element--request-end next)))
+                    (setf (org-element--request-parent next)
+                          (org-element-property :parent first))))
+              ;; The current and NEXT modifications are intersecting
+              ;; with current modification starting before NEXT and NEXT
+              ;; ending after current.  We need to update the common
+              ;; non-robust parent for the new extended modification
+              ;; region.
+             (let ((first (org-element--cache-for-removal beg delete-to 
offset)))
+                (org-element--cache-log-message
+                 "Current request intersects with next. Candidate parent: %S"
+                 (org-element--format-element first))
+               (when (and first
+                           (org-element--cache-key-less-p
+                            (org-element--cache-key first)
+                            (org-element--request-key next)))
+                  (org-element--cache-log-message
+                   "Current request intersects with next. Updating. New 
parent: %S"
+                   (org-element--format-element first))
+                  (setf (org-element--request-key next) 
(org-element--cache-key first))
+                  (setf (org-element--request-beg next) (org-element-property 
:begin first))
+                  (setf (org-element--request-end next)
+                        (max (org-element-property :end first)
+                             (org-element--request-end next)))
+                  (setf (org-element--request-parent next) 
(org-element-property :parent first))))))
+        ;; Ensure cache is correct up to END.  Also make sure that NEXT,
+        ;; if any, is no longer a 0-phase request, thus ensuring that
+        ;; phases are properly ordered.  We need to provide OFFSET as
+        ;; optional parameter since current modifications are not known
+        ;; yet to the otherwise correct part of the cache (i.e, before
+        ;; the first request).
+        (org-element--cache-log-message "Adding new phase 0 request")
+        (when next (org-element--cache-sync (current-buffer) end beg offset))
+        (let ((first (org-element--cache-for-removal beg end offset)))
+         (if first
+             (push (let ((first-beg (org-element-property :begin first))
+                         (key (org-element--cache-key first)))
+                     (cond
+                      ;; When changes happen before the first known
+                      ;; element, re-parent and shift the rest of the
+                      ;; cache.
+                      ((> first-beg end)
+                        (org-element--cache-log-message "Changes are before 
first known element. Submitting phase 1 request")
+                        (vector key first-beg nil offset nil 1))
+                      ;; Otherwise, we find the first non robust
+                      ;; element containing END.  All elements between
+                      ;; FIRST and this one are to be removed.
+                       ;;
+                       ;; The current modification is completely inside
+                       ;; FIRST.  Clear and update cached elements in
+                       ;; region containing FIRST.
+                      ((let ((first-end (org-element-property :end first)))
+                         (when (> first-end end)
+                            (org-element--cache-log-message "Extending to 
non-robust element %S" (org-element--format-element first))
+                           (vector key first-beg first-end offset 
(org-element-property :parent first) 0))))
+                      (t
+                        ;; Now, FIRST is the first element after BEG or
+                        ;; non-robust element containing BEG.  However,
+                        ;; FIRST ends before END and there might be
+                        ;; another ELEMENT before END that spans beyond
+                        ;; END.  If there is such element, we need to
+                        ;; extend the region down to end of the common
+                        ;; parent of FIRST and everything inside
+                        ;; BEG..END.
+                       (let* ((element (org-element--cache-find end))
+                              (element-end (org-element-property :end element))
+                              (up element))
+                         (while (and (not (eq up first))
+                                      (setq up (org-element-property :parent 
up))
+                                     (>= (org-element-property :begin up) 
first-beg))
+                            ;; Note that UP might have been already
+                            ;; shifted if it is a robust element.  After
+                            ;; deletion, it can put it's end before yet
+                            ;; unprocessed ELEMENT.
+                           (setq element-end (max (org-element-property :end 
up) element-end)
+                                 element up))
+                          ;; Extend region to remove elements between
+                          ;; beginning of first and the end of outermost
+                          ;; element starting before END but after
+                          ;; beginning of first.
+                          ;; of the FIRST.
+                          (org-element--cache-log-message
+                           "Extending to all elements between:\n 1: %S\n 2: %S"
+                           (org-element--format-element first)
+                           (org-element--format-element element))
+                         (vector key first-beg element-end offset up 0)))))
+                   org-element--cache-sync-requests)
+           ;; No element to remove.  No need to re-parent either.
+           ;; Simply shift additional elements, if any, by OFFSET.
+           (if org-element--cache-sync-requests
+                (progn
+                  (org-element--cache-log-message
+                   "Nothing to remove. Updating offset of the next request by 
𝝙%S: %S"
+                   offset
+                   (let ((print-level 3))
+                     (car org-element--cache-sync-requests)))
+                 (cl-incf (org-element--request-offset (car 
org-element--cache-sync-requests))
+                          offset))
+              (org-element--cache-log-message
+               "Nothing to remove. No elements in cache after %S. Terminating."
+               end))))))
+    (setq org-element--cache-change-warning nil)))
+
+(defun org-element--cache-verify-element (element)
+  "Verify correctness of ELEMENT when `org-element--cache-self-verify' is 
non-nil.
+
+Return non-nil when verification failed."
+  (let ((org-element--cache-self-verify
+         (or org-element--cache-self-verify
+             (and (boundp 'org-batch-test) org-batch-test)))
+        (org-element--cache-self-verify-frequency
+         (if (and (boundp 'org-batch-test) org-batch-test)
+             1
+           org-element--cache-self-verify-frequency)))
+    ;; Verify correct parent for the element.
+    (unless (or (not org-element--cache-self-verify)
+                (org-element-property :parent element)
+                (eq 'org-data (org-element-type element)))
+      (org-element--cache-warn "Got element without parent (cache active?: 
%S). Please report it to Org mode mailing list (M-x 
org-submit-bug-report).\n%S" (org-element--cache-active-p)  element)
+      (org-element-cache-reset))
+    (when (and org-element--cache-self-verify
+               (org-element--cache-active-p)
+               (eq 'headline (org-element-type element))
+               ;; Avoid too much slowdown
+               (< (random 1000) (* 1000 
org-element--cache-self-verify-frequency)))
+      (org-with-point-at (org-element-property :begin element)
+        (org-element-with-disabled-cache (org-up-heading-or-point-min))
+        (unless (or (= (point) (org-element-property :begin 
(org-element-property :parent element)))
+                    (eq (point) (point-min)))
+          (org-element--cache-warn
+           "Cached element has wrong parent in %s. Resetting.
+If this warning appears regularly, please report the warning text to Org mode 
mailing list (M-x org-submit-bug-report).
+The element is: %S\n The parent is: %S\n The real parent is: %S"
+           (buffer-name (current-buffer))
+           (org-element--format-element element)
+           (org-element--format-element (org-element-property :parent element))
+           (org-element--format-element (org-element--current-element 
(org-element-property :end (org-element-property :parent element)))))
+          (org-element-cache-reset))
+        (org-element--cache-verify-element (org-element-property :parent 
element))))
+    ;; Verify the element itself.
+    (when (and org-element--cache-self-verify
+               (org-element--cache-active-p)
+               element
+               (not (memq (org-element-type element) '(section org-data)))
+               ;; Avoid too much slowdown
+               (< (random 1000) (* 1000 
org-element--cache-self-verify-frequency)))
+      (let ((real-element (let (org-element-use-cache)
+                            (org-element--parse-to
+                             (if (memq (org-element-type element) '(table-row 
item))
+                                 (1+ (org-element-property :begin element))
+                               (org-element-property :begin element))))))
+        (unless (and (eq (org-element-type real-element) (org-element-type 
element))
+                     (eq (org-element-property :begin real-element) 
(org-element-property :begin element))
+                     (eq (org-element-property :end real-element) 
(org-element-property :end element))
+                     (eq (org-element-property :contents-begin real-element) 
(org-element-property :contents-begin element))
+                     (eq (org-element-property :contents-end real-element) 
(org-element-property :contents-end element))
+                     (or (not (org-element-property :ID real-element))
+                         (string= (org-element-property :ID real-element) 
(org-element-property :ID element))))
+          (org-element--cache-warn "(%S) Cached element is incorrect in %s. 
(Cache tic up to date: %S) Resetting.
+If this warning appears regularly, please report the warning text to Org mode 
mailing list (M-x org-submit-bug-report).
+The element is: %S\n The real element is: %S\n Cache around 
:begin:\n%S\n%S\n%S"
+                                   this-command
+                                   (buffer-name (current-buffer))
+                                   (if (/= org-element--cache-change-tic
+                                          (buffer-chars-modified-tick))
+                                       "no" "yes")
+                                   (org-element--format-element element)
+                                   (org-element--format-element real-element)
+                                   (org-element--cache-find (1- 
(org-element-property :begin real-element)))
+                                   (car (org-element--cache-find 
(org-element-property :begin real-element) 'both))
+                                   (cdr (org-element--cache-find 
(org-element-property :begin real-element) 'both)))
+          (org-element-cache-reset))))))
+
+;;; Cache persistence
+
+(defun org-element--cache-persist-before-write (container &optional associated)
+  "Sync cache before saving."
+  (when (equal container '(elisp org-element--cache))
+    (if (and org-element-use-cache
+             (plist-get associated :file)
+             (get-file-buffer (plist-get associated :file))
+             org-element-cache-persistent)
+        (with-current-buffer (get-file-buffer (plist-get associated :file))
+          (if (and (derived-mode-p 'org-mode)
+                   org-element--cache)
+              (org-with-wide-buffer
+               (org-element--cache-sync (current-buffer) (point-max))
+               ;; Cleanup cache request keys to avoid collisions during next
+               ;; Emacs session.
+               (avl-tree-mapc
+                (lambda (el)
+                  (org-element-put-property el :org-element--cache-sync-key 
nil))
+                org-element--cache)
+               nil)
+            'forbid))
+      'forbid)))
+
+(defun org-element--cache-persist-before-read (container &optional associated)
+  "Avoid reading cache before Org mode is loaded."
+  (when (equal container '(elisp org-element--cache))
+    (if (not (and (plist-get associated :file)
+                (get-file-buffer (plist-get associated :file))))
+        'forbid
+      (with-current-buffer (get-file-buffer (plist-get associated :file))
+        (unless (and org-element-use-cache
+                     org-element-cache-persistent
+                     (derived-mode-p 'org-mode)
+                     (equal (secure-hash 'md5 (current-buffer))
+                            (plist-get associated :hash)))
+          'forbid)))))
+
+(defun org-element--cache-persist-after-read (container &optional associated)
+  "Setup restored cache."
+  (when (and (plist-get associated :file)
+             (get-file-buffer (plist-get associated :file)))
+    (with-current-buffer (get-file-buffer (plist-get associated :file))
+      (when (and org-element-use-cache org-element-cache-persistent)
+        (when (and (equal container '(elisp org-element--cache)) 
org-element--cache)
+          (setq-local org-element--cache-size (avl-tree-size 
org-element--cache)))
+        (when (and (equal container '(elisp org-element--headline-cache)) 
org-element--headline-cache)
+          (setq-local org-element--headline-cache-size (avl-tree-size 
org-element--headline-cache)))))))
+
+(add-hook 'org-persist-before-write-hook 
#'org-element--cache-persist-before-write)
+(add-hook 'org-persist-before-read-hook 
#'org-element--cache-persist-before-read)
+(add-hook 'org-persist-after-read-hook #'org-element--cache-persist-after-read)
 
 ;;;; Public Functions
 
+(defvar-local org-element--cache-gapless nil
+  "An alist containing (granularity . `org-element--cache-change-tic') 
elements.
+Each element indicates the latest `org-element--cache-change-tic' when
+change did not contain gaps.")
+
 ;;;###autoload
-(defun org-element-cache-reset (&optional all)
+(defun org-element-cache-reset (&optional all no-persistance)
   "Reset cache in current buffer.
 When optional argument ALL is non-nil, reset cache in all Org
-buffers."
+buffers.
+When optional argument NO-PERSISTANCE is non-nil, do not try to update
+the cache persistence in the buffer."
   (interactive "P")
   (dolist (buffer (if all (buffer-list) (list (current-buffer))))
-    (with-current-buffer buffer
+    (org-with-base-buffer buffer
       (when (and org-element-use-cache (derived-mode-p 'org-mode))
+        ;; Only persist cache in file buffers.
+        (when (and (buffer-file-name) (not no-persistance))
+          (when (not org-element-cache-persistent)
+            (org-persist-unregister 'org-element--headline-cache 
(current-buffer))
+            (org-persist-unregister 'org-element--cache (current-buffer)))
+          (when (and org-element-cache-persistent
+                     (buffer-file-name (current-buffer)))
+            (org-persist-register 'org-element--cache (current-buffer))
+            (org-persist-register 'org-element--headline-cache
+                                  (current-buffer)
+                                  :inherit 'org-element--cache)))
+        (setq-local org-element--cache-change-tic (buffer-chars-modified-tick))
+        (setq-local org-element--cache-last-buffer-size (buffer-size))
+        (setq-local org-element--cache-gapless nil)
        (setq-local org-element--cache
                    (avl-tree-create #'org-element--cache-compare))
-       (setq-local org-element--cache-sync-keys
-                   (make-hash-table :weakness 'key :test #'eq))
+        (setq-local org-element--headline-cache
+                   (avl-tree-create #'org-element--cache-compare))
+        (setq-local org-element--cache-hash-left (make-vector 
org-element--cache-hash-size nil))
+        (setq-local org-element--cache-hash-right (make-vector 
org-element--cache-hash-size nil))
+        (setq-local org-element--cache-size 0)
+        (setq-local org-element--headline-cache-size 0)
+       (setq-local org-element--cache-sync-keys-value 0)
        (setq-local org-element--cache-change-warning nil)
        (setq-local org-element--cache-sync-requests nil)
        (setq-local org-element--cache-sync-timer nil)
-       (add-hook 'before-change-functions
-                 #'org-element--cache-before-change nil t)
-       (add-hook 'after-change-functions
-                 #'org-element--cache-after-change nil t)))))
+        (org-element--cache-setup-change-functions)
+        ;; Make sure that `org-element--cache-after-change' and
+        ;; `org-element--cache-before-change' are working inside properly 
created
+        ;; indirect buffers.  Note that `clone-indirect-buffer-hook'
+        ;; will not work inside indirect buffers not created by
+        ;; calling `clone-indirect-buffer'.  We consider that the code
+        ;; not using `clone-indirect-buffer' to be written with
+        ;; awareness about possible consequences.
+        (add-hook 'clone-indirect-buffer-hook
+                  #'org-element--cache-setup-change-functions)))))
 
 ;;;###autoload
 (defun org-element-cache-refresh (pos)
@@ -5961,8 +7315,470 @@ buffers."
     (org-element--cache-submit-request pos pos 0)
     (org-element--cache-set-timer (current-buffer))))
 
+(defvar warning-minimum-log-level) ; Defined in warning.el
+
+(defvar org-element-cache-map-continue-from nil
+  "Position from where mapping should continue.
+This variable can be set by called function, especially when the
+function modified the buffer.")
+;;;###autoload
+(cl-defun org-element-cache-map (func &key (granularity 'headline+inlinetask) 
restrict-elements
+                                      next-re fail-re from-pos (to-pos 
(point-max-marker)) after-element limit-count
+                                      narrow)
+  "Map all elements in current buffer with FUNC according to
+GRANULARITY.  Collect non-nil return values into result list.
+
+FUNC should accept a single argument - the element.
+
+FUNC can modify the buffer, but doing so may reduce performance.  If
+buffer is modified, the mapping will continue from an element starting
+after the last mapped element.  If the last mapped element is deleted,
+the subsequent element will be skipped as it cannot be distinguished
+deterministically from a changed element.  If FUNC is expected to
+delete the element, it should directly set the value of
+`org-element-cache-map-continue-from' to force `org-element-cache-map'
+continue from the right point in buffer.
+
+If some elements are not yet in cache, they will be added.
+
+GRANULARITY can be `headline', `headline+inlinetask'
+`greater-element', or `element'.  The default is
+`headline+inlinetask'.  `object' granularity is not supported.
+
+RESTRICT-ELEMENTS is a list of element types to be mapped over.
+
+NEXT-RE is a regexp used to search next candidate match when FUNC
+returns non-nil and to search the first candidate match.  FAIL-RE is a
+regexp used to search next candidate match when FUNC returns nil.  The
+mapping will continue starting from headline at the RE match.
+
+FROM-POS and TO-POS are buffer positions.  When non-nil, they bound the
+mapped elements to elements starting at of after FROM-POS but before
+TO-POS.
+
+AFTER-ELEMENT, when non-nil, bounds the mapping to all the elements
+after AFTER-ELEMENT (i.e. if AFTER-ELEMENT is a headline section, we
+map all the elements starting from first element inside section, but
+not including the section).
+
+LIMIT-COUNT limits mapping to that many first matches where FUNC
+returns non-nil.
+
+NARROW controls whether current buffer narrowing should be preserved.
+
+This function does a subset of what `org-element-map' does, but with
+much better performance.  Cached elements are supplied as the single
+argument of FUNC.  Changes to elements made in FUNC will also alter
+the cache."
+  (unless (org-element--cache-active-p)
+    (error "Cache must be active."))
+  (unless (memq granularity '( headline headline+inlinetask
+                               greater-element element))
+    (error "Unsupported granularity: %S" granularity))
+  ;; Make TO-POS marker.  Otherwise, buffer edits may garble the the
+  ;; process.
+  (unless (markerp to-pos)
+    (let ((mk (make-marker)))
+      (set-marker mk to-pos)
+      (setq to-pos mk)))
+  (let (;; Bind variables used inside loop to avoid memory
+        ;; re-allocation on every iteration.
+        ;; See https://emacsconf.org/2021/talks/faster/
+        tmpnext-start tmpparent tmpelement)
+    (save-excursion
+      (save-restriction
+        (unless narrow (widen))
+        ;; Synchronize cache up to the end of mapped region.
+        (org-element-at-point to-pos)
+        (cl-macrolet ((cache-root
+                        ;; Use the most optimal version of cache available.
+                        () `(if (memq granularity '(headline 
headline+inlinetask))
+                                (org-element--headline-cache-root)
+                              (org-element--cache-root)))
+                      (cache-size
+                        ;; Use the most optimal version of cache available.
+                        () `(if (memq granularity '(headline 
headline+inlinetask))
+                                org-element--headline-cache-size
+                              org-element--cache-size))
+                      (cache-walk-restart
+                        ;; Restart tree traversal after AVL tree re-balance.
+                        () `(when node
+                              (org-element-at-point (point-max))
+                              (setq node (cache-root)
+                                   stack (list nil)
+                                   leftp t
+                                   continue-flag t)))
+                      (cache-walk-abort
+                        ;; Abort tree traversal.
+                        () `(setq continue-flag t
+                                  node nil))
+                      (element-match-at-point
+                        ;; Returning the first element to match around point.
+                        ;; For example, if point is inside headline and
+                        ;; granularity is restricted to headlines only, skip
+                        ;; over all the child elements inside the headline
+                        ;; and return the first parent headline.
+                        ;; When we are inside a cache gap, calling
+                        ;; `org-element-at-point' also fills the cache gap 
down to
+                        ;; point.
+                        () `(progn
+                              ;; Parsing is one of the performance
+                              ;; bottlenecks.  Make sure to optimize it as
+                              ;; much as possible.
+                              ;;
+                              ;; Avoid extra staff like timer cancels et al
+                              ;; and only call 
`org-element--cache-sync-requests' when
+                              ;; there are pending requests.
+                              (when org-element--cache-sync-requests
+                                (org-element--cache-sync (current-buffer)))
+                              ;; Call `org-element--parse-to' directly 
avoiding any
+                              ;; kind of `org-element-at-point' overheads.
+                              (if restrict-elements
+                                  ;; Search directly instead of calling
+                                  ;; `org-element-lineage' to avoid funcall 
overheads
+                                  ;; and making sure that we do not go all
+                                  ;; the way to `org-data' as 
`org-element-lineage'
+                                  ;; does.
+                                  (progn
+                                    (setq tmpelement (org-element--parse-to 
(point)))
+                                    (while (and tmpelement (not (memq 
(org-element-type tmpelement) restrict-elements)))
+                                      (setq tmpelement (org-element-property 
:parent tmpelement)))
+                                    tmpelement)
+                                (org-element--parse-to (point)))))
+                      ;; Starting from (point), search RE and move START to
+                      ;; the next valid element to be matched according to
+                      ;; restriction.  Abort cache walk if no next element
+                      ;; can be found.  When RE is nil, just find element at
+                      ;; point.
+                      (move-start-to-next-match
+                        (re) `(save-match-data
+                                (if (or (not ,re)
+                                        (if org-element--cache-map-statistics
+                                            (progn
+                                              (setq before-time (float-time))
+                                              (re-search-forward (or (car-safe 
,re) ,re) nil 'move)
+                                              (cl-incf re-search-time
+                                                       (- (float-time)
+                                                          before-time)))
+                                          (re-search-forward (or (car-safe 
,re) ,re) nil 'move)))
+                                    (unless (or (< (point) (or start -1))
+                                                (and data
+                                                     (< (point) 
(org-element-property :begin data))))
+                                      (if (cdr-safe ,re)
+                                          ;; Avoid parsing when we are 100%
+                                          ;; sure that regexp is good enough
+                                          ;; to find new START.
+                                          (setq start (match-beginning 0))
+                                        (setq start (max (or start -1)
+                                                         (or 
(org-element-property :begin data) -1)
+                                                         (or 
(org-element-property :begin (element-match-at-point)) -1))))
+                                      (when (>= start to-pos) 
(cache-walk-abort))
+                                      (when (eq start -1) (setq start nil)))
+                                  (cache-walk-abort))))
+                      ;; Find expected begin position of an element after
+                      ;; DATA.
+                      (next-element-start
+                        () `(progn
+                              (setq tmpnext-start nil)
+                              (if (memq granularity '(headline 
headline+inlinetask))
+                                  (setq tmpnext-start (or (when (memq 
(org-element-type data) '(headline org-data))
+                                                            
(org-element-property :contents-begin data))
+                                                          
(org-element-property :end data)))
+                               (setq tmpnext-start (or (when (memq 
(org-element-type data) org-element-greater-elements)
+                                                          
(org-element-property :contents-begin data))
+                                                        (org-element-property 
:end data))))
+                              ;; DATA end may be the last element inside
+                              ;; i.e. source block.  Skip up to the end
+                              ;; of parent in such case.
+                              (setq tmpparent data)
+                             (catch :exit
+                                (when (eq tmpnext-start (org-element-property 
:contents-end tmpparent))
+                                 (setq tmpnext-start (org-element-property 
:end tmpparent)))
+                               (while (setq tmpparent (org-element-property 
:parent tmpparent))
+                                 (if (eq tmpnext-start (org-element-property 
:contents-end tmpparent))
+                                     (setq tmpnext-start (org-element-property 
:end tmpparent))
+                                    (throw :exit t))))
+                              tmpnext-start))
+                      ;; Check if cache does not have gaps.
+                      (cache-gapless-p
+                        () `(eq org-element--cache-change-tic
+                                (alist-get granularity 
org-element--cache-gapless))))
+          ;; The core algorithm is simple walk along binary tree.  However,
+          ;; instead of checking all the tree elements from first to last
+          ;; (like in `avl-tree-mapcar'), we begin from FROM-POS skipping
+          ;; the elements before FROM-POS efficiently: O(logN) instead of
+          ;; O(Nbefore).
+          ;;
+          ;; Later, we may also not check every single element in the
+          ;; binary tree after FROM-POS.  Instead, we can find position of
+          ;; next candidate elements by means of regexp search and skip the
+          ;; binary tree branches that are before the next candidate:
+          ;; again, O(logN) instead of O(Nbetween).
+          ;;
+          ;; Some elements might not yet be in the tree.  So, we also parse
+          ;; the empty gaps in cache as needed making sure that we do not
+          ;; miss anything.
+          (let* (;; START is always beginning of an element.  When there is
+                 ;; no element in cache at START, we are inside cache gap
+                 ;; and need to fill it.
+                 (start (and from-pos
+                             (progn
+                               (goto-char from-pos)
+                               (org-element-property :begin 
(element-match-at-point)))))
+                 ;; Some elements may start at the same position, so we
+                 ;; also keep track of the last processed element and make
+                 ;; sure that we do not try to search it again.
+                 (prev after-element)
+                 (node (cache-root))
+                 data
+                 (stack (list nil))
+                 (leftp t)
+                 result
+                 ;; Whether previous element matched FUNC (FUNC
+                 ;; returned non-nil).
+                 (last-match t)
+                 continue-flag
+                 ;; Generic regexp to search next potential match.  If it
+                 ;; is a cons of (regexp . 'match-beg), we are 100% sure
+                 ;; that the match beginning is the existing element
+                 ;; beginning.
+                 (next-element-re (pcase granularity
+                                    ((or `headline
+                                         (guard (eq '(headline)
+                                                    restrict-elements)))
+                                     (cons
+                                      (org-with-limited-levels
+                                       org-element-headline-re)
+                                      'match-beg))
+                                    (`headline+inlinetask
+                                     (cons
+                                      (if (eq '(inlinetask) restrict-elements)
+                                          (org-inlinetask-outline-regexp)
+                                        org-element-headline-re)
+                                      'match-beg))
+                                    ;; TODO: May add other commonly
+                                    ;; searched elements as needed.
+                                    (_)))
+                 ;; Make sure that we are not checking the same regexp twice.
+                 (next-re (unless (and next-re
+                                       (string= next-re
+                                                (or (car-safe next-element-re)
+                                                    next-element-re)))
+                            next-re))
+                 (fail-re (unless (and fail-re
+                                       (string= fail-re
+                                                (or (car-safe next-element-re)
+                                                    next-element-re)))
+                            fail-re))
+                 (restrict-elements (or restrict-elements
+                                        (pcase granularity
+                                          (`headline
+                                           '(headline))
+                                          (`headline+inlinetask
+                                           '(headline inlinetask))
+                                          (`greater-element
+                                           org-element-greater-elements)
+                                          (_ nil))))
+                 ;; Statistics
+                 (time (float-time))
+                 (predicate-time 0)
+                 (pre-process-time 0)
+                 (re-search-time 0)
+                 (count-predicate-calls-match 0)
+                 (count-predicate-calls-fail 0)
+                 ;; Bind variables used inside loop to avoid memory
+                 ;; re-allocation on every iteration.
+                 ;; See https://emacsconf.org/2021/talks/faster/
+                 cache-size before-time modified-tic)
+            ;; Skip to first element within region.
+            (goto-char (or start (point-min)))
+            (move-start-to-next-match next-element-re)
+            (unless (and start (>= start to-pos))
+              (while node
+                (setq data (avl-tree--node-data node))
+                (if (and leftp (avl-tree--node-left node) ; Left branch.
+                         ;; Do not move to left branch when we are before
+                         ;; PREV.
+                        (or (not prev)
+                            (not (org-element--cache-key-less-p
+                                  (org-element--cache-key data)
+                                  (org-element--cache-key prev))))
+                         ;; ... or when we are before START.
+                         (or (not start)
+                             (not (> start (org-element-property :begin 
data)))))
+                   (progn (push node stack)
+                          (setq node (avl-tree--node-left node)))
+                  ;; The whole tree left to DATA is before START and
+                  ;; PREV.  DATA may still be before START (i.e. when
+                  ;; DATA is the root or when START moved), at START, or
+                  ;; after START.
+                  ;;
+                  ;; If DATA is before start, skip it over and move to
+                  ;; subsequent elements.
+                  ;; If DATA is at start, run FUNC if necessary and
+                  ;; update START according and NEXT-RE, FAIL-RE,
+                  ;; NEXT-ELEMENT-RE.
+                  ;; If DATA is after start, we have found a cache gap
+                  ;; and need to fill it.
+                  (unless (or (and start (< (org-element-property :begin data) 
start))
+                             (and prev (not (org-element--cache-key-less-p
+                                             (org-element--cache-key prev)
+                                             (org-element--cache-key data)))))
+                    ;; DATA is at of after START and PREV.
+                   (if (or (not start) (= (org-element-property :begin data) 
start))
+                        ;; DATA is at START.  Match it.
+                        ;; In the process, we may alter the buffer,
+                        ;; so also keep track of the cache state.
+                        (progn
+                          (setq modified-tic org-element--cache-change-tic)
+                          (setq cache-size (cache-size))
+                          ;; When NEXT-RE/FAIL-RE is provided, skip to
+                          ;; next regexp match after :begin of the current
+                          ;; element.
+                          (when (if last-match next-re fail-re)
+                            (goto-char (org-element-property :begin data))
+                            (move-start-to-next-match
+                             (if last-match next-re fail-re)))
+                          (when (and (or (not start) (eq (org-element-property 
:begin data) start))
+                                     (< (org-element-property :begin data) 
to-pos))
+                            ;; Calculate where next possible element
+                            ;; starts and update START if needed.
+                           (setq start (next-element-start))
+                            (goto-char start)
+                            ;; Move START further if possible.
+                            (when (and next-element-re
+                                       ;; Do not move if we know for
+                                       ;; sure that cache does not
+                                       ;; contain gaps.  Regexp
+                                       ;; searches are not cheap.
+                                       (not (cache-gapless-p)))
+                              (move-start-to-next-match next-element-re)
+                              ;; Make sure that point is at START
+                              ;; before running FUNC.
+                              (goto-char start))
+                            ;; Try FUNC if DATA matches all the
+                            ;; restrictions.  Calculate new START.
+                            (when (or (not restrict-elements)
+                                      (memq (org-element-type data) 
restrict-elements))
+                              ;; DATA matches restriction.  FUNC may
+                              ;;
+                              ;; Call FUNC.  FUNC may move point.
+                              (setq org-element-cache-map-continue-from nil)
+                              (if org-element--cache-map-statistics
+                                  (progn
+                                    (setq before-time (float-time))
+                                    (push (funcall func data) result)
+                                    (cl-incf predicate-time
+                                             (- (float-time)
+                                                before-time))
+                                    (if (car result)
+                                        (cl-incf count-predicate-calls-match)
+                                      (cl-incf count-predicate-calls-fail)))
+                                (push (funcall func data) result)
+                                (when (car result) (cl-incf 
count-predicate-calls-match)))
+                              ;; Set `last-match'.
+                              (setq last-match (car result))
+                              ;; If FUNC moved point forward, update
+                              ;; START.
+                              (when org-element-cache-map-continue-from
+                                (goto-char 
org-element-cache-map-continue-from))
+                              (when (> (point) start)
+                                (move-start-to-next-match nil))
+                              ;; Drop nil.
+                              (unless (car result) (pop result)))
+                            ;; If FUNC did not move the point and we
+                            ;; know for sure that cache does not contain
+                            ;; gaps, do not try to calculate START in
+                            ;; advance but simply loop to the next cache
+                            ;; element.
+                            (when (and (cache-gapless-p)
+                                       (eq (next-element-start)
+                                           start))
+                              (setq start nil))
+                            ;; Check if the buffer has been modified.
+                            (unless (and (eq modified-tic 
org-element--cache-change-tic)
+                                         (eq cache-size (cache-size)))
+                              ;; START may no longer be valid, update
+                              ;; it to beginning of real element.
+                              ;; Upon modification, START may lay
+                              ;; inside an element.  We want to move
+                              ;; it to real beginning then despite
+                              ;; START being larger.
+                              (setq start nil)
+                              (move-start-to-next-match nil)
+                              ;; The new element may now start before
+                              ;; or at already processed position.
+                              ;; Make sure that we continue from an
+                              ;; element past already processed
+                              ;; place.
+                              (when (and start
+                                         (<= start (org-element-property 
:begin data))
+                                         (not 
org-element-cache-map-continue-from))
+                                (goto-char start)
+                                (setq data (element-match-at-point))
+                                ;; If DATA is nil, buffer is
+                                ;; empty. Abort.
+                                (when data
+                                  (goto-char (next-element-start))
+                                  (move-start-to-next-match next-element-re)))
+                              (org-element-at-point to-pos)
+                              (cache-walk-restart))
+                            ;; Reached LIMIT-COUNT.  Abort.
+                            (when (and limit-count
+                                       (>= count-predicate-calls-match
+                                           limit-count))
+                              (cache-walk-abort))
+                            (if (org-element-property :cached data)
+                               (setq prev data)
+                              (setq prev nil))))
+                      ;; DATA is after START.  Fill the gap.
+                      (if (memq (org-element-type (org-element--parse-to 
start)) '(plain-list table))
+                          ;; Tables and lists are special, we need a
+                          ;; trickery to make items/rows be populated
+                          ;; into cache.
+                          (org-element--parse-to (1+ start)))
+                      ;; Restart tree traversal as AVL tree is
+                      ;; re-balanced upon adding elements.  We can no
+                      ;; longer trust STACK.
+                      (cache-walk-restart)))
+                  ;; Second, move to the right branch of the tree or skip
+                  ;; it altogether.
+                  (if continue-flag
+                     (setq continue-flag nil)
+                   (setq node (if (and (car stack)
+                                        ;; If START advanced beyond stack 
parent, skip the right branch.
+                                        (or (and start (< 
(org-element-property :begin (avl-tree--node-data (car stack))) start))
+                                           (and prev 
(org-element--cache-key-less-p
+                                                      (org-element--cache-key 
(avl-tree--node-data (car stack)))
+                                                       (org-element--cache-key 
prev)))))
+                                   (progn
+                                     (setq leftp nil)
+                                     (pop stack))
+                                 ;; Otherwise, move ahead into the right
+                                 ;; branch when it exists.
+                                 (if (setq leftp (avl-tree--node-right node))
+                                    (avl-tree--node-right node)
+                                  (pop stack))))))))
+            (when (and org-element--cache-map-statistics
+                       (or (not org-element--cache-map-statistics-threshold)
+                           (> (- (float-time) time) 
org-element--cache-map-statistics-threshold)))
+              (message "Mapped over elements in %S. %d/%d predicate matches. 
Total time: %f sec. Pre-process time: %f sec. Predicate time: %f sec. Re-search 
time: %f sec.
+       Calling parameters: :granularity %S :restrict-elements %S :next-re %S 
:fail-re %S :from-pos %S :to-pos %S :limit-count %S :after-element %S"
+                       (current-buffer)
+                       count-predicate-calls-match
+                       (+ count-predicate-calls-match
+                          count-predicate-calls-fail)
+                       (- (float-time) time)
+                       pre-process-time
+                       predicate-time
+                       re-search-time
+                       granularity restrict-elements next-re fail-re from-pos 
to-pos limit-count after-element))
+            ;; Return result.
+            (nreverse result)))))))
 
 
+
+
 ;;; The Toolbox
 ;;
 ;; The first move is to implement a way to obtain the smallest element
@@ -5981,8 +7797,11 @@ buffers."
 
 
 ;;;###autoload
-(defun org-element-at-point ()
-  "Determine closest element around point.
+(defun org-element-at-point (&optional pom cached-only)
+  "Determine closest element around point or POM.
+
+Only check cached element when CACHED-ONLY is non-nil and return nil
+unconditionally when element at POM is not in cache.
 
 Return value is a list like (TYPE PROPS) where TYPE is the type
 of the element and PROPS a plist of properties associated to the
@@ -6000,24 +7819,65 @@ instead of the first row.
 
 When point is at the end of the buffer, return the innermost
 element ending there."
-  (org-with-wide-buffer
-   (let ((origin (point)))
-     (end-of-line)
-     (skip-chars-backward " \r\t\n")
-     (cond
-      ;; Within blank lines at the beginning of buffer, return nil.
-      ((bobp) nil)
-      ;; Within blank lines right after a headline, return that
-      ;; headline.
-      ((org-with-limited-levels (org-at-heading-p))
-       (beginning-of-line)
-       (org-element-headline-parser (point-max) t))
-      ;; Otherwise parse until we find element containing ORIGIN.
-      (t
-       (when (org-element--cache-active-p)
-        (if (not org-element--cache) (org-element-cache-reset)
-          (org-element--cache-sync (current-buffer) origin)))
-       (org-element--parse-to origin))))))
+  (setq pom (or pom (point)))
+  ;; Allow re-parsing when the command can benefit from it.
+  (when (and cached-only
+             (memq this-command org-element--cache-non-modifying-commands))
+    (setq cached-only nil))
+  (let (element)
+    (when (org-element--cache-active-p)
+      (if (not org-element--cache) (org-element-cache-reset)
+        (unless cached-only (org-element--cache-sync (current-buffer) pom))))
+    (setq element (if cached-only
+                      (when (and (org-element--cache-active-p)
+                                 (or (not org-element--cache-sync-requests)
+                                     (< pom
+                                        (org-element--request-beg
+                                         (car 
org-element--cache-sync-requests)))))
+                        (org-element--cache-find pom))
+                    (condition-case err
+                        (org-element--parse-to pom)
+                      (error
+                       (org-element--cache-warn
+                        "Org parser error in %s::%S. Resetting.\n The error 
was: %S\n Backtrace:\n%S\n Please report this to Org mode mailing list (M-x 
org-submit-bug-report)."
+                        (buffer-name (current-buffer))
+                        pom
+                        err
+                        (when (and (fboundp 'backtrace-get-frames)
+                                   (fboundp 'backtrace-to-string))
+                          (backtrace-to-string (backtrace-get-frames 
'backtrace))))
+                       (org-element-cache-reset)
+                       (org-element--parse-to pom)))))
+    (when (and (org-element--cache-active-p)
+               element
+               (org-element--cache-verify-element element))
+      (setq element (org-element--parse-to pom)))
+    (unless (eq 'org-data (org-element-type element))
+      (unless (and cached-only
+                   (not (and element
+                             (or (= pom (org-element-property :begin element))
+                                 (and (not (memq (org-element-type element) 
org-element-greater-elements))
+                                      (>= pom (org-element-property :begin 
element))
+                                      (< pom (org-element-property :end 
element)))
+                                 (and (org-element-property :contents-begin 
element)
+                                      (>= pom (org-element-property :begin 
element))
+                                      (< pom (org-element-property 
:contents-begin element)))
+                                 (and (not (org-element-property :contents-end 
element))
+                                      (>= pom (org-element-property :begin 
element))
+                                      (< pom (org-element-property :end 
element)))))))
+        (if (not (eq (org-element-type element) 'section))
+            element
+          (org-element-at-point (1+ pom) cached-only))))))
+
+;;;###autoload
+(defsubst org-element-at-point-no-context (&optional pom)
+  "Quickly find element at point or POM.
+
+It is a faster version of `org-element-at-point' that is not
+guaranteed to return correct `:parent' properties even when cache is
+enabled."
+  (or (org-element-at-point pom 'cached-only)
+      (let (org-element-use-cache) (org-element-at-point pom))))
 
 ;;;###autoload
 (defun org-element-context (&optional element)
@@ -6038,115 +7898,116 @@ the beginning of any other object, return that object.
 Optional argument ELEMENT, when non-nil, is the closest element
 containing point, as returned by `org-element-at-point'.
 Providing it allows for quicker computation."
-  (catch 'objects-forbidden
-    (org-with-wide-buffer
-     (let* ((pos (point))
-           (element (or element (org-element-at-point)))
-           (type (org-element-type element))
-           (post (org-element-property :post-affiliated element)))
-       ;; If point is inside an element containing objects or
-       ;; a secondary string, narrow buffer to the container and
-       ;; proceed with parsing.  Otherwise, return ELEMENT.
-       (cond
-       ;; At a parsed affiliated keyword, check if we're inside main
-       ;; or dual value.
-       ((and post (< pos post))
-        (beginning-of-line)
-        (let ((case-fold-search t)) (looking-at org-element--affiliated-re))
-        (cond
-         ((not (member-ignore-case (match-string 1)
+  (save-match-data
+    (catch 'objects-forbidden
+      (org-with-wide-buffer
+       (let* ((pos (point))
+             (element (or element (org-element-at-point)))
+             (type (org-element-type element))
+             (post (org-element-property :post-affiliated element)))
+         ;; If point is inside an element containing objects or
+         ;; a secondary string, narrow buffer to the container and
+         ;; proceed with parsing.  Otherwise, return ELEMENT.
+         (cond
+         ;; At a parsed affiliated keyword, check if we're inside main
+         ;; or dual value.
+         ((and post (< pos post))
+          (beginning-of-line)
+          (let ((case-fold-search t)) (looking-at org-element--affiliated-re))
+          (cond
+           ((not (member-ignore-case (match-string 1)
                                    org-element-parsed-keywords))
-          (throw 'objects-forbidden element))
-         ((< (match-end 0) pos)
-          (narrow-to-region (match-end 0) (line-end-position)))
-         ((and (match-beginning 2)
-               (>= pos (match-beginning 2))
-               (< pos (match-end 2)))
-          (narrow-to-region (match-beginning 2) (match-end 2)))
+            (throw 'objects-forbidden element))
+           ((< (match-end 0) pos)
+            (narrow-to-region (match-end 0) (line-end-position)))
+           ((and (match-beginning 2)
+                 (>= pos (match-beginning 2))
+                 (< pos (match-end 2)))
+            (narrow-to-region (match-beginning 2) (match-end 2)))
+           (t (throw 'objects-forbidden element)))
+          ;; Also change type to retrieve correct restrictions.
+          (setq type 'keyword))
+         ;; At an item, objects can only be located within tag, if any.
+         ((eq type 'item)
+          (let ((tag (org-element-property :tag element)))
+            (if (or (not tag) (/= (line-beginning-position) post))
+                (throw 'objects-forbidden element)
+              (beginning-of-line)
+              (search-forward tag (line-end-position))
+              (goto-char (match-beginning 0))
+              (if (and (>= pos (point)) (< pos (match-end 0)))
+                  (narrow-to-region (point) (match-end 0))
+                (throw 'objects-forbidden element)))))
+         ;; At an headline or inlinetask, objects are in title.
+         ((memq type '(headline inlinetask))
+          (let ((case-fold-search nil))
+            (goto-char (org-element-property :begin element))
+            (looking-at org-complex-heading-regexp)
+            (let ((end (match-end 4)))
+              (if (not end) (throw 'objects-forbidden element)
+                (goto-char (match-beginning 4))
+                (when (looking-at org-element-comment-string)
+                  (goto-char (match-end 0)))
+                (if (>= (point) end) (throw 'objects-forbidden element)
+                  (narrow-to-region (point) end))))))
+         ;; At a paragraph, a table-row or a verse block, objects are
+         ;; located within their contents.
+         ((memq type '(paragraph table-row verse-block))
+          (let ((cbeg (org-element-property :contents-begin element))
+                (cend (org-element-property :contents-end element)))
+            ;; CBEG is nil for table rules.
+            (if (and cbeg cend (>= pos cbeg)
+                     (or (< pos cend) (and (= pos cend) (eobp))))
+                (narrow-to-region cbeg cend)
+              (throw 'objects-forbidden element))))
          (t (throw 'objects-forbidden element)))
-        ;; Also change type to retrieve correct restrictions.
-        (setq type 'keyword))
-       ;; At an item, objects can only be located within tag, if any.
-       ((eq type 'item)
-        (let ((tag (org-element-property :tag element)))
-          (if (or (not tag) (/= (line-beginning-position) post))
-              (throw 'objects-forbidden element)
-            (beginning-of-line)
-            (search-forward tag (line-end-position))
-            (goto-char (match-beginning 0))
-            (if (and (>= pos (point)) (< pos (match-end 0)))
-                (narrow-to-region (point) (match-end 0))
-              (throw 'objects-forbidden element)))))
-       ;; At an headline or inlinetask, objects are in title.
-       ((memq type '(headline inlinetask))
-        (let ((case-fold-search nil))
-          (goto-char (org-element-property :begin element))
-          (looking-at org-complex-heading-regexp)
-          (let ((end (match-end 4)))
-            (if (not end) (throw 'objects-forbidden element)
-              (goto-char (match-beginning 4))
-              (when (looking-at org-comment-string)
-                (goto-char (match-end 0)))
-              (if (>= (point) end) (throw 'objects-forbidden element)
-                (narrow-to-region (point) end))))))
-       ;; At a paragraph, a table-row or a verse block, objects are
-       ;; located within their contents.
-       ((memq type '(paragraph table-row verse-block))
-        (let ((cbeg (org-element-property :contents-begin element))
-              (cend (org-element-property :contents-end element)))
-          ;; CBEG is nil for table rules.
-          (if (and cbeg cend (>= pos cbeg)
-                   (or (< pos cend) (and (= pos cend) (eobp))))
-              (narrow-to-region cbeg cend)
-            (throw 'objects-forbidden element))))
-       (t (throw 'objects-forbidden element)))
-       (goto-char (point-min))
-       (let ((restriction (org-element-restriction type))
-            (parent element)
-            last)
-        (catch 'exit
-          (while t
-            (let ((next (org-element--object-lex restriction)))
-              (when next (org-element-put-property next :parent parent))
-              ;; Process NEXT, if any, in order to know if we need to
-              ;; skip it, return it or move into it.
-              (if (or (not next) (> (org-element-property :begin next) pos))
-                  (throw 'exit (or last parent))
-                (let ((end (org-element-property :end next))
-                      (cbeg (org-element-property :contents-begin next))
-                      (cend (org-element-property :contents-end next)))
-                  (cond
-                   ;; Skip objects ending before point.  Also skip
-                   ;; objects ending at point unless it is also the
-                   ;; end of buffer, since we want to return the
-                   ;; innermost object.
-                   ((and (<= end pos) (/= (point-max) end))
-                    (goto-char end)
-                    ;; For convenience, when object ends at POS,
-                    ;; without any space, store it in LAST, as we
-                    ;; will return it if no object starts here.
-                    (when (and (= end pos)
-                               (not (memq (char-before) '(?\s ?\t))))
-                      (setq last next)))
-                   ;; If POS is within a container object, move into
-                   ;; that object.
-                   ((and cbeg cend
-                         (>= pos cbeg)
-                         (or (< pos cend)
-                             ;; At contents' end, if there is no
-                             ;; space before point, also move into
-                             ;; object, for consistency with
-                             ;; convenience feature above.
-                             (and (= pos cend)
-                                  (or (= (point-max) pos)
-                                      (not (memq (char-before pos)
-                                                 '(?\s ?\t)))))))
-                    (goto-char cbeg)
-                    (narrow-to-region (point) cend)
-                    (setq parent next)
-                    (setq restriction (org-element-restriction next)))
-                   ;; Otherwise, return NEXT.
-                   (t (throw 'exit next)))))))))))))
+         (goto-char (point-min))
+         (let ((restriction (org-element-restriction type))
+              (parent element)
+              last)
+          (catch 'exit
+            (while t
+              (let ((next (org-element--object-lex restriction)))
+                (when next (org-element-put-property next :parent parent))
+                ;; Process NEXT, if any, in order to know if we need to
+                ;; skip it, return it or move into it.
+                (if (or (not next) (> (org-element-property :begin next) pos))
+                    (throw 'exit (or last parent))
+                  (let ((end (org-element-property :end next))
+                        (cbeg (org-element-property :contents-begin next))
+                        (cend (org-element-property :contents-end next)))
+                    (cond
+                     ;; Skip objects ending before point.  Also skip
+                     ;; objects ending at point unless it is also the
+                     ;; end of buffer, since we want to return the
+                     ;; innermost object.
+                     ((and (<= end pos) (/= (point-max) end))
+                      (goto-char end)
+                      ;; For convenience, when object ends at POS,
+                      ;; without any space, store it in LAST, as we
+                      ;; will return it if no object starts here.
+                      (when (and (= end pos)
+                                 (not (memq (char-before) '(?\s ?\t))))
+                        (setq last next)))
+                     ;; If POS is within a container object, move into
+                     ;; that object.
+                     ((and cbeg cend
+                           (>= pos cbeg)
+                           (or (< pos cend)
+                               ;; At contents' end, if there is no
+                               ;; space before point, also move into
+                               ;; object, for consistency with
+                               ;; convenience feature above.
+                               (and (= pos cend)
+                                    (or (= (point-max) pos)
+                                        (not (memq (char-before pos)
+                                                   '(?\s ?\t)))))))
+                      (goto-char cbeg)
+                      (narrow-to-region (point) cend)
+                      (setq parent next)
+                      (setq restriction (org-element-restriction next)))
+                     ;; Otherwise, return NEXT.
+                     (t (throw 'exit next))))))))))))))
 
 (defun org-element-lineage (datum &optional types with-self)
   "List all ancestors of a given element or object.
@@ -6196,60 +8057,51 @@ end of ELEM-A."
     (when (and specialp
               (or (not (eq (org-element-type elem-B) 'paragraph))
                   (/= (org-element-property :begin elem-B)
-                      (org-element-property :contents-begin elem-B))))
+                     (org-element-property :contents-begin elem-B))))
       (error "Cannot swap elements"))
-    ;; In a special situation, ELEM-A will have no indentation.  We'll
-    ;; give it ELEM-B's (which will in, in turn, have no indentation).
-    (let* ((ind-B (when specialp
-                   (goto-char (org-element-property :begin elem-B))
-                   (current-indentation)))
-          (beg-A (org-element-property :begin elem-A))
-          (end-A (save-excursion
-                   (goto-char (org-element-property :end elem-A))
-                   (skip-chars-backward " \r\t\n")
-                    (line-end-position)))
-          (beg-B (org-element-property :begin elem-B))
-          (end-B (save-excursion
-                   (goto-char (org-element-property :end elem-B))
-                   (skip-chars-backward " \r\t\n")
-                    (line-end-position)))
-          ;; Store inner overlays responsible for visibility status.
-          ;; We also need to store their boundaries as they will be
-          ;; removed from buffer.
-          (overlays
-           (cons
-            (delq nil
-                  (mapcar (lambda (o)
-                            (and (>= (overlay-start o) beg-A)
-                                 (<= (overlay-end o) end-A)
-                                 (list o (overlay-start o) (overlay-end o))))
-                          (overlays-in beg-A end-A)))
-            (delq nil
-                  (mapcar (lambda (o)
-                            (and (>= (overlay-start o) beg-B)
-                                 (<= (overlay-end o) end-B)
-                                 (list o (overlay-start o) (overlay-end o))))
-                          (overlays-in beg-B end-B)))))
-          ;; Get contents.
-          (body-A (buffer-substring beg-A end-A))
-          (body-B (delete-and-extract-region beg-B end-B)))
-      (goto-char beg-B)
-      (when specialp
-       (setq body-B (replace-regexp-in-string "\\`[ \t]*" "" body-B))
-       (indent-to-column ind-B))
-      (insert body-A)
-      ;; Restore ex ELEM-A overlays.
-      (let ((offset (- beg-B beg-A)))
-       (dolist (o (car overlays))
-         (move-overlay (car o) (+ (nth 1 o) offset) (+ (nth 2 o) offset)))
+    ;; Preserve folding state when `org-fold-core-style' is set to
+    ;; `text-properties'.
+    (org-fold-core-ignore-modifications
+      ;; In a special situation, ELEM-A will have no indentation.  We'll
+      ;; give it ELEM-B's (which will in, in turn, have no indentation).
+      (let* ((ind-B (when specialp
+                     (goto-char (org-element-property :begin elem-B))
+                     (current-indentation)))
+            (beg-A (org-element-property :begin elem-A))
+            (end-A (save-excursion
+                     (goto-char (org-element-property :end elem-A))
+                     (skip-chars-backward " \r\t\n")
+                     (line-end-position)))
+            (beg-B (org-element-property :begin elem-B))
+            (end-B (save-excursion
+                     (goto-char (org-element-property :end elem-B))
+                     (skip-chars-backward " \r\t\n")
+                     (line-end-position)))
+            ;; Store inner folds responsible for visibility status.
+            (folds
+             (cons
+               (org-fold-core-get-regions :from beg-A :to end-A :relative t)
+               (org-fold-core-get-regions :from beg-B :to end-B :relative t)))
+            ;; Get contents.
+            (body-A (buffer-substring beg-A end-A))
+            (body-B (buffer-substring beg-B end-B)))
+        ;; Clear up the folds.
+        (org-fold-region beg-A end-A nil)
+        (org-fold-region beg-B end-B nil)
+        (delete-region beg-B end-B)
+        (goto-char beg-B)
+        (when specialp
+         (setq body-B (replace-regexp-in-string "\\`[ \t]*" "" body-B))
+         (indent-to-column ind-B))
+        (insert body-A)
+        ;; Restore ex ELEM-A folds.
+        (org-fold-core-regions (car folds) :relative beg-B)
        (goto-char beg-A)
        (delete-region beg-A end-A)
        (insert body-B)
-       ;; Restore ex ELEM-B overlays.
-       (dolist (o (cdr overlays))
-         (move-overlay (car o) (- (nth 1 o) offset) (- (nth 2 o) offset))))
-      (goto-char (org-element-property :end elem-B)))))
-
+        ;; Restore ex ELEM-A folds.
+        (org-fold-core-regions (cdr folds) :relative beg-A)
+        (goto-char (org-element-property :end elem-B))))))
 
 (provide 'org-element)
 
diff --git a/lisp/org/org-entities.el b/lisp/org/org-entities.el
index b2dbccd40c..153aa2b676 100644
--- a/lisp/org/org-entities.el
+++ b/lisp/org/org-entities.el
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>,
 ;;         Ulf Stegemann <ulf at zeitform dot de>
 ;; Keywords: outlines, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -27,6 +27,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (declare-function org-mode "org" ())
 (declare-function org-toggle-pretty-entities "org"       ())
 (declare-function org-table-align            "org-table" ())
@@ -89,8 +92,8 @@ packages to be loaded, add these packages to 
`org-latex-packages-alist'."
      ("aacute" "\\'{a}" nil "&aacute;" "a" "á" "á")
      ("Acirc" "\\^{A}" nil "&Acirc;" "A" "Â" "Â")
      ("acirc" "\\^{a}" nil "&acirc;" "a" "â" "â")
-     ("Amacr" "\\bar{A}" nil "&Amacr;" "A" "Ã" "Ã")
-     ("amacr" "\\bar{a}" nil "&amacr;" "a" "ã" "ã")
+     ("Amacr" "\\={A}" nil "&Amacr;" "A" "Ã" "Ã")
+     ("amacr" "\\={a}" nil "&amacr;" "a" "ã" "ã")
      ("Atilde" "\\~{A}" nil "&Atilde;" "A" "Ã" "Ã")
      ("atilde" "\\~{a}" nil "&atilde;" "a" "ã" "ã")
      ("Auml" "\\\"{A}" nil "&Auml;" "Ae" "Ä" "Ä")
@@ -307,7 +310,7 @@ packages to be loaded, add these packages to 
`org-latex-packages-alist'."
      ("trade" "\\texttrademark{}" nil "&trade;" "TM" "TM" "™")
 
      "** Science et al."
-     ("minus" "\\minus" t "&minus;" "-" "-" "−")
+     ("minus" "-" t "&minus;" "-" "-" "−")
      ("pm" "\\textpm{}" nil "&plusmn;" "+-" "±" "±")
      ("plusmn" "\\textpm{}" nil "&plusmn;" "+-" "±" "±")
      ("times" "\\texttimes{}" nil "&times;" "*" "×" "×")
diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el
index 78148a1b6d..0effa13a1d 100644
--- a/lisp/org/org-faces.el
+++ b/lisp/org/org-faces.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -28,6 +28,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (defgroup org-faces nil
   "Faces in Org mode."
   :tag "Org Faces"
@@ -338,7 +341,7 @@ determines if it is a foreground or a background color."
 
 (defvar org-tags-special-faces-re nil)
 (defun org-set-tag-faces (var value)
-  (set var value)
+  (set-default-toplevel-value var value)
   (if (not value)
       (setq org-tags-special-faces-re nil)
     (setq org-tags-special-faces-re
@@ -455,6 +458,10 @@ verse and quote blocks are fontified using the `org-verse' 
and
   "Face used for the line delimiting the end of source blocks."
   :group 'org-faces)
 
+(defface org-inline-src-block '((t (:inherit org-block)))
+  "Face used for inline source blocks as a whole."
+  :group 'org-faces)
+
 (defface org-verbatim '((t (:inherit shadow)))
   "Face for fixed-with text like code snippets."
   :group 'org-faces
@@ -593,7 +600,7 @@ See also `org-agenda-deadline-faces'.")
     (0.0 . org-upcoming-distant-deadline))
   "Faces for showing deadlines in the agenda.
 This is a list of cons cells.  The cdr of each cell is a face to be used,
-and it can also just be like \\='(:foreground \"yellow\").
+and it can also just be like (:foreground \"yellow\").
 Each car is a fraction of the head-warning time that must have passed for
 this the face in the cdr to be used for display.  The numbers must be
 given in descending order.  The head-warning time is normally taken
diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el
index c7b4bde0d2..3523a6c5ba 100644
--- a/lisp/org/org-feed.el
+++ b/lisp/org/org-feed.el
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -88,6 +88,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org)
 (require 'sha1)
 
@@ -412,8 +415,8 @@ it can be a list structured like an entry in 
`org-feed-alist'."
 
          ;; Normalize the visibility of the inbox tree
          (goto-char inbox-pos)
-         (org-flag-subtree t)
-         (org-show-children)
+         (org-fold-subtree t)
+         (org-fold-show-children)
 
          ;; Hooks and messages
          (when org-feed-save-after-adding (save-buffer))
diff --git a/lisp/org/org-fold-core.el b/lisp/org/org-fold-core.el
new file mode 100644
index 0000000000..ffa689d4fa
--- /dev/null
+++ b/lisp/org/org-fold-core.el
@@ -0,0 +1,1516 @@
+;;; org-fold-core.el --- Folding buffer text -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020-2020 Free Software Foundation, Inc.
+;;
+;; Author: Ihor Radchenko <yantar92 at gmail dot com>
+;; Keywords: folding, invisible text
+;; URL: https://orgmode.org
+;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+
+;; This file contains library to control temporary invisibility
+;; (folding and unfolding) of text in buffers.
+
+;; The file implements the following functionality:
+;;
+;; - Folding/unfolding regions of text
+;; - Searching and examining boundaries of folded text
+;; - Interactive searching in folded text (via isearch)
+;; - Handling edits in folded text
+;; - Killing/yanking (copying/pasting) of the folded text
+
+;; To setup folding in an arbitrary buffer, one must call
+;; `org-fold-core-initialize', optionally providing the list of folding specs 
to be
+;; used in the buffer.  The specs can be added, removed, or
+;; re-configured later.  Read below for more details.
+
+;;; Folding/unfolding regions of text
+
+;; User can temporarily hide/reveal (fold/unfold) arbitrary regions or
+;; text.  The folds can be nested.
+
+;; Internally, nested folds are marked with different folding specs
+;; Overlapping folds marked with the same folding spec are
+;; automatically merged, while folds with different folding specs can
+;; coexist and be folded/unfolded independently.
+
+;; When multiple folding specs are applied to the same region of text,
+;; text visibility is decided according to the folding spec with
+;; topmost priority.
+
+;; By default, we define two types of folding specs:
+;; - 'org-fold-visible :: the folded text is not hidden
+;; - 'org-fold-hidden  :: the folded text is completely hidden
+;;
+;; The 'org-fold-visible spec has highest priority allowing parts of
+;; text folded with 'org-fold-hidden to be shown unconditionally.
+
+;; Consider the following Org mode link:
+;; [[file:/path/to/file/file.ext][description]]
+;; Only the word "description" is normally visible in this link.
+;;
+;; The way this partial visibility is achieved is combining the two
+;; folding specs.  The whole link is folded using 'org-fold-hidden
+;; folding spec, but the visible part is additionally folded using
+;; 'org-fold-visible:
+;;
+;; <begin org-fold-hidden>[[file:/path/to/file/file.ext][<begin 
org-fold-visible>description<end org-fold-visible>]]<end org-fold-hidden>
+;;
+;; Because 'org-fold-visible has higher priority than
+;; 'org-fold-hidden, it suppresses the 'org-fold-hidden effect and
+;; thus reveals the description part of the link.
+
+;; Similar to 'org-fold-visible, display of any arbitrary folding spec
+;; can be configured using folding spec properties.  In particular,
+;; `:visible' folding spec property controls whether the folded text
+;; is visible or not.  If the `:visible' folding spec property is nil,
+;; folded text is hidden or displayed as a constant string (ellipsis)
+;; according to the value of `:ellipsis' folding spec property.  See
+;; docstring of `org-fold-core--specs' for the description of all the available
+;; folding spec properties.
+
+;; Folding spec properties of any valid folding spec can be changed
+;; any time using `org-fold-core-set-folding-spec-property'.
+
+;; If necessary, one can add or remove folding specs using
+;; `org-fold-core-add-folding-spec' and `org-fold-core-remove-folding-spec'.
+
+;; If a buffer initialized with `org-fold-core-initialize' is cloned into 
indirect
+;; buffers, it's folding state is copied to that indirect buffer.
+;; The folding states are independent.
+
+;; When working with indirect buffers that are handled by this
+;; library, one has to keep in mind that folding state is preserved on
+;; copy when using non-interactive functions.  Moreover, the folding
+;; states of all the indirect buffers will be copied together.
+;;
+;; Example of the implications:
+;; Consider a base buffer and indirect buffer with the following state:
+;; ----- base buffer --------
+;; * Heading<begin fold>
+;; Some text folded in the base buffer, but unfolded in the indirect 
buffer<end fold>
+;; * Other heading
+;; Heading unfolded in both the buffers.
+;; ---------------------------
+;; ------ indirect buffer ----
+;; * Heading
+;; Some text folded in the base buffer, but unfolded in the indirect buffer
+;; * Other heading
+;; Heading unfolded in both the buffers.
+;; ----------------------------
+;; If some Elisp code copies the whole "Heading" from the indirect
+;; buffer with `buffer-substring' or match data and inserts it into
+;; the base buffer, the inserted heading will be folded since the
+;; internal setting for the folding state is shared between the base
+;; and indirect buffers.  It's just that the indirect buffer ignores
+;; the base buffer folding settings.  However, as soon as the text is
+;; copied back to the base buffer, the folding state will become
+;; respected again.
+
+;; If the described situation is undesired, Elisp code can use
+;; `filter-buffer-substring' instead of `buffer-substring'.  All the
+;; folding states that do not belong to the currently active buffer
+;; will be cleared in the copied text then.  See
+;; `org-fold-core--buffer-substring-filter' for more details.
+
+;; Because of details of implementation of the folding, it is also not
+;; recommended to set text visibility in buffer directly by setting
+;; `invisible' text property to anything other than t.  While this
+;; should usually work just fine, normal folding can be broken if one
+;; sets `invisible' text property to a value not listed in
+;; `buffer-invisibility-spec'.
+
+;;; Searching and examining boundaries of folded text
+
+;; It is possible to examine folding specs (there may be several) of
+;; text at point or search for regions with the same folding spec.
+;; See functions defined under ";;;; Searching and examining folded
+;; text" below for details.
+
+;; All the folding specs can be specified by symbol representing their
+;; name.  However, this is not always convenient, especially if the
+;; same spec can be used for fold different syntaxical structures.
+;; Any folding spec can be additionally referenced by a symbol listed
+;; in the spec's `:alias' folding spec property.  For example, Org
+;; mode's `org-fold-outline' folding spec can be referenced as any
+;; symbol from the following list: '(headline heading outline
+;; inlinetask plain-list) The list is the value of the spec's `:alias'
+;; property.
+
+;; Most of the functions defined below that require a folding spec
+;; symbol as their argument, can also accept any symbol from the
+;; `:alias' spec property to reference that folding spec.
+
+;; If one wants to search invisible text without using the provided
+;; functions, it is important to keep in mind that 'invisible text
+;; property may have multiple possible values (not just nil and
+;; t). Hence, (next-single-char-property-change pos 'invisible) is not
+;; guaranteed to return the boundary of invisible/visible text.
+
+;;; Interactive searching inside folded text (via isearch)
+
+;; The library provides a way to control if the folded text can be
+;; searchable using isearch.  If the text is searchable, it is also
+;; possible to control to unfold it temporarily during interactive
+;; isearch session.
+
+;; The isearch behavior is controlled on per-folding-spec basis by
+;; setting `isearch-open' and `isearch-ignore' folding spec
+;; properties.  The the docstring of `org-fold-core--specs' for more details.
+
+;;; Handling edits inside folded text
+
+;; The visibility of the text inserted in front, rear, or in the
+;; middle of a folded region is managed according to `:front-sticky'
+;; and `:rear-sticky' folding properties of the corresponding folding
+;; spec.  The rules are the same with stickiness of text properties in
+;; Elisp.
+
+;; If a text being inserted into the buffer is already folded and
+;; invisible (before applying the stickiness rules), then it is
+;; revealed.  This behavior can be changed by wrapping the insertion
+;; code into `org-fold-core-ignore-modifications' macro.  The macro will 
disable
+;; all the processing related to buffer modifications.
+
+;; The library also provides a way to unfold the text after some
+;; destructive changes breaking syntaxical structure of the buffer.
+;; For example, Org mode automatically reveals folded drawers when the
+;; drawer becomes syntaxically incorrect:
+;; ------- before modification -------
+;; :DRAWER:<begin fold>
+;; Some folded text inside drawer
+;; :END:<end fold>
+;; -----------------------------------
+;; If the ":END:" is edited, drawer syntax is not correct anymore and
+;; the folded text is automatically unfolded.
+;; ------- after modification --------
+;; :DRAWER:
+;; Some folded text inside drawer
+;; :EN:
+;; -----------------------------------
+
+;; The described automatic unfolding is controlled by `:fragile'
+;; folding spec property.  It's value can be a function checking if
+;; changes inside (or around) the fold should drigger the unfold.  By
+;; default, only changes that directly involve folded regions will
+;; trigger the check.  In addition, 
`org-fold-core-extend-changed-region-functions'
+;; can be set to extend the checks to all folded regions intersecting
+;; with the region returned by the functions listed in the variable.
+
+;; The fragility checks can be bypassed if the code doing
+;; modifications is wrapped into `org-fold-core-ignore-fragility-checks' macro.
+
+;;; Performance considerations
+
+;; This library is using text properties to hide text.  Text
+;; properties are much faster than overlays, that could be used for
+;; the same purpose.  Overlays are implemented with O(n) complexity in
+;; Emacs (as for 2021-03-11).  It means that any attempt to move
+;; through hidden text in a file with many invisible overlays will
+;; require time scaling with the number of folded regions (the problem
+;; Overlays note of the manual warns about).  For curious, historical
+;; reasons why overlays are not efficient can be found in
+;; https://www.jwz.org/doc/lemacs.html.
+
+;; Despite using text properties, the performance is still limited by
+;; Emacs display engine.  For example, >7Mb of text hidden within
+;; visible part of a buffer may cause noticeable lags (which is still
+;; orders of magnitude better in comparison with overlays).  If the
+;; performance issues become critical while using this library, it is
+;; recommended to minimize the number of folding specs used in the
+;; same buffer at a time.
+
+;; Alternatively, the library provides 
`org-fold-core--optimise-for-huge-buffers'
+;; for additional speedup.  This can be used as a file-local variable
+;; in huge buffers.  The variable can be set to enable various levels
+;; of extra optimization.  See the docstring for detailed information.
+
+;; It is worth noting that when using 
`org-fold-core--optimise-for-huge-buffers'
+;; with `grab-invisible' option, folded regions copied to other
+;; buffers (including buffers that do not use this library) will
+;; remain invisible.  org-fold-core provides functions to work around
+;; this issue: `org-fold-core-remove-optimisation' and 
`org-fold-core-update-optimisation', but
+;; it is unlikely that a random external package will use them.
+
+;; Another possible bottleneck is the fragility check after the change
+;; related to the folded text.  The functions used in `:fragile'
+;; folding properties must be optimized.  Also,
+;; `org-fold-core-ignore-fragility-checks' or even 
`org-fold-core-ignore-modifications' may be
+;; used when appropriate in the performance-critical code.  When
+;; inserting text from within `org-fold-core-ignore-modifications' macro, it is
+;; recommended to use `insert-and-inherit' instead of `insert' and
+;; `insert-before-markers-and-inherit' instead of
+;; `insert-before-markers' to avoid revealing inserted text in the
+;; middle of a folded region.
+
+;; Performance of isearch is currently limited by Emacs isearch
+;; implementation.  For now, Emacs isearch only supports searching
+;; through text hidden using overlays.  This library handles isearch
+;; by converting folds with matching text to overlays, which may
+;; affect performance in case of large number of matches.  In the
+;; future, Emacs will hopefully accept the relevant patch allowing
+;; isearch to work with text hidden via text properties, but the
+;; performance hit has to be accepted meanwhile.
+
+;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'org-macs)
+(require 'org-compat)
+
+(declare-function isearch-filter-visible "isearch" (beg end))
+
+;;; Customization
+
+(defcustom org-fold-core-style 'text-properties
+  "Internal implementation detail used to hide folded text.
+Can be either `text-properties' or `overlays'.
+The former is faster on large files, while the latter is generally
+less error-prone with regard to third-party packages that haven't yet
+adapted to the new folding implementation.
+
+Important: This variable must be set before loading Org."
+  :group 'org
+  :package-version '(Org . "9.6")
+  :type '(choice
+          (const :tag "Overlays" overlays)
+          (const :tag "Text properties" text-properties)))
+
+(defvar-local org-fold-core-isearch-open-function 
#'org-fold-core--isearch-reveal
+  "Function used to reveal hidden text found by isearch.
+The function is called with a single argument - point where text is to
+be revealed.")
+
+(defvar-local org-fold-core--optimise-for-huge-buffers nil
+  "Non-nil turns on extra speedup on huge buffers (Mbs of folded text).
+
+This setting is risky and may cause various artifacts and degraded
+functionality, especially when using external packages.  It is
+recommended to enable it on per-buffer basis as file-local variable.
+
+When set to non-nil, must be a list containing one or multiple the
+following symbols:
+
+- `grab-invisible': Use `invisible' text property to hide text.  This
+  will reduce the load on Emacs display engine and one may use it if
+  moving point across folded regions becomes slow.  However, as a side
+  effect, some external packages extracting i.e. headlings from folded
+  parts of buffer may keep the text invisible.
+
+- `ignore-fragility-checks': Do not try to detect when user edits
+  break structure of the folded elements.  This will speed up
+  modifying the folded regions at the cost that some higher-level
+  functions relying on this package might not be able to unfold the
+  edited text.  For example, removed leading stars from a folded
+  headline in Org mode will break visibility cycling since Org mode
+  will not be avare that the following folded text belonged to
+  headline.
+
+- `ignore-modification-checks': Do not try to detect insertions in the
+  middle of the folded regions.  This will speed up non-interactive
+  edits of the folded regions.  However, text inserted in the middle
+  of the folded regions may become visible for some external packages
+  inserting text using `insert' instead of `insert-and-inherit' (the
+  latter is rarely used in practice).
+
+- `ignore-indirect': Do not decouple folding state in the indirect
+  buffers.  This can speed up Emacs display engine (and thus motion of
+  point), especially when large number of indirect buffers is being
+  used.
+
+- `merge-folds': Do not distinguish between different types of folding
+  specs.  This is the most aggressive optimization with unforeseen and
+  potentially drastic effects.")
+(put 'org-fold-core--optimise-for-huge-buffers 'safe-local-variable 'listp)
+
+;;; Core functionality
+
+;;;; Folding specs
+
+(defvar-local org-fold-core--specs '((org-fold-visible
+                        (:visible . t)
+                         (:alias . (visible)))
+                        (org-fold-hidden
+                        (:ellipsis . "...")
+                         (:isearch-open . t)
+                         (:alias . (hidden))))
+  "Folding specs defined in current buffer.
+
+Each spec is a list (SPEC-SYMBOL SPEC-PROPERTIES).
+SPEC-SYMBOL is the symbol representing the folding spec.
+SPEC-PROPERTIES is an alist defining folding spec properties.
+
+If a text region is folded using multiple specs, only the folding spec
+listed earlier is used.
+
+The following properties are known:
+- :ellipsis         :: must be nil or string to show when text is folded
+                      using this spec.
+- :global           :: non-nil means that folding state will be preserved
+                      when copying folded text between buffers.
+- :isearch-ignore   :: non-nil means that folded text is not searchable
+                      using isearch.
+- :isearch-open     :: non-nil means that isearch can reveal text hidden
+                      using this spec.  This property does nothing
+                      when `isearch-ignore' property is non-nil.
+- :front-sticky     :: non-nil means that text prepended to the folded text
+                      is automatically folded.
+- :rear-sticky      :: non-nil means that text appended to the folded text
+                      is folded.
+- :visible          :: non-nil means that folding spec visibility is not
+                       managed.  Instead, visibility settings in
+                       `buffer-invisibility-spec' will be used as is.
+                       Note that changing this property from nil to t may
+                       clear the setting in `buffer-invisibility-spec'.
+- :alias            :: a list of aliases for the SPEC-SYMBOL.
+- :fragile          :: Must be a function accepting two arguments.
+                       Non-nil means that changes in region may cause
+                       the region to be revealed.  The region is
+                       revealed after changes if the function returns
+                       non-nil.
+                       The function called after changes are made with
+                       two arguments: cons (beg . end) representing the
+                       folded region and spec symbol.")
+(defvar-local org-fold-core--spec-symbols nil
+  "Alist holding buffer spec symbols and aliases.
+
+This variable is defined to reduce load on Emacs garbage collector
+reducing the number of transiently allocated variables.")
+(defvar-local org-fold-core--spec-list nil
+  "List holding buffer spec symbols, but not aliases.
+
+This variable is defined to reduce load on Emacs garbage collector
+reducing the number of transiently allocated variables.")
+
+(defvar-local org-fold-core-extend-changed-region-functions nil
+  "Special hook run just before handling changes in buffer.
+
+This is used to account changes outside folded regions that still
+affect the folded region visibility.  For example, removing all stars
+at the beginning of a folded Org mode heading should trigger the
+folded text to be revealed.  Each function is called with two
+arguments: beginning and the end of the changed region.")
+
+;;; Utility functions
+
+(defsubst org-fold-core-folding-spec-list (&optional buffer)
+  "Return list of all the folding spec symbols in BUFFER."
+  (or (buffer-local-value 'org-fold-core--spec-list (or buffer 
(current-buffer)))
+      (with-current-buffer (or buffer (current-buffer))
+        (setq org-fold-core--spec-list (mapcar #'car org-fold-core--specs)))))
+
+(defun org-fold-core-get-folding-spec-from-alias (spec-or-alias)
+  "Return the folding spec symbol for SPEC-OR-ALIAS.
+Return nil when there is no matching folding spec."
+  (when spec-or-alias
+    (unless org-fold-core--spec-symbols
+      (dolist (spec (org-fold-core-folding-spec-list))
+        (push (cons spec spec) org-fold-core--spec-symbols)
+        (dolist (alias (assq :alias (assq spec org-fold-core--specs)))
+          (push (cons alias spec) org-fold-core--spec-symbols))))
+    (alist-get spec-or-alias org-fold-core--spec-symbols)))
+
+(defsubst org-fold-core-folding-spec-p (spec-or-alias)
+  "Check if SPEC-OR-ALIAS is a registered folding spec."
+  (org-fold-core-get-folding-spec-from-alias spec-or-alias))
+
+(defsubst org-fold-core--check-spec (spec-or-alias)
+  "Throw an error if SPEC-OR-ALIAS is not in 
`org-fold-core--spec-priority-list'."
+  (unless (org-fold-core-folding-spec-p spec-or-alias)
+    (error "%s is not a valid folding spec" spec-or-alias)))
+
+(defsubst org-fold-core-get-folding-spec-property (spec-or-alias property)
+  "Get PROPERTY of a folding SPEC-OR-ALIAS.
+Possible properties can be found in `org-fold-core--specs' docstring."
+  (org-fold-core--check-spec spec-or-alias)
+  (if (and (memql 'ignore-indirect org-fold-core--optimise-for-huge-buffers)
+           (eq property :global))
+      t
+    (if (and (memql 'merge-folds org-fold-core--optimise-for-huge-buffers)
+             (eq property :visible))
+        nil
+      (cdr (assq property (assq (org-fold-core-get-folding-spec-from-alias 
spec-or-alias) org-fold-core--specs))))))
+
+(defconst org-fold-core--spec-property-prefix "org-fold--spec-"
+  "Prefix used to create property symbol.")
+
+(defsubst org-fold-core-get-folding-property-symbol (spec &optional buffer 
global)
+  "Get folding text property using to store SPEC in current buffer or BUFFER.
+If GLOBAL is non-nil, do not make the property unique in the BUFFER."
+  (if (memql 'merge-folds org-fold-core--optimise-for-huge-buffers)
+      (intern (format "%s-global" org-fold-core--spec-property-prefix))
+    (intern (format (concat org-fold-core--spec-property-prefix "%s-%S")
+                    (symbol-name spec)
+                    ;; (sxhash buf) appears to be not constant over time.
+                    ;; Using buffer-name is safe, since the only place where
+                    ;; buffer-local text property actually matters is an 
indirect
+                    ;; buffer, where the name cannot be same anyway.
+                    (if (or global
+                            (memql 'ignore-indirect 
org-fold-core--optimise-for-huge-buffers))
+                        'global
+                      (sxhash (buffer-name (or buffer (current-buffer)))))))))
+
+(defsubst org-fold-core-get-folding-spec-from-folding-prop (folding-prop)
+  "Return folding spec symbol used for folding property with name 
FOLDING-PROP."
+  (catch :exit
+    (dolist (spec (org-fold-core-folding-spec-list))
+      ;; We know that folding properties have
+      ;; folding spec in their name.
+      (when (string-match-p (symbol-name spec)
+                            (symbol-name folding-prop))
+        (throw :exit spec)))))
+
+(defvar org-fold-core--property-symbol-cache (make-hash-table :test 'equal)
+  "Saved values of folding properties for (buffer . spec) conses.")
+(defvar-local org-fold-core--indirect-buffers nil
+  "List of indirect buffers created from current buffer.
+
+The first element of the list is always the current buffer.
+
+This variable is needed to work around Emacs bug#46982, while Emacs
+does not provide a way `after-change-functions' in any other buffer
+than the buffer where the change was actually made.")
+
+(defmacro org-fold-core-cycle-over-indirect-buffers (&rest body)
+  "Execute BODY in current buffer and all its indirect buffers.
+
+Also, make sure that folding properties from killed buffers are not
+hanging around."
+  (declare (debug (form body)) (indent 0))
+  `(let (buffers dead-properties)
+     (if (and (not (buffer-base-buffer))
+              (not (memq (current-buffer) org-fold-core--indirect-buffers)))
+         ;; We are in base buffer with `org-fold-core--indirect-buffers' value 
from
+         ;; different buffer.  This can happen, for example, when
+         ;; org-capture copies local variables into *Capture* buffer.
+         (setq buffers (list (current-buffer)))
+       (dolist (buf (cons (or (buffer-base-buffer) (current-buffer))
+                          (buffer-local-value 'org-fold-core--indirect-buffers 
(or (buffer-base-buffer) (current-buffer)))))
+         (if (buffer-live-p buf)
+             (push buf buffers)
+           (dolist (spec (org-fold-core-folding-spec-list))
+             (when (and (not (org-fold-core-get-folding-spec-property spec 
:global))
+                        (gethash (cons buf spec) 
org-fold-core--property-symbol-cache))
+               ;; Make sure that dead-properties variable can be passed
+               ;; as argument to `remove-text-properties'.
+               (push t dead-properties)
+               (push (gethash (cons buf spec) 
org-fold-core--property-symbol-cache)
+                     dead-properties))))))
+     (dolist (buf buffers)
+       (with-current-buffer buf
+         (with-silent-modifications
+           (save-restriction
+             (widen)
+             (remove-text-properties
+              (point-min) (point-max)
+              dead-properties)))
+         ,@body))))
+
+;; This is the core function used to fold text in buffers.  We use
+;; text properties to hide folded text, however 'invisible property is
+;; not directly used (unless risky `org-fold-core--optimise-for-huge-buffers' 
is
+;; enabled). Instead, we define unique text property (folding
+;; property) for every possible folding spec and add the resulting
+;; text properties into `char-property-alias-alist', so that
+;; 'invisible text property is automatically defined if any of the
+;; folding properties is non-nil.  This approach lets us maintain
+;; multiple folds for the same text region - poor man's overlays (but
+;; much faster).  Additionally, folding properties are ensured to be
+;; unique for different buffers (especially for indirect
+;; buffers). This is done to allow different folding states in
+;; indirect buffers.
+(defun org-fold-core--property-symbol-get-create (spec &optional buffer 
return-only)
+  "Return a unique symbol suitable as folding text property.
+Return value is unique for folding SPEC in BUFFER.
+If the buffer already have buffer-local setup in `char-property-alias-alist'
+and the setup appears to be created for different buffer,
+copy the old invisibility state into new buffer-local text properties,
+unless RETURN-ONLY is non-nil."
+  (if (eq org-fold-core-style 'overlays)
+      (org-fold-core-get-folding-property-symbol spec nil 'global)
+    (let* ((buf (or buffer (current-buffer))))
+      ;; Create unique property symbol for SPEC in BUFFER
+      (let ((local-prop (or (gethash (cons buf spec) 
org-fold-core--property-symbol-cache)
+                           (puthash (cons buf spec)
+                                     (org-fold-core-get-folding-property-symbol
+                                      spec buf
+                                      (org-fold-core-get-folding-spec-property 
spec :global))
+                                     org-fold-core--property-symbol-cache))))
+        (prog1
+            local-prop
+          (unless return-only
+           (with-current-buffer buf
+              ;; Update folding properties carried over from other
+              ;; buffer (implying that current buffer is indirect
+              ;; buffer). Normally, `char-property-alias-alist' in new
+              ;; indirect buffer is a copy of the same variable from
+              ;; the base buffer. Then, `char-property-alias-alist'
+              ;; would contain folding properties, which are not
+              ;; matching the generated `local-prop'.
+             (unless (member local-prop (cdr (assq 'invisible 
char-property-alias-alist)))
+                ;; Add current buffer to the list of indirect buffers in the 
base buffer.
+                (when (buffer-base-buffer)
+                  (with-current-buffer (buffer-base-buffer)
+                    (setq-local org-fold-core--indirect-buffers
+                                (let (bufs)
+                                  (org-fold-core-cycle-over-indirect-buffers
+                                    (push (current-buffer) bufs))
+                                  (push buf bufs)
+                                  (delete-dups bufs)))))
+                ;; Copy all the old folding properties to preserve the folding 
state
+                (with-silent-modifications
+                  (dolist (old-prop (cdr (assq 'invisible 
char-property-alias-alist)))
+                    (org-with-wide-buffer
+                     (let* ((pos (point-min))
+                           (spec 
(org-fold-core-get-folding-spec-from-folding-prop old-prop))
+                            ;; Generate new buffer-unique folding property
+                           (new-prop (when spec 
(org-fold-core--property-symbol-get-create spec nil 'return-only))))
+                       ;; Copy the visibility state for `spec' from `old-prop' 
to `new-prop'
+                       (unless (eq old-prop new-prop)
+                         (while (< pos (point-max))
+                          (let ((val (get-text-property pos old-prop))
+                                 (next (next-single-char-property-change pos 
old-prop)))
+                            (when val
+                              (put-text-property pos next new-prop val))
+                             (setq pos next)))))))
+                  ;; Update `char-property-alias-alist' with folding
+                  ;; properties unique for the current buffer.
+                  (setq-local char-property-alias-alist
+                             (cons (cons 'invisible
+                                         (mapcar (lambda (spec)
+                                                   
(org-fold-core--property-symbol-get-create spec nil 'return-only))
+                                                 
(org-fold-core-folding-spec-list)))
+                                   (remove (assq 'invisible 
char-property-alias-alist)
+                                           char-property-alias-alist)))
+                  ;; Set folding property stickiness according to
+                  ;; their `:font-sticky' and `:rear-sticky'
+                  ;; parameters.
+                  (let (full-prop-list)
+                    (org-fold-core-cycle-over-indirect-buffers
+                      (setq full-prop-list
+                            (append full-prop-list
+                                    (delq nil
+                                          (mapcar (lambda (spec)
+                                                    (cond
+                                                     
((org-fold-core-get-folding-spec-property spec :front-sticky)
+                                                      (cons 
(org-fold-core--property-symbol-get-create spec nil 'return-only)
+                                                            nil))
+                                                     
((org-fold-core-get-folding-spec-property spec :rear-sticky)
+                                                      nil)
+                                                     (t
+                                                      (cons 
(org-fold-core--property-symbol-get-create spec nil 'return-only)
+                                                            t))))
+                                                  
(org-fold-core-folding-spec-list))))))
+                    (org-fold-core-cycle-over-indirect-buffers
+                      (setq-local text-property-default-nonsticky
+                                  (delete-dups (append
+                                                text-property-default-nonsticky
+                                                full-prop-list))))))))))))))
+
+(defun org-fold-core-decouple-indirect-buffer-folds ()
+  "Copy and decouple folding state in a newly created indirect buffer.
+This function is mostly intended to be used in
+`clone-indirect-buffer-hook'."
+  (when (and (buffer-base-buffer)
+             (eq org-fold-core-style 'text-properties)
+             (not (memql 'ignore-indirect 
org-fold-core--optimise-for-huge-buffers)))
+    (org-fold-core--property-symbol-get-create (car 
(org-fold-core-folding-spec-list)))))
+
+;;; API
+
+;;;; Modifying folding specs
+
+(defun org-fold-core-set-folding-spec-property (spec property value &optional 
force)
+  "Set PROPERTY of a folding SPEC to VALUE.
+Possible properties and values can be found in `org-fold-core--specs' 
docstring.
+Do not check previous value when FORCE is non-nil."
+  (pcase property
+    (:ellipsis
+     (unless (and (not force) (equal value 
(org-fold-core-get-folding-spec-property spec :ellipsis)))
+       (remove-from-invisibility-spec (cons spec 
(org-fold-core-get-folding-spec-property spec :ellipsis)))
+       (unless (org-fold-core-get-folding-spec-property spec :visible)
+         (add-to-invisibility-spec (cons spec value)))))
+    (:visible
+     (unless (or (memql 'merge-folds org-fold-core--optimise-for-huge-buffers)
+                 (and (not force) (equal value 
(org-fold-core-get-folding-spec-property spec :visible))))
+       (if value
+          (remove-from-invisibility-spec (cons spec 
(org-fold-core-get-folding-spec-property spec :ellipsis)))
+         (add-to-invisibility-spec (cons spec 
(org-fold-core-get-folding-spec-property spec :ellipsis))))))
+    (:alias
+     ;; Clear symbol cache.
+     (setq org-fold-core--spec-symbols nil))
+    (:isearch-open nil)
+    (:isearch-ignore nil)
+    (:front-sticky nil)
+    (:rear-sticky nil)
+    (_ nil))
+  (setf (cdr (assq property (assq spec org-fold-core--specs))) value))
+
+(defun org-fold-core-add-folding-spec (spec &optional properties buffer append)
+  "Add a new folding SPEC with PROPERTIES in BUFFER.
+
+SPEC must be a symbol.  BUFFER can be a buffer to set SPEC in or nil to
+set SPEC in current buffer.
+
+By default, the added SPEC will have highest priority among the
+previously defined specs.  When optional APPEND argument is non-nil,
+SPEC will have the lowest priority instead.  If SPEC was already
+defined earlier, it will be redefined according to provided optional
+arguments.
+`
+The folding spec properties will be set to PROPERTIES (see
+`org-fold-core--specs' for details)."
+  (when (eq spec 'all) (error "Cannot use reserved folding spec symbol 'all"))
+  (with-current-buffer (or buffer (current-buffer))
+    ;; Clear the cache.
+    (setq org-fold-core--spec-list nil
+          org-fold-core--spec-symbols nil)
+    (let* ((full-properties (mapcar (lambda (prop) (cons prop (cdr (assq prop 
properties))))
+                                    '( :visible :ellipsis :isearch-ignore
+                                       :global :isearch-open :front-sticky
+                                       :rear-sticky :fragile :alias)))
+           (full-spec (cons spec full-properties)))
+      (add-to-list 'org-fold-core--specs full-spec append)
+      (mapc (lambda (prop-cons) (org-fold-core-set-folding-spec-property spec 
(car prop-cons) (cdr prop-cons) 'force)) full-properties)
+      ;; Update buffer inivisibility specs.
+      (org-fold-core--property-symbol-get-create spec))))
+
+(defun org-fold-core-remove-folding-spec (spec &optional buffer)
+  "Remove a folding SPEC in BUFFER.
+
+SPEC must be a symbol.
+
+BUFFER can be a buffer to remove SPEC in, nil to remove SPEC in current
+buffer, or `all' to remove SPEC in all open `org-mode' buffers and all
+future org buffers."
+  (org-fold-core--check-spec spec)
+  (when (eq buffer 'all)
+    (setq-default org-fold-core--specs (delete (cdr (assq spec 
org-fold-core--specs)) org-fold-core--specs))
+    (mapc (lambda (buf)
+           (org-fold-core-remove-folding-spec spec buf))
+         (buffer-list)))
+  (let ((buffer (or buffer (current-buffer))))
+    (with-current-buffer buffer
+      ;; Clear the cache.
+      (setq org-fold-core--spec-list nil
+            org-fold-core--spec-symbols nil)
+      (org-fold-core-set-folding-spec-property spec :visible t)
+      (setq org-fold-core--specs (delete (cdr (assq spec 
org-fold-core--specs)) org-fold-core--specs)))))
+
+(defun org-fold-core-initialize (&optional specs)
+  "Setup folding in current buffer using SPECS as value of 
`org-fold-core--specs'."
+  ;; Preserve the priorities.
+  (when specs (setq specs (nreverse specs)))
+  (unless specs (setq specs org-fold-core--specs))
+  (setq org-fold-core--specs nil
+        org-fold-core--spec-list nil
+        org-fold-core--spec-symbols nil)
+  (dolist (spec specs)
+    (org-fold-core-add-folding-spec (car spec) (cdr spec)))
+  (add-hook 'after-change-functions 'org-fold-core--fix-folded-region nil 
'local)
+  (add-hook 'clone-indirect-buffer-hook 
#'org-fold-core-decouple-indirect-buffer-folds nil 'local)
+  ;; Setup killing text
+  (setq-local filter-buffer-substring-function 
#'org-fold-core--buffer-substring-filter)
+  (if (and (boundp 'isearch-opened-regions)
+           (eq org-fold-core-style 'text-properties))
+      ;; Use new implementation of isearch allowing to search inside text
+      ;; hidden via text properties.
+      (org-fold-core--isearch-setup 'text-properties)
+    (org-fold-core--isearch-setup 'overlays)))
+
+;;;; Searching and examining folded text
+
+(defsubst org-fold-core-folded-p (&optional pos spec-or-alias)
+  "Non-nil if the character after POS is folded.
+If POS is nil, use `point' instead.
+If SPEC-OR-ALIAS is a folding spec or a list, only check the given
+folding spec or the listed specs."
+  (if (and spec-or-alias (listp spec-or-alias))
+      (catch :found
+        (dolist (spec spec-or-alias)
+          (let ((val (org-fold-core-get-folding-spec spec pos)))
+            (when val (throw :found val)))))
+    (org-fold-core-get-folding-spec spec-or-alias pos)))
+
+(defun org-fold-core-region-folded-p (beg end &optional spec-or-alias)
+  "Non-nil if the region between BEG and END is folded.
+If SPEC-OR-ALIAS is a folding spec, only check the given folding spec."
+  (org-with-point-at beg
+    (catch :visible
+      (while (< (point) end)
+        (unless (org-fold-core-get-folding-spec spec-or-alias) (throw :visible 
nil))
+        (goto-char (org-fold-core-next-folding-state-change spec-or-alias nil 
end)))
+      t)))
+
+(defun org-fold-core-get-folding-spec (&optional spec-or-alias pom)
+  "Get folding state at `point' or POM.
+Return nil if there is no folding at point or POM.
+If SPEC-OR-ALIAS is nil, return a folding spec with highest priority
+among present at `point' or POM.
+If SPEC-OR-ALIAS is `all', return the list of all present folding
+specs.
+If SPEC-OR-ALIAS is a valid folding spec or a spec alias, return the
+corresponding folding spec (if the text is folded using that spec)."
+  (let ((spec (if (eq spec-or-alias 'all)
+                  'all
+                (org-fold-core-get-folding-spec-from-alias spec-or-alias))))
+    (when (and spec (not (eq spec 'all))) (org-fold-core--check-spec spec))
+    (org-with-point-at pom
+      (cond
+       ((eq spec 'all)
+        (let ((result))
+         (dolist (spec (org-fold-core-folding-spec-list))
+           (let ((val (get-char-property (point) 
(org-fold-core--property-symbol-get-create spec nil t))))
+             (when val (push val result))))
+          (reverse result)))
+       ((null spec)
+        (let ((result (get-char-property (point) 'invisible)))
+          (when (org-fold-core-folding-spec-p result) result)))
+       (t (get-char-property (point) 
(org-fold-core--property-symbol-get-create spec nil t)))))))
+
+(defun org-fold-core-get-folding-specs-in-region (beg end)
+  "Get all folding specs in region from BEG to END."
+  (let ((pos beg)
+       all-specs)
+    (while (< pos end)
+      (setq all-specs (append all-specs (org-fold-core-get-folding-spec nil 
pos)))
+      (setq pos (org-fold-core-next-folding-state-change nil pos end)))
+    (unless (listp all-specs) (setq all-specs (list all-specs)))
+    (delete-dups all-specs)))
+
+(defun org-fold-core-get-region-at-point (&optional spec-or-alias pom)
+  "Return region folded using SPEC-OR-ALIAS at POM.
+If SPEC is nil, return the largest possible folded region.
+The return value is a cons of beginning and the end of the region.
+Return nil when no fold is present at point of POM."
+  (let ((spec (org-fold-core-get-folding-spec-from-alias spec-or-alias)))
+    (org-with-point-at (or pom (point))
+      (if spec
+          (if (eq org-fold-core-style 'text-properties)
+             (org-find-text-property-region (point) 
(org-fold-core--property-symbol-get-create spec nil t))
+            (let ((ov (cdr (get-char-property-and-overlay (point) 
(org-fold-core--property-symbol-get-create spec nil t)))))
+              (when ov (cons (overlay-start ov) (overlay-end ov)))))
+        (let ((region (cons (point) (point))))
+         (dolist (spec (org-fold-core-get-folding-spec 'all))
+            (let ((local-region (org-fold-core-get-region-at-point spec)))
+              (when (< (car local-region) (car region))
+                (setcar region (car local-region)))
+              (when (> (cdr local-region) (cdr region))
+                (setcdr region (cdr local-region)))))
+         (unless (eq (car region) (cdr region)) region))))))
+
+(defun org-fold-core-next-visibility-change (&optional pos limit 
ignore-hidden-p previous-p)
+  "Return next point from POS up to LIMIT where text becomes visible/invisible.
+By default, text hidden by any means (i.e. not only by folding, but
+also via fontification) will be considered.
+If IGNORE-HIDDEN-P is non-nil, consider only folded text.
+If PREVIOUS-P is non-nil, search backwards."
+  (let* ((pos (or pos (point)))
+        (invisible-p (if ignore-hidden-p
+                         #'org-fold-core-folded-p
+                       #'invisible-p))
+         (invisible-initially? (funcall invisible-p pos))
+        (limit (or limit (if previous-p
+                             (point-min)
+                           (point-max))))
+         (cmp (if previous-p #'> #'<))
+        (next-change (if previous-p
+                         (if ignore-hidden-p
+                              (lambda (p) 
(org-fold-core-previous-folding-state-change (org-fold-core-get-folding-spec 
nil p) p limit))
+                           (lambda (p) (max limit (1- 
(previous-single-char-property-change p 'invisible nil limit)))))
+                        (if ignore-hidden-p
+                            (lambda (p) 
(org-fold-core-next-folding-state-change (org-fold-core-get-folding-spec nil p) 
p limit))
+                         (lambda (p) (next-single-char-property-change p 
'invisible nil limit)))))
+        (next pos))
+    (while (and (funcall cmp next limit)
+               (not (org-xor invisible-initially? (funcall invisible-p next))))
+      (setq next (funcall next-change next)))
+    next))
+
+(defun org-fold-core-previous-visibility-change (&optional pos limit 
ignore-hidden-p)
+  "Call `org-fold-core-next-visibility-change' searching backwards."
+  (org-fold-core-next-visibility-change pos limit ignore-hidden-p 'previous))
+
+(defun org-fold-core-next-folding-state-change (&optional spec-or-alias pos 
limit previous-p)
+  "Return point after POS where folding state changes up to LIMIT.
+If SPEC-OR-ALIAS is nil, return next point where _any_ single folding
+spec changes.
+For example, (org-fold-core-next-folding-state-change nil) with point
+somewhere in the below structure will return the nearest <...> point.
+
+* Headline <begin outline fold>
+:PROPERTIES:<begin drawer fold>
+:ID: test
+:END:<end drawer fold>
+
+Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo,
+quis tempor ligula erat quis odio.
+
+** Another headline
+:DRAWER:<begin drawer fold>
+:END:<end drawer fold>
+** Yet another headline
+<end of outline fold>
+
+If SPEC-OR-ALIAS is a folding spec symbol, only consider that folding
+spec.
+
+If SPEC-OR-ALIAS is a list, only consider changes of folding specs
+from the list.
+
+Search backwards when PREVIOUS-P is non-nil."
+  (when (and spec-or-alias (symbolp spec-or-alias))
+    (setq spec-or-alias (list spec-or-alias)))
+  (when spec-or-alias
+    (setq spec-or-alias
+         (mapcar (lambda (spec-or-alias)
+                   (or (org-fold-core-get-folding-spec-from-alias 
spec-or-alias)
+                       spec-or-alias))
+                  spec-or-alias))
+    (mapc #'org-fold-core--check-spec spec-or-alias))
+  (unless spec-or-alias
+    (setq spec-or-alias (org-fold-core-folding-spec-list)))
+  (setq pos (or pos (point)))
+  (apply (if previous-p
+            #'max
+          #'min)
+         (mapcar (if previous-p
+                    (lambda (prop) (max (or limit (point-min)) 
(previous-single-char-property-change pos prop nil (or limit (point-min)))))
+                  (lambda (prop) (next-single-char-property-change pos prop 
nil (or limit (point-max)))))
+                 (mapcar (lambda (el) 
(org-fold-core--property-symbol-get-create el nil t))
+                        spec-or-alias))))
+
+(defun org-fold-core-previous-folding-state-change (&optional spec-or-alias 
pos limit)
+  "Call `org-fold-core-next-folding-state-change' searching backwards."
+  (org-fold-core-next-folding-state-change spec-or-alias pos limit 'previous))
+
+(defun org-fold-core-search-forward (spec-or-alias &optional limit)
+  "Search next region folded via folding SPEC-OR-ALIAS up to LIMIT.
+Move point right after the end of the region, to LIMIT, or
+`point-max'.  The `match-data' will contain the region."
+  (let ((spec (org-fold-core-get-folding-spec-from-alias spec-or-alias)))
+    (let ((prop-symbol (org-fold-core--property-symbol-get-create spec nil t)))
+      (goto-char (or (next-single-char-property-change (point) prop-symbol nil 
limit) limit (point-max)))
+      (when (and (< (point) (or limit (point-max)))
+                (not (org-fold-core-get-folding-spec spec)))
+        (goto-char (next-single-char-property-change (point) prop-symbol nil 
limit)))
+      (when (org-fold-core-get-folding-spec spec)
+        (let ((region (org-fold-core-get-region-at-point spec)))
+         (when (< (cdr region) (or limit (point-max)))
+           (goto-char (1+ (cdr region)))
+            (set-match-data (list (set-marker (make-marker) (car region) 
(current-buffer))
+                                 (set-marker (make-marker) (cdr region) 
(current-buffer))))))))))
+
+(cl-defun org-fold-core-get-regions (&key specs from to with-markers relative)
+  "Find all the folded regions in current buffer.
+
+Each element of the returned list represent folded region boundaries
+and the folding spec: (BEG END SPEC).
+
+Search folds intersecting with (FROM TO) buffer region if FROM and TO
+are provided.
+
+If FROM is non-nil and TO is nil, search the folded regions at FROM.
+
+When both FROM and TO are nil, search folded regions in the whole buffer.
+
+When SPECS is non-nil it should be a list of folding specs or a symbol.
+Only return the matching fold types.
+
+When WITH-MARKERS is non-nil, use markers to represent region
+boundaries.
+
+When RELATIVE is a buffer position, regions boundaries are given
+relative to that position.
+When RELATIVE is t, use FROM as the position.
+WITH-MARKERS must be nil when RELATIVE is non-nil."
+  (when (and relative with-markers)
+    (error "Cannot use markers in non-absolute region boundaries"))
+  (when (eq relative t) (setq relative from))
+  (unless (listp specs) (setq specs (list specs)))
+  (let (regions region mk-region)
+    (org-with-wide-buffer
+     (when (and (not from) (not to))
+       (setq from (point-min)
+             to (point-max)))
+     (when (and from (not to)) (setq to (point-max)))
+     (when (and from (< from (point-min))) (setq from (point-min)))
+     (when (and to (> to (point-max))) (setq to (point-max)))
+     (unless from (setq from (point-min)))
+     (dolist (spec (or specs (org-fold-core-folding-spec-list)) regions)
+       (goto-char from)
+       (catch :exit
+         (while (or (not to) (< (point) to))
+           (when (org-fold-core-get-folding-spec spec)
+             (setq region (org-fold-core-get-region-at-point spec))
+             (when relative
+               (cl-decf (car region) relative)
+               (cl-decf (cdr region) relative))
+             (if (not with-markers)
+                 (setq mk-region `(,(car region) ,(cdr region) ,spec))
+               (setq mk-region `(,(make-marker) ,(make-marker) ,spec))
+               (move-marker (nth 0 mk-region) (car region))
+               (move-marker (nth 1 mk-region) (cdr region)))
+             (push mk-region regions))
+           (unless to (throw :exit nil))
+           (goto-char (org-fold-core-next-folding-state-change spec nil 
to))))))))
+
+;;;; Changing visibility
+
+;;;;; Region visibility
+
+;; This is the core function performing actual folding/unfolding.  The
+;; folding state is stored in text property (folding property)
+;; returned by `org-fold-core--property-symbol-get-create'.  The value of the
+;; folding property is folding spec symbol.
+(defun org-fold-core-region (from to flag &optional spec-or-alias)
+  "Hide or show lines from FROM to TO, according to FLAG.
+SPEC-OR-ALIAS is the folding spec or foldable element, as a symbol.
+If SPEC-OR-ALIAS is omitted and FLAG is nil, unfold everything in the region."
+  (let ((spec (org-fold-core-get-folding-spec-from-alias spec-or-alias)))
+    (when spec (org-fold-core--check-spec spec))
+    (with-silent-modifications
+      (org-with-wide-buffer
+       (when (eq org-fold-core-style 'overlays) (remove-overlays from to 
'invisible spec))
+       (if flag
+          (if (not spec)
+               (error "Calling `org-fold-core-region' with missing SPEC")
+             (if (eq org-fold-core-style 'overlays)
+                 ;; Use `front-advance' since text right before to the 
beginning of
+                 ;; the overlay belongs to the visible line than to the 
contents.
+                 (let ((o (make-overlay from to nil
+                                        
(org-fold-core-get-folding-spec-property spec :front-sticky)
+                                        
(org-fold-core-get-folding-spec-property spec :rear-sticky))))
+                   (overlay-put o 'evaporate t)
+                   (overlay-put o (org-fold-core--property-symbol-get-create 
spec) spec)
+                   (overlay-put o 'invisible spec)
+                   (overlay-put o 'isearch-open-invisible 
#'org-fold-core--isearch-show)
+                   (overlay-put o 'isearch-open-invisible-temporary 
#'org-fold-core--isearch-show-temporary))
+              (put-text-property from to 
(org-fold-core--property-symbol-get-create spec) spec)
+              (put-text-property from to 'isearch-open-invisible 
#'org-fold-core--isearch-show)
+              (put-text-property from to 'isearch-open-invisible-temporary 
#'org-fold-core--isearch-show-temporary)
+               (when (memql 'grab-invisible 
org-fold-core--optimise-for-huge-buffers)
+                 ;; If the SPEC has highest priority, assign it directly
+                 ;; to 'invisible property as well.  This is done to speed
+                 ;; up Emacs redisplay on huge (Mbs) folded regions where
+                 ;; we don't even want Emacs to spend time cycling over
+                 ;; `char-property-alias-alist'.
+                 (when (eq spec (caar org-fold-core--specs)) 
(put-text-property from to 'invisible spec)))))
+         (if (not spec)
+             (mapc (lambda (spec) (org-fold-core-region from to nil spec)) 
(org-fold-core-folding-spec-list))
+           (when (and (memql 'grab-invisible 
org-fold-core--optimise-for-huge-buffers)
+                      (eq org-fold-core-style 'text-properties))
+             (when (eq spec (caar org-fold-core--specs))
+               (let ((pos from))
+                 (while (< pos to)
+                   (if (eq spec (get-text-property pos 'invisible))
+                       (let ((next (org-fold-core-next-folding-state-change 
spec pos to)))
+                         (remove-text-properties pos next '(invisible t))
+                         (setq pos next))
+                     (setq pos (next-single-char-property-change pos 
'invisible nil to)))))))
+           (when (eq org-fold-core-style 'text-properties)
+            (remove-text-properties from to (list 
(org-fold-core--property-symbol-get-create spec) nil)))))))))
+
+(cl-defmacro org-fold-core-regions (regions &key override clean-markers 
relative)
+  "Fold every region in REGIONS list in current buffer.
+
+Each region in the list is a list (BEG END SPEC-OR-ALIAS) describing
+region and folding spec to be applied.
+
+When optional argument OVERRIDE is non-nil, clear folding state in the
+buffer first.
+
+When optional argument CLEAN-MARKERS is non-nil, clear markers used to
+mark region boundaries in REGIONS.
+
+When optional argument RELATIVE is non-nil, it must be a buffer
+position.  REGION boundaries are then treated as relative distances
+from that position."
+  `(org-with-wide-buffer
+    (when ,override (org-fold-core-region (point-min) (point-max) nil))
+    (pcase-dolist (`(,beg ,end ,spec) (delq nil ,regions))
+      (let ((rel ,relative))
+        (if rel
+            (org-fold-core-region (+ rel beg) (+ rel end) t spec)
+          (org-fold-core-region beg end t spec)))
+      (when ,clean-markers
+        (when (markerp beg) (set-marker beg nil))
+        (when (markerp end) (set-marker end nil))))))
+
+(defmacro org-fold-core-save-visibility (use-markers &rest body)
+  "Save and restore folding state around BODY.
+If USE-MARKERS is non-nil, use markers for the positions.  This
+means that the buffer may change while running BODY, but it also
+means that the buffer should stay alive during the operation,
+because otherwise all these markers will point to nowhere."
+  (declare (debug (form body)) (indent 1))
+  (org-with-gensyms (regions)
+    `(let* ((,regions (org-fold-core-get-regions :with-markers ,use-markers)))
+       (unwind-protect (progn ,@body)
+         (org-fold-core-regions ,regions :override t :clean-markers t)))))
+
+;;; Make isearch search in some text hidden via text propertoes
+
+(defvar org-fold-core--isearch-overlays nil
+  "List of overlays temporarily created during isearch.
+This is used to allow searching in regions hidden via text properties.
+As for [2020-05-09 Sat], Isearch only has special handling of hidden overlays.
+Any text hidden via text properties is not revealed even if `search-invisible'
+is set to `t'.")
+
+(defvar-local org-fold-core--isearch-local-regions (make-hash-table :test 
'equal)
+  "Hash table storing temporarily shown folds from isearch matches.")
+
+(defun org-fold-core--isearch-setup (type)
+  "Initialize isearch in org buffer.
+TYPE can be either `text-properties' or `overlays'."
+  (pcase type
+    (`text-properties
+     (setq-local search-invisible 'open-all)
+     (add-hook 'isearch-mode-end-hook #'org-fold-core--clear-isearch-state nil 
'local)
+     (add-hook 'isearch-mode-hook #'org-fold-core--clear-isearch-state nil 
'local)
+     (setq-local isearch-filter-predicate 
#'org-fold-core--isearch-filter-predicate-text-properties))
+    (`overlays
+     (when (eq org-fold-core-style 'text-properties)
+       (setq-local isearch-filter-predicate 
#'org-fold-core--isearch-filter-predicate-overlays)
+       (add-hook 'isearch-mode-end-hook 
#'org-fold-core--clear-isearch-overlays nil 'local)))
+    (_ (error "%s: Unknown type of setup for `org-fold-core--isearch-setup'" 
type))))
+
+(defun org-fold-core--isearch-reveal (pos)
+  "Default function used to reveal hidden text at POS for isearch."
+  (let ((region (org-fold-core-get-region-at-point pos)))
+    (org-fold-core-region (car region) (cdr region) nil)))
+
+(defun org-fold-core--isearch-filter-predicate-text-properties (beg end)
+  "Make sure that folded text is searchable when user want so.
+This function is intended to be used as `isearch-filter-predicate'."
+  (and
+   ;; Check folding specs that cannot be searched
+   (not (memq nil (mapcar (lambda (spec) (not 
(org-fold-core-get-folding-spec-property spec :isearch-ignore)))
+                      (org-fold-core-get-folding-specs-in-region beg end))))
+   ;; Check 'invisible properties that are not folding specs.
+   (or (eq search-invisible t) ; User wants to search anyway, allow it.
+       (let ((pos beg)
+            unknown-invisible-property)
+        (while (and (< pos end)
+                    (not unknown-invisible-property))
+          (when (and (get-text-property pos 'invisible)
+                      (not (org-fold-core-folding-spec-p (get-text-property 
pos 'invisible))))
+            (setq unknown-invisible-property t))
+          (setq pos (next-single-char-property-change pos 'invisible)))
+        (not unknown-invisible-property)))
+   (or (and (eq search-invisible t)
+           ;; FIXME: this opens regions permanenly for now.
+            ;; I also tried to force search-invisible 'open-all around
+            ;; `isearch-range-invisible', but that somehow causes
+            ;; infinite loop in `isearch-lazy-highlight'.
+            (prog1 t
+             ;; We still need to reveal the folded location
+             (org-fold-core--isearch-show-temporary (cons beg end) nil)))
+       (not (isearch-range-invisible beg end)))))
+
+(defun org-fold-core--clear-isearch-state ()
+  "Clear `org-fold-core--isearch-local-regions'."
+  (clrhash org-fold-core--isearch-local-regions))
+
+(defun org-fold-core--isearch-show (region)
+  "Reveal text in REGION found by isearch.
+REGION can also be an overlay in current buffer."
+  (when (overlayp region)
+    (setq region (cons (overlay-start region)
+                       (overlay-end region))))
+  (org-with-point-at (car region)
+    (while (< (point) (cdr region))
+      (funcall org-fold-core-isearch-open-function (car region))
+      (goto-char (org-fold-core-next-visibility-change (point) (cdr region) 
'ignore-hidden)))))
+
+(defun org-fold-core--isearch-show-temporary (region hide-p)
+  "Temporarily reveal text in REGION.
+Hide text instead if HIDE-P is non-nil.
+REGION can also be an overlay in current buffer."
+  (when (overlayp region)
+    (setq region (cons (overlay-start region)
+                       (overlay-end region))))
+  (if (not hide-p)
+      (let ((pos (car region)))
+       (while (< pos (cdr region))
+          (let ((spec-no-open
+                 (catch :found
+                   (dolist (spec (org-fold-core-get-folding-spec 'all pos))
+                     (unless (org-fold-core-get-folding-spec-property spec 
:isearch-open)
+                       (throw :found spec))))))
+            (if spec-no-open
+                ;; Skip regions folded with folding specs that cannot be 
opened.
+                (setq pos (org-fold-core-next-folding-state-change 
spec-no-open pos (cdr region)))
+             (dolist (spec (org-fold-core-get-folding-spec 'all pos))
+               (push (cons spec (org-fold-core-get-region-at-point spec pos)) 
(gethash region org-fold-core--isearch-local-regions)))
+              (org-fold-core--isearch-show region)
+             (setq pos (org-fold-core-next-folding-state-change nil pos (cdr 
region)))))))
+    (mapc (lambda (val) (org-fold-core-region (cadr val) (cddr val) t (car 
val))) (gethash region org-fold-core--isearch-local-regions))
+    (remhash region org-fold-core--isearch-local-regions)))
+
+(defvar-local org-fold-core--isearch-special-specs nil
+  "List of specs that can break visibility state when converted to overlays.
+This is a hack, but I do not see a better way around until isearch
+gets support of text properties.")
+(defun org-fold-core--create-isearch-overlays (beg end)
+  "Replace text property invisibility spec by overlays between BEG and END.
+All the searchable folded regions will be changed to use overlays
+instead of text properties.  The created overlays will be stored in
+`org-fold-core--isearch-overlays'."
+  (let ((pos beg))
+    (while (< pos end)
+      ;; We need loop below to make sure that we clean all invisible
+      ;; properties, which may be nested.
+      (dolist (spec (org-fold-core-get-folding-spec 'all pos))
+        (unless (org-fold-core-get-folding-spec-property spec :isearch-ignore)
+         (let* ((region (org-fold-core-get-region-at-point spec pos)))
+            (when (memq spec org-fold-core--isearch-special-specs)
+              (setq pos (min pos (car region)))
+              (setq end (max end (cdr region))))
+           ;; Changing text properties is considered buffer modification.
+           ;; We do not want it here.
+           (with-silent-modifications
+              (org-fold-core-region (car region) (cdr region) nil spec)
+             ;; The overlay is modeled after `outline-flag-region'
+             ;; [2020-05-09 Sat] overlay for 'outline blocks.
+             (let ((o (make-overlay (car region) (cdr region) nil 
'front-advance)))
+               (overlay-put o 'evaporate t)
+               (overlay-put o 'invisible spec)
+                (overlay-put o 'org-invisible spec)
+                ;; Make sure that overlays are applied in the same order
+                ;; with the folding specs.
+                ;; Note: `memq` returns cdr with car equal to the first
+                ;; found matching element.
+                (overlay-put o 'priority (length (memq spec 
(org-fold-core-folding-spec-list))))
+               ;; `delete-overlay' here means that spec information will be 
lost
+               ;; for the region. The region will remain visible.
+                (if (org-fold-core-get-folding-spec-property spec 
:isearch-open)
+                   (overlay-put o 'isearch-open-invisible #'delete-overlay)
+                  (overlay-put o 'isearch-open-invisible #'ignore)
+                  (overlay-put o 'isearch-open-invisible-temporary #'ignore))
+               (push o org-fold-core--isearch-overlays))))))
+      (setq pos (org-fold-core-next-folding-state-change nil pos end)))))
+
+(defun org-fold-core--isearch-filter-predicate-overlays (beg end)
+  "Return non-nil if text between BEG and END is deemed visible by isearch.
+This function is intended to be used as `isearch-filter-predicate'."
+  (org-fold-core--create-isearch-overlays beg end) ;; trick isearch by 
creating overlays in place of invisible text
+  (isearch-filter-visible beg end))
+
+(defun org-fold-core--clear-isearch-overlay (ov)
+  "Convert OV region back into using text properties."
+  (let ((spec (if isearch-mode-end-hook-quit
+                  ;; Restore all folds.
+                  (overlay-get ov 'org-invisible)
+                ;; Leave opened folds open.
+                (overlay-get ov 'invisible))))
+    ;; Ignore deleted overlays.
+    (when (and spec
+              (overlay-buffer ov))
+      ;; Changing text properties is considered buffer modification.
+      ;; We do not want it here.
+      (with-silent-modifications
+       (when (<= (overlay-end ov) (point-max))
+         (org-fold-core-region (overlay-start ov) (overlay-end ov) t spec)))))
+  (when (member ov isearch-opened-overlays)
+    (setq isearch-opened-overlays (delete ov isearch-opened-overlays)))
+  (delete-overlay ov))
+
+(defun org-fold-core--clear-isearch-overlays ()
+  "Convert overlays from `org-fold-core--isearch-overlays' back to text 
properties."
+  (when org-fold-core--isearch-overlays
+    (mapc #'org-fold-core--clear-isearch-overlay 
org-fold-core--isearch-overlays)
+    (setq org-fold-core--isearch-overlays nil)))
+
+;;; Handling changes in folded elements
+
+(defvar org-fold-core--ignore-modifications nil
+  "Non-nil: skip processing modifications in 
`org-fold-core--fix-folded-region'.")
+(defvar org-fold-core--ignore-fragility-checks nil
+  "Non-nil: skip fragility checks in `org-fold-core--fix-folded-region'.")
+
+(defmacro org-fold-core-ignore-modifications (&rest body)
+  "Run BODY ignoring buffer modifications in 
`org-fold-core--fix-folded-region'."
+  (declare (debug (form body)) (indent 0))
+  `(let ((org-fold-core--ignore-modifications t))
+     (unwind-protect (progn ,@body)
+       (setq org-fold-core--last-buffer-chars-modified-tick 
(buffer-chars-modified-tick)))))
+
+(defmacro org-fold-core-ignore-fragility-checks (&rest body)
+  "Run BODY skipping :fragility checks in `org-fold-core--fix-folded-region'."
+  (declare (debug (form body)) (indent 0))
+  `(let ((org-fold-core--ignore-fragility-checks t))
+     (progn ,@body)))
+
+(defvar-local org-fold-core--last-buffer-chars-modified-tick nil
+  "Variable storing the last return value of `buffer-chars-modified-tick'.")
+
+(defun org-fold-core--fix-folded-region (from to _)
+  "Process modifications in folded elements within FROM . TO region.
+This function intended to be used as one of `after-change-functions'.
+
+This function does nothing if text the only modification was changing
+text properties (for the sake of reducing overheads).
+
+If a text was inserted into invisible region, hide the inserted text.
+If a text was inserted in front/back of the region, hide it according
+to :front-sticky/:rear-sticky folding spec property.
+
+If the folded region is folded with a spec with non-nil :fragile
+property, unfold the region if the :fragile function returns non-nil."
+  ;; If no insertions or deletions in buffer, skip all the checks.
+  (unless (or (eq org-fold-core--last-buffer-chars-modified-tick 
(buffer-chars-modified-tick))
+              org-fold-core--ignore-modifications
+              (memql 'ignore-modification-checks 
org-fold-core--optimise-for-huge-buffers))
+    ;; Store the new buffer modification state.
+    (setq org-fold-core--last-buffer-chars-modified-tick 
(buffer-chars-modified-tick))
+    (save-match-data
+      ;; Handle changes in all the indirect buffers and in the base
+      ;; buffer.  Work around Emacs bug#46982.
+      (when (eq org-fold-core-style 'text-properties)
+        (org-fold-core-cycle-over-indirect-buffers
+          ;; Re-hide text inserted in the middle/front/back of a folded
+          ;; region.
+          (unless (equal from to) ; Ignore deletions.
+           (dolist (spec (org-fold-core-folding-spec-list))
+              ;; Reveal fully invisible text inserted in the middle
+              ;; of visible portion of the buffer.  This is needed,
+              ;; for example, when there was a deletion in a folded
+              ;; heading, the heading was unfolded, end `undo' was
+              ;; called.  The `undo' would insert the folded text.
+              (when (and (or (eq from (point-min))
+                             (not (org-fold-core-folded-p (1- from) spec)))
+                         (or (eq to (point-max))
+                             (not (org-fold-core-folded-p to spec)))
+                         (org-fold-core-region-folded-p from to spec))
+                (org-fold-core-region from to nil spec))
+              ;; Look around and fold the new text if the nearby folds are
+              ;; sticky.
+              (unless (org-fold-core-region-folded-p from to spec)
+               (let ((spec-to (org-fold-core-get-folding-spec spec (min to (1- 
(point-max)))))
+                     (spec-from (org-fold-core-get-folding-spec spec (max 
(point-min) (1- from)))))
+                  ;; Reveal folds around undone deletion.
+                  (when undo-in-progress
+                    (let ((lregion (org-fold-core-get-region-at-point spec 
(max (point-min) (1- from))))
+                          (rregion (org-fold-core-get-region-at-point spec 
(min to (1- (point-max))))))
+                      (if (and lregion rregion)
+                          (org-fold-core-region (car lregion) (cdr rregion) 
nil spec)
+                        (when lregion
+                          (org-fold-core-region (car lregion) (cdr lregion) 
nil spec))
+                        (when rregion
+                          (org-fold-core-region (car rregion) (cdr rregion) 
nil spec)))))
+                  ;; Hide text inserted in the middle of a fold.
+                 (when (and (or spec-from (eq from (point-min)))
+                             (or spec-to (eq to (point-max)))
+                             (or spec-from spec-to)
+                             (eq spec-to spec-from)
+                             (or (org-fold-core-get-folding-spec-property spec 
:front-sticky)
+                                 (org-fold-core-get-folding-spec-property spec 
:rear-sticky)))
+                    (unless (and (eq from (point-min)) (eq to (point-max))) ; 
Buffer content replaced.
+                     (org-fold-core-region from to t (or spec-from spec-to))))
+                  ;; Hide text inserted at the end of a fold.
+                  (when (and spec-from 
(org-fold-core-get-folding-spec-property spec-from :rear-sticky))
+                    (org-fold-core-region from to t spec-from))
+                  ;; Hide text inserted in front of a fold.
+                  (when (and spec-to
+                             (not (eq to (point-max))) ; Text inserted at the 
end of buffer is not prepended anywhere.
+                             (org-fold-core-get-folding-spec-property spec-to 
:front-sticky))
+                    (org-fold-core-region from to t spec-to))))))))
+      ;; Process all the folded text between `from' and `to'.  Do it
+      ;; only in current buffer to avoid verifying semantic structure
+      ;; multiple times in indirect buffers that have exactly same
+      ;; text anyway.
+      (unless (or org-fold-core--ignore-fragility-checks
+                  (memql 'ignore-fragility-checks 
org-fold-core--optimise-for-huge-buffers))
+        (dolist (func org-fold-core-extend-changed-region-functions)
+          (let ((new-region (funcall func from to)))
+            (setq from (car new-region))
+            (setq to (cdr new-region))))
+        (org-fold-core-cycle-over-indirect-buffers
+          (dolist (spec (org-fold-core-folding-spec-list))
+            ;; No action is needed when :fragile is nil for the spec.
+            (when (org-fold-core-get-folding-spec-property spec :fragile)
+              (org-with-wide-buffer
+               ;; Expand the considered region to include partially present 
fold.
+               ;; Note: It is important to do this inside loop over all
+               ;; specs.  Otherwise, the region may be expanded to huge
+               ;; outline fold, potentially involving majority of the
+               ;; buffer.  That would cause the below code to loop over
+               ;; almost all the folds in buffer, which would be too slow.
+               (let ((local-from from)
+                     (local-to to)
+                     (region-from (org-fold-core-get-region-at-point spec (max 
(point-min) (1- from))))
+                     (region-to (org-fold-core-get-region-at-point spec (min 
to (1- (point-max))))))
+                 (when region-from (setq local-from (car region-from)))
+                 (when region-to (setq local-to (cdr region-to)))
+                 (let ((pos local-from))
+                   ;; Move to the first hidden region.
+                   (unless (org-fold-core-get-folding-spec spec pos)
+                     (setq pos (org-fold-core-next-folding-state-change spec 
pos local-to)))
+                   ;; Cycle over all the folds.
+                   (while (< pos local-to)
+                     (save-match-data ; we should not clobber match-data in 
after-change-functions
+                       (let ((fold-begin (and (org-fold-core-get-folding-spec 
spec pos)
+                                              pos))
+                             (fold-end 
(org-fold-core-next-folding-state-change spec pos local-to)))
+                         (when (and fold-begin fold-end)
+                           (when (save-excursion
+                                   (funcall 
(org-fold-core-get-folding-spec-property spec :fragile)
+                                            (cons fold-begin fold-end)
+                                            spec))
+                             ;; Reveal completely, not just from the SPEC.
+                             (org-fold-core-region fold-begin fold-end nil)))))
+                     ;; Move to next fold.
+                     (setq pos (org-fold-core-next-folding-state-change spec 
pos local-to)))))))))))))
+
+;;; Handling killing/yanking of folded text
+
+;; By default, all the text properties of the killed text are
+;; preserved, including the folding text properties.  This can be
+;; awkward when we copy a text from an indirect buffer to another
+;; indirect buffer (or the base buffer).  The copied text might be
+;; visible in the source buffer, but might disappear if we yank it in
+;; another buffer.  This happens in the following situation:
+;; ---- base buffer ----
+;; * Headline<begin fold>
+;; Some text hidden in the base buffer, but revealed in the indirect
+;; buffer.<end fold>
+;; * Another headline
+;;
+;; ---- end of base buffer ----
+;; ---- indirect buffer ----
+;; * Headline
+;; Some text hidden in the base buffer, but revealed in the indirect
+;; buffer.
+;; * Another headline
+;;
+;; ---- end of indirect buffer ----
+;; If we copy the text under "Headline" from the indirect buffer and
+;; insert it under "Another headline" in the base buffer, the inserted
+;; text will be hidden since it's folding text properties are copied.
+;; Basically, the copied text would have two sets of folding text
+;; properties: (1) Properties for base buffer telling that the text is
+;; hidden; (2) Properties for the indirect buffer telling that the
+;; text is visible.  The first set of the text properties in inactive
+;; in the indirect buffer, but will become active once we yank the
+;; text back into the base buffer.
+;;
+;; To avoid the above situation, we simply clear all the properties,
+;; unrealated to current buffer when a text is copied.
+;; FIXME: Ideally, we may want to carry the folding state of copied
+;; text between buffer (probably via user customization).
+(defun org-fold-core--buffer-substring-filter (beg end &optional delete)
+  "Clear folding state in killed text.
+This function is intended to be used as `filter-buffer-substring-function'.
+The arguments and return value are as specified for `filter-buffer-substring'."
+  (let ((return-string (buffer-substring--filter beg end delete))
+       ;; The list will be used as an argument to `remove-text-properties'.
+       props-list)
+    ;; There is no easy way to examine all the text properties of a
+    ;; string, so we utilize the fact that printed string
+    ;; representation lists all its properties.
+    ;; Loop over the elements of string representation.
+    (unless (or (string= "" return-string)
+                (<= end beg)
+                (eq org-fold-core-style 'overlays))
+      ;; Collect all the text properties the string is completely
+      ;; hidden with.
+      (dolist (spec (org-fold-core-folding-spec-list))
+        (when (and (org-fold-core-region-folded-p beg end spec)
+                   (org-region-invisible-p beg end))
+          (push (org-fold-core--property-symbol-get-create spec nil t) 
props-list)))
+      (dolist (plist
+               (if (fboundp 'object-intervals)
+                   (object-intervals return-string)
+                 ;; Backward compatibility with Emacs <28.
+                 ;; FIXME: Is there any better way to do it?
+                 ;; Yes, it is a hack.
+                 ;; The below gives us string representation as a list.
+                 ;; Note that we need to remove unreadable values, like 
markers (#<...>).
+                 (seq-partition
+                  (cdr (let ((data (read (replace-regexp-in-string
+                                          "^#(" "("
+                                          (replace-regexp-in-string
+                                           " #(" " ("
+                                           (replace-regexp-in-string
+                                            "#<[^>]+>" "dummy"
+                                            ;; Get text representation of the 
string object.
+                                            ;; Make sure to print everything 
(see `prin1' docstring).
+                                            ;; `prin1' is used to print "%S" 
format.
+                                            (let (print-level print-length)
+                                              (format "%S" 
return-string))))))))
+                         (if (listp data) data (list data))))
+                  3)))
+        (let* ((start (car plist))
+               (fin (cadr plist))
+               (plist (car (cddr plist))))
+          ;; Only lists contain text properties.
+          (when (listp plist)
+            ;; Collect all the relevant text properties.
+            (while plist
+              (let* ((prop (car plist))
+                     (prop-name (symbol-name prop)))
+                ;; Reveal hard-hidden text.  See
+                ;; `org-fold-core--optimise-for-huge-buffers'.
+                (when (and (eq prop 'invisible)
+                           (member (cadr plist) 
(org-fold-core-folding-spec-list)))
+                  (remove-text-properties start fin '(invisible t) 
return-string))
+                ;; We do not care about values now.
+                (setq plist (cddr plist))
+                (when (string-match-p org-fold-core--spec-property-prefix 
prop-name)
+                  ;; Leave folding specs from current buffer.  See
+                  ;; comments in `org-fold-core--property-symbol-get-create' to
+                  ;; understand why it works.
+                  (unless (member prop (cdr (assq 'invisible 
char-property-alias-alist)))
+                    (push prop props-list))))))))
+      (remove-text-properties 0 (length return-string) props-list 
return-string))
+    return-string))
+
+(defun org-fold-core-update-optimisation (beg end)
+  "Update huge buffer optimization between BEG and END.
+See `org-fold-core--optimise-for-huge-buffers'."
+  (when (and (memql 'grab-invisible org-fold-core--optimise-for-huge-buffers)
+             (eq org-fold-core-style 'text-properties))
+    (let ((pos beg))
+      (while (< pos end)
+        (when (and (org-fold-core-folded-p pos (caar org-fold-core--specs))
+                   (not (eq (caar org-fold-core--specs) (get-text-property pos 
'invisible))))
+          (put-text-property pos (org-fold-core-next-folding-state-change 
(caar org-fold-core--specs) pos end)
+                             'invisible (caar org-fold-core--specs)))
+        (setq pos (org-fold-core-next-folding-state-change (caar 
org-fold-core--specs) pos end))))))
+
+(defun org-fold-core-remove-optimisation (beg end)
+  "Remove huge buffer optimization between BEG and END.
+See `org-fold-core--optimise-for-huge-buffers'."
+  (when (and (memql 'grab-invisible org-fold-core--optimise-for-huge-buffers)
+             (eq org-fold-core-style 'text-properties))
+    (let ((pos beg))
+      (while (< pos end)
+        (if (and (org-fold-core-folded-p pos (caar org-fold-core--specs))
+                 (eq (caar org-fold-core--specs) (get-text-property pos 
'invisible)))
+            (remove-text-properties pos 
(org-fold-core-next-folding-state-change (caar org-fold-core--specs) pos end)
+                                    '(invisible t)))
+        (setq pos (org-fold-core-next-folding-state-change (caar 
org-fold-core--specs) pos end))))))
+
+(provide 'org-fold-core)
+
+;;; org-fold-core.el ends here
diff --git a/lisp/org/org-fold.el b/lisp/org/org-fold.el
new file mode 100644
index 0000000000..4d213e9648
--- /dev/null
+++ b/lisp/org/org-fold.el
@@ -0,0 +1,906 @@
+;;; org-fold.el --- Folding of Org entries -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020-2020 Free Software Foundation, Inc.
+;;
+;; Author: Ihor Radchenko <yantar92 at gmail dot com>
+;; Keywords: folding, invisible text
+;; URL: https://orgmode.org
+;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+
+;; This file contains code handling temporary invisibility (folding
+;; and unfolding) of text in org buffers.
+
+;; The folding is implemented using generic org-fold-core library.  This file
+;; contains org-specific implementation of the folding.  Also, various
+;; useful functions from org-fold-core are aliased under shorted `org-fold'
+;; prefix.
+
+;; The following features are implemented:
+;; - Folding/unfolding various Org mode elements and regions of Org buffers:
+;;   + Region before first heading;
+;;   + Org headings, their text, children (subtree), siblings, parents, etc;
+;;   + Org blocks and drawers
+;; - Revealing Org structure around invisible point location
+;; - Revealing folded Org elements broken by user edits
+
+;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'org-macs)
+(require 'org-fold-core)
+
+(defvar org-inlinetask-min-level)
+(defvar org-link--link-folding-spec)
+(defvar org-link--description-folding-spec)
+(defvar org-odd-levels-only)
+(defvar org-drawer-regexp)
+(defvar org-property-end-re)
+(defvar org-link-descriptive)
+(defvar org-outline-regexp-bol)
+(defvar org-archive-tag)
+(defvar org-custom-properties-overlays)
+(defvar org-element-headline-re)
+
+(declare-function isearch-filter-visible "isearch" (beg end))
+(declare-function org-element-type "org-element" (element))
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
+(declare-function org-element-property "org-element" (property element))
+(declare-function org-element--current-element "org-element" (limit &optional 
granularity mode structure))
+(declare-function org-element--cache-active-p "org-element" ())
+(declare-function org-toggle-custom-properties-visibility "org" ())
+(declare-function org-item-re "org-list" ())
+(declare-function org-up-heading-safe "org" ())
+(declare-function org-get-tags "org" (&optional pos local fontify))
+(declare-function org-get-valid-level "org" (level &optional change))
+(declare-function org-before-first-heading-p "org" ())
+(declare-function org-goto-sibling "org" (&optional previous))
+(declare-function org-block-map "org" (function &optional start end))
+(declare-function org-map-region "org" (fun beg end))
+(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
+(declare-function org-back-to-heading-or-point-min "org" (&optional 
invisible-ok))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-at-heading-p "org" (&optional invisible-not-ok))
+(declare-function org-cycle-hide-drawers "org-cycle" (state))
+
+(declare-function outline-show-branches "outline" ())
+(declare-function outline-hide-sublevels "outline" (levels))
+(declare-function outline-get-next-sibling "outline" ())
+(declare-function outline-invisible-p "outline" (&optional pos))
+(declare-function outline-next-heading "outline" ())
+
+;;; Customization
+
+(defgroup org-fold-reveal-location nil
+  "Options about how to make context of a location visible."
+  :tag "Org Reveal Location"
+  :group 'org-structure)
+
+(defcustom org-fold-show-context-detail '((agenda . local)
+                                 (bookmark-jump . lineage)
+                                 (isearch . lineage)
+                                 (default . ancestors))
+  "Alist between context and visibility span when revealing a location.
+
+\\<org-mode-map>Some actions may move point into invisible
+locations.  As a consequence, Org always exposes a neighborhood
+around point.  How much is shown depends on the initial action,
+or context.  Valid contexts are
+
+  agenda         when exposing an entry from the agenda
+  org-goto       when using the command `org-goto' (`\\[org-goto]')
+  occur-tree     when using the command `org-occur' (`\\[org-sparse-tree] /')
+  tags-tree      when constructing a sparse tree based on tags matches
+  link-search    when exposing search matches associated with a link
+  mark-goto      when exposing the jump goal of a mark
+  bookmark-jump  when exposing a bookmark location
+  isearch        when exiting from an incremental search
+  default        default for all contexts not set explicitly
+
+Allowed visibility spans are
+
+  minimal        show current headline; if point is not on headline,
+                 also show entry
+
+  local          show current headline, entry and next headline
+
+  ancestors      show current headline and its direct ancestors; if
+                 point is not on headline, also show entry
+
+  ancestors-full show current subtree and its direct ancestors
+
+  lineage        show current headline, its direct ancestors and all
+                 their children; if point is not on headline, also show
+                 entry and first child
+
+  tree           show current headline, its direct ancestors and all
+                 their children; if point is not on headline, also show
+                 entry and all children
+
+  canonical      show current headline, its direct ancestors along with
+                 their entries and children; if point is not located on
+                 the headline, also show current entry and all children
+
+As special cases, a nil or t value means show all contexts in
+`minimal' or `canonical' view, respectively.
+
+Some views can make displayed information very compact, but also
+make it harder to edit the location of the match.  In such
+a case, use the command `org-fold-reveal' (`\\[org-fold-reveal]') to show
+more context."
+  :group 'org-fold-reveal-location
+  :version "26.1"
+  :package-version '(Org . "9.0")
+  :type '(choice
+         (const :tag "Canonical" t)
+         (const :tag "Minimal" nil)
+         (repeat :greedy t :tag "Individual contexts"
+                 (cons
+                  (choice :tag "Context"
+                          (const agenda)
+                          (const org-goto)
+                          (const occur-tree)
+                          (const tags-tree)
+                          (const link-search)
+                          (const mark-goto)
+                          (const bookmark-jump)
+                          (const isearch)
+                          (const default))
+                  (choice :tag "Detail level"
+                          (const minimal)
+                          (const local)
+                          (const ancestors)
+                           (const ancestors-full)
+                          (const lineage)
+                          (const tree)
+                          (const canonical))))))
+
+(defvar org-fold-reveal-start-hook nil
+  "Hook run before revealing a location.")
+
+(defcustom org-fold-catch-invisible-edits 'smart
+  "Check if in invisible region before inserting or deleting a character.
+Valid values are:
+
+nil              Do not check, so just do invisible edits.
+error            Throw an error and do nothing.
+show             Make point visible, and do the requested edit.
+show-and-error   Make point visible, then throw an error and abort the edit.
+smart            Make point visible, and do insertion/deletion if it is
+                 adjacent to visible text and the change feels predictable.
+                 Never delete a previously invisible character or add in the
+                 middle or right after an invisible region.  Basically, this
+                 allows insertion and backward-delete right before ellipses.
+                 FIXME: maybe in this case we should not even show?"
+  :group 'org-edit-structure
+  :version "24.1"
+  :type '(choice
+         (const :tag "Do not check" nil)
+         (const :tag "Throw error when trying to edit" error)
+         (const :tag "Unhide, but do not do the edit" show-and-error)
+         (const :tag "Show invisible part and do the edit" show)
+         (const :tag "Be smart and do the right thing" smart)))
+
+;;; Core functionality
+
+;;; API
+
+;;;; Modifying folding specs
+
+(defalias 'org-fold-folding-spec-p #'org-fold-core-folding-spec-p)
+(defalias 'org-fold-add-folding-spec #'org-fold-core-add-folding-spec)
+(defalias 'org-fold-remove-folding-spec #'org-fold-core-remove-folding-spec)
+
+(defun org-fold-initialize (ellipsis)
+  "Setup folding in current Org buffer."
+  (setq-local org-fold-core-isearch-open-function #'org-fold--isearch-reveal)
+  (setq-local org-fold-core-extend-changed-region-functions (list 
#'org-fold--extend-changed-region))
+  ;; FIXME: Converting org-link + org-description to overlays when
+  ;; search matches hidden "[[" part of the link, reverses priority of
+  ;; link and description and hides the whole link.  Working around
+  ;; this until there will be no need to convert text properties to
+  ;; overlays for isearch.
+  (setq-local org-fold-core--isearch-special-specs '(org-link))
+  (org-fold-core-initialize
+   `((,(if (eq org-fold-core-style 'text-properties) 'org-fold-outline 
'outline)
+      (:ellipsis . ,ellipsis)
+      (:fragile . ,#'org-fold--reveal-outline-maybe)
+      (:isearch-open . t)
+      ;; This is needed to make sure that inserting a
+      ;; new planning line in folded heading is not
+      ;; revealed.  Also, the below combination of :front-sticky and
+      ;; :rear-sticky conforms to the overlay properties in outline.el
+      ;; and the older Org versions as in `outline-flag-region'.
+      (:front-sticky . t)
+      (:rear-sticky . nil)
+      (:alias . (headline heading outline inlinetask plain-list)))
+     (,(if (eq org-fold-core-style 'text-properties) 'org-fold-block 
'org-hide-block)
+      (:ellipsis . ,ellipsis)
+      (:fragile . ,#'org-fold--reveal-drawer-or-block-maybe)
+      (:isearch-open . t)
+      (:front-sticky . t)
+      (:alias . ( block center-block comment-block
+                  dynamic-block example-block export-block
+                  quote-block special-block src-block
+                  verse-block)))
+     (,(if (eq org-fold-core-style 'text-properties) 'org-fold-drawer 
'org-hide-drawer)
+      (:ellipsis . ,ellipsis)
+      (:fragile . ,#'org-fold--reveal-drawer-or-block-maybe)
+      (:isearch-open . t)
+      (:front-sticky . t)
+      (:alias . (drawer property-drawer)))
+     ,org-link--description-folding-spec
+     ,org-link--link-folding-spec)))
+
+;;;; Searching and examining folded text
+
+(defalias 'org-fold-folded-p #'org-fold-core-folded-p)
+(defalias 'org-fold-get-folding-spec #'org-fold-core-get-folding-spec)
+(defalias 'org-fold-get-folding-specs-in-region 
#'org-fold-core-get-folding-specs-in-region)
+(defalias 'org-fold-get-region-at-point #'org-fold-core-get-region-at-point)
+(defalias 'org-fold-get-regions #'org-fold-core-get-regions)
+(defalias 'org-fold-next-visibility-change 
#'org-fold-core-next-visibility-change)
+(defalias 'org-fold-previous-visibility-change 
#'org-fold-core-previous-visibility-change)
+(defalias 'org-fold-next-folding-state-change 
#'org-fold-core-next-folding-state-change)
+(defalias 'org-fold-previous-folding-state-change 
#'org-fold-core-previous-folding-state-change)
+(defalias 'org-fold-search-forward #'org-fold-core-search-forward)
+
+;;;;; Macros
+
+(defalias 'org-fold-save-outline-visibility #'org-fold-core-save-visibility)
+
+;;;; Changing visibility (regions, blocks, drawers, headlines)
+
+;;;;; Region visibility
+
+(defalias 'org-fold-region #'org-fold-core-region)
+(defalias 'org-fold-regions #'org-fold-core-regions)
+
+(defun org-fold-show-all (&optional types)
+  "Show all contents in the visible part of the buffer.
+By default, the function expands headings, blocks and drawers.
+When optional argument TYPES is a list of symbols among `blocks',
+`drawers' and `headings', to only expand one specific type."
+  (interactive)
+  (dolist (type (or types '(blocks drawers headings)))
+    (org-fold-region (point-min) (point-max) nil
+            (pcase type
+              (`blocks 'block)
+              (`drawers 'drawer)
+              (`headings 'headline)
+              (_ (error "Invalid type: %S" type))))))
+
+(defun org-fold-flag-above-first-heading (&optional arg)
+  "Hide from bob up to the first heading.
+Move point to the beginning of first heading or end of buffer."
+  (goto-char (point-min))
+  (unless (org-at-heading-p)
+    (outline-next-heading))
+  (unless (bobp)
+    (org-fold-region 1 (1- (point)) (not arg) 'outline)))
+
+;;;;; Heading visibility
+
+(defun org-fold-heading (flag &optional entry)
+  "Fold/unfold the current heading.  FLAG non-nil means make invisible.
+When ENTRY is non-nil, show the entire entry."
+  (save-excursion
+    (org-back-to-heading t)
+    ;; Check if we should show the entire entry
+    (if (not entry)
+       (org-fold-region
+        (line-end-position 0) (line-end-position) flag 'outline)
+      (org-fold-show-entry)
+      (save-excursion
+       ;; FIXME: potentially catches inlinetasks
+       (and (outline-next-heading)
+            (org-fold-heading nil))))))
+
+(defun org-fold-hide-entry ()
+  "Hide the body directly following this heading."
+  (interactive)
+  (save-excursion
+    (org-back-to-heading-or-point-min t)
+    (when (org-at-heading-p) (forward-line))
+    (unless (or (eobp) (org-at-heading-p)) ; Current headline is empty.
+      (org-fold-region
+       (line-end-position 0)
+       (save-excursion
+         (if (re-search-forward
+              (concat "[\r\n]" (org-get-limited-outline-regexp)) nil t)
+             (line-end-position 0)
+           (point-max)))
+       t
+       'outline))))
+
+(defun org-fold-subtree (flag)
+"Hide (when FLAG) or reveal subtree at point."
+  (save-excursion
+    (org-back-to-heading t)
+    (org-fold-region
+     (line-end-position)
+     (progn (org-end-of-subtree t t) (if (eobp) (point) (1- (point))))
+     flag
+     'outline)))
+
+;; Replaces `outline-hide-subtree'.
+(defun org-fold-hide-subtree ()
+  "Hide everything after this heading at deeper levels."
+  (interactive)
+  (org-fold-subtree t))
+
+;; Replaces `outline-hide-sublevels'
+(defun org-fold-hide-sublevels (levels)
+  "Hide everything but the top LEVELS levels of headers, in whole buffer.
+This also unhides the top heading-less body, if any.
+
+Interactively, the prefix argument supplies the value of LEVELS.
+When invoked without a prefix argument, LEVELS defaults to the level
+of the current heading, or to 1 if the current line is not a heading."
+  (interactive (list
+               (cond
+                (current-prefix-arg (prefix-numeric-value current-prefix-arg))
+                ((save-excursion (beginning-of-line)
+                                 (looking-at outline-regexp))
+                 (funcall outline-level))
+                (t 1))))
+  (if (< levels 1)
+      (error "Must keep at least one level of headers"))
+  (save-excursion
+    (let* ((beg (progn
+                  (goto-char (point-min))
+                  ;; Skip the prelude, if any.
+                  (unless (org-at-heading-p) (outline-next-heading))
+                  (point)))
+           (end (progn
+                  (goto-char (point-max))
+                  ;; Keep empty last line, if available.
+                  (max (point-min) (if (bolp) (1- (point)) (point))))))
+      (if (< end beg)
+         (setq beg (prog1 end (setq end beg))))
+      ;; First hide everything.
+      (org-fold-region beg end t 'headline)
+      ;; Then unhide the top level headers.
+      (org-map-region
+       (lambda ()
+        (when (<= (funcall outline-level) levels)
+           (org-fold-heading nil)))
+       beg end)
+      ;; Finally unhide any trailing newline.
+      (goto-char (point-max))
+      (if (and (bolp) (not (bobp)) (outline-invisible-p (1- (point))))
+          (org-fold-region (max (point-min) (1- (point))) (point) nil)))))
+
+(defun org-fold-show-entry (&optional hide-drawers)
+  "Show the body directly following its heading.
+Show the heading too, if it is currently invisible."
+  (interactive)
+  (save-excursion
+    (org-back-to-heading-or-point-min t)
+    (org-fold-region
+     (line-end-position 0)
+     (save-excursion
+       (if (re-search-forward
+            (concat "[\r\n]\\(" (org-get-limited-outline-regexp) "\\)") nil t)
+           (match-beginning 1)
+         (point-max)))
+     nil
+     'outline)
+    (when hide-drawers (org-cycle-hide-drawers 'children))))
+
+(defalias 'org-fold-show-hidden-entry #'org-fold-show-entry
+  "Show an entry where even the heading is hidden.")
+
+(defun org-fold-show-siblings ()
+  "Show all siblings of the current headline."
+  (save-excursion
+    (while (org-goto-sibling) (org-fold-heading nil)))
+  (save-excursion
+    (while (org-goto-sibling 'previous)
+      (org-fold-heading nil))))
+
+(defun org-fold-show-children (&optional level)
+  "Show all direct subheadings of this heading.
+Prefix arg LEVEL is how many levels below the current level
+should be shown.  Default is enough to cause the following
+heading to appear."
+  (interactive "p")
+  (unless (org-before-first-heading-p)
+    (save-excursion
+      (org-with-limited-levels (org-back-to-heading t))
+      (let* ((current-level (funcall outline-level))
+             (max-level (org-get-valid-level
+                         current-level
+                         (if level (prefix-numeric-value level) 1)))
+             (end (save-excursion (org-end-of-subtree t t)))
+             (regexp-fmt "^\\*\\{%d,%s\\}\\(?: \\|$\\)")
+             (past-first-child nil)
+             ;; Make sure to skip inlinetasks.
+             (re (format regexp-fmt
+                         current-level
+                         (cond
+                          ((not (featurep 'org-inlinetask)) "")
+                          (org-odd-levels-only (- (* 2 
org-inlinetask-min-level)
+                                                  3))
+                          (t (1- org-inlinetask-min-level))))))
+        ;; Display parent heading.
+        (org-fold-heading nil)
+        (forward-line)
+        ;; Display children.  First child may be deeper than expected
+        ;; MAX-LEVEL.  Since we want to display it anyway, adjust
+        ;; MAX-LEVEL accordingly.
+        (while (re-search-forward re end t)
+          (unless past-first-child
+            (setq re (format regexp-fmt
+                             current-level
+                             (max (funcall outline-level) max-level)))
+            (setq past-first-child t))
+          (org-fold-heading nil))))))
+
+(defun org-fold-show-subtree ()
+  "Show everything after this heading at deeper levels."
+  (interactive)
+  (org-fold-region
+   (point) (save-excursion (org-end-of-subtree t t)) nil 'outline))
+
+(defun org-fold-show-branches ()
+  "Show all subheadings of this heading, but not their bodies."
+  (interactive)
+  (org-fold-show-children 1000))
+
+(defun org-fold-show-branches-buffer ()
+  "Show all branches in the buffer."
+  (org-fold-flag-above-first-heading)
+  (org-fold-hide-sublevels 1)
+  (unless (eobp)
+    (org-fold-show-branches)
+    (while (outline-get-next-sibling)
+      (org-fold-show-branches)))
+  (goto-char (point-min)))
+
+;;;;; Blocks and drawers visibility
+
+(defun org-fold--hide-wrapper-toggle (element category force no-error)
+  "Toggle visibility for ELEMENT.
+
+ELEMENT is a block or drawer type parsed element.  CATEGORY is
+either `block' or `drawer'.  When FORCE is `off', show the block
+or drawer.  If it is non-nil, hide it unconditionally.  Throw an
+error when not at a block or drawer, unless NO-ERROR is non-nil.
+
+Return a non-nil value when toggling is successful."
+  (let ((type (org-element-type element)))
+    (cond
+     ((memq type
+            (pcase category
+              (`drawer '(drawer property-drawer))
+              (`block '(center-block
+                        comment-block dynamic-block example-block export-block
+                        quote-block special-block src-block verse-block))
+              (_ (error "Unknown category: %S" category))))
+      (let* ((post (org-element-property :post-affiliated element))
+             (start (save-excursion
+                      (goto-char post)
+                      (line-end-position)))
+             (end (save-excursion
+                    (goto-char (org-element-property :end element))
+                    (skip-chars-backward " \t\n")
+                    (line-end-position))))
+        ;; Do nothing when not before or at the block opening line or
+        ;; at the block closing line.
+        (unless (let ((eol (line-end-position)))
+                  (and (> eol start) (/= eol end)))
+          (org-fold-region start end
+                   (cond ((eq force 'off) nil)
+                         (force t)
+                         ((org-fold-folded-p start category) nil)
+                         (t t))
+                   category)
+          ;; When the block is hidden away, make sure point is left in
+          ;; a visible part of the buffer.
+          (when (invisible-p (max (1- (point)) (point-min)))
+            (goto-char post))
+          ;; Signal success.
+          t)))
+     (no-error nil)
+     (t
+      (user-error (format "%s@%s: %s"
+                          (buffer-file-name (buffer-base-buffer))
+                          (point)
+                          (if (eq category 'drawer)
+                             "Not at a drawer"
+                           "Not at a block")))))))
+
+(defun org-fold-hide-block-toggle (&optional force no-error element)
+  "Toggle the visibility of the current block.
+
+When optional argument FORCE is `off', make block visible.  If it
+is non-nil, hide it unconditionally.  Throw an error when not at
+a block, unless NO-ERROR is non-nil.  When optional argument
+ELEMENT is provided, consider it instead of the current block.
+
+Return a non-nil value when toggling is successful."
+  (interactive)
+  (org-fold--hide-wrapper-toggle
+   (or element (org-element-at-point)) 'block force no-error))
+
+(defun org-fold-hide-drawer-toggle (&optional force no-error element)
+  "Toggle the visibility of the current drawer.
+
+When optional argument FORCE is `off', make drawer visible.  If
+it is non-nil, hide it unconditionally.  Throw an error when not
+at a drawer, unless NO-ERROR is non-nil.  When optional argument
+ELEMENT is provided, consider it instead of the current drawer.
+
+Return a non-nil value when toggling is successful."
+  (interactive)
+  (org-fold--hide-wrapper-toggle
+   (or element (org-element-at-point)) 'drawer force no-error))
+
+(defun org-fold-hide-block-all ()
+  "Fold all blocks in the current buffer."
+  (interactive)
+  (org-block-map (apply-partially #'org-fold-hide-block-toggle 'hide)))
+
+(defun org-fold-hide-drawer-all ()
+  "Fold all drawers in the current buffer."
+  (let ((begin (point-min))
+        (end (point-max)))
+    (org-fold--hide-drawers begin end)))
+
+(defun org-fold--hide-drawers (begin end)
+  "Hide all drawers between BEGIN and END."
+  (save-excursion
+    (goto-char begin)
+    (while (and (< (point) end)
+                (re-search-forward org-drawer-regexp end t))
+      ;; Skip folded drawers
+      (if (org-fold-folded-p nil 'drawer)
+          (goto-char (org-fold-next-folding-state-change 'drawer nil end))
+        (let* ((drawer (org-element-at-point))
+               (type (org-element-type drawer)))
+          (when (memq type '(drawer property-drawer))
+            (org-fold-hide-drawer-toggle t nil drawer)
+            ;; Make sure to skip drawer entirely or we might flag it
+            ;; another time when matching its ending line with
+            ;; `org-drawer-regexp'.
+            (goto-char (org-element-property :end drawer))))))))
+
+(defun org-fold-hide-archived-subtrees (beg end)
+  "Re-hide all archived subtrees after a visibility state change."
+  (org-with-wide-buffer
+   (let ((case-fold-search nil)
+        (re (concat org-outline-regexp-bol ".*:" org-archive-tag ":")))
+     (goto-char beg)
+     ;; Include headline point is currently on.
+     (beginning-of-line)
+     (while (and (< (point) end) (re-search-forward re end t))
+       (when (member org-archive-tag (org-get-tags nil t))
+        (org-fold-subtree t)
+        (org-end-of-subtree t))))))
+
+;;;;; Reveal point location
+
+(defun org-fold-show-context (&optional key)
+  "Make sure point and context are visible.
+Optional argument KEY, when non-nil, is a symbol.  See
+`org-fold-show-context-detail' for allowed values and how much is to
+be shown."
+  (org-fold-show-set-visibility
+   (cond ((symbolp org-fold-show-context-detail) org-fold-show-context-detail)
+        ((cdr (assq key org-fold-show-context-detail)))
+        (t (cdr (assq 'default org-fold-show-context-detail))))))
+
+
+(defvar org-hide-emphasis-markers); Defined in org.el
+(defvar org-pretty-entities); Defined in org.el
+(defun org-fold-show-set-visibility (detail)
+  "Set visibility around point according to DETAIL.
+DETAIL is either nil, `minimal', `local', `ancestors',
+`ancestors-full', `lineage', `tree', `canonical' or t.  See
+`org-show-context-detail' for more information."
+  ;; Show current heading and possibly its entry, following headline
+  ;; or all children.
+  (if (and (org-at-heading-p) (not (eq detail 'local)))
+      (org-fold-heading nil)
+    (org-fold-show-entry)
+    ;; If point is hidden make sure to expose it.
+    (when (org-invisible-p)
+      ;; FIXME: No clue why, but otherwise the following might not work.
+      (redisplay)
+      (let ((region (org-fold-get-region-at-point)))
+        ;; Reveal emphasis markers.
+        (when (eq detail 'local)
+          (let (org-hide-emphasis-markers
+                org-link-descriptive
+                org-pretty-entities
+                (org-hide-macro-markers nil)
+                (region (or (org-find-text-property-region (point) 
'org-emphasis)
+                            (org-find-text-property-region (point) 'org-macro)
+                            (org-find-text-property-region (point) 'invisible)
+                            region)))
+            ;; Silence byte-compiler.
+            (ignore org-hide-macro-markers)
+            (when region
+              (org-with-point-at (car region)
+                (beginning-of-line)
+                (let (font-lock-extend-region-functions)
+                  (font-lock-fontify-region (max (point-min) (1- (car 
region))) (cdr region))))))
+          ;; Unfold links.
+          (when region
+            (dolist (spec '(org-link org-link-description))
+              (org-fold-region (car region) (cdr region) nil spec))))
+        (when region
+          (dolist (spec (org-fold-core-folding-spec-list))
+            ;; Links are taken care by above.
+            (unless (memq spec '(org-link org-link-description))
+              (org-fold-region (car region) (cdr region) nil spec))))))
+    (unless (org-before-first-heading-p)
+      (org-with-limited-levels
+       (cl-case detail
+        ((tree canonical t) (org-fold-show-children))
+        ((nil minimal ancestors ancestors-full))
+        (t (save-excursion
+             (outline-next-heading)
+             (org-fold-heading nil)))))))
+  ;; Show whole subtree.
+  (when (eq detail 'ancestors-full) (org-fold-show-subtree))
+  ;; Show all siblings.
+  (when (eq detail 'lineage) (org-fold-show-siblings))
+  ;; Show ancestors, possibly with their children.
+  (when (memq detail '(ancestors ancestors-full lineage tree canonical t))
+    (save-excursion
+      (while (org-up-heading-safe)
+       (org-fold-heading nil)
+       (when (memq detail '(canonical t)) (org-fold-show-entry))
+       (when (memq detail '(tree canonical t)) (org-fold-show-children))))))
+
+(defun org-fold-reveal (&optional siblings)
+  "Show current entry, hierarchy above it, and the following headline.
+
+This can be used to show a consistent set of context around
+locations exposed with `org-fold-show-context'.
+
+With optional argument SIBLINGS, on each level of the hierarchy all
+siblings are shown.  This repairs the tree structure to what it would
+look like when opened with hierarchical calls to `org-cycle'.
+
+With a \\[universal-argument] \\[universal-argument] prefix, \
+go to the parent and show the entire tree."
+  (interactive "P")
+  (run-hooks 'org-fold-reveal-start-hook)
+  (cond ((equal siblings '(4)) (org-fold-show-set-visibility 'canonical))
+       ((equal siblings '(16))
+        (save-excursion
+          (when (org-up-heading-safe)
+            (org-fold-show-subtree)
+            (run-hook-with-args 'org-cycle-hook 'subtree))))
+       (t (org-fold-show-set-visibility 'lineage))))
+
+;;; Make isearch search in some text hidden via text properties.
+
+(defun org-fold--isearch-reveal (&rest _)
+  "Reveal text at POS found by isearch."
+  (org-fold-show-context 'isearch))
+
+;;; Handling changes in folded elements
+
+(defun org-fold--extend-changed-region (from to)
+  "Consider folded regions in the next/previous line when fixing
+region visibility.
+This function is intended to be used as a member of
+`org-fold-core-extend-changed-region-functions'."
+  ;; If the edit is done in the first line of a folded drawer/block,
+  ;; the folded text is only starting from the next line and needs to
+  ;; be checked.
+  (setq to (save-excursion (goto-char to) (line-beginning-position 2)))
+  ;; If the ":END:" line of the drawer is deleted, the folded text is
+  ;; only ending at the previous line and needs to be checked.
+  (setq from (save-excursion (goto-char from) (line-beginning-position 0)))
+  (cons from to))
+
+(defun org-fold--reveal-headline-at-point ()
+  "Reveal header line and empty contents inside.
+Reveal the header line and, if present, also reveal its contents, when
+the contents consists of blank lines.
+
+Assume that point is located at the header line."
+  (org-with-wide-buffer
+   (beginning-of-line)
+   (org-fold-region
+    (max (point-min) (1- (point)))
+    (let ((endl (line-end-position)))
+      (save-excursion
+        (goto-char endl)
+        (skip-chars-forward "\n\t\r ")
+        ;; Unfold blank lines after newly inserted headline.
+        (if (equal (point)
+                   (save-excursion
+                     (goto-char endl)
+                     (org-end-of-subtree)
+                     (skip-chars-forward "\n\t\r ")))
+            (point)
+          endl)))
+    nil 'headline)))
+
+(defun org-fold--reveal-outline-maybe (region _)
+  "Reveal folded outline in REGION when needed.
+
+This function is intended to be used as :fragile property of
+`org-fold-outline' spec.  See `org-fold-core--specs' for details."
+  (save-match-data
+    (org-with-wide-buffer
+     (goto-char (car region))
+     ;; The line before beginning of the fold should be either a
+     ;; headline or a list item.
+     (backward-char)
+     (beginning-of-line)
+     ;; Make sure that headline is not partially hidden.
+     (unless (org-fold-folded-p nil 'headline)
+       (org-fold--reveal-headline-at-point))
+     ;; Never hide level 1 headlines
+     (save-excursion
+       (goto-char (line-end-position))
+       (unless (>= (point) (cdr region))
+         (when (re-search-forward (rx bol "* ") (cdr region) t)
+           (org-fold--reveal-headline-at-point))))
+     ;; Make sure that headline after is not partially hidden.
+     (goto-char (cdr region))
+     (beginning-of-line)
+     (unless (org-fold-folded-p nil 'headline)
+       (when (looking-at-p org-element-headline-re)
+         (org-fold--reveal-headline-at-point)))
+     ;; Check the validity of headline
+     (goto-char (car region))
+     (backward-char)
+     (beginning-of-line)
+     (unless (let ((case-fold-search t))
+              (looking-at (rx-to-string
+                            `(or (regex ,(org-item-re))
+                                (regex ,org-outline-regexp-bol)))))
+       t))))
+
+(defun org-fold--reveal-drawer-or-block-maybe (region spec)
+  "Reveal folded drawer/block (according to SPEC) in REGION when needed.
+
+This function is intended to be used as :fragile property of
+`org-fold-drawer' or `org-fold-block' spec."
+  (let ((begin-re (cond
+                  ((eq spec (org-fold-core-get-folding-spec-from-alias 
'drawer))
+                   org-drawer-regexp)
+                  ;; Group one below contains the type of the block.
+                  ((eq spec (org-fold-core-get-folding-spec-from-alias 'block))
+                   (rx bol (zero-or-more (any " " "\t"))
+                       "#+begin"
+                       (or ":"
+                           (seq "_"
+                                (group (one-or-more (not (syntax 
whitespace))))))))))
+        ;; To be determined later. May depend on `begin-re' match (i.e. for 
blocks).
+        end-re)
+    (save-match-data ; we should not clobber match-data in 
after-change-functions
+      (let ((fold-begin (car region))
+           (fold-end (cdr region)))
+       (let (unfold?)
+         (catch :exit
+           ;; The line before folded text should be beginning of
+           ;; the drawer/block.
+           (save-excursion
+             (goto-char fold-begin)
+             ;; The line before beginning of the fold should be the
+             ;; first line of the drawer/block.
+             (backward-char)
+             (beginning-of-line)
+             (unless (let ((case-fold-search t))
+                       (looking-at begin-re)) ; the match-data will be used 
later
+               (throw :exit (setq unfold? t))))
+            ;; Set `end-re' for the current drawer/block.
+            (setq end-re
+                 (cond
+                  ((eq spec (org-fold-core-get-folding-spec-from-alias 
'drawer))
+                    org-property-end-re)
+                  ((eq spec (org-fold-core-get-folding-spec-from-alias 'block))
+                   (let ((block-type (match-string 1))) ; the last match is 
from `begin-re'
+                     (concat (rx bol (zero-or-more (any " " "\t")) "#+end")
+                             (if block-type
+                                 (concat "_"
+                                         (regexp-quote block-type)
+                                         (rx (zero-or-more (any " " "\t")) 
eol))
+                               (rx (opt ":") (zero-or-more (any " " "\t")) 
eol)))))))
+           ;; The last line of the folded text should match `end-re'.
+           (save-excursion
+             (goto-char fold-end)
+             (beginning-of-line)
+             (unless (let ((case-fold-search t))
+                       (looking-at end-re))
+               (throw :exit (setq unfold? t))))
+           ;; There should be no `end-re' or
+           ;; `org-outline-regexp-bol' anywhere in the
+           ;; drawer/block body.
+           (save-excursion
+             (goto-char fold-begin)
+             (when (save-excursion
+                     (let ((case-fold-search t))
+                       (re-search-forward (rx-to-string `(or (regex ,end-re)
+                                                             (regex 
,org-outline-regexp-bol)))
+                                          (max (point)
+                                               (1- (save-excursion
+                                                     (goto-char fold-end)
+                                                     
(line-beginning-position))))
+                                          t)))
+               (throw :exit (setq unfold? t)))))
+          unfold?)))))
+
+;; Catching user edits inside invisible text
+(defun org-fold-check-before-invisible-edit (kind)
+  "Check if editing KIND is dangerous with invisible text around.
+The detailed reaction depends on the user option
+`org-fold-catch-invisible-edits'."
+  ;; First, try to get out of here as quickly as possible, to reduce overhead
+  (when (and org-fold-catch-invisible-edits
+            (or (not (boundp 'visible-mode)) (not visible-mode))
+            (or (org-invisible-p)
+                (org-invisible-p (max (point-min) (1- (point))))))
+    ;; OK, we need to take a closer look.  Only consider invisibility
+    ;; caused by folding of headlines, drawers, and blocks.  Edits
+    ;; inside links will be handled by font-lock.
+    (let* ((invisible-at-point (org-fold-folded-p (point) '(headline drawer 
block)))
+          (invisible-before-point
+           (and (not (bobp))
+                (org-fold-folded-p (1- (point)) '(headline drawer block))))
+          (border-and-ok-direction
+           (or
+            ;; Check if we are acting predictably before invisible
+            ;; text.
+            (and invisible-at-point (not invisible-before-point)
+                 (memq kind '(insert delete-backward)))
+             ;; Check if we are acting predictably after invisible text
+             ;; This works not well, and I have turned it off.  It seems
+             ;; better to always show and stop after invisible text.
+             ;; (and (not invisible-at-point) invisible-before-point
+             ;;  (memq kind '(insert delete)))
+             )))
+      (when (or invisible-at-point invisible-before-point)
+       (when (eq org-fold-catch-invisible-edits 'error)
+         (user-error "Editing in invisible areas is prohibited, make them 
visible first"))
+       (if (and org-custom-properties-overlays
+                (y-or-n-p "Display invisible properties in this buffer? "))
+           (org-toggle-custom-properties-visibility)
+         ;; Make the area visible
+          (save-excursion
+           (org-fold-show-set-visibility 'local))
+          (when invisible-before-point
+            (org-with-point-at (1- (point)) (org-fold-show-set-visibility 
'local)))
+         (cond
+          ((eq org-fold-catch-invisible-edits 'show)
+           ;; That's it, we do the edit after showing
+           (message
+            "Unfolding invisible region around point before editing")
+           (sit-for 1))
+          ((and (eq org-fold-catch-invisible-edits 'smart)
+                border-and-ok-direction)
+           (message "Unfolding invisible region around point before editing"))
+          (t
+           ;; Don't do the edit, make the user repeat it in full visibility
+           (user-error "Edit in invisible region aborted, repeat to confirm 
with text visible"))))))))
+
+(provide 'org-fold)
+
+;;; org-fold.el ends here
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el
index 112d6504fe..ac78360aef 100644
--- a/lisp/org/org-footnote.el
+++ b/lisp/org/org-footnote.el
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -28,6 +28,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 ;;;; Declarations
 
 (require 'cl-lib)
@@ -39,7 +42,7 @@
 (declare-function org-back-over-empty-lines "org" ())
 (declare-function org-end-of-meta-data "org" (&optional full))
 (declare-function org-edit-footnote-reference "org-src" ())
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-class "org-element" (datum &optional parent))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-lineage "org-element" (blob &optional types 
with-self))
@@ -52,7 +55,7 @@
 (declare-function org-inside-LaTeX-fragment-p "org" ())
 (declare-function org-inside-latex-macro-p "org" ())
 (declare-function org-mark-ring-push "org" (&optional pos buffer))
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-fold-show-context "org-fold" (&optional key))
 (declare-function outline-next-heading "outline")
 
 (defvar electric-indent-mode)
@@ -91,13 +94,13 @@ Match group 1 contains definition's label.")
 (defcustom org-footnote-section "Footnotes"
   "Outline heading containing footnote definitions.
 
-This can be nil, to place footnotes locally at the end of the
-current outline node.  If can also be the name of a special
-outline heading under which footnotes should be put.
+This can be nil, to place footnotes locally at the end of the current
+outline node.  It can also be a string representing the name of a
+special outline heading under which footnotes should be put.
 
 This variable defines the place where Org puts the definition
 automatically, i.e. when creating the footnote, and when sorting
-the notes.  However, by hand you may place definitions
+the notes.  However, by hand, you may place definitions
 *anywhere*.
 
 If this is a string, during export, all subtrees starting with
@@ -110,7 +113,7 @@ you will need to run the following command after the change:
   :group 'org-footnote
   :initialize 'custom-initialize-default
   :set (lambda (var val)
-        (set var val)
+        (set-default-toplevel-value var val)
         (when (fboundp 'org-element-cache-reset)
           (org-element-cache-reset 'all)))
   :type '(choice
@@ -555,7 +558,7 @@ value if point was successfully moved."
     (goto-char def-start)
     (looking-at (format "\\[fn:%s[]:]" (regexp-quote label)))
     (goto-char (match-end 0))
-    (org-show-context 'link-search)
+    (org-fold-show-context 'link-search)
     (when (derived-mode-p 'org-mode)
       (message "%s" (substitute-command-keys
                     "Edit definition and go back with \
@@ -581,7 +584,7 @@ value if point was successfully moved."
           (user-error "Reference is outside narrowed part of buffer")))
     (org-mark-ring-push)
     (goto-char start)
-    (org-show-context 'link-search)))
+    (org-fold-show-context 'link-search)))
 
 
 ;;;; Getters
@@ -848,9 +851,12 @@ to `org-footnote-section'.  Inline definitions are 
ignored."
                            (format "[fn:%s] DEFINITION NOT FOUND." label))
                        "\n"))))
          ;; Insert un-referenced footnote definitions at the end.
-         (pcase-dolist (`(,label . ,definition) definitions)
-           (unless (member label inserted)
-             (insert "\n" definition "\n")))))))))
+          ;; Combine all insertions into one to create a single cache
+          ;; update call.
+          (combine-change-calls (point) (point)
+           (pcase-dolist (`(,label . ,definition) definitions)
+             (unless (member label inserted)
+               (insert "\n" definition "\n"))))))))))
 
 (defun org-footnote-normalize ()
   "Turn every footnote in buffer into a numbered one."
diff --git a/lisp/org/org-goto.el b/lisp/org/org-goto.el
index 860b0a3de4..6801303840 100644
--- a/lisp/org/org-goto.el
+++ b/lisp/org/org-goto.el
@@ -22,6 +22,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org)
 (require 'org-refile)
 
@@ -110,10 +113,8 @@ When nil, you can use these keybindings to navigate the 
buffer:
          (org-defkey map [(down)] 'outline-next-visible-heading)
          (org-defkey map [(up)] 'outline-previous-visible-heading)
          (if org-goto-auto-isearch
-             (if (fboundp 'define-key-after)
-                 (define-key-after map [t] 'org-goto-local-auto-isearch)
-               nil)
-           (org-defkey map "q" 'org-goto-quit)
+              (define-key-after map [t] 'org-goto-local-auto-isearch)
+            (org-defkey map "q" 'org-goto-quit)
            (org-defkey map "n" 'outline-next-visible-heading)
            (org-defkey map "p" 'outline-previous-visible-heading)
            (org-defkey map "f" 'outline-forward-same-level)
@@ -157,7 +158,7 @@ When nil, you can use these keybindings to navigate the 
buffer:
     (when (eq (lookup-key isearch-mode-map keys) 'isearch-printing-char)
       (isearch-mode t)
       (isearch-process-search-char (string-to-char keys))
-      (org-font-lock-ensure))))
+      (font-lock-ensure))))
 
 (defun org-goto-ret (&optional _arg)
   "Finish `org-goto' by going to the new location."
@@ -222,13 +223,13 @@ position or nil."
                                    "  Just type for auto-isearch."
                                  "  n/p/f/b/u to navigate, q to quit.")))))
        (org-fit-window-to-buffer (get-buffer-window "*Org Help*"))
-       (org-overview)
+       (org-cycle-overview)
        (setq buffer-read-only t)
        (if (and (boundp 'org-goto-start-pos)
                 (integer-or-marker-p org-goto-start-pos))
            (progn (goto-char org-goto-start-pos)
                   (when (org-invisible-p)
-                    (org-show-set-visibility 'lineage)))
+                    (org-fold-show-set-visibility 'lineage)))
          (goto-char (point-min)))
        (let (org-special-ctrl-a/e) (org-beginning-of-line))
        (message "Select location and press RET")
@@ -279,7 +280,7 @@ With a prefix argument, use the alternative interface: 
e.g., if
          (org-mark-ring-push org-goto-start-pos)
          (goto-char selected-point)
          (when (or (org-invisible-p) (org-invisible-p2))
-           (org-show-context 'org-goto)))
+           (org-fold-show-context 'org-goto)))
       (message "Quit"))))
 
 (provide 'org-goto)
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el
index 3bf4307f4a..677b7adb6f 100644
--- a/lisp/org/org-habit.el
+++ b/lisp/org/org-habit.el
@@ -4,7 +4,7 @@
 
 ;; Author: John Wiegley <johnw at gnu dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -28,6 +28,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org)
 (require 'org-agenda)
@@ -423,8 +426,7 @@ current time."
   "Insert consistency graph for any habitual tasks."
   (let ((inhibit-read-only t)
        (buffer-invisibility-spec '(org-link))
-       (moment (org-time-subtract nil
-                                  (* 3600 org-extend-today-until))))
+       (moment (time-subtract nil (* 3600 org-extend-today-until))))
     (save-excursion
       (goto-char (if line (line-beginning-position) (point-min)))
       (while (not (eobp))
diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el
index 2fb299d5e8..8cb5666a29 100644
--- a/lisp/org/org-id.el
+++ b/lisp/org/org-id.el
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -70,12 +70,17 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org)
 (require 'org-refile)
 (require 'ol)
 
 (declare-function message-make-fqdn "message" ())
 (declare-function org-goto-location "org-goto" (&optional _buf help))
+;; Declared inside `org-element-with-disabled-cache' macro.
+(declare-function org-element--cache-active-p "org-element.el" (&optional 
called-from-cache-change-func-p))
 
 ;;; Customization
 
@@ -330,7 +335,7 @@ Move the cursor to that entry in that buffer."
     (pop-to-buffer-same-window (marker-buffer m))
     (goto-char m)
     (move-marker m nil)
-    (org-show-context)))
+    (org-fold-show-context)))
 
 ;;;###autoload
 (defun org-id-find (id &optional markerp)
@@ -488,8 +493,8 @@ and TIME is a Lisp time value (HI LO USEC)."
 (defun org-id-update-id-locations (&optional files silent)
   "Scan relevant files for IDs.
 Store the relation between files and corresponding IDs.
-This will scan all agenda files, all associated archives, and all
-files currently mentioned in `org-id-locations'.
+This will scan all agenda files, all associated archives, all open Org
+files, and all files currently mentioned in `org-id-locations'.
 When FILES is given, scan also these files.
 If SILENT is non-nil, messages are suppressed."
   (interactive)
@@ -512,6 +517,8 @@ If SILENT is non-nil, messages are suppressed."
                       org-id-extra-files)
                     ;; All files known to have IDs.
                     org-id-files
+                     ;; All Org files open in Emacs.
+                     (mapcar #'buffer-file-name (org-buffer-list 'files t))
                     ;; Additional files from function call.
                     files)))))
          (nfiles (length files))
@@ -521,30 +528,31 @@ If SILENT is non-nil, messages are suppressed."
          (ndup 0)
          (i 0))
     (with-temp-buffer
-      (delay-mode-hooks
-       (org-mode)
-       (dolist (file files)
-         (when (file-exists-p file)
-            (unless silent
-              (cl-incf i)
-              (message "Finding ID locations (%d/%d files): %s" i nfiles file))
-           (insert-file-contents file nil nil nil 'replace)
-            (let ((ids nil)
-                 (case-fold-search t))
-              (org-with-point-at 1
-               (while (re-search-forward id-regexp nil t)
-                 (when (org-at-property-p)
-                    (push (org-entry-get (point) "ID") ids)))
-               (when ids
-                 (push (cons (abbreviate-file-name file) ids)
-                       org-id-locations)
-                 (dolist (id ids)
-                    (cond
-                     ((not (member id seen-ids)) (push id seen-ids))
-                     (silent nil)
-                     (t
-                      (message "Duplicate ID %S" id)
-                      (cl-incf ndup)))))))))))
+      (org-element-with-disabled-cache
+        (delay-mode-hooks
+         (org-mode)
+         (dolist (file files)
+           (when (file-exists-p file)
+              (unless silent
+                (cl-incf i)
+                (message "Finding ID locations (%d/%d files): %s" i nfiles 
file))
+             (insert-file-contents file nil nil nil 'replace)
+              (let ((ids nil)
+                   (case-fold-search t))
+                (org-with-point-at 1
+                 (while (re-search-forward id-regexp nil t)
+                   (when (org-at-property-p)
+                      (push (org-entry-get (point) "ID") ids)))
+                 (when ids
+                   (push (cons (abbreviate-file-name file) ids)
+                         org-id-locations)
+                   (dolist (id ids)
+                      (cond
+                       ((not (member id seen-ids)) (push id seen-ids))
+                       (silent nil)
+                       (t
+                        (message "Duplicate ID %S" id)
+                        (cl-incf ndup))))))))))))
     (setq org-id-files (mapcar #'car org-id-locations))
     (org-id-locations-save)
     ;; Now convert to a hash table.
@@ -741,7 +749,7 @@ or filename if no title."
        (funcall cmd (marker-buffer m)))
     (goto-char m)
     (move-marker m nil)
-    (org-show-context)))
+    (org-fold-show-context)))
 
 (org-link-set-parameters "id" :follow #'org-id-open)
 
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el
index fd19b14db6..de237415cc 100644
--- a/lisp/org/org-indent.el
+++ b/lisp/org/org-indent.el
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -36,6 +36,9 @@
 ;;
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org-macs)
 (require 'org-compat)
 (require 'org)
@@ -330,7 +333,7 @@ stopped."
      (let* ((case-fold-search t)
            (limited-re (org-get-limited-outline-regexp))
            (level (or (org-current-level) 0))
-           (time-limit (and delay (org-time-add nil delay))))
+           (time-limit (and delay (time-add nil delay))))
        ;; For each line, set `line-prefix' and `wrap-prefix'
        ;; properties depending on the type of line (headline, inline
        ;; task, item or other).
@@ -343,7 +346,7 @@ stopped."
            ;; In asynchronous mode, take a break of
            ;; `org-indent-agent-resume-delay' every DELAY to avoid
            ;; blocking any other idle timer or process output.
-           ((and delay (org-time-less-p time-limit nil))
+           ((and delay (time-less-p time-limit nil))
             (setq org-indent-agent-resume-timer
                   (run-with-idle-timer
                    (time-add (current-idle-time) org-indent-agent-resume-delay)
@@ -409,7 +412,13 @@ This function is meant to be called by 
`after-change-functions'."
                 (goto-char beg)
                 (beginning-of-line)
                 (re-search-forward
-                 (org-with-limited-levels org-outline-regexp-bol) end t)))
+                 (org-with-limited-levels org-outline-regexp-bol)
+                  (save-excursion
+                    (goto-char end)
+                    ;; Extend to headline if END is within its
+                    ;; headline stars.
+                    (line-end-position))
+                  t)))
           (let ((end (save-excursion
                        (goto-char end)
                        (org-with-limited-levels (outline-next-heading))
diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el
index 2cbbf7f7ac..1c4124d4c7 100644
--- a/lisp/org/org-inlinetask.el
+++ b/lisp/org/org-inlinetask.el
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -78,6 +78,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org)
 
 (defgroup org-inlinetask nil
@@ -305,8 +308,10 @@ If the task has an end part, also demote it."
       (add-text-properties (match-beginning 3) (match-end 3)
                           '(face org-inlinetask font-lock-fontified t)))))
 
-(defun org-inlinetask-toggle-visibility ()
-  "Toggle visibility of inline task at point."
+(defun org-inlinetask-toggle-visibility (&optional state)
+  "Toggle visibility of inline task at point.
+When optional argument STATE is `fold', fold unconditionally.
+When STATE is `unfold', unfold unconditionally."
   (let ((end (save-excursion
               (org-inlinetask-goto-end)
               (if (bolp) (1- (point)) (point))))
@@ -317,9 +322,11 @@ If the task has an end part, also demote it."
      ;; Nothing to show/hide.
      ((= end start))
      ;; Inlinetask was folded: expand it.
-     ((eq (get-char-property (1+ start) 'invisible) 'outline)
-      (org-flag-region start end nil 'outline))
-     (t (org-flag-region start end t 'outline)))))
+     ((and (not (eq state 'fold))
+           (or (eq state 'unfold)
+               (org-fold-get-folding-spec 'headline (1+ start))))
+      (org-fold-region start end nil 'headline))
+     (t (org-fold-region start end t 'headline)))))
 
 (defun org-inlinetask-hide-tasks (state)
   "Hide inline tasks in buffer when STATE is `contents' or `children'.
@@ -330,14 +337,14 @@ This function is meant to be used in `org-cycle-hook'."
        (save-excursion
         (goto-char (point-min))
         (while (re-search-forward regexp nil t)
-          (org-inlinetask-toggle-visibility)
+          (org-inlinetask-toggle-visibility 'fold)
           (org-inlinetask-goto-end)))))
     (`children
      (save-excursion
        (while
           (or (org-inlinetask-at-task-p)
               (and (outline-next-heading) (org-inlinetask-at-task-p)))
-        (org-inlinetask-toggle-visibility)
+        (org-inlinetask-toggle-visibility 'fold)
         (org-inlinetask-goto-end))))))
 
 (defun org-inlinetask-remove-END-maybe ()
diff --git a/lisp/org/org-install.el b/lisp/org/org-install.el
deleted file mode 100644
index d521d819db..0000000000
--- a/lisp/org/org-install.el
+++ /dev/null
@@ -1,17 +0,0 @@
-;;; org-install.el --- backward compatibility file for obsolete configuration  
-*- lexical-binding: t -*-
-;;
-;;; Code:
-;;
-;; The file org-install is obsolete.
-;;
-;; It is provided here so that (require 'org-install) does not
-;; trigger an error for users with obsolete Emacs configuration.
-;; You can safely remove (require 'org-install) from your config."
-
-(provide 'org-install)
-
-;; Local Variables:
-;; no-byte-compile: t
-;; coding: utf-8
-;; End:
-;;; org-install.el ends here
diff --git a/lisp/org/org-keys.el b/lisp/org/org-keys.el
index b3ba5dc85b..95f64a3f9e 100644
--- a/lisp/org/org-keys.el
+++ b/lisp/org/org-keys.el
@@ -27,6 +27,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 
 (defvar org-outline-regexp)
@@ -67,8 +70,8 @@
 (declare-function org-ctrl-c-tab "org" (&optional arg))
 (declare-function org-cut-special "org" ())
 (declare-function org-cut-subtree "org" (&optional n))
-(declare-function org-cycle "org" (&optional arg))
-(declare-function org-cycle-agenda-files "org" ())
+(declare-function org-cycle "org-cycle" (&optional arg))
+(declare-function org-cycle-agenda-files "org-cycle" ())
 (declare-function org-date-from-calendar "org" ())
 (declare-function org-dynamic-block-insert-dblock "org" (&optional arg))
 (declare-function org-dblock-update "org" (&optional arg))
@@ -81,7 +84,7 @@
 (declare-function org-display-outline-path "org" (&optional file current 
separator just-return-string))
 (declare-function org-down-element "org" ())
 (declare-function org-edit-special "org" (&optional arg))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-emphasize "org" (&optional char))
 (declare-function org-end-of-line "org" (&optional n))
@@ -94,7 +97,7 @@
 (declare-function org-fill-paragraph "org" (&optional justify region))
 (declare-function org-find-file-at-mouse "org" (ev))
 (declare-function org-footnote-action "org" (&optional special))
-(declare-function org-force-cycle-archived "org" ())
+(declare-function org-cycle-force-archived "org-cycle" ())
 (declare-function org-force-self-insert "org" (n))
 (declare-function org-forward-element "org" ())
 (declare-function org-forward-heading-same-level "org" (arg &optional 
invisible-ok))
@@ -128,7 +131,7 @@
 (declare-function org-metaup "org" (&optional _arg))
 (declare-function org-narrow-to-block "org" ())
 (declare-function org-narrow-to-element "org" ())
-(declare-function org-narrow-to-subtree "org" ())
+(declare-function org-narrow-to-subtree "org" (&optional element))
 (declare-function org-next-block "org" (arg &optional backward block-regexp))
 (declare-function org-next-link "org" (&optional search-backward))
 (declare-function org-next-visible-heading "org" (arg))
@@ -143,8 +146,8 @@
 (declare-function org-priority "org" (&optional action show))
 (declare-function org-promote-subtree "org" ())
 (declare-function org-redisplay-inline-images "org" ())
-(declare-function org-refile "org" (&optional arg1 default-buffer rfloc msg))
-(declare-function org-refile-copy "org" ())
+(declare-function org-refile "org-refile" (&optional arg1 default-buffer rfloc 
msg))
+(declare-function org-refile-copy "org-refile" ())
 (declare-function org-refile-reverse "org-refile" (&optional arg 
default-buffer rfloc msg))
 (declare-function org-reftex-citation "org" ())
 (declare-function org-reload "org" (&optional arg1))
@@ -152,7 +155,7 @@
 (declare-function org-resolve-clocks "org" (&optional only-dangling-p 
prompt-fn last-valid))
 (declare-function org-return "org" (&optional indent))
 (declare-function org-return-and-maybe-indent "org" ())
-(declare-function org-reveal "org" (&optional siblings))
+(declare-function org-fold-reveal "org-fold" (&optional siblings))
 (declare-function org-schedule "org" (arg &optional time))
 (declare-function org-self-insert-command "org" (N))
 (declare-function org-set-effort "org" (&optional increment value))
@@ -172,9 +175,9 @@
 (declare-function org-shiftright "org" (&optional arg))
 (declare-function org-shifttab "org" (&optional arg))
 (declare-function org-shiftup "org" (&optional arg))
-(declare-function org-show-all "org" (&optional types))
-(declare-function org-show-children "org" (&optional level))
-(declare-function org-show-subtree "org" ())
+(declare-function org-fold-show-all "org-fold" (&optional types))
+(declare-function org-fold-show-children "org-fold" (&optional level))
+(declare-function org-fold-show-subtree "org-fold" ())
 (declare-function org-sort "org" (&optional with-case))
 (declare-function org-sparse-tree "org" (&optional arg type))
 (declare-function org-table-copy-down "org" (n))
@@ -201,7 +204,7 @@
 (declare-function org-toggle-radio-button "org" (&optional arg))
 (declare-function org-toggle-comment "org" ())
 (declare-function org-toggle-fixed-width "org" ())
-(declare-function org-toggle-inline-images "org" (&optional include-linked))
+(declare-function org-toggle-inline-images "org" (&optional include-linked beg 
end))
 (declare-function org-latex-preview "org" (&optional arg))
 (declare-function org-toggle-narrow-to-subtree "org" ())
 (declare-function org-toggle-ordered-property "org" ())
@@ -244,7 +247,7 @@ become effective."
 
 (defcustom org-use-extra-keys nil
   "Non-nil means use extra key sequence definitions for certain commands.
-This happens automatically if `window-system' is nil.  This
+This happens automatically if `display-graphic-p' returns nil.  This
 variable lets you do the same manually.  You must set it before
 loading Org."
   :group 'org-startup
@@ -423,7 +426,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command 
names."
 (define-key org-mode-map [menu-bar show] 'undefined)
 
 (define-key org-mode-map [remap outline-mark-subtree] #'org-mark-subtree)
-(define-key org-mode-map [remap outline-show-subtree] #'org-show-subtree)
+(define-key org-mode-map [remap outline-show-subtree] #'org-fold-show-subtree)
 (define-key org-mode-map [remap outline-forward-same-level]
   #'org-forward-heading-same-level)
 (define-key org-mode-map [remap outline-backward-same-level]
@@ -437,14 +440,14 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command 
names."
   #'org-next-visible-heading)
 (define-key org-mode-map [remap outline-previous-visible-heading]
   #'org-previous-visible-heading)
-(define-key org-mode-map [remap show-children] #'org-show-children)
+(define-key org-mode-map [remap outline-show-children] 
#'org-fold-show-children)
 
 ;;;; Make `C-c C-x' a prefix key
 (org-defkey org-mode-map (kbd "C-c C-x") (make-sparse-keymap))
 
 ;;;; TAB key with modifiers
 (org-defkey org-mode-map (kbd "TAB") #'org-cycle)
-(org-defkey org-mode-map (kbd "C-c C-<tab>") #'org-force-cycle-archived)
+(org-defkey org-mode-map (kbd "C-c C-<tab>") #'org-cycle-force-archived)
 ;; Override text-mode binding to expose `complete-symbol' for
 ;; pcomplete functionality.
 (org-defkey org-mode-map (kbd "M-TAB") nil)
@@ -462,6 +465,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command 
names."
 
 ;;;; Cursor keys with modifiers
 (org-defkey org-mode-map (kbd "M-<left>") #'org-metaleft)
+(org-defkey org-mode-map (kbd "ESC <left>") #'org-metaleft)
 (org-defkey org-mode-map (kbd "M-<right>") #'org-metaright)
 (org-defkey org-mode-map (kbd "ESC <right>") #'org-metaright)
 (org-defkey org-mode-map (kbd "M-<up>") #'org-metaup)
@@ -495,7 +499,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command 
names."
 ;;  We only set them when really needed because otherwise the
 ;;  menus don't show the simple keys
 
-(when (or org-use-extra-keys (not window-system))
+(when (or org-use-extra-keys (not (display-graphic-p)))
   (org-defkey org-mode-map (kbd "C-c C-x c") #'org-table-copy-down)
   (org-defkey org-mode-map (kbd "C-c C-x m") #'org-meta-return)
   (org-defkey org-mode-map (kbd "C-c C-x M") #'org-insert-todo-heading)
@@ -544,7 +548,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command 
names."
 
 ;;;; All the other keys
 (org-defkey org-mode-map (kbd "|") #'org-force-self-insert)
-(org-defkey org-mode-map (kbd "C-c C-r") #'org-reveal)
+(org-defkey org-mode-map (kbd "C-c C-r") #'org-fold-reveal)
 (org-defkey org-mode-map (kbd "C-M-t") #'org-transpose-element)
 (org-defkey org-mode-map (kbd "M-}") #'org-forward-element)
 (org-defkey org-mode-map (kbd "ESC }") #'org-forward-element)
@@ -804,10 +808,6 @@ command."
   (interactive)
   (unless org-use-speed-commands
     (user-error "Speed commands are not activated, customize 
`org-use-speed-commands'"))
-  ;; FIXME: remove this warning for 9.6
-  (when (boundp 'org-speed-commands-user)
-    (message "`org-speed-command-user' is obsolete, please use 
`org-speed-commands'")
-    (sit-for 3))
   (with-output-to-temp-buffer "*Help*"
     (princ "Speed commands\n==============\n")
     (mapc #'org-print-speed-command
diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el
index 6d8cf3f237..ff2999cb8f 100644
--- a/lisp/org/org-lint.el
+++ b/lisp/org/org-lint.el
@@ -22,282 +22,331 @@
 
 ;;; Commentary:
 
-;; This library implements linting for Org syntax.  The sole public
-;; function is `org-lint', which see.
+;; This library implements linting for Org syntax.  The process is
+;; started by calling `org-lint' command, which see.
 
-;; Internally, the library defines a new structure:
-;; `org-lint-checker', with the following slots:
-
-;;   - NAME: Unique check identifier, as a non-nil symbol that doesn't
-;;     start with an hyphen.
-;;
-;;     The check is done calling the function `org-lint-NAME' with one
-;;     mandatory argument, the parse tree describing the current Org
-;;     buffer.  Such function calls are wrapped within
-;;     a `save-excursion' and point is always at `point-min'.  Its
-;;     return value has to be an alist (POSITION MESSAGE) when
-;;     POSITION refer to the buffer position of the error, as an
-;;     integer, and MESSAGE is a string describing the error.
-
-;;   - DESCRIPTION: Summary about the check, as a string.
-
-;;   - CATEGORIES: Categories relative to the check, as a list of
-;;     symbol.  They are used for filtering when calling `org-lint'.
-;;     Checkers not explicitly associated to a category are collected
-;;     in the `default' one.
-
-;;   - TRUST: The trust level one can have in the check.  It is either
-;;     `low' or `high', depending on the heuristics implemented and
-;;     the nature of the check.  This has an indicative value only and
-;;     is displayed along reports.
-
-;; All checks have to be listed in `org-lint--checkers'.
+;; New checkers are added by `org-lint-add-checker' function.
+;; Internally, all checks are listed in `org-lint--checkers'.
 
 ;; Results are displayed in a special "*Org Lint*" buffer with
 ;; a dedicated major mode, derived from `tabulated-list-mode'.
-;;
 ;; In addition to the usual key-bindings inherited from it, "C-j" and
 ;; "TAB" display problematic line reported under point whereas "RET"
 ;; jumps to it.  Also, "h" hides all reports similar to the current
 ;; one.  Additionally, "i" removes them from subsequent reports.
 
-;; Checks currently implemented are:
-
-;;   - duplicate CUSTOM_ID properties
-;;   - duplicate NAME values
-;;   - duplicate targets
-;;   - duplicate footnote definitions
-;;   - orphaned affiliated keywords
-;;   - obsolete affiliated keywords
-;;   - missing language in source blocks
-;;   - missing back-end in export blocks
-;;   - invalid Babel call blocks
-;;   - NAME values with a colon
-;;   - deprecated export block syntax
-;;   - deprecated Babel header properties
-;;   - wrong header arguments in source blocks
-;;   - misuse of CATEGORY keyword
-;;   - "coderef" links with unknown destination
-;;   - "custom-id" links with unknown destination
-;;   - "fuzzy" links with unknown destination
-;;   - "id" links with unknown destination
-;;   - links to non-existent local files
-;;   - SETUPFILE keywords with non-existent file parameter
-;;   - INCLUDE keywords with wrong link parameter
-;;   - obsolete markup in INCLUDE keyword
-;;   - unknown items in OPTIONS keyword
-;;   - spurious macro arguments or invalid macro templates
-;;   - special properties in properties drawer
-;;   - obsolete syntax for PROPERTIES drawers
-;;   - Invalid EFFORT property value
-;;   - missing definition for footnote references
-;;   - missing reference for footnote definitions
-;;   - non-footnote definitions in footnote section
-;;   - probable invalid keywords
-;;   - invalid blocks
-;;   - misplaced planning info line
-;;   - incomplete drawers
-;;   - indented diary-sexps
-;;   - obsolete QUOTE section
-;;   - obsolete "file+application" link
-;;   - spurious colons in tags
+;; Checks currently implemented report the following:
+
+;; - duplicates CUSTOM_ID properties,
+;; - duplicate NAME values,
+;; - duplicate targets,
+;; - duplicate footnote definitions,
+;; - orphaned affiliated keywords,
+;; - obsolete affiliated keywords,
+;; - deprecated export block syntax,
+;; - deprecated Babel header syntax,
+;; - missing language in source blocks,
+;; - missing back-end in export blocks,
+;; - invalid Babel call blocks,
+;; - NAME values with a colon,
+;; - wrong babel headers,
+;; - invalid value in babel headers,
+;; - misuse of CATEGORY keyword,
+;; - "coderef" links with unknown destination,
+;; - "custom-id" links with unknown destination,
+;; - "fuzzy" links with unknown destination,
+;; - "id" links with unknown destination,
+;; - links to non-existent local files,
+;; - SETUPFILE keywords with non-existent file parameter,
+;; - INCLUDE keywords with misleading link parameter,
+;; - obsolete markup in INCLUDE keyword,
+;; - unknown items in OPTIONS keyword,
+;; - spurious macro arguments or invalid macro templates,
+;; - special properties in properties drawers,
+;; - obsolete syntax for properties drawers,
+;; - invalid duration in EFFORT property,
+;; - missing definition for footnote references,
+;; - missing reference for footnote definitions,
+;; - non-footnote definitions in footnote section,
+;; - probable invalid keywords,
+;; - invalid blocks,
+;; - misplaced planning info line,
+;; - probable incomplete drawers,
+;; - probable indented diary-sexps,
+;; - obsolete QUOTE section,
+;; - obsolete "file+application" link,
+;; - obsolete escape syntax in links,
+;; - spurious colons in tags,
+;; - invalid bibliography file,
+;; - missing "print_bibliography" keyword,
+;; - invalid value for "cite_export" keyword,
+;; - incomplete citation object.
 
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ob)
+(require 'oc)
 (require 'ol)
 (require 'org-attach)
 (require 'org-macro)
+(require 'org-fold)
 (require 'ox)
+(require 'seq)
 
 
-;;; Checkers
+;;; Checkers structure
 
 (cl-defstruct (org-lint-checker (:copier nil))
-  (name 'missing-checker-name)
-  (description "")
-  (categories '(default))
-  (trust 'high))                       ; `low' or `high'
-
-(defun org-lint-missing-checker-name (_)
-  (error
-   "`A checker has no `:name' property.  Please verify `org-lint--checkers'"))
-
-(defconst org-lint--checkers
-  (list
-   (make-org-lint-checker
-    :name 'duplicate-custom-id
-    :description "Report duplicates CUSTOM_ID properties"
-    :categories '(link))
-   (make-org-lint-checker
-    :name 'duplicate-name
-    :description "Report duplicate NAME values"
-    :categories '(babel link))
-   (make-org-lint-checker
-    :name 'duplicate-target
-    :description "Report duplicate targets"
-    :categories '(link))
-   (make-org-lint-checker
-    :name 'duplicate-footnote-definition
-    :description "Report duplicate footnote definitions"
-    :categories '(footnote))
-   (make-org-lint-checker
-    :name 'orphaned-affiliated-keywords
-    :description "Report orphaned affiliated keywords"
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'obsolete-affiliated-keywords
-    :description "Report obsolete affiliated keywords"
-    :categories '(obsolete))
-   (make-org-lint-checker
-    :name 'deprecated-export-blocks
-    :description "Report deprecated export block syntax"
-    :categories '(obsolete export)
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'deprecated-header-syntax
-    :description "Report deprecated Babel header syntax"
-    :categories '(obsolete babel)
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'missing-language-in-src-block
-    :description "Report missing language in source blocks"
-    :categories '(babel))
-   (make-org-lint-checker
-    :name 'missing-backend-in-export-block
-    :description "Report missing back-end in export blocks"
-    :categories '(export))
-   (make-org-lint-checker
-    :name 'invalid-babel-call-block
-    :description "Report invalid Babel call blocks"
-    :categories '(babel))
-   (make-org-lint-checker
-    :name 'colon-in-name
-    :description "Report NAME values with a colon"
-    :categories '(babel))
-   (make-org-lint-checker
-    :name 'wrong-header-argument
-    :description "Report wrong babel headers"
-    :categories '(babel))
-   (make-org-lint-checker
-    :name 'wrong-header-value
-    :description "Report invalid value in babel headers"
-    :categories '(babel)
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'deprecated-category-setup
-    :description "Report misuse of CATEGORY keyword"
-    :categories '(obsolete))
-   (make-org-lint-checker
-    :name 'invalid-coderef-link
-    :description "Report \"coderef\" links with unknown destination"
-    :categories '(link))
-   (make-org-lint-checker
-    :name 'invalid-custom-id-link
-    :description "Report \"custom-id\" links with unknown destination"
-    :categories '(link))
-   (make-org-lint-checker
-    :name 'invalid-fuzzy-link
-    :description "Report \"fuzzy\" links with unknown destination"
-    :categories '(link))
-   (make-org-lint-checker
-    :name 'invalid-id-link
-    :description "Report \"id\" links with unknown destination"
-    :categories '(link))
-   (make-org-lint-checker
-    :name 'link-to-local-file
-    :description "Report links to non-existent local files"
-    :categories '(link)
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'non-existent-setupfile-parameter
-    :description "Report SETUPFILE keywords with non-existent file parameter"
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'wrong-include-link-parameter
-    :description "Report INCLUDE keywords with misleading link parameter"
-    :categories '(export)
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'obsolete-include-markup
-    :description "Report obsolete markup in INCLUDE keyword"
-    :categories '(obsolete export)
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'unknown-options-item
-    :description "Report unknown items in OPTIONS keyword"
-    :categories '(export)
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'invalid-macro-argument-and-template
-    :description "Report spurious macro arguments or invalid macro templates"
-    :categories '(export)
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'special-property-in-properties-drawer
-    :description "Report special properties in properties drawers"
-    :categories '(properties))
-   (make-org-lint-checker
-    :name 'obsolete-properties-drawer
-    :description "Report obsolete syntax for properties drawers"
-    :categories '(obsolete properties))
-   (make-org-lint-checker
-    :name 'invalid-effort-property
-    :description "Report invalid duration in EFFORT property"
-    :categories '(properties))
-   (make-org-lint-checker
-    :name 'undefined-footnote-reference
-    :description "Report missing definition for footnote references"
-    :categories '(footnote))
-   (make-org-lint-checker
-    :name 'unreferenced-footnote-definition
-    :description "Report missing reference for footnote definitions"
-    :categories '(footnote))
-   (make-org-lint-checker
-    :name 'extraneous-element-in-footnote-section
-    :description "Report non-footnote definitions in footnote section"
-    :categories '(footnote))
-   (make-org-lint-checker
-    :name 'invalid-keyword-syntax
-    :description "Report probable invalid keywords"
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'invalid-block
-    :description "Report invalid blocks"
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'misplaced-planning-info
-    :description "Report misplaced planning info line"
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'incomplete-drawer
-    :description "Report probable incomplete drawers"
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'indented-diary-sexp
-    :description "Report probable indented diary-sexps"
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'quote-section
-    :description "Report obsolete QUOTE section"
-    :categories '(obsolete)
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'file-application
-    :description "Report obsolete \"file+application\" link"
-    :categories '(link obsolete))
-   (make-org-lint-checker
-    :name 'percent-encoding-link-escape
-    :description "Report obsolete escape syntax in links"
-    :categories '(link obsolete)
-    :trust 'low)
-   (make-org-lint-checker
-    :name 'spurious-colons
-    :description "Report spurious colons in tags"
-    :categories '(tags)))
-  "List of all available checkers.")
+  name summary function trust categories)
+
+(defvar org-lint--checkers nil
+  "List of all available checkers.
+This list is populated by `org-lint-add-checker' function.")
+
+;;;###autoload
+(defun org-lint-add-checker (name summary fun &rest props)
+  "Add a new checker for linter.
+
+NAME is a unique check identifier, as a non-nil symbol.  SUMMARY
+is a short description of the check, as a string.
+
+The check is done calling the function FUN with one mandatory
+argument, the parse tree describing the current Org buffer.  Such
+function calls are wrapped within a `save-excursion' and point is
+always at `point-min'.  Its return value has to be an
+alist (POSITION MESSAGE) where POSITION refer to the buffer
+position of the error, as an integer, and MESSAGE is a one-line
+string describing the error.
+
+Optional argument PROPS provides additional information about the
+checker.  Currently, two properties are supported:
+
+  `:categories'
+
+     Categories relative to the check, as a list of symbol.  They
+     are used for filtering when calling `org-lint'.  Checkers
+     not explicitly associated to a category are collected in the
+     `default' one.
+
+  `:trust'
+
+    The trust level one can have in the check.  It is either
+    `low' or `high', depending on the heuristics implemented and
+    the nature of the check.  This has an indicative value only
+    and is displayed along reports."
+  (declare (indent 1))
+  ;; Sanity checks.
+  (pcase name
+    (`nil (error "Name field is mandatory for checkers"))
+    ((pred symbolp) nil)
+    (_ (error "Invalid type for name field")))
+  (unless (functionp fun)
+    (error "Checker field is expected to be a valid function"))
+  ;; Install checker in `org-lint--checkers'; uniquify by name.
+  (setq org-lint--checkers
+        (cons (apply #'make-org-lint-checker
+                     :name name
+                     :summary summary
+                     :function fun
+                     props)
+              (seq-remove (lambda (c) (eq name (org-lint-checker-name c)))
+                          org-lint--checkers))))
+
+
+;;; Reports UI
+
+(defvar org-lint--report-mode-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map tabulated-list-mode-map)
+    (define-key map (kbd "RET") 'org-lint--jump-to-source)
+    (define-key map (kbd "TAB") 'org-lint--show-source)
+    (define-key map (kbd "C-j") 'org-lint--show-source)
+    (define-key map (kbd "h") 'org-lint--hide-checker)
+    (define-key map (kbd "i") 'org-lint--ignore-checker)
+    map)
+  "Local keymap for `org-lint--report-mode' buffers.")
+
+(define-derived-mode org-lint--report-mode tabulated-list-mode "OrgLint"
+  "Major mode used to display reports emitted during linting.
+\\{org-lint--report-mode-map}"
+  (setf tabulated-list-format
+       `[("Line" 6
+          (lambda (a b)
+            (< (string-to-number (aref (cadr a) 0))
+               (string-to-number (aref (cadr b) 0))))
+          :right-align t)
+         ("Trust" 5 t)
+         ("Warning" 0 t)])
+  (tabulated-list-init-header))
+
+(defun org-lint--generate-reports (buffer checkers)
+  "Generate linting report for BUFFER.
+
+CHECKERS is the list of checkers used.
+
+Return an alist (ID [LINE TRUST DESCRIPTION CHECKER]), suitable
+for `tabulated-list-printer'."
+  (with-current-buffer buffer
+    (save-excursion
+      (goto-char (point-min))
+      (let ((ast (org-element-parse-buffer))
+           (id 0)
+           (last-line 1)
+           (last-pos 1))
+       ;; Insert unique ID for each report.  Replace buffer positions
+       ;; with line numbers.
+       (mapcar
+        (lambda (report)
+          (list
+           (cl-incf id)
+           (apply #'vector
+                  (cons
+                   (progn
+                     (goto-char (car report))
+                     (beginning-of-line)
+                     (prog1 (number-to-string
+                             (cl-incf last-line
+                                      (count-lines last-pos (point))))
+                       (setf last-pos (point))))
+                   (cdr report)))))
+        ;; Insert trust level in generated reports.  Also sort them
+        ;; by buffer position in order to optimize lines computation.
+        (sort (cl-mapcan
+               (lambda (c)
+                 (let ((trust (symbol-name (org-lint-checker-trust c))))
+                   (mapcar
+                    (lambda (report)
+                      (list (car report) trust (nth 1 report) c))
+                    (save-excursion
+                      (funcall (org-lint-checker-function c)
+                               ast)))))
+               checkers)
+              #'car-less-than-car))))))
+
+(defvar-local org-lint--source-buffer nil
+  "Source buffer associated to current report buffer.")
+
+(defvar-local org-lint--local-checkers nil
+  "List of checkers used to build current report.")
+
+(defun org-lint--refresh-reports ()
+  (setq tabulated-list-entries
+       (org-lint--generate-reports org-lint--source-buffer
+                                   org-lint--local-checkers))
+  (tabulated-list-print))
+
+(defun org-lint--current-line ()
+  "Return current report line, as a number."
+  (string-to-number (aref (tabulated-list-get-entry) 0)))
+
+(defun org-lint--current-checker (&optional entry)
+  "Return current report checker.
+When optional argument ENTRY is non-nil, use this entry instead
+of current one."
+  (aref (if entry (nth 1 entry) (tabulated-list-get-entry)) 3))
+
+(defun org-lint--display-reports (source checkers)
+  "Display linting reports for buffer SOURCE.
+CHECKERS is the list of checkers used."
+  (let ((buffer (get-buffer-create "*Org Lint*")))
+    (with-current-buffer buffer
+      (org-lint--report-mode)
+      (setf org-lint--source-buffer source)
+      (setf org-lint--local-checkers checkers)
+      (org-lint--refresh-reports)
+      (add-hook 'tabulated-list-revert-hook #'org-lint--refresh-reports nil t))
+    (pop-to-buffer buffer)))
+
+(defun org-lint--jump-to-source ()
+  "Move to source line that generated the report at point."
+  (interactive)
+  (let ((l (org-lint--current-line)))
+    (switch-to-buffer-other-window org-lint--source-buffer)
+    (org-goto-line l)
+    (org-fold-show-set-visibility 'local)
+    (recenter)))
+
+(defun org-lint--show-source ()
+  "Show source line that generated the report at point."
+  (interactive)
+  (let ((buffer (current-buffer)))
+    (org-lint--jump-to-source)
+    (switch-to-buffer-other-window buffer)))
+
+(defun org-lint--hide-checker ()
+  "Hide all reports from checker that generated the report at point."
+  (interactive)
+  (let ((c (org-lint--current-checker)))
+    (setf tabulated-list-entries
+         (cl-remove-if (lambda (e) (equal c (org-lint--current-checker e)))
+                       tabulated-list-entries))
+    (tabulated-list-print)))
+
+(defun org-lint--ignore-checker ()
+  "Ignore all reports from checker that generated the report at point.
+Checker will also be ignored in all subsequent reports."
+  (interactive)
+  (setf org-lint--local-checkers
+       (remove (org-lint--current-checker) org-lint--local-checkers))
+  (org-lint--hide-checker))
+
+
+;;; Main function
+
+;;;###autoload
+(defun org-lint (&optional arg)
+  "Check current Org buffer for syntax mistakes.
+
+By default, run all checkers.  With a `\\[universal-argument]' prefix ARG, \
+select one
+category of checkers only.  With a `\\[universal-argument] \
+\\[universal-argument]' prefix, run one precise
+checker by its name.
+
+ARG can also be a list of checker names, as symbols, to run."
+  (interactive "P")
+  (unless (derived-mode-p 'org-mode) (user-error "Not in an Org buffer"))
+  (when (called-interactively-p 'any)
+    (message "Org linting process starting..."))
+  (let ((checkers
+        (pcase arg
+          (`nil org-lint--checkers)
+          (`(4)
+           (let ((category
+                  (completing-read
+                   "Checker category: "
+                   (mapcar #'org-lint-checker-categories org-lint--checkers)
+                   nil t)))
+             (cl-remove-if-not
+              (lambda (c)
+                (assoc-string category (org-lint-checker-categories c)))
+              org-lint--checkers)))
+          (`(16)
+           (list
+            (let ((name (completing-read
+                         "Checker name: "
+                         (mapcar #'org-lint-checker-name org-lint--checkers)
+                         nil t)))
+              (catch 'exit
+                (dolist (c org-lint--checkers)
+                  (when (string= (org-lint-checker-name c) name)
+                    (throw 'exit c)))))))
+          ((pred consp)
+           (cl-remove-if-not (lambda (c) (memq (org-lint-checker-name c) arg))
+                             org-lint--checkers))
+          (_ (user-error "Invalid argument `%S' for `org-lint'" arg)))))
+    (if (not (called-interactively-p 'any))
+       (org-lint--generate-reports (current-buffer) checkers)
+      (org-lint--display-reports (current-buffer) checkers)
+      (message "Org linting process completed"))))
+
+
+;;; Checker functions
 
 (defun org-lint--collect-duplicates
     (ast type extract-key extract-position build-message)
@@ -334,7 +383,7 @@ called with one argument, the key used for comparison."
    ast
    'node-property
    (lambda (property)
-     (and (string-equal-ignore-case
+     (and (org-string-equal-ignore-case
            "CUSTOM_ID" (org-element-property :key property))
          (org-element-property :value property)))
    (lambda (property _) (org-element-property :begin property))
@@ -601,39 +650,40 @@ in description"
   (org-element-map ast 'keyword
     (lambda (k)
       (when (equal (org-element-property :key k) "INCLUDE")
-       (let* ((value (org-element-property :value k))
-              (path
-               (and (string-match "^\\(\".+\"\\|\\S-+\\)[ \t]*" value)
-                    (save-match-data
-                      (org-strip-quotes (match-string 1 value))))))
-         (if (not path)
-             (list (org-element-property :post-affiliated k)
-                   "Missing location argument in INCLUDE keyword")
-           (let* ((file (org-string-nw-p
-                         (if (string-match "::\\(.*\\)\\'" path)
-                             (substring path 0 (match-beginning 0))
-                           path)))
-                  (search (and (not (equal file path))
-                               (org-string-nw-p (match-string 1 path)))))
-             (if (and file
-                      (not (file-remote-p file))
-                      (not (file-exists-p file)))
-                 (list (org-element-property :post-affiliated k)
-                       "Non-existent file argument in INCLUDE keyword")
-               (let* ((visiting (if file (find-buffer-visiting file)
-                                  (current-buffer)))
-                      (buffer (or visiting (find-file-noselect file)))
-                      (org-link-search-must-match-exact-headline t))
-                 (unwind-protect
-                     (with-current-buffer buffer
-                       (when (and search
-                                  (not (ignore-errors
-                                         (org-link-search search nil t))))
-                         (list (org-element-property :post-affiliated k)
-                               (format
-                                "Invalid search part \"%s\" in INCLUDE keyword"
-                                search))))
-                   (unless visiting (kill-buffer buffer))))))))))))
+        (let* ((value (org-element-property :value k))
+               (path
+                (and (string-match "^\\(\".+?\"\\|\\S-+\\)[ \t]*" value)
+                     (save-match-data
+                       (org-strip-quotes (match-string 1 value))))))
+          (if (not path)
+              (list (org-element-property :post-affiliated k)
+                    "Missing location argument in INCLUDE keyword")
+            (let* ((file (org-string-nw-p
+                          (if (string-match "::\\(.*\\)\\'" path)
+                              (substring path 0 (match-beginning 0))
+                            path)))
+                   (search (and (not (equal file path))
+                                (org-string-nw-p (match-string 1 path)))))
+              (unless (org-url-p file)
+                (if (and file
+                         (not (file-remote-p file))
+                         (not (file-exists-p file)))
+                    (list (org-element-property :post-affiliated k)
+                          "Non-existent file argument in INCLUDE keyword")
+                  (let* ((visiting (if file (find-buffer-visiting file)
+                                     (current-buffer)))
+                         (buffer (or visiting (find-file-noselect file)))
+                         (org-link-search-must-match-exact-headline t))
+                    (unwind-protect
+                        (with-current-buffer buffer
+                          (when (and search
+                                     (not (ignore-errors
+                                            (org-link-search search nil t))))
+                            (list (org-element-property :post-affiliated k)
+                                  (format
+                                   "Invalid search part \"%s\" in INCLUDE 
keyword"
+                                   search))))
+                      (unless visiting (kill-buffer buffer)))))))))))))
 
 (defun org-lint-obsolete-include-markup (ast)
   (let ((regexp (format "\\`\\(?:\".+\"\\|\\S-+\\)[ \t]+%s"
@@ -1016,8 +1066,10 @@ Use \"export %s\" instead"
          (`keyword
           (when (string= (org-element-property :key datum) "PROPERTY")
             (let ((value (org-element-property :value datum)))
-              (when (string-match "\\`header-args\\(?::\\(\\S-+\\)\\)?\\+? *"
-                                  value)
+              (when (or (string-match "\\`header-args\\(?::\\(\\S-+\\)\\)?\\+ 
*"
+                                      value)
+                         (string-match "\\`header-args\\(?::\\(\\S-+\\)\\)? *"
+                                      value))
                 (funcall verify
                          datum
                          (match-string 1 value)
@@ -1026,8 +1078,10 @@ Use \"export %s\" instead"
          (`node-property
           (let ((key (org-element-property :key datum)))
             (when (let ((case-fold-search t))
-                    (string-match "\\`HEADER-ARGS\\(?::\\(\\S-+\\)\\)?\\+?"
-                                  key))
+                    (or (string-match "\\`HEADER-ARGS\\(?::\\(\\S-+\\)\\)?\\+"
+                                      key)
+                         (string-match "\\`HEADER-ARGS\\(?::\\(\\S-+\\)\\)?"
+                                      key)))
               (funcall verify
                        datum
                        (match-string 1 key)
@@ -1123,196 +1177,278 @@ Use \"export %s\" instead"
        (list (org-element-property :begin h)
              "Tags contain a spurious colon")))))
 
+(defun org-lint-non-existent-bibliography (ast)
+  (org-element-map ast 'keyword
+    (lambda (k)
+      (when (equal "BIBLIOGRAPHY" (org-element-property :key k))
+        (let ((file (org-strip-quotes (org-element-property :value k))))
+          (and (not (file-remote-p file))
+              (not (file-exists-p file))
+              (list (org-element-property :begin k)
+                    (format "Non-existent bibliography %S" file))))))))
+
+(defun org-lint-missing-print-bibliography (ast)
+  (and (org-element-map ast 'citation #'identity nil t)
+       (not (org-element-map ast 'keyword
+              (lambda (k)
+                (equal "PRINT_BIBLIOGRAPHY" (org-element-property :key k)))
+              nil t))
+       (list
+        (list (point-max) "Possibly missing \"PRINT_BIBLIOGRAPHY\" keyword"))))
+
+(defun org-lint-invalid-cite-export-declaration (ast)
+  (org-element-map ast 'keyword
+    (lambda (k)
+      (when (equal "CITE_EXPORT" (org-element-property :key k))
+        (let ((value (org-element-property :value k))
+              (source (org-element-property :begin k)))
+          (if (equal value "")
+              (list source "Missing export processor name")
+            (condition-case _
+                (pcase (org-cite-read-processor-declaration value)
+                  (`(,(and (pred symbolp) name)
+                     ,(pred string-or-null-p)
+                     ,(pred string-or-null-p))
+                   (unless (org-cite-get-processor name)
+                     (list source "Unknown cite export processor %S" name)))
+                  (_
+                   (list source "Invalid cite export processor declaration")))
+              (error
+               (list source "Invalid cite export processor 
declaration")))))))))
+
+(defun org-lint-incomplete-citation (ast)
+  (org-element-map ast 'plain-text
+    (lambda (text)
+      (and (string-match-p org-element-citation-prefix-re text)
+           ;; XXX: The code below signals the error at the beginning
+           ;; of the paragraph containing the faulty object.  It is
+           ;; not very accurate but may be enough for now.
+           (list (org-element-property :contents-begin
+                                       (org-element-property :parent text))
+                 "Possibly incomplete citation markup")))))
 
 
-;;; Reports UI
-
-(defvar org-lint--report-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map tabulated-list-mode-map)
-    (define-key map (kbd "RET") 'org-lint--jump-to-source)
-    (define-key map (kbd "TAB") 'org-lint--show-source)
-    (define-key map (kbd "C-j") 'org-lint--show-source)
-    (define-key map (kbd "h") 'org-lint--hide-checker)
-    (define-key map (kbd "i") 'org-lint--ignore-checker)
-    map)
-  "Local keymap for `org-lint--report-mode' buffers.")
-
-(define-derived-mode org-lint--report-mode tabulated-list-mode "OrgLint"
-  "Major mode used to display reports emitted during linting.
-\\{org-lint--report-mode-map}"
-  (setf tabulated-list-format
-       `[("Line" 6
-          (lambda (a b)
-            (< (string-to-number (aref (cadr a) 0))
-               (string-to-number (aref (cadr b) 0))))
-          :right-align t)
-         ("Trust" 5 t)
-         ("Warning" 0 t)])
-  (tabulated-list-init-header))
-
-(defun org-lint--generate-reports (buffer checkers)
-  "Generate linting report for BUFFER.
-
-CHECKERS is the list of checkers used.
-
-Return an alist (ID [LINE TRUST DESCRIPTION CHECKER]), suitable
-for `tabulated-list-printer'."
-  (with-current-buffer buffer
-    (save-excursion
-      (goto-char (point-min))
-      (let ((ast (org-element-parse-buffer))
-           (id 0)
-           (last-line 1)
-           (last-pos 1))
-       ;; Insert unique ID for each report.  Replace buffer positions
-       ;; with line numbers.
-       (mapcar
-        (lambda (report)
-          (list
-           (cl-incf id)
-           (apply #'vector
-                  (cons
-                   (progn
-                     (goto-char (car report))
-                     (beginning-of-line)
-                     (prog1 (number-to-string
-                             (cl-incf last-line
-                                      (count-lines last-pos (point))))
-                       (setf last-pos (point))))
-                   (cdr report)))))
-        ;; Insert trust level in generated reports.  Also sort them
-        ;; by buffer position in order to optimize lines computation.
-        (sort (cl-mapcan
-               (lambda (c)
-                 (let ((trust (symbol-name (org-lint-checker-trust c))))
-                   (mapcar
-                    (lambda (report)
-                      (list (car report) trust (nth 1 report) c))
-                    (save-excursion
-                      (funcall
-                       (intern (format "org-lint-%s"
-                                       (org-lint-checker-name c)))
-                       ast)))))
-               checkers)
-              #'car-less-than-car))))))
-
-(defvar-local org-lint--source-buffer nil
-  "Source buffer associated to current report buffer.")
-
-(defvar-local org-lint--local-checkers nil
-  "List of checkers used to build current report.")
-
-(defun org-lint--refresh-reports ()
-  (setq tabulated-list-entries
-       (org-lint--generate-reports org-lint--source-buffer
-                                   org-lint--local-checkers))
-  (tabulated-list-print))
-
-(defun org-lint--current-line ()
-  "Return current report line, as a number."
-  (string-to-number (aref (tabulated-list-get-entry) 0)))
-
-(defun org-lint--current-checker (&optional entry)
-  "Return current report checker.
-When optional argument ENTRY is non-nil, use this entry instead
-of current one."
-  (aref (if entry (nth 1 entry) (tabulated-list-get-entry)) 3))
-
-(defun org-lint--display-reports (source checkers)
-  "Display linting reports for buffer SOURCE.
-CHECKERS is the list of checkers used."
-  (let ((buffer (get-buffer-create "*Org Lint*")))
-    (with-current-buffer buffer
-      (org-lint--report-mode)
-      (setf org-lint--source-buffer source)
-      (setf org-lint--local-checkers checkers)
-      (org-lint--refresh-reports)
-      (add-hook 'tabulated-list-revert-hook #'org-lint--refresh-reports nil t))
-    (pop-to-buffer buffer)))
-
-(defun org-lint--jump-to-source ()
-  "Move to source line that generated the report at point."
-  (interactive)
-  (let ((l (org-lint--current-line)))
-    (switch-to-buffer-other-window org-lint--source-buffer)
-    (org-goto-line l)
-    (org-show-set-visibility 'local)
-    (recenter)))
-
-(defun org-lint--show-source ()
-  "Show source line that generated the report at point."
-  (interactive)
-  (let ((buffer (current-buffer)))
-    (org-lint--jump-to-source)
-    (switch-to-buffer-other-window buffer)))
-
-(defun org-lint--hide-checker ()
-  "Hide all reports from checker that generated the report at point."
-  (interactive)
-  (let ((c (org-lint--current-checker)))
-    (setf tabulated-list-entries
-         (cl-remove-if (lambda (e) (equal c (org-lint--current-checker e)))
-                       tabulated-list-entries))
-    (tabulated-list-print)))
-
-(defun org-lint--ignore-checker ()
-  "Ignore all reports from checker that generated the report at point.
-Checker will also be ignored in all subsequent reports."
-  (interactive)
-  (setf org-lint--local-checkers
-       (remove (org-lint--current-checker) org-lint--local-checkers))
-  (org-lint--hide-checker))
-
-
-;;; Public function
-
-;;;###autoload
-(defun org-lint (&optional arg)
-  "Check current Org buffer for syntax mistakes.
-
-By default, run all checkers.  With a `\\[universal-argument]' prefix ARG, \
-select one
-category of checkers only.  With a `\\[universal-argument] \
-\\[universal-argument]' prefix, run one precise
-checker by its name.
-
-ARG can also be a list of checker names, as symbols, to run."
-  (interactive "P")
-  (unless (derived-mode-p 'org-mode) (user-error "Not in an Org buffer"))
-  (when (called-interactively-p 'any)
-    (message "Org linting process starting..."))
-  (let ((checkers
-        (pcase arg
-          (`nil org-lint--checkers)
-          (`(4)
-           (let ((category
-                  (completing-read
-                   "Checker category: "
-                   (mapcar #'org-lint-checker-categories org-lint--checkers)
-                   nil t)))
-             (cl-remove-if-not
-              (lambda (c)
-                (assoc-string (org-lint-checker-categories c) category))
-              org-lint--checkers)))
-          (`(16)
-           (list
-            (let ((name (completing-read
-                         "Checker name: "
-                         (mapcar #'org-lint-checker-name org-lint--checkers)
-                         nil t)))
-              (catch 'exit
-                (dolist (c org-lint--checkers)
-                  (when (string= (org-lint-checker-name c) name)
-                    (throw 'exit c)))))))
-          ((pred consp)
-           (cl-remove-if-not (lambda (c) (memq (org-lint-checker-name c) arg))
-                             org-lint--checkers))
-          (_ (user-error "Invalid argument `%S' for `org-lint'" arg)))))
-    (if (not (called-interactively-p 'any))
-       (org-lint--generate-reports (current-buffer) checkers)
-      (org-lint--display-reports (current-buffer) checkers)
-      (message "Org linting process completed"))))
+;;; Checkers declaration
+
+(org-lint-add-checker 'duplicate-custom-id
+  "Report duplicates CUSTOM_ID properties"
+  #'org-lint-duplicate-custom-id
+  :categories '(link))
+
+(org-lint-add-checker 'duplicate-name
+  "Report duplicate NAME values"
+  #'org-lint-duplicate-name
+  :categories '(babel 'link))
+
+(org-lint-add-checker 'duplicate-target
+  "Report duplicate targets"
+  #'org-lint-duplicate-target
+  :categories '(link))
+
+(org-lint-add-checker 'duplicate-footnote-definition
+  "Report duplicate footnote definitions"
+  #'org-lint-duplicate-footnote-definition
+  :categories '(footnote))
+
+(org-lint-add-checker 'orphaned-affiliated-keywords
+  "Report orphaned affiliated keywords"
+  #'org-lint-orphaned-affiliated-keywords
+  :trust 'low)
+
+(org-lint-add-checker 'obsolete-affiliated-keywords
+  "Report obsolete affiliated keywords"
+  #'org-lint-obsolete-affiliated-keywords
+  :categories '(obsolete))
+
+(org-lint-add-checker 'deprecated-export-blocks
+  "Report deprecated export block syntax"
+  #'org-lint-deprecated-export-blocks
+  :trust 'low :categories '(obsolete export))
+
+(org-lint-add-checker 'deprecated-header-syntax
+  "Report deprecated Babel header syntax"
+  #'org-lint-deprecated-header-syntax
+  :trust 'low :categories '(obsolete babel))
+
+(org-lint-add-checker 'missing-language-in-src-block
+  "Report missing language in source blocks"
+  #'org-lint-missing-language-in-src-block
+  :categories '(babel))
+
+(org-lint-add-checker 'missing-backend-in-export-block
+  "Report missing back-end in export blocks"
+  #'org-lint-missing-backend-in-export-block
+  :categories '(export))
+
+(org-lint-add-checker 'invalid-babel-call-block
+  "Report invalid Babel call blocks"
+  #'org-lint-invalid-babel-call-block
+  :categories '(babel))
+
+(org-lint-add-checker 'colon-in-name
+  "Report NAME values with a colon"
+  #'org-lint-colon-in-name
+  :categories '(babel))
+
+(org-lint-add-checker 'wrong-header-argument
+  "Report wrong babel headers"
+  #'org-lint-wrong-header-argument
+  :categories '(babel))
+
+(org-lint-add-checker 'wrong-header-value
+  "Report invalid value in babel headers"
+  #'org-lint-wrong-header-value
+  :categories '(babel) :trust 'low)
+
+(org-lint-add-checker 'deprecated-category-setup
+  "Report misuse of CATEGORY keyword"
+  #'org-lint-deprecated-category-setup
+  :categories '(obsolete))
+
+(org-lint-add-checker 'invalid-coderef-link
+  "Report \"coderef\" links with unknown destination"
+  #'org-lint-invalid-coderef-link
+  :categories '(link))
+
+(org-lint-add-checker 'invalid-custom-id-link
+  "Report \"custom-id\" links with unknown destination"
+  #'org-lint-invalid-custom-id-link
+  :categories '(link))
+
+(org-lint-add-checker 'invalid-fuzzy-link
+  "Report \"fuzzy\" links with unknown destination"
+  #'org-lint-invalid-fuzzy-link
+  :categories '(link))
+
+(org-lint-add-checker 'invalid-id-link
+  "Report \"id\" links with unknown destination"
+  #'org-lint-invalid-id-link
+  :categories '(link))
+
+(org-lint-add-checker 'link-to-local-file
+  "Report links to non-existent local files"
+  #'org-lint-link-to-local-file
+  :categories '(link) :trust 'low)
+
+(org-lint-add-checker 'non-existent-setupfile-parameter
+  "Report SETUPFILE keywords with non-existent file parameter"
+  #'org-lint-non-existent-setupfile-parameter
+  :trust 'low)
+
+(org-lint-add-checker 'wrong-include-link-parameter
+  "Report INCLUDE keywords with misleading link parameter"
+  #'org-lint-wrong-include-link-parameter
+  :categories '(export) :trust 'low)
+
+(org-lint-add-checker 'obsolete-include-markup
+  "Report obsolete markup in INCLUDE keyword"
+  #'org-lint-obsolete-include-markup
+  :categories '(obsolete export) :trust 'low)
+
+(org-lint-add-checker 'unknown-options-item
+  "Report unknown items in OPTIONS keyword"
+  #'org-lint-unknown-options-item
+  :categories '(export) :trust 'low)
+
+(org-lint-add-checker 'invalid-macro-argument-and-template
+  "Report spurious macro arguments or invalid macro templates"
+  #'org-lint-invalid-macro-argument-and-template
+  :categories '(export) :trust 'low)
+
+(org-lint-add-checker 'special-property-in-properties-drawer
+  "Report special properties in properties drawers"
+  #'org-lint-special-property-in-properties-drawer
+  :categories '(properties))
+
+(org-lint-add-checker 'obsolete-properties-drawer
+  "Report obsolete syntax for properties drawers"
+  #'org-lint-obsolete-properties-drawer
+  :categories '(obsolete properties))
+
+(org-lint-add-checker 'invalid-effort-property
+  "Report invalid duration in EFFORT property"
+  #'org-lint-invalid-effort-property
+  :categories '(properties))
+
+(org-lint-add-checker 'undefined-footnote-reference
+  "Report missing definition for footnote references"
+  #'org-lint-undefined-footnote-reference
+  :categories '(footnote))
+
+(org-lint-add-checker 'unreferenced-footnote-definition
+  "Report missing reference for footnote definitions"
+  #'org-lint-unreferenced-footnote-definition
+  :categories '(footnote))
+
+(org-lint-add-checker 'extraneous-element-in-footnote-section
+  "Report non-footnote definitions in footnote section"
+  #'org-lint-extraneous-element-in-footnote-section
+  :categories '(footnote))
+
+(org-lint-add-checker 'invalid-keyword-syntax
+  "Report probable invalid keywords"
+  #'org-lint-invalid-keyword-syntax
+  :trust 'low)
+
+(org-lint-add-checker 'invalid-block
+  "Report invalid blocks"
+  #'org-lint-invalid-block
+  :trust 'low)
+
+(org-lint-add-checker 'misplaced-planning-info
+  "Report misplaced planning info line"
+  #'org-lint-misplaced-planning-info
+  :trust 'low)
+
+(org-lint-add-checker 'incomplete-drawer
+  "Report probable incomplete drawers"
+  #'org-lint-incomplete-drawer
+  :trust 'low)
+
+(org-lint-add-checker 'indented-diary-sexp
+  "Report probable indented diary-sexps"
+  #'org-lint-indented-diary-sexp
+  :trust 'low)
+
+(org-lint-add-checker 'quote-section
+  "Report obsolete QUOTE section"
+  #'org-lint-quote-section
+  :categories '(obsolete) :trust 'low)
+
+(org-lint-add-checker 'file-application
+  "Report obsolete \"file+application\" link"
+  #'org-lint-file-application
+  :categories '(link obsolete))
+
+(org-lint-add-checker 'percent-encoding-link-escape
+  "Report obsolete escape syntax in links"
+  #'org-lint-percent-encoding-link-escape
+  :categories '(link obsolete) :trust 'low)
+
+(org-lint-add-checker 'spurious-colons
+  "Report spurious colons in tags"
+  #'org-lint-spurious-colons
+  :categories '(tags))
+
+(org-lint-add-checker 'non-existent-bibliography
+  "Report invalid bibliography file"
+  #'org-lint-non-existent-bibliography
+  :categories '(cite))
+
+(org-lint-add-checker 'missing-print-bibliography
+  "Report missing \"print_bibliography\" keyword"
+  #'org-lint-missing-print-bibliography
+  :categories '(cite))
+
+(org-lint-add-checker 'invalid-cite-export-declaration
+  "Report invalid value for \"cite_export\" keyword"
+  #'org-lint-invalid-cite-export-declaration
+  :categories '(cite))
+
+(org-lint-add-checker 'incomplete-citation
+  "Report incomplete citation object"
+  #'org-lint-incomplete-citation
+  :categories '(cite) :trust 'low)
 
 (provide 'org-lint)
 
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el
index 978e36ed61..606bdb3d8e 100644
--- a/lisp/org/org-list.el
+++ b/lisp/org/org-list.el
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;;        Bastien Guerry <bzg@gnu.org>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -76,9 +76,14 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org-macs)
 (require 'org-compat)
+(require 'org-fold-core)
+(require 'org-footnote)
 
 (defvar org-M-RET-may-split-line)
 (defvar org-adapt-indentation)
@@ -103,7 +108,7 @@
 (declare-function org-back-to-heading "org" (&optional invisible-ok))
 (declare-function org-before-first-heading-p "org" ())
 (declare-function org-current-level "org" ())
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-interpret-data "org-element" (data))
 (declare-function org-element-lineage "org-element" (blob &optional types 
with-self))
@@ -133,12 +138,13 @@
 (declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
 (declare-function org-level-increment "org" ())
 (declare-function org-mode "org" ())
-(declare-function org-narrow-to-subtree "org" ())
+(declare-function org-narrow-to-subtree "org" (&optional element))
 (declare-function org-outline-level "org" ())
 (declare-function org-previous-line-empty-p "org" ())
 (declare-function org-reduced-level "org" (L))
 (declare-function org-set-tags "org" (tags))
-(declare-function org-show-subtree "org" ())
+(declare-function org-fold-show-subtree "org-fold" ())
+(declare-function org-fold-region "org-fold" (from to flag &optional spec))
 (declare-function org-sort-remove-invisible "org" (S))
 (declare-function org-time-string-to-seconds "org" (s))
 (declare-function org-timer-hms-to-secs "org-timer" (hms))
@@ -233,7 +239,7 @@ interface or run the following code after updating it:
   :type '(choice (const :tag "dot like in \"2.\"" ?.)
                 (const :tag "paren like in \"2)\"" ?\))
                 (const :tag "both" t))
-  :set (lambda (var val) (set var val)
+  :set (lambda (var val) (set-default-toplevel-value var val)
         (when (featurep 'org-element) (org-element-update-syntax))))
 
 (defcustom org-list-allow-alphabetical nil
@@ -251,7 +257,7 @@ interface or run the following code after updating it:
   :group 'org-plain-lists
   :version "24.1"
   :type 'boolean
-  :set (lambda (var val) (set var val)
+  :set (lambda (var val) (set-default-toplevel-value var val)
         (when (featurep 'org-element) (org-element-update-syntax))))
 
 (defcustom org-list-two-spaces-after-bullet-regexp nil
@@ -406,7 +412,7 @@ group 4: description tag")
           (ind-ref (if (or (looking-at "^[ \t]*$")
                            (and inlinetask-re (looking-at inlinetask-re)))
                        10000
-                     (current-indentation))))
+                     (org-current-text-indentation))))
       (cond
        ((eq (nth 2 context) 'invalid) nil)
        ((looking-at item-re) (point))
@@ -428,7 +434,7 @@ group 4: description tag")
        ;; Look for an item, less indented that reference line.
        (catch 'exit
          (while t
-           (let ((ind (current-indentation)))
+           (let ((ind (org-current-text-indentation)))
              (cond
               ;; This is exactly what we want.
               ((and (looking-at item-re) (< ind ind-ref))
@@ -598,7 +604,7 @@ Assume point is at an item."
           (item-re (org-item-re))
           (inlinetask-re (and (featurep 'org-inlinetask)
                               (org-inlinetask-outline-regexp)))
-          (beg-cell (cons (point) (current-indentation)))
+          (beg-cell (cons (point) (org-current-text-indentation)))
            itm-lst itm-lst-2 end-lst end-lst-2 struct
           (assoc-at-point
            ;; Return association at point.
@@ -624,7 +630,7 @@ Assume point is at an item."
       (save-excursion
        (catch 'exit
          (while t
-           (let ((ind (current-indentation)))
+           (let ((ind (org-current-text-indentation)))
              (cond
               ((<= (point) lim-up)
                ;; At upward limit: if we ended at an item, store it,
@@ -684,7 +690,7 @@ Assume point is at an item."
       ;;    position of items in END-LST-2.
       (catch 'exit
        (while t
-         (let ((ind (current-indentation)))
+         (let ((ind (org-current-text-indentation)))
            (cond
             ((>= (point) lim-down)
              ;; At downward limit: this is de facto the end of the
@@ -1089,79 +1095,64 @@ to the same sub-list.
 
 This function modifies STRUCT."
   (save-excursion
-    (let* ((end-A-no-blank (org-list-get-item-end-before-blank beg-A struct))
-          (end-B-no-blank (org-list-get-item-end-before-blank beg-B struct))
-          (end-A (org-list-get-item-end beg-A struct))
-          (end-B (org-list-get-item-end beg-B struct))
-          (size-A (- end-A-no-blank beg-A))
-          (size-B (- end-B-no-blank beg-B))
-          (body-A (buffer-substring beg-A end-A-no-blank))
-          (body-B (buffer-substring beg-B end-B-no-blank))
-          (between-A-no-blank-and-B (buffer-substring end-A-no-blank beg-B))
-          (sub-A (cons beg-A (org-list-get-subtree beg-A struct)))
-          (sub-B (cons beg-B (org-list-get-subtree beg-B struct)))
-          ;; Store overlays responsible for visibility status.  We
-          ;; also need to store their boundaries as they will be
-          ;; removed from buffer.
-          (overlays
-           (cons
-            (delq nil
-                  (mapcar (lambda (o)
-                            (and (>= (overlay-start o) beg-A)
-                                 (<= (overlay-end o) end-A)
-                                 (list o (overlay-start o) (overlay-end o))))
-                          (overlays-in beg-A end-A)))
-            (delq nil
-                  (mapcar (lambda (o)
-                            (and (>= (overlay-start o) beg-B)
-                                 (<= (overlay-end o) end-B)
-                                 (list o (overlay-start o) (overlay-end o))))
-                          (overlays-in beg-B end-B))))))
-      ;; 1. Move effectively items in buffer.
-      (goto-char beg-A)
-      (delete-region beg-A end-B-no-blank)
-      (insert (concat body-B between-A-no-blank-and-B body-A))
-      ;; 2. Now modify struct.  No need to re-read the list, the
-      ;;    transformation is just a shift of positions.  Some special
-      ;;    attention is required for items ending at END-A and END-B
-      ;;    as empty spaces are not moved there.  In others words,
-      ;;    item BEG-A will end with whitespaces that were at the end
-      ;;    of BEG-B and the same applies to BEG-B.
-      (dolist (e struct)
-       (let ((pos (car e)))
-         (cond
-          ((< pos beg-A))
-          ((memq pos sub-A)
-           (let ((end-e (nth 6 e)))
-             (setcar e (+ pos (- end-B-no-blank end-A-no-blank)))
-             (setcar (nthcdr 6 e)
-                     (+ end-e (- end-B-no-blank end-A-no-blank)))
-             (when (= end-e end-A) (setcar (nthcdr 6 e) end-B))))
-          ((memq pos sub-B)
-           (let ((end-e (nth 6 e)))
-             (setcar e (- (+ pos beg-A) beg-B))
-             (setcar (nthcdr 6 e) (+ end-e (- beg-A beg-B)))
-             (when (= end-e end-B)
-               (setcar (nthcdr 6 e)
-                       (+ beg-A size-B (- end-A end-A-no-blank))))))
-          ((< pos beg-B)
-           (let ((end-e (nth 6 e)))
-             (setcar e (+ pos (- size-B size-A)))
-             (setcar (nthcdr 6 e) (+ end-e (- size-B size-A))))))))
-      (setq struct (sort struct #'car-less-than-car))
-      ;; Restore visibility status, by moving overlays to their new
-      ;; position.
-      (dolist (ov (car overlays))
-       (move-overlay
-        (car ov)
-        (+ (nth 1 ov) (- (+ beg-B (- size-B size-A)) beg-A))
-        (+ (nth 2 ov) (- (+ beg-B (- size-B size-A)) beg-A))))
-      (dolist (ov (cdr overlays))
-       (move-overlay (car ov)
-                     (+ (nth 1 ov) (- beg-A beg-B))
-                     (+ (nth 2 ov) (- beg-A beg-B))))
-      ;; Return structure.
-      struct)))
+    (org-fold-core-ignore-modifications
+      (let* ((end-A-no-blank (org-list-get-item-end-before-blank beg-A struct))
+            (end-B-no-blank (org-list-get-item-end-before-blank beg-B struct))
+            (end-A (org-list-get-item-end beg-A struct))
+            (end-B (org-list-get-item-end beg-B struct))
+            (size-A (- end-A-no-blank beg-A))
+            (size-B (- end-B-no-blank beg-B))
+            (body-A (buffer-substring beg-A end-A-no-blank))
+            (body-B (buffer-substring beg-B end-B-no-blank))
+            (between-A-no-blank-and-B (buffer-substring end-A-no-blank beg-B))
+            (sub-A (cons beg-A (org-list-get-subtree beg-A struct)))
+            (sub-B (cons beg-B (org-list-get-subtree beg-B struct)))
+            ;; Store inner folds responsible for visibility status.
+            (folds
+             (cons
+               (org-fold-core-get-regions :from beg-A :to end-A :relative t)
+               (org-fold-core-get-regions :from beg-B :to end-B :relative t))))
+        ;; Clear up the folds.
+        (org-fold-region beg-A end-B-no-blank nil)
+        ;; 1. Move effectively items in buffer.
+        (goto-char beg-A)
+        (delete-region beg-A end-B-no-blank)
+        (insert (concat body-B between-A-no-blank-and-B body-A))
+        ;; Restore visibility status.
+        (org-fold-core-regions (cdr folds) :relative beg-A)
+        (org-fold-core-regions
+         (car folds)
+         :relative (+ beg-B (- size-B size-A (length 
between-A-no-blank-and-B))))
+        ;; 2. Now modify struct.  No need to re-read the list, the
+        ;;    transformation is just a shift of positions.  Some special
+        ;;    attention is required for items ending at END-A and END-B
+        ;;    as empty spaces are not moved there.  In others words,
+        ;;    item BEG-A will end with whitespaces that were at the end
+        ;;    of BEG-B and the same applies to BEG-B.
+        (dolist (e struct)
+         (let ((pos (car e)))
+           (cond
+            ((< pos beg-A))
+            ((memq pos sub-A)
+             (let ((end-e (nth 6 e)))
+               (setcar e (+ pos (- end-B-no-blank end-A-no-blank)))
+               (setcar (nthcdr 6 e)
+                       (+ end-e (- end-B-no-blank end-A-no-blank)))
+               (when (= end-e end-A) (setcar (nthcdr 6 e) end-B))))
+            ((memq pos sub-B)
+             (let ((end-e (nth 6 e)))
+               (setcar e (- (+ pos beg-A) beg-B))
+               (setcar (nthcdr 6 e) (+ end-e (- beg-A beg-B)))
+               (when (= end-e end-B)
+                 (setcar (nthcdr 6 e)
+                         (+ beg-A size-B (- end-A end-A-no-blank))))))
+            ((< pos beg-B)
+             (let ((end-e (nth 6 e)))
+               (setcar e (+ pos (- size-B size-A)))
+               (setcar (nthcdr 6 e) (+ end-e (- size-B size-A))))))))
+        (setq struct (sort struct #'car-less-than-car))
+        ;; Return structure.
+        struct))))
 
 (defun org-list-separating-blank-lines-number (pos struct prevs)
   "Return number of blank lines that should separate items in list.
@@ -1850,7 +1841,7 @@ Initial position of cursor is restored after the changes."
                (org-inlinetask-goto-beginning))
               ;; Shift only non-empty lines.
               ((looking-at-p "^[ \t]*\\S-")
-               (indent-line-to (+ (current-indentation) delta))))
+               (indent-line-to (+ (org-current-text-indentation) delta))))
              (forward-line -1))))
         (modify-item
          ;; Replace ITEM first line elements with new elements from
@@ -1858,7 +1849,7 @@ Initial position of cursor is restored after the changes."
          (lambda (item)
            (goto-char item)
            (let* ((new-ind (org-list-get-ind item struct))
-                  (old-ind (current-indentation))
+                  (old-ind (org-current-text-indentation))
                   (new-bul (org-list-bullet-string
                             (org-list-get-bullet item struct)))
                   (old-bul (org-list-get-bullet item old-struct))
@@ -1866,7 +1857,22 @@ Initial position of cursor is restored after the 
changes."
              (looking-at org-list-full-item-re)
              ;; a.  Replace bullet
              (unless (equal old-bul new-bul)
-               (replace-match new-bul nil nil nil 1))
+                (let ((keep-space ""))
+                  (save-excursion
+                    ;; If origin is inside the bullet, preserve the
+                    ;; spaces after origin.
+                    (when (<= (match-beginning 1) origin (match-end 1))
+                      (org-with-point-at origin
+                        (save-match-data
+                          (when (looking-at "[ \t]+")
+                            (setq keep-space (match-string 0))))))
+                    (replace-match "" nil nil nil 1)
+                    (goto-char (match-end 1))
+                    (insert-before-markers new-bul)
+                    (insert keep-space))))
+              ;; Refresh potentially shifted match markers.
+              (goto-char item)
+              (looking-at org-list-full-item-re)
              ;; b.  Replace checkbox.
              (cond
               ((equal (match-string 3) new-box))
@@ -1933,7 +1939,7 @@ Initial position of cursor is restored after the changes."
                        ;; Ignore empty lines.  Also ignore blocks and
                        ;; drawers contents.
                        (unless (looking-at-p "[ \t]*$")
-                         (setq min-ind (min (current-indentation) min-ind))
+                         (setq min-ind (min (org-current-text-indentation) 
min-ind))
                          (cond
                           ((and (looking-at "#\\+BEGIN\\(:\\|_\\S-+\\)")
                                 (re-search-forward
@@ -2029,7 +2035,7 @@ Possible values are: `folded', `children' or `subtree'.  
See
    ((eq view 'folded)
     (let ((item-end (org-list-get-item-end-before-blank item struct)))
       ;; Hide from eol
-      (org-flag-region (save-excursion (goto-char item) (line-end-position))
+      (org-fold-region (save-excursion (goto-char item) (line-end-position))
                       item-end t 'outline)))
    ((eq view 'children)
     ;; First show everything.
@@ -2042,7 +2048,7 @@ Possible values are: `folded', `children' or `subtree'.  
See
    ((eq view 'subtree)
     ;; Show everything
     (let ((item-end (org-list-get-item-end item struct)))
-      (org-flag-region item item-end nil 'outline)))))
+      (org-fold-region item item-end nil 'outline)))))
 
 (defun org-list-item-body-column (item)
   "Return column at which body of ITEM should start."
@@ -2212,6 +2218,7 @@ item is invisible."
          (setq struct (org-list-insert-item pos struct prevs checkbox desc))
          (org-list-write-struct struct (org-list-parents-alist struct))
          (when checkbox (org-update-checkbox-count-maybe))
+          (beginning-of-line)
          (looking-at org-list-full-item-re)
          (goto-char (if (and (match-beginning 4)
                              (save-match-data
@@ -2240,12 +2247,19 @@ is an integer, 0 means `-', 1 means `+' etc.  If WHICH 
is
 `previous', cycle backwards."
   (interactive "P")
   (unless (org-at-item-p) (error "Not at an item"))
-  (save-excursion
+  (let ((origin (point-marker)))
     (beginning-of-line)
     (let* ((struct (org-list-struct))
            (parents (org-list-parents-alist struct))
            (prevs (org-list-prevs-alist struct))
            (list-beg (org-list-get-first-item (point) struct prevs))
+           ;; Record relative point position to bullet beginning.
+           (origin-offset (- origin
+                             (+ (point) (org-list-get-ind (point) struct))))
+           ;; Record relative point position to bullet end.
+           (origin-offset2 (- origin
+                              (+ (point) (org-list-get-ind (point) struct)
+                                 (length (org-list-get-bullet (point) 
struct)))))
            (bullet (org-list-get-bullet list-beg struct))
           (alpha-p (org-list-use-alpha-bul-p list-beg struct prevs))
           (case-fold-search nil)
@@ -2291,7 +2305,24 @@ is an integer, 0 means `-', 1 means `+' etc.  If WHICH is
         (org-list-set-bullet list-beg struct (org-list-bullet-string new))
         (org-list-struct-fix-bul struct prevs)
         (org-list-struct-fix-ind struct parents)
-        (org-list-struct-apply-struct struct old-struct)))))
+        (org-list-struct-apply-struct struct old-struct))
+      (goto-char origin)
+      (setq struct (org-list-struct))
+      (cond
+       ((>= origin-offset2 0)
+        (beginning-of-line)
+        (move-marker origin (+ (point)
+                               (org-list-get-ind (point) struct)
+                               (length (org-list-get-bullet (point) struct))
+                               origin-offset2))
+        (goto-char origin))
+       ((>= origin-offset 0)
+        (beginning-of-line)
+        (move-marker origin (+ (point)
+                               (org-list-get-ind (point) struct)
+                               origin-offset))
+        (goto-char origin)))
+      (move-marker origin nil))))
 
 ;;;###autoload
 (define-minor-mode org-list-checkbox-radio-mode
@@ -2455,7 +2486,7 @@ subtree, ignoring planning line and any drawer following 
it."
     (save-restriction
       (save-excursion
        (org-narrow-to-subtree)
-       (org-show-subtree)
+       (org-fold-show-subtree)
        (goto-char (point-min))
        (let ((end (point-max)))
          (while (< (point) end)
@@ -2910,7 +2941,7 @@ function is being called interactively."
                   (error "Missing key extractor"))))
         (sort-func
          (cond
-          ((= dcst ?a) #'org-string-collate-lessp)
+          ((= dcst ?a) #'string-collate-lessp)
           ((= dcst ?f)
            (or compare-func
                (and interactive?
@@ -2991,7 +3022,38 @@ If it is an item, convert all items to normal lines.
 If it is normal text, change region into a list of items.
 With a prefix argument ARG, change the region in a single item."
   (interactive "P")
-  (let ((shift-text
+  (let ((extract-footnote-definitions
+         (lambda (end)
+           ;; Remove footnote definitions from point to END.
+           ;; Return the list of the extracted definitions.
+           (let (definitions element)
+             (save-excursion
+               (while (re-search-forward org-footnote-definition-re end t)
+                 (setq element (org-element-at-point))
+                 (when (eq 'footnote-definition
+                           (org-element-type element))
+                   (push (buffer-substring-no-properties
+                          (org-element-property :begin element)
+                          (org-element-property :end element))
+                         definitions)
+                   ;; Ensure at least 2 blank lines after the last
+                   ;; footnote definition, thus not slurping the
+                   ;; following element.
+                   (unless (<= 2 (org-element-property
+                                 :post-blank
+                                 (org-element-at-point)))
+                     (setf (car definitions)
+                           (concat (car definitions)
+                                   (make-string
+                                    (- 2 (org-element-property
+                                          :post-blank
+                                          (org-element-at-point)))
+                                    ?\n))))
+                   (delete-region
+                    (org-element-property :begin element)
+                    (org-element-property :end element))))
+               definitions))))
+        (shift-text
         (lambda (ind end)
           ;; Shift text in current section to IND, from point to END.
           ;; The function leaves point to END line.
@@ -3001,7 +3063,7 @@ With a prefix argument ARG, change the region in a single 
item."
             (save-excursion
               (catch 'exit
                 (while (< (point) end)
-                  (let ((i (current-indentation)))
+                  (let ((i (org-current-text-indentation)))
                     (cond
                      ;; Skip blank lines and inline tasks.
                      ((looking-at "^[ \t]*$"))
@@ -3017,7 +3079,7 @@ With a prefix argument ARG, change the region in a single 
item."
               (while (< (point) end)
                 (unless (or (looking-at "^[ \t]*$")
                             (looking-at org-outline-regexp-bol))
-                  (indent-line-to (+ (current-indentation) delta)))
+                  (indent-line-to (+ (org-current-text-indentation) delta)))
                 (forward-line))))))
        (skip-blanks
         (lambda (pos)
@@ -3049,7 +3111,7 @@ With a prefix argument ARG, change the region in a single 
item."
             (skip-chars-forward " \t")
             (delete-region (point) (match-end 0)))
           (forward-line)))
-       ;; Case 2. Start at an heading: convert to items.
+       ;; Case 2. Start at a heading: convert to items.
        ((org-at-heading-p)
         ;; Remove metadata
         (let (org-loop-over-headlines-in-active-region)
@@ -3065,7 +3127,9 @@ With a prefix argument ARG, change the region in a single 
item."
                              (t (length (match-string 0))))))
                ;; Level of first heading.  Further headings will be
                ;; compared to it to determine hierarchy in the list.
-               (ref-level (org-reduced-level (org-outline-level))))
+               (ref-level (org-reduced-level (org-outline-level)))
+                (footnote-definitions
+                 (funcall extract-footnote-definitions end)))
           (while (< (point) end)
             (let* ((level (org-reduced-level (org-outline-level)))
                    (delta (max 0 (- level ref-level)))
@@ -3094,8 +3158,8 @@ With a prefix argument ARG, change the region in a single 
item."
                        "[X]"
                      "[ ]"))
                   (org-list-write-struct struct
-                                         (org-list-parents-alist struct)
-                                         old)))
+                                 (org-list-parents-alist struct)
+                                 old)))
               ;; Ensure all text down to END (or SECTION-END) belongs
               ;; to the newly created item.
               (let ((section-end (save-excursion
@@ -3103,13 +3167,23 @@ With a prefix argument ARG, change the region in a 
single item."
                 (forward-line)
                 (funcall shift-text
                          (+ start-ind (* (1+ delta) bul-len))
-                         (min end section-end)))))))
+                         (min end section-end)))))
+           (when footnote-definitions
+             (goto-char end)
+             ;; Insert footnote definitions after the list.
+             (unless (bolp) (beginning-of-line 2))
+             ;; At (point-max).
+             (unless (bolp) (insert "\n"))
+             (dolist (def footnote-definitions)
+               (insert def)))))
        ;; Case 3. Normal line with ARG: make the first line of region
        ;;         an item, and shift indentation of others lines to
        ;;         set them as item's body.
        (arg (let* ((bul (org-list-bullet-string "-"))
                    (bul-len (length bul))
-                   (ref-ind (current-indentation)))
+                   (ref-ind (org-current-text-indentation))
+                    (footnote-definitions
+                     (funcall extract-footnote-definitions end)))
               (skip-chars-forward " \t")
               (insert bul)
               (forward-line)
@@ -3120,7 +3194,21 @@ With a prefix argument ARG, change the region in a 
single item."
                          (+ ref-ind bul-len)
                          (min end (save-excursion (or (outline-next-heading)
                                                       (point)))))
-                (forward-line))))
+                (forward-line))
+               (when footnote-definitions
+                 ;; If the new list is followed by same-level items,
+                 ;; move past them as well.
+                 (goto-char (org-element-property
+                             :end
+                             (org-element-lineage
+                              (org-element-at-point (1- end))
+                              '(plain-list) t)))
+                 ;; Insert footnote definitions after the list.
+                 (unless (bolp) (beginning-of-line 2))
+                 ;; At (point-max).
+                 (unless (bolp) (insert "\n"))
+                 (dolist (def footnote-definitions)
+                   (insert def)))))
        ;; Case 4. Normal line without ARG: turn each non-item line
        ;;         into an item.
        (t
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
index b58c51f3fb..a7fb8f858e 100644
--- a/lisp/org/org-macro.el
+++ b/lisp/org/org-macro.el
@@ -46,22 +46,28 @@
 ;; {{{email}}} and {{{title}}} macros.
 
 ;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org-macs)
 (require 'org-compat)
 
 (declare-function org-collect-keywords "org" (keywords &optional unique 
directory))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-copy "org-element" (datum))
 (declare-function org-element-macro-parser "org-element" ())
+(declare-function org-element-keyword-parser "org-element" (limit affiliated))
+(declare-function org-element-put-property "org-element" (element property 
value))
 (declare-function org-element-parse-secondary-string "org-element" (string 
restriction &optional parent))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-restriction "org-element" (element))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-entry-get "org" (pom property &optional inherit 
literal-nil))
 (declare-function org-file-contents "org" (file &optional noerror nocache))
-(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
+(declare-function org-in-commented-heading-p "org" (&optional no-inheritance 
element))
 (declare-function org-link-search "ol" (s &optional avoid-pos stealth))
 (declare-function org-mode "org" ())
 (declare-function vc-backend "vc-hooks" (f))
@@ -239,6 +245,13 @@ a definition in TEMPLATES."
                     (goto-char (match-beginning 0))
                     (org-element-macro-parser))))))
           (when macro
+             ;; `:parent' property might change as we modify buffer.
+             ;; We do not care about it when checking for circular
+             ;; dependencies.  So, setting `:parent' to nil making sure
+             ;; that actual macro element (if org-element-cache is
+             ;; active) is unchanged.
+             (setq macro (cl-copy-list macro))
+             (org-element-put-property macro :parent nil)
             (let* ((key (org-element-property :key macro))
                    (value (org-macro-expand macro templates))
                    (begin (org-element-property :begin macro))
@@ -338,7 +351,7 @@ in the buffer."
          (result nil))
       (catch :exit
        (while (re-search-forward regexp nil t)
-         (let ((element (org-element-at-point)))
+         (let ((element (org-with-point-at (match-beginning 0) 
(org-element-keyword-parser (line-end-position) (list (match-beginning 0))))))
            (when (eq 'keyword (org-element-type element))
              (let ((value (org-element-property :value element)))
                (if (not collect) (throw :exit value)
@@ -355,12 +368,13 @@ Return value as a string."
             (not (cdr date))
             (eq 'timestamp (org-element-type (car date))))
        (format "(eval (if (org-string-nw-p $1) %s %S))"
-               (format "(org-timestamp-format '%S $1)"
+               (format "(org-format-timestamp '%S $1)"
                        (org-element-copy (car date)))
                value)
       value)))
 
 (defun org-macro--vc-modified-time (file)
+  (require 'vc) ; Not everything we need is autoloaded.
   (save-window-excursion
     (when (vc-backend file)
       (let ((buf (get-buffer-create " *org-vc*"))
@@ -378,7 +392,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 (org-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 cf0eb48f2d..0c6a2173d2 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -34,13 +34,71 @@
 (require 'cl-lib)
 (require 'format-spec)
 
+;;; Org version verification.
+
+(defmacro org-assert-version ()
+  "Assert compile time and runtime version match."
+  ;; We intentionally use a more permissive `org-release' instead of
+  ;; `org-git-version' to work around deficiencies in Elisp
+  ;; compilation after pulling latest changes.  Unchanged files will
+  ;; not be re-compiled and thus their macro-expanded
+  ;; `org-assert-version' calls would fail using strict
+  ;; `org-git-version' check because the generated Org version strings
+  ;; will not match.
+  `(unless (equal (org-release) ,(org-release))
+     (warn "Org version mismatch.  Make sure that correct `load-path' is set 
early in init.el
+This warning usually appears when a built-in Org version is loaded
+prior to the more recent Org version.
+
+Version mismatch is commonly encountered in the following situations:
+
+1. Emacs is loaded using literate Org config and more recent Org
+   version is loaded inside the file loaded by `org-babel-load-file'.
+   `org-babel-load-file' triggers the built-in Org version clashing
+   the newer Org version attempt to be loaded later.
+
+   It is recommended to move the Org loading code before the
+   `org-babel-load-file' call.
+
+2. New Org version is loaded manually by setting `load-path', but some
+   other package depending on Org is loaded before the `load-path' is
+   configured.
+   This \"other package\" is triggering built-in Org version, again
+   causing the version mismatch.
+
+   It is recommended to set `load-path' as early in the config as
+   possible.
+
+3. New Org version is loaded using straight.el package manager and
+   other package depending on Org is loaded before straight triggers
+   loading of the newer Org version.
+
+   It is recommended to put
+    (straight-use-package 'org)
+   early in the config.  Ideally, right after the straight.el
+   bootstrap.  Moving `use-package' :straight declaration may not be
+   sufficient if the corresponding `use-package' statement is
+   deferring the loading.")
+     (error "Org version mismatch.  Make sure that correct `load-path' is set 
early in init.el")))
+
+;; We rely on org-macs when generating Org version.  Checking Org
+;; version here will interfere with Org build process.
+;; (org-assert-version)
+
 (declare-function org-mode "org" ())
-(declare-function org-show-context "org" (&optional key))
-(declare-function org-string-collate-lessp "org-compat" (s1 s2 &optional 
locale ignore-case))
+(declare-function org-agenda-files "org" (&optional unrestricted archives))
+(declare-function org-time-string-to-seconds "org" (s))
+(declare-function org-fold-show-context "org-fold" (&optional key))
+(declare-function org-fold-save-outline-visibility "org-fold" (use-markers 
&rest body))
+(declare-function org-fold-next-visibility-change "org-fold" (&optional pos 
limit ignore-hidden-p previous-p))
+(declare-function org-fold-core-with-forced-fontification "org-fold" (&rest 
body))
+(declare-function org-fold-folded-p "org-fold" (&optional pos limit 
ignore-hidden-p previous-p))
+(declare-function string-collate-lessp "org-compat" (s1 s2 &optional locale 
ignore-case))
 (declare-function org-time-convert-to-integer "org-compat" (time))
 
 (defvar org-ts-regexp0)
 (defvar ffap-url-regexp)
+(defvar org-fold-core-style)
 
 
 ;;; Macros
@@ -65,16 +123,12 @@
             ,@body)
         (set-buffer-modified-p ,was-modified)))))
 
-(defmacro org-without-partial-completion (&rest body)
-  (declare (debug (body)))
-  `(if (and (boundp 'partial-completion-mode)
-           partial-completion-mode
-           (fboundp 'partial-completion-mode))
-       (unwind-protect
-          (progn
-            (partial-completion-mode -1)
-            ,@body)
-        (partial-completion-mode 1))
+(defmacro org-with-base-buffer (buffer &rest body)
+  "Run BODY in base buffer for BUFFER.
+If BUFFER is nil, use base buffer for `current-buffer'."
+  (declare (debug (body)) (indent 1))
+  `(with-current-buffer (or (buffer-base-buffer ,buffer)
+                            (or ,buffer (current-buffer)))
      ,@body))
 
 (defmacro org-with-point-at (pom &rest body)
@@ -118,38 +172,7 @@
   (declare (debug (body)))
   `(let ((inhibit-read-only t)) ,@body))
 
-(defmacro org-save-outline-visibility (use-markers &rest body)
-  "Save and restore outline visibility around BODY.
-If USE-MARKERS is non-nil, use markers for the positions.  This
-means that the buffer may change while running BODY, but it also
-means that the buffer should stay alive during the operation,
-because otherwise all these markers will point to nowhere."
-  (declare (debug (form body)) (indent 1))
-  (org-with-gensyms (data invisible-types markers?)
-    `(let* ((,invisible-types '(org-hide-block outline))
-           (,markers? ,use-markers)
-           (,data
-            (mapcar (lambda (o)
-                      (let ((beg (overlay-start o))
-                            (end (overlay-end o))
-                            (type (overlay-get o 'invisible)))
-                        (and beg end
-                             (> end beg)
-                             (memq type ,invisible-types)
-                             (list (if ,markers? (copy-marker beg) beg)
-                                   (if ,markers? (copy-marker end t) end)
-                                   type))))
-                    (org-with-wide-buffer
-                     (overlays-in (point-min) (point-max))))))
-       (unwind-protect (progn ,@body)
-        (org-with-wide-buffer
-         (dolist (type ,invisible-types)
-           (remove-overlays (point-min) (point-max) 'invisible type))
-         (pcase-dolist (`(,beg ,end ,type) (delq nil ,data))
-           (org-flag-region beg end t type)
-           (when ,markers?
-             (set-marker beg nil)
-             (set-marker end nil))))))))
+(defalias 'org-save-outline-visibility #'org-fold-save-outline-visibility)
 
 (defmacro org-with-wide-buffer (&rest body)
   "Execute body while temporarily widening the buffer."
@@ -192,27 +215,31 @@ because otherwise all these markers will point to 
nowhere."
             (and (re-search-backward "^[ \t]*# +Local Variables:"
                                      (max (- (point) 3000) 1)
                                      t)
-                 (delete-and-extract-region (point) (point-max)))))))
+               (let ((buffer-undo-list t))
+                (delete-and-extract-region (point) (point-max)))))))
+         (tick-counter-before (buffer-modified-tick)))
      (unwind-protect (progn ,@body)
        (when local-variables
         (org-with-wide-buffer
          (goto-char (point-max))
-         ;; If last section is folded, make sure to also hide file
-         ;; local variables after inserting them back.
-         (let ((overlay
-                (cl-find-if (lambda (o)
-                              (eq 'outline (overlay-get o 'invisible)))
-                            (overlays-at (1- (point))))))
-           (unless (bolp) (insert "\n"))
+         (unless (bolp) (insert "\n"))
+          (let ((modified (< tick-counter-before (buffer-modified-tick)))
+                (buffer-undo-list t))
            (insert local-variables)
-           (when overlay
-             (move-overlay overlay (overlay-start overlay) (point-max)))))))))
+            (unless modified
+              (restore-buffer-modified-p nil))))))))
 
 (defmacro org-no-popups (&rest body)
   "Suppress popup windows and evaluate BODY."
   `(let (pop-up-frames pop-up-windows)
      ,@body))
 
+(defmacro org-element-with-disabled-cache (&rest body)
+  "Run BODY without active org-element-cache."
+  (declare (debug (form body)) (indent 0))
+  `(cl-letf (((symbol-function #'org-element--cache-active-p) (lambda (&rest 
_) nil)))
+     ,@body))
+
 
 ;;; Buffer and windows
 
@@ -242,32 +269,74 @@ WINDOW defaults to the selected window.  MAX-HEIGHT and 
MIN-HEIGHT are
 passed through to `fit-window-to-buffer'.  If SHRINK-ONLY is set, call
 `shrink-window-if-larger-than-buffer' instead, the height limit is
 ignored in this case."
-  (cond ((if (fboundp 'window-full-width-p)
-             (not (window-full-width-p window))
-           ;; Do nothing if another window would suffer.
-           (> (frame-width) (window-width window))))
-        ((and (fboundp 'fit-window-to-buffer) (not shrink-only))
+  (cond ((not (window-full-width-p window))
+         ;; Do nothing if another window would suffer.
+         )
+        ((not shrink-only)
          (fit-window-to-buffer window max-height min-height))
-        ((fboundp 'shrink-window-if-larger-than-buffer)
-         (shrink-window-if-larger-than-buffer window)))
+        (t (shrink-window-if-larger-than-buffer window)))
   (or window (selected-window)))
 
+(defun org-buffer-list (&optional predicate exclude-tmp)
+  "Return a list of Org buffers.
+PREDICATE can be `export', `files' or `agenda'.
+
+export   restrict the list to Export buffers.
+files    restrict the list to buffers visiting Org files.
+agenda   restrict the list to buffers visiting agenda files.
+
+If EXCLUDE-TMP is non-nil, ignore temporary buffers."
+  (let* ((bfn nil)
+        (agenda-files (and (eq predicate 'agenda)
+                           (mapcar 'file-truename (org-agenda-files t))))
+        (filter
+         (cond
+          ((eq predicate 'files)
+           (lambda (b) (with-current-buffer b (derived-mode-p 'org-mode))))
+          ((eq predicate 'export)
+           (lambda (b) (string-match "\\*Org .*Export" (buffer-name b))))
+          ((eq predicate 'agenda)
+           (lambda (b)
+             (with-current-buffer b
+               (and (derived-mode-p 'org-mode)
+                    (setq bfn (buffer-file-name b))
+                    (member (file-truename bfn) agenda-files)))))
+          (t (lambda (b) (with-current-buffer b
+                           (or (derived-mode-p 'org-mode)
+                               (string-match "\\*Org .*Export"
+                                             (buffer-name b)))))))))
+    (delq nil
+         (mapcar
+          (lambda(b)
+            (if (and (funcall filter b)
+                     (or (not exclude-tmp)
+                         (not (string-match "tmp" (buffer-name b)))))
+                b
+              nil))
+          (buffer-list)))))
+
 
 
 ;;; File
 
 (defun org-file-newer-than-p (file time)
-  "Non-nil if FILE is newer than TIME.
-FILE is a filename, as a string, TIME is a Lisp time value, as
-returned by, e.g., `current-time'."
-  (and (file-exists-p file)
-       ;; Only compare times up to whole seconds as some file-systems
-       ;; (e.g. HFS+) do not retain any finer granularity.  As
-       ;; a consequence, make sure we return non-nil when the two
-       ;; times are equal.
-       (not (time-less-p (org-time-convert-to-integer
-                         (nth 5 (file-attributes file)))
-                        (org-time-convert-to-integer time)))))
+  "Non-nil if FILE modification time is greater than TIME.
+TIME should be obtained earlier for the same FILE name using
+
+  \(file-attribute-modification-time (file-attributes file))
+
+If TIME is nil (file did not exist) then any existing FILE
+is considered as a newer one.  Some file systems have coarse
+timestamp resolution, for example 1 second on HFS+ or 2 seconds on FAT,
+so nil may be returned when file is updated twice within a short period
+of time.  File timestamp and system clock `current-time' may have
+different resolution, so attempts to compare them may give unexpected
+results.
+
+Consider `file-newer-than-file-p' to check up to date state
+in target-prerequisite files relation."
+  (let ((mtime (file-attribute-modification-time (file-attributes file))))
+    (and mtime (or (not time) (time-less-p time mtime)))))
 
 (defun org-compile-file (source process ext &optional err-msg log-buf spec)
   "Compile a SOURCE file using PROCESS.
@@ -301,7 +370,7 @@ it for output."
         (full-name (file-truename source))
         (out-dir (or (file-name-directory source) "./"))
         (output (expand-file-name (concat base-name "." ext) out-dir))
-        (time (current-time))
+        (time (file-attribute-modification-time (file-attributes output)))
         (err-msg (if (stringp err-msg) (concat ".  " err-msg) "")))
     (save-window-excursion
       (pcase process
@@ -314,8 +383,13 @@ it for output."
                               (?F . ,(shell-quote-argument full-name))
                               (?o . ,(shell-quote-argument out-dir))
                               (?O . ,(shell-quote-argument output))))))
-          (dolist (command process)
-            (shell-command (format-spec command spec) log-buf))
+           ;; Combine output of all commands in PROCESS.
+           (with-current-buffer log-buf
+             (let (buffer-read-only)
+               (erase-buffer)))
+           (let ((shell-command-dont-erase-buffer t))
+            (dolist (command process)
+              (shell-command (format-spec command spec) log-buf)))
           (when log-buf (with-current-buffer log-buf (compilation-mode)))))
        (_ (error "No valid command to process %S%s" source err-msg))))
     ;; Check for process failure.  Output file is expected to be
@@ -328,6 +402,11 @@ it for output."
 
 ;;; Indentation
 
+(defmacro org-current-text-indentation ()
+  "Like `current-indentation', but ignore display/invisible properties."
+  `(let ((buffer-invisibility-spec nil))
+     (current-indentation)))
+
 (defun org-do-remove-indentation (&optional n skip-fl)
   "Remove the maximum common indentation from the buffer.
 When optional argument N is a positive integer, remove exactly
@@ -342,7 +421,7 @@ line.  Return nil if it fails."
                   (save-excursion
                      (when skip-fl (forward-line))
                     (while (re-search-forward "^[ \t]*\\S-" nil t)
-                      (let ((ind (current-indentation)))
+                      (let ((ind (org-current-text-indentation)))
                         (if (zerop ind) (throw :exit nil)
                           (setq min-ind (min min-ind ind))))))
                   min-ind))))
@@ -521,7 +600,7 @@ is selected, only the bare key is returned."
 For example, in this alist:
 
 \(org-uniquify-alist \\='((a 1) (b 2) (a 3)))
-  => \\='((a 1 3) (b 2))
+  => ((a 1 3) (b 2))
 
 merge (a 1) and (a 3) into (a 1 3).
 
@@ -578,7 +657,18 @@ ones and overrule settings in the other lists."
 
 (defconst org-unique-local-variables
   '(org-element--cache
-    org-element--cache-objects
+    org-element--headline-cache
+    org-element--cache-change-tic
+    org-element--cache-last-buffer-size
+    org-element--cache-change-warning
+    org-element--cache-gapless
+    org-element--cache-hash-left
+    org-element--cache-hash-right
+    org-element--cache-size
+    org-element--headline-cache-size
+    org-element--cache-sync-keys-value
+    org-element--cache-diagnostics-ring
+    org-element--cache-diagnostics-ring-size
     org-element--cache-sync-keys
     org-element--cache-sync-requests
     org-element--cache-sync-timer)
@@ -724,7 +814,7 @@ When NEXT is non-nil, check the next line instead."
 
 
 
-;;; Overlays
+;;; Overlays and text properties
 
 (defun org-overlay-display (ovl text &optional face evap)
   "Make overlay OVL display TEXT with face FACE."
@@ -747,20 +837,22 @@ If DELETE is non-nil, delete all those overlays."
            (delete (delete-overlay ov))
            (t (push ov found))))))
 
-(defun org-flag-region (from to flag spec)
-  "Hide or show lines from FROM to TO, according to FLAG.
-SPEC is the invisibility spec, as a symbol."
-  (remove-overlays from to 'invisible spec)
-  ;; Use `front-advance' since text right before to the beginning of
-  ;; the overlay belongs to the visible line than to the contents.
-  (when flag
-    (let ((o (make-overlay from to nil 'front-advance)))
-      (overlay-put o 'evaporate t)
-      (overlay-put o 'invisible spec)
-      (overlay-put o
-                  'isearch-open-invisible
-                  (lambda (&rest _) (org-show-context 'isearch))))))
-
+(defun org-find-text-property-region (pos prop)
+  "Find a region around POS containing same non-nil value of PROP text 
property.
+Return nil when PROP is not set at POS."
+  (let* ((beg (and (get-text-property pos prop) pos))
+        (end beg))
+    (when beg
+      (unless (or (equal beg (point-min))
+                 (not (eq (get-text-property beg prop)
+                        (get-text-property (1- beg) prop))))
+       (setq beg (previous-single-property-change pos prop nil (point-min))))
+      (unless (or (equal end (point-max))
+                 ;; (not (eq (get-text-property end prop)
+                 ;;     (get-text-property (1+ end) prop)))
+                 )
+       (setq end (next-single-property-change pos prop nil (point-max))))
+      (cons beg end))))
 
 
 ;;; Regexp matching
@@ -827,17 +919,17 @@ return nil."
 ;;; String manipulation
 
 (defun org-string< (a b)
-  (org-string-collate-lessp a b))
+  (string-collate-lessp a b))
 
 (defun org-string<= (a b)
-  (or (string= a b) (org-string-collate-lessp a b)))
+  (or (string= a b) (string-collate-lessp a b)))
 
 (defun org-string>= (a b)
-  (not (org-string-collate-lessp a b)))
+  (not (string-collate-lessp a b)))
 
 (defun org-string> (a b)
   (and (not (string= a b))
-       (not (org-string-collate-lessp a b))))
+       (not (string-collate-lessp a b))))
 
 (defun org-string<> (a b)
   (not (string= a b)))
@@ -892,14 +984,13 @@ delimiting S."
        (cursor beg))
     (while (setq beg (text-property-not-all beg end property nil s))
       (let* ((next (next-single-property-change beg property s end))
-            (props (text-properties-at beg s))
-            (spec (plist-get props property))
+            (spec (get-text-property beg property s))
             (value
              (pcase property
                (`invisible
-                ;; If `invisible' property in PROPS means text is to
-                ;; be invisible, return 0.  Otherwise return nil so
-                ;; as to resume search.
+                ;; If `invisible' property means text is to be
+                ;; invisible, return 0.  Otherwise return nil so as
+                ;; to resume search.
                 (and (or (eq t buffer-invisibility-spec)
                          (assoc-string spec buffer-invisibility-spec))
                      0))
@@ -940,7 +1031,7 @@ delimiting S."
             ((= cursor end) 0)
             (t (string-width (substring s cursor end)))))))
 
-(defun org-string-width (string)
+(defun org--string-width-1 (string)
   "Return width of STRING when displayed in the current buffer.
 Unlike `string-width', this function takes into consideration
 `invisible' and `display' text properties.  It supports the
@@ -949,6 +1040,104 @@ Results may be off sometimes if it cannot handle a given
 `display' value."
   (org--string-from-props string 'display 0 (length string)))
 
+(defun org-string-width (string &optional pixels)
+  "Return width of STRING when displayed in the current buffer.
+Return width in pixels when PIXELS is non-nil."
+  (if (and (version< emacs-version "28") (not pixels))
+      ;; FIXME: Fallback to old limited version, because
+      ;; `window-pixel-width' is buggy in older Emacs.
+      (org--string-width-1 string)
+    ;; Wrap/line prefix will make `window-text-pizel-size' return too
+    ;; large value including the prefix.
+    (remove-text-properties 0 (length string)
+                            '(wrap-prefix t line-prefix t)
+                            string)
+    ;; Face should be removed to make sure that all the string symbols
+    ;; are using default face with constant width.  Constant char width
+    ;; is critical to get right string width from pixel width (not needed
+    ;; when PIXELS are requested though).
+    (unless pixels
+      (remove-text-properties 0 (length string) '(face t) string))
+    (let (;; We need to remove the folds to make sure that folded table
+          ;; alignment is not messed up.
+          (current-invisibility-spec
+           (or (and (not (listp buffer-invisibility-spec))
+                    buffer-invisibility-spec)
+               (let (result)
+                 (dolist (el buffer-invisibility-spec)
+                   (unless (or (memq el
+                                     '(org-fold-drawer
+                                       org-fold-block
+                                       org-fold-outline))
+                               (and (listp el)
+                                    (memq (car el)
+                                          '(org-fold-drawer
+                                            org-fold-block
+                                            org-fold-outline))))
+                     (push el result)))
+                 result)))
+          (current-char-property-alias-alist char-property-alias-alist))
+      (with-temp-buffer
+        (setq-local display-line-numbers nil)
+        (setq-local buffer-invisibility-spec
+                    (if (listp current-invisibility-spec)
+                        (mapcar (lambda (el)
+                                  ;; Consider ellipsis to have 0 width.
+                                  ;; It is what Emacs 28+ does, but we have
+                                  ;; to force it in earlier Emacs versions.
+                                  (if (and (consp el) (cdr el))
+                                      (list (car el))
+                                    el))
+                                current-invisibility-spec)
+                      current-invisibility-spec))
+        (setq-local char-property-alias-alist
+                    current-char-property-alias-alist)
+        (let (pixel-width symbol-width)
+          (with-silent-modifications
+            (erase-buffer)
+            (insert string)
+            (setq pixel-width
+                  (if (get-buffer-window (current-buffer))
+                      (car (window-text-pixel-size
+                            nil (line-beginning-position) (point-max)))
+                    (let ((dedicatedp (window-dedicated-p))
+                          (oldbuffer (window-buffer)))
+                      (unwind-protect
+                          (progn
+                            ;; Do not throw error in dedicated windows.
+                            (set-window-dedicated-p nil nil)
+                            (set-window-buffer nil (current-buffer))
+                            (car (window-text-pixel-size
+                                  nil (line-beginning-position) (point-max))))
+                        (set-window-buffer nil oldbuffer)
+                        (set-window-dedicated-p nil dedicatedp)))))
+            (unless pixels
+              (erase-buffer)
+              (insert "a")
+              (setq symbol-width
+                    (if (get-buffer-window (current-buffer))
+                        (car (window-text-pixel-size
+                              nil (line-beginning-position) (point-max)))
+                      (let ((dedicatedp (window-dedicated-p))
+                            (oldbuffer (window-buffer)))
+                        (unwind-protect
+                            (progn
+                              ;; Do not throw error in dedicated windows.
+                              (set-window-dedicated-p nil nil)
+                              (set-window-buffer nil (current-buffer))
+                              (car (window-text-pixel-size
+                                    nil (line-beginning-position) 
(point-max))))
+                          (set-window-buffer nil oldbuffer)
+                          (set-window-dedicated-p nil dedicatedp)))))))
+          (if pixels
+              pixel-width
+            (/ pixel-width symbol-width)))))))
+
+(defmacro org-current-text-column ()
+  "Like `current-column' but ignore display properties."
+  `(string-width (buffer-substring-no-properties
+                  (line-beginning-position) (point))))
+
 (defun org-not-nil (v)
   "If V not nil, and also not the string \"nil\", then return V.
 Otherwise return nil."
@@ -962,7 +1151,8 @@ removed.  Return the new string.  If STRING is nil, return 
nil."
   (and string
        (if (and (string-prefix-p pre string)
                (string-suffix-p post string))
-          (substring string (length pre) (- (length post)))
+          (substring string (length pre)
+                      (and (not (string-equal "" post)) (- (length post))))
         string)))
 
 (defun org-strip-quotes (string)
@@ -1054,7 +1244,10 @@ as-is if removal failed."
   "Find each %key of ALIST in TEMPLATE and replace it."
   (let ((case-fold-search nil))
     (dolist (entry (sort (copy-sequence alist)
-                         (lambda (a b) (< (length (car a)) (length (car b))))))
+                         ; Sort from longest key to shortest, so that
+                         ; "noweb-ref" and "tangle-mode" get processed
+                         ; before "noweb" and "tangle", respectively.
+                         (lambda (a b) (< (length (car b)) (length (car a))))))
       (setq template
            (replace-regexp-in-string
             (concat "%" (regexp-quote (car entry)))
@@ -1096,6 +1289,25 @@ so values can contain further %-escapes if they are 
define later in TABLE."
                                   org-emphasis t)
   "Properties to remove when a string without properties is wanted.")
 
+(defun org-buffer-substring-fontified (beg end)
+  "Return fontified region between BEG and END."
+  (when (bound-and-true-p jit-lock-mode)
+    (when (text-property-not-all beg end 'fontified t)
+      (save-excursion (save-match-data (font-lock-fontify-region beg end)))))
+  (buffer-substring beg end))
+
+(defun org-looking-at-fontified (re)
+  "Call `looking-at' RE and make sure that the match is fontified."
+  (prog1 (looking-at re)
+    (when (bound-and-true-p jit-lock-mode)
+      (when (text-property-not-all
+             (match-beginning 0) (match-end 0)
+             'fontified t)
+        (save-excursion
+          (save-match-data
+            (font-lock-fontify-region (match-beginning 0)
+                              (match-end 0))))))))
+
 (defsubst org-no-properties (s &optional restricted)
   "Remove all text properties from string S.
 When RESTRICTED is non-nil, only remove the properties listed
@@ -1112,15 +1324,14 @@ that will be added to PLIST.  Returns the string that 
was modified."
    0 (length string) (if props (append plist props) plist) string)
   string)
 
-(defun org-make-parameter-alist (flat)
-  ;; FIXME: "flat" is called a "plist"!
-  "Return alist based on FLAT.
-FLAT is a list with alternating symbol names and values.  The
-returned alist is a list of lists with the symbol name in car and
-the value in cadr."
-  (when flat
-    (cons (list (car flat) (cadr flat))
-         (org-make-parameter-alist (cddr flat)))))
+(defun org-make-parameter-alist (plist)
+  "Return alist based on PLIST.
+PLIST is a property list with alternating symbol names and values.
+The returned alist is a list of lists with the symbol name in `car'
+and the value in `cadr'."
+  (when plist
+    (cons (list (car plist) (cadr plist))
+         (org-make-parameter-alist (cddr plist)))))
 
 (defsubst org-get-at-bol (property)
   "Get text property PROPERTY at the beginning of line."
@@ -1136,18 +1347,19 @@ the value in cadr."
       (get-text-property (or (next-single-property-change 0 prop s) 0)
                         prop s)))
 
+;; FIXME: move to org-fold?
 (defun org-invisible-p (&optional pos folding-only)
   "Non-nil if the character after POS is invisible.
 If POS is nil, use `point' instead.  When optional argument
 FOLDING-ONLY is non-nil, only consider invisible parts due to
 folding of a headline, a block or a drawer, i.e., not because of
 fontification."
-  (let ((value (get-char-property (or pos (point)) 'invisible)))
+  (let ((value (invisible-p (or pos (point)))))
     (cond ((not value) nil)
-         (folding-only (memq value '(org-hide-block outline)))
+         (folding-only (org-fold-folded-p (or pos (point))))
          (t value))))
 
-(defun org-truely-invisible-p ()
+(defun org-truly-invisible-p ()
   "Check if point is at a character currently not visible.
 This version does not only check the character property, but also
 `visible-mode'."
@@ -1163,17 +1375,23 @@ move it back by one char before doing this check."
       (backward-char 1))
     (org-invisible-p)))
 
+(defun org-region-invisible-p (beg end)
+  "Check if region if completely hidden."
+  (org-with-wide-buffer
+   (and (org-invisible-p beg)
+        (org-invisible-p (org-fold-next-visibility-change beg end)))))
+
 (defun org-find-visible ()
   "Return closest visible buffer position, or `point-max'."
   (if (org-invisible-p)
-      (next-single-char-property-change (point) 'invisible)
+      (org-fold-next-visibility-change (point))
     (point)))
 
 (defun org-find-invisible ()
   "Return closest invisible buffer position, or `point-max'."
   (if (org-invisible-p)
       (point)
-    (next-single-char-property-change (point) 'invisible)))
+    (org-fold-next-visibility-change (point))))
 
 
 ;;; Time
@@ -1187,7 +1405,7 @@ nil, just return 0."
    ((numberp s) s)
    ((stringp s)
     (condition-case nil
-       (float-time (apply #'encode-time (org-parse-time-string s)))
+       (org-time-string-to-seconds s)
       (error 0)))
    (t 0)))
 
@@ -1221,6 +1439,39 @@ nil, just return 0."
        (b (org-2ft b)))
     (and (> a 0) (> b 0) (\= a b))))
 
+(defmacro org-encode-time (&rest time)
+  "Compatibility and convenience helper for `encode-time'.
+TIME may be a 9 components list (SECONDS ... YEAR IGNORED DST ZONE)
+as the recommended way since Emacs-27 or 6 or 9 separate arguments
+similar to the only possible variant for Emacs-26 and earlier.
+6 elements list as the only argument causes wrong type argument till
+Emacs-29.
+
+Warning: use -1 for DST to guess the actual value, nil means no
+daylight saving time and may be wrong at particular time.
+
+DST value is ignored prior to Emacs-27.  Since Emacs-27 DST value matters
+even when multiple arguments is passed to this macro and such
+behavior is different from `encode-time'.  See
+Info node `(elisp)Time Conversion' for details and caveats,
+preferably the latest version."
+  (if (version< emacs-version "27.1")
+      (if (cdr time)
+          `(encode-time ,@time)
+        `(apply #'encode-time ,@time))
+    (if (ignore-errors (with-no-warnings (encode-time '(0 0 0 1 1 1971))))
+        (pcase (length time) ; Emacs-29 since d75e2c12eb
+          (1 `(encode-time ,@time))
+          ((or 6 9) `(encode-time (list ,@time)))
+          (_ (error "`org-encode-time' may be called with 1, 6, or 9 arguments 
but %d given"
+                    (length time))))
+      (pcase (length time)
+        (1 `(encode-time ,@time))
+        (6 `(encode-time (list ,@time nil -1 nil)))
+        (9 `(encode-time (list ,@time)))
+        (_ (error "`org-encode-time' may be called with 1, 6, or 9 arguments 
but %d given"
+                  (length time)))))))
+
 (defun org-parse-time-string (s &optional nodefault)
   "Parse Org time string S.
 
@@ -1244,7 +1495,7 @@ This should be a lot faster than the `parse-time-string'."
        (string-to-number (match-string 4 s))
        (string-to-number (match-string 3 s))
        (string-to-number (match-string 2 s))
-       nil nil nil))
+       nil -1 nil))
 
 (defun org-matcher-time (s)
   "Interpret a time comparison value S as a floating point time.
@@ -1254,8 +1505,8 @@ 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
-                                 (append '(0 0 0) (nthcdr 3 (decode-time)))))))
+  (let ((today (float-time (org-encode-time
+                            (append '(0 0 0) (nthcdr 3 (decode-time)))))))
     (save-match-data
       (cond
        ((string= s "<now>") (float-time))
@@ -1301,6 +1552,13 @@ window."
         (message "Beginning of buffer")
         (sit-for 1))))))
 
+(cl-defun org-knuth-hash (number &optional (base 32))
+  "Calculate Knuth's multiplicative hash for NUMBER.
+BASE is the maximum bitcount.
+Credit: 
https://stackoverflow.com/questions/11871245/knuth-multiplicative-hash#41537995";
+  (cl-assert (and (<= 0 base 32)))
+  (ash (* number 2654435769) (- base 32)))
+
 (provide 'org-macs)
 
 ;; Local variables:
diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el
index 6f0a60125c..a95c4e4769 100644
--- a/lisp/org/org-mobile.el
+++ b/lisp/org/org-mobile.el
@@ -3,7 +3,7 @@
 ;;
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -31,6 +31,9 @@
 ;; iPhone and Android - any external viewer/flagging/editing
 ;; application that uses the same conventions could be used.
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org)
 (require 'org-agenda)
@@ -1064,7 +1067,7 @@ be returned that indicates what went wrong."
          (progn
            ;; Workaround a `org-insert-heading-respect-content' bug
            ;; which prevents correct insertion when point is invisible
-           (org-show-subtree)
+           (org-fold-show-subtree)
            (end-of-line 1)
            (org-insert-heading-respect-content t)
            (org-demote))
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el
index aa4c20050f..817a2d1b05 100644
--- a/lisp/org/org-mouse.el
+++ b/lisp/org/org-mouse.el
@@ -136,6 +136,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org)
 (require 'cl-lib)
 
@@ -208,7 +211,11 @@ this function is called.  Otherwise, the current major 
mode menu is used."
   (interactive "@e \nP")
   (if (and (= (event-click-count event) 1)
           (or (not mark-active)
-               (sit-for (/ (mouse-double-click-time) 1000.0))))
+               (sit-for
+                (/ (if (fboundp 'mouse-double-click-time) ; Emacs >= 29
+                       (mouse-double-click-time)
+                     double-click-time)
+                   1000.0))))
       (progn
        (select-window (posn-window (event-start event)))
        (when (not (org-mouse-mark-active))
@@ -217,10 +224,7 @@ this function is called.  Otherwise, the current major 
mode menu is used."
          (sit-for 0))
        (if (functionp org-mouse-context-menu-function)
            (funcall org-mouse-context-menu-function event)
-         (if (fboundp 'mouse-menu-major-mode-map)
-             (popup-menu (mouse-menu-major-mode-map) event prefix)
-           (with-no-warnings ; don't warn about fallback, obsolete since 23.1
-             (mouse-major-mode-menu event prefix)))))
+          (popup-menu (mouse-menu-major-mode-map) event prefix)))
     (setq this-command 'mouse-save-then-kill)
     (mouse-save-then-kill event)))
 
@@ -580,15 +584,17 @@ This means, between the beginning of line and the point."
   (insert text)
   (beginning-of-line))
 
-(defadvice dnd-insert-text (around org-mouse-dnd-insert-text activate)
+(advice-add 'dnd-insert-text :around #'org--mouse-dnd-insert-text)
+(defun org--mouse-dnd-insert-text (orig-fun window action text &rest args)
   (if (derived-mode-p 'org-mode)
       (org-mouse-insert-item text)
-    ad-do-it))
+    (apply orig-fun window action text args)))
 
-(defadvice dnd-open-file (around org-mouse-dnd-open-file activate)
+(advice-add 'dnd-open-file :around #'org--mouse-dnd-open-file)
+(defun org--mouse-dnd-open-file (orig-fun uri &rest args)
   (if (derived-mode-p 'org-mode)
       (org-mouse-insert-item uri)
-    ad-do-it))
+    (apply orig-fun uri args)))
 
 (defun org-mouse-match-closure (function)
   (let ((match (match-data t)))
@@ -894,15 +900,17 @@ This means, between the beginning of line and the point."
                   (1 `(face nil keymap ,org-mouse-map mouse-face highlight) 
prepend)))
                t))
 
-            (defadvice org-open-at-point (around org-mouse-open-at-point 
activate)
-              (let ((context (org-context)))
-                (cond
-                 ((assq :headline-stars context) (org-cycle))
-                 ((assq :checkbox context) (org-toggle-checkbox))
-                 ((assq :item-bullet context)
-                  (let ((org-cycle-include-plain-lists t)) (org-cycle)))
-                 ((org-footnote-at-reference-p) nil)
-                 (t ad-do-it))))))
+            (advice-add 'org-open-at-point :around 
#'org--mouse-open-at-point)))
+
+(defun org--mouse-open-at-point (orig-fun &rest args)
+  (let ((context (org-context)))
+    (cond
+     ((assq :headline-stars context) (org-cycle))
+     ((assq :checkbox context) (org-toggle-checkbox))
+     ((assq :item-bullet context)
+      (let ((org-cycle-include-plain-lists t)) (org-cycle)))
+     ((org-footnote-at-reference-p) nil)
+     (t (apply orig-fun args)))))
 
 (defun org-mouse-move-tree-start (_event)
   (interactive "e")
@@ -1003,10 +1011,10 @@ This means, between the beginning of line and the 
point."
            (with-current-buffer buffer
              (widen)
              (goto-char pos)
-             (org-show-hidden-entry)
+             (org-fold-show-hidden-entry)
              (save-excursion
                (and (outline-next-heading)
-                    (org-flag-heading nil)))   ; show the next heading
+                    (org-fold-heading nil)))   ; show the next heading
              (org-back-to-heading)
              (setq marker (point-marker))
               (goto-char (max (line-beginning-position) (- (line-end-position) 
anticol)))
diff --git a/lisp/org/org-num.el b/lisp/org/org-num.el
index 4de62630e9..4a57e6a9e3 100644
--- a/lisp/org/org-num.el
+++ b/lisp/org/org-num.el
@@ -61,6 +61,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org-macs)
 (require 'org) ;Otherwise `org-num--comment-re' burps on `org-comment-string'
@@ -458,6 +461,7 @@ NUMBERING is a list of numbers."
    (org-num-mode
     (unless (derived-mode-p 'org-mode)
       (user-error "Cannot activate headline numbering outside Org mode"))
+    (org-num--clear)
     (setq org-num--numbering nil)
     (setq org-num--overlays (nreverse (org-num--number-region nil nil)))
     (add-hook 'after-change-functions #'org-num--verify nil t)
diff --git a/lisp/org/org-pcomplete.el b/lisp/org/org-pcomplete.el
index d1172d8988..5e5e48d3f4 100644
--- a/lisp/org/org-pcomplete.el
+++ b/lisp/org/org-pcomplete.el
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;;         John Wiegley <johnw at gnu dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -26,16 +26,19 @@
 
 ;;;; Require other packages
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org-macs)
 (require 'org-compat)
 (require 'pcomplete)
 
 (declare-function org-at-heading-p "org" (&optional ignored))
 (declare-function org-babel-combine-header-arg-lists "ob-core" (original &rest 
others))
-(declare-function org-babel-get-src-block-info "ob-core" (&optional light 
datum))
+(declare-function org-babel-get-src-block-info "ob-core" (&optional no-eval 
datum))
 (declare-function org-before-first-heading-p "org" ())
 (declare-function org-buffer-property-keys "org" (&optional specials defaults 
columns))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-property "org-element" property element)
 (declare-function org-element-type "org-element" (element))
 (declare-function org-end-of-meta-data "org" (&optional full))
@@ -47,6 +50,7 @@
 (declare-function org-get-tags "org" (&optional pos local))
 (declare-function org-link-heading-search-string "ol" (&optional string))
 (declare-function org-tag-alist-to-string "org" (alist &optional skip-key))
+(declare-function org-time-stamp-format "org" (&optional with-time inactive 
custom))
 
 (defvar org-babel-common-header-args-w-values)
 (defvar org-current-tag-alist)
@@ -67,7 +71,6 @@
 (defvar org-property-re)
 (defvar org-startup-options)
 (defvar org-tag-re)
-(defvar org-time-stamp-formats)
 (defvar org-todo-keywords-1)
 (defvar org-todo-line-regexp)
 
@@ -227,7 +230,7 @@ When completing for #+STARTUP, for example, this function 
returns
 
 (defun pcomplete/org-mode/file-option/date ()
   "Complete arguments for the #+DATE file option."
-  (pcomplete-here (list (format-time-string (car org-time-stamp-formats)))))
+  (pcomplete-here (list (format-time-string (org-time-stamp-format)))))
 
 (defun pcomplete/org-mode/file-option/email ()
   "Complete arguments for the #+EMAIL file option."
@@ -361,7 +364,11 @@ This needs more work, to handle headings with lots of 
spaces in them."
              (pcomplete-uniquify-list tbl)))
          ;; When completing a bracketed link, i.e., "[[*", argument
          ;; starts at the star, so remove this character.
-         (substring pcomplete-stub 1))))
+          ;; Also, if the completion is done inside [[*head<point>]],
+          ;; drop the closing parentheses.
+          (replace-regexp-in-string
+           "\\]+$" ""
+          (substring pcomplete-stub 1)))))
 
 (defun pcomplete/org-mode/tag ()
   "Complete a tag name.  Omit tags already set."
@@ -421,7 +428,7 @@ switches."
                                    (symbol-plist
                                     'org-babel-load-languages)
                                    'custom-type)))))))
-  (let* ((info (org-babel-get-src-block-info 'light))
+  (let* ((info (org-babel-get-src-block-info 'no-eval))
         (lang (car info))
         (lang-headers (intern (concat "org-babel-header-args:" lang)))
         (headers (org-babel-combine-header-arg-lists
diff --git a/lisp/org/org-persist.el b/lisp/org/org-persist.el
new file mode 100644
index 0000000000..6ccf357784
--- /dev/null
+++ b/lisp/org/org-persist.el
@@ -0,0 +1,993 @@
+;;; org-persist.el --- Persist cached data across Emacs sessions         -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
+
+;; Author: Ihor Radchenko <yantar92 at gmail dot com>
+;; Keywords: cache, storage
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; This file implements persistent cache storage across Emacs sessions.
+;; Both global and buffer-local data can be stored.  This
+;; implementation is not meant to be used to store important data -
+;; all the caches should be safe to remove at any time.
+;;
+;; Example usage:
+;;
+;; 1. Temporarily cache Elisp symbol value to disk.  Remove upon
+;;    closing Emacs:
+;;    (org-persist-write 'variable-symbol)
+;;    (org-persist-read 'variable-symbol) ;; read the data later
+;; 2. Temporarily cache a remote URL file to disk.  Remove upon
+;;    closing Emacs:
+;;    (org-persist-write 'url "https://static.fsf.org/common/img/logo-new.png";)
+;;    (org-persist-read 'url "https://static.fsf.org/common/img/logo-new.png";)
+;;    `org-persist-read' will return the cached file location or nil if cached 
file
+;;    has been removed.
+;; 3. Temporarily cache a file, including TRAMP path to disk:
+;;    (org-persist-write 'file "/path/to/file")
+;; 4. Cache file or URL while some other file exists.
+;;    (org-persist-register '(url 
"https://static.fsf.org/common/img/logo-new.png";) '(:file "/path to the other 
file") :expiry 'never :write-immediately t)
+;;    or, if the other file is current buffer file
+;;    (org-persist-register '(url 
"https://static.fsf.org/common/img/logo-new.png";) (current-buffer) :expiry 
'never :write-immediately t)
+;; 5. Cache value of a Elisp variable to disk.  The value will be
+;;    saved and restored automatically (except buffer-local
+;;    variables).
+;;    ;; Until `org-persist-default-expiry'
+;;    (org-persist-register 'variable-symbol)
+;;    ;; Specify expiry explicitly
+;;    (org-persist-register 'variable-symbol :expiry 'never)
+;;    ;; Save buffer-local variable (buffer-local will not be
+;;    ;; autoloaded!)
+;;    (org-persist-register 'org-element--cache (current-buffer))
+;;    ;; Save buffer-local variable preserving circular links:
+;;    (org-persist-register 'org-element--headline-cache (current-buffer)
+;;               :inherit 'org-element--cache)
+;; 6. Load variable by side effects assigning variable symbol:
+;;    (org-persist-load 'variable-symbol (current-buffer))
+;; 7. Version variable value:
+;;    (org-persist-register '((elisp variable-symbol) (version "2.0")))
+;; 8. Cancel variable persistence:
+;;    (org-persist-unregister 'variable-symbol 'all) ; in all buffers
+;;    (org-persist-unregister 'variable-symbol) ;; global variable
+;;    (org-persist-unregister 'variable-symbol (current-buffer)) ;; 
buffer-local
+;;
+;; Most common data type is variable data.  However, other data types
+;; can also be stored.
+;;
+;; Persistent data is stored in individual files.  Each of the files
+;; can contain a collection of related data, which is particularly
+;; useful when, say, several variables cross-reference each-other's
+;; data-cells and we want to preserve their circular structure.
+;;
+;; Each data collection can be associated with a local or remote file,
+;; its inode number, or contents hash.  The persistent data collection
+;; can later be accessed using either file buffer, file, inode, or
+;; contents hash.
+;;
+;; The data collections can be versioned and removed upon expiry.
+;;
+;; In the code below I will use the following naming conventions:
+;; 1. Container :: a type of data to be stored
+;;    Containers can store elisp variables, files, and version
+;;    numbers.  Each container can be customized with container
+;;    options.  For example, `elisp' container is customized with
+;;    variable symbol.  (elisp variable) is a container storing
+;;    Lisp variable value.  Similarly, (version "2.0") container
+;;    will store version number.
+;; 2. Associated :: an object the container is associated with.  The
+;;    object can be a buffer, file, inode number, file contents hash,
+;;    a generic key, or multiple of them.  Associated can also be nil.
+;; 3. Data collection :: a list of containers linked to an associated
+;;    object/objects.  Each data collection can also have auxiliary
+;;    records.  Their only purpose is readability of the collection
+;;    index.
+;; 4. Index file :: a file listing all the stored data collections.
+;; 5. Persist file :: a file holding data values or references to
+;;    actual data values for a single data collection.  This file
+;;    contains an alist associating each data container in data
+;;    collection with its value or a reference to the actual value.
+;;
+;; All the persistent data is stored in `org-persist-directory'.  The data
+;; collections are listed in `org-persist-index-file' and the actual data is
+;; stored in UID-style subfolders.
+;;
+;; The `org-persist-index-file' stores the value of `org-persist--index'.
+;;
+;; Each collection is represented as a plist containing the following
+;; properties:
+;; - `:container'   : list of data continers to be stored in single
+;;                    file;
+;; - `:persist-file': data file name;
+;; - `:associated'  : list of associated objects;
+;; - `:last-access' : last date when the container has been accessed;
+;; - `:expiry'      : list of expiry conditions.
+;; - all other keywords are ignored
+;;
+;; The available types of data containers are:
+;; 1. (file variable-symbol) or just variable-symbol :: Storing
+;;    elisp variable data.
+;; 2. (file) :: Store a copy of the associated file preserving the
+;;    extension.
+;;    (file "/path/to/a/file") :: Store a copy of the file in path.
+;; 3. (version "version number") :: Version the data collection.
+;;     If the stored collection has different version than "version
+;;     number", disregard it.
+;; 4. (url) :: Store a downloaded copy of URL object.
+;;
+;; The data collections can expire, in which case they will be removed
+;; from the persistent storage at the end of Emacs session.  The
+;; expiry condition can be set when saving/registering data
+;; containers.  The expirty condition can be `never' - data will never
+;; expire; nil - data will expire at the end of current Emacs session;
+;; a number - data will expire after the number days from last access;
+;; a function - data will expire if the function, called with a single
+;; argument - collection, returns non-nil.
+;;
+;;
+;; Data collections associated with files will automatically expire
+;; when the file is removed.  If the associated file is remote, the
+;; expiry is controlled by `org-persist-remote-files' instead.
+;;
+;; Data loading/writing can be more accurately controlled using
+;; `org-persist-before-write-hook', `org-persist-before-read-hook', and 
`org-persist-after-read-hook'.
+
+;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'org-compat)
+(require 'org-id)
+(require 'xdg nil t)
+
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
+(declare-function org-at-heading-p "org" (&optional invisible-not-ok))
+
+
+(defconst org-persist--storage-version "2.7"
+  "Persistent storage layout version.")
+
+(defgroup org-persist nil
+  "Persistent cache for Org mode."
+  :tag "Org persist"
+  :group 'org)
+
+(defcustom org-persist-directory (expand-file-name
+                       (org-file-name-concat
+                        (let ((cache-dir (when (fboundp 'xdg-cache-home)
+                                           (xdg-cache-home))))
+                          (if (or (seq-empty-p cache-dir)
+                                  (not (file-exists-p cache-dir))
+                                  (file-exists-p (org-file-name-concat
+                                                  user-emacs-directory
+                                                  "org-persist")))
+                              user-emacs-directory
+                            cache-dir))
+                        "org-persist/"))
+  "Directory where the data is stored."
+  :group 'org-persist
+  :package-version '(Org . "9.6")
+  :type 'directory)
+
+(defcustom org-persist-remote-files 100
+  "Whether to keep persistent data for remote files.
+
+When this variable is nil, never save persistent data associated with
+remote files.  When t, always keep the data.  When
+`check-existence', contact remote server containing the file and only
+keep the data when the file exists on the server.  When a number, keep
+up to that number persistent values for remote files.
+
+Note that the last option `check-existence' may cause Emacs to show
+password prompts to log in."
+  :group 'org-persist
+  :package-version '(Org . "9.6")
+  :type '(choice (const :tag "Never" nil)
+                 (const :tag "Always" t)
+                 (number :tag "Keep not more than X files")
+                 (const :tag "Check if exist on remote" check-existence)))
+
+(defcustom org-persist-default-expiry 30
+  "Default expiry condition for persistent data.
+
+When this variable is nil, all the data vanishes at the end of Emacs
+session.  When `never', the data never vanishes.  When a number, the
+data is deleted that number days after last access.  When a function,
+it should be a function returning non-nil when the data is expired.  The
+function will be called with a single argument - collection."
+  :group 'org-persist
+  :package-version '(Org . "9.6")
+  :type '(choice (const :tag "Never" never)
+                 (const :tag "Always" nil)
+                 (number :tag "Keep N days")
+                 (function :tag "Function")))
+
+(defconst org-persist-index-file "index"
+  "File name used to store the data index.")
+
+(defvar org-persist--disable-when-emacs-Q t
+  "Disable persistence when Emacs is called with -Q command line arg.
+When non-nil, this sets `org-persist-directory' to temporary directory.
+
+This variable must be set before loading org-persist library.")
+
+(defvar org-persist-before-write-hook nil
+  "Abnormal hook ran before saving data.
+The hook must accept the same arguments as `org-persist-write'.
+The hooks will be evaluated until a hook returns non-nil.
+If any of the hooks return non-nil, do not save the data.")
+
+(defvar org-persist-before-read-hook nil
+  "Abnormal hook ran before reading data.
+The hook must accept the same arguments as `org-persist-read'.
+The hooks will be evaluated until a hook returns non-nil.
+If any of the hooks return non-nil, do not read the data.")
+
+(defvar org-persist-after-read-hook nil
+  "Abnormal hook ran after reading data.
+The hook must accept the same arguments as `org-persist-read'.")
+
+(defvar org-persist--index nil
+  "Global index.
+
+The index is a list of plists.  Each plist contains information about
+persistent data storage.  Each plist contains the following
+properties:
+
+  - `:container'  : list of data continers to be stored in single file
+  - `:persist-file': data file name
+  - `:associated'  : list of associated objects
+  - `:last-access' : last date when the container has been read
+  - `:expiry'      : list of expiry conditions
+  - all other keywords are ignored.")
+
+(defvar org-persist--index-hash nil
+  "Hash table storing `org-persist--index'.  Used for quick access.
+They keys are conses of (container . associated).")
+
+(defvar org-persist--report-time 0.5
+  "Whether to report read/write time.
+
+When the value is a number, it is a threshold number of seconds.  If
+the read/write time of a single variable exceeds the threshold, a
+message is displayed.
+
+When the value is a non-nil non-number, always display the message.
+When the value is nil, never display the message.")
+
+;;;; Common functions
+
+(defun org-persist--display-time (duration format &rest args)
+  "Report DURATION according to FORMAT + ARGS message.
+FORMAT and ARGS are passed to `message'."
+  (when (or (and org-persist--report-time
+                 (numberp org-persist--report-time)
+                 (>= duration org-persist--report-time))
+            (and org-persist--report-time
+                 (not (numberp org-persist--report-time))))
+    (apply #'message
+           (format "org-persist: %s took %%.2f sec" format)
+           (append args (list duration)))))
+
+(defun org-persist--read-elisp-file (&optional buffer-or-file)
+  "Read elisp data from BUFFER-OR-FILE or current buffer."
+  (unless buffer-or-file (setq buffer-or-file (current-buffer)))
+  (with-temp-buffer
+    (if (bufferp buffer-or-file)
+        (set-buffer buffer-or-file)
+      (insert-file-contents buffer-or-file))
+    (condition-case err
+        (let ((coding-system-for-read 'utf-8)
+              (read-circle t)
+              (start-time (float-time)))
+          ;; FIXME: Reading sometimes fails to read circular objects.
+          ;; I suspect that it happens when we have object reference
+          ;; #N# read before object definition #N=.  If it is really
+          ;; so, it should be Emacs bug - either in `read' or in
+          ;; `prin1'.  Meanwhile, just fail silently when `read'
+          ;; fails to parse the saved cache object.
+          (prog1
+              (read (current-buffer))
+            (org-persist--display-time
+             (- (float-time) start-time)
+             "Reading from %S" buffer-or-file)))
+      ;; Recover gracefully if index file is corrupted.
+      (error
+       ;; Remove problematic file.
+       (unless (bufferp buffer-or-file) (delete-file buffer-or-file))
+       ;; Do not report the known error to user.
+       (if (string-match-p "Invalid read syntax" (error-message-string err))
+           (message "Emacs reader failed to read data in %S. The error was: %S"
+                    buffer-or-file (error-message-string err))
+         (warn "Emacs reader failed to read data in %S. The error was: %S"
+               buffer-or-file (error-message-string err)))
+       nil))))
+
+(defun org-persist--write-elisp-file (file data &optional no-circular pp)
+  "Write elisp DATA to FILE."
+  (let ((print-circle (not no-circular))
+        print-level
+        print-length
+        print-quoted
+        (print-escape-control-characters t)
+        (print-escape-nonascii t)
+        (print-continuous-numbering t)
+        print-number-table
+        (start-time (float-time)))
+    (unless (file-exists-p (file-name-directory file))
+      (make-directory (file-name-directory file) t))
+    (with-temp-file file
+      (if pp
+          (pp data (current-buffer))
+        (prin1 data (current-buffer))))
+    (org-persist--display-time
+     (- (float-time) start-time)
+     "Writing to %S" file)))
+
+(defmacro org-persist-gc:generic (container collection)
+  "Garbage collect CONTAINER data from COLLECTION."
+  `(let* ((c (org-persist--normalize-container ,container))
+          (gc-func-symbol (intern (format "org-persist-gc:%s" (car c)))))
+     (unless (fboundp gc-func-symbol)
+       (error "org-persist: GC function %s not defined"
+              gc-func-symbol))
+     (funcall gc-func-symbol c ,collection)))
+
+(defmacro org-persist--gc-expired-p (cnd collection)
+  "Check if expiry condition CND triggers for COLLECTION."
+  `(pcase ,cnd
+     (`nil t)
+     (`never nil)
+     ((pred numberp)
+      (when (plist-get ,collection :last-access)
+        (> (float-time) (+ (plist-get ,collection :last-access) (* ,cnd 24 60 
60)))))
+     ((pred functionp)
+      (funcall ,cnd ,collection))
+     (_ (error "org-persist: Unsupported expiry type %S" ,cnd))))
+
+;;;; Working with index
+
+(defmacro org-persist-collection-let (collection &rest body)
+  "Bind container and associated from COLLECTION and execute BODY."
+  (declare (debug (form body)) (indent 1))
+  `(with-no-warnings
+     (let* ((container (plist-get ,collection :container))
+            (associated (plist-get ,collection :associated))
+            (path (plist-get associated :file))
+            (inode (plist-get associated :inode))
+            (hash (plist-get associated :hash))
+            (key (plist-get associated :key)))
+       ;; Suppress "unused variable" warnings.
+       (ignore container associated path inode hash key)
+       ,@body)))
+
+(defun org-persist--find-index (collection)
+"Find COLLECTION in `org-persist--index'."
+(org-persist-collection-let collection
+  (and org-persist--index-hash
+       (catch :found
+         (dolist (cont (cons container container))
+           (let (r)
+             (setq r (or (gethash (cons cont associated) 
org-persist--index-hash)
+                         (and path (gethash (cons cont (list :file path)) 
org-persist--index-hash))
+                         (and inode (gethash (cons cont (list :inode inode)) 
org-persist--index-hash))
+                         (and hash (gethash (cons cont (list :hash hash)) 
org-persist--index-hash))
+                         (and key (gethash (cons cont (list :key key)) 
org-persist--index-hash))))
+             (when r (throw :found r))))))))
+
+(defun org-persist--add-to-index (collection &optional hash-only)
+  "Add or update COLLECTION in `org-persist--index'.
+When optional HASH-ONLY is non-nil, only modify the hash table.
+Return PLIST."
+  (org-persist-collection-let collection
+    (let ((existing (org-persist--find-index collection)))
+      (if existing
+          (progn
+            (plist-put existing :container container)
+            (plist-put (plist-get existing :associated) :file path)
+            (plist-put (plist-get existing :associated) :inode inode)
+            (plist-put (plist-get existing :associated) :hash hash)
+            (plist-put (plist-get existing :associated) :key key)
+            existing)
+        (unless hash-only (push collection org-persist--index))
+        (unless org-persist--index-hash (setq org-persist--index-hash 
(make-hash-table :test 'equal)))
+        (dolist (cont (cons container container))
+          (puthash (cons cont associated) collection org-persist--index-hash)
+          (when path (puthash (cons cont (list :file path)) collection 
org-persist--index-hash))
+          (when inode (puthash (cons cont (list :inode inode)) collection 
org-persist--index-hash))
+          (when hash (puthash (cons cont (list :hash inode)) collection 
org-persist--index-hash))
+          (when key (puthash (cons cont (list :key inode)) collection 
org-persist--index-hash)))
+        collection))))
+
+(defun org-persist--remove-from-index (collection)
+  "Remove COLLECTION from `org-persist--index'."
+  (let ((existing (org-persist--find-index collection)))
+    (when existing
+      (org-persist-collection-let collection
+        (dolist (cont (cons container container))
+          (unless (listp (car container))
+            (org-persist-gc:generic cont collection))
+          (remhash (cons cont associated) org-persist--index-hash)
+          (when path (remhash (cons cont (list :file path)) 
org-persist--index-hash))
+          (when inode (remhash (cons cont (list :inode inode)) 
org-persist--index-hash))
+          (when hash (remhash (cons cont (list :hash hash)) 
org-persist--index-hash))
+          (when key (remhash (cons cont (list :key key)) 
org-persist--index-hash))))
+      (setq org-persist--index (delq existing org-persist--index)))))
+
+(defun org-persist--get-collection (container &optional associated &rest misc)
+  "Return or create collection used to store CONTAINER for ASSOCIATED.
+When ASSOCIATED is nil, it is a global CONTAINER.
+ASSOCIATED can also be a (:buffer buffer) or buffer, (:file file-path)
+or file-path, (:inode inode), (:hash hash), or or (:key key).
+MISC, if non-nil will be appended to the collection."
+  (unless (and (listp container) (listp (car container)))
+    (setq container (list container)))
+  (setq associated (org-persist--normalize-associated associated))
+  (unless (equal misc '(nil))
+    (setq associated (append associated misc)))
+  (or (org-persist--find-index
+       `( :container ,(org-persist--normalize-container container)
+          :associated ,associated))
+      (org-persist--add-to-index
+       (list :container (org-persist--normalize-container container)
+             :persist-file
+             (replace-regexp-in-string "^.." "\\&/" (org-id-uuid))
+             :associated associated))))
+
+;;;; Reading container data.
+
+(defun org-persist--normalize-container (container)
+  "Normalize CONTAINER representation into (type . settings)."
+  (if (and (listp container) (listp (car container)))
+      (mapcar #'org-persist--normalize-container container)
+    (pcase container
+      ((or `elisp `version `file `index `url)
+       (list container nil))
+      ((pred symbolp)
+       (list `elisp container))
+      (`(,(or `elisp `version `file `index `url) . ,_)
+       container)
+      (_ (error "org-persist: Unknown container type: %S" container)))))
+
+(defvar org-persist--associated-buffer-cache (make-hash-table :weakness 'key)
+  "Buffer hash cache.")
+
+(defun org-persist--normalize-associated (associated)
+  "Normalize ASSOCIATED representation into (:type value)."
+  (pcase associated
+    ((or (pred stringp) `(:file ,_))
+     (unless (stringp associated)
+       (setq associated (cadr associated)))
+     (let* ((rtn `(:file ,associated))
+            (inode (and (fboundp 'file-attribute-inode-number)
+                        (file-attribute-inode-number
+                         (file-attributes associated)))))
+       (when inode (plist-put rtn :inode inode))
+       rtn))
+    ((or (pred bufferp) `(:buffer ,_))
+     (unless (bufferp associated)
+       (setq associated (cadr associated)))
+     (let ((cached (gethash associated org-persist--associated-buffer-cache))
+           file inode hash)
+       (if (and cached (eq (buffer-modified-tick associated)
+                           (car cached)))
+           (progn
+             (setq file (nth 1 cached)
+                   inode (nth 2 cached)
+                   hash (nth 3 cached)))
+         (setq file (buffer-file-name
+                     (or (buffer-base-buffer associated)
+                         associated)))
+         (setq inode (when (and file
+                                (fboundp 'file-attribute-inode-number))
+                       (file-attribute-inode-number
+                        (file-attributes file))))
+         (setq hash (secure-hash 'md5 associated))
+         (puthash associated
+                  (list (buffer-modified-tick associated)
+                        file inode hash)
+                  org-persist--associated-buffer-cache))
+       (let ((rtn `(:hash ,hash)))
+         (when file (setq rtn (plist-put rtn :file file)))
+         (when inode (setq rtn (plist-put rtn :inode inode)))
+         rtn)))
+    ((pred listp)
+     associated)
+    (_ (error "Unknown associated object %S" associated))))
+
+(defmacro org-persist-read:generic (container reference-data collection)
+  "Read and return the data stored in CONTAINER.
+REFERENCE-DATA is associated with CONTAINER in the persist file.
+COLLECTION is the plist holding data collection."
+  `(let* ((c (org-persist--normalize-container ,container))
+          (read-func-symbol (intern (format "org-persist-read:%s" (car c)))))
+     (setf ,collection (plist-put ,collection :last-access (float-time)))
+     (setf ,collection (plist-put ,collection :last-access-hr 
(format-time-string "%FT%T%z" (float-time))))
+     (unless (fboundp read-func-symbol)
+       (error "org-persist: Read function %s not defined"
+              read-func-symbol))
+     (funcall read-func-symbol c ,reference-data ,collection)))
+
+(defun org-persist-read:elisp (_ lisp-value __)
+  "Read elisp container and return LISP-VALUE."
+  lisp-value)
+
+(defun org-persist-read:version (container _ __)
+  "Read version CONTAINER."
+  (cadr container))
+
+(defun org-persist-read:file (_ path __)
+  "Read file container from PATH."
+  (when (and path (file-exists-p (concat org-persist-directory path)))
+    (concat org-persist-directory path)))
+
+(defun org-persist-read:url (_ path __)
+  "Read file container from PATH."
+  (when (and path (file-exists-p (concat org-persist-directory path)))
+    (concat org-persist-directory path)))
+
+(defun org-persist-read:index (cont index-file _)
+  "Read index container CONT from INDEX-FILE."
+  (when (file-exists-p index-file)
+    (let ((index (org-persist--read-elisp-file index-file)))
+      (when index
+        (catch :found
+          (dolist (collection index)
+            (org-persist-collection-let collection
+              (when (and (not associated)
+                         (pcase container
+                           (`((index ,version))
+                            (equal version (cadr cont)))
+                           (_ nil)))
+                (throw :found index)))))))))
+
+;;;; Applying container data for side effects.
+
+(defmacro org-persist-load:generic (container reference-data collection)
+  "Load the data stored in CONTAINER for side effects.
+REFERENCE-DATA is associated with CONTAINER in the persist file.
+COLLECTION is the plist holding data collection."
+  `(let* ((container (org-persist--normalize-container ,container))
+          (load-func-symbol (intern (format "org-persist-load:%s" (car 
container)))))
+     (setf ,collection (plist-put ,collection :last-access (float-time)))
+     (setf ,collection (plist-put ,collection :last-access-hr 
(format-time-string "%FT%T%z" (float-time))))
+     (unless (fboundp load-func-symbol)
+       (error "org-persist: Load function %s not defined"
+              load-func-symbol))
+     (funcall load-func-symbol container ,reference-data ,collection)))
+
+(defun org-persist-load:elisp (container lisp-value collection)
+  "Assign elisp CONTAINER in COLLECTION LISP-VALUE."
+  (let ((lisp-symbol (cadr container))
+        (buffer (when (plist-get (plist-get collection :associated) :file)
+                  (get-file-buffer (plist-get (plist-get collection 
:associated) :file)))))
+    (if buffer
+        (with-current-buffer buffer
+          (make-variable-buffer-local lisp-symbol)
+          (set lisp-symbol lisp-value))
+      (set lisp-symbol lisp-value))))
+
+(defalias 'org-persist-load:version #'org-persist-read:version)
+(defalias 'org-persist-load:file #'org-persist-read:file)
+
+(defun org-persist-load:index (container index-file _)
+  "Load `org-persist--index' from INDEX-FILE according to CONTAINER."
+  (unless org-persist--index
+    (setq org-persist--index (org-persist-read:index container index-file nil))
+    (setq org-persist--index-hash nil)
+    (if org-persist--index
+        (mapc (lambda (collection) (org-persist--add-to-index collection 
'hash)) org-persist--index)
+      (setq org-persist--index nil)
+      (when (file-exists-p org-persist-directory)
+        (dolist (file (directory-files org-persist-directory 'absolute
+                                       "\\`[^.][^.]"))
+          (if (file-directory-p file)
+              (delete-directory file t)
+            (delete-file file))))
+      (plist-put (org-persist--get-collection container) :expiry 'never))))
+
+(defun org-persist--load-index ()
+  "Load `org-persist--index."
+  (org-persist-load:index
+   `(index ,org-persist--storage-version)
+   (org-file-name-concat org-persist-directory org-persist-index-file)
+   nil))
+
+;;;; Writing container data
+
+(defmacro org-persist-write:generic (container collection)
+  "Write CONTAINER in COLLECTION."
+  `(let* ((c (org-persist--normalize-container ,container))
+          (write-func-symbol (intern (format "org-persist-write:%s" (car c)))))
+     (setf ,collection (plist-put ,collection :last-access (float-time)))
+     (setf ,collection (plist-put ,collection :last-access-hr 
(format-time-string "%FT%T%z" (float-time))))
+     (unless (fboundp write-func-symbol)
+       (error "org-persist: Write function %s not defined"
+              write-func-symbol))
+     (funcall write-func-symbol c ,collection)))
+
+(defun org-persist-write:elisp (container collection)
+  "Write elisp CONTAINER according to COLLECTION."
+  (if (and (plist-get (plist-get collection :associated) :file)
+           (get-file-buffer (plist-get (plist-get collection :associated) 
:file)))
+      (let ((buf (get-file-buffer (plist-get (plist-get collection 
:associated) :file))))
+        ;; FIXME: There is `buffer-local-boundp' introduced in Emacs 28.
+        ;; Not using it yet to keep backward compatibility.
+        (condition-case nil
+            (buffer-local-value (cadr container) buf)
+          (void-variable nil)))
+    (when (boundp (cadr container))
+      (symbol-value (cadr container)))))
+
+(defalias 'org-persist-write:version #'ignore)
+
+(defun org-persist-write:file (c collection)
+  "Write file container C according to COLLECTION."
+  (org-persist-collection-let collection
+    (when (or (and path (file-exists-p path))
+              (and (stringp (cadr c)) (file-exists-p (cadr c))))
+      (when (and (stringp (cadr c)) (file-exists-p (cadr c)))
+        (setq path (cadr c)))
+      (let* ((persist-file (plist-get collection :persist-file))
+             (ext (file-name-extension path))
+             (file-copy (org-file-name-concat
+                         org-persist-directory
+                         (format "%s-%s.%s" persist-file (md5 path) ext))))
+        (unless (file-exists-p (file-name-directory file-copy))
+          (make-directory (file-name-directory file-copy) t))
+        (copy-file path file-copy 'overwrite)
+        (format "%s-%s.%s" persist-file (md5 path) ext)))))
+
+(defun org-persist-write:url (c collection)
+  "Write url container C according to COLLECTION."
+  (org-persist-collection-let collection
+    (when (or path (cadr c))
+      (when (cadr c) (setq path (cadr c)))
+      (let* ((persist-file (plist-get collection :persist-file))
+             (ext (file-name-extension path))
+             (file-copy (org-file-name-concat
+                         org-persist-directory
+                         (format "%s-%s.%s" persist-file (md5 path) ext))))
+        (unless (file-exists-p file-copy)
+          (unless (file-exists-p (file-name-directory file-copy))
+            (make-directory (file-name-directory file-copy) t))
+          (if (org--should-fetch-remote-resource-p path)
+              (url-copy-file path file-copy 'overwrite)
+            (error "The remote resource %S is considered unsafe, and will not 
be downloaded."
+                   path)))
+        (format "%s-%s.%s" persist-file (md5 path) ext)))))
+
+(defun org-persist-write:index (container _)
+  "Write index CONTAINER."
+  (org-persist--get-collection container)
+  (unless (file-exists-p org-persist-directory)
+    (make-directory org-persist-directory))
+  (unless (file-exists-p org-persist-directory)
+    (warn "Failed to create org-persist storage in %s."
+          org-persist-directory)
+    (let ((dir (directory-file-name
+                (file-name-as-directory org-persist-directory))))
+      (while (and (not (file-exists-p dir))
+                  (not (equal dir (setq dir (directory-file-name
+                                           (file-name-directory dir)))))))
+      (unless (file-writable-p dir)
+        (message "Missing write access rights to org-persist-directory: %S"
+                 org-persist-directory))))
+  (when (file-exists-p org-persist-directory)
+    (org-persist--write-elisp-file
+     (org-file-name-concat org-persist-directory org-persist-index-file)
+     org-persist--index
+     t t)
+    (org-file-name-concat org-persist-directory org-persist-index-file)))
+
+(defun org-persist--save-index ()
+  "Save `org-persist--index."
+  (org-persist-write:index
+   `(index ,org-persist--storage-version) nil))
+
+;;;; Public API
+
+(cl-defun org-persist-register (container &optional associated &rest misc
+                               &key inherit
+                               &key (expiry org-persist-default-expiry)
+                               &key (write-immediately nil)
+                               &allow-other-keys)
+  "Register CONTAINER in ASSOCIATED to be persistent across Emacs sessions.
+Optional key INHERIT makes CONTAINER dependent on another container.
+Such dependency means that data shared between variables will be
+preserved (see elisp#Circular Objects).
+Optional key EXPIRY will set the expiry condition of the container.
+It can be `never', nil - until end of session, a number of days since
+last access, or a function accepting a single argument - collection.
+EXPIRY key has no effect when INHERIT is non-nil.
+Optional key WRITE-IMMEDIATELY controls whether to save the container
+data immediately.
+MISC will be appended to CONTAINER.
+When WRITE-IMMEDIATELY is non-nil, the return value will be the same
+with `org-persist-write'."
+  (unless org-persist--index (org-persist--load-index))
+  (setq container (org-persist--normalize-container container))
+  (when inherit
+    (setq inherit (org-persist--normalize-container inherit))
+    (let ((inherited-collection (org-persist--get-collection inherit 
associated))
+          new-collection)
+      (unless (member container (plist-get inherited-collection :container))
+        (setq new-collection
+              (plist-put (copy-sequence inherited-collection) :container
+                         (cons container (plist-get inherited-collection 
:container))))
+        (org-persist--remove-from-index inherited-collection)
+        (org-persist--add-to-index new-collection))))
+  (let ((collection (org-persist--get-collection container associated misc)))
+    (when (and expiry (not inherit))
+      (when expiry (plist-put collection :expiry expiry))))
+  (when (or (bufferp associated) (bufferp (plist-get associated :buffer)))
+    (with-current-buffer (if (bufferp associated)
+                             associated
+                           (plist-get associated :buffer))
+      (add-hook 'kill-buffer-hook #'org-persist-write-all-buffer nil 'local)))
+  (when write-immediately (org-persist-write container associated)))
+
+(defun org-persist-unregister (container &optional associated)
+  "Unregister CONTAINER in ASSOCIATED to be persistent.
+When ASSOCIATED is `all', unregister CONTAINER everywhere."
+  (unless org-persist--index (org-persist--load-index))
+  (setq container (org-persist--normalize-container container))
+  (setq associated (org-persist--normalize-associated associated))
+  (if (eq associated 'all)
+      (mapc (lambda (collection)
+              (when (member container (plist-get collection :container))
+                (org-persist-unregister container (plist-get collection 
:associated))))
+            org-persist--index)
+    (let ((collection (org-persist--find-index `(:container ,container 
:associated ,associated))))
+      (when collection
+        (if (= (length (plist-get collection :container)) 1)
+            (org-persist--remove-from-index collection)
+          (plist-put collection :container
+                     (remove container (plist-get collection :container)))
+          (org-persist--add-to-index collection))))))
+
+(defvar org-persist--write-cache (make-hash-table :test #'equal)
+  "Hash table storing as-written data objects.
+
+This data is used to avoid reading the data multiple times.")
+(defun org-persist-read (container &optional associated hash-must-match load?)
+  "Restore CONTAINER data for ASSOCIATED.
+When HASH-MUST-MATCH is non-nil, do not restore data if hash for
+ASSOCIATED file or buffer does not match.
+ASSOCIATED can be a plist, a buffer, or a string.
+A buffer is treated as (:buffer ASSOCIATED).
+A string is treated as (:file ASSOCIATED).
+When LOAD? is non-nil, load the data instead of reading."
+  (unless org-persist--index (org-persist--load-index))
+  (setq associated (org-persist--normalize-associated associated))
+  (setq container (org-persist--normalize-container container))
+  (let* ((collection (org-persist--find-index `(:container ,container 
:associated ,associated)))
+         (persist-file
+          (when collection
+            (org-file-name-concat
+             org-persist-directory
+             (plist-get collection :persist-file))))
+         (data nil))
+    (when (and collection
+               (file-exists-p persist-file)
+               (or (not (plist-get collection :expiry)) ; current session
+                   (not (org-persist--gc-expired-p
+                       (plist-get collection :expiry) collection)))
+               (or (not hash-must-match)
+                   (and (plist-get associated :hash)
+                        (equal (plist-get associated :hash)
+                               (plist-get (plist-get collection :associated) 
:hash)))))
+      (unless (seq-find (lambda (v)
+                          (run-hook-with-args-until-success 
'org-persist-before-read-hook v associated))
+                        (plist-get collection :container))
+        (setq data (or (gethash persist-file org-persist--write-cache)
+                       (org-persist--read-elisp-file persist-file)))
+        (when data
+          (cl-loop for container in (plist-get collection :container)
+                   with result = nil
+                   do
+                   (if load?
+                       (push (org-persist-load:generic container (alist-get 
container data nil nil #'equal) collection) result)
+                     (push (org-persist-read:generic container (alist-get 
container data nil nil #'equal) collection) result))
+                   (run-hook-with-args 'org-persist-after-read-hook container 
associated)
+                   finally return (if (= 1 (length result)) (car result) 
result)))))))
+
+(defun org-persist-load (container &optional associated hash-must-match)
+  "Load CONTAINER data for ASSOCIATED.
+The arguments have the same meaning as in `org-persist-read'."
+  (org-persist-read container associated hash-must-match t))
+
+(defun org-persist-load-all (&optional associated)
+  "Restore all the persistent data associated with ASSOCIATED."
+  (unless org-persist--index (org-persist--load-index))
+  (setq associated (org-persist--normalize-associated associated))
+  (let (all-containers)
+    (dolist (collection org-persist--index)
+      (when collection
+        (cl-pushnew (plist-get collection :container) all-containers :test 
#'equal)))
+    (dolist (container all-containers)
+      (condition-case err
+          (org-persist-load container associated t)
+        (error
+         (message "%s. Deleting bad index entry." err)
+         (org-persist--remove-from-index (org-persist--find-index `(:container 
,container :associated ,associated)))
+         nil)))))
+
+(defun org-persist-load-all-buffer ()
+  "Call `org-persist-load-all' in current buffer."
+  (org-persist-load-all (current-buffer)))
+
+(defun org-persist-write (container &optional associated ignore-return)
+  "Save CONTAINER according to ASSOCIATED.
+ASSOCIATED can be a plist, a buffer, or a string.
+A buffer is treated as (:buffer ASSOCIATED).
+A string is treated as (:file ASSOCIATED).
+The return value is nil when writing fails and the written value (as
+returned by `org-persist-read') on success.
+When IGNORE-RETURN is non-nil, just return t on success without calling
+`org-persist-read'."
+  (setq associated (org-persist--normalize-associated associated))
+  ;; Update hash
+  (when (and (plist-get associated :file)
+             (plist-get associated :hash)
+             (get-file-buffer (plist-get associated :file)))
+    (setq associated (org-persist--normalize-associated (get-file-buffer 
(plist-get associated :file)))))
+  (let ((collection (org-persist--get-collection container associated)))
+    (setf collection (plist-put collection :associated associated))
+    (unless (or
+             ;; Prevent data leakage from encrypted files.
+             ;; We do it in somewhat paranoid manner and do not
+             ;; allow anything related to encrypted files to be
+             ;; written.
+             (and (plist-get associated :file)
+                  (string-match-p epa-file-name-regexp (plist-get associated 
:file)))
+             (seq-find (lambda (v)
+                         (run-hook-with-args-until-success 
'org-persist-before-write-hook v associated))
+                       (plist-get collection :container)))
+      (when (or (file-exists-p org-persist-directory) 
(org-persist--save-index))
+        (let ((file (org-file-name-concat org-persist-directory (plist-get 
collection :persist-file)))
+              (data (mapcar (lambda (c) (cons c (org-persist-write:generic c 
collection)))
+                            (plist-get collection :container))))
+          (puthash file data org-persist--write-cache)
+          (org-persist--write-elisp-file file data)
+          (or ignore-return (org-persist-read container associated)))))))
+
+(defun org-persist-write-all (&optional associated)
+  "Save all the persistent data.
+When ASSOCIATED is non-nil, only save the matching data."
+  (unless org-persist--index (org-persist--load-index))
+  (setq associated (org-persist--normalize-associated associated))
+  (unless
+      (and (equal 1 (length org-persist--index))
+           ;; The single collection only contains a single container
+           ;; in the container list.
+           (equal 1 (length (plist-get (car org-persist--index) :container)))
+           ;; The container is an `index' container.
+           (eq 'index (caar (plist-get (car org-persist--index) :container)))
+           ;; No `org-persist-directory' exists yet.
+           (not (file-exists-p org-persist-directory)))
+    (let (all-containers)
+      (dolist (collection org-persist--index)
+        (if associated
+            (when collection
+              (cl-pushnew (plist-get collection :container) all-containers 
:test #'equal))
+          (condition-case err
+              (org-persist-write (plist-get collection :container) (plist-get 
collection :associated) t)
+            (error
+             (message "%s. Deleting bad index entry." err)
+             (org-persist--remove-from-index collection)
+             nil))))
+      (dolist (container all-containers)
+        (let ((collection (org-persist--find-index `(:container ,container 
:associated ,associated))))
+          (when collection
+            (condition-case err
+                (org-persist-write container associated t)
+              (error
+               (message "%s. Deleting bad index entry." err)
+               (org-persist--remove-from-index collection)
+               nil))))))))
+
+(defun org-persist-write-all-buffer ()
+  "Call `org-persist-write-all' in current buffer.
+Do nothing in an indirect buffer."
+  (unless (buffer-base-buffer (current-buffer))
+    (org-persist-write-all (current-buffer))))
+
+(defalias 'org-persist-gc:elisp #'ignore)
+(defalias 'org-persist-gc:index #'ignore)
+
+(defun org-persist-gc:file (container collection)
+  "Garbage collect file CONTAINER in COLLECTION."
+  (let ((file (org-persist-read container (plist-get collection :associated))))
+    (when (file-exists-p file)
+      (delete-file file))))
+
+(defun org-persist-gc:url (container collection)
+  "Garbage collect url CONTAINER in COLLECTION."
+  (let ((file (org-persist-read container (plist-get collection :associated))))
+    (when (file-exists-p file)
+      (delete-file file))))
+
+(defmacro org-persist--gc-persist-file (persist-file)
+  "Garbage collect PERSIST-FILE."
+  `(when (file-exists-p ,persist-file)
+     (delete-file ,persist-file)
+     (when (org-directory-empty-p (file-name-directory ,persist-file))
+       (delete-directory (file-name-directory ,persist-file)))))
+
+(defun org-persist-gc ()
+  "Remove expired or unregistered containers.
+Also, remove containers associated with non-existing files."
+  (let (new-index (remote-files-num 0))
+    (dolist (collection org-persist--index)
+      (let* ((file (plist-get (plist-get collection :associated) :file))
+             (file-remote (when file (file-remote-p file)))
+             (persist-file (when (plist-get collection :persist-file)
+                             (org-file-name-concat
+                              org-persist-directory
+                              (plist-get collection :persist-file))))
+             (expired? (org-persist--gc-expired-p
+                        (plist-get collection :expiry) collection)))
+        (when persist-file
+          (when file
+            (when file-remote (cl-incf remote-files-num))
+            (unless (if (not file-remote)
+                        (file-exists-p file)
+                      (pcase org-persist-remote-files
+                        ('t t)
+                        ('check-existence
+                         (file-exists-p file))
+                        ((pred numberp)
+                         (<= org-persist-remote-files remote-files-num))
+                        (_ nil)))
+              (setq expired? t)))
+          (if expired?
+              (org-persist--gc-persist-file persist-file)
+            (push collection new-index)))))
+    (setq org-persist--index (nreverse new-index))))
+
+;; Automatically write the data, but only when we have write access.
+(let ((dir (directory-file-name
+            (file-name-as-directory org-persist-directory))))
+  (while (and (not (file-exists-p dir))
+              (not (equal dir (setq dir (directory-file-name
+                                         (file-name-directory dir)))))))
+  (if (not (file-writable-p dir))
+      (message "Missing write access rights to org-persist-directory: %S"
+               org-persist-directory)
+    (add-hook 'kill-emacs-hook #'org-persist-write-all)
+    ;; `org-persist-gc' should run before `org-persist-write-all'.
+    ;; So we are adding the hook after `org-persist-write-all'.
+    (add-hook 'kill-emacs-hook #'org-persist-gc)))
+
+;; Point to temp directory when `org-persist--disable-when-emacs-Q' is set.
+(if (and org-persist--disable-when-emacs-Q
+         ;; FIXME: This is relying on undocumented fact that
+         ;; Emacs sets `user-init-file' to nil when loaded with
+         ;; "-Q" argument.
+         (not user-init-file))
+    (setq org-persist-directory
+          (make-temp-file "org-persist-" 'dir)))
+
+(add-hook 'after-init-hook #'org-persist-load-all)
+
+(provide 'org-persist)
+
+;;; org-persist.el ends here
diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el
index 1912f6762a..ef6b5aa057 100644
--- a/lisp/org/org-plot.el
+++ b/lisp/org/org-plot.el
@@ -3,9 +3,9 @@
 ;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric Schulte <schulte dot eric at gmail dot com>
-;; Maintainer: TEC <tecosaur@gmail.com>
+;; Maintainer: TEC <orgmode@tec.tecosaur.net>
 ;; Keywords: tables, plotting
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -31,6 +31,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org)
 (require 'org-table)
@@ -280,7 +283,7 @@ When NORMALIZE is non-nil, the count is divided by the 
number of values."
             collect (cons n (/ (length m) normaliser)))))
 
 (defun org--plot/prime-factors (value)
-  "Return the prime decomposition of VALUE, e.g. for 12, \\='(3 2 2)."
+  "Return the prime decomposition of VALUE, e.g. for 12, (3 2 2)."
   (let ((factors '(1)) (i 1))
     (while (/= 1 value)
       (setq i (1+ i))
@@ -291,6 +294,11 @@ When NORMALIZE is non-nil, the count is divided by the 
number of values."
        ))
     (cl-subseq factors 0 -1)))
 
+(defgroup org-plot nil
+  "Options for plotting in Org mode."
+  :tag "Org Plot"
+  :group 'org)
+
 (defcustom org-plot/gnuplot-script-preamble ""
   "String of function to be inserted before the gnuplot plot command is run.
 
@@ -668,7 +676,8 @@ line directly before or after the table."
           (num-cols (length (if (eq (nth 0 table) 'hline) (nth 1 table)
                               (nth 0 table))))
           (type (assoc (plist-get params :plot-type)
-                       org-plot/preset-plot-types)))
+                       org-plot/preset-plot-types))
+           gnuplot-script)
 
       (unless type
        (user-error "Org-plot type `%s' is undefined" (plist-get params 
:plot-type)))
@@ -702,16 +711,17 @@ line directly before or after the table."
                                  ind-column))
                 (plist-put params :textind t))))) ; ind holds text
       ;; Write script.
+      (setq gnuplot-script
+            (org-plot/gnuplot-script
+             table data-file num-cols params (plist-get params :script)))
       (with-temp-buffer
        (if (plist-get params :script)  ; user script
-           (progn (insert
-                   (org-plot/gnuplot-script table data-file num-cols params t))
-                  (insert "\n")
+           (progn (insert gnuplot-script "\n")
                   (insert-file-contents (plist-get params :script))
                   (goto-char (point-min))
                   (while (re-search-forward "\\$datafile" nil t)
                     (replace-match data-file nil nil)))
-         (insert (org-plot/gnuplot-script table data-file num-cols params)))
+         (insert gnuplot-script))
        ;; Graph table.
        (gnuplot-mode)
         (condition-case nil
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el
index cd99f30e7b..9ce21cf2ac 100644
--- a/lisp/org/org-protocol.el
+++ b/lisp/org/org-protocol.el
@@ -128,12 +128,14 @@
 ;;
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'org)
 (require 'ol)
 
 (declare-function org-publish-get-project-from-filename "ox-publish"
                  (filename &optional up))
-(declare-function server-edit "server" (&optional arg))
 
 (defvar org-capture-link-is-already-stored)
 (defvar org-capture-templates)
@@ -173,7 +175,6 @@ The filenames passed on the command line are passed to the 
emacs-server in
 reverse order.  Set to t (default) to re-reverse the list, i.e. use the
 sequence on the command line.  If nil, the sequence of the filenames is
 unchanged."
-  :group 'org-protocol
   :type 'boolean)
 
 (defcustom org-protocol-project-alist nil
@@ -232,7 +233,6 @@ Example:
 Consider using the interactive functions `org-protocol-create'
 and `org-protocol-create-for-org' to help you filling this
 variable with valid contents."
-  :group 'org-protocol
   :type 'alist)
 
 (defcustom org-protocol-protocol-alist nil
@@ -283,20 +283,17 @@ Here is an example:
         (\"your-protocol\"
          :protocol \"your-protocol\"
          :function your-protocol-handler-function)))"
-  :group 'org-protocol
   :type '(alist))
 
 (defcustom org-protocol-default-template-key nil
   "The default template key to use.
 This is usually a single character string but can also be a
 string with two characters."
-  :group 'org-protocol
   :type '(choice (const nil) (string)))
 
 (defcustom org-protocol-data-separator "/+\\|\\?"
   "The default data separator to use.
 This should be a single regexp string."
-  :group 'org-protocol
   :version "24.4"
   :package-version '(Org . "8.0")
   :type 'regexp)
@@ -308,7 +305,8 @@ This should be a single regexp string."
 Emacsclient compresses double and triple slashes."
   (when (string-match "^\\([a-z]+\\):/" uri)
     (let* ((splitparts (split-string uri "/+")))
-      (setq uri (concat (car splitparts) "//" (mapconcat 'identity (cdr 
splitparts) "/")))))
+      (setq uri (concat (car splitparts) "//"
+                        (mapconcat #'identity (cdr splitparts) "/")))))
   uri)
 
 (defun org-protocol-split-data (data &optional unhexify separator)
@@ -370,6 +368,7 @@ returned list."
          ret)
       l)))
 
+;; `flatten-tree' was added in Emacs 27.1.
 (defalias 'org-protocol-flatten
   (if (fboundp 'flatten-tree) 'flatten-tree
     (lambda (list)
@@ -548,10 +547,10 @@ Now template ?b will be used."
   "Convert QUERY key=value pairs in the URL to a property list."
   (when query
     (let ((plus-decoded (replace-regexp-in-string "\\+" " " query t t)))
-      (apply 'append (mapcar (lambda (x)
-                              (let ((c (split-string x "=")))
-                                (list (intern (concat ":" (car c))) (cadr c))))
-                            (split-string plus-decoded "&"))))))
+      (cl-mapcan (lambda (x)
+                  (let ((c (split-string x "=")))
+                    (list (intern (concat ":" (car c))) (cadr c))))
+                (split-string plus-decoded "&")))))
 
 (defun org-protocol-open-source (fname)
   "Process an org-protocol://open-source?url= style URL with FNAME.
@@ -640,7 +639,7 @@ Old-style links such as 
\"protocol://sub-protocol://param1/param2\" are
 also recognized.
 
 If a matching protocol is found, the protocol is stripped from
-fname and the result is passed to the protocol function as the
+FNAME and the result is passed to the protocol function as the
 first parameter.  The second parameter will be non-nil if FNAME
 uses key=val&key2=val2-type arguments, or nil if FNAME uses
 val/val2-type arguments.  If the function returns nil, the
@@ -670,7 +669,8 @@ CLIENT is ignored."
                       (new-style (not (= ?: (aref (match-string 1 fname) 0)))))
                   (when (plist-get (cdr prolist) :kill-client)
                    (message "Greedy org-protocol handler.  Killing client.")
-                   (server-edit))
+                   ;; If not fboundp, there's no client to kill.
+                   (if (fboundp 'server-edit) (server-edit)))
                   (when (fboundp func)
                     (unless greedy
                       (throw 'fname
@@ -686,12 +686,12 @@ to deal with new-style links.")
                     (throw 'fname t))))))))
       fname)))
 
-(defadvice server-visit-files (before org-protocol-detect-protocol-server 
activate)
+(advice-add 'server-visit-files :around #'org--protocol-detect-protocol-server)
+(defun org--protocol-detect-protocol-server (orig-fun files client &rest args)
   "Advice server-visit-flist to call 
`org-protocol-check-filename-for-protocol'."
   (let ((flist (if org-protocol-reverse-list-of-files
-                   (reverse  (ad-get-arg 0))
-                 (ad-get-arg 0)))
-        (client (ad-get-arg 1)))
+                   (reverse files)
+                 files)))
     (catch 'greedy
       (dolist (var flist)
        ;; `\' to `/' on windows.  FIXME: could this be done any better?
@@ -700,11 +700,16 @@ to deal with new-style links.")
                       fname (member var flist)  client))
           (if (eq fname t) ;; greedy? We need the t return value.
               (progn
-                (ad-set-arg 0 nil)
+                ;; FIXME: Doesn't this just ignore all the files before
+                ;; this one (the remaining ones have been passed to
+                ;; `org-protocol-check-filename-for-protocol' but not
+                ;; the ones before).
+                (setq files nil)
                 (throw 'greedy t))
             (if (stringp fname) ;; probably filename
                 (setcar var fname)
-              (ad-set-arg 0 (delq var (ad-get-arg 0))))))))))
+              (setq files (delq var files)))))))
+    (apply orig-fun files client args)))
 
 ;;; Org specific functions:
 
diff --git a/lisp/org/org-refile.el b/lisp/org/org-refile.el
index 3b3344b270..8c514b9d0b 100644
--- a/lisp/org/org-refile.el
+++ b/lisp/org/org-refile.el
@@ -25,6 +25,8 @@
 ;; Org Refile allows you to refile subtrees to various locations.
 
 ;;; Code:
+(require 'org-macs)
+(org-assert-version)
 
 (require 'org)
 
@@ -95,7 +97,7 @@ You can set the variable `org-refile-target-verify-function' 
to a function
 to verify each headline found by the simple criteria above.
 
 When this variable is nil, all top-level headlines in the current buffer
-are used, equivalent to the value `((nil . (:level . 1))'."
+are used, equivalent to the value `((nil . (:level . 1)))'."
   :group 'org-refile
   :type '(repeat
          (cons
@@ -153,12 +155,14 @@ When `full-file-path', include the full file path.
 
 When `buffer-name', use the buffer name."
   :group 'org-refile
+  :package-version '(Org . "9.6")
   :type '(choice
          (const :tag "Not" nil)
          (const :tag "Yes" t)
          (const :tag "Start with file name" file)
          (const :tag "Start with full file path" full-file-path)
-         (const :tag "Start with buffer name" buffer-name)))
+         (const :tag "Start with buffer name" buffer-name)
+         (const :tag "Start with document title" title)))
 
 (defcustom org-outline-path-complete-in-steps t
   "Non-nil means complete the outline path in hierarchical steps.
@@ -317,6 +321,11 @@ converted to a headline before refiling."
                 (push (list (and (buffer-file-name (buffer-base-buffer))
                                   (file-truename (buffer-file-name 
(buffer-base-buffer))))
                              f nil nil) tgs))
+               (when (eq org-refile-use-outline-path 'title)
+                 (push (list (or (org-get-title)
+                                 (and f (file-name-nondirectory f)))
+                             f nil nil)
+                       tgs))
               (org-with-wide-buffer
                (goto-char (point-min))
                (setq org-outline-path-cache nil)
@@ -343,7 +352,12 @@ converted to a headline before refiling."
                                            (and (buffer-file-name 
(buffer-base-buffer))
                                                 (file-name-nondirectory
                                                  (buffer-file-name 
(buffer-base-buffer))))))
-                                  (`full-file-path
+                                   (`title (list
+                                            (or (org-get-title)
+                                                (and (buffer-file-name 
(buffer-base-buffer))
+                                                     (file-name-nondirectory
+                                                      (buffer-file-name 
(buffer-base-buffer)))))))
+                                   (`full-file-path
                                    (list (buffer-file-name
                                           (buffer-base-buffer))))
                                   (`buffer-name
@@ -521,7 +535,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
                (goto-char (cond (pos)
                                 ((org-notes-order-reversed-p) (point-min))
                                 (t (point-max))))
-               (org-show-context 'org-goto))
+               (org-fold-show-context 'org-goto))
            (if regionp
                (progn
                  (org-kill-new (buffer-substring region-start region-end))
@@ -631,7 +645,7 @@ this function appends the default value from
         (tbl (mapcar
               (lambda (x)
                 (if (and (not (member org-refile-use-outline-path
-                                      '(file full-file-path)))
+                                      '(file full-file-path title)))
                          (not (equal filename (nth 1 x))))
                     (cons (concat (car x) extra " ("
                                   (file-name-nondirectory (nth 1 x)) ")")
@@ -643,10 +657,7 @@ this function appends the default value from
          (prompt (let ((default (or (car org-refile-history)
                                     (and (assoc cbnex tbl) (setq cdef cbnex)
                                          cbnex))))
-                   ;; `format-prompt' is new in Emacs 28.1.
-                   (if (fboundp 'format-prompt)
-                       (format-prompt prompt default)
-                     (concat prompt " (default " default ": "))))
+                   (org-format-prompt prompt default)))
         pa answ parent-target child parent old-hist)
     (setq old-hist org-refile-history)
     (setq answ (funcall cfunc prompt tbl nil (not new-nodes)
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index 89d0c28a43..7d5f5d5431 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -6,7 +6,7 @@
 ;;        Bastien Guerry <bzg@gnu.org>
 ;;         Dan Davison <davison at stats dot ox dot ac dot uk>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -31,19 +31,25 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ob-comint)
 (require 'org-macs)
 (require 'org-compat)
 (require 'org-keys)
 
+(declare-function org--get-expected-indentation "org" (element contentsp))
 (declare-function org-mode "org" ())
 (declare-function org--get-expected-indentation "org" (element contentsp))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-fold-region "org-fold" (from to flag &optional 
spec-or-alias))
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-class "org-element" (datum &optional parent))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-lineage "org-element"
                  (blob &optional types with-self))
+(declare-function org-element--parse-paired-brackets "org-element" (char))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-footnote-goto-definition "org-footnote"
@@ -169,6 +175,7 @@ Values that modify the window layout (reorganize-frame, 
split-window-below,
 split-window-right) will restore the layout after exiting the edit buffer."
   :group 'org-edit-structure
   :type '(choice
+          (const plain)
          (const current-window)
          (const split-window-below)
          (const split-window-right)
@@ -196,12 +203,14 @@ but which mess up the display of a snippet in Org 
exported files.")
     ("calc" . fundamental)
     ("cpp" . c++)
     ("ditaa" . artist)
+    ("desktop" . conf-desktop)
     ("dot" . fundamental)
     ("elisp" . emacs-lisp)
     ("ocaml" . tuareg)
     ("screen" . shell-script)
     ("shell" . sh)
-    ("sqlite" . sql))
+    ("sqlite" . sql)
+    ("toml" . conf-toml))
   "Alist mapping languages to their major mode.
 
 The key is the language name.  The value is the mode name, as
@@ -212,6 +221,7 @@ not the case, this variable provides a way to simplify 
things on
 the user side.  For example, there is no `ocaml-mode' in Emacs,
 but the mode to use is `tuareg-mode'."
   :group 'org-edit-structure
+  :package-version '(Org . "9.6")
   :type '(repeat
          (cons
           (string "Language name")
@@ -225,12 +235,13 @@ Each element is a cell of the format
 
 Where FACE is either a defined face or an anonymous face.
 
-For instance, the following value would color the background of
+For instance, the following would color the background of
 emacs-lisp source blocks and python source blocks in purple and
 green, respectability.
 
-    \\='((\"emacs-lisp\" (:background \"#EEE2FF\"))
-      (\"python\" (:background \"#e5ffb8\")))"
+  (setq org-src-block-faces
+        \\='((\"emacs-lisp\" (:background \"#EEE2FF\"))
+          (\"python\" (:background \"#e5ffb8\"))))"
   :group 'org-edit-structure
   :type '(repeat (list (string :tag "language")
                        (choice
@@ -240,8 +251,7 @@ green, respectability.
   :package-version '(Org . "9.0"))
 
 (defcustom org-src-tab-acts-natively t
-  "If non-nil, the effect of TAB in a code block is as if it were
-issued in the language major mode buffer."
+  "If non-nil, TAB uses the language's major-mode binding in code blocks."
   :type 'boolean
   :package-version '(Org . "9.4")
   :group 'org-babel)
@@ -304,7 +314,8 @@ is 0.")
 (put 'org-src--preserve-blank-line 'permanent-local t)
 
 (defun org-src--construct-edit-buffer-name (org-buffer-name lang)
-  "Construct the buffer name for a source editing buffer."
+  "Construct the buffer name for a source editing buffer.
+Format is \"*Org Src ORG-BUFFER-NAME [ LANG ]*\"."
   (concat "*Org Src " org-buffer-name "[ " lang " ]*"))
 
 (defun org-src--edit-buffer (beg end)
@@ -378,7 +389,7 @@ where BEG and END are buffer positions and CONTENTS is a 
string."
        (let ((beg (org-element-property :contents-begin datum))
             (end (org-element-property :contents-end datum)))
         (list beg end (buffer-substring-no-properties beg end))))
-      ((memq type '(example-block export-block src-block))
+      ((memq type '(example-block export-block src-block comment-block))
        (list (progn (goto-char (org-element-property :post-affiliated datum))
                    (line-beginning-position 2))
             (progn (goto-char (org-element-property :end datum))
@@ -524,11 +535,11 @@ Leave point in edit buffer."
             (block-ind (org-with-point-at (org-element-property :begin datum)
                           (cond
                            ((save-excursion (skip-chars-backward " \t") (bolp))
-                           (current-indentation))
+                           (org-current-text-indentation))
                            ((org-element-property :parent datum)
                             (org--get-expected-indentation
                              (org-element-property :parent datum) nil))
-                           (t (current-indentation)))))
+                           (t (org-current-text-indentation)))))
             (content-ind org-edit-src-content-indentation)
              (blank-line (save-excursion (beginning-of-line)
                                          (looking-at-p "^[[:space:]]*$")))
@@ -613,8 +624,9 @@ Leave point in edit buffer."
 
 ;;; Fontification of source blocks
 
+(defvar org-src-fontify-natively) ; Defined in org.el
 (defun org-src-font-lock-fontify-block (lang start end)
-  "Fontify code block.
+  "Fontify code block between START and END using LANG's syntax.
 This function is called by Emacs' automatic fontification, as long
 as `org-src-fontify-natively' is non-nil."
   (let ((lang-mode (org-src-get-lang-mode lang)))
@@ -631,27 +643,123 @@ as `org-src-fontify-natively' is non-nil."
            ;; Add string and a final space to ensure property change.
            (insert string " "))
          (unless (eq major-mode lang-mode) (funcall lang-mode))
-         (org-font-lock-ensure)
+          (font-lock-ensure)
          (let ((pos (point-min)) next)
            (while (setq next (next-property-change pos))
              ;; Handle additional properties from font-lock, so as to
              ;; preserve, e.g., composition.
-             (dolist (prop (cons 'face font-lock-extra-managed-props))
+              ;; FIXME: We copy 'font-lock-face property explicitly because
+              ;; `font-lock-mode' is not enabled in the buffers starting from
+              ;; space and the remapping between 'font-lock-face and 'face
+              ;; text properties may thus not be set.  See commit
+              ;; 453d634bc.
+             (dolist (prop (append '(font-lock-face face) 
font-lock-extra-managed-props))
                (let ((new-prop (get-text-property pos prop)))
-                 (put-text-property
-                  (+ start (1- pos)) (1- (+ start next)) prop new-prop
-                  org-buffer)))
-             (setq pos next))))
+                  (when new-prop
+                    (if (not (eq prop 'invisible))
+                       (put-text-property
+                        (+ start (1- pos)) (1- (+ start next)) prop new-prop
+                        org-buffer)
+                      ;; Special case.  `invisible' text property may
+                      ;; clash with Org folding.  Do not assign
+                      ;; `invisible' text property directly.  Use
+                      ;; property alias instead.
+                      (let ((invisibility-spec
+                             (or
+                              ;; ATOM spec.
+                              (and (memq new-prop buffer-invisibility-spec)
+                                   new-prop)
+                              ;; (ATOM . ELLIPSIS) spec.
+                              (assq new-prop buffer-invisibility-spec))))
+                        (with-current-buffer org-buffer
+                          ;; Add new property alias.
+                          (unless (memq 'org-src-invisible
+                                        (cdr (assq 'invisible 
char-property-alias-alist)))
+                            (setq-local
+                             char-property-alias-alist
+                             (cons (cons 'invisible
+                                        (nconc (cdr (assq 'invisible 
char-property-alias-alist))
+                                                '(org-src-invisible)))
+                                  (remove (assq 'invisible 
char-property-alias-alist)
+                                          char-property-alias-alist))))
+                          ;; Carry over the invisibility spec, unless
+                          ;; already present.  Note that there might
+                          ;; be conflicting invisibility specs from
+                          ;; different major modes.  We cannot do much
+                          ;; about this then.
+                          (when invisibility-spec
+                            (add-to-invisibility-spec invisibility-spec))
+                          (put-text-property
+                          (+ start (1- pos)) (1- (+ start next))
+                           'org-src-invisible new-prop
+                          org-buffer)))))))
+             (setq pos next)))
+          (set-buffer-modified-p nil))
        ;; Add Org faces.
        (let ((src-face (nth 1 (assoc-string lang org-src-block-faces t))))
           (when (or (facep src-face) (listp src-face))
             (font-lock-append-text-property start end 'face src-face))
          (font-lock-append-text-property start end 'face 'org-block))
+        ;; Clear abbreviated link folding.
+        (org-fold-region start end nil 'org-link)
        (add-text-properties
         start end
         '(font-lock-fontified t fontified t font-lock-multiline t))
        (set-buffer-modified-p modified)))))
 
+(defun org-fontify-inline-src-blocks (limit)
+  "Try to apply `org-fontify-inline-src-blocks-1'."
+  (condition-case nil
+      (org-fontify-inline-src-blocks-1 limit)
+    (error (message "Org mode fontification error in %S at %d"
+                    (current-buffer)
+                    (line-number-at-pos)))))
+
+(defun org-fontify-inline-src-blocks-1 (limit)
+  "Fontify inline src_LANG blocks, from `point' up to LIMIT."
+  (let ((case-fold-search t))
+    ;; The regexp below is copied from `org-element-inline-src-block-parser'.
+    (while (re-search-forward "\\_<src_\\([^ \t\n[{]+\\)[{[]?" limit t)
+      (let ((beg (match-beginning 0))
+            (lang-beg (match-beginning 1))
+            (lang-end (match-end 1))
+            pt)
+        (font-lock-append-text-property
+         lang-beg lang-end 'face 'org-meta-line)
+        (font-lock-append-text-property
+         beg lang-beg 'face 'shadow)
+        (font-lock-append-text-property
+         beg lang-end 'face 'org-inline-src-block)
+        (setq pt (goto-char lang-end))
+        ;; `org-element--parse-paired-brackets' doesn't take a limit, so to
+        ;; prevent it searching the entire rest of the buffer we temporarily
+        ;; narrow the active region.
+        (save-restriction
+          (narrow-to-region beg
+                            (min limit (or (save-excursion
+                                             (and (search-forward"\n" limit t 
2)
+                                                  (point)))
+                                           (point-max))))
+          (when (ignore-errors (org-element--parse-paired-brackets ?\[))
+            (font-lock-append-text-property
+             pt (point) 'face 'org-inline-src-block)
+            (setq pt (point)))
+          (when (ignore-errors (org-element--parse-paired-brackets ?\{))
+            (remove-text-properties pt (point) '(face nil))
+            (font-lock-append-text-property
+             pt (1+ pt) 'face '(org-inline-src-block shadow))
+            (unless (= (1+ pt) (1- (point)))
+              (if org-src-fontify-natively
+                  (org-src-font-lock-fontify-block
+                   (buffer-substring-no-properties lang-beg lang-end)
+                   (1+ pt) (1- (point)))
+                (font-lock-append-text-property
+                 (1+ pt) (1- (point)) 'face 'org-inline-src-block)))
+            (font-lock-append-text-property
+             (1- (point)) (point) 'face '(org-inline-src-block shadow))
+            (setq pt (point)))))
+      t)))
+
 
 ;;; Escape contents
 
@@ -760,7 +868,9 @@ See also `org-src-mode-hook'."
 ;;; Babel related functions
 
 (defun org-src-associate-babel-session (info)
-  "Associate edit buffer with comint session."
+  "Associate edit buffer with comint session.
+INFO should be a list similar in format to the return value of
+`org-babel-get-src-block-info'."
   (interactive)
   (let ((session (cdr (assq :session (nth 2 info)))))
     (and session (not (string= session "none"))
@@ -770,6 +880,7 @@ See also `org-src-mode-hook'."
            (and (fboundp f) (funcall f session))))))
 
 (defun org-src-babel-configure-edit-buffer ()
+  "Configure src editing buffer."
   (when org-src--babel-info
     (org-src-associate-babel-session org-src--babel-info)))
 
@@ -842,6 +953,7 @@ Raise an error when current buffer is not a source editing 
buffer."
   org-src--source-type)
 
 (defun org-src-switch-to-buffer (buffer context)
+  "Switch to BUFFER considering CONTEXT and `org-src-window-setup'."
   (pcase org-src-window-setup
     (`plain
      (when (eq context 'exit) (quit-restore-window))
@@ -1090,6 +1202,29 @@ Throw an error when not at an export block."
        (lambda () (org-escape-code-in-region (point-min) (point-max)))))
     t))
 
+(defun org-edit-comment-block ()
+  "Edit comment block at point.
+\\<org-src-mode-map>
+A new buffer is created and the block is copied into it, and the
+buffer is switched into Org mode.
+
+When done, exit with `\\[org-edit-src-exit]'.  The edited text will
+then replace the area in the Org mode buffer.
+
+Throw an error when not at a comment block."
+  (interactive)
+  (let ((element (org-element-at-point)))
+    (unless (and (eq (org-element-type element) 'comment-block)
+                (org-src--on-datum-p element))
+      (user-error "Not in a comment block"))
+    (org-src--edit-element
+     element
+     (org-src--construct-edit-buffer-name (buffer-name) "org")
+     'org-mode
+     (lambda () (org-escape-code-in-region (point-min) (point-max)))
+     (org-unescape-code-in-string (org-element-property :value element)))
+    t))
+
 (defun org-edit-src-code (&optional code edit-buffer-name)
   "Edit the source or example block at point.
 \\<org-src-mode-map>
@@ -1116,7 +1251,7 @@ name of the sub-editing buffer."
              "example"))
           (lang-f (and (eq type 'src-block) (org-src-get-lang-mode lang)))
           (babel-info (and (eq type 'src-block)
-                           (org-babel-get-src-block-info 'light)))
+                           (org-babel-get-src-block-info 'no-eval)))
           deactivate-mark)
       (when (and (eq type 'src-block) (not (functionp lang-f)))
        (error "No such language mode: %s" lang-f))
@@ -1148,7 +1283,7 @@ name of the sub-editing buffer."
       (user-error "Not on inline source code"))
     (let* ((lang (org-element-property :language context))
           (lang-f (org-src-get-lang-mode lang))
-          (babel-info (org-babel-get-src-block-info 'light))
+          (babel-info (org-babel-get-src-block-info 'no-eval))
           deactivate-mark)
       (unless (functionp lang-f) (error "No such language mode: %s" lang-f))
       (org-src--edit-element
@@ -1204,11 +1339,12 @@ the area in the Org mode buffer."
   (interactive)
   (let (org-src--allow-write-back) (org-edit-src-exit)))
 
-(defun org-edit-src-continue (e)
+(defun org-edit-src-continue (event)
   "Unconditionally return to buffer editing area under point.
-Throw an error if there is no such buffer."
+Throw an error if there is no such buffer.
+EVENT is passed to `mouse-set-point'."
   (interactive "e")
-  (mouse-set-point e)
+  (mouse-set-point event)
   (let ((buf (get-char-property (point) 'edit-buffer)))
     (if buf (org-src-switch-to-buffer buf 'continue)
       (user-error "No sub-editing buffer for area at point"))))
@@ -1272,8 +1408,8 @@ Throw an error if there is no such buffer."
     (org-with-wide-buffer
      (when (and write-back
                 (not (equal (buffer-substring beg end)
-                           (with-current-buffer write-back-buf
-                              (buffer-string)))))
+                         (with-current-buffer write-back-buf
+                            (buffer-string)))))
        (undo-boundary)
        (goto-char beg)
        (let ((expecting-bol (bolp)))
@@ -1294,8 +1430,10 @@ Throw an error if there is no such buffer."
       (goto-char beg)
       (cond
        ;; Block is hidden; move at start of block.
-       ((cl-some (lambda (o) (eq (overlay-get o 'invisible) 'org-hide-block))
-                (overlays-at (point)))
+       ((if (eq org-fold-core-style 'text-properties)
+            (org-fold-folded-p nil 'block)
+          (cl-some (lambda (o) (eq (overlay-get o 'invisible) 'org-hide-block))
+                  (overlays-at (point))))
        (beginning-of-line 0))
        (write-back (org-src--goto-coordinates coordinates beg end))))
     ;; Clean up left-over markers and restore window configuration.
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 9b692d0973..fa9a0319be 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -34,10 +34,14 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org-macs)
 (require 'org-compat)
 (require 'org-keys)
+(require 'org-fold-core)
 
 (declare-function calc-eval "calc" (str &optional separator &rest args))
 (declare-function face-remap-remove-relative "face-remap" (cookie))
@@ -47,7 +51,7 @@
 (declare-function org-mode "org" ())
 (declare-function org-duration-p "org-duration" (duration &optional canonical))
 (declare-function org-duration-to-minutes "org-duration" (duration &optional 
canonical))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-contents "org-element" (element))
 (declare-function org-element-extract-element "org-element" (element))
 (declare-function org-element-interpret-data "org-element" (data))
@@ -56,6 +60,7 @@
 (declare-function org-element-parse-buffer "org-element" (&optional 
granularity visible-only))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
+(declare-function org-element-cache-reset "org-element" (&optional all 
no-persistence))
 (declare-function org-entry-get "org" (pom property &optional inherit 
literal-nil))
 (declare-function org-export-create-backend "ox" (&rest rest) t)
 (declare-function org-export-data-with-backend "ox" (data backend info))
@@ -566,11 +571,23 @@ This works for both table types.")
   (concat "\\(" "@[-0-9I$]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\)")
   "Match a reference that needs translation, for reference display.")
 
-(defconst org-table-separator-space
+(defconst org-table--separator-space-pre
   (propertize " " 'display '(space :relative-width 1))
-  "Space used around fields when aligning the table.
+  "Space used in front of fields when aligning the table.
 This space serves as a segment separator for the purposes of the
-bidirectional reordering.")
+bidirectional reordering.
+Note that `org-table--separator-space-pre' is not `eq' to
+`org-table--separator-space-post'.  This is done to prevent Emacs from
+visually merging spaces in an empty table cell.  See bug#45915.")
+
+(defconst org-table--separator-space-post
+  (propertize " " 'display '(space :relative-width 1.001))
+  "Space used after fields when aligning the table.
+This space serves as a segment separator for the purposes of the
+bidirectional reordering.
+Note that `org-table--separator-space-pre' is not `eq' to
+`org-table--separator-space-post'.  This is done to prevent Emacs from
+visually merging spaces in an empty table cell.  See bug#45915.")
 
 
 ;;; Internal Variables
@@ -843,7 +860,11 @@ SIZE is a string Columns x Rows like for example \"3x2\"."
   "Convert region to a table.
 
 The region goes from BEG0 to END0, but these borders will be moved
-slightly, to make sure a beginning of line in the first line is included.
+slightly, to make sure a beginning of line in the first line is
+included.
+
+Throw an error when the region has more than
+`org-table-convert-region-max-lines' lines.
 
 SEPARATOR specifies the field separator in the lines.  It can have the
 following values:
@@ -1339,6 +1360,9 @@ However, when FORCE is non-nil, create new columns if 
necessary."
   "Insert a new column into the table."
   (interactive)
   (unless (org-at-table-p) (user-error "Not at a table"))
+  (when (eobp) (save-excursion (insert "\n")))
+  (unless (string-match-p "|[ \t]*$" (org-current-line-string))
+    (org-table-align))
   (org-table-find-dataline)
   (let ((col (max 1 (org-table-current-column)))
        (beg (org-table-begin))
@@ -1633,6 +1657,9 @@ Swap with anything in target cell."
 With prefix ARG, insert below the current line."
   (interactive "P")
   (unless (org-at-table-p) (user-error "Not at a table"))
+  (when (eobp) (save-excursion (insert "\n")))
+  (unless (string-match-p "|[ \t]*$" (org-current-line-string))
+    (org-table-align))
   (org-table-with-shrunk-columns
    (let* ((line (buffer-substring (line-beginning-position) 
(line-end-position)))
          (new (org-table-clean-line line)))
@@ -2254,13 +2281,14 @@ For all numbers larger than LIMIT, shift them by DELTA."
                 (format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
            s n a)
        (when remove
-          (while (re-search-forward re2 (line-end-position) t)
-           (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
-             (if (equal (char-before (match-beginning 0)) ?.)
-                 (user-error
-                  "Change makes TBLFM term %s invalid, use undo to recover"
-                  (match-string 0))
-               (replace-match "")))))
+          (save-excursion
+            (while (re-search-forward re2 (line-end-position) t)
+             (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
+               (if (equal (char-before (match-beginning 0)) ?.)
+                   (user-error
+                    "Change makes TBLFM term %s invalid, use undo to recover"
+                    (match-string 0))
+                 (replace-match ""))))))
         (while (re-search-forward re (line-end-position) t)
          (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
            (setq s (match-string 1) n (string-to-number s))
@@ -2607,8 +2635,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
-                            (save-match-data (org-parse-time-string ts))))))
+                     (save-match-data (org-time-string-to-time ts)))))
                 form t t))
 
          (setq ev (if (and duration (string-match 
"^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form))
@@ -2869,7 +2896,7 @@ ARGS are passed as arguments to the `message' function.  
Returns
 current time if a message is printed, otherwise returns T1.  If
 T1 is nil, always messages."
   (let ((curtime (current-time)))
-    (if (or (not t1) (org-time-less-p 1 (org-time-subtract curtime t1)))
+    (if (or (not t1) (time-less-p 1 (time-subtract curtime t1)))
        (progn (apply 'message args)
               curtime)
       t1)))
@@ -3415,7 +3442,9 @@ full TBLFM line."
 (defun org-table-convert-refs-to-an (s)
   "Convert spreadsheet references from to @7$28 to AB7.
 Works for single references, but also for entire formulas and even the
-full TBLFM line."
+full TBLFM line.
+
+Leave the relative references unchanged."
   (while (string-match "@\\([0-9]+\\)\\$\\([0-9]+\\)" s)
     (setq s (replace-match
             (format "%s%d"
@@ -3423,7 +3452,7 @@ full TBLFM line."
                      (string-to-number (match-string 2 s)))
                     (string-to-number (match-string 1 s)))
             t t s)))
-  (while (string-match "\\(^\\|[^0-9a-zA-Z]\\)\\$\\([0-9]+\\)" s)
+  (while (string-match "\\(^\\|[^0-9a-zA-Z]\\)\\$\\([1-9][0-9]*\\)" s)
     (setq s (replace-match (concat "\\1"
                                   (org-number-to-letters
                                    (string-to-number (match-string 2 s))) "&")
@@ -3667,8 +3696,6 @@ With prefix ARG, apply the new formulas to the table."
       (goto-char pos)
       (call-interactively 'lisp-indent-line))
      ((looking-at "[$&@0-9a-zA-Z]+ *= *[^ \t\n']") (goto-char pos))
-     ((not (fboundp 'pp-buffer))
-      (user-error "Cannot pretty-print.  Command `pp-buffer' is not 
available"))
      ((looking-at "[$&@0-9a-zA-Z]+ *= *'(")
       (goto-char (- (match-end 0) 2))
       (setq beg (point))
@@ -3890,7 +3917,7 @@ mouse onto the overlay.
 
 When optional argument PRE is non-nil, assume the overlay is
 located at the beginning of the field, and prepend
-`org-table-separator-space' to it.  Otherwise, concatenate
+`org-table--separator-space-pre' to it.  Otherwise, concatenate
 `org-table-shrunk-column-indicator' at its end.
 
 Return the overlay."
@@ -3909,7 +3936,7 @@ Return the overlay."
     ;; Make sure overlays stays on top of table coordinates overlays.
     ;; See `org-table-overlay-coordinates'.
     (overlay-put o 'priority 1)
-    (let ((d (if pre (concat org-table-separator-space display)
+    (let ((d (if pre (concat org-table--separator-space-pre display)
               (concat display org-table-shrunk-column-indicator))))
       (org-overlay-display o d 'org-table t))
     o))
@@ -4082,7 +4109,7 @@ COLUMNS is a sorted list of column numbers.  BEG and END 
are,
 respectively, the beginning position and the end position of the
 table."
   (org-with-wide-buffer
-   (org-font-lock-ensure beg end)
+   (font-lock-ensure beg end)
    (dolist (c columns)
      (goto-char beg)
      (let ((align nil)
@@ -4204,7 +4231,7 @@ beginning and end position of the current table."
      (org-table-expand begin end)
      ;; Make sure invisible characters in the table are at the right
      ;; place since column widths take them into account.
-     (org-font-lock-ensure begin end)
+     (font-lock-ensure begin end)
      (org-table--shrink-columns (sort columns #'<) begin end))))
 
 ;;;###autoload
@@ -4322,11 +4349,11 @@ FIELD is a string.  WIDTH is a number.  ALIGN is either 
\"c\",
                   ("r" (make-string spaces ?\s))
                   ("c" (make-string (/ spaces 2) ?\s))))
         (suffix (make-string (- spaces (length prefix)) ?\s)))
-    (concat org-table-separator-space
+    (concat org-table--separator-space-pre
            prefix
            field
            suffix
-           org-table-separator-space)))
+           org-table--separator-space-post)))
 
 (defun org-table-align ()
   "Align the table at point by aligning all vertical bars."
@@ -4336,7 +4363,7 @@ FIELD is a string.  WIDTH is a number.  ALIGN is either 
\"c\",
     (org-table-save-field
      ;; Make sure invisible characters in the table are at the right
      ;; place since column widths take them into account.
-     (org-font-lock-ensure beg end)
+     (font-lock-ensure beg end)
      (move-marker org-table-aligned-begin-marker beg)
      (move-marker org-table-aligned-end-marker end)
      (goto-char beg)
@@ -4422,6 +4449,13 @@ FIELD is a string.  WIDTH is a number.  ALIGN is either 
\"c\",
 (defun org-table-justify-field-maybe (&optional new)
   "Justify the current field, text to left, number to right.
 Optional argument NEW may specify text to replace the current field content."
+  ;; FIXME: Prevent newlines inside field.  They are currently not
+  ;; supported.
+  (when (and (stringp new) (string-match-p "\n" new))
+    (message "Removing newlines from formula result: %S" new)
+    (setq new (replace-regexp-in-string
+               "\n" " "
+               (replace-regexp-in-string "\\(^\n+\\)\\|\\(\n+$\\)" "" new))))
   (cond
    ((and (not new) org-table-may-need-update)) ; Realignment will happen anyway
    ((org-at-table-hline-p))
@@ -4564,8 +4598,8 @@ function is being called interactively."
             (predicate
              (cl-case sorting-type
                ((?n ?N ?t ?T) #'<)
-               ((?a ?A) (if with-case #'org-string-collate-lessp
-                          (lambda (s1 s2) (org-string-collate-lessp s1 s2 nil 
t))))
+               ((?a ?A) (if with-case #'string-collate-lessp
+                          (lambda (s1 s2) (string-collate-lessp s1 s2 nil t))))
                ((?f ?F)
                 (or compare-func
                     (and interactive?
@@ -5168,15 +5202,13 @@ When LOCAL is non-nil, show references for the table at 
point."
                    (concat orgtbl-line-start-regexp "\\|"
                            auto-fill-inhibit-regexp)
                  orgtbl-line-start-regexp))
-    (when (fboundp 'font-lock-add-keywords)
-      (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
-      (org-restart-font-lock)))
+    (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
+    (org-restart-font-lock))
    (t
     (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
     (remove-hook 'before-change-functions 'org-before-change-function t)
-    (when (fboundp 'font-lock-remove-keywords)
-      (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords)
-      (org-restart-font-lock))
+    (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords)
+    (org-restart-font-lock)
     (force-mode-line-update 'all))))
 
 (defun orgtbl-make-binding (fun n &rest keys)
@@ -5291,6 +5323,7 @@ to execute outside of tables."
       (org-remap orgtbl-mode-map
                 'self-insert-command 'orgtbl-self-insert-command
                 'delete-char 'org-delete-char
+                 'delete-forward-char 'org-delete-char
                 'delete-backward-char 'org-delete-backward-char)
       (org-defkey orgtbl-mode-map "|" 'org-force-self-insert))
     t))
@@ -5544,10 +5577,14 @@ First element has index 0, or I0 if given."
         beg end)
     (save-excursion
       (beginning-of-line 1)
-      (while (looking-at re) (beginning-of-line 0))
-      (beginning-of-line 2)
+      (while (and (not (eq (point) (point-min)))
+                  (looking-at re))
+        (beginning-of-line 0))
+      (unless (eq (point) (point-min)) (beginning-of-line 2))
       (setq beg (point))
-      (while (looking-at re) (beginning-of-line 2))
+      (while (and (not (eq (point) (point-max)))
+                  (looking-at re))
+        (beginning-of-line 2))
       (setq end (point)))
     (comment-region beg end (if commented '(4) nil))))
 
@@ -5651,6 +5688,9 @@ strings, or the current cell) returning a string:
 
     (:fmt (2 \"$%s$\" 4 (lambda (c) (format \"$%s$\" c))))
 
+  The format is ignored for empty fields.  Use :raw t with non-nil
+  :backend option to force formatting empty fields.
+
 :hlstart :hllstart :hlend :hllend :hsep :hlfmt :hllfmt :hfmt
 
  Same as above, specific for the header lines in the table.
@@ -5689,30 +5729,32 @@ This may be either a string or a function of two 
arguments:
     ;; Initialize communication channel in INFO.
     (with-temp-buffer
       (let ((org-inhibit-startup t)) (org-mode))
-      (let ((standard-output (current-buffer))
-           (org-element-use-cache nil))
-       (dolist (e table)
-         (cond ((eq e 'hline) (princ "|--\n"))
-               ((consp e)
-                (princ "| ") (dolist (c e) (princ c) (princ " |"))
-                (princ "\n")))))
-      ;; Add back-end specific filters, but not user-defined ones.  In
-      ;; particular, make sure to call parse-tree filters on the
-      ;; table.
-      (setq info
-           (let ((org-export-filters-alist nil))
-             (org-export-install-filters
-              (org-combine-plists
-               (org-export-get-environment backend nil params)
-               `(:back-end ,(org-export-get-backend backend))))))
-      (setq data
-           (org-export-filter-apply-functions
-            (plist-get info :filter-parse-tree)
-            (org-element-map (org-element-parse-buffer) 'table
-              #'identity nil t)
-            info)))
-    (when (and backend (symbolp backend) (not (org-export-get-backend 
backend)))
-      (user-error "Unknown :backend value"))
+      (org-fold-core-ignore-modifications
+        (let ((standard-output (current-buffer))
+             (org-element-use-cache nil))
+         (dolist (e table)
+           (cond ((eq e 'hline) (princ "|--\n"))
+                 ((consp e)
+                  (princ "| ") (dolist (c e) (princ c) (princ " |"))
+                  (princ "\n")))))
+        (org-element-cache-reset)
+        ;; Add back-end specific filters, but not user-defined ones.  In
+        ;; particular, make sure to call parse-tree filters on the
+        ;; table.
+        (setq info
+             (let ((org-export-filters-alist nil))
+               (org-export-install-filters
+                (org-combine-plists
+                 (org-export-get-environment backend nil params)
+                 `(:back-end ,(org-export-get-backend backend))))))
+        (setq data
+             (org-export-filter-apply-functions
+              (plist-get info :filter-parse-tree)
+              (org-element-map (org-element-parse-buffer) 'table
+                #'identity nil t)
+              info))
+        (when (and backend (symbolp backend) (not (org-export-get-backend 
backend)))
+          (user-error "Unknown :backend value"))))
     (when (or (not backend) (plist-get info :raw)) (require 'ox-org))
     ;; Handle :skip parameter.
     (let ((skip (plist-get info :skip)))
diff --git a/lisp/org/org-tempo.el b/lisp/org/org-tempo.el
index b34007bf78..0902a45e8a 100644
--- a/lisp/org/org-tempo.el
+++ b/lisp/org/org-tempo.el
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Rasmus Pank Roulund <emacs at pank dot eu>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -38,6 +38,9 @@
 ;;
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'tempo)
 (require 'cl-lib)
 (require 'org)
@@ -67,7 +70,6 @@ just like `org-structure-template-alist'.  The tempo snippet
 
 Do not use \"I\" as a KEY, as it is reserved for expanding
 \"#+include\"."
-  :group 'org-tempo
   :type '(repeat (cons (string :tag "Key")
                       (string :tag "Keyword")))
   :package-version '(Org . "9.2"))
@@ -102,8 +104,8 @@ Tempo templates will be added."
 
 Go through `org-structure-template-alist' and
 `org-tempo-keywords-alist' and update tempo templates."
-  (mapc 'org--check-org-structure-template-alist '(org-structure-template-alist
-                                                  org-tempo-keywords-alist))
+  (mapc #'org--check-org-structure-template-alist 
'(org-structure-template-alist
+                                                   org-tempo-keywords-alist))
   (let ((keys (org-tempo--keys)))
     ;; Check for duplicated snippet keys and warn if any are found.
     (when (> (length keys) (length (delete-dups keys)))
@@ -119,11 +121,18 @@ Go through `org-structure-template-alist' and
   "Add block entry from `org-structure-template-alist'."
   (let* ((key (format "<%s" (car entry)))
         (name (cdr entry))
-        (special (member name '("src" "export"))))
+        (special (member name '("src" "export")))
+         (upcase? (string= (car (split-string name))
+                           (upcase (car (split-string name))))))
     (tempo-define-template (format "org-%s" (replace-regexp-in-string " " "-" 
name))
-                          `(,(format "#+begin_%s%s" name (if special " " ""))
+                          `(,(format "#+%s_%s%s"
+                                      (if upcase? "BEGIN" "begin")
+                                      name
+                                      (if special " " ""))
                             ,(when special 'p) '> n ,(unless special 'p) n
-                            ,(format "#+end_%s" (car (split-string name " ")))
+                            ,(format "#+%s_%s"
+                                      (if upcase? "END" "end")
+                                      (car (split-string name " ")))
                             >)
                           key
                           (format "Insert a %s block" name)
@@ -176,8 +185,8 @@ didn't succeed."
 ;; Org Tempo is set up with each new Org buffer and potentially in the
 ;; current Org buffer.
 
-(add-hook 'org-mode-hook 'org-tempo-setup)
-(add-hook 'org-tab-before-tab-emulation-hook 'org-tempo-complete-tag)
+(add-hook 'org-mode-hook #'org-tempo-setup)
+(add-hook 'org-tab-before-tab-emulation-hook #'org-tempo-complete-tag)
 
 ;; Enable Org Tempo in all open Org buffers.
 (dolist (b (org-buffer-list 'files))
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el
index 4c9c1ba276..9741ac6797 100644
--- a/lisp/org/org-timer.el
+++ b/lisp/org/org-timer.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -35,6 +35,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org-clock)
 
@@ -139,7 +142,7 @@ the region 0:00:00."
                   (format "Restart timer with offset [%s]: " def)))
          (unless (string-match "\\S-" s) (setq s def))
          (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s)))))
-       (setq org-timer-start-time (org-time-since delta)))
+       (setq org-timer-start-time (time-since delta)))
       (setq org-timer-pause-time nil)
       (org-timer-set-mode-line 'on)
       (message "Timer start time set to %s, current value is %s"
@@ -163,9 +166,9 @@ With prefix arg STOP, stop it entirely."
            (setq org-timer-countdown-timer
                  (org-timer--run-countdown-timer
                   new-secs org-timer-countdown-timer-title))
-           (setq org-timer-start-time (org-time-add nil new-secs)))
+           (setq org-timer-start-time (time-add nil new-secs)))
        (setq org-timer-start-time
-             (org-time-since (- pause-secs start-secs))))
+             (time-since (- pause-secs start-secs))))
       (setq org-timer-pause-time nil)
       (org-timer-set-mode-line 'on)
       (run-hooks 'org-timer-continue-hook)
@@ -387,7 +390,7 @@ VALUE can be `on', `off', or `paused'."
       ;; Note: Once our minimal require is Emacs 27, we can drop this
       ;; org-time-convert-to-integer call.
       (org-time-convert-to-integer
-       (org-time-subtract (timer--time org-timer-countdown-timer) nil))))))
+       (time-subtract (timer--time org-timer-countdown-timer) nil))))))
 
 ;;;###autoload
 (defun org-timer-set-timer (&optional opt)
@@ -448,7 +451,7 @@ using three \\[universal-argument] prefix arguments."
                (org-timer--run-countdown-timer
                 secs org-timer-countdown-timer-title))
          (run-hooks 'org-timer-set-hook)
-         (setq org-timer-start-time (org-time-add nil secs))
+         (setq org-timer-start-time (time-add nil secs))
          (setq org-timer-pause-time nil)
          (org-timer-set-mode-line 'on))))))
 
@@ -478,7 +481,6 @@ Try to use an Org header, otherwise use the buffer name."
        (with-current-buffer (marker-buffer marker)
          (org-with-wide-buffer
           (goto-char hdmarker)
-          (org-show-entry)
           (or (ignore-errors (org-get-heading))
               (buffer-name (buffer-base-buffer))))))))
    ((derived-mode-p 'org-mode)
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index 3273d8707d..8de0d1a4a9 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.5"))
+   (let ((org-release "9.6"))
      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.5"))
+   (let ((org-git-version "release_9.6-49-g47d129"))
      org-git-version))
 
 (provide 'org-version)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 7de907590e..6aa2a16219 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -6,10 +6,10 @@
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;; Maintainer: Bastien Guerry <bzg@gnu.org>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 ;; Package-Requires: ((emacs "25.1"))
 
-;; Version: 9.5.5
+;; Version: 9.6
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -56,10 +56,10 @@
 ;; Documentation
 ;; -------------
 ;; The documentation of Org mode can be found in the TeXInfo file.  The
-;; distribution also contains a PDF version of it.  At the homepage of
-;; Org mode, you can read the same text online as HTML.  There is also an
-;; excellent reference card made by Philip Rooke.  This card can be found
-;; in the doc/ directory.
+;; distribution also contains a PDF version of it.  At the Org mode website,
+;; you can read the same text online as HTML.  There is also an excellent
+;; reference card made by Philip Rooke.  This card can be found in the
+;; doc/ directory.
 ;;
 ;; A list of recent changes can be found at
 ;; https://orgmode.org/Changes.html
@@ -71,6 +71,9 @@
 
 ;;;; Require other packages
 
+(require 'org-compat)
+(org-assert-version)
+
 (require 'cl-lib)
 
 (eval-when-compile (require 'gnus-sum))
@@ -79,24 +82,34 @@
 (require 'find-func)
 (require 'format-spec)
 
-(or (eq this-command 'eval-buffer)
-    (condition-case nil
-       (load (concat (file-name-directory load-file-name)
-                     "org-loaddefs")
-             nil t nil t)
-      (error
-       (message "WARNING: No org-loaddefs.el file could be found from where 
org.el is loaded.")
-       (sit-for 3)
-       (message "You need to run \"make\" or \"make autoloads\" from Org lisp 
directory")
-       (sit-for 3))))
+(condition-case nil
+    (load (concat (file-name-directory load-file-name)
+                 "org-loaddefs")
+         nil t nil t)
+  (error
+   (message "WARNING: No org-loaddefs.el file could be found from where org.el 
is loaded.")
+   (sit-for 3)
+   (message "You need to run \"make\" or \"make autoloads\" from Org lisp 
directory")
+   (sit-for 3)))
 
 (eval-and-compile (require 'org-macs))
 (require 'org-compat)
 (require 'org-keys)
 (require 'ol)
 (require 'oc)
-(require 'oc-basic)
 (require 'org-table)
+(require 'org-fold)
+
+(require 'org-cycle)
+(defvaralias 'org-hide-block-startup 'org-cycle-hide-block-startup)
+(defvaralias 'org-hide-drawer-startup 'org-cycle-hide-drawer-startup)
+(defvaralias 'org-pre-cycle-hook 'org-cycle-pre-hook)
+(defvaralias 'org-tab-first-hook 'org-cycle-tab-first-hook)
+(defalias 'org-global-cycle #'org-cycle-global)
+(defalias 'org-overview #'org-cycle-overview)
+(defalias 'org-content #'org-cycle-content)
+(defalias 'org-reveal #'org-fold-reveal)
+(defalias 'org-force-cycle-archived #'org-cycle-force-archived)
 
 ;; `org-outline-regexp' ought to be a defconst but is let-bound in
 ;; some places -- e.g. see the macro `org-with-limited-levels'.
@@ -119,6 +132,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function isearch-no-upper-case-p "isearch" (string regexp-flag))
 (declare-function org-add-archive-files "org-archive" (files))
 (declare-function org-agenda-entry-get-agenda-timestamp "org-agenda" (pom))
+(declare-function org-agenda-todo-yesterday "org-agenda" (&optional arg))
 (declare-function org-agenda-list "org-agenda" (&optional arg start-day span 
with-hour))
 (declare-function org-agenda-redo "org-agenda" (&optional all))
 (declare-function org-agenda-remove-restriction-lock "org-agenda" (&optional 
noupdate))
@@ -152,9 +166,11 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function org-columns-insert-dblock "org-colview" ())
 (declare-function org-duration-from-minutes "org-duration" (minutes &optional 
fmt canonical))
 (declare-function org-duration-to-minutes "org-duration" (duration &optional 
canonical))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
+(declare-function org-element-at-point-no-context "org-element" (&optional 
pom))
 (declare-function org-element-cache-refresh "org-element" (pos))
-(declare-function org-element-cache-reset "org-element" (&optional all))
+(declare-function org-element-cache-reset "org-element" (&optional all 
no-persistence))
+(declare-function org-element-cache-map "org-element" (func &rest keys))
 (declare-function org-element-contents "org-element" (element))
 (declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-copy "org-element" (datum))
@@ -162,6 +178,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function org-element-extract-element "org-element" (element))
 (declare-function org-element-insert-before "org-element" (element location))
 (declare-function org-element-interpret-data "org-element" (data))
+(declare-function org-element-keyword-parser "org-element" (limit affiliated))
 (declare-function org-element-lineage "org-element" (blob &optional types 
with-self))
 (declare-function org-element-link-parser "org-element" ())
 (declare-function org-element-map "org-element" (data types fun &optional info 
first-match no-recursion with-affiliated))
@@ -174,6 +191,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function org-element-swap-A-B "org-element" (elem-a elem-b))
 (declare-function org-element-timestamp-parser "org-element" ())
 (declare-function org-element-type "org-element" (element))
+(declare-function org-element--cache-active-p "org-element" ())
 (declare-function org-export-dispatch "ox" (&optional arg))
 (declare-function org-export-get-backend "ox" (name))
 (declare-function org-export-get-environment "ox" (&optional backend subtreep 
ext-plist))
@@ -188,6 +206,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function org-latex-make-preamble "ox-latex" (info &optional template 
snippet?))
 (declare-function org-num-mode "org-num" (&optional arg))
 (declare-function org-plot/gnuplot "org-plot" (&optional params))
+(declare-function org-persist-load "org-persist" (container &optional 
associated hash-must-match))
 (declare-function org-tags-view "org-agenda" (&optional todo-only match))
 (declare-function org-timer "org-timer" (&optional restart no-insert))
 (declare-function org-timer-item "org-timer" (&optional arg))
@@ -198,7 +217,9 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function org-toggle-archive-tag "org-archive" (&optional find-done))
 (declare-function org-update-radio-target-regexp "ol" ())
 
+(defvar org-agenda-buffer-name)
 (defvar org-element-paragraph-separate)
+(defvar org-element-cache-map-continue-from)
 (defvar org-element--timestamp-regexp)
 (defvar org-indent-indentation-per-level)
 (defvar org-radio-target-regexp)
@@ -214,7 +235,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
 ;;;###autoload
 (defun org-babel-do-load-languages (sym value)
   "Load the languages defined in `org-babel-load-languages'."
-  (set-default sym value)
+  (set-default-toplevel-value sym value)
   (dolist (pair org-babel-load-languages)
     (let ((active (cdr pair)) (lang (symbol-name (car pair))))
       (if active
@@ -234,16 +255,22 @@ optional prefix argument COMPILE, the tangled Emacs Lisp 
file is
 byte-compiled before it is loaded."
   (interactive "fFile to load: \nP")
   (let ((tangled-file (concat (file-name-sans-extension file) ".el")))
-    ;; Tangle only if the Org file is newer than the Elisp file.
-    (unless (org-file-newer-than-p
-            tangled-file
-            (file-attribute-modification-time
-             (file-attributes (file-truename file))))
+    ;; Tangle only if the Elisp file is older than the Org file.
+    ;; Catch the case when the .el file exists while the .org file is missing.
+    (unless (file-exists-p file)
+      (error "File to tangle does not exist: %s" file))
+    (when (file-newer-than-file-p file tangled-file)
       (org-babel-tangle-file file
                              tangled-file
                              (rx string-start
                                  (or "emacs-lisp" "elisp")
-                                 string-end)))
+                                 string-end))
+      ;; Make sure that tangled file modification time is
+      ;; updated even when `org-babel-tangle-file' does not make changes.
+      ;; This avoids re-tangling changed FILE where the changes did
+      ;; not affect the tangled code.
+      (when (file-exists-p tangled-file)
+        (set-file-times tangled-file)))
     (if compile
        (progn
          (byte-compile-file tangled-file)
@@ -255,9 +282,10 @@ byte-compiled before it is loaded."
 (defcustom org-babel-load-languages '((emacs-lisp . t))
   "Languages which can be evaluated in Org buffers.
 \\<org-mode-map>
-This list can be used to load support for any of the languages
-below.  Each language will depend on a different set of system
-executables and/or Emacs modes.
+This list can be used to load support for any of the available
+languages with babel support (see info node `(org) Languages').  Each
+language will depend on a different set of system executables and/or
+Emacs modes.
 
 When a language is \"loaded\", code blocks in that language can
 be evaluated with `org-babel-execute-src-block', which is bound
@@ -334,7 +362,7 @@ In non-interactive uses, a reduced version string is output 
unless
 FULL is given."
   (interactive (list current-prefix-arg t (not current-prefix-arg)))
   (let ((org-dir (ignore-errors (org-find-library-dir "org")))
-       (save-load-suffixes (when (boundp 'load-suffixes) load-suffixes))
+        (save-load-suffixes load-suffixes)
        (load-suffixes (list ".el"))
        (org-install-dir
         (ignore-errors (org-find-library-dir "org-loaddefs"))))
@@ -409,7 +437,7 @@ FULL is given."
 This one does not require the space after the date, so it can be used
 on a string that terminates immediately after the date.")
 
-(defconst org-ts-regexp1 
"\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9>\r\n 
-]*\\)\\( \\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
+(defconst org-ts-regexp1 
"\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\(?: 
*\\([^]+0-9>\r\n -]+\\)\\)?\\( \\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
   "Regular expression matching time strings for analysis.")
 
 (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>")
@@ -441,8 +469,17 @@ The time stamps may be either active or inactive.")
   "Regular expression for specifying repeated events.
 After a match, group 1 contains the repeat expression.")
 
-(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
-  "Formats for `format-time-string' which are used for time stamps.")
+(defconst org-time-stamp-formats '("%Y-%m-%d %a" . "%Y-%m-%d %a %H:%M")
+  "Formats for `format-time-string' which are used for time stamps.
+
+The value is a cons cell containing two strings.  The `car' and `cdr'
+of the cons cell are used to format time stamps that do not and do
+contain time, respectively.
+
+Leading \"<\"/\"[\" and trailing \">\"/\"]\" pair will be stripped
+from the format strings.
+
+Also, see `org-time-stamp-format'.")
 
 ;;;; Clock and Planning
 
@@ -567,7 +604,7 @@ Group 1 contains drawer's name or \"END\".")
 
 (defconst org-property-drawer-re
   (concat "^[ \t]*:PROPERTIES:[ \t]*\n"
-         "\\(?:[ \t]*:\\S-+:\\(?: .*\\)?[ \t]*\n\\)*?"
+         "\\(?:[ \t]*:\\S-+:\\(?:[ \t].*\\)?[ \t]*\n\\)*?"
          "[ \t]*:END:[ \t]*$")
   "Matches an entire property drawer.")
 
@@ -683,7 +720,7 @@ defined in org-duration.el.")
 
 (defun org-set-modules (var value)
   "Set VAR to VALUE and call `org-load-modules-maybe' with the force flag."
-  (set var value)
+  (set-default-toplevel-value var value)
   (when (featurep 'org)
     (org-load-modules-maybe 'force)
     (org-element-cache-reset 'all)))
@@ -814,7 +851,7 @@ depends on, if any."
   :package-version '(Org . "9.0")
   :initialize 'custom-initialize-set
   :set (lambda (var val)
-        (if (not (featurep 'ox)) (set-default var val)
+        (if (not (featurep 'ox)) (set-default-toplevel-value var val)
           ;; Any back-end not required anymore (not present in VAL and not
           ;; a parent of any back-end in the new value) is removed from the
           ;; list of registered back-ends.
@@ -839,7 +876,7 @@ depends on, if any."
                          backend))
                ((not (memq backend new-list)) (push backend new-list))))
             ;; Set VAR to that list with fixed dependencies.
-            (set-default var new-list))))
+            (set-default-toplevel-value var new-list))))
   :type '(set :greedy t
              (const :tag "   ascii       Export buffer to ASCII format" ascii)
              (const :tag "   beamer      Export buffer to Beamer presentation" 
beamer)
@@ -941,6 +978,11 @@ equivalent option for agenda views."
   :group 'org-todo
   :group 'org-archive)
 
+(defgroup org-startup nil
+  "Startup options Org uses when first visiting a file."
+  :tag "Org Startup"
+  :group 'org)
+
 (defcustom org-startup-folded 'showeverything
   "Non-nil means entering Org mode will switch to OVERVIEW.
 
@@ -1173,90 +1215,6 @@ are matched against file names, and values."
   :tag "Org Structure"
   :group 'org)
 
-(defgroup org-reveal-location nil
-  "Options about how to make context of a location visible."
-  :tag "Org Reveal Location"
-  :group 'org-structure)
-
-(defcustom org-show-context-detail '((agenda . local)
-                                    (bookmark-jump . lineage)
-                                    (isearch . lineage)
-                                    (default . ancestors))
-  "Alist between context and visibility span when revealing a location.
-
-\\<org-mode-map>Some actions may move point into invisible
-locations.  As a consequence, Org always exposes a neighborhood
-around point.  How much is shown depends on the initial action,
-or context.  Valid contexts are
-
-  agenda         when exposing an entry from the agenda
-  org-goto       when using the command `org-goto' (`\\[org-goto]')
-  occur-tree     when using the command `org-occur' (`\\[org-sparse-tree] /')
-  tags-tree      when constructing a sparse tree based on tags matches
-  link-search    when exposing search matches associated with a link
-  mark-goto      when exposing the jump goal of a mark
-  bookmark-jump  when exposing a bookmark location
-  isearch        when exiting from an incremental search
-  default        default for all contexts not set explicitly
-
-Allowed visibility spans are
-
-  minimal        show current headline; if point is not on headline,
-                 also show entry
-
-  local          show current headline, entry and next headline
-
-  ancestors      show current headline and its direct ancestors; if
-                 point is not on headline, also show entry
-
-  ancestors-full show current subtree and its direct ancestors
-
-  lineage        show current headline, its direct ancestors and all
-                 their children; if point is not on headline, also show
-                 entry and first child
-
-  tree           show current headline, its direct ancestors and all
-                 their children; if point is not on headline, also show
-                 entry and all children
-
-  canonical      show current headline, its direct ancestors along with
-                 their entries and children; if point is not located on
-                 the headline, also show current entry and all children
-
-As special cases, a nil or t value means show all contexts in
-`minimal' or `canonical' view, respectively.
-
-Some views can make displayed information very compact, but also
-make it harder to edit the location of the match.  In such
-a case, use the command `org-reveal' (`\\[org-reveal]') to show
-more context."
-  :group 'org-reveal-location
-  :version "26.1"
-  :package-version '(Org . "9.0")
-  :type '(choice
-         (const :tag "Canonical" t)
-         (const :tag "Minimal" nil)
-         (repeat :greedy t :tag "Individual contexts"
-                 (cons
-                  (choice :tag "Context"
-                          (const agenda)
-                          (const org-goto)
-                          (const occur-tree)
-                          (const tags-tree)
-                          (const link-search)
-                          (const mark-goto)
-                          (const bookmark-jump)
-                          (const isearch)
-                          (const default))
-                  (choice :tag "Detail level"
-                          (const minimal)
-                          (const local)
-                          (const ancestors)
-                           (const ancestors-full)
-                          (const lineage)
-                          (const tree)
-                          (const canonical))))))
-
 (defcustom org-indirect-buffer-display 'other-window
   "How should indirect tree buffers be displayed?
 
@@ -1356,6 +1314,16 @@ Possible values for the file identifier are:
 \"evince -p %1 %s\")
                      to open [[file:document.pdf::5]] with evince at page 5.
 
+                 Likely, you will need more entries: without page
+                 number; with search pattern; with cross-reference
+                 anchor; some combination of options.  Consider simple
+                 pattern here and a Lisp function to determine command
+                 line arguments instead.  Passing argument list to
+                 `call-process' or `make-process' directly allows to
+                 avoid treating some character in peculiar file names
+                 as shell specialls causing executing part of file
+                 name as a subcommand.
+
  `directory'   Matches a directory
  `remote'      Matches a remote file, accessible through tramp.
                Remote files most likely should be visited through Emacs
@@ -1413,6 +1381,36 @@ For more examples, see the system specific constants
                        (string :tag "Command")
                        (function :tag "Function")))))
 
+(defcustom org-resource-download-policy 'prompt
+  "The policy applied to requests to obtain remote resources.
+
+This affects keywords like #+setupfile and #+include on export,
+`org-persist-write:url',and `org-attach-url' in non-interactive
+Emacs sessions.
+
+This recognizes four possible values:
+- t, remote resources should always be downloaded.
+- prompt, you will be prompted to download resources not considered safe.
+- safe, only resources considered safe will be downloaded.
+- nil, never download remote resources.
+
+A resource is considered safe if it matches one of the patterns
+in `org-safe-remote-resources'."
+  :group 'org
+  :package-version '(Org . "9.6")
+  :type '(choice (const :tag "Always download remote resources" t)
+                 (const :tag "Prompt before downloading an unsafe resource" 
prompt)
+                 (const :tag "Only download resources considered safe" safe)
+                 (const :tag "Never download any resources" nil)))
+
+(defcustom org-safe-remote-resources nil
+  "A list of regexp patterns matching safe URIs.
+URI regexps are applied to both URLs and Org files requesting
+remote resources."
+  :group 'org
+  :package-version '(Org . "9.6")
+  :type '(repeat regexp))
+
 (defcustom org-open-non-existing-files nil
   "Non-nil means `org-open-file' opens non-existing files.
 
@@ -1448,130 +1446,6 @@ is not set."
   :group 'org-structure
   :type 'plist)
 
-(defgroup org-cycle nil
-  "Options concerning visibility cycling in Org mode."
-  :tag "Org Cycle"
-  :group 'org-structure)
-
-(defcustom org-cycle-skip-children-state-if-no-children t
-  "Non-nil means skip CHILDREN state in entries that don't have any."
-  :group 'org-cycle
-  :type 'boolean)
-
-(defcustom org-cycle-max-level nil
-  "Maximum level which should still be subject to visibility cycling.
-Levels higher than this will, for cycling, be treated as text, not a headline.
-When `org-odd-levels-only' is set, a value of N in this variable actually
-means 2N-1 stars as the limiting headline.
-When nil, cycle all levels.
-Note that the limiting level of cycling is also influenced by
-`org-inlinetask-min-level'.  When `org-cycle-max-level' is not set but
-`org-inlinetask-min-level' is, cycling will be limited to levels one less
-than its value."
-  :group 'org-cycle
-  :type '(choice
-         (const :tag "No limit" nil)
-         (integer :tag "Maximum level")))
-
-(defcustom org-hide-block-startup nil
-  "Non-nil means entering Org mode will fold all blocks.
-This can also be set in on a per-file basis with
-
-#+STARTUP: hideblocks
-#+STARTUP: showblocks"
-  :group 'org-startup
-  :group 'org-cycle
-  :type 'boolean)
-
-(defcustom org-cycle-global-at-bob nil
-  "Cycle globally if cursor is at beginning of buffer and not at a headline.
-
-This makes it possible to do global cycling without having to use `S-TAB'
-or `\\[universal-argument] TAB'.  For this special case to work, the first \
-line of the buffer
-must not be a headline -- it may be empty or some other text.
-
-When used in this way, `org-cycle-hook' is disabled temporarily to make
-sure the cursor stays at the beginning of the buffer.
-
-When this option is nil, don't do anything special at the beginning of
-the buffer."
-  :group 'org-cycle
-  :type 'boolean)
-
-(defcustom org-cycle-level-after-item/entry-creation t
-  "Non-nil means cycle entry level or item indentation in new empty entries.
-
-When the cursor is at the end of an empty headline, i.e., with only stars
-and maybe a TODO keyword, TAB will then switch the entry to become a child,
-and then all possible ancestor states, before returning to the original state.
-This makes data entry extremely fast:  M-RET to create a new headline,
-on TAB to make it a child, two or more tabs to make it a (grand-)uncle.
-
-When the cursor is at the end of an empty plain list item, one TAB will
-make it a subitem, two or more tabs will back up to make this an item
-higher up in the item hierarchy."
-  :group 'org-cycle
-  :type 'boolean)
-
-(defcustom org-cycle-emulate-tab t
-  "Where should `org-cycle' emulate TAB.
-nil         Never
-white       Only in completely white lines
-whitestart  Only at the beginning of lines, before the first non-white char
-t           Everywhere except in headlines
-exc-hl-bol  Everywhere except at the start of a headline
-If TAB is used in a place where it does not emulate TAB, the current subtree
-visibility is cycled."
-  :group 'org-cycle
-  :type '(choice (const :tag "Never" nil)
-                (const :tag "Only in completely white lines" white)
-                (const :tag "Before first char in a line" whitestart)
-                (const :tag "Everywhere except in headlines" t)
-                (const :tag "Everywhere except at bol in headlines" 
exc-hl-bol)))
-
-(defcustom org-cycle-separator-lines 2
-  "Number of empty lines needed to keep an empty line between collapsed trees.
-If you leave an empty line between the end of a subtree and the following
-headline, this empty line is hidden when the subtree is folded.
-Org mode will leave (exactly) one empty line visible if the number of
-empty lines is equal or larger to the number given in this variable.
-So the default 2 means at least 2 empty lines after the end of a subtree
-are needed to produce free space between a collapsed subtree and the
-following headline.
-
-If the number is negative, and the number of empty lines is at least -N,
-all empty lines are shown.
-
-Special case: when 0, never leave empty lines in collapsed view."
-  :group 'org-cycle
-  :type 'integer)
-(put 'org-cycle-separator-lines 'safe-local-variable 'integerp)
-
-(defcustom org-pre-cycle-hook nil
-  "Hook that is run before visibility cycling is happening.
-The function(s) in this hook must accept a single argument which indicates
-the new state that will be set right after running this hook.  The
-argument is a symbol.  Before a global state change, it can have the values
-`overview', `content', or `all'.  Before a local state change, it can have
-the values `folded', `children', or `subtree'."
-  :group 'org-cycle
-  :type 'hook)
-
-(defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
-                           org-cycle-hide-drawers
-                           org-cycle-show-empty-lines
-                           org-optimize-window-after-visibility-change)
-  "Hook that is run after `org-cycle' has changed the buffer visibility.
-The function(s) in this hook must accept a single argument which indicates
-the new state that was set by the most recent `org-cycle' command.  The
-argument is a symbol.  After a global state change, it can have the values
-`overview', `contents', or `all'.  After a local state change, it can have
-the values `folded', `children', or `subtree'."
-  :group 'org-cycle
-  :package-version '(Org . "9.4")
-  :type 'hook)
-
 (defgroup org-edit-structure nil
   "Options concerning structure editing in Org mode."
   :tag "Org Edit Structure"
@@ -1670,13 +1544,15 @@ This may also be a cons cell where the behavior for 
`C-a' and
                        (const :tag "reversed: after tags first" reversed)))))
 
 (defcustom org-special-ctrl-k nil
-  "Non-nil means `C-k' will behave specially in headlines.
-When nil, `C-k' will call the default `kill-line' command.
-When t, the following will happen while the cursor is in the headline:
+  "Non-nil means that \\<org-mode-map>\\[org-kill-line] \
+will behave specially in headlines.
+
+When nil, \\[org-kill-line] will call the default `kill-line' command.
+Otherwise, the following will happen when point is in a headline:
 
-- When at the beginning of a headline, kill the entire subtree.
-- When in the middle of the headline text, kill the text up to the tags.
-- When after the headline text and before the tags, kill all the tags."
+- At the beginning of a headline, kill the entire line.
+- In the middle of the headline text, kill the text up to the tags.
+- After the headline text and before the tags, kill all the tags."
   :group 'org-edit-structure
   :type 'boolean)
 
@@ -1698,29 +1574,6 @@ OK to kill that hidden subtree.  When nil, kill without 
remorse."
   :group 'org-edit-structure
   :type 'boolean)
 
-(defcustom org-catch-invisible-edits nil
-  "Check if in invisible region before inserting or deleting a character.
-Valid values are:
-
-nil              Do not check, so just do invisible edits.
-error            Throw an error and do nothing.
-show             Make point visible, and do the requested edit.
-show-and-error   Make point visible, then throw an error and abort the edit.
-smart            Make point visible, and do insertion/deletion if it is
-                 adjacent to visible text and the change feels predictable.
-                 Never delete a previously invisible character or add in the
-                 middle or right after an invisible region.  Basically, this
-                 allows insertion and backward-delete right before ellipses.
-                 FIXME: maybe in this case we should not even show?"
-  :group 'org-edit-structure
-  :version "24.1"
-  :type '(choice
-         (const :tag "Do not check" nil)
-         (const :tag "Throw error when trying to edit" error)
-         (const :tag "Unhide, but do not do the edit" show-and-error)
-         (const :tag "Show invisible part and do the edit" show)
-         (const :tag "Be smart and do the right thing" smart)))
-
 (defcustom org-yank-folded-subtrees t
   "Non-nil means when yanking subtrees, fold them.
 If the kill is a single subtree, or a sequence of subtrees, i.e. if
@@ -1763,7 +1616,6 @@ default   the value to be used for all contexts not 
explicitly
                           (const default))
                   (boolean)))))
 
-
 (defcustom org-insert-heading-respect-content nil
   "Non-nil means insert new headings after the current subtree.
 \\<org-mode-map>
@@ -2024,9 +1876,9 @@ are followed by a letter in parenthesis, like TODO(t)."
   :group 'org-todo
   :set (lambda (var val)
         (cond
-         ((eq var t) (set var 'auto))
-         ((eq var 'prefix) (set var nil))
-         (t (set var val))))
+         ((eq var t) (set-default-toplevel-value var 'auto))
+         ((eq var 'prefix) (set-default-toplevel-value var nil))
+         (t (set-default-toplevel-value var val))))
   :type '(choice
          (const :tag "Never" nil)
          (const :tag "Automatically, when key letter have been defined" auto)
@@ -2108,7 +1960,7 @@ be blocked if any prior sibling is not yet done.
 Finally, if the parent is blocked because of ordered siblings of its own,
 the child will also be blocked."
   :set (lambda (var val)
-        (set var val)
+        (set-default-toplevel-value var val)
         (if val
             (add-hook 'org-blocker-hook
                       'org-block-todo-from-children-or-siblings-or-parent)
@@ -2126,7 +1978,7 @@ This variable needs to be set before org.el is loaded, 
and you need to
 restart Emacs after a change to make the change effective.  The only way
 to change it while Emacs is running is through the customize interface."
   :set (lambda (var val)
-        (set var val)
+        (set-default-toplevel-value var val)
         (if val
             (add-hook 'org-blocker-hook
                       'org-block-todo-from-checkboxes)
@@ -2577,27 +2429,53 @@ The formats are defined through the variable 
`org-time-stamp-custom-formats'.
 To turn this on on a per-file basis, insert anywhere in the file:
    #+STARTUP: customtime"
   :group 'org-time
-  :set 'set-default
   :type 'sexp)
 (make-variable-buffer-local 'org-display-custom-times)
 
 (defcustom org-time-stamp-custom-formats
-  '("<%m/%d/%y %a>" . "<%m/%d/%y %a %H:%M>") ; american
-  "Custom formats for time stamps.  See `format-time-string' for the syntax.
+  '("%m/%d/%y %a" . "%m/%d/%y %a %H:%M") ; american
+  "Custom formats for time stamps.
+
+See `format-time-string' for the syntax.
+
 These are overlaid over the default ISO format if the variable
 `org-display-custom-times' is set.  Time like %H:%M should be at the
 end of the second format.  The custom formats are also honored by export
-commands, if custom time display is turned on at the time of export."
-  :group 'org-time
-  :type 'sexp)
+commands, if custom time display is turned on at the time of export.
 
-(defun org-time-stamp-format (&optional long inactive)
-  "Get the right format for a time string."
-  (let ((f (if long (cdr org-time-stamp-formats)
-            (car org-time-stamp-formats))))
-    (if inactive
-       (concat "[" (substring f 1 -1) "]")
-      f)))
+Leading \"<\" and trailing \">\" pair will be stripped from the format
+strings."
+  :group 'org-time
+  :package-version '(Org . "9.6")
+  :type '(cons string string))
+
+(defun org-time-stamp-format (&optional with-time inactive custom)
+  "Get timestamp format for a time string.
+
+The format is based on `org-time-stamp-formats' (if CUSTOM is nil) or or
+`org-time-stamp-custom-formats' (if CUSTOM if non-nil).
+
+When optional argument WITH-TIME is non-nil, the timestamp will contain
+time.
+
+When optional argument INACTIVE is nil, format active timestamp.
+When `no-brackets', strip timestamp brackets.
+Otherwise, format inactive timestamp."
+  (let ((format (funcall
+                 (if with-time #'cdr #'car)
+                 (if custom
+                     org-time-stamp-custom-formats
+                   org-time-stamp-formats))))
+    ;; Strip brackets, if any.
+    (when (or (and (string-prefix-p "<" format)
+                   (string-suffix-p ">" format))
+              (and (string-prefix-p "[" format)
+                   (string-suffix-p "]" format)))
+      (setq format (substring format 1 -1)))
+    (pcase inactive
+      (`no-brackets format)
+      (`nil (concat "<" format ">"))
+      (_ (concat "[" format "]")))))
 
 (defcustom org-deadline-warning-days 14
   "Number of days before expiration during which a deadline becomes active.
@@ -2976,7 +2854,7 @@ is better to limit inheritance to certain tags using the 
variables
   :group 'org-tags
   :type '(choice
          (const :tag "No sorting" nil)
-         (const :tag "Alphabetical" org-string-collate-lessp)
+         (const :tag "Alphabetical" string-collate-lessp)
          (const :tag "Reverse alphabetical" org-string-collate-greaterp)
          (function :tag "Custom function" nil)))
 
@@ -3065,6 +2943,35 @@ in this variable)."
     (member-ignore-case property org-use-property-inheritance))
    (t (error "Invalid setting of `org-use-property-inheritance'"))))
 
+(defcustom org-property-separators nil
+  "An alist to control how properties are combined.
+
+The car of each item should be either a list of property names or
+a regular expression, while the cdr should be the separator to
+use when combining that property.
+
+If an alist item cannot be found that matches a given property, a
+single space will be used as the separator."
+  :group 'org-properties
+  :package-version '(Org . "9.6")
+  :type '(alist :key-type (choice (repeat :tag "Properties" string)
+                                  (string :tag "Regular Expression"))
+                :value-type (restricted-sexp :tag "Separator"
+                                             :match-alternatives (stringp)
+                                             :value " ")))
+
+(defun org--property-get-separator (property)
+  "Get the separator to use for combining PROPERTY."
+  (or
+   (catch 'separator
+     (dolist (spec org-property-separators)
+       (if (listp (car spec))
+           (if (member property (car spec))
+               (throw 'separator (cdr spec)))
+         (if (string-match-p (car spec) property)
+             (throw 'separator (cdr spec))))))
+   " "))
+
 (defcustom org-columns-default-format "%25ITEM %TODO %3PRIORITY %TAGS"
   "The default column format, if no other format has been defined.
 This variable can be set on the per-file basis by inserting a line
@@ -3326,7 +3233,9 @@ All available processes and theirs documents can be found 
in
      :image-output-type "png"
      :image-size-adjust (1.0 . 1.0)
      :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
-     :image-converter ("dvipng -D %D -T tight -bg Transparent -o %O %f"))
+     :image-converter ("dvipng -D %D -T tight -o %O %f")
+     :transparent-image-converter
+     ("dvipng -D %D -T tight -bg Transparent -o %O %f"))
     (dvisvgm
      :programs ("latex" "dvisvgm")
      :description "dvi > svg"
@@ -3335,7 +3244,7 @@ All available processes and theirs documents can be found 
in
      :image-output-type "svg"
      :image-size-adjust (1.7 . 1.5)
      :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
-     :image-converter ("dvisvgm %f -n -b min -c %S -o %O"))
+     :image-converter ("dvisvgm %f --no-fonts --exact-bbox --scale=%S 
--output=%O"))
     (imagemagick
      :programs ("latex" "convert")
      :description "pdf > png"
@@ -3381,6 +3290,9 @@ PROPERTIES accepts the following attributes:
                       given to the shell and supports any of the following
                       place-holders defined below.
 
+If set, :transparent-image-converter is used instead of :image-converter to
+convert an image when the background color is nil or \"Transparent\".
+
 Place-holders used by `:image-converter' and `:latex-compiler':
 
   %f    input file name
@@ -3394,8 +3306,7 @@ Place-holders only used by `:image-converter':
   %S    the image size scale ratio, which is used to adjust image size by some
         processing commands."
   :group 'org-latex
-  :version "26.1"
-  :package-version '(Org . "9.0")
+  :package-version '(Org . "9.6")
   :type '(alist :tag "LaTeX to image backends"
                :value-type (plist)))
 
@@ -3424,8 +3335,8 @@ images at the same place."
 
 (defcustom org-format-latex-header "\\documentclass{article}
 \\usepackage[usenames]{color}
-\[PACKAGES]
 \[DEFAULT-PACKAGES]
+\[PACKAGES]
 \\pagestyle{empty}             % do not remove
 % The settings below are copied from fullpage.sty
 \\setlength{\\textwidth}{\\paperwidth}
@@ -3451,7 +3362,7 @@ header, or they will be appended."
 
 (defun org-set-packages-alist (var val)
   "Set the packages alist and make sure it has 3 elements per entry."
-  (set var (mapcar (lambda (x)
+  (set-default-toplevel-value var (mapcar (lambda (x)
                     (if (and (consp x) (= (length x) 2))
                         (list (car x) (nth 1 x) t)
                       x))
@@ -3605,7 +3516,7 @@ lines to the buffer:
 
 (defcustom org-hidden-keywords nil
   "List of symbols corresponding to keywords to be hidden in the Org buffer.
-For example, a value \\='(title) for this list makes the document's title
+For example, a value (title) for this list makes the document's title
 appear in the buffer without the initial \"#+TITLE:\" part."
   :group 'org-appearance
   :package-version '(Org . "9.5")
@@ -3724,7 +3635,7 @@ After a match, the match groups contain these elements:
 (defvar org-emphasis-alist) ; defined just below
 (defun org-set-emph-re (var val)
   "Set variable and compute the emphasis regular expression."
-  (set var val)
+  (set-default-toplevel-value var val)
   (when (and (boundp 'org-emphasis-alist)
             (boundp 'org-emphasis-regexp-components)
             org-emphasis-alist org-emphasis-regexp-components)
@@ -3823,7 +3734,7 @@ This is needed for font-lock setup.")
                  "org-agenda"
                  (beg end))
 (declare-function org-agenda-set-restriction-lock "org-agenda" (&optional 
type))
-(declare-function org-agenda-skip "org-agenda" ())
+(declare-function org-agenda-skip "org-agenda" (&optional element))
 (declare-function org-attach-expand "org-attach" (file))
 (declare-function org-attach-reveal "org-attach" ())
 (declare-function org-attach-reveal-in-emacs "org-attach" ())
@@ -3970,15 +3881,6 @@ Instead, use the key `v' to cycle the archives-mode in 
the agenda."
   :group 'org-properties
   :type 'boolean)
 
-(defcustom org-cycle-open-archived-trees nil
-  "Non-nil means `org-cycle' will open archived trees.
-An archived tree is a tree marked with the tag ARCHIVE.
-When nil, archived trees will stay folded.  You can still open them with
-normal outline commands like `show-all', but not with the cycling commands."
-  :group 'org-archive
-  :group 'org-cycle
-  :type 'boolean)
-
 (defcustom org-sparse-tree-open-archived-trees nil
   "Non-nil means sparse tree construction shows matches in archived trees.
 When nil, matches in these trees are highlighted, but the trees are kept in
@@ -4008,51 +3910,6 @@ Otherwise, these types are allowed:
   :package-version '(Org . "8.3")
   :group 'org-sparse-trees)
 
-(defun org-cycle-hide-archived-subtrees (state)
-  "Re-hide all archived subtrees after a visibility state change.
-STATE should be one of the symbols listed in the docstring of
-`org-cycle-hook'."
-  (when (and (not org-cycle-open-archived-trees)
-             (not (memq state '(overview folded))))
-    (save-excursion
-      (let* ((globalp (memq state '(contents all)))
-             (beg (if globalp (point-min) (point)))
-             (end (if globalp (point-max) (org-end-of-subtree t))))
-       (org-hide-archived-subtrees beg end)
-       (goto-char beg)
-       (when (looking-at-p (concat ".*:" org-archive-tag ":"))
-         (message "%s" (substitute-command-keys
-                        "Subtree is archived and stays closed.  Use \
-`\\[org-force-cycle-archived]' to cycle it anyway.")))))))
-
-(defun org-force-cycle-archived ()
-  "Cycle subtree even if it is archived."
-  (interactive)
-  (setq this-command 'org-cycle)
-  (let ((org-cycle-open-archived-trees t))
-    (call-interactively 'org-cycle)))
-
-(defun org-hide-archived-subtrees (beg end)
-  "Re-hide all archived subtrees after a visibility state change."
-  (org-with-wide-buffer
-   (let ((case-fold-search nil)
-        (re (concat org-outline-regexp-bol ".*:" org-archive-tag ":")))
-     (goto-char beg)
-     ;; Include headline point is currently on.
-     (beginning-of-line)
-     (while (and (< (point) end) (re-search-forward re end t))
-       (when (member org-archive-tag (org-get-tags nil t))
-        (org-flag-subtree t)
-        (org-end-of-subtree t))))))
-
-(defun org-flag-subtree (flag)
-  (save-excursion
-    (org-back-to-heading t)
-    (org-flag-region (line-end-position)
-                    (progn (org-end-of-subtree t) (point))
-                    flag
-                    'outline)))
-
 (defalias 'org-advertized-archive-subtree 'org-archive-subtree)
 
 ;; Declare Column View Code
@@ -4105,7 +3962,8 @@ expected to be bound to nil when matching against this 
regexp.")
   "Printf format to make regexp to match an exact headline.
 This regexp will match the headline of any node which has the
 exact headline text that is put into the format, but may have any
-TODO state, priority and tags.")
+TODO state, priority, tags, statistics cookies (at the beginning
+or end of the headline title), or COMMENT keyword.")
 
 (defvar-local org-todo-line-tags-regexp nil
   "Matches a headline and puts TODO state into group 2 if present.
@@ -4214,6 +4072,8 @@ After a match, the following groups carry important 
information:
     ("noptag" org-tag-persistent-alist nil)
     ("hideblocks" org-hide-block-startup t)
     ("nohideblocks" org-hide-block-startup nil)
+    ("hidedrawers" org-hide-drawer-startup t)
+    ("nohidedrawers" org-hide-drawer-startup nil)
     ("beamer" org-startup-with-beamer-mode t)
     ("entitiespretty" org-pretty-entities t)
     ("entitiesplain" org-pretty-entities nil))
@@ -4368,7 +4228,11 @@ related expressions."
               (delq nil
                     (mapcar
                      (lambda (value)
-                       (and (string-match "\\`\\(\\S-+\\)[ \t]+\\(.+\\)" value)
+                       (and (or
+                              ;; "abbrev with spaces" spec
+                              (string-match "\\`\"\\(.+[^\\]\\)\"[ 
\t]+\\(.+\\)" value)
+                              ;; abbrev spec
+                              (string-match "\\`\\(\\S-+\\)[ \t]+\\(.+\\)" 
value))
                             (cons (match-string-no-properties 1 value)
                                   (match-string-no-properties 2 value))))
                      (cdr (assoc "LINK" alist))))))
@@ -4472,6 +4336,8 @@ related expressions."
                      "\\(?: +" org-todo-regexp "\\)?"
                      "\\(?: +\\(\\[#.\\]\\)\\)?"
                      "\\(?: +"
+                      ;; Headline might be commented
+                      "\\(?:" org-comment-string " +\\)?"
                      ;; Stats cookies can be stuck to body.
                      "\\(?:\\[[0-9%%/]+\\] *\\)*"
                      "\\(%s\\)"
@@ -4688,21 +4554,25 @@ is available.  This option applies only if FILE is a 
URL."
     (cond
      (cache)
      (is-url
-      (with-current-buffer (url-retrieve-synchronously file)
-       (goto-char (point-min))
-       ;; Move point to after the url-retrieve header.
-       (search-forward "\n\n" nil :move)
-       ;; Search for the success code only in the url-retrieve header.
-       (if (save-excursion
-             (re-search-backward "HTTP.*\\s-+200\\s-OK" nil :noerror))
-           ;; Update the cache `org--file-cache' and return contents.
-           (puthash file
-                    (buffer-substring-no-properties (point) (point-max))
-                    org--file-cache)
-         (funcall (if noerror #'message #'user-error)
-                  "Unable to fetch file from %S"
-                  file)
-         nil)))
+      (if (org--should-fetch-remote-resource-p file)
+          (with-current-buffer (url-retrieve-synchronously file)
+            (goto-char (point-min))
+            ;; Move point to after the url-retrieve header.
+            (search-forward "\n\n" nil :move)
+            ;; Search for the success code only in the url-retrieve header.
+            (if (save-excursion
+                  (re-search-backward "HTTP.*\\s-+200\\s-OK" nil :noerror))
+                ;; Update the cache `org--file-cache' and return contents.
+                (puthash file
+                         (buffer-substring-no-properties (point) (point-max))
+                         org--file-cache)
+              (funcall (if noerror #'message #'user-error)
+                       "Unable to fetch file from %S"
+                       file)
+              nil))
+        (funcall (if noerror #'message #'user-error)
+                 "The remote resource %S is considered unsafe, and will not be 
downloaded."
+                 file)))
      (t
       (with-temp-buffer
         (condition-case nil
@@ -4715,6 +4585,95 @@ is available.  This option applies only if FILE is a 
URL."
                    file)
           nil)))))))
 
+(defun org--should-fetch-remote-resource-p (uri)
+  "Return non-nil if the URI should be fetched."
+  (or (eq org-resource-download-policy t)
+      (org--safe-remote-resource-p uri)
+      (and (eq org-resource-download-policy 'prompt)
+           (org--confirm-resource-safe uri))))
+
+(defun org--safe-remote-resource-p (uri)
+  "Return non-nil if URI is considered safe.
+This checks every pattern in `org-safe-remote-resources', and
+returns non-nil if any of them match."
+  (let ((uri-patterns org-safe-remote-resources)
+        (file-uri (and (buffer-file-name (buffer-base-buffer))
+                       (concat "file://" (file-truename (buffer-file-name 
(buffer-base-buffer))))))
+        match-p)
+    (while (and (not match-p) uri-patterns)
+      (setq match-p (or (string-match-p (car uri-patterns) uri)
+                        (and file-uri (string-match-p (car uri-patterns) 
file-uri)))
+            uri-patterns (cdr uri-patterns)))
+    match-p))
+
+(defun org--confirm-resource-safe (uri)
+  "Ask the user if URI should be considered safe, returning non-nil if so."
+  (unless noninteractive
+    (let ((current-file (and (buffer-file-name (buffer-base-buffer))
+                             (file-truename (buffer-file-name 
(buffer-base-buffer)))))
+          (domain (and (string-match
+                        (rx (seq "http" (? "s") "://")
+                            (optional (+ (not (any "@/\n"))) "@")
+                            (optional "www.")
+                            (one-or-more (not (any ":/?\n"))))
+                        uri)
+                       (match-string 0 uri)))
+          (buf (get-buffer-create "*Org Remote Resource*")))
+      ;; Set up the contents of the *Org Remote Resource* buffer.
+      (with-current-buffer buf
+        (erase-buffer)
+        (insert "An org-mode document would like to download "
+                (propertize uri 'face '(:inherit org-link :weight normal))
+                ", which is not considered safe.\n\n"
+                "Do you want to download this?  You can type\n "
+                (propertize "!" 'face 'success)
+                " to download this resource, and permanently mark it as 
safe.\n "
+                (if domain
+                    (concat
+                     (propertize "d" 'face 'success)
+                     " to download this resource, and mark the domain ("
+                     (propertize domain 'face '(:inherit org-link :weight 
normal))
+                     ") as safe.\n ")
+                  "")
+                (propertize "f" 'face 'success)
+                (if current-file
+                    (concat
+                     " to download this resource, and permanently mark all 
resources in "
+                     (propertize current-file 'face 'underline)
+                     " as safe.\n ")
+                  "")
+                (propertize "y" 'face 'warning)
+                " to download this resource, just this once.\n "
+                (propertize "n" 'face 'error)
+                " to skip this resource.\n")
+        (setq-local cursor-type nil)
+        (set-buffer-modified-p nil)
+        (goto-char (point-min)))
+      ;; Display the buffer and read a choice.
+      (save-window-excursion
+        (pop-to-buffer buf)
+        (let* ((exit-chars (append '(?y ?n ?! ?d ?\s) (and current-file 
'(?f))))
+               (prompt (format "Please type y, n%s, d, or !%s: "
+                               (if current-file ", f" "")
+                               (if (< (line-number-at-pos (point-max))
+                                      (window-body-height))
+                                   ""
+                                 ", or C-v/M-v to scroll")))
+               char)
+          (setq char (read-char-choice prompt exit-chars))
+          (when (memq char '(?! ?f ?d))
+            (customize-push-and-save
+             'org-safe-remote-resources
+             (list (if (eq char ?d)
+                       (concat "\\`" (regexp-quote domain) "\\(?:/\\|\\'\\)")
+                     (concat "\\`"
+                             (regexp-quote
+                              (if (and (= char ?f) current-file)
+                                  (concat "file://" current-file) uri))
+                             "\\'")))))
+          (prog1 (memq char '(?y ?n ?! ?d ?\s ?f))
+            (quit-window t)))))))
+
 (defun org-extract-log-state-settings (x)
   "Extract the log state setting from a TODO keyword string.
 This will extract info from a string like \"WAIT(w@/!)\"."
@@ -4790,7 +4749,6 @@ This is for getting out of special buffers like capture.")
 
 ;; Other stuff we need.
 (require 'time-date)
-(unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time))
 (when (< emacs-major-version 28)  ; preloaded in Emacs 28
   (require 'easymenu))
 
@@ -4805,6 +4763,14 @@ This is for getting out of special buffers like 
capture.")
 ;; babel
 (require 'ob)
 
+(defvar org-element-cache-persistent); Defined in org-element.el
+(defvar org-element-use-cache); Defined in org-element.el
+(defvar org-mode-loading nil
+  "Non-nil during Org mode initialization.")
+
+(defvar org-agenda-file-menu-enabled t
+  "When non-nil, refresh Agenda files in Org menu when loading Org.")
+
 ;;;###autoload
 (define-derived-mode org-mode outline-mode "Org"
   "Outline-based notes management and organizer, alias
@@ -4824,14 +4790,22 @@ can be exported as a structured ASCII or HTML file.
 The following commands are available:
 
 \\{org-mode-map}"
+  (setq-local org-mode-loading t)
   (org-load-modules-maybe)
-  (org-install-agenda-files-menu)
-  (when org-link-descriptive (add-to-invisibility-spec '(org-link)))
+  (when org-agenda-file-menu-enabled
+    (org-install-agenda-files-menu))
+  (when (and org-link-descriptive
+             (eq org-fold-core-style 'overlays))
+    (add-to-invisibility-spec '(org-link)))
+  (org-fold-initialize (or (and (stringp org-ellipsis) (not (equal "" 
org-ellipsis)) org-ellipsis)
+                        "..."))
   (make-local-variable 'org-link-descriptive)
-  (add-to-invisibility-spec '(org-hide-block . t))
+  (when (eq org-fold-core-style 'overlays) (add-to-invisibility-spec 
'(org-hide-block . t)))
+  (if org-link-descriptive
+      (org-fold-core-set-folding-spec-property (car 
org-link--link-folding-spec) :visible nil)
+    (org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) 
:visible t))
   (setq-local outline-regexp org-outline-regexp)
   (setq-local outline-level 'org-outline-level)
-  (setq bidi-paragraph-direction 'left-to-right)
   (when (and (stringp org-ellipsis) (not (equal "" org-ellipsis)))
     (unless org-display-table
       (setq org-display-table (make-display-table)))
@@ -4859,6 +4833,11 @@ The following commands are available:
   (add-hook 'before-change-functions 'org-before-change-function nil 'local)
   ;; Check for running clock before killing a buffer
   (add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local)
+  ;; Initialize cache.
+  (org-element-cache-reset)
+  (when (and org-element-cache-persistent
+             org-element-use-cache)
+    (org-persist-load 'org-element--cache (current-buffer) t))
   ;; Initialize macros templates.
   (org-macro-initialize-templates)
   ;; Initialize radio targets.
@@ -4870,8 +4849,6 @@ The following commands are available:
   (org-setup-filling)
   ;; Comments.
   (org-setup-comments-handling)
-  ;; Initialize cache.
-  (org-element-cache-reset)
   ;; Beginning/end of defun
   (setq-local beginning-of-defun-function 'org-backward-element)
   (setq-local end-of-defun-function
@@ -4933,7 +4910,7 @@ The following commands are available:
        t))
      (when org-startup-with-inline-images (org-display-inline-images))
      (when org-startup-with-latex-preview (org-latex-preview '(16)))
-     (unless org-inhibit-startup-visibility-stuff (org-set-startup-visibility))
+     (unless org-inhibit-startup-visibility-stuff 
(org-cycle-set-startup-visibility))
      (when org-startup-truncated (setq truncate-lines t))
      (when org-startup-numerated (require 'org-num) (org-num-mode 1))
      (when org-startup-indented (require 'org-indent) (org-indent-mode 1))))
@@ -4960,7 +4937,8 @@ The following commands are available:
   ;; Set face extension as requested.
   (org--set-faces-extend '(org-block-begin-line org-block-end-line)
                          org-fontify-whole-block-delimiter-line)
-  (org--set-faces-extend org-level-faces org-fontify-whole-heading-line))
+  (org--set-faces-extend org-level-faces org-fontify-whole-heading-line)
+  (setq-local org-mode-loading nil))
 
 ;; Update `customize-package-emacs-version-alist'
 (add-to-list 'customize-package-emacs-version-alist
@@ -4974,7 +4952,8 @@ The following commands are available:
                   ("9.2" . "27.1")
                   ("9.3" . "27.1")
                   ("9.4" . "27.2")
-                  ("9.5" . "28.1")))
+                  ("9.5" . "28.1")
+                  ("9.6" . "29.1")))
 
 (defvar org-mode-transpose-word-syntax-table
   (let ((st (make-syntax-table text-mode-syntax-table)))
@@ -5010,16 +4989,18 @@ the rounding returns a past time."
     (if (< r 1)
        now
       (let* ((time (decode-time now))
-            (res (apply #'encode-time 0 (* r (round (nth 1 time) r))
-                        (nthcdr 2 time))))
-       (if (or (not past) (org-time-less-p res now))
+            (res (org-encode-time
+                   (apply #'list
+                          0 (* r (round (nth 1 time) r))
+                          (nthcdr 2 time)))))
+       (if (or (not past) (time-less-p res now))
            res
-         (org-time-subtract res (* r 60)))))))
+         (time-subtract res (* r 60)))))))
 
 (defun org-today ()
   "Return today date, considering `org-extend-today-until'."
   (time-to-days
-   (org-time-since (* 3600 org-extend-today-until))))
+   (time-since (* 3600 org-extend-today-until))))
 
 ;;;; Font-Lock stuff, including the activators
 
@@ -5100,6 +5081,10 @@ stacked delimiters is N.  Escaping delimiters is not 
possible."
              (when verbatim?
                (org-remove-flyspell-overlays-in
                 (match-beginning 0) (match-end 0))
+                (when (and (org-fold-core-folding-spec-p 'org-link)
+                           (org-fold-core-folding-spec-p 
'org-link-description))
+                  (org-fold-region (match-beginning 0) (match-end 0) nil 
'org-link)
+                  (org-fold-region (match-beginning 0) (match-end 0) nil 
'org-link-description))
                (remove-text-properties (match-beginning 2) (match-end 2)
                                        '(display t invisible t intangible t)))
              (add-text-properties (match-beginning 2) (match-end 2)
@@ -5163,7 +5148,7 @@ prompted for."
 (defsubst org-rear-nonsticky-at (pos)
   (add-text-properties (1- pos) pos (list 'rear-nonsticky 
org-nonsticky-props)))
 
-(defun org-activate-links (limit)
+(defun org-activate-links--overlays (limit)
   "Add link properties to links.
 This includes angle, plain, and bracket links."
   (catch :exit
@@ -5178,13 +5163,13 @@ This includes angle, plain, and bracket links."
        (when (and (memq style org-highlight-links)
                   ;; Do not span over paragraph boundaries.
                   (not (string-match-p org-element-paragraph-separate
-                                       (match-string 0)))
+                                     (match-string 0)))
                   ;; Do not confuse plain links with tags.
                   (not (and (eq style 'plain)
-                            (let ((face (get-text-property
-                                         (max (1- start) (point-min)) 'face)))
-                              (if (consp face) (memq 'org-tag face)
-                                (eq 'org-tag face))))))
+                          (let ((face (get-text-property
+                                       (max (1- start) (point-min)) 'face)))
+                            (if (consp face) (memq 'org-tag face)
+                              (eq 'org-tag face))))))
          (let* ((link-object (save-excursion
                                (goto-char start)
                                (save-match-data (org-element-link-parser))))
@@ -5234,6 +5219,99 @@ This includes angle, plain, and bracket links."
                (funcall f start end path (eq style 'bracket))))
            (throw :exit t)))))         ;signal success
     nil))
+(defun org-activate-links--text-properties (limit)
+  "Add link properties to links.
+This includes angle, plain, and bracket links."
+  (catch :exit
+    (while (re-search-forward org-link-any-re limit t)
+      (let* ((start (match-beginning 0))
+            (end (match-end 0))
+            (visible-start (or (match-beginning 3) (match-beginning 2)))
+            (visible-end (or (match-end 3) (match-end 2)))
+            (style (cond ((eq ?< (char-after start)) 'angle)
+                         ((eq ?\[ (char-after (1+ start))) 'bracket)
+                         (t 'plain))))
+       (when (and (memq style org-highlight-links)
+                  ;; Do not span over paragraph boundaries.
+                  (not (string-match-p org-element-paragraph-separate
+                                       (match-string 0)))
+                  ;; Do not confuse plain links with tags.
+                  (not (and (eq style 'plain)
+                            (let ((face (get-text-property
+                                         (max (1- start) (point-min)) 'face)))
+                              (if (consp face) (memq 'org-tag face)
+                                (eq 'org-tag face))))))
+         (let* ((link-object (save-excursion
+                               (goto-char start)
+                               (save-match-data (org-element-link-parser))))
+                (link (org-element-property :raw-link link-object))
+                (type (org-element-property :type link-object))
+                (path (org-element-property :path link-object))
+                 (face-property (pcase (org-link-get-parameter type :face)
+                                 ((and (pred functionp) face) (funcall face 
path))
+                                 ((and (pred facep) face) face)
+                                 ((and (pred consp) face) face) ;anonymous
+                                 (_ 'org-link)))
+                (properties            ;for link's visible part
+                 (list 'mouse-face (or (org-link-get-parameter type 
:mouse-face)
+                                       'highlight)
+                       'keymap (or (org-link-get-parameter type :keymap)
+                                   org-mouse-map)
+                       'help-echo (pcase (org-link-get-parameter type 
:help-echo)
+                                    ((and (pred stringp) echo) echo)
+                                    ((and (pred functionp) echo) echo)
+                                    (_ (concat "LINK: " link)))
+                       'htmlize-link (pcase (org-link-get-parameter type
+                                                                 :htmlize-link)
+                                       ((and (pred functionp) f) (funcall f))
+                                       (_ `(:uri ,link)))
+                       'font-lock-multiline t)))
+           (org-remove-flyspell-overlays-in start end)
+           (org-rear-nonsticky-at end)
+           (if (not (eq 'bracket style))
+               (progn
+                  (add-face-text-property start end face-property)
+                 (add-text-properties start end properties))
+              ;; Initialize folding when used outside org-mode.
+              (unless (or (derived-mode-p 'org-mode)
+                         (and (org-fold-folding-spec-p 'org-link-description)
+                               (org-fold-folding-spec-p 'org-link)))
+                (org-fold-initialize (or (and (stringp org-ellipsis) (not 
(equal "" org-ellipsis)) org-ellipsis)
+                                      "...")))
+             ;; Handle invisible parts in bracket links.
+             (let ((spec (or (org-link-get-parameter type :display)
+                             'org-link)))
+                (unless (org-fold-folding-spec-p spec)
+                  (org-fold-add-folding-spec spec
+                                          (cdr org-link--link-folding-spec)
+                                          nil
+                                          'append)
+                  (org-fold-core-set-folding-spec-property spec :visible t))
+                (org-fold-region start end nil 'org-link)
+                (org-fold-region start end nil 'org-link-description)
+                ;; We are folding the whole emphasized text with SPEC
+                ;; first.  It makes everything invisible (or whatever
+                ;; the user wants).
+                (org-fold-region start end t spec)
+                ;; The visible part of the text is folded using
+                ;; 'org-link-description, which is forcing this part of
+                ;; the text to be visible.
+                (org-fold-region visible-start visible-end t 
'org-link-description)
+               (add-text-properties start end properties)
+                (add-face-text-property start end face-property)
+               (org-rear-nonsticky-at visible-start)
+               (org-rear-nonsticky-at visible-end)))
+           (let ((f (org-link-get-parameter type :activate-func)))
+             (when (functionp f)
+               (funcall f start end path (eq style 'bracket))))
+           (throw :exit t)))))         ;signal success
+    nil))
+(defsubst org-activate-links (limit)
+  "Add link properties to links.
+This includes angle, plain, and bracket links."
+  (if (eq org-fold-core-style 'text-properties)
+      (org-activate-links--text-properties limit)
+    (org-activate-links--overlays limit)))
 
 (defun org-activate-code (limit)
   (when (re-search-forward "^[ \t]*\\(:\\(?: .*\\|$\\)\n?\\)" limit t)
@@ -5765,8 +5843,13 @@ needs to be inserted at a specific position in the 
font-lock sequence.")
                '(9 'org-special-keyword t))
          ;; Blocks and meta lines
          '(org-fontify-meta-lines-and-blocks)
-          ;; Citations
-          '(org-cite-activate))))
+          '(org-fontify-inline-src-blocks)
+          ;; Citations.  When an activate processor is specified, if
+          ;; specified, try loading it beforehand.
+          (progn
+            (unless (null org-cite-activate-processor)
+              (org-cite-try-load-processor org-cite-activate-processor))
+            '(org-cite-activate)))))
     (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
     (run-hooks 'org-font-lock-set-keywords-hook)
     ;; Now set the full font-lock-keywords
@@ -5852,8 +5935,11 @@ needs to be inserted at a specific position in the 
font-lock sequence.")
     (insert s)
     (let ((org-odd-levels-only odd-levels))
       (org-mode)
-      (org-font-lock-ensure)
-      (buffer-string))))
+      (font-lock-ensure)
+      (if org-link-descriptive
+          (org-link-display-format
+           (buffer-string))
+        (buffer-string)))))
 
 (defun org-get-level-face (n)
   "Get the right face for match N in font-lock matching of headlines."
@@ -5935,6 +6021,9 @@ If TAG is a number, get the corresponding match group."
                            '(mouse-face t keymap t org-linked-text t
                                         invisible t intangible t
                                         org-emphasis t))
+    (org-fold-region beg end nil 'org-link)
+    (org-fold-region beg end nil 'org-link-description)
+    (org-fold-core-update-optimisation beg end)
     (org-remove-font-lock-display-properties beg end)))
 
 (defconst org-script-display  '(((raise -0.3) (height 0.7))
@@ -5980,6 +6069,8 @@ and subscripts."
                           (if (equal (char-after (match-beginning 2)) ?^)
                               (nth (if table-p 3 1) org-script-display)
                             (nth (if table-p 2 0) org-script-display)))
+        (put-text-property (match-beginning 2) (match-end 3)
+                           'org-emphasis t)
        (add-text-properties (match-beginning 2) (match-end 2)
                             (list 'invisible t))
        (when (and (eq (char-after (match-beginning 3)) ?{)
@@ -5999,6 +6090,7 @@ and subscripts."
                                        (overlay-end o))))
         (delete-overlay o))))
 
+;; FIXME: This function is unused.
 (defun org-show-empty-lines-in-parent ()
   "Move to the parent and re-show empty lines before visible headlines."
   (save-excursion
@@ -6011,853 +6103,38 @@ This is useful for operations that need to scan all of 
a user's
 open and agenda-wise Org files."
   (let ((files (mapcar #'expand-file-name (org-agenda-files))))
     (dolist (buf (buffer-list))
-      (with-current-buffer buf
-       (when (and (derived-mode-p 'org-mode) (buffer-file-name))
-         (cl-pushnew (expand-file-name (buffer-file-name)) files
-                     :test #'equal))))
-    files))
-
-(defsubst org-entry-beginning-position ()
-  "Return the beginning position of the current entry."
-  (save-excursion (org-back-to-heading t) (point)))
-
-(defsubst org-entry-end-position ()
-  "Return the end position of the current entry."
-  (save-excursion (outline-next-heading) (point)))
-
-(defun org-subtree-end-visible-p ()
-  "Is the end of the current subtree visible?"
-  (pos-visible-in-window-p
-   (save-excursion (org-end-of-subtree t) (point))))
-
-(defun org-first-headline-recenter ()
-  "Move cursor to the first headline and recenter the headline."
-  (let ((window (get-buffer-window)))
-    (when window
-      (goto-char (point-min))
-      (when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t)
-       (set-window-start window (line-beginning-position))))))
-
-
-;;; Visibility (headlines, blocks, drawers)
-
-;;;; Headlines visibility
-
-(defun org-show-entry ()
-  "Show the body directly following its heading.
-Show the heading too, if it is currently invisible."
-  (interactive)
-  (save-excursion
-    (org-back-to-heading-or-point-min t)
-    (org-flag-region
-     (line-end-position 0)
-     (save-excursion
-       (if (re-search-forward
-           (concat "[\r\n]\\(" org-outline-regexp "\\)") nil t)
-          (match-beginning 1)
-        (point-max)))
-     nil
-     'outline)
-    (org-cycle-hide-drawers 'children)))
-
-(defun org-hide-entry ()
-  "Hide the body directly following its heading."
-  (interactive)
-  (save-excursion
-    (org-back-to-heading-or-point-min t)
-    (when (org-at-heading-p) (forward-line))
-    (org-flag-region
-     (line-end-position 0)
-     (save-excursion
-       (if (re-search-forward
-           (concat "[\r\n]" org-outline-regexp) nil t)
-           (line-end-position 0)
-        (point-max)))
-     t
-     'outline)))
-
-(defun org-show-children (&optional level)
-  "Show all direct subheadings of this heading.
-Prefix arg LEVEL is how many levels below the current level
-should be shown.  Default is enough to cause the following
-heading to appear."
-  (interactive "p")
-  (unless (org-before-first-heading-p)
-    (save-excursion
-      (org-with-limited-levels (org-back-to-heading t))
-      (let* ((current-level (funcall outline-level))
-            (max-level (org-get-valid-level
-                        current-level
-                        (if level (prefix-numeric-value level) 1)))
-            (end (save-excursion (org-end-of-subtree t t)))
-            (regexp-fmt "^\\*\\{%d,%s\\}\\(?: \\|$\\)")
-            (past-first-child nil)
-            ;; Make sure to skip inlinetasks.
-            (re (format regexp-fmt
-                        current-level
-                        (cond
-                         ((not (featurep 'org-inlinetask)) "")
-                         (org-odd-levels-only (- (* 2 org-inlinetask-min-level)
-                                                 3))
-                         (t (1- org-inlinetask-min-level))))))
-       ;; Display parent heading.
-       (org-flag-heading nil)
-       (forward-line)
-       ;; Display children.  First child may be deeper than expected
-       ;; MAX-LEVEL.  Since we want to display it anyway, adjust
-       ;; MAX-LEVEL accordingly.
-       (while (re-search-forward re end t)
-         (unless past-first-child
-           (setq re (format regexp-fmt
-                            current-level
-                            (max (funcall outline-level) max-level)))
-           (setq past-first-child t))
-         (org-flag-heading nil))))))
-
-(defun org-show-subtree ()
-  "Show everything after this heading at deeper levels."
-  (interactive)
-  (org-flag-region
-   (point) (save-excursion (org-end-of-subtree t t)) nil 'outline))
-
-;;;; Blocks and drawers visibility
-
-(defun org--hide-wrapper-toggle (element category force no-error)
-  "Toggle visibility for ELEMENT.
-
-ELEMENT is a block or drawer type parsed element.  CATEGORY is
-either `block' or `drawer'.  When FORCE is `off', show the block
-or drawer.  If it is non-nil, hide it unconditionally.  Throw an
-error when not at a block or drawer, unless NO-ERROR is non-nil.
-
-Return a non-nil value when toggling is successful."
-  (let ((type (org-element-type element)))
-    (cond
-     ((memq type
-           (pcase category
-             (`drawer '(drawer property-drawer))
-             (`block '(center-block
-                       comment-block dynamic-block example-block export-block
-                       quote-block special-block src-block verse-block))
-             (_ (error "Unknown category: %S" category))))
-      (let* ((post (org-element-property :post-affiliated element))
-            (start (save-excursion
-                     (goto-char post)
-                     (line-end-position)))
-            (end (save-excursion
-                   (goto-char (org-element-property :end element))
-                   (skip-chars-backward " \t\n")
-                   (line-end-position))))
-       ;; Do nothing when not before or at the block opening line or
-       ;; at the block closing line.
-       (unless (let ((eol (line-end-position)))
-                 (and (> eol start) (/= eol end)))
-         (let* ((spec (if (eq category 'block) 'org-hide-block 'outline))
-                (flag
-                 (cond ((eq force 'off) nil)
-                       (force t)
-                       ((eq spec (get-char-property start 'invisible)) nil)
-                       (t t))))
-           (org-flag-region start end flag spec))
-         ;; When the block is hidden away, make sure point is left in
-         ;; a visible part of the buffer.
-         (when (invisible-p (max (1- (point)) (point-min)))
-           (goto-char post))
-         ;; Signal success.
-         t)))
-     (no-error nil)
-     (t
-      (user-error (if (eq category 'drawer)
-                     "Not at a drawer"
-                   "Not at a block"))))))
-
-(defun org-hide-block-toggle (&optional force no-error element)
-  "Toggle the visibility of the current block.
-
-When optional argument FORCE is `off', make block visible.  If it
-is non-nil, hide it unconditionally.  Throw an error when not at
-a block, unless NO-ERROR is non-nil.  When optional argument
-ELEMENT is provided, consider it instead of the current block.
-
-Return a non-nil value when toggling is successful."
-  (interactive)
-  (org--hide-wrapper-toggle
-   (or element (org-element-at-point)) 'block force no-error))
-
-(defun org-hide-drawer-toggle (&optional force no-error element)
-  "Toggle the visibility of the current drawer.
-
-When optional argument FORCE is `off', make drawer visible.  If
-it is non-nil, hide it unconditionally.  Throw an error when not
-at a drawer, unless NO-ERROR is non-nil.  When optional argument
-ELEMENT is provided, consider it instead of the current drawer.
-
-Return a non-nil value when toggling is successful."
-  (interactive)
-  (org--hide-wrapper-toggle
-   (or element (org-element-at-point)) 'drawer force no-error))
-
-(defun org-hide-block-all ()
-  "Fold all blocks in the current buffer."
-  (interactive)
-  (org-show-all '(blocks))
-  (org-block-map 'org-hide-block-toggle))
-
-(defun org-hide-drawer-all ()
-  "Fold all drawers in the current buffer."
-  (let ((begin (point-min))
-       (end (point-max)))
-    (org--hide-drawers begin end)))
-
-(defun org-cycle-hide-drawers (state)
-  "Re-hide all drawers after a visibility state change.
-STATE should be one of the symbols listed in the docstring of
-`org-cycle-hook'."
-  (when (derived-mode-p 'org-mode)
-    (cond ((not (memq state '(overview folded contents)))
-          (let* ((global? (eq state 'all))
-                 (beg (if global? (point-min) (line-beginning-position)))
-                 (end (cond (global? (point-max))
-                            ((eq state 'children) (org-entry-end-position))
-                            (t (save-excursion (org-end-of-subtree t t))))))
-            (org--hide-drawers beg end)))
-         ((memq state '(overview contents))
-          ;; Hide drawers before first heading.
-          (let ((beg (point-min))
-                (end (save-excursion
-                       (goto-char (point-min))
-                       (if (org-before-first-heading-p)
-                           (org-entry-end-position)
-                         (point-min)))))
-            (when (< beg end)
-              (org--hide-drawers beg end)))))))
-
-(defun org--hide-drawers (begin end)
-  "Hide all drawers between BEGIN and END."
-  (save-excursion
-    (goto-char begin)
-    (while (re-search-forward org-drawer-regexp end t)
-      (let* ((pair (get-char-property-and-overlay (line-beginning-position)
-                                                 'invisible))
-            (o (cdr-safe pair)))
-       (if (overlayp o) (goto-char (overlay-end o)) ;invisible drawer
-         (pcase (get-char-property-and-overlay (point) 'invisible)
-           (`(outline . ,o) (goto-char (overlay-end o))) ;already folded
-           (_
-            (let* ((drawer (org-element-at-point))
-                   (type (org-element-type drawer)))
-              (when (memq type '(drawer property-drawer))
-                (org-hide-drawer-toggle t nil drawer)
-                ;; Make sure to skip drawer entirely or we might flag it
-                ;; another time when matching its ending line with
-                ;; `org-drawer-regexp'.
-                (goto-char (org-element-property :end drawer)))))))))))
-
-;;;; Visibility cycling
-
-(defvar-local org-cycle-global-status nil)
-(put 'org-cycle-global-status 'org-state t)
-(defvar-local org-cycle-subtree-status nil)
-(put 'org-cycle-subtree-status 'org-state t)
-
-(defun org-show-all (&optional types)
-  "Show all contents in the visible part of the buffer.
-By default, the function expands headings, blocks and drawers.
-When optional argument TYPE is a list of symbols among `blocks',
-`drawers' and `headings', to only expand one specific type."
-  (interactive)
-  (let ((types (or types '(blocks drawers headings))))
-    (when (memq 'blocks types)
-      (org-flag-region (point-min) (point-max) nil 'org-hide-block))
-    (cond
-     ;; Fast path.  Since headings and drawers share the same
-     ;; invisible spec, clear everything in one go.
-     ((and (memq 'headings types)
-          (memq 'drawers types))
-      (org-flag-region (point-min) (point-max) nil 'outline))
-     ((memq 'headings types)
-      (org-flag-region (point-min) (point-max) nil 'outline)
-      (org-cycle-hide-drawers 'all))
-     ((memq 'drawers types)
-      (save-excursion
-       (goto-char (point-min))
-       (while (re-search-forward org-drawer-regexp nil t)
-         (let* ((pair (get-char-property-and-overlay (line-beginning-position)
-                                                     'invisible))
-                (o (cdr-safe pair)))
-           (if (overlayp o) (goto-char (overlay-end o))
-             (pcase (get-char-property-and-overlay (point) 'invisible)
-               (`(outline . ,o)
-                (goto-char (overlay-end o))
-                (delete-overlay o))
-               (_ nil))))))))))
-
-;;;###autoload
-(defun org-cycle (&optional arg)
-  "TAB-action and visibility cycling for Org mode.
-
-This is the command invoked in Org mode by the `TAB' key.  Its main
-purpose is outline visibility cycling, but it also invokes other actions
-in special contexts.
-
-When this function is called with a `\\[universal-argument]' prefix, rotate \
-the entire
-buffer through 3 states (global cycling)
-  1. OVERVIEW: Show only top-level headlines.
-  2. CONTENTS: Show all headlines of all levels, but no body text.
-  3. SHOW ALL: Show everything.
-
-With a `\\[universal-argument] \\[universal-argument]' prefix argument, \
-switch to the startup visibility,
-determined by the variable `org-startup-folded', and by any VISIBILITY
-properties in the buffer.
-
-With a `\\[universal-argument] \\[universal-argument] \
-\\[universal-argument]' prefix argument, show the entire buffer, including
-any drawers.
-
-When inside a table, re-align the table and move to the next field.
-
-When point is at the beginning of a headline, rotate the subtree started
-by this line through 3 different states (local cycling)
-  1. FOLDED:   Only the main headline is shown.
-  2. CHILDREN: The main headline and the direct children are shown.
-               From this state, you can move to one of the children
-               and zoom in further.
-  3. SUBTREE:  Show the entire subtree, including body text.
-If there is no subtree, switch directly from CHILDREN to FOLDED.
-
-When point is at the beginning of an empty headline and the variable
-`org-cycle-level-after-item/entry-creation' is set, cycle the level
-of the headline by demoting and promoting it to likely levels.  This
-speeds up creation document structure by pressing `TAB' once or several
-times right after creating a new headline.
-
-When there is a numeric prefix, go up to a heading with level ARG, do
-a `show-subtree' and return to the previous cursor position.  If ARG
-is negative, go up that many levels.
-
-When point is not at the beginning of a headline, execute the global
-binding for `TAB', which is re-indenting the line.  See the option
-`org-cycle-emulate-tab' for details.
-
-As a special case, if point is at the very beginning of the buffer, if
-there is no headline there, and if the variable `org-cycle-global-at-bob'
-is non-nil, this function acts as if called with prefix argument \
-\(`\\[universal-argument] TAB',
-same as `S-TAB') also when called without prefix argument."
-  (interactive "P")
-  (org-load-modules-maybe)
-  (unless (or (run-hook-with-args-until-success 'org-tab-first-hook)
-             (and org-cycle-level-after-item/entry-creation
-                  (or (org-cycle-level)
-                      (org-cycle-item-indentation))))
-    (let* ((limit-level
-           (or org-cycle-max-level
-               (and (boundp 'org-inlinetask-min-level)
-                    org-inlinetask-min-level
-                    (1- org-inlinetask-min-level))))
-          (nstars
-           (and limit-level
-                (if org-odd-levels-only
-                    (1- (* 2 limit-level))
-                  limit-level)))
-          (org-outline-regexp
-           (format "\\*%s " (if nstars (format "\\{1,%d\\}" nstars) "+"))))
-      (cond
-       ((equal arg '(16))
-       (setq last-command 'dummy)
-       (org-set-startup-visibility)
-       (org-unlogged-message "Startup visibility, plus VISIBILITY properties"))
-       ((equal arg '(64))
-       (org-show-all)
-       (org-unlogged-message "Entire buffer visible, including drawers"))
-       ((equal arg '(4)) (org-cycle-internal-global))
-       ;; Show-subtree, ARG levels up from here.
-       ((integerp arg)
-       (save-excursion
-         (org-back-to-heading)
-         (outline-up-heading (if (< arg 0) (- arg)
-                               (- (funcall outline-level) arg)))
-         (org-show-subtree)))
-       ;; Global cycling at BOB: delegate to `org-cycle-internal-global'.
-       ((and org-cycle-global-at-bob
-            (bobp)
-            (not (looking-at org-outline-regexp)))
-       (let ((org-cycle-hook
-              (remq 'org-optimize-window-after-visibility-change
-                    org-cycle-hook)))
-         (org-cycle-internal-global)))
-       ;; Try CDLaTeX TAB completion.
-       ((org-try-cdlatex-tab))
-       ;; Inline task: delegate to `org-inlinetask-toggle-visibility'.
-       ((and (featurep 'org-inlinetask)
-            (org-inlinetask-at-task-p)
-            (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
-       (org-inlinetask-toggle-visibility))
-       (t
-       (let ((pos (point))
-             (element (org-element-at-point)))
-         (cond
-          ;; Try toggling visibility for block at point.
-          ((org-hide-block-toggle nil t element))
-          ;; Try toggling visibility for drawer at point.
-          ((org-hide-drawer-toggle nil t element))
-          ;; Table: enter it or move to the next field.
-          ((and (org-match-line "[ \t]*[|+]")
-                (org-element-lineage element '(table) t))
-           (if (and (eq 'table (org-element-type element))
-                    (eq 'table.el (org-element-property :type element)))
-               (message (substitute-command-keys "\\<org-mode-map>\
-Use `\\[org-edit-special]' to edit table.el tables"))
-             (org-table-justify-field-maybe)
-             (call-interactively #'org-table-next-field)))
-          ((run-hook-with-args-until-success
-            'org-tab-after-check-for-table-hook))
-          ;; At an item/headline: delegate to `org-cycle-internal-local'.
-          ((and (or (and org-cycle-include-plain-lists
-                         (let ((item (org-element-lineage element
-                                                          '(item plain-list)
-                                                          t)))
-                           (and item
-                                (= (line-beginning-position)
-                                   (org-element-property :post-affiliated
-                                                         item)))))
-                    (org-match-line org-outline-regexp))
-                (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
-           (org-cycle-internal-local))
-          ;; From there: TAB emulation and template completion.
-          (buffer-read-only (org-back-to-heading))
-          ((run-hook-with-args-until-success
-            'org-tab-after-check-for-cycling-hook))
-          ((run-hook-with-args-until-success
-            'org-tab-before-tab-emulation-hook))
-          ((and (eq org-cycle-emulate-tab 'exc-hl-bol)
-                (or (not (bolp))
-                    (not (looking-at org-outline-regexp))))
-           (call-interactively (global-key-binding (kbd "TAB"))))
-          ((or (eq org-cycle-emulate-tab t)
-               (and (memq org-cycle-emulate-tab '(white whitestart))
-                    (save-excursion (beginning-of-line 1) (looking-at "[ 
\t]*"))
-                    (or (and (eq org-cycle-emulate-tab 'white)
-                              (= (match-end 0) (line-end-position)))
-                        (and (eq org-cycle-emulate-tab 'whitestart)
-                             (>= (match-end 0) pos)))))
-           (call-interactively (global-key-binding (kbd "TAB"))))
-          (t
-           (save-excursion
-             (org-back-to-heading)
-             (org-cycle))))))))))
-
-(defun org-cycle-internal-global ()
-  "Do the global cycling action."
-  ;; Hack to avoid display of messages for .org  attachments in Gnus
-  (let ((ga (string-match-p "\\*fontification" (buffer-name))))
-    (cond
-     ((and (eq last-command this-command)
-          (eq org-cycle-global-status 'overview))
-      ;; We just created the overview - now do table of contents
-      ;; This can be slow in very large buffers, so indicate action
-      (run-hook-with-args 'org-pre-cycle-hook 'contents)
-      (unless ga (org-unlogged-message "CONTENTS..."))
-      (org-content)
-      (unless ga (org-unlogged-message "CONTENTS...done"))
-      (setq org-cycle-global-status 'contents)
-      (run-hook-with-args 'org-cycle-hook 'contents))
-
-     ((and (eq last-command this-command)
-          (eq org-cycle-global-status 'contents))
-      ;; We just showed the table of contents - now show everything
-      (run-hook-with-args 'org-pre-cycle-hook 'all)
-      (org-show-all '(headings blocks))
-      (unless ga (org-unlogged-message "SHOW ALL"))
-      (setq org-cycle-global-status 'all)
-      (run-hook-with-args 'org-cycle-hook 'all))
-
-     (t
-      ;; Default action: go to overview
-      (run-hook-with-args 'org-pre-cycle-hook 'overview)
-      (org-overview)
-      (unless ga (org-unlogged-message "OVERVIEW"))
-      (setq org-cycle-global-status 'overview)
-      (run-hook-with-args 'org-cycle-hook 'overview)))))
-
-(defvar org-called-with-limited-levels nil
-  "Non-nil when `org-with-limited-levels' is currently active.")
-
-(defun org-cycle-internal-local ()
-  "Do the local cycling action."
-  (let ((goal-column 0) eoh eol eos has-children children-skipped struct)
-    ;; First, determine end of headline (EOH), end of subtree or item
-    ;; (EOS), and if item or heading has children (HAS-CHILDREN).
-    (save-excursion
-      (if (org-at-item-p)
-         (progn
-           (beginning-of-line)
-           (setq struct (org-list-struct))
-            (setq eoh (line-end-position))
-           (setq eos (org-list-get-item-end-before-blank (point) struct))
-           (setq has-children (org-list-has-child-p (point) struct)))
-       (org-back-to-heading)
-       (setq eoh (save-excursion (outline-end-of-heading) (point)))
-       (setq eos (save-excursion
-                   (org-end-of-subtree t t)
-                   (unless (eobp) (forward-char -1))
-                   (point)))
-       (setq has-children
-             (or
-              (save-excursion
-                (let ((level (funcall outline-level)))
-                  (outline-next-heading)
-                  (and (org-at-heading-p t)
-                       (> (funcall outline-level) level))))
-              (and (eq org-cycle-include-plain-lists 'integrate)
-                   (save-excursion
-                     (org-list-search-forward (org-item-beginning-re) eos 
t))))))
-      ;; Determine end invisible part of buffer (EOL)
-      (beginning-of-line 2)
-      (while (and (not (eobp))         ;this is like `next-line'
-                 (get-char-property (1- (point)) 'invisible))
-       (goto-char (next-single-char-property-change (point) 'invisible))
-       (and (eolp) (beginning-of-line 2)))
-      (setq eol (point)))
-    ;; Find out what to do next and set `this-command'
-    (cond
-     ((= eos eoh)
-      ;; Nothing is hidden behind this heading
-      (unless (org-before-first-heading-p)
-       (run-hook-with-args 'org-pre-cycle-hook 'empty))
-      (org-unlogged-message "EMPTY ENTRY")
-      (setq org-cycle-subtree-status nil)
-      (save-excursion
-       (goto-char eos)
-       (outline-next-heading)
-       (when (org-invisible-p) (org-flag-heading nil))))
-     ((and (or (>= eol eos)
-              (not (string-match "\\S-" (buffer-substring eol eos))))
-          (or has-children
-              (not (setq children-skipped
-                         org-cycle-skip-children-state-if-no-children))))
-      ;; Entire subtree is hidden in one line: children view
-      (unless (org-before-first-heading-p)
-       (run-hook-with-args 'org-pre-cycle-hook 'children))
-      (if (org-at-item-p)
-          (org-list-set-item-visibility (line-beginning-position) struct 
'children)
-       (org-show-entry)
-       (org-with-limited-levels (org-show-children))
-       (org-show-set-visibility 'tree)
-       ;; Fold every list in subtree to top-level items.
-       (when (eq org-cycle-include-plain-lists 'integrate)
-         (save-excursion
-           (org-back-to-heading)
-           (while (org-list-search-forward (org-item-beginning-re) eos t)
-             (beginning-of-line 1)
-             (let* ((struct (org-list-struct))
-                    (prevs (org-list-prevs-alist struct))
-                    (end (org-list-get-bottom-point struct)))
-               (dolist (e (org-list-get-all-items (point) struct prevs))
-                 (org-list-set-item-visibility e struct 'folded))
-               (goto-char (if (< end eos) end eos)))))))
-      (org-unlogged-message "CHILDREN")
-      (save-excursion
-       (goto-char eos)
-       (outline-next-heading)
-       (when (org-invisible-p) (org-flag-heading nil)))
-      (setq org-cycle-subtree-status 'children)
-      (unless (org-before-first-heading-p)
-       (run-hook-with-args 'org-cycle-hook 'children)))
-     ((or children-skipped
-         (and (eq last-command this-command)
-              (eq org-cycle-subtree-status 'children)))
-      ;; We just showed the children, or no children are there,
-      ;; now show everything.
-      (unless (org-before-first-heading-p)
-       (run-hook-with-args 'org-pre-cycle-hook 'subtree))
-      (org-flag-region eoh eos nil 'outline)
-      (org-unlogged-message
-       (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE"))
-      (setq org-cycle-subtree-status 'subtree)
-      (unless (org-before-first-heading-p)
-       (run-hook-with-args 'org-cycle-hook 'subtree)))
-     (t
-      ;; Default action: hide the subtree.
-      (run-hook-with-args 'org-pre-cycle-hook 'folded)
-      (org-flag-region eoh eos t 'outline)
-      (org-unlogged-message "FOLDED")
-      (setq org-cycle-subtree-status 'folded)
-      (unless (org-before-first-heading-p)
-       (run-hook-with-args 'org-cycle-hook 'folded))))))
-
-;;;###autoload
-(defun org-global-cycle (&optional arg)
-  "Cycle the global visibility.  For details see `org-cycle'.
-With `\\[universal-argument]' prefix ARG, switch to startup visibility.
-With a numeric prefix, show all headlines up to that level."
-  (interactive "P")
-  (cond
-   ((integerp arg)
-    (org-content arg)
-    (setq org-cycle-global-status 'contents))
-   ((equal arg '(4))
-    (org-set-startup-visibility)
-    (org-unlogged-message "Startup visibility, plus VISIBILITY properties."))
-   (t
-    (org-cycle '(4)))))
-
-(defun org-set-startup-visibility ()
-  "Set the visibility required by startup options and properties."
-  (cond
-   ((eq org-startup-folded t)
-    (org-overview))
-   ((eq org-startup-folded 'content)
-    (org-content))
-   ((eq org-startup-folded 'show2levels)
-    (org-content 2))
-   ((eq org-startup-folded 'show3levels)
-    (org-content 3))
-   ((eq org-startup-folded 'show4levels)
-    (org-content 4))
-   ((eq org-startup-folded 'show5levels)
-    (org-content 5))
-   ((or (eq org-startup-folded 'showeverything)
-       (eq org-startup-folded nil))
-    (org-show-all)))
-  (unless (eq org-startup-folded 'showeverything)
-    (when org-hide-block-startup (org-hide-block-all))
-    (org-set-visibility-according-to-property)
-    (org-cycle-hide-archived-subtrees 'all)
-    (org-cycle-hide-drawers 'all)
-    (org-cycle-show-empty-lines t)))
-
-(defun org-set-visibility-according-to-property ()
-  "Switch subtree visibility according to VISIBILITY property."
-  (interactive)
-  (let ((regexp (org-re-property "VISIBILITY")))
-    (org-with-point-at 1
-      (while (re-search-forward regexp nil t)
-       (let ((state (match-string 3)))
-         (if (not (org-at-property-p)) (outline-next-heading)
-           (save-excursion
-             (org-back-to-heading t)
-             (org-flag-subtree t)
-             (org-reveal)
-             (pcase state
-               ("folded"
-                (org-flag-subtree t))
-               ("children"
-                (org-show-hidden-entry)
-                (org-show-children))
-               ("content"
-                (save-excursion
-                  (save-restriction
-                    (org-narrow-to-subtree)
-                    (org-content))))
-               ((or "all" "showall")
-                (outline-show-subtree))
-               (_ nil)))
-           (org-end-of-subtree)))))))
-
-(defun org-overview ()
-  "Switch to overview mode, showing only top-level headlines."
-  (interactive)
-  (org-show-all '(headings drawers))
-  (save-excursion
-    (goto-char (point-min))
-    (when (re-search-forward org-outline-regexp-bol nil t)
-      (let* ((last (line-end-position))
-             (level (- (match-end 0) (match-beginning 0) 1))
-             (regexp (format "^\\*\\{1,%d\\} " level)))
-        (while (re-search-forward regexp nil :move)
-          (org-flag-region last (line-end-position 0) t 'outline)
-          (setq last (line-end-position))
-          (setq level (- (match-end 0) (match-beginning 0) 1))
-          (setq regexp (format "^\\*\\{1,%d\\} " level)))
-        (org-flag-region last (point) t 'outline)))))
-
-(defun org-content (&optional arg)
-  "Show all headlines in the buffer, like a table of contents.
-With numerical argument N, show content up to level N."
-  (interactive "p")
-  (org-show-all '(headings drawers))
-  (save-excursion
-    (goto-char (point-max))
-    (let ((regexp (if (and (wholenump arg) (> arg 0))
-                      (format "^\\*\\{1,%d\\} " arg)
-                    "^\\*+ "))
-          (last (point)))
-      (while (re-search-backward regexp nil t)
-        (org-flag-region (line-end-position) last t 'outline)
-        (setq last (line-end-position 0))))))
-
-(defvar org-scroll-position-to-restore nil
-  "Temporarily store scroll position to restore.")
-(defun org-optimize-window-after-visibility-change (state)
-  "Adjust the window after a change in outline visibility.
-This function is the default value of the hook `org-cycle-hook'."
-  (when (get-buffer-window (current-buffer))
-    (let ((repeat (eq last-command this-command)))
-      (unless repeat
-       (setq org-scroll-position-to-restore nil))
-      (cond
-       ((eq state 'content)  nil)
-       ((eq state 'all)      nil)
-       ((and org-scroll-position-to-restore repeat
-            (eq state 'folded))
-       (set-window-start nil org-scroll-position-to-restore))
-       ((eq state 'folded) nil)
-       ((eq state 'children)
-       (setq org-scroll-position-to-restore (window-start))
-       (or (org-subtree-end-visible-p) (recenter 1)))
-       ((eq state 'subtree)
-       (unless repeat
-         (setq org-scroll-position-to-restore (window-start)))
-       (or (org-subtree-end-visible-p) (recenter 1)))))))
-
-(defun org-clean-visibility-after-subtree-move ()
-  "Fix visibility issues after moving a subtree."
-  ;; First, find a reasonable region to look at:
-  ;; Start two siblings above, end three below
-  (let* ((beg (save-excursion
-               (and (org-get-previous-sibling)
-                    (org-get-previous-sibling))
-               (point)))
-        (end (save-excursion
-               (and (org-get-next-sibling)
-                    (org-get-next-sibling)
-                    (org-get-next-sibling))
-               (if (org-at-heading-p)
-                    (line-end-position)
-                 (point))))
-        (level (looking-at "\\*+"))
-        (re (when level (concat "^" (regexp-quote (match-string 0)) " "))))
-    (save-excursion
-      (save-restriction
-       (narrow-to-region beg end)
-       (when re
-         ;; Properly fold already folded siblings
-         (goto-char (point-min))
-         (while (re-search-forward re nil t)
-           (when (and (not (org-invisible-p))
-                      (org-invisible-p (line-end-position)))
-             (outline-hide-entry))))
-       (org-cycle-hide-drawers 'all)
-       (org-cycle-show-empty-lines 'overview)))))
+      (with-current-buffer buf
+       (when (and (derived-mode-p 'org-mode) (buffer-file-name))
+         (cl-pushnew (expand-file-name (buffer-file-name)) files
+                     :test #'equal))))
+    files))
 
-(defun org-cycle-show-empty-lines (state)
-  "Show empty lines above all visible headlines.
-The region to be covered depends on STATE when called through
-`org-cycle-hook'.  Lisp program can use t for STATE to get the
-entire buffer covered.  Note that an empty line is only shown if there
-are at least `org-cycle-separator-lines' empty lines before the headline."
-  (when (/= org-cycle-separator-lines 0)
-    (save-excursion
-      (let* ((n (abs org-cycle-separator-lines))
-            (re (cond
-                 ((= n 1) "\\(\n[ \t]*\n\\*+\\) ")
-                 ((= n 2) "^[ \t]*\\(\n[ \t]*\n\\*+\\) ")
-                 (t (let ((ns (number-to-string (- n 2))))
-                      (concat "^\\(?:[ \t]*\n\\)\\{" ns "," ns "\\}"
-                              "[ \t]*\\(\n[ \t]*\n\\*+\\) ")))))
-            beg end)
-       (cond
-        ((memq state '(overview contents t))
-         (setq beg (point-min) end (point-max)))
-        ((memq state '(children folded))
-         (setq beg (point)
-               end (progn (org-end-of-subtree t t)
-                          (line-beginning-position 2)))))
-       (when beg
-         (goto-char beg)
-         (while (re-search-forward re end t)
-           (unless (get-char-property (match-end 1) 'invisible)
-             (let ((e (match-end 1))
-                   (b (if (>= org-cycle-separator-lines 0)
-                          (match-beginning 1)
-                        (save-excursion
-                          (goto-char (match-beginning 0))
-                          (skip-chars-backward " \t\n")
-                          (line-end-position)))))
-               (org-flag-region b e nil 'outline))))))))
-  ;; Never hide empty lines at the end of the file.
-  (save-excursion
-    (goto-char (point-max))
-    (outline-previous-heading)
-    (outline-end-of-heading)
-    (when (and (looking-at "[ \t\n]+")
-              (= (match-end 0) (point-max)))
-      (org-flag-region (point) (match-end 0) nil 'outline))))
-
-;;;; Reveal point location
-
-(defun org-show-context (&optional key)
-  "Make sure point and context are visible.
-Optional argument KEY, when non-nil, is a symbol.  See
-`org-show-context-detail' for allowed values and how much is to
-be shown."
-  (org-show-set-visibility
-   (cond ((symbolp org-show-context-detail) org-show-context-detail)
-        ((cdr (assq key org-show-context-detail)))
-        (t (cdr (assq 'default org-show-context-detail))))))
-
-(defun org-show-set-visibility (detail)
-  "Set visibility around point according to DETAIL.
-DETAIL is either nil, `minimal', `local', `ancestors',
-`ancestors-full', `lineage', `tree', `canonical' or t.  See
-`org-show-context-detail' for more information."
-  ;; Show current heading and possibly its entry, following headline
-  ;; or all children.
-  (if (and (org-at-heading-p) (not (eq detail 'local)))
-      (org-flag-heading nil)
-    (org-show-entry)
-    ;; If point is hidden within a drawer or a block, make sure to
-    ;; expose it.
-    (dolist (o (overlays-at (point)))
-      (when (memq (overlay-get o 'invisible) '(org-hide-block outline))
-       (delete-overlay o)))
-    (unless (org-before-first-heading-p)
-      (org-with-limited-levels
-       (cl-case detail
-        ((tree canonical t) (org-show-children))
-        ((nil minimal ancestors ancestors-full))
-        (t (save-excursion
-             (outline-next-heading)
-             (org-flag-heading nil)))))))
-  ;; Show whole subtree.
-  (when (eq detail 'ancestors-full) (org-show-subtree))
-  ;; Show all siblings.
-  (when (eq detail 'lineage) (org-show-siblings))
-  ;; Show ancestors, possibly with their children.
-  (when (memq detail '(ancestors ancestors-full lineage tree canonical t))
-    (save-excursion
-      (while (org-up-heading-safe)
-       (org-flag-heading nil)
-       (when (memq detail '(canonical t)) (org-show-entry))
-       (when (memq detail '(tree canonical t)) (org-show-children))))))
+(defsubst org-entry-beginning-position ()
+  "Return the beginning position of the current entry."
+  (save-excursion (org-back-to-heading t) (point)))
 
-(defvar org-reveal-start-hook nil
-  "Hook run before revealing a location.")
+(defsubst org-entry-end-position ()
+  "Return the end position of the current entry."
+  (save-excursion (outline-next-heading) (point)))
 
-(defun org-reveal (&optional siblings)
-  "Show current entry, hierarchy above it, and the following headline.
+(defun org-subtree-end-visible-p ()
+  "Is the end of the current subtree visible?"
+  (pos-visible-in-window-p
+   (save-excursion (org-end-of-subtree t) (point))))
 
-This can be used to show a consistent set of context around
-locations exposed with `org-show-context'.
+(defun org-first-headline-recenter ()
+  "Move cursor to the first headline and recenter the headline."
+  (let ((window (get-buffer-window)))
+    (when window
+      (goto-char (point-min))
+      (when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t)
+       (set-window-start window (line-beginning-position))))))
 
-With optional argument SIBLINGS, on each level of the hierarchy all
-siblings are shown.  This repairs the tree structure to what it would
-look like when opened with hierarchical calls to `org-cycle'.
+
 
-With a \\[universal-argument] \\[universal-argument] prefix, \
-go to the parent and show the entire tree."
-  (interactive "P")
-  (run-hooks 'org-reveal-start-hook)
-  (cond ((equal siblings '(4)) (org-show-set-visibility 'canonical))
-       ((equal siblings '(16))
-        (save-excursion
-          (when (org-up-heading-safe)
-            (org-show-subtree)
-            (run-hook-with-args 'org-cycle-hook 'subtree))))
-       (t (org-show-set-visibility 'lineage))))
+;; FIXME: It was in the middle of visibility section. Where should it go to?
+(defvar org-called-with-limited-levels nil
+  "Non-nil when `org-with-limited-levels' is currently active.")
 
 
 ;;; Indirect buffer display of subtrees
@@ -6927,24 +6204,27 @@ frame is not changed."
       (pop-to-buffer ibuf))
      (t (error "Invalid value")))
     (narrow-to-region beg end)
-    (org-show-all '(headings drawers blocks))
+    (org-fold-show-all '(headings drawers blocks))
     (goto-char pos)
     (run-hook-with-args 'org-cycle-hook 'all)
     (and (window-live-p cwin) (select-window cwin))))
 
-(defun org-get-indirect-buffer (&optional buffer heading)
-  (setq buffer (or buffer (current-buffer)))
-  (let ((n 1) (base (buffer-name buffer)) bname)
-    (while (buffer-live-p
-           (get-buffer
-            (setq bname
-                  (concat base "-"
-                          (if heading (concat heading "-" (number-to-string n))
-                            (number-to-string n))))))
-      (setq n (1+ n)))
-    (condition-case nil
-        (make-indirect-buffer buffer bname 'clone)
-      (error (make-indirect-buffer buffer bname)))))
+(cl-defun org-get-indirect-buffer (&optional (buffer (current-buffer)) heading)
+  "Return an indirect buffer based on BUFFER.
+If HEADING, append it to the name of the new buffer."
+  (let* ((base-buffer (or (buffer-base-buffer buffer) buffer))
+         (buffer-name (generate-new-buffer-name
+                       (format "%s%s"
+                               (buffer-name base-buffer)
+                               (if heading
+                                   (concat "::" heading)
+                                 ""))))
+         (indirect-buffer (make-indirect-buffer base-buffer buffer-name 
'clone)))
+    ;; Decouple folding state.  We need to do it manually since
+    ;; `make-indirect-buffer' does not run
+    ;; `clone-indirect-buffer-hook'.
+    (org-fold-core-decouple-indirect-buffer-folds)
+    indirect-buffer))
 
 (defun org-set-frame-title (title)
   "Set the title of the current frame to the string TITLE."
@@ -7039,10 +6319,18 @@ unconditionally."
       ;; When INVISIBLE-OK is non-nil, ensure newly created headline
       ;; is visible.
       (unless invisible-ok
-       (pcase (get-char-property-and-overlay (point) 'invisible)
-         (`(outline . ,o)
-          (move-overlay o (overlay-start o) (line-end-position 0)))
-         (_ nil))))
+        (if (eq org-fold-core-style 'text-properties)
+           (cond
+            ((org-fold-folded-p
+               (max (point-min)
+                    (1- (line-beginning-position)))
+               'headline)
+             (org-fold-region (line-end-position 0) (line-end-position) nil 
'headline))
+            (t nil))
+          (pcase (get-char-property-and-overlay (point) 'invisible)
+           (`(outline . ,o)
+            (move-overlay o (overlay-start o) (line-end-position 0)))
+           (_ nil)))))
      ;; At a headline...
      ((org-at-heading-p)
       (cond ((bolp)
@@ -7106,7 +6394,11 @@ Return nil before first heading."
       (org-back-to-heading t)
       (let ((case-fold-search nil))
        (looking-at org-complex-heading-regexp)
-       (let ((todo (and (not no-todo) (match-string 2)))
+        ;; When using `org-fold-core--optimise-for-huge-buffers',
+        ;; returned text will be invisible.  Clear it up.
+        (save-match-data
+          (org-fold-core-remove-optimisation (match-beginning 0) (match-end 
0)))
+        (let ((todo (and (not no-todo) (match-string 2)))
              (priority (and (not no-priority) (match-string 3)))
              (headline (pcase (match-string 4)
                          (`nil "")
@@ -7117,6 +6409,8 @@ Return nil before first heading."
                            "" h))
                          (h h)))
              (tags (and (not no-tags) (match-string 5))))
+          ;; Restore cleared optimization.
+          (org-fold-core-update-optimisation (match-beginning 0) (match-end 0))
          (mapconcat #'identity
                     (delq nil (list todo priority headline tags))
                     " "))))))
@@ -7133,18 +6427,21 @@ This is a list with the following elements:
   (save-excursion
     (org-back-to-heading t)
     (when (let (case-fold-search) (looking-at org-complex-heading-regexp))
-      (list (length (match-string 1))
-           (org-reduced-level (length (match-string 1)))
-           (match-string-no-properties 2)
-           (and (match-end 3) (aref (match-string 3) 2))
-           (match-string-no-properties 4)
-           (match-string-no-properties 5)))))
+      (org-fold-core-remove-optimisation (match-beginning 0) (match-end 0))
+      (prog1
+          (list (length (match-string 1))
+               (org-reduced-level (length (match-string 1)))
+               (match-string-no-properties 2)
+               (and (match-end 3) (aref (match-string 3) 2))
+               (match-string-no-properties 4)
+               (match-string-no-properties 5))
+        (org-fold-core-update-optimisation (match-beginning 0) (match-end 
0))))))
 
 (defun org-get-entry ()
   "Get the entry text, after heading, entire subtree."
   (save-excursion
     (org-back-to-heading t)
-    (buffer-substring (line-beginning-position 2) (org-end-of-subtree t))))
+    (filter-buffer-substring (line-beginning-position 2) (org-end-of-subtree 
t))))
 
 (defun org-edit-headline (&optional heading)
   "Edit the current headline.
@@ -7177,10 +6474,11 @@ Set it to HEADING when provided."
   (interactive)
   (org-insert-heading '(4) invisible-ok))
 
-(defun org-insert-todo-heading-respect-content (&optional force-state)
+(defun org-insert-todo-heading-respect-content (&optional _)
   "Insert TODO heading with `org-insert-heading-respect-content' set to t."
   (interactive)
-  (org-insert-todo-heading force-state '(4)))
+  (let ((org-insert-heading-respect-content t))
+    (org-insert-todo-heading '(4) t)))
 
 (defun org-insert-todo-heading (arg &optional force-heading)
   "Insert a new heading with the same level and TODO state as current heading.
@@ -7253,7 +6551,9 @@ When a subtree is being promoted, the hook will be called 
for each node.")
 See also `org-promote'."
   (interactive)
   (save-excursion
-    (org-with-limited-levels (org-map-tree 'org-promote)))
+    (org-back-to-heading t)
+    (combine-change-calls (point) (save-excursion (org-end-of-subtree t))
+      (org-with-limited-levels (org-map-tree 'org-promote))))
   (org-fix-position-after-promote))
 
 (defun org-demote-subtree ()
@@ -7261,7 +6561,9 @@ See also `org-promote'."
 See `org-demote' and `org-promote'."
   (interactive)
   (save-excursion
-    (org-with-limited-levels (org-map-tree 'org-demote)))
+    (org-back-to-heading t)
+    (combine-change-calls (point) (save-excursion (org-end-of-subtree t))
+      (org-with-limited-levels (org-map-tree 'org-demote))))
   (org-fix-position-after-promote))
 
 (defun org-do-promote ()
@@ -7355,7 +6657,7 @@ odd number.  Returns values greater than 0."
        (replace-match "# " nil t))
       ((= level 1)
        (user-error "Cannot promote to level 0.  UNDO to recover if necessary"))
-      (t (replace-match up-head nil t)))
+      (t (replace-match (apply #'propertize up-head (text-properties-at 
(match-beginning 0))) t)))
      (unless (= level 1)
        (when org-auto-align-tags (org-align-tags))
        (when org-adapt-indentation (org-fixup-indentation (- diff))))
@@ -7370,9 +6672,10 @@ odd number.  Returns values greater than 0."
          (level (save-match-data (funcall outline-level)))
          (down-head (concat (make-string (org-get-valid-level level 1) ?*) " 
"))
          (diff (abs (- level (length down-head) -1))))
-     (replace-match down-head nil t)
-     (when org-auto-align-tags (org-align-tags))
-     (when org-adapt-indentation (org-fixup-indentation diff))
+     (org-fold-core-ignore-fragility-checks
+       (replace-match (apply #'propertize down-head (text-properties-at 
(match-beginning 0))) t)
+       (when org-auto-align-tags (org-align-tags))
+       (when org-adapt-indentation (org-fixup-indentation diff)))
      (run-hooks 'org-after-demote-entry-hook))))
 
 (defun org-cycle-level ()
@@ -7580,7 +6883,7 @@ case."
   (goto-char (point-min))
   ;; First check if there are no even levels
   (when (re-search-forward "^\\(\\*\\*\\)+ " nil t)
-    (org-show-set-visibility 'canonical)
+    (org-fold-show-set-visibility 'canonical)
     (error "Not all levels are odd in this file.  Conversion not possible"))
   (when (yes-or-no-p "Are you sure you want to globally change levels to 
odd-even? ")
     (let ((outline-regexp org-outline-regexp)
@@ -7605,6 +6908,36 @@ case."
   (interactive "p")
   (org-move-subtree-down (- (prefix-numeric-value arg))))
 
+(defun org-clean-visibility-after-subtree-move ()
+  "Fix visibility issues after moving a subtree."
+  ;; First, find a reasonable region to look at:
+  ;; Start two siblings above, end three below
+  (let* ((beg (save-excursion
+               (and (org-get-previous-sibling)
+                    (org-get-previous-sibling))
+               (point)))
+        (end (save-excursion
+               (and (org-get-next-sibling)
+                    (org-get-next-sibling)
+                    (org-get-next-sibling))
+               (if (org-at-heading-p)
+                   (line-end-position)
+                 (point))))
+        (level (looking-at "\\*+"))
+        (re (when level (concat "^" (regexp-quote (match-string 0)) " "))))
+    (save-excursion
+      (save-restriction
+       (narrow-to-region beg end)
+       (when re
+         ;; Properly fold already folded siblings
+         (goto-char (point-min))
+         (while (re-search-forward re nil t)
+           (when (and (not (org-invisible-p))
+                      (org-invisible-p (line-end-position)))
+             (org-fold-heading nil))))
+       (org-cycle-hide-drawers 'all)
+       (org-cycle-show-empty-lines 'overview)))))
+
 (defun org-move-subtree-down (&optional arg)
   "Move the current subtree down past ARG headlines of the same level."
   (interactive "p")
@@ -7643,9 +6976,9 @@ case."
      (setq txt (buffer-substring beg end))
      (org-save-markers-in-region beg end)
      (delete-region beg end)
-     (org-remove-empty-overlays-at beg)
-     (unless (= beg (point-min)) (org-flag-region (1- beg) beg nil 'outline))
-     (unless (bobp) (org-flag-region (1- (point)) (point) nil 'outline))
+     (when (eq org-fold-core-style 'overlays) (org-remove-empty-overlays-at 
beg))
+     (unless (= beg (point-min)) (org-fold-region (1- beg) beg nil 'outline))
+     (unless (bobp) (org-fold-region (1- (point)) (point) nil 'outline))
      (and (not (bolp)) (looking-at "\n") (forward-char 1))
      (let ((bbb (point)))
        (insert-before-markers txt)
@@ -7656,9 +6989,9 @@ case."
      (org-skip-whitespace)
      (move-marker ins-point nil)
      (if folded
-        (org-flag-subtree t)
-       (org-show-entry)
-       (org-show-children))
+        (org-fold-subtree t)
+       (org-fold-show-entry 'hide-drawers)
+       (org-fold-show-children))
      (org-clean-visibility-after-subtree-move)
      ;; move back to the initial column we were at
      (move-to-column col))))
@@ -7747,84 +7080,87 @@ the inserted text when done.
 
 When REMOVE is non-nil, remove the subtree from the clipboard."
   (interactive "P")
-  (setq tree (or tree (and kill-ring (current-kill 0))))
+  (setq tree (or tree (current-kill 0)))
   (unless (org-kill-is-subtree-p tree)
     (user-error
      (substitute-command-keys
       "The kill is not a (set of) tree(s).  Use `\\[yank]' to yank anyway")))
   (org-with-limited-levels
-   (let* ((visp (not (org-invisible-p)))
-         (txt tree)
-         (old-level (if (string-match org-outline-regexp-bol txt)
-                        (- (match-end 0) (match-beginning 0) 1)
-                      -1))
-         (force-level
-          (cond
-           (level (prefix-numeric-value level))
-           ;; When point is after the stars in an otherwise empty
-           ;; headline, use the number of stars as the forced level.
-           ((and (org-match-line "^\\*+[ \t]*$")
-                 (not (eq ?* (char-after))))
-            (org-outline-level))
-           ((looking-at-p org-outline-regexp-bol) (org-outline-level))))
-         (previous-level
-          (save-excursion
-            (org-previous-visible-heading 1)
-            (if (org-at-heading-p) (org-outline-level) 1)))
-         (next-level
-          (save-excursion
-            (if (org-at-heading-p) (org-outline-level)
-              (org-next-visible-heading 1)
-              (if (org-at-heading-p) (org-outline-level) 1))))
-         (new-level (or force-level (max previous-level next-level)))
-         (shift (if (or (= old-level -1)
-                        (= new-level -1)
-                        (= old-level new-level))
-                    0
-                  (- new-level old-level)))
-         (delta (if (> shift 0) -1 1))
-         (func (if (> shift 0) #'org-demote #'org-promote))
-         (org-odd-levels-only nil)
-         beg end newend)
-     ;; Remove the forced level indicator.
-     (when (and force-level (not level))
-       (delete-region (line-beginning-position) (point)))
-     ;; Paste before the next visible heading or at end of buffer,
-     ;; unless point is at the beginning of a headline.
-     (unless (and (bolp) (org-at-heading-p))
-       (org-next-visible-heading 1)
-       (unless (bolp) (insert "\n")))
-     (setq beg (point))
-     (when (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt))
-     (insert-before-markers txt)
-     (unless (string-suffix-p "\n" txt) (insert "\n"))
-     (setq newend (point))
-     (org-reinstall-markers-in-region beg)
-     (setq end (point))
-     (goto-char beg)
-     (skip-chars-forward " \t\n\r")
-     (setq beg (point))
-     (when (and (org-invisible-p) visp)
-       (save-excursion (outline-show-heading)))
-     ;; Shift if necessary.
-     (unless (= shift 0)
-       (save-restriction
-        (narrow-to-region beg end)
-        (while (not (= shift 0))
-          (org-map-region func (point-min) (point-max))
-          (setq shift (+ delta shift)))
-        (goto-char (point-min))
-        (setq newend (point-max))))
-     (when (or for-yank (called-interactively-p 'interactive))
-       (message "Clipboard pasted as level %d subtree" new-level))
-     (when (and (not for-yank) ; in this case, org-yank will decide about 
folding
-               kill-ring
-               (equal org-subtree-clip (current-kill 0))
-               org-subtree-clip-folded)
-       ;; The tree was folded before it was killed/copied
-       (org-flag-subtree t))
-     (when for-yank (goto-char newend))
-     (when remove (pop kill-ring)))))
+   (org-fold-core-ignore-fragility-checks
+     (let* ((visp (not (org-invisible-p)))
+           (txt tree)
+           (old-level (if (string-match org-outline-regexp-bol txt)
+                          (- (match-end 0) (match-beginning 0) 1)
+                        -1))
+           (force-level
+            (cond
+             (level (prefix-numeric-value level))
+             ;; When point is after the stars in an otherwise empty
+             ;; headline, use the number of stars as the forced level.
+             ((and (org-match-line "^\\*+[ \t]*$")
+                   (not (eq ?* (char-after))))
+              (org-outline-level))
+             ((looking-at-p org-outline-regexp-bol) (org-outline-level))))
+           (previous-level
+            (save-excursion
+              (org-previous-visible-heading 1)
+              (if (org-at-heading-p) (org-outline-level) 1)))
+           (next-level
+            (save-excursion
+              (if (org-at-heading-p) (org-outline-level)
+                (org-next-visible-heading 1)
+                (if (org-at-heading-p) (org-outline-level) 1))))
+           (new-level (or force-level (max previous-level next-level)))
+           (shift (if (or (= old-level -1)
+                          (= new-level -1)
+                          (= old-level new-level))
+                      0
+                    (- new-level old-level)))
+           (delta (if (> shift 0) -1 1))
+           (func (if (> shift 0) #'org-demote #'org-promote))
+           (org-odd-levels-only nil)
+           beg end newend)
+       ;; Remove the forced level indicator.
+       (when (and force-level (not level))
+         (delete-region (line-beginning-position) (point)))
+       ;; Paste before the next visible heading or at end of buffer,
+       ;; unless point is at the beginning of a headline.
+       (unless (and (bolp) (org-at-heading-p))
+         (org-next-visible-heading 1)
+         (unless (bolp) (insert "\n")))
+       (setq beg (point))
+       ;; Avoid re-parsing cache elements when i.e. level 1 heading
+       ;; is inserted and then promoted.
+       (combine-change-calls beg beg
+         (when (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt))
+         (insert txt)
+         (unless (string-suffix-p "\n" txt) (insert "\n"))
+         (setq newend (point))
+         (org-reinstall-markers-in-region beg)
+         (setq end (point))
+         (goto-char beg)
+         (skip-chars-forward " \t\n\r")
+         (setq beg (point))
+         (when (and (org-invisible-p) visp)
+           (save-excursion (org-fold-heading nil)))
+         ;; Shift if necessary.
+         (unless (= shift 0)
+           (save-restriction
+            (narrow-to-region beg end)
+            (while (not (= shift 0))
+              (org-map-region func (point-min) (point-max))
+              (setq shift (+ delta shift)))
+            (goto-char (point-min))
+            (setq newend (point-max)))))
+       (when (or for-yank (called-interactively-p 'interactive))
+         (message "Clipboard pasted as level %d subtree" new-level))
+       (when (and (not for-yank) ; in this case, org-yank will decide about 
folding
+                 (equal org-subtree-clip tree)
+                 org-subtree-clip-folded)
+         ;; The tree was folded before it was killed/copied
+         (org-fold-subtree t))
+       (when for-yank (goto-char newend))
+       (when remove (pop kill-ring))))))
 
 (defun org-kill-is-subtree-p (&optional txt)
   "Check if the current kill is an outline subtree, or a set of trees.
@@ -7833,7 +7169,7 @@ headline level is not the largest headline level in the 
tree.
 So this will actually accept several entries of equal levels as well,
 which is OK for `org-paste-subtree'.
 If optional TXT is given, check this string instead of the current kill."
-  (let* ((kill (or txt (and kill-ring (current-kill 0)) ""))
+  (let* ((kill (or txt (ignore-errors (current-kill 0))))
         (re (org-get-limited-outline-regexp))
         (^re (concat "^" re))
         (start-level (and kill
@@ -7885,17 +7221,27 @@ If yes, remember the marker and the distance to BEG."
     (move-marker (car x) (+ beg (cdr x))))
   (setq org-markers-to-move nil))
 
-(defun org-narrow-to-subtree ()
+(defun org-narrow-to-subtree (&optional element)
   "Narrow buffer to the current subtree."
   (interactive)
-  (save-excursion
-    (save-match-data
-      (org-with-limited-levels
-       (narrow-to-region
-       (progn (org-back-to-heading t) (point))
-       (progn (org-end-of-subtree t t)
-              (when (and (org-at-heading-p) (not (eobp))) (backward-char 1))
-              (point)))))))
+  (if (org-element--cache-active-p)
+      (let* ((heading (org-element-lineage
+                       (or element (org-element-at-point))
+                       '(headline) t))
+             (end (org-element-property :end heading)))
+        (if (and heading end)
+            (narrow-to-region (org-element-property :begin heading)
+                              (if (= end (point-max))
+                                  end (1- end)))
+          (signal 'outline-before-first-heading nil)))
+    (save-excursion
+      (save-match-data
+        (org-with-limited-levels
+         (narrow-to-region
+         (progn (org-back-to-heading t) (point))
+         (progn (org-end-of-subtree t t)
+                (when (and (org-at-heading-p) (not (eobp))) (backward-char 1))
+                (point))))))))
 
 (defun org-toggle-narrow-to-subtree ()
   "Narrow to the subtree at point or widen a narrowed buffer."
@@ -8003,7 +7349,7 @@ with the original repeater."
                  (insert template)
                  (org-mode)
                  (goto-char (point-min))
-                 (org-show-subtree)
+                 (org-fold-show-subtree)
                  (and idprop (if org-clone-delete-id
                                  (org-entry-delete nil "ID")
                                (org-id-get-create t)))
@@ -8122,10 +7468,26 @@ the default is \"/\"."
        (setf (substring fpath (- width 2)) "..")))
     fpath))
 
-(defun org-display-outline-path (&optional file current separator 
just-return-string)
+(defun org-get-title (&optional buffer-or-file)
+  "Collect title from the provided `org-mode' BUFFER-OR-FILE.
+
+Returns nil if there are no #+TITLE property."
+  (let ((buffer (cond ((bufferp buffer-or-file) buffer-or-file)
+                      ((stringp buffer-or-file) (find-file-noselect
+                                                 buffer-or-file))
+                      (t (current-buffer)))))
+    (with-current-buffer buffer
+      (org-macro-initialize-templates)
+      (let ((title (assoc-default "title" org-macro-templates)))
+        (unless (string= "" title)
+          title)))))
+
+(defun org-display-outline-path (&optional file-or-title current separator 
just-return-string)
   "Display the current outline path in the echo area.
 
-If FILE is non-nil, prepend the output with the file name.
+If FILE-OR-TITLE is `title', prepend outline with file title.  If
+it is non-nil or title is not present in document, prepend
+outline path with the file name.
 If CURRENT is non-nil, append the current heading to the output.
 SEPARATOR is passed through to `org-format-outline-path'.  It separates
 the different parts of the path and defaults to \"/\".
@@ -8133,6 +7495,7 @@ If JUST-RETURN-STRING is non-nil, return a string, don't 
display a message."
   (interactive "P")
   (let* (case-fold-search
         (bfn (buffer-file-name (buffer-base-buffer)))
+         (title-prop (when (eq file-or-title 'title) (org-get-title)))
         (path (and (derived-mode-p 'org-mode) (org-get-outline-path)))
         res)
     (when current (setq path (append path
@@ -8144,7 +7507,10 @@ If JUST-RETURN-STRING is non-nil, return a string, don't 
display a message."
          (org-format-outline-path
           path
           (1- (frame-width))
-          (and file bfn (concat (file-name-nondirectory bfn) separator))
+          (and file-or-title bfn (concat (if (and (eq file-or-title 'title) 
title-prop)
+                                             title-prop
+                                           (file-name-nondirectory bfn))
+                                separator))
           separator))
     (add-face-text-property 0 (length res)
                            `(:height ,(face-attribute 'default :height))
@@ -8275,7 +7641,7 @@ function is being called interactively."
                       (point))
            what "children")
       (goto-char start)
-      (outline-show-subtree)
+      (org-fold-show-subtree)
       (outline-next-heading))
      (t
       ;; we will sort the top-level entries in this file
@@ -8291,7 +7657,7 @@ function is being called interactively."
       (setq end (point-max))
       (setq what "top-level")
       (goto-char start)
-      (org-show-all '(headings drawers blocks))))
+      (org-fold-show-all '(headings drawers blocks))))
 
     (setq beg (point))
     (when (>= beg end) (goto-char start) (user-error "Nothing to sort"))
@@ -8419,7 +7785,7 @@ function is being called interactively."
             (t (error "Invalid sorting type `%c'" sorting-type))))
          nil
          (cond
-          ((= dcst ?a) 'org-string-collate-lessp)
+          ((= dcst ?a) 'string-collate-lessp)
           ((= dcst ?f)
            (or compare-func
                (and interactive?
@@ -8519,7 +7885,7 @@ definitions."
 ;; string-collate-greaterp in Emacs.
 (defun org-string-collate-greaterp (s1 s2)
   "Return non-nil if S1 is greater than S2 in collation order."
-  (not (org-string-collate-lessp s1 s2)))
+  (not (string-collate-lessp s1 s2)))
 
 ;;;###autoload
 (defun org-run-like-in-org-mode (cmd)
@@ -8528,23 +7894,30 @@ This will temporarily bind local variables that are 
typically bound in
 Org mode to the values they have in Org mode, and then interactively
 call CMD."
   (org-load-modules-maybe)
-  (let (binds)
+  (let (vars vals)
     (dolist (var (org-get-local-variables))
       (when (or (not (boundp (car var)))
                (eq (symbol-value (car var))
                    (default-value (car var))))
-       (push (list (car var) `(quote ,(cadr var))) binds)))
-    (eval `(let ,binds
-            (call-interactively (quote ,cmd))))))
+       (push (car var) vars)
+       (push (cadr var) vals)))
+    (cl-progv vars vals
+      (call-interactively cmd))))
 
 (defun org-get-category (&optional pos force-refresh)
   "Get the category applying to position POS."
   (save-match-data
     (when force-refresh (org-refresh-category-properties))
     (let ((pos (or pos (point))))
-      (or (get-text-property pos 'org-category)
-         (progn (org-refresh-category-properties)
-                (get-text-property pos 'org-category))))))
+      (if (org-element--cache-active-p)
+          ;; Sync cache.
+          (org-with-point-at (org-element-property :begin 
(org-element-at-point pos))
+            (or (org-entry-get-with-inheritance "CATEGORY")
+                "???"))
+        (or (get-text-property pos 'org-category)
+            (progn
+              (org-refresh-category-properties)
+              (get-text-property pos 'org-category)))))))
 
 ;;; Refresh properties
 
@@ -8591,57 +7964,59 @@ the whole buffer."
                        (org-end-of-subtree t t))
                       ((outline-next-heading))
                       ((point-max))))))
-      (if (symbolp tprop)
-         ;; TPROP is a text property symbol.
-         (put-text-property start end tprop p)
-       ;; TPROP is an alist with (property . function) elements.
-       (pcase-dolist (`(,prop . ,f) tprop)
-         (put-text-property start end prop (funcall f p)))))))
+      (with-silent-modifications
+       (if (symbolp tprop)
+           ;; TPROP is a text property symbol.
+           (put-text-property start end tprop p)
+         ;; TPROP is an alist with (property . function) elements.
+         (pcase-dolist (`(,prop . ,f) tprop)
+           (put-text-property start end prop (funcall f p))))))))
 
 (defun org-refresh-category-properties ()
   "Refresh category text properties in the buffer."
-  (let ((case-fold-search t)
-       (inhibit-read-only t)
-       (default-category
-         (cond ((null org-category)
-                (if buffer-file-name
-                    (file-name-sans-extension
-                     (file-name-nondirectory buffer-file-name))
-                  "???"))
-               ((symbolp org-category) (symbol-name org-category))
-               (t org-category))))
-    (with-silent-modifications
-      (org-with-wide-buffer
-       ;; Set buffer-wide property from keyword.  Search last #+CATEGORY
-       ;; keyword.  If none is found, fall-back to `org-category' or
-       ;; buffer file name, or set it by the document property drawer.
-       (put-text-property
-       (point-min) (point-max)
-       'org-category
-       (catch 'buffer-category
-         (goto-char (point-max))
-         (while (re-search-backward "^[ \t]*#\\+CATEGORY:" (point-min) t)
-           (let ((element (org-element-at-point)))
-             (when (eq (org-element-type element) 'keyword)
-               (throw 'buffer-category
-                      (org-element-property :value element)))))
-         default-category))
-       ;; Set categories from the document property drawer or
-       ;; property drawers in the outline.  If category is found in
-       ;; the property drawer for the whole buffer that value
-       ;; overrides the keyword-based value set above.
-       (goto-char (point-min))
-       (let ((regexp (org-re-property "CATEGORY")))
-        (while (re-search-forward regexp nil t)
-          (let ((value (match-string-no-properties 3)))
-            (when (org-at-property-p)
-              (put-text-property
-               (save-excursion (org-back-to-heading-or-point-min t))
-               (save-excursion (if (org-before-first-heading-p)
-                                   (point-max)
-                                 (org-end-of-subtree t t)))
-               'org-category
-               value)))))))))
+  (unless (org-element--cache-active-p)
+    (let ((case-fold-search t)
+         (inhibit-read-only t)
+         (default-category
+           (cond ((null org-category)
+                  (if buffer-file-name
+                      (file-name-sans-extension
+                       (file-name-nondirectory buffer-file-name))
+                    "???"))
+                 ((symbolp org-category) (symbol-name org-category))
+                 (t org-category))))
+      (let ((category (catch 'buffer-category
+                        (org-with-wide-buffer
+                        (goto-char (point-max))
+                        (while (re-search-backward "^[ \t]*#\\+CATEGORY:" 
(point-min) t)
+                          (let ((element (org-element-at-point-no-context)))
+                            (when (eq (org-element-type element) 'keyword)
+                              (throw 'buffer-category
+                                     (org-element-property :value element))))))
+                       default-category)))
+        (with-silent-modifications
+          (org-with-wide-buffer
+           ;; Set buffer-wide property from keyword.  Search last #+CATEGORY
+           ;; keyword.  If none is found, fall-back to `org-category' or
+           ;; buffer file name, or set it by the document property drawer.
+           (put-text-property (point-min) (point-max)
+                              'org-category category)
+           ;; Set categories from the document property drawer or
+           ;; property drawers in the outline.  If category is found in
+           ;; the property drawer for the whole buffer that value
+           ;; overrides the keyword-based value set above.
+           (goto-char (point-min))
+           (let ((regexp (org-re-property "CATEGORY")))
+             (while (re-search-forward regexp nil t)
+               (let ((value (match-string-no-properties 3)))
+                 (when (org-at-property-p)
+                   (put-text-property
+                    (save-excursion (org-back-to-heading-or-point-min t))
+                    (save-excursion (if (org-before-first-heading-p)
+                                        (point-max)
+                                      (org-end-of-subtree t t)))
+                    'org-category
+                    value)))))))))))
 
 (defun org-refresh-stats-properties ()
   "Refresh stats text properties in the buffer."
@@ -8692,7 +8067,7 @@ This is saved in case the need arises to restore it.")
     (`windows-nt org-file-apps-windowsnt)
     (_ org-file-apps-gnu)))
 
-(defun org--file-apps-entry-dlink-p (entry)
+(defun org--file-apps-entry-locator-p (entry)
   "Non-nil if ENTRY should be matched against the link by `org-open-file'.
 
 It assumes that is the case when the entry uses a regular
@@ -8706,7 +8081,7 @@ a parameter."
          (> (regexp-opt-depth selector) 0)
          (or (and (stringp action)
                   (string-match "%[0-9]" action))
-             (consp action))))
+             (functionp action))))
     (_ nil)))
 
 (defun org--file-apps-regexp-alist (list &optional add-auto-mode)
@@ -8729,6 +8104,74 @@ opened in Emacs."
    (when add-auto-mode
      (mapcar (lambda (x) (cons (car x) 'emacs)) auto-mode-alist))))
 
+(defun org--open-file-format-command
+    (mailcap-command file link match-data)
+  "Format MAILCAP-COMMAND to launch viewer for the FILE.
+
+MAILCAP-COMMAND may be an entry from the `org-file-apps' list or viewer
+field from mailcap file loaded to `mailcap-mime-data'.  See \"RFC
+1524.  A User Agent Configuration Mechanism For Multimedia Mail Format
+Information\" (URL `https://www.rfc-editor.org/rfc/rfc1524.html') for
+details, man page `mailcap(5)' for brief summary, and Info node
+`(emacs-mime) mailcap' for specific related to Emacs.  Only a part of
+mailcap specification is supported.
+
+The following substitutions are interpolated in the MAILCAP-COMMAND
+string:
+
+- \"%s\" to FILE name passed through
+  `convert-standard-filename', so it must be absolute path.
+
+- \"%1\" to \"%9\" groups from MATCH-DATA found in the LINK string by
+  the regular expression in the key part of the `org-file-apps' entry.
+  (performed by caller).  Not recommended, consider a lisp function
+  instead of a shell command.  For example, the following link in an
+  Org file
+
+       <file:///usr/share/doc/bash/bashref.pdf::#Redirections::allocate a file>
+
+   may be handled by an `org-file-apps' entry like
+
+       
(\"\\\\.pdf\\\\(?:\\\\.[gx]z\\\\|\\\\.bz2\\\\)?::\\\\(#[^:]+\\\\)::\\\\(.+\\\\)\\\\\\='\"
+        . \"okular --find %2 %s%1\")
+
+Use backslash \"\\\" to quote percent \"%\" or any other character
+including backslash itself.
+
+In addition, each argument is passed through `shell-quote-argument',
+so quotes around substitutions should not be used.  For compliance
+with mailcap files shipped e.g. in Debian GNU/Linux, single or double
+quotes around substitutions are stripped.  It deviates from mailcap
+specification that requires file name to be safe for shell and for the
+application."
+  (let ((spec (list (cons ?s  (convert-standard-filename file))))
+        (ngroups (min 9 (- (/ (length match-data) 2) 1))))
+    (when (> ngroups 0)
+      (set-match-data match-data)
+      (dolist (i (number-sequence 1 ngroups))
+        (push (cons (+ ?0 i) (match-string-no-properties i link)) spec)))
+    (replace-regexp-in-string
+     (rx (or (and "\\" (or (group anything) string-end))
+             (and (optional (group (any "'\"")))
+                  "%"
+                  (or (group anything) string-end)
+                  (optional (group (backref 2))))))
+     (lambda (fmt)
+       (let* ((backslash (match-string-no-properties 1 fmt))
+              (key (match-string 3 fmt))
+              (value (and key (alist-get (string-to-char key) spec))))
+         (cond
+          (backslash)
+          (value (let ((quot (match-string 2 fmt))
+                       (subst (shell-quote-argument value)))
+                   ;; Remove quotes around the file name - we use
+                   ;; `shell-quote-argument'.
+                   (if (match-string 4 fmt)
+                       subst
+                     (concat quot subst))))
+          (t (error "Invalid format `%s'" fmt)))))
+     mailcap-command nil 'literal)))
+
 ;;;###autoload
 (defun org-open-file (path &optional in-emacs line search)
   "Open the file at PATH.
@@ -8755,9 +8198,9 @@ If the file does not exist, throw an error."
   (let* ((file (if (equal path "") buffer-file-name
                 (substitute-in-file-name (expand-file-name path))))
         (file-apps (append org-file-apps (org--file-default-apps)))
-        (apps (cl-remove-if #'org--file-apps-entry-dlink-p file-apps))
-        (apps-dlink (cl-remove-if-not #'org--file-apps-entry-dlink-p
-                                      file-apps))
+        (apps (cl-remove-if #'org--file-apps-entry-locator-p file-apps))
+        (apps-locator (cl-remove-if-not #'org--file-apps-entry-locator-p
+                                         file-apps))
         (remp (and (assq 'remote apps) (file-remote-p file)))
         (dirp (unless remp (file-directory-p file)))
         (file (if (and dirp org-open-directory-means-index-dot-org)
@@ -8770,7 +8213,6 @@ If the file does not exist, throw an error."
         (link (cond (line (concat file "::" (number-to-string line)))
                     (search (concat file "::" search))
                     (t file)))
-        (dlink (downcase link))
         (ext
          (and (string-match "\\`.*?\\.\\([a-zA-Z0-9]+\\(\\.gz\\)?\\)\\'" dfile)
               (match-string 1 dfile)))
@@ -8792,16 +8234,17 @@ If the file does not exist, throw an error."
      (t
       (setq cmd (or (and remp (cdr (assq 'remote apps)))
                    (and dirp (cdr (assq 'directory apps)))
-                   ;; First, try matching against apps-dlink if we
+                   ;; First, try matching against apps-locator if we
                    ;; get a match here, store the match data for
                    ;; later.
-                   (let ((match (assoc-default dlink apps-dlink
-                                               'string-match)))
+                   (let* ((case-fold-search t)
+                           (match (assoc-default link apps-locator
+                                                 'string-match)))
                      (if match
                          (progn (setq link-match-data (match-data))
                                 match)
                        (progn (setq in-emacs (or in-emacs line search))
-                              nil))) ; if we have no match in apps-dlink,
+                              nil))) ; if we have no match in apps-locator,
                                        ; always open the file in emacs if line 
or search
                                        ; is given (for backwards compatibility)
                    (assoc-default dfile
@@ -8826,27 +8269,8 @@ If the file does not exist, throw an error."
               (not org-open-non-existing-files))
       (user-error "No such file: %s" file))
     (cond
-     ((and (stringp cmd) (not (string-match "^\\s-*$" cmd)))
-      ;; Remove quotes around the file name - we'll use shell-quote-argument.
-      (while (string-match "['\"]%s['\"]" cmd)
-       (setq cmd (replace-match "%s" t t cmd)))
-      (setq cmd (replace-regexp-in-string
-                "%s"
-                (shell-quote-argument (convert-standard-filename file))
-                cmd
-                nil t))
-
-      ;; Replace "%1", "%2" etc. in command with group matches from regex
-      (save-match-data
-       (let ((match-index 1)
-             (number-of-groups (- (/ (length link-match-data) 2) 1)))
-         (set-match-data link-match-data)
-         (while (<= match-index number-of-groups)
-           (let ((regex (concat "%" (number-to-string match-index)))
-                 (replace-with (match-string match-index dlink)))
-             (while (string-match regex cmd)
-               (setq cmd (replace-match replace-with t t cmd))))
-           (setq match-index (+ match-index 1)))))
+     ((org-string-nw-p cmd)
+      (setq cmd (org--open-file-format-command cmd file link link-match-data))
 
       (save-window-excursion
        (message "Running %s...done" cmd)
@@ -8866,7 +8290,7 @@ If the file does not exist, throw an error."
       (funcall (cdr (assq 'file org-link-frame-setup)) file)
       (widen)
       (cond (line (org-goto-line line)
-                 (when (derived-mode-p 'org-mode) (org-reveal)))
+                 (when (derived-mode-p 'org-mode) (org-fold-reveal)))
            (search (condition-case err
                        (org-link-search search)
                      ;; Save position before error-ing out so user
@@ -8923,7 +8347,9 @@ a link at point.  If they don't find anything interesting 
at point,
 they must return nil.")
 
 (defun org-open-at-point (&optional arg)
-  "Open link, timestamp, footnote or tags at point.
+  "Open thing at point.
+The thing can be a link, citation, timestamp, footnote, src-block or
+tags.
 
 When point is on a link, follow it.  Normally, files will be
 opened by an appropriate application.  If the optional prefix
@@ -8938,6 +8364,10 @@ When point is a footnote definition, move to the first 
reference
 found.  If it is on a reference, move to the associated
 definition.
 
+When point is on a src-block of inline src-block, open its result.
+
+When point is on a citation, follow it.
+
 When point is on a headline, display a list of every link in the
 entry, so it is possible to pick one, or all, of them.  If point
 is on a tag, call `org-tags-view' instead.
@@ -9056,7 +8486,10 @@ there is one, return it."
         (org-back-to-heading t)
         (setq end (save-excursion (outline-next-heading) (point)))
         (while (re-search-forward org-link-any-re end t)
-          (push (match-string 0) links))
+           ;; Only consider valid links or links openable via
+           ;; `org-open-at-point'.
+           (when (memq (org-element-type (org-element-context)) '(link comment 
comment-block node-property keyword))
+            (push (match-string 0) links)))
         (setq links (org-uniquify (reverse links))))
        (cond
        ((null links)
@@ -9162,7 +8595,7 @@ or to another Org file, automatically push the old 
position onto the ring."
     (setq m (car p))
     (pop-to-buffer-same-window (marker-buffer m))
     (goto-char m)
-    (when (or (org-invisible-p) (org-invisible-p2)) (org-show-context 
'mark-goto))))
+    (when (or (org-invisible-p) (org-invisible-p2)) (org-fold-show-context 
'mark-goto))))
 
 ;;; Following specific links
 
@@ -9417,11 +8850,12 @@ keywords relative to each registered export back-end."
        (push (nth 1 option-entry) keywords)))))
 
 (defconst org-options-keywords
-  '("ARCHIVE:" "AUTHOR:" "BIND:" "CATEGORY:" "COLUMNS:" "CREATOR:" "DATE:"
-    "DESCRIPTION:" "DRAWERS:" "EMAIL:" "EXCLUDE_TAGS:" "FILETAGS:" "INCLUDE:"
-    "INDEX:" "KEYWORDS:" "LANGUAGE:" "MACRO:" "OPTIONS:" "PROPERTY:"
-    "PRIORITIES:" "SELECT_TAGS:" "SEQ_TODO:" "SETUPFILE:" "STARTUP:" "TAGS:"
-    "TITLE:" "TODO:" "TYP_TODO:" "SELECT_TAGS:" "EXCLUDE_TAGS:"))
+  '("ARCHIVE:" "AUTHOR:" "BIBLIOGRAPHY:" "BIND:" "CATEGORY:" "CITE_EXPORT:"
+    "COLUMNS:" "CREATOR:" "DATE:" "DESCRIPTION:" "DRAWERS:" "EMAIL:"
+    "EXCLUDE_TAGS:" "FILETAGS:" "INCLUDE:" "INDEX:" "KEYWORDS:" "LANGUAGE:"
+    "MACRO:" "OPTIONS:" "PROPERTY:" "PRINT_BIBLIOGRAPHY" "PRIORITIES:"
+    "SELECT_TAGS:" "SEQ_TODO:" "SETUPFILE:" "STARTUP:" "TAGS:" "TITLE:" "TODO:"
+    "TYP_TODO:" "SELECT_TAGS:" "EXCLUDE_TAGS:"))
 
 (defcustom org-structure-template-alist
   '(("a" . "export ascii")
@@ -9435,9 +8869,11 @@ keywords relative to each registered export back-end."
     ("s" . "src")
     ("v" . "verse"))
   "An alist of keys and block types.
-`org-insert-structure-template' will display a menu with this
-list of templates to choose from.  The block type is inserted,
-with \"#+BEGIN_\" and \"#+END_\" added automatically.
+`org-insert-structure-template' will display a menu with this list of
+templates to choose from.  The block type is inserted, with
+\"#+begin_\" and \"#+end_\" added automatically.  If the block type
+consists of just uppercase letters, \"#+BEGIN_\" and \"#+END_\" are
+added instead.
 
 The menu keys are defined by the car of each entry in this alist.
 If two entries have the keys \"a\" and \"aa\" respectively, the
@@ -9451,14 +8887,14 @@ block can be inserted by pressing TAB after the string 
\"<KEY\"."
   :type '(repeat
          (cons (string :tag "Key")
                (string :tag "Template")))
-  :package-version '(Org . "9.2"))
+  :package-version '(Org . "9.6"))
 
 (defun org--check-org-structure-template-alist (&optional checklist)
   "Check whether `org-structure-template-alist' is set up correctly.
 In particular, check if the Org 9.2 format is used as opposed to
 previous format."
   (let ((elm (cl-remove-if-not (lambda (x) (listp (cdr x)))
-                              (or (eval checklist)
+                              (or (symbol-value checklist)
                                   org-structure-template-alist))))
     (when elm
       (org-display-warning
@@ -9569,18 +9005,24 @@ If an element cannot be made unique, an error is 
raised."
 Select a block from `org-structure-template-alist' then type
 either RET, TAB or SPC to write the block type.  With an active
 region, wrap the region in the block.  Otherwise, insert an empty
-block."
+block.
+
+When foo is written as FOO, upcase the #+BEGIN/END as well."
   (interactive
    (list (pcase (org--insert-structure-template-mks)
           (`("\t" . ,_) (read-string "Structure type: "))
           (`(,_ ,choice . ,_) choice))))
-  (let* ((region? (use-region-p))
+  (let* ((case-fold-search t) ; Make sure that matches are case-insensitive.
+         (region? (use-region-p))
         (region-start (and region? (region-beginning)))
         (region-end (and region? (copy-marker (region-end))))
         (extended? (string-match-p "\\`\\(src\\|export\\)\\'" type))
         (verbatim? (string-match-p
-                    (concat "\\`" (regexp-opt '("example" "export" "src")))
-                    type)))
+                    (concat "\\`" (regexp-opt '("example" "export"
+                                                "src" "comment")))
+                    type))
+         (upcase? (string= (car (split-string type))
+                           (upcase (car (split-string type))))))
     (when region? (goto-char region-start))
     (let ((column (current-indentation)))
       (if (save-excursion (skip-chars-backward " \t") (bolp))
@@ -9588,7 +9030,7 @@ block."
        (insert "\n"))
       (save-excursion
        (indent-to column)
-       (insert (format "#+begin_%s%s\n" type (if extended? " " "")))
+       (insert (format "#+%s_%s%s\n" (if upcase? "BEGIN" "begin") type (if 
extended? " " "")))
        (when region?
          (when verbatim? (org-escape-code-in-region (point) region-end))
          (goto-char region-end)
@@ -9597,7 +9039,7 @@ block."
          (end-of-line))
        (unless (bolp) (insert "\n"))
        (indent-to column)
-       (insert (format "#+end_%s" (car (split-string type))))
+       (insert (format "#+%s_%s" (if upcase? "END" "end") (car (split-string 
type))))
        (if (looking-at "[ \t]*$") (replace-match "")
          (insert "\n"))
        (when (and (eobp) (not (bolp))) (insert "\n")))
@@ -9652,7 +9094,7 @@ nil or a string to be used for the todo mark." )
           (org-use-last-clock-out-time-as-effective-time
            (or (org-clock-get-last-clock-out-time) ct))
           ((and org-use-effective-time (< (nth 2 dct) org-extend-today-until))
-           (encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct)))
+           (org-encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct)))
           (t ct))))
     ct1))
 
@@ -9660,7 +9102,7 @@ nil or a string to be used for the todo mark." )
   "Like `org-todo' but the time of change will be 23:59 of yesterday."
   (interactive "P")
   (if (eq major-mode 'org-agenda-mode)
-      (apply 'org-agenda-todo-yesterday arg)
+      (org-agenda-todo-yesterday arg)
     (let* ((org-use-effective-time t)
           (hour (nth 2 (decode-time (org-current-time))))
           (org-extend-today-until (1+ hour)))
@@ -9735,7 +9177,8 @@ When called through ELisp, arg is also interpreted in the 
following way:
         nil cl
         (when (org-invisible-p) (org-end-of-subtree nil t))))
     (when (equal arg '(16)) (setq arg 'nextset))
-    (when (equal arg -1) (org-cancel-repeater) (setq arg nil))
+    (when (equal (prefix-numeric-value arg) -1) (org-cancel-repeater) (setq 
arg nil))
+    (when (< (prefix-numeric-value arg) -1) (user-error "Prefix argument %d 
not supported" arg))
     (let ((org-blocker-hook org-blocker-hook)
          commentp
          case-fold-search)
@@ -9779,16 +9222,16 @@ When called through ELisp, arg is also interpreted in 
the following way:
                             ((eq arg 'right)
                              ;; Next state
                              (if this
-                                 (if tail (car tail) nil)
-                               (car org-todo-keywords-1)))
+                                 (if tail (car tail) nil)
+                               (car org-todo-keywords-1)))
                             ((eq arg 'left)
                              ;; Previous state
                              (unless (equal member org-todo-keywords-1)
-                               (if this
+                               (if this
                                    (nth (- (length org-todo-keywords-1)
                                            (length tail) 2)
-                                        org-todo-keywords-1)
-                                 (org-last org-todo-keywords-1))))
+                                        org-todo-keywords-1)
+                                 (org-last org-todo-keywords-1))))
                             (arg
                              ;; User or caller requests a specific state.
                              (cond
@@ -9796,15 +9239,15 @@ When called through ELisp, arg is also interpreted in 
the following way:
                               ((eq arg 'none) nil)
                               ((eq arg 'done) (or done-word (car 
org-done-keywords)))
                               ((eq arg 'nextset)
-                               (or (car (cdr (member head org-todo-heads)))
+                               (or (car (cdr (member head org-todo-heads)))
                                    (car org-todo-heads)))
                               ((eq arg 'previousset)
-                               (let ((org-todo-heads (reverse org-todo-heads)))
-                                 (or (car (cdr (member head org-todo-heads)))
+                               (let ((org-todo-heads (reverse org-todo-heads)))
+                                 (or (car (cdr (member head org-todo-heads)))
                                      (car org-todo-heads))))
                               ((car (member arg org-todo-keywords-1)))
                               ((stringp arg)
-                               (user-error "State `%s' not valid in this file" 
arg))
+                               (user-error "State `%s' not valid in this file" 
arg))
                               ((nth (1- (prefix-numeric-value arg))
                                     org-todo-keywords-1))))
                             ((and org-todo-key-trigger 
org-use-fast-todo-selection)
@@ -9815,10 +9258,10 @@ When called through ELisp, arg is also interpreted in 
the following way:
                             ((null tail) nil) ;-> first entry
                             ((memq interpret '(type priority))
                              (if (eq this-command last-command)
-                                 (car tail)
-                               (if (> (length tail) 0)
+                                 (car tail)
+                               (if (> (length tail) 0)
                                    (or done-word (car org-done-keywords))
-                                 nil)))
+                                 nil)))
                             (t
                              (car tail))))
                 (org-state (or
@@ -9849,7 +9292,20 @@ When called through ELisp, arg is also interpreted in 
the following way:
                             this org-state block-reason)
                    (throw 'exit nil)))))
            (store-match-data match-data)
-           (replace-match next t t)
+            (org-fold-core-ignore-modifications
+              (goto-char (match-beginning 0))
+              (replace-match "")
+              ;; We need to use `insert-before-markers-and-inherit'
+              ;; because: (1) We want to preserve the folding state
+              ;; text properties; (2) We do not want to make point
+              ;; move before new todo state when inserting a new todo
+              ;; into an empty heading.  In (2), the above
+              ;; `save-excursion' is relying on markers saved before.
+              (insert-before-markers-and-inherit next)
+              (unless (org-invisible-p (line-beginning-position))
+                (org-fold-region (line-beginning-position)
+                                 (line-end-position)
+                                 nil)))
            (cond ((and org-state (equal this org-state))
                   (message "TODO state was already %s" (org-trim next)))
                  ((not (pos-visible-in-window-p hl-pos))
@@ -10163,9 +9619,9 @@ statistics everywhere."
          (setq first nil cookie-present nil)
          (unless (and level
                       (not (string-match
-                            "\\<checkbox\\>"
-                            (downcase (or (org-entry-get nil "COOKIE_DATA")
-                                          "")))))
+                          "\\<checkbox\\>"
+                          (downcase (or (org-entry-get nil "COOKIE_DATA")
+                                        "")))))
            (throw 'exit nil))
           (while (re-search-forward box-re (line-end-position) t)
            (setq cnt-all 0 cnt-done 0 cookie-present t)
@@ -10477,7 +9933,8 @@ This function is run automatically after each state 
change to a DONE state."
                    (while (re-search-forward org-clock-line-re end t)
                      (when (org-at-clock-log-p) (throw :clock t))))))
        (org-entry-put nil "LAST_REPEAT" (format-time-string
-                                         (org-time-stamp-format t t))))
+                                         (org-time-stamp-format t t)
+                                          (org-current-effective-time))))
       (when org-log-repeat
        (if org-log-setup
            ;; We are already setup for some record.
@@ -10535,7 +9992,7 @@ This function is run automatically after each state 
change to a DONE state."
                      (let ((nshiftmax 10)
                            (nshift 0))
                        (while (or (= nshift 0)
-                                  (not (org-time-less-p nil time)))
+                                  (not (time-less-p nil time)))
                          (when (= nshiftmax (cl-incf nshift))
                            (or (y-or-n-p
                                 (format "%d repeater intervals were not \
@@ -10592,81 +10049,86 @@ of `org-todo-keywords-1'."
   "Insert DEADLINE or SCHEDULE information in current entry.
 TYPE is either `deadline' or `scheduled'.  See `org-deadline' or
 `org-schedule' for information about ARG and TIME arguments."
-  (let* ((deadline? (eq type 'deadline))
-        (keyword (if deadline? org-deadline-string org-scheduled-string))
-        (log (if deadline? org-log-redeadline org-log-reschedule))
-        (old-date (org-entry-get nil (if deadline? "DEADLINE" "SCHEDULED")))
-        (old-date-time (and old-date (org-time-string-to-time old-date)))
-        ;; Save repeater cookie from either TIME or current scheduled
-        ;; time stamp.  We are going to insert it back at the end of
-        ;; the process.
-        (repeater (or (and (org-string-nw-p time)
-                           ;; We use `org-repeat-re' because we need
-                           ;; to tell the difference between a real
-                           ;; repeater and a time delta, e.g. "+2d".
-                           (string-match org-repeat-re time)
-                           (match-string 1 time))
-                      (and (org-string-nw-p old-date)
-                           (string-match "\\([.+-]+[0-9]+[hdwmy]\
+  (org-fold-core-ignore-modifications
+    (let* ((deadline? (eq type 'deadline))
+          (keyword (if deadline? org-deadline-string org-scheduled-string))
+          (log (if deadline? org-log-redeadline org-log-reschedule))
+          (old-date (org-entry-get nil (if deadline? "DEADLINE" "SCHEDULED")))
+          (old-date-time (and old-date (org-time-string-to-time old-date)))
+          ;; Save repeater cookie from either TIME or current scheduled
+          ;; time stamp.  We are going to insert it back at the end of
+          ;; the process.
+          (repeater (or (and (org-string-nw-p time)
+                             ;; We use `org-ts-regexp-both' because we
+                             ;; need to tell the difference between a
+                             ;; real repeater and a time delta, e.g.
+                             ;; "+2d".
+                              (string-match-p org-ts-regexp-both time)
+                              (string-match "\\([.+-]+[0-9]+[hdwmy]\
 \\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\)"
-                                         old-date)
-                           (match-string 1 old-date)))))
-    (pcase arg
-      (`(4)
-       (if (not old-date)
-          (message (if deadline? "Entry had no deadline to remove"
-                     "Entry was not scheduled"))
-        (when (and old-date log)
-          (org-add-log-setup (if deadline? 'deldeadline 'delschedule)
-                             nil old-date log))
-        (org-remove-timestamp-with-keyword keyword)
-        (message (if deadline? "Entry no longer has a deadline."
-                   "Entry is no longer scheduled."))))
-      (`(16)
-       (save-excursion
-        (org-back-to-heading t)
-        (let ((regexp (if deadline? org-deadline-time-regexp
-                        org-scheduled-time-regexp)))
-          (if (not (re-search-forward regexp (line-end-position 2) t))
-              (user-error (if deadline? "No deadline information to update"
-                            "No scheduled information to update"))
-            (let* ((rpl0 (match-string 1))
-                   (rpl (replace-regexp-in-string " -[0-9]+[hdwmy]" "" rpl0))
-                   (msg (if deadline? "Warn starting from" "Delay until")))
-              (replace-match
-               (concat keyword
-                       " <" rpl
-                       (format " -%dd"
-                               (abs (- (time-to-days
-                                        (save-match-data
-                                          (org-read-date
-                                           nil t nil msg old-date-time)))
-                                       (time-to-days old-date-time))))
-                       ">") t t))))))
-      (_
-       (org-add-planning-info type time 'closed)
-       (when (and old-date
-                 log
-                 (not (equal old-date org-last-inserted-timestamp)))
-        (org-add-log-setup (if deadline? 'redeadline 'reschedule)
-                           org-last-inserted-timestamp
-                           old-date
-                           log))
-       (when repeater
-        (save-excursion
+                                           time)
+                             (match-string 1 time))
+                        (and (org-string-nw-p old-date)
+                             (string-match "\\([.+-]+[0-9]+[hdwmy]\
+\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\)"
+                                           old-date)
+                             (match-string 1 old-date)))))
+      (pcase arg
+        (`(4)
+         (if (not old-date)
+            (message (if deadline? "Entry had no deadline to remove"
+                       "Entry was not scheduled"))
+          (when (and old-date log)
+            (org-add-log-setup (if deadline? 'deldeadline 'delschedule)
+                            nil old-date log))
+          (org-remove-timestamp-with-keyword keyword)
+          (message (if deadline? "Entry no longer has a deadline."
+                     "Entry is no longer scheduled."))))
+        (`(16)
+         (save-excursion
           (org-back-to-heading t)
-          (when (re-search-forward
-                 (concat keyword " " org-last-inserted-timestamp)
-                 (line-end-position 2)
-                 t)
-            (goto-char (1- (match-end 0)))
-            (insert " " repeater)
-            (setq org-last-inserted-timestamp
-                  (concat (substring org-last-inserted-timestamp 0 -1)
-                          " " repeater
-                          (substring org-last-inserted-timestamp -1))))))
-       (message (if deadline? "Deadline on %s" "Scheduled to %s")
-               org-last-inserted-timestamp)))))
+          (let ((regexp (if deadline? org-deadline-time-regexp
+                          org-scheduled-time-regexp)))
+            (if (not (re-search-forward regexp (line-end-position 2) t))
+                (user-error (if deadline? "No deadline information to update"
+                              "No scheduled information to update"))
+              (let* ((rpl0 (match-string 1))
+                     (rpl (replace-regexp-in-string " -[0-9]+[hdwmy]" "" rpl0))
+                     (msg (if deadline? "Warn starting from" "Delay until")))
+                (replace-match
+                 (concat keyword
+                         " <" rpl
+                         (format " -%dd"
+                                 (abs (- (time-to-days
+                                          (save-match-data
+                                            (org-read-date
+                                             nil t nil msg old-date-time)))
+                                         (time-to-days old-date-time))))
+                         ">") t t))))))
+        (_
+         (org-add-planning-info type time 'closed)
+         (when (and old-date
+                   log
+                   (not (equal old-date org-last-inserted-timestamp)))
+          (org-add-log-setup (if deadline? 'redeadline 'reschedule)
+                             org-last-inserted-timestamp
+                             old-date
+                             log))
+         (when repeater
+          (save-excursion
+            (org-back-to-heading t)
+            (when (re-search-forward
+                   (concat keyword " " org-last-inserted-timestamp)
+                   (line-end-position 2)
+                   t)
+              (goto-char (1- (match-end 0)))
+              (insert-and-inherit " " repeater)
+              (setq org-last-inserted-timestamp
+                    (concat (substring org-last-inserted-timestamp 0 -1)
+                            " " repeater
+                            (substring org-last-inserted-timestamp -1))))))
+         (message (if deadline? "Deadline on %s" "Scheduled to %s")
+                 org-last-inserted-timestamp))))))
 
 (defun org-deadline (arg &optional time)
   "Insert a \"DEADLINE:\" string with a timestamp to make a deadline.
@@ -10751,15 +10213,18 @@ nil."
   "Non-nil when point is on a planning info line."
   ;; This is as accurate and faster than `org-element-at-point' since
   ;; planning info location is fixed in the section.
-  (org-with-wide-buffer
-   (beginning-of-line)
-   (and (looking-at-p org-planning-line-re)
-       (eq (point)
-           (ignore-errors
-             (if (and (featurep 'org-inlinetask) (org-inlinetask-in-task-p))
-                 (org-back-to-heading t)
-               (org-with-limited-levels (org-back-to-heading t)))
-             (line-beginning-position 2))))))
+  (or (let ((cached (org-element-at-point nil 'cached)))
+        (and cached
+             (eq 'planning (org-element-type cached))))
+      (org-with-wide-buffer
+       (beginning-of-line)
+       (and (looking-at-p org-planning-line-re)
+           (eq (point)
+               (ignore-errors
+                 (if (and (featurep 'org-inlinetask) 
(org-inlinetask-in-task-p))
+                     (org-back-to-heading t)
+                   (org-with-limited-levels (org-back-to-heading t)))
+                 (line-beginning-position 2)))))))
 
 (defun org-add-planning-info (what &optional time &rest remove)
   "Insert new timestamp with keyword in the planning line.
@@ -10768,101 +10233,102 @@ among `closed', `deadline', `scheduled' and nil.  
TIME indicates
 the time to use.  If none is given, the user is prompted for
 a date.  REMOVE indicates what kind of entries to remove.  An old
 WHAT entry will also be removed."
-  (let (org-time-was-given org-end-time-was-given default-time default-input)
-    (when (and (memq what '(scheduled deadline))
-              (or (not time)
-                  (and (stringp time)
-                       (string-match "^[-+]+[0-9]" time))))
-      ;; Try to get a default date/time from existing timestamp
-      (save-excursion
-       (org-back-to-heading t)
-       (let ((end (save-excursion (outline-next-heading) (point))) ts)
-         (when (re-search-forward (if (eq what 'scheduled)
-                                      org-scheduled-time-regexp
-                                    org-deadline-time-regexp)
-                                  end t)
-           (setq ts (match-string 1)
-                 default-time (org-time-string-to-time ts)
-                 default-input (and ts (org-get-compact-tod ts)))))))
-    (when what
-      (setq time
-           (if (stringp time)
-               ;; This is a string (relative or absolute), set
-               ;; proper date.
-               (apply #'encode-time
-                      (org-read-date-analyze
-                       time default-time (decode-time default-time)))
-             ;; If necessary, get the time from the user
-             (or time (org-read-date nil 'to-time nil
-                                     (cl-case what
-                                       (deadline "DEADLINE")
-                                       (scheduled "SCHEDULED")
-                                       (otherwise nil))
-                                     default-time default-input)))))
-    (org-with-wide-buffer
-     (org-back-to-heading t)
-     (let ((planning? (save-excursion
-                       (forward-line)
-                       (looking-at-p org-planning-line-re))))
-       (cond
-       (planning?
-        (forward-line)
-        ;; Move to current indentation.
-        (skip-chars-forward " \t")
-        ;; Check if we have to remove something.
-        (dolist (type (if what (cons what remove) remove))
-          (save-excursion
-            (when (re-search-forward
-                   (cl-case type
-                     (closed org-closed-time-regexp)
-                     (deadline org-deadline-time-regexp)
-                     (scheduled org-scheduled-time-regexp)
-                     (otherwise (error "Invalid planning type: %s" type)))
-                   (line-end-position)
-                   t)
-              ;; Delete until next keyword or end of line.
-              (delete-region
-               (match-beginning 0)
-               (if (re-search-forward org-keyword-time-not-clock-regexp
-                                      (line-end-position)
-                                      t)
-                   (match-beginning 0)
-                 (line-end-position))))))
-        ;; If there is nothing more to add and no more keyword is
-        ;; left, remove the line completely.
-        (if (and (looking-at-p "[ \t]*$") (not what))
-            (delete-region (line-end-position 0)
-                           (line-end-position))
-          ;; If we removed last keyword, do not leave trailing white
-          ;; space at the end of line.
-          (let ((p (point)))
+  (org-fold-core-ignore-modifications
+    (let (org-time-was-given org-end-time-was-given default-time default-input)
+      (when (and (memq what '(scheduled deadline))
+                (or (not time)
+                    (and (stringp time)
+                         (string-match "^[-+]+[0-9]" time))))
+        ;; Try to get a default date/time from existing timestamp
+        (save-excursion
+         (org-back-to-heading t)
+         (let ((end (save-excursion (outline-next-heading) (point))) ts)
+           (when (re-search-forward (if (eq what 'scheduled)
+                                        org-scheduled-time-regexp
+                                      org-deadline-time-regexp)
+                                    end t)
+             (setq ts (match-string 1)
+                   default-time (org-time-string-to-time ts)
+                   default-input (and ts (org-get-compact-tod ts)))))))
+      (when what
+        (setq time
+             (if (stringp time)
+                 ;; This is a string (relative or absolute), set
+                 ;; proper date.
+                 (org-encode-time
+                  (org-read-date-analyze
+                   time default-time (decode-time default-time)))
+               ;; If necessary, get the time from the user
+               (or time (org-read-date nil 'to-time nil
+                                    (cl-case what
+                                      (deadline "DEADLINE")
+                                      (scheduled "SCHEDULED")
+                                      (otherwise nil))
+                                    default-time default-input)))))
+      (org-with-wide-buffer
+       (org-back-to-heading t)
+       (let ((planning? (save-excursion
+                         (forward-line)
+                         (looking-at-p org-planning-line-re))))
+         (cond
+         (planning?
+          (forward-line)
+          ;; Move to current indentation.
+          (skip-chars-forward " \t")
+          ;; Check if we have to remove something.
+          (dolist (type (if what (cons what remove) remove))
             (save-excursion
-              (end-of-line)
-              (unless (= (skip-chars-backward " \t" p) 0)
-                (delete-region (point) (line-end-position)))))))
-       (what
-        (end-of-line)
-        (insert "\n")
-        (when org-adapt-indentation
-          (indent-to-column (1+ (org-outline-level)))))
-       (t nil)))
-     (when what
-       ;; Insert planning keyword.
-       (insert (cl-case what
-                (closed org-closed-string)
-                (deadline org-deadline-string)
-                (scheduled org-scheduled-string)
-                (otherwise (error "Invalid planning type: %s" what)))
-              " ")
-       ;; Insert associated timestamp.
-       (let ((ts (org-insert-time-stamp
-                 time
-                 (or org-time-was-given
-                     (and (eq what 'closed) org-log-done-with-time))
-                 (eq what 'closed)
-                 nil nil (list org-end-time-was-given))))
-        (unless (eolp) (insert " "))
-        ts)))))
+              (when (re-search-forward
+                     (cl-case type
+                       (closed org-closed-time-regexp)
+                       (deadline org-deadline-time-regexp)
+                       (scheduled org-scheduled-time-regexp)
+                       (otherwise (error "Invalid planning type: %s" type)))
+                     (line-end-position)
+                     t)
+                ;; Delete until next keyword or end of line.
+                (delete-region
+                 (match-beginning 0)
+                 (if (re-search-forward org-keyword-time-not-clock-regexp
+                                        (line-end-position)
+                                        t)
+                     (match-beginning 0)
+                   (line-end-position))))))
+          ;; If there is nothing more to add and no more keyword is
+          ;; left, remove the line completely.
+          (if (and (looking-at-p "[ \t]*$") (not what))
+              (delete-region (line-end-position 0)
+                             (line-end-position))
+            ;; If we removed last keyword, do not leave trailing white
+            ;; space at the end of line.
+            (let ((p (point)))
+              (save-excursion
+                (end-of-line)
+                (unless (= (skip-chars-backward " \t" p) 0)
+                  (delete-region (point) (line-end-position)))))))
+         (what
+          (end-of-line)
+          (insert-and-inherit "\n")
+          (when org-adapt-indentation
+            (indent-to-column (1+ (org-outline-level)))))
+         (t nil)))
+       (when what
+         ;; Insert planning keyword.
+         (insert-and-inherit (cl-case what
+                              (closed org-closed-string)
+                              (deadline org-deadline-string)
+                              (scheduled org-scheduled-string)
+                              (otherwise (error "Invalid planning type: %s" 
what)))
+                            " ")
+         ;; Insert associated timestamp.
+         (let ((ts (org-insert-time-stamp
+                   time
+                   (or org-time-was-given
+                       (and (eq what 'closed) org-log-done-with-time))
+                   (eq what 'closed)
+                   nil nil (list org-end-time-was-given))))
+          (unless (eolp) (insert " "))
+          ts))))))
 
 (defvar org-log-note-marker (make-marker)
   "Marker pointing at the entry where the note is to be inserted.")
@@ -10876,6 +10342,10 @@ WHAT entry will also be removed."
   "Remembered current time.
 So that dynamically scoped `org-extend-today-until' affects
 timestamps in state change log.")
+(defvar org-log-note-this-command
+  "`this-command' when `org-add-log-setup' is called.")
+(defvar org-log-note-recursion-depth
+  "`recursion-depth' when `org-add-log-setup' is called.")
 
 (defvar org-log-post-message nil
   "Message to be displayed after a log note has been stored.
@@ -10912,21 +10382,36 @@ narrowing."
                 (throw 'exit nil))))
           ;; No drawer found.  Create one, if permitted.
           (when create
-            (unless (bolp) (insert "\n"))
-            (let ((beg (point)))
-              (insert ":" drawer ":\n:END:\n")
-              (org-indent-region beg (point))
-              (org-flag-region (line-end-position -1)
-                                (1- (point)) t 'outline))
-            (end-of-line -1)))))
+             ;; Unless current heading is the last heading in buffer
+             ;; and does not have a newline, `org-end-of-meta-data'
+             ;; should move us somewhere below the heading.
+             ;; Avoid situation when we insert drawer right before
+             ;; first "*".  Otherwise, if the previous heading is
+             ;; folded, we are inserting after visible newline at
+             ;; the end of the fold, thus breaking the fold
+             ;; continuity.
+             (unless (eobp)
+               (when (org-at-heading-p) (backward-char)))
+             (org-fold-core-ignore-modifications
+              (unless (bolp) (insert-and-inherit "\n"))
+              (let ((beg (point)))
+                (insert-and-inherit ":" drawer ":\n:END:\n")
+                (org-indent-region beg (point))
+                (org-fold-region (line-end-position -1) (1- (point)) t (if (eq 
org-fold-core-style 'text-properties) 'drawer 'outline)))))
+          (end-of-line -1))))
       (t
        (org-end-of-meta-data org-log-state-notes-insert-after-drawers)
-       (skip-chars-forward " \t\n")
-       (beginning-of-line)
-       (unless org-log-states-order-reversed
-        (org-skip-over-state-notes)
-        (skip-chars-backward " \t\n")
-        (forward-line)))))
+       (let ((endpos (point)))
+         (skip-chars-forward " \t\n")
+         (beginning-of-line)
+         (unless org-log-states-order-reversed
+          (org-skip-over-state-notes)
+          (skip-chars-backward " \t\n")
+          (beginning-of-line 2))
+         ;; When current headline is at the end of buffer and does not
+         ;; end with trailing newline the above can move to the
+         ;; beginning of the headline.
+         (when (< (point) endpos) (goto-char endpos))))))
    (if (bolp) (point) (line-beginning-position 2))))
 
 (defun org-add-log-setup (&optional purpose state prev-state how extra)
@@ -10941,6 +10426,8 @@ EXTRA is additional text that will be inserted into the 
notes buffer."
        org-log-note-how how
        org-log-note-extra extra
        org-log-note-effective-time (org-current-effective-time)
+        org-log-note-this-command this-command
+        org-log-note-recursion-depth (recursion-depth)
         org-log-setup t)
   (add-hook 'post-command-hook 'org-add-log-note 'append))
 
@@ -10969,37 +10456,39 @@ EXTRA is additional text that will be inserted into 
the notes buffer."
 
 (defun org-add-log-note (&optional _purpose)
   "Pop up a window for taking a note, and add this note later."
-  (remove-hook 'post-command-hook 'org-add-log-note)
-  (setq org-log-setup nil)
-  (setq org-log-note-window-configuration (current-window-configuration))
-  (delete-other-windows)
-  (move-marker org-log-note-return-to (point))
-  (pop-to-buffer-same-window (marker-buffer org-log-note-marker))
-  (goto-char org-log-note-marker)
-  (org-switch-to-buffer-other-window "*Org Note*")
-  (erase-buffer)
-  (if (memq org-log-note-how '(time state))
-      (org-store-log-note)
-    (let ((org-inhibit-startup t)) (org-mode))
-    (insert (format "# Insert note for %s.
+  (when (and (equal org-log-note-this-command this-command)
+             (= org-log-note-recursion-depth (recursion-depth)))
+    (remove-hook 'post-command-hook 'org-add-log-note)
+    (setq org-log-setup nil)
+    (setq org-log-note-window-configuration (current-window-configuration))
+    (delete-other-windows)
+    (move-marker org-log-note-return-to (point))
+    (pop-to-buffer-same-window (marker-buffer org-log-note-marker))
+    (goto-char org-log-note-marker)
+    (org-switch-to-buffer-other-window "*Org Note*")
+    (erase-buffer)
+    (if (memq org-log-note-how '(time state))
+        (org-store-log-note)
+      (let ((org-inhibit-startup t)) (org-mode))
+      (insert (format "# Insert note for %s.
 # Finish with C-c C-c, or cancel with C-c C-k.\n\n"
-                   (cl-case org-log-note-purpose
-                     (clock-out "stopped clock")
-                     (done  "closed todo item")
-                     (reschedule "rescheduling")
-                     (delschedule "no longer scheduled")
-                     (redeadline "changing deadline")
-                     (deldeadline "removing deadline")
-                     (refile "refiling")
-                     (note "this entry")
-                     (state
-                      (format "state change from \"%s\" to \"%s\""
-                              (or org-log-note-previous-state "")
-                              (or org-log-note-state "")))
-                     (t (error "This should not happen")))))
-    (when org-log-note-extra (insert org-log-note-extra))
-    (setq-local org-finish-function 'org-store-log-note)
-    (run-hooks 'org-log-buffer-setup-hook)))
+                      (cl-case org-log-note-purpose
+                        (clock-out "stopped clock")
+                        (done  "closed todo item")
+                        (reschedule "rescheduling")
+                        (delschedule "no longer scheduled")
+                        (redeadline "changing deadline")
+                        (deldeadline "removing deadline")
+                        (refile "refiling")
+                        (note "this entry")
+                        (state
+                         (format "state change from \"%s\" to \"%s\""
+                                 (or org-log-note-previous-state "")
+                                 (or org-log-note-state "")))
+                        (t (error "This should not happen")))))
+      (when org-log-note-extra (insert org-log-note-extra))
+      (setq-local org-finish-function 'org-store-log-note)
+      (run-hooks 'org-log-buffer-setup-hook))))
 
 (defvar org-note-abort nil) ; dynamically scoped
 (defun org-store-log-note ()
@@ -11052,34 +10541,36 @@ EXTRA is additional text that will be inserted into 
the notes buffer."
       (push note lines))
     (when (and lines (not org-note-abort))
       (with-current-buffer (marker-buffer org-log-note-marker)
-       (org-with-wide-buffer
-        ;; Find location for the new note.
-        (goto-char org-log-note-marker)
-        (set-marker org-log-note-marker nil)
-        ;; Note associated to a clock is to be located right after
-        ;; the clock.  Do not move point.
-        (unless (eq org-log-note-purpose 'clock-out)
-          (goto-char (org-log-beginning t)))
-        ;; Make sure point is at the beginning of an empty line.
-        (cond ((not (bolp)) (let ((inhibit-read-only t)) (insert "\n")))
-              ((looking-at "[ \t]*\\S-") (save-excursion (insert "\n"))))
-        ;; In an existing list, add a new item at the top level.
-        ;; Otherwise, indent line like a regular one.
-        (let ((itemp (org-in-item-p)))
-          (if itemp
-              (indent-line-to
-               (let ((struct (save-excursion
-                               (goto-char itemp) (org-list-struct))))
-                 (org-list-get-ind (org-list-get-top-point struct) struct)))
-            (org-indent-line)))
-        (insert (org-list-bullet-string "-") (pop lines))
-        (let ((ind (org-list-item-body-column (line-beginning-position))))
-          (dolist (line lines)
-            (insert "\n")
-            (indent-line-to ind)
-            (insert line)))
-        (message "Note stored")
-        (org-back-to-heading t)))))
+        (org-fold-core-ignore-modifications
+         (org-with-wide-buffer
+          ;; Find location for the new note.
+          (goto-char org-log-note-marker)
+          (set-marker org-log-note-marker nil)
+          ;; Note associated to a clock is to be located right after
+          ;; the clock.  Do not move point.
+          (unless (eq org-log-note-purpose 'clock-out)
+            (goto-char (org-log-beginning t)))
+          ;; Make sure point is at the beginning of an empty line.
+          (cond ((not (bolp)) (let ((inhibit-read-only t)) (insert-and-inherit 
"\n")))
+                ((looking-at "[ \t]*\\S-") (save-excursion (insert-and-inherit 
"\n"))))
+          ;; In an existing list, add a new item at the top level.
+          ;; Otherwise, indent line like a regular one.
+          (let ((itemp (org-in-item-p)))
+            (if itemp
+                (indent-line-to
+                 (let ((struct (save-excursion
+                                 (goto-char itemp) (org-list-struct))))
+                   (org-list-get-ind (org-list-get-top-point struct) struct)))
+              (org-indent-line)))
+          (insert-and-inherit (org-list-bullet-string "-") (pop lines))
+          (let ((ind (org-list-item-body-column (line-beginning-position))))
+            (dolist (line lines)
+              (insert-and-inherit "\n")
+               (unless (string-empty-p line)
+                (indent-line-to ind)
+                (insert-and-inherit line))))
+          (message "Note stored")
+          (org-back-to-heading t))))))
   ;; Don't add undo information when called from `org-agenda-todo'.
   (set-window-configuration org-log-note-window-configuration)
   (with-current-buffer (marker-buffer org-log-note-return-to)
@@ -11174,7 +10665,7 @@ as well.")
   "Make a compact tree showing all matches of REGEXP.
 
 The tree will show the lines where the regexp matches, and any other context
-defined in `org-show-context-detail', which see.
+defined in `org-fold-show-context-detail', which see.
 
 When optional argument KEEP-PREVIOUS is non-nil, highlighting and exposing
 done by a previous call to `org-occur' will be kept, to allow stacking of
@@ -11196,7 +10687,7 @@ The function must neither move point nor alter 
narrowing."
       (when (or (not keep-previous)        ; do not want to keep
                (not org-occur-highlights)) ; no previous matches
        ;; hide everything
-       (org-overview))
+       (org-cycle-overview))
       (let ((case-fold-search (if (eq org-occur-case-fold-search 'smart)
                                  (isearch-no-upper-case-p regexp t)
                                org-occur-case-fold-search)))
@@ -11206,12 +10697,12 @@ The function must neither move point nor alter 
narrowing."
            (setq cnt (1+ cnt))
            (when org-highlight-sparse-tree-matches
              (org-highlight-new-match (match-beginning 0) (match-end 0)))
-           (org-show-context 'occur-tree)))))
+           (org-fold-show-context 'occur-tree)))))
     (when org-remove-highlights-with-change
       (add-hook 'before-change-functions 'org-remove-occur-highlights
                nil 'local))
     (unless org-sparse-tree-open-archived-trees
-      (org-hide-archived-subtrees (point-min) (point-max)))
+      (org-fold-hide-archived-subtrees (point-min) (point-max)))
     (run-hooks 'org-occur-hook)
     (when (called-interactively-p 'interactive)
       (message "%d match(es) for regexp %s" cnt regexp))
@@ -11470,7 +10961,7 @@ headlines matching this string."
                         ;; Get the correct level to match
                         (concat "\\*\\{" (number-to-string start-level) "\\} ")
                       org-outline-regexp)
-                    " *\\(" (regexp-opt org-todo-keywords-1 'words) "\\)?"
+                    " *\\(?:\\(" (regexp-opt org-todo-keywords-1 t) "\\) \\)?"
                     " *\\(.*?\\)\\([ \t]:\\(?:" org-tag-re ":\\)+\\)?[ \t]*$"))
         (props (list 'face 'default
                      'done-face 'org-agenda-done
@@ -11495,120 +10986,220 @@ headlines matching this string."
     (save-excursion
       (goto-char (point-min))
       (when (eq action 'sparse-tree)
-       (org-overview)
+       (org-cycle-overview)
        (org-remove-occur-highlights))
-      (while (let (case-fold-search)
-              (re-search-forward re nil t))
-       (setq org-map-continue-from nil)
-       (catch :skip
-         ;; Ignore closing parts of inline tasks.
-         (when (and (fboundp 'org-inlinetask-end-p) (org-inlinetask-end-p))
-           (throw :skip t))
-         (setq todo (and (match-end 1) (match-string-no-properties 1)))
-         (setq tags (and (match-end 4) (org-trim (match-string-no-properties 
4))))
-         (goto-char (setq lspos (match-beginning 0)))
-         (setq level (org-reduced-level (org-outline-level))
-               category (org-get-category))
-          (when (eq action 'agenda)
-            (setq ts-date-pair (org-agenda-entry-get-agenda-timestamp (point))
-                 ts-date (car ts-date-pair)
-                 ts-date-type (cdr ts-date-pair)))
-         (setq i llast llast level)
-         ;; remove tag lists from same and sublevels
-         (while (>= i level)
-           (when (setq entry (assoc i tags-alist))
-             (setq tags-alist (delete entry tags-alist)))
-           (setq i (1- i)))
-         ;; add the next tags
-         (when tags
-           (setq tags (org-split-string tags ":")
-                 tags-alist
-                 (cons (cons level tags) tags-alist)))
-         ;; compile tags for current headline
-         (setq tags-list
-               (if org-use-tag-inheritance
-                   (apply 'append (mapcar 'cdr (reverse tags-alist)))
-                 tags)
-               org-scanner-tags tags-list)
-         (when org-use-tag-inheritance
-           (setcdr (car tags-alist)
-                   (mapcar (lambda (x)
-                             (setq x (copy-sequence x))
-                             (org-add-prop-inherited x))
-                           (cdar tags-alist))))
-         (when (and tags org-use-tag-inheritance
-                    (or (not (eq t org-use-tag-inheritance))
-                        org-tags-exclude-from-inheritance))
-           ;; Selective inheritance, remove uninherited ones.
-           (setcdr (car tags-alist)
-                   (org-remove-uninherited-tags (cdar tags-alist))))
-         (when (and
-
-                ;; eval matcher only when the todo condition is OK
-                (and (or (not todo-only) (member todo org-todo-keywords-1))
-                     (if (functionp matcher)
-                         (let ((case-fold-search t) (org-trust-scanner-tags t))
-                           (funcall matcher todo tags-list level))
-                       matcher))
-
-                ;; Call the skipper, but return t if it does not
-                ;; skip, so that the `and' form continues evaluating.
-                (progn
-                  (unless (eq action 'sparse-tree) (org-agenda-skip))
-                  t)
-
-                ;; Check if timestamps are deselecting this entry
-                (or (not todo-only)
-                    (and (member todo org-todo-keywords-1)
-                         (or (not org-agenda-tags-todo-honor-ignore-options)
-                             (not 
(org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item))))))
-
-           ;; select this headline
-           (cond
-            ((eq action 'sparse-tree)
-             (and org-highlight-sparse-tree-matches
-                  (org-get-heading) (match-end 0)
-                  (org-highlight-new-match
-                   (match-beginning 1) (match-end 1)))
-             (org-show-context 'tags-tree))
-            ((eq action 'agenda)
-             (setq txt (org-agenda-format-item
-                        ""
-                        (concat
-                         (if (eq org-tags-match-list-sublevels 'indented)
-                             (make-string (1- level) ?.) "")
-                         (org-get-heading))
-                        (make-string level ?\s)
-                        category
-                        tags-list)
-                   priority (org-get-priority txt))
-             (goto-char lspos)
-             (setq marker (org-agenda-new-marker))
-             (org-add-props txt props
-               'org-marker marker 'org-hd-marker marker 'org-category category
-               'todo-state todo
-                'ts-date ts-date
-               'priority priority
-                'type (concat "tagsmatch" ts-date-type))
-             (push txt rtn))
-            ((functionp action)
-             (setq org-map-continue-from nil)
-             (save-excursion
-               (setq rtn1 (funcall action))
-               (push rtn1 rtn)))
-            (t (user-error "Invalid action")))
-
-           ;; if we are to skip sublevels, jump to end of subtree
-           (unless org-tags-match-list-sublevels
-             (org-end-of-subtree t)
-             (backward-char 1))))
-       ;; Get the correct position from where to continue
-       (if org-map-continue-from
-           (goto-char org-map-continue-from)
-         (and (= (point) lspos) (end-of-line 1)))))
+      (if (org-element--cache-active-p)
+          (let ((fast-re (concat "^"
+                                 (if start-level
+                                    ;; Get the correct level to match
+                                    (concat "\\*\\{" (number-to-string 
start-level) "\\} ")
+                                  org-outline-regexp))))
+            (org-element-cache-map
+             (lambda (el)
+               (goto-char (org-element-property :begin el))
+               (setq todo (org-element-property :todo-keyword el)
+                     level (org-element-property :level el)
+                     category (org-entry-get-with-inheritance "CATEGORY" nil 
el)
+                     tags-list (org-get-tags el)
+                     org-scanner-tags tags-list)
+               (when (eq action 'agenda)
+                 (setq ts-date-pair (org-agenda-entry-get-agenda-timestamp 
(point))
+                      ts-date (car ts-date-pair)
+                      ts-date-type (cdr ts-date-pair)))
+               (catch :skip
+                 (when (and
+
+                       ;; eval matcher only when the todo condition is OK
+                       (and (or (not todo-only) (member todo 
org-todo-keywords-1))
+                            (if (functionp matcher)
+                                (let ((case-fold-search t) 
(org-trust-scanner-tags t))
+                                  (funcall matcher todo tags-list level))
+                              matcher))
+
+                       ;; Call the skipper, but return t if it does not
+                       ;; skip, so that the `and' form continues evaluating.
+                       (progn
+                         (unless (eq action 'sparse-tree) (org-agenda-skip el))
+                         t)
+
+                       ;; Check if timestamps are deselecting this entry
+                       (or (not todo-only)
+                           (and (member todo org-todo-keywords-1)
+                                (or (not 
org-agenda-tags-todo-honor-ignore-options)
+                                    (not 
(org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item))))))
+
+                  ;; select this headline
+                  (cond
+                   ((eq action 'sparse-tree)
+                    (and org-highlight-sparse-tree-matches
+                         (org-get-heading) (match-end 0)
+                         (org-highlight-new-match
+                          (match-beginning 1) (match-end 1)))
+                    (org-fold-show-context 'tags-tree))
+                   ((eq action 'agenda)
+                     (let* ((effort (org-entry-get (point) 
org-effort-property))
+                            (effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort)))))
+                      (setq txt (org-agenda-format-item
+                                 ""
+                                  ;; Add `effort' and `effort-minutes'
+                                  ;; properties for prefix format.
+                                  (org-add-props
+                                      (concat
+                                      (if (eq org-tags-match-list-sublevels 
'indented)
+                                          (make-string (1- level) ?.) "")
+                                      (org-get-heading))
+                                      nil
+                                    'effort effort
+                                    'effort-minutes effort-minutes)
+                                 (make-string level ?\s)
+                                 category
+                                 tags-list)
+                            priority (org-get-priority txt))
+                       ;; Now add `effort' and `effort-minutes' to
+                       ;; full agenda line.
+                       (setq txt (org-add-props txt nil
+                                   'effort effort
+                                   'effort-minutes effort-minutes)))
+                    (goto-char (org-element-property :begin el))
+                    (setq marker (org-agenda-new-marker))
+                    (org-add-props txt props
+                      'org-marker marker 'org-hd-marker marker 'org-category 
category
+                      'todo-state todo
+                       'ts-date ts-date
+                      'priority priority
+                       'type (concat "tagsmatch" ts-date-type))
+                    (push txt rtn))
+                   ((functionp action)
+                    (setq org-map-continue-from nil)
+                    (save-excursion
+                      (setq rtn1 (funcall action))
+                      (push rtn1 rtn)))
+                   (t (user-error "Invalid action")))
+
+                  ;; if we are to skip sublevels, jump to end of subtree
+                  (unless org-tags-match-list-sublevels
+                    (goto-char (1- (org-element-property :end el))))))
+               ;; Get the correct position from where to continue
+              (when org-map-continue-from
+                 (setq org-element-cache-map-continue-from 
org-map-continue-from)
+                (goto-char org-map-continue-from))
+               ;; Return nil.
+               nil)
+             :next-re fast-re
+             :fail-re fast-re
+             :narrow t))
+        (while (let (case-fold-search)
+                (re-search-forward re nil t))
+         (setq org-map-continue-from nil)
+         (catch :skip
+           ;; Ignore closing parts of inline tasks.
+           (when (and (fboundp 'org-inlinetask-end-p) (org-inlinetask-end-p))
+             (throw :skip t))
+           (setq todo (and (match-end 1) (match-string-no-properties 1)))
+            (setq tags (and (match-end 4) (org-trim 
(match-string-no-properties 4))))
+           (goto-char (setq lspos (match-beginning 0)))
+           (setq level (org-reduced-level (org-outline-level))
+                 category (org-get-category))
+            (when (eq action 'agenda)
+              (setq ts-date-pair (org-agenda-entry-get-agenda-timestamp 
(point))
+                   ts-date (car ts-date-pair)
+                   ts-date-type (cdr ts-date-pair)))
+           (setq i llast llast level)
+           ;; remove tag lists from same and sublevels
+           (while (>= i level)
+             (when (setq entry (assoc i tags-alist))
+               (setq tags-alist (delete entry tags-alist)))
+             (setq i (1- i)))
+           ;; add the next tags
+           (when tags
+             (setq tags (org-split-string tags ":")
+                   tags-alist
+                   (cons (cons level tags) tags-alist)))
+           ;; compile tags for current headline
+           (setq tags-list
+                 (if org-use-tag-inheritance
+                     (apply 'append (mapcar 'cdr (reverse tags-alist)))
+                   tags)
+                 org-scanner-tags tags-list)
+           (when org-use-tag-inheritance
+             (setcdr (car tags-alist)
+                     (mapcar (lambda (x)
+                               (setq x (copy-sequence x))
+                               (org-add-prop-inherited x))
+                             (cdar tags-alist))))
+           (when (and tags org-use-tag-inheritance
+                      (or (not (eq t org-use-tag-inheritance))
+                          org-tags-exclude-from-inheritance))
+             ;; Selective inheritance, remove uninherited ones.
+             (setcdr (car tags-alist)
+                     (org-remove-uninherited-tags (cdar tags-alist))))
+           (when (and
+
+                  ;; eval matcher only when the todo condition is OK
+                  (and (or (not todo-only) (member todo org-todo-keywords-1))
+                       (if (functionp matcher)
+                           (let ((case-fold-search t) (org-trust-scanner-tags 
t))
+                             (funcall matcher todo tags-list level))
+                         matcher))
+
+                  ;; Call the skipper, but return t if it does not
+                  ;; skip, so that the `and' form continues evaluating.
+                  (progn
+                    (unless (eq action 'sparse-tree) (org-agenda-skip))
+                    t)
+
+                  ;; Check if timestamps are deselecting this entry
+                  (or (not todo-only)
+                      (and (member todo org-todo-keywords-1)
+                           (or (not org-agenda-tags-todo-honor-ignore-options)
+                               (not 
(org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item))))))
+
+             ;; select this headline
+             (cond
+              ((eq action 'sparse-tree)
+               (and org-highlight-sparse-tree-matches
+                    (org-get-heading) (match-end 0)
+                    (org-highlight-new-match
+                     (match-beginning 1) (match-end 1)))
+               (org-fold-show-context 'tags-tree))
+              ((eq action 'agenda)
+               (setq txt (org-agenda-format-item
+                          ""
+                          (concat
+                           (if (eq org-tags-match-list-sublevels 'indented)
+                               (make-string (1- level) ?.) "")
+                           (org-get-heading))
+                          (make-string level ?\s)
+                          category
+                          tags-list)
+                     priority (org-get-priority txt))
+               (goto-char lspos)
+               (setq marker (org-agenda-new-marker))
+               (org-add-props txt props
+                 'org-marker marker 'org-hd-marker marker 'org-category 
category
+                 'todo-state todo
+                  'ts-date ts-date
+                 'priority priority
+                  'type (concat "tagsmatch" ts-date-type))
+               (push txt rtn))
+              ((functionp action)
+               (setq org-map-continue-from nil)
+               (save-excursion
+                 (setq rtn1 (funcall action))
+                 (push rtn1 rtn)))
+              (t (user-error "Invalid action")))
+
+             ;; if we are to skip sublevels, jump to end of subtree
+             (unless org-tags-match-list-sublevels
+               (org-end-of-subtree t)
+               (backward-char 1))))
+         ;; Get the correct position from where to continue
+         (if org-map-continue-from
+             (goto-char org-map-continue-from)
+           (and (= (point) lspos) (end-of-line 1))))))
     (when (and (eq action 'sparse-tree)
               (not org-sparse-tree-open-archived-trees))
-      (org-hide-archived-subtrees (point-min) (point-max)))
+      (org-fold-hide-archived-subtrees (point-min) (point-max)))
     (nreverse rtn)))
 
 (defun org-remove-uninherited-tags (tags)
@@ -11785,13 +11376,13 @@ See also `org-scan-tags'."
                     (propp
                      (let* ((gv (pcase (upcase (match-string 5 term))
                                   ("CATEGORY"
-                                   '(get-text-property (point) 'org-category))
+                                   '(org-get-category (point)))
                                   ("TODO" 'todo)
                                   (p `(org-cached-entry-get nil ,p))))
                             (pv (match-string 7 term))
                             (regexp (eq (string-to-char pv) ?{))
                             (strp (eq (string-to-char pv) ?\"))
-                            (timep (string-match-p "^\"[[<].*[]>]\"$" pv))
+                            (timep (string-match-p 
"^\"[[<]\\(?:[0-9]+\\|now\\|today\\|tomorrow\\|[+-][0-9]+[dmwy]\\).*[]>]\"$" 
pv))
                             (po (org-op-to-function (match-string 6 term)
                                                     (if timep 'time strp))))
                        (setq pv (if (or regexp strp) (substring pv 1 -1) pv))
@@ -12027,24 +11618,29 @@ in Lisp code use `org-set-tags' instead."
     (cond
      ((equal '(4) arg) (org-align-tags t))
      ((and (org-region-active-p) org-loop-over-headlines-in-active-region)
-      (let (org-loop-over-headlines-in-active-region) ;  hint: infinite 
recursion.
+      (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
+                   'region-start-level 'region))
+            org-loop-over-headlines-in-active-region) ;  hint: infinite 
recursion.
        (org-map-entries
         #'org-set-tags-command
-        nil
-        (if (eq org-loop-over-headlines-in-active-region 'start-level)
-            'region-start-level
-          'region)
+        nil cl
         (lambda () (when (org-invisible-p) (org-end-of-subtree nil t))))))
      (t
       (save-excursion
        (org-back-to-heading)
        (let* ((all-tags (org-get-tags))
+               (local-table (or org-current-tag-alist (org-get-buffer-tags)))
               (table (setq org-last-tags-completion-table
-                           (org--tag-add-to-alist
-                            (and org-complete-tags-always-offer-all-agenda-tags
-                                 (org-global-tags-completion-table
-                                  (org-agenda-files)))
-                            (or org-current-tag-alist (org-get-buffer-tags)))))
+                            (append
+                             ;; Put local tags in front.
+                             local-table
+                             (cl-set-difference
+                             (org--tag-add-to-alist
+                              (and 
org-complete-tags-always-offer-all-agenda-tags
+                                   (org-global-tags-completion-table
+                                    (org-agenda-files)))
+                              local-table)
+                              local-table))))
               (current-tags
                (cl-remove-if (lambda (tag) (get-text-property 0 'inherited 
tag))
                              all-tags))
@@ -12086,8 +11682,12 @@ visible part of the buffer."
   (let ((get-indent-column
         (lambda ()
           (let ((offset (if (bound-and-true-p org-indent-mode)
-                            (* (1- org-indent-indentation-per-level)
-                               (1- (org-current-level)))
+                             (save-excursion
+                               (org-back-to-heading-or-point-min)
+                               (length
+                                (get-text-property
+                                 (line-end-position)
+                                 'line-prefix)))
                           0)))
             (+ org-tags-column
                (if (> org-tags-column 0) (- offset) offset))))))
@@ -12110,34 +11710,35 @@ If TAGS is nil or the empty string, all tags are 
removed.
 
 This function assumes point is on a headline."
   (org-with-wide-buffer
-   (let ((tags (pcase tags
-                ((pred listp) tags)
-                ((pred stringp) (split-string (org-trim tags) ":" t))
-                (_ (error "Invalid tag specification: %S" tags))))
-        (old-tags (org-get-tags nil t))
-        (tags-change? nil))
-     (when (functionp org-tags-sort-function)
-       (setq tags (sort tags org-tags-sort-function)))
-     (setq tags-change? (not (equal tags old-tags)))
-     (when tags-change?
-       ;; Delete previous tags and any trailing white space.
-       (goto-char (if (org-match-line org-tag-line-re) (match-beginning 1)
-                   (line-end-position)))
-       (skip-chars-backward " \t")
-       (delete-region (point) (line-end-position))
-       ;; Deleting white spaces may break an otherwise empty headline.
-       ;; Re-introduce one space in this case.
-       (unless (org-at-heading-p) (insert " "))
-       (when tags
-        (save-excursion (insert " " (org-make-tag-string tags)))
-        ;; When text is being inserted on an invisible region
-        ;; boundary, it can be inadvertently sucked into
-        ;; invisibility.
-        (unless (org-invisible-p (line-beginning-position))
-          (org-flag-region (point) (line-end-position) nil 'outline))))
-     ;; Align tags, if any.
-     (when tags (org-align-tags))
-     (when tags-change? (run-hooks 'org-after-tags-change-hook)))))
+   (org-fold-core-ignore-modifications
+     (let ((tags (pcase tags
+                  ((pred listp) tags)
+                  ((pred stringp) (split-string (org-trim tags) ":" t))
+                  (_ (error "Invalid tag specification: %S" tags))))
+          (old-tags (org-get-tags nil t))
+          (tags-change? nil))
+       (when (functionp org-tags-sort-function)
+         (setq tags (sort tags org-tags-sort-function)))
+       (setq tags-change? (not (equal tags old-tags)))
+       (when tags-change?
+         ;; Delete previous tags and any trailing white space.
+         (goto-char (if (org-match-line org-tag-line-re) (match-beginning 1)
+                     (line-end-position)))
+         (skip-chars-backward " \t")
+         (delete-region (point) (line-end-position))
+         ;; Deleting white spaces may break an otherwise empty headline.
+         ;; Re-introduce one space in this case.
+         (unless (org-at-heading-p) (insert " "))
+         (when tags
+          (save-excursion (insert-and-inherit " " (org-make-tag-string tags)))
+          ;; When text is being inserted on an invisible region
+          ;; boundary, it can be inadvertently sucked into
+          ;; invisibility.
+          (unless (org-invisible-p (line-beginning-position))
+            (org-fold-region (point) (line-end-position) nil 'outline))))
+       ;; Align tags, if any.
+       (when tags (org-align-tags))
+       (when tags-change? (run-hooks 'org-after-tags-change-hook))))))
 
 (defun org-change-tag-in-region (beg end tag off)
   "Add or remove TAG for each entry in the region.
@@ -12315,7 +11916,9 @@ Returns the new tags string, or nil to not change the 
current settings."
              (while (equal (car tbl) '(:newline))
                (insert "\n")
                (setq tbl (cdr tbl)))))
-          ((equal e '(:grouptags)) (insert " : "))
+          ((equal e '(:grouptags))
+            (delete-char -3)
+            (insert " : "))
           (t
            (setq tg (copy-sequence (car e)) c2 nil)
            (if (cdr e)
@@ -12328,7 +11931,13 @@ Returns the new tags string, or nil to not change the 
current settings."
                  (while (or (rassoc char ntable) (rassoc char table))
                    (setq char (1+ char)))
                (setq c2 c1))
-             (setq c (or c2 char)))
+             (setq c (or c2
+                          (if (> char ?~)
+                              ?\s
+                            char)))
+              ;; Consider characters A-Z after a-z.
+              (if (equal char ?z)
+                  (setq char ?A)))
            (when ingroup (push tg (car groups)))
            (setq tg (org-add-props tg nil 'face
                                    (cond
@@ -12434,8 +12043,7 @@ Returns the new tags string, or nil to not change the 
current settings."
                               (cond
                                ((member tag current) c-face)
                                ((member tag inherited) i-face)
-                               (t (get-text-property (match-beginning 1) '
-                                                     face))))))))
+                               (t 'default)))))))
                  (goto-char (point-min)))))
        (delete-overlay org-tags-overlay)
        (if rtn
@@ -12451,13 +12059,21 @@ TAGS is a list of strings."
 (defun org--get-local-tags ()
   "Return list of tags for the current headline.
 Assume point is at the beginning of the headline."
-  (and (looking-at org-tag-line-re)
-       (split-string (match-string-no-properties 2) ":" t)))
-
-(defun org-get-tags (&optional pos local)
+  (let* ((cached (and (org-element--cache-active-p) (org-element-at-point nil 
'cached)))
+         (cached-tags (org-element-property :tags cached)))
+    (if cached
+        ;; If we do not explicitly copy the result, reference would
+        ;; be returned and cache element might be modified directly.
+        (mapcar #'copy-sequence cached-tags)
+      ;; Parse tags manually.
+      (and (looking-at org-tag-line-re)
+           (split-string (match-string-no-properties 2) ":" t)))))
+
+(defun org-get-tags (&optional pos-or-element local)
   "Get the list of tags specified in the current headline.
 
-When argument POS is non-nil, retrieve tags for headline at POS.
+When argument POS-OR-ELEMENT is non-nil, retrieve tags for headline at
+POS.
 
 According to `org-use-tag-inheritance', tags may be inherited
 from parent headlines, and from the whole document, through
@@ -12470,19 +12086,36 @@ However, when optional argument LOCAL is non-nil, 
only return
 tags specified at the headline.
 
 Inherited tags have the `inherited' text property."
-  (if (and org-trust-scanner-tags
-           (or (not pos) (eq pos (point)))
-           (not local))
-      org-scanner-tags
-    (org-with-point-at (or pos (point))
-      (unless (org-before-first-heading-p)
-        (org-back-to-heading t)
-        (let ((ltags (org--get-local-tags)) itags)
+  (save-match-data
+    (if (and org-trust-scanner-tags
+             (or (not pos-or-element) (eq pos-or-element (point)))
+             (not local))
+        org-scanner-tags
+      (org-with-point-at (unless (org-element-type pos-or-element)
+                        (or pos-or-element (point)))
+        (unless (or (org-element-type pos-or-element)
+                    (org-before-first-heading-p))
+          (org-back-to-heading t))
+        (let ((ltags (if (org-element-type pos-or-element)
+                         (org-element-property :tags (org-element-lineage 
pos-or-element '(headline inlinetask) t))
+                       (org--get-local-tags)))
+              itags)
           (if (or local (not org-use-tag-inheritance)) ltags
-            (while (org-up-heading-safe)
-              (setq itags (nconc (mapcar #'org-add-prop-inherited
-                                        (org--get-local-tags))
-                                itags)))
+            (let ((cached (and (org-element--cache-active-p)
+                               (if (org-element-type pos-or-element)
+                                   (org-element-lineage pos-or-element 
'(headline org-data inlinetask) t)
+                                 (org-element-at-point nil 'cached)))))
+              (if cached
+                  (while (setq cached (org-element-property :parent cached))
+                    (setq itags (nconc (mapcar #'org-add-prop-inherited
+                                               ;; If we do explicitly copy the 
result, reference would
+                                               ;; be returned and cache 
element might be modified directly.
+                                               (mapcar #'copy-sequence 
(org-element-property :tags cached)))
+                                       itags)))
+                (while (org-up-heading-safe)
+                  (setq itags (nconc (mapcar #'org-add-prop-inherited
+                                            (org--get-local-tags))
+                                    itags)))))
             (setq itags (append org-file-tags itags))
             (nreverse
             (delete-dups
@@ -12490,12 +12123,24 @@ Inherited tags have the `inherited' text property."
 
 (defun org-get-buffer-tags ()
   "Get a table of all tags used in the buffer, for completion."
-  (org-with-point-at 1
-    (let (tags)
-      (while (re-search-forward org-tag-line-re nil t)
-       (setq tags (nconc (split-string (match-string-no-properties 2) ":")
-                         tags)))
-      (mapcar #'list (delete-dups (append org-file-tags tags))))))
+  (if (org-element--cache-active-p)
+      ;; `org-element-cache-map' is about 2x faster compared to regexp
+      ;; search.
+      (let ((hashed (make-hash-table :test #'equal)))
+        (org-element-cache-map
+         (lambda (el)
+           (dolist (tag (org-element-property :tags el))
+             ;; Do not carry over the text properties.  They may look
+             ;; ugly in the completion.
+             (puthash (list (substring-no-properties tag)) t hashed))))
+        (dolist (tag org-file-tags) (puthash (list tag) t hashed))
+        (hash-table-keys hashed))
+    (org-with-point-at 1
+      (let (tags)
+        (while (re-search-forward org-tag-line-re nil t)
+         (setq tags (nconc (split-string (match-string-no-properties 2) ":")
+                           tags)))
+        (mapcar #'list (delete-dups (append org-file-tags tags)))))))
 
 ;;;; The mapping API
 
@@ -12606,15 +12251,18 @@ a *different* entry, you cannot use these techniques."
 
          (if (not scope)
              (progn
-               (org-agenda-prepare-buffers
-                (and buffer-file-name (list buffer-file-name)))
+                ;; Agenda expects a file buffer.  Skip over refreshing
+                ;; agenda cache for non-file buffers.
+                (when buffer-file-name
+                 (org-agenda-prepare-buffers
+                  (and buffer-file-name (list buffer-file-name))))
                (setq res
                      (org-scan-tags
                       func matcher org--matcher-tags-todo-only start-level)))
            ;; Get the right scope
            (cond
             ((and scope (listp scope) (symbolp (car scope)))
-             (setq scope (eval scope)))
+             (setq scope (eval scope t)))
             ((eq scope 'agenda)
              (setq scope (org-agenda-files t)))
             ((eq scope 'agenda-with-archives)
@@ -12652,7 +12300,8 @@ but in some other way.")
     "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME"
     "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "UNNUMBERED"
     "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE"
-    "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS")
+    "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS"
+    "ORG-IMAGE-ACTUAL-WIDTH")
   "Some properties that are used by Org mode for various purposes.
 Being in this list makes sure that they are offered for completion.")
 
@@ -12781,9 +12430,10 @@ variables is set."
     ;; Maybe update the effort value:
     (unless (equal current value)
       (org-entry-put nil org-effort-property value))
-    (org-refresh-property '((effort . identity)
-                           (effort-minutes . org-duration-to-minutes))
-                         value)
+    (unless (org-element--cache-active-p)
+      (org-refresh-property '((effort . identity)
+                          (effort-minutes . org-duration-to-minutes))
+                        value))
     (when (equal (org-get-heading t t t t)
                 (bound-and-true-p org-clock-current-task))
       (setq org-clock-effort value)
@@ -12992,30 +12642,41 @@ strings."
          ;; Return value.
          props)))))
 
-(defun org--property-local-values (property literal-nil)
-  "Return value for PROPERTY in current entry.
+(defun org--property-local-values (property literal-nil &optional element)
+  "Return value for PROPERTY in current entry or ELEMENT.
 Value is a list whose car is the base value for PROPERTY and cdr
 a list of accumulated values.  Return nil if neither is found in
 the entry.  Also return nil when PROPERTY is set to \"nil\",
 unless LITERAL-NIL is non-nil."
-  (let ((range (org-get-property-block)))
-    (when range
-      (goto-char (car range))
-      (let* ((case-fold-search t)
-            (end (cdr range))
-            (value
-             ;; Base value.
-             (save-excursion
-               (let ((v (and (re-search-forward
-                              (org-re-property property nil t) end t)
-                             (match-string-no-properties 3))))
-                 (list (if literal-nil v (org-not-nil v)))))))
-       ;; Find additional values.
-       (let* ((property+ (org-re-property (concat property "+") nil t)))
-         (while (re-search-forward property+ end t)
-           (push (match-string-no-properties 3) value)))
-       ;; Return final values.
-       (and (not (equal value '(nil))) (nreverse value))))))
+  (let ((element (or element
+                     (and (org-element--cache-active-p)
+                          (org-element-at-point nil 'cached)))))
+    (if element
+        (let* ((element (org-element-lineage element '(headline org-data 
inlinetask) 'with-self))
+               (base-value (org-element-property (intern (concat ":" (upcase 
property))) element))
+               (base-value (if literal-nil base-value (org-not-nil 
base-value)))
+               (extra-value (org-element-property (intern (concat ":" (upcase 
property) "+")) element))
+               (extra-value (if (listp extra-value) extra-value (list 
extra-value)))
+               (value (cons base-value extra-value)))
+          (and (not (equal value '(nil))) value))
+      (let ((range (org-get-property-block)))
+        (when range
+          (goto-char (car range))
+          (let* ((case-fold-search t)
+                (end (cdr range))
+                (value
+                 ;; Base value.
+                 (save-excursion
+                   (let ((v (and (re-search-forward
+                                  (org-re-property property nil t) end t)
+                                 (match-string-no-properties 3))))
+                     (list (if literal-nil v (org-not-nil v)))))))
+           ;; Find additional values.
+           (let* ((property+ (org-re-property (concat property "+") nil t)))
+             (while (re-search-forward property+ end t)
+               (push (match-string-no-properties 3) value)))
+           ;; Return final values.
+           (and (not (equal value '(nil))) (nreverse value))))))))
 
 (defun org--property-global-or-keyword-value (property literal-nil)
   "Return value for PROPERTY as defined by global properties or by keyword.
@@ -13056,7 +12717,9 @@ value higher up the hierarchy."
       (org-entry-get-with-inheritance property literal-nil))
      (t
       (let* ((local (org--property-local-values property literal-nil))
-            (value (and local (mapconcat #'identity (delq nil local) " "))))
+            (value (and local (mapconcat #'identity
+                                          (delq nil local)
+                                          (org--property-get-separator 
property)))))
        (if literal-nil value (org-not-nil value)))))))
 
 (defun org-property-or-variable-value (var &optional inherit)
@@ -13153,7 +12816,7 @@ no match, the marker will point nowhere.
 Note that also `org-entry-get' calls this function, if the INHERIT flag
 is set.")
 
-(defun org-entry-get-with-inheritance (property &optional literal-nil)
+(defun org-entry-get-with-inheritance (property &optional literal-nil element)
   "Get PROPERTY of entry or content at point, search higher levels if needed.
 The search will stop at the first ancestor which has the property defined.
 If the value found is \"nil\", return nil to show that the property
@@ -13161,27 +12824,63 @@ should be considered as undefined (this is the 
meaning of nil here).
 However, if LITERAL-NIL is set, return the string value \"nil\" instead."
   (move-marker org-entry-property-inherited-from nil)
   (org-with-wide-buffer
-   (let (value)
+   (let (value at-bob-no-heading)
      (catch 'exit
-       (while t
-        (let ((v (org--property-local-values property literal-nil)))
-          (when v
-            (setq value
-                  (concat (mapconcat #'identity (delq nil v) " ")
-                          (and value " ")
-                          value)))
-          (cond
-           ((car v)
-            (org-back-to-heading-or-point-min t)
-            (move-marker org-entry-property-inherited-from (point))
-            (throw 'exit nil))
-           ((org-up-heading-or-point-min))
-           (t
-            (let ((global (org--property-global-or-keyword-value property 
literal-nil)))
-              (cond ((not global))
-                    (value (setq value (concat global " " value)))
-                    (t (setq value global))))
-            (throw 'exit nil))))))
+       (let ((element (or element
+                          (and (org-element--cache-active-p)
+                               (org-element-at-point nil 'cached))))
+             (separator (org--property-get-separator property)))
+         (if element
+             (let ((element (org-element-lineage element '(headline org-data 
inlinetask) 'with-self)))
+               (while t
+                 (let* ((v (org--property-local-values property literal-nil 
element))
+                        (v (if (listp v) v (list v))))
+                   (when v
+                     (setq value
+                           (concat (mapconcat #'identity (delq nil v) 
separator)
+                                   (and value separator)
+                                   value)))
+                   (cond
+                   ((car v)
+                    (move-marker org-entry-property-inherited-from 
(org-element-property :begin element))
+                    (throw 'exit nil))
+                   ((org-element-property :parent element)
+                     (setq element (org-element-property :parent element)))
+                   (t
+                    (let ((global (org--property-global-or-keyword-value 
property literal-nil)))
+                      (cond ((not global))
+                            (value (setq value (concat global separator 
value)))
+                            (t (setq value global))))
+                    (throw 'exit nil))))))
+           (while t
+            (let ((v (org--property-local-values property literal-nil)))
+              (when v
+                (setq value
+                      (concat (mapconcat #'identity (delq nil v) separator)
+                              (and value separator)
+                              value)))
+              (cond
+               ((car v)
+                (org-back-to-heading-or-point-min t)
+                (move-marker org-entry-property-inherited-from (point))
+                (throw 'exit nil))
+               ((or (org-up-heading-safe)
+                     (and (not (bobp))
+                          (goto-char (point-min))
+                          nil)
+                     ;; `org-up-heading-safe' returned nil.  We are at low
+                     ;; level heading or bob.  If there is headline
+                     ;; there, do not try to fetch its properties.
+                     (and (bobp)
+                          (not at-bob-no-heading)
+                          (not (org-at-heading-p))
+                          (setq at-bob-no-heading t))))
+               (t
+                (let ((global (org--property-global-or-keyword-value property 
literal-nil)))
+                  (cond ((not global))
+                        (value (setq value (concat global separator value)))
+                        (t (setq value global))))
+                (throw 'exit nil))))))))
      (if literal-nil value (org-not-nil value)))))
 
 (defvar org-property-changed-functions nil
@@ -13250,19 +12949,20 @@ decreases scheduled or deadline date by one day."
         ((member property org-special-properties)
         (error "The %s property cannot be set with `org-entry-put'" property))
         (t
-        (let* ((range (org-get-property-block beg 'force))
-               (end (cdr range))
-               (case-fold-search t))
-          (goto-char (car range))
-          (if (re-search-forward (org-re-property property nil t) end t)
-              (progn (delete-region (match-beginning 0) (match-end 0))
-                     (goto-char (match-beginning 0)))
-            (goto-char end)
-            (insert "\n")
-            (backward-char))
-          (insert ":" property ":")
-          (when value (insert " " value))
-          (org-indent-line)))))
+         (org-fold-core-ignore-modifications
+          (let* ((range (org-get-property-block beg 'force))
+                 (end (cdr range))
+                 (case-fold-search t))
+            (goto-char (car range))
+            (if (re-search-forward (org-re-property property nil t) end t)
+                (progn (delete-region (match-beginning 0) (match-end 0))
+                       (goto-char (match-beginning 0)))
+              (goto-char end)
+              (insert-and-inherit "\n")
+              (backward-char))
+            (insert-and-inherit ":" property ":")
+            (when value (insert-and-inherit " " value))
+            (org-indent-line))))))
      (run-hook-with-args 'org-property-changed-functions property value))))
 
 (defun org-buffer-property-keys (&optional specials defaults columns)
@@ -13364,9 +13064,8 @@ drawer is immediately hidden."
      (org-with-limited-levels (org-back-to-heading-or-point-min t)))
    (if (org-before-first-heading-p)
        (while (and (org-at-comment-p) (bolp)) (forward-line))
-     (progn
-       (forward-line)
-       (when (looking-at-p org-planning-line-re) (forward-line))))
+     (forward-line)
+     (when (looking-at-p org-planning-line-re) (forward-line)))
    (unless (looking-at-p org-property-drawer-re)
      ;; Make sure we start editing a line from current entry, not from
      ;; next one.  It prevents extending text properties or overlays
@@ -13376,7 +13075,7 @@ drawer is immediately hidden."
           (inhibit-read-only t))
        (unless (bobp) (insert "\n"))
        (insert ":PROPERTIES:\n:END:")
-       (org-flag-region (line-end-position 0) (point) t 'outline)
+       (org-fold-region (line-end-position 0) (point) t (if (eq 
org-fold-core-style 'text-properties) 'drawer 'outline))
        (when (or (eobp) (= begin (point-min))) (insert "\n"))
        (org-indent-region begin (point))))))
 
@@ -13685,10 +13384,11 @@ completion."
     (beginning-of-line 1)
     (skip-chars-forward " \t")
     (when (equal prop org-effort-property)
-      (org-refresh-property
-       '((effort . identity)
-        (effort-minutes . org-duration-to-minutes))
-       nval)
+      (unless (org-element--cache-active-p)
+        (org-refresh-property
+         '((effort . identity)
+          (effort-minutes . org-duration-to-minutes))
+         nval))
       (when (string= org-clock-current-task heading)
        (setq org-clock-effort nval)
        (org-clock-update-mode-line)))
@@ -13948,6 +13648,9 @@ The function understands only English month and weekday 
abbreviations.
 While prompting, a calendar is popped up - you can also select the
 date with the mouse (button 1).  The calendar shows a period of three
 months.  To scroll it to other months, use the keys `>' and `<'.
+There are many other calendar navigation commands available, see
+Info node `(org) The date/time prompt' for a full list.
+
 If you don't like the calendar, turn it off with
        (setq org-read-date-popup-calendar nil)
 
@@ -13983,7 +13686,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 (org-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")
@@ -14056,7 +13759,7 @@ user."
                 "range representable on this machine"))
       (ding))
 
-    (setq final (apply #'encode-time final))
+    (setq final (org-encode-time final))
 
     (setq org-read-date-final-answer ans)
 
@@ -14079,23 +13782,20 @@ user."
       (save-excursion
        (end-of-line 1)
        (while (not (equal (buffer-substring
-                           (max (point-min) (- (point) 4)) (point))
-                          "    "))
+                         (max (point-min) (- (point) 4)) (point))
+                        "    "))
          (insert " ")))
       (let* ((ans (concat (buffer-substring (line-beginning-position)
                                             (point-max))
                          " " (or org-ans1 org-ans2)))
             (org-end-time-was-given nil)
             (f (org-read-date-analyze ans org-def org-defdecode))
-            (fmts (if org-display-custom-times
-                      org-time-stamp-custom-formats
-                    org-time-stamp-formats))
-            (fmt (if (or org-with-time
-                         (and (boundp 'org-time-was-given) org-time-was-given))
-                     (cdr fmts)
-                   (car fmts)))
-            (txt (format-time-string fmt (apply #'encode-time f)))
-            (txt (if org-read-date-inactive (concat "[" (substring txt 1 -1) 
"]") txt))
+            (fmt (org-time-stamp-format
+                   (or org-with-time
+                       (and (boundp 'org-time-was-given) org-time-was-given))
+                   org-read-date-inactive
+                   org-display-custom-times))
+            (txt (format-time-string fmt (org-encode-time f)))
             (txt (concat "=> " txt)))
        (when (and org-end-time-was-given
                   (string-match org-plain-time-of-day-regexp txt))
@@ -14305,14 +14005,18 @@ user."
       (unless deltadef
        (let ((now (decode-time)))
          (setq day (nth 3 now) month (nth 4 now) year (nth 5 now))))
-      (cond ((member deltaw '("d" "")) (setq day (+ day deltan)))
-           ((equal deltaw "w") (setq day (+ day (* 7 deltan))))
-           ((equal deltaw "m") (setq month (+ month deltan)))
-           ((equal deltaw "y") (setq year (+ year deltan)))))
+      (cond ((member deltaw '("h" ""))
+             (when (boundp 'org-time-was-given)
+               (setq org-time-was-given t))
+             (setq hour (+ hour deltan)))
+            ((member deltaw '("d" "")) (setq day (+ day deltan)))
+            ((equal deltaw "w") (setq day (+ day (* 7 deltan))))
+            ((equal deltaw "m") (setq month (+ month deltan)))
+            ((equal deltaw "y") (setq year (+ year deltan)))))
      ((and wday (not (nth 3 tl)))
       ;; Weekday was given, but no day, so pick that day in the week
       ;; on or after the derived date.
-      (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year))))
+      (setq wday1 (nth 6 (decode-time (org-encode-time 0 0 0 day month year))))
       (unless (equal wday wday1)
        (setq day (+ day (% (- wday wday1 -7) 7))))))
     (when (and (boundp 'org-time-was-given)
@@ -14327,12 +14031,12 @@ user."
          (when (> year 2037)
            (setq year 2037 org-read-date-analyze-forced-year t)))
       (condition-case nil
-         (ignore (encode-time second minute hour day month year))
+         (ignore (org-encode-time second minute hour day month year))
        (error
         (setq year (nth 5 org-defdecode))
         (setq org-read-date-analyze-forced-year t))))
     (setq org-read-date-analyze-futurep futurep)
-    (list second minute hour day month year)))
+    (list second minute hour day month year nil -1 nil)))
 
 (defvar parse-time-weekdays)
 (defun org-read-date-get-relative (s today default)
@@ -14345,12 +14049,14 @@ DEF-FLAG   is t when a double ++ or -- indicates 
shift relative to
            the DEFAULT date rather than TODAY."
   (require 'parse-time)
   (when (and
-        (string-match
-         (concat
-          "\\`[ \t]*\\([-+]\\{0,2\\}\\)"
-          "\\([0-9]+\\)?"
-          "\\([hdwmy]\\|\\(" (mapconcat 'car parse-time-weekdays "\\|") 
"\\)\\)?"
-          "\\([ \t]\\|$\\)") s)
+         ;; Force case-insensitive.
+         (let ((case-fold-search t))
+          (string-match
+           (concat
+            "\\`[ \t]*\\([-+]\\{0,2\\}\\)"
+            "\\([0-9]+\\)?"
+            "\\([hdwmy]\\|\\(" (mapconcat 'car parse-time-weekdays "\\|") 
"\\)\\)?"
+            "\\([ \t]\\|$\\)") s))
         (or (> (match-end 1) (match-beginning 1)) (match-end 4)))
     (let* ((dir (if (> (match-end 1) (match-beginning 1))
                    (string-to-char (substring (match-string 1 s) -1))
@@ -14389,10 +14095,10 @@ Unless KEEPDATE is non-nil, update `org-ans2' to the 
cursor date."
   (let ((sf (selected-frame))
        (sw (selected-window)))
     (select-window (get-buffer-window "*Calendar*" t))
-    (eval form)
+    (eval form t)
     (when (and (not keepdate) (calendar-cursor-to-date))
       (let* ((date (calendar-cursor-to-date))
-            (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
+            (time (org-encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 
date))))
        (setq org-ans2 (format-time-string "%Y-%m-%d" time))))
     (move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
     (select-window sw)
@@ -14404,7 +14110,7 @@ This is used by `org-read-date' in a temporary keymap 
for the calendar buffer."
   (interactive)
   (when (calendar-cursor-to-date)
     (let* ((date (calendar-cursor-to-date))
-          (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
+          (time (org-encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 
date))))
       (setq org-ans1 (format-time-string "%Y-%m-%d" time)))
     (when (active-minibuffer-window) (exit-minibuffer))))
 
@@ -14417,23 +14123,23 @@ stamp will not contribute to the agenda.
 PRE and POST are optional strings to be inserted before and after the
 stamp.
 The command returns the inserted time stamp."
-  (let ((fmt (funcall (if with-hm 'cdr 'car) org-time-stamp-formats))
-       stamp)
-    (when inactive (setq fmt (concat "[" (substring fmt 1 -1) "]")))
-    (insert-before-markers (or pre ""))
-    (when (listp extra)
-      (setq extra (car extra))
-      (if (and (stringp extra)
-              (string-match "\\([0-9]+\\):\\([0-9]+\\)" extra))
-         (setq extra (format "-%02d:%02d"
-                             (string-to-number (match-string 1 extra))
-                             (string-to-number (match-string 2 extra))))
-       (setq extra nil)))
-    (when extra
-      (setq fmt (concat (substring fmt 0 -1) extra (substring fmt -1))))
-    (insert-before-markers (setq stamp (format-time-string fmt time)))
-    (insert-before-markers (or post ""))
-    (setq org-last-inserted-timestamp stamp)))
+  (org-fold-core-ignore-modifications
+    (let ((fmt (org-time-stamp-format with-hm inactive))
+         stamp)
+      (insert-before-markers-and-inherit (or pre ""))
+      (when (listp extra)
+        (setq extra (car extra))
+        (if (and (stringp extra)
+                (string-match "\\([0-9]+\\):\\([0-9]+\\)" extra))
+           (setq extra (format "-%02d:%02d"
+                               (string-to-number (match-string 1 extra))
+                               (string-to-number (match-string 2 extra))))
+         (setq extra nil)))
+      (when extra
+        (setq fmt (concat (substring fmt 0 -1) extra (substring fmt -1))))
+      (insert-before-markers-and-inherit (setq stamp (format-time-string fmt 
time)))
+      (insert-before-markers-and-inherit (or post ""))
+      (setq org-last-inserted-timestamp stamp))))
 
 (defun org-toggle-time-stamp-overlays ()
   "Toggle the use of custom time stamp formats."
@@ -14464,11 +14170,10 @@ The command returns the inserted time stamp."
        (setq off (- (match-end 0) (match-beginning 0)))))
     (setq end (- end off))
     (setq with-hm (and (nth 1 t1) (nth 2 t1))
-         tf (funcall (if with-hm 'cdr 'car) org-time-stamp-custom-formats)
+         tf (org-time-stamp-format with-hm 'no-brackets 'custom)
          time (org-fix-decoded-time t1)
          str (org-add-props
-                 (format-time-string
-                  (substring tf 1 -1) (apply 'encode-time time))
+                 (format-time-string tf (org-encode-time time))
                  nil 'mouse-face 'highlight))
     (put-text-property beg end 'display str)))
 
@@ -14522,7 +14227,7 @@ This is used by `org-read-date' in a temporary keymap 
for the calendar buffer."
   (mouse-set-point ev)
   (when (calendar-cursor-to-date)
     (let* ((date (calendar-cursor-to-date))
-          (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
+          (time (org-encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 
date))))
       (setq org-ans1 (format-time-string "%Y-%m-%d" time)))
     (when (active-minibuffer-window) (exit-minibuffer))))
 
@@ -14723,13 +14428,13 @@ 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)))
+  (org-encode-time (org-parse-time-string s)))
 
 (defun org-time-string-to-seconds (s)
   "Convert a timestamp string S into a number of seconds."
   (float-time (org-time-string-to-time s)))
 
-(org-define-error 'org-diary-sexp-no-match "Unable to match diary sexp")
+(define-error 'org-diary-sexp-no-match "Unable to match diary sexp")
 
 (defun org-time-string-to-absolute (s &optional daynr prefer buffer pos)
   "Convert time stamp S to an absolute day number.
@@ -14786,7 +14491,7 @@ into a past one.  Any year larger than 99 is returned 
unchanged."
   "Return the time corresponding to date D.
 D may be an absolute day number, or a calendar-type list (month day year)."
   (when (numberp d) (setq d (calendar-gregorian-from-absolute d)))
-  (encode-time 0 0 0 (nth 1 d) (car d) (nth 2 d)))
+  (org-encode-time 0 0 0 (nth 1 d) (car d) (nth 2 d)))
 
 (defvar org-agenda-current-date)
 (defun org-calendar-holiday ()
@@ -14795,30 +14500,40 @@ D may be an absolute day number, or a calendar-type 
list (month day year)."
   (let ((hl (calendar-check-holidays org-agenda-current-date)))
     (and hl (mapconcat #'identity hl "; "))))
 
+(defvar org--diary-sexp-entry-cache (make-hash-table :test #'equal)
+  "Hash table holding return values of `org-diary-sexp-entry'.")
 (defun org-diary-sexp-entry (sexp entry d)
   "Process a SEXP diary ENTRY for date D."
   (require 'diary-lib)
   ;; `org-anniversary' and alike expect ENTRY and DATE to be bound
   ;; dynamically.
-  (let* ((sexp `(let ((entry ,entry)
-                     (date ',d))
-                 ,(car (read-from-string sexp))))
-        (result (if calendar-debug-sexp (eval sexp)
-                  (condition-case nil
-                      (eval sexp)
-                    (error
-                     (beep)
-                     (message "Bad sexp at line %d in %s: %s"
-                              (org-current-line)
-                              (buffer-file-name) sexp)
-                     (sleep-for 2))))))
-    (cond ((stringp result) (split-string result "; "))
-         ((and (consp result)
-               (not (consp (cdr result)))
-               (stringp (cdr result))) (cdr result))
-         ((and (consp result)
-               (stringp (car result))) result)
-         (result entry))))
+  (let ((cached (gethash (list sexp entry d) org--diary-sexp-entry-cache 
'none)))
+    (if (not (eq 'none cached)) cached
+      (puthash (list sexp entry d)
+               (let* ((sexp `(let ((entry ,entry)
+                                  (date ',d))
+                              ,(car (read-from-string sexp))))
+                      ;; FIXME: Do not use (eval ... t) in the following sexp 
as
+                      ;; diary vars are still using dynamic scope.
+                     (result (if calendar-debug-sexp (eval sexp)
+                               (condition-case nil
+                                   (eval sexp)
+                                 (error
+                                  (beep)
+                                  (message "Bad sexp at line %d in %s: %s"
+                                           (org-current-line)
+                                           (buffer-file-name) sexp)
+                                  (sleep-for 2))))))
+                 (cond ((stringp result) (split-string result "; "))
+                      ((and (consp result)
+                            (not (consp (cdr result)))
+                            (stringp (cdr result)))
+                       (cdr result))
+                      ((and (consp result)
+                            (stringp (car result)))
+                       result)
+                      (result entry)))
+               org--diary-sexp-entry-cache))))
 
 (defun org-diary-to-ical-string (frombuf)
   "Get iCalendar entries from diary entries in buffer FROMBUF.
@@ -15138,14 +14853,15 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays 
like
          (setcar (cdr time0) (+ (nth 1 time0)
                                 (if (> n 0) (- rem) (- dm rem))))))
       (setq time
-           (apply #'encode-time
-                  (or (car time0) 0)
-                  (+ (if (eq timestamp? 'minute) n 0) (nth 1 time0))
-                  (+ (if (eq timestamp? 'hour) n 0)   (nth 2 time0))
-                  (+ (if (eq timestamp? 'day) n 0)    (nth 3 time0))
-                  (+ (if (eq timestamp? 'month) n 0)  (nth 4 time0))
-                  (+ (if (eq timestamp? 'year) n 0)   (nth 5 time0))
-                  (nthcdr 6 time0)))
+           (org-encode-time
+             (apply #'list
+                    (or (car time0) 0)
+                    (+ (if (eq timestamp? 'minute) n 0) (nth 1 time0))
+                    (+ (if (eq timestamp? 'hour) n 0)   (nth 2 time0))
+                    (+ (if (eq timestamp? 'day) n 0)    (nth 3 time0))
+                    (+ (if (eq timestamp? 'month) n 0)  (nth 4 time0))
+                    (+ (if (eq timestamp? 'year) n 0)   (nth 5 time0))
+                    (nthcdr 6 time0))))
       (when (and (memq timestamp? '(hour minute))
                 extra
                 (string-match "-\\([012][0-9]\\):\\([0-5][0-9]\\)" extra))
@@ -15163,7 +14879,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 (org-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).
@@ -15217,7 +14933,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like
                  (message "No clock to adjust")
                (save-excursion
                  (org-goto-marker-or-bmk clfixpos)
-                 (org-show-subtree)
+                 (org-fold-show-subtree)
                  (when (re-search-forward clrgx nil t)
                    (goto-char (match-beginning 1))
                    (let (org-clock-adjust-closest)
@@ -15309,7 +15025,7 @@ If there is already a time stamp at the cursor 
position, update it."
       (org-timestamp-change 0 'calendar)
     (let ((cal-date (org-get-date-from-calendar)))
       (org-insert-time-stamp
-       (encode-time 0 0 0 (nth 1 cal-date) (car cal-date) (nth 2 cal-date))))))
+       (org-encode-time 0 0 0 (nth 1 cal-date) (car cal-date) (nth 2 
cal-date))))))
 
 (defcustom org-image-actual-width t
   "When non-nil, use the actual width of images when inlining them.
@@ -15420,44 +15136,6 @@ prefix, restrict available buffers to agenda files."
                      (mapcar #'list (mapcar #'buffer-name blist))
                      nil t))))
 
-(defun org-buffer-list (&optional predicate exclude-tmp)
-  "Return a list of Org buffers.
-PREDICATE can be `export', `files' or `agenda'.
-
-export   restrict the list to Export buffers.
-files    restrict the list to buffers visiting Org files.
-agenda   restrict the list to buffers visiting agenda files.
-
-If EXCLUDE-TMP is non-nil, ignore temporary buffers."
-  (let* ((bfn nil)
-        (agenda-files (and (eq predicate 'agenda)
-                           (mapcar 'file-truename (org-agenda-files t))))
-        (filter
-         (cond
-          ((eq predicate 'files)
-           (lambda (b) (with-current-buffer b (derived-mode-p 'org-mode))))
-          ((eq predicate 'export)
-           (lambda (b) (string-match "\\*Org .*Export" (buffer-name b))))
-          ((eq predicate 'agenda)
-           (lambda (b)
-             (with-current-buffer b
-               (and (derived-mode-p 'org-mode)
-                    (setq bfn (buffer-file-name b))
-                    (member (file-truename bfn) agenda-files)))))
-          (t (lambda (b) (with-current-buffer b
-                           (or (derived-mode-p 'org-mode)
-                               (string-match "\\*Org .*Export"
-                                             (buffer-name b)))))))))
-    (delq nil
-         (mapcar
-          (lambda(b)
-            (if (and (funcall filter b)
-                     (or (not exclude-tmp)
-                         (not (string-match "tmp" (buffer-name b)))))
-                b
-              nil))
-          (buffer-list)))))
-
 (defun org-agenda-files (&optional unrestricted archives)
   "Get the list of agenda files.
 Optional UNRESTRICTED means return the full list even if a restriction
@@ -15667,72 +15345,56 @@ When a buffer is unmodified, it is just killed.  When 
modified, it is saved
 (defun org-agenda-prepare-buffers (files)
   "Create buffers for all agenda files, protect archived trees and comments."
   (interactive)
-  (let ((pa '(:org-archived t))
-       (pc '(:org-comment t))
-       (pall '(:org-archived t :org-comment t))
-       (inhibit-read-only t)
+  (let ((inhibit-read-only t)
        (org-inhibit-startup org-agenda-inhibit-startup)
-       (rea (org-make-tag-string (list org-archive-tag)))
-       re pos)
+        ;; Do not refresh list of agenda files in the menu when
+        ;; opening every new file.
+        (org-agenda-file-menu-enabled nil))
     (setq org-tag-alist-for-agenda nil
          org-tag-groups-alist-for-agenda nil)
-    (save-excursion
-      (save-restriction
-       (dolist (file files)
-         (catch 'nextfile
-           (if (bufferp file)
-               (set-buffer file)
-             (org-check-agenda-file file)
-             (set-buffer (org-get-agenda-file-buffer file)))
-           (widen)
-           (org-set-regexps-and-options 'tags-only)
-           (setq pos (point))
-           (or (memq 'category org-agenda-ignore-properties)
-               (org-refresh-category-properties))
-           (or (memq 'stats org-agenda-ignore-properties)
-               (org-refresh-stats-properties))
-           (or (memq 'effort org-agenda-ignore-properties)
-               (org-refresh-effort-properties))
-           (or (memq 'appt org-agenda-ignore-properties)
-               (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime))
-           (setq org-todo-keywords-for-agenda
-                 (append org-todo-keywords-for-agenda org-todo-keywords-1))
-           (setq org-done-keywords-for-agenda
-                 (append org-done-keywords-for-agenda org-done-keywords))
-           (setq org-todo-keyword-alist-for-agenda
-                 (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
-           (setq org-tag-alist-for-agenda
-                 (org--tag-add-to-alist
-                  org-tag-alist-for-agenda
-                  org-current-tag-alist))
-           ;; Merge current file's tag groups into global
-           ;; `org-tag-groups-alist-for-agenda'.
-           (when org-group-tags
-             (dolist (alist org-tag-groups-alist)
-               (let ((old (assoc (car alist) org-tag-groups-alist-for-agenda)))
-                 (if old
-                     (setcdr old (org-uniquify (append (cdr old) (cdr alist))))
-                   (push alist org-tag-groups-alist-for-agenda)))))
-           (with-silent-modifications
-             (save-excursion
-               (remove-text-properties (point-min) (point-max) pall)
-               (when org-agenda-skip-archived-trees
-                 (goto-char (point-min))
-                 (while (re-search-forward rea nil t)
-                   (when (org-at-heading-p t)
-                      (add-text-properties (line-beginning-position)
-                                           (org-end-of-subtree t) pa))))
-               (goto-char (point-min))
-               (setq re (format "^\\*+ .*\\<%s\\>" org-comment-string))
-               (while (re-search-forward re nil t)
-                 (when (save-match-data (org-in-commented-heading-p t))
-                   (add-text-properties
-                    (match-beginning 0) (org-end-of-subtree t) pc)))))
-           (goto-char pos)))))
-    (setq org-todo-keywords-for-agenda
-          (org-uniquify org-todo-keywords-for-agenda))
-    (setq org-todo-keyword-alist-for-agenda
-         (org-uniquify org-todo-keyword-alist-for-agenda))))
+    (dolist (file files)
+      (catch 'nextfile
+        (with-current-buffer
+            (if (bufferp file)
+                file
+              (org-check-agenda-file file)
+              (org-get-agenda-file-buffer file))
+          (org-with-wide-buffer
+          (org-set-regexps-and-options 'tags-only)
+          (or (memq 'category org-agenda-ignore-properties)
+              (org-refresh-category-properties))
+          (or (memq 'stats org-agenda-ignore-properties)
+              (org-refresh-stats-properties))
+          (or (memq 'effort org-agenda-ignore-properties)
+               (unless org-element-use-cache
+                (org-refresh-effort-properties)))
+          (or (memq 'appt org-agenda-ignore-properties)
+              (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime))
+           (dolist (el org-todo-keywords-1)
+             (unless (member el org-todo-keywords-for-agenda)
+               (push el org-todo-keywords-for-agenda)))
+           (dolist (el org-done-keywords)
+             (unless (member el org-done-keywords-for-agenda)
+               (push el org-done-keywords-for-agenda)))
+          (setq org-todo-keyword-alist-for-agenda
+                 (org--tag-add-to-alist
+                 org-todo-key-alist
+                  org-todo-keyword-alist-for-agenda))
+          (setq org-tag-alist-for-agenda
+                (org--tag-add-to-alist
+                 org-current-tag-alist
+                  org-tag-alist-for-agenda))
+          ;; Merge current file's tag groups into global
+          ;; `org-tag-groups-alist-for-agenda'.
+          (when org-group-tags
+            (dolist (alist org-tag-groups-alist)
+              (let ((old (assoc (car alist) org-tag-groups-alist-for-agenda)))
+                (if old
+                    (setcdr old (org-uniquify (append (cdr old) (cdr alist))))
+                  (push alist org-tag-groups-alist-for-agenda)))))))))
+    ;; Refresh the menu once after loading all the agenda buffers.
+    (when org-agenda-file-menu-enabled
+      (org-install-agenda-files-menu))))
 
 
 ;;;; CDLaTeX minor mode
@@ -15761,25 +15423,29 @@ in Org mode.
     (cdlatex-compute-tables))
   (unless org-cdlatex-texmathp-advice-is-done
     (setq org-cdlatex-texmathp-advice-is-done t)
-    (defadvice texmathp (around org-math-always-on activate)
-      "Always return t in Org buffers.
+    (advice-add 'texmathp :around #'org--math-always-on)))
+
+(defun org--math-always-on (orig-fun &rest args)
+  "Always return t in Org buffers.
 This is because we want to insert math symbols without dollars even outside
 the LaTeX math segments.  If Org mode thinks that point is actually inside
 an embedded LaTeX fragment, let `texmathp' do its job.
 `\\[org-cdlatex-mode-map]'"
-      (interactive)
-      (let (p)
-       (cond
-        ((not (derived-mode-p 'org-mode)) ad-do-it)
-        ((eq this-command 'cdlatex-math-symbol)
-         (setq ad-return-value t
-               texmathp-why '("cdlatex-math-symbol in org-mode" . 0)))
-        (t
-         (let ((p (org-inside-LaTeX-fragment-p)))
-           (if (and p (member (car p) (plist-get org-format-latex-options 
:matchers)))
-               (setq ad-return-value t
-                     texmathp-why '("Org mode embedded math" . 0))
-             (when p ad-do-it)))))))))
+  (interactive)
+  (cond
+   ((not (derived-mode-p 'org-mode)) (apply orig-fun args))
+   ((eq this-command 'cdlatex-math-symbol)
+    (setq texmathp-why '("cdlatex-math-symbol in org-mode" . 0))
+    t)
+   (t
+    (let ((p (org-inside-LaTeX-fragment-p)))
+      (when p ;; FIXME: Shouldn't we return t when `p' is nil?
+       (if (member (car p)
+                   (plist-get org-format-latex-options :matchers))
+           (progn
+             (setq texmathp-why '("Org mode embedded math" . 0))
+             t)
+         (apply orig-fun args)))))))
 
 (defun turn-on-org-cdlatex ()
   "Unconditionally turn on `org-cdlatex-mode'."
@@ -15982,7 +15648,8 @@ BEG and END are buffer positions."
 If the cursor is on a LaTeX fragment, create the image and
 overlay it over the source code, if there is none.  Remove it
 otherwise.  If there is no fragment at point, display images for
-all fragments in the current section.
+all fragments in the current section.  With an active region,
+display images for all fragments in the region.
 
 With a `\\[universal-argument]' prefix argument ARG, clear images \
 for all fragments
@@ -16010,10 +15677,18 @@ fragments in the buffer."
    ;; Clear current section.
    ((equal arg '(4))
     (org-clear-latex-preview
-     (if (org-before-first-heading-p) (point-min)
-       (save-excursion
-        (org-with-limited-levels (org-back-to-heading t) (point))))
-     (org-with-limited-levels (org-entry-end-position))))
+     (if (use-region-p)
+         (region-beginning)
+       (if (org-before-first-heading-p) (point-min)
+         (save-excursion
+          (org-with-limited-levels (org-back-to-heading t) (point)))))
+     (if (use-region-p)
+         (region-end)
+       (org-with-limited-levels (org-entry-end-position)))))
+   ((use-region-p)
+    (message "Creating LaTeX previews in region...")
+    (org--latex-preview-region (region-beginning) (region-end))
+    (message "Creating LaTeX previews in region... done."))
    ;; Toggle preview on LaTeX code at point.
    ((let ((datum (org-element-context)))
       (and (memq (org-element-type datum) '(latex-environment latex-fragment))
@@ -16314,7 +15989,6 @@ a HTML file."
               org-format-latex-header
               'snippet)))
         (latex-compiler (plist-get processing-info :latex-compiler))
-        (image-converter (plist-get processing-info :image-converter))
         (tmpdir temporary-file-directory)
         (texfilebase (make-temp-name
                       (expand-file-name "orgtex" tmpdir)))
@@ -16323,12 +15997,16 @@ a HTML file."
                                '(1.0 . 1.0)))
         (scale (* (if buffer (car image-size-adjust) (cdr image-size-adjust))
                   (or (plist-get options (if buffer :scale :html-scale)) 1.0)))
-        (dpi (* scale (if buffer (org--get-display-dpi) 140.0)))
+        (dpi (* scale (if (and buffer (display-graphic-p)) 
(org--get-display-dpi) 140.0)))
         (fg (or (plist-get options (if buffer :foreground :html-foreground))
                 "Black"))
         (bg (or (plist-get options (if buffer :background :html-background))
                 "Transparent"))
-        (log-buf (get-buffer-create "*Org Preview LaTeX Output*"))
+        (image-converter
+          (or (and (string= bg "Transparent")
+                   (plist-get processing-info :transparent-image-converter))
+              (plist-get processing-info :image-converter)))
+         (log-buf (get-buffer-create "*Org Preview LaTeX Output*"))
         (resize-mini-windows nil)) ;Fix Emacs flicker when creating image.
     (dolist (program programs)
       (org-check-external-command program error-message))
@@ -16460,21 +16138,32 @@ SNIPPETS-P indicates if this is run to create snippet 
images for HTML."
 
 (defvar-local org-inline-image-overlays nil)
 
-(defun org-toggle-inline-images (&optional include-linked)
+(defun org--inline-image-overlays (&optional beg end)
+  "Return image overlays between BEG and END."
+  (let* ((beg (or beg (point-min)))
+         (end (or end (point-max)))
+         (overlays (overlays-in beg end))
+         result)
+    (dolist (ov overlays result)
+      (when (memq ov org-inline-image-overlays)
+        (push ov result)))))
+
+(defun org-toggle-inline-images (&optional include-linked beg end)
   "Toggle the display of inline images.
 INCLUDE-LINKED is passed to `org-display-inline-images'."
   (interactive "P")
-  (if org-inline-image-overlays
+  (if (org--inline-image-overlays beg end)
       (progn
-       (org-remove-inline-images)
-       (when (called-interactively-p 'interactive)
+        (org-remove-inline-images beg end)
+        (when (called-interactively-p 'interactive)
          (message "Inline image display turned off")))
-    (org-display-inline-images include-linked)
+    (org-display-inline-images include-linked nil beg end)
     (when (called-interactively-p 'interactive)
-      (message (if org-inline-image-overlays
-                  (format "%d images displayed inline"
-                          (length org-inline-image-overlays))
-                "No images to display inline")))))
+      (let ((new (org--inline-image-overlays beg end)))
+        (message (if new
+                    (format "%d images displayed inline"
+                            (length new))
+                  "No images to display inline"))))))
 
 (defun org-redisplay-inline-images ()
   "Assure display of inline images and refresh them."
@@ -16529,7 +16218,7 @@ according to the value of 
`org-display-remote-inline-images'."
                         width
                         'imagemagick)
                    remote?
-                   :width width))))
+                   :width width :scale 1))))
 
 (defun org-display-inline-images (&optional include-linked refresh beg end)
   "Display inline images.
@@ -16559,8 +16248,8 @@ BEG and END define the considered part.  They default 
to the
 buffer boundaries with possible narrowing."
   (interactive "P")
   (when (display-graphic-p)
-    (unless refresh
-      (org-remove-inline-images)
+    (when refresh
+      (org-remove-inline-images beg end)
       (when (fboundp 'clear-image-cache) (clear-image-cache)))
     (let ((end (or end (point-max))))
       (org-with-point-at (or beg (point-min))
@@ -16635,6 +16324,10 @@ buffer boundaries with possible narrowing."
                                          (org-element-property :end link))
                                         (skip-chars-backward " \t")
                                         (point)))))
+                              ;; FIXME: See bug#59902.  We cannot rely
+                              ;; on Emacs to update image if the file
+                              ;; has changed.
+                              (image-flush image)
                              (overlay-put ov 'display image)
                              (overlay-put ov 'face 'default)
                              (overlay-put ov 'org-image-overlay t)
@@ -16658,66 +16351,94 @@ buffer boundaries with possible narrowing."
   If the value is a float between 0 and 2, it interpreted as that proportion
   of the text width in the buffer."
   ;; Apply `org-image-actual-width' specifications.
-  (cond
-   ((eq org-image-actual-width t) nil)
-   ((listp org-image-actual-width)
-    (let* ((case-fold-search t)
-           (par (org-element-lineage link '(paragraph)))
-           (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)")
-           (par-end (org-element-property :post-affiliated par))
-           ;; Try to find an attribute providing a :width.
-           (attr-width
-            (when (and par (org-with-point-at
-                               (org-element-property :begin par)
-                             (re-search-forward attr-re par-end t)))
-              (match-string 1)))
-           (attr-width-val
-            (cond
-             ((null attr-width) nil)
-             ((string-match-p "\\`[0-9.]+%" attr-width)
-              (/ (string-to-number attr-width) 100.0))
-             (t (string-to-number attr-width))))
-           ;; Fallback to `org-image-actual-width' if no explicit width is 
given.
-           (width (or attr-width-val (car org-image-actual-width))))
-      (if (and (floatp width) (<= 0.0 width 2.0))
-          ;; A float in [0,2] should be interpereted as this portion of
-          ;; the text width in the window.  This works well with cases like
-          ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width,
-          ;; as the "0.X" is pulled out as a float.  We use 2 as the upper
-          ;; bound as cases such as 1.2\linewidth are feasible.
-          (round (* width
-                    (window-pixel-width)
-                    (/ (or (and (bound-and-true-p visual-fill-column-mode)
-                                (or visual-fill-column-width 
auto-fill-function))
-                           (when auto-fill-function fill-column)
-                           (window-text-width))
-                       (float (window-total-width)))))
-        width)))
-   ((numberp org-image-actual-width)
-    org-image-actual-width)
-   (t nil)))
+  ;; Support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified
+  ;; width.
+  (let ((org-image-actual-width (org-property-or-variable-value 
'org-image-actual-width)))
+    (cond
+     ((eq org-image-actual-width t) nil)
+     ((listp org-image-actual-width)
+      (let* ((case-fold-search t)
+             (par (org-element-lineage link '(paragraph)))
+             (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)")
+             (par-end (org-element-property :post-affiliated par))
+             ;; Try to find an attribute providing a :width.
+             (attr-width
+              (when (and par (org-with-point-at
+                                 (org-element-property :begin par)
+                               (re-search-forward attr-re par-end t)))
+                (match-string 1)))
+             (width
+              (cond
+               ;; Treat :width t as if `org-image-actual-width' were t.
+               ((string= attr-width "t") nil)
+               ;; Fallback to `org-image-actual-width' if no interprable width 
is given.
+               ((or (null attr-width)
+                    (string-match-p "\\`[^0-9]" attr-width))
+                (car org-image-actual-width))
+               ;; Convert numeric widths to numbers, converting percentages.
+               ((string-match-p "\\`[0-9.]+%" attr-width)
+                (/ (string-to-number attr-width) 100.0))
+               (t (string-to-number attr-width)))))
+        (if (and (floatp width) (<= 0.0 width 2.0))
+            ;; A float in [0,2] should be interpereted as this portion of
+            ;; the text width in the window.  This works well with cases like
+            ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width,
+            ;; as the "0.X" is pulled out as a float.  We use 2 as the upper
+            ;; bound as cases such as 1.2\linewidth are feasible.
+            (round (* width
+                      (window-pixel-width)
+                      (/ (or (and (bound-and-true-p visual-fill-column-mode)
+                                  (or visual-fill-column-width 
auto-fill-function))
+                             (when auto-fill-function fill-column)
+                             (- (window-text-width) 
(line-number-display-width)))
+                         (float (window-total-width)))))
+          width)))
+     ((numberp org-image-actual-width)
+      org-image-actual-width)
+     (t nil))))
 
 (defun org-display-inline-remove-overlay (ov after _beg _end &optional _len)
   "Remove inline-display overlay if a corresponding region is modified."
   (when (and ov after)
     (delete ov org-inline-image-overlays)
+    ;; Clear image from cache to avoid image not updating upon
+    ;; changing on disk.  See Emacs bug#59902.
+    (when (overlay-get ov 'org-image-overlay)
+      (image-flush (overlay-get ov 'display)))
     (delete-overlay ov)))
 
-(defun org-remove-inline-images ()
+(defun org-remove-inline-images (&optional beg end)
   "Remove inline display of images."
   (interactive)
-  (mapc #'delete-overlay org-inline-image-overlays)
-  (setq org-inline-image-overlays nil))
+  (let* ((beg (or beg (point-min)))
+         (end (or end (point-max)))
+         (overlays (overlays-in beg end)))
+    (dolist (ov overlays)
+      (when (memq ov org-inline-image-overlays)
+        (setq org-inline-image-overlays (delq ov org-inline-image-overlays))
+        (delete-overlay ov)))
+    ;; Clear removed overlays.
+    (dolist (ov org-inline-image-overlays)
+      (unless (overlay-buffer ov)
+        (setq org-inline-image-overlays (delq ov 
org-inline-image-overlays))))))
 
 (defvar org-self-insert-command-undo-counter 0)
 (defvar org-speed-command nil)
 
+(defun org-fix-tags-on-the-fly ()
+  "Align tags in headline at point.
+Unlike `org-align-tags', this function does nothing if point is
+either not currently on a tagged headline or on a tag."
+  (when (and (org-match-line org-tag-line-re)
+            (< (point) (match-beginning 1)))
+    (org-align-tags)))
+
 (defun org-self-insert-command (N)
   "Like `self-insert-command', use overwrite-mode for whitespace in tables.
 If the cursor is in a table looking at whitespace, the whitespace is
 overwritten, and the table is not marked as requiring realignment."
   (interactive "p")
-  (org-check-before-invisible-edit 'insert)
+  (org-fold-check-before-invisible-edit 'insert)
   (cond
    ((and org-use-speed-commands
         (let ((kv (this-command-keys-vector)))
@@ -16731,8 +16452,8 @@ overwritten, and the table is not marked as requiring 
realignment."
       (call-interactively org-speed-command))
      ((functionp org-speed-command)
       (funcall org-speed-command))
-     ((and org-speed-command (listp org-speed-command))
-      (eval org-speed-command))
+     ((consp org-speed-command)
+      (eval org-speed-command t))
      (t (let (org-use-speed-commands)
          (call-interactively 'org-self-insert-command)))))
    ((and
@@ -16779,80 +16500,6 @@ overwritten, and the table is not marked as requiring 
realignment."
          (setq org-self-insert-command-undo-counter
                (1+ org-self-insert-command-undo-counter))))))))
 
-(defun org-check-before-invisible-edit (kind)
-  "Check if editing kind KIND would be dangerous with invisible text around.
-The detailed reaction depends on the user option `org-catch-invisible-edits'."
-  ;; First, try to get out of here as quickly as possible, to reduce overhead
-  (when (and org-catch-invisible-edits
-            (or (not (boundp 'visible-mode)) (not visible-mode))
-            (or (get-char-property (point) 'invisible)
-                (get-char-property (max (point-min) (1- (point))) 'invisible)))
-    ;; OK, we need to take a closer look.  Do not consider
-    ;; invisibility obtained through text properties (e.g., link
-    ;; fontification), as it cannot be toggled.
-    (let* ((invisible-at-point
-           (pcase (get-char-property-and-overlay (point) 'invisible)
-             (`(,_ . ,(and (pred overlayp) o)) o)))
-          ;; Assume that point cannot land in the middle of an
-          ;; overlay, or between two overlays.
-          (invisible-before-point
-           (and (not invisible-at-point)
-                (not (bobp))
-                (pcase (get-char-property-and-overlay (1- (point)) 'invisible)
-                  (`(,_ . ,(and (pred overlayp) o)) o))))
-          (border-and-ok-direction
-           (or
-            ;; Check if we are acting predictably before invisible
-            ;; text.
-            (and invisible-at-point
-                 (memq kind '(insert delete-backward)))
-            ;; Check if we are acting predictably after invisible text
-            ;; This works not well, and I have turned it off.  It seems
-            ;; better to always show and stop after invisible text.
-            ;; (and (not invisible-at-point) invisible-before-point
-            ;;  (memq kind '(insert delete)))
-            )))
-      (when (or invisible-at-point invisible-before-point)
-       (when (eq org-catch-invisible-edits 'error)
-         (user-error "Editing in invisible areas is prohibited, make them 
visible first"))
-       (if (and org-custom-properties-overlays
-                (y-or-n-p "Display invisible properties in this buffer? "))
-           (org-toggle-custom-properties-visibility)
-         ;; Make the area visible
-         (save-excursion
-           (when invisible-before-point
-             (goto-char
-              (previous-single-char-property-change (point) 'invisible)))
-           ;; Remove whatever overlay is currently making yet-to-be
-           ;; edited text invisible.  Also remove nested invisibility
-           ;; related overlays.
-           (delete-overlay (or invisible-at-point invisible-before-point))
-           (let ((origin (if invisible-at-point (point) (1- (point)))))
-             (while (pcase (get-char-property-and-overlay origin 'invisible)
-                      (`(,_ . ,(and (pred overlayp) o))
-                       (delete-overlay o)
-                       t)))))
-         (cond
-          ((eq org-catch-invisible-edits 'show)
-           ;; That's it, we do the edit after showing
-           (message
-            "Unfolding invisible region around point before editing")
-           (sit-for 1))
-          ((and (eq org-catch-invisible-edits 'smart)
-                border-and-ok-direction)
-           (message "Unfolding invisible region around point before editing"))
-          (t
-           ;; Don't do the edit, make the user repeat it in full visibility
-           (user-error "Edit in invisible region aborted, repeat to confirm 
with text visible"))))))))
-
-(defun org-fix-tags-on-the-fly ()
-  "Align tags in headline at point.
-Unlike `org-align-tags', this function does nothing if point is
-either not currently on a tagged headline or on a tag."
-  (when (and (org-match-line org-tag-line-re)
-            (< (point) (match-beginning 1)))
-    (org-align-tags)))
-
 (defun org-delete-backward-char (N)
   "Like `delete-backward-char', insert whitespace at field end in tables.
 When deleting backwards, in tables this function will insert whitespace in
@@ -16861,7 +16508,7 @@ still be marked for re-alignment if the field did fill 
the entire column,
 because, in this case the deletion might narrow the column."
   (interactive "p")
   (save-match-data
-    (org-check-before-invisible-edit 'delete-backward)
+    (org-fold-check-before-invisible-edit 'delete-backward)
     (if (and (= N 1)
             (not overwrite-mode)
             (not (org-region-active-p))
@@ -16881,7 +16528,7 @@ still be marked for re-alignment if the field did fill 
the entire column,
 because, in this case the deletion might narrow the column."
   (interactive "p")
   (save-match-data
-    (org-check-before-invisible-edit 'delete)
+    (org-fold-check-before-invisible-edit 'delete)
     (cond
      ((or (/= N 1)
          (eq (char-after) ?|)
@@ -16964,16 +16611,6 @@ must check if the context is appropriate for it to 
act.  If yes,
 it should do its thing and then return a non-nil value.  If the
 context is wrong, just do nothing and return nil.")
 
-(defvar org-tab-first-hook nil
-  "Hook for functions to attach themselves to TAB.
-See `org-ctrl-c-ctrl-c-hook' for more information.
-This hook runs as the first action when TAB is pressed, even before
-`org-cycle' messes around with the `outline-regexp' to cater for
-inline tasks and plain list item folding.
-If any function in this hook returns t, any other actions that
-would have been caused by TAB (such as table field motion or visibility
-cycling) will not occur.")
-
 (defvar org-tab-after-check-for-table-hook nil
   "Hook for functions to attach themselves to TAB.
 See `org-ctrl-c-ctrl-c-hook' for more information.
@@ -17077,11 +16714,11 @@ When ARG is a numeric prefix, show contents of this 
level."
    ((integerp arg)
     (let ((arg2 (if org-odd-levels-only (1- (* 2 arg)) arg)))
       (message "Content view to level: %d" arg)
-      (org-content (prefix-numeric-value arg2))
+      (org-cycle-content (prefix-numeric-value arg2))
       (org-cycle-show-empty-lines t)
       (setq org-cycle-global-status 'overview)
       (run-hook-with-args 'org-cycle-hook 'overview)))
-   (t (call-interactively 'org-global-cycle))))
+   (t (call-interactively 'org-cycle-global))))
 
 (defun org-shiftmetaleft ()
   "Promote subtree or delete table column.
@@ -17090,6 +16727,10 @@ Calls `org-promote-subtree', `org-outdent-item-tree', 
or
 individual commands for more information."
   (interactive)
   (cond
+   ((and (eq system-type 'darwin)
+         (or (eq org-support-shift-select 'always)
+             (and org-support-shift-select (org-region-active-p))))
+    (org-call-for-shift-select 'backward-char))
    ((run-hook-with-args-until-success 'org-shiftmetaleft-hook))
    ((org-at-table-p) (call-interactively 'org-table-delete-column))
    ((org-at-heading-p) (call-interactively 'org-promote-subtree))
@@ -17106,6 +16747,10 @@ Calls `org-demote-subtree', `org-indent-item-tree', or
 individual commands for more information."
   (interactive)
   (cond
+   ((and (eq system-type 'darwin)
+         (or (eq org-support-shift-select 'always)
+             (and org-support-shift-select (org-region-active-p))))
+    (org-call-for-shift-select 'forward-char))
    ((run-hook-with-args-until-success 'org-shiftmetaright-hook))
    ((org-at-table-p) (call-interactively 'org-table-insert-column))
    ((org-at-heading-p) (call-interactively 'org-demote-subtree))
@@ -17235,14 +16880,14 @@ this function returns t, nil otherwise."
           (setq beg (line-beginning-position))
          (beginning-of-line 2)
          (while (and (not (eobp)) ;; this is like `next-line'
-                     (get-char-property (1- (point)) 'invisible))
+                     (org-invisible-p (1- (point))))
            (beginning-of-line 2))
          (setq end (point))
          (goto-char beg)
           (goto-char (line-end-position))
          (setq end (max end (point)))
          (while (re-search-forward re end t)
-           (when (get-char-property (match-beginning 0) 'invisible)
+           (when (org-invisible-p (match-beginning 0))
              (throw 'exit t))))
        nil))))
 
@@ -17256,10 +16901,10 @@ for more information."
    ((run-hook-with-args-until-success 'org-metaup-hook))
    ((org-region-active-p)
     (let* ((a (save-excursion
-               (goto-char (min (region-beginning) (region-end)))
+               (goto-char (region-beginning))
                (line-beginning-position)))
           (b (save-excursion
-               (goto-char (max (region-beginning) (region-end)))
+               (goto-char (region-end))
                (if (bolp) (1- (point)) (line-end-position))))
           (c (save-excursion
                (goto-char a)
@@ -17289,10 +16934,10 @@ commands for more information."
    ((run-hook-with-args-until-success 'org-metadown-hook))
    ((org-region-active-p)
     (let* ((a (save-excursion
-               (goto-char (min (region-beginning) (region-end)))
+               (goto-char (region-beginning))
                (line-beginning-position)))
           (b (save-excursion
-               (goto-char (max (region-beginning) (region-end)))
+               (goto-char (region-end))
                (if (bolp) (1- (point)) (line-end-position))))
           (c (save-excursion
                (goto-char b)
@@ -17530,12 +17175,22 @@ this numeric value."
   (interactive "r")
   (let ((result ""))
     (while (/= beg end)
-      (if (invisible-p beg)
-          (setq beg (next-single-char-property-change beg 'invisible nil end))
+      (if (eq org-fold-core-style 'text-properties)
+          (progn
+            (while (org-invisible-p beg)
+             (setq beg (org-fold-next-visibility-change beg end)))
+            (let ((next (org-fold-next-visibility-change beg end)))
+             (setq result (concat result (buffer-substring beg next)))
+             (setq beg next)))
+        (when (invisible-p beg)
+         (setq beg (next-single-char-property-change beg 'invisible nil end)))
         (let ((next (next-single-char-property-change beg 'invisible nil end)))
-          (setq result (concat result (buffer-substring beg next)))
-          (setq beg next))))
-    (setq deactivate-mark t)
+         (setq result (concat result (buffer-substring beg next)))
+         (setq beg next))))
+    ;; Prevent Emacs from adding full selected text to `kill-ring'
+    ;; when `select-enable-primary' is non-nil.  This special value of
+    ;; `deactivate-mark' only works since Emacs 29.
+    (setq deactivate-mark 'dont-save)
     (kill-new result)
     (message "Visible strings have been copied to the kill ring.")))
 
@@ -17570,6 +17225,7 @@ When at a table, call the formula editor with 
`org-table-edit-formulas'.
 When in a source code block, call `org-edit-src-code'.
 When in a fixed-width region, call `org-edit-fixed-width-region'.
 When in an export block, call `org-edit-export-block'.
+When in a comment block, call `org-edit-comment-block'.
 When in a LaTeX environment, call `org-edit-latex-environment'.
 When at an INCLUDE, SETUPFILE or BIBLIOGRAPHY keyword, visit the included file.
 When at a footnote reference, call `org-edit-footnote-reference'.
@@ -17616,6 +17272,7 @@ Otherwise, return a user error."
       (`table-row (call-interactively 'org-table-edit-formulas))
       (`example-block (org-edit-src-code))
       (`export-block (org-edit-export-block))
+      (`comment-block (org-edit-comment-block))
       (`fixed-width (org-edit-fixed-width-region))
       (`latex-environment (org-edit-latex-environment))
       (`planning
@@ -17741,8 +17398,13 @@ This command does many different things, depending on 
context:
               "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))
        ((or `babel-call `inline-babel-call)
         (let ((info (org-babel-lob-get-info context)))
-          (when info (org-babel-execute-src-block nil info))))
-       (`clock (org-clock-update-time-maybe))
+          (when info (org-babel-execute-src-block nil info nil type))))
+       (`clock
+         (if (org-at-timestamp-p 'lax)
+             ;; Update the timestamp as well.  `org-timestamp-change'
+             ;; will call `org-clock-update-time-maybe'.
+             (org-timestamp-change 0 'day)
+           (org-clock-update-time-maybe)))
        (`dynamic-block
         (save-excursion
           (goto-char (org-element-property :post-affiliated context))
@@ -17902,39 +17564,20 @@ Use `\\[org-edit-special]' to edit table.el tables")))
     (org-reset-file-cache))
   (message "%s restarted" major-mode))
 
-(defun org-flag-above-first-heading (&optional arg)
-  "Hide from bob up to the first heading.
-Move point to the beginning of first heading or end of buffer."
-  (goto-char (point-min))
-  (unless (org-at-heading-p)
-    (outline-next-heading))
-  (unless (bobp)
-    (org-flag-region 1 (1- (point)) (not arg) 'outline)))
-
-(defun org-show-branches-buffer ()
-  "Show all branches in the buffer."
-  (org-flag-above-first-heading)
-  (outline-hide-sublevels 1)
-  (unless (eobp)
-    (outline-show-branches)
-    (while (outline-get-next-sibling)
-      (outline-show-branches)))
-  (goto-char (point-min)))
-
 (defun org-kill-note-or-show-branches ()
   "Abort storing current note, or show just branches."
   (interactive)
   (cond (org-finish-function
         (let ((org-note-abort t)) (funcall org-finish-function)))
        ((org-before-first-heading-p)
-        (org-show-branches-buffer)
-        (org-hide-archived-subtrees (point-min) (point-max)))
+        (org-fold-show-branches-buffer)
+        (org-fold-hide-archived-subtrees (point-min) (point-max)))
        (t
         (let ((beg (progn (org-back-to-heading) (point)))
               (end (save-excursion (org-end-of-subtree t t) (point))))
-          (outline-hide-subtree)
-          (outline-show-branches)
-          (org-hide-archived-subtrees beg end)))))
+          (org-fold-hide-subtree)
+          (org-fold-show-branches)
+          (org-fold-hide-archived-subtrees beg end)))))
 
 (defun org-delete-indentation (&optional arg)
   "Join current line to previous and fix whitespace at join.
@@ -18057,7 +17700,7 @@ object (e.g., within a comment).  In these case, you 
need to use
         (org-auto-align-tags (org-align-tags))
         (t (org--align-tags-here tags-column))) ;preserve tags column
        (end-of-line)
-       (org-show-entry)
+       (org-fold-show-entry 'hide-drawers)
        (org--newline indent arg interactive)
        (when string (save-excursion (insert (org-trim string))))))
      ;; In a list, make sure indenting keeps trailing text within.
@@ -18095,11 +17738,11 @@ level to hide."
     (call-interactively #'org-table-toggle-column-width))
    ((org-before-first-heading-p)
     (save-excursion
-      (org-flag-above-first-heading)
-      (outline-hide-sublevels (or arg 1))))
+      (org-fold-flag-above-first-heading)
+      (org-fold-hide-sublevels (or arg 1))))
    (t
-    (outline-hide-subtree)
-    (org-show-children arg))))
+    (org-fold-hide-subtree)
+    (org-fold-show-children arg))))
 
 (defun org-ctrl-c-star ()
   "Compute table, or change heading status of lines.
@@ -18147,6 +17790,9 @@ In a region:
   universal prefix argument.
 
 - If it is a plain list item, turn all plain list items into headings.
+  The checkboxes are converted to appropriate TODO or DONE keywords
+  (using `car' or `org-done-keywords' and `org-not-done-keywords' when
+  available).
 
 When converting a line into a heading, the number of stars is chosen
 such that the lines become children of the current entry.  However,
@@ -18186,7 +17832,7 @@ number of stars to add."
        ;; Case 1. Started at an heading: de-star headings.
        ((org-at-heading-p)
         (while (< (point) end)
-          (when (org-at-heading-p t)
+          (when (org-at-heading-p)
             (looking-at org-outline-regexp) (replace-match "")
             (setq toggled t))
           (forward-line)))
@@ -18205,7 +17851,15 @@ number of stars to add."
                          (org-list-to-lisp t)
                          (pcase (org-current-level)
                            (`nil 1)
-                           (l (1+ (org-reduced-level l)))))
+                           (l (1+ (org-reduced-level l))))
+                          ;; Keywords to replace checkboxes.
+                          (list
+                           ;; [X]
+                           :cbon (concat (or (car org-done-keywords) "DONE") " 
")
+                           ;; [ ]
+                           :cboff (concat (or (car org-not-done-keywords) 
"TODO") " ")
+                           ;; [-]
+                           :cbtrans (concat (or (car org-not-done-keywords) 
"TODO") " ")))
                         "\n")))
             (setq toggled t))
           (forward-line)))
@@ -18234,7 +17888,7 @@ Calls `org-insert-heading', `org-insert-item' or
 `org-table-wrap-region', depending on context.  When called with
 an argument, unconditionally call `org-insert-heading'."
   (interactive "P")
-  (org-check-before-invisible-edit 'insert)
+  (org-fold-check-before-invisible-edit 'insert)
   (or (run-hook-with-args-until-success 'org-metareturn-hook)
       (call-interactively (cond (arg #'org-insert-heading)
                                ((org-at-table-p) #'org-table-wrap-region)
@@ -18254,8 +17908,8 @@ an argument, unconditionally call `org-insert-heading'."
      ["Cycle Visibility" org-cycle :active (or (bobp) (outline-on-heading-p))]
      ["Cycle Global Visibility" org-shifttab :active (not (org-at-table-p))]
      ["Sparse Tree..." org-sparse-tree t]
-     ["Reveal Context" org-reveal t]
-     ["Show All" org-show-all t]
+     ["Reveal Context" org-fold-reveal t]
+     ["Show All" org-fold-show-all t]
      "--"
      ["Subtree to indirect buffer" org-tree-to-indirect-buffer t])
     "--"
@@ -18560,7 +18214,8 @@ such private information before sending the email.")
                            (string-match "\\(-hook\\|-function\\)\\'" 
(symbol-name v)))
                       (and
                        (get v 'custom-type) (get v 'standard-value)
-                       (not (equal (symbol-value v) (eval (car (get v 
'standard-value)))))))
+                       (not (equal (symbol-value v)
+                                   (eval (car (get v 'standard-value)) t)))))
                   (push v list)))))
         (kill-buffer (get-buffer "*Warn about privacy*"))
         list))
@@ -18576,7 +18231,6 @@ Your bug report will be posted to the Org mailing list.
       (when (re-search-backward "^\\(Subject: \\)Org mode version \\(.*?\\);[ 
\t]*\\(.*\\)" nil t)
        (replace-match "\\1[BUG] \\3 [\\2]")))))
 
-
 (defun org-install-agenda-files-menu ()
   "Install agenda file menu."
   (let ((bl (buffer-list)))
@@ -18615,7 +18269,7 @@ With prefix arg UNCOMPILED, load the uncompiled 
versions."
   (require 'loadhist)
   (let* ((org-dir     (org-find-library-dir "org"))
         (contrib-dir (or (org-find-library-dir "org-contribdir") org-dir))
-        (feature-re "^\\(org\\|ob\\|ox\\)\\(-.*\\)?")
+        (feature-re "^\\(org\\|ob\\|ox\\|ol\\|oc\\)\\(-.*\\)?")
         (remove-re (format "\\`%s\\'"
                            (regexp-opt '("org" "org-loaddefs" "org-version"))))
         (feats (delete-dups
@@ -18635,18 +18289,17 @@ With prefix arg UNCOMPILED, load the uncompiled 
versions."
                                   feats)))
                  'string-lessp)
                 (list "org-version" "org")))
-        (load-suffixes (when (boundp 'load-suffixes) load-suffixes))
         (load-suffixes (if uncompiled (reverse load-suffixes) load-suffixes))
         load-uncore load-misses)
     (setq load-misses
-         (delq 't
+         (delq t
                (mapcar (lambda (f)
                          (or (org-load-noerror-mustsuffix (concat org-dir f))
                              (and (string= org-dir contrib-dir)
                                   (org-load-noerror-mustsuffix (concat 
contrib-dir f)))
                              (and (org-load-noerror-mustsuffix (concat 
(org-find-library-dir f) f))
                                   (push f load-uncore)
-                                  't)
+                                  t)
                              f))
                        lfeat)))
     (when load-uncore
@@ -18713,7 +18366,7 @@ With prefix arg UNCOMPILED, load the uncompiled 
versions."
        (when (or (> marker (point-max)) (< marker (point-min)))
          (widen))
        (goto-char marker)
-       (org-show-context 'org-goto))
+       (org-fold-show-context 'org-goto))
     (if bookmark
        (bookmark-jump bookmark)
       (error "Cannot find location"))))
@@ -18748,10 +18401,10 @@ When ELEMENT is provided, it is considered to be 
element at point."
   (when (eq 'src-block (org-element-type element))
     (or (not inside)
         (not (or (= (line-beginning-position)
-                  (org-element-property :post-affiliated element))
-               (= (1+ (line-end-position))
-                  (- (org-element-property :end element)
-                     (org-element-property :post-blank element))))))))
+                    (org-element-property :post-affiliated element))
+                 (= (1+ (line-end-position))
+                    (- (org-element-property :end element)
+                       (org-element-property :post-blank element))))))))
 
 (defun org-context ()
   "Return a list of contexts of the current cursor position.
@@ -18787,7 +18440,7 @@ and :keyword."
         (p (point)) clist o)
     ;; First the large context
     (cond
-     ((org-at-heading-p t)
+     ((org-at-heading-p)
       (push (list :headline (line-beginning-position)
                   (line-end-position))
             clist)
@@ -18952,7 +18605,7 @@ block from point."
      regexp)))
 
 (add-hook 'occur-mode-find-occurrence-hook
-         (lambda () (when (derived-mode-p 'org-mode) (org-reveal))))
+         (lambda () (when (derived-mode-p 'org-mode) (org-fold-reveal))))
 
 (defun org-occur-link-in-agenda-files ()
   "Create a link and search for it in the agendas.
@@ -19003,14 +18656,14 @@ earliest time on the cursor date that Org treats as 
that date
     (cond
      ((eq major-mode 'calendar-mode)
       (setq date (calendar-cursor-to-date)
-           defd (encode-time 0 (or mod 0) (or hod org-extend-today-until)
-                             (nth 1 date) (nth 0 date) (nth 2 date))))
+           defd (org-encode-time 0 (or mod 0) (or hod org-extend-today-until)
+                                  (nth 1 date) (nth 0 date) (nth 2 date))))
      ((eq major-mode 'org-agenda-mode)
       (setq day (get-text-property (point) 'day))
       (when day
        (setq date (calendar-gregorian-from-absolute day)
-             defd (encode-time 0 (or mod 0) (or hod org-extend-today-until)
-                               (nth 1 date) (nth 0 date) (nth 2 date))))))
+             defd (org-encode-time 0 (or mod 0) (or hod org-extend-today-until)
+                                    (nth 1 date) (nth 0 date) (nth 2 date))))))
     (or defd (current-time))))
 
 (defun org-mark-subtree (&optional up)
@@ -19030,6 +18683,37 @@ hierarchy of headlines by UP levels before marking the 
subtree."
 
 ;;; Indentation
 
+(defun org--at-headline-data-p (&optional beg element)
+  "Return non-nil when `point' or BEG is inside headline metadata.
+
+Metadata is planning line, properties drawer, logbook drawer right
+after property drawer, or clock log line immediately following
+properties drawer/planning line/ heading.
+
+Optional argument ELEMENT contains element at BEG."
+  (org-with-wide-buffer
+   (when beg (goto-char beg))
+   (setq element (or element (org-element-at-point)))
+   (if (or (eq (org-element-type element) 'headline)
+           (not (org-element-lineage element '(headline inlinetask))))
+       nil ; Not inside heading.
+     ;; Skip to top-level parent in section.
+     (while (not (eq 'section (org-element-type (org-element-property :parent 
element))))
+       (setq element (org-element-property :parent element)))
+     (pcase (org-element-type element)
+       ((or `planning `property-drawer)
+        t)
+       (`drawer
+        ;; LOGBOOK drawer with appropriate name.
+        (equal
+         (org-log-into-drawer)
+         (org-element-property :drawer-name element)))
+       (`clock
+        ;; Previous element must be headline metadata or headline.
+        (goto-char (1- (org-element-property :begin element)))
+        (or (org-at-heading-p)
+            (org--at-headline-data-p)))))))
+
 (defvar org-element-greater-elements)
 (defun org--get-expected-indentation (element contentsp)
   "Expected indentation column for current line, according to ELEMENT.
@@ -19044,6 +18728,10 @@ ELEMENT."
       (contentsp
        (cl-case type
         ((diary-sexp footnote-definition) 0)
+         (section
+          (org--get-expected-indentation
+           (org-element-property :parent element)
+           t))
         ((headline inlinetask nil)
          (if (not org-adapt-indentation) 0
            (let ((level (org-current-level)))
@@ -19064,9 +18752,9 @@ ELEMENT."
        (org-element-property :parent element) t))
       ;; At first line: indent according to previous sibling, if any,
       ;; ignoring footnote definitions and inline tasks, or parent's
-      ;; contents.
-      ((and ( = (line-beginning-position) start)
-           (eq org-adapt-indentation t))
+      ;; contents.  If `org-adapt-indentation' is `headline-data', ignore
+      ;; previous headline data siblings.
+      ((= (line-beginning-position) start)
        (catch 'exit
         (while t
           (if (= (point-min) start) (throw 'exit 0)
@@ -19083,6 +18771,14 @@ ELEMENT."
                ((memq (org-element-type previous)
                       '(footnote-definition inlinetask))
                 (setq start (org-element-property :begin previous)))
+                ;; Do not indent like previous when the previous
+                ;; element is headline data and `org-adapt-indentation'
+                ;; is set to `headline-data'.
+                ((and (eq 'headline-data org-adapt-indentation)
+                      (not (org--at-headline-data-p start element))
+                      (or (org-at-heading-p)
+                          (org--at-headline-data-p (1- start) previous)))
+                 (throw 'exit 0))
                (t (goto-char (org-element-property :begin previous))
                   (throw 'exit
                          (if (bolp) (current-indentation)
@@ -19143,11 +18839,14 @@ Alignment is done according to `org-property-format', 
which see."
   (when (save-excursion
          (beginning-of-line)
          (looking-at org-property-re))
-    (replace-match
-     (concat (match-string 4)
-            (org-trim
-             (format org-property-format (match-string 1) (match-string 3))))
-     t t)))
+    (combine-change-calls (match-beginning 0) (match-end 0)
+      (let ((newtext (concat (match-string 4)
+                            (org-trim
+                             (format org-property-format (match-string 1) 
(match-string 3))))))
+        ;; Do not use `replace-match' here as we want to inherit folding
+        ;; properties if inside fold.
+        (delete-region (match-beginning 0) (match-end 0))
+        (insert-and-inherit newtext)))))
 
 (defun org-indent-line ()
   "Indent line depending on context.
@@ -19193,17 +18892,15 @@ list structure.  Instead, use 
\\<org-mode-map>`\\[org-shiftmetaleft]' or \
 
 Also align node properties according to `org-property-format'."
   (interactive)
-  (unless (or (org-at-heading-p)
-              (and (eq org-adapt-indentation 'headline-data)
-                   (not (or (org-at-clock-log-p)
-                            (org-at-planning-p)))
-                   (save-excursion
-                     (beginning-of-line 1)
-                     (skip-chars-backward "\n")
-                     (or (org-at-heading-p)
-                         (looking-back ":END:.*" (line-beginning-position))))))
-    (let* ((element (save-excursion (beginning-of-line) 
(org-element-at-point)))
-          (type (org-element-type element)))
+  (let* ((element (save-excursion (beginning-of-line) 
(org-element-at-point-no-context)))
+        (type (org-element-type element)))
+    (unless (or (org-at-heading-p)
+                (and (eq org-adapt-indentation 'headline-data)
+                     (not (org--at-headline-data-p nil element))
+                     (save-excursion
+                       (goto-char (1- (org-element-property :begin element)))
+                       (or (org-at-heading-p)
+                           (org--at-headline-data-p)))))
       (cond ((and (memq type '(plain-list item))
                  (= (line-beginning-position)
                     (org-element-property :post-affiliated element)))
@@ -19230,13 +18927,13 @@ Also align node properties according to 
`org-property-format'."
                (let ((element (org-element-at-point))
                      block-content-ind some-ind)
                  (org-with-point-at (org-element-property :begin element)
-                   (setq block-content-ind (+ (current-indentation)
+                   (setq block-content-ind (+ (org-current-text-indentation)
                                               
org-edit-src-content-indentation))
                    (forward-line)
                   (save-match-data (re-search-forward "^[ \t]*\\S-" nil t))
                    (backward-char)
                    (setq some-ind (if (looking-at-p "#\\+end_src")
-                                      block-content-ind 
(current-indentation))))
+                                      block-content-ind 
(org-current-text-indentation))))
                  (indent-line-to (min block-content-ind some-ind))))
             (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")))
            (t
@@ -19345,7 +19042,7 @@ assumed to be significant there."
                ;; might break the list as a whole.  On the other
                ;; hand, when at a plain list, indent it as a whole.
                (cond ((eq type 'plain-list)
-                      (let ((offset (- ind (current-indentation))))
+                      (let ((offset (- ind (org-current-text-indentation))))
                         (unless (zerop offset)
                           (indent-rigidly (org-element-property :begin element)
                                           (org-element-property :end element)
@@ -19381,7 +19078,7 @@ assumed to be significant there."
            (beginning-of-line)
            (looking-at-p org-drawer-regexp))
     (user-error "Not at a drawer"))
-  (let ((element (org-element-at-point)))
+  (let ((element (org-element-at-point-no-context)))
     (unless (memq (org-element-type element) '(drawer property-drawer))
       (user-error "Not at a drawer"))
     (org-with-wide-buffer
@@ -19397,7 +19094,7 @@ assumed to be significant there."
            (let ((case-fold-search t))
              (looking-at-p "[ \t]*#\\+\\(begin\\|end\\)_")))
     (user-error "Not at a block"))
-  (let ((element (org-element-at-point)))
+  (let ((element (org-element-at-point-no-context)))
     (unless (memq (org-element-type element)
                  '(comment-block center-block dynamic-block example-block
                                  export-block quote-block special-block
@@ -19425,21 +19122,25 @@ assumed to be significant there."
 ;; `org-setup-filling' installs filling and auto-filling related
 ;; variables during `org-mode' initialization.
 
+(defvar org--single-lines-list-is-paragraph) ; defined later
+
 (defun org-setup-filling ()
   (require 'org-element)
   ;; Prevent auto-fill from inserting unwanted new items.
-  (when (boundp 'fill-nobreak-predicate)
-    (setq-local
-     fill-nobreak-predicate
-     (org-uniquify
-      (append fill-nobreak-predicate
-             '(org-fill-line-break-nobreak-p
-               org-fill-n-macro-as-item-nobreak-p
-               org-fill-paragraph-with-timestamp-nobreak-p)))))
+  (setq-local fill-nobreak-predicate
+              (org-uniquify
+               (append fill-nobreak-predicate
+                       '(org-fill-line-break-nobreak-p
+                         org-fill-n-macro-as-item-nobreak-p
+                         org-fill-paragraph-with-timestamp-nobreak-p))))
   (let ((paragraph-ending (substring org-element-paragraph-separate 1)))
     (setq-local paragraph-start paragraph-ending)
     (setq-local paragraph-separate paragraph-ending))
   (setq-local fill-paragraph-function 'org-fill-paragraph)
+  (setq-local fill-forward-paragraph-function
+              (lambda (&optional arg)
+                (let ((org--single-lines-list-is-paragraph nil))
+                  (org-forward-paragraph arg))))
   (setq-local auto-fill-inhibit-regexp nil)
   (setq-local adaptive-fill-function 'org-adaptive-fill-function)
   (setq-local normal-auto-fill-function 'org-auto-fill-function)
@@ -19544,11 +19245,18 @@ a footnote definition, try to fill the first 
paragraph within."
       ;; the buffer.  In that case, ignore filling.
       (cl-case (org-element-type element)
        ;; Use major mode filling function is source blocks.
-       (src-block (org-babel-do-in-edit-buffer
-                    (push-mark (point-min))
-                    (goto-char (point-max))
-                    (setq mark-active t)
-                    (funcall-interactively #'fill-paragraph justify 'region)))
+        (src-block
+         (let ((regionp (region-active-p)))
+           (org-babel-do-in-edit-buffer
+            ;; `org-babel-do-in-edit-buffer' will preserve region if it
+            ;; is within src block contents.  Otherwise, the region
+            ;; crosses src block boundaries.  We re-fill the whole src
+            ;; block in such scenario.
+            (when (and regionp (not (region-active-p)))
+              (push-mark (point-min))
+              (goto-char (point-max))
+              (setq mark-active t))
+            (funcall-interactively #'fill-paragraph justify 'region))))
        ;; Align Org tables, leave table.el tables as-is.
        (table-row (org-table-align) t)
        (table
@@ -19669,9 +19377,11 @@ filling the current element."
            (progn
              (goto-char (region-end))
              (skip-chars-backward " \t\n")
-             (while (> (point) start)
-               (org-fill-element justify)
-               (org-backward-paragraph)))
+             (let ((org--single-lines-list-is-paragraph nil))
+                (while (> (point) start)
+                 (org-fill-element justify)
+                 (org-backward-paragraph)
+                  (skip-chars-backward " \t\n"))))
          (goto-char origin)
          (set-marker origin nil))))
      (t
@@ -19702,12 +19412,18 @@ filling the current element."
   "Break line at point and indent, continuing comment if within one.
 The inserted newline is marked hard if variable
 `use-hard-newlines' is true, unless optional argument SOFT is
-non-nil."
-  (if soft (insert-and-inherit ?\n) (newline 1))
-  (save-excursion (forward-char -1) (delete-horizontal-space))
-  (delete-horizontal-space)
-  (indent-to-left-margin)
-  (insert-before-markers-and-inherit fill-prefix))
+non-nil.
+
+This function is a simplified version of `comment-indent-new-line'
+that bypasses the complex Emacs machinery dealing with comments.
+We instead rely on Org parser, utilizing `org-adaptive-fill-function'"
+  (let ((fill-prefix (org-adaptive-fill-function)))
+    (if soft (insert-and-inherit ?\n) (newline 1))
+    (save-excursion (forward-char -1) (delete-horizontal-space))
+    (delete-horizontal-space)
+    (indent-to-left-margin)
+    (when fill-prefix
+      (insert-before-markers-and-inherit fill-prefix))))
 
 
 ;;; Fixed Width Areas
@@ -19799,7 +19515,7 @@ region only contains such lines."
               (catch 'zerop
                 (while (< (point) end)
                   (unless (looking-at-p "[ \t]*$")
-                    (let ((ind (current-indentation)))
+                    (let ((ind (org-current-text-indentation)))
                       (setq min-ind (min min-ind ind))
                       (when (zerop ind) (throw 'zerop t))))
                   (forward-line)))))
@@ -19884,7 +19600,7 @@ Throw an error if no block is found."
          (cl-decf count))))
     (if (= count 0)
        (prog1 (goto-char (org-element-property :post-affiliated last-element))
-         (save-match-data (org-show-context)))
+         (save-match-data (org-fold-show-context)))
       (goto-char origin)
       (user-error "No %s code blocks" (if backward "previous" "further")))))
 
@@ -19959,10 +19675,10 @@ strictly within a source block, use appropriate 
comment syntax."
                  (line-end-position))
                beg)
             (>= (save-excursion
-                  (goto-char (org-element-property :end element))
-                  (skip-chars-backward " \r\t\n")
-                  (line-beginning-position))
-                end)))
+                 (goto-char (org-element-property :end element))
+                 (skip-chars-backward " \r\t\n")
+                 (line-beginning-position))
+               end)))
       ;; Translate region boundaries for the Org buffer to the source
       ;; buffer.
       (let ((offset (- end beg)))
@@ -20005,7 +19721,7 @@ strictly within a source block, use appropriate comment 
syntax."
              (goto-char (point-min))
              (while (and (not (eobp)) (not (zerop min-indent)))
                (unless (looking-at "[ \t]*$")
-                 (setq min-indent (min min-indent (current-indentation))))
+                 (setq min-indent (min min-indent 
(org-current-text-indentation))))
                (forward-line)))
            ;; Then loop over all lines.
            (save-excursion
@@ -20068,18 +19784,20 @@ return an active timestamp."
   "Convert TIMESTAMP object into an Emacs internal time value.
 Use end of date range or time range when END is non-nil.
 Otherwise, use its start."
-  (apply #'encode-time 0
-        (mapcar
-         (lambda (prop) (or (org-element-property prop timestamp) 0))
-         (if end '(:minute-end :hour-end :day-end :month-end :year-end)
-           '(:minute-start :hour-start :day-start :month-start
-                           :year-start)))))
+  (org-encode-time
+   (append '(0)
+           (mapcar
+            (lambda (prop) (or (org-element-property prop timestamp) 0))
+            (if end '(:minute-end :hour-end :day-end :month-end :year-end)
+              '(:minute-start :hour-start :day-start :month-start
+                              :year-start)))
+           '(nil -1 nil))))
 
 (defun org-timestamp-has-time-p (timestamp)
   "Non-nil when TIMESTAMP has a time specified."
   (org-element-property :hour-start timestamp))
 
-(defun org-timestamp-format (timestamp format &optional end utc)
+(defun org-format-timestamp (timestamp format &optional end utc)
   "Format a TIMESTAMP object into a string.
 
 FORMAT is a format specifier to be passed to
@@ -20140,13 +19858,13 @@ it has a `diary' type."
   (let ((type (org-element-property :type timestamp)))
     (if (or (not org-display-custom-times) (eq type 'diary))
        (org-element-interpret-data timestamp)
-      (let ((fmt (funcall (if (org-timestamp-has-time-p timestamp) #'cdr #'car)
-                         org-time-stamp-custom-formats)))
+      (let ((fmt (org-time-stamp-format
+                  (org-timestamp-has-time-p timestamp) nil 'custom)))
        (if (and (not boundary) (memq type '(active-range inactive-range)))
-           (concat (org-timestamp-format timestamp fmt)
+           (concat (org-format-timestamp timestamp fmt)
                    "--"
-                   (org-timestamp-format timestamp fmt t))
-         (org-timestamp-format timestamp fmt (eq boundary 'end)))))))
+                   (org-format-timestamp timestamp fmt t))
+         (org-format-timestamp timestamp fmt (eq boundary 'end)))))))
 
 ;;; Other stuff
 
@@ -20359,13 +20077,17 @@ depending on context."
            (call-interactively #'forward-sentence)))))))
 
 (defun org-kill-line (&optional _arg)
-  "Kill line, to tags or end of line."
+  "Kill line, to tags or end of line.
+
+The behavior of this command depends on the user options
+`org-special-ctrl-k' and `org-ctrl-k-protect-subtree' (which
+see)."
   (interactive)
   (cond
    ((or (not org-special-ctrl-k)
        (bolp)
        (not (org-at-heading-p)))
-    (when (and (get-char-property (line-end-position) 'invisible)
+    (when (and (org-invisible-p (line-end-position))
               org-ctrl-k-protect-subtree
               (or (eq org-ctrl-k-protect-subtree 'error)
                   (not (y-or-n-p "Kill hidden subtree along with headline? 
"))))
@@ -20453,7 +20175,7 @@ interactive command with similar behavior."
             (or (looking-at org-outline-regexp)
                 (re-search-forward org-outline-regexp-bol end t))
             (while (and (< (point) end) (looking-at org-outline-regexp))
-              (org-flag-subtree t)
+              (org-fold-subtree t)
               (org-cycle-show-empty-lines 'folded)
               (condition-case nil
                   (outline-forward-same-level 1)
@@ -20489,60 +20211,124 @@ interactive command with similar behavior."
                     (<= (org-outline-level) level))))))))
 
 (defun org-back-to-heading (&optional invisible-ok)
-  "Call `outline-back-to-heading', but provide a better error message."
-  (condition-case nil
-      (outline-back-to-heading invisible-ok)
-    (error
-     (user-error "Before first headline at position %d in buffer %s"
-                (point) (current-buffer)))))
+  "Go back to beginning of heading."
+  (beginning-of-line)
+  (or (org-at-heading-p (not invisible-ok))
+      (if (org-element--cache-active-p)
+          (let ((heading (org-element-lineage (org-element-at-point)
+                                           '(headline inlinetask)
+                                           'include-self)))
+            (when heading
+              (goto-char (org-element-property :begin heading)))
+            (while (and (not invisible-ok)
+                        heading
+                        (org-fold-folded-p))
+              (goto-char (org-fold-core-previous-visibility-change))
+              (setq heading (org-element-lineage (org-element-at-point)
+                                              '(headline inlinetask)
+                                              'include-self))
+              (when heading
+                (goto-char (org-element-property :begin heading))))
+            (unless heading
+              (user-error "Before first headline at position %d in buffer %s"
+                         (point) (current-buffer)))
+            (point))
+        (let (found)
+         (save-excursion
+            ;; At inlinetask end.  Move to bol, so that the following
+            ;; search goes to the beginning of the inlinetask.
+            (when (and (featurep 'org-inlinetask)
+                       (fboundp 'org-inlinetask-end-p)
+                       (org-inlinetask-end-p))
+              (goto-char (line-beginning-position)))
+           (while (not found)
+             (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
+                                     nil t)
+                  (user-error "Before first headline at position %d in buffer 
%s"
+                             (point) (current-buffer)))
+              ;; Skip inlinetask end.
+              (if (and (featurep 'org-inlinetask)
+                       (fboundp 'org-inlinetask-end-p)
+                       (org-inlinetask-end-p))
+                  (org-inlinetask-goto-beginning)
+               (setq found (and (or invisible-ok (not (org-fold-folded-p)))
+                                (point))))))
+         (goto-char found)
+         found))))
 
 (defun org-back-to-heading-or-point-min (&optional invisible-ok)
   "Go back to heading or first point in buffer.
 If point is before first heading go to first point in buffer
 instead of back to heading."
-  (condition-case nil
-      (outline-back-to-heading invisible-ok)
-    (error
-     (goto-char (point-min)))))
+  (if (org-before-first-heading-p)
+      (goto-char (point-min))
+    (org-back-to-heading invisible-ok)))
 
 (defun org-before-first-heading-p ()
-  "Before first heading?"
-  (org-with-limited-levels
-   (save-excursion
-     (end-of-line)
-     (null (re-search-backward org-outline-regexp-bol nil t)))))
+  "Before first heading?
+Respect narrowing."
+  (let ((cached (org-element-at-point nil 'cached)))
+    (if cached
+        (let ((cached-headline (org-element-lineage cached '(headline) t)))
+          (or (not cached-headline)
+              (< (org-element-property :begin cached-headline) (point-min))))
+      (org-with-limited-levels
+       (save-excursion
+         (end-of-line)
+         (null (re-search-backward org-outline-regexp-bol nil t)))))))
 
-(defun org-at-heading-p (&optional _)
-  "Non-nil when on a headline."
-  (outline-on-heading-p t))
+(defun org-at-heading-p (&optional invisible-not-ok)
+  "Return t if point is on a (possibly invisible) heading line.
+If INVISIBLE-NOT-OK is non-nil, an invisible heading line is not ok."
+  (save-excursion
+    (beginning-of-line)
+    (and (bolp) (or (not invisible-not-ok) (not (org-fold-folded-p)))
+        (looking-at outline-regexp))))
 
-(defun org-in-commented-heading-p (&optional no-inheritance)
+(defun org-in-commented-heading-p (&optional no-inheritance element)
   "Non-nil if point is under a commented heading.
 This function also checks ancestors of the current headline,
-unless optional argument NO-INHERITANCE is non-nil."
-  (cond
-   ((org-before-first-heading-p) nil)
-   ((let ((headline (nth 4 (org-heading-components))))
-      (and headline
-          (let ((case-fold-search nil))
-            (string-match-p (concat "^" org-comment-string "\\(?: \\|$\\)")
-                            headline)))))
-   (no-inheritance nil)
-   (t
-    (save-excursion (and (org-up-heading-safe) 
(org-in-commented-heading-p))))))
+unless optional argument NO-INHERITANCE is non-nil.
 
-(defun org-in-archived-heading-p (&optional no-inheritance)
+Optional argument ELEMENT contains element at point."
+  (save-match-data
+    (let ((el (or element
+                  (org-element-at-point nil 'cached)
+                  (org-with-wide-buffer
+                   (org-back-to-heading-or-point-min t)
+                   (org-element-at-point)))))
+      (catch :found
+        (setq el (org-element-lineage el '(headline inlinetask) 'include-self))
+        (if no-inheritance
+            (org-element-property :commentedp el)
+          (while el
+            (when (org-element-property :commentedp el)
+              (throw :found t))
+            (setq el (org-element-property :parent el))))))))
+
+(defun org-in-archived-heading-p (&optional no-inheritance element)
   "Non-nil if point is under an archived heading.
 This function also checks ancestors of the current headline,
-unless optional argument NO-INHERITANCE is non-nil."
+unless optional argument NO-INHERITANCE is non-nil.
+
+Optional argument ELEMENT contains element at point."
   (cond
-   ((org-before-first-heading-p) nil)
-   ((let ((tags (org-get-tags nil 'local)))
-      (and tags
-          (cl-some (apply-partially #'string= org-archive-tag) tags))))
+   ((and (not element) (org-before-first-heading-p)) nil)
+   ((if element
+        (org-element-property :archivedp element)
+      (let ((tags (org-get-tags element 'local)))
+        (and tags
+            (cl-some (apply-partially #'string= org-archive-tag) tags)))))
    (no-inheritance nil)
    (t
-    (save-excursion (and (org-up-heading-safe) (org-in-archived-heading-p))))))
+    (if (or element (org-element--cache-active-p))
+        (catch :archived
+          (unless element (setq element (org-element-at-point)))
+          (while element
+            (when (org-element-property :archivedp element)
+              (throw :archived t))
+            (setq element (org-element-property :parent element))))
+      (save-excursion (and (org-up-heading-safe) 
(org-in-archived-heading-p)))))))
 
 (defun org-at-comment-p nil
   "Return t if cursor is in a commented line."
@@ -20602,29 +20388,43 @@ headline found, or nil if no higher level is found.
 Also, this function will be a lot faster than `outline-up-heading',
 because it relies on stars being the outline starters.  This can really
 make a significant difference in outlines with very many siblings."
-  (when (ignore-errors (org-back-to-heading t))
-    (let (level-cache)
-      (unless org--up-heading-cache
-        (setq org--up-heading-cache (make-hash-table)))
-      (if (and (eq (buffer-chars-modified-tick) org--up-heading-cache-tick)
-               (setq level-cache (gethash (point) org--up-heading-cache)))
-          (when (<= (point-min) (car level-cache) (point-max))
-            ;; Parent is inside accessible part of the buffer.
-            (progn (goto-char (car level-cache))
-                   (cdr level-cache)))
-        ;; Buffer modified.  Invalidate cache.
-        (unless (eq (buffer-chars-modified-tick) org--up-heading-cache-tick)
-          (setq-local org--up-heading-cache-tick
-                      (buffer-chars-modified-tick))
-          (clrhash org--up-heading-cache))
-        (let* ((level-up (1- (funcall outline-level)))
-               (pos (point))
-               (result (and (> level-up 0)
-                           (re-search-backward
-                             (format "^\\*\\{1,%d\\} " level-up) nil t)
-                           (funcall outline-level))))
-          (when result (puthash pos (cons (point) result) 
org--up-heading-cache))
-          result)))))
+  (let ((element (and (org-element--cache-active-p)
+                      (org-element-at-point nil t))))
+    (if element
+        (let* ((current-heading (org-element-lineage element '(headline 
inlinetask) 'with-self))
+               (parent (org-element-lineage current-heading '(headline))))
+          (if (and parent
+                   (<= (point-min) (org-element-property :begin parent)))
+              (progn
+                (goto-char (org-element-property :begin parent))
+                (org-element-property :level parent))
+            (when (and current-heading
+                       (<= (point-min) (org-element-property :begin 
current-heading)))
+              (goto-char (org-element-property :begin current-heading))
+              nil)))
+      (when (ignore-errors (org-back-to-heading t))
+        (let (level-cache)
+          (unless org--up-heading-cache
+            (setq org--up-heading-cache (make-hash-table)))
+          (if (and (eq (buffer-chars-modified-tick) org--up-heading-cache-tick)
+                   (setq level-cache (gethash (point) org--up-heading-cache)))
+              (when (<= (point-min) (car level-cache) (point-max))
+                ;; Parent is inside accessible part of the buffer.
+                (progn (goto-char (car level-cache))
+                       (cdr level-cache)))
+            ;; Buffer modified.  Invalidate cache.
+            (unless (eq (buffer-chars-modified-tick) 
org--up-heading-cache-tick)
+              (setq-local org--up-heading-cache-tick
+                          (buffer-chars-modified-tick))
+              (clrhash org--up-heading-cache))
+            (let* ((level-up (1- (funcall outline-level)))
+                   (pos (point))
+                   (result (and (> level-up 0)
+                               (re-search-backward
+                                 (format "^\\*\\{1,%d\\} " level-up) nil t)
+                               (funcall outline-level))))
+              (when result (puthash pos (cons (point) result) 
org--up-heading-cache))
+              result)))))))
 
 (defun org-up-heading-or-point-min ()
   "Move to the heading line of which the present is a subheading, or point-min.
@@ -20634,7 +20434,9 @@ level of the headline found (down to 0) or nil if 
already at a
 point before the first headline or at point-min."
   (when (ignore-errors (org-back-to-heading t))
     (if (< 1 (funcall outline-level))
-       (org-up-heading-safe)
+       (or (org-up-heading-safe)
+            ;; The first heading may not be level 1 heading.
+            (goto-char (point-min)))
       (unless (= (point) (point-min)) (goto-char (point-min))))))
 
 (defun org-first-sibling-p ()
@@ -20671,44 +20473,33 @@ move point."
        (goto-char pos)
        nil))))
 
-(defun org-show-siblings ()
-  "Show all siblings of the current headline."
-  (save-excursion
-    (while (org-goto-sibling) (org-flag-heading nil)))
-  (save-excursion
-    (while (org-goto-sibling 'previous)
-      (org-flag-heading nil))))
-
-(defun org-goto-first-child ()
+(defun org-goto-first-child (&optional element)
   "Goto the first child, even if it is invisible.
 Return t when a child was found.  Otherwise don't move point and
 return nil."
-  (let (level (pos (point)) (re org-outline-regexp-bol))
-    (when (org-back-to-heading-or-point-min t)
-      (setq level (org-outline-level))
-      (forward-char 1)
-      (if (and (re-search-forward re nil t) (> (org-outline-level) level))
-         (progn (goto-char (match-beginning 0)) t)
-       (goto-char pos) nil))))
-
-(defun org-show-hidden-entry ()
-  "Show an entry where even the heading is hidden."
-  (save-excursion
-    (org-show-entry)))
-
-(defun org-flag-heading (flag &optional entry)
-  "Flag the current heading.  FLAG non-nil means make invisible.
-When ENTRY is non-nil, show the entire entry."
-  (save-excursion
-    (org-back-to-heading t)
-    ;; Check if we should show the entire entry
-    (if (not entry)
-       (org-flag-region
-        (line-end-position 0) (line-end-position) flag 'outline)
-      (org-show-entry)
-      (save-excursion
-       (and (outline-next-heading)
-            (org-flag-heading nil))))))
+  (if (org-element--cache-active-p)
+      (let ((heading (org-element-lineage
+                      (or element (org-element-at-point))
+                      '(headline inlinetask org-data)
+                      t)))
+        (when heading
+          (unless (or (eq 'inlinetask (org-element-type heading))
+                      (not (org-element-property :contents-begin heading)))
+            (let ((pos (point)))
+              (goto-char (org-element-property :contents-begin heading))
+              (if (re-search-forward
+                   org-outline-regexp-bol
+                   (org-element-property :end heading)
+                   t)
+                  (progn (goto-char (match-beginning 0)) t)
+                (goto-char pos) nil)))))
+    (let (level (pos (point)) (re org-outline-regexp-bol))
+      (when (org-back-to-heading-or-point-min t)
+        (setq level (org-outline-level))
+        (forward-char 1)
+        (if (and (re-search-forward re nil t) (> (org-outline-level) level))
+           (progn (goto-char (match-beginning 0)) t)
+         (goto-char pos) nil)))))
 
 (defun org-get-next-sibling ()
   "Move to next heading of the same level, and return point.
@@ -20734,8 +20525,8 @@ If there is no such heading, return nil."
       (unless (< (funcall outline-level) level)
         (point)))))
 
-(defun org-end-of-subtree (&optional invisible-ok to-heading)
-  "Goto to the end of a subtree."
+(defun org-end-of-subtree (&optional invisible-ok to-heading element)
+  "Goto to the end of a subtree at point or for ELEMENT heading."
   ;; This contains an exact copy of the original function, but it uses
   ;; `org-back-to-heading-or-point-min', to make it work also in invisible
   ;; trees and before first headline.  And is uses an invisible-ok argument.
@@ -20743,32 +20534,40 @@ If there is no such heading, return nil."
   ;; Furthermore, when used inside Org, finding the end of a large subtree
   ;; with many children and grandchildren etc, this can be much faster
   ;; than the outline version.
-  (org-back-to-heading-or-point-min invisible-ok)
-  (let ((first t)
-       (level (funcall outline-level)))
-    (cond ((= level 0)
-          (goto-char (point-max)))
-         ((and (derived-mode-p 'org-mode) (< level 1000))
-          ;; A true heading (not a plain list item), in Org
-          ;; This means we can easily find the end by looking
-          ;; only for the right number of stars.  Using a regexp to do
-          ;; this is so much faster than using a Lisp loop.
-          (let ((re (concat "^\\*\\{1," (number-to-string level) "\\} ")))
-            (forward-char 1)
-            (and (re-search-forward re nil 'move) (beginning-of-line 1))))
-         (t
-          ;; something else, do it the slow way
-          (while (and (not (eobp))
-                      (or first (> (funcall outline-level) level)))
-            (setq first nil)
-            (outline-next-heading))))
-    (unless to-heading
+  (if element
+      (setq element (org-element-lineage element '(headline inlinetask) 
'include-self))
+    (org-back-to-heading-or-point-min invisible-ok))
+  (unless (and (org-element--cache-active-p)
+               (let ((cached (or element (org-element-at-point nil t))))
+                 (and cached
+                      (eq 'headline (org-element-type cached))
+                      (goto-char (org-element-property
+                                  :end cached)))))
+    (let ((first t)
+         (level (funcall outline-level)))
+      (cond ((= level 0)
+            (goto-char (point-max)))
+           ((and (derived-mode-p 'org-mode) (< level 1000))
+            ;; A true heading (not a plain list item), in Org
+            ;; This means we can easily find the end by looking
+            ;; only for the right number of stars.  Using a regexp to do
+            ;; this is so much faster than using a Lisp loop.
+            (let ((re (concat "^\\*\\{1," (number-to-string level) "\\} ")))
+              (forward-char 1)
+              (and (re-search-forward re nil 'move) (beginning-of-line 1))))
+           (t
+            ;; something else, do it the slow way
+            (while (and (not (eobp))
+                        (or first (> (funcall outline-level) level)))
+              (setq first nil)
+              (outline-next-heading))))))
+  (unless to-heading
+    (when (memq (preceding-char) '(?\n ?\^M))
+      ;; Go to end of line before heading
+      (forward-char -1)
       (when (memq (preceding-char) '(?\n ?\^M))
-       ;; Go to end of line before heading
-       (forward-char -1)
-       (when (memq (preceding-char) '(?\n ?\^M))
-         ;; leave blank line before heading
-         (forward-char -1)))))
+       ;; leave blank line before heading
+       (forward-char -1))))
   (point))
 
 (defun org-end-of-meta-data (&optional full)
@@ -20867,20 +20666,16 @@ With ARG, repeats or can move backward if negative."
       (end-of-line))
     (while (and (< arg 0) (re-search-backward regexp nil :move))
       (unless (bobp)
-       (while (pcase (get-char-property-and-overlay (point) 'invisible)
-                (`(outline . ,o)
-                 (goto-char (overlay-start o))
-                 (re-search-backward regexp nil :move))
-                (_ nil))))
+       (when (org-fold-folded-p)
+         (goto-char (org-fold-previous-visibility-change))
+          (unless (looking-at-p regexp)
+            (re-search-backward regexp nil :mode))))
       (cl-incf arg))
-    (while (and (> arg 0) (re-search-forward regexp nil t))
-      (while (pcase (get-char-property-and-overlay (point) 'invisible)
-              (`(outline . ,o)
-               (goto-char (overlay-end o))
-               (re-search-forward regexp nil :move))
-              (_
-               (end-of-line)
-               nil)))                  ;leave the loop
+    (while (and (> arg 0) (re-search-forward regexp nil :move))
+      (when (org-fold-folded-p)
+       (goto-char (org-fold-next-visibility-change))
+        (skip-chars-forward " \t\n")
+       (end-of-line))
       (cl-decf arg))
     (if (> arg 0) (goto-char (point-max)) (beginning-of-line))))
 
@@ -20938,6 +20733,9 @@ It also provides the following special moves for 
convenience:
     ;; Return moves left.
     arg))
 
+(defvar org--single-lines-list-is-paragraph t
+  "Treat plain lists with single line items as a whole paragraph")
+
 (defun org--paragraph-at-point ()
   "Return paragraph, or equivalent, element at point.
 
@@ -20999,7 +20797,7 @@ Function may return a real element, or a pseudo-element 
with type
              (while (memq (org-element-type (org-element-property :parent l))
                           '(item plain-list))
                (setq l (org-element-property :parent l)))
-             (and l
+             (and l org--single-lines-list-is-paragraph
                   (org-with-point-at (org-element-property :post-affiliated l)
                     (forward-line (length (org-element-property :structure l)))
                     (= (point) (org-element-property :contents-end l)))
@@ -21025,12 +20823,10 @@ See `org-forward-paragraph'."
     (cond
      ((eobp) nil)
      ;; When inside a folded part, move out of it.
-     ((pcase (get-char-property-and-overlay (point) 'invisible)
-       (`(,(or `outline `org-hide-block) . ,o)
-        (goto-char (overlay-end o))
-        (forward-line)
-        t)
-       (_ nil)))
+     ((when (org-invisible-p nil t)
+        (goto-char (cdr (org-fold-get-region-at-point)))
+        (forward-line)
+        t))
      (t
       (let* ((element (org--paragraph-at-point))
             (type (org-element-type element))
@@ -21042,14 +20838,13 @@ See `org-forward-paragraph'."
          (forward-char)
          (org--forward-paragraph-once))
         ;; If the element is folded, skip it altogether.
-        ((pcase (org-with-point-at post-affiliated
-                  (get-char-property-and-overlay (line-end-position)
-                                                 'invisible))
-           (`(,(or `outline `org-hide-block) . ,o)
-            (goto-char (overlay-end o))
-            (forward-line)
-            t)
-           (_ nil)))
+         ((when (org-with-point-at post-affiliated (org-invisible-p 
(line-end-position) t))
+            (goto-char (cdr (org-fold-get-region-at-point
+                            nil
+                            (org-with-point-at post-affiliated
+                              (line-end-position)))))
+           (forward-line)
+           t))
         ;; At a greater element, move inside.
         ((and contents-begin
               (> contents-begin (point))
@@ -21101,12 +20896,10 @@ See `org-backward-paragraph'."
           (save-excursion (skip-chars-backward " \t\n") (bobp)))
       (goto-char (point-min)))
      ;; When inside a folded part, move out of it.
-     ((pcase (get-char-property-and-overlay (1- (point)) 'invisible)
-       (`(,(or `outline `org-hide-block) . ,o)
-        (goto-char (1- (overlay-start o)))
-        (org--backward-paragraph-once)
-        t)
-       (_ nil)))
+     ((when (org-invisible-p (1- (point)) t)
+        (goto-char (1- (car (org-fold-get-region-at-point nil (1- (point))))))
+       (org--backward-paragraph-once)
+       t))
      (t
       (let* ((element (org--paragraph-at-point))
             (type (org-element-type element))
@@ -21132,15 +20925,13 @@ See `org-backward-paragraph'."
          (cond
           ;; There is a blank line above.  Move there.
           ((and (org-previous-line-empty-p)
-                 (let ((lep (line-end-position 0)))
-                   ;; When the first headline start at point 2, don't choke 
while
-                   ;; checking with `org-invisible-p'.
-                   (or (= lep 1)
-                      (not (org-invisible-p (1- (line-end-position 0)))))))
+                (not (org-invisible-p (1- (line-end-position 0)))))
            (forward-line -1))
           ;; At the beginning of the first element within a greater
           ;; element.  Move to the beginning of the greater element.
-          ((and parent (= begin (org-element-property :contents-begin parent)))
+          ((and parent
+                 (not (eq 'section (org-element-type parent)))
+                 (= begin (org-element-property :contents-begin parent)))
            (funcall reach (org-element-property :begin parent)))
           ;; Since we have to move anyway, find the beginning
           ;; position of the element above.
@@ -21153,8 +20944,7 @@ See `org-backward-paragraph'."
               (org-with-point-at begin (not (bolp))))
          (funcall reach (progn (goto-char begin) (line-beginning-position))))
         ;; If the element is folded, skip it altogether.
-        ((org-with-point-at post-affiliated
-           (org-invisible-p (line-end-position) t))
+        ((org-with-point-at post-affiliated (org-invisible-p 
(line-end-position) t))
          (funcall reach begin))
         ;; At the end of a greater element, move inside.
         ((and contents-end
@@ -21249,7 +21039,12 @@ Move to the previous element at the same level, when 
possible."
       (unless (org-up-heading-safe) (user-error "No surrounding element"))
     (let* ((elem (org-element-at-point))
           (parent (org-element-property :parent elem)))
-      (if parent (goto-char (org-element-property :begin parent))
+      ;; Skip sections
+      (when (eq 'section (org-element-type parent))
+        (setq parent (org-element-property :parent parent)))
+      (if (and parent
+               (not (eq (org-element-type parent) 'org-data)))
+          (goto-char (org-element-property :begin parent))
        (if (org-with-limited-levels (org-before-first-heading-p))
            (user-error "No surrounding element")
          (org-with-limited-levels (org-back-to-heading)))))))
@@ -21485,9 +21280,9 @@ Started from `gnus-info-find-node'."
 
 ;;; Finish up
 
-(add-hook 'org-mode-hook     ;remove overlays when changing major mode
+(add-hook 'org-mode-hook     ;remove folds when changing major mode
          (lambda () (add-hook 'change-major-mode-hook
-                              'org-show-all 'append 'local)))
+                         'org-fold-show-all 'append 'local)))
 
 (provide 'org)
 
diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el
index 1452f36c11..7e5ba104ff 100644
--- a/lisp/org/ox-ascii.el
+++ b/lisp/org/ox-ascii.el
@@ -3,7 +3,7 @@
 ;; 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>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: outlines, hypermedia, calendar, wp
 
 ;; This file is part of GNU Emacs.
@@ -28,6 +28,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ox)
 (require 'ox-publish)
 (require 'cl-lib)
@@ -35,6 +38,9 @@
 ;;; Function Declarations
 
 (declare-function aa2u "ext:ascii-art-to-unicode" ())
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
 
 ;;; Define Back-End
 ;;
diff --git a/lisp/org/ox-beamer.el b/lisp/org/ox-beamer.el
index a70f6e4a0f..51684448d6 100644
--- a/lisp/org/ox-beamer.el
+++ b/lisp/org/ox-beamer.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
 ;;         Nicolas Goaziou <n.goaziou AT gmail DOT com>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: org, wp, tex
 
 ;; This file is part of GNU Emacs.
@@ -30,6 +30,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ox-latex)
 
@@ -734,13 +737,23 @@ used as a communication channel."
   (or (org-export-custom-protocol-maybe link contents 'beamer info)
       ;; Fall-back to LaTeX export.  However, prefer "\hyperlink" over
       ;; "\hyperref" since the former handles overlay specifications.
-      (let ((latex-link (org-export-with-backend 'latex link contents info)))
-       (if (string-match "\\`\\\\hyperref\\[\\(.*?\\)\\]" latex-link)
-           (replace-match
-            (format "\\\\hyperlink%s{\\1}"
-                    (or (org-beamer--element-has-overlay-p link) ""))
-            nil nil latex-link)
-         latex-link))))
+      (let* ((latex-link (org-export-with-backend 'latex link contents info))
+             (parent (org-export-get-parent-element link))
+             (attr (org-export-read-attribute :attr_beamer parent))
+             (overlay (plist-get attr :overlay)))
+        (cond ((string-match "\\`\\\\hyperref\\[\\(.*?\\)\\]" latex-link)
+               (replace-match
+                (format "\\\\hyperlink%s{\\1}"
+                        (or (org-beamer--element-has-overlay-p link) ""))
+                nil nil latex-link))
+              ((string-match "\\\\include\\(graphics\\|svg\\)\\([[{]?\\)" 
latex-link)
+               ;; Check for overlay specification and insert if
+               ;; present.
+               (replace-match
+                (format "\\\\include\\1%s\\2"
+                        (if overlay overlay ""))
+                nil nil latex-link))
+              (t latex-link)))))
 
 
 ;;;; Plain List
@@ -857,6 +870,12 @@ holding export options."
      (let ((template (plist-get info :latex-hyperref-template)))
        (and (stringp template)
            (format-spec template (org-latex--format-spec info))))
+     ;; engrave-faces-latex preamble
+     (when (and (eq org-latex-src-block-backend 'engraved)
+                (org-element-map (plist-get info :parse-tree)
+                    '(src-block inline-src-block) #'identity
+                    info t))
+       (org-latex-generate-engraved-preamble info))
      ;; Document start.
      "\\begin{document}\n\n"
      ;; Title command.
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el
index 9cf9125aeb..86b10cbf78 100644
--- a/lisp/org/ox-html.el
+++ b/lisp/org/ox-html.el
@@ -4,7 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
 ;;      Jambunathan K <kjambunathan at gmail dot com>
-;; Maintainer: TEC <tecosaur@gmail.com>
+;; Maintainer: TEC <orgmode@tec.tecosaur.net>
 ;; Keywords: outlines, hypermedia, calendar, wp
 
 ;; This file is part of GNU Emacs.
@@ -31,6 +31,9 @@
 
 ;;; Dependencies
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'format-spec)
 (require 'ox)
@@ -43,6 +46,9 @@
 (declare-function org-id-find-id-file "org-id" (id))
 (declare-function htmlize-region "ext:htmlize" (beg end))
 (declare-function mm-url-decode-entities "mm-url" ())
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
 
 (defvar htmlize-css-name-prefix)
 (defvar htmlize-output-type)
@@ -211,7 +217,7 @@
     ("xhtml-frameset" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 
Frameset//EN\"
 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\";>")
     ("xhtml-11" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"
-\"http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd\";>")
+\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\";>")
 
     ("html5" . "<!DOCTYPE html>")
     ("xhtml5" . "<!DOCTYPE html>"))
@@ -833,6 +839,8 @@ are directly put into a \"href\" tag in HTML.  However, 
links to other Org files
 (recognized by the extension \".org\") should become links to the corresponding
 HTML file, assuming that the linked Org file will also be converted to HTML.
 
+Links to \"file.org.gpg\" are also converted.
+
 When nil, the links still point to the plain \".org\" file."
   :group 'org-export-html
   :type 'boolean)
@@ -889,7 +897,8 @@ all the faces you are interested in are defined, for 
example by loading files
 in all modes you want.  Then, use the command
 `\\[org-html-htmlize-generate-css]' to extract class definitions."
   :group 'org-export-html
-  :type '(choice (const css) (const inline-css) (const nil)))
+  :type '(choice (const css) (const inline-css) (const nil))
+  :safe #'symbolp)
 
 (defcustom org-html-htmlize-font-prefix "org-"
   "The prefix for CSS class names for htmlize font specifications."
@@ -1158,72 +1167,116 @@ See `format-time-string' for more information on its 
components."
 ;;;; Template :: Mathjax
 
 (defcustom org-html-mathjax-options
-  '((path 
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML";
 )
-    (scale "100")
+  '((path "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";)
+    (scale 1.0)
     (align "center")
-    (font "TeX")
-    (linebreaks "false")
-    (autonumber "AMS")
+    (font "mathjax-modern")
+    (overflow "overflow")
+    (tags "ams")
     (indent "0em")
     (multlinewidth "85%")
     (tagindent ".8em")
     (tagside "right"))
   "Options for MathJax setup.
 
-Alist of the following elements.  All values are strings.
+Alist of the following elements.
 
-path          The path to MathJax.
+path          The path to MathJax version 3 or later.
 scale         Scaling with HTML-CSS, MathML and SVG output engines.
 align         How to align display math: left, center, or right.
-font          The font to use with HTML-CSS and SVG output.  As of MathJax 2.5
-              the following values are understood: \"TeX\", \"STIX-Web\",
-              \"Asana-Math\", \"Neo-Euler\", \"Gyre-Pagella\",
-              \"Gyre-Termes\", and \"Latin-Modern\".
+font          The font to use with HTML-CSS and SVG output.  Needs
+              MathJax version 4+.  MathJax 4 provides 11 fonts:
+              \"mathjax-modern\"   Latin-Modern font, default in MathJax 4+
+              \"mathjax-asana\"    Asana-Math font
+              \"mathjax-bonum\"    Gyre Bonum font
+              \"mathjax-dejavu\"   Gyre DejaVu font
+              \"mathjax-pagella\"  Gyre Pagella font
+              \"mathjax-schola\"   Gyre Schola font
+              \"mathjax-termes\"   Gyre Termes font
+              \"mathjax-stix2\"    STIX2 font
+              \"mathjax-fira\"     Fira and Fira-Math fonts
+              \"mathjax-euler\"    Neo Euler font that extends Latin-Modern
+              \"mathjax-tex\"      The original MathJax TeX font
+overflow      How to break displayed equations when too large. Needs
+              MathJax 4 or newer.  Supported options include
+              \"overflow\", \"scale\", \"scroll\", \"truncate\",
+              \"linebreak\", and \"elide\".
 linebreaks    Let MathJax perform automatic linebreaks.  Valid values
               are \"true\" and \"false\".
-indent        If align is not center, how far from the left/right side?
-              Valid values are \"left\" and \"right\"
+indent        If align is not center, how far from the left/right side?  For
+              example, \"1em\".
 multlinewidth The width of the multline environment.
-autonumber    How to number equations.  Valid values are \"None\",
-              \"all\" and \"AMS Math\".
+tags          How to number equations.  Valid values are \"none\",
+              \"all\" and \"ams\".
 tagindent     The amount tags are indented.
 tagside       Which side to show tags/labels on.  Valid values are
               \"left\" and \"right\"
 
-You can also customize this for each buffer, using something like
+You can also customize this for some buffer, using something like
 
-#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
+#+HTML_MATHJAX: align: left indent: 5em tagside: left
 
 For further information about MathJax options, see the MathJax documentation:
 
-  https://docs.mathjax.org/";
+  https://docs.mathjax.org/
+
+To maintain compatibility with pre-9.6 Org that used MathJax 2,
+the following conversions take place.
+
+The legacy \"autonumber\" option, with the value \"AMS\",
+\"None\", or \"All\", becomes the \"tags\" option set to the
+value \"ams\", \"none\", or \"all\", respectively.
+
+Any legacy values of the \"scale\" option, specified as
+percentage strings, become converted to unit-interval numbers.
+For example, a legacy scale of \"150\" becomes a scale of 1.5.
+
+The legacy \"linebreaks\" option, with the value \"true\" or
+\"false\", becomes the \"overflow\" option set to the value
+\"linebreak\" or \"overflow\", respectively.
+
+The legacy values of the \"font\" option, namely \"TeX\",
+\"STIX-Web\", \"Asana-Math\", \"Neo-Euler\", \"Gyre-Pagella\",
+\"Gyre-Termes\", \"Latin-Modern\", become converted to the
+corresponding MathJax 4+ font names.
+
+Legacy options and values always take precedence.
+"
   :group 'org-export-html
-  :package-version '(Org . "8.3")
+  :package-version '(Org . "9.6")
   :type '(list :greedy t
               (list :tag "path   (the path from where to load MathJax.js)"
                     (const :format "       " path) (string))
               (list :tag "scale  (scaling for the displayed math)"
-                    (const :format "       " scale) (string))
+                    (const :format "   " scale) (float))
               (list :tag "align  (alignment of displayed equations)"
                     (const :format "       " align) (string))
-              (list :tag "font (used to display math)"
-                    (const :format "            " font)
-                    (choice (const "TeX")
-                            (const "STIX-Web")
-                            (const "Asana-Math")
-                            (const "Neo-Euler")
-                            (const "Gyre-Pagella")
-                            (const "Gyre-Termes")
-                            (const "Latin-Modern")))
-              (list :tag "linebreaks (automatic line-breaking)"
-                    (const :format "      " linebreaks)
-                    (choice (const "true")
-                            (const "false")))
-              (list :tag "autonumber (when should equations be numbered)"
-                    (const :format "      " autonumber)
-                    (choice (const "AMS")
-                            (const "None")
-                            (const "All")))
+               (list :tag "font (used to typeset math)"
+                    (const :format "               " font)
+                     (choice (const "mathjax-modern")
+                             (const "mathjax-asana")
+                             (const "mathjax-bonum")
+                             (const "mathjax-dejavu")
+                             (const "mathjax-pagella")
+                             (const "mathjax-schola")
+                             (const "mathjax-termes")
+                             (const "mathjax-stix2")
+                             (const "mathjax-fira")
+                             (const "mathjax-euler")
+                             (const "mathjax-tex")))
+               (list :tag "overflow (how to break displayed math)"
+                    (const :format "         " overflow)
+                     (choice (const "overflow")
+                             (const "scale")
+                             (const "scroll")
+                             (const "truncate")
+                             (const "linebreak")
+                             (const "elide")))
+              (list :tag "tags (whether equations are numbered and how)"
+                    (const :format "    " tags)
+                    (choice (const "ams")
+                            (const "none")
+                            (const "all")))
               (list :tag "indent (indentation with left or right alignment)"
                     (const :format "       " indent) (string))
               (list :tag "multlinewidth (width to use for the multline 
environment)"
@@ -1236,27 +1289,38 @@ For further information about MathJax options, see the 
MathJax documentation:
                             (const "right")))))
 
 (defcustom org-html-mathjax-template
-  "<script type=\"text/x-mathjax-config\">
-    MathJax.Hub.Config({
-        displayAlign: \"%ALIGN\",
-        displayIndent: \"%INDENT\",
-
-        \"HTML-CSS\": { scale: %SCALE,
-                        linebreaks: { automatic: \"%LINEBREAKS\" },
-                        webFont: \"%FONT\"
-                       },
-        SVG: {scale: %SCALE,
-              linebreaks: { automatic: \"%LINEBREAKS\" },
-              font: \"%FONT\"},
-        NativeMML: {scale: %SCALE},
-        TeX: { equationNumbers: {autoNumber: \"%AUTONUMBER\"},
-               MultLineWidth: \"%MULTLINEWIDTH\",
-               TagSide: \"%TAGSIDE\",
-               TagIndent: \"%TAGINDENT\"
-             }
-});
+  "<script>
+  window.MathJax = {
+    tex: {
+      ams: {
+        multlineWidth: '%MULTLINEWIDTH'
+      },
+      tags: '%TAGS',
+      tagSide: '%TAGSIDE',
+      tagIndent: '%TAGINDENT'
+    },
+    chtml: {
+      scale: %SCALE,
+      displayAlign: '%ALIGN',
+      displayIndent: '%INDENT'
+    },
+    svg: {
+      scale: %SCALE,
+      displayAlign: '%ALIGN',
+      displayIndent: '%INDENT'
+    },
+    output: {
+      font: '%FONT',
+      displayOverflow: '%OVERFLOW'
+    }
+  };
 </script>
-<script src=\"%PATH\"></script>"
+
+<script
+  id=\"MathJax-script\"
+  async
+  src=\"%PATH\">
+</script>"
   "The MathJax template.  See also `org-html-mathjax-options'."
   :group 'org-export-html
   :type 'string)
@@ -1268,9 +1332,11 @@ For further information about MathJax options, see the 
MathJax documentation:
 
 When set to `auto', check against the
 `org-export-with-author/email/creator/date' variables to set the
-content of the postamble.  When set to a string, use this string
-as the postamble.  When t, insert a string as defined by the
-formatting string in `org-html-postamble-format'.
+content of the postamble.  When t, insert a string as defined by the
+formatting string in `org-html-postamble-format'.  When set to a
+string, use this formatting string instead (see
+`org-html-postamble-format' for an example of such a formatting
+string).
 
 When set to a function, apply this function and insert the
 returned string.  The function takes the property list of export
@@ -1881,7 +1947,6 @@ INFO is a plist used as a communication channel."
         ;; empty, which is invalid.
         (title (if (org-string-nw-p title) title "&lrm;"))
         (charset (or (and org-html-coding-system
-                          (fboundp 'coding-system-get)
                           (symbol-name
                            (coding-system-get org-html-coding-system
                                               'mime-charset)))
@@ -1938,21 +2003,85 @@ INFO is a plist used as a communication channel."
   "Insert the user setup into the mathjax template.
 INFO is a plist used as a communication channel."
   (when (and (memq (plist-get info :with-latex) '(mathjax t))
-            (org-element-map (plist-get info :parse-tree)
-                '(latex-fragment latex-environment) #'identity info t nil t))
+             (org-element-map (plist-get info :parse-tree)
+                 '(latex-fragment latex-environment) #'identity info t nil t))
     (let ((template (plist-get info :html-mathjax-template))
-         (options (plist-get info :html-mathjax-options))
-         (in-buffer (or (plist-get info :html-mathjax) "")))
+          (options (let ((options (plist-get info :html-mathjax-options)))
+                     ;; If the user customized some legacy option, set
+                     ;; the corresponding new option to nil, so that
+                     ;; the legacy user choice overrides the default.
+                     ;; Otherwise, the user did not set the legacy
+                     ;; option, in which case still set the legacy
+                     ;; option but to no value, so that the code can
+                     ;; find its in-buffer value, if set.
+                     `((,(if (plist-member options 'autonumber)
+                             'tags 'autonumber)
+                        nil)
+                       (,(if (plist-member options 'linebreaks)
+                             'overflow 'linebreaks)
+                        nil)
+                       ,@options)))
+          (in-buffer (or (plist-get info :html-mathjax) "")))
       (dolist (e options (org-element-normalize-string template))
-       (let ((name (car e))
-             (val (nth 1 e)))
-         (when (string-match (concat "\\<" (symbol-name name) ":") in-buffer)
-           (setq val
-                 (car (read-from-string (substring in-buffer (match-end 0))))))
-         (unless (stringp val) (setq val (format "%s" val)))
-         (while (string-match (concat "%" (upcase (symbol-name name)))
-                              template)
-           (setq template (replace-match val t t template))))))))
+        (let ((symbol (car e))
+              (value (nth 1 e)))
+          (when (string-match (concat "\\<" (symbol-name symbol) ":")
+                              in-buffer)
+            (setq value
+                  (car (split-string (substring in-buffer
+                                                (match-end 0))))))
+          (when value
+            (pcase symbol
+              (`font
+               (when-let
+                   ((value-new
+                     (pcase value
+                       ("TeX" "mathjax-tex")
+                       ("STIX-Web" "mathjax-stix2")
+                       ("Asana-Math" "mathjax-asana")
+                       ("Neo-Euler" "mathjax-euler")
+                       ("Gyre-Pagella" "mathjax-pagella")
+                       ("Gyre-Termes" "mathjax-termes")
+                       ("Latin-Modern" "mathjax-modern"))))
+                 (setq value value-new)))
+              (`linebreaks
+               (org-display-warning
+                "Converting legacy MathJax option: linebreaks")
+               (setq symbol 'overflow
+                     value (if (string= value "true")
+                               "linebreak"
+                             "overflow")))
+              (`scale
+               (when (stringp value)
+                 (let ((value-maybe (string-to-number value)))
+                   (setq value
+                         (if (= value-maybe 0)
+                             (progn
+                               (org-display-warning
+                                (format "Non-numerical MathJax scale: %s"
+                                        value))
+                               1.0)
+                           value-maybe))))
+               (when (>= value 10)
+                 (setq value
+                       (let ((value-new (/ (float value) 100)))
+                         (org-display-warning
+                          (format "Converting legacy MathJax scale: %s to %s"
+                                  value
+                                  value-new))
+                         value-new))))
+              (`autonumber
+               (org-display-warning
+                "Converting legacy MathJax option: autonumber")
+               (setq symbol 'tags
+                     value (downcase value))))
+            (while (string-match (format "\\(%%%s\\)[^A-Z]"
+                                         (upcase (symbol-name symbol)))
+                                 template)
+              (setq template
+                    (replace-match (format "%s" value)
+                                   t
+                                   t template 1)))))))))
 
 (defun org-html-format-spec (info)
   "Return format specification for preamble and postamble.
@@ -1986,7 +2115,7 @@ communication channel."
             (if (functionp section) (funcall section info)
               (cond
                ((stringp section) (format-spec section spec))
-               ((eq section 'auto)
+               ((and (eq section 'auto) (eq type 'postamble))
                 (let ((date (cdr (assq ?d spec)))
                       (author (cdr (assq ?a spec)))
                       (email (cdr (assq ?e spec)))
@@ -2068,7 +2197,7 @@ holding export options."
         (format "%s\n"
                 (format decl
                         (or (and org-html-coding-system
-                                 (fboundp 'coding-system-get)
+                                  ;; FIXME: Use Emacs 22 style here, see 
`coding-system-get'.
                                  (coding-system-get org-html-coding-system 
'mime-charset))
                             "iso-8859-1"))))))
    (org-html-doctype info)
@@ -2222,7 +2351,7 @@ is the language used for CODE, as a string, or nil."
                    (funcall lang-mode)
                    (insert code)
                    ;; Fontify buffer.
-                   (org-font-lock-ensure)
+                    (font-lock-ensure)
                    ;; Remove formatting on newline characters.
                    (save-excursion
                      (let ((beg (point-min))
@@ -2872,11 +3001,14 @@ INFO is a plist containing export properties."
        ;; temporary buffer so that dvipng/imagemagick can properly
        ;; turn the fragment into an image.
        (setq latex-frag (concat latex-header latex-frag))))
-    (with-temp-buffer
-      (insert latex-frag)
-      (org-format-latex cache-relpath nil nil cache-dir nil
-                       "Creating LaTeX Image..." nil processing-type)
-      (buffer-string))))
+    (org-export-with-buffer-copy
+     :to-buffer (get-buffer-create " *Org HTML Export LaTeX*")
+     :drop-visibility t :drop-narrowing t :drop-contents t
+     (erase-buffer)
+     (insert latex-frag)
+     (org-format-latex cache-relpath nil nil cache-dir nil
+                      "Creating LaTeX Image..." nil processing-type)
+     (buffer-string))))
 
 (defun org-html--wrap-latex-environment (contents _ &optional caption label)
   "Wrap CONTENTS string within appropriate environment for equations.
@@ -3060,12 +3192,13 @@ INFO is a plist holding contextual information.  See
          (lambda (raw-path info)
            ;; Treat links to `file.org' as links to `file.html', if
            ;; needed.  See `org-html-link-org-files-as-html'.
-           (cond
-            ((and (plist-get info :html-link-org-files-as-html)
-                  (string= ".org"
-                           (downcase (file-name-extension raw-path "."))))
-             (concat (file-name-sans-extension raw-path) dot html-ext))
-            (t raw-path))))
+            (save-match-data
+             (cond
+              ((and (plist-get info :html-link-org-files-as-html)
+                     (let ((case-fold-search t))
+                       (string-match "\\(.+\\)\\.org\\(?:\\.gpg\\)?$" 
raw-path)))
+               (concat (match-string 1 raw-path) dot html-ext))
+              (t raw-path)))))
         (type (org-element-property :type link))
         (raw-path (org-element-property :path link))
         ;; Ensure DESC really exists, or set it to nil.
diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el
index 7a62145076..cfbfabafb0 100644
--- a/lisp/org/ox-icalendar.el
+++ b/lisp/org/ox-icalendar.el
@@ -3,10 +3,10 @@
 ;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik@gmail.com>
-;;      Nicolas Goaziou <n dot goaziou at gmail dot com>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;;      Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -32,10 +32,16 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'org-agenda)
 (require 'ox-ascii)
 (declare-function org-bbdb-anniv-export-ical "ol-bbdb" nil)
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
 
 
 
@@ -66,6 +72,17 @@ for timed events.  If non-zero, alarms are created.
   :version "24.1"
   :type 'integer)
 
+(defcustom org-icalendar-force-alarm nil
+  "Non-nil means alarm will be created even if is set to zero.
+
+This overrides default behavior where zero means no alarm.  With
+this set to non-nil and alarm set to zero, alarm will be created
+and will fire at the event start."
+  :group 'org-export-icalendar
+  :type 'boolean
+  :package-version '(Org . "9.6")
+  :safe #'booleanp)
+
 (defcustom org-icalendar-combined-name "OrgMode"
   "Calendar name for the combined iCalendar representing all agenda files."
   :group 'org-export-icalendar
@@ -84,6 +101,21 @@ keyword."
   :group 'org-export-icalendar
   :type '(repeat (string :tag "Tag")))
 
+(defcustom org-icalendar-scheduled-summary-prefix "S: "
+  "String prepended to exported scheduled headlines."
+  :group 'org-export-icalendar
+  :type 'string
+  :package-version '(Org . "9.6")
+  :safe #'stringp)
+
+
+(defcustom org-icalendar-deadline-summary-prefix "DL: "
+  "String prepended to exported headlines with a deadline."
+  :group 'org-export-icalendar
+  :type 'string
+  :package-version '(Org . "9.6")
+  :safe #'stringp)
+
 (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due)
   "Contexts where iCalendar export should use a deadline time stamp.
 
@@ -300,7 +332,9 @@ re-read the iCalendar file.")
     (:icalendar-store-UID nil nil org-icalendar-store-UID)
     (:icalendar-timezone nil nil org-icalendar-timezone)
     (:icalendar-use-deadline nil nil org-icalendar-use-deadline)
-    (:icalendar-use-scheduled nil nil org-icalendar-use-scheduled))
+    (:icalendar-use-scheduled nil nil org-icalendar-use-scheduled)
+    (:icalendar-scheduled-summary-prefix nil nil 
org-icalendar-scheduled-summary-prefix)
+    (:icalendar-deadline-summary-prefix nil nil 
org-icalendar-deadline-summary-prefix))
   :filters-alist
   '((:filter-headline . org-icalendar-clear-blank-lines))
   :menu-entry
@@ -430,7 +464,7 @@ format (e.g. \"Europe/London\").  In either case, the value 
of
                                         t)))
       ;; Convert timestamp into internal time in order to use
       ;; `format-time-string' and fix any mistake (i.e. MI >= 60).
-      (encode-time 0 mi h d m y)
+      (org-encode-time 0 mi h d m y)
       (and (or (string-equal tz "UTC")
               (and (null tz)
                    with-time-p
@@ -598,7 +632,9 @@ inlinetask within the section."
          ;; "VEVENT" component from scheduled, deadline, or any
          ;; timestamp in the entry.
          (let ((deadline (org-element-property :deadline entry))
-               (use-deadline (plist-get info :icalendar-use-deadline)))
+               (use-deadline (plist-get info :icalendar-use-deadline))
+                (deadline-summary-prefix (org-icalendar-cleanup-string
+                                          (plist-get info 
:icalendar-deadline-summary-prefix))))
            (and deadline
                 (pcase todo-type
                   (`todo (or (memq 'event-if-todo-not-done use-deadline)
@@ -607,9 +643,12 @@ inlinetask within the section."
                   (_ (memq 'event-if-not-todo use-deadline)))
                 (org-icalendar--vevent
                  entry deadline (concat "DL-" uid)
-                 (concat "DL: " summary) loc desc cat tz class)))
+                 (concat deadline-summary-prefix summary)
+                  loc desc cat tz class)))
          (let ((scheduled (org-element-property :scheduled entry))
-               (use-scheduled (plist-get info :icalendar-use-scheduled)))
+               (use-scheduled (plist-get info :icalendar-use-scheduled))
+                (scheduled-summary-prefix (org-icalendar-cleanup-string
+                                           (plist-get info 
:icalendar-scheduled-summary-prefix))))
            (and scheduled
                 (pcase todo-type
                   (`todo (or (memq 'event-if-todo-not-done use-scheduled)
@@ -618,7 +657,8 @@ inlinetask within the section."
                   (_ (memq 'event-if-not-todo use-scheduled)))
                 (org-icalendar--vevent
                  entry scheduled (concat "SC-" uid)
-                 (concat "S: " summary) loc desc cat tz class)))
+                 (concat scheduled-summary-prefix summary)
+                  loc desc cat tz class)))
          ;; When collecting plain timestamps from a headline and its
          ;; title, skip inlinetasks since collection will happen once
          ;; ENTRY is one of them.
@@ -792,8 +832,11 @@ Return VALARM component as a string, or nil if it isn't 
allowed."
   (let ((alarm-time
         (let ((warntime
                (org-element-property :APPT_WARNTIME entry)))
-          (if warntime (string-to-number warntime) 0))))
-    (and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
+          (if warntime (string-to-number warntime) nil))))
+    (and (or (and alarm-time
+                 (> alarm-time 0))
+            (> org-icalendar-alarm-time 0)
+            org-icalendar-force-alarm)
         (org-element-property :hour-start timestamp)
         (format "BEGIN:VALARM
 ACTION:DISPLAY
@@ -801,8 +844,10 @@ DESCRIPTION:%s
 TRIGGER:-P0DT0H%dM0S
 END:VALARM\n"
                 summary
-                (if (zerop alarm-time) org-icalendar-alarm-time alarm-time)))))
-
+                 (cond
+                  ((and alarm-time org-icalendar-force-alarm) alarm-time)
+                  ((and alarm-time (not (zerop alarm-time))) alarm-time)
+                  (t org-icalendar-alarm-time))))))
 
 ;;;; Template
 
@@ -994,7 +1039,7 @@ FILES is a list of files to build the calendar from."
              user-full-name
              ;; Timezone.
              (or (org-string-nw-p org-icalendar-timezone)
-                 (format-time-string "Z"))
+                 (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 6b5edd20f5..a6cfb24a9e 100644
--- a/lisp/org/ox-koma-letter.el
+++ b/lisp/org/ox-koma-letter.el
@@ -165,6 +165,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ox-latex)
 
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el
index e4e146bc5f..5b29a284c9 100644
--- a/lisp/org/ox-latex.el
+++ b/lisp/org/ox-latex.el
@@ -3,6 +3,7 @@
 ;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Daniel Fleischer <danflscr@gmail.com>
 ;; Keywords: outlines, hypermedia, calendar, wp
 
 ;; This file is part of GNU Emacs.
@@ -26,6 +27,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ox)
 (require 'ox-publish)
@@ -36,6 +40,14 @@
 (defvar org-latex-packages-alist)
 (defvar orgtbl-exp-regexp)
 
+(declare-function engrave-faces-latex-gen-preamble "ext:engrave-faces-latex")
+(declare-function engrave-faces-latex-buffer "ext:engrave-faces-latex")
+(declare-function engrave-faces-latex-gen-preamble-line 
"ext:engrave-faces-latex")
+(declare-function engrave-faces-get-theme "ext:engrave-faces")
+
+(defvar engrave-faces-latex-output-style)
+(defvar engrave-faces-current-preset-style)
+(defvar engrave-faces-latex-mathescape)
 
 
 ;;; Define Back-End
@@ -124,6 +136,9 @@
     (:latex-default-quote-environment nil nil 
org-latex-default-quote-environment)
     (:latex-default-table-mode nil nil org-latex-default-table-mode)
     (:latex-diary-timestamp-format nil nil org-latex-diary-timestamp-format)
+    (:latex-engraved-options nil nil org-latex-engraved-options)
+    (:latex-engraved-preamble nil nil org-latex-engraved-preamble)
+    (:latex-engraved-theme "LATEX_ENGRAVED_THEME" nil org-latex-engraved-theme)
     (:latex-footnote-defined-format nil nil org-latex-footnote-defined-format)
     (:latex-footnote-separator nil nil org-latex-footnote-separator)
     (:latex-format-drawer-function nil nil org-latex-format-drawer-function)
@@ -138,7 +153,7 @@
     (:latex-inactive-timestamp-format nil nil 
org-latex-inactive-timestamp-format)
     (:latex-inline-image-rules nil nil org-latex-inline-image-rules)
     (:latex-link-with-unknown-path-format nil nil 
org-latex-link-with-unknown-path-format)
-    (:latex-listings nil nil org-latex-listings)
+    (:latex-src-block-backend nil nil org-latex-src-block-backend)
     (:latex-listings-langs nil nil org-latex-listings-langs)
     (:latex-listings-options nil nil org-latex-listings-options)
     (:latex-minted-langs nil nil org-latex-minted-langs)
@@ -160,148 +175,126 @@
 
 ;;; Internal Variables
 
-(defconst org-latex-babel-language-alist
-  '(("af" . "afrikaans")
-    ("bg" . "bulgarian")
-    ("ca" . "catalan")
-    ("cs" . "czech")
-    ("cy" . "welsh")
-    ("da" . "danish")
-    ("de" . "germanb")
-    ("de-at" . "naustrian")
-    ("de-de" . "ngerman")
-    ("el" . "greek")
-    ("en" . "english")
-    ("en-au" . "australian")
-    ("en-ca" . "canadian")
-    ("en-gb" . "british")
-    ("en-ie" . "irish")
-    ("en-nz" . "newzealand")
-    ("en-us" . "american")
-    ("es" . "spanish")
-    ("et" . "estonian")
-    ("eu" . "basque")
-    ("fi" . "finnish")
-    ("fr" . "french")
-    ("fr-ca" . "canadien")
-    ("gl" . "galician")
-    ("hr" . "croatian")
-    ("hu" . "hungarian")
-    ("id" . "indonesian")
-    ("is" . "icelandic")
-    ("it" . "italian")
-    ("la" . "latin")
-    ("ms" . "malay")
-    ("nl" . "dutch")
-    ("nb" . "norsk")
-    ("nn" . "nynorsk")
-    ("no" . "norsk")
-    ("pl" . "polish")
-    ("pt" . "portuguese")
-    ("pt-br" . "brazilian")
-    ("ro" . "romanian")
-    ("ru" . "russian")
-    ("sa" . "sanskrit")
-    ("sb" . "uppersorbian")
-    ("sk" . "slovak")
-    ("sl" . "slovene")
-    ("sq" . "albanian")
-    ("sr" . "serbian")
-    ("sv" . "swedish")
-    ("ta" . "tamil")
-    ("tr" . "turkish")
-    ("uk" . "ukrainian"))
-  "Alist between language code and corresponding Babel option.")
-
-(defconst org-latex-polyglossia-language-alist
-  '(("am" "amharic")
-    ("ar" "arabic")
-    ("ast" "asturian")
-    ("bg" "bulgarian")
-    ("bn" "bengali")
-    ("bo" "tibetan")
-    ("br" "breton")
-    ("ca" "catalan")
-    ("cop" "coptic")
-    ("cs" "czech")
-    ("cy" "welsh")
-    ("da" "danish")
-    ("de" "german" "german")
-    ("de-at" "german" "austrian")
-    ("de-de" "german" "german")
-    ("dsb" "lsorbian")
-    ("dv" "divehi")
-    ("el" "greek")
-    ("en" "english" "usmax")
-    ("en-au" "english" "australian")
-    ("en-gb" "english" "uk")
-    ("en-nz" "english" "newzealand")
-    ("en-us" "english" "usmax")
-    ("eo" "esperanto")
-    ("es" "spanish")
-    ("et" "estonian")
-    ("eu" "basque")
-    ("fa" "farsi")
-    ("fi" "finnish")
-    ("fr" "french")
-    ("fu" "friulan")
-    ("ga" "irish")
-    ("gd" "scottish")
-    ("gl" "galician")
-    ("he" "hebrew")
-    ("hi" "hindi")
-    ("hr" "croatian")
-    ("hsb" "usorbian")
-    ("hu" "magyar")
-    ("hy" "armenian")
-    ("ia" "interlingua")
-    ("id" "bahasai")
-    ("is" "icelandic")
-    ("it" "italian")
-    ("kn" "kannada")
-    ("la" "latin" "modern")
-    ("la-classic" "latin" "classic")
-    ("la-medieval" "latin" "medieval")
-    ("la-modern" "latin" "modern")
-    ("lo" "lao")
-    ("lt" "lithuanian")
-    ("lv" "latvian")
-    ("ml" "malayalam")
-    ("mr" "maranthi")
-    ("nb" "norsk")
-    ("nko" "nko")
-    ("nl" "dutch")
-    ("nn" "nynorsk")
-    ("no" "norsk")
-    ("oc" "occitan")
-    ("pl" "polish")
-    ("pms" "piedmontese")
-    ("pt" "portuges")
-    ("pt-br" "brazilian")
-    ("rm" "romansh")
-    ("ro" "romanian")
-    ("ru" "russian")
-    ("sa" "sanskrit")
-    ("se" "samin")
-    ("sk" "slovak")
-    ("sl" "slovenian")
-    ("sq" "albanian")
-    ("sr" "serbian")
-    ("sv" "swedish")
-    ("syr" "syriac")
-    ("ta" "tamil")
-    ("te" "telugu")
-    ("th" "thai")
-    ("tk" "turkmen")
-    ("tr" "turkish")
-    ("uk" "ukrainian")
-    ("ur" "urdu")
-    ("vi" "vietnamese"))
-  "Alist between language code and corresponding Polyglossia option.")
-
-(defconst org-latex-table-matrix-macros '(("bordermatrix" . "\\cr")
+(defconst org-latex-language-alist
+  '(("am" :babel-ini-only "amharic" :polyglossia "amharic" :lang-name 
"Amharic")
+    ("ar" :babel "arabic" :polyglossia "arabic" :lang-name "Arabic")
+    ("ast" :babel-ini-only "asturian" :polyglossia "asturian" :lang-name 
"Asturian")
+    ("bg"  :babel "bulgarian" :polyglossia "bulgarian" :lang-name "Bulgarian")
+    ("bn"  :babel-ini-only "bengali" :polyglossia "bengali" :lang-name 
"Bengali")
+    ("bo"  :babel-ini-only "tibetan" :polyglossia "tibetan" :lang-name 
"Tibetan")
+    ("br"  :babel "breton" :polyglossia "breton" :lang-name "Breton")
+    ("ca"  :babel "catalan" :polyglossia "catalan" :lang-name "Catalan")
+    ("cop"  :babel-ini-only "coptic" :polyglossia "coptic" :lang-name "Coptic")
+    ("cs"  :babel "czech" :polyglossia "czech" :lang-name "Czech")
+    ("cy"  :babel "welsh" :polyglossia "welsh" :lang-name "Welsh")
+    ("da"  :babel "danish" :polyglossia "danish" :lang-name "Danish")
+    ("de"  :babel "ngerman" :polyglossia "german" :polyglossia-variant 
"german" :lang-name "German")
+    ("de-at"  :babel "naustrian" :polyglossia "german" :polyglossia-variant 
"austrian" :lang-name "German")
+    ("dsb"  :babel "lsorbian" :polyglossia "sorbian" :polyglossia-variant 
"lower" :lang-name "Lower Sorbian")
+    ("dv"  :babel-ini-only "divehi" :polyglossia "divehi" :lang-name "Divehi")
+    ("el"  :babel "greek" :polyglossia "greek" :lang-name "Greek")
+    ("el-polyton"  :babel "polutonikogreek" :polyglossia "greek" 
:polyglossia-variant "polytonic" :lang-name "Polytonic Greek")
+    ("en"  :babel "american" :polyglossia "english" :polyglossia-variant 
"usmax" :lang-name "English")
+    ("en-au"  :babel "australian" :polyglossia "english" :polyglossia-variant 
"australian" :lang-name "English")
+    ("en-gb"  :babel "british" :polyglossia "english" :polyglossia-variant 
"uk" :lang-name "English")
+    ("en-nz"  :babel "newzealand" :polyglossia "english" :polyglossia-variant 
"newzealand" :lang-name "English")
+    ("en-us"  :babel "american" :polyglossia "english" :polyglossia-variant 
"usmax" :lang-name "English")
+    ("eo"  :babel "esperanto" :polyglossia "esperanto" :lang-name "Esperanto")
+    ("es"  :babel "spanish" :polyglossia "spanish" :lang-name "Spanish")
+    ("es-mx"  :babel "spanishmx" :polyglossia "spanish" :polyglossia-variant 
"mexican" :lang-name "Spanish")
+    ("et"  :babel "estonian" :polyglossia "estonian" :lang-name "Estonian")
+    ("eu"  :babel "basque" :polyglossia "basque" :lang-name "Basque")
+    ("fa"  :babel "farsi" :polyglossia "farsi" :lang-name "Farsi")
+    ("fi"  :babel "finnish" :polyglossia "finnish" :lang-name "Finnish")
+    ("fr"  :babel "french" :polyglossia "french" :lang-name "French")
+    ("fr-ca"  :babel "canadien" :polyglossia "french" :polyglossia-variant 
"canadian" :lang-name "French")
+    ("fur"  :babel "friulan" :polyglossia "friulan" :lang-name "Friulian")
+    ("ga"  :babel "irish" :polyglossia "irish" :lang-name "Irish")
+    ("gd"  :babel "scottish" :polyglossia "scottish" :lang-name "Scottish 
Gaelic")
+    ("gl"  :babel "galician" :polyglossia "galician" :lang-name "Galician")
+    ("he"  :babel "hebrew" :polyglossia "hebrew" :lang-name "Hebrew")
+    ("hi"  :babel "hindi" :polyglossia "hindi" :lang-name "Hindi")
+    ("hr"  :babel "croatian" :polyglossia "croatian" :lang-name "Croatian")
+    ("hsb"  :babel "uppersorbian" :polyglossia "sorbian" :polyglossia-variant 
"upper" :lang-name "Upper Sorbian")
+    ("hu"  :babel "magyar" :polyglossia "magyar" :lang-name "Magyar")
+    ("hy"  :babel-ini-only "armenian" :polyglossia "armenian" :lang-name 
"Armenian")
+    ("ia"  :babel "interlingua" :polyglossia "interlingua" :lang-name 
"Interlingua")
+    ("id"  :babel-ini-only "bahasai" :polyglossia "bahasai" :lang-name 
"Bahasai")
+    ("is"  :babel "icelandic" :polyglossia "icelandic" :lang-name "Icelandic")
+    ("it"  :babel "italian" :polyglossia "italian" :lang-name "Italian")
+    ("kn"  :babel-ini-only "kannada" :polyglossia "kannada" :lang-name 
"Kannada")
+    ("la"  :babel "latin" :polyglossia "latin" :lang-name "Latin")
+    ("la-classic"  :babel "classiclatin" :polyglossia "latin" 
:polyglossia-variant "classic" :lang-name "Classic Latin")
+    ("la-medieval"  :babel "medievallatin" :polyglossia "latin" 
:polyglossia-variant "medieval" :lang-name "Medieval Latin")
+    ("la-ecclesiastic"  :babel "ecclesiasticlatin" :polyglossia "latin" 
:polyglossia-variant "ecclesiastic" :lang-name "Ecclesiastic Latin")
+    ("lo"  :babel-ini-only "lao" :polyglossia "lao" :lang-name "Lao")
+    ("lt"  :babel "lithuanian" :polyglossia "lithuanian" :lang-name 
"Lithuanian")
+    ("lv"  :babel "latvian" :polyglossia "latvian" :lang-name "Latvian")
+    ("ml"  :babel-ini-only "malayalam" :polyglossia "malayalam" :lang-name 
"Malayalam")
+    ("mr"  :babel-ini-only "maranthi" :polyglossia "maranthi" :lang-name 
"Maranthi")
+    ("nb"  :babel "norsk" :polyglossia "norwegian" :polyglossia-variant 
"bokmal" :lang-name "Norwegian Bokmål")
+    ("nl"  :babel "dutch" :polyglossia "dutch" :lang-name "Dutch")
+    ("nn"  :babel "nynorsk" :polyglossia "norwegian" :polyglossia-variant 
"nynorsk" :lang-name "Norwegian Nynorsk")
+    ("no"  :babel "norsk" :polyglossia "norsk" :lang-name "Norwegian")
+    ("oc"  :babel "occitan" :polyglossia "occitan" :lang-name "Occitan")
+    ("pl"  :babel "polish" :polyglossia "polish" :lang-name "Polish")
+    ("pms"  :babel "piedmontese" :polyglossia "piedmontese" :lang-name 
"Piedmontese")
+    ("pt"  :babel "portuges" :polyglossia "portuges" :lang-name "Portuges")
+    ("pt-br"  :babel "brazilian" :polyglossia "brazilian" :lang-name 
"Portuges")
+    ("rm"  :babel-ini-only "romansh" :polyglossia "romansh" :lang-name 
"Romansh")
+    ("ro"  :babel "romanian" :polyglossia "romanian" :lang-name "Romanian")
+    ("ru"  :babel "russian" :polyglossia "russian" :lang-name "Russian")
+    ("sa"  :babel-ini-only "sanskrit" :polyglossia "sanskrit" :lang-name 
"Sanskrit")
+    ("sk"  :babel "slovak" :polyglossia "slovak" :lang-name "Slovak")
+    ("sl"  :babel "slovene" :polyglossia "slovene" :lang-name "Slovene")
+    ("sq"  :babel "albanian" :polyglossia "albanian" :lang-name "Albanian")
+    ("sr"  :babel "serbian" :polyglossia "serbian" :lang-name "Serbian")
+    ("sv"  :babel "swedish" :polyglossia "swedish" :lang-name "Swedish")
+    ("syr"  :babel-ini-only "syriac" :polyglossia "syriac" :lang-name "Syriac")
+    ("ta"  :babel-ini-only "tamil" :polyglossia "tamil" :lang-name "Tamil")
+    ("te"  :babel-ini-only "telugu" :polyglossia "telugu" :lang-name "Telugu")
+    ("th"  :babel "thai" :polyglossia "thai" :lang-name "Thai")
+    ("tk"  :babel "turkmen" :polyglossia "turkmen" :lang-name "Turkmen")
+    ("tr"  :babel "turkish" :polyglossia "turkish" :lang-name "Turkish")
+    ("uk"  :babel "ukrainian" :polyglossia "ukrainian" :lang-name "Ukrainian")
+    ("ur"  :babel-ini-only "urdu" :polyglossia "urdu" :lang-name "Urdu")
+    ("vi"  :babel "vietnamese" :polyglossia "vietnamese" :lang-name 
"Vietnamese"))
+  "Alist between language code and its properties for LaTeX export.
+
+In each element of the list car is always the code of the
+language and cdr is a property list.  Valid keywords for this
+list can be:
+
+- `:babel' the name of the language loaded by the Babel LaTeX package
+
+- `:polyglossia' the name of the language loaded by the Polyglossia
+  LaTeX package
+
+- `:babel-ini-only' the name of the language loaded by Babel
+ exclusively through the new ini files method.  See
+ `http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf'
+
+- `:polyglossia-variant' the language variant loaded by Polyglossia
+
+- `:lang-name' the actual name of the language.")
+
+(defconst org-latex-line-break-safe "\\\\[0pt]"
+  "Linebreak protecting the following [...].
+
+Without \"[0pt]\" it would be interpreted as an optional argument to
+the \\\\.
+
+This constant, for example, makes the below code not err:
+
+\\begin{tabular}{c|c}
+    [t] & s\\\\[0pt]
+    [I] & A\\\\[0pt]
+    [m] & kg
+\\end{tabular}")
+
+(defconst org-latex-table-matrix-macros `(("bordermatrix" . "\\cr")
                                          ("qbordermatrix" . "\\cr")
-                                         ("kbordermatrix" . "\\\\"))
+                                         ("kbordermatrix" . 
,org-latex-line-break-safe))
   "Alist between matrix macros and their row ending.")
 
 (defconst org-latex-math-environments-re
@@ -755,8 +748,11 @@ environment."
 
 (defcustom org-latex-inline-image-rules
   `(("file" . ,(rx "."
-                  (or "pdf" "jpeg" "jpg" "png" "ps" "eps" "tikz" "pgf" "svg")
-                  eos)))
+                   (or "pdf" "jpeg" "jpg" "png" "ps" "eps" "tikz" "pgf" "svg")
+                   eos))
+    ("https" . ,(rx "."
+                    (or "jpeg" "jpg" "png" "ps" "eps" "tikz" "pgf" "svg")
+                    eos)))
   "Rules characterizing image files that can be inlined into LaTeX.
 
 A rule consists in an association whose key is the type of link
@@ -769,7 +765,7 @@ pdflatex, pdf, jpg and png images are OK.  When processing
 through dvi to Postscript, only ps and eps are allowed.  The
 default we use here encompasses both."
   :group 'org-export-latex
-  :package-version '(Org . "9.4")
+  :package-version '(Org . "9.6")
   :type '(alist :key-type (string :tag "Type")
                :value-type (regexp :tag "Path")))
 
@@ -929,27 +925,38 @@ The function should return the string to be exported."
 
 ;; Src blocks
 
-(defcustom org-latex-listings nil
-  "Non-nil means export source code using the listings package.
+(defcustom org-latex-src-block-backend 'verbatim
+  "Backend used to generate source code listings.
+
+This sets the behavior for fontifying source code, possibly even with
+color.  There are four implementations of this functionality you may
+choose from (ordered from least to most capable):
+1. Verbatim
+2. Listings
+3. Minted
+4. Engraved
 
-This package will fontify source code, possibly even with color.
-If you want to use this, you also need to make LaTeX use the
-listings package, and if you want to have color, the color
-package.  Just add these to `org-latex-packages-alist', for
-example using customize, or with something like:
+The first two options provide basic syntax
+highlighting (listings), or none at all (verbatim).
+
+When using listings, you also need to make use of LaTeX package
+\"listings\".  The \"color\" LaTeX package is also needed if you
+would like color too.  These can simply be added to
+`org-latex-packages-alist', using customize or something like:
 
   (require \\='ox-latex)
   (add-to-list \\='org-latex-packages-alist \\='(\"\" \"listings\"))
   (add-to-list \\='org-latex-packages-alist \\='(\"\" \"color\"))
 
-Alternatively,
+There are two further options for more comprehensive
+fontification. The first can be set with,
 
-  (setq org-latex-listings \\='minted)
+  (setq org-latex-src-block-backend \\='minted)
 
-causes source code to be exported using the minted package as
-opposed to listings.  If you want to use minted, you need to add
-the minted package to `org-latex-packages-alist', for example
-using customize, or with
+which causes source code to be exported using the LaTeX package
+minted as opposed to listings.  If you want to use minted, you
+need to add the minted package to `org-latex-packages-alist', for
+example using customize, or with
 
   (require \\='ox-latex)
   (add-to-list \\='org-latex-packages-alist \\='(\"newfloat\" \"minted\"))
@@ -962,13 +969,30 @@ passed to pdflatex.
 The minted choice has possible repercussions on the preview of
 latex fragments (see `org-preview-latex-fragment').  If you run
 into previewing problems, please consult
-URL `https://orgmode.org/worg/org-tutorials/org-latex-preview.html'."
+URL `https://orgmode.org/worg/org-tutorials/org-latex-preview.html'.
+
+The most comprehensive option can be set with,
+
+  (setq org-latex-src-block-backend \\='engraved)
+
+which causes source code to be run through
+`engrave-faces-latex-buffer', which generates colorings using
+Emacs' font-lock information.  This requires the Emacs package
+engrave-faces (available from ELPA), and the LaTeX package
+fvextra be installed.
+
+The styling of the engraved result can be customized with
+`org-latex-engraved-preamble' and `org-latex-engraved-options'.
+The default preamble also uses the LaTeX package tcolorbox in
+addition to fvextra."
   :group 'org-export-latex
+  :package-version '(Org . "9.6")
   :type '(choice
-         (const :tag "Use listings" t)
+         (const :tag "Use listings" listings)
          (const :tag "Use minted" minted)
-         (const :tag "Export verbatim" nil))
-  :safe (lambda (s) (memq s '(t nil minted))))
+         (const :tag "Use engrave-faces-latex" engraved)
+         (const :tag "Export verbatim" verbatim))
+  :safe (lambda (s) (memq s '(listings minted engraved verbatim))))
 
 (defcustom org-latex-listings-langs
   '((emacs-lisp "Lisp") (lisp "Lisp") (clojure "Lisp")
@@ -1002,12 +1026,16 @@ in this list - but it does not hurt if it is present."
 
 These options are supplied as a comma-separated list to the
 \\lstset command.  Each element of the association list should be
-a list containing two strings: the name of the option, and the
-value.  For example,
+a list or cons cell containing two strings: the name of the
+option, and the value.  For example,
 
   (setq org-latex-listings-options
     \\='((\"basicstyle\" \"\\\\small\")
       (\"keywordstyle\" \"\\\\color{black}\\\\bfseries\\\\underbar\")))
+  ; or
+  (setq org-latex-listings-options
+    \\='((\"basicstyle\" . \"\\\\small\")
+      (\"keywordstyle\" . \"\\\\color{black}\\\\bfseries\\\\underbar\")))
 
 will typeset the code in a small size font with underlined, bold
 black keywords.
@@ -1055,11 +1083,14 @@ with:
 
 These options are supplied within square brackets in
 \\begin{minted} environments.  Each element of the alist should
-be a list containing two strings: the name of the option, and the
-value.  For example,
+be a list or cons cell containing two strings: the name of the
+option, and the value.  For example,
 
   (setq org-latex-minted-options
     \\='((\"bgcolor\" \"bg\") (\"frame\" \"lines\")))
+  ; or
+  (setq org-latex-minted-options
+    \\='((\"bgcolor\" . \"bg\") (\"frame\" . \"lines\")))
 
 will result in source blocks being exported with
 
@@ -1131,6 +1162,203 @@ will produce
   :version "26.1"
   :package-version '(Org . "9.0"))
 
+(defcustom org-latex-engraved-preamble
+  "\\usepackage{fvextra}
+
+[FVEXTRA-SETUP]
+
+% Make line numbers smaller and grey.
+\\renewcommand\\theFancyVerbLine{\\footnotesize\\color{black!40!white}\\arabic{FancyVerbLine}}
+
+\\usepackage{xcolor}
+
+% In case engrave-faces-latex-gen-preamble has not been run.
+\\providecolor{EfD}{HTML}{f7f7f7}
+\\providecolor{EFD}{HTML}{28292e}
+
+% Define a Code environment to prettily wrap the fontified code.
+\\usepackage[breakable,xparse]{tcolorbox}
+\\DeclareTColorBox[]{Code}{o}%
+{colback=EfD!98!EFD, colframe=EfD!95!EFD,
+  fontupper=\\footnotesize\\setlength{\\fboxsep}{0pt},
+  colupper=EFD,
+  IfNoValueTF={#1}%
+  {boxsep=2pt, arc=2.5pt, outer arc=2.5pt,
+    boxrule=0.5pt, left=2pt}%
+  {boxsep=2.5pt, arc=0pt, outer arc=0pt,
+    boxrule=0pt, leftrule=1.5pt, left=0.5pt},
+  right=2pt, top=1pt, bottom=0.5pt,
+  breakable}
+
+[LISTINGS-SETUP]"
+  "Preamble content injected when using engrave-faces-latex for source blocks.
+This is relevant when `org-latex-src-block-backend' is set to `engraved'.
+
+There is quite a lot of flexibility in what this preamble can be,
+as long as it:
+- Loads the fvextra package.
+- Loads the package xcolor (if it is not already loaded elsewhere).
+- Defines a \"Code\" environment (note the capital C), which all
+  \"Verbatim\" environments (provided by fvextra) will be wrapped with.
+
+In the default value the colors \"EFD\" and \"EfD\" are provided
+as they are respectively the foreground and background colors,
+just in case they aren't provided by the generated preamble, so
+we can assume they are always set.
+
+Within this preamble there are two recognized macro-like placeholders:
+
+  [FVEXTRA-SETUP]
+
+  [LISTINGS-SETUP]
+
+Unless you have a very good reason, both of these placeholders
+should be included in the preamble.
+
+FVEXTRA-SETUP sets fvextra's defaults according to
+`org-latex-engraved-options', and LISTINGS-SETUP creates the
+listings environment used for captioned or floating code blocks,
+as well as defining \\listoflistings."
+  :group 'org-export-latex
+  :type 'string
+  :package-version '(Org . "9.6"))
+
+(defcustom org-latex-engraved-options
+  '(("commandchars" . "\\\\\\{\\}")
+    ("highlightcolor" . "white!95!black!80!blue")
+    ("breaklines" . "true")
+    ("breaksymbol" . 
"\\color{white!60!black}\\tiny\\ensuremath{\\hookrightarrow}"))
+  "Association list of options for the latex fvextra package when engraving 
code.
+
+These options are set using \\fvset{...} in the preamble of the
+LaTeX export.  Each element of the alist should be a list or cons
+cell containing two strings: the name of the option, and the
+value.  For example,
+
+  (setq org-latex-engraved-options
+    \\='((\"highlightcolor\" \"green\") (\"frame\" \"lines\")))
+  ; or
+  (setq org-latex-engraved-options
+    \\='((\"highlightcolor\" . \"green\") (\"frame\" . \"lines\")))
+
+will result in the following LaTeX in the preamble
+
+\\fvset{%
+  bgcolor=bg,
+  frame=lines}
+
+This will affect all fvextra environments.  Note that the same
+options will be applied to all blocks.  If you need
+block-specific options, you may use the following syntax:
+
+  #+ATTR_LATEX: :options key1=value1,key2=value2
+  #+BEGIN_SRC <LANG>
+  ...
+  #+END_SRC"
+  :group 'org-export-latex
+  :package-version '(Org . "9.6")
+  :type '(alist :key-type (string :tag "option")
+                :value-type (string :tag "value")))
+
+(defcustom org-latex-engraved-theme nil
+  "The theme that should be used for engraved code, when non-nil.
+This can be set to any theme defined in `engrave-faces-themes' or
+loadable by Emacs.  When set to t, the current Emacs theme is
+used.  When nil, no theme is applied."
+  :group 'org-export-latex
+  :package-version '(Org . "9.6")
+  :type 'symbol)
+
+(defun org-latex-generate-engraved-preamble (info)
+  "Generate the preamble to setup engraved code.
+The result is constructed from the :latex-engraved-preamble and
+:latex-engraved-optionsn export options, the default values of
+which are given by `org-latex-engraved-preamble' and
+`org-latex-engraved-options' respectively."
+  (let* ((engraved-options
+          (plist-get info :latex-engraved-options))
+         (engraved-preamble (plist-get info :latex-engraved-preamble))
+         (engraved-theme (plist-get info :latex-engraved-theme))
+         (engraved-themes
+          (mapcar
+           #'intern
+           (cl-delete-duplicates
+            (org-element-map
+                (plist-get info :parse-tree)
+                '(src-block inline-src-block)
+              (lambda (src)
+                (plist-get
+                 (org-export-read-attribute :attr_latex src)
+                 :engraved-theme))
+              info))))
+         (gen-theme-spec
+          (lambda (theme)
+            (if (eq engrave-faces-latex-output-style 'preset)
+                (engrave-faces-latex-gen-preamble theme)
+              (engrave-faces-latex-gen-preamble-line
+               'default
+               (alist-get 'default
+                          (if theme
+                              (engrave-faces-get-theme (intern theme))
+                            engrave-faces-current-preset-style)))))))
+    (when (stringp engraved-theme)
+      (setq engraved-theme (intern engraved-theme)))
+    (when (string-match "^[ \t]*\\[FVEXTRA-SETUP\\][ \t]*\n?" 
engraved-preamble)
+      (setq engraved-preamble
+            (replace-match
+             (concat
+              "\\fvset{%\n  "
+              (org-latex--make-option-string engraved-options ",\n  ")
+              "}\n")
+             t t
+             engraved-preamble)))
+    (when (string-match "^[ \t]*\\[LISTINGS-SETUP\\][ \t]*\n?" 
engraved-preamble)
+      (setq engraved-preamble
+            (replace-match
+             (format
+              "%% Support listings with captions
+\\usepackage{float}
+\\floatstyle{%s}
+\\newfloat{listing}{htbp}{lst}
+\\newcommand{\\listingsname}{Listing}
+\\floatname{listing}{\\listingsname}
+\\newcommand{\\listoflistingsname}{List of Listings}
+\\providecommand{\\listoflistings}{\\listof{listing}{\\listoflistingsname}}\n"
+              (if (memq 'src-block org-latex-caption-above)
+                  "plaintop" "plain"))
+             t t
+             engraved-preamble)))
+    (concat
+     "\n% Setup for code blocks [1/2]\n\n"
+     engraved-preamble
+     "\n\n% Setup for code blocks [2/2]: syntax highlighting colors\n\n"
+     (if (require 'engrave-faces-latex nil t)
+         (if engraved-themes
+             (concat
+              (mapconcat
+               (lambda (theme)
+                 (format
+                  "\n\\newcommand{\\engravedtheme%s}{%%\n%s\n}"
+                  (replace-regexp-in-string "[^A-Za-z]" "" (symbol-name theme))
+                  (replace-regexp-in-string
+                   "newcommand" "renewcommand"
+                   (replace-regexp-in-string
+                    "#" "##"
+                    (funcall gen-theme-spec theme)))))
+               engraved-themes
+               "\n")
+              "\n\n"
+              (cond
+               ((memq engraved-theme engraved-themes)
+                (concat "\\engravedtheme"
+                        (replace-regexp-in-string
+                         "[^A-Za-z]" "" engraved-theme)
+                        "\n"))
+               (t (funcall gen-theme-spec engraved-theme))))
+           (funcall gen-theme-spec engraved-theme))
+       (message "Cannot engrave source blocks. Consider installing 
`engrave-faces'.")
+       "% WARNING syntax highlighting unavailable as engrave-faces-latex was 
missing.\n")
+     "\n")))
 
 ;;;; Compilation
 
@@ -1187,6 +1415,9 @@ A better approach is to use a compiler suit such as 
`latexmk'."
       "%latex -interaction nonstopmode -output-directory %o %f"))
   "Commands to process a LaTeX file to a PDF file.
 
+The command output will be parsed to extract compilation errors and
+warnings according to `org-latex-known-warnings'.
+
 This is a list of strings, each of them will be given to the
 shell as a command.  %f in the command will be replaced by the
 relative file name, %F by the absolute file name, %b by the file
@@ -1209,7 +1440,7 @@ Alternatively, this may be a Lisp function that does the
 processing, so you could use this to apply the machinery of
 AUCTeX or the Emacs LaTeX mode.  This function should accept the
 file name as its single argument."
-  :group 'org-export-pdf
+  :group 'org-export-latex
   :type '(choice
          (repeat :tag "Shell command sequence"
                  (string :tag "Shell command"))
@@ -1315,6 +1546,7 @@ Eventually, if FULL is non-nil, wrap label within 
\"\\label{}\"."
                           (`paragraph
                            (and (org-element-property :caption datum)
                                 "fig:"))
+                           (`src-block "lst:")
                           (_ nil))
                         (org-export-get-reference datum info))))))
     (cond ((not full) label)
@@ -1339,7 +1571,8 @@ For non-floats, see `org-latex--wrap-label'."
                            main)
                       (and (eq type 'src-block)
                            (not (plist-get attr :float))
-                           (null (plist-get info :latex-listings)))))
+                           (memq (plist-get info :latex-src-block-backend)
+                                  '(verbatim nil)))))
         (short (org-export-get-caption element t))
         (caption-from-attr-latex (plist-get attr :caption)))
     (cond
@@ -1359,7 +1592,8 @@ For non-floats, see `org-latex--wrap-label'."
                      (paragraph "figure")
                      (image "figure")
                      (special-block "figure")
-                     (src-block (if (plist-get info :latex-listings)
+                     (src-block (if (not (memq (plist-get info 
:latex-src-block-backend)
+                                                '(verbatim nil)))
                                     "listing"
                                   "figure"))
                      (t (symbol-name type*)))
@@ -1396,31 +1630,52 @@ Insertion of guessed language only happens when Babel 
package has
 explicitly been loaded.  Then it is added to the rest of
 package's options.
 
-The argument to Babel may be \"AUTO\" which is then replaced with
-the language of the document or `org-export-default-language'
-unless language in question is already loaded.
+The optional argument to Babel or the mandatory argument to
+`\babelprovide' command may be \"AUTO\" which is then replaced
+with the language of the document or
+`org-export-default-language' unless language in question is
+already loaded.
 
 Return the new header."
-  (let ((language-code (plist-get info :language)))
-    ;; If no language is set or Babel package is not loaded, return
-    ;; HEADER as-is.
-    (if (or (not (stringp language-code))
-           (not (string-match "\\\\usepackage\\[\\(.*\\)\\]{babel}" header)))
+  (let* ((language-code (plist-get info :language))
+        (plist (cdr
+                (assoc language-code org-latex-language-alist)))
+        (language (plist-get plist :babel))
+        (language-ini-only (plist-get plist :babel-ini-only))
+        ;; If no language is set, or Babel package is not loaded, or
+        ;; LANGUAGE keyword value is a language served by Babel
+        ;; exclusively through ini files, return HEADER as-is.
+        (header (if (or language-ini-only
+                        (not (stringp language-code))
+                        (not (string-match 
"\\\\usepackage\\[\\(.*\\)\\]{babel}" header)))
+                    header
+                  (let ((options (save-match-data
+                                   (org-split-string (match-string 1 header) 
",[ \t]*"))))
+                    ;; If LANGUAGE is already loaded, return header
+                    ;; without AUTO.  Otherwise, replace AUTO with language or
+                    ;; append language if AUTO is not present.  Languages that 
are
+                    ;; served in Babel exclusively through ini files are not 
added
+                    ;; to the babel argument, and must be loaded using
+                    ;; `\babelprovide'.
+                    (replace-match
+                     (mapconcat (lambda (option) (if (equal "AUTO" option) 
language option))
+                                (cond ((member language options) (delete 
"AUTO" options))
+                                      ((member "AUTO" options) options)
+                                      (t (append options (list language))))
+                                ", ")
+                     t nil header 1)))))
+    ;; If `\babelprovide[args]{AUTO}' is present, AUTO is
+    ;; replaced by LANGUAGE.
+    (if (not (string-match "\\\\babelprovide\\[.*\\]{\\(.+\\)}" header))
        header
-      (let ((options (save-match-data
-                      (org-split-string (match-string 1 header) ",[ \t]*")))
-           (language (cdr (assoc-string language-code
-                                        org-latex-babel-language-alist t))))
-       ;; If LANGUAGE is already loaded, return header without AUTO.
-       ;; Otherwise, replace AUTO with language or append language if
-       ;; AUTO is not present.
-       (replace-match
-        (mapconcat (lambda (option) (if (equal "AUTO" option) language option))
-                   (cond ((member language options) (delete "AUTO" options))
-                         ((member "AUTO" options) options)
-                         (t (append options (list language))))
-                   ", ")
-        t nil header 1)))))
+      (let ((prov (match-string 1 header)))
+       (if (equal "AUTO" prov)
+           (replace-regexp-in-string (format
+                                      
"\\(\\\\babelprovide\\[.*\\]\\)\\({\\)%s}" prov)
+                                     (format "\\1\\2%s}"
+                                             (or language language-ini-only))
+                                     header t)
+         header)))))
 
 (defun org-latex-guess-polyglossia-language (header info)
   "Set the Polyglossia language according to the LANGUAGE keyword.
@@ -1437,7 +1692,7 @@ replaced with the language of the document or
 using \setdefaultlanguage and not as an option to the package.
 
 Return the new header."
-  (let ((language (plist-get info :language)))
+  (let* ((language (plist-get info :language)))
     ;; If no language is set or Polyglossia is not loaded, return
     ;; HEADER as-is.
     (if (or (not (stringp language))
@@ -1462,15 +1717,20 @@ Return the new header."
         (concat "\\usepackage{polyglossia}\n"
                 (mapconcat
                  (lambda (l)
-                   (let ((l (or (assoc l org-latex-polyglossia-language-alist)
-                                l)))
-                     (format (if main-language-set "\\setotherlanguage%s{%s}\n"
+                   (let* ((plist (cdr
+                                  (assoc language org-latex-language-alist)))
+                          (polyglossia-variant (plist-get plist 
:polyglossia-variant))
+                          (polyglossia-lang (plist-get plist :polyglossia))
+                          (l (if (equal l language)
+                                 polyglossia-lang
+                               l)))
+                     (format (if main-language-set (format 
"\\setotherlanguage{%s}\n" l)
                                (setq main-language-set t)
                                "\\setmainlanguage%s{%s}\n")
-                             (if (and (consp l) (= (length l) 3))
-                                 (format "[variant=%s]" (nth 2 l))
+                             (if polyglossia-variant
+                                 (format "[variant=%s]" polyglossia-variant)
                                "")
-                             (nth 1 l))))
+                             l)))
                  languages
                  ""))
         t t header 0)))))
@@ -1502,21 +1762,24 @@ This is used to choose a separator for constructs like 
\\verb."
             when (not (string-match (regexp-quote (char-to-string c)) s))
             return (char-to-string c))))
 
-(defun org-latex--make-option-string (options)
+(defun org-latex--make-option-string (options &optional separator)
   "Return a comma separated string of keywords and values.
 OPTIONS is an alist where the key is the options keyword as
 a string, and the value a list containing the keyword value, or
 nil."
   (mapconcat (lambda (pair)
-              (pcase-let ((`(,keyword ,value) pair))
-                (concat keyword
-                        (and (> (length value) 0)
-                             (concat "="
-                                      (if (string-match-p (rx (any "[]")) 
value)
-                                          (format "{%s}" value)
-                                        value))))))
-            options
-            ","))
+               (let ((keyword (car pair))
+                     (value (pcase (cdr pair)
+                              ((pred stringp) (cdr pair))
+                              ((pred consp) (cadr pair)))))
+                 (concat keyword
+                         (when value
+                           (concat "="
+                                   (if (string-match-p (rx (any "[]")) value)
+                                       (format "{%s}" value)
+                                     value))))))
+             options
+             (or separator ",")))
 
 (defun org-latex--wrap-label (element output info)
   "Wrap label associated to ELEMENT around OUTPUT, if appropriate.
@@ -1611,10 +1874,12 @@ INFO is a plist used as a communication channel."
 (defun org-latex--format-spec (info)
   "Create a format-spec for document meta-data.
 INFO is a plist used as a communication channel."
-  (let ((language (let ((lang (plist-get info :language)))
-                   (or (cdr (assoc-string lang org-latex-babel-language-alist 
t))
-                       (nth 1 (assoc-string lang 
org-latex-polyglossia-language-alist t))
-                       lang))))
+  (let ((language (let* ((lang (plist-get info :language))
+                        (plist (cdr
+                                (assoc lang org-latex-language-alist))))
+                    ;; Here the actual name of the LANGUAGE or LANG is used.
+                   (or (plist-get plist :lang-name)
+                       lang))))
     `((?a . ,(org-export-data (plist-get info :author) info))
       (?t . ,(org-export-data (plist-get info :title) info))
       (?s . ,(org-export-data (plist-get info :subtitle) info))
@@ -1627,7 +1892,7 @@ INFO is a plist used as a communication channel."
       (?c . ,(plist-get info :creator))
       (?l . ,language)
       (?L . ,(capitalize language))
-      (?D . ,(org-export-get-date info)))))
+      (?D . ,(org-export-data (org-export-get-date info) info)))))
 
 (defun org-latex--insert-compiler (info)
   "Insert LaTeX_compiler info into the document.
@@ -1724,6 +1989,9 @@ holding export options."
              (format "\\author{%s\\thanks{%s}}\n" author email))
             ((or author email) (format "\\author{%s}\n" (or author email)))))
      ;; Date.
+     ;; LaTeX displays today's date by default. One can override this by
+     ;; inserting \date{} for no date, or \date{string} with any other
+     ;; string to be displayed as the date.
      (let ((date (and (plist-get info :with-date) (org-export-get-date info))))
        (format "\\date{%s}\n" (org-export-data date info)))
      ;; Title and subtitle.
@@ -1742,6 +2010,12 @@ holding export options."
      (let ((template (plist-get info :latex-hyperref-template)))
        (and (stringp template)
             (format-spec template spec)))
+     ;; engrave-faces-latex preamble
+     (when (and (eq org-latex-src-block-backend 'engraved)
+                (org-element-map (plist-get info :parse-tree)
+                    '(src-block inline-src-block) #'identity
+                    info t))
+       (org-latex-generate-engraved-preamble info))
      ;; Document start.
      "\\begin{document}\n\n"
      ;; Title command.
@@ -1805,7 +2079,7 @@ information."
           (concat (org-timestamp-translate (org-element-property :value clock))
                   (let ((time (org-element-property :duration clock)))
                     (and time (format " (%s)" time)))))
-   "\\\\"))
+   org-latex-line-break-safe))
 
 
 ;;;; Code
@@ -2123,36 +2397,51 @@ CONTENTS is nil.  INFO is a plist holding contextual 
information."
   "Transcode an INLINE-SRC-BLOCK element from Org to LaTeX.
 CONTENTS holds the contents of the item.  INFO is a plist holding
 contextual information."
-  (let* ((code (org-element-property :value inline-src-block))
-        (separator (org-latex--find-verb-separator code)))
-    (cl-case (plist-get info :latex-listings)
-      ;; Do not use a special package: transcode it verbatim, as code.
-      ((nil) (org-latex--text-markup code 'code info))
-      ;; Use minted package.
-      (minted
-       (let* ((org-lang (org-element-property :language inline-src-block))
-             (mint-lang (or (cadr (assq (intern org-lang)
-                                        (plist-get info :latex-minted-langs)))
-                            (downcase org-lang)))
-             (options (org-latex--make-option-string
-                       (plist-get info :latex-minted-options))))
-        (format "\\mintinline%s{%s}{%s}"
-                (if (string= options "") "" (format "[%s]" options))
-                mint-lang
-                code)))
-      ;; Use listings package.
-      (otherwise
-       ;; Maybe translate language's name.
-       (let* ((org-lang (org-element-property :language inline-src-block))
-             (lst-lang (or (cadr (assq (intern org-lang)
-                                       (plist-get info :latex-listings-langs)))
-                           org-lang))
-             (options (org-latex--make-option-string
-                       (append (plist-get info :latex-listings-options)
-                               `(("language" ,lst-lang))))))
-        (concat (format "\\lstinline[%s]" options)
-                separator code separator))))))
-
+  (let ((code (org-element-property :value inline-src-block))
+        (lang (org-element-property :language inline-src-block)))
+    (pcase (plist-get info :latex-src-block-backend)
+      (`verbatim (org-latex--text-markup code 'code info))
+      (`minted (org-latex-inline-src-block--minted info code lang))
+      (`engraved (org-latex-inline-src-block--engraved info code lang))
+      (`listings (org-latex-inline-src-block--listings info code lang))
+      (oldval
+       (message "Please update the LaTeX src-block-backend to %s"
+                (if oldval "listings" "verbatim"))
+       (if oldval
+           (org-latex-inline-src-block--listings info code lang)
+         (org-latex--text-markup code 'code info))))))
+
+(defun org-latex-inline-src-block--minted (info code lang)
+  "Transcode an inline src block's content from Org to LaTeX, using minted.
+INFO, CODE, and LANG are provided by `org-latex-inline-src-block'."
+  (let ((mint-lang (or (cadr (assq (intern lang)
+                                   (plist-get info :latex-minted-langs)))
+                       (downcase lang)))
+        (options (org-latex--make-option-string
+                  (plist-get info :latex-minted-options))))
+    (format "\\mintinline%s{%s}{%s}"
+            (if (string= options "") "" (format "[%s]" options))
+            mint-lang
+            code)))
+
+(defun org-latex-inline-src-block--engraved (info code lang)
+  "Transcode an inline src block's content from Org to LaTeX, using 
engrave-faces.
+INFO, CODE, and LANG are provided by `org-latex-inline-src-block'."
+  (org-latex-src--engrave-code
+   code lang nil (plist-get info :latex-engraved-options) t))
+
+(defun org-latex-inline-src-block--listings (info code lang)
+  "Transcode an inline src block's content from Org to LaTeX, using 
lstlistings.
+INFO, CODE, and LANG are provided by `org-latex-inline-src-block'."
+  (let* ((lst-lang (or (cadr (assq (intern lang)
+                                   (plist-get info :latex-listings-langs)))
+                       lang))
+         (separator (org-latex--find-verb-separator code))
+         (options (org-latex--make-option-string
+                   (append (plist-get info :latex-listings-options)
+                           `(("language" ,lst-lang))))))
+    (concat (format "\\lstinline[%s]" options)
+            separator code separator)))
 
 ;;;; Inlinetask
 
@@ -2187,10 +2476,10 @@ See `org-latex-format-inlinetask-function' for details."
                            (mapcar #'org-latex--protect-text tags)))))))
     (concat "\\begin{center}\n"
            "\\fbox{\n"
-           "\\begin{minipage}[c]{.6\\textwidth}\n"
+           "\\begin{minipage}[c]{.6\\linewidth}\n"
            full-title "\n\n"
            (and (org-string-nw-p contents)
-                (concat "\\rule[.8em]{\\textwidth}{2pt}\n\n" contents))
+                (concat "\\rule[.8em]{\\linewidth}{2pt}\n\n" contents))
            "\\end{minipage}\n"
            "}\n"
            "\\end{center}")))
@@ -2304,9 +2593,10 @@ CONTENTS is nil.  INFO is a plist holding contextual 
information."
              (concat depth (and depth "\n") "\\tableofcontents"))))
         ((string-match-p "\\<tables\\>" value) "\\listoftables")
         ((string-match-p "\\<listings\\>" value)
-         (cl-case (plist-get info :latex-listings)
+         (cl-case (plist-get info :latex-src-block-backend)
            ((nil) "\\listoffigures")
            (minted "\\listoflistings")
+           (engraved "\\listoflistings")
            (otherwise "\\lstlistoflistings")))))))))
 
 
@@ -2386,7 +2676,7 @@ CONTENTS is nil.  INFO is a plist holding contextual 
information."
 (defun org-latex-line-break (_line-break _contents _info)
   "Transcode a LINE-BREAK object from Org to LaTeX.
 CONTENTS is nil.  INFO is a plist holding contextual information."
-  "\\\\\n")
+  (concat org-latex-line-break-safe "\n"))
 
 
 ;;;; Link
@@ -2411,6 +2701,7 @@ used as a communication channel."
                  (cond ((string= float "wrap") 'wrap)
                        ((string= float "sideways") 'sideways)
                        ((string= float "multicolumn") 'multicolumn)
+                        ((string= float "t") 'figure)
                        ((and (plist-member attr :float) (not float)) 'nonfloat)
                         (float float)
                        ((or (org-element-property :caption parent)
@@ -2493,7 +2784,12 @@ used as a communication channel."
                          ((string-prefix-p "," options)
                           (format "[%s]" (substring options 1)))
                          (t (format "[%s]" options)))
-                   path))
+                    ;; While \includegraphics is fine with unicode in the path,
+                    ;; \includesvg is prone to producing errors.
+                    (if (and (string-match-p "[^[:ascii:]]" path)
+                             (equal filetype "svg"))
+                        (concat "\\detokenize{" path "}")
+                      path)))
       (when (equal filetype "svg")
        (setq image-code (replace-regexp-in-string "^\\\\includegraphics"
                                                   "\\includesvg"
@@ -2588,7 +2884,7 @@ INFO is a plist holding contextual information.  See
      ;; Link type is handled by a special function.
      ((org-export-custom-protocol-maybe link desc 'latex info))
      ;; Image file.
-     (imagep (org-latex--inline-image link info))
+     (imagep (org-latex--inline-image (org-export-link-localise link) info))
      ;; Radio link: Transcode target's contents and use them as link's
      ;; description.
      ((string= type "radio")
@@ -2726,7 +3022,9 @@ contextual information."
     ;; Handle break preservation if required.
     (when (plist-get info :preserve-breaks)
       (setq output (replace-regexp-in-string
-                   "\\(?:[ \t]*\\\\\\\\\\)?[ \t]*\n" "\\\\\n" output nil t)))
+                   "\\(?:[ \t]*\\\\\\\\\\)?[ \t]*\n"
+                    (concat org-latex-line-break-safe "\n")
+                    output nil t)))
     ;; Return value.
     output))
 
@@ -2762,7 +3060,7 @@ information."
                (format (plist-get info :latex-active-timestamp-format)
                        (org-timestamp-translate scheduled)))))))
     " ")
-   "\\\\"))
+   org-latex-line-break-safe))
 
 
 ;;;; Property Drawer
@@ -2980,176 +3278,351 @@ CONTENTS holds the contents of the item.  INFO is a 
plist holding
 contextual information."
   (when (org-string-nw-p (org-element-property :value src-block))
     (let* ((lang (org-element-property :language src-block))
-          (caption (org-element-property :caption src-block))
-          (caption-above-p (org-latex--caption-above-p src-block info))
-          (label (org-element-property :name src-block))
-          (custom-env (and lang
-                           (cadr (assq (intern lang)
-                                       org-latex-custom-lang-environments))))
-          (num-start (org-export-get-loc src-block info))
-          (retain-labels (org-element-property :retain-labels src-block))
-          (attributes (org-export-read-attribute :attr_latex src-block))
-          (float (plist-get attributes :float))
-          (listings (plist-get info :latex-listings)))
-      (cond
-       ;; Case 1.  No source fontification.
-       ((or (not lang) (not listings))
-       (let ((caption-str (org-latex--caption/label-string src-block info))
-              (verbatim (format "\\begin{verbatim}\n%s\\end{verbatim}"
-                                (org-export-format-code-default src-block 
info))))
-          (cond ((string= "multicolumn" float)
-                 (format "\\begin{figure*}[%s]\n%s%s\n%s\\end{figure*}"
-                         (plist-get info :latex-default-figure-position)
-                         (if caption-above-p caption-str "")
-                         verbatim
-                         (if caption-above-p "" caption-str)))
-                (caption (concat
-                          (if caption-above-p caption-str "")
-                          verbatim
-                          (if caption-above-p "" (concat "\n" caption-str))))
-                (t verbatim))))
-       ;; Case 2.  Custom environment.
-       (custom-env
-       (let ((caption-str (org-latex--caption/label-string src-block info))
-              (formatted-src (org-export-format-code-default src-block info)))
-          (if (string-match-p "\\`[a-zA-Z0-9]+\\'" custom-env)
-             (format "\\begin{%s}\n%s\\end{%s}\n"
-                     custom-env
-                     (concat (and caption-above-p caption-str)
-                             formatted-src
-                             (and (not caption-above-p) caption-str))
-                     custom-env)
-           (format-spec custom-env
-                        `((?s . ,formatted-src)
-                          (?c . ,caption)
-                          (?f . ,float)
-                          (?l . ,(org-latex--label src-block info))
-                          (?o . ,(or (plist-get attributes :options) "")))))))
-       ;; Case 3.  Use minted package.
-       ((eq listings 'minted)
-       (let* ((caption-str (org-latex--caption/label-string src-block info))
-              (placement (or (org-unbracket-string "[" "]" (plist-get 
attributes :placement))
-                             (plist-get info :latex-default-figure-position)))
-              (float-env
-               (cond
-                ((string= "multicolumn" float)
-                 (format "\\begin{listing*}[%s]\n%s%%s\n%s\\end{listing*}"
-                         placement
-                         (if caption-above-p caption-str "")
-                         (if caption-above-p "" caption-str)))
-                (caption
-                 (format "\\begin{listing}[%s]\n%s%%s\n%s\\end{listing}"
-                         placement
-                         (if caption-above-p caption-str "")
-                         (if caption-above-p "" caption-str)))
-                ((string= "t" float)
-                 (concat (format "\\begin{listing}[%s]\n"
-                                 placement)
-                         "%s\n\\end{listing}"))
-                (t "%s")))
-              (options (plist-get info :latex-minted-options))
-              (body
-               (format
-                "\\begin{minted}[%s]{%s}\n%s\\end{minted}"
-                ;; Options.
-                (concat
-                 (org-latex--make-option-string
-                  (if (or (not num-start) (assoc "linenos" options))
-                      options
-                    (append
-                     `(("linenos")
-                       ("firstnumber" ,(number-to-string (1+ num-start))))
-                     options)))
-                 (let ((local-options (plist-get attributes :options)))
-                   (and local-options (concat "," local-options))))
-                ;; Language.
-                (or (cadr (assq (intern lang)
-                                (plist-get info :latex-minted-langs)))
-                    (downcase lang))
-                ;; Source code.
-                (let* ((code-info (org-export-unravel-code src-block))
-                       (max-width
-                        (apply 'max
-                               (mapcar 'length
-                                       (org-split-string (car code-info)
-                                                         "\n")))))
-                  (org-export-format-code
-                   (car code-info)
-                   (lambda (loc _num ref)
-                     (concat
-                      loc
-                      (when ref
-                        ;; Ensure references are flushed to the right,
-                        ;; separated with 6 spaces from the widest line
-                        ;; of code.
-                        (concat (make-string (+ (- max-width (length loc)) 6)
-                                             ?\s)
-                                (format "(%s)" ref)))))
-                   nil (and retain-labels (cdr code-info)))))))
-         ;; Return value.
-         (format float-env body)))
-       ;; Case 4.  Use listings package.
-       (t
-       (let ((lst-lang
-              (or (cadr (assq (intern lang)
-                              (plist-get info :latex-listings-langs)))
-                  lang))
-             (caption-str
-              (when caption
-                (let ((main (org-export-get-caption src-block))
-                      (secondary (org-export-get-caption src-block t)))
-                  (if (not secondary)
-                      (format "{%s}" (org-export-data main info))
-                    (format "{[%s]%s}"
-                            (org-export-data secondary info)
-                            (org-export-data main info))))))
-             (lst-opt (plist-get info :latex-listings-options)))
-         (concat
-          ;; Options.
-          (format
-           "\\lstset{%s}\n"
-           (concat
-            (org-latex--make-option-string
-             (append
-              lst-opt
-              (cond
-               ((and (not float) (plist-member attributes :float)) nil)
-               ((string= "multicolumn" float) '(("float" "*")))
-               ((and float (not (assoc "float" lst-opt)))
-                `(("float" ,(plist-get info :latex-default-figure-position)))))
-              `(("language" ,lst-lang))
-              (if label
-                  `(("label" ,(org-latex--label src-block info)))
-                '(("label" " ")))
-              (if caption-str `(("caption" ,caption-str)) '(("caption" " ")))
-              `(("captionpos" ,(if caption-above-p "t" "b")))
-              (cond ((assoc "numbers" lst-opt) nil)
-                    ((not num-start) '(("numbers" "none")))
-                    (t `(("firstnumber" ,(number-to-string (1+ num-start)))
-                         ("numbers" "left"))))))
-            (let ((local-options (plist-get attributes :options)))
-              (and local-options (concat "," local-options)))))
-          ;; Source code.
-          (format
-           "\\begin{lstlisting}\n%s\\end{lstlisting}"
-           (let* ((code-info (org-export-unravel-code src-block))
-                  (max-width
-                   (apply 'max
-                          (mapcar 'length
-                                  (org-split-string (car code-info) "\n")))))
-             (org-export-format-code
-              (car code-info)
-              (lambda (loc _num ref)
-                (concat
-                 loc
-                 (when ref
-                   ;; Ensure references are flushed to the right,
-                   ;; separated with 6 spaces from the widest line of
-                   ;; code
-                   (concat (make-string (+ (- max-width (length loc)) 6) ?\s)
-                           (format "(%s)" ref)))))
-              nil (and retain-labels (cdr code-info))))))))))))
-
+           (caption (org-element-property :caption src-block))
+           (caption-above-p (org-latex--caption-above-p src-block info))
+           (label (org-element-property :name src-block))
+           (custom-env (and lang
+                            (cadr (assq (intern lang)
+                                        org-latex-custom-lang-environments))))
+           (num-start (org-export-get-loc src-block info))
+           (retain-labels (org-element-property :retain-labels src-block))
+           (attributes (org-export-read-attribute :attr_latex src-block))
+           (float (plist-get attributes :float)))
+      (funcall
+       (pcase (plist-get info :latex-src-block-backend)
+         ((or `verbatim (guard (not lang))) #'org-latex-src-block--verbatim)
+         (`minted #'org-latex-src-block--minted)
+         (`engraved #'org-latex-src-block--engraved)
+         (`listings #'org-latex-src-block--listings)
+         ((guard custom-env) #'org-latex-src-block--custom)
+         (oldval
+          (message "Please update the LaTeX src-block-backend to %s"
+                   (if oldval "listings" "verbatim"))
+          (if oldval
+              #'org-latex-src-block--listings
+            #'org-latex-src-block--verbatim)))
+       :src-block src-block
+       :info info
+       :lang lang
+       :caption caption
+       :caption-above-p caption-above-p
+       :label label
+       :num-start num-start
+       :retain-labels retain-labels
+       :attributes attributes
+       :float float
+       :custom-env custom-env))))
+
+(cl-defun org-latex-src-block--verbatim
+    (&key src-block info caption caption-above-p float &allow-other-keys)
+  "Transcode a SRC-BLOCK element from Org to LaTeX, using verbatim.
+LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
+and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
+  (let ((caption-str (org-latex--caption/label-string src-block info))
+        (verbatim (format "\\begin{verbatim}\n%s\\end{verbatim}"
+                          (org-export-format-code-default src-block info))))
+    (cond ((string= "multicolumn" float)
+           (format "\\begin{figure*}[%s]\n%s%s\n%s\\end{figure*}"
+                   (plist-get info :latex-default-figure-position)
+                   (if caption-above-p caption-str "")
+                   verbatim
+                   (if caption-above-p "" caption-str)))
+          (caption (concat
+                    (if caption-above-p caption-str "")
+                    verbatim
+                    (if caption-above-p "" (concat "\n" caption-str))))
+          (t verbatim))))
+
+(cl-defun org-latex-src-block--custom
+    (&key src-block info caption caption-above-p attributes float custom-env 
&allow-other-keys)
+  "Transcode a SRC-BLOCK element from Org to LaTeX, using a custom environment.
+LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
+and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
+  (let ((caption-str (org-latex--caption/label-string src-block info))
+        (formatted-src (org-export-format-code-default src-block info)))
+    (if (string-match-p "\\`[a-zA-Z0-9]+\\'" custom-env)
+        (format "\\begin{%s}\n%s\\end{%s}\n"
+                custom-env
+                (concat (and caption-above-p caption-str)
+                        formatted-src
+                        (and (not caption-above-p) caption-str))
+                custom-env)
+      (format-spec custom-env
+                   `((?s . ,formatted-src)
+                     (?c . ,caption)
+                     (?f . ,float)
+                     (?l . ,(org-latex--label src-block info))
+                     (?o . ,(or (plist-get attributes :options) "")))))))
+
+(cl-defun org-latex-src-block--minted
+    (&key src-block info lang caption caption-above-p num-start retain-labels 
attributes float &allow-other-keys)
+  "Transcode a SRC-BLOCK element from Org to LaTeX, using minted.
+LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
+and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
+  (let* ((caption-str (org-latex--caption/label-string src-block info))
+         (placement (or (org-unbracket-string "[" "]" (plist-get attributes 
:placement))
+                        (plist-get info :latex-default-figure-position)))
+         (multicolumn-p (string= "multicolumn" float))
+         (float-env
+          (cond
+           ((or caption multicolumn-p)
+            (cons
+             (concat "\\begin{listing" (when multicolumn-p "*")
+                     "}[" placement "]\n"
+                     (if caption-above-p caption-str ""))
+             (concat "\n" (if caption-above-p "" caption-str)
+                     "\\end{listing" (when multicolumn-p "*") "}")))
+           ((string= "t" float)
+            (cons
+             (concat "\\begin{listing}[" placement "]\n")
+             "\n\\end{listing}"))))
+         (options (plist-get info :latex-minted-options))
+         (body
+          (format
+           "\\begin{minted}[%s]{%s}\n%s\\end{minted}"
+           ;; Options.
+           (concat
+            (org-latex--make-option-string
+             (if (or (not num-start) (assoc "linenos" options))
+                 options
+               (append
+                `(("linenos")
+                  ("firstnumber" ,(number-to-string (1+ num-start))))
+                options)))
+            (let ((local-options (plist-get attributes :options)))
+              (and local-options (concat "," local-options))))
+           ;; Language.
+           (or (cadr (assq (intern lang)
+                           (plist-get info :latex-minted-langs)))
+               (downcase lang))
+           ;; Source code.
+           (let* ((code-info (org-export-unravel-code src-block))
+                  (max-width
+                   (apply 'max
+                          (mapcar 'string-width
+                                  (org-split-string (car code-info)
+                                                    "\n")))))
+             (org-export-format-code
+              (car code-info)
+              (lambda (loc _num ref)
+                (concat
+                 loc
+                 (when ref
+                   ;; Ensure references are flushed to the right,
+                   ;; separated with 6 spaces from the widest line
+                   ;; of code.
+                   (concat (make-string (+ (- max-width (length loc)) 6)
+                                        ?\s)
+                           (format "(%s)" ref)))))
+              nil (and retain-labels (cdr code-info)))))))
+    (concat (car float-env) body (cdr float-env))))
+
+(defun org-latex-src--engrave-mathescape-p (info options)
+  "From the export INFO plist, and the per-block OPTIONS, determine 
mathescape."
+  (let ((default-options (plist-get info :latex-engraved-options))
+        (mathescape-status
+         (lambda (opts)
+           (cl-some
+            (lambda (opt)
+              (or (and
+                   (null (cdr opt))
+                   (cond
+                    ((string-match-p
+                      "\\(?:^\\|,\\)mathescape=false\\(?:,\\|$\\)"
+                      (car opt))
+                     'no)
+                    ((or (string-match-p
+                          "\\(?:^\\|,\\)mathescape\\(?:=true\\)?\\(?:,\\|$\\)"
+                          (car opt))
+                         (string= "mathescape" (car opt)))
+                     'yes)))
+                  (and
+                   (string= (car opt) "mathescape")
+                   (cond
+                    ((or (and (stringp (cdr opt)) (string= (cdr opt) "true"))
+                         (equal '("true") (cdr opt)))
+                     'yes)
+                    ((or (and (stringp (cdr opt)) (string= "false" (cdr opt)))
+                         (equal '("false") (cdr opt)))
+                     'no)))))
+            opts))))
+    (let ((mathescape (or (funcall mathescape-status default-options)
+                          (funcall mathescape-status options))))
+      (when (eq mathescape 'yes)
+        (or engrave-faces-latex-mathescape t)))))
+
+(defun org-latex-src--engrave-code (content lang &optional theme options 
inline)
+  "Engrave CONTENT to LaTeX in a LANG-mode buffer, and give the result.
+When the THEME symbol is non-nil, that theme will be used.
+
+When INLINE is nil, a Verbatim environment wrapped in a Code
+environment will be used. When t, a Verb command will be used.
+
+When OPTIONS is provided, as either a string or list of key-value
+pairs accepted by `org-latex--make-option-string', it is passed
+to the Verbatim environment or Verb command."
+  (if (require 'engrave-faces-latex nil t)
+      (let* ((lang-mode (and lang (org-src-get-lang-mode lang)))
+             (engrave-faces-current-preset-style
+              (if theme
+                  (engrave-faces-get-theme theme)
+                engrave-faces-current-preset-style))
+             (engraved-buffer
+              (with-temp-buffer
+                (insert (replace-regexp-in-string "\n\\'" "" content))
+                (when lang-mode
+                  (if (functionp lang-mode)
+                      (funcall lang-mode)
+                    (message "Cannot engrave code as %s. %s is undefined."
+                             lang lang-mode)))
+                (engrave-faces-latex-buffer)))
+             (engraved-code
+              (with-current-buffer engraved-buffer
+                (buffer-string)))
+             (engraved-options
+              (when options
+                (concat "["
+                        (if (listp options)
+                            (org-latex--make-option-string options)
+                          options)
+                        "]")))
+             (engraved-wrapped
+              (if inline
+                  (concat "\\Verb" engraved-options "{" engraved-code "}")
+                (concat "\\begin{Code}\n\\begin{Verbatim}" engraved-options 
"\n"
+                        engraved-code "\n\\end{Verbatim}\n\\end{Code}"))))
+        (kill-buffer engraved-buffer)
+        (if theme
+            (concat "{\\engravedtheme"
+                    (replace-regexp-in-string "[^A-Za-z]" ""
+                                              (symbol-name theme))
+                    engraved-wrapped
+                    "}")
+          engraved-wrapped))
+    (user-error "Cannot engrave code as `engrave-faces-latex' is 
unavailable.")))
+
+(cl-defun org-latex-src-block--engraved
+    (&key src-block info lang caption caption-above-p num-start retain-labels 
attributes float &allow-other-keys)
+  "Transcode a SRC-BLOCK element from Org to LaTeX, using engrave-faces-latex.
+LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
+and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
+  (let* ((caption-str (org-latex--caption/label-string src-block info))
+         (placement (or (org-unbracket-string "[" "]" (plist-get attributes 
:placement))
+                        (plist-get info :latex-default-figure-position)))
+         (multicolumn-p (string= "multicolumn" float))
+         (float-env
+          (cond
+           ((or caption multicolumn-p)
+            (cons
+             (concat "\\begin{listing" (when multicolumn-p "*")
+                     "}[" placement "]\n"
+                     (if caption-above-p caption-str ""))
+             (concat "\n" (if caption-above-p "" caption-str)
+                     "\\end{listing" (when multicolumn-p "*") "}")))
+           ((string= "t" float)
+            (cons
+             (concat "\\begin{listing}[" placement "]\n")
+             "\n\\end{listing}"))))
+         (options
+          (let ((engraved-options (plist-get info :latex-engraved-options))
+                (local-options (plist-get attributes :options)))
+            (append
+             (when (and num-start (not (assoc "linenos" engraved-options)))
+               `(("linenos")
+                 ("firstnumber" ,(number-to-string (1+ num-start)))))
+             (and local-options `((,local-options))))))
+         (engraved-theme (plist-get attributes :engraved-theme))
+         (content
+          (let* ((code-info (org-export-unravel-code src-block))
+                 (max-width
+                  (apply 'max
+                         (mapcar 'string-width
+                                 (org-split-string (car code-info)
+                                                   "\n")))))
+            (org-export-format-code
+             (car code-info)
+             (lambda (loc _num ref)
+               (concat
+                loc
+                (when ref
+                  ;; Ensure references are flushed to the right,
+                  ;; separated with 6 spaces from the widest line
+                  ;; of code.
+                  (concat (make-string (+ (- max-width (length loc)) 6)
+                                       ?\s)
+                          (format "(%s)" ref)))))
+             nil (and retain-labels (cdr code-info)))))
+         (body
+          (let ((engrave-faces-latex-mathescape
+                 (org-latex-src--engrave-mathescape-p info options)))
+            (org-latex-src--engrave-code
+             content lang
+             (when engraved-theme (intern engraved-theme))
+             options))))
+    (concat (car float-env) body (cdr float-env))))
+
+(cl-defun org-latex-src-block--listings
+    (&key src-block info lang caption caption-above-p label num-start 
retain-labels attributes float &allow-other-keys)
+  "Transcode a SRC-BLOCK element from Org to LaTeX, using listings.
+LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
+and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
+  (let ((lst-lang
+         (or (cadr (assq (intern lang)
+                         (plist-get info :latex-listings-langs)))
+             lang))
+        (caption-str
+         (when caption
+           (let ((main (org-export-get-caption src-block))
+                 (secondary (org-export-get-caption src-block t)))
+             (if (not secondary)
+                 (format "{%s}" (org-export-data main info))
+               (format "{[%s]%s}"
+                       (org-export-data secondary info)
+                       (org-export-data main info))))))
+        (lst-opt (plist-get info :latex-listings-options)))
+    (concat
+     (format
+      "\\begin{lstlisting}[%s]\n%s\\end{lstlisting}"
+      ;; Options.
+      (concat
+       (org-latex--make-option-string
+        (append
+         lst-opt
+         (cond
+          ((and (not float) (plist-member attributes :float)) nil)
+          ((string= "multicolumn" float) '(("float" "*")))
+          ((and float (not (assoc "float" lst-opt)))
+           `(("float" ,(plist-get info :latex-default-figure-position)))))
+         `(("language" ,lst-lang))
+         (if label
+             `(("label" ,(org-latex--label src-block info)))
+           '(("label" " ")))
+         (if caption-str `(("caption" ,caption-str)) '(("caption" " ")))
+         `(("captionpos" ,(if caption-above-p "t" "b")))
+         (cond ((assoc "numbers" lst-opt) nil)
+               ((not num-start) '(("numbers" "none")))
+               (t `(("firstnumber" ,(number-to-string (1+ num-start)))
+                    ("numbers" "left"))))))
+       (let ((local-options (plist-get attributes :options)))
+         (and local-options (concat "," local-options))))
+      ;; Source code.
+      (let* ((code-info (org-export-unravel-code src-block))
+             (max-width
+              (apply 'max
+                     (mapcar 'string-width
+                             (org-split-string (car code-info) "\n")))))
+        (org-export-format-code
+         (car code-info)
+         (lambda (loc _num ref)
+           (concat
+            loc
+            (when ref
+              ;; Ensure references are flushed to the right,
+              ;; separated with 6 spaces from the widest line of
+              ;; code
+              (concat (make-string (+ (- max-width (length loc)) 6) ?\s)
+                      (format "(%s)" ref)))))
+         nil (and retain-labels (cdr code-info))))))))
 
 ;;;; Statistics Cookie
 
@@ -3190,7 +3663,8 @@ CONTENTS is the contents of the object."
 ;; `org-latex-table' is the entry point for table transcoding.  It
 ;; takes care of tables with a "verbatim" mode.  Otherwise, it
 ;; delegates the job to either `org-latex--table.el-table',
-;; `org-latex--org-table' or `org-latex--math-table' functions,
+;; `org-latex--org-table', `org-latex--math-table' or
+;; `org-latex--org-tabbing' functions,
 ;; depending of the type of the table and the mode requested.
 ;;
 ;; `org-latex--align-string' is a subroutine used to build alignment
@@ -3214,8 +3688,11 @@ contextual information."
                           `(table nil ,@(org-element-contents table))))))
        ;; Case 2: Matrix.
        ((or (string= type "math") (string= type "inline-math"))
-       (org-latex--math-table table info))
-       ;; Case 3: Standard table.
+        (org-latex--math-table table info))
+       ;; Case 3: Tabbing
+       ((string= type "tabbing")
+        (org-table--org-tabbing table contents info))
+       ;; Case 4: Standard table.
        (t (concat (org-latex--org-table table contents info)
                  ;; When there are footnote references within the
                  ;; table, insert their definition just after it.
@@ -3252,6 +3729,30 @@ centered."
          info)
        (apply 'concat (nreverse align)))))
 
+(defun org-latex--align-string-tabbing (table info)
+  "Return LaTeX alignment string using tabbing environment.
+TABLE is the considered table.  INFO is a plist used as
+a communication channel."
+  (or (org-export-read-attribute :attr_latex table :align)
+      (let* ((count
+              ;; Count the number of cells in the first row.
+              (length
+               (org-element-map
+                   (org-element-map table 'table-row
+                     (lambda (row)
+                       (and (eq (org-element-property :type row)
+                                'standard)
+                            row))
+                     info 'first-match)
+                   'table-cell #'identity)))
+             ;; Calculate the column width, using a proportion of
+             ;; the document's textwidth.
+             (separator
+              (format "\\hspace{%s\\textwidth} \\= "
+                      (- (/  1.0 count) 0.01))))
+        (concat (apply 'concat (make-list count separator))
+                "\\kill"))))
+
 (defun org-latex--decorate-table (table attributes caption above? info)
   "Decorate TABLE string with caption and float environment.
 
@@ -3266,6 +3767,7 @@ Return new environment, as a string."
            (cond ((and (not float) (plist-member attributes :float)) nil)
                  ((member float '("sidewaystable" "sideways")) "sidewaystable")
                  ((equal float "multicolumn") "table*")
+                  ((string= float "t") "table")
                   (float float)
                  ((org-string-nw-p caption) "table")
                  (t nil))))
@@ -3314,6 +3816,7 @@ This function assumes TABLE has `org' as its `:type' 
property and
 `table' as its `:mode' attribute."
   (let* ((attr (org-export-read-attribute :attr_latex table))
         (alignment (org-latex--align-string table info))
+         (opt (org-export-read-attribute :attr_latex table :options))
         (table-env (or (plist-get attr :environment)
                        (plist-get info :latex-default-table-environment)))
         (width
@@ -3335,22 +3838,38 @@ This function assumes TABLE has `org' as its `:type' 
property and
                (format "\\begin{%s}%s{%s}\n" table-env width alignment)
                (and above?
                     (org-string-nw-p caption)
-                    (concat caption "\\\\\n"))
+                    (concat caption org-latex-line-break-safe "\n"))
                contents
                (and (not above?)
                     (org-string-nw-p caption)
-                    (concat caption "\\\\\n"))
+                    (concat caption org-latex-line-break-safe "\n"))
                (format "\\end{%s}" table-env)
                (and fontsize "}"))))
      (t
-      (let ((output (format "\\begin{%s}%s{%s}\n%s\\end{%s}"
+      (let ((output (format "\\begin{%s}%s%s{%s}\n%s\\end{%s}"
                            table-env
+                            (if opt (format "[%s]" opt) "")
                            width
                            alignment
                            contents
                            table-env)))
        (org-latex--decorate-table output attr caption above? info))))))
 
+
+(defun org-table--org-tabbing (table contents info)
+  "Return tabbing environment LaTeX code for Org table.
+TABLE is the table type element to transcode.  CONTENTS is its
+contents, as a string.  INFO is a plist used as a communication
+channel.
+
+This function assumes TABLE has `org' as its `:type' property and
+`tabbing' as its `:mode' attribute."
+  (format "\\begin{%s}\n%s\n%s\\end{%s}"
+          "tabbing"
+          (org-latex--align-string-tabbing table info)
+          contents
+          "tabbing"))
+
 (defun org-latex--table.el-table (table info)
   "Return appropriate LaTeX code for a table.el table.
 
@@ -3408,7 +3927,7 @@ This function assumes TABLE has `org' as its `:type' 
property and
                 (lambda (cell)
                   (substring (org-element-interpret-data cell) 0 -1))
                 (org-element-map row 'table-cell #'identity info) "&")
-               (or (cdr (assoc env org-latex-table-matrix-macros)) "\\\\")
+               (or (cdr (assoc env org-latex-table-matrix-macros)) 
org-latex-line-break-safe)
                "\n")))
           (org-element-map table 'table-row #'identity info) "")))
     (concat
@@ -3434,8 +3953,10 @@ This function assumes TABLE has `org' as its `:type' 
property and
   "Transcode a TABLE-CELL element from Org to LaTeX.
 CONTENTS is the cell contents.  INFO is a plist used as
 a communication channel."
-  (concat
-   (let ((scientific-format (plist-get info :latex-table-scientific-notation)))
+  (let ((type (org-export-read-attribute
+               :attr_latex (org-export-get-parent-table table-cell) :mode))
+        (scientific-format (plist-get info :latex-table-scientific-notation)))
+    (concat
      (if (and contents
              scientific-format
              (string-match orgtbl-exp-regexp contents))
@@ -3444,8 +3965,9 @@ a communication channel."
         (format scientific-format
                 (match-string 1 contents)
                 (match-string 2 contents))
-       contents))
-   (when (org-export-get-next-element table-cell info) " & ")))
+       contents)
+     (when (org-export-get-next-element table-cell info)
+       (if (string= type "tabbing") " \\> " " & ")))))
 
 
 ;;;; Table Row
@@ -3477,7 +3999,7 @@ a communication channel."
        ;; hline was specifically marked.
        (and booktabsp (not (org-export-get-previous-element table-row info))
            "\\toprule\n")
-       contents "\\\\\n"
+       contents org-latex-line-break-safe "\n"
        (cond
        ;; Special case for long tables.  Define header and footers.
        ((and longtablep (org-export-table-row-ends-header-p table-row info))
@@ -3485,9 +4007,9 @@ a communication channel."
                              (org-export-get-parent-table table-row) info))))
           (format "%s
 \\endfirsthead
-\\multicolumn{%d}{l}{%s} \\\\
+\\multicolumn{%d}{l}{%s} \\\\[0pt]
 %s
-%s \\\\\n
+%s \\\\[0pt]\n
 %s
 \\endhead
 %s\\multicolumn{%d}{r}{%s} \\\\
@@ -3585,10 +4107,15 @@ contextual information."
              (replace-regexp-in-string
               "^[ \t]+" (lambda (m) (format "\\hspace*{%dem}" (length m)))
               (replace-regexp-in-string
-               "^[ \t]*\\\\\\\\$" "\\vspace*{1em}"
+                (concat "^[ \t]*" (regexp-quote org-latex-line-break-safe) "$")
+               "\\vspace*{1em}"
                (replace-regexp-in-string
-                "\\([ \t]*\\\\\\\\\\)?[ \t]*\n" "\\\\\n"
-                contents nil t) nil t) nil t) linreset)
+                "\\([ \t]*\\\\\\\\\\)?[ \t]*\n"
+                 (concat org-latex-line-break-safe "\n")
+                contents nil t)
+                nil t)
+               nil t)
+              linreset)
       info)
      ;; Insert footnote definitions, if any, after the environment, so
      ;; the special formatting above is not applied to them.
@@ -3731,6 +4258,9 @@ produced."
                                            t)
                     (progn (beginning-of-line) (looking-at-p "%"))
                     (match-string 0)))
+              ;; Cannot find the compiler inserted by
+              ;; `org-latex-template' -> `org-latex--insert-compiler'.
+              ;; Use a fallback.
              "pdflatex"))
         (process (if (functionp org-latex-pdf-process) org-latex-pdf-process
                    ;; Replace "%latex" with "%L" and "%bib" and
diff --git a/lisp/org/ox-man.el b/lisp/org/ox-man.el
index e808edcdfc..111c46aed9 100644
--- a/lisp/org/ox-man.el
+++ b/lisp/org/ox-man.el
@@ -37,6 +37,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ox)
 
@@ -223,7 +226,6 @@ By default, Org uses 3 runs of to do the processing.
 Alternatively, this may be a Lisp function that does the
 processing.  This function should accept the file name as
 its single argument."
-  :group 'org-export-pdf
   :group 'org-export-man
   :version "24.4"
   :package-version '(Org . "8.0")
diff --git a/lisp/org/ox-md.el b/lisp/org/ox-md.el
index 3551e4184e..dcd95e9871 100644
--- a/lisp/org/ox-md.el
+++ b/lisp/org/ox-md.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: org, wp, markdown
 
 ;; This file is part of GNU Emacs.
@@ -29,6 +29,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ox-html)
 (require 'ox-publish)
@@ -71,6 +74,23 @@ The %s will be replaced by the footnote reference itself."
   :version "26.1"
   :package-version '(Org . "9.0"))
 
+(defcustom org-md-toplevel-hlevel 1
+  "Heading level to use for level 1 Org headings in markdown export.
+
+If this is 1, headline levels will be preserved on export.  If this is
+2, top level Org headings will be exported to level 2 markdown
+headings, level 2 Org headings will be exported to level 3 markdown
+headings, and so on.
+
+Incrementing this value may be helpful when creating markdown to be
+included into another document or application that reserves top-level
+headings for its own use."
+  :group 'org-export-md
+  :package-version '(Org . "9.6")
+  ;; Avoid `natnum' because that's not available until Emacs 28.1.
+  :type 'integer)
+
+
 
 ;;; Define Back-End
 
@@ -120,7 +140,8 @@ The %s will be replaced by the footnote reference itself."
   :options-alist
   '((:md-footnote-format nil nil org-md-footnote-format)
     (:md-footnotes-section nil nil org-md-footnotes-section)
-    (:md-headline-style nil nil org-md-headline-style)))
+    (:md-headline-style nil nil org-md-headline-style)
+    (:md-toplevel-hlevel nil nil org-md-toplevel-hlevel)))
 
 
 ;;; Filters
@@ -229,9 +250,10 @@ When optional argument SCOPE is non-nil, build a table of
 contents according to the specified element."
   (concat
    (unless scope
-     (let ((style (plist-get info :md-headline-style))
+     (let ((level (plist-get info :md-toplevel-hlevel))
+           (style (plist-get info :md-headline-style))
           (title (org-html--translate "Table of Contents" info)))
-       (org-md--headline-title style 1 title nil)))
+       (org-md--headline-title style level title nil)))
    (mapconcat
     (lambda (headline)
       (let* ((indentation
@@ -350,7 +372,8 @@ CONTENTS is nil.  INFO is a plist holding contextual 
information."
 CONTENTS is the headline contents.  INFO is a plist used as
 a communication channel."
   (unless (org-element-property :footnote-section-p headline)
-    (let* ((level (org-export-get-relative-level headline info))
+    (let* ((level (+ (org-export-get-relative-level headline info)
+                     (1- (plist-get info :md-toplevel-hlevel))))
           (title (org-export-data (org-element-property :title headline) info))
           (todo (and (plist-get info :with-todo-keywords)
                      (let ((todo (org-element-property :todo-keyword
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el
index 8c8c80136a..402c754471 100644
--- a/lisp/org/ox-odt.el
+++ b/lisp/org/ox-odt.el
@@ -4,7 +4,7 @@
 
 ;; Author: Jambunathan K <kjambunathan at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
 
 ;; This file is part of GNU Emacs.
 
@@ -25,6 +25,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'format-spec)
 (require 'org-compat)
@@ -32,6 +35,10 @@
 (require 'ox)
 (require 'table nil 'noerror)
 
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
+
 ;;; Define Back-End
 
 (org-export-define-backend 'odt
@@ -362,7 +369,6 @@ When this option is turned on, `indent-region' is run on all
 component xml buffers before they are saved.  Turn this off for
 regular use.  Turn this on if you need to examine the xml
 visually."
-  :group 'org-export-odt
   :version "24.1"
   :type 'boolean)
 
@@ -399,14 +405,13 @@ with GNU ELPA tar or standard Emacs distribution."
   :type '(choice
          (const :tag "Not set" nil)
          (directory :tag "Schema directory"))
-  :group 'org-export-odt
   :version "24.1"
   :set
   (lambda (var value)
     "Set `org-odt-schema-dir'.
 Also add it to `rng-schema-locating-files'."
     (let ((schema-dir value))
-      (set var
+      (set-default-toplevel-value var
           (if (and
                (file-expand-wildcards
                 (expand-file-name "od-manifest-schema*.rnc" schema-dir))
@@ -437,7 +442,6 @@ If unspecified, the file named \"OrgOdtContentTemplate.xml\"
 under `org-odt-styles-dir' is used."
   :type '(choice (const nil)
                 (file))
-  :group 'org-export-odt
   :version "24.3")
 
 (defcustom org-odt-styles-file nil
@@ -471,7 +475,6 @@ a per-file basis.  For example,
 
 #+ODT_STYLES_FILE: \"/path/to/styles.xml\" or
 #+ODT_STYLES_FILE: (\"/path/to/file.ott\" (\"styles.xml\" \"image/hdr.png\"))."
-  :group 'org-export-odt
   :version "24.1"
   :type
   '(choice
@@ -486,7 +489,6 @@ a per-file basis.  For example,
 
 (defcustom org-odt-display-outline-level 2
   "Outline levels considered for enumerating captioned entities."
-  :group 'org-export-odt
   :version "24.4"
   :package-version '(Org . "8.0")
   :type 'integer)
@@ -516,7 +518,6 @@ specifiers are interpreted as below:
 %d output dir in full
 %D output dir as a URL.
 %x extra options as set in `org-odt-convert-capabilities'."
-  :group 'org-export-odt
   :version "24.1"
   :type
   '(choice
@@ -529,7 +530,6 @@ specifiers are interpreted as below:
   "Use this converter to convert from \"odt\" format to other formats.
 During customization, the list of converter names are populated
 from `org-odt-convert-processes'."
-  :group 'org-export-odt
   :version "24.1"
   :type '(choice :convert-widget
                 (lambda (w)
@@ -591,7 +591,6 @@ format) to be converted to any of the export formats 
associated
 with that class.
 
 See default setting of this variable for a typical configuration."
-  :group 'org-export-odt
   :version "24.1"
   :type
   '(choice
@@ -618,7 +617,6 @@ variable, the list of valid values are populated based on
 
 You can set this option on per-file basis using file local
 values.  See Info node `(emacs) File Variables'."
-  :group 'org-export-odt
   :version "24.1"
   :type '(choice :convert-widget
                 (lambda (w)
@@ -644,7 +642,6 @@ The function must accept two parameters:
 The function should return the string to be exported.
 
 The default value simply returns the value of CONTENTS."
-  :group 'org-export-odt
   :version "26.1"
   :package-version '(Org . "8.3")
   :type 'function)
@@ -664,7 +661,6 @@ TEXT      the main headline text (string).
 TAGS      the tags string, separated with colons (string or nil).
 
 The function result will be used as headline text."
-  :group 'org-export-odt
   :version "26.1"
   :package-version '(Org . "8.3")
   :type 'function)
@@ -685,7 +681,6 @@ The function must accept six parameters:
   CONTENTS  the contents of the inlinetask, as a string.
 
 The function should return the string to be exported."
-  :group 'org-export-odt
   :version "26.1"
   :package-version '(Org . "8.3")
   :type 'function)
@@ -712,7 +707,6 @@ nil            Ignore math snippets.
                be loaded.
 
 Any other symbol is a synonym for `mathjax'."
-  :group 'org-export-odt
   :version "24.4"
   :package-version '(Org . "8.0")
   :type '(choice
@@ -732,7 +726,6 @@ Any other symbol is a synonym for `mathjax'."
 A rule consists in an association whose key is the type of link
 to consider, and value is a regexp that will be matched against
 link's path."
-  :group 'org-export-odt
   :version "24.4"
   :package-version '(Org . "8.0")
   :type '(alist :key-type (string :tag "Type")
@@ -745,7 +738,6 @@ link's path."
 A rule consists in an association whose key is the type of link
 to consider, and value is a regexp that will be matched against
 link's path."
-  :group 'org-export-odt
   :version "26.1"
   :package-version '(Org . "8.3")
   :type '(alist :key-type (string :tag "Type")
@@ -756,7 +748,6 @@ link's path."
 Use this for sizing of embedded images.  See Info node `(org)
 Images in ODT export' for more information."
   :type 'float
-  :group 'org-export-odt
   :version "24.4"
   :package-version '(Org . "8.1"))
 
@@ -778,7 +769,6 @@ styles.xml already contains needed styles for colorizing to 
work.
 
 This variable is effective only if `org-odt-fontify-srcblocks' is
 turned on."
-  :group 'org-export-odt
   :version "24.1"
   :type 'boolean)
 
@@ -788,7 +778,6 @@ Turn this option on if you want to colorize the source code
 blocks in the exported file.  For colorization to work, you need
 to make available an enhanced version of `htmlfontify' library."
   :type 'boolean
-  :group 'org-export-odt
   :version "24.1")
 
 
@@ -873,7 +862,6 @@ implementation filed under `org-odt-get-table-cell-styles'.
 The TABLE-STYLE-NAME \"OrgEquation\" is used internally for
 formatting of numbered display equations.  Do not delete this
 style from the list."
-  :group 'org-export-odt
   :version "24.1"
   :type '(choice
           (const :tag "None" nil)
@@ -918,7 +906,6 @@ document by setting the default language and country either 
using
 the application UI or through a custom styles file.
 
 See `org-odt--build-date-styles' for implementation details."
-  :group 'org-export-odt
   :version "24.4"
   :package-version '(Org . "8.0")
   :type 'boolean)
@@ -933,7 +920,7 @@ See `org-odt--build-date-styles' for implementation 
details."
   (let* ((format-timestamp
          (lambda (timestamp format &optional end utc)
            (if timestamp
-               (org-timestamp-format timestamp format end utc)
+               (org-format-timestamp timestamp format end utc)
              (format-time-string format nil utc))))
         (has-time-p (or (not timestamp)
                         (org-timestamp-has-time-p timestamp)))
@@ -949,14 +936,8 @@ See `org-odt--build-date-styles' for implementation 
details."
             ;; don't bother about formatting the date contents to be
             ;; compatible with "OrgDate1" and "OrgDateTime" styles.  A
             ;; simple Org-style date should suffice.
-            (date (let* ((formats
-                          (if org-display-custom-times
-                              (cons (substring
-                                     (car org-time-stamp-custom-formats) 1 -1)
-                                    (substring
-                                     (cdr org-time-stamp-custom-formats) 1 -1))
-                            '("%Y-%m-%d %a" . "%Y-%m-%d %a %H:%M")))
-                         (format (if has-time-p (cdr formats) (car formats))))
+            (date (let ((format (org-time-stamp-format
+                                  has-time-p 'no-brackets 'custom)))
                     (funcall format-timestamp timestamp format end)))
             (repeater (let ((repeater-type (org-element-property
                                             :repeater-type timestamp))
@@ -1435,8 +1416,10 @@ original parsed data.  INFO is a plist holding export 
options."
         ;; value before moving on to temp-buffer context down below.
         (custom-time-fmts
          (if org-display-custom-times
-             (cons (substring (car org-time-stamp-custom-formats) 1 -1)
-                   (substring (cdr org-time-stamp-custom-formats) 1 -1))
+              (cons (org-time-stamp-format
+                     nil 'no-brackets 'custom)
+                    (org-time-stamp-format
+                     'with-time 'no-brackets 'custom))
            '("%Y-%M-%d %a" . "%Y-%M-%d %a %H:%M"))))
     (with-temp-buffer
       (insert-file-contents
@@ -2005,14 +1988,16 @@ information."
 
 ;;;; Latex Environment
 
-
 ;; (eval-after-load 'ox-odt '(ad-deactivate 'org-format-latex-as-mathml))
-;; (defadvice org-format-latex-as-mathml       ; FIXME
-;;   (after org-odt-protect-latex-fragment activate)
+;; (advice-add 'org-format-latex-as-mathml     ; FIXME
+;;   :around #'org--odt-protect-latex-fragment)
+;; (defun org--odt-protect-latex-fragment (orig-fun latex-frag &rest args)
 ;;   "Encode LaTeX fragment as XML.
 ;; Do this when translation to MathML fails."
-;;   (unless (> (length ad-return-value) 0)
-;;     (setq ad-return-value (org-odt--encode-plain-text (ad-get-arg 0)))))
+;;   (let ((retval (apply orig-fun latex-frag args)))
+;;     (if (> (length retval) 0)
+;;         retval
+;;       (org-odt--encode-plain-text latex-frag))))
 
 (defun org-odt-latex-environment (latex-environment _contents info)
   "Transcode a LATEX-ENVIRONMENT element from Org to ODT.
@@ -2699,7 +2684,14 @@ INFO is a plist holding contextual information.  See
                ((member type '("http" "https" "ftp" "mailto"))
                 (concat type ":" raw-path))
                ((string= type "file")
-                (org-export-file-uri raw-path))
+                 (let ((path-uri (org-export-file-uri raw-path)))
+                   (if (string-prefix-p "file://" path-uri)
+                       path-uri
+                     ;; Otherwise, it is a relative path.
+                     ;; OpenOffice treats base directory inside the odt
+                     ;; archive.  The directory containing the odt file
+                     ;; is "../".
+                     (concat "../" path-uri))))
                (t raw-path)))
         ;; Convert & to &amp; for correct XML representation
         (path (replace-regexp-in-string "&" "&amp;" path)))
@@ -2748,6 +2740,16 @@ INFO is a plist holding contextual information.  See
           (format "<text:a xlink:type=\"simple\" 
xlink:href=\"#%s\">%s</text:a>"
                   (org-export-get-reference destination info)
                   (or desc (org-export-get-ordinal destination info))))
+          ;; Link to a file, corresponding to string return value of
+          ;; `org-export-resolve-id-link'.  Export it is file link.
+          (plain-text
+           (let ((file-link (org-element-copy link)))
+             (org-element-put-property file-link :type "file")
+             (org-element-put-property file-link :path destination)
+             (org-element-put-property
+              file-link
+              :raw-link (format "file:%s" destination))
+             (org-odt-link file-link desc info)))
          ;; Fuzzy link points to some element (e.g., an inline image,
          ;; a math formula or a table).
          (otherwise
@@ -2914,9 +2916,28 @@ contextual information."
        (setq output
              (replace-regexp-in-string (car pair) (cdr pair) output t nil))))
     ;; Handle break preservation if required.
-    (when (plist-get info :preserve-breaks)
-      (setq output (replace-regexp-in-string
-                   "\\(\\\\\\\\\\)?[ \t]*\n" "<text:line-break/>" output t)))
+    (if (plist-get info :preserve-breaks)
+        (setq output (replace-regexp-in-string
+                     "\\(\\\\\\\\\\)?[ \t]*\n" "<text:line-break/>" output t))
+      ;; OpenDocument schema recognizes newlines as spaces, which may
+      ;; not be desired in scripts that do not separate words with
+      ;; spaces (for example, Han script).  `fill-region' is able to
+      ;; handle such situations.
+      ;; FIXME: The unnecessary spaced may still remain when a newline
+      ;; is at a boundary between Org objects (e.g. italics markup
+      ;; followed by newline).
+      (setq output
+            (with-temp-buffer
+              (insert output)
+              (save-match-data
+                (let ((leading (and (string-match (rx bos (1+ blank)) output)
+                                    (match-string 0 output)))
+                      (trailing (and (string-match (rx (1+ blank) eos) output)
+                                     (match-string 0 output))))
+                  ;; Unfill, retaining leading/trailing space.
+                  (let ((fill-column (point-max)))
+                    (fill-region (point-min) (point-max)))
+                  (concat leading (buffer-string) trailing))))))
     ;; Return value.
     output))
 
@@ -3101,7 +3122,7 @@ and prefix with \"OrgSrc\".  For example,
                 (with-temp-buffer
                   (insert code)
                   (funcall lang-mode)
-                  (org-font-lock-ensure)
+                   (font-lock-ensure)
                   (buffer-string))))
         (fontifier (if use-htmlfontify-p 'org-odt-htmlfontify-string
                      'org-odt--encode-plain-text))
diff --git a/lisp/org/ox-org.el b/lisp/org/ox-org.el
index 0613ede317..159a41b983 100644
--- a/lisp/org/ox-org.el
+++ b/lisp/org/ox-org.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: org, wp
 
 ;; This file is part of GNU Emacs.
@@ -25,6 +25,9 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'ox)
 (declare-function htmlize-buffer "ext:htmlize" (&optional buffer))
 (defvar htmlize-output-type)
@@ -328,8 +331,8 @@ Return output file name."
           (work-buffer (or visitingp (find-file-noselect filename)))
           newbuf)
       (with-current-buffer work-buffer
-        (org-font-lock-ensure)
-        (org-show-all)
+        (font-lock-ensure)
+        (org-fold-show-all)
         (setq newbuf (htmlize-buffer)))
       (with-current-buffer newbuf
        (when org-org-htmlized-css-url
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index 51e2352b4e..a5999ef7bd 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -2,7 +2,7 @@
 ;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
 
 ;; Author: David O'Toole <dto@gnu.org>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: hypermedia, outlines, wp
 
 ;; This file is part of GNU Emacs.
@@ -38,10 +38,16 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'format-spec)
 (require 'ox)
 
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
 
 
 ;;; Variables
@@ -379,7 +385,7 @@ still decide about that independently."
   "Update publishing timestamp for file FILENAME.
 If there is no timestamp, create one."
   (let ((key (org-publish-timestamp-filename filename pub-dir pub-func))
-       (stamp (org-publish-cache-ctime-of-src filename)))
+       (stamp (org-publish-cache-mtime-of-src filename)))
     (org-publish-cache-set key stamp)))
 
 (defun org-publish-remove-all-timestamps ()
@@ -1289,7 +1295,7 @@ the file including them will be republished as well."
   (let* ((key (org-publish-timestamp-filename filename pub-dir pub-func))
         (pstamp (org-publish-cache-get key))
         (org-inhibit-startup t)
-        included-files-ctime)
+        included-files-mtime)
     (when (equal (file-name-extension filename) "org")
       (let ((case-fold-search t))
        (with-temp-buffer
@@ -1310,14 +1316,14 @@ the file including them will be republished as well."
                                     (substring m 0 (match-beginning 0))
                                   m)))))
                    (when include-filename
-                     (push (org-publish-cache-ctime-of-src
+                     (push (org-publish-cache-mtime-of-src
                             (expand-file-name include-filename 
(file-name-directory filename)))
-                           included-files-ctime))))))))))
+                           included-files-mtime))))))))))
     (or (null pstamp)
-       (let ((ctime (org-publish-cache-ctime-of-src filename)))
-         (or (time-less-p pstamp ctime)
-             (cl-some (lambda (ct) (time-less-p ctime ct))
-                      included-files-ctime))))))
+       (let ((mtime (org-publish-cache-mtime-of-src filename)))
+         (or (time-less-p pstamp mtime)
+             (cl-some (lambda (ct) (time-less-p mtime ct))
+                      included-files-mtime))))))
 
 (defun org-publish-cache-set-file-property
     (filename property value &optional project-name)
@@ -1362,8 +1368,8 @@ does not exist."
     (error "`org-publish-cache-set' called, but no cache present"))
   (puthash key value org-publish-cache))
 
-(defun org-publish-cache-ctime-of-src (file)
-  "Get the ctime of FILE as an integer."
+(defun org-publish-cache-mtime-of-src (file)
+  "Get the mtime of FILE as an integer."
   (let ((attr (file-attributes
               (expand-file-name (or (file-symlink-p file) file)
                                 (file-name-directory file)))))
diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el
index 9a8217583e..73ba349b1b 100644
--- a/lisp/org/ox-texinfo.el
+++ b/lisp/org/ox-texinfo.el
@@ -2,7 +2,7 @@
 
 ;; 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>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: outlines, hypermedia, calendar, wp
 
 ;; This file is part of GNU Emacs.
@@ -26,11 +26,14 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ox)
 
 (defvar orgtbl-exp-regexp)
-
+(defvar org-texinfo-supports-math--cache)
 
 
 ;;; Define Back-End
@@ -55,6 +58,8 @@
     (italic . org-texinfo-italic)
     (item . org-texinfo-item)
     (keyword . org-texinfo-keyword)
+    (latex-environment . org-texinfo-latex-environment)
+    (latex-fragment . org-texinfo-latex-fragment)
     (line-break . org-texinfo-line-break)
     (link . org-texinfo-link)
     (node-property . org-texinfo-node-property)
@@ -83,7 +88,8 @@
     (verse-block . org-texinfo-verse-block))
   :filters-alist
   '((:filter-headline . org-texinfo--filter-section-blank-lines)
-    (:filter-parse-tree . org-texinfo--normalize-headlines)
+    (:filter-parse-tree . (org-texinfo--normalize-headlines
+                          org-texinfo--separate-definitions))
     (:filter-section . org-texinfo--filter-section-blank-lines)
     (:filter-final-output . org-texinfo--untabify))
   :menu-entry
@@ -118,8 +124,10 @@
     (:texinfo-table-default-markup nil nil org-texinfo-table-default-markup)
     (:texinfo-text-markup-alist nil nil org-texinfo-text-markup-alist)
     (:texinfo-format-drawer-function nil nil 
org-texinfo-format-drawer-function)
-    (:texinfo-format-inlinetask-function nil nil 
org-texinfo-format-inlinetask-function)))
-
+    (:texinfo-format-inlinetask-function nil nil 
org-texinfo-format-inlinetask-function)
+    (:texinfo-compact-itemx nil "compact-itemx" org-texinfo-compact-itemx)
+    ;; Redefine regular options.
+    (:with-latex nil "tex" org-texinfo-with-latex)))
 
 
 ;;; User Configurable Variables
@@ -354,6 +362,37 @@ The function should return the string to be exported."
   :group 'org-export-texinfo
   :type 'function)
 
+;;;; LaTeX
+
+(defcustom org-texinfo-with-latex (and org-export-with-latex 'detect)
+  "When non-nil, the Texinfo exporter attempts to process LaTeX math.
+
+When set to t, the exporter will process LaTeX environments and
+fragments as Texinfo \"@displaymath\" and \"@math\" commands
+respectively.  Alternatively, when set to `detect', the exporter
+does so only if the installed version of Texinfo supports the
+necessary commands."
+  :group 'org-export-texinfo
+  :package-version '(Org . "9.6")
+  :type '(choice
+          (const :tag "Detect" detect)
+          (const :tag "Yes" t)
+          (const :tag "No" nil)))
+
+;;;; Itemx
+
+(defcustom org-texinfo-compact-itemx nil
+  "Non-nil means certain items in description list become `@itemx'.
+
+If this is non-nil and an item in a description list has no
+body but is followed by another item, then the second item is
+transcoded to `@itemx'.  See info node `(org)Plain lists in
+Texinfo export' for how to enable this for individual lists."
+  :package-version '(Org . "9.6")
+  :group 'org-export-texinfo
+  :type 'boolean
+  :safe t)
+
 ;;;; Compilation
 
 (defcustom org-texinfo-info-process '("makeinfo --no-split %f")
@@ -407,6 +446,30 @@ If two strings share the same prefix (e.g. \"ISO-8859-1\" 
and
              (regexp-opt '("eps" "pdf" "png" "jpg" "jpeg" "gif" "svg"))))
   "Rules characterizing image files that can be inlined.")
 
+(defvar org-texinfo--quoted-keys-regexp
+  (regexp-opt '("BS" "TAB" "RET" "ESC" "SPC" "DEL"
+               "LFD" "DELETE" "SHIFT" "Ctrl" "Meta" "Alt"
+               "Cmd" "Super" "UP" "LEFT" "RIGHT" "DOWN")
+             'words)
+  "Regexp matching keys that have to be quoted using @key{KEY}.")
+
+(defconst org-texinfo--definition-command-alist
+  '(("deffn Command" . "Command")
+    ("defun" . "Function")
+    ("defmac" . "Macro")
+    ("defspec" . "Special Form")
+    ("defvar" . "Variable")
+    ("defopt" . "User Option")
+    (nil . "Key"))
+  "Alist mapping Texinfo definition commands to output in Info files.")
+
+(defconst org-texinfo--definition-command-regexp
+  (format "\\`%s: \\(.+\\)"
+         (regexp-opt
+          (delq nil (mapcar #'cdr org-texinfo--definition-command-alist))
+          t))
+  "Regexp used to match definition commands in descriptive lists.")
+
 
 ;;; Internal Functions
 
@@ -570,6 +633,130 @@ INFO is a plist holding export options."
       (`(,_ ,_ . ,sections) sections)
       (_ (user-error "Unknown Texinfo class: %S" class)))))
 
+(defun org-texinfo--separate-definitions (tree _backend info)
+  "Split up descriptive lists in TREE that contain Texinfo definition commands.
+INFO is a plist used as a communication channel.
+Return new tree."
+  (org-element-map tree 'plain-list
+    (lambda (plain-list)
+      (when (eq (org-element-property :type plain-list) 'descriptive)
+       (let ((contents (org-element-contents plain-list))
+             (items nil))
+         (dolist (item contents)
+           (pcase-let ((`(,cmd . ,args) (org-texinfo--match-definition item)))
+             (cond
+              (cmd
+               (when items
+                 (org-texinfo--split-plain-list plain-list (nreverse items))
+                 (setq items nil))
+               (org-texinfo--split-definition plain-list item cmd args))
+              (t
+               (when args
+                 (org-texinfo--massage-key-item plain-list item args info))
+               (push item items)))))
+         (unless (org-element-contents plain-list)
+           (org-element-extract-element plain-list)))))
+    info)
+  tree)
+
+(defun org-texinfo--match-definition (item)
+  "Return a cons-cell if ITEM specifies a Texinfo definition command.
+The car is the command and the cdr is its arguments."
+  (let ((tag (car-safe (org-element-property :tag item))))
+    (and tag
+        (stringp tag)
+        (string-match org-texinfo--definition-command-regexp tag)
+        (pcase-let*
+            ((cmd (car (rassoc (match-string-no-properties 1 tag)
+                                org-texinfo--definition-command-alist)))
+             (`(,cmd ,category)
+              (and cmd (save-match-data (split-string cmd " "))))
+             (args (match-string-no-properties 2 tag)))
+          (cons cmd (if category (concat category " " args) args))))))
+
+(defun org-texinfo--split-definition (plain-list item cmd args)
+  "Insert a definition command before list PLAIN-LIST.
+Replace list item ITEM with a special-block that inherits the
+contents of ITEM and whose type and Texinfo attributes are
+specified by CMD and ARGS."
+  (let ((contents (org-element-contents item)))
+    (org-element-insert-before
+     (apply #'org-element-create 'special-block
+           (list :type cmd
+                 :attr_texinfo (list (format ":options %s" args))
+                 :post-blank (if contents 1 0))
+           (mapc #'org-element-extract-element contents))
+     plain-list))
+  (org-element-extract-element item))
+
+(defun org-texinfo--split-plain-list (plain-list items)
+  "Insert a new plain list before the plain list PLAIN-LIST.
+Remove ITEMS from PLAIN-LIST and use them as the contents of the
+new plain list."
+  (org-element-insert-before
+   (apply #'org-element-create 'plain-list
+         (list :type 'descriptive
+                :attr_texinfo (org-element-property :attr_texinfo plain-list)
+                :post-blank 1)
+         (mapc #'org-element-extract-element items))
+   plain-list))
+
+(defun org-texinfo--massage-key-item (plain-list item args info)
+  "In PLAIN-LIST modify ITEM based on ARGS.
+
+Reformat ITEM's tag property and determine the arguments for the
+`@findex' and `@kindex' commands for ITEM and store them in ITEM
+using the `:findex' and `:kindex' properties.
+
+If PLAIN-LIST is a description list whose `:compact' attribute is
+non-nil and ITEM has no content but is followed by another item,
+then store the `@findex' and `@kindex' values in the next item.
+If the previous item stored its respective values in this item,
+then move them to the next item.
+
+INFO is a plist used as a communication channel."
+  (let ((key nil)
+       (cmd nil))
+    (if (string-match (rx (+ " ")
+                         "(" (group (+ (not (any "()")))) ")"
+                         (* " ")
+                         eos)
+                     args)
+       (setq key (substring args 0 (match-beginning 0))
+             cmd (match-string 1 args))
+      (setq key args))
+    (org-element-put-property
+     item :tag
+     (cons (org-export-raw-string (org-texinfo-kbd-macro key t))
+          (and cmd `(" (" (code (:value ,cmd :post-blank 0)) ")"))))
+    (let ((findex (org-element-property :findex item))
+         (kindex (org-element-property :kindex item))
+         (next-item (org-export-get-next-element item nil))
+         (mx (string-prefix-p "M-x " key)))
+      (when (and (not cmd) mx)
+       (setq cmd (substring key 4)))
+      (when (and cmd (not (member cmd findex)))
+       (setq findex (nconc findex (list cmd))))
+      (unless mx
+       (setq kindex (nconc kindex (list key))))
+      (cond
+       ((and next-item
+             (or (plist-get info :texinfo-compact-itemx)
+                (org-not-nil
+                 (org-export-read-attribute :attr_texinfo plain-list 
:compact)))
+            (not (org-element-contents item))
+            (eq 1 (org-element-property :post-blank item)))
+       (org-element-put-property next-item :findex findex)
+       (org-element-put-property next-item :kindex kindex)
+       (org-element-put-property item :findex nil)
+       (org-element-put-property item :kindex nil))
+       (t
+       (org-element-set-contents
+        item
+        (nconc (mapcar (lambda (key) `(keyword (:key "KINDEX" :value ,key))) 
kindex)
+               (mapcar (lambda (cmd) `(keyword (:key "FINDEX" :value ,cmd))) 
findex)
+               (org-element-contents item))))))))
+
 ;;; Template
 
 (defun org-texinfo-template (contents info)
@@ -990,25 +1177,42 @@ contextual information."
 CONTENTS holds the contents of the item.  INFO is a plist holding
 contextual information."
   (let* ((tag (org-element-property :tag item))
-        (split (org-string-nw-p
-                (org-export-read-attribute :attr_texinfo
-                                           (org-element-property :parent item)
-                                           :sep)))
-        (items (and tag
-                    (let ((tag (org-export-data tag info)))
-                      (if split
-                          (split-string tag (regexp-quote split) t "[ \t\n]+")
-                        (list tag))))))
-    (format "%s\n%s"
-           (pcase items
-             (`nil "@item")
-             (`(,item) (concat "@item " item))
-             (`(,item . ,items)
-              (concat "@item " item "\n"
-                      (mapconcat (lambda (i) (concat "@itemx " i))
-                                 items
-                                 "\n"))))
-           (or contents ""))))
+         (plain-list (org-element-property :parent item))
+         (compact (and (eq (org-element-property :type plain-list) 
'descriptive)
+                       (or (plist-get info :texinfo-compact-itemx)
+                           (org-not-nil (org-export-read-attribute
+                                         :attr_texinfo plain-list :compact)))))
+         (previous-item nil))
+    (when (and compact
+               (org-export-get-next-element item info)
+               (not (org-element-contents item))
+               (eq 1 (org-element-property :post-blank item)))
+      (org-element-put-property item :post-blank 0))
+    (if (and compact
+             (setq previous-item (org-export-get-previous-element item info))
+             (not (org-element-contents previous-item))
+            (eq 0 (org-element-property :post-blank previous-item)))
+        (format "@itemx%s\n%s"
+                (if tag (concat " " (org-export-data tag info)) "")
+                (or contents ""))
+      (let* ((split (org-string-nw-p (org-export-read-attribute
+                                      :attr_texinfo plain-list :sep)))
+            (items (and tag
+                        (let ((tag (org-export-data tag info)))
+                          (if split
+                              (split-string tag (regexp-quote split)
+                                             t "[ \t\n]+")
+                            (list tag))))))
+        (format "%s\n%s"
+               (pcase items
+                 (`nil "@item")
+                 (`(,item) (concat "@item " item))
+                 (`(,item . ,items)
+                  (concat "@item " item "\n"
+                          (mapconcat (lambda (i) (concat "@itemx " i))
+                                     items
+                                     "\n"))))
+               (or contents ""))))))
 
 ;;;; Keyword
 
@@ -1032,6 +1236,52 @@ CONTENTS is nil.  INFO is a plist holding contextual 
information."
              (concat "@listoffloats "
                      (org-export-translate "Listing" :utf-8 info))))))))
 
+;;;; LaTeX Environment
+
+(defun org-texinfo-latex-environment (environment _contents info)
+  "Transcode a LaTeX ENVIRONMENT from Org to Texinfo.
+CONTENTS is ignored.  INFO is a plist holding contextual information."
+  (let ((with-latex (plist-get info :with-latex)))
+    (when (or (eq with-latex t)
+              (and (eq with-latex 'detect)
+                   (org-texinfo-supports-math-p)))
+      (let ((value (org-element-property :value environment)))
+        (string-join (list "@displaymath"
+                           (string-trim (org-remove-indentation value))
+                           "@end displaymath")
+                     "\n")))))
+
+;;;; LaTeX Fragment
+
+(defun org-texinfo-latex-fragment (fragment _contents info)
+  "Transcode a LaTeX FRAGMENT from Org to Texinfo.
+INFO is a plist holding contextual information."
+  (let ((with-latex (plist-get info :with-latex)))
+    (when (or (eq with-latex t)
+              (and (eq with-latex 'detect)
+                   (org-texinfo-supports-math-p)))
+      (let ((value (org-remove-indentation
+                    (org-element-property :value fragment))))
+        (cond
+         ((or (string-match-p "^\\\\\\[" value)
+              (string-match-p "^\\$\\$" value))
+          (concat "\n"
+                  "@displaymath"
+                  "\n"
+                  (string-trim (substring value 2 -2))
+                  "\n"
+                  "@end displaymath"
+                  "\n"))
+         ((string-match-p "^\\$" value)
+          (concat "@math{"
+                  (string-trim (substring value 1 -1))
+                  "}"))
+         ((string-match-p "^\\\\(" value)
+          (concat "@math{"
+                  (string-trim (substring value 2 -2))
+                  "}"))
+         (t value))))))
+
 ;;;; Line Break
 
 (defun org-texinfo-line-break (_line-break _contents _info)
@@ -1611,7 +1861,28 @@ contextual information."
   (format "@display\n%s@end display" contents))
 
 
-;;; Interactive functions
+;;; Public Functions
+
+(defun org-texinfo-kbd-macro (key &optional noquote)
+  "Quote KEY using @kbd{...} and if necessary @key{...}.
+
+This is intended to be used as an Org macro like so:
+
+  #+macro: kbd (eval (org-texinfo-kbd-macro $1))
+  Type {{{kbd(C-c SPC)}}}.
+
+Also see info node `(org)Key bindings in Texinfo export'.
+
+If optional NOQOUTE is non-nil, then do not add the quoting
+that is necessary when using this in an Org macro."
+  (format (if noquote "@kbd{%s}" "@@texinfo:@kbd{@@%s@@texinfo:}@@")
+         (let ((case-fold-search nil))
+           (replace-regexp-in-string
+            org-texinfo--quoted-keys-regexp
+            (if noquote "@key{\\&}" "@@texinfo:@key{@@\\&@@texinfo:}@@")
+            key t))))
+
+;;; Interactive Functions
 
 ;;;###autoload
 (defun org-texinfo-export-to-texinfo
@@ -1747,6 +2018,31 @@ Return INFO file name or an error if it couldn't be 
produced."
     (message "Process completed.")
     output))
 
+(defun org-texinfo-supports-math-p ()
+  "Return t if the installed version of Texinfo supports \"@math\".
+
+Once computed, the results remain cached."
+  (unless (boundp 'org-texinfo-supports-math--cache)
+    (setq org-texinfo-supports-math--cache
+          (let ((math-example "1 + 1 = 2"))
+            (let* ((input-file
+                    (make-temp-file "test" nil ".info"))
+                   (input-content
+                    (concat (format "@setfilename %s" input-file) "\n"
+                            "@node Top" "\n"
+                            (format "@displaymath{%s}" math-example) "\n")))
+              (with-temp-file input-file
+                (insert input-content))
+              (let* ((output-file (org-texinfo-compile input-file))
+                     (output-content (with-temp-buffer
+                                       (insert-file-contents output-file)
+                                       (buffer-string))))
+                (let ((result (string-match-p (regexp-quote math-example)
+                                              output-content)))
+                  (delete-file input-file)
+                  (delete-file output-file)
+                  (if result t nil)))))))
+  org-texinfo-supports-math--cache)
 
 (provide 'ox-texinfo)
 
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index ca6b3f2208..737703f11d 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -2,8 +2,8 @@
 
 ;; 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>
+;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;; Keywords: outlines, hypermedia, calendar, wp
 
 ;; This file is part of GNU Emacs.
@@ -72,15 +72,16 @@
 
 ;;; Code:
 
+(require 'org-macs)
+(org-assert-version)
+
 (require 'cl-lib)
 (require 'ob-exp)
 (require 'oc)
-(require 'oc-basic)    ;default value for `org-cite-export-processors'
 (require 'ol)
 (require 'org-element)
 (require 'org-macro)
 (require 'tabulated-list)
-(require 'subr-x)
 
 (declare-function org-src-coderef-format "org-src" (&optional element))
 (declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
@@ -88,6 +89,9 @@
 (declare-function org-publish-all "ox-publish" (&optional force async))
 (declare-function org-publish-current-file "ox-publish" (&optional force 
async))
 (declare-function org-publish-current-project "ox-publish" (&optional force 
async))
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
 
 (defvar org-publish-project-alist)
 (defvar org-table-number-fraction)
@@ -260,9 +264,13 @@ See `org-export-inline-image-p' for more information about
 rules.")
 
 (defconst org-export-ignored-local-variables
-  '(org-font-lock-keywords
-    org-element--cache org-element--cache-objects org-element--cache-sync-keys
-    org-element--cache-sync-requests org-element--cache-sync-timer)
+  '( org-font-lock-keywords org-element--cache-change-tic
+     org-element--cache-change-tic org-element--cache-size
+     org-element--headline-cache-size
+     org-element--cache-sync-keys-value
+     org-element--cache-change-warning org-element--headline-cache
+     org-element--cache org-element--cache-sync-keys
+     org-element--cache-sync-requests org-element--cache-sync-timer)
   "List of variables not copied through upon buffer duplication.
 Export process takes place on a copy of the original buffer.
 When this copy is created, all Org related local variables not in
@@ -869,8 +877,12 @@ This option can also be set with the OPTIONS keyword, e.g.,
 
 This variable allows providing shortcuts for export snippets.
 
-For example, with a value of \\='((\"h\" . \"html\")), the
-HTML back-end will recognize the contents of \"@@h:<b>@@\" as
+For example, with:
+
+  (setq org-export-snippet-translation-alist
+        \\='((\"h\" . \"html\")))
+
+the HTML back-end will recognize the contents of \"@@h:<b>@@\" as
 HTML code while every other back-end will ignore it."
   :group 'org-export-general
   :version "24.4"
@@ -1179,7 +1191,7 @@ keywords are understood:
     Menu entry for the export dispatcher.  It should be a list
     like:
 
-      \\='(KEY DESCRIPTION-OR-ORDINAL ACTION-OR-MENU)
+      (KEY DESCRIPTION-OR-ORDINAL ACTION-OR-MENU)
 
     where :
 
@@ -1203,17 +1215,17 @@ keywords are understood:
       If it is an alist, associations should follow the
       pattern:
 
-        \\='(KEY DESCRIPTION ACTION)
+        (KEY DESCRIPTION ACTION)
 
       where KEY, DESCRIPTION and ACTION are described above.
 
     Valid values include:
 
-      \\='(?m \"My Special Back-end\" my-special-export-function)
+      (?m \"My Special Back-end\" my-special-export-function)
 
       or
 
-      \\='(?l \"Export to LaTeX\"
+       (?l \"Export to LaTeX\"
            ((?p \"As PDF file\" org-latex-export-to-pdf)
             (?o \"As PDF file and open\"
                 (lambda (a s v b)
@@ -1224,7 +1236,7 @@ keywords are understood:
       or the following, which will be added to the previous
       sub-menu,
 
-      \\='(?l 1
+       (?l 1
           ((?B \"As TEX buffer (Beamer)\" org-beamer-export-as-latex)
            (?P \"As PDF file (Beamer)\" org-beamer-export-to-pdf)))
 
@@ -1392,14 +1404,15 @@ Optional argument BACKEND is an export back-end, as 
returned by,
 e.g., `org-export-create-backend'.  It specifies which back-end
 specific items to read, if any."
   (let ((line
-        (let ((s 0) alist)
-          (while (string-match "\\(.+?\\):\\((.*?)\\|\\S-+\\)?[ \t]*" options 
s)
-            (setq s (match-end 0))
-            (let ((value (match-string 2 options)))
-               (when value
-                 (push (cons (match-string 1 options)
-                             (read value))
-                      alist))))
+        (let (alist)
+           (with-temp-buffer
+             (insert options)
+             (goto-char (point-min))
+             (while (re-search-forward "\\s-*\\(.+?\\):" nil t)
+               (when (looking-at-p "\\S-")
+                 (push (cons (match-string 1)
+                             (read (current-buffer))) ; moves point
+                       alist))))
           alist))
        ;; Priority is given to back-end specific options.
        (all (append (org-export-get-all-options backend)
@@ -1422,7 +1435,7 @@ for export.  Return options as a plist."
   ;; property is the keyword with "EXPORT_" appended to it.
   (org-with-wide-buffer
    ;; Make sure point is at a heading.
-   (if (org-at-heading-p) (org-up-heading-safe) (org-back-to-heading t))
+   (org-back-to-heading t)
    (let ((plist
          ;; EXPORT_OPTIONS are parsed in a non-standard way.  Take
          ;; care of them right from the start.
@@ -1926,34 +1939,28 @@ Return a string."
                              (and (not greaterp)
                                   (memq type org-element-recursive-objects)))
                             (contents
-                              (let ((export-buffer (current-buffer)))
-                                (with-temp-buffer
-                                  (dolist (element (org-element-contents
-                                                   (if (or greaterp objectp) 
data
-                                                     ;; Elements directly 
containing
-                                                     ;; objects must have 
their indentation
-                                                     ;; normalized first.
-                                                     
(org-element-normalize-contents
-                                                      data
-                                                      ;; When normalizing 
first paragraph
-                                                      ;; of an item or
-                                                      ;; a 
footnote-definition, ignore
-                                                      ;; first line's 
indentation.
-                                                      (and
-                                                       (eq type 'paragraph)
-                                                       (memq (org-element-type 
parent)
-                                                             
'(footnote-definition item))
-                                                       (eq (car 
(org-element-contents parent))
-                                                           data)
-                                                       (eq 
(org-element-property :pre-blank parent)
-                                                           0))))))
-                                    (insert
-                                     ;; Use right local variable
-                                     ;; environment if there are, for
-                                     ;; example, #+BIND variables.
-                                     (with-current-buffer export-buffer
-                                       (org-export-data element info))))
-                                  (buffer-string)))))
+                             (mapconcat
+                              (lambda (element) (org-export-data element info))
+                              (org-element-contents
+                               (if (or greaterp objectp) data
+                                 ;; Elements directly containing
+                                 ;; objects must have their indentation
+                                 ;; normalized first.
+                                 (org-element-normalize-contents
+                                  data
+                                  ;; When normalizing first paragraph
+                                  ;; of an item or
+                                  ;; a footnote-definition, ignore
+                                  ;; first line's indentation.
+                                  (and
+                                   (eq type 'paragraph)
+                                   (memq (org-element-type parent)
+                                         '(footnote-definition item))
+                                   (eq (car (org-element-contents parent))
+                                       data)
+                                   (eq (org-element-property :pre-blank parent)
+                                       0)))))
+                              "")))
                        (broken-link-handler
                         (funcall transcoder data
                                  (if (not greaterp) contents
@@ -2084,8 +2091,8 @@ keywords before output."
 
 ;;;; Hooks
 
-(defvar org-export-before-processing-hook nil
-  "Hook run at the beginning of the export process.
+(defvar org-export-before-processing-functions nil
+  "Abnormal hook run at the beginning of the export process.
 
 This is run before include keywords and macros are expanded and
 Babel code blocks executed, on a copy of the original buffer
@@ -2095,8 +2102,8 @@ is at the beginning of the buffer.
 Every function in this hook will be called with one argument: the
 back-end currently used, as a symbol.")
 
-(defvar org-export-before-parsing-hook nil
-  "Hook run before parsing an export buffer.
+(defvar org-export-before-parsing-functions nil
+  "Abnormal hook run before parsing an export buffer.
 
 This is run after include keywords and macros have been expanded
 and Babel code blocks executed, on a copy of the original buffer
@@ -2538,100 +2545,176 @@ Return the updated communication channel."
 ;; a default template (or a back-end specific template) at point or in
 ;; current subtree.
 
-(defun org-export-copy-buffer ()
+(cl-defun org-export-copy-buffer (&key to-buffer drop-visibility
+                                       drop-narrowing drop-contents
+                                       drop-locals)
   "Return a copy of the current buffer.
 The copy preserves Org buffer-local variables, visibility and
-narrowing."
-  (let ((copy-buffer-fun (org-export--generate-copy-script (current-buffer)))
-       (new-buf (generate-new-buffer (buffer-name))))
+narrowing.
+
+IMPORTANT: The buffer copy may also have `buffer-file-name' copied.
+To prevent Emacs overwriting the original buffer file,
+`write-contents-functions' is set to (always).  Do not alter this
+variable and do not do anything that might alter it (like calling a
+major mode) to prevent data corruption.  Also, do note that Emacs may
+jump into the created buffer if the original file buffer is closed and
+then re-opened.  Making edits in the buffer copy may also trigger
+Emacs save dialog.  Prefer using `org-export-with-buffer-copy' macro
+when possible.
+
+When optional key `:to-buffer' is non-nil, copy into BUFFER.
+
+Optional keys `:drop-visibility', `:drop-narrowing', `:drop-contents',
+and `:drop-locals' are passed to `org-export--generate-copy-script'."
+  (let ((copy-buffer-fun (org-export--generate-copy-script
+                          (current-buffer)
+                          :copy-unreadable 'do-not-check
+                          :drop-visibility drop-visibility
+                          :drop-narrowing drop-narrowing
+                          :drop-contents drop-contents
+                          :drop-locals drop-locals))
+       (new-buf (or to-buffer (generate-new-buffer (buffer-name)))))
     (with-current-buffer new-buf
       (funcall copy-buffer-fun)
       (set-buffer-modified-p nil))
     new-buf))
 
-(defmacro org-export-with-buffer-copy (&rest body)
+(cl-defmacro org-export-with-buffer-copy ( &rest body
+                                           &key to-buffer drop-visibility
+                                           drop-narrowing drop-contents
+                                           drop-locals
+                                           &allow-other-keys)
   "Apply BODY in a copy of the current buffer.
 The copy preserves local variables, visibility and contents of
 the original buffer.  Point is at the beginning of the buffer
-when BODY is applied."
+when BODY is applied.
+
+Optional keys can modify what is being copied and the generated buffer
+copy.  `:to-buffer', `:drop-visibility', `:drop-narrowing',
+`:drop-contents', and `:drop-locals' are passed as arguments to
+`org-export-copy-buffer'."
   (declare (debug t))
   (org-with-gensyms (buf-copy)
-    `(let ((,buf-copy (org-export-copy-buffer)))
+    `(let ((,buf-copy (org-export-copy-buffer
+                       :to-buffer ,to-buffer
+                       :drop-visibility ,drop-visibility
+                       :drop-narrowing ,drop-narrowing
+                       :drop-contents ,drop-contents
+                       :drop-locals ,drop-locals)))
        (unwind-protect
           (with-current-buffer ,buf-copy
             (goto-char (point-min))
-            (progn ,@body))
+             (prog1
+                (progn ,@body)
+               ;; `org-export-copy-buffer' carried the value of
+               ;; `buffer-file-name' from the original buffer.  When not
+               ;; killed, the new buffer copy may become a target of
+               ;; `find-file'.  Prevent this.
+               (setq buffer-file-name nil)))
         (and (buffer-live-p ,buf-copy)
              ;; Kill copy without confirmation.
              (progn (with-current-buffer ,buf-copy
                       (restore-buffer-modified-p nil))
-                    (kill-buffer ,buf-copy)))))))
-
-(defun org-export--generate-copy-script (buffer)
+                     (unless ,to-buffer
+                      (kill-buffer ,buf-copy))))))))
+
+(cl-defun org-export--generate-copy-script (buffer
+                                            &key
+                                            copy-unreadable
+                                            drop-visibility
+                                            drop-narrowing
+                                            drop-contents
+                                            drop-locals)
   "Generate a function duplicating BUFFER.
 
 The copy will preserve local variables, visibility, contents and
 narrowing of the original buffer.  If a region was active in
 BUFFER, contents will be narrowed to that region instead.
 
+When optional key `:copy-unreadable' is non-nil, do not ensure that all
+the copied local variables will be readable in another Emacs session.
+
+When optional keys `:drop-visibility', `:drop-narrowing',
+`:drop-contents', or `:drop-locals' are non-nil, do not preserve
+visibility, narrowing, contents, or local variables correspondingly.
+
 The resulting function can be evaluated at a later time, from
 another buffer, effectively cloning the original buffer there.
 
 The function assumes BUFFER's major mode is `org-mode'."
   (with-current-buffer buffer
-    (let ((str (org-with-wide-buffer (buffer-string)))
+    (let ((str (unless drop-contents (org-with-wide-buffer (buffer-string))))
           (narrowing
-           (if (org-region-active-p)
-              (list (region-beginning) (region-end))
-            (list (point-min) (point-max))))
+           (unless drop-narrowing
+             (if (org-region-active-p)
+                (list (region-beginning) (region-end))
+              (list (point-min) (point-max)))))
          (pos (point))
          (varvals
-          (let ((bound-variables (org-export--list-bound-variables))
-                (varvals nil))
-            (dolist (entry (buffer-local-variables (buffer-base-buffer)))
-              (when (consp entry)
-                (let ((var (car entry))
-                      (val (cdr entry)))
-                  (and (not (memq var org-export-ignored-local-variables))
-                       (or (memq var
-                                 '(default-directory
-                                    buffer-file-name
-                                    buffer-file-coding-system))
-                           (assq var bound-variables)
-                           (string-match "^\\(org-\\|orgtbl-\\)"
-                                         (symbol-name var)))
-                       ;; Skip unreadable values, as they cannot be
-                       ;; sent to external process.
-                       (or (not val) (ignore-errors (read (format "%S" val))))
-                       (push (cons var val) varvals)))))
-             varvals))
+           (unless drop-locals
+            (let ((bound-variables (org-export--list-bound-variables))
+                  (varvals nil))
+              (dolist (entry (buffer-local-variables (buffer-base-buffer)))
+                (when (consp entry)
+                  (let ((var (car entry))
+                        (val (cdr entry)))
+                    (and (not (memq var org-export-ignored-local-variables))
+                         (or (memq var
+                                   '(default-directory
+                                       ;; Required to convert file
+                                       ;; links in the #+INCLUDEd
+                                       ;; files.  See
+                                       ;; `org-export--prepare-file-contents'.
+                                      buffer-file-name
+                                      buffer-file-coding-system
+                                       ;; Needed to preserve folding state
+                                       char-property-alias-alist))
+                             (assq var bound-variables)
+                             (string-match "^\\(org-\\|orgtbl-\\)"
+                                           (symbol-name var)))
+                         ;; Skip unreadable values, as they cannot be
+                         ;; sent to external process.
+                         (or copy-unreadable (not val)
+                              (ignore-errors (read (format "%S" val))))
+                         (push (cons var val) varvals)))))
+               varvals)))
          (ols
-          (let (ov-set)
-            (dolist (ov (overlays-in (point-min) (point-max)))
-              (let ((invis-prop (overlay-get ov 'invisible)))
-                (when invis-prop
-                  (push (list (overlay-start ov) (overlay-end ov)
-                              invis-prop)
-                        ov-set))))
-            ov-set)))
+           (unless drop-visibility
+            (let (ov-set)
+              (dolist (ov (overlays-in (point-min) (point-max)))
+                (let ((invis-prop (overlay-get ov 'invisible)))
+                  (when invis-prop
+                    (push (list (overlay-start ov) (overlay-end ov)
+                                invis-prop)
+                          ov-set))))
+              ov-set))))
       (lambda ()
        (let ((inhibit-modification-hooks t))
-         ;; Set major mode. Ignore `org-mode-hook' as it has been run
-         ;; already in BUFFER.
-         (let ((org-mode-hook nil) (org-inhibit-startup t)) (org-mode))
+         ;; Set major mode. Ignore `org-mode-hook' and other hooks as
+         ;; they have been run already in BUFFER.
+          (unless (eq major-mode 'org-mode)
+            (delay-mode-hooks
+              (let ((org-inhibit-startup t)) (org-mode))))
          ;; Copy specific buffer local variables and variables set
          ;; through BIND keywords.
          (pcase-dolist (`(,var . ,val) varvals)
            (set (make-local-variable var) val))
-         ;; Whole buffer contents.
-         (insert str)
+         ;; Whole buffer contents when requested.
+          (when str (erase-buffer) (insert str))
+          ;; Make org-element-cache not complain about changed buffer
+          ;; state.
+          (org-element-cache-reset nil 'no-persistence)
          ;; Narrowing.
-         (apply #'narrow-to-region narrowing)
+          (when narrowing
+           (apply #'narrow-to-region narrowing))
          ;; Current position of point.
          (goto-char pos)
          ;; Overlays with invisible property.
          (pcase-dolist (`(,start ,end ,invis) ols)
-           (overlay-put (make-overlay start end) 'invisible invis)))))))
+           (overlay-put (make-overlay start end) 'invisible invis))
+          ;; Never write the buffer copy to disk, despite
+          ;; `buffer-file-name' not being nil.
+          (setq write-contents-functions (list (lambda (&rest _) t))))))))
 
 (defun org-export--delete-comment-trees ()
   "Delete commented trees and commented inlinetasks in the buffer.
@@ -2941,141 +3024,147 @@ still inferior to file-local settings.
 Return code as a string."
   (when (symbolp backend) (setq backend (org-export-get-backend backend)))
   (org-export-barf-if-invalid-backend backend)
-  (save-excursion
-    (save-restriction
-      ;; Narrow buffer to an appropriate region or subtree for
-      ;; parsing.  If parsing subtree, be sure to remove main
-      ;; headline, planning data and property drawer.
-      (cond ((org-region-active-p)
-            (narrow-to-region (region-beginning) (region-end)))
-           (subtreep
-            (org-narrow-to-subtree)
-            (goto-char (point-min))
-            (org-end-of-meta-data)
-            (narrow-to-region (point) (point-max))))
-      ;; Initialize communication channel with original buffer
-      ;; attributes, unavailable in its copy.
-      (let* ((org-export-current-backend (org-export-backend-name backend))
-            (info (org-combine-plists
-                   (org-export--get-export-attributes
-                    backend subtreep visible-only body-only)
-                   (org-export--get-buffer-attributes)))
-            (parsed-keywords
-             (delq nil
-                   (mapcar (lambda (o) (and (eq (nth 4 o) 'parse) (nth 1 o)))
-                           (append (org-export-get-all-options backend)
-                                   org-export-options-alist))))
-            tree modified-tick)
-       ;; Update communication channel and get parse tree.  Buffer
-       ;; isn't parsed directly.  Instead, all buffer modifications
-       ;; and consequent parsing are undertaken in a temporary copy.
-       (org-export-with-buffer-copy
-         (font-lock-mode -1)
-        ;; Run first hook with current back-end's name as argument.
-        (run-hook-with-args 'org-export-before-processing-hook
-                            (org-export-backend-name backend))
-        (org-export-expand-include-keyword)
-        (org-export--delete-comment-trees)
-        (org-macro-initialize-templates org-export-global-macros)
-        (org-macro-replace-all org-macro-templates parsed-keywords)
-        ;; Refresh buffer properties and radio targets after previous
-        ;; potentially invasive changes.
-        (org-set-regexps-and-options)
-        (org-update-radio-target-regexp)
-         (setq modified-tick (buffer-chars-modified-tick))
-        ;;  Possibly execute Babel code.  Re-run a macro expansion
-        ;;  specifically for {{{results}}} since inline source blocks
-        ;;  may have generated some more.  Refresh buffer properties
-        ;;  and radio targets another time.
-        (when org-export-use-babel
-          (org-babel-exp-process-buffer)
-          (org-macro-replace-all '(("results" . "$1")) parsed-keywords)
+  (org-fold-core-ignore-modifications
+    (save-excursion
+      (save-restriction
+        ;; Narrow buffer to an appropriate region or subtree for
+        ;; parsing.  If parsing subtree, be sure to remove main
+        ;; headline, planning data and property drawer.
+        (cond ((org-region-active-p)
+              (narrow-to-region (region-beginning) (region-end)))
+             (subtreep
+              (org-narrow-to-subtree)
+              (goto-char (point-min))
+              (org-end-of-meta-data)
+               ;; Make the region include top heading in the subtree.
+               ;; This way, we will be able to retrieve its export
+               ;; options when calling
+               ;; `org-export--get-subtree-options'.
+               (backward-char)
+              (narrow-to-region (point) (point-max))))
+        ;; Initialize communication channel with original buffer
+        ;; attributes, unavailable in its copy.
+        (let* ((org-export-current-backend (org-export-backend-name backend))
+              (info (org-combine-plists
+                     (org-export--get-export-attributes
+                      backend subtreep visible-only body-only)
+                     (org-export--get-buffer-attributes)))
+              (parsed-keywords
+               (delq nil
+                     (mapcar (lambda (o) (and (eq (nth 4 o) 'parse) (nth 1 o)))
+                             (append (org-export-get-all-options backend)
+                                     org-export-options-alist))))
+              tree modified-tick)
+         ;; Update communication channel and get parse tree.  Buffer
+         ;; isn't parsed directly.  Instead, all buffer modifications
+         ;; and consequent parsing are undertaken in a temporary copy.
+         (org-export-with-buffer-copy
+           (font-lock-mode -1)
+          ;; Run first hook with current back-end's name as argument.
+          (run-hook-with-args 'org-export-before-processing-hook
+                              (org-export-backend-name backend))
+          (org-export-expand-include-keyword)
+          (org-export--delete-comment-trees)
+          (org-macro-initialize-templates org-export-global-macros)
+          (org-macro-replace-all org-macro-templates parsed-keywords)
+          ;; Refresh buffer properties and radio targets after previous
+          ;; potentially invasive changes.
+          (org-set-regexps-and-options)
+          (org-update-radio-target-regexp)
+           (setq modified-tick (buffer-chars-modified-tick))
+          ;;  Possibly execute Babel code.  Re-run a macro expansion
+          ;;  specifically for {{{results}}} since inline source blocks
+          ;;  may have generated some more.  Refresh buffer properties
+          ;;  and radio targets another time.
+          (when org-export-use-babel
+            (org-babel-exp-process-buffer)
+            (org-macro-replace-all '(("results" . "$1")) parsed-keywords)
+             (unless (eq modified-tick (buffer-chars-modified-tick))
+              (org-set-regexps-and-options)
+              (org-update-radio-target-regexp))
+             (setq modified-tick (buffer-chars-modified-tick)))
+          ;; Run last hook with current back-end's name as argument.
+          ;; Update buffer properties and radio targets one last time
+          ;; before parsing.
+          (goto-char (point-min))
+          (save-excursion
+            (run-hook-with-args 'org-export-before-parsing-hook
+                                (org-export-backend-name backend)))
            (unless (eq modified-tick (buffer-chars-modified-tick))
             (org-set-regexps-and-options)
             (org-update-radio-target-regexp))
-           (setq modified-tick (buffer-chars-modified-tick)))
-        ;; Run last hook with current back-end's name as argument.
-        ;; Update buffer properties and radio targets one last time
-        ;; before parsing.
-        (goto-char (point-min))
-        (save-excursion
-          (run-hook-with-args 'org-export-before-parsing-hook
-                              (org-export-backend-name backend)))
-         (unless (eq modified-tick (buffer-chars-modified-tick))
-          (org-set-regexps-and-options)
-          (org-update-radio-target-regexp))
-         (setq modified-tick (buffer-chars-modified-tick))
-        ;; Update communication channel with environment.
-        (setq info
-              (org-combine-plists
-               info (org-export-get-environment backend subtreep ext-plist)))
-         ;; Pre-process citations environment, i.e. install
-        ;; bibliography list, and citation processor in INFO.
-        (org-cite-store-bibliography info)
-         (org-cite-store-export-processor info)
-        ;; De-activate uninterpreted data from parsed keywords.
-        (dolist (entry (append (org-export-get-all-options backend)
-                               org-export-options-alist))
-          (pcase entry
-            (`(,p ,_ ,_ ,_ parse)
-             (let ((value (plist-get info p)))
-               (plist-put info
-                          p
-                          (org-export--remove-uninterpreted-data value info))))
-            (_ nil)))
-        ;; Install user's and developer's filters.
-        (setq info (org-export-install-filters info))
-        ;; Call options filters and update export options.  We do not
-        ;; use `org-export-filter-apply-functions' here since the
-        ;; arity of such filters is different.
-        (let ((backend-name (org-export-backend-name backend)))
-          (dolist (filter (plist-get info :filter-options))
-            (let ((result (funcall filter info backend-name)))
-              (when result (setq info result)))))
-        ;; Parse buffer.
-        (setq tree (org-element-parse-buffer nil visible-only))
-        ;; Prune tree from non-exported elements and transform
-        ;; uninterpreted elements or objects in both parse tree and
-        ;; communication channel.
-        (org-export--prune-tree tree info)
-        (org-export--remove-uninterpreted-data tree info)
-        ;; Call parse tree filters.
-        (setq tree
-              (org-export-filter-apply-functions
-               (plist-get info :filter-parse-tree) tree info))
-        ;; Now tree is complete, compute its properties and add them
-        ;; to communication channel.
-        (setq info (org-export--collect-tree-properties tree info))
-         ;; Process citations and bibliography.  Replace each citation
-        ;; and "print_bibliography" keyword in the parse tree with
-        ;; the output of the selected citation export processor.
-         (org-cite-process-citations info)
-         (org-cite-process-bibliography info)
-        ;; Eventually transcode TREE.  Wrap the resulting string into
-        ;; a template.
-        (let* ((body (org-element-normalize-string
-                      (or (org-export-data tree info) "")))
-               (inner-template (cdr (assq 'inner-template
-                                          (plist-get info :translate-alist))))
-               (full-body (org-export-filter-apply-functions
-                           (plist-get info :filter-body)
-                           (if (not (functionp inner-template)) body
-                             (funcall inner-template body info))
-                           info))
-               (template (cdr (assq 'template
-                                    (plist-get info :translate-alist))))
-                (output
-                 (if (or (not (functionp template)) body-only) full-body
-                  (funcall template full-body info))))
-           ;; Call citation export finalizer.
-           (setq output (org-cite-finalize-export output info))
-          ;; Remove all text properties since they cannot be
-          ;; retrieved from an external process.  Finally call
-          ;; final-output filter and return result.
-          (org-no-properties
-           (org-export-filter-apply-functions
-            (plist-get info :filter-final-output)
-            output info))))))))
+           (setq modified-tick (buffer-chars-modified-tick))
+          ;; Update communication channel with environment.
+          (setq info
+                (org-combine-plists
+                 info (org-export-get-environment backend subtreep ext-plist)))
+           ;; Pre-process citations environment, i.e. install
+          ;; bibliography list, and citation processor in INFO.
+          (org-cite-store-bibliography info)
+           (org-cite-store-export-processor info)
+          ;; De-activate uninterpreted data from parsed keywords.
+          (dolist (entry (append (org-export-get-all-options backend)
+                                 org-export-options-alist))
+            (pcase entry
+              (`(,p ,_ ,_ ,_ parse)
+               (let ((value (plist-get info p)))
+                 (plist-put info
+                            p
+                            (org-export--remove-uninterpreted-data value 
info))))
+              (_ nil)))
+          ;; Install user's and developer's filters.
+          (setq info (org-export-install-filters info))
+          ;; Call options filters and update export options.  We do not
+          ;; use `org-export-filter-apply-functions' here since the
+          ;; arity of such filters is different.
+          (let ((backend-name (org-export-backend-name backend)))
+            (dolist (filter (plist-get info :filter-options))
+              (let ((result (funcall filter info backend-name)))
+                (when result (setq info result)))))
+          ;; Parse buffer.
+          (setq tree (org-element-parse-buffer nil visible-only))
+          ;; Prune tree from non-exported elements and transform
+          ;; uninterpreted elements or objects in both parse tree and
+          ;; communication channel.
+          (org-export--prune-tree tree info)
+          (org-export--remove-uninterpreted-data tree info)
+          ;; Call parse tree filters.
+          (setq tree
+                (org-export-filter-apply-functions
+                 (plist-get info :filter-parse-tree) tree info))
+          ;; Now tree is complete, compute its properties and add them
+          ;; to communication channel.
+          (setq info (org-export--collect-tree-properties tree info))
+           ;; Process citations and bibliography.  Replace each citation
+          ;; and "print_bibliography" keyword in the parse tree with
+          ;; the output of the selected citation export processor.
+           (org-cite-process-citations info)
+           (org-cite-process-bibliography info)
+          ;; Eventually transcode TREE.  Wrap the resulting string into
+          ;; a template.
+          (let* ((body (org-element-normalize-string
+                        (or (org-export-data tree info) "")))
+                 (inner-template (cdr (assq 'inner-template
+                                            (plist-get info 
:translate-alist))))
+                 (full-body (org-export-filter-apply-functions
+                             (plist-get info :filter-body)
+                             (if (not (functionp inner-template)) body
+                               (funcall inner-template body info))
+                             info))
+                 (template (cdr (assq 'template
+                                      (plist-get info :translate-alist))))
+                  (output
+                   (if (or (not (functionp template)) body-only) full-body
+                    (funcall template full-body info))))
+             ;; Call citation export finalizer.
+             (setq output (org-cite-finalize-export output info))
+            ;; Remove all text properties since they cannot be
+            ;; retrieved from an external process.  Finally call
+            ;; final-output filter and return result.
+            (org-no-properties
+             (org-export-filter-apply-functions
+              (plist-get info :filter-final-output)
+              output info)))))))))
 
 ;;;###autoload
 (defun org-export-string-as (string backend &optional body-only ext-plist)
@@ -3226,7 +3315,7 @@ storing and resolving footnotes.  It is created 
automatically."
            (beginning-of-line)
            ;; Extract arguments from keyword's value.
            (let* ((value (org-element-property :value element))
-                  (ind (current-indentation))
+                  (ind (org-current-text-indentation))
                   location
                   (coding-system-for-read
                    (or (and (string-match ":coding +\\(\\S-+\\)>" value)
@@ -3238,15 +3327,18 @@ storing and resolving footnotes.  It is created 
automatically."
                                       value)
                         (prog1
                             (save-match-data
-                              (let ((matched (match-string 1 value)))
+                              (let ((matched (match-string 1 value))
+                                     stripped)
                                 (when (string-match "\\(::\\(.*?\\)\\)\"?\\'"
                                                     matched)
                                   (setq location (match-string 2 matched))
                                   (setq matched
                                         (replace-match "" nil nil matched 1)))
-                                (expand-file-name (org-strip-quotes matched)
-                                                  dir)))
-                          (setq value (replace-match "" nil nil value)))))
+                                 (setq stripped (org-strip-quotes matched))
+                                 (if (org-url-p stripped)
+                                     stripped
+                                   (expand-file-name stripped dir))))
+                           (setq value (replace-match "" nil nil value)))))
                   (only-contents
                    (and (string-match ":only-contents *\\([^: \r\t\n]\\S-*\\)?"
                                       value)
@@ -3282,7 +3374,7 @@ storing and resolving footnotes.  It is created 
automatically."
              (delete-region (point) (line-beginning-position 2))
              (cond
               ((not file) nil)
-              ((not (file-readable-p file))
+              ((and (not (org-url-p file)) (not (file-readable-p file)))
                (error "Cannot include file %s" file))
               ;; Check if files has already been parsed.  Look after
               ;; inclusion lines too, as different parts of the same
@@ -3328,8 +3420,9 @@ storing and resolving footnotes.  It is created 
automatically."
                         includer-file)))
                     (org-export-expand-include-keyword
                      (cons (list file lines) included)
-                     (file-name-directory file)
-                     footnotes)
+                      (unless (org-url-p file)
+                        (file-name-directory file))
+                      footnotes)
                     (buffer-string)))))
                ;; Expand footnotes after all files have been
                ;; included.  Footnotes are stored at end of buffer.
@@ -3352,7 +3445,7 @@ Org-Element.  If LINES is non-nil only those lines are 
included.
 Return a string of lines to be included in the format expected by
 `org-export--prepare-file-contents'."
   (with-temp-buffer
-    (insert-file-contents file)
+    (insert (org-file-contents file))
     (unless (eq major-mode 'org-mode)
       (let ((org-inhibit-startup t)) (org-mode)))
     (condition-case err
@@ -3457,7 +3550,7 @@ the included document.
 Optional argument INCLUDER is the file name where the inclusion
 is to happen."
   (with-temp-buffer
-    (insert-file-contents file)
+    (insert (org-file-contents file))
     (when lines
       (let* ((lines (split-string lines "-"))
             (lbeg (string-to-number (car lines)))
@@ -4109,7 +4202,7 @@ meant to be translated with `org-export-data' or alike."
          ((and fmt
                (not (cdr date))
                (eq (org-element-type (car date)) 'timestamp))
-          (org-timestamp-format (car date) fmt))
+          (org-format-timestamp (car date) fmt))
          (t date))))
 
 
@@ -4146,7 +4239,7 @@ meant to be translated with `org-export-data' or alike."
 ;; `org-export-data' for further processing, depending on
 ;; `org-export-with-broken-links' value.
 
-(org-define-error 'org-link-broken "Unable to resolve link; aborting")
+(define-error 'org-link-broken "Unable to resolve link; aborting")
 
 (defun org-export-custom-protocol-maybe (link desc backend &optional info)
   "Try exporting LINK object with a dedicated function.
@@ -4294,7 +4387,7 @@ A search cell follows the pattern (TYPE . SEARCH) where
     - target's or radio-target's name as a list of strings if
       TYPE is `target'.
 
-    - NAME affiliated keyword if TYPE is `other'.
+    - NAME or RESULTS affiliated keyword if TYPE is `other'.
 
 A search cell is the internal representation of a fuzzy link.  It
 ignores white spaces and statistics cookies, if applicable."
@@ -4312,7 +4405,8 @@ ignores white spaces and statistics cookies, if 
applicable."
                (and custom-id (cons 'custom-id custom-id)))))))
     (`target
      (list (cons 'target (split-string (org-element-property :value datum)))))
-    ((and (let name (org-element-property :name datum))
+    ((and (let name (or (org-element-property :name datum)
+                        (car (org-element-property :results datum))))
          (guard name))
      (list (cons 'other (split-string name))))
     (_ nil)))
@@ -4344,8 +4438,9 @@ Return value can be an object or an element:
 
 - If LINK path matches a target object (i.e. <<path>>) return it.
 
-- If LINK path exactly matches the name affiliated keyword
-  (i.e. #+NAME: path) of an element, return that element.
+- If LINK path exactly matches the name or results affiliated keyword
+  (i.e. #+NAME: path or #+RESULTS: name) of an element, return that
+  element.
 
 - If LINK path exactly matches any headline name, return that
   element.
@@ -4437,11 +4532,11 @@ INFO is a plist used as a communication channel.
 
 Return value can be a radio-target object or nil.  Assume LINK
 has type \"radio\"."
-  (let ((path (string-clean-whitespace (org-element-property :path link))))
+  (let ((path (org-string-clean-whitespace (org-element-property :path link))))
     (org-element-map (plist-get info :parse-tree) 'radio-target
       (lambda (radio)
-       (and (string-equal-ignore-case
-             (string-clean-whitespace (org-element-property :value radio))
+       (and (org-string-equal-ignore-case
+             (org-string-clean-whitespace (org-element-property :value radio))
               path)
             radio))
       info 'first-match)))
@@ -4481,6 +4576,55 @@ Return value can be an object or an element:
           (concat (if (string-prefix-p "/" fullname) "file://" "file:///")
                   fullname)))))
 
+(defun org-export-link-remote-p (link)
+  "Returns non-nil if the link refers to a remote resource."
+  (or (member (org-element-property :type link) '("http" "https" "ftp"))
+      (and (string= (org-element-property :type link) "file")
+           (file-remote-p (org-element-property :path link)))))
+
+(defun org-export-link--remote-local-copy (link)
+  "Download the remote resource specified by LINK, and return its local path."
+  ;; TODO work this into ol.el as a link parameter, say :download.
+  (let* ((location-type
+          (pcase (org-element-property :type link)
+            ((or "http" "https" "ftp") 'url)
+            ((and "file" (guard (file-remote-p
+                                 (org-element-property :path link))))
+             'file)
+            (_ (error "Cannot copy %s:%s to a local file"
+                      (org-element-property :type link)
+                      (org-element-property :path link)))))
+         (path
+          (pcase location-type
+            ('url
+             (concat (org-element-property :type link)
+                     ":" (org-element-property :path link)))
+            ('file
+             (org-element-property :path link)))))
+    (or (org-persist-read location-type path)
+        (org-persist-register location-type path
+                              :write-immediately t))))
+
+(require 'subr-x) ;; FIXME: For `thread-first' in Emacs 26.
+(defun org-export-link-localise (link)
+  "Convert remote LINK to local link.
+If LINK refers to a remote resource, modify it to point to a local
+downloaded copy.  Otherwise, return unchanged LINK."
+  (when (org-export-link-remote-p link)
+    (let* ((local-path (org-export-link--remote-local-copy link)))
+      (if local-path
+          (setcdr link
+                  (thread-first (cadr link)
+                                (plist-put :type "file")
+                                (plist-put :path local-path)
+                                (plist-put :raw-link (concat "file:" 
local-path))
+                                list))
+        (display-warning
+         '(org export)
+         (format "unable to obtain local copy of %s"
+                 (org-element-property :raw-link link))))))
+  link)
+
 ;;;; For References
 ;;
 ;; `org-export-get-reference' associate a unique reference for any
@@ -4614,12 +4758,28 @@ objects of the same type."
      (let ((counter 0))
        ;; Increment counter until ELEMENT is found again.
        (org-element-map (plist-get info :parse-tree)
-          (or types (org-element-type element))
+          (or (and types (cons (org-element-type element) types))
+               (org-element-type element))
         (lambda (el)
-          (cond
-           ((eq element el) (1+ counter))
-           ((not predicate) (cl-incf counter) nil)
-           ((funcall predicate el info) (cl-incf counter) nil)))
+           (let ((cached (org-element-property :org-export--counter el)))
+            (cond
+             ((eq element el) (1+ counter))
+              ;; Use cached result.
+              ((and cached
+                    (equal predicate (car cached))
+                    (equal types (cadr cached)))
+               (setq counter (nth 2 cached))
+               nil)
+             ((not predicate)
+               (cl-incf counter)
+               (org-element-put-property
+                el :org-export--counter (list predicate types counter))
+               nil)
+             ((funcall predicate el info)
+               (cl-incf counter)
+               (org-element-put-property
+                el :org-export--counter (list predicate types counter))
+               nil))))
         info 'first-match)))))
 
 ;;;; For Raw objects
@@ -5505,6 +5665,18 @@ transcoding it."
      (secondary-opening :utf-8 "“" :html "&ldquo;" :latex "``" :texinfo "``")
      (secondary-closing :utf-8 "”" :html "&rdquo;" :latex "''" :texinfo "''")
      (apostrophe :utf-8 "’" :html "&rsquo;"))
+    ("fa"
+     (primary-opening
+      :utf-8 "«" :html "&laquo;" :latex "\\guillemotleft{}"
+      :texinfo "@guillemetleft{}")
+     (primary-closing
+      :utf-8 "»" :html "&raquo;" :latex "\\guillemotright{}"
+      :texinfo "@guillemetright{}")
+     (secondary-opening :utf-8 "‹" :html "&lsaquo;" :latex "\\guilsinglleft{}"
+                       :texinfo "@guilsinglleft{}")
+     (secondary-closing :utf-8 "›" :html "&rsaquo;" :latex "\\guilsinglright{}"
+                       :texinfo "@guilsinglright{}")
+     (apostrophe :utf-8 "’" :html "&rsquo;"))
     ("fr"
      (primary-opening
       :utf-8 "« " :html "&laquo;&nbsp;" :latex "\\og "
@@ -5826,6 +5998,7 @@ them."
      ("eo" :html "A&#365;toro")
      ("es" :default "Autor")
      ("et" :default "Autor")
+     ("fa" :default "نویسنده")
      ("fi" :html "Tekij&auml;")
      ("fr" :default "Auteur")
      ("hu" :default "Szerz&otilde;")
@@ -5851,6 +6024,7 @@ them."
      ("cs" :default "Pokračování z předchozí strany")
      ("de" :default "Fortsetzung von vorheriger Seite")
      ("es" :html "Contin&uacute;a de la p&aacute;gina anterior" :ascii 
"Continua de la pagina anterior" :default "Continúa de la página anterior")
+     ("fa" :default "ادامه از صفحهٔ قبل")
      ("fr" :default "Suite de la page précédente")
      ("it" :default "Continua da pagina precedente")
      ("ja" :default "前ページからの続き")
@@ -5868,6 +6042,7 @@ them."
      ("cs" :default "Pokračuje na další stránce")
      ("de" :default "Fortsetzung nächste Seite")
      ("es" :html "Contin&uacute;a en la siguiente p&aacute;gina" :ascii 
"Continua en la siguiente pagina" :default "Continúa en la siguiente página")
+     ("fa" :default "ادامه در صفحهٔ بعد")
      ("fr" :default "Suite page suivante")
      ("it" :default "Continua alla pagina successiva")
      ("ja" :default "次ページに続く")
@@ -5882,6 +6057,7 @@ them."
      ("tr" :default "Devamı sonraki sayfada"))
     ("Created"
      ("cs" :default "Vytvořeno")
+     ("fa" :default "ساخته شده")
      ("nl" :default "Gemaakt op")  ;; must be followed by a date or date+time
      ("pt_BR" :default "Criado em")
      ("ro" :default "Creat")
@@ -5896,6 +6072,7 @@ them."
      ("eo" :default "Dato")
      ("es" :default "Fecha")
      ("et" :html "Kuup&#228;ev" :utf-8 "Kuupäev")
+     ("fa" :default "تاریخ")
      ("fi" :html "P&auml;iv&auml;m&auml;&auml;r&auml;")
      ("hu" :html "D&aacute;tum")
      ("is" :default "Dagsetning")
@@ -5922,6 +6099,7 @@ them."
      ("de" :default "Gleichung")
      ("es" :ascii "Ecuacion" :html "Ecuaci&oacute;n" :default "Ecuación")
      ("et" :html "V&#245;rrand" :utf-8 "Võrrand")
+     ("fa" :default "معادله")
      ("fr" :ascii "Equation" :default "Équation")
      ("is" :default "Jafna")
      ("ja" :default "方程式")
@@ -5944,6 +6122,7 @@ them."
      ("de" :default "Abbildung")
      ("es" :default "Figura")
      ("et" :default "Joonis")
+     ("fa" :default "شکل")
      ("is" :default "Mynd")
      ("it" :default "Figura")
      ("ja" :default "図" :html "&#22259;")
@@ -5964,6 +6143,7 @@ them."
      ("de" :default "Abbildung %d:")
      ("es" :default "Figura %d:")
      ("et" :default "Joonis %d:")
+     ("fa" :default "شکل %d:")
      ("fr" :default "Figure %d :" :html "Figure&nbsp;%d&nbsp;:")
      ("is" :default "Mynd %d")
      ("it" :default "Figura %d:")
@@ -5988,6 +6168,7 @@ them."
      ("eo" :default "Piednotoj")
      ("es" :ascii "Notas al pie de pagina" :html "Notas al pie de 
p&aacute;gina" :default "Notas al pie de página")
      ("et" :html "Allm&#228;rkused" :utf-8 "Allmärkused")
+     ("fa" :default "پانوشت‌ها")
      ("fi" :default "Alaviitteet")
      ("fr" :default "Notes de bas de page")
      ("hu" :html "L&aacute;bjegyzet")
@@ -6016,6 +6197,7 @@ them."
      ("de" :default "Programmauflistungsverzeichnis")
      ("es" :ascii "Indice de Listados de programas" :html "&Iacute;ndice de 
Listados de programas" :default "Índice de Listados de programas")
      ("et" :default "Loendite nimekiri")
+     ("fa" :default "فهرست برنامه‌ریزی‌ها")
      ("fr" :default "Liste des programmes")
      ("ja" :default "ソースコード目次")
      ("nl" :default "Lijst van programma's")
@@ -6034,6 +6216,7 @@ them."
      ("de" :default "Tabellenverzeichnis")
      ("es" :ascii "Indice de tablas" :html "&Iacute;ndice de tablas" :default 
"Índice de tablas")
      ("et" :default "Tabelite nimekiri")
+     ("fa" :default "فهرست جدول‌ها")
      ("fr" :default "Liste des tableaux")
      ("is" :default "Töfluskrá" :html "T&ouml;fluskr&aacute;")
      ("it" :default "Indice delle tabelle")
@@ -6057,6 +6240,7 @@ them."
      ("de" :default "Programmlisting")
      ("es" :default "Listado de programa")
      ("et" :default "Loend")
+     ("fa" :default "برنامه‌ریزی")
      ("fr" :default "Programme" :html "Programme")
      ("it" :default "Listato")
      ("ja" :default "ソースコード")
@@ -6077,6 +6261,7 @@ them."
      ("de" :default "Programmlisting %d")
      ("es" :default "Listado de programa %d")
      ("et" :default "Loend %d")
+     ("fa" :default "برنامه‌ریزی %d:")
      ("fr" :default "Programme %d :" :html "Programme&nbsp;%d&nbsp;:")
      ("it" :default "Listato %d :")
      ("ja" :default "ソースコード%d:")
@@ -6095,6 +6280,7 @@ them."
      ("cs" :default "Reference")
      ("de" :default "Quellen")
      ("es" :default "Referencias")
+     ("fa" :default "منابع")
      ("fr" :ascii "References" :default "Références")
      ("it" :default "Riferimenti")
      ("nl" :default "Bronverwijzingen")
@@ -6104,6 +6290,7 @@ them."
      ("tr" :default "Referanslar"))
     ("See figure %s"
      ("cs" :default "Viz obrázek %s")
+     ("fa" :default "نمایش شکل %s")
      ("fr" :default "cf. figure %s"
       :html "cf.&nbsp;figure&nbsp;%s" :latex "cf.~figure~%s")
      ("it" :default "Vedi figura %s")
@@ -6115,6 +6302,7 @@ them."
      ("tr" :default "bkz. şekil %s"))
     ("See listing %s"
      ("cs" :default "Viz program %s")
+     ("fa" :default "نمایش برنامه‌ریزی %s")
      ("fr" :default "cf. programme %s"
       :html "cf.&nbsp;programme&nbsp;%s" :latex "cf.~programme~%s")
      ("nl" :default "Zie programma %s"
@@ -6130,6 +6318,7 @@ them."
      ("de" :default "siehe Abschnitt %s")
      ("es" :ascii "Vea seccion %s" :html "Vea secci&oacute;n %s" :default "Vea 
sección %s")
      ("et" :html "Vaata peat&#252;kki %s" :utf-8 "Vaata peatükki %s")
+     ("fa" :default "نمایش بخش %s")
      ("fr" :default "cf. section %s")
      ("it" :default "Vedi sezione %s")
      ("ja" :default "セクション %s を参照")
@@ -6145,6 +6334,7 @@ them."
      ("zh-CN" :html "&#21442;&#35265;&#31532;%s&#33410;" :utf-8 "参见第%s节"))
     ("See table %s"
      ("cs" :default "Viz tabulka %s")
+     ("fa" :default "نمایش جدول %s")
      ("fr" :default "cf. tableau %s"
       :html "cf.&nbsp;tableau&nbsp;%s" :latex "cf.~tableau~%s")
      ("it" :default "Vedi tabella %s")
@@ -6160,6 +6350,7 @@ them."
      ("de" :default "Tabelle")
      ("es" :default "Tabla")
      ("et" :default "Tabel")
+     ("fa" :default "جدول")
      ("fr" :default "Tableau")
      ("is" :default "Tafla")
      ("it" :default "Tabella")
@@ -6178,6 +6369,7 @@ them."
      ("de" :default "Tabelle %d")
      ("es" :default "Tabla %d")
      ("et" :default "Tabel %d")
+     ("fa" :default "جدول %d")
      ("fr" :default "Tableau %d :")
      ("is" :default "Tafla %d")
      ("it" :default "Tabella %d:")
@@ -6203,6 +6395,7 @@ them."
      ("eo" :default "Enhavo")
      ("es" :ascii "Indice" :html "&Iacute;ndice" :default "Índice")
      ("et" :default "Sisukord")
+     ("fa" :default "فهرست")
      ("fi" :html "Sis&auml;llysluettelo")
      ("fr" :ascii "Sommaire" :default "Table des matières")
      ("hu" :html "Tartalomjegyz&eacute;k")
@@ -6230,6 +6423,7 @@ them."
      ("de" :default "Unbekannter Verweis")
      ("es" :default "Referencia desconocida")
      ("et" :default "Tundmatu viide")
+     ("fa" :default "منبع ناشناس")
      ("fr" :ascii "Destination inconnue" :default "Référence inconnue")
      ("it" :default "Riferimento sconosciuto")
      ("ja" :default "不明な参照先")
@@ -6489,8 +6683,7 @@ or FILE."
   (declare (indent 2))
   (if (not (file-writable-p file)) (error "Output file not writable")
     (let ((ext-plist (org-combine-plists `(:output-file ,file) ext-plist))
-         (encoding (or org-export-coding-system buffer-file-coding-system))
-          auto-mode-alist)
+         (encoding (or org-export-coding-system buffer-file-coding-system)))
       (if async
           (org-export-async-start
              (lambda (file)
@@ -6502,14 +6695,14 @@ or FILE."
               (with-temp-buffer
                 (insert output)
                 (let ((coding-system-for-write ',encoding))
-                  (write-file ,file)))
+                  (write-region (point-min) (point-max) ,file)))
               (or (ignore-errors (funcall ',post-process ,file)) ,file)))
         (let ((output (org-export-as
                        backend subtreep visible-only body-only ext-plist)))
           (with-temp-buffer
             (insert output)
             (let ((coding-system-for-write encoding))
-             (write-file file)))
+             (write-region (point-min) (point-max) file)))
           (when (and (org-export--copy-to-kill-ring-p) (org-string-nw-p 
output))
             (org-kill-new output))
           ;; Get proper return value.
@@ -6965,8 +7158,20 @@ back to standard interface."
        (delete-other-windows)
        (org-switch-to-buffer-other-window
         (get-buffer-create "*Org Export Dispatcher*"))
-       (setq cursor-type nil
-             header-line-format "Use SPC, DEL, C-n or C-p to navigate.")
+        (setq cursor-type nil)
+        (setq header-line-format
+              (let ((propertize-help-key
+                     (lambda (key)
+                       ;; Add `face' *and* `font-lock-face' to "work
+                       ;; reliably in any buffer", per a comment in
+                       ;; `help--key-description-fontified'.
+                       (propertize key
+                                   'font-lock-face 'help-key-binding
+                                   'face 'help-key-binding))))
+                (apply 'format
+                       (cons "Use %s, %s, %s, or %s to navigate."
+                             (mapcar propertize-help-key
+                                     (list "SPC" "DEL" "C-n" "C-p"))))))
        ;; Make sure that invisible cursor will not highlight square
        ;; brackets.
        (set-syntax-table (copy-syntax-table))
diff --git a/lisp/outline.el b/lisp/outline.el
index 86ac19aa41..53bfc4d556 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -318,6 +318,12 @@ don't modify the buffer."
 (defvar-local outline--use-rtl nil
   "Non-nil when direction of clickable buttons is right-to-left.")
 
+(defvar-local outline--margin-width nil
+  "Current margin width.")
+
+(defvar-local outline-margin-width nil
+  "Default margin width.")
+
 (define-icon outline-open nil
   '((image "outline-open.svg" "outline-open.pbm" :height (0.8 . em))
     (emoji "🔽")
@@ -344,24 +350,24 @@ don't modify the buffer."
   "Right-to-left icon used for buttons in closed outline sections."
   :version "29.1")
 
-(define-icon outline-open-in-margins outline-open
-  '((image "outline-open.svg" "outline-open.pbm" :height 10)
+(define-icon outline-open-in-margins nil
+  '((image "outline-open.svg" "outline-open.pbm" :width font)
     (emoji "🔽")
     (symbol "▼")
     (text "v"))
   "Icon used for buttons for opened sections in margins."
   :version "29.1")
 
-(define-icon outline-close-in-margins outline-close
-  '((image "outline-open.svg" "outline-open.pbm" :height 10 :rotation -90)
+(define-icon outline-close-in-margins nil
+  '((image "outline-open.svg" "outline-open.pbm" :width font :rotation -90)
     (emoji "▶️")
     (symbol "▶")
     (text ">"))
   "Icon used for buttons for closed sections in margins."
   :version "29.1")
 
-(define-icon outline-close-rtl-in-margins outline-close-rtl
-  '((image "outline-open.svg" "outline-open.pbm" :height 10 :rotation 90)
+(define-icon outline-close-rtl-in-margins nil
+  '((image "outline-open.svg" "outline-open.pbm" :width font :rotation 90)
     (emoji "◀️")
     (symbol "◀")
     (text "<"))
@@ -528,9 +534,22 @@ See the command `outline-mode' for more information on 
this mode."
           (when (and (eq outline-minor-mode-use-buttons 'in-margins)
                      (> 1 (if outline--use-rtl right-margin-width
                             left-margin-width)))
+            (setq outline--margin-width
+                  (or outline-margin-width
+                      (ceiling
+                       (/ (seq-max
+                           (seq-map #'string-pixel-width
+                                    (seq-map #'icon-string
+                                             `(outline-open-in-margins
+                                               ,(if outline--use-rtl
+                                                    
'outline-close-rtl-in-margins
+                                                  
'outline-close-in-margins)))))
+                          (* (default-font-width) 1.0)))))
             (if outline--use-rtl
-                (setq-local right-margin-width (1+ right-margin-width))
-              (setq-local left-margin-width (1+ left-margin-width)))
+                (setq-local right-margin-width (+ right-margin-width
+                                                  outline--margin-width))
+              (setq-local left-margin-width (+ left-margin-width
+                                               outline--margin-width)))
             (setq-local fringes-outside-margins t)
             ;; Force display of margins
             (when (eq (current-buffer) (window-buffer))
@@ -566,8 +585,10 @@ See the command `outline-mode' for more information on 
this mode."
                  (< 0 (if outline--use-rtl right-margin-width
                         left-margin-width)))
         (if outline--use-rtl
-            (setq-local right-margin-width (1- right-margin-width))
-          (setq-local left-margin-width (1- left-margin-width)))
+            (setq-local right-margin-width (- right-margin-width
+                                              outline--margin-width))
+          (setq-local left-margin-width (- left-margin-width
+                                           outline--margin-width)))
         (setq-local fringes-outside-margins nil)
         ;; Force removal of margins
         (when (eq (current-buffer) (window-buffer))
@@ -1796,7 +1817,7 @@ With a prefix argument, show headings up to that LEVEL."
         (unless o
           (when (eq outline-minor-mode-use-buttons 'insert)
             (let ((inhibit-read-only t))
-              (insert "  ")
+              (insert (apply #'propertize "  " (text-properties-at (point))))
               (beginning-of-line)))
           (setq o (make-overlay (point) (1+ (point))))
           (overlay-put o 'outline-button t)
diff --git a/lisp/paren.el b/lisp/paren.el
index e2c060ceb9..eeda95809a 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -120,7 +120,7 @@ On non-graphical frames, the context is shown in the echo 
area."
 
 (defcustom show-paren-predicate '(not (derived-mode . special-mode))
   "Whether to use `show-paren-mode' in a buffer.
-The default is to enable the mode in all buffers that have don't
+The default is to enable the mode in all buffers that don't
 derive from `special-mode', which means that it's on (by default)
 in all editing buffers."
   :type 'buffer-predicate
@@ -410,6 +410,10 @@ It is the default value of `show-paren-data-function'."
                 (line-end-position))))
     (setq show-paren--context-overlay (make-overlay beg end)))
   (overlay-put show-paren--context-overlay 'display text)
+  ;; Use the (default very high) `show-paren-priority' ensuring that
+  ;; not other overlays shine through (bug#59527).
+  (overlay-put show-paren--context-overlay 'priority
+               show-paren-priority)
   (overlay-put show-paren--context-overlay
                'face `(:box
                        ( :line-width (1 . -1)
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index ef286b70fe..4e3a88bbda 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -193,7 +193,7 @@ and how is entirely up to the behavior of the
   "If non-nil, allow effects in `pcomplete-parse-arguments-function'.
 For the `pcomplete' command, it was common for functions in
 `pcomplete-parse-arguments-function' to make modifications to the
-buffer, like expanding variables are such.
+buffer, like expanding variables and such.
 For `completion-at-point-functions', this is not an option any more, so
 this variable is used to tell `pcomplete-parse-arguments-function'
 whether it can do the modifications like it used to, or whether
@@ -1456,7 +1456,7 @@ COMMAND and ARGS as arguments."
                            (pcomplete-match-string 1 0)))
           ((string-prefix-p "-" (pcomplete-arg 0))
            (pcomplete-here (apply #'pcomplete-from-help command args)))
-          (t (pcomplete-here (pcomplete-entries))))))
+          (t (pcomplete-here* (pcomplete-entries))))))
 
 (provide 'pcomplete)
 
diff --git a/lisp/play/zone.el b/lisp/play/zone.el
index a470f23dfe..6e27ba5165 100644
--- a/lisp/play/zone.el
+++ b/lisp/play/zone.el
@@ -320,7 +320,7 @@ run a specific program.  The program must be a member of
   (zone-pgm-jitter))
 
 
-;;;; putzing w/ case
+;;;; putzing with case
 
 ;; Faster than `zone-pgm-putz-with-case', but not as good: all
 ;; instances of the same letter have the same case, which produces a
diff --git a/lisp/proced.el b/lisp/proced.el
index ac44ae1513..c09ee18a8b 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -114,41 +114,58 @@ the external command (usually \"kill\")."
 (defcustom proced-grammar-alist
   '( ;; attributes defined in `process-attributes'
     (euid    "EUID"    "%d" right proced-< nil (euid pid) (nil t nil))
-    (user    "User"    nil left proced-string-lessp nil (user pid) (nil t nil))
+    (user    "User"    proced-format-user left proced-string-lessp nil
+                       (user pid) (nil t nil))
     (egid    "EGID"    "%d" right proced-< nil (egid euid pid) (nil t nil))
-    (group   "Group"   nil left proced-string-lessp nil (group user pid) (nil 
t nil))
+    (group   "Group"   nil left proced-string-lessp nil (group user pid)
+                       (nil t nil))
     (comm    "Command" nil left proced-string-lessp nil (comm pid) (nil t nil))
-    (state   "Stat"    nil left proced-string-lessp nil (state pid) (nil t 
nil))
-    (ppid    "PPID"    "%d" right proced-< nil (ppid pid)
-             ((lambda (ppid) (proced-filter-parents proced-process-alist ppid))
-              "refine to process parents"))
-    (pgrp    "PGrp"    "%d" right proced-< nil (pgrp euid pid) (nil t nil))
-    (sess    "Sess"    "%d" right proced-< nil (sess pid) (nil t nil))
-    (ttname  "TTY"     proced-format-ttname left proced-string-lessp nil 
(ttname pid) (nil t nil))
+    (state   "Stat"    proced-format-state left proced-string-lessp nil
+                       (state pid) (nil t nil))
+    (ppid    "PPID"    proced-format-ppid right proced-< nil (ppid pid)
+                       ((lambda (ppid)
+                          (proced-filter-parents proced-process-alist ppid))
+                        "refine to process parents"))
+    (pgrp    "PGrp"    proced-format-pgrp right proced-< nil (pgrp euid pid)
+                       (nil t nil))
+    (sess    "Sess"    proced-format-sess right proced-< nil (sess pid)
+                       (nil t nil))
+    (ttname  "TTY"     proced-format-ttname left proced-string-lessp nil
+                       (ttname pid) (nil t nil))
     (tpgid   "TPGID"   "%d" right proced-< nil (tpgid pid) (nil t nil))
     (minflt  "MinFlt"  "%d" right proced-< nil (minflt pid) (nil t t))
     (majflt  "MajFlt"  "%d" right proced-< nil (majflt pid) (nil t t))
     (cminflt "CMinFlt" "%d" right proced-< nil (cminflt pid) (nil t t))
     (cmajflt "CMajFlt" "%d" right proced-< nil (cmajflt pid) (nil t t))
-    (utime   "UTime"   proced-format-time right proced-time-lessp t (utime 
pid) (nil t t))
-    (stime   "STime"   proced-format-time right proced-time-lessp t (stime 
pid) (nil t t))
-    (time    "Time"   proced-format-time right proced-time-lessp t (time pid) 
(nil t t))
-    (cutime  "CUTime"  proced-format-time right proced-time-lessp t (cutime 
pid) (nil t t))
-    (cstime  "CSTime"  proced-format-time right proced-time-lessp t (cstime 
pid) (nil t t))
-    (ctime   "CTime"  proced-format-time right proced-time-lessp t (ctime pid) 
(nil t t))
+    (utime   "UTime"   proced-format-time right proced-time-lessp t (utime pid)
+                       (nil t t))
+    (stime   "STime"   proced-format-time right proced-time-lessp t (stime pid)
+                       (nil t t))
+    (time    "Time"    proced-format-time right proced-time-lessp t (time pid)
+                       (nil t t))
+    (cutime  "CUTime"  proced-format-time right proced-time-lessp t (cutime 
pid)
+                       (nil t t))
+    (cstime  "CSTime"  proced-format-time right proced-time-lessp t (cstime 
pid)
+                       (nil t t))
+    (ctime   "CTime"   proced-format-time right proced-time-lessp t (ctime pid)
+                       (nil t t))
     (pri     "Pr"      "%d" right proced-< t (pri pid) (nil t t))
     (nice    "Ni"      "%3d" 3 proced-< t (nice pid) (t t nil))
     (thcount "THCount" "%d" right proced-< t (thcount pid) (nil t t))
-    (start   "Start"   proced-format-start 6 proced-time-lessp nil (start pid) 
(t t nil))
-    (vsize   "VSize"   proced-format-memory right proced-< t (vsize pid) (nil 
t t))
-    (rss     "RSS"     proced-format-memory right proced-< t (rss pid) (nil t 
t))
-    (etime   "ETime"   proced-format-time right proced-time-lessp t (etime 
pid) (nil t t))
-    (pcpu    "%CPU"    "%.1f" right proced-< t (pcpu pid) (nil t t))
-    (pmem    "%Mem"    "%.1f" right proced-< t (pmem pid) (nil t t))
-    (args    "Args"    proced-format-args left proced-string-lessp nil (args 
pid) (nil t nil))
+    (start   "Start"   proced-format-start 6 proced-time-lessp nil (start pid)
+                       (t t nil))
+    (vsize   "VSize"   proced-format-memory right proced-< t (vsize pid)
+                       (nil t t))
+    (rss     "RSS"     proced-format-rss right proced-< t (rss pid) (nil t t))
+    (etime   "ETime"   proced-format-time right proced-time-lessp t (etime pid)
+                       (nil t t))
+    (pcpu    "%CPU"    proced-format-cpu right proced-< t (pcpu pid) (nil t t))
+    (pmem    "%Mem"    proced-format-mem right proced-< t (pmem pid) (nil t t))
+    (args    "Args"    proced-format-args left proced-string-lessp nil
+                       (args pid) (nil t nil))
     ;;
     ;; attributes defined by proced (see `proced-process-attributes')
-    (pid     "PID"     "%d" right proced-< nil (pid)
+    (pid     "PID"     proced-format-pid right proced-< nil (pid)
              ((lambda (ppid) (proced-filter-children proced-process-alist 
ppid))
               "refine to process children"))
     ;; process tree
@@ -367,6 +384,32 @@ May be used to revert the process listing."
   :type 'hook
   :options '(proced-revert))
 
+(defcustom proced-enable-color-flag nil
+  "Non-nil means Proced should display some process attributes with color."
+  :type 'boolean
+  :version "29.1")
+
+(defcustom proced-low-memory-usage-threshold 0.1
+  "The upper bound for low relative memory usage display in Proced.
+
+When `proced-enable-color-flag' is non-nil, RSS values denoting a
+proportion of memory, relative to total memory, that is lower
+than this value will be displayed using the `proced-memory-low-usage' face."
+  :type 'float
+  :version "29.1")
+
+(defcustom proced-medium-memory-usage-threshold 0.5
+  "The upper bound for medium relative memory usage display in Proced.
+
+When `proced-enable-color-flag' is non-nil, RSS values denoting a
+proportion of memory, relative to total memory, that is less than
+this value, but greater than `proced-low-memory-usage-threshold',
+will be displayed using the `proced-memory-medium-usage' face.
+RSS values denoting a greater proportion than this value will be
+displayed using the `proced-memory-high-usage' face."
+  :type 'float
+  :version "29.1")
+
 ;; Internal variables
 
 (defvar proced-available t;(not (null (list-system-processes)))
@@ -403,6 +446,114 @@ It is a list of lists (KEY PREDICATE REVERSE).")
   '((t (:inherit font-lock-keyword-face)))
   "Face used for header of attribute used for sorting.")
 
+(defface proced-run-status-code
+  '((t (:foreground "green")))
+  "Face used in Proced buffers for running or runnable status code character 
\"R\"."
+  :version "29.1")
+
+(defface proced-interruptible-sleep-status-code
+  '((((class color) (min-colors 88)) (:foreground "DimGrey"))
+    (t (:italic t)))
+  "Face used in Proced buffers for interruptible sleep status code character 
\"S\"."
+  :version "29.1")
+
+(defface proced-uninterruptible-sleep-status-code
+  '((((class color)) (:foreground "red"))
+    (t (:bold t)))
+  "Face used in Proced buffers for uninterruptible sleep status code character 
\"D\"."
+  :version "29.1")
+
+(defface proced-executable
+  '((((class color) (min-colors 88) (background dark)) (:foreground 
"DeepSkyBlue"))
+    (((class color) (background dark)) (:foreground "cyan"))
+    (((class color) (background light)) (:foreground "blue"))
+    (t (:bold t)))
+  "Face used in Proced buffers for executable names.
+The first word in the process arguments attribute is assumed to
+be the executable that runs in the process."
+  :version "29.1")
+
+(defface proced-memory-high-usage
+  '((((class color) (min-colors 88) (background dark)) (:foreground "orange"))
+    (((class color) (min-colors 88) (background light)) (:foreground 
"OrangeRed"))
+    (((class color)) (:foreground "red"))
+    (t (:underline t)))
+  "Face used in Proced buffers for high memory usage."
+  :version "29.1")
+
+(defface proced-memory-medium-usage
+  '((((class color) (min-colors 88) (background dark)) (:foreground "yellow3"))
+    (((class color) (min-colors 88) (background light)) (:foreground "orange"))
+    (((class color)) (:foreground "yellow")))
+  "Face used in Proced buffers for medium memory usage."
+  :version "29.1")
+
+(defface proced-memory-low-usage
+  '((((class color) (min-colors 88) (background dark)) (:foreground "#8bcd50"))
+    (((class color)) (:foreground "green")))
+  "Face used in Proced buffers for low memory usage."
+  :version "29.1")
+
+(defface proced-emacs-pid
+  '((((class color) (min-colors 88)) (:foreground "purple"))
+    (((class color)) (:foreground "magenta")))
+  "Face used in Proced buffers for the process ID of the current Emacs 
process."
+  :version "29.1")
+
+(defface proced-pid
+  '((((class color) (min-colors 88)) (:foreground "#5085ef"))
+    (((class color)) (:foreground "blue")))
+  "Face used in Proced buffers for process IDs."
+  :version "29.1")
+
+(defface proced-session-leader-pid
+  '((((class color) (min-colors 88)) (:foreground "#5085ef" :underline t))
+    (((class color)) (:foreground "blue" :underline t))
+    (t (:underline t)))
+  "Face used in Proced buffers for process IDs which are session leaders."
+  :version "29.1")
+
+(defface proced-ppid
+  '((((class color) (min-colors 88)) (:foreground "#5085bf"))
+    (((class color)) (:foreground "blue")))
+  "Face used in Proced buffers for parent process IDs."
+  :version "29.1")
+
+(defface proced-pgrp
+  '((((class color) (min-colors 88)) (:foreground "#4785bf"))
+    (((class color)) (:foreground "blue")))
+  "Face used in Proced buffers for process group IDs."
+  :version "29.1")
+
+(defface proced-sess
+  '((((class color) (min-colors 88)) (:foreground "#41729f"))
+    (((class color)) (:foreground "MidnightBlue")))
+  "Face used in Proced buffers for process session IDs."
+  :version "29.1")
+
+(defface proced-cpu
+  '((((class color) (min-colors 88)) (:foreground "#6d5cc3" :bold t))
+    (t (:bold t)))
+  "Face used in Proced buffers for process CPU utilization."
+  :version "29.1")
+
+(defface proced-mem
+  '((((class color) (min-colors 88))
+     (:foreground "#6d5cc3")))
+  "Face used in Proced buffers for process memory utilization."
+  :version "29.1")
+
+(defface proced-user
+  '((t (:bold t)))
+  "Face used in Proced buffers for the user owning the process."
+  :version "29.1")
+
+(defface proced-time-colon
+  '((((class color) (min-colors 88)) (:foreground "DarkMagenta"))
+    (t (:bold t)))
+  "Face used in Proced buffers for the colon in time strings."
+  :version "29.1")
+
 (defvar proced-re-mark "^[^ \n]"
   "Regexp matching a marked line.
 Important: the match ends just after the marker.")
@@ -505,6 +656,14 @@ Important: the match ends just after the marker.")
   )
 (put 'proced-mark :advertised-binding "m")
 
+(defvar-local proced-refinements nil
+  "Information about the current buffer refinements.
+
+It should be a list of elements of the form (REFINER PID KEY GRAMMAR), where
+REFINER and GRAMMAR are as described in `proced-grammar-alist', PID is the
+process ID of the process used to create the refinement, and KEY the attribute
+of the process.  A value of nil indicates that there are no active 
refinements.")
+
 (easy-menu-define proced-menu proced-mode-map
   "Proced Menu."
   `("Proced"
@@ -1186,20 +1345,7 @@ a certain refinement, consider defining a new filter in 
`proced-filter-alist'."
         (let* ((grammar (assq key proced-grammar-alist))
                (refiner (nth 7 grammar)))
           (when refiner
-            (cond ((functionp (car refiner))
-                   (setq proced-process-alist (funcall (car refiner) pid)))
-                  ((consp refiner)
-                   (let ((predicate (nth 4 grammar))
-                         (ref (cdr (assq key (cdr (assq pid 
proced-process-alist)))))
-                         val new-alist)
-                     (dolist (process proced-process-alist)
-                       (setq val (funcall predicate (cdr (assq key (cdr 
process))) ref))
-                       (if (cond ((not val) (nth 2 refiner))
-                                 ((eq val 'equal) (nth 1 refiner))
-                                 (val (car refiner)))
-                           (push process new-alist)))
-                     (setq proced-process-alist new-alist))))
-            ;; Do not revert listing.
+            (add-to-list 'proced-refinements (list refiner pid key grammar) t)
             (proced-update)))
       (message "No refiner defined here."))))
 
@@ -1392,26 +1538,32 @@ Prefix ARG controls sort order, see 
`proced-sort-interactive'."
          (hours (truncate ftime 3600))
          (ftime (mod ftime 3600))
          (minutes (truncate ftime 60))
-         (seconds (mod ftime 60)))
+         (seconds (mod ftime 60))
+         (colon (if proced-enable-color-flag
+                    (propertize ":" 'font-lock-face 'proced-time-colon)
+                  ":")))
     (cond ((< 0 days)
-           (format "%d-%02d:%02d:%02d" days hours minutes seconds))
+           (format "%d-%02d%s%02d%s%02d" days hours colon minutes colon 
seconds))
           ((< 0 hours)
-           (format "%02d:%02d:%02d" hours minutes seconds))
+           (format "%02d%s%02d%s%02d" hours colon minutes colon seconds))
           (t
-           (format "%02d:%02d" minutes seconds)))))
+           (format "%02d%s%02d" minutes colon seconds)))))
 
 (defun proced-format-start (start)
   "Format time START.
 The return string is always 6 characters wide."
   (let ((d-start (decode-time start))
-        (d-current (decode-time)))
+        (d-current (decode-time))
+        (colon (if proced-enable-color-flag
+                   (propertize ":" 'font-lock-face 'proced-time-colon)
+                 ":")))
     (cond (;; process started in previous years
            (< (decoded-time-year d-start) (decoded-time-year d-current))
            (format-time-string "  %Y" start))
           ;; process started today
           ((and (= (decoded-time-day d-start) (decoded-time-day d-current))
                 (= (decoded-time-month d-start) (decoded-time-month 
d-current)))
-           (format-time-string " %H:%M" start))
+           (string-replace ":" colon (format-time-string " %H:%M" start)))
           (t ;; process started this year
            (format-time-string "%b %e" start)))))
 
@@ -1429,12 +1581,97 @@ The return string is always 6 characters wide."
 (defun proced-format-args (args)
   "Format attribute ARGS.
 Replace newline characters by \"^J\" (two characters)."
-  (string-replace "\n" "^J" args))
+  (string-replace "\n" "^J"
+                  (pcase-let* ((`(,exe . ,rest) (split-string args))
+                               (exe-prop (if proced-enable-color-flag
+                                             (propertize exe 'font-lock-face 
'proced-executable)
+                                           exe)))
+                    (mapconcat #'identity (cons exe-prop rest) " "))))
 
 (defun proced-format-memory (kilobytes)
   "Format KILOBYTES in a human readable format."
   (funcall byte-count-to-string-function (* 1024 kilobytes)))
 
+(defun proced-format-rss (kilobytes)
+  "Format RSS KILOBYTES in a human readable format."
+  (let ((formatted (proced-format-memory kilobytes)))
+    (if-let* ((proced-enable-color-flag)
+              (total (car (memory-info)))
+              (proportion (/ (float kilobytes) total)))
+        (cond ((< proportion proced-low-memory-usage-threshold)
+               (propertize formatted 'font-lock-face 'proced-memory-low-usage))
+              ((< proportion proced-medium-memory-usage-threshold)
+               (propertize formatted 'font-lock-face 
'proced-memory-medium-usage))
+              (t (propertize formatted 'font-lock-face 
'proced-memory-high-usage)))
+      formatted)))
+
+(defun proced-format-state (state)
+  "Format STATE."
+  (cond ((and proced-enable-color-flag (string= state "R"))
+         (propertize state 'font-lock-face 'proced-run-status-code))
+        ((and proced-enable-color-flag (string= state "S"))
+         (propertize state 'font-lock-face 
'proced-interruptible-sleep-status-code))
+        ((and proced-enable-color-flag (string= state "D"))
+         (propertize state 'font-lock-face 
'proced-uninterruptible-sleep-status-code))
+        (t state)))
+
+(defun proced-format-pid (pid)
+  "Format PID."
+  (let ((proc-info (process-attributes pid))
+        (pid-s (number-to-string pid)))
+    (cond ((and proced-enable-color-flag
+                (not (file-remote-p default-directory))
+                (equal pid (emacs-pid)))
+           (propertize pid-s 'font-lock-face 'proced-emacs-pid))
+          ((and proced-enable-color-flag (equal pid (alist-get 'sess 
proc-info)))
+           (propertize pid-s 'font-lock-face 'proced-session-leader-pid))
+          (proced-enable-color-flag
+           (propertize pid-s 'font-lock-face 'proced-pid))
+          (t pid-s))))
+
+(defun proced-format-ppid (ppid)
+  "Format PPID."
+  (let ((ppid-s (number-to-string ppid)))
+    (cond ((and proced-enable-color-flag
+                (not (file-remote-p default-directory))
+                (= ppid (emacs-pid)))
+           (propertize ppid-s 'font-lock-face 'proced-emacs-pid))
+          (proced-enable-color-flag
+           (propertize ppid-s 'font-lock-face 'proced-ppid))
+          (t ppid-s))))
+
+(defun proced-format-pgrp (pgrp)
+  "Format PGRP."
+  (if proced-enable-color-flag
+      (propertize (number-to-string pgrp) 'font-lock-face 'proced-pgrp)
+    (number-to-string pgrp)))
+
+(defun proced-format-sess (sess)
+  "Format SESS."
+  (if proced-enable-color-flag
+      (propertize (number-to-string sess) 'font-lock-face 'proced-sess)
+    (number-to-string sess)))
+
+(defun proced-format-cpu (cpu)
+  "Format CPU."
+  (let ((formatted (format "%.1f" cpu)))
+    (if proced-enable-color-flag
+        (propertize formatted 'font-lock-face 'proced-cpu)
+      formatted)))
+
+(defun proced-format-mem (mem)
+  "Format MEM."
+  (let ((formatted (format "%.1f" mem)))
+    (if proced-enable-color-flag
+        (propertize formatted 'font-lock-face 'proced-mem)
+      formatted)))
+
+(defun proced-format-user (user)
+  "Format USER."
+  (if proced-enable-color-flag
+      (propertize user 'font-lock-face 'proced-user)
+    user))
+
 (defun proced-format (process-alist format)
   "Display PROCESS-ALIST using FORMAT."
   (if (symbolp format)
@@ -1617,10 +1854,29 @@ After updating a displayed Proced buffer run the normal 
hook
                        "Updating process display...")))
   (if revert ;; evaluate all processes
       (setq proced-process-alist (proced-process-attributes)))
-  ;; filtering and sorting
+  ;; filtering
+  (setq proced-process-alist (proced-filter proced-process-alist 
proced-filter))
+  ;; refinements
+  (pcase-dolist (`(,refiner ,pid ,key ,grammar) proced-refinements)
+    ;; It's possible the process has exited since the refinement was made
+    (when (assq pid proced-process-alist)
+      (cond ((functionp (car refiner))
+             (setq proced-process-alist (funcall (car refiner) pid)))
+            ((consp refiner)
+             (let ((predicate (nth 4 grammar))
+                   (ref (cdr (assq key (cdr (assq pid proced-process-alist)))))
+                   val new-alist)
+               (dolist (process proced-process-alist)
+                 (setq val (funcall predicate (cdr (assq key (cdr process))) 
ref))
+                 (when (cond ((not val) (nth 2 refiner))
+                             ((eq val 'equal) (nth 1 refiner))
+                             (val (car refiner)))
+                   (push process new-alist)))
+               (setq proced-process-alist new-alist))))))
+
+  ;; sorting
   (setq proced-process-alist
-        (proced-sort (proced-filter proced-process-alist proced-filter)
-                     proced-sort proced-descend))
+        (proced-sort proced-process-alist proced-sort proced-descend))
 
   ;; display as process tree?
   (setq proced-process-alist
@@ -1734,7 +1990,9 @@ After updating a displayed Proced buffer run the normal 
hook
 
 (defun proced-revert (&rest _args)
   "Reevaluate the process listing based on the currently running processes.
-Preserves point and marks."
+Preserves point and marks, but not refinements (see `proced-refine' for
+information on refinements)."
+  (setq proced-refinements nil)
   (proced-update t))
 
 (defun proced-marked-processes ()
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el
index b722790334..efee400681 100644
--- a/lisp/progmodes/antlr-mode.el
+++ b/lisp/progmodes/antlr-mode.el
@@ -1777,7 +1777,7 @@ For AREA and OLD, see `antlr-insert-option-do'."
        (skip-chars-forward " \t")
 
        (if (looking-at "$\\|//")
-           ;; just comment after point => skip (+ lines w/ same col comment)
+            ;; just comment after point => skip (+ lines with same col comment)
            (let ((same (if (> (match-end 0) (match-beginning 0))
                            (current-column))))
              (beginning-of-line 2)
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el
index aaf063b517..2a63c10002 100644
--- a/lisp/progmodes/asm-mode.el
+++ b/lisp/progmodes/asm-mode.el
@@ -209,7 +209,7 @@ repeatedly until you are satisfied with the kind of 
comment."
     (indent-according-to-mode)
     (insert asm-comment-char asm-comment-char ?\ ))
 
-   ;; Nonblank line w/o comment => start a comment at comment-column.
+   ;; Nonblank line without comment => start a comment at comment-column.
    ;; Also: point before the comment => jump inside.
    ((or (null comment) (< (point) comment))
     (indent-for-comment))
diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el
index 6bac297a29..5e833047af 100644
--- a/lisp/progmodes/bat-mode.el
+++ b/lisp/progmodes/bat-mode.el
@@ -44,7 +44,7 @@
 ;; Separate package `dos-indent' (Matthew Fidler) provides rudimentary
 ;; indentation, see https://www.emacswiki.org/emacs/dos-indent.el.
 ;;
-;; Acknowledgements:
+;; Acknowledgments:
 ;;
 ;; Inspired by `batch-mode' (Agnar Renolen) and `cmd-mode' (Tadamegu Furukawa).
 
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 3555eb23d1..cf941236f8 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -9,19 +9,18 @@
 
 ;; 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.
 
-;; 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 <http://www.gnu.org/licenses/>.
-
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 ;;
@@ -29,7 +28,7 @@
 ;;; Code:
 
 (require 'treesit)
-(require 'rx)
+(eval-when-compile (require 'rx))
 
 (declare-function treesit-parser-create "treesit.c")
 (declare-function treesit-induce-sparse-tree "treesit.c")
@@ -79,9 +78,19 @@ follows the form of `treesit-simple-indent-rules'."
     (modify-syntax-entry ?\240 "."   table)
     (modify-syntax-entry ?/  ". 124b" table)
     (modify-syntax-entry ?*  ". 23"   table)
+    (modify-syntax-entry ?\n "> b"  table)
+    (modify-syntax-entry ?\^m "> b" table)
     table)
   "Syntax table for `c-ts-mode'.")
 
+(defvar c++-ts-mode--syntax-table
+  (let ((table (make-syntax-table c-ts-mode--syntax-table)))
+    ;; Template delimiters.
+    (modify-syntax-entry ?<  "("     table)
+    (modify-syntax-entry ?>  ")"     table)
+    table)
+  "Syntax table for `c++-ts-mode'.")
+
 (defun c-ts-mode--indent-styles (mode)
   "Indent rules supported by `c-ts-mode'.
 MODE is either `c' or `cpp'."
@@ -94,7 +103,6 @@ MODE is either `c' or `cpp'."
            ((node-is "case") parent-bol 0)
            ((node-is "preproc_arg") no-indent)
            ((and (parent-is "comment") comment-end) comment-start -1)
-           ((parent-is "comment") comment-start-skip 0)
            ((node-is "labeled_statement") parent-bol 0)
            ((parent-is "labeled_statement") parent-bol c-ts-mode-indent-offset)
            ((match "preproc_ifdef" "compound_statement") point-min 0)
@@ -119,6 +127,8 @@ MODE is either `c' or `cpp'."
            ((query "(call_expression arguments: (_) @indent)") parent 
c-ts-mode-indent-offset)
            ((parent-is "call_expression") parent 0)
            ((parent-is "enumerator_list") parent-bol c-ts-mode-indent-offset)
+           ,@(when (eq mode 'cpp)
+               '(((node-is "access_specifier") parent-bol 0)))
            ((parent-is "field_declaration_list") parent-bol 
c-ts-mode-indent-offset)
            ((parent-is "initializer_list") parent-bol c-ts-mode-indent-offset)
            ((parent-is "if_statement") parent-bol c-ts-mode-indent-offset)
@@ -168,10 +178,10 @@ MODE is either `c' or `cpp'."
   (let ((c-keywords
          '("break" "case" "const" "continue"
            "default" "do" "else" "enum"
-           "extern" "for" "goto" "if"
-           "long" "register" "return" "short"
-           "signed" "sizeof" "static" "struct"
-           "switch" "typedef" "union" "unsigned"
+           "extern" "for" "goto" "if" "inline"
+           "register" "return"
+           "sizeof" "static" "struct"
+           "switch" "typedef" "union"
            "volatile" "while")))
     (if (eq mode 'cpp)
         (append c-keywords
@@ -179,7 +189,7 @@ MODE is either `c' or `cpp'."
                   "catch" "class" "co_await" "co_return"
                   "co_yield" "compl" "concept" "consteval"
                   "constexpr" "constinit" "decltype" "delete"
-                  "explicit" "final" "friend" "friend"
+                  "explicit" "final" "friend"
                   "mutable" "namespace" "new" "noexcept"
                   "not" "not_eq" "operator" "or"
                   "or_eq" "override" "private" "protected"
@@ -188,6 +198,10 @@ MODE is either `c' or `cpp'."
                   "xor" "xor_eq"))
       (append '("auto") c-keywords))))
 
+(defvar c-ts-mode--type-keywords
+  '("long" "short" "signed" "unsigned")
+  "Keywords that should be considered as part of a type.")
+
 (defvar c-ts-mode--operators
   '("=" "-" "*" "/" "+" "%" "~" "|" "&" "^" "<<" ">>" "->"
     "." "<" "<=" ">=" ">" "==" "!=" "!" "&&" "||" "-="
@@ -229,13 +243,14 @@ MODE is either `c' or `cpp'."
      (false) @font-lock-constant-face
      (null) @font-lock-constant-face
      ,@(when (eq mode 'cpp)
-         '((this) @font-lock-constant-face)))
+         '((nullptr) @font-lock-constant-face)))
 
    :language mode
    :feature 'keyword
    `([,@(c-ts-mode--keywords mode)] @font-lock-keyword-face
      ,@(when (eq mode 'cpp)
-         '((auto) @font-lock-keyword-face)))
+         '((auto) @font-lock-keyword-face
+           (this) @font-lock-keyword-face)))
 
    :language mode
    :feature 'operator
@@ -245,7 +260,9 @@ MODE is either `c' or `cpp'."
    :language mode
    :feature 'string
    `((string_literal) @font-lock-string-face
-     (system_lib_string) @font-lock-string-face)
+     (system_lib_string) @font-lock-string-face
+     ,@(when (eq mode 'cpp)
+         '((raw_string_literal) @font-lock-string-face)))
 
    :language mode
    :feature 'literal
@@ -263,7 +280,8 @@ MODE is either `c' or `cpp'."
            (qualified_identifier
             scope: (namespace_identifier) @font-lock-type-face)
 
-           (operator_cast) type: (type_identifier) @font-lock-type-face)))
+           (operator_cast) type: (type_identifier) @font-lock-type-face))
+     [,@c-ts-mode--type-keywords] @font-lock-type-face)
 
    :language mode
    :feature 'definition
@@ -314,7 +332,7 @@ MODE is either `c' or `cpp'."
 
    :language mode
    :feature 'error
-   '((ERROR) @font-lock-warning-face)
+   '((ERROR) @c-ts-mode--fontify-error)
 
    :feature 'escape-sequence
    :language mode
@@ -360,25 +378,22 @@ For NODE, OVERRIDE, START, END, and ARGS, see
             override start end args))
     ((or "identifier" "field_identifier")
      (treesit-fontify-with-override
-      (max (treesit-node-start node) start)
-      (min (treesit-node-end node) end)
+      (treesit-node-start node) (treesit-node-end node)
       (pcase (treesit-node-type (treesit-node-parent node))
         ("function_declarator" 'font-lock-function-name-face)
         (_ 'font-lock-variable-name-face))
-      override))))
+      override start end))))
 
 (defun c-ts-mode--fontify-variable (node override start end &rest _)
-  "Fontify an identifier node.
-Fontify it if NODE is not a function identifier.  For NODE,
+  "Fontify an identifier node if it is a variable.
+Don't fontify if it is a function identifier.  For NODE,
 OVERRIDE, START, END, and ARGS, see `treesit-font-lock-rules'."
   (when (not (equal (treesit-node-type
                      (treesit-node-parent node))
                     "call_expression"))
     (treesit-fontify-with-override
-     (max (treesit-node-start node) start)
-     (min (treesit-node-end node) end)
-     'font-lock-variable-name-face
-     override)))
+     (treesit-node-start node) (treesit-node-end node)
+     'font-lock-variable-name-face override start end)))
 
 (defun c-ts-mode--fontify-defun (node override start end &rest _)
   "Correctly fontify the DEFUN macro.
@@ -405,21 +420,38 @@ This function corrects the fontification on the colon in
       (when (equal (treesit-node-text node t) ":")
         (treesit-fontify-with-override
          (treesit-node-start node) (treesit-node-end node)
-         'default override)))
+         'default override start end)))
     ;; Fix the parameter list.
     (while arg-list-2
       (let ((type (and arg-list-2 (pop arg-list-2)))
             (arg (and arg-list-2 (pop arg-list-2))))
         (when type
           (treesit-fontify-with-override
-           (max start (treesit-node-start type))
-           (min end (treesit-node-end type))
-           'font-lock-type-face override))
+           (treesit-node-start type) (treesit-node-end type)
+           'font-lock-type-face override start end))
         (when arg
           (treesit-fontify-with-override
-           (max start (treesit-node-start arg))
-           (min end (treesit-node-end arg))
-           'default override))))))
+           (treesit-node-start arg) (treesit-node-end arg)
+           'default override start end))))))
+
+(defun c-ts-mode--fontify-error (node override start end &rest _)
+  "Fontify the error nodes.
+For NODE, OVERRIDE, START, and END, see
+`treesit-font-lock-rules'."
+  (let ((parent (treesit-node-parent node))
+        (child (treesit-node-child node 0)))
+    (treesit-fontify-with-override
+     (treesit-node-start node) (treesit-node-end node)
+     (cond
+      ;; This matches the case MACRO(struct a, b, c)
+      ;; where struct is seen as error.
+      ((and (equal (treesit-node-type child) "identifier")
+            (equal (treesit-node-type parent) "argument_list")
+            (member (treesit-node-text child)
+                    '("struct" "long" "short" "enum" "union")))
+       'font-lock-keyword-face)
+      (t 'font-lock-warning-face))
+     override start end)))
 
 (defun c-ts-mode--imenu-1 (node)
   "Helper for `c-ts-mode--imenu'.
@@ -485,15 +517,80 @@ the subtrees."
      (when var-index `(("Variable" . ,var-index)))
      (when func-index `(("Function" . ,func-index))))))
 
+(defun c-ts-mode--end-of-defun ()
+  "`end-of-defun-function' of `c-ts-mode'."
+  ;; A struct/enum/union_specifier node doesn't include the ; at the
+  ;; end, so we manually skip it.
+  (treesit-end-of-defun)
+  (when (looking-at (rx (* " ") ";"))
+    (goto-char (match-end 0))
+    ;; This part is copied from `end-of-defun'.
+    (unless (bolp)
+      (skip-chars-forward " \t")
+      (if (looking-at "\\s<\\|\n")
+         (forward-line 1)))))
+
+(defun c-ts-mode--defun-valid-p (node)
+  (if (string-match-p
+       (rx (or "struct_specifier"
+               "enum_specifier"
+               "union_specifier"))
+       (treesit-node-type node))
+      (null
+       (treesit-node-top-level
+        node (rx (or "function_definition"
+                     "type_definition"))))
+    t))
+
+(defun c-ts-mode--defun-skipper ()
+  "Custom defun skipper for `c-ts-mode' and friends.
+Structs in C ends with a semicolon, but the semicolon is not
+considered part of the struct node, so point would stop before
+the semicolon.  This function skips the semicolon."
+  (when (looking-at (rx (* (or " " "\t")) ";"))
+    (goto-char (match-end 0)))
+  (treesit-default-defun-skipper))
+
+(defun c-ts-mode-indent-defun ()
+  "Indent the current top-level declaration syntactically.
+
+`treesit-defun-type-regexp' defines what constructs to indent."
+  (interactive "*")
+  (let ((orig-point (point-marker)))
+    ;; If `treesit-beginning-of-defun' returns nil, we are not in a
+    ;; defun, so don't indent anything.
+    (when (treesit-beginning-of-defun)
+      (let ((start (point)))
+        (treesit-end-of-defun)
+        (indent-region start (point))))
+    (goto-char orig-point)))
+
+(defvar-keymap c-ts-mode-map
+  :doc "Keymap for the C language with tree-sitter"
+  :parent prog-mode-map
+  "C-c C-q" #'c-ts-mode-indent-defun)
+
 ;;;###autoload
-(define-derived-mode c-ts-mode--base-mode prog-mode "C"
-  "Major mode for editing C, powered by tree-sitter."
+(define-derived-mode c-ts-base-mode prog-mode "C"
+  "Major mode for editing C, powered by tree-sitter.
+
+\\{c-ts-mode-map}"
   :syntax-table c-ts-mode--syntax-table
 
   ;; Navigation.
   (setq-local treesit-defun-type-regexp
-              (rx (or "specifier"
-                      "definition")))
+              (cons (regexp-opt '("function_definition"
+                                  "type_definition"
+                                  "struct_specifier"
+                                  "enum_specifier"
+                                  "union_specifier"
+                                  "class_specifier"))
+                    #'c-ts-mode--defun-valid-p))
+  (setq-local treesit-defun-skipper #'c-ts-mode--defun-skipper)
+
+  ;; Nodes like struct/enum/union_specifier can appear in
+  ;; function_definitions, so we need to find the top-level node.
+  (setq-local treesit-defun-prefer-top-level t)
 
   ;; Indent.
   (when (eq c-ts-mode-indent-style 'linux)
@@ -508,13 +605,13 @@ the subtrees."
   (setq-local which-func-functions nil)
 
   (setq-local treesit-font-lock-feature-list
-              '(( comment constant keyword literal preprocessor string)
-                ( assignment definition label property type)
-                ( delimiter error escape-sequence function
-                  operator variable bracket))))
+              '(( comment definition)
+                ( keyword preprocessor string type)
+                ( assignment constant escape-sequence label literal property )
+                ( bracket delimiter error function operator variable))))
 
 ;;;###autoload
-(define-derived-mode c-ts-mode c-ts-mode--base-mode "C"
+(define-derived-mode c-ts-mode c-ts-base-mode "C"
   "Major mode for editing C, powered by tree-sitter."
   :group 'c
 
@@ -525,10 +622,14 @@ the subtrees."
 
   ;; Comments.
   (setq-local comment-start "/* ")
-  (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
   (setq-local comment-end " */")
-  (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*"))))
-  (setq-local treesit-comment-end (rx (+ (or "*")) "/"))
+  (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                         (seq "/" (+ "*")))
+                                     (* (syntax whitespace))))
+  (setq-local comment-end-skip
+              (rx (* (syntax whitespace))
+                  (group (or (syntax comment-end)
+                             (seq (+ "*") "/")))))
 
   (setq-local treesit-simple-indent-rules
               (c-ts-mode--set-indent-style 'c))
@@ -536,20 +637,35 @@ the subtrees."
   ;; Font-lock.
   (setq-local treesit-font-lock-settings (c-ts-mode--font-lock-settings 'c))
 
-  (treesit-major-mode-setup))
+  (treesit-major-mode-setup)
+
+  ;; Override default value of end-of-defun-function set by
+  ;; `treesit-major-mode-setup'.
+  (setq-local end-of-defun-function #'c-ts-mode--end-of-defun))
 
 ;;;###autoload
-(define-derived-mode c++-ts-mode c-ts-mode--base-mode "C++"
+(define-derived-mode c++-ts-mode c-ts-base-mode "C++"
   "Major mode for editing C++, powered by tree-sitter."
   :group 'c++
+  :syntax-table c++-ts-mode--syntax-table
 
   (unless (treesit-ready-p 'cpp)
     (error "Tree-sitter for C++ isn't available"))
 
   ;; Comments.
   (setq-local comment-start "// ")
-  (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
   (setq-local comment-end "")
+  (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                         (seq "/" (+ "*")))
+                                     (* (syntax whitespace))))
+  (setq-local comment-end-skip
+              (rx (* (syntax whitespace))
+                  (group (or (syntax comment-end)
+                             (seq (+ "*") "/")))))
+
+  (setq-local treesit-text-type-regexp
+              (regexp-opt '("comment"
+                            "raw_string_literal")))
 
   (treesit-parser-create 'cpp)
 
@@ -559,7 +675,11 @@ the subtrees."
   ;; Font-lock.
   (setq-local treesit-font-lock-settings (c-ts-mode--font-lock-settings 'cpp))
 
-  (treesit-major-mode-setup))
+  (treesit-major-mode-setup)
+
+  ;; Override default value of end-of-defun-function set by
+  ;; `treesit-major-mode-setup'.
+  (setq-local end-of-defun-function #'c-ts-mode--end-of-defun))
 
 (provide 'c-ts-mode)
 
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index b13f6a5914..dd6d33009d 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -1826,7 +1826,7 @@ with value CHAR in the region [FROM to)."
     '(or (looking-at
          "\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\)"
          (let ((prop (c-get-char-property (point) 'syntax-table)))
-           (eq prop '(14)))))))                ; '(14) is generic comment 
delimiter.
+           (equal prop '(14))))))) ; '(14) is generic comment delimiter.
 
 
 (defsubst c-intersect-lists (list alist)
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 086166c822..edb873f5a6 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -4951,30 +4951,31 @@ comment at the start of cc-engine.el for more info."
       "\\w\\|\\s_\\|\\s\"\\|\\s|"
     "\\w\\|\\s_\\|\\s\""))
 
-(defun c-forward-over-token (&optional balanced)
+(defun c-forward-over-token (&optional balanced limit)
   "Move forward over a token.
 Return t if we moved, nil otherwise (i.e. we were at EOB, or a
 non-token or BALANCED is non-nil and we can't move).  If we
 are at syntactic whitespace, move over this in place of a token.
 
 If BALANCED is non-nil move over any balanced parens we are at, and never move
-out of an enclosing paren."
+out of an enclosing paren.  LIMIT is the limit to where we might move to."
   (let ((jump-syntax (if balanced
                         c-jump-syntax-balanced
                       c-jump-syntax-unbalanced))
-       (here (point)))
+       (here (point))
+       (limit (or limit (point-max))))
     (condition-case nil
        (cond
         ((/= (point)
-             (progn (c-forward-syntactic-ws) (point)))
+             (progn (c-forward-syntactic-ws limit) (point)))
          ;; If we're at whitespace, count this as the token.
          t)
         ((eobp) nil)
         ((looking-at jump-syntax)
-         (goto-char (scan-sexps (point) 1))
+         (goto-char (min limit (scan-sexps (point) 1)))
          t)
         ((looking-at c-nonsymbol-token-regexp)
-         (goto-char (match-end 0))
+         (goto-char (min (match-end 0) limit))
          t)
         ((save-restriction
            (widen)
@@ -10677,6 +10678,8 @@ This function might do hidden buffer changes."
        (c-forward-syntactic-ws))
 
       (when (and (not got-identifier)
+                (or backup-at-type
+                    (not (memq context '(arglist decl))))
                 (or (and new-style-auto
                          (looking-at c-auto-ops-re))
                     (and (or maybe-typeless backup-maybe-typeless)
@@ -11076,8 +11079,9 @@ This function might do hidden buffer changes."
                              at-decl-start))
                 (let ((space-before-id
                        (save-excursion
-                         (goto-char name-start)
-                         (or (bolp) (memq (char-before) '(?\  ?\t)))))
+                         (goto-char id-start) ; Position of "*".
+                         (and (> (skip-chars-forward "* \t\n\r") 0)
+                              (memq (char-before) '(?\  ?\t ?\n ?\r)))))
                       (space-after-type
                        (save-excursion
                          (goto-char type-start)
@@ -11087,6 +11091,8 @@ This function might do hidden buffer changes."
                                   (memq (char-after) '(?\  ?\t)))))))
                   (when (not (eq (not space-before-id)
                                  (not space-after-type)))
+                    (when (eq at-type 'maybe)
+                      (setq unsafe-maybe t))
                     (setq maybe-expression t)
                     (throw 'at-decl-or-cast t)))))
 
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 47e05438ea..581685cad7 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1188,7 +1188,7 @@ definition, or nil if the language doesn't have any."
   t (if (c-lang-const c-opt-cpp-macro-define)
        (concat (c-lang-const c-anchored-cpp-prefix)
                (c-lang-const c-opt-cpp-macro-define)
-               "[ \t]+\\(\\sw\\|_\\)+\\([^(a-zA-Z0-9_]\\|$\\)")))
+               "[ \t]+[a-zA-Z0-9_]+\\([^(a-zA-Z0-9_]\\|$\\)")))
 
 (c-lang-defconst c-cpp-expr-directives
   "List of cpp directives (without the prefix) that are followed by an
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 99067e4761..6a2c2f2911 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -2482,7 +2482,8 @@ with // and /*, not more generic line and block comments."
       (let* ((lim1 (save-excursion
                     (and (c-beginning-of-macro)
                          (progn (c-end-of-macro) (point)))))
-            (decl-res (c-forward-declarator)))
+            (lim+ (c-determine-+ve-limit 200))
+            (decl-res (c-forward-declarator lim+)))
        (if (or (cadr (cddr (cddr decl-res))) ; We scanned an arglist.
                (and (eq (char-after) ?\()    ; Move over a non arglist (...).
                     (prog1 (c-go-list-forward)
@@ -2499,7 +2500,7 @@ with // and /*, not more generic line and block comments."
                   (c-backward-syntactic-ws lim1)
                   (eq (char-before) ?\())
                 (c-fl-decl-end (1- (point))))
-             (c-forward-over-token)
+             (c-forward-over-token nil lim+) ; The , or ) after the declarator.
              (point))
          (if (progn (c-forward-syntactic-ws)
                     (not (eobp)))
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index e0f5a7ee02..60d568add5 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1043,6 +1043,8 @@ can always override the use of `c-default-style' by 
making calls to
                  (const :format "Pike  " pike-mode) (string :format "%v"))
            (cons :format "%v"
                  (const :format "AWK   " awk-mode) (string :format "%v"))
+           (cons :format "%v"
+                 (const :format "C#   "  csharp-mode) (string :format "%v"))
            (cons :format "%v"
                  (const :format "Other " other) (string :format "%v"))))
   :group 'c)
diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el
new file mode 100644
index 0000000000..fc25d2ba5f
--- /dev/null
+++ b/lisp/progmodes/cmake-ts-mode.el
@@ -0,0 +1,234 @@
+;;; cmake-ts-mode.el --- tree-sitter support for CMake  -*- lexical-binding: 
t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author     : Randy Taylor <dev@rjt.dev>
+;; Maintainer : Randy Taylor <dev@rjt.dev>
+;; Created    : December 2022
+;; Keywords   : cmake languages tree-sitter
+
+;; 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 'treesit)
+(eval-when-compile (require 'rx))
+
+(declare-function treesit-parser-create "treesit.c")
+(declare-function treesit-induce-sparse-tree "treesit.c")
+(declare-function treesit-node-child "treesit.c")
+(declare-function treesit-node-start "treesit.c")
+(declare-function treesit-node-type "treesit.c")
+
+(defcustom cmake-ts-mode-indent-offset 2
+  "Number of spaces for each indentation step in `cmake-ts-mode'."
+  :version "29.1"
+  :type 'integer
+  :safe 'integerp
+  :group 'cmake)
+
+(defvar cmake-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?#  "<" table)
+    (modify-syntax-entry ?\n ">" table)
+    (modify-syntax-entry ?$  "'" table)
+    table)
+  "Syntax table for `cmake-ts-mode'.")
+
+(defvar cmake-ts-mode--indent-rules
+  `((cmake
+     ((node-is ")") parent-bol 0)
+     ((node-is "else_command") parent-bol 0)
+     ((node-is "elseif_command") parent-bol 0)
+     ((node-is "endforeach_command") parent-bol 0)
+     ((node-is "endfunction_command") parent-bol 0)
+     ((node-is "endif_command") parent-bol 0)
+     ((parent-is "foreach_loop") parent-bol cmake-ts-mode-indent-offset)
+     ((parent-is "function_def") parent-bol cmake-ts-mode-indent-offset)
+     ((parent-is "if_condition") parent-bol cmake-ts-mode-indent-offset)
+     ((parent-is "normal_command") parent-bol cmake-ts-mode-indent-offset)))
+  "Tree-sitter indent rules for `cmake-ts-mode'.")
+
+(defvar cmake-ts-mode--constants
+  '("1" "ON" "TRUE" "YES" "Y" "0" "OFF" "FALSE" "NO" "N" "IGNORE"
+    "NOTFOUND")
+  "CMake constants for tree-sitter font-locking.")
+
+(defvar cmake-ts-mode--keywords
+  '((else) (elseif) (endforeach) (endfunction) (endif) (endmacro)
+    (endwhile) (foreach) (function) (if) (macro) (while))
+  "CMake keywords for tree-sitter font-locking.")
+
+(defvar cmake-ts-mode--foreach-options
+  '("IN" "ITEMS" "LISTS" "RANGE" "ZIP_LISTS")
+  "CMake foreach options for tree-sitter font-locking.")
+
+(defvar cmake-ts-mode--if-conditions
+  '("AND" "COMMAND" "DEFINED" "EQUAL" "EXISTS" "GREATER"
+    "GREATER_EQUAL" "LESS" "LESS_EQUAL" "MATCHES" "NOT" "OR"
+    "PATH_EQUAL" "STREQUAL" "STRGREATER" "STRGREATER_EQUAL" "STRLESS"
+    "STRLESS_EQUAL" "VERSION_EQUAL" "VERSION_GREATER"
+    "VERSION_GREATER_EQUAL" "VERSION_LESS" "VERSION_LESS_EQUAL")
+  "CMake if conditions for tree-sitter font-locking.")
+
+(defvar cmake-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'cmake
+   :feature 'bracket
+   '((["(" ")"]) @font-lock-bracket-face)
+
+   :language 'cmake
+   :feature 'builtin
+   `(((foreach_command
+       ((argument) @font-lock-constant-face
+        (:match ,(rx-to-string
+                  `(seq bol
+                        (or ,@cmake-ts-mode--foreach-options)
+                        eol))
+                @font-lock-constant-face))))
+     ((if_command
+       ((argument) @font-lock-constant-face
+        (:match ,(rx-to-string
+                  `(seq bol
+                        (or ,@cmake-ts-mode--if-conditions)
+                        eol))
+                @font-lock-constant-face)))))
+
+   :language 'cmake
+   :feature 'comment
+   '([(bracket_comment) (line_comment)] @font-lock-comment-face)
+
+   :language 'cmake
+   :feature 'constant
+   `(((argument) @font-lock-constant-face
+      (:match ,(rx-to-string
+                `(seq bol
+                      (or ,@cmake-ts-mode--constants)
+                      eol))
+              @font-lock-constant-face)))
+
+   :language 'cmake
+   :feature 'function
+   '((normal_command (identifier) @font-lock-function-name-face))
+
+   :language 'cmake
+   :feature 'keyword
+   `([,@cmake-ts-mode--keywords] @font-lock-keyword-face)
+
+   :language 'cmake
+   :feature 'number
+   '(((unquoted_argument) @font-lock-number-face
+      (:match "^[[:digit:]]*\\.?[[:digit:]]*\\.?[[:digit:]]+$" 
@font-lock-number-face)))
+
+   :language 'cmake
+   :feature 'string
+   '([(bracket_argument) (quoted_argument)] @font-lock-string-face)
+
+   :language 'cmake
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face)
+
+   :language 'cmake
+   :feature 'misc-punctuation
+   ;; Don't override strings.
+   :override 'nil
+   '((["$" "{" "}" "<" ">"]) @font-lock-misc-punctuation-face)
+
+   :language 'cmake
+   :feature 'variable
+   :override t
+   '((variable) @font-lock-variable-name-face)
+
+   :language 'cmake
+   :feature 'error
+   :override t
+   '((ERROR) @font-lock-warning-face))
+  "Tree-sitter font-lock settings for `cmake-ts-mode'.")
+
+(defun cmake-ts-mode--imenu ()
+  "Return Imenu alist for the current buffer."
+  (let* ((node (treesit-buffer-root-node))
+         (func-tree (treesit-induce-sparse-tree
+                     node "function_def" nil 1000))
+         (func-index (cmake-ts-mode--imenu-1 func-tree)))
+    (append
+     (when func-index `(("Function" . ,func-index))))))
+
+(defun cmake-ts-mode--imenu-1 (node)
+  "Helper for `cmake-ts-mode--imenu'.
+Find string representation for NODE and set marker, then recurse
+the subtrees."
+  (let* ((ts-node (car node))
+         (children (cdr node))
+         (subtrees (mapcan #'cmake-ts-mode--imenu-1
+                           children))
+         (name (when ts-node
+                 (pcase (treesit-node-type ts-node)
+                   ("function_def"
+                    (treesit-node-text
+                     (treesit-node-child (treesit-node-child ts-node 0) 2) 
t)))))
+         (marker (when ts-node
+                   (set-marker (make-marker)
+                               (treesit-node-start ts-node)))))
+    (cond
+     ((or (null ts-node) (null name)) subtrees)
+     (subtrees
+      `((,name ,(cons name marker) ,@subtrees)))
+     (t
+      `((,name . ,marker))))))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist
+             '("\\(?:CMakeLists\\.txt\\|\\.cmake\\)\\'" . cmake-ts-mode))
+
+;;;###autoload
+(define-derived-mode cmake-ts-mode prog-mode "CMake"
+  "Major mode for editing CMake files, powered by tree-sitter."
+  :group 'cmake
+  :syntax-table cmake-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'cmake)
+    (treesit-parser-create 'cmake)
+
+    ;; Comments.
+    (setq-local comment-start "# ")
+    (setq-local comment-end "")
+    (setq-local comment-start-skip (rx "#" (* (syntax whitespace))))
+
+    ;; Imenu.
+    (setq-local imenu-create-index-function #'cmake-ts-mode--imenu)
+    (setq-local which-func-functions nil)
+
+    ;; Indent.
+    (setq-local treesit-simple-indent-rules cmake-ts-mode--indent-rules)
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings cmake-ts-mode--font-lock-settings)
+    (setq-local treesit-font-lock-feature-list
+                '((comment)
+                  (keyword string)
+                  (builtin constant escape-sequence function number variable)
+                  (bracket error misc-punctuation)))
+
+    (treesit-major-mode-setup)))
+
+(provide 'cmake-ts-mode)
+
+;;; cmake-ts-mode.el ends here
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 18c996e899..319dc97e69 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -186,6 +186,7 @@ and a string describing how the process finished.")
                      face compilation-info
                      help-echo "Number of informational messages so far")
     "]"))
+(put 'compilation-mode-line-errors 'risky-local-variable t)
 
 ;; If you make any changes to `compilation-error-regexp-alist-alist',
 ;; be sure to run the ERT test in test/lisp/progmodes/compile-tests.el.
@@ -2807,7 +2808,7 @@ This is the value of `next-error-function' in Compilation 
buffers."
             (goto-char (point-min))
             ;; Treat file's found lines in forward order, 1 by 1.
             (dolist (line (reverse (cddr (compilation--loc->file-struct loc))))
-              (when (car line)         ; else this is a filename w/o a line#
+              (when (car line)         ; else this is a filename without a 
line#
                 (compilation-beginning-of-line (- (car line) last -1))
                 (setq last (car line)))
               ;; Treat line's found columns and store/update a marker for each.
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
new file mode 100644
index 0000000000..9e8b22c6ab
--- /dev/null
+++ b/lisp/progmodes/csharp-mode.el
@@ -0,0 +1,959 @@
+;;; csharp-mode.el --- Support for editing C#  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2022  Free Software Foundation, Inc.
+
+;; Author     : Theodor Thornhill <theo@thornhill.no>
+;;              Jostein Kjønigsen <jostein@kjonigsen.net>
+;; Maintainer : Theodor Thornhill <theo@thornhill.no>
+;;              Jostein Kjønigsen <jostein@kjonigsen.net>
+;; Created    : September 2022
+;; Keywords   : c# languages oop
+
+;; 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:
+
+;; Support for editing C#.
+
+;;; Code:
+
+(require 'compile)
+(require 'cc-mode)
+(require 'cc-langs)
+(require 'treesit)
+
+(eval-when-compile
+  (require 'cc-fonts)
+  (require 'rx))
+
+(declare-function treesit-parser-create "treesit.c")
+(declare-function treesit-induce-sparse-tree "treesit.c")
+(declare-function treesit-node-start "treesit.c")
+(declare-function treesit-node-child-by-field-name "treesit.c")
+
+(defgroup csharp nil
+  "Major mode for editing C# code."
+  :group 'prog-mode)
+
+(eval-and-compile
+  (defconst csharp--regex-identifier
+    "[A-Za-z][A-Za-z0-9_]*"
+    "Regex describing an identifier in C#.")
+
+  (defconst csharp--regex-identifier-matcher
+    (concat "\\(" csharp--regex-identifier "\\)")
+    "Regex matching an identifier in C#.")
+
+  (defconst csharp--regex-type-name
+    "[A-Z][A-Za-z0-9_]*"
+    "Regex describing a type identifier in C#.")
+
+  (defconst csharp--regex-type-name-matcher
+    (concat "\\(" csharp--regex-type-name "\\)")
+    "Regex matching a type identifier in C#.")
+
+  (defconst csharp--regex-using-or-namespace
+    (concat "^using" "\\|" "namespace"
+            "\\s *"
+            csharp--regex-type-name-matcher)
+    "Regex matching identifiers after a using or namespace
+    declaration."))
+
+(eval-and-compile
+  (c-add-language 'csharp-mode 'java-mode)
+
+  (defun csharp--make-mode-syntax-table ()
+    (let ((table (make-syntax-table)))
+      (c-populate-syntax-table table)
+      (modify-syntax-entry ?@ "_" table)
+      table))
+  (defvar csharp--make-mode-syntax-table #'csharp--make-mode-syntax-table
+    "Workaround for Emacs bug#57065."))
+
+(c-lang-defconst c-make-mode-syntax-table
+  csharp #'csharp--make-mode-syntax-table)
+
+(c-lang-defconst c-identifier-syntax-modifications
+  csharp (append '((?@ . "w"))
+                 (c-lang-const c-identifier-syntax-modifications)))
+
+(c-lang-defconst c-symbol-start
+  csharp (concat "[" c-alpha "_@]"))
+
+(c-lang-defconst c-opt-type-suffix-key
+  csharp (concat "\\(\\[" (c-lang-const c-simple-ws) "*\\]\\|\\?\\)"))
+
+(c-lang-defconst c-identifier-ops
+  csharp '((left-assoc ".")))
+
+(c-lang-defconst c-overloadable-operators
+  csharp '("+" "-" "*" "/" "%" "&" "|" "^" "<<" ">>" "=="
+           "!=" ">" "<" ">=" "<="))
+
+(c-lang-defconst c-multiline-string-start-char
+  csharp ?@)
+
+(c-lang-defconst c-ml-string-opener-re
+  ;; "\\(\\(?:@\\$?\\)\\(\"\\)\\)"
+  csharp
+  (rx
+   (group
+    (or "@" "@$")
+    (group "\""))))
+
+(c-lang-defconst c-ml-string-max-opener-len
+  csharp 3)
+
+(c-lang-defconst c-ml-string-max-closer-len
+  csharp 2)
+
+(c-lang-defconst c-ml-string-any-closer-re
+  ;; "\\(?:\"\"\\)*\\(\\(\"\\)\\)\\(?:[^\"]\\|\\'\\)"
+  csharp
+  (rx
+   (seq
+    (zero-or-more "\"\"")
+    (group
+     (group "\""))
+    (or (not (any "\"")) eos))))
+
+(c-lang-defconst c-ml-string-back-closer-re
+  ;; "\\(?:\\`\\|[^\"]\\)\"*"
+  csharp
+  (rx
+   (seq
+    (or bos
+        (not (any "\"")))
+    (zero-or-more "\""))))
+
+(c-lang-defconst c-type-prefix-kwds
+  csharp '("class" "interface" "struct"))
+
+(c-lang-defconst c-class-decl-kwds
+  csharp '("class" "interface" "struct"))
+
+;;; Keyword lists
+
+(c-lang-defconst c-primitive-type-kwds
+  csharp '("bool" "byte" "sbyte" "char" "decimal" "double" "float" "int" "uint"
+           "long" "ulong" "short" "ushort" "void" "object" "string" "var"))
+
+(c-lang-defconst c-other-decl-kwds
+  csharp nil)
+
+(c-lang-defconst c-type-list-kwds
+  csharp nil)
+
+(c-lang-defconst c-other-block-decl-kwds
+  csharp nil)
+
+(c-lang-defconst c-return-kwds
+  csharp '("return"))
+
+(c-lang-defconst c-typedef-kwds
+  csharp nil)
+
+(c-lang-defconst c-typeof-kwds
+  csharp '("typeof" "is" "as"))
+
+(c-lang-defconst c-type-modifier-prefix-kwds
+  csharp '("volatile"))
+
+(c-lang-defconst c-type-modifier-kwds
+  csharp '("readonly" "new"))
+
+(c-lang-defconst c-brace-list-decl-kwds
+  csharp '("enum" "new"))
+
+(c-lang-defconst c-recognize-post-brace-list-type-p
+  csharp t)
+
+(c-lang-defconst c-ref-list-kwds
+  csharp nil)
+
+(c-lang-defconst c-using-kwds
+  csharp '("using"))
+
+(c-lang-defconst c-equals-type-clause-kwds
+  csharp '("using"))
+
+(defun csharp-at-vsemi-p (&optional pos)
+  (if pos (goto-char pos))
+  (save-excursion
+    (beginning-of-line)
+    (c-forward-syntactic-ws)
+    (looking-at "using\\s *(")))
+
+(c-lang-defconst c-at-vsemi-p-fn
+  csharp 'csharp-at-vsemi-p)
+
+(defun csharp-vsemi-status-unknown () t)
+
+(c-lang-defconst c-vsemi-status-unknown-p-fn
+  csharp 'csharp-vsemi-status-unknown-p)
+
+
+(c-lang-defconst c-modifier-kwds
+  csharp '("abstract" "default" "final" "native" "private" "protected"
+           "public" "partial" "internal" "readonly" "static" "event" 
"transient"
+           "volatile" "sealed" "ref" "out" "virtual" "implicit" "explicit"
+           "fixed" "override" "params" "async" "await" "extern" "unsafe"
+           "get" "set" "this" "const" "delegate"))
+
+(c-lang-defconst c-other-kwds
+  csharp '("select" "from" "where" "join" "in" "on" "equals" "into"
+           "orderby" "ascending" "descending" "group" "when"
+           "let" "by" "namespace"))
+
+(c-lang-defconst c-colon-type-list-kwds
+  csharp '("class" "struct" "interface"))
+
+(c-lang-defconst c-block-stmt-1-kwds
+  csharp '("do" "else" "finally" "try"))
+
+(c-lang-defconst c-block-stmt-1-2-kwds
+  csharp '("try"))
+
+(c-lang-defconst c-block-stmt-2-kwds
+  csharp '("for" "if" "switch" "while" "catch" "foreach" "fixed" "checked"
+           "unchecked" "using" "lock"))
+
+(c-lang-defconst c-simple-stmt-kwds
+  csharp '("break" "continue" "goto" "throw" "return" "yield"))
+
+(c-lang-defconst c-constant-kwds
+  csharp  '("true" "false" "null" "value"))
+
+(c-lang-defconst c-primary-expr-kwds
+  csharp '("this" "base" "operator"))
+
+(c-lang-defconst c-inexpr-class-kwds
+  csharp nil)
+
+(c-lang-defconst c-class-decl-kwds
+  csharp '("class" "struct" "interface"))
+
+(c-lang-defconst c-std-abbrev-keywords
+  csharp (append (c-lang-const c-std-abbrev-keywords) '("catch" "finally")))
+
+(c-lang-defconst c-decl-prefix-re
+  csharp "\\([{}(;,<]+\\)")
+
+(c-lang-defconst c-recognize-typeless-decls
+  csharp t)
+
+(c-lang-defconst c-recognize-<>-arglists
+  csharp t)
+
+(c-lang-defconst c-opt-cpp-prefix
+  csharp "\\s *#\\s *")
+
+(c-lang-defconst c-opt-cpp-macro-define
+  csharp (if (c-lang-const c-opt-cpp-prefix)
+             "define"))
+
+(c-lang-defconst c-cpp-message-directives
+  csharp '("error" "warning" "region"))
+
+(c-lang-defconst c-cpp-expr-directives
+  csharp '("if" "elif"))
+
+(c-lang-defconst c-other-op-syntax-tokens
+  csharp  (append '("#")
+                  (c-lang-const c-other-op-syntax-tokens)))
+
+(c-lang-defconst c-line-comment-starter
+  csharp "//")
+
+(c-lang-defconst c-doc-comment-start-regexp
+  csharp "///")
+
+(c-add-style "csharp"
+             '("java"
+               (c-basic-offset . 4)
+               (c-comment-only-line-offset . (0 . 0))
+               (c-offsets-alist . ((inline-open           . 0)
+                                   (arglist-intro         . +)
+                                   (arglist-close         . 0)
+                                   (inexpr-class          . 0)
+                                   (case-label            . +)
+                                   (cpp-macro             . 
c-lineup-dont-change)
+                                   (substatement-open     . 0)))))
+
+(eval-and-compile
+  (unless (or (stringp c-default-style)
+              (assoc 'csharp-mode c-default-style))
+    (setq c-default-style
+          (cons '(csharp-mode . "csharp")
+                c-default-style))))
+
+(defun csharp--color-forwards (font-lock-face)
+  (let (id-beginning)
+    (goto-char (match-beginning 0))
+    (forward-word)
+    (while (and (not (or (eq (char-after) ?\;)
+                         (eq (char-after) ?\{)))
+                (progn
+                  (forward-char)
+                  (c-forward-syntactic-ws)
+                  (setq id-beginning (point))
+                  (> (skip-chars-forward
+                      (c-lang-const c-symbol-chars))
+                     0))
+                (not (get-text-property (point) 'face)))
+      (c-put-font-lock-face id-beginning (point) font-lock-face)
+      (c-forward-syntactic-ws))))
+
+(c-lang-defconst c-basic-matchers-before
+  csharp `(
+           ;; Warning face on unclosed strings
+           ("\\s|" 0 font-lock-warning-face t nil)
+
+           ;; Invalid single quotes
+           c-font-lock-invalid-single-quotes
+
+           ;; Keyword constants
+           ,@(when (c-lang-const c-constant-kwds)
+               (let ((re (c-make-keywords-re nil (c-lang-const 
c-constant-kwds))))
+                 `((eval . (list ,(concat "\\<\\(" re "\\)\\>")
+                                 1 c-constant-face-name)))))
+
+           ;; Keywords except the primitive types.
+           ,`(,(concat "\\<" (c-lang-const c-regular-keywords-regexp))
+              1 font-lock-keyword-face)
+
+           ;; Chained identifiers in using/namespace statements
+           ,`(,(c-make-font-lock-search-function
+                csharp--regex-using-or-namespace
+                `((csharp--color-forwards font-lock-variable-name-face)
+                  nil
+                  (goto-char (match-end 0)))))
+
+           ;; Negation character
+           (eval . (list "\\(!\\)[^=]" 1 c-negation-char-face-name))
+
+           ;; Types after 'new'
+           (eval . (list (concat "\\<new\\> *" csharp--regex-type-name-matcher)
+                         1 font-lock-type-face))
+
+           ;; Single identifier in attribute
+           (eval . (list (concat "\\[" csharp--regex-type-name-matcher 
"\\][^;]")
+                         1 font-lock-variable-name-face t))
+
+           ;; Function names
+           (eval . (list "\\([A-Za-z0-9_]+\\)\\(<[a-zA-Z0-9, ]+>\\)?("
+                         1 font-lock-function-name-face))
+
+           ;; Nameof
+           (eval . (list (concat "\\(\\<nameof\\>\\) *(")
+                         1 font-lock-function-name-face))
+
+           (eval . (list (concat "\\<nameof\\> *( *"
+                                 csharp--regex-identifier-matcher
+                                 " *) *")
+                         1 font-lock-variable-name-face))
+
+           ;; Catch statements with type only
+           (eval . (list (concat "\\<catch\\> *( *"
+                                 csharp--regex-type-name-matcher
+                                 " *) *")
+                         1 font-lock-type-face))))
+
+(c-lang-defconst c-basic-matchers-after
+  csharp (append
+          ;; Merge with cc-mode defaults - enables us to add more later
+          (c-lang-const c-basic-matchers-after)))
+
+(defcustom csharp-codedoc-tag-face 'c-doc-markup-face-name
+  "Face to be used on the codedoc docstring tags.
+
+Should be one of the font lock faces, such as
+`font-lock-variable-name-face' and friends.
+
+Needs to be set before `csharp-mode' is loaded, because of
+compilation and evaluation time conflicts."
+  :type 'symbol)
+
+(defcustom csharp-font-lock-extra-types
+  (list csharp--regex-type-name)
+  (c-make-font-lock-extra-types-blurb "C#" "csharp-mode" (concat))
+  :type 'c-extra-types-widget
+  :group 'c)
+
+(defconst csharp-font-lock-keywords-1 (c-lang-const c-matchers-1 csharp)
+  "Minimal font locking for C# mode.")
+
+(defconst csharp-font-lock-keywords-2 (c-lang-const c-matchers-2 csharp)
+  "Fast normal font locking for C# mode.")
+
+(defconst csharp-font-lock-keywords-3 (c-lang-const c-matchers-3 csharp)
+  "Accurate normal font locking for C# mode.")
+
+(defvar csharp-font-lock-keywords csharp-font-lock-keywords-3
+  "Default expressions to highlight in C# mode.")
+
+(defun csharp-font-lock-keywords-2 ()
+  (c-compose-keywords-list csharp-font-lock-keywords-2))
+(defun csharp-font-lock-keywords-3 ()
+  (c-compose-keywords-list csharp-font-lock-keywords-3))
+(defun csharp-font-lock-keywords ()
+  (c-compose-keywords-list csharp-font-lock-keywords))
+
+;;; Doc comments
+
+(defconst codedoc-font-lock-doc-comments
+  ;; Most of this is taken from the javadoc example, however, we don't use the
+  ;; '@foo' syntax, so I removed that. Supports the XML tags only
+  `((,(concat "</?\\sw"         ; XML tags.
+              "\\("
+              (concat "\\sw\\|\\s \\|[=\n\r*.:]\\|"
+                      "\"[^\"]*\"\\|'[^']*'")
+              "\\)*/?>")
+     0 ,csharp-codedoc-tag-face prepend nil)
+    ;; ("\\([a-zA-Z0-9_]+\\)=" 0 font-lock-variable-name-face prepend nil)
+    ;; ("\".*\"" 0 font-lock-string-face prepend nil)
+    ("&\\(\\sw\\|[.:]\\)+;"     ; XML entities.
+     0 ,csharp-codedoc-tag-face prepend nil)))
+
+(defconst codedoc-font-lock-keywords
+  `((,(lambda (limit)
+        (c-font-lock-doc-comments "///" limit
+          codedoc-font-lock-doc-comments)))))
+
+;;; End of doc comments
+
+;;; Adding syntax constructs
+
+(advice-add 'c-looking-at-inexpr-block
+            :around #'csharp-looking-at-inexpr-block)
+
+(defun csharp-looking-at-inexpr-block (orig-fun &rest args)
+  (let ((res (csharp-at-lambda-header)))
+    (if res
+        res
+      (apply orig-fun args))))
+
+(defun csharp-at-lambda-header ()
+  (save-excursion
+    (c-backward-syntactic-ws)
+    (unless (bobp)
+      (backward-char)
+      (c-safe (goto-char (scan-sexps (point) -1)))
+      (when (or (looking-at "([[:alnum:][:space:]_,]*)[ \t\n]*=>[ \t\n]*{")
+                (looking-at "[[:alnum:]_]+[ \t\n]*=>[ \t\n]*{"))
+        ;; If we are at a C# lambda header
+        (cons 'inexpr (point))))))
+
+(advice-add 'c-guess-basic-syntax
+            :around #'csharp-guess-basic-syntax)
+
+(defun csharp-guess-basic-syntax (orig-fun &rest args)
+  (cond
+   (;; Attributes
+    (save-excursion
+      (goto-char (c-point 'iopl))
+      (and
+       (eq (char-after) ?\[)
+       (save-excursion
+         (c-go-list-forward)
+         (and (eq (char-before) ?\])
+              (not (eq (char-after) ?\;))))))
+    `((annotation-top-cont ,(c-point 'iopl))))
+
+   ((and
+     ;; Heuristics to find object initializers
+     (save-excursion
+       ;; Next non-whitespace character should be '{'
+       (goto-char (c-point 'boi))
+       (eq (char-after) ?{))
+     (save-excursion
+       ;; 'new' should be part of the line
+       (goto-char (c-point 'iopl))
+       (looking-at ".*new.*"))
+     ;; Line should not already be terminated
+     (save-excursion
+       (goto-char (c-point 'eopl))
+       (or (not (eq (char-before) ?\;))
+           (not (eq (char-before) ?\{)))))
+    (if (save-excursion
+          ;; if we have a hanging brace on line before
+          (goto-char (c-point 'eopl))
+          (eq (char-before) ?\{))
+        `((brace-list-intro ,(c-point 'iopl)))
+      `((block-open) (statement ,(c-point 'iopl)))))
+   (t
+    (apply orig-fun args))))
+
+;;; End of new syntax constructs
+
+;; When invoked by MSBuild, csc’s errors look like this:
+;; subfolder\file.cs(6,18): error CS1006: Name of constructor must
+;; match name of class [c:\Users\user\project.csproj]
+
+(defun csharp--compilation-error-file-resolve ()
+  "Resolve an msbuild error to a (filename . dirname) cons cell."
+  ;; https://stackoverflow.com/a/18049590/429091
+  (cons (match-string 1) (file-name-directory (match-string 4))))
+
+(defconst csharp-compilation-re-msbuild-error
+  (concat
+   "^[[:blank:]]*\\(?:[[:digit:]]+>\\)?"
+   "\\([^(\r\n)]+\\)(\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)?): "
+   "error [[:alnum:]]+: [^\r\n]+\\[\\([^]\r\n]+\\)\\]$")
+  "Regexp to match compilation error from msbuild.")
+
+(defconst csharp-compilation-re-msbuild-warning
+  (concat
+   "^[[:blank:]]*\\(?:[[:digit:]]+>\\)?"
+   "\\([^(\r\n)]+\\)(\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)?): "
+   "warning [[:alnum:]]+: [^\r\n]+\\[\\([^]\r\n]+\\)\\]$")
+  "Regexp to match compilation warning from msbuild.")
+
+;; Notes on xbuild and devenv commonalities
+;;
+;; These regexes were tailored for xbuild, but apart from the concurrent
+;; build-marker ("1>") they share exactly the same match-markers.
+;;
+;; If we don't exclude the match-markers explicitly, these regexes
+;; will also be used to match for devenv as well, including the build-marker
+;; in the file-name, causing the lookup to fail.
+;;
+;; So if we don't want devenv to fail, we actually need to handle it in our
+;; xbuild-regexes, but then we automatically get devenv-support for free.
+
+(defconst csharp-compilation-re-xbuild-error
+  (concat
+   "^[[:blank:]]*\\(?:[[:digit:]]+>\\)?"
+   "\\([^(\r\n)]+\\)(\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)?"
+   ;; handle weird devenv output format with 4 numbers, not 2 by having 
optional
+   ;; extra capture-groups.
+   "\\(?:,\\([0-9]+\\)\\)*): "
+   "error [[:alnum:]]+: .+$")
+  "Regexp to match compilation error from xbuild.")
+
+(defconst csharp-compilation-re-xbuild-warning
+  (concat
+   "^[[:blank:]]*\\(?:[[:digit:]]+>\\)?"
+   "\\([^(\r\n)]+\\)(\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)?"
+   ;; handle weird devenv output format with 4 numbers, not 2 by having 
optional
+   ;; extra capture-groups.
+   "\\(?:,\\([0-9]+\\)\\)*): "
+   "warning [[:alnum:]]+: .+$")
+  "Regexp to match compilation warning from xbuild.")
+
+(defconst csharp-compilation-re-dotnet-error
+  "\\([^\r\n]+\\) : error [A-Z]+[0-9]+:")
+
+(defconst csharp-compilation-re-dotnet-warning
+  "\\([^\r\n]+\\) : warning [A-Z]+[0-9]+:")
+
+(defconst csharp-compilation-re-dotnet-testfail
+  (concat
+   "[[:blank:]]+Stack Trace:\n"
+   "[[:blank:]]+at [^\n]+ in \\([^\n]+\\):line \\([0-9]+\\)"))
+
+
+(eval-after-load 'compile
+  (lambda ()
+    (dolist
+        (regexp
+         `((dotnet-testfail
+            ,csharp-compilation-re-dotnet-testfail
+            1 2)
+           (xbuild-error
+            ,csharp-compilation-re-xbuild-error
+            1 2 3 2)
+           (xbuild-warning
+            ,csharp-compilation-re-xbuild-warning
+            1 2 3 1)
+           (msbuild-error
+            ,csharp-compilation-re-msbuild-error
+            csharp--compilation-error-file-resolve
+            2
+            3
+            2
+            nil
+            (1 compilation-error-face)
+            (4 compilation-error-face))
+           (msbuild-warning
+            ,csharp-compilation-re-msbuild-warning
+            csharp--compilation-error-file-resolve
+            2
+            3
+            1
+            nil
+            (1 compilation-warning-face)
+            (4 compilation-warning-face))
+           (dotnet-error
+            ,csharp-compilation-re-dotnet-error
+            1)
+           (dotnet-warning
+            ,csharp-compilation-re-dotnet-warning
+            1 nil nil 1)))
+      (add-to-list 'compilation-error-regexp-alist-alist regexp)
+      (add-to-list 'compilation-error-regexp-alist (car regexp)))))
+
+(defvar csharp-mode-syntax-table
+  (funcall (c-lang-const c-make-mode-syntax-table csharp))
+  "Syntax table used in `csharp-mode' buffers.")
+
+(defvar csharp-mode-map
+  (let ((map (c-make-inherited-keymap)))
+    map)
+  "Keymap used in `csharp-mode' buffers.")
+
+(easy-menu-define csharp-mode-menu csharp-mode-map "C# Mode Commands."
+  (cons "C#" (c-lang-const c-mode-menu csharp)))
+
+;;; Tree-sitter support
+
+(defcustom csharp-ts-mode-indent-offset 4
+  "Number of spaces for each indentation step in `csharp-ts-mode'."
+  :type 'integer
+  :safe 'integerp
+  :group 'csharp)
+
+(defvar csharp-ts-mode--indent-rules
+  `((c-sharp
+     ((parent-is "compilation_unit") parent-bol 0)
+     ((node-is "}") parent-bol 0)
+     ((node-is ")") parent-bol 0)
+     ((node-is "]") parent-bol 0)
+     ((parent-is "namespace_declaration") parent-bol 0)
+     ((parent-is "class_declaration") parent-bol 0)
+     ((parent-is "constructor_declaration") parent-bol 0)
+     ((parent-is "method_declaration") parent-bol 0)
+     ((parent-is "enum_declaration") parent-bol 0)
+     ((parent-is "operator_declaration") parent-bol 0)
+     ((parent-is "field_declaration") parent-bol 0)
+     ((parent-is "struct_declaration") parent-bol 0)
+     ((parent-is "declaration_list") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "argument_list") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "interpolation") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "binary_expression") parent 0)
+     ((parent-is "block") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "local_function_statement") parent-bol 0)
+     ((parent-is "if_statement") parent-bol 0)
+     ((parent-is "for_statement") parent-bol 0)
+     ((parent-is "for_each_statement") parent-bol 0)
+     ((parent-is "while_statement") parent-bol 0)
+     ((match "{" "switch_expression") parent-bol 0)
+     ((parent-is "switch_statement") parent-bol 0)
+     ((parent-is "switch_body") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "switch_section") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "switch_expression") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "case_statement") parent-bol 0)
+     ((parent-is "do_statement") parent-bol 0)
+     ((parent-is "equals_value_clause") parent-bol 
csharp-ts-mode-indent-offset)
+     ((parent-is "ternary_expression") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "conditional_expression") parent-bol 
csharp-ts-mode-indent-offset)
+     ((parent-is "statement_block") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "type_arguments") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "variable_declarator") parent-bol 
csharp-ts-mode-indent-offset)
+     ((parent-is "arguments") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "array") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "formal_parameters") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "template_substitution") parent-bol 
csharp-ts-mode-indent-offset)
+     ((parent-is "object_pattern") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "object") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "object_type") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "enum_body") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "arrow_function") parent-bol csharp-ts-mode-indent-offset)
+     ((parent-is "parenthesized_expression") parent-bol 
csharp-ts-mode-indent-offset))))
+
+(defvar csharp-ts-mode--keywords
+  '("using" "namespace" "class" "if" "else" "throw" "new" "for"
+    "return" "await" "struct" "enum" "switch" "case"
+    "default" "typeof" "try" "catch" "finally" "break"
+    "foreach" "in" "yield" "get" "set" "when" "as" "out"
+    "is" "while" "continue" "this" "ref" "goto" "interface"
+    "from" "where" "select" "lock" "base" "record" "init"
+    "with" "let" "static" "var" "do" "public" "private"
+    "readonly" "unmanaged")
+  "C# keywords for tree-sitter font-locking.")
+
+(defvar csharp-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'c-sharp
+   :override t
+   :feature 'comment
+   '((comment)  @font-lock-comment-face)
+   :language 'c-sharp
+   :override t
+   :feature 'keyword
+   `([,@csharp-ts-mode--keywords] @font-lock-keyword-face
+     (modifier) @font-lock-keyword-face
+     (this_expression) @font-lock-keyword-face)
+   :language 'c-sharp
+   :override t
+   :feature 'attribute
+   `((attribute (identifier) @font-lock-property-face 
(attribute_argument_list))
+     (attribute (identifier) @font-lock-property-face))
+   :language 'c-sharp
+   :override t
+   :feature 'escape-sequence
+   '((escape_sequence) @font-lock-escape-face)
+   :language 'c-sharp
+   :override t
+   :feature 'literal
+   `((integer_literal) @font-lock-number-face
+     (real_literal) @font-lock-number-face
+     (null_literal) @font-lock-constant-face
+     (boolean_literal) @font-lock-constant-face)
+   :language 'c-sharp
+   :override t
+   :feature 'string
+   `([(string_literal)
+      (verbatim_string_literal)
+      (interpolated_string_text)
+      (interpolated_verbatim_string_text)
+      (character_literal)
+      "\""
+      "$\""
+      "@$\""
+      "$@\""] @font-lock-string-face)
+   :language 'c-sharp
+   :override t
+   :feature 'type
+   '((predefined_type) @font-lock-type-face
+     (implicit_type) @font-lock-type-face
+     (nullable_type) @font-lock-type-face
+     (type_parameter
+      (identifier) @font-lock-type-face)
+     (type_argument_list
+      (identifier) @font-lock-type-face)
+     (generic_name
+      (identifier) @font-lock-type-face)
+     (array_type
+      (identifier) @font-lock-type-face)
+     (cast_expression (identifier) @font-lock-type-face)
+     ["operator"] @font-lock-type-face
+     (type_parameter_constraints_clause
+      target: (identifier) @font-lock-type-face)
+     (type_of_expression (identifier) @font-lock-type-face)
+     (object_creation_expression (identifier) @font-lock-type-face))
+   :language 'c-sharp
+   :feature 'definition
+   :override t
+   '((qualified_name (identifier) @font-lock-type-face)
+     (using_directive (identifier) @font-lock-type-face)
+     (using_directive (name_equals
+                       (identifier) @font-lock-type-face
+                       ["="] @default-face))
+
+     (enum_declaration (identifier) @font-lock-type-face)
+     (enum_member_declaration (identifier) @font-lock-variable-name-face)
+
+     (interface_declaration (identifier) @font-lock-type-face)
+
+     (struct_declaration (identifier) @font-lock-type-face)
+
+     (record_declaration (identifier) @font-lock-type-face)
+     (namespace_declaration (identifier) @font-lock-type-face)
+     (base_list (identifier) @font-lock-type-face)
+     (property_declaration (generic_name))
+     (property_declaration
+      type: (nullable_type) @font-lock-type-face
+      name: (identifier) @font-lock-variable-name-face)
+     (property_declaration
+      type: (predefined_type) @font-lock-type-face
+      name: (identifier) @font-lock-variable-name-face)
+     (property_declaration
+      type: (identifier) @font-lock-type-face
+      name: (identifier) @font-lock-variable-name-face)
+     (class_declaration (identifier) @font-lock-type-face)
+
+     (constructor_declaration name: (_) @font-lock-type-face)
+
+     (method_declaration type: (_) @font-lock-type-face)
+     (method_declaration name: (_) @font-lock-function-name-face)
+
+     (invocation_expression
+      (member_access_expression
+       (generic_name (identifier) @font-lock-function-name-face)))
+     (invocation_expression
+      (member_access_expression
+       ((identifier) @font-lock-variable-name-face
+        (identifier) @font-lock-function-name-face)))
+     (invocation_expression
+      (identifier) @font-lock-function-name-face)
+     (invocation_expression
+      (member_access_expression
+       expression: (identifier) @font-lock-variable-name-face))
+     (invocation_expression
+      function: [(generic_name (identifier)) @font-lock-function-name-face
+                 (generic_name (type_argument_list
+                                ["<"] @font-lock-bracket-face
+                                (identifier) @font-lock-type-face
+                                [">"] @font-lock-bracket-face)
+                               )])
+
+     (catch_declaration
+      ((identifier) @font-lock-type-face))
+     (catch_declaration
+      ((identifier) @font-lock-type-face
+       (identifier) @font-lock-variable-name-face))
+
+     (variable_declaration (identifier) @font-lock-type-face)
+     (variable_declarator (identifier) @font-lock-variable-name-face)
+
+     (parameter type: (identifier) @font-lock-type-face)
+     (parameter name: (identifier) @font-lock-variable-name-face)
+
+     (binary_expression (identifier) @font-lock-variable-name-face)
+     (argument (identifier) @font-lock-variable-name-face))
+   :language 'c-sharp
+   :feature 'expression
+   '((conditional_expression (identifier) @font-lock-variable-name-face)
+     (postfix_unary_expression (identifier)* @font-lock-variable-name-face)
+     (assignment_expression (identifier) @font-lock-variable-name-face))
+   :language 'c-sharp
+   :feature 'bracket
+   '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
+
+   :language 'c-sharp
+   :feature 'delimiter
+   '((["," ":" ";"]) @font-lock-delimiter-face)
+
+   :language 'c-sharp
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face
+     (ERROR) @font-lock-warning-face)))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
+
+(defun csharp-ts-mode--imenu-1 (node)
+  "Helper for `csharp-ts-mode--imenu'.
+Find string representation for NODE and set marker, then recurse
+the subtrees."
+  (let* ((ts-node (car node))
+         (subtrees (mapcan #'csharp-ts-mode--imenu-1 (cdr node)))
+         (name (when ts-node
+                 (or (treesit-node-text
+                      (or (treesit-node-child-by-field-name
+                           ts-node "name"))
+                      t)
+                     "Unnamed node")))
+         (marker (when ts-node
+                   (set-marker (make-marker)
+                               (treesit-node-start ts-node)))))
+    (cond
+     ((null ts-node) subtrees)
+     (subtrees
+      `((,name ,(cons name marker) ,@subtrees)))
+     (t
+      `((,name . ,marker))))))
+
+(defun csharp-ts-mode--imenu ()
+  "Return Imenu alist for the current buffer."
+  (let* ((node (treesit-buffer-root-node))
+         (class-tree (treesit-induce-sparse-tree
+                      node "^class_declaration$" nil 1000))
+         (interface-tree (treesit-induce-sparse-tree
+                          node "^interface_declaration$" nil 1000))
+         (enum-tree (treesit-induce-sparse-tree
+                     node "^enum_declaration$" nil 1000))
+         (struct-tree (treesit-induce-sparse-tree
+                       node "^struct_declaration$"  nil 1000))
+         (record-tree (treesit-induce-sparse-tree
+                       node "^record_declaration$"  nil 1000))
+         (method-tree (treesit-induce-sparse-tree
+                       node "^method_declaration$" nil 1000))
+         (class-index (csharp-ts-mode--imenu-1 class-tree))
+         (interface-index (csharp-ts-mode--imenu-1 interface-tree))
+         (enum-index (csharp-ts-mode--imenu-1 enum-tree))
+         (record-index (csharp-ts-mode--imenu-1 record-tree))
+         (struct-index (csharp-ts-mode--imenu-1 struct-tree))
+         (method-index (csharp-ts-mode--imenu-1 method-tree)))
+    (append
+     (when class-index `(("Class" . ,class-index)))
+     (when interface-index `(("Interface" . ,interface-index)))
+     (when enum-index `(("Enum" . ,enum-index)))
+     (when record-index `(("Record" . ,record-index)))
+     (when struct-index `(("Struct" . ,struct-index)))
+     (when method-index `(("Method" . ,method-index))))))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
+
+;;;###autoload
+(define-derived-mode csharp-mode prog-mode "C#"
+  "Major mode for editing Csharp code.
+
+Key bindings:
+\\{csharp-mode-map}"
+  :after-hook (c-update-modeline)
+  (c-initialize-cc-mode t)
+  (c-init-language-vars csharp-mode)
+  (c-common-init 'csharp-mode)
+  (setq-local c-doc-comment-style '((csharp-mode . codedoc)))
+  (run-mode-hooks 'c-mode-common-hook))
+
+;;;###autoload
+(define-derived-mode csharp-ts-mode prog-mode "C#"
+  "Major mode for editing C# code."
+  :syntax-table (csharp--make-mode-syntax-table)
+
+  (unless (treesit-ready-p 'c-sharp)
+    (error "Tree-sitter for C# isn't available"))
+
+  ;; Tree-sitter.
+  (treesit-parser-create 'c-sharp)
+
+  ;; Comments.
+  (setq-local comment-start "// ")
+  (setq-local comment-end "")
+  (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                         (seq "/" (+ "*")))
+                                     (* (syntax whitespace))))
+  (setq-local comment-end-skip
+              (rx (* (syntax whitespace))
+                  (group (or (syntax comment-end)
+                             (seq (+ "*") "/")))))
+
+  (setq-local treesit-text-type-regexp
+              (regexp-opt '("comment"
+                            "verbatim_string-literal"
+                            "interpolated_verbatim_string-text")))
+
+  ;; Indent.
+  (setq-local treesit-simple-indent-rules csharp-ts-mode--indent-rules)
+
+  ;; Electric
+  (setq-local electric-indent-chars
+              (append "{}():;," electric-indent-chars))
+
+  ;; Navigation.
+  (setq-local treesit-defun-type-regexp "declaration")
+
+  ;; Font-lock.
+  (setq-local treesit-font-lock-settings csharp-ts-mode--font-lock-settings)
+  (setq-local treesit-font-lock-feature-list
+              '(( comment definition)
+                ( keyword string escape-sequence type)
+                ( attribute constant expression literal)
+                ( bracket delimiter)))
+
+  ;; Imenu.
+  (setq-local imenu-create-index-function #'csharp-ts-mode--imenu)
+  (setq-local which-func-functions nil) ;; Piggyback on imenu
+  (treesit-major-mode-setup))
+
+(provide 'csharp-mode)
+
+;;; csharp-mode.el ends here
diff --git a/lisp/progmodes/dockerfile-ts-mode.el 
b/lisp/progmodes/dockerfile-ts-mode.el
new file mode 100644
index 0000000000..40d90cc2df
--- /dev/null
+++ b/lisp/progmodes/dockerfile-ts-mode.el
@@ -0,0 +1,177 @@
+;;; dockerfile-ts-mode.el --- tree-sitter support for Dockerfiles  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author     : Randy Taylor <dev@rjt.dev>
+;; Maintainer : Randy Taylor <dev@rjt.dev>
+;; Created    : December 2022
+;; Keywords   : dockerfile languages tree-sitter
+
+;; 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 'treesit)
+(eval-when-compile (require 'rx))
+
+(declare-function treesit-parser-create "treesit.c")
+(declare-function treesit-induce-sparse-tree "treesit.c")
+(declare-function treesit-node-child "treesit.c")
+(declare-function treesit-node-child-by-field-name "treesit.c")
+(declare-function treesit-node-start "treesit.c")
+(declare-function treesit-node-type "treesit.c")
+
+(defvar dockerfile-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?#  "<" table)
+    (modify-syntax-entry ?\n ">" table)
+    table)
+  "Syntax table for `dockerfile-ts-mode'.")
+
+(defvar dockerfile-ts-mode--indent-rules
+  `((dockerfile
+     ((parent-is "copy_instruction") (nth-sibling 1) 0)
+     ((parent-is "env_instruction") (nth-sibling 1) 0)
+     ((parent-is "expose_instruction") (nth-sibling 1) 0)
+     ((parent-is "label_instruction") (nth-sibling 1) 0)
+     ((parent-is "shell_command") first-sibling 0)
+     ((parent-is "string_array") first-sibling 1)))
+  "Tree-sitter indent rules.")
+
+(defvar dockerfile-ts-mode--keywords
+  '("ADD" "ARG" "AS" "CMD" "COPY" "CROSS_BUILD" "ENTRYPOINT" "ENV"
+    "EXPOSE" "FROM" "HEALTHCHECK" "LABEL" "MAINTAINER" "ONBUILD" "RUN"
+    "SHELL" "STOPSIGNAL" "USER" "VOLUME" "WORKDIR")
+  "Dockerfile keywords for tree-sitter font-locking.")
+
+(defvar dockerfile-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'dockerfile
+   :feature 'bracket
+   '((["[" "]"]) @font-lock-bracket-face)
+
+   :language 'dockerfile
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
+
+   :language 'dockerfile
+   :feature 'delimiter
+   '(([","]) @font-lock-delimiter-face)
+
+   :language 'dockerfile
+   :feature 'image-spec
+   '((image_spec) @font-lock-constant-face)
+
+   :language 'dockerfile
+   :feature 'keyword
+   `([,@dockerfile-ts-mode--keywords] @font-lock-keyword-face)
+
+   :language 'dockerfile
+   :feature 'number
+   '((expose_port) @font-lock-number-face)
+
+   :language 'dockerfile
+   :feature 'operator
+   '((["="]) @font-lock-operator-face)
+
+   :language 'dockerfile
+   :feature 'string
+   '((double_quoted_string) @font-lock-string-face)
+
+   :language 'dockerfile
+   :feature 'error
+   :override t
+   '((ERROR) @font-lock-warning-face))
+  "Tree-sitter font-lock settings.")
+
+(defun dockerfile-ts-mode--imenu ()
+  "Return Imenu alist for the current buffer."
+  (let* ((node (treesit-buffer-root-node))
+         (stage-tree (treesit-induce-sparse-tree
+                      node "from_instruction"
+                      nil 1000)))
+    `(("Stage" . ,(dockerfile-ts-mode--imenu-1 stage-tree)))))
+
+(defun dockerfile-ts-mode--imenu-1 (node)
+  "Helper for `dockerfile-ts-mode--imenu'.
+Find string representation for NODE and set marker, then recurse
+the subtrees."
+  (let* ((ts-node (car node))
+         (children (cdr node))
+         (subtrees (mapcan #'dockerfile-ts-mode--imenu-1
+                           children))
+         (name (when ts-node
+                 (pcase (treesit-node-type ts-node)
+                   ("from_instruction"
+                    (treesit-node-text
+                     (or (treesit-node-child-by-field-name ts-node "as")
+                         (treesit-node-child ts-node 1)) t)))))
+         (marker (when ts-node
+                   (set-marker (make-marker)
+                               (treesit-node-start ts-node)))))
+    (cond
+     ((or (null ts-node) (null name)) subtrees)
+     (subtrees
+      `((,name ,(cons name marker) ,@subtrees)))
+     (t
+      `((,name . ,marker))))))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist
+             ;; NOTE: We can't use `rx' here, as it breaks bootstrap.
+             '("\\(?:Dockerfile\\(?:\\..*\\)?\\|\\.[Dd]ockerfile\\)\\'"
+               . dockerfile-ts-mode))
+
+;;;###autoload
+(define-derived-mode dockerfile-ts-mode prog-mode "Dockerfile"
+  "Major mode for editing Dockerfiles, powered by tree-sitter."
+  :group 'dockerfile
+  :syntax-table dockerfile-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'dockerfile)
+    (treesit-parser-create 'dockerfile)
+
+    ;; Comments.
+    (setq-local comment-start "# ")
+    (setq-local comment-end "")
+    (setq-local comment-start-skip (rx "#" (* (syntax whitespace))))
+
+    ;; Imenu.
+    (setq-local imenu-create-index-function
+                #'dockerfile-ts-mode--imenu)
+    (setq-local which-func-functions nil)
+
+    ;; Indent.
+    (setq-local treesit-simple-indent-rules
+                dockerfile-ts-mode--indent-rules)
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings
+                dockerfile-ts-mode--font-lock-settings)
+    (setq-local treesit-font-lock-feature-list
+                '((comment)
+                  (keyword string)
+                  (image-spec number)
+                  (bracket delimiter error operator)))
+
+    (treesit-major-mode-setup)))
+
+(provide 'dockerfile-ts-mode)
+
+;;; dockerfile-ts-mode.el ends here
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index e057b12e0e..ce4ca4f3d9 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2,12 +2,12 @@
 
 ;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
 
-;; Version: 1.9
+;; Version: 1.10
 ;; Author: João Távora <joaotavora@gmail.com>
 ;; Maintainer: João Távora <joaotavora@gmail.com>
 ;; URL: https://github.com/joaotavora/eglot
 ;; Keywords: convenience, languages
-;; Package-Requires: ((emacs "26.3") (jsonrpc "1.0.14") (flymake "1.2.1") 
(project "0.3.0") (xref "1.0.1") (eldoc "1.11.0") (seq "2.23"))
+;; Package-Requires: ((emacs "26.3") (jsonrpc "1.0.16") (flymake "1.2.1") 
(project "0.9.3") (xref "1.0.1") (eldoc "1.11.0") (seq "2.23") 
(external-completion "0.1"))
 
 ;; This is a GNU ELPA :core package.  Avoid adding functionality
 ;; that is not available in the version of Emacs recorded above or any
@@ -110,6 +110,7 @@
 (require 'filenotify)
 (require 'ert)
 (require 'array)
+(require 'external-completion)
 
 ;; ElDoc is preloaded in Emacs, so `require'-ing won't guarantee we are
 ;; using the latest version from GNU Elpa when we load eglot.el.  Use an
@@ -166,7 +167,7 @@ chosen (interactively or automatically)."
                (cond ((cdr available)
                       (cdr (assoc
                             (completing-read
-                             "[eglot] More than one server executable 
available:"
+                             "[eglot] More than one server executable 
available: "
                              (mapcar #'car available)
                              nil t nil nil (car (car available)))
                             available #'equal)))
@@ -181,22 +182,25 @@ chosen (interactively or automatically)."
                       when probe return (cons probe args)
                       finally (funcall err)))))))
 
-(defvar eglot-server-programs `((rust-mode . ,(eglot-alternatives 
'("rust-analyzer" "rls")))
-                                (cmake-mode . ("cmake-language-server"))
+(defvar eglot-server-programs `(((rust-ts-mode rust-mode) . 
,(eglot-alternatives '("rust-analyzer" "rls")))
+                                ((cmake-mode cmake-ts-mode) . 
("cmake-language-server"))
                                 (vimrc-mode . ("vim-language-server" 
"--stdio"))
-                                (python-mode
+                                ((python-mode python-ts-mode)
                                  . ,(eglot-alternatives
                                      '("pylsp" "pyls" ("pyright-langserver" 
"--stdio") "jedi-language-server")))
-                                ((js-json-mode json-mode) . 
,(eglot-alternatives '(("vscode-json-language-server" "--stdio") 
("json-languageserver" "--stdio"))))
-                                ((js-mode ts-mode typescript-mode)
+                                ((js-json-mode json-mode json-ts-mode)
+                                 . ,(eglot-alternatives 
'(("vscode-json-language-server" "--stdio")
+                                                          
("json-languageserver" "--stdio"))))
+                                ((js-mode js-ts-mode tsx-ts-mode 
typescript-ts-mode typescript-mode)
                                  . ("typescript-language-server" "--stdio"))
-                                (sh-mode . ("bash-language-server" "start"))
+                                ((bash-ts-mode sh-mode) . 
("bash-language-server" "start"))
                                 ((php-mode phps-mode)
                                  . ,(eglot-alternatives
                                      '(("phpactor" "language-server")
                                        ("php" 
"vendor/felixfbecker/language-server/bin/php-language-server.php"))))
-                                ((c++-mode c-mode) . ,(eglot-alternatives
-                                                       '("clangd" "ccls")))
+                                ((c-mode c-ts-mode c++-mode c++-ts-mode)
+                                 . ,(eglot-alternatives
+                                     '("clangd" "ccls")))
                                 (((caml-mode :language-id "ocaml")
                                   (tuareg-mode :language-id "ocaml") 
reason-mode)
                                  . ("ocamllsp"))
@@ -207,10 +211,11 @@ chosen (interactively or automatically)."
                                 (elm-mode . ("elm-language-server"))
                                 (mint-mode . ("mint" "ls"))
                                 (kotlin-mode . ("kotlin-language-server"))
-                                ((go-mode go-dot-mod-mode go-dot-work-mode) . 
("gopls"))
+                                ((go-mode go-dot-mod-mode go-dot-work-mode 
go-ts-mode go-mod-ts-mode)
+                                 . ("gopls"))
                                 ((R-mode ess-r-mode) . ("R" "--slave" "-e"
                                                         
"languageserver::run()"))
-                                (java-mode . ("jdtls"))
+                                ((java-mode java-ts-mode) . ("jdtls"))
                                 (dart-mode . ("dart" "language-server"
                                               "--client-id" 
"emacs.eglot-dart"))
                                 (elixir-mode . ("language_server.sh"))
@@ -220,7 +225,7 @@ chosen (interactively or automatically)."
                                 ((tex-mode context-mode texinfo-mode 
bibtex-mode)
                                  . ,(eglot-alternatives '("digestif" 
"texlab")))
                                 (erlang-mode . ("erlang_ls" "--transport" 
"stdio"))
-                                (yaml-mode . ("yaml-language-server" 
"--stdio"))
+                                ((yaml-ts-mode yaml-mode) . 
("yaml-language-server" "--stdio"))
                                 (nix-mode . ,(eglot-alternatives '("nil" 
"rnix-lsp")))
                                 (gdscript-mode . ("localhost" 6008))
                                 ((fortran-mode f90-mode) . ("fortls"))
@@ -228,12 +233,17 @@ chosen (interactively or automatically)."
                                 (lua-mode . ,(eglot-alternatives
                                               '("lua-language-server" 
"lua-lsp")))
                                 (zig-mode . ("zls"))
-                                (css-mode . ,(eglot-alternatives 
'(("vscode-css-language-server" "--stdio") ("css-languageserver" "--stdio"))))
+                                ((css-mode css-ts-mode)
+                                 . ,(eglot-alternatives 
'(("vscode-css-language-server" "--stdio")
+                                                          
("css-languageserver" "--stdio"))))
                                 (html-mode . ,(eglot-alternatives 
'(("vscode-html-language-server" "--stdio") ("html-languageserver" "--stdio"))))
-                                (dockerfile-mode . ("docker-langserver" 
"--stdio"))
+                                ((dockerfile-mode dockerfile-ts-mode) . 
("docker-langserver" "--stdio"))
                                 ((clojure-mode clojurescript-mode 
clojurec-mode)
                                  . ("clojure-lsp"))
-                                (csharp-mode . ("omnisharp" "-lsp"))
+                                ((csharp-mode csharp-ts-mode)
+                                 . ,(eglot-alternatives
+                                     '(("omnisharp" "-lsp")
+                                       ("csharp-ls"))))
                                 (purescript-mode . 
("purescript-language-server" "--stdio"))
                                 ((perl-mode cperl-mode) . ("perl" 
"-MPerl::LanguageServer" "-e" "Perl::LanguageServer::run"))
                                 (markdown-mode . ("marksman" "server")))
@@ -380,6 +390,11 @@ done by `eglot-reconnect'."
   "String displayed in mode line when Eglot is active."
   :type 'string)
 
+(defcustom eglot-report-progress t
+  "If non-nil, show progress of long running LSP server work"
+  :type 'boolean
+  :version "29.1")
+
 (defvar eglot-withhold-process-id nil
   "If non-nil, Eglot will not send the Emacs process id to the language server.
 This can be useful when using docker to run a language server.")
@@ -464,6 +479,7 @@ This can be useful when using docker to run a language 
server.")
       (TextDocumentEdit (:textDocument :edits) ())
       (TextEdit (:range :newText))
       (VersionedTextDocumentIdentifier (:uri :version) ())
+      (WorkDoneProgress (:kind) (:title :message :percentage :cancellable))
       (WorkspaceEdit () (:changes :documentChanges))
       (WorkspaceSymbol (:name :kind) (:containerName :location :data)))
     "Alist (INTERFACE-NAME . INTERFACE) of known external LSP interfaces.
@@ -486,7 +502,7 @@ Here's what an element of this alist might look like:
       ;; disallow-non-standard-keys
       ;; enforce-required-keys
       ;; enforce-optional-keys
-      )
+      no-unknown-interfaces)
     "How strictly to check LSP interfaces at compile- and run-time.
 
 Value is a list of symbols (if the list is empty, no checks are
@@ -507,7 +523,10 @@ happens at run-time.  At compile-time, a warning is raised 
if a
 destructuring spec doesn't use all optional fields.
 
 If the symbol `disallow-unknown-methods' is present, Eglot warns
-on unknown notifications and errors on unknown requests."))
+on unknown notifications and errors on unknown requests.
+
+If the symbol `no-unknown-interfaces' is present, Eglot warns at
+compile time if an undeclared LSP interface is used."))
 
 (cl-defun eglot--check-object (interface-name
                                object
@@ -534,7 +553,7 @@ on unknown notifications and errors on unknown requests."))
        for type = (or (cdr (assoc k types)) t) ;; FIXME: enforce nil type?
        unless (cl-typep v type)
        do (eglot--error "A `%s' must have a %s as %s, but has %s"
-                        interface-name )))
+                        interface-name)))
     t))
 
 (eval-and-compile
@@ -581,7 +600,7 @@ on unknown notifications and errors on unknown requests."))
                (when missing-out (byte-compile-warn
                                   "Destructuring for %s is missing out on %s"
                                   interface-name missing-out))))
-            (t
+            ((memq 'no-unknown-interfaces eglot-strict-mode)
              (byte-compile-warn "Unknown LSP interface %s" interface-name))))))
 
 (cl-defmacro eglot--dbind (vars object &body body)
@@ -737,6 +756,10 @@ treated as in `eglot--dbind'."
                                            t
                                          :json-false)
                                       :deprecatedSupport t
+                                      :resolveSupport (:properties
+                                                       ["documentation"
+                                                        "details"
+                                                        "additionalTextEdits"])
                                       :tagSupport (:valueSet [1]))
                                     :contextSupport t)
              :hover              (list :dynamicRegistration :json-false
@@ -821,6 +844,9 @@ treated as in `eglot--dbind'."
    (project
     :documentation "Project associated with server."
     :accessor eglot--project)
+   (progress-reporters
+    :initform (make-hash-table :test #'equal) :accessor 
eglot--progress-reporters
+    :documentation "Maps LSP progress tokens to progress reporters.")
    (inhibit-autoreconnect
     :initform t
     :documentation "Generalized boolean inhibiting auto-reconnection if true."
@@ -915,7 +941,7 @@ PRESERVE-BUFFERS as in `eglot-shutdown', which see."
                   (push sym retval))))
     retval))
 
-(defvar eglot--command-history nil
+(defvar eglot-command-history nil
   "History of CONTACT arguments to `eglot'.")
 
 (defun eglot--lookup-mode (mode)
@@ -1001,7 +1027,7 @@ be guessed."
           (and base-prompt
                (cond (current-prefix-arg base-prompt)
                      ((null guess)
-                      (format "[eglot] Sorry, couldn't guess for `%s'!\n%s"
+                      (format "[eglot] Couldn't guess LSP server for `%s'\n%s"
                               main-mode base-prompt))
                      ((and program
                            (not (file-name-absolute-p program))
@@ -1115,11 +1141,11 @@ INTERACTIVE is t if called interactively."
   (let ((buffer (current-buffer)))
     (cl-labels
         ((maybe-connect
-          ()
-          (remove-hook 'post-command-hook #'maybe-connect nil)
-          (eglot--when-live-buffer buffer
-            (unless eglot--managed-mode
-              (apply #'eglot--connect (eglot--guess-contact))))))
+           ()
+           (remove-hook 'post-command-hook #'maybe-connect nil)
+           (eglot--when-live-buffer buffer
+             (unless eglot--managed-mode
+               (apply #'eglot--connect (eglot--guess-contact))))))
       (when buffer-file-name
         (add-hook 'post-command-hook #'maybe-connect 'append nil)))))
 
@@ -1171,7 +1197,7 @@ Each function is passed the server as an argument")
       (list "sh" "-c"
             (string-join (cons "stty raw > /dev/null;"
                                (mapcar #'shell-quote-argument contact))
-             " "))
+                         " "))
     contact))
 
 (defvar-local eglot--cached-server nil
@@ -1181,9 +1207,7 @@ Each function is passed the server as an argument")
   "Connect to MANAGED-MODES, LANGUAGE-ID, PROJECT, CLASS and CONTACT.
 This docstring appeases checkdoc, that's all."
   (let* ((default-directory (project-root project))
-         (nickname (if (fboundp 'project-name)
-                       (project-name project)
-                     (file-name-base (directory-file-name default-directory))))
+         (nickname (project-name project))
          (readable-name (format "EGLOT (%s/%s)" nickname managed-modes))
          autostart-inferior-process
          server-info
@@ -1227,7 +1251,7 @@ This docstring appeases checkdoc, that's all."
                      ,@more-initargs)))))
          (spread (lambda (fn) (lambda (server method params)
                                 (let ((eglot--cached-server server))
-                                 (apply fn server method (append params 
nil))))))
+                                  (apply fn server method (append params 
nil))))))
          (server
           (apply
            #'make-instance class
@@ -1501,11 +1525,15 @@ If optional MARKER, return a marker instead"
 (defun eglot--path-to-uri (path)
   "URIfy PATH."
   (let ((truepath (file-truename path)))
-    (if (url-type (url-generic-parse-url truepath))
+    (if (and (url-type (url-generic-parse-url path))
+             ;; It might be MS Windows path which includes a drive
+             ;; letter that looks like a URL scheme (bug#59338)
+             (not (and (eq system-type 'windows-nt)
+                       (file-name-absolute-p truepath))))
         ;; Path is already a URI, so forward it to the LSP server
         ;; untouched.  The server should be able to handle it, since
         ;; it provided this URI to clients in the first place.
-        truepath
+        path
       (concat "file://"
               ;; Add a leading "/" for local MS Windows-style paths.
               (if (and (eq system-type 'windows-nt)
@@ -1557,7 +1585,7 @@ Doubles as an indicator of snippet support."
       (setq-local markdown-fontify-code-blocks-natively t)
       (insert string)
       (let ((inhibit-message t)
-           (message-log-max nil))
+            (message-log-max nil))
         (ignore-errors (delay-mode-hooks (funcall mode))))
       (font-lock-ensure)
       (string-trim (buffer-string)))))
@@ -1842,8 +1870,8 @@ If it is activated, also signal textDocument/didOpen."
                                            (force-mode-line-update t))))))
 
 (defun eglot-manual () "Open documentation."
-  (declare (obsolete info "29.1"))
-  (interactive) (info "(eglot)"))
+       (declare (obsolete info "29.1"))
+       (interactive) (info "(eglot)"))
 
 (easy-menu-define eglot-menu nil "Eglot"
   `("Eglot"
@@ -1947,17 +1975,17 @@ Uses THING, FACE, DEFS and PREPEND."
            'keymap (let ((map (make-sparse-keymap)))
                      (define-key map [mode-line down-mouse-1] 
eglot-server-menu)
                      map))
-       ,@(when last-error
+         ,@(when last-error
              `("/" ,(eglot--mode-line-props
                      "error" 'compilation-mode-line-fail
                      '((mouse-3 eglot-clear-status  "Clear this status"))
                      (format "An error occurred: %s\n" (plist-get last-error
-                                                                 :message)))))
-       ,@(when (cl-plusp pending)
-           `("/" ,(eglot--mode-line-props
-                   (format "%d" pending) 'warning
-                   '((mouse-3 eglot-forget-pending-continuations
-                              "Forget pending continuations"))
+                                                                  :message)))))
+         ,@(when (cl-plusp pending)
+             `("/" ,(eglot--mode-line-props
+                     (format "%d" pending) 'warning
+                     '((mouse-3 eglot-forget-pending-continuations
+                                "Forget pending continuations"))
                      "Number of outgoing, \
 still unanswered LSP requests to the server\n"))))))))
 
@@ -1975,13 +2003,13 @@ still unanswered LSP requests to the server\n"))))))))
 (defalias 'eglot--diag-data 'flymake-diagnostic-data)
 
 (cl-loop for i from 1
-         for type in '(eglot-note eglot-warning eglot-error )
+         for type in '(eglot-note eglot-warning eglot-error)
          do (put type 'flymake-overlay-control
                  `((mouse-face . highlight)
                    (priority . ,(+ 50 i))
                    (keymap . ,(let ((map (make-sparse-keymap)))
                                 (define-key map [mouse-1]
-                                  (eglot--mouse-call 'eglot-code-actions))
+                                            (eglot--mouse-call 
'eglot-code-actions))
                                 map)))))
 
 
@@ -2037,6 +2065,27 @@ COMMAND is a symbol naming the command."
   (_server (_method (eql telemetry/event)) &rest _any)
   "Handle notification telemetry/event.") ;; noop, use events buffer
 
+(cl-defmethod eglot-handle-notification
+  (server (_method (eql $/progress)) &key token value)
+  "Handle $/progress notification identified by TOKEN from SERVER."
+  (when eglot-report-progress
+    (cl-flet ((fmt (&rest args) (mapconcat #'identity args " ")))
+      (eglot--dbind ((WorkDoneProgress) kind title percentage message) value
+        (pcase kind
+          ("begin"
+           (let* ((prefix (format (concat "[eglot] %s %s:" (when percentage " 
"))
+                                  (eglot-project-nickname server) token))
+                  (pr (puthash token
+                       (if percentage
+                           (make-progress-reporter prefix 0 100 percentage 1 0)
+                         (make-progress-reporter prefix nil nil nil 1 0))
+                       (eglot--progress-reporters server))))
+             (progress-reporter-update pr percentage (fmt title message))))
+          ("report"
+           (when-let ((pr (gethash token (eglot--progress-reporters server))))
+             (progress-reporter-update pr percentage (fmt title message))))
+          ("end" (remhash token (eglot--progress-reporters server))))))))
+
 (cl-defmethod eglot-handle-notification
   (_server (_method (eql textDocument/publishDiagnostics)) &key uri diagnostics
            &allow-other-keys) ; FIXME: doesn't respect `eglot-strict-mode'
@@ -2048,9 +2097,11 @@ COMMAND is a symbol naming the command."
                     (t          'eglot-note)))
             (mess (source code message)
               (concat source (and code (format " [%s]" code)) ": " message)))
-    (if-let ((buffer (find-buffer-visiting (eglot--uri-to-path uri))))
+    (if-let* ((path (expand-file-name (eglot--uri-to-path uri)))
+              (buffer (find-buffer-visiting path)))
         (with-current-buffer buffer
           (cl-loop
+           initially (assoc-delete-all path flymake-list-only-diagnostics 
#'string=)
            for diag-spec across diagnostics
            collect (eglot--dbind ((Diagnostic) range code message severity 
source tags)
                        diag-spec
@@ -2093,7 +2144,6 @@ COMMAND is a symbol naming the command."
                          (t
                           (setq eglot--diagnostics diags)))))
       (cl-loop
-       with path = (expand-file-name (eglot--uri-to-path uri))
        for diag-spec across diagnostics
        collect (eglot--dbind ((Diagnostic) code range message severity source) 
diag-spec
                  (setq message (mess source code message))
@@ -2160,7 +2210,7 @@ THINGS are either registrations or unregisterations 
(sic)."
   (append
    (eglot--VersionedTextDocumentIdentifier)
    (list :languageId
-        (eglot--language-id (eglot--current-server-or-lose))
+         (eglot--language-id (eglot--current-server-or-lose))
          :text
          (eglot--widening
           (buffer-substring-no-properties (point-min) (point-max))))))
@@ -2559,7 +2609,7 @@ If BUFFER, switch to it before."
                   (let ((probe (gethash pat cache :missing)))
                     (if (eq probe :missing) (puthash pat (refresh pat) cache)
                       probe)))
-                (lookup (pat)
+                (lookup (pat _point)
                   (let ((res (lookup-1 pat))
                         (def (and (string= pat "") (gethash :default cache))))
                     (append def res nil)))
@@ -2567,16 +2617,12 @@ If BUFFER, switch to it before."
                   (cl-getf (get-text-property
                             0 'eglot--lsp-workspaceSymbol c)
                            :score 0)))
-      (lambda (string _pred action)
-        (pcase action
-          (`metadata `(metadata
-                       (cycle-sort-function
-                        . ,(lambda (completions)
-                             (cl-sort completions #'> :key #'score)))
-                       (category . eglot-indirection-joy)))
-          (`(eglot--lsp-tryc . ,point) `(eglot--lsp-tryc . (,string . ,point)))
-          (`(eglot--lsp-allc . ,_point) `(eglot--lsp-allc . ,(lookup string)))
-          (_ nil))))))
+      (external-completion-table
+       'eglot-indirection-joy
+       #'lookup
+       `((cycle-sort-function
+          . ,(lambda (completions)
+               (cl-sort completions #'> :key #'score))))))))
 
 (defun eglot--recover-workspace-symbol-meta (string)
   "Search `eglot--workspace-symbols-cache' for rich entry of STRING."
@@ -2588,9 +2634,6 @@ If BUFFER, switch to it before."
                  (setq v (cdr v))))
              eglot--workspace-symbols-cache)))
 
-(add-to-list 'completion-category-overrides
-             '(eglot-indirection-joy (styles . (eglot--lsp-backend-style))))
-
 (cl-defmethod xref-backend-identifier-at-point ((_backend (eql eglot)))
   (let ((attempt
          (and (xref--prompt-p this-command)
@@ -2629,7 +2672,7 @@ If BUFFER, switch to it before."
                                                uri range))))))
        (if (vectorp response) response (and response (list response)))))))
 
-(cl-defun eglot--lsp-xref-helper (method &key extra-params capability )
+(cl-defun eglot--lsp-xref-helper (method &key extra-params capability)
   "Helper for `eglot-find-declaration' & friends."
   (let ((eglot--lsp-xref-refs (eglot--lsp-xrefs-for-method
                                method
@@ -2661,7 +2704,7 @@ If BUFFER, switch to it before."
             (get-text-property 0 'eglot--lsp-workspaceSymbol probe)
           (eglot--dbind ((Location) uri range) location
             (list (eglot--xref-make-match name uri range))))
-        (eglot--lsp-xrefs-for-method :textDocument/definition))))
+      (eglot--lsp-xrefs-for-method :textDocument/definition))))
 
 (cl-defmethod xref-backend-references ((_backend (eql eglot)) _identifier)
   (or
@@ -2700,7 +2743,7 @@ for which LSP on-type-formatting should be requested."
                  `(:textDocument/onTypeFormatting
                    :documentOnTypeFormattingProvider
                    ,`(:position ,(eglot--pos-to-lsp-position beg)
-                      :ch ,(string on-type-format))))
+                                :ch ,(string on-type-format))))
                 ((and beg end)
                  `(:textDocument/rangeFormatting
                    :documentRangeFormattingProvider
@@ -3273,24 +3316,24 @@ at point.  With prefix argument, prompt for 
ACTION-KIND."
                                 (eglot--project server))))))
     (cl-labels
         ((handle-event
-          (event)
-          (pcase-let* ((`(,desc ,action ,file ,file1) event)
-                       (action-type (cl-case action
-                                      (created 1) (changed 2) (deleted 3)))
-                       (action-bit (when action-type
-                                     (ash 1 (1- action-type)))))
-            (cond
-             ((and (memq action '(created changed deleted))
-                   (cl-loop for (glob . kind-bitmask) in globs
-                            thereis (and (> (logand kind-bitmask action-bit) 0)
-                                         (funcall glob file))))
-              (jsonrpc-notify
-               server :workspace/didChangeWatchedFiles
-               `(:changes ,(vector `(:uri ,(eglot--path-to-uri file)
-                                          :type ,action-type)))))
-             ((eq action 'renamed)
-              (handle-event `(,desc 'deleted ,file))
-              (handle-event `(,desc 'created ,file1)))))))
+           (event)
+           (pcase-let* ((`(,desc ,action ,file ,file1) event)
+                        (action-type (cl-case action
+                                       (created 1) (changed 2) (deleted 3)))
+                        (action-bit (when action-type
+                                      (ash 1 (1- action-type)))))
+             (cond
+              ((and (memq action '(created changed deleted))
+                    (cl-loop for (glob . kind-bitmask) in globs
+                             thereis (and (> (logand kind-bitmask action-bit) 
0)
+                                          (funcall glob file))))
+               (jsonrpc-notify
+                server :workspace/didChangeWatchedFiles
+                `(:changes ,(vector `(:uri ,(eglot--path-to-uri file)
+                                           :type ,action-type)))))
+              ((eq action 'renamed)
+               (handle-event `(,desc 'deleted ,file))
+               (handle-event `(,desc 'created ,file1)))))))
       (unwind-protect
           (progn
             (dolist (dir dirs-to-watch)
@@ -3425,42 +3468,6 @@ If NOERROR, return predicate, else erroring function."
                         'eglot-managed-mode-hook "1.6")
 (provide 'eglot)
 
-
-;;; Backend completion
-
-;; Written by Stefan Monnier circa 2016.  Something to move to
-;; minibuffer.el "ASAP" (with all the `eglot--lsp-' replaced by
-;; something else. The very same code already in SLY and stable for a
-;; long time.
-
-;; This "completion style" delegates all the work to the "programmable
-;; completion" table which is then free to implement its own
-;; completion style.  Typically this is used to take advantage of some
-;; external tool which already has its own completion system and
-;; doesn't give you efficient access to the prefix completion needed
-;; by other completion styles.  The table should recognize the symbols
-;; 'eglot--lsp-tryc and 'eglot--lsp-allc as ACTION, reply with
-;; (eglot--lsp-tryc COMP...) or (eglot--lsp-allc . (STRING . POINT)),
-;; accordingly.  tryc/allc names made akward/recognizable on purpose.
-
-(add-to-list 'completion-styles-alist
-             '(eglot--lsp-backend-style
-               eglot--lsp-backend-style-try-completion
-               eglot--lsp-backend-style-all-completions
-               "Ad-hoc completion style provided by the completion table."))
-
-(defun eglot--lsp-backend-style-call (op string table pred point)
-  (when (functionp table)
-    (let ((res (funcall table string pred (cons op point))))
-      (when (eq op (car-safe res))
-        (cdr res)))))
-
-(defun eglot--lsp-backend-style-try-completion (string table pred point)
-  (eglot--lsp-backend-style-call 'eglot--lsp-tryc string table pred point))
-
-(defun eglot--lsp-backend-style-all-completions (string table pred point)
-  (eglot--lsp-backend-style-call 'eglot--lsp-allc string table pred point))
-
 
 ;; Local Variables:
 ;; bug-reference-bug-regexp: "\\(github#\\([0-9]+\\)\\)"
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index adb984c3e5..7af62c3535 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -54,9 +54,8 @@
 ;; (question mark) if no backends were even configured.
 ;;
 ;; For programmers interested in writing a new Flymake backend, the
-;; docstring of `flymake-diagnostic-functions', the Flymake manual,
-;; and the code of existing backends are probably a good starting
-;; point.
+;; docstring of `flymake-diagnostic-functions', the Flymake manual, and the
+;; code of existing backends are probably good starting points.
 ;;
 ;; The user wishing to customize the appearance of error types should
 ;; set properties on the symbols associated with each diagnostic type.
@@ -1636,6 +1635,7 @@ buffer."
 (define-derived-mode flymake-diagnostics-buffer-mode tabulated-list-mode
   "Flymake diagnostics"
   "A mode for listing Flymake diagnostics."
+  :interactive nil
   (setq tabulated-list-format flymake--diagnostics-base-tabulated-list-format)
   (setq tabulated-list-entries
         'flymake--diagnostics-buffer-entries)
@@ -1693,6 +1693,7 @@ some of this variable's contents the diagnostic 
listings.")
 (define-derived-mode flymake-project-diagnostics-mode tabulated-list-mode
   "Flymake diagnostics"
   "A mode for listing Flymake diagnostics."
+  :interactive nil
   (setq tabulated-list-format
         (vconcat [("File" 25 t)]
                  flymake--diagnostics-base-tabulated-list-format))
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index dff677e785..ff14546c63 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -177,7 +177,7 @@ May be manually changed by user with `gdb-select-frame'.")
   "Number of selected line for main current thread.")
 
 (defvar gdb-threads-list nil
-  "Associative list of threads provided by \"-thread-info\" MI command.
+  "Association list of threads provided by \"-thread-info\" MI command.
 
 Keys are thread numbers (in strings) and values are structures as
 returned from -thread-info by `gdb-mi--partial-output'.  Updated in
@@ -196,7 +196,7 @@ Updated in `gdb-thread-list-handler-custom'.")
 See also `gdb-running-threads-count'.")
 
 (defvar gdb-breakpoints-list nil
-  "Associative list of breakpoints provided by \"-break-list\" MI command.
+  "Association list of breakpoints provided by \"-break-list\" MI command.
 
 Keys are breakpoint numbers (in string) and values are structures
 as returned from \"-break-list\" by `gdb-mi--partial-output'
@@ -1113,13 +1113,13 @@ no input, and GDB is waiting for input."
              (process-live-p proc)
             (not gud-running)
             (= (point) (marker-position (process-mark proc))))
-       ;; Sending an EOF does not work with GDB-MI; submit an
-       ;; explicit quit command.
-       (progn
-          (if (> gdb-control-level 0)
-              (process-send-eof proc)
-            (insert "quit")
-            (comint-send-input t t)))
+      ;; Exit a recursive reading loop or quit.
+      (if (> gdb-control-level 0)
+          (process-send-eof proc)
+        ;; Sending an EOF does not work with GDB-MI; submit an
+        ;; explicit quit command.
+        (insert "quit")
+        (comint-send-input t t))
       (delete-char arg))))
 
 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
@@ -3159,7 +3159,7 @@ See `def-gdb-auto-update-handler'."
           (gdb-remove-breakpoint-icons (point-min) (point-max)))))
   (dolist (breakpoint gdb-breakpoints-list)
     (let* ((breakpoint (cdr breakpoint)) ; gdb-breakpoints-list is
-                                        ; an associative list
+                                        ; an association list
            (line (gdb-mi--field breakpoint 'line)))
       (when line
         (let ((file (gdb-mi--field breakpoint 'fullname))
@@ -4355,6 +4355,24 @@ member."
   :group 'gud
   :version "29.1")
 
+(defcustom gdb-locals-table-row-config `((name . 20)
+                                         (type . 20)
+                                         (value . ,gdb-locals-value-limit))
+  "Configuration for table rows in the local variable display.
+
+An alist that controls the display of the name, type and value of
+local variables inside the currently active stack-frame.  The key
+controls which column to change whereas the value determines the
+maximum number of characters to display in each column.  A value
+of 0 means there is no limit.
+
+Additionally, the order the element in the alist determines the
+left-to-right display order of the properties."
+  :type '(alist :key-type symbol :value-type integer)
+  :group 'gud
+  :version "30.1")
+
+
 (defvar gdb-locals-values-table (make-hash-table :test #'equal)
   "Mapping of local variable names to a string with their value.")
 
@@ -4384,12 +4402,9 @@ member."
 
 (defun gdb-locals-value-filter (value)
   "Filter function for the local variable VALUE."
-  (let* ((no-nl (replace-regexp-in-string "\n" " " value))
-         (str (replace-regexp-in-string "[[:space:]]+" " " no-nl))
-         (limit gdb-locals-value-limit))
-    (if (>= (length str) limit)
-        (concat (substring str 0 limit) "...")
-      str)))
+  (let* ((no-nl (replace-regexp-in-string "\n" " " (or value "<Unknown>")))
+         (str (replace-regexp-in-string "[[:space:]]+" " " no-nl)))
+    str))
 
 (defun gdb-edit-locals-value (&optional event)
   "Assign a value to a variable displayed in the locals buffer."
@@ -4403,6 +4418,22 @@ member."
       (gud-basic-call
        (concat  "-gdb-set variable " var " = " value)))))
 
+
+(defun gdb-locals-table-columns-list (alist)
+  "Format and arrange the columns in locals display based on ALIST."
+  (let (columns)
+    (dolist (config gdb-locals-table-row-config columns)
+      (let* ((key  (car config))
+             (max  (cdr config))
+             (prop (alist-get key alist)))
+        (when prop
+          (if (and (> max 0) (length> prop max))
+              (push (propertize (string-truncate-left prop max) 'help-echo 
prop)
+                    columns)
+            (push prop columns)))))
+    (nreverse columns)))
+
+
 ;; Complex data types are looked up in `gdb-locals-values-table'.
 (defun gdb-locals-handler-custom ()
   "Handler to rebuild the local variables table buffer."
@@ -4431,12 +4462,14 @@ member."
                                             help-echo "mouse-2: edit value"
                                             local-map ,gdb-edit-locals-map-1)
                                value))
+        (setf (gdb-table-right-align table) t)
+        (setq name (propertize name 'font-lock-face 
font-lock-variable-name-face))
+        (setq type (propertize type 'font-lock-face font-lock-type-face))
         (gdb-table-add-row
          table
-         (list
-          (propertize type 'font-lock-face font-lock-type-face)
-          (propertize name 'font-lock-face font-lock-variable-name-face)
-          value)
+         (gdb-locals-table-columns-list `((name  . ,name)
+                                          (type  . ,type)
+                                          (value . ,value)))
          `(gdb-local-variable ,local))))
     (insert (gdb-table-string table " "))
     (setq mode-name
@@ -5124,6 +5157,8 @@ This arrangement depends on the values of variable
 (defun gdb-reset ()
   "Exit a debugging session cleanly.
 Kills the gdb buffers, and resets variables and the source buffers."
+  ;; Save GDB history
+  (comint-write-input-ring)
   ;; The gdb-inferior buffer has a pty hooked up to the main gdb
   ;; process.  This pty must be deleted explicitly.
   (let ((pty (get-process "gdb-inferior")))
diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el
new file mode 100644
index 0000000000..124d9b044a
--- /dev/null
+++ b/lisp/progmodes/go-ts-mode.el
@@ -0,0 +1,354 @@
+;;; go-ts-mode.el --- tree-sitter support for Go  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author     : Randy Taylor <dev@rjt.dev>
+;; Maintainer : Randy Taylor <dev@rjt.dev>
+;; Created    : December 2022
+;; Keywords   : go languages tree-sitter
+
+;; 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 'treesit)
+(eval-when-compile (require 'rx))
+
+(declare-function treesit-parser-create "treesit.c")
+(declare-function treesit-induce-sparse-tree "treesit.c")
+(declare-function treesit-node-child "treesit.c")
+(declare-function treesit-node-child-by-field-name "treesit.c")
+(declare-function treesit-node-start "treesit.c")
+(declare-function treesit-node-type "treesit.c")
+
+(defcustom go-ts-mode-indent-offset 4
+  "Number of spaces for each indentation step in `go-ts-mode'."
+  :version "29.1"
+  :type 'integer
+  :safe 'integerp
+  :group 'go)
+
+(defvar go-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?+   "."      table)
+    (modify-syntax-entry ?-   "."      table)
+    (modify-syntax-entry ?=   "."      table)
+    (modify-syntax-entry ?%   "."      table)
+    (modify-syntax-entry ?&   "."      table)
+    (modify-syntax-entry ?|   "."      table)
+    (modify-syntax-entry ?^   "."      table)
+    (modify-syntax-entry ?!   "."      table)
+    (modify-syntax-entry ?<   "."      table)
+    (modify-syntax-entry ?>   "."      table)
+    (modify-syntax-entry ?\\  "\\"     table)
+    (modify-syntax-entry ?/   ". 124b" table)
+    (modify-syntax-entry ?*   ". 23"   table)
+    (modify-syntax-entry ?\n  "> b"    table)
+    table)
+  "Syntax table for `go-ts-mode'.")
+
+(defvar go-ts-mode--indent-rules
+  `((go
+     ((node-is ")") parent-bol 0)
+     ((node-is "]") parent-bol 0)
+     ((node-is "}") parent-bol 0)
+     ((node-is "labeled_statement") no-indent)
+     ((parent-is "argument_list") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "block") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "const_declaration") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "default_case") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "expression_case") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "expression_switch_statement") parent-bol 0)
+     ((parent-is "field_declaration_list") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "import_spec_list") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "labeled_statement") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "literal_value") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "type_spec") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "var_declaration") parent-bol go-ts-mode-indent-offset)
+     (no-node parent-bol 0)))
+  "Tree-sitter indent rules for `go-ts-mode'.")
+
+(defvar go-ts-mode--keywords
+  '("break" "case" "chan" "const" "continue" "default" "defer" "else"
+    "fallthrough" "for" "func" "go" "goto" "if" "import" "interface" "map"
+    "package" "range" "return" "select" "struct" "switch" "type" "var")
+  "Go keywords for tree-sitter font-locking.")
+
+(defvar go-ts-mode--operators
+  '("+" "&" "+=" "&=" "&&" "==" "!=" "-" "|" "-=" "|=" "||" "<" "<="
+    "*" "^" "*=" "^=" "<-" ">" ">=" "/" "<<" "/=" "<<=" "++" "=" ":=" "%"
+    ">>" "%=" ">>=" "--" "!"  "..."  "&^" "&^=" "~")
+  "Go operators for tree-sitter font-locking.")
+
+(defvar go-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'go
+   :feature 'bracket
+   '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
+
+   :language 'go
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
+
+   :language 'go
+   :feature 'constant
+   '([(false) (iota) (nil) (true)] @font-lock-constant-face
+     (const_declaration
+      (const_spec name: (identifier) @font-lock-constant-face)))
+
+   :language 'go
+   :feature 'delimiter
+   '((["," "." ";" ":"]) @font-lock-delimiter-face)
+
+   :language 'go
+   :feature 'function
+   '((call_expression
+      function: (identifier) @font-lock-function-name-face)
+     (call_expression
+      function: (selector_expression
+                 field: (field_identifier) @font-lock-function-name-face))
+     (function_declaration
+      name: (identifier) @font-lock-function-name-face)
+     (method_declaration
+      name: (field_identifier) @font-lock-function-name-face))
+
+   :language 'go
+   :feature 'keyword
+   `([,@go-ts-mode--keywords] @font-lock-keyword-face)
+
+   :language 'go
+   :feature 'label
+   '((label_name) @font-lock-constant-face)
+
+   :language 'go
+   :feature 'number
+   '([(float_literal)
+      (imaginary_literal)
+      (int_literal)] @font-lock-number-face)
+
+   :language 'go
+   :feature 'string
+   '([(interpreted_string_literal)
+      (raw_string_literal)
+      (rune_literal)] @font-lock-string-face)
+
+   :language 'go
+   :feature 'type
+   '([(package_identifier) (type_identifier)] @font-lock-type-face)
+
+   :language 'go
+   :feature 'variable
+   '((identifier) @font-lock-variable-name-face)
+
+   :language 'go
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face)
+
+   :language 'go
+   :feature 'property
+   :override t
+   '((field_identifier) @font-lock-property-face
+     (keyed_element (_ (identifier) @font-lock-property-face)))
+
+   :language 'go
+   :feature 'error
+   :override t
+   '((ERROR) @font-lock-warning-face))
+  "Tree-sitter font-lock settings for `go-ts-mode'.")
+
+(defun go-ts-mode--imenu ()
+  "Return Imenu alist for the current buffer."
+  (let* ((node (treesit-buffer-root-node))
+         (func-tree (treesit-induce-sparse-tree
+                     node "function_declaration" nil 1000))
+         (type-tree (treesit-induce-sparse-tree
+                     node "type_spec" nil 1000))
+         (func-index (go-ts-mode--imenu-1 func-tree))
+         (type-index (go-ts-mode--imenu-1 type-tree)))
+    (append
+     (when func-index `(("Function" . ,func-index)))
+     (when type-index `(("Type" . ,type-index))))))
+
+(defun go-ts-mode--imenu-1 (node)
+  "Helper for `go-ts-mode--imenu'.
+Find string representation for NODE and set marker, then recurse
+the subtrees."
+  (let* ((ts-node (car node))
+         (children (cdr node))
+         (subtrees (mapcan #'go-ts-mode--imenu-1
+                           children))
+         (name (when ts-node
+                 (treesit-node-text
+                  (pcase (treesit-node-type ts-node)
+                    ("function_declaration"
+                     (treesit-node-child-by-field-name ts-node "name"))
+                    ("type_spec"
+                     (treesit-node-child-by-field-name ts-node "name"))))))
+         (marker (when ts-node
+                   (set-marker (make-marker)
+                               (treesit-node-start ts-node)))))
+    (cond
+     ((or (null ts-node) (null name)) subtrees)
+     (subtrees
+      `((,name ,(cons name marker) ,@subtrees)))
+     (t
+      `((,name . ,marker))))))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode))
+
+;;;###autoload
+(define-derived-mode go-ts-mode prog-mode "Go"
+  "Major mode for editing Go, powered by tree-sitter."
+  :group 'go
+  :syntax-table go-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'go)
+    (treesit-parser-create 'go)
+
+    ;; Comments.
+    (setq-local comment-start "// ")
+    (setq-local comment-end "")
+    (setq-local comment-start-skip (rx "//" (* (syntax whitespace))))
+
+    ;; Imenu.
+    (setq-local imenu-create-index-function #'go-ts-mode--imenu)
+    (setq-local which-func-functions nil)
+
+    ;; Indent.
+    (setq-local indent-tabs-mode t
+                treesit-simple-indent-rules go-ts-mode--indent-rules)
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings go-ts-mode--font-lock-settings)
+    (setq-local treesit-font-lock-feature-list
+                '(( comment)
+                  ( keyword string type)
+                  ( constant escape-sequence function label number
+                    property variable)
+                  ( bracket delimiter error operator)))
+
+    (treesit-major-mode-setup)))
+
+;; go.mod support.
+
+(defvar go-mod-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?/   ". 124b" table)
+    (modify-syntax-entry ?\n  "> b"    table)
+    table)
+  "Syntax table for `go-mod-ts-mode'.")
+
+(defvar go-mod-ts-mode--indent-rules
+  `((gomod
+     ((node-is ")") parent-bol 0)
+     ((parent-is "exclude_directive") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "module_directive") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "replace_directive") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "require_directive") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "retract_directive") parent-bol go-ts-mode-indent-offset)
+     ((go-mod-ts-mode--in-directive-p) no-indent go-ts-mode-indent-offset)
+     (no-node no-indent 0)))
+  "Tree-sitter indent rules for `go-mod-ts-mode'.")
+
+(defun go-mod-ts-mode--in-directive-p ()
+  "Return non-nil if inside a directive.
+When entering an empty directive or adding a new entry to one, no node
+will be present meaning none of the indentation rules will match,
+because there is no parent to match against.  This function determines
+what the parent of the node would be if it were a node."
+  (lambda (node _ _ &rest _)
+    (unless (treesit-node-type node)
+      (save-excursion
+        (backward-up-list)
+        (back-to-indentation)
+        (pcase (treesit-node-type (treesit-node-at (point)))
+          ("exclude" t)
+          ("module" t)
+          ("replace" t)
+          ("require" t)
+          ("retract" t))))))
+
+(defvar go-mod-ts-mode--keywords
+  '("exclude" "go" "module" "replace" "require" "retract")
+  "go.mod keywords for tree-sitter font-locking.")
+
+(defvar go-mod-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'gomod
+   :feature 'bracket
+   '((["(" ")"]) @font-lock-bracket-face)
+
+   :language 'gomod
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
+
+   :language 'gomod
+   :feature 'keyword
+   `([,@go-mod-ts-mode--keywords] @font-lock-keyword-face)
+
+   :language 'gomod
+   :feature 'number
+   '([(go_version) (version)] @font-lock-number-face)
+
+   :language 'gomod
+   :feature 'operator
+   '((["=>"]) @font-lock-operator-face)
+
+   :language 'gomod
+   :feature 'error
+   :override t
+   '((ERROR) @font-lock-warning-face))
+  "Tree-sitter font-lock settings for `go-mod-ts-mode'.")
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode))
+
+;;;###autoload
+(define-derived-mode go-mod-ts-mode prog-mode "Go Mod"
+  "Major mode for editing go.mod files, powered by tree-sitter."
+  :group 'go
+  :syntax-table go-mod-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'gomod)
+    (treesit-parser-create 'gomod)
+
+    ;; Comments.
+    (setq-local comment-start "// ")
+    (setq-local comment-end "")
+    (setq-local comment-start-skip (rx "//" (* (syntax whitespace))))
+
+    ;; Indent.
+    (setq-local indent-tabs-mode t
+                treesit-simple-indent-rules go-mod-ts-mode--indent-rules)
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings go-mod-ts-mode--font-lock-settings)
+    (setq-local treesit-font-lock-feature-list
+                '((comment)
+                  (keyword)
+                  (number)
+                  (bracket error operator)))
+
+    (treesit-major-mode-setup)))
+
+(provide 'go-ts-mode)
+
+;;; go-ts-mode.el ends here
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 2446e86abb..35cac43bee 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -1254,6 +1254,10 @@ or not."
                                          nil default-directory t))
                (confirm (equal current-prefix-arg '(4))))
           (list regexp files dir confirm))))))
+  ;; If called non-interactively, also compute the defaults if we
+  ;; haven't already.
+  (unless grep-find-template
+    (grep-compute-defaults))
   (when (and (stringp regexp) (> (length regexp) 0))
     (unless (and dir (file-accessible-directory-p dir))
       (setq dir default-directory))
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 9b7d7a0535..6ffcf497b9 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -250,6 +250,9 @@ Used to gray out relevant toolbar icons.")
      :button (:toggle . gud-tooltip-mode)]
     ["Info (debugger)" gud-goto-info]))
 
+(setf (alist-get 'gud-minor-mode minor-mode-map-alist)
+      gud-minor-mode-map)
+
 (defvar gud-tool-bar-map
   (let ((map (make-sparse-keymap)))
     (dolist (x '((gud-break . "gud/break")
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index cd2fc7c707..395c51d542 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -133,7 +133,7 @@
 ;;   limited to comments only and occurs only when a comment
 ;;   paragraph is filled via `idlwave-fill-paragraph'.
 ;;
-;;   Muti-statement lines (using "&") on block begin and end lines can
+;;   Multi-statement lines (using "&") on block begin and end lines can
 ;;   ruin the formatting.  For example, multiple end statements on a
 ;;   line: endif & endif.  Using "&" outside of block begin/end lines
 ;;   should be okay.
diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el
index ee2934f53c..bd6a8aa474 100644
--- a/lisp/progmodes/java-ts-mode.el
+++ b/lisp/progmodes/java-ts-mode.el
@@ -9,19 +9,18 @@
 
 ;; 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.
 
-;; 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 <http://www.gnu.org/licenses/>.
-
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 ;;
@@ -29,6 +28,7 @@
 ;;; Code:
 
 (require 'treesit)
+(eval-when-compile (require 'rx))
 
 (declare-function treesit-parser-create "treesit.c")
 (declare-function treesit-induce-sparse-tree "treesit.c")
@@ -57,6 +57,11 @@
     (modify-syntax-entry ?|  "."     table)
     (modify-syntax-entry ?\' "\""    table)
     (modify-syntax-entry ?\240 "."   table)
+    (modify-syntax-entry ?/  ". 124b" table)
+    (modify-syntax-entry ?*  ". 23"   table)
+    (modify-syntax-entry ?\n "> b"  table)
+    (modify-syntax-entry ?\^m "> b" table)
+    (modify-syntax-entry ?@ "'" table)
     table)
   "Syntax table for `java-ts-mode'.")
 
@@ -68,6 +73,7 @@
      ((node-is "]") parent-bol 0)
      ((and (parent-is "comment") comment-end) comment-start -1)
      ((parent-is "comment") comment-start-skip 0)
+     ((parent-is "text_block") no-indent)
      ((parent-is "class_body") parent-bol java-ts-mode-indent-offset)
      ((parent-is "interface_body") parent-bol java-ts-mode-indent-offset)
      ((parent-is "constructor_body") parent-bol java-ts-mode-indent-offset)
@@ -80,6 +86,7 @@
      ((parent-is "method_invocation") parent-bol java-ts-mode-indent-offset)
      ((parent-is "switch_rule") parent-bol java-ts-mode-indent-offset)
      ((parent-is "ternary_expression") parent-bol java-ts-mode-indent-offset)
+     ((parent-is "lambda_expression") parent-bol java-ts-mode-indent-offset)
      ((parent-is "element_value_array_initializer") parent-bol 
java-ts-mode-indent-offset)
      ((parent-is "function_definition") parent-bol 0)
      ((parent-is "conditional_expression") first-sibling 0)
@@ -113,14 +120,14 @@
     "static" "strictfp" "switch" "synchronized"
     "throw" "throws" "to" "transient" "transitive"
     "try" "uses" "volatile" "while" "with" "record")
-  "C keywords for tree-sitter font-locking.")
+  "Java keywords for tree-sitter font-locking.")
 
 (defvar java-ts-mode--operators
   '("+" ":" "++" "-" "--" "&" "&&" "|" "||" "="
     "!=" "==" "*" "/" "%" "<" "<=" ">" ">="
     "-=" "+=" "*=" "/=" "%=" "->" "^" "^="
     "|=" "~" ">>" ">>>" "<<" "::" "?" "&=")
-  "C operators for tree-sitter font-locking.")
+  "Java operators for tree-sitter font-locking.")
 
 (defvar java-ts-mode--font-lock-settings
   (treesit-font-lock-rules
@@ -138,9 +145,10 @@
    :language 'java
    :override t
    :feature 'keyword
-   `([,@java-ts-mode--keywords] @font-lock-keyword-face
-     (labeled_statement
-      (identifier) @font-lock-keyword-face))
+   `([,@java-ts-mode--keywords
+      (this)] @font-lock-keyword-face
+      (labeled_statement
+       (identifier) @font-lock-keyword-face))
    :language 'java
    :override t
    :feature 'operator
@@ -157,7 +165,8 @@
    :language 'java
    :override t
    :feature 'string
-   `((string_literal) @font-lock-string-face)
+   `((string_literal) @font-lock-string-face
+     (text_block) @font-lock-string-face)
    :language 'java
    :override t
    :feature 'literal
@@ -237,7 +246,7 @@
    :language 'java
    :feature 'delimiter
    '((["," ":" ";"]) @font-lock-delimiter-face))
-  "Tree-sitter font-lock settings.")
+  "Tree-sitter font-lock settings for `java-ts-mode'.")
 
 (defun java-ts-mode--imenu-1 (node)
   "Helper for `java-ts-mode--imenu'.
@@ -299,10 +308,19 @@ the subtrees."
 
   ;; Comments.
   (setq-local comment-start "// ")
-  (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
   (setq-local comment-end "")
-  (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*"))))
-  (setq-local treesit-comment-end (rx (+ (or "*")) "/"))
+  (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                         (seq "/" (+ "*")))
+                                     (* (syntax whitespace))))
+  (setq-local comment-end-skip
+              (rx (* (syntax whitespace))
+                  (group (or (syntax comment-end)
+                             (seq (+ "*") "/")))))
+
+  (setq-local treesit-text-type-regexp
+              (regexp-opt '("line_comment"
+                            "block_comment"
+                            "text_block")))
 
   ;; Indent.
   (setq-local treesit-simple-indent-rules java-ts-mode--indent-rules)
@@ -312,14 +330,23 @@ the subtrees."
               (append "{}():;," electric-indent-chars))
 
   ;; Navigation.
-  (setq-local treesit-defun-type-regexp "declaration")
+  (setq-local treesit-defun-type-regexp
+              (regexp-opt '("method_declaration"
+                            "class_declaration"
+                            "record_declaration"
+                            "interface_declaration"
+                            "enum_declaration"
+                            "import_declaration"
+                            "package_declaration"
+                            "module_declaration")))
 
   ;; Font-lock.
   (setq-local treesit-font-lock-settings java-ts-mode--font-lock-settings)
   (setq-local treesit-font-lock-feature-list
-              '((comment constant keyword string)
-                (annotation definition expression literal type)
-                (bracket delimiter operator)))
+              '(( comment definition )
+                ( constant keyword string type)
+                ( annotation expression literal)
+                ( bracket delimiter operator)))
 
   ;; Imenu.
   (setq-local imenu-create-index-function #'java-ts-mode--imenu)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index da05b7b364..cbcca81baa 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -686,7 +686,7 @@ This variable is like `sgml-attribute-offset'."
     (modify-syntax-entry ?$ "_" table)
     (modify-syntax-entry ?` "\"" table)
     table)
-  "Syntax table for `js-mode'.")
+  "Syntax table for `js-mode' and `js-ts-mode'.")
 
 (defvar-local js--quick-match-re nil
   "Autogenerated regexp used by `js-mode' to match buffer constructs.")
@@ -1928,7 +1928,7 @@ This performs fontification according to 
`js--class-styles'."
 ;; identified as such), then the `syntax-propertize' region won’t be
 ;; extended backwards to the start of the JSXOpeningElement:
 ;;
-;;   <div         ← This line wasn’t JSX when last edited.
+;;   <div         ← This line wasn't JSX when last edited.
 ;;     attr="">   ← Despite completing the JSX, the next
 ;;             ^    `syntax-propertize' region wouldn’t magically
 ;;                  extend back a few lines.
@@ -2090,7 +2090,7 @@ JSXElement or a JSXOpeningElement/JSXClosingElement pair."
                         ;; JSXOpeningElement has been found, so keep
                         ;; looking backwards for an enclosing one).
                         (or (not close-tag-pos) (<= start 
close-tag-pos)))))))))
-      ;; Don’t return the last tag pos, as it wasn’t enclosing.
+      ;; Don't return the last tag pos, as it wasn't enclosing.
       (setq tag-beg nil close-tag-pos nil))
     (and tag-beg (list tag-beg-pos tag-end-pos close-tag-pos))))
 
@@ -3445,17 +3445,19 @@ This function is intended for use in 
`after-change-functions'."
        ((parent-is "pair") parent-bol js-indent-level)
        ((parent-is "arrow_function") parent-bol js-indent-level)
        ((parent-is "parenthesized_expression") parent-bol js-indent-level)
+       ((parent-is "binary_expression") parent-bol js-indent-level)
        ((parent-is "class_body") parent-bol js-indent-level)
        ((parent-is ,switch-case) parent-bol js-indent-level)
        ((parent-is "statement_block") parent-bol js-indent-level)
 
        ;; JSX
-       ((parent-is "jsx_opening_element") parent js-indent-level)
+       ((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset)
+       ((node-is "jsx_element") parent typescript-ts-mode-indent-offset)
+       ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset)
+       ((node-is "jsx_self_closing_element") parent 
typescript-ts-mode-indent-offset)
        ((node-is "jsx_closing_element") parent 0)
-       ((node-is "jsx_text") parent js-indent-level)
-       ((parent-is "jsx_element") parent js-indent-level)
        ((node-is "/") parent 0)
-       ((parent-is "jsx_self_closing_element") parent js-indent-level)))))
+       ((node-is ">") parent 0)))))
 
 (defvar js--treesit-keywords
   '("as" "async" "await" "break" "case" "catch" "class" "const" "continue"
@@ -3543,6 +3545,20 @@ This function is intended for use in 
`after-change-functions'."
      (arrow_function
       parameter: (identifier) @font-lock-variable-name-face))
 
+   :language 'javascript
+   :override t
+   :feature 'property
+   ;; This needs to be before function-name feature, because methods
+   ;; can be both property and function-name, and we want them in
+   ;; function-name face.
+   `((property_identifier) @font-lock-property-face
+
+     (pair value: (identifier) @font-lock-variable-name-face)
+
+     ((shorthand_property_identifier) @font-lock-property-face)
+
+     ((shorthand_property_identifier_pattern) @font-lock-property-face))
+
    :language 'javascript
    :override t
    :feature 'expression
@@ -3611,18 +3627,7 @@ This function is intended for use in 
`after-change-functions'."
    :language 'javascript
    :feature 'escape-sequence
    :override t
-   '((escape_sequence) @font-lock-escape-face)
-
-   :language 'javascript
-   :override t
-   :feature 'property
-   `((property_identifier) @font-lock-property-face
-
-     (pair value: (identifier) @font-lock-variable-name-face)
-
-     ((shorthand_property_identifier) @font-lock-property-face)
-
-     ((shorthand_property_identifier_pattern) @font-lock-property-face)))
+   '((escape_sequence) @font-lock-escape-face))
   "Tree-sitter font-lock settings.")
 
 (defun js--fontify-template-string (node override start end &rest _)
@@ -3647,7 +3652,7 @@ OVERRIDE is the override flag described in
         (setq font-beg (max start font-beg))
         (when (< font-beg end)
           (treesit-fontify-with-override
-           font-beg font-end 'font-lock-string-face override)))
+           font-beg font-end 'font-lock-string-face override start end)))
       (setq font-beg (treesit-node-end child)
             child (treesit-node-next-sibling child)))))
 
@@ -3734,7 +3739,7 @@ definition*\"."
          (var-tree (treesit-induce-sparse-tree
                     node "lexical_declaration" nil 1000)))
     `(("Class" . ,(js--treesit-imenu-1 class-tree))
-      ("Varieable" . ,(js--treesit-imenu-1 var-tree))
+      ("Variable" . ,(js--treesit-imenu-1 var-tree))
       ("Function" . ,(js--treesit-imenu-1 func-tree)))))
 
 ;;; Main Function
@@ -3840,6 +3845,7 @@ Currently there are `js-mode' and `js-ts-mode'."
 
 \\<js-ts-mode-map>"
   :group 'js
+  :syntax-table js-mode-syntax-table
   (when (treesit-ready-p 'javascript)
     ;; Borrowed from `js-mode'.
     (setq-local prettify-symbols-alist js--prettify-symbols-alist)
@@ -3848,11 +3854,20 @@ Currently there are `js-mode' and `js-ts-mode'."
     (setq-local which-func-imenu-joiner-function #'js--which-func-joiner)
     ;; Comment.
     (setq-local comment-start "// ")
-    (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
     (setq-local comment-end "")
+    (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                           (seq "/" (+ "*")))
+                                       (* (syntax whitespace))))
+    (setq-local comment-end-skip
+                (rx (* (syntax whitespace))
+                    (group (or (syntax comment-end)
+                               (seq (+ "*") "/")))))
     (setq-local comment-multi-line t)
-    (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*"))))
-    (setq-local treesit-comment-end (rx (+ (or "*")) "/"))
+
+    (setq-local treesit-text-type-regexp
+                (regexp-opt '("comment"
+                              "template_string")))
+
     ;; Electric-indent.
     (setq-local electric-indent-chars
                (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds 
"[]*".
@@ -3864,6 +3879,7 @@ Currently there are `js-mode' and `js-ts-mode'."
     ;; Indent.
     (setq-local treesit-simple-indent-rules js--treesit-indent-rules)
     ;; Navigation.
+    (setq-local treesit-defun-prefer-top-level t)
     (setq-local treesit-defun-type-regexp
                 (rx (or "class_declaration"
                         "method_definition"
@@ -3873,9 +3889,10 @@ Currently there are `js-mode' and `js-ts-mode'."
     (setq-local treesit-font-lock-settings js--treesit-font-lock-settings)
     (setq-local treesit-font-lock-feature-list
                 '(( comment declaration)
-                  ( constant expression identifier keyword number string)
-                  ( bracket delimiter escape-sequence jsx operator
-                    pattern property)))
+                  ( keyword string)
+                  ( constant escape-sequence expression
+                    identifier jsx number pattern property)
+                  ( bracket delimiter operator)))
     ;; Imenu
     (setq-local imenu-create-index-function
                 #'js--treesit-imenu)
diff --git a/lisp/progmodes/json-ts-mode.el b/lisp/progmodes/json-ts-mode.el
index 101e873cf6..6c2f380587 100644
--- a/lisp/progmodes/json-ts-mode.el
+++ b/lisp/progmodes/json-ts-mode.el
@@ -9,19 +9,18 @@
 
 ;; 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.
 
-;; 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 <http://www.gnu.org/licenses/>.
-
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 ;;
@@ -46,9 +45,7 @@
 
 (defvar json-ts-mode--syntax-table
   (let ((table (make-syntax-table)))
-    ;; Taken from the cc-langs version
     (modify-syntax-entry ?_  "_"     table)
-    (modify-syntax-entry ?$ "_"      table)
     (modify-syntax-entry ?\\ "\\"    table)
     (modify-syntax-entry ?+  "."     table)
     (modify-syntax-entry ?-  "."     table)
@@ -58,8 +55,12 @@
     (modify-syntax-entry ?>  "."     table)
     (modify-syntax-entry ?&  "."     table)
     (modify-syntax-entry ?|  "."     table)
-    (modify-syntax-entry ?` "\""     table)
+    (modify-syntax-entry ?\' "\""    table)
     (modify-syntax-entry ?\240 "."   table)
+    (modify-syntax-entry ?/  ". 124b" table)
+    (modify-syntax-entry ?*  ". 23"   table)
+    (modify-syntax-entry ?\n "> b"  table)
+    (modify-syntax-entry ?\^m "> b" table)
     table)
   "Syntax table for `json-ts-mode'.")
 
@@ -69,10 +70,14 @@
      ((node-is "}") parent-bol 0)
      ((node-is ")") parent-bol 0)
      ((node-is "]") parent-bol 0)
-     ((parent-is "object") parent-bol json-ts-mode-indent-offset))))
+     ((parent-is "object") parent-bol json-ts-mode-indent-offset)
+     ((parent-is "array") parent-bol json-ts-mode-indent-offset))))
 
 (defvar json-ts-mode--font-lock-settings
   (treesit-font-lock-rules
+   :language 'json
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
    :language 'json
    :feature 'bracket
    '((["[" "]" "{" "}"]) @font-lock-bracket-face)
@@ -93,6 +98,10 @@
    :override t
    '((escape_sequence) @font-lock-escape-face)
    :language 'json
+   :feature 'pair
+   :override t ; Needed for overriding string face on keys.
+   '((pair key: (_) @font-lock-variable-name-face))
+   :language 'json
    :feature 'error
    :override t
    '((ERROR) @font-lock-warning-face))
@@ -156,7 +165,7 @@ the subtrees."
   ;; Font-lock.
   (setq-local treesit-font-lock-settings json-ts-mode--font-lock-settings)
   (setq-local treesit-font-lock-feature-list
-              '((constant number string)
+              '((comment constant number pair string)
                 (escape-sequence)
                 (bracket delimiter error)))
 
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 58cb48f182..aa37a4ac86 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -30,7 +30,12 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib)
-                   (require 'subr-x))
+                   (require 'subr-x)
+                   (require 'treesit))
+
+(declare-function treesit-available-p "treesit.c")
+(declare-function treesit-parser-list "treesit.c")
+(declare-function treesit-node-type "treesit.c")
 
 (defgroup prog-mode nil
   "Generic programming mode, from which others derive."
@@ -102,7 +107,8 @@
 
 (defvar-keymap prog-mode-map
   :doc "Keymap used for programming modes."
-  "C-M-q" #'prog-indent-sexp)
+  "C-M-q" #'prog-indent-sexp
+  "M-q" #'prog-fill-reindent-defun)
 
 (defvar prog-indentation-context nil
   "When non-nil, provides context for indenting embedded code chunks.
@@ -140,6 +146,33 @@ instead."
          (end (progn (forward-sexp 1) (point))))
       (indent-region start end nil))))
 
+(defun prog-fill-reindent-defun (&optional argument)
+  "Refill or reindent the paragraph or defun that contains point.
+
+If the point is in a string or a comment, fill the paragraph that
+contains point or follows point.
+
+Otherwise, reindent the function definition that contains point
+or follows point."
+  (interactive "P")
+  (save-excursion
+    (let ((treesit-text-node
+           (and (treesit-available-p)
+                (treesit-parser-list)
+                (string-match-p
+                 treesit-text-type-regexp
+                 (treesit-node-type (treesit-node-at (point)))))))
+      (if (or treesit-text-node
+              (nth 8 (syntax-ppss))
+              (re-search-forward comment-start-skip (line-end-position) t))
+          (if (memq fill-paragraph-function '(t nil))
+              (lisp-fill-paragraph argument)
+            (funcall fill-paragraph-function argument))
+        (beginning-of-defun)
+        (let ((start (point)))
+          (end-of-defun)
+          (indent-region start (point) nil))))))
+
 (defun prog-first-column ()
   "Return the indentation column normally used for top-level constructs."
   (or (car prog-indentation-context) 0))
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index c7b2c386cc..559da6dd64 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1,7 +1,7 @@
 ;;; project.el --- Operations on the current project  -*- lexical-binding: t; 
-*-
 
 ;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
-;; Version: 0.8.3
+;; Version: 0.9.3
 ;; Package-Requires: ((emacs "26.1") (xref "1.4.0"))
 
 ;; This is a GNU ELPA :core package.  Avoid using functionality that
@@ -58,13 +58,30 @@
 ;;
 ;; This list can change in future versions.
 ;;
-;; VC project:
+;; Transient project:
+;;
+;; An instance of this type can be returned by `project-current' if no
+;; project was detected automatically, and the user had to pick a
+;; directory manually.  The fileset it describes is the whole
+;; directory, with the exception of some standard ignored files and
+;; directories.  This type has little purpose otherwise, as the only
+;; generic function it provides an override for is `project-root'.
+;;
+;; VC-aware project:
 ;;
 ;; Originally conceived as an example implementation, now it's a
 ;; relatively fast backend that delegates to 'git ls-files' or 'hg
 ;; status' to list the project's files.  It honors the VC ignore
 ;; files, but supports additions to the list using the user option
-;; `project-vc-ignores' (usually through .dir-locals.el).
+;; `project-vc-ignores' (usually through .dir-locals.el).  See the
+;; customization group `project-vc' for other options that control its
+;; behavior.
+;;
+;; If the repository is using any other VCS than Git or Hg, the file
+;; listing uses the default mechanism based on `find-program'.
+;;
+;; This project type can also be used for non-VCS controlled
+;; directories, see the variable `project-vc-extra-root-markers'.
 ;;
 ;; Utils:
 ;;
@@ -157,6 +174,7 @@
 ;;; Code:
 
 (require 'cl-generic)
+(require 'cl-lib)
 (require 'seq)
 (eval-when-compile (require 'subr-x))
 
@@ -175,8 +193,14 @@ function; the only practical limitation is to use values 
that
 `cl-defmethod' can dispatch on, like a cons cell, or a list, or a
 CL struct.")
 
-(defvar project-current-inhibit-prompt nil
-  "Non-nil to skip prompting the user in `project-current'.")
+(define-obsolete-variable-alias
+  'project-current-inhibit-prompt
+  'project-current-directory-override
+  "29.1")
+
+(defvar project-current-directory-override nil
+  "Value to use instead of `default-directory' when detecting the project.
+When it is non-nil, `project-current' will always skip prompting too.")
 
 ;;;###autoload
 (defun project-current (&optional maybe-prompt directory)
@@ -190,16 +214,17 @@ project instance.
 
 The \"transient\" project instance is a special kind of value
 which denotes a project rooted in that directory and includes all
-the files under the directory except for those that should be
-ignored (per `project-ignores').
+the files under the directory except for those that match entries
+in `vc-directory-exclusion-list' or `grep-find-ignored-files'.
 
 See the doc string of `project-find-functions' for the general form
 of the project instance object."
-  (unless directory (setq directory default-directory))
+  (unless directory (setq directory (or project-current-directory-override
+                                        default-directory)))
   (let ((pr (project--find-in-directory directory)))
     (cond
      (pr)
-     ((unless project-current-inhibit-prompt
+     ((unless project-current-directory-override
         maybe-prompt)
       (setq directory (project-prompt-project-dir)
             pr (project--find-in-directory directory))))
@@ -254,7 +279,7 @@ headers search path, load path, class path, and so on."
 (cl-defgeneric project-name (project)
   "A human-readable name for the project.
 Nominally unique, but not enforced."
-  (file-name-base (directory-file-name (project-root project))))
+  (file-name-nondirectory (directory-file-name (project-root project))))
 
 (cl-defgeneric project-ignores (_project _dir)
   "Return the list of glob patterns to ignore inside DIR.
@@ -370,7 +395,7 @@ the buffer's value of `default-directory'."
     (nreverse bufs)))
 
 (defgroup project-vc nil
-  "Project implementation based on the VC package."
+  "VC-aware project implementation."
   :version "25.1"
   :group 'project)
 
@@ -390,20 +415,50 @@ you might have to restart Emacs to see the effect."
   :safe #'booleanp)
 
 (defcustom project-vc-include-untracked t
-  "When non-nil, the VC project backend includes untracked files."
+  "When non-nil, the VC-aware project backend includes untracked files."
   :type 'boolean
   :version "29.1"
   :safe #'booleanp)
 
 (defcustom project-vc-name nil
-  "When non-nil, the name of the current VC project.
+  "When non-nil, the name of the current VC-aware project.
 
-The best way to change the value a VC project reports as its
-name, is by setting this in .dir-locals.el."
-  :type 'string
+The best way to change the value a VC-aware project reports as
+its name, is by setting this in .dir-locals.el."
+  :type '(choice (const :tag "Default to the base name" nil)
+                 (string :tag "Custom name"))
   :version "29.1"
+  :package-version '(project . "0.9.0")
   :safe #'stringp)
 
+;; Not using regexps because these wouldn't work in Git pathspecs, in
+;; case we decide we need to be able to list nested projects.
+(defcustom project-vc-extra-root-markers nil
+  "List of additional markers to signal project roots.
+
+A marker is either a base file name or a glob pattern for such.
+
+A directory containing such a marker file or a file matching a
+marker pattern will be recognized as the root of a VC-aware
+project.
+
+Example values: \".dir-locals.el\", \"package.json\", \"pom.xml\",
+\"requirements.txt\", \"Gemfile\", \"*.gemspec\", \"autogen.sh\".
+
+These will be used in addition to regular directory markers such
+as \".git\", \".hg\", and so on, depending on the value of
+`vc-handled-backends'.  It is most useful when a project has
+subdirectories inside it that need to be considered as separate
+projects.  It can also be used for projects outside of VC
+repositories.
+
+In either case, their behavior will still obey the relevant
+variables, such as `project-vc-ignores' or `project-vc-name'."
+  :type '(repeat string)
+  :version "29.1"
+  :package-version '(project . "0.9.0")
+  :safe (lambda (val) (and (listp val) (cl-every #'stringp val))))
+
 ;; FIXME: Using the current approach, major modes are supposed to set
 ;; this variable to a buffer-local value.  So we don't have access to
 ;; the "external roots" of language A from buffers of language B, which
@@ -412,7 +467,7 @@ name, is by setting this in .dir-locals.el."
 ;;
 ;; We could add a second argument to this function: a file extension,
 ;; or a language name.  Some projects will know the set of languages
-;; used in them; for others, like VC-based projects, we'll need
+;; used in them; for others, like the VC-aware type, we'll need
 ;; auto-detection.  I see two options:
 ;;
 ;; - That could be implemented as a separate second hook, with a
@@ -436,32 +491,56 @@ name, is by setting this in .dir-locals.el."
 It should return a list of directory roots that contain source
 files related to the current buffer.
 
-The directory names should be absolute.  Used in the VC project
-backend implementation of `project-external-roots'.")
+The directory names should be absolute.  Used in the VC-aware
+project backend implementation of `project-external-roots'.")
 
 (defun project-try-vc (dir)
+  (defvar vc-svn-admin-directory)
+  (require 'vc-svn)
+  ;; FIXME: Learn to invalidate when the value of
+  ;; `project-vc-merge-submodules' or `project-vc-extra-root-markers'
+  ;; changes.
   (or (vc-file-getprop dir 'project-vc)
-      (let* ((backend (ignore-errors (vc-responsible-backend dir)))
+      (let* ((backend-markers-alist `((Git . ".git")
+                                      (Hg . ".hg")
+                                      (Bzr . ".bzr")
+                                      (SVN . ,vc-svn-admin-directory)
+                                      (DARCS . "_darcs")
+                                      (Fossil . ".fslckout")))
+             (backend-markers
+              (delete
+               nil
+               (mapcar
+                (lambda (b) (assoc-default b backend-markers-alist))
+                vc-handled-backends)))
+             (marker-re
+              (mapconcat
+               (lambda (m) (format "\\(%s\\)" (wildcard-to-regexp m)))
+               (append backend-markers
+                       (project--value-in-dir 'project-vc-extra-root-markers 
dir))
+               "\\|"))
+             (locate-dominating-stop-dir-regexp
+              (or vc-ignore-dir-regexp locate-dominating-stop-dir-regexp))
+             last-matches
              (root
-              (pcase backend
-                ('Git
-                 ;; Don't stop at submodule boundary.
-                 (or (vc-file-getprop dir 'project-git-root)
-                     (let ((root (vc-call-backend backend 'root dir)))
-                       (vc-file-setprop
-                        dir 'project-git-root
-                        (if (and
-                             ;; FIXME: Invalidate the cache when the value
-                             ;; of this variable changes.
-                             (project--vc-merge-submodules-p root)
-                             (project--submodule-p root))
-                            (let* ((parent (file-name-directory
-                                            (directory-file-name root))))
-                              (vc-call-backend backend 'root parent))
-                          root)))))
-                ('nil nil)
-                (_ (ignore-errors (vc-call-backend backend 'root dir)))))
+              (locate-dominating-file
+               dir
+               (lambda (d)
+                 ;; Maybe limit count to 100 when we can drop Emacs < 28.
+                 (setq last-matches (directory-files d nil marker-re t)))))
+             (backend
+              (cl-find-if
+               (lambda (b)
+                 (member (assoc-default b backend-markers-alist)
+                         last-matches))
+               vc-handled-backends))
              project)
+        (when (and
+               (eq backend 'Git)
+               (project--vc-merge-submodules-p root)
+               (project--submodule-p root))
+          (let* ((parent (file-name-directory (directory-file-name root))))
+            (setq root (vc-call-backend 'Git 'root parent))))
         (when root
           (setq project (list 'vc backend root))
           ;; FIXME: Cache for a shorter time.
@@ -505,10 +584,11 @@ backend implementation of `project-external-roots'.")
 (cl-defmethod project-files ((project (head vc)) &optional dirs)
   (mapcan
    (lambda (dir)
-     (let ((ignores (project--value-in-dir 'project-vc-ignores dir))
-           backend)
+     (let ((ignores (project--value-in-dir 'project-vc-ignores (nth 2 
project)))
+           (backend (cadr project)))
+       (when backend
+         (require (intern (concat "vc-" (downcase (symbol-name backend))))))
        (if (and (file-equal-p dir (nth 2 project))
-                (setq backend (cadr project))
                 (cond
                  ((eq backend 'Hg))
                  ((and (eq backend 'Git)
@@ -530,13 +610,16 @@ backend implementation of `project-external-roots'.")
   (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)
+     (let* ((default-directory (expand-file-name (file-name-as-directory dir)))
+            (args '("-z"))
+            (vc-git-use-literal-pathspecs nil)
+            (include-untracked (project--value-in-dir
+                                'project-vc-include-untracked
+                                dir))
+            files)
        (setq args (append args
                           '("-c" "--exclude-standard")
-                          (and project-vc-include-untracked '("-o"))))
+                          (and include-untracked '("-o"))))
        (when extra-ignores
          (setq args (append args
                             (cons "--"
@@ -587,10 +670,13 @@ backend implementation of `project-external-roots'.")
        ;; XXX: Better solutions welcome, but this seems cheap enough.
        (delete-consecutive-dups files)))
     (`Hg
-     (let ((default-directory (expand-file-name (file-name-as-directory dir)))
-           (args (list (concat "-mcard" (and project-vc-include-untracked "u"))
-                       "--no-status"
-                       "-0")))
+     (let* ((default-directory (expand-file-name (file-name-as-directory dir)))
+            (include-untracked (project--value-in-dir
+                                'project-vc-include-untracked
+                                dir))
+            (args (list (concat "-mcard" (and include-untracked "u"))
+                        "--no-status"
+                        "-0")))
        (when extra-ignores
          (setq args (nconc args
                            (mapcan
@@ -624,7 +710,8 @@ backend implementation of `project-external-roots'.")
   (let* ((root (nth 2 project))
          backend)
     (append
-     (when (file-equal-p dir root)
+     (when (and backend
+                (file-equal-p dir root))
        (setq backend (cadr project))
        (delq
         nil
@@ -952,11 +1039,22 @@ by the user at will."
          (_ (when included-cpd
               (setq substrings (cons "./" substrings))))
          (new-collection (project--file-completion-table substrings))
-         (res (project--completing-read-strict prompt
-                                               new-collection
-                                               predicate
-                                               hist mb-default)))
-    (concat common-parent-directory res)))
+         (abbr-cpd (abbreviate-file-name common-parent-directory))
+         (relname (cl-letf ((history-add-new-input nil)
+                            ((symbol-value hist)
+                             (mapcan
+                              (lambda (s)
+                                (and (string-prefix-p abbr-cpd s)
+                                     (list (substring s (length abbr-cpd)))))
+                              (symbol-value hist))))
+                    (project--completing-read-strict prompt
+                                                     new-collection
+                                                     predicate
+                                                     hist mb-default)))
+         (absname (expand-file-name relname common-parent-directory)))
+    (when (and hist history-add-new-input)
+      (add-to-history hist (abbreviate-file-name absname)))
+    absname))
 
 (defun project--read-file-absolute (prompt
                                     all-files &optional predicate
@@ -1250,18 +1348,33 @@ By default, all project buffers are listed except those 
whose names
 start with a space (which are for internal use).  With prefix argument
 ARG, show only buffers that are visiting files."
   (interactive "P")
-  (let ((pr (project-current t)))
+  (let* ((pr (project-current t))
+         (buffer-list-function
+          (lambda ()
+            (seq-filter
+             (lambda (buffer)
+               (let ((name (buffer-name buffer))
+                     (file (buffer-file-name buffer)))
+                 (and (or (not (string= (substring name 0 1) " "))
+                          file)
+                      (not (eq buffer (current-buffer)))
+                      (or file (not Buffer-menu-files-only)))))
+             (project-buffers pr)))))
     (display-buffer
      (if (version< emacs-version "29.0.50")
-         (let ((buf (list-buffers-noselect arg (project-buffers pr))))
+         (let ((buf (list-buffers-noselect
+                     arg (with-current-buffer
+                             (get-buffer-create "*Buffer List*")
+                           (let ((Buffer-menu-files-only arg))
+                             (funcall buffer-list-function))))))
            (with-current-buffer buf
              (setq-local revert-buffer-function
                          (lambda (&rest _ignored)
-                           (list-buffers--refresh (project-buffers pr))
+                           (list-buffers--refresh
+                            (funcall buffer-list-function))
                            (tabulated-list-print t))))
            buf)
-       (list-buffers-noselect
-        arg nil (lambda (buf) (memq buf (project-buffers pr))))))))
+       (list-buffers-noselect arg buffer-list-function)))))
 
 (defcustom project-kill-buffer-conditions
   '(buffer-file-name    ; All file-visiting buffers are included.
@@ -1698,10 +1811,8 @@ to directory DIR."
   (let ((command (if (symbolp project-switch-commands)
                      project-switch-commands
                    (project--switch-project-command))))
-    (with-temp-buffer
-      (let ((default-directory dir)
-            (project-current-inhibit-prompt t))
-        (call-interactively command)))))
+    (let ((project-current-directory-override dir))
+      (call-interactively command))))
 
 (provide 'project)
 ;;; project.el ends here
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 18594a3e23..bdc9e6fa78 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -279,7 +279,7 @@
 (declare-function treesit-node-start "treesit.c")
 (declare-function treesit-node-end "treesit.c")
 (declare-function treesit-node-parent "treesit.c")
-
+(declare-function treesit-node-prev-sibling "treesit.c")
 
 (autoload 'comint-mode "comint")
 (autoload 'help-function-arglist "help-fns")
@@ -454,7 +454,7 @@ This variant of `rx' supports common Python named REGEXPS."
             (close-paren       (or "}" "]" ")"))
             (simple-operator   (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%))
             (not-simple-operator (not (or simple-operator ?\n)))
-            (operator          (or "==" ">=" "is" "not"
+            (operator          (or "==" ">="
                                    "**" "//" "<<" ">>" "<=" "!="
                                    "+" "-" "/" "&" "^" "~" "|" "*" "<" ">"
                                    "=" "%"))
@@ -791,6 +791,7 @@ sign in chained assignment."
                    (? (or ")" "]") (* sp-bsnl))
                    (group assignment-operator)))
      (1 font-lock-variable-name-face)
+     (2 'font-lock-operator-face)
      (,(python-rx grouped-assignment-target)
       (progn
         (goto-char (match-end 1))       ; go back after the first symbol
@@ -806,8 +807,9 @@ sign in chained assignment."
        (python-rx (or line-start ?\;) (* sp-bsnl)
                   grouped-assignment-target (* sp-bsnl)
                   (? ?: (* sp-bsnl) (+ not-simple-operator) (* sp-bsnl))
-                  assignment-operator))
-     (1 font-lock-variable-name-face))
+                  (group assignment-operator)))
+     (1 font-lock-variable-name-face)
+     (2 'font-lock-operator-face))
     ;; special cases
     ;;   (a) = 5
     ;;   [a] = 5,
@@ -817,8 +819,11 @@ sign in chained assignment."
                   (or "[" "(") (* sp-nl)
                   grouped-assignment-target (* sp-nl)
                   (or ")" "]") (* sp-bsnl)
-                  assignment-operator))
-     (1 font-lock-variable-name-face))
+                  (group assignment-operator)))
+     (1 font-lock-variable-name-face)
+     (2 'font-lock-operator-face))
+    ;; Operators.
+    (,(python-rx operator) . 'font-lock-operator-face)
     ;; escape sequences within bytes literals
     ;;   "\\" "\'" "\a" "\b" "\f" "\n" "\r" "\t" "\v"
     ;;   "\ooo" character with octal value ooo
@@ -962,9 +967,9 @@ It makes underscores and dots word constituent chars.")
 ;; merge with `python-font-lock-keywords-level-2'.
 
 (defvar python--treesit-keywords
-  '("as" "assert" "async" "await" "break" "class" "continue" "def"
+  '("as" "assert" "async" "await" "break" "case" "class" "continue" "def"
     "del" "elif" "else" "except" "exec" "finally" "for" "from"
-    "global" "if" "import" "lambda" "nonlocal" "pass" "print"
+    "global" "if" "import" "lambda" "match" "nonlocal" "pass" "print"
     "raise" "return" "try" "while" "with" "yield"
     ;; These are technically operators, but we fontify them as
     ;; keywords.
@@ -988,7 +993,8 @@ It makes underscores and dots word constituent chars.")
 
 (defvar python--treesit-operators
   '("-" "-=" "!=" "*" "**" "**=" "*=" "/" "//" "//=" "/=" "&" "%" "%="
-    "^" "+" "+=" "<" "<<" "<=" "<>" "=" "==" ">" ">=" ">>" "|" "~"))
+    "^" "+" "->" "+=" "<" "<<" "<=" "<>" "=" ":=" "==" ">" ">=" ">>" "|"
+    "~" "@" "@="))
 
 (defvar python--treesit-special-attributes
   '("__annotations__" "__closure__" "__code__"
@@ -1033,12 +1039,27 @@ fontified."
   (let* ((string-beg (treesit-node-start node))
          (string-end (treesit-node-end node))
          (maybe-expression (treesit-node-parent node))
-         (maybe-defun (treesit-node-parent
+         (grandparent (treesit-node-parent
                        (treesit-node-parent
                         maybe-expression)))
-         (face (if (and (member (treesit-node-type maybe-defun)
-                                '("function_definition"
-                                  "class_definition"))
+         (maybe-defun grandparent)
+         (face (if (and (or (member (treesit-node-type maybe-defun)
+                                    '("function_definition"
+                                      "class_definition"))
+                            ;; If the grandparent is null, meaning the
+                            ;; string is top-level, and the string has
+                            ;; no node or only comment preceding it,
+                            ;; it's a BOF docstring.
+                            (and (null grandparent)
+                                 (cl-loop
+                                  for prev = (treesit-node-prev-sibling
+                                              maybe-expression)
+                                  then (treesit-node-prev-sibling prev)
+                                  while prev
+                                  if (not (equal (treesit-node-type prev)
+                                                 "comment"))
+                                  return nil
+                                  finally return t)))
                         ;; This check filters out this case:
                         ;; def function():
                         ;;     return "some string"
@@ -1049,7 +1070,7 @@ fontified."
     (when (eq (char-after string-beg) ?f)
       (cl-incf string-beg))
     (treesit-fontify-with-override
-     (max start string-beg) (min end string-end) face override)))
+     string-beg string-end face override start end)))
 
 (defvar python--treesit-settings
   (treesit-font-lock-rules
@@ -1074,6 +1095,14 @@ fontified."
      (class_definition
       name: (identifier) @font-lock-type-face))
 
+   :feature 'function
+   :language 'python
+   '((function_definition
+      name: (identifier) @font-lock-function-name-face)
+     (call function: (identifier) @font-lock-function-name-face)
+     (call function: (attribute
+                      attribute: (identifier) @font-lock-function-name-face)))
+
    :feature 'keyword
    :language 'python
    `([,@python--treesit-keywords] @font-lock-keyword-face
@@ -2396,55 +2425,6 @@ position, else returns nil."
       (ignore (goto-char point)))))
 
 
-;;; Tree-sitter navigation
-
-(defun python-treesit-beginning-of-defun (&optional arg)
-  "Tree-sitter `beginning-of-defun' function.
-ARG is the same as in `beginning-of-defun'."
-  (let ((arg (or arg 1))
-        (node (treesit-node-at (point)))
-        (function-or-class (rx (or "function" "class") "_definition")))
-    (if (> arg 0)
-        ;; Go backward.
-        (while (and (> arg 0)
-                    (setq node (treesit-search-forward-goto
-                                node function-or-class t t)))
-          ;; Here we deviate from `treesit-beginning-of-defun': if
-          ;; NODE is function_definition, find the top-level
-          ;; function_definition, if NODE is class_definition, find
-          ;; the top-level class_definition, don't mix the two like
-          ;; `treesit-beginning-of-defun' would.
-          (setq node (or (treesit-node-top-level node)
-                         node))
-          (setq arg (1- arg)))
-      ;; Go forward.
-      (while (and (< arg 0)
-                  (setq node (treesit-search-forward-goto
-                              node function-or-class)))
-        (setq node (or (treesit-node-top-level node)
-                       node))
-        (setq arg (1+ arg))))
-    (when node
-      (goto-char (treesit-node-start node))
-      t)))
-
-(defun python-treesit-end-of-defun ()
-  "Tree-sitter `end-of-defun' function."
-  ;; Why not simply get the largest node at point: when point is at
-  ;; (point-min), that gives us the root node.
-  (let* ((node (treesit-node-at (point)))
-         (top-func (treesit-node-top-level
-                    node
-                    "function_definition"))
-         (top-class (treesit-node-top-level
-                     node
-                     "class_definition")))
-    ;; Prefer function_definition over class_definition: when we are
-    ;; in a function_definition inside a class_definition, jump to the
-    ;; end of function_definition.
-    (goto-char (or (treesit-node-end (or top-func top-class)) (point)))))
-
-
 ;;; Shell integration
 
 (defcustom python-shell-buffer-name "Python"
@@ -6592,19 +6572,21 @@ implementations: `python-mode' and `python-ts-mode'."
         (add-function :before-until (local 'eldoc-documentation-function)
                       #'python-eldoc-function))))
 
-  (add-to-list
-   'hs-special-modes-alist
-   `(python-mode
-     ,python-nav-beginning-of-block-regexp
-     ;; Use the empty string as end regexp so it doesn't default to
-     ;; "\\s)".  This way parens at end of defun are properly hidden.
-     ""
-     "#"
-     python-hideshow-forward-sexp-function
-     nil
-     python-nav-beginning-of-block
-     python-hideshow-find-next-block
-     python-info-looking-at-beginning-of-block))
+  ;; TODO: Use tree-sitter to figure out the block in `python-ts-mode'.
+  (dolist (mode '(python-mode python-ts-mode))
+    (add-to-list
+     'hs-special-modes-alist
+     `(,mode
+       ,python-nav-beginning-of-block-regexp
+       ;; Use the empty string as end regexp so it doesn't default to
+       ;; "\\s)".  This way parens at end of defun are properly hidden.
+       ""
+       "#"
+       python-hideshow-forward-sexp-function
+       nil
+       python-nav-beginning-of-block
+       python-hideshow-find-next-block
+       python-info-looking-at-beginning-of-block)))
 
   (setq-local outline-regexp (python-rx (* space) block-start))
   (setq-local outline-level
@@ -6618,9 +6600,6 @@ implementations: `python-mode' and `python-ts-mode'."
 
   (make-local-variable 'python-shell-internal-buffer)
 
-  (when python-indent-guess-indent-offset
-    (python-indent-guess-indent-offset))
-
   (add-hook 'flymake-diagnostic-functions #'python-flymake nil t))
 
 ;;;###autoload
@@ -6632,33 +6611,42 @@ implementations: `python-mode' and `python-ts-mode'."
               `(,python-font-lock-keywords
                 nil nil nil nil
                 (font-lock-syntactic-face-function
-                 . python-font-lock-syntactic-face-function)))
+                 . python-font-lock-syntactic-face-function)
+                (font-lock-extend-after-change-region-function
+                 . python-font-lock-extend-region)))
   (setq-local syntax-propertize-function
               python-syntax-propertize-function)
   (setq-local imenu-create-index-function
               #'python-imenu-create-index)
-  (add-hook 'which-func-functions #'python-info-current-defun nil t))
+
+  (add-hook 'which-func-functions #'python-info-current-defun nil t)
+
+  (when python-indent-guess-indent-offset
+    (python-indent-guess-indent-offset)))
 
 ;;;###autoload
 (define-derived-mode python-ts-mode python-base-mode "Python"
   "Major mode for editing Python files, using tree-sitter library.
 
 \\{python-ts-mode-map}"
+  :syntax-table python-mode-syntax-table
   (when (treesit-ready-p 'python)
     (treesit-parser-create 'python)
     (setq-local treesit-font-lock-feature-list
-                '(( comment string definition)
-                  ( keyword builtin constant type)
-                  ( assignment decorator escape-sequence
-                    string-interpolation number property
-                    operator bracket delimiter)))
+                '(( comment definition)
+                  ( keyword string type)
+                  ( assignment builtin constant decorator
+                    escape-sequence number property string-interpolation )
+                  ( function bracket delimiter operator)))
     (setq-local treesit-font-lock-settings python--treesit-settings)
     (setq-local imenu-create-index-function
                 #'python-imenu-treesit-create-index)
-    (setq-local beginning-of-defun-function
-                #'python-treesit-beginning-of-defun)
-    (setq-local end-of-defun-function #'python-treesit-end-of-defun)
-    (treesit-major-mode-setup)))
+    (setq-local treesit-defun-type-regexp (rx (or "function" "class")
+                                              "_definition"))
+    (treesit-major-mode-setup)
+
+    (when python-indent-guess-indent-offset
+      (python-indent-guess-indent-offset))))
 
 ;;; Completion predicates for M-x
 ;; Commands that only make sense when editing Python code
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 17467b5554..fa51597697 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -134,6 +134,13 @@ This should only be called after matching against 
`ruby-here-doc-beg-re'."
 (defconst ruby-symbol-re (concat "[" ruby-symbol-chars "]")
   "Regexp to match symbols.")
 
+(defconst ruby-endless-method-head-re
+  (format " *\\(%s+\\.\\)?%s+[?!]? *\\(([^()]*)\\)? +="
+          ruby-symbol-re ruby-symbol-re)
+  "Regexp to match the beginning of an endless method definition.
+
+It should match the part after \"def\" and until \"=\".")
+
 (defvar ruby-use-smie t)
 (make-obsolete-variable 'ruby-use-smie nil "28.1")
 
@@ -351,7 +358,8 @@ This only affects the output of the command 
`ruby-toggle-block'."
        (exp  (exp1) (exp "," exp) (exp "=" exp)
              (id " @ " exp))
        (exp1 (exp2) (exp2 "?" exp1 ":" exp1))
-       (exp2 (exp3) (exp3 "." exp3))
+       (exp2 (exp3) (exp3 "." exp3)
+             (exp3 "def=" exp3))
        (exp3 ("def" insts "end")
              ("begin" insts-rescue-insts "end")
              ("do" insts "end")
@@ -468,7 +476,7 @@ This only affects the output of the command 
`ruby-toggle-block'."
                                              "else" "elsif" "do" "end" "and")
                                            'symbols))))
          (memq (car (syntax-after pos)) '(7 15))
-         (looking-at "[([]\\|[-+!~:]\\(?:\\sw\\|\\s_\\)")))))
+         (looking-at "[([]\\|[-+!~:@$]\\(?:\\sw\\|\\s_\\)")))))
 
 (defun ruby-smie--before-method-name ()
   ;; Only need to be accurate when method has keyword name.
@@ -528,6 +536,9 @@ This only affects the output of the command 
`ruby-toggle-block'."
               (ruby-smie--forward-token)) ;Fully redundant.
              (t ";")))
            ((equal tok "&.") ".")
+           ((and (equal tok "def")
+                 (looking-at ruby-endless-method-head-re))
+            "def=")
            (t tok)))))))))
 
 (defun ruby-smie--backward-token ()
@@ -575,6 +586,9 @@ This only affects the output of the command 
`ruby-toggle-block'."
             (ruby-smie--backward-token)) ;Fully redundant.
            (t ";")))
          ((equal tok "&.") ".")
+         ((and (equal tok "def")
+               (looking-at (concat "def" ruby-endless-method-head-re)))
+          "def=")
          (t tok)))))))
 
 (defun ruby-smie--indent-to-stmt ()
@@ -629,6 +643,11 @@ This only affects the output of the command 
`ruby-toggle-block'."
                      (not (ruby-smie--bosp)))
            (forward-char -1))
          (smie-indent-virtual))
+        ((save-excursion
+           (and (smie-rule-parent-p " @ ")
+                (goto-char (nth 1 (smie-indent--parent)))
+                (smie-rule-prev-p "def=")
+                (cons 'column (- (current-column) 3)))))
         (t (smie-rule-parent))))))
     (`(:after . ,(or "(" "[" "{"))
      ;; FIXME: Shouldn't this be the default behavior of
@@ -672,6 +691,12 @@ This only affects the output of the command 
`ruby-toggle-block'."
      (and (smie-rule-parent-p ";" nil)
           (smie-indent--hanging-p)
           ruby-indent-level))
+    (`(:before . "=")
+     (save-excursion
+      (and (smie-rule-parent-p " @ ")
+           (goto-char (nth 1 (smie-indent--parent)))
+           (smie-rule-prev-p "def=")
+           (cons 'column (+ (current-column) ruby-indent-level -3)))))
     (`(:after . ,(or "?" ":")) ruby-indent-level)
     (`(:before . ,(guard (memq (intern-soft token) ruby-alignable-keywords)))
      (when (not (ruby--at-indentation-p))
@@ -1375,9 +1400,10 @@ With ARG, move backward multiple defuns.  Negative ARG 
means
 move forward."
   (interactive "p")
   (let (case-fold-search)
-    (and (re-search-backward (concat "^\\s *" ruby-defun-beg-re "\\_>")
-                             nil t (or arg 1))
-         (beginning-of-line))))
+    (when (re-search-backward (concat "^\\s *" ruby-defun-beg-re "\\_>")
+                              nil t (or arg 1))
+      (beginning-of-line)
+      t)))
 
 (defun ruby-end-of-defun ()
   "Move point to the end of the current defun.
@@ -1611,7 +1637,8 @@ For example:
 See `add-log-current-defun-function'."
   (condition-case nil
       (save-excursion
-        (let* ((indent 0) mname mlist
+        (let* ((indent (ruby--add-log-current-indent))
+               mname mlist
                (start (point))
                (make-definition-re
                 (lambda (re &optional method-name?)
@@ -1626,18 +1653,30 @@ See `add-log-current-defun-function'."
                (definition-re (funcall make-definition-re ruby-defun-beg-re t))
                (module-re (funcall make-definition-re "\\(class\\|module\\)")))
           ;; Get the current method definition (or class/module).
-          (when (re-search-backward definition-re nil t)
+          (when (catch 'found
+                  (while (and (re-search-backward definition-re nil t)
+                              (if (if (string-equal "def" (match-string 1))
+                                      ;; We're inside a method.
+                                      (if (ruby-block-contains-point (1- 
start))
+                                          t
+                                        ;; Try to match a method only once.
+                                        (setq definition-re module-re)
+                                        nil)
+                                    ;; Class/module. For performance,
+                                    ;; comparing indentation.
+                                    (or (not (numberp indent))
+                                        (> indent (current-indentation))))
+                                  (throw 'found t)
+                                t))))
             (goto-char (match-beginning 1))
             (if (not (string-equal "def" (match-string 1)))
                 (setq mlist (list (match-string 2)))
-              ;; We're inside the method. For classes and modules,
-              ;; this check is skipped for performance.
-              (when (ruby-block-contains-point start)
-                (setq mname (match-string 2))))
+              (setq mname (match-string 2)))
             (setq indent (current-column))
             (beginning-of-line))
           ;; Walk up the class/module nesting.
-          (while (and (> indent 0)
+          (while (and indent
+                      (> indent 0)
                       (re-search-backward module-re nil t))
             (goto-char (match-beginning 1))
             (when (< (current-column) indent)
@@ -1691,6 +1730,17 @@ See `add-log-current-defun-function'."
         (ruby-forward-sexp))
       (> (point) pt))))
 
+(defun ruby--add-log-current-indent ()
+  (save-excursion
+    (back-to-indentation)
+    (cond
+     ((looking-at "[[:graph:]]")
+      (current-indentation))
+     (ruby-use-smie
+      (smie-indent-calculate))
+     (t
+      (ruby-calculate-indent)))))
+
 (defun ruby-brace-to-do-end (orig end)
   (let (beg-marker end-marker)
     (goto-char end)
diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
new file mode 100644
index 0000000000..8b2ed19101
--- /dev/null
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -0,0 +1,371 @@
+;;; rust-ts-mode.el --- tree-sitter support for Rust  -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author     : Randy Taylor <dev@rjt.dev>
+;; Maintainer : Randy Taylor <dev@rjt.dev>
+;; Created    : December 2022
+;; Keywords   : rust languages tree-sitter
+
+;; 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 'treesit)
+(eval-when-compile (require 'rx))
+
+(declare-function treesit-parser-create "treesit.c")
+(declare-function treesit-induce-sparse-tree "treesit.c")
+(declare-function treesit-node-child "treesit.c")
+(declare-function treesit-node-child-by-field-name "treesit.c")
+(declare-function treesit-node-start "treesit.c")
+(declare-function treesit-node-type "treesit.c")
+
+(defcustom rust-ts-mode-indent-offset 4
+  "Number of spaces for each indentation step in `rust-ts-mode'."
+  :version "29.1"
+  :type 'integer
+  :safe 'integerp
+  :group 'rust)
+
+(defvar rust-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?+   "."      table)
+    (modify-syntax-entry ?-   "."      table)
+    (modify-syntax-entry ?=   "."      table)
+    (modify-syntax-entry ?%   "."      table)
+    (modify-syntax-entry ?&   "."      table)
+    (modify-syntax-entry ?|   "."      table)
+    (modify-syntax-entry ?^   "."      table)
+    (modify-syntax-entry ?!   "."      table)
+    (modify-syntax-entry ?@   "."      table)
+    (modify-syntax-entry ?~   "."      table)
+    (modify-syntax-entry ?<   "."      table)
+    (modify-syntax-entry ?>   "."      table)
+    (modify-syntax-entry ?/   ". 124b" table)
+    (modify-syntax-entry ?*   ". 23"   table)
+    (modify-syntax-entry ?\n  "> b"    table)
+    (modify-syntax-entry ?\^m "> b"    table)
+    table)
+  "Syntax table for `rust-ts-mode'.")
+
+(defvar rust-ts-mode--indent-rules
+  `((rust
+     ((node-is ")") parent-bol 0)
+     ((node-is "]") parent-bol 0)
+     ((node-is "}") (and parent parent-bol) 0)
+     ((parent-is "arguments") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "await_expression") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "array_expression") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "binary_expression") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "block") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "declaration_list") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "enum_variant_list") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "field_declaration_list") parent-bol 
rust-ts-mode-indent-offset)
+     ((parent-is "field_expression") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "field_initializer_list") parent-bol 
rust-ts-mode-indent-offset)
+     ((parent-is "let_declaration") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "macro_definition") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "parameters") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "token_tree") parent-bol rust-ts-mode-indent-offset)
+     ((parent-is "use_list") parent-bol rust-ts-mode-indent-offset)))
+  "Tree-sitter indent rules for `rust-ts-mode'.")
+
+(defvar rust-ts-mode--builtin-macros
+  '("concat_bytes" "concat_idents" "const_format_args"
+    "format_args_nl" "log_syntax" "trace_macros" "assert" "assert_eq"
+    "assert_ne" "cfg" "column" "compile_error" "concat" "dbg"
+    "debug_assert" "debug_assert_eq" "debug_assert_ne" "env" "eprint"
+    "eprintln" "file" "format" "format_args" "include" "include_bytes"
+    "include_str" "is_x86_feature_detected" "line" "matches"
+    "module_path" "option_env" "panic" "print" "println" "stringify"
+    "thread_local" "todo" "try" "unimplemented" "unreachable" "vec"
+    "write" "writeln")
+  "Rust built-in macros for tree-sitter font-locking.")
+
+(defvar rust-ts-mode--keywords
+  '("as" "async" "await" "break" "const" "continue" "dyn" "else"
+    "enum" "extern" "fn" "for" "if" "impl" "in" "let" "loop" "match"
+    "mod" "move" "pub" "ref" "return" "static" "struct" "trait" "type"
+    "union" "unsafe" "use" "where" "while" (crate) (self) (super)
+    (mutable_specifier))
+  "Rust keywords for tree-sitter font-locking.")
+
+(defvar rust-ts-mode--operators
+  '("!"  "!=" "%" "%=" "&" "&=" "&&" "*" "*=" "+" "+=" "," "-" "-="
+    "->" "."  ".."  "..=" "..."  "/" "/=" ":" ";" "<<" "<<=" "<" "<="
+    "=" "==" "=>" ">" ">=" ">>" ">>=" "@" "^" "^=" "|" "|=" "||" "?")
+  "Rust operators for tree-sitter font-locking.")
+
+(defvar rust-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'rust
+   :feature 'attribute
+   '((attribute_item) @font-lock-constant-face
+     (inner_attribute_item) @font-lock-constant-face)
+
+   :language 'rust
+   :feature 'bracket
+   '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
+
+   :language 'rust
+   :feature 'builtin
+   `((macro_invocation
+      macro: ((identifier) @font-lock-builtin-face
+              (:match ,(rx-to-string
+                        `(seq bol
+                              (or ,@rust-ts-mode--builtin-macros)
+                              eol))
+                      @font-lock-builtin-face)))
+     ((identifier) @font-lock-type-face
+      (:match "^\\(:?Err\\|Ok\\|None\\|Some\\)$" @font-lock-type-face)))
+
+   :language 'rust
+   :feature 'comment
+   '(([(block_comment) (line_comment)]) @font-lock-comment-face)
+
+   :language 'rust
+   :feature 'constant
+   `((boolean_literal) @font-lock-constant-face
+     ((identifier) @font-lock-constant-face
+      (:match "^[A-Z][A-Z\\d_]*$" @font-lock-constant-face)))
+
+   :language 'rust
+   :feature 'delimiter
+   '((["," "." ";" ":" "::"]) @font-lock-delimiter-face)
+
+   :language 'rust
+   :feature 'function
+   '((call_expression
+      function:
+      [(identifier) @font-lock-function-name-face
+       (field_expression
+        field: (field_identifier) @font-lock-function-name-face)
+       (scoped_identifier
+        name: (identifier) @font-lock-function-name-face)])
+     (function_item (identifier) @font-lock-function-name-face)
+     (generic_function
+      function: [(identifier) @font-lock-function-name-face
+                 (field_expression
+                  field: (field_identifier) @font-lock-function-name-face)
+                 (scoped_identifier
+                  name: (identifier) @font-lock-function-name-face)])
+     (macro_definition "macro_rules!" @font-lock-constant-face)
+     (macro_definition (identifier) @font-lock-preprocessor-face)
+     (macro_invocation macro: (identifier) @font-lock-preprocessor-face))
+
+   :language 'rust
+   :feature 'keyword
+   `([,@rust-ts-mode--keywords] @font-lock-keyword-face)
+
+   :language 'rust
+   :feature 'number
+   '([(float_literal) (integer_literal)] @font-lock-number-face)
+
+   :language 'rust
+   :feature 'operator
+   `([,@rust-ts-mode--operators] @font-lock-operator-face)
+
+   :language 'rust
+   :feature 'string
+   '([(char_literal)
+      (raw_string_literal)
+      (string_literal)] @font-lock-string-face)
+
+   :language 'rust
+   :feature 'type
+   `((call_expression
+      function: (scoped_identifier
+                 path: (identifier) @font-lock-type-face))
+     (enum_variant name: (identifier) @font-lock-type-face)
+     (match_arm
+      pattern: (match_pattern (_ type: (identifier) @font-lock-type-face)))
+     (match_arm
+      pattern: (match_pattern
+                (_ type: (scoped_identifier
+                          path: (identifier) @font-lock-type-face))))
+     (mod_item name: (identifier) @font-lock-constant-face)
+     (primitive_type) @font-lock-type-face
+     (type_identifier) @font-lock-type-face
+     (scoped_identifier name: (identifier) @font-lock-type-face)
+     (scoped_identifier path: (identifier) @font-lock-constant-face)
+     (scoped_identifier
+      (scoped_identifier
+       path: (identifier) @font-lock-constant-face))
+     ((scoped_identifier
+       path: [(identifier) @font-lock-type-face
+              (scoped_identifier
+               name: (identifier) @font-lock-type-face)])
+      (:match "^[A-Z]" @font-lock-type-face))
+     (scoped_type_identifier path: (identifier) @font-lock-constant-face)
+     (scoped_use_list
+      path: [(identifier) @font-lock-constant-face
+             (scoped_identifier (identifier) @font-lock-constant-face)])
+     (type_identifier) @font-lock-type-face
+     (use_as_clause alias: (identifier) @font-lock-type-face)
+     (use_list (identifier) @font-lock-type-face))
+
+   :language 'rust
+   :feature 'variable
+   '((identifier) @font-lock-variable-name-face
+     ;; Everything in a token_tree is an identifier.
+     (token_tree (identifier) @default))
+
+   :language 'rust
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face)
+
+   :language 'rust
+   :feature 'property
+   :override t
+   '((field_identifier) @font-lock-property-face
+     (shorthand_field_initializer (identifier) @font-lock-property-face))
+
+   :language 'rust
+   :feature 'error
+   :override t
+   '((ERROR) @font-lock-warning-face))
+  "Tree-sitter font-lock settings for `rust-ts-mode'.")
+
+(defun rust-ts-mode--imenu ()
+  "Return Imenu alist for the current buffer."
+  (let* ((node (treesit-buffer-root-node))
+         (enum-tree (treesit-induce-sparse-tree
+                     node "enum_item" nil))
+         (enum-index (rust-ts-mode--imenu-1 enum-tree))
+         (func-tree (treesit-induce-sparse-tree
+                     node "function_item" nil))
+         (func-index (rust-ts-mode--imenu-1 func-tree))
+         (impl-tree (treesit-induce-sparse-tree
+                     node "impl_item" nil))
+         (impl-index (rust-ts-mode--imenu-1 impl-tree))
+         (mod-tree (treesit-induce-sparse-tree
+                    node "mod_item" nil))
+         (mod-index (rust-ts-mode--imenu-1 mod-tree))
+         (struct-tree (treesit-induce-sparse-tree
+                       node "struct_item" nil))
+         (struct-index (rust-ts-mode--imenu-1 struct-tree))
+         (type-tree (treesit-induce-sparse-tree
+                     node "type_item" nil))
+         (type-index (rust-ts-mode--imenu-1 type-tree)))
+    (append
+     (when mod-index `(("Module" . ,mod-index)))
+     (when enum-index `(("Enum" . ,enum-index)))
+     (when impl-index `(("Impl" . ,impl-index)))
+     (when type-index `(("Type" . ,type-index)))
+     (when struct-index `(("Struct" . ,struct-index)))
+     (when func-index `(("Fn" . ,func-index))))))
+
+(defun rust-ts-mode--imenu-1 (node)
+  "Helper for `rust-ts-mode--imenu'.
+Find string representation for NODE and set marker, then recurse
+the subtrees."
+  (let* ((ts-node (car node))
+         (children (cdr node))
+         (subtrees (mapcan #'rust-ts-mode--imenu-1
+                           children))
+         (name (when ts-node
+                 (pcase (treesit-node-type ts-node)
+                   ("enum_item"
+                    (treesit-node-text
+                     (treesit-node-child-by-field-name ts-node "name") t))
+                   ("function_item"
+                    (treesit-node-text
+                     (treesit-node-child-by-field-name ts-node "name") t))
+                   ("impl_item"
+                    (let ((trait-node (treesit-node-child-by-field-name 
ts-node "trait")))
+                      (concat
+                       (treesit-node-text
+                        trait-node t)
+                       (when trait-node
+                         " for ")
+                       (treesit-node-text
+                        (treesit-node-child-by-field-name ts-node "type") t))))
+                   ("mod_item"
+                    (treesit-node-text
+                     (treesit-node-child-by-field-name ts-node "name") t))
+                   ("struct_item"
+                    (treesit-node-text
+                     (treesit-node-child-by-field-name ts-node "name") t))
+                   ("type_item"
+                    (treesit-node-text
+                     (treesit-node-child-by-field-name ts-node "name") t)))))
+         (marker (when ts-node
+                   (set-marker (make-marker)
+                               (treesit-node-start ts-node)))))
+    (cond
+     ((or (null ts-node) (null name)) subtrees)
+     (subtrees
+      `((,name ,(cons name marker) ,@subtrees)))
+     (t
+      `((,name . ,marker))))))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-ts-mode))
+
+;;;###autoload
+(define-derived-mode rust-ts-mode prog-mode "Rust"
+  "Major mode for editing Rust, powered by tree-sitter."
+  :group 'rust
+  :syntax-table rust-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'rust)
+    (treesit-parser-create 'rust)
+
+    ;; Comments.
+    (setq-local comment-start "// ")
+    (setq-local comment-end "")
+    (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                           (seq "/" (+ "*")))
+                                       (* (syntax whitespace))))
+    (setq-local comment-end-skip
+                (rx (* (syntax whitespace))
+                    (group (or (syntax comment-end)
+                               (seq (+ "*") "/")))))
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings rust-ts-mode--font-lock-settings)
+    (setq-local treesit-font-lock-feature-list
+                '(( comment)
+                  ( keyword string)
+                  ( attribute builtin constant escape-sequence
+                    function number property type variable)
+                  ( bracket delimiter error operator)))
+
+    ;; Imenu.
+    (setq-local imenu-create-index-function #'rust-ts-mode--imenu)
+    (setq-local which-func-functions nil)
+
+    ;; Indent.
+    (setq-local indent-tabs-mode nil
+                treesit-simple-indent-rules rust-ts-mode--indent-rules)
+
+    ;; Navigation.
+    (setq-local treesit-defun-type-regexp
+                (regexp-opt '("enum_item"
+                              "function_item"
+                              "impl_item"
+                              "struct_item")))
+
+    (treesit-major-mode-setup)))
+
+(provide 'rust-ts-mode)
+
+;;; rust-ts-mode.el ends here
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index e0453c3b2f..8454f24356 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -361,7 +361,7 @@ See `run-hooks'."
               ) t)
         "\\>") 1)
       ;;
-      ;; It wouldn't be Scheme w/o named-let.
+      ;; It wouldn't be Scheme without named-let.
       '("(let\\s-+\\(\\sw+\\)"
         (1 font-lock-function-name-face))
       ;;
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 067aef8669..3f995d17b5 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1468,6 +1468,25 @@ When the region is active, send the region instead."
 
 (defvar sh-mode--treesit-settings)
 
+(defun sh--guess-shell ()
+  "Guess the shell used in the current buffer.
+Return the name of the shell suitable for `sh-set-shell'."
+  (cond ((save-excursion
+           (goto-char (point-min))
+           (looking-at auto-mode-interpreter-regexp))
+         (match-string 2))
+        ((not buffer-file-name) sh-shell-file)
+        ;; Checks that use `buffer-file-name' follow.
+        ((string-match "\\.m?spec\\'" buffer-file-name) "rpm")
+        ((string-match "[.]sh\\>"     buffer-file-name) "sh")
+        ((string-match "[.]bash\\(rc\\)?\\>"   buffer-file-name) "bash")
+        ((string-match "[.]ksh\\>"    buffer-file-name) "ksh")
+        ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh")
+        ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh")
+        ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh")
+       ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
+        (t sh-shell-file)))
+
 ;;;###autoload
 (define-derived-mode sh-base-mode prog-mode "Shell-script"
   "Generic major mode for editing shell scripts.
@@ -1519,23 +1538,7 @@ implementations.  Currently there are two: `sh-mode' and
                   "\\")))
   ;; Parse or insert magic number for exec, and set all variables depending
   ;; on the shell thus determined.
-  (sh-set-shell
-   (cond ((save-excursion
-            (goto-char (point-min))
-            (looking-at auto-mode-interpreter-regexp))
-          (match-string 2))
-         ((not buffer-file-name) sh-shell-file)
-         ;; Checks that use `buffer-file-name' follow.
-         ((string-match "\\.m?spec\\'" buffer-file-name) "rpm")
-         ((string-match "[.]sh\\>"     buffer-file-name) "sh")
-         ((string-match "[.]bash\\(rc\\)?\\>"   buffer-file-name) "bash")
-         ((string-match "[.]ksh\\>"    buffer-file-name) "ksh")
-         ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh")
-         ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh")
-         ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh")
-        ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
-         (t sh-shell-file))
-   nil nil)
+  (sh-set-shell (sh--guess-shell) nil nil)
   (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t)
   (add-hook 'hack-local-variables-hook
             #'sh-after-hack-local-variables nil t))
@@ -1605,17 +1608,43 @@ with your script for an edit-interpret-debug cycle."
 
 ;;;###autoload
 (define-derived-mode bash-ts-mode sh-base-mode "Bash"
-  "Major mode for editing Bash shell scripts."
+  "Major mode for editing Bash shell scripts.
+This mode automatically falls back to `sh-mode' if the buffer is
+not written in Bash or sh."
+  :syntax-table sh-mode-syntax-table
   (when (treesit-ready-p 'bash)
+    (treesit-parser-create 'bash)
     (setq-local treesit-font-lock-feature-list
-                '(( comment function heredoc string)
-                  ( command declaration-command keyword number variable)
-                  ( bracket builtin-variable constant delimiter
-                    misc-punctuation operator)))
+                '(( comment function)
+                  ( command declaration-command keyword string)
+                  ( builtin-variable constant heredoc number variable)
+                  ( bracket delimiter misc-punctuation operator)))
     (setq-local treesit-font-lock-settings
                 sh-mode--treesit-settings)
+    (setq-local treesit-text-type-regexp
+                (regexp-opt '("comment"
+                              "heredoc_start"
+                              "heredoc_body")))
+    (setq-local treesit-defun-type-regexp "function_definition")
     (treesit-major-mode-setup)))
 
+(advice-add 'bash-ts-mode :around #'sh--redirect-bash-ts-mode
+            ;; Give it lower precedence than normal advice, so other
+            ;; advices take precedence over it.
+            '((depth . 50)))
+
+(defvar sh--redirect-recursing nil)
+(defun sh--redirect-bash-ts-mode (oldfn)
+  "Redirect to `sh-mode' if the current file is not written in Bash or sh.
+OLDFN should be `bash-ts-mode'."
+  (let ((sh--redirect-recursing sh--redirect-recursing))
+    (funcall (if (or delay-mode-hooks sh--redirect-recursing)
+                 oldfn
+               (setq sh--redirect-recursing t)
+               (if (member (file-name-base (sh--guess-shell)) '("bash" "sh"))
+                   oldfn
+                 #'sh-mode)))))
+
 (defun sh-font-lock-keywords (&optional keywords)
   "Function to get simple fontification based on `sh-font-lock-keywords'.
 This adds rules for comments and assignments."
@@ -1666,19 +1695,17 @@ This adds rules for comments and assignments."
 ;; (defun sh--var-completion-table (string pred action)
 ;;   (complete-with-action action (sh--vars-before-point) string pred))
 
-(defun sh--cmd-completion-table (string pred action)
-  (let ((cmds
-         (append (when (fboundp 'imenu--make-index-alist)
-                   (mapcar #'car
-                           (condition-case nil
-                               (imenu--make-index-alist)
-                             (imenu-unavailable nil))))
-                 (mapcar (lambda (v) (concat v "="))
-                         (sh--vars-before-point))
-                 (locate-file-completion-table
-                  exec-path exec-suffixes string pred t)
-                 sh--completion-keywords)))
-    (complete-with-action action cmds string pred)))
+(defun sh--cmd-completion-table-gen (string)
+  (append (when (fboundp 'imenu--make-index-alist)
+            (mapcar #'car
+                    (condition-case nil
+                        (imenu--make-index-alist)
+                      (imenu-unavailable nil))))
+          (mapcar (lambda (v) (concat v "="))
+                  (sh--vars-before-point))
+          (locate-file-completion-table
+           exec-path exec-suffixes string nil t)
+          sh--completion-keywords))
 
 (defun sh-completion-at-point-function ()
   (save-excursion
@@ -1691,14 +1718,14 @@ This adds rules for comments and assignments."
         (list start end (sh--vars-before-point)
               :company-kind (lambda (_) 'variable)))
        ((sh-smie--keyword-p)
-        (list start end #'sh--cmd-completion-table
+        (list start end
+              (completion-table-with-cache #'sh--cmd-completion-table-gen)
               :company-kind
               (lambda (s)
                 (cond
                  ((member s sh--completion-keywords) 'keyword)
                  ((string-suffix-p "=" s) 'variable)
-                 (t 'function)))
-              ))))))
+                 (t 'function)))))))))
 
 ;;; Indentation and navigation with SMIE.
 
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index e585799dc6..6a71da77a2 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -4526,7 +4526,8 @@ optionally is saved to the user's init file."
   "Run PRODUCT interpreter as an inferior process.
 
 If buffer `*SQL*' exists but no process is running, make a new process.
-If buffer exists and a process is running, just switch to buffer `*SQL*'.
+If buffer exists and a process is running, just make sure buffer `*SQL*'
+is displayed.
 
 To specify the SQL product, prefix the call with
 \\[universal-argument].  To set the buffer name as well, prefix
diff --git a/lisp/progmodes/ts-mode.el b/lisp/progmodes/ts-mode.el
deleted file mode 100644
index 436b198f59..0000000000
--- a/lisp/progmodes/ts-mode.el
+++ /dev/null
@@ -1,339 +0,0 @@
-;;; ts-mode.el --- tree sitter support for TypeScript  -*- lexical-binding: t; 
-*-
-
-;; Copyright (C) 2022 Free Software Foundation, Inc.
-
-;; Author     : Theodor Thornhill <theo@thornhill.no>
-;; Maintainer : Theodor Thornhill <theo@thornhill.no>
-;; Created    : October 2022
-;; Keywords   : typescript tsx languages tree-sitter
-
-;; This file is part of GNU Emacs.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; Code:
-
-(require 'treesit)
-(require 'rx)
-(require 'js)
-
-(defcustom ts-mode-indent-offset 2
-  "Number of spaces for each indentation step in `ts-mode'."
-  :version "29.1"
-  :type 'integer
-  :safe 'integerp
-  :group 'typescript)
-
-(defvar ts-mode--syntax-table
-  (let ((table (make-syntax-table)))
-    ;; Taken from the cc-langs version
-    (modify-syntax-entry ?_  "_"     table)
-    (modify-syntax-entry ?$ "_"      table)
-    (modify-syntax-entry ?\\ "\\"    table)
-    (modify-syntax-entry ?+  "."     table)
-    (modify-syntax-entry ?-  "."     table)
-    (modify-syntax-entry ?=  "."     table)
-    (modify-syntax-entry ?%  "."     table)
-    (modify-syntax-entry ?<  "."     table)
-    (modify-syntax-entry ?>  "."     table)
-    (modify-syntax-entry ?&  "."     table)
-    (modify-syntax-entry ?|  "."     table)
-    (modify-syntax-entry ?` "\""     table)
-    (modify-syntax-entry ?\240 "."   table)
-    table)
-  "Syntax table for `ts-mode'.")
-
-(defvar ts-mode--indent-rules
-  `((tsx
-     ((parent-is "program") parent-bol 0)
-     ((node-is "}") parent-bol 0)
-     ((node-is ")") parent-bol 0)
-     ((node-is "]") parent-bol 0)
-     ((node-is ">") parent-bol 0)
-     ((and (parent-is "comment") comment-end) comment-start -1)
-     ((parent-is "comment") comment-start-skip 0)
-     ((parent-is "ternary_expression") parent-bol ts-mode-indent-offset)
-     ((parent-is "member_expression") parent-bol ts-mode-indent-offset)
-     ((parent-is "named_imports") parent-bol ts-mode-indent-offset)
-     ((parent-is "statement_block") parent-bol ts-mode-indent-offset)
-     ((parent-is "type_arguments") parent-bol ts-mode-indent-offset)
-     ((parent-is "variable_declarator") parent-bol ts-mode-indent-offset)
-     ((parent-is "arguments") parent-bol ts-mode-indent-offset)
-     ((parent-is "array") parent-bol ts-mode-indent-offset)
-     ((parent-is "formal_parameters") parent-bol ts-mode-indent-offset)
-     ((parent-is "template_substitution") parent-bol ts-mode-indent-offset)
-     ((parent-is "object_pattern") parent-bol ts-mode-indent-offset)
-     ((parent-is "object") parent-bol ts-mode-indent-offset)
-     ((parent-is "object_type") parent-bol ts-mode-indent-offset)
-     ((parent-is "enum_body") parent-bol ts-mode-indent-offset)
-     ((parent-is "arrow_function") parent-bol ts-mode-indent-offset)
-     ((parent-is "parenthesized_expression") parent-bol ts-mode-indent-offset)
-
-     ;; TSX
-     ((parent-is "jsx_opening_element") parent ts-mode-indent-offset)
-     ((node-is "jsx_closing_element") parent 0)
-     ((parent-is "jsx_element") parent ts-mode-indent-offset)
-     ((node-is "/") parent 0)
-     ((parent-is "jsx_self_closing_element") parent ts-mode-indent-offset)
-     (no-node parent-bol 0)))
-  "Tree-sitter indent rules.")
-
-(defvar ts-mode--keywords
-  '("!" "abstract" "as" "async" "await" "break"
-    "case" "catch" "class" "const" "continue" "debugger"
-    "declare" "default" "delete" "do" "else" "enum"
-    "export" "extends" "finally" "for" "from" "function"
-    "get" "if" "implements" "import" "in" "instanceof" "interface"
-    "keyof" "let" "namespace" "new" "of" "private" "protected"
-    "public" "readonly" "return" "set" "static" "switch"
-    "target" "throw" "try" "type" "typeof" "var" "void"
-    "while" "with" "yield")
-  "TypeScript keywords for tree-sitter font-locking.")
-
-(defvar ts-mode--operators
-  '("=" "+=" "-=" "*=" "/=" "%=" "**=" "<<=" ">>=" ">>>=" "&=" "^="
-    "|=" "&&=" "||=" "??=" "==" "!=" "===" "!==" ">" ">=" "<" "<=" "+"
-    "-" "*" "/" "%" "++" "--" "**" "&" "|" "^" "~" "<<" ">>" ">>>"
-    "&&" "||" "!" "?.")
-  "TypeScript operators for tree-sitter font-locking.")
-
-(defvar ts-mode--font-lock-settings
-  (treesit-font-lock-rules
-   :language 'tsx
-   :override t
-   :feature 'comment
-   `((comment) @font-lock-comment-face)
-
-   :language 'tsx
-   :override t
-   :feature 'constant
-   `(((identifier) @font-lock-constant-face
-      (:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face))
-
-     [(true) (false) (null)] @font-lock-constant-face)
-
-   :language 'tsx
-   :override t
-   :feature 'keyword
-   `([,@ts-mode--keywords] @font-lock-keyword-face
-     [(this) (super)] @font-lock-keyword-face)
-
-   :language 'tsx
-   :override t
-   :feature 'string
-   `((regex pattern: (regex_pattern)) @font-lock-string-face
-     (string) @font-lock-string-face
-     (template_string) @js--fontify-template-string
-     (template_substitution ["${" "}"] @font-lock-builtin-face))
-
-   :language 'tsx
-   :override t
-   :feature 'declaration
-   `((function
-      name: (identifier) @font-lock-function-name-face)
-
-     (function_declaration
-      name: (identifier) @font-lock-function-name-face)
-
-     (method_definition
-      name: (property_identifier) @font-lock-function-name-face)
-
-     (variable_declarator
-      name: (identifier) @font-lock-variable-name-face)
-
-     (enum_declaration (identifier) @font-lock-type-face)
-
-     (arrow_function
-      parameter: (identifier) @font-lock-variable-name-face)
-
-     (variable_declarator
-      name: (identifier) @font-lock-function-name-face
-      value: [(function) (arrow_function)])
-
-     (variable_declarator
-      name: (array_pattern
-             (identifier)
-             (identifier) @font-lock-function-name-face)
-      value: (array (number) (function))))
-
-   :language 'tsx
-   :override t
-   :feature 'identifier
-   `((nested_type_identifier
-      module: (identifier) @font-lock-type-face)
-
-     (type_identifier) @font-lock-type-face
-
-     (predefined_type) @font-lock-type-face
-
-     (new_expression
-      constructor: (identifier) @font-lock-type-face)
-
-     (enum_body (property_identifier) @font-lock-type-face)
-
-     (enum_assignment name: (property_identifier) @font-lock-type-face)
-
-     (assignment_expression
-      left: [(identifier) @font-lock-variable-name-face
-             (member_expression
-              property: (property_identifier) @font-lock-variable-name-face)])
-
-     (for_in_statement
-      left: (identifier) @font-lock-variable-name-face)
-
-     (arrow_function
-      parameters:
-      [(_ (identifier) @font-lock-variable-name-face)
-       (_ (_ (identifier) @font-lock-variable-name-face))
-       (_ (_ (_ (identifier) @font-lock-variable-name-face)))]))
-
-   :language 'tsx
-   :override t
-   :feature 'expression
-   '((assignment_expression
-      left: [(identifier) @font-lock-function-name-face
-             (member_expression
-              property: (property_identifier) @font-lock-function-name-face)]
-      right: [(function) (arrow_function)])
-
-     (call_expression
-      function:
-      [(identifier) @font-lock-function-name-face
-       (member_expression
-        property: (property_identifier) @font-lock-function-name-face)]))
-
-   :language 'tsx
-   :override t
-   :feature 'pattern
-   `((pair_pattern
-      key: (property_identifier) @font-lock-property-face)
-
-     (array_pattern (identifier) @font-lock-variable-name-face))
-
-   :language 'tsx
-   :override t
-   :feature 'jsx
-   `((jsx_opening_element
-      [(nested_identifier (identifier)) (identifier)]
-      @font-lock-function-name-face)
-
-     (jsx_closing_element
-      [(nested_identifier (identifier)) (identifier)]
-      @font-lock-function-name-face)
-
-     (jsx_self_closing_element
-      [(nested_identifier (identifier)) (identifier)]
-      @font-lock-function-name-face)
-
-     (jsx_attribute (property_identifier) @font-lock-constant-face))
-
-   :language 'tsx
-   :feature 'number
-   `((number) @font-lock-number-face
-     ((identifier) @font-lock-number-face
-      (:match "^\\(:?NaN\\|Infinity\\)$" @font-lock-number-face)))
-
-   :language 'tsx
-   :feature 'operator
-   `([,@ts-mode--operators] @font-lock-operator-face
-     (ternary_expression ["?" ":"] @font-lock-operator-face))
-
-   :language 'tsx
-   :feature 'bracket
-   '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
-
-   :language 'tsx
-   :feature 'delimiter
-   '((["," "." ";" ":"]) @font-lock-delimiter-face)
-
-   :language 'tsx
-   :feature 'escape-sequence
-   :override t
-   '((escape_sequence) @font-lock-escape-face)
-
-   :language 'tsx
-   :override t
-   :feature 'property
-   `(((property_identifier) @font-lock-property-face)
-
-     (pair value: (identifier) @font-lock-variable-name-face)
-
-     ((shorthand_property_identifier) @font-lock-property-face)
-
-     ((shorthand_property_identifier_pattern)
-      @font-lock-property-face)))
-  "Tree-sitter font-lock settings.")
-
-;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.ts\\'" . ts-mode))
-
-;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.tsx\\'" . ts-mode))
-
-;;;###autoload
-(define-derived-mode ts-mode prog-mode "TypeScript"
-  "Major mode for editing TypeScript."
-  :group 'typescript
-  :syntax-table ts-mode--syntax-table
-
-  (cond
-   ;; `ts-mode' requires tree-sitter to work, so we don't check if
-   ;; user enables tree-sitter for it.
-   ((treesit-ready-p 'tsx)
-    ;; Tree-sitter.
-    (treesit-parser-create 'tsx)
-
-    ;; Comments.
-    (setq-local comment-start "// ")
-    (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
-    (setq-local comment-end "")
-    (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*"))))
-    (setq-local treesit-comment-end (rx (+ (or "*")) "/"))
-
-    ;; Electric
-    (setq-local electric-indent-chars
-                (append "{}():;," electric-indent-chars))
-
-    ;; Indent.
-    (setq-local treesit-simple-indent-rules ts-mode--indent-rules)
-
-    ;; Navigation.
-    (setq-local treesit-defun-type-regexp
-                (rx (or "class_declaration"
-                        "method_definition"
-                        "function_declaration"
-                        "lexical_declaration")))
-
-    ;; Font-lock.
-    (setq-local treesit-font-lock-settings ts-mode--font-lock-settings)
-    (setq-local treesit-font-lock-feature-list
-                '((comment declaration)
-                  (constant expression identifier keyword number string)
-                  (bracket delimiter jsx pattern property)))
-    ;; Imenu.
-    (setq-local imenu-create-index-function #'js--treesit-imenu)
-
-    ;; Which-func (use imenu).
-    (setq-local which-func-functions nil)
-
-    (treesit-major-mode-setup))
-
-   ;; Elisp.
-   (t
-    (js-mode)
-    (message "Tree-sitter for TypeScript isn't available, falling back to 
`js-mode'"))))
-
-(provide 'ts-mode)
-
-;;; ts-mode.el ends here
diff --git a/lisp/progmodes/typescript-ts-mode.el 
b/lisp/progmodes/typescript-ts-mode.el
new file mode 100644
index 0000000000..6ba1b9b12c
--- /dev/null
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -0,0 +1,422 @@
+;;; typescript-ts-mode.el --- tree sitter support for TypeScript  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author     : Theodor Thornhill <theo@thornhill.no>
+;; Maintainer : Theodor Thornhill <theo@thornhill.no>
+;; Created    : October 2022
+;; Keywords   : typescript tsx languages tree-sitter
+
+;; 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 'treesit)
+(require 'js)
+(eval-when-compile (require 'rx))
+
+(declare-function treesit-parser-create "treesit.c")
+
+(defcustom typescript-ts-mode-indent-offset 2
+  "Number of spaces for each indentation step in `typescript-ts-mode'."
+  :version "29.1"
+  :type 'integer
+  :safe 'integerp
+  :group 'typescript)
+
+(defvar typescript-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    ;; Taken from the cc-langs version
+    (modify-syntax-entry ?_  "_"     table)
+    (modify-syntax-entry ?\\ "\\"    table)
+    (modify-syntax-entry ?+  "."     table)
+    (modify-syntax-entry ?-  "."     table)
+    (modify-syntax-entry ?=  "."     table)
+    (modify-syntax-entry ?%  "."     table)
+    (modify-syntax-entry ?<  "."     table)
+    (modify-syntax-entry ?>  "."     table)
+    (modify-syntax-entry ?&  "."     table)
+    (modify-syntax-entry ?|  "."     table)
+    (modify-syntax-entry ?\' "\""    table)
+    (modify-syntax-entry ?\240 "."   table)
+    (modify-syntax-entry ?/  ". 124b" table)
+    (modify-syntax-entry ?*  ". 23"   table)
+    (modify-syntax-entry ?\n "> b"  table)
+    (modify-syntax-entry ?\^m "> b" table)
+    (modify-syntax-entry ?$ "_" table)
+    (modify-syntax-entry ?` "\"" table)
+    table)
+  "Syntax table for `typescript-ts-mode'.")
+
+(defun typescript-ts-mode--indent-rules (language)
+  "Rules used for indentation.
+Argument LANGUAGE is either `typescript' or `tsx'."
+  `((,language
+     ((parent-is "program") parent-bol 0)
+     ((node-is "}") parent-bol 0)
+     ((node-is ")") parent-bol 0)
+     ((node-is "]") parent-bol 0)
+     ((node-is ">") parent-bol 0)
+     ((and (parent-is "comment") comment-end) comment-start -1)
+     ((parent-is "comment") comment-start-skip 0)
+     ((parent-is "ternary_expression") parent-bol 
typescript-ts-mode-indent-offset)
+     ((parent-is "member_expression") parent-bol 
typescript-ts-mode-indent-offset)
+     ((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "statement_block") parent-bol 
typescript-ts-mode-indent-offset)
+     ((parent-is "type_arguments") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "variable_declarator") parent-bol 
typescript-ts-mode-indent-offset)
+     ((parent-is "arguments") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "array") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "formal_parameters") parent-bol 
typescript-ts-mode-indent-offset)
+     ((parent-is "template_substitution") parent-bol 
typescript-ts-mode-indent-offset)
+     ((parent-is "object_pattern") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "object") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "object_type") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "enum_body") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "class_body") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "arrow_function") parent-bol typescript-ts-mode-indent-offset)
+     ((parent-is "parenthesized_expression") parent-bol 
typescript-ts-mode-indent-offset)
+     ((parent-is "binary_expression") parent-bol 
typescript-ts-mode-indent-offset)
+
+     ,@(when (eq language 'tsx)
+         `(((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset)
+           ((node-is "jsx_element") parent typescript-ts-mode-indent-offset)
+           ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset)
+           ((node-is "jsx_self_closing_element") parent 
typescript-ts-mode-indent-offset)
+           ((node-is "jsx_closing_element") parent 0)
+           ((node-is "/") parent 0)
+           ((node-is ">") parent 0)))
+     (no-node parent-bol 0))))
+
+(defvar typescript-ts-mode--keywords
+  '("!" "abstract" "as" "async" "await" "break"
+    "case" "catch" "class" "const" "continue" "debugger"
+    "declare" "default" "delete" "do" "else" "enum"
+    "export" "extends" "finally" "for" "from" "function"
+    "get" "if" "implements" "import" "in" "instanceof" "interface"
+    "keyof" "let" "namespace" "new" "of" "private" "protected"
+    "public" "readonly" "return" "set" "static" "switch"
+    "target" "throw" "try" "type" "typeof" "var" "void"
+    "while" "with" "yield")
+  "TypeScript keywords for tree-sitter font-locking.")
+
+(defvar typescript-ts-mode--operators
+  '("=" "+=" "-=" "*=" "/=" "%=" "**=" "<<=" ">>=" ">>>=" "&=" "^="
+    "|=" "&&=" "||=" "??=" "==" "!=" "===" "!==" ">" ">=" "<" "<=" "+"
+    "-" "*" "/" "%" "++" "--" "**" "&" "|" "^" "~" "<<" ">>" ">>>"
+    "&&" "||" "!" "?.")
+  "TypeScript operators for tree-sitter font-locking.")
+
+(defun typescript-ts-mode--font-lock-settings (language)
+  "Tree-sitter font-lock settings.
+Argument LANGUAGE is either `typescript' or `tsx'."
+  (treesit-font-lock-rules
+   :language language
+   :override t
+   :feature 'comment
+   `((comment) @font-lock-comment-face)
+
+   :language language
+   :override t
+   :feature 'constant
+   `(((identifier) @font-lock-constant-face
+      (:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face))
+
+     [(true) (false) (null)] @font-lock-constant-face)
+
+   :language language
+   :override t
+   :feature 'keyword
+   `([,@typescript-ts-mode--keywords] @font-lock-keyword-face
+     [(this) (super)] @font-lock-keyword-face)
+
+   :language language
+   :override t
+   :feature 'string
+   `((regex pattern: (regex_pattern)) @font-lock-string-face
+     (string) @font-lock-string-face
+     (template_string) @js--fontify-template-string
+     (template_substitution ["${" "}"] @font-lock-builtin-face))
+
+   :language language
+   :override t
+   :feature 'declaration
+   `((function
+      name: (identifier) @font-lock-function-name-face)
+
+     (function_declaration
+      name: (identifier) @font-lock-function-name-face)
+
+     (method_definition
+      name: (property_identifier) @font-lock-function-name-face)
+     (required_parameter (identifier) @font-lock-variable-name-face)
+     (optional_parameter (identifier) @font-lock-variable-name-face)
+
+     (variable_declarator
+      name: (identifier) @font-lock-variable-name-face)
+
+     (enum_declaration (identifier) @font-lock-type-face)
+
+     (extends_clause value: (identifier) @font-lock-type-face)
+     ;; extends React.Component<T>
+     (extends_clause value: (member_expression
+                             object: (identifier) @font-lock-type-face
+                             property: (property_identifier) 
@font-lock-type-face))
+
+     (arrow_function
+      parameter: (identifier) @font-lock-variable-name-face)
+
+     (variable_declarator
+      name: (identifier) @font-lock-function-name-face
+      value: [(function) (arrow_function)])
+
+     (variable_declarator
+      name: (array_pattern
+             (identifier)
+             (identifier) @font-lock-function-name-face)
+      value: (array (number) (function))))
+
+   :language language
+   :override t
+   :feature 'identifier
+   `((nested_type_identifier
+      module: (identifier) @font-lock-type-face)
+
+     (type_identifier) @font-lock-type-face
+
+     (predefined_type) @font-lock-type-face
+
+     (new_expression
+      constructor: (identifier) @font-lock-type-face)
+
+     (enum_body (property_identifier) @font-lock-type-face)
+
+     (enum_assignment name: (property_identifier) @font-lock-type-face)
+
+     (assignment_expression
+      left: [(identifier) @font-lock-variable-name-face
+             (member_expression
+              property: (property_identifier) @font-lock-variable-name-face)])
+
+     (for_in_statement
+      left: (identifier) @font-lock-variable-name-face)
+
+     (arrow_function
+      parameters:
+      [(_ (identifier) @font-lock-variable-name-face)
+       (_ (_ (identifier) @font-lock-variable-name-face))
+       (_ (_ (_ (identifier) @font-lock-variable-name-face)))])
+
+     (return_statement (identifier) @font-lock-variable-name-face)
+
+     (binary_expression left: (identifier) @font-lock-variable-name-face)
+     (binary_expression right: (identifier) @font-lock-variable-name-face)
+
+     (arguments (identifier) @font-lock-variable-name-face)
+
+     (parenthesized_expression (identifier) @font-lock-variable-name-face)
+     (parenthesized_expression (_ (identifier) @font-lock-variable-name-face)))
+
+   :language language
+   :override t
+   :feature 'property
+   `((property_signature
+      name: (property_identifier) @font-lock-property-face)
+     (public_field_definition
+      name: (property_identifier) @font-lock-property-face)
+     (member_expression
+      object: (identifier) @font-lock-variable-name-face)
+     (member_expression
+      property: (_) @font-lock-property-face)
+
+     (pair key: (property_identifier) @font-lock-variable-name-face)
+
+     (pair value: (identifier) @font-lock-variable-name-face)
+
+     ((shorthand_property_identifier) @font-lock-property-face)
+
+     ((shorthand_property_identifier_pattern)
+      @font-lock-property-face))
+
+   :language language
+   :override t
+   :feature 'expression
+   '((assignment_expression
+      left: [(identifier) @font-lock-function-name-face
+             (member_expression
+              property: (property_identifier) @font-lock-function-name-face)]
+      right: [(function) (arrow_function)])
+
+     (call_expression
+      function:
+      [(identifier) @font-lock-function-name-face
+       (member_expression
+        property: (property_identifier) @font-lock-function-name-face)]))
+
+   :language language
+   :override t
+   :feature 'pattern
+   `((pair_pattern
+      key: (property_identifier) @font-lock-property-face)
+
+     (array_pattern (identifier) @font-lock-variable-name-face))
+
+   :language language
+   :override t
+   :feature 'jsx
+   `((jsx_opening_element
+      [(nested_identifier (identifier)) (identifier)]
+      @font-lock-function-name-face)
+
+     (jsx_closing_element
+      [(nested_identifier (identifier)) (identifier)]
+      @font-lock-function-name-face)
+
+     (jsx_self_closing_element
+      [(nested_identifier (identifier)) (identifier)]
+      @font-lock-function-name-face)
+
+     (jsx_attribute (property_identifier) @font-lock-constant-face))
+
+   :language language
+   :feature 'number
+   `((number) @font-lock-number-face
+     ((identifier) @font-lock-number-face
+      (:match "^\\(:?NaN\\|Infinity\\)$" @font-lock-number-face)))
+
+   :language language
+   :feature 'operator
+   `([,@typescript-ts-mode--operators] @font-lock-operator-face
+     (ternary_expression ["?" ":"] @font-lock-operator-face))
+
+   :language language
+   :feature 'bracket
+   '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
+
+   :language language
+   :feature 'delimiter
+   '((["," "." ";" ":"]) @font-lock-delimiter-face)
+
+   :language language
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face)))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
+
+;;;###autoload
+(define-derived-mode typescript-ts-base-mode prog-mode "TypeScript"
+  "Major mode for editing TypeScript."
+  :group 'typescript
+  :syntax-table typescript-ts-mode--syntax-table
+
+  ;; Comments.
+  (setq-local comment-start "// ")
+  (setq-local comment-end "")
+  (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
+  (setq-local comment-end-skip
+              (rx (* (syntax whitespace))
+                  (group (or (syntax comment-end)
+                             (seq (+ "*") "/")))))
+
+  (setq-local treesit-text-type-regexp
+              (regexp-opt '("comment"
+                            "template_string")))
+  (setq-local treesit-defun-prefer-top-level t)
+
+  ;; Electric
+  (setq-local electric-indent-chars
+              (append "{}():;," electric-indent-chars))
+
+  ;; Navigation.
+  (setq-local treesit-defun-type-regexp
+              (regexp-opt '("class_declaration"
+                            "method_definition"
+                            "function_declaration"
+                            "lexical_declaration")))
+  ;; Imenu.
+  (setq-local imenu-create-index-function #'js--treesit-imenu)
+
+  ;; Which-func (use imenu).
+  (setq-local which-func-functions nil))
+
+;;;###autoload
+(define-derived-mode typescript-ts-mode typescript-ts-base-mode "TypeScript"
+  "Major mode for editing TypeScript."
+  :group 'typescript
+  :syntax-table typescript-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'typescript)
+    (treesit-parser-create 'typescript)
+
+    ;; Indent.
+    (setq-local treesit-simple-indent-rules
+                (typescript-ts-mode--indent-rules 'typescript))
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings
+                (typescript-ts-mode--font-lock-settings 'typescript))
+    (setq-local treesit-font-lock-feature-list
+                '((comment declaration keyword string escape-sequence)
+                  (constant expression identifier number pattern property)
+                  (bracket delimiter)))
+
+    (treesit-major-mode-setup)))
+
+;;;###autoload
+(define-derived-mode tsx-ts-mode typescript-ts-base-mode "TypeScript[TSX]"
+  "Major mode for editing TypeScript."
+  :group 'typescript
+  :syntax-table typescript-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'tsx)
+    (treesit-parser-create 'tsx)
+
+    ;; Comments.
+    (setq-local comment-start "// ")
+    (setq-local comment-end "")
+    (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+                                           (seq "/" (+ "*")))
+                                       (* (syntax whitespace))))
+    (setq-local comment-end-skip
+                (rx (* (syntax whitespace))
+                    (group (or (syntax comment-end)
+                               (seq (+ "*") "/")))))
+
+    ;; Indent.
+    (setq-local treesit-simple-indent-rules
+                (typescript-ts-mode--indent-rules 'tsx))
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings
+                (typescript-ts-mode--font-lock-settings 'tsx))
+    (setq-local treesit-font-lock-feature-list
+                '((comment declaration keyword string escape-sequence)
+                  (constant expression identifier jsx number pattern property)
+                  (bracket delimiter)))
+
+    (treesit-major-mode-setup)))
+
+(provide 'typescript-ts-mode)
+
+;;; typescript-ts-mode.el ends here
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index e5458e6a07..47a1cb3233 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -9,7 +9,7 @@
 ;; Keywords: languages
 ;; The "Version" is the date followed by the decimal rendition of the Git
 ;;     commit hex.
-;; Version: 2021.10.14.127365406
+;; Version: 2022.12.18.181110314
 
 ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
 ;; file on 19/3/2008, and the maintainer agreed that when a bug is
@@ -124,7 +124,7 @@
 ;;
 
 ;; This variable will always hold the version number of the mode
-(defconst verilog-mode-version "2021-10-14-797711e-vpo-GNU"
+(defconst verilog-mode-version "2022-12-18-acb862a-vpo-GNU"
   "Version of this Verilog mode.")
 (defconst verilog-mode-release-emacs t
   "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -455,11 +455,11 @@ This function may be removed when Emacs 21 is no longer 
supported."
            last-command-event)))
 
 (defvar verilog-no-change-functions nil
-  "True if `after-change-functions' is disabled.
+  "Non-nil if `after-change-functions' is disabled.
 Use of `syntax-ppss' may break, as ppss's cache may get corrupted.")
 
 (defvar verilog-in-hooks nil
-  "True when within a `verilog-run-hooks' block.")
+  "Non-nil when within a `verilog-run-hooks' block.")
 
 (defmacro verilog-run-hooks (&rest hooks)
   "Run each hook in HOOKS using `run-hooks'.
@@ -505,8 +505,14 @@ Set `verilog-in-hooks' during this time, to assist AUTO 
caches."
 (defvar verilog-debug nil
   "Non-nil means enable debug messages for `verilog-mode' internals.")
 
-(defvar verilog-warn-fatal nil
-  "Non-nil means `verilog-warn-error' warnings are fatal `error's.")
+(defcustom verilog-warn-fatal nil
+  "Non-nil means `verilog-warn-error' warnings are fatal `error's."
+  :group 'verilog-mode-auto
+  :type 'boolean)
+(put 'verilog-warn-fatal 'safe-local-variable #'verilog-booleanp)
+
+;; Internal use similar to `verilog-warn-fatal'
+(defvar verilog-warn-fatal-internal t)
 
 (defcustom verilog-linter
   "echo 'No verilog-linter set, see \"M-x describe-variable verilog-linter\"'"
@@ -679,6 +685,18 @@ Set to 0 to have all directives start at the left side of 
the screen."
   :type 'integer)
 (put 'verilog-indent-level-directive 'safe-local-variable #'integerp)
 
+(defcustom verilog-indent-ignore-multiline-defines t
+  "Non-nil means ignore indentation on lines that are part of a multiline 
define."
+  :group 'verilog-mode-indent
+  :type 'boolean)
+(put 'verilog-indent-ignore-multiline-defines 'safe-local-variable 
#'verilog-booleanp)
+
+(defcustom verilog-indent-ignore-regexp nil
+  "Regexp that matches lines that should be ignored for indentation."
+  :group 'verilog-mode-indent
+  :type 'boolean)
+(put 'verilog-indent-ignore-regexp 'safe-local-variable #'stringp)
+
 (defcustom verilog-cexp-indent 2
   "Indentation of Verilog statements split across lines."
   :group 'verilog-mode-indent
@@ -723,6 +741,13 @@ Otherwise, line them up."
   :type 'boolean)
 (put 'verilog-indent-begin-after-if 'safe-local-variable #'verilog-booleanp)
 
+(defcustom verilog-indent-class-inside-pkg t
+  "Non-nil means indent classes inside packages.
+Otherwise, classes have zero indentation."
+  :group 'verilog-mode-indent
+  :type 'boolean)
+(put 'verilog-indent-class-inside-pkg 'safe-local-variable #'verilog-booleanp)
+
 (defcustom verilog-align-ifelse nil
   "Non-nil means align `else' under matching `if'.
 Otherwise else is lined up with first character on line holding matching if."
@@ -730,6 +755,38 @@ Otherwise else is lined up with first character on line 
holding matching if."
   :type 'boolean)
 (put 'verilog-align-ifelse 'safe-local-variable #'verilog-booleanp)
 
+(defcustom verilog-align-decl-expr-comments t
+  "Non-nil means align declaration and expressions comments."
+  :group 'verilog-mode-indent
+  :type 'boolean)
+(put 'verilog-align-decl-expr-comments 'safe-local-variable #'verilog-booleanp)
+
+(defcustom verilog-align-comment-distance 1
+  "Distance (in spaces) between longest declaration/expression and comments.
+Only works if `verilog-align-decl-expr-comments' is non-nil."
+  :group 'verilog-mode-indent
+  :type 'integer)
+(put 'verilog-align-comment-distance 'safe-local-variable #'integerp)
+
+(defcustom verilog-align-assign-expr nil
+  "Non-nil means align expressions of continuous assignments."
+  :group 'verilog-mode-indent
+  :type 'boolean)
+(put 'verilog-align-assign-expr 'safe-local-variable #'verilog-booleanp)
+
+(defcustom verilog-align-typedef-regexp nil
+  "Regexp that matches user typedefs for declaration alignment."
+  :group 'verilog-mode-indent
+  :type '(choice (regexp :tag "Regexp")
+                 (const :tag "None" nil)))
+(put 'verilog-align-typedef-regexp 'safe-local-variable #'stringp)
+
+(defcustom verilog-align-typedef-words nil
+  "List of words that match user typedefs for declaration alignment."
+  :group 'verilog-mode-indent
+  :type '(repeat string))
+(put 'verilog-align-typedef-words 'safe-local-variable #'listp)
+
 (defcustom verilog-minimum-comment-distance 10
   "Minimum distance (in lines) between begin and end required before a comment.
 Setting this variable to zero results in every end acquiring a comment; the
@@ -876,6 +933,12 @@ always be saved."
   :type 'boolean)
 (put 'verilog-auto-star-save 'safe-local-variable #'verilog-booleanp)
 
+(defcustom verilog-fontify-variables t
+  "Non-nil means fontify declaration variables."
+  :group 'verilog-mode-actions
+  :type 'boolean)
+(put 'verilog-fontify-variables 'safe-local-variable #'verilog-booleanp)
+
 (defvar verilog-auto-update-tick nil
   "Modification tick at which autos were last performed.")
 
@@ -1052,7 +1115,7 @@ You might want these defined in each file; put at the 
*END* of your file
 something like:
 
     // Local Variables:
-    // verilog-library-files:(\"/some/path/technology.v\" 
\"/some/path/tech2.v\")
+    // verilog-library-files:(\"/path/technology.v\" \"/path2/tech2.v\")
     // End:
 
 Verilog-mode attempts to detect changes to this local variable, but they
@@ -1124,7 +1187,7 @@ those temporaries reset.  See example in 
`verilog-auto-reset'."
 (put 'verilog-auto-reset-blocking-in-non 'safe-local-variable 
#'verilog-booleanp)
 
 (defcustom verilog-auto-reset-widths t
-  "True means AUTORESET should determine the width of signals.
+  "Non-nil means AUTORESET should determine the width of signals.
 This is then used to set the width of the zero (32'h0 for example).  This
 is required by some lint tools that aren't smart enough to ignore widths of
 the constant zero.  This may result in ugly code when parameters determine
@@ -1264,7 +1327,7 @@ See `verilog-auto-inst-param-value'."
 Also affects AUTOINSTPARAM.  Declaration order is the default for
 backward compatibility, and as some teams prefer signals that are
 declared together to remain together.  Sorted order reduces
-changes when declarations are moved around in a file. Sorting is
+changes when declarations are moved around in a file.  Sorting is
 within input/output/inout groupings, there is intentionally no
 option to intermix between input/output/inouts.
 
@@ -1275,7 +1338,7 @@ See also `verilog-auto-arg-sort'."
 (put 'verilog-auto-inst-sort 'safe-local-variable #'verilog-booleanp)
 
 (defcustom verilog-auto-inst-vector t
-  "True means when creating default ports with AUTOINST, use bus subscripts.
+  "Non-nil means when creating default ports with AUTOINST, use bus subscripts.
 If nil, skip the subscript when it matches the entire bus as declared in
 the module (AUTOWIRE signals always are subscripted, you must manually
 declare the wire to have the subscripts removed.)  Setting this to nil may
@@ -1515,10 +1578,9 @@ If set will become buffer local.")
     (define-key map "\C-c/"    #'verilog-star-comment)
     (define-key map "\C-c\C-c" #'verilog-comment-region)
     (define-key map "\C-c\C-u" #'verilog-uncomment-region)
-    (when (featurep 'xemacs)
-      (define-key map [(meta control h)] #'verilog-mark-defun)
-      (define-key map "\M-\C-a"  #'verilog-beg-of-defun)
-      (define-key map "\M-\C-e"  #'verilog-end-of-defun))
+    (define-key map "\M-\C-h"  #'verilog-mark-defun)
+    (define-key map "\M-\C-a"  #'verilog-beg-of-defun)
+    (define-key map "\M-\C-e"  #'verilog-end-of-defun)
     (define-key map "\C-c\C-d" #'verilog-goto-defun)
     (define-key map "\C-c\C-k" #'verilog-delete-auto)
     (define-key map "\C-c\C-a" #'verilog-auto)
@@ -2028,11 +2090,11 @@ Where __FLAGS__ appears in the string 
`verilog-current-flags'
 will be substituted.  Where __FILE__ appears in the string, the
 current buffer's file-name, without the directory portion, will
 be substituted."
-  (setq command        (verilog-string-replace-matches
+  (setq command (verilog-string-replace-matches
                 ;; Note \\b only works if under verilog syntax table
                 "\\b__FLAGS__\\b" (verilog-current-flags)
                 t t command))
-  (setq command        (verilog-string-replace-matches
+  (setq command (verilog-string-replace-matches
                 "\\b__FILE__\\b" (file-name-nondirectory
                                  (or (buffer-file-name) ""))
                 t t command))
@@ -2468,13 +2530,8 @@ find the errors."
 ;;
 ;; Regular expressions used to calculate indent, etc.
 ;;
-(defconst verilog-symbol-re      "\\<[a-zA-Z_][a-zA-Z_0-9.]*\\>")
-;; Want to match
-;; aa :
-;; aa,bb :
-;; a[34:32] :
-;; a,
-;;   b :
+(defconst verilog-identifier-re "[a-zA-Z_][a-zA-Z_0-9]*")
+(defconst verilog-identifier-sym-re (concat "\\<" verilog-identifier-re "\\>"))
 (defconst verilog-assignment-operator-re
   (eval-when-compile
     (verilog-regexp-opt
@@ -2492,12 +2549,11 @@ find the errors."
        ) 't
          )))
 (defconst verilog-assignment-operation-re
-  (concat
-   ;; "\\(^\\s-*[A-Za-z0-9_]+\\(\\[\\([A-Za-z0-9_]+\\)\\]\\)*\\s-*\\)"
-   ;; "\\(^\\s-*[^=<>+-*/%&|^:\\s-]+[^=<>+-*/%&|^\n]*?\\)"
-   "\\(^.*?\\)" "\\B" verilog-assignment-operator-re "\\B" ))
+  (concat "\\(^.*?\\)" verilog-assignment-operator-re))
+(defconst verilog-assignment-operation-re-2
+  (concat "\\(.*?\\)" verilog-assignment-operator-re))
 
-(defconst verilog-label-re (concat verilog-symbol-re "\\s-*:\\s-*"))
+(defconst verilog-label-re (concat verilog-identifier-sym-re "\\s-*:\\s-*"))
 (defconst verilog-property-re
   (concat "\\(" verilog-label-re "\\)?"
           ;; "\\(assert\\|assume\\|cover\\)\\s-+property\\>"
@@ -2732,6 +2788,9 @@ find the errors."
            "\\|\\(\\<clocking\\>\\)"              ;17
            "\\|\\(\\<`[ou]vm_[a-z_]+_begin\\>\\)" ;18
            "\\|\\(\\<`vmm_[a-z_]+_member_begin\\>\\)"
+           "\\|\\(\\<`ifn?def\\>\\)"              ;20, matched end can be: 
`else `elsif `endif
+           "\\|\\(\\<`else\\>\\)"                 ;21, matched end can be: 
`endif
+           "\\|\\(\\<`elsif\\>\\)"                ;22, matched end can be: 
`else `endif
           ;;
           ))
 
@@ -2817,40 +2876,54 @@ find the errors."
        "localparam" "parameter" "var"
        ;; misc
        "string" "event" "chandle" "virtual" "enum" "genvar"
-       "struct" "union"
+       "struct" "union" "type"
        ;; builtin classes
        "mailbox" "semaphore"
        ))))
-(defconst verilog-declaration-re
-  (concat "\\(" verilog-declaration-prefix-re "\\s-*\\)?" 
verilog-declaration-core-re))
 (defconst verilog-range-re "\\(\\[[^]]*\\]\\s-*\\)+")
 (defconst verilog-optional-signed-re "\\s-*\\(\\(un\\)?signed\\)?")
 (defconst verilog-optional-signed-range-re
-  (concat
-   
"\\s-*\\(\\<\\(reg\\|wire\\)\\>\\s-*\\)?\\(\\<\\(un\\)?signed\\>\\s-*\\)?\\(" 
verilog-range-re "\\)?"))
+  (concat 
"\\s-*\\(\\<\\(reg\\|wire\\)\\>\\s-*\\)?\\(\\<\\(un\\)?signed\\>\\s-*\\)?\\(" 
verilog-range-re "\\)?"))
 (defconst verilog-macroexp-re "`\\sw+")
-
 (defconst verilog-delay-re 
"#\\s-*\\(\\([0-9_]+\\('s?[hdxbo][0-9a-fA-F_xz]+\\)?\\)\\|\\(([^()]*)\\)\\|\\(\\sw+\\)\\)")
-(defconst verilog-declaration-re-2-no-macro
-  (concat "\\s-*" verilog-declaration-re
-          "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" 
verilog-delay-re "\\)"
-          "\\)"))
-(defconst verilog-declaration-re-2-macro
-  (concat "\\s-*" verilog-declaration-re
-          "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" 
verilog-delay-re "\\)"
-          "\\|\\(" verilog-macroexp-re "\\)"
-          "\\)"))
-(defconst verilog-declaration-re-1-macro
-  (concat "^" verilog-declaration-re-2-macro))
-
-(defconst verilog-declaration-re-1-no-macro (concat "^" 
verilog-declaration-re-2-no-macro))
+(defconst verilog-interface-modport-re 
"\\(\\s-*\\([a-zA-Z0-9`_$]+\\.[a-zA-Z0-9`_$]+\\)[ \t\f]+\\)")
+(defconst verilog-comment-start-regexp "//\\|/\\*" "Dual comment value for 
`comment-start-regexp'.")
+(defconst verilog-typedef-enum-re
+  (concat "^\\s-*\\(typedef\\s-+\\)?enum\\(\\s-+" verilog-declaration-core-re 
verilog-optional-signed-range-re "\\)?"))
+
+(defconst verilog-declaration-simple-re
+  (concat "\\(" verilog-declaration-prefix-re "\\s-*\\)?" 
verilog-declaration-core-re))
+(defconst verilog-declaration-re
+  (concat "\\s-*" verilog-declaration-simple-re
+          "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" 
verilog-delay-re "\\)\\)"))
+(defconst verilog-declaration-re-macro
+  (concat "\\s-*" verilog-declaration-simple-re
+          "\\s-*\\(\\(" verilog-optional-signed-range-re "\\)\\|\\(" 
verilog-delay-re "\\)\\|\\(" verilog-macroexp-re "\\)\\)"))
+(defconst verilog-declaration-or-iface-mp-re
+  (concat "\\(" verilog-declaration-re "\\)\\|\\(" 
verilog-interface-modport-re "\\)"))
+(defconst verilog-declaration-embedded-comments-re
+  (concat "\\( " verilog-declaration-re "\\) ""\\s-*" "\\(" 
verilog-comment-start-regexp "\\)")
+  "Match expressions such as: input logic [7:0] /* auto enum sm_psm */ 
sm_psm;.")
 
 (defconst verilog-defun-re
   (eval-when-compile (verilog-regexp-words '("macromodule" "connectmodule" 
"module" "class" "program" "interface" "package" "primitive" "config"))))
 (defconst verilog-end-defun-re
   (eval-when-compile (verilog-regexp-words '("endconnectmodule" "endmodule" 
"endclass" "endprogram" "endinterface" "endpackage" "endprimitive" 
"endconfig"))))
+(defconst verilog-defun-tf-re-beg
+  (eval-when-compile (verilog-regexp-words '("macromodule" "connectmodule" 
"module" "class" "program" "interface" "package" "primitive" "config" 
"function" "task"))))
+(defconst verilog-defun-tf-re-end
+  (eval-when-compile (verilog-regexp-words '("endconnectmodule" "endmodule" 
"endclass" "endprogram" "endinterface" "endpackage" "endprimitive" "endconfig" 
"endfunction" "endtask"))))
+(defconst verilog-defun-tf-re-all
+  (eval-when-compile (verilog-regexp-words '("macromodule" "connectmodule" 
"module" "class" "program" "interface" "package" "primitive" "config" 
"function" "task"
+                                             "endconnectmodule" "endmodule" 
"endclass" "endprogram" "endinterface" "endpackage" "endprimitive" "endconfig" 
"endfunction" "endtask"))))
+(defconst verilog-defun-no-class-re
+  (eval-when-compile (verilog-regexp-words '("macromodule" "connectmodule" 
"module" "program" "interface" "package" "primitive" "config"))))
+(defconst verilog-end-defun-no-class-re
+  (eval-when-compile (verilog-regexp-words '("endconnectmodule" "endmodule" 
"endprogram" "endinterface" "endpackage" "endprimitive" "endconfig"))))
 (defconst verilog-zero-indent-re
   (concat verilog-defun-re "\\|" verilog-end-defun-re))
+(defconst verilog-zero-indent-no-class-re
+  (concat verilog-defun-no-class-re "\\|" verilog-end-defun-no-class-re))
 (defconst verilog-inst-comment-re
   (eval-when-compile (verilog-regexp-words '("Outputs" "Inouts" "Inputs" 
"Interfaces" "Interfaced"))))
 
@@ -2983,19 +3056,38 @@ find the errors."
 (defconst verilog-extended-case-re 
"\\(\\(unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\|randcase\\)")
 (defconst verilog-extended-complete-re
   ;; verilog-beg-of-statement also looks backward one token to extend this 
match
-  (concat 
"\\(\\(\\<extern\\s-+\\|\\<\\(\\<\\(pure\\|context\\)\\>\\s-+\\)?virtual\\s-+\\|\\<protected\\s-+\\|\\<static\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)\\)"
+  (concat 
"\\(\\(\\<extern\\s-+\\|\\<\\(\\<\\(pure\\|context\\)\\>\\s-+\\)?virtual\\s-+\\|\\<local\\s-+\\|\\<protected\\s-+\\|\\<static\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)\\)"
          
"\\|\\(\\(\\<typedef\\>\\s-+\\)*\\(\\<struct\\>\\|\\<union\\>\\|\\<class\\>\\)\\)"
          
"\\|\\(\\(\\<\\(import\\|export\\)\\>\\s-+\\)?\\(\"DPI\\(-C\\)?\"\\s-+\\)?\\(\\<\\(pure\\|context\\)\\>\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_]*\\s-*=\\s-*\\)?\\(function\\>\\|task\\>\\)\\)"
          "\\|" verilog-extended-case-re ))
+
+(eval-and-compile
+  (defconst verilog-basic-complete-words
+    '("always" "assign" "always_latch" "always_ff" "always_comb" "analog" 
"connectmodule" "constraint"
+      "import" "initial" "final" "module" "macromodule" "repeat" "randcase" 
"while"
+      "if" "for" "forever" "foreach" "else" "parameter" "do" "localparam" 
"assert" "default" "generate"))
+  (defconst verilog-basic-complete-words-expr
+    (let ((words verilog-basic-complete-words))
+      (dolist (word '("default" "parameter" "localparam"))
+        (setq words (remove word words)))
+      words))
+  (defconst verilog-basic-complete-words-expr-no-assign
+    (remove "assign" verilog-basic-complete-words-expr)))
+
 (defconst verilog-basic-complete-re
   (eval-when-compile
-    (verilog-regexp-words
-     '(
-       "always" "assign" "always_latch" "always_ff" "always_comb" "analog" 
"connectmodule" "constraint"
-       "import" "initial" "final" "module" "macromodule" "repeat" "randcase" 
"while"
-       "if" "for" "forever" "foreach" "else" "parameter" "do" "localparam" 
"assert"
-       ))))
-(defconst verilog-complete-reg
+    (verilog-regexp-words verilog-basic-complete-words)))
+
+(defconst verilog-basic-complete-expr-re
+  (eval-when-compile
+    (verilog-regexp-words verilog-basic-complete-words-expr)))
+
+(defconst verilog-basic-complete-expr-no-assign-re
+  (eval-when-compile
+    (verilog-regexp-words verilog-basic-complete-words-expr-no-assign)))
+
+
+(defconst verilog-complete-re
   (concat
    verilog-extended-complete-re "\\|\\(" verilog-basic-complete-re "\\)"))
 
@@ -3114,9 +3206,6 @@ find the errors."
             ))
   "List of Verilog keywords.")
 
-(defconst verilog-comment-start-regexp "//\\|/\\*"
-  "Dual comment value for `comment-start-regexp'.")
-
 (defvar verilog-mode-syntax-table
   (let ((table (make-syntax-table)))
     ;; Populate the syntax TABLE.
@@ -3338,12 +3427,12 @@ See also `verilog-font-lock-extra-types'.")
                 (list
                  
"\\<\\(\\(macro\\|connect\\)?module\\|primitive\\|class\\|program\\|interface\\|package\\|task\\)\\>\\s-*\\(\\sw+\\)"
                  '(1 font-lock-keyword-face)
-                 '(3 font-lock-function-name-face prepend))
+                 '(3 font-lock-function-name-face))
                 ;; Fontify function definitions
                 (list
                  (concat 
"\\<function\\>\\s-+\\(integer\\|real\\(time\\)?\\|time\\)\\s-+\\(\\sw+\\)" )
                   '(1 font-lock-keyword-face)
-                  '(3 font-lock-constant-face prepend))
+                  '(3 font-lock-constant-face))
                 '("\\<function\\>\\s-+\\(\\[[^]]+\\]\\)\\s-+\\(\\sw+\\)"
                   (1 font-lock-keyword-face)
                   (2 font-lock-constant-face append))
@@ -3358,12 +3447,12 @@ See also `verilog-font-lock-extra-types'.")
                    ;; Pre-form for this anchored matcher:
                    ;; First, avoid declaration keywords written in comments,
                    ;; which can also trigger this anchor.
-                   '(if (not (verilog-in-comment-p))
+                   '(if (and (not (verilog-in-comment-p))
+                             (not (member (thing-at-point 'symbol) 
verilog-keywords)))
                         (verilog-single-declaration-end 
verilog-highlight-max-lookahead)
                       (point)) ;; => current declaration statement is of 0 
length
                    nil ;; Post-form: nothing to be done
-                   '(0 font-lock-variable-name-face t t)))
-                )))
+                   '(0 font-lock-variable-name-face))))))
 
 
   (setq verilog-font-lock-keywords-2
@@ -3617,7 +3706,7 @@ inserted using a single call to `verilog-insert'."
 (defun verilog-single-declaration-end (limit)
   "Return pos where current (single) declaration statement ends.
 Also, this function moves POINT forward to the start of a variable name
-(skipping the range-part and whitespace).
+\(skipping the range-part and whitespace).
 Function expected to be called with POINT just after a declaration keyword.
 LIMIT sets the max POINT for searching and moving to.  No such limit if LIMIT
 is 0.
@@ -3629,8 +3718,6 @@ Meaning of *single* declaration:
 and `output [1:0] y' is the other single declaration.  In the 1st single
 declaration, POINT is moved to start of `clk'.  And in the 2nd declaration,
 POINT is moved to `y'."
-
-
   (let (maxpoint old-point)
     ;; maxpoint = min(curr-point + limit, buffer-size)
     (setq maxpoint (if (eq limit 0)
@@ -3651,7 +3738,7 @@ POINT is moved to `y'."
                   (not (eq old-point (point)))
                   (not (eq (char-after) ?\; ))
                   (not (eq (char-after) ?\) ))
-                  (not (looking-at verilog-declaration-re)))
+                  (not (looking-at (verilog-get-declaration-re))))
         (setq old-point (point))
         (ignore-errors
           (forward-sexp)
@@ -3669,31 +3756,28 @@ This function moves POINT to the next variable within 
the same declaration (if
 it exists).
 LIMIT is expected to be the pos at which current single-declaration ends,
 obtained using `verilog-single-declaration-end'."
-
-  (let (found-var old-point)
-
-    ;; Remove starting whitespace
-    (verilog-forward-ws&directives limit)
-
-    (when (< (point) limit) ;; no matching if this is violated
-
-      ;; Find the variable name (match-data is set here)
-      (setq found-var (re-search-forward verilog-symbol-re limit t))
-
-      ;; Walk to this variable's delimiter
-      (save-match-data
-        (verilog-forward-ws&directives limit)
-        (setq old-point nil)
-        (while (and (< (point) limit)
-                    (not (member (char-after) '(?, ?\) ?\;)))
-                    (not (eq old-point (point))))
-          (setq old-point (point))
+  (when (and verilog-fontify-variables
+             (not (member (thing-at-point 'symbol) verilog-keywords)))
+    (let (found-var old-point)
+      ;; Remove starting whitespace
+      (verilog-forward-ws&directives limit)
+      (when (< (point) limit) ;; no matching if this is violated
+        ;; Find the variable name (match-data is set here)
+        (setq found-var (re-search-forward verilog-identifier-sym-re limit t))
+        ;; Walk to this variable's delimiter
+        (save-match-data
           (verilog-forward-ws&directives limit)
-          (forward-sexp)
-          (verilog-forward-ws&directives limit))
-        ;; Only a comma or semicolon expected at this point
-        (skip-syntax-forward "."))
-      found-var)))
+          (setq old-point nil)
+          (while (and (< (point) limit)
+                      (not (member (char-after) '(?, ?\) ?\] ?\} ?\;)))
+                      (not (eq old-point (point))))
+            (setq old-point (point))
+            (verilog-forward-ws&directives limit)
+            (forward-sexp)
+            (verilog-forward-ws&directives limit))
+          ;; Only a comma or semicolon expected at this point
+          (skip-syntax-forward "."))
+        found-var))))
 
 (defun verilog-point-text (&optional pointnum)
   "Return text describing where POINTNUM or current point is (for errors).
@@ -3728,9 +3812,14 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
        (elsec 1)
        (found nil)
        (st (point)))
-    (if (not (looking-at "\\<"))
-       (forward-word-strictly -1))
+    (unless (looking-at "\\<")
+      (forward-word-strictly -1))
     (cond
+     ((save-excursion
+        (goto-char st)
+        (member (preceding-char) '(?\) ?\} ?\])))
+      (goto-char st)
+      (backward-sexp 1))
      ((verilog-skip-backward-comment-or-string))
      ((looking-at "\\<else\\>")
       (setq reg (concat
@@ -3754,7 +3843,17 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
              (setq found 't))))))
      ((looking-at verilog-end-block-re)
       (verilog-leap-to-head))
-     ((looking-at 
"\\(endmodule\\>\\)\\|\\(\\<endprimitive\\>\\)\\|\\(\\<endclass\\>\\)\\|\\(\\<endprogram\\>\\)\\|\\(\\<endinterface\\>\\)\\|\\(\\<endpackage\\>\\)\\|\\(\\<endconnectmodule\\>\\)")
+     (;; Fallback, when current word does not match `verilog-end-block-re'
+      (looking-at (concat
+                   "\\(\\<endmodule\\>\\)\\|"        ; 1
+                   "\\(\\<endprimitive\\>\\)\\|"     ; 2
+                   "\\(\\<endclass\\>\\)\\|"         ; 3
+                   "\\(\\<endprogram\\>\\)\\|"       ; 4
+                   "\\(\\<endinterface\\>\\)\\|"     ; 5
+                   "\\(\\<endpackage\\>\\)\\|"       ; 6
+                   "\\(\\<endconnectmodule\\>\\)\\|" ; 7
+                   "\\(\\<endchecker\\>\\)\\|"       ; 8
+                   "\\(\\<endconfig\\>\\)"))         ; 9
       (cond
        ((match-end 1)
        (verilog-re-search-backward "\\<\\(macro\\)?module\\>" nil 'move))
@@ -3769,7 +3868,11 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
        ((match-end 6)
        (verilog-re-search-backward "\\<package\\>" nil 'move))
        ((match-end 7)
-       (verilog-re-search-backward "\\<connectmodule\\>" nil 'move))
+        (verilog-re-search-backward "\\<connectmodule\\>" nil 'move))
+       ((match-end 8)
+        (verilog-re-search-backward "\\<checker\\>" nil 'move))
+       ((match-end 9)
+        (verilog-re-search-backward "\\<config\\>" nil 'move))
        (t
        (goto-char st)
        (backward-sexp 1))))
@@ -3782,9 +3885,14 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
        (md 2)
        (st (point))
        (nest 'yes))
-    (if (not (looking-at "\\<"))
-       (forward-word-strictly -1))
+    (unless (looking-at "\\<")
+      (forward-word-strictly -1))
     (cond
+     ((save-excursion
+        (goto-char st)
+        (member (following-char) '(?\( ?\{ ?\[)))
+      (goto-char st)
+      (forward-sexp 1))
      ((verilog-skip-forward-comment-or-string)
       (verilog-forward-syntactic-ws))
      ((looking-at verilog-beg-block-re-ordered)
@@ -3843,22 +3951,31 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
         ;; Search forward for matching endtask
         (setq reg "\\<endtask\\>" )
         (setq nest 'no))
-       ((match-end 12)
+       ((match-end 13)
         ;; Search forward for matching endgenerate
         (setq reg "\\(\\<generate\\>\\)\\|\\(\\<endgenerate\\>\\)" ))
-       ((match-end 13)
+       ((match-end 14)
         ;; Search forward for matching endgroup
         (setq reg "\\(\\<covergroup\\>\\)\\|\\(\\<endgroup\\>\\)" ))
-       ((match-end 14)
+       ((match-end 15)
         ;; Search forward for matching endproperty
         (setq reg "\\(\\<property\\>\\)\\|\\(\\<endproperty\\>\\)" ))
-       ((match-end 15)
+       ((match-end 16)
         ;; Search forward for matching endsequence
         (setq reg "\\(\\<\\(rand\\)?sequence\\>\\)\\|\\(\\<endsequence\\>\\)" )
         (setq md 3)) ; 3 to get to endsequence in the reg above
        ((match-end 17)
         ;; Search forward for matching endclocking
-        (setq reg "\\(\\<clocking\\>\\)\\|\\(\\<endclocking\\>\\)" )))
+        (setq reg "\\(\\<clocking\\>\\)\\|\\(\\<endclocking\\>\\)" ))
+       ((match-end 20)
+        ;; Search forward for matching `ifn?def, can be `else `elseif or `endif
+        (setq reg 
"\\(\\<`ifn?def\\>\\)\\|\\(\\<`endif\\>\\|\\<`else\\>\\|\\<`elsif\\>\\)" ))
+       ((match-end 21)
+        ;; Search forward for matching `else, can be `endif
+        (setq reg "\\(\\<`else\\>\\|\\<`ifn?def\\>\\)\\|\\(\\<`endif\\>\\)" ))
+       ((match-end 22)
+        ;; Search forward for matching `elsif, can be `else or `endif, DONT 
support `elsif
+        (setq reg 
"\\(\\<`elsif\\>\\|\\<`ifn?def\\>\\)\\|\\(\\<`endif\\>\\|\\<`else\\>\\)" )))
       (if (and reg
               (forward-word-strictly 1))
          (catch 'skip
@@ -3867,15 +3984,26 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
                      here)
                  (while (verilog-re-search-forward reg nil 'move)
                    (cond
-                    ((match-end md) ; a closer in regular expression, so we 
are climbing out
+                     ((and (or (match-end md)
+                               (and (member (match-string-no-properties 1) 
'("`else" "`elsif"))
+                                    (= 1 depth)))
+                           (or (and (member (match-string-no-properties 2) 
'("`else" "`elsif"))
+                                    (= 1 depth))
+                               ;; stop at `else/`elsif which matching ifn?def 
(or `elsif with same depth)
+                               ;; a closer in regular expression, so we are 
climbing out
+                               (not (member (match-string-no-properties 2) 
'("`else" "`elsif")))))
                      (setq depth (1- depth))
                      (if (= 0 depth) ; we are out!
                          (throw 'skip 1)))
-                    ((match-end 1) ; an opener in the r-e, so we are in deeper 
now
+                     ((and (match-end 1)  ; an opener in the r-e, so we are in 
deeper now
+                           (not (member (match-string-no-properties 1) 
'("`else" "`elsif"))))
                      (setq here (point)) ; remember where we started
                      (goto-char (match-beginning 1))
                      (cond
-                      ((if (or
+                       ((verilog-looking-back "\\(\\<typedef\\>\\s-+\\)" 
(point-at-bol))
+                        ;; avoid nesting for typedef class defs
+                        (forward-word-strictly 1))
+                       ((if (or
                             (looking-at verilog-disable-fork-re)
                             (and (looking-at "fork")
                                  (progn
@@ -3890,28 +4018,37 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
                  (throw 'skip 1))))))
 
      ((looking-at (concat
-                  "\\(\\<\\(macro\\)?module\\>\\)\\|"
-                  "\\(\\<primitive\\>\\)\\|"
-                  "\\(\\<class\\>\\)\\|"
-                  "\\(\\<program\\>\\)\\|"
-                  "\\(\\<interface\\>\\)\\|"
-                  "\\(\\<package\\>\\)\\|"
-                  "\\(\\<connectmodule\\>\\)"))
+                   "\\(\\<\\(macro\\)?module\\>\\)\\|"                         
; 1,2
+                   "\\(\\<primitive\\>\\)\\|"                                  
; 3
+                   "\\(\\(\\(interface\\|virtual\\)\\s-+\\)?\\<class\\>\\)\\|" 
; 4,5,6
+                   "\\(\\<program\\>\\)\\|"                                    
; 7
+                   "\\(\\<interface\\>\\)\\|"                                  
; 8
+                   "\\(\\<package\\>\\)\\|"                                    
; 9
+                   "\\(\\<connectmodule\\>\\)\\|"                              
; 10
+                   "\\(\\<generate\\>\\)\\|"                                   
; 11
+                   "\\(\\<checker\\>\\)\\|"                                    
; 12
+                   "\\(\\<config\\>\\)"))                                      
; 13
       (cond
        ((match-end 1)
        (verilog-re-search-forward "\\<endmodule\\>" nil 'move))
-       ((match-end 2)
-       (verilog-re-search-forward "\\<endprimitive\\>" nil 'move))
        ((match-end 3)
-       (verilog-re-search-forward "\\<endclass\\>" nil 'move))
+       (verilog-re-search-forward "\\<endprimitive\\>" nil 'move))
        ((match-end 4)
+       (verilog-re-search-forward "\\<endclass\\>" nil 'move))
+       ((match-end 7)
        (verilog-re-search-forward "\\<endprogram\\>" nil 'move))
-       ((match-end 5)
+       ((match-end 8)
        (verilog-re-search-forward "\\<endinterface\\>" nil 'move))
-       ((match-end 6)
+       ((match-end 9)
        (verilog-re-search-forward "\\<endpackage\\>" nil 'move))
-       ((match-end 7)
-       (verilog-re-search-forward "\\<endconnectmodule\\>" nil 'move))
+       ((match-end 10)
+        (verilog-re-search-forward "\\<endconnectmodule\\>" nil 'move))
+       ((match-end 11)
+        (verilog-re-search-forward "\\<endgenerate\\>" nil 'move))
+       ((match-end 12)
+        (verilog-re-search-forward "\\<endchecker\\>" nil 'move))
+       ((match-end 13)
+        (verilog-re-search-forward "\\<endconfig\\>" nil 'move))
        (t
        (goto-char st)
        (if (= (following-char) ?\) )
@@ -3924,11 +4061,69 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
        (forward-sexp 1))))))
 
 (defun verilog-declaration-beg ()
-  (verilog-re-search-backward verilog-declaration-re (bobp) t))
-
-;;
-;;
-;;  Mode
+  (verilog-re-search-backward (verilog-get-declaration-re) (bobp) t))
+
+(defun verilog-align-typedef-enabled-p ()
+  "Return non-nil if alignment of user typedefs is enabled.
+This will be automatically set when either `verilog-align-typedef-regexp'
+or `verilog-align-typedef-words' are non-nil."
+  (when (or verilog-align-typedef-regexp
+            verilog-align-typedef-words)
+    t))
+
+(defun verilog-get-declaration-typedef-re ()
+  "Return regexp of a user defined typedef.
+See `verilog-align-typedef-regexp' and `verilog-align-typedef-words'."
+  (let (typedef-re words words-re re)
+    (when (verilog-align-typedef-enabled-p)
+      (setq typedef-re verilog-align-typedef-regexp)
+      (setq words verilog-align-typedef-words)
+      (setq words-re (verilog-regexp-words verilog-align-typedef-words))
+      (cond ((and typedef-re (not words))
+             (setq re typedef-re))
+            ((and (not typedef-re) words)
+             (setq re words-re))
+            ((and typedef-re words)
+             (setq re (concat verilog-align-typedef-regexp "\\|" words-re))))
+      (concat "\\s-*" "\\(" verilog-declaration-prefix-re "\\s-*\\(" 
verilog-range-re "\\)?" "\\s-*\\)?"
+              (concat "\\(" re "\\)")
+              "\\(\\s-*" verilog-range-re "\\)?\\s-+"))))
+
+(defun verilog-get-declaration-re (&optional type)
+  "Return declaration regexp depending on customizable variables and TYPE."
+  (let ((re (cond ((equal type 'iface-mp)
+                   verilog-declaration-or-iface-mp-re)
+                  ((equal type 'embedded-comments)
+                   verilog-declaration-embedded-comments-re)
+                  (verilog-indent-declaration-macros
+                   verilog-declaration-re-macro)
+                  (t
+                   verilog-declaration-re))))
+    (when (and (verilog-align-typedef-enabled-p)
+               (or (string= re verilog-declaration-or-iface-mp-re)
+                   (string= re verilog-declaration-re)))
+      (setq re (concat "\\(" (verilog-get-declaration-typedef-re) "\\)\\|\\(" 
re "\\)")))
+    re))
+
+(defun verilog-looking-at-decl-to-align ()
+  "Return non-nil if pointing at a Verilog variable declaration that must be 
aligned."
+  (let* ((re (verilog-get-declaration-re))
+         (valid-re (looking-at re))
+         (id-pos (match-end 0)))
+    (and valid-re
+         (not (verilog-at-struct-decl-p))
+         (not (verilog-at-enum-decl-p))
+         (save-excursion
+           (goto-char id-pos)
+           (verilog-forward-syntactic-ws)
+           (and (not (looking-at ";"))
+                (not (member (thing-at-point 'symbol) verilog-keywords))
+                (progn ; Avoid alignment of instances whose name match user 
defined types
+                  (forward-word)
+                  (verilog-forward-syntactic-ws)
+                  (not (looking-at "("))))))))
+
+;;; Mode:
 ;;
 (defvar verilog-which-tool 1)
 ;;;###autoload
@@ -3965,6 +4160,11 @@ Variables controlling indentation/edit style:
    function keyword.
  `verilog-indent-level-directive'     (default 1)
    Indentation of \\=`ifdef/\\=`endif blocks.
+ `verilog-indent-ignore-multiline-defines' (default t)
+   Non-nil means ignore indentation on lines that are part of a multiline
+   define.
+ `verilog-indent-ignore-regexp'     (default nil
+   Regexp that matches lines that should be ignored for indentation.
  `verilog-cexp-indent'              (default 1)
    Indentation of Verilog statements broken across lines i.e.:
       if (a)
@@ -3988,6 +4188,9 @@ Variables controlling indentation/edit style:
    otherwise you get:
       if (a)
       begin
+ `verilog-indent-class-inside-pkg'  (default t)
+   Non-nil means indent classes inside packages.
+   Otherwise, classes have zero indentation.
  `verilog-auto-endcomments'         (default t)
    Non-nil means a comment /* ... */ is set after the ends which ends
    cases, tasks, functions and modules.
@@ -3997,6 +4200,17 @@ Variables controlling indentation/edit style:
    will be inserted.  Setting this variable to zero results in every
    end acquiring a comment; the default avoids too many redundant
    comments in tight quarters.
+ `verilog-align-decl-expr-comments' (default t)
+   Non-nil means align declaration and expressions comments.
+ `verilog-align-comment-distance'   (default 1)
+   Distance (in spaces) between longest declaration and comments.
+   Only works if `verilog-align-decl-expr-comments' is non-nil.
+ `verilog-align-assign-expr'        (default nil)
+   Non-nil means align expressions of continuous assignments.
+ `verilog-align-typedef-regexp'     (default nil)
+   Regexp that matches user typedefs for declaration alignment.
+ `verilog-align-typedef-words'      (default nil)
+   List of words that match user typedefs for declaration alignment.
  `verilog-auto-lineup'              (default `declarations')
    List of contexts where auto lineup of code should be done.
 
@@ -4020,17 +4234,20 @@ Some other functions are:
     \\[verilog-mark-defun]  Mark function.
     \\[verilog-beg-of-defun]  Move to beginning of current function.
     \\[verilog-end-of-defun]  Move to end of current function.
-    \\[verilog-label-be]  Label matching begin ... end, fork ... join, etc 
statements.
+    \\[verilog-label-be]  Label matching begin ... end, fork ... join, etc
+                          statements.
 
     \\[verilog-comment-region]  Put marked area in a comment.
-    \\[verilog-uncomment-region]  Uncomment an area commented with 
\\[verilog-comment-region].
+    \\[verilog-uncomment-region]  Uncomment an area commented with
+                                  \\[verilog-comment-region].
     \\[verilog-insert-block]  Insert begin ... end.
     \\[verilog-star-comment]    Insert /* ... */.
 
     \\[verilog-sk-always]  Insert an always @(AS) begin .. end block.
     \\[verilog-sk-begin]  Insert a begin .. end block.
     \\[verilog-sk-case]  Insert a case block, prompting for details.
-    \\[verilog-sk-for]  Insert a for (...) begin .. end block, prompting for 
details.
+    \\[verilog-sk-for]  Insert a for (...) begin .. end block, prompting for
+                        details.
     \\[verilog-sk-generate]  Insert a generate .. endgenerate block.
     \\[verilog-sk-header]  Insert a header block at the top of file.
     \\[verilog-sk-initial]  Insert an initial begin .. end block.
@@ -4053,14 +4270,17 @@ Some other functions are:
     \\[verilog-sk-else-if]  Insert an else if (..) begin .. end block.
     \\[verilog-sk-comment]  Insert a comment block.
     \\[verilog-sk-assign]  Insert an assign .. = ..; statement.
-    \\[verilog-sk-function]  Insert a function .. begin .. end endfunction 
block.
+    \\[verilog-sk-function]  Insert a function .. begin .. end endfunction
+                             block.
     \\[verilog-sk-input]  Insert an input declaration, prompting for details.
     \\[verilog-sk-output]  Insert an output declaration, prompting for details.
-    \\[verilog-sk-state-machine]  Insert a state machine definition, prompting 
for details.
+    \\[verilog-sk-state-machine]  Insert a state machine definition, prompting
+                                  for details.
     \\[verilog-sk-inout]  Insert an inout declaration, prompting for details.
     \\[verilog-sk-wire]  Insert a wire declaration, prompting for details.
     \\[verilog-sk-reg]  Insert a register declaration, prompting for details.
-    \\[verilog-sk-define-signal]  Define signal under point as a register at 
the top of the module.
+    \\[verilog-sk-define-signal]  Define signal under point as a register at
+                                  the top of the module.
 
 All key bindings can be seen in a Verilog-buffer with \\[describe-bindings].
 Key bindings specific to `verilog-mode-map' are:
@@ -4147,7 +4367,7 @@ Key bindings specific to `verilog-mode-map' are:
   ;; verilog-mode-hook call added by define-derived-mode
   )
 
-;;; Integration with the speedbar
+;;; Integration with the speedbar:
 ;;
 
 ;; Avoid problems with XEmacs byte-compiles.
@@ -4427,15 +4647,24 @@ following code fragment:
   "Mark the current Verilog function (or procedure).
 This puts the mark at the end, and point at the beginning."
   (interactive)
-  (if (featurep 'xemacs)
-      (progn
-       (push-mark)
-       (verilog-end-of-defun)
-       (push-mark)
-       (verilog-beg-of-defun)
-       (if (fboundp 'zmacs-activate-region)
-           (zmacs-activate-region)))
-    (mark-defun)))
+  (let (found)
+    (if (featurep 'xemacs)
+        (progn
+          (push-mark)
+          (verilog-end-of-defun)
+          (push-mark)
+          (verilog-beg-of-defun)
+          (if (fboundp 'zmacs-activate-region)
+              (zmacs-activate-region)))
+      ;; GNU Emacs
+      (when (verilog-beg-of-defun)
+        (setq found (point))
+        (verilog-end-of-defun)
+        (end-of-line)
+        (push-mark)
+        (goto-char found)
+        (beginning-of-line)
+        (setq mark-active t)))))
 
 (defun verilog-comment-region (start end)
   ;; checkdoc-params: (start end)
@@ -4514,7 +4743,21 @@ area.  See also `verilog-comment-region'."
 (defun verilog-beg-of-defun ()
   "Move backward to the beginning of the current function or procedure."
   (interactive)
-  (verilog-re-search-backward verilog-defun-re nil 'move))
+  (let (found)
+    (save-excursion
+      (when (verilog-looking-back verilog-defun-tf-re-end (point-at-bol))
+        (verilog-backward-sexp)
+        (setq found (point)))
+      (while (and (not found)
+                  (verilog-re-search-backward verilog-defun-tf-re-all nil t))
+        (cond ((verilog-looking-back "\\(\\<typedef\\>\\s-+\\)" 
(point-at-bol)) ; corner case, e.g. 'typedef class <id>;'
+               (backward-word))
+              ((looking-at verilog-defun-tf-re-end)
+               (verilog-backward-sexp))
+              ((looking-at verilog-defun-tf-re-beg)
+               (setq found (point))))))
+    (when found
+      (goto-char found))))
 
 (defun verilog-beg-of-defun-quick ()
   "Move backward to the beginning of the current function or procedure.
@@ -4525,7 +4768,10 @@ Uses `verilog-scan' cache."
 (defun verilog-end-of-defun ()
   "Move forward to the end of the current function or procedure."
   (interactive)
-  (verilog-re-search-forward verilog-end-defun-re nil 'move))
+  (when (or (looking-at verilog-defun-tf-re-beg)
+            (verilog-beg-of-defun))
+    (verilog-forward-sexp)
+    (point)))
 
 (defun verilog-get-end-of-defun ()
   (save-excursion
@@ -4542,10 +4788,10 @@ Uses `verilog-scan' cache."
        (case-fold-search nil)
        (oldpos (point))
        (b (progn
-            (verilog-beg-of-defun)
+            (verilog-re-search-backward verilog-defun-re nil 'move)
             (point-marker)))
        (e (progn
-            (verilog-end-of-defun)
+            (verilog-re-search-forward verilog-end-defun-re nil 'move)
             (point-marker))))
     (goto-char (marker-position b))
     (if (> (- e b) 200)
@@ -4605,19 +4851,18 @@ Uses `verilog-scan' cache."
                 (goto-char h)))
              ;; stop if we see an extended complete reg, perhaps a complete one
              (and
-              (looking-at verilog-complete-reg)
+              (looking-at verilog-complete-re)
               (let* ((p (point)))
                 (while (and (looking-at verilog-extended-complete-re)
                             (progn (setq p (point))
                                    (verilog-backward-token)
                                    (/= p (point)))))
                 (goto-char p)))
-             ;; stop if we see a complete reg (previous found extended ones)
-             (looking-at verilog-basic-complete-re)
              ;; stop if previous token is an ender
              (save-excursion
                (verilog-backward-token)
-               (looking-at verilog-end-block-re))))
+               (or (looking-at verilog-end-block-re)
+                    (verilog-in-directive-p)))))
       (verilog-backward-syntactic-ws)
       (verilog-backward-token))
     ;; Now point is where the previous line ended.
@@ -4634,28 +4879,23 @@ Uses `verilog-scan' cache."
       (verilog-backward-syntactic-ws))
   (let ((pt (point)))
     (catch 'done
-      (while (not (looking-at verilog-complete-reg))
+      (while (not (looking-at verilog-complete-re))
         (setq pt (point))
         (verilog-backward-syntactic-ws)
         (if (or (bolp)
                 (= (preceding-char) ?\;)
+                (and (= (preceding-char) ?\{)
+                     (save-excursion
+                       (backward-char)
+                       (verilog-at-struct-p)))
                (progn
                  (verilog-backward-token)
-                 (looking-at verilog-ends-re)))
+                  (or (looking-at verilog-ends-re)
+                      (looking-at "begin"))))
             (progn
               (goto-char pt)
               (throw 'done t)))))
     (verilog-forward-syntactic-ws)))
-;;
-;;      (while (and
-;;              (not (looking-at verilog-complete-reg))
-;;              (not (bolp))
-;;              (not (= (preceding-char) ?\;)))
-;;        (verilog-backward-token)
-;;        (verilog-backward-syntactic-ws)
-;;        (setq pt (point)))
-;;      (goto-char pt)
-;;   ;(verilog-forward-syntactic-ws)
 
 (defun verilog-end-of-statement ()
   "Move forward to end of current statement."
@@ -4713,7 +4953,7 @@ Uses `verilog-scan' cache."
         pos)))))
 
 (defun verilog-in-case-region-p ()
-  "Return true if in a case region.
+  "Return non-nil if in a case region.
 More specifically, point @ in the line foo : @ begin"
   (interactive)
   (save-excursion
@@ -4758,37 +4998,29 @@ More specifically, point @ in the line foo : @ begin"
     (forward-sexp arg)))
 
 (defun verilog-in-generate-region-p ()
-  "Return true if in a generate region.
+  "Return non-nil if in a generate region.
 More specifically, after a generate and before an endgenerate."
   (interactive)
-  (let ((nest 1))
-    (save-excursion
-      (catch 'done
-       (while (and
-               (/= nest 0)
-               (verilog-re-search-backward
-                
"\\<\\(module\\)\\|\\(connectmodule\\)\\|\\(generate\\)\\|\\(endgenerate\\)\\|\\(if\\)\\|\\(case\\)\\|\\(for\\)\\>"
 nil 'move)
-               (cond
-                ((match-end 1) ; module - we have crawled out
-                 (throw 'done 1))
-                ((match-end 2) ; connectmodule - we have crawled out
-                 (throw 'done 1))
-                ((match-end 3) ; generate
-                 (setq nest (1- nest)))
-                ((match-end 4) ; endgenerate
-                 (setq nest (1+ nest)))
-                ((match-end 5) ; if
-                 (setq nest (1- nest)))
-                ((match-end 6) ; case
-                 (setq nest (1- nest)))
-                ((match-end 7) ; for
-                 (setq nest (1- nest))))))))
-    (= nest 0) )) ; return nest
+  (let ((pos (point))
+        gen-beg-point gen-end-point)
+    (save-match-data
+      (save-excursion
+        (and (verilog-re-search-backward "\\<\\(generate\\)\\>" nil t)
+             (forward-word)
+             (setq gen-beg-point (point))
+             (verilog-forward-sexp)
+             (backward-word)
+             (setq gen-end-point (point)))))
+    (if (and gen-beg-point gen-end-point
+             (>= pos gen-beg-point)
+             (<= pos gen-end-point))
+        t
+      nil)))
 
 (defun verilog-in-fork-region-p ()
-  "Return true if between a fork and join."
+  "Return non-nil if between a fork and join."
   (interactive)
-  (let ((lim (save-excursion (verilog-beg-of-defun)  (point)))
+  (let ((lim (save-excursion (verilog-re-search-backward verilog-defun-re nil 
'move)  (point)))
        (nest 1))
     (save-excursion
       (while (and
@@ -4802,7 +5034,7 @@ More specifically, after a generate and before an 
endgenerate."
     (= nest 0) )) ; return nest
 
 (defun verilog-in-deferred-immediate-final-p ()
-  "Return true if inside an `assert/assume/cover final' statement."
+  "Return non-nil if inside an `assert/assume/cover final' statement."
   (interactive)
   (and (looking-at "final")
        (verilog-looking-back "\\<\\(?:assert\\|assume\\|cover\\)\\>\\s-+" nil))
@@ -5013,7 +5245,7 @@ primitive or interface named NAME."
                             (insert str)
                             (ding 't))
                         (let ((lim
-                               (save-excursion (verilog-beg-of-defun) (point)))
+                               (save-excursion (verilog-re-search-backward 
verilog-defun-re nil 'move) (point)))
                               (here (point)))
                           (cond
                            (;-- handle named block differently
@@ -5461,7 +5693,7 @@ For example:
 becomes:
         // surefire lint_line_off UDDONX"
   (interactive)
-  (let ((buff (if (boundp 'next-error-last-buffer) ;Added to Emacs-22.1
+  (let ((buff (if (boundp 'next-error-last-buffer)  ; Added to Emacs-22.1
                   next-error-last-buffer
                 (verilog--suppressed-warnings
                     ((obsolete compilation-last-buffer))
@@ -5585,13 +5817,14 @@ FILENAME to find directory to run in, or defaults to 
`buffer-file-name'."
 (defun verilog-warn-error (string &rest args)
   "Call `error' using STRING and optional ARGS.
 If `verilog-warn-fatal' is non-nil, call `verilog-warn' instead."
-  (apply (if verilog-warn-fatal #'error #'verilog-warn)
+  (apply (if (and verilog-warn-fatal verilog-warn-fatal-internal)
+             #'error #'verilog-warn)
          string args))
 
 (defmacro verilog-batch-error-wrapper (&rest body)
   "Execute BODY and add error prefix to any errors found.
 This lets programs calling batch mode to easily extract error messages."
-  `(let ((verilog-warn-fatal nil))
+  `(let ((verilog-warn-fatal-internal nil))
      (condition-case err
         (progn ,@body)
        (error
@@ -5721,7 +5954,7 @@ This sets up the appropriate Verilog mode environment, 
calls
     (string      . 0)))
 
 (defun verilog-continued-line-1 (lim)
-  "Return true if this is a continued line.
+  "Return non-nil if this is a continued line.
 Set point to where line starts.  Limit search to point LIM."
   (let ((continued 't))
     (if (eq 0 (forward-line -1))
@@ -5774,7 +6007,6 @@ Return a list of two elements: (INDENT-TYPE 
INDENT-LEVEL)."
                    ;; if we are in a parenthesized list, and the user likes to 
indent these, return.
                    ;; unless we are in the newfangled coverpoint or constraint 
blocks
                    (if (and
-                        verilog-indent-lists
                         (verilog-in-paren)
                         (not (verilog-in-coverage-p))
                         )
@@ -5791,7 +6023,7 @@ Return a list of two elements: (INDENT-TYPE 
INDENT-LEVEL)."
                                   (looking-at verilog-in-constraint-re) ))  ; 
may still get hosed if concat in constraint
                          (let ((sp (point)))
                            (if (and
-                                (not (looking-at verilog-complete-reg))
+                                (not (looking-at verilog-complete-re))
                                 (verilog-continued-line-1 lim))
                                (progn (goto-char sp)
                                       (throw 'nesting 'cexp))
@@ -5996,6 +6228,12 @@ Return a list of two elements: (INDENT-TYPE 
INDENT-LEVEL)."
                        (goto-char here) ; or is clocking, starts a new block
                        (throw 'nesting 'block)))))
 
+             ;; if find `ifn?def `else `elsif
+             ((or (match-end 20)
+                  (match-end 21)
+                  (match-end 22))
+              (throw 'continue 'foo))
+
              ((looking-at "\\<class\\|struct\\|function\\|task\\>")
               ;; *sigh* These words have an optional prefix:
               ;; extern {virtual|protected}? function a();
@@ -6025,7 +6263,7 @@ Return a list of two elements: (INDENT-TYPE 
INDENT-LEVEL)."
               ;;    {assert|assume|cover} property (); are complete
               ;;   and could also be labeled: - foo: assert property
               ;; but
-              ;;    property ID () ... needs end_property
+              ;;    property ID () ... needs endproperty
               (verilog-beg-of-statement)
               (if (looking-at verilog-property-re)
                   (throw 'continue 'statement) ; We don't need an endproperty 
for these
@@ -6110,6 +6348,23 @@ of the appropriate enclosing block."
        (ding 't)
        (setq nest 0))))))
 
+(defun verilog-leap-to-class-head ()
+  (let ((nest 1)
+        (class-re (concat "\\(\\<class\\>\\)\\|\\(\\<endclass\\>\\)")))
+    (catch 'skip
+      (while (verilog-re-search-backward class-re nil 'move)
+        (cond
+         ((match-end 1) ; begin
+          (when (verilog-looking-back 
"\\(\\<interface\\>\\s-+\\)\\|\\(\\<virtual\\>\\s-+\\)" (point-at-bol))
+            (goto-char (match-beginning 0)))
+          (unless (verilog-looking-back "\\<typedef\\>\\s-+" (point-at-bol))
+            (setq nest (1- nest))
+            (if (= 0 nest)
+               ;; Now previous line describes syntax
+               (throw 'skip 1))))
+        ((match-end 2) ; end
+          (setq nest (1+ nest))))))))
+
 (defun verilog-leap-to-head ()
   "Move point to the head of this block.
 Jump from end to matching begin, from endcase to matching case, and so on."
@@ -6137,7 +6392,9 @@ Jump from end to matching begin, from endcase to matching 
case, and so on."
       (setq reg "\\(\\<fork\\>\\)\\|\\(\\<join\\(_any\\|_none\\)?\\>\\)" ))
      ((looking-at "\\<endclass\\>")
       ;; 5: Search back for matching class
-      (setq reg "\\(\\<class\\>\\)\\|\\(\\<endclass\\>\\)" ))
+      (catch 'nesting
+        (verilog-leap-to-class-head)
+        (setq reg nil)))
      ((looking-at "\\<endtable\\>")
       ;; 6: Search back for matching table
       (setq reg "\\(\\<table\\>\\)\\|\\(\\<endtable\\>\\)" ))
@@ -6175,7 +6432,19 @@ Jump from end to matching begin, from endcase to 
matching case, and so on."
       (setq reg "\\(\\<\\(rand\\)?sequence\\>\\)\\|\\(\\<endsequence\\>\\)" ))
      ((looking-at "\\<endclocking\\>")
       ;; 12: Search back for matching clocking
-      (setq reg "\\(\\<clocking\\)\\|\\(\\<endclocking\\>\\)" )))
+      (setq reg "\\(\\<clocking\\)\\|\\(\\<endclocking\\>\\)" ))
+     ;; Search back for matching package
+     ((looking-at "\\<endpackage\\>")
+      (setq reg "\\(\\<package\\>\\)" ))
+     ;; Search back for matching program
+     ((looking-at "\\<endprogram\\>")
+      (setq reg "\\(\\<program\\>\\)" ))
+     ((looking-at "\\<`endif\\>")
+      ;; Search back for matching `endif `else `elsif
+      (setq reg "\\(\\<`ifn?def\\>\\)\\|\\(\\<`endif\\>\\)" ))
+     ((looking-at "\\<`else\\>")
+      ;; Search back for matching `else `else `elsif
+      (setq reg "\\(\\<`ifn?def\\>\\|\\<`elsif\\>\\)\\|\\(\\<`else\\>\\)" )))
     (if reg
        (catch 'skip
          (if (eq nesting 'yes)
@@ -6221,7 +6490,7 @@ Jump from end to matching begin, from endcase to matching 
case, and so on."
              (throw 'skip 1)))))))
 
 (defun verilog-continued-line ()
-  "Return true if this is a continued line.
+  "Return non-nil if this is a continued line.
 Set point to where line starts."
   (let ((continued 't))
     (if (eq 0 (forward-line -1))
@@ -6394,10 +6663,10 @@ Optional BOUND limits search."
            (let ((state (save-excursion (verilog-syntax-ppss))))
              (cond
                ((nth 7 state)  ; in // comment
-               (verilog-re-search-backward "//" nil 'move)
+               (re-search-backward "//" nil 'move)
                 (skip-chars-backward "/"))
                ((nth 4 state)  ; in /* */ comment
-               (verilog-re-search-backward "/\\*" nil 'move))))
+               (re-search-backward "/\\*" nil 'move))))
            (narrow-to-region bound (point))
            (while (/= here (point))
              (setq here (point))
@@ -6450,13 +6719,60 @@ Optional BOUND limits search."
              (if jump
                  (beginning-of-line 2))))))))
 
+(defun verilog-pos-at-beg-of-statement ()
+  "Return point position at the beginning of current statement."
+  (save-excursion
+    (verilog-beg-of-statement)
+    (point)))
+
+(defun verilog-col-at-beg-of-statement ()
+  "Return current column at the beginning of current statement."
+  (save-excursion
+    (verilog-beg-of-statement)
+    (current-column)))
+
+(defun verilog-pos-at-end-of-statement ()
+  "Return point position at the end of current statement."
+  (save-excursion
+    (verilog-end-of-statement)))
+
+(defun verilog-col-at-end-of-statement ()
+  "Return current column at the end of current statement."
+  (save-excursion
+    (verilog-end-of-statement)
+    (current-column)))
+
+(defun verilog-pos-at-forward-syntactic-ws ()
+  "Return point position at next non whitespace/comment token."
+  (save-excursion
+    (verilog-forward-syntactic-ws)
+    (point)))
+
+(defun verilog-col-at-forward-syntactic-ws ()
+  "Return current column at next non whitespace/comment token."
+  (save-excursion
+    (verilog-forward-syntactic-ws)
+    (current-column)))
+
+(defun verilog-pos-at-backward-syntactic-ws ()
+  "Return point position at previous non whitespace/comment token."
+  (save-excursion
+    (verilog-backward-syntactic-ws)
+    (point)))
+
+(defun verilog-col-at-backward-syntactic-ws ()
+  "Return current column at previous non whitespace/comment token."
+  (save-excursion
+    (verilog-backward-syntactic-ws)
+    (current-column)))
+
 (defun verilog-in-comment-p ()
-  "Return true if in a star or // comment."
+  "Return non-nil if in a star or // comment."
   (let ((state (save-excursion (verilog-syntax-ppss))))
     (or (nth 4 state) (nth 7 state))))
 
 (defun verilog-in-star-comment-p ()
-  "Return true if in a star comment."
+  "Return non-nil if in a star comment."
   (let ((state (save-excursion (verilog-syntax-ppss))))
     (and
      (nth 4 state)                     ; t if in a comment of style a // or b 
/**/
@@ -6465,40 +6781,39 @@ Optional BOUND limits search."
       ))))
 
 (defun verilog-in-slash-comment-p ()
-  "Return true if in a slash comment."
+  "Return non-nil if in a slash comment."
   (let ((state (save-excursion (verilog-syntax-ppss))))
     (nth 7 state)))
 
 (defun verilog-in-comment-or-string-p ()
-  "Return true if in a string or comment."
+  "Return non-nil if in a string or comment."
   (let ((state (save-excursion (verilog-syntax-ppss))))
     (or (nth 3 state) (nth 4 state) (nth 7 state)))) ; Inside string or 
comment)
 
 (defun verilog-in-attribute-p ()
-  "Return true if point is in an attribute (* [] attribute *)."
-  (save-match-data
-    (save-excursion
-      (verilog-re-search-backward "\\((\\*\\)\\|\\(\\*)\\)" nil 'move)
-      (cond
-       ((match-end 1)
-        (progn (goto-char (match-end 1))
-               (not (looking-at "\\s-*)")))
-        nil)
-       ((match-end 2)
-        (progn (goto-char (match-beginning 2))
-               (not (looking-at "(\\s-*")))
-        nil)
-       (t nil)))))
+  "Return non-nil if point is in an attribute (* [] attribute *)."
+  (let ((pos (point)))
+    (save-match-data
+      (save-excursion
+        (and (verilog-re-search-backward "(\\*" nil 'move)
+             (progn (forward-sexp)
+                    (skip-chars-backward "*)"))
+             (< pos (point)))))))
 
 (defun verilog-in-parameter-p ()
-  "Return true if point is in a parameter assignment #( p1=1, p2=5)."
+  "Return non-nil if point is in a parameter assignment #( p1=1, p2=5)."
   (save-match-data
     (save-excursion
-      (verilog-re-search-backward "\\(#(\\)\\|\\()\\)" nil 'move)
-      (numberp (match-beginning 1)))))
+      (and (progn
+             (verilog-backward-up-list 1)
+             (verilog-backward-syntactic-ws)
+             (= (preceding-char) ?\#))
+           (progn
+             (verilog-beg-of-statement-1)
+             (looking-at verilog-defun-re))))))
 
 (defun verilog-in-escaped-name-p ()
-  "Return true if in an escaped name."
+  "Return non-nil if in an escaped name."
   (save-excursion
     (backward-char)
     (skip-chars-backward "^ \t\n\f")
@@ -6507,20 +6822,20 @@ Optional BOUND limits search."
       nil)))
 
 (defun verilog-in-directive-p ()
-  "Return true if in a directive."
+  "Return non-nil if in a directive."
   (save-excursion
     (beginning-of-line)
     (looking-at verilog-directive-re-1)))
 
 (defun verilog-in-parenthesis-p ()
-  "Return true if in a ( ) expression (but not { } or [ ])."
+  "Return non-nil if in a ( ) expression (but not { } or [ ])."
   (save-match-data
     (save-excursion
       (verilog-re-search-backward "\\((\\)\\|\\()\\)" nil 'move)
       (numberp (match-beginning 1)))))
 
 (defun verilog-in-paren ()
-  "Return true if in a parenthetical expression.
+  "Return non-nil if in a parenthetical expression.
 May cache result using `verilog-syntax-ppss'."
   (let ((state (save-excursion (verilog-syntax-ppss))))
     (> (nth 0 state) 0 )))
@@ -6534,7 +6849,7 @@ May cache result using `verilog-syntax-ppss'."
       0 )))
 
 (defun verilog-in-paren-quick ()
-  "Return true if in a parenthetical expression.
+  "Return non-nil if in a parenthetical expression.
 Always starts from `point-min', to allow inserts with hooks disabled."
   ;; The -quick refers to its use alongside the other -quick functions,
   ;; not that it's likely to be faster than verilog-in-paren.
@@ -6542,7 +6857,7 @@ Always starts from `point-min', to allow inserts with 
hooks disabled."
     (> (nth 0 state) 0 )))
 
 (defun verilog-in-struct-p ()
-  "Return true if in a struct declaration."
+  "Return non-nil if in a struct declaration."
   (interactive)
   (save-excursion
     (if (verilog-in-paren)
@@ -6568,7 +6883,7 @@ Return >0 for nested struct."
         nil))))
 
 (defun verilog-in-coverage-p ()
-  "Return true if in a constraint or coverpoint expression."
+  "Return non-nil if in a constraint or coverpoint expression."
   (interactive)
   (save-excursion
     (if (verilog-in-paren)
@@ -6608,7 +6923,7 @@ Also move point to constraint."
                        (equal (char-before) ?\;)
                        (equal (char-before) ?\}))
                    ;; skip what looks like bus repetition operator {#{
-                   (not (string-match "^{\\s-*[()0-9a-zA-Z_\\]*\\s-*{"
+                   (not (string-match "^{\\s-*[][()0-9a-zA-Z_,:\\]*\\s-*{"
                                       (buffer-substring p (point)))))))))
       (progn
         (let ( (pt (point)) (pass 0))
@@ -6625,7 +6940,7 @@ Also move point to constraint."
                        ))
             ;; if first word token not keyword, it maybe the instance name
             ;;   check next word token
-            (if (looking-at "\\<\\w+\\>\\|\\s-*(\\s-*\\S-+")
+            (if (looking-at "\\<\\w+\\>\\|\\s-*[[(}]\\s-*\\S-+")
                 (progn (verilog-beg-of-statement)
                        (if (and
                             (not (string-match verilog-named-block-re 
(buffer-substring pt (point)))) ;; Abort if 'begin' keyword is found
@@ -6674,13 +6989,39 @@ Also move point to constraint."
        (verilog-in-struct-p)
        (looking-at "}\\(?:\\s-*\\w+\\s-*\\(?:,\\s-*\\w+\\s-*\\)*\\)?;")))
 
+(defun verilog-at-struct-decl-p ()
+  "Return non-nil if at a struct declaration."
+  (interactive)
+  (save-excursion
+    (verilog-re-search-forward "{" (point-at-eol) t)
+    (unless (bobp)
+      (backward-char))
+    (verilog-at-struct-p)))
+
+(defun verilog-at-enum-p ()
+  "If at the { of a enum, return true, not moving point."
+  (save-excursion
+    (when (equal (char-after) ?\{)
+      (verilog-beg-of-statement)
+      (beginning-of-line)
+      (when (verilog-re-search-forward verilog-typedef-enum-re 
(verilog-pos-at-end-of-statement) t)
+        t))))
+
+(defun verilog-at-enum-decl-p ()
+  "Return non-nil if at a enum declaration."
+  (interactive)
+  (save-excursion
+    (verilog-re-search-forward "{" (verilog-pos-at-end-of-statement) t)
+    (unless (bobp)
+      (backward-char))
+    (verilog-at-enum-p)))
+
 (defun verilog-parenthesis-depth ()
   "Return non zero if in parenthetical-expression."
   (save-excursion (nth 1 (verilog-syntax-ppss))))
 
-
 (defun verilog-skip-forward-comment-or-string ()
-  "Return true if in a string or comment."
+  "Return non-nil if in a string or comment."
   (let ((state (save-excursion (verilog-syntax-ppss))))
     (cond
      ((nth 3 state)                    ;Inside string
@@ -6695,7 +7036,7 @@ Also move point to constraint."
       nil))))
 
 (defun verilog-skip-backward-comment-or-string ()
-  "Return true if in a string or comment."
+  "Return non-nil if in a string or comment."
   (let ((state (save-excursion (verilog-syntax-ppss))))
     (cond
      ((nth 3 state)                    ;Inside string
@@ -6712,7 +7053,7 @@ Also move point to constraint."
       nil))))
 
 (defun verilog-skip-backward-comments ()
-  "Return true if a comment was skipped."
+  "Return non-nil if a comment was skipped."
   (let ((more t))
     (while more
       (setq more
@@ -6831,6 +7172,9 @@ Only look at a few lines to determine indent level."
   (let ((type (car indent-str))
        (ind (car (cdr indent-str))))
     (cond
+     (; handle indentation ignoring
+      (verilog-indent-ignore-p)
+      nil)
      (; handle continued exp
       (eq type 'cexp)
       (let ((here (point)))
@@ -6840,14 +7184,14 @@ Only look at a few lines to determine indent level."
           (= (preceding-char) ?\,)
           (save-excursion
             (verilog-beg-of-statement-1)
-            (looking-at verilog-declaration-re)))
+            (verilog-looking-at-decl-to-align)))
          (let* ( fst
                  (val
                   (save-excursion
                     (backward-char 1)
                     (verilog-beg-of-statement-1)
                     (setq fst (point))
-                    (if (looking-at verilog-declaration-re)
+                    (if (looking-at (verilog-get-declaration-re))
                          (progn  ; we have multiple words
                           (goto-char (match-end 0))
                           (skip-chars-forward " \t")
@@ -6869,9 +7213,9 @@ Only look at a few lines to determine indent level."
                         (+ (current-column) verilog-cexp-indent))))))
            (goto-char here)
            (indent-line-to val)
-           (if (and (not verilog-indent-lists)
-                    (verilog-in-paren))
-               (verilog-pretty-declarations-auto))
+            (when (and (not verilog-indent-lists)
+                       (verilog-in-paren))
+              (verilog-pretty-declarations-auto))
            ))
         ((= (preceding-char) ?\) )
          (goto-char here)
@@ -6897,21 +7241,17 @@ Only look at a few lines to determine indent level."
 
      (; handle inside parenthetical expressions
       (eq type 'cparenexp)
-      (let* ( here
-             (val (save-excursion
-                    (verilog-backward-up-list 1)
-                    (forward-char 1)
-                     (if verilog-indent-lists
-                         (skip-chars-forward " \t")
-                       (verilog-forward-syntactic-ws))
+      (let* ((val (verilog-cparenexp-indent-level))
+             (here (save-excursion
+                     (verilog-backward-up-list 1)
+                     (forward-char 1)
+                     (skip-chars-forward " \t")
+                     (point)))
+             (decl (save-excursion
+                     (goto-char here)
+                     (verilog-forward-syntactic-ws)
                      (setq here (point))
-                     (current-column)))
-
-             (decl (save-excursion
-                     (goto-char here)
-                     (verilog-forward-syntactic-ws)
-                     (setq here (point))
-                     (looking-at verilog-declaration-re))))
+                     (looking-at (verilog-get-declaration-re)))))
         (indent-line-to val)
         (if decl
             (verilog-pretty-declarations-auto))))
@@ -6938,17 +7278,20 @@ Only look at a few lines to determine indent level."
 
      (;-- defun
       (and (eq type 'defun)
-          (looking-at verilog-zero-indent-re))
+          (or (and verilog-indent-class-inside-pkg
+                    (looking-at verilog-zero-indent-no-class-re))
+               (and (not verilog-indent-class-inside-pkg)
+                    (looking-at verilog-zero-indent-re))))
       (indent-line-to 0))
 
      (;-- declaration
       (and (or
            (eq type 'defun)
            (eq type 'block))
-          (looking-at verilog-declaration-re)
+           (verilog-looking-at-decl-to-align)
            ;; Do not consider "virtual function", "virtual task", "virtual 
class"
            ;; as declarations
-           (not (looking-at (concat verilog-declaration-re
+           (not (looking-at (concat (verilog-get-declaration-re)
                                     "\\s-+\\(function\\|task\\|class\\)\\b"))))
       (verilog-indent-declaration ind))
 
@@ -6994,6 +7337,81 @@ Do not count named blocks or case-statements."
      (t
       (current-column)))))
 
+(defun verilog-cparenexp-indent-level ()
+  "Return indent level for current line inside a parenthetical expression."
+  (let ((start-pos (point))
+        (close-par (looking-at "[)}]"))
+        pos pos-arg-paren)
+    (save-excursion
+      (verilog-backward-up-list 1)
+      (if verilog-indent-lists
+          (progn
+            (forward-char 1)
+            (skip-chars-forward " \t")
+            (current-column))
+        ;; Indentation with `verilog-indent-lists' set to nil
+        (verilog-beg-of-statement-1)
+        (when (looking-at "\\<\\(function\\|task\\)\\>")
+          (verilog-beg-of-statement)) ; find virtual/protected/static
+        (cond (;; 1) Closing ); of a module/function/task
+               (and close-par
+                    (save-excursion
+                      (verilog-beg-of-statement-1)
+                      (or (looking-at verilog-complete-re)
+                          (progn (beginning-of-line)
+                                 (not (looking-at 
verilog-assignment-operation-re))))))
+               (current-column))
+              (;; 2) if (condition)
+               (looking-at "(")
+               (forward-char 1)
+               (skip-chars-forward " \t\f" (point-at-eol))
+               (current-column))
+              (;; 3) Inside a module/defun param list or function/task 
argument list
+               (or (looking-at verilog-defun-level-re)
+                   (looking-at 
"\\(\\<\\(virtual\\|protected\\|static\\)\\>\\s-+\\)?\\(\\<task\\>\\|\\<function\\>\\)"))
+               (setq pos-arg-paren (save-excursion
+                                     (goto-char start-pos)
+                                     (verilog-backward-up-list 1)
+                                     (forward-char)
+                                     (skip-chars-forward " \t")
+                                     (when (not (eolp))
+                                       (current-column))))
+               (or pos-arg-paren
+                   ;; arg in next line after (
+                   (+ (current-column) verilog-indent-level)))
+              (;; 4) Assignment operation
+               (save-excursion
+                 (beginning-of-line)
+                 (and (looking-at verilog-assignment-operation-re)
+                      (save-excursion
+                        (goto-char (match-beginning 2))
+                        (not (verilog-within-string)))
+                      (progn (verilog-forward-syntactic-ws)
+                             (not (looking-at verilog-complete-re)))))
+               (goto-char (match-end 2))
+               (skip-chars-forward " \t\f" (point-at-eol))
+               (skip-chars-forward "{(" (1+ (point)))
+               (skip-chars-forward " \t\f" (point-at-eol))
+               (current-column))
+              (;; 5) Typedef enum declaration
+               (verilog-at-enum-decl-p)
+               (verilog-re-search-forward "{" 
(verilog-pos-at-end-of-statement) t)
+               (if (> (verilog-pos-at-forward-syntactic-ws) (point-at-eol))
+                   (+ (verilog-col-at-beg-of-statement) verilog-indent-level)
+                 (verilog-col-at-forward-syntactic-ws)))
+              (;; 6) Long reporting strings (e.g. $display or $sformatf inside 
`uvm_info)
+               (save-excursion
+                 (goto-char start-pos)
+                 (verilog-backward-up-list 1)
+                 (setq pos (1+ (point)))
+                 (backward-word)
+                 (or (looking-at (concat "\\$" verilog-identifier-re)) ; 
System function/task
+                     (looking-at verilog-uvm-statement-re)))         ; `uvm_* 
macros
+               (goto-char pos)
+               (current-column))
+              (t ;; 7) Default
+               (+ (current-column) verilog-indent-level)))))))
+
 (defun verilog-indent-comment ()
   "Indent current line as comment."
   (let* ((stcol
@@ -7053,90 +7471,137 @@ _ARG is ignored, for `comment-indent-function' 
compatibility."
 
 ;;
 
+(defun verilog-align-comments (startpos endpos)
+  "Align inline comments between STARTPOS and ENDPOS."
+  (let (comm-ind e)
+    (when verilog-align-decl-expr-comments
+      (setq comm-ind (verilog-get-comment-align-indent (marker-position 
startpos) endpos))
+      (save-excursion
+        (goto-char (marker-position startpos))
+        (while (progn (setq e (marker-position endpos))
+                      (< (point) e))
+          (when (verilog-search-comment-in-declaration e)
+            (goto-char (match-beginning 0))
+            (delete-horizontal-space)
+            (indent-to (1- (+ comm-ind verilog-align-comment-distance)))))))))
+
 (defun verilog-pretty-declarations-auto (&optional quiet)
   "Call `verilog-pretty-declarations' QUIET based on `verilog-auto-lineup'."
   (when (or (eq 'all verilog-auto-lineup)
            (eq 'declarations verilog-auto-lineup))
     (verilog-pretty-declarations quiet)))
 
+(defun verilog--pretty-declarations-find-end (&optional reg-end)
+  "Find end position for current alignment of declarations.
+If region is active, use arg REG-END to set a limit on the alignment."
+  (let (e)
+    (if (and (verilog-parenthesis-depth)
+             (not (verilog-in-struct-p)))
+        ;; In an argument list or parameter block
+        (progn
+          (verilog-backward-up-list -1)
+          (forward-char -1)
+          (verilog-backward-syntactic-ws)
+          (if (region-active-p)
+              (min reg-end (point))
+            (point)))
+      ;; In a declaration block (not in argument list)
+      (verilog-end-of-statement)
+      (setq e (point)) ; Might be on last line
+      (verilog-forward-syntactic-ws)
+      (while (verilog-looking-at-decl-to-align)
+        (verilog-end-of-statement)
+        (setq e (point))
+        (verilog-forward-syntactic-ws))
+      (if (region-active-p)
+          (min reg-end e)
+        e))))
+
+(defun verilog--pretty-declarations-find-base-ind ()
+  "Find base indentation for current alignment of declarations."
+  (if (and (verilog-parenthesis-depth)
+           (not (verilog-in-struct-p)))
+      ;; In an argument list or parameter block
+      (progn
+        (unless (or (verilog-looking-back "(" (point-at-bol))
+                    (bolp))
+          (forward-char 1))
+       (skip-chars-forward " \t")
+       (current-column))
+    ;; In a declaration block (not in argument list)
+    (progn
+      (verilog-do-indent (verilog-calculate-indent))
+      (verilog-forward-ws&directives)
+      (current-column))))
+
 (defun verilog-pretty-declarations (&optional quiet)
   "Line up declarations around point.
 Be verbose about progress unless optional QUIET set."
   (interactive)
-  (let* ((m1 (make-marker))
-         (e (point))
-        el
-         r
-        (here (point))
-         ind
-         start
-         startpos
-         end
-         endpos
-         base-ind
-         )
+  (let ((m1 (make-marker))
+        (e (point))
+       (here (point))
+       el r ind start startpos end endpos base-ind rstart rend)
     (save-excursion
+      (when (region-active-p)
+        (setq rstart (region-beginning))
+        (setq rend (region-end))
+        (goto-char rstart)) ; Shrinks the region but ensures that start is a 
valid declaration
       (if (progn
-            ;; (verilog-beg-of-statement-1)
+            ;; Check if alignment can be performed
             (beginning-of-line)
             (verilog-forward-syntactic-ws)
-            (and (not (verilog-in-directive-p))  ; could have `define input foo
-                 (looking-at verilog-declaration-re)))
-         (progn
-           (if (verilog-parenthesis-depth)
-               ;; in an argument list or parameter block
-               (setq el (verilog-backward-up-list -1)
-                     start (progn
-                             (goto-char e)
-                             (verilog-backward-up-list 1)
-                              (forward-line)  ; ignore ( input foo,
-                             (verilog-re-search-forward verilog-declaration-re 
el 'move)
-                             (goto-char (match-beginning 0))
+            (or (and (not (verilog-in-directive-p))  ; could have `define 
input foo
+                     (verilog-looking-at-decl-to-align))
+                (and (verilog-parenthesis-depth)
+                     (looking-at verilog-interface-modport-re))))
+          ;; Find boundaries of alignment
+          (progn
+            (cond (;; Using region
+                   (region-active-p)
+                   (setq start rstart
+                         startpos (set-marker (make-marker) start)
+                         end (progn (goto-char start)
+                                    (verilog--pretty-declarations-find-end 
rend))
+                         endpos (set-marker (make-marker) end)
+                         base-ind (progn (goto-char start)
+                                         
(verilog--pretty-declarations-find-base-ind))))
+                  (;; In an argument list or parameter block
+                   (and (verilog-parenthesis-depth)
+                        (not (verilog-in-struct-p)))
+                   (setq el (verilog-backward-up-list -1)
+                        start (progn
+                                (goto-char e)
+                                (verilog-backward-up-list 1)
+                                (verilog-re-search-forward 
(verilog-get-declaration-re 'iface-mp) el 'move)
+                                (goto-char (match-beginning 0))
+                                (skip-chars-backward " \t")
+                                (point))
+                        startpos (set-marker (make-marker) start)
+                        end (progn (goto-char start)
+                                    (verilog--pretty-declarations-find-end))
+                        endpos (set-marker (make-marker) end)
+                        base-ind (progn (goto-char start)
+                                         
(verilog--pretty-declarations-find-base-ind))))
+                  (;; In a declaration block (not in argument list)
+                   t
+                   (setq
+                   start (progn
+                           (verilog-beg-of-statement-1)
+                           (while (and (verilog-looking-at-decl-to-align)
+                                       (not (bobp)))
                              (skip-chars-backward " \t")
-                             (point))
-                     startpos (set-marker (make-marker) start)
-                     end (progn
-                           (goto-char start)
-                           (verilog-backward-up-list -1)
-                           (forward-char -1)
-                           (verilog-backward-syntactic-ws)
-                           (point))
-                     endpos (set-marker (make-marker) end)
-                     base-ind (progn
-                                (goto-char start)
-                                (forward-char 1)
-                                (skip-chars-forward " \t")
-                                (current-column)))
-             ;; in a declaration block (not in argument list)
-             (setq
-              start (progn
-                      (verilog-beg-of-statement-1)
-                      (while (and (looking-at verilog-declaration-re)
-                                  (not (bobp)))
-                        (skip-chars-backward " \t")
-                        (setq e (point))
-                        (beginning-of-line)
-                        (verilog-backward-syntactic-ws)
-                        (backward-char)
-                        (verilog-beg-of-statement-1))
-                      e)
-              startpos (set-marker (make-marker) start)
-              end (progn
-                    (goto-char here)
-                    (verilog-end-of-statement)
-                    (setq e (point))   ;Might be on last line
-                    (verilog-forward-syntactic-ws)
-                    (while (looking-at verilog-declaration-re)
-                      (verilog-end-of-statement)
-                      (setq e (point))
-                      (verilog-forward-syntactic-ws))
-                    e)
-              endpos (set-marker (make-marker) end)
-              base-ind (progn
-                         (goto-char start)
-                         (verilog-do-indent (verilog-calculate-indent))
-                         (verilog-forward-ws&directives)
-                         (current-column))))
+                             (setq e (point))
+                             (verilog-backward-syntactic-ws)
+                             (backward-char)
+                             (verilog-beg-of-statement-1))
+                           e)
+                   startpos (set-marker (make-marker) start)
+                   end (progn (goto-char here)
+                               (verilog--pretty-declarations-find-end))
+                   endpos (set-marker (make-marker) end)
+                   base-ind (progn (goto-char start)
+                                    
(verilog--pretty-declarations-find-base-ind)))))
            ;; OK, start and end are set
            (goto-char (marker-position startpos))
            (if (and (not quiet)
@@ -7152,12 +7617,13 @@ Be verbose about progress unless optional QUIET set."
                 (indent-line-to base-ind)
                 (verilog-forward-ws&directives)
                 (if (< (point) e)
-                    (verilog-re-search-forward "[ \t\n\f]" e 'move)))
+                    (verilog-re-search-forward "[ \t\n\f]" (marker-position 
endpos) 'move)))
               (t
-               (just-one-space)
-               (verilog-re-search-forward "[ \t\n\f]" e 'move)))
-             ;;(forward-line)
-             )
+                (unless (verilog-looking-back "(" (point-at-bol))
+                  (just-one-space))
+                (if (looking-at verilog-comment-start-regexp)
+                    (verilog-forward-syntactic-ws)
+                 (verilog-re-search-forward "[ \t\n\f]" e 'move)))))
            ;; Now find biggest prefix
            (setq ind (verilog-get-lineup-indent (marker-position startpos) 
endpos))
            ;; Now indent each line.
@@ -7167,27 +7633,27 @@ Be verbose about progress unless optional QUIET set."
                          (> r 0))
              (setq e (point))
              (unless quiet (message "%d" r))
-              ;; (verilog-do-indent (verilog-calculate-indent)))
              (verilog-forward-ws&directives)
              (cond
-              ((or (and verilog-indent-declaration-macros
-                        (looking-at verilog-declaration-re-2-macro))
-                   (looking-at verilog-declaration-re-2-no-macro))
-               (let ((p (match-end 0)))
-                 (set-marker m1 p)
-                 (if (verilog-re-search-forward "[[#`]" p 'move)
-                     (progn
-                       (forward-char -1)
-                       (just-one-space)
-                       (goto-char (marker-position m1))
+              ((looking-at (verilog-get-declaration-re 'iface-mp))
+                (unless (looking-at (verilog-get-declaration-re 
'embedded-comments))
+                  (let ((p (match-end 0)))
+                    (set-marker m1 p)
+                    (if (verilog-re-search-forward "[[#`]" p 'move)
+                        (progn
+                          (forward-char -1)
+                          (just-one-space)
+                          (goto-char (marker-position m1))
+                          (delete-horizontal-space)
+                          (indent-to ind 1))
+                      (progn
                         (delete-horizontal-space)
-                        (indent-to ind 1))
-                   (progn
-                      (delete-horizontal-space)
-                      (indent-to ind 1)))))
+                        (indent-to ind 1))))))
               ((verilog-continued-line-1 (marker-position startpos))
                (goto-char e)
-               (indent-line-to ind))
+                (unless (and (verilog-in-parenthesis-p)
+                             (looking-at (concat "\\s-*" 
verilog-identifier-sym-re "\\s-+" verilog-identifier-sym-re "\\s-*")))
+                  (indent-line-to ind)))
               ((verilog-in-struct-p)
                ;; could have a declaration of a user defined item
                (goto-char e)
@@ -7197,104 +7663,202 @@ Be verbose about progress unless optional QUIET set."
                (verilog-forward-ws&directives)
                (forward-line -1)))
              (forward-line 1))
-           (unless quiet (message "")))))))
+            ;; Align comments if enabled
+            (when verilog-align-decl-expr-comments
+              (verilog-align-comments startpos endpos)))
+        ;; Exit
+       (unless quiet (message ""))))))
+
+(defun verilog--pretty-expr-assignment-found (&optional discard-re)
+  "Return non-nil if point is at a valid assignment operation to be aligned.
+Ensure cursor is not over DISCARD-RE (e.g. Verilog keywords).
+If returned non-nil, update match data according to 
`verilog-assignment-operation-re'."
+  ;; Not looking at a verilog keyword sentence (i.e looking at a potential 
assignment)
+  (and (if discard-re
+           (not (looking-at discard-re))
+         t)
+       ;; Corner case to filter first parameter on param lists
+       (save-excursion
+         (if (and (verilog-re-search-forward verilog-assignment-operation-re 
(point-at-eol) 'move)
+                  (verilog-in-parenthesis-p))
+             (progn (verilog-backward-up-list 1)
+                    (forward-char 1)
+                    (not (eq 0 (string-match discard-re 
(buffer-substring-no-properties (point) (point-at-eol))))))
+           t))
+       ;; Don't work on multiline assignments unless they are continued lines
+       ;; e.g, multiple parameters or variable declarations in the same 
statement
+       (if (save-excursion
+             (and (not (verilog-in-parameter-p))
+                  (verilog-continued-line)
+                  (not (looking-at verilog-basic-complete-re))))
+           (save-excursion
+             (verilog-beg-of-statement-1)
+             (looking-at (verilog-get-declaration-re)))
+         t)
+       ;; Ensure it's not any kind of logical comparison
+       (save-excursion
+         (unless (and (not (verilog-in-parameter-p))
+                      (verilog-re-search-forward (verilog-regexp-words '("if" 
"for" "assert" "with")) (point-at-eol) 'move))
+           t))
+       ;; Looking at an assignment (last check, provides match data)
+       (looking-at verilog-assignment-operation-re)))
+
+(defun verilog--pretty-expr-find-end (&optional discard-re reg-end)
+  "Find end position for current alignment of expressions.
+Use optional arg DISCARD-RE when aligning expressions outside of an
+argument list and REG-END to set a limit on the alignment when the
+region is active."
+  (if (verilog-in-parenthesis-p)
+      ;; Limit end in argument list
+      (progn
+        (verilog-backward-up-list -1)
+        (forward-char -1)
+        (verilog-backward-syntactic-ws)
+        (if (region-active-p)
+            (min reg-end (point))
+          (point)))
+    ;; Limit end in non-argument list
+    (save-excursion ; EOL of the last line of the assignment block
+      (end-of-line)
+      (let ((pt (point))) ; Might be on last line
+        (verilog-forward-syntactic-ws)
+        (beginning-of-line)
+        (while (and (verilog--pretty-expr-assignment-found discard-re)
+                    (progn
+                      (end-of-line)
+                      (not (eq pt (point)))))
+          (setq pt (point))
+          (verilog-forward-syntactic-ws)
+          (beginning-of-line))
+        (if (region-active-p)
+            (min reg-end pt)
+          pt)))))
 
 (defun verilog-pretty-expr (&optional quiet)
   "Line up expressions around point.
 If QUIET is non-nil, do not print messages showing the progress of line-up."
   (interactive)
-  (unless (verilog-in-comment-or-string-p)
+  (let* ((basic-complete-pretty-expr-re (if verilog-align-assign-expr
+                                            
verilog-basic-complete-expr-no-assign-re
+                                          verilog-basic-complete-expr-re))
+         (complete-pretty-expr-re (concat verilog-extended-complete-re 
"\\|\\(" basic-complete-pretty-expr-re "\\)"))
+         (discard-re (concat "^\\s-*\\(" complete-pretty-expr-re "\\)"))
+         rstart rend)
     (save-excursion
-      (let ((regexp (concat "^\\s-*" verilog-complete-reg))
-            (regexp1 (concat "^\\s-*" verilog-basic-complete-re)))
+      (when (region-active-p)
+        (setq rstart (region-beginning))
+        (setq rend (region-end))
+        (goto-char rstart))
+      (unless (verilog-in-comment-or-string-p)
         (beginning-of-line)
-        (when (and (not (looking-at regexp))
-                   (looking-at verilog-assignment-operation-re)
+        (when (and (verilog--pretty-expr-assignment-found discard-re)
                    (save-excursion
                      (goto-char (match-end 2))
                      (and (not (verilog-in-attribute-p))
-                          (not (verilog-in-parameter-p))
                           (not (verilog-in-comment-or-string-p)))))
-          (let* ((start (save-excursion ; BOL of the first line of the 
assignment block
-                          (beginning-of-line)
-                          (let ((pt (point)))
-                            (verilog-backward-syntactic-ws)
-                            (beginning-of-line)
-                            (while (and (not (looking-at regexp1))
-                                        (looking-at 
verilog-assignment-operation-re)
-                                        (not (bobp)))
-                              (setq pt (point))
-                              (verilog-backward-syntactic-ws)
-                              (beginning-of-line)) ; Ack, need to grok `define
-                            pt)))
-                 (end (save-excursion ; EOL of the last line of the assignment 
block
-                        (end-of-line)
-                        (let ((pt (point))) ; Might be on last line
-                          (verilog-forward-syntactic-ws)
-                          (beginning-of-line)
-                          (while (and
-                                  (not (looking-at regexp1))
-                                  (looking-at verilog-assignment-operation-re)
-                                  (progn
-                                    (end-of-line)
-                                    (not (eq pt (point)))))
-                            (setq pt (point))
-                            (verilog-forward-syntactic-ws)
-                            (beginning-of-line))
-                          pt)))
-                 (contains-2-char-operator (string-match "<=" 
(buffer-substring-no-properties start end)))
-                 (endmark (set-marker (make-marker) end)))
-            (goto-char start)
-            (verilog-do-indent (verilog-calculate-indent))
+          (let* ((start (cond (;; Using region
+                               (region-active-p)
+                               rstart)
+                              (;; Parameter list
+                               (verilog-in-parenthesis-p)
+                               (progn
+                                 (verilog-backward-up-list 1)
+                                 (forward-char)
+                                 (verilog-re-search-forward 
verilog-assignment-operation-re-2 nil 'move)
+                                 (goto-char (match-beginning 0))
+                                 (point)))
+                              (t ;; Declarations
+                               (save-excursion ; BOL of the first line of the 
assignment block
+                                 (beginning-of-line)
+                                 (let ((pt (point)))
+                                   (verilog-backward-syntactic-ws)
+                                   (beginning-of-line)
+                                   (while (and 
(verilog--pretty-expr-assignment-found discard-re)
+                                               (not (bobp)))
+                                     (setq pt (point))
+                                     (verilog-backward-syntactic-ws)
+                                     (beginning-of-line)) ; Ack, need to grok 
`define
+                                   pt)))))
+                 (startpos (set-marker (make-marker) start))
+                 (end (cond (;; Using region
+                             (region-active-p)
+                             (verilog--pretty-expr-find-end discard-re rend))
+                            (;; Parameter list
+                             (verilog-in-parenthesis-p)
+                             (verilog--pretty-expr-find-end))
+                            (t ;; Declarations
+                             (verilog--pretty-expr-find-end discard-re))))
+                (endpos (set-marker (make-marker) end))
+                 (contains-2-char-operator (string-match "<=" 
(buffer-substring-no-properties start end))))
+            ;; Start with alignment
+            (goto-char startpos)
+            (unless (save-excursion
+                      (beginning-of-line)
+                      (looking-at discard-re))
+              (verilog-do-indent (verilog-calculate-indent)))
             (when (and (not quiet)
-                       (> (- end start) 100))
+                       (> (- (marker-position endpos) (marker-position 
startpos)) 100))
               (message "Lining up expressions.. (please stand by)"))
-
             ;; Set indent to minimum throughout region
             ;; Rely on mark rather than on point as the indentation changes can
             ;; make the older point reference obsolete
-            (while (< (point) (marker-position endmark))
+            (while (< (point) (marker-position endpos))
               (beginning-of-line)
               (save-excursion
-                (verilog-just-one-space verilog-assignment-operation-re))
+                (if (looking-at verilog-complete-re)
+                    (progn (goto-char (marker-position startpos))
+                           (verilog-just-one-space 
verilog-assignment-operation-re-2))
+                  (verilog-just-one-space verilog-assignment-operation-re)))
               (verilog-do-indent (verilog-calculate-indent))
               (end-of-line)
               (verilog-forward-syntactic-ws))
 
-            (let ((ind (verilog-get-lineup-indent-2 
verilog-assignment-operation-re start (marker-position endmark))) ; Find the 
biggest prefix
+            (let ((ind (verilog-get-lineup-indent-2 
verilog-assignment-operation-re (marker-position startpos) (marker-position 
endpos))) ; Find the biggest prefix
                   e)
               ;; Now indent each line.
-              (goto-char start)
+              (goto-char (marker-position startpos))
               (while (progn
-                       (setq e (marker-position endmark))
+                       (setq e (marker-position endpos))
                        (> e (point)))
                 (unless quiet
                   (message " verilog-pretty-expr: %d" (- e (point))))
                 (setq e (point))
                 (cond
-                 ((looking-at verilog-assignment-operation-re)
+                 ((or (looking-at verilog-assignment-operation-re)
+                      (and (verilog-in-parenthesis-p)
+                           (looking-at verilog-assignment-operation-re-2)))
                   (goto-char (match-beginning 2))
-                  (unless (or (verilog-in-parenthesis-p) ; Leave attributes 
and comparisons alone
+                  (unless (or (and (verilog-in-parenthesis-p) ; Leave 
attributes and comparisons alone
+                                   (save-excursion ; Allow alignment of some 
expressions inside param/port list
+                                     (verilog-backward-up-list 1)
+                                     (verilog-beg-of-statement-1)
+                                     (not (looking-at 
verilog-defun-level-re))))
                               (verilog-in-coverage-p))
                     (if (and contains-2-char-operator
                              (eq (char-after) ?=))
                         (indent-to (1+ ind)) ; Line up the = of the <= with 
surrounding =
-                      (indent-to ind))))
-                 ((verilog-continued-line-1 start)
+                      (indent-to ind)))
+                  (forward-line 1))
+                 ((and (save-excursion
+                         (verilog-forward-syntactic-ws)
+                         (not (looking-at verilog-complete-re)))
+                       (verilog-continued-line-1 (marker-position startpos)))
                   (goto-char e)
-                  (indent-line-to ind))
-                 (t                     ; Must be comment or white space
+                  (indent-line-to ind)
+                  (forward-line 1))
+                 (t ; Must be comment, white space or syntax error
                   (goto-char e)
-                  (verilog-forward-ws&directives)
-                  (forward-line -1)))
-                (forward-line 1))
+                  (forward-line 1))))
+              ;; Align comments if enabled
+              (when verilog-align-decl-expr-comments
+                (verilog-align-comments startpos endpos))
               (unless quiet
                 (message "")))))))))
 
 (defun verilog-just-one-space (myre)
   "Remove extra spaces around regular expression MYRE."
   (interactive)
-  (if (and (not(looking-at verilog-complete-reg))
+  (if (and (not(looking-at verilog-complete-re))
           (looking-at myre))
       (let ((p1 (match-end 1))
            (p2 (match-end 2)))
@@ -7312,59 +7876,63 @@ BASEIND is the base indent to offset everything."
   ;; `ind' is used in expressions stored in `verilog-indent-alist'.
   (verilog--suppressed-warnings ((lexical ind)) (defvar ind))
   (let ((pos (point-marker))
-       (lim (save-excursion
-              ;; (verilog-re-search-backward verilog-declaration-opener nil 
'move)
-              (verilog-re-search-backward 
"\\(\\<begin\\>\\)\\|\\(\\<\\(connect\\)?module\\>\\)\\|\\(\\<task\\>\\)" nil 
'move)
-              (point)))
-       (ind)
-       (val)
-       (m1 (make-marker)))
-    (setq val
-         (+ baseind (eval (cdr (assoc 'declaration verilog-indent-alist)))))
+        (m1 (make-marker))
+        (in-paren (verilog-parenthesis-depth))
+        (val (+ baseind (eval (cdr (assoc 'declaration 
verilog-indent-alist)))))
+        ind)
     (indent-line-to val)
-
     ;; Use previous declaration (in this module) as template.
-    (if (or (eq 'all verilog-auto-lineup)
-           (eq 'declarations verilog-auto-lineup))
-       (if (verilog-re-search-backward
-            (or (and verilog-indent-declaration-macros
-                     verilog-declaration-re-1-macro)
-                verilog-declaration-re-1-no-macro)
-            lim t)
-           (progn
-             (goto-char (match-end 0))
-             (skip-chars-forward " \t")
-             (setq ind (current-column))
-             (goto-char pos)
-             (setq val
-                   (+ baseind
-                      (eval (cdr (assoc 'declaration verilog-indent-alist)))))
-             (indent-line-to val)
-             (if (and verilog-indent-declaration-macros
-                      (looking-at verilog-declaration-re-2-macro))
-                 (let ((p (match-end 0)))
-                   (set-marker m1 p)
-                   (if (verilog-re-search-forward "[[#`]" p 'move)
-                       (progn
-                         (forward-char -1)
-                         (just-one-space)
-                         (goto-char (marker-position m1))
-                          (delete-horizontal-space)
-                          (indent-to ind 1))
-                      (delete-horizontal-space)
-                      (indent-to ind 1)))
-               (if (looking-at verilog-declaration-re-2-no-macro)
-                   (let ((p (match-end 0)))
-                     (set-marker m1 p)
-                     (if (verilog-re-search-forward "[[`#]" p 'move)
-                         (progn
-                           (forward-char -1)
-                           (just-one-space)
-                           (goto-char (marker-position m1))
-                            (delete-horizontal-space)
-                            (indent-to ind 1))
-                        (delete-horizontal-space)
-                        (indent-to ind 1))))))))
+    (when (and (or (eq 'all verilog-auto-lineup)
+                   (eq 'declarations verilog-auto-lineup))
+               ;; Limit alignment to consecutive statements
+               (progn
+                 (verilog-backward-syntactic-ws)
+                 (backward-char)
+                 (looking-at ";"))
+               (progn
+                 (verilog-beg-of-statement)
+                 (looking-at (verilog-get-declaration-re)))
+               ;; Make sure that we don't jump to an argument list or 
parameter block if
+               ;; we were in a declaration block (not in argument list)
+               (or (and in-paren
+                        (verilog-parenthesis-depth))
+                   (and (not in-paren)
+                        (not (verilog-parenthesis-depth))))
+               ;; Skip variable declarations inside functions/tasks
+               (skip-chars-backward " \t\f")
+               (bolp))
+      (goto-char (match-end 0))
+      (skip-chars-forward " \t")
+      (setq ind (current-column))
+      (goto-char pos)
+      (setq val
+            (+ baseind
+               (eval (cdr (assoc 'declaration verilog-indent-alist)))))
+      (indent-line-to val)
+      (if (looking-at (verilog-get-declaration-re))
+          (let ((p (match-end 0)))
+            (set-marker m1 p)
+            (if (verilog-re-search-forward "[[#`]" p 'move)
+                (progn
+                  (forward-char -1)
+                  (just-one-space)
+                  (goto-char (marker-position m1))
+                  (delete-horizontal-space)
+                  (indent-to ind 1))
+              (delete-horizontal-space)
+              (indent-to ind 1)))
+        (when (looking-at (verilog-get-declaration-re))
+          (let ((p (match-end 0)))
+            (set-marker m1 p)
+            (if (verilog-re-search-forward "[[`#]" p 'move)
+                (progn
+                  (forward-char -1)
+                  (just-one-space)
+                  (goto-char (marker-position m1))
+                  (delete-horizontal-space)
+                  (indent-to ind 1))
+              (delete-horizontal-space)
+              (indent-to ind 1))))))
     (goto-char pos)))
 
 (defun verilog-get-lineup-indent (b edpos)
@@ -7376,16 +7944,13 @@ Region is defined by B and EDPOS."
       ;; Get rightmost position
       (while (progn (setq e (marker-position edpos))
                    (< (point) e))
-       (if (verilog-re-search-forward
-            (or (and verilog-indent-declaration-macros
-                     verilog-declaration-re-1-macro)
-                verilog-declaration-re-1-no-macro) e 'move)
-           (progn
-             (goto-char (match-end 0))
-             (verilog-backward-syntactic-ws)
-             (if (> (current-column) ind)
-                 (setq ind (current-column)))
-             (goto-char (match-end 0)))))
+       (when (verilog-re-search-forward (verilog-get-declaration-re 'iface-mp) 
e 'move)
+         (goto-char (match-end 0))
+         (verilog-backward-syntactic-ws)
+         (if (> (current-column) ind)
+             (setq ind (current-column)))
+          (goto-char (match-end 0))
+          (forward-line 1)))
       (if (> ind 0)
          (1+ ind)
        ;; No lineup-string found
@@ -7402,12 +7967,13 @@ BEG and END."
   (save-excursion
     (let ((ind 0))
       (goto-char beg)
+      (beginning-of-line)
       ;; Get rightmost position
       (while (< (point) end)
        (when (and (verilog-re-search-forward regexp end 'move)
                    (not (verilog-in-attribute-p))) ; skip attribute exprs
          (goto-char (match-beginning 2))
-         (verilog-backward-syntactic-ws)
+          (skip-chars-backward " \t")
          (if (> (current-column) ind)
              (setq ind (current-column)))
          (goto-char (match-end 0))))
@@ -7420,6 +7986,32 @@ BEG and END."
                  (1+ (current-column))))
       ind)))
 
+(defun verilog-search-comment-in-declaration (bound)
+  "Move cursor to position of comment in declaration and return point.
+BOUND is a buffer position that bounds the search."
+  (and (verilog-re-search-forward (verilog-get-declaration-re 'iface-mp) bound 
'move)
+       (not (looking-at (concat "\\s-*" verilog-comment-start-regexp)))
+       (re-search-forward verilog-comment-start-regexp (point-at-eol) 
:noerror)))
+
+(defun verilog-get-comment-align-indent (b endpos)
+  "Return the indent level that will line up comments within the region.
+Region is defined by B and ENDPOS."
+  (save-excursion
+    (let ((ind 0)
+          e comm-ind)
+      (goto-char b)
+      ;; Get rightmost position
+      (while (progn (setq e (marker-position endpos))
+                    (< (point) e))
+        (when (verilog-search-comment-in-declaration e)
+          (end-of-line)
+          (verilog-backward-syntactic-ws)
+          (setq comm-ind (1+ (current-column)))
+          (when (> comm-ind ind)
+            (setq ind comm-ind)))
+        (forward-line 1))
+      ind)))
+
 (defun verilog-comment-depth (type val)
   "A useful mode debugging aide.  TYPE and VAL are comments for insertion."
   (save-excursion
@@ -7439,6 +8031,19 @@ BEG and END."
     (insert
      (format "%s %d" type val))))
 
+(defun verilog-indent-ignore-p ()
+  "Return non-nil if current line should ignore indentation."
+  (or (and verilog-indent-ignore-multiline-defines
+           ;; Line with multiline define, ends with "\" or "\" plus trailing 
whitespace
+           (or (looking-at ".*\\\\\\s-*$")
+               (save-excursion  ; Last line after multiline define
+                 (verilog-backward-syntactic-ws)
+                 (unless (bobp)
+                   (backward-char))
+                 (looking-at "\\\\"))))
+      (and verilog-indent-ignore-regexp ; Ignore lines according to specified 
regexp
+           (looking-at verilog-indent-ignore-regexp))))
+
 
 ;;; Completion:
 ;;
@@ -7446,7 +8051,7 @@ BEG and END."
 (defvar verilog-all nil)
 (defvar verilog-buffer-to-use nil)
 (defvar verilog-toggle-completions nil
-  "True means \\<verilog-mode-map>\\[verilog-complete-word] should try all 
possible completions one by one.
+  "Non-nil means \\<verilog-mode-map>\\[verilog-complete-word] should try all 
possible completions one by one.
 Repeated use of \\[verilog-complete-word] will show you all of them.
 Normally, when there is more than one possible completion,
 it displays a list of all possible completions.")
@@ -7598,16 +8203,14 @@ TYPE is `module', `tf' for task or function, or t if 
unknown."
 (defun verilog-get-completion-decl (end)
   "Macro for searching through current declaration (var, type or const)
 for matches of `str' and adding the occurrence tp `all' through point END."
-  (let ((re (or (and verilog-indent-declaration-macros
-                    verilog-declaration-re-2-macro)
-               verilog-declaration-re-2-no-macro))
+  (let ((re (verilog-get-declaration-re))
        decl-end match)
     ;; Traverse lines
     (while (and (< (point) end)
                (verilog-re-search-forward re end t))
       ;; Traverse current line
       (setq decl-end (save-excursion (verilog-declaration-end)))
-      (while (and (verilog-re-search-forward verilog-symbol-re decl-end t)
+      (while (and (verilog-re-search-forward verilog-identifier-sym-re 
decl-end t)
                  (not (match-end 1)))
        (setq match (buffer-substring (match-beginning 0) (match-end 0)))
        (if (string-match (concat "\\<" verilog-str) match)
@@ -7619,7 +8222,7 @@ for matches of `str' and adding the occurrence tp `all' 
through point END."
   "Calculate all possible completions for variables (or constants)."
   (let ((start (point)))
     ;; Search for all reachable var declarations
-    (verilog-beg-of-defun)
+    (verilog-re-search-backward verilog-defun-re nil 'move)
     (save-excursion
       ;; Check var declarations
       (verilog-get-completion-decl start))))
@@ -8765,6 +9368,11 @@ Return an array of [outputs inouts inputs wire reg 
assign const gparam intf]."
                 (t  ; Bit width
                 (setq vec (verilog-string-replace-matches
                            "\\s-+" "" nil nil keywd)))))
+         ;; int'(a) is cast, not declaration of a
+         ((and (looking-at "'")
+               (not rvalue))
+          (forward-char 1)
+          (setq expect-signal nil rvalue nil))
         ;; Normal or escaped identifier -- note we remember the \ if escaped
         ((looking-at "\\s-*\\([a-zA-Z0-9`_$]+\\|\\\\[^ \t\n\f]+\\)")
          (goto-char (match-end 0))
@@ -9702,9 +10310,9 @@ resolve it.  If optional RECURSE is non-nil, recurse 
through \\=`includes.
 Localparams must be simple assignments to constants, or have their own
 \"localparam\" label rather than a list of localparams.  Thus:
 
-    localparam X = 5, Y = 10;  // Ok
-    localparam X = {1\\='b1, 2\\='h2}; // Ok
-    localparam X = {1\\='b1, 2\\='h2}, Y = 10; // Bad, make into 2 localparam 
lines
+    localparam X = 5, Y = 10;   // Ok
+    localparam X = {1\\='b1, 2\\='h2};  // Ok
+    localparam X = {1\\='b1, 2\\='h2}, Y = 10;  // Bad, make into 2 localparam 
lines
 
 Defines must be simple text substitutions, one on a line, starting
 at the beginning of the line.  Any ifdefs or multiline comments around the
@@ -9827,8 +10435,7 @@ variable over and over when many modules are compiled 
together, put a test
 around the inside each include file:
 
 foo.v (an include file):
-        \\=`ifdef _FOO_V        // include if not already included
-        \\=`else
+        \\=`ifndef _FOO_V        // include if not already included
         \\=`define _FOO_V
         ... contents of file
         \\=`endif // _FOO_V"
@@ -10066,7 +10673,7 @@ Results are cached if inside 
`verilog-preserve-dir-cache'."
 ;; (prin1 (verilog-dir-files ".")) nil)
 
 (defun verilog-dir-file-exists-p (filename)
-  "Return true if FILENAME exists.
+  "Return non-nil if FILENAME exists.
 Like `file-exists-p' but results are cached if inside
 `verilog-preserve-dir-cache'."
   (let* ((dirname (file-name-directory filename))
@@ -10105,7 +10712,7 @@ Allows version control to check out the file if need 
be."
             modi)))))
 
 (defun verilog-is-number (symbol)
-  "Return true if SYMBOL is number-like."
+  "Return non-nil if SYMBOL is number-like."
   (or (string-match "^[0-9 \t:]+$" symbol)
       (string-match "^[---]*[0-9]+$" symbol)
       (string-match "^[0-9 \t]+'s?[hdxbo][0-9a-fA-F_xz? \t]*$" symbol)))
@@ -10177,7 +10784,7 @@ Or, just the existing dirnames themselves if there are 
no wildcards."
   (unless dirnames
     (error "`verilog-library-directories' should include at least `.'"))
   (save-match-data
-    (setq dirnames (reverse dirnames)) ; not nreverse
+    (setq dirnames (reverse dirnames))  ; not nreverse
     (let ((dirlist nil)
           pattern dirfile dirfiles dirname root filename rest basefile)
       (setq dirnames (mapcar #'substitute-in-file-name dirnames))
@@ -10885,12 +11492,12 @@ This repairs those mis-inserted by an AUTOARG."
                                (if (equal (match-string 3 out) ">>")
                                    (int-to-string (ash (string-to-number 
(match-string 2 out))
                                                        (* -1 (string-to-number 
(match-string 4 out))))))
-                               (if (equal (match-string 3 out) "<<")
-                                   (int-to-string (ash (string-to-number 
(match-string 2 out))
-                                                       (string-to-number 
(match-string 4 out)))))
                                (if (equal (match-string 3 out) ">>>")
                                    (int-to-string (ash (string-to-number 
(match-string 2 out))
                                                        (* -1 (string-to-number 
(match-string 4 out))))))
+                               (if (equal (match-string 3 out) "<<")
+                                   (int-to-string (ash (string-to-number 
(match-string 2 out))
+                                                       (string-to-number 
(match-string 4 out)))))
                                (if (equal (match-string 3 out) "<<<")
                                    (int-to-string (ash (string-to-number 
(match-string 2 out))
                                                        (string-to-number 
(match-string 4 out)))))
@@ -10920,7 +11527,7 @@ This repairs those mis-inserted by an AUTOARG."
     (ceiling (/ (log value) (log 2)))))
 
 (defun verilog-typedef-name-p (variable-name)
-  "Return true if the VARIABLE-NAME is a type definition."
+  "Return non-nil if the VARIABLE-NAME is a type definition."
   (when verilog-typedef-regexp
     (verilog-string-match-fold verilog-typedef-regexp variable-name)))
 
@@ -11678,7 +12285,7 @@ If PAR-VALUES replace final strings with these 
parameter values."
                              (concat "." vl-modport) "")
                          dflt-bits))
     ;; Find template
-    (cond (tpl-ass         ; Template of exact port name
+    (cond (tpl-ass  ; Template of exact port name
           (setq tpl-net (nth 1 tpl-ass)))
          ((nth 1 tpl-list) ; Wildcards in template, search them
           (let ((wildcards (nth 1 tpl-list)))
@@ -12240,7 +12847,9 @@ For more information see the \\[verilog-faq] and forums 
at URL
           (cond ((not verilog-auto-inst-first-any)
                 (re-search-backward "," pt t)
                 (delete-char 1)
-                (insert ");")
+                 (when (looking-at "  ")
+                   (delete-char 1))  ; so we can align // Templated comments
+                 (insert ");")
                  (search-forward "\n")  ; Added by inst-port
                 (delete-char -1)
                  (if (search-forward ")" nil t)  ; From user, moved up a line
@@ -14645,7 +15254,7 @@ and the case items."
     (if (not (member v1 verilog-keywords))
        (save-excursion
          (setq verilog-sk-signal v1)
-         (verilog-beg-of-defun)
+         (verilog-re-search-backward verilog-defun-re nil 'move)
          (verilog-end-of-statement)
          (verilog-forward-syntactic-ws)
          (verilog-sk-def-reg)
@@ -14897,7 +15506,12 @@ Files are checked based on `verilog-library-flags'."
      '(
        verilog-active-low-regexp
        verilog-after-save-font-hook
+       verilog-align-assign-expr
+       verilog-align-comment-distance
+       verilog-align-decl-expr-comments
        verilog-align-ifelse
+       verilog-align-typedef-regexp
+       verilog-align-typedef-words
        verilog-assignment-delay
        verilog-auto-arg-sort
        verilog-auto-declare-nettype
@@ -14942,13 +15556,17 @@ Files are checked based on `verilog-library-flags'."
        verilog-compiler
        verilog-coverage
        verilog-delete-auto-hook
+       verilog-fontify-variables
        verilog-getopt-flags-hook
        verilog-highlight-grouping-keywords
        verilog-highlight-includes
        verilog-highlight-modules
        verilog-highlight-translate-off
        verilog-indent-begin-after-if
+       verilog-indent-class-inside-pkg
        verilog-indent-declaration-macros
+       verilog-indent-ignore-multiline-defines
+       verilog-indent-ignore-regexp
        verilog-indent-level
        verilog-indent-level-behavioral
        verilog-indent-level-declaration
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 4fe4edc164..8a90b6d26e 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -2,8 +2,8 @@
 
 ;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
 
-;; Author:   Alex Rezinsky <alexr@msil.sps.mot.com>
-;;           (doesn't seem to be responsive any more)
+;; Author: Alex Rezinsky <alexr@msil.sps.mot.com>
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: mode-line, imenu, tools
 
 ;; This file is part of GNU Emacs.
@@ -27,16 +27,6 @@
 ;; located in mode line.  It assumes that you work with the imenu
 ;; package and `imenu--index-alist' is up to date.
 
-;; KNOWN BUGS
-;; ----------
-;; Really this package shows not "function where the current point is
-;; located now", but "nearest function which defined above the current
-;; point".  So if your current point is located after the end of
-;; function FOO but before the beginning of function BAR, FOO will be
-;; displayed in the mode line.
-;; - If two windows display the same buffer, both windows
-;;   show the same `which-func' information.
-
 ;; TODO LIST
 ;; ---------
 ;;     1. Dependence on imenu package should be removed.  Separate
@@ -50,8 +40,8 @@
 ;; THANKS TO
 ;; ---------
 ;; Per Abrahamsen   <abraham@iesd.auc.dk>
-;;     Some ideas (inserting  in mode-line,  using of post-command  hook
-;;     and toggling this  mode) have  been   borrowed from  his  package
+;;     Some ideas (inserting in mode-line, using of post-command hook
+;;     and toggling this mode) have been borrowed from his package
 ;;     column.el
 ;; Peter Eisenhauer <pipe@fzi.de>
 ;;     Bug fixing in case nested indexes.
@@ -61,9 +51,6 @@
 
 ;;; Code:
 
-;; So that we can use the edebug spec in `lisp-current-defun-name'.
-(require 'edebug)
-
 ;; Variables for customization
 ;; ---------------------------
 ;;
@@ -91,12 +78,22 @@ then Which Function mode is enabled in any major mode that 
supports it."
 This means that Which Function mode won't really do anything
 until you use Imenu, in these modes.  Note that files
 larger than `which-func-maxout' behave in this way too;
-Which Function mode doesn't do anything until you use Imenu."
+Which Function mode doesn't do anything until you use Imenu.
+
+If Which Function delays the initial display of buffers too much,
+e.g., when it is used with Eglot, and the language server takes a
+long time to send the information, you can use this option to delay
+activation of Which Function until Imenu is used for the first time."
   :type '(repeat (symbol :tag "Major mode")))
 
 (defcustom which-func-maxout 500000
   "Don't automatically compute the Imenu menu if buffer is this big or bigger.
-Zero means compute the Imenu menu regardless of size."
+Zero means compute the Imenu menu regardless of size.
+
+If Which Function delays the initial display of buffers too much,
+e.g., when it is used with Eglot, and the language server takes a
+long time to send the information, you can use this option to delay
+activation of Which Function until Imenu is used for the first time."
   :type 'integer)
 
 (defvar which-func-keymap
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 139929dc8a..0790d3a565 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1,7 +1,7 @@
 ;;; xref.el --- Cross-referencing commands              -*-lexical-binding:t-*-
 
 ;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
-;; Version: 1.5.1
+;; Version: 1.6.0
 ;; Package-Requires: ((emacs "26.1"))
 
 ;; This is a GNU ELPA :core package.  Avoid functionality that is not
@@ -346,7 +346,9 @@ backward."
         (value nil))
     (while (progn
              (goto-char (funcall next (point) property))
-             (not (or (setq value (get-text-property (point) property))
+             (not (or (and
+                       (memq (get-char-property (point) 'invisible) '(ellipsis 
nil))
+                       (setq value (get-text-property (point) property)))
                       (eobp)
                       (bobp)))))
     (cond (value)
@@ -427,32 +429,82 @@ or earlier: it can break 
`dired-do-find-regexp-and-replace'."
   :version "28.1"
   :package-version '(xref . "1.2.0"))
 
+(defcustom xref-history-storage #'xref-global-history
+  "Function that returns xref history.
+
+The following functions that can be used as this variable's value
+are predefined:
+
+- `xref-global-history'
+    Return a single, global history used across the entire Emacs
+    session.  This is the default.
+- `xref-window-local-history'
+    Return separate xref histories, one per window.  Allows
+    independent navigation of code in each window.  A new
+    xref history is created for every new window."
+  :type '(radio
+          (function-item :tag "Per-window history" xref-window-local-history)
+          (function-item :tag "Global history for Emacs session"
+                         xref-global-history)
+          (function :tag "Other"))
+  :version "29.1"
+  :package-version '(xref . "1.6.0"))
+
 (make-obsolete-variable 'xref--marker-ring 'xref--history "29.1")
 
 (defun xref-set-marker-ring-length (_var _val)
   (declare (obsolete nil "29.1"))
   nil)
 
-(defvar xref--history (cons nil nil)
+(defun xref--make-xref-history ()
+  "Return a new xref history."
+  (cons nil nil))
+
+(defvar xref--history (xref--make-xref-history)
   "(BACKWARD-STACK . FORWARD-STACK) of markers to visited Xref locations.")
 
+(defun xref-global-history (&optional new-value)
+  "Return the xref history that is global for the current Emacs session.
+
+Override existing value with NEW-VALUE if NEW-VALUE is set."
+  (if new-value
+      (setq xref--history new-value)
+    xref--history))
+
+(defun xref-window-local-history (&optional new-value)
+  "Return window-local xref history for the selected window.
+
+Override existing value with NEW-VALUE if NEW-VALUE is set."
+  (let ((w (selected-window)))
+    (if new-value
+        (set-window-parameter w 'xref--history new-value)
+      (or (window-parameter w 'xref--history)
+          (set-window-parameter w 'xref--history (xref--make-xref-history))))))
+
+(defun xref--get-history ()
+  "Return xref history using xref-history-storage."
+  (funcall xref-history-storage))
+
 (defun xref--push-backward (m)
   "Push marker M onto the backward history stack."
-  (unless (equal m (caar xref--history))
-    (push m (car xref--history))))
+  (let ((history (xref--get-history)))
+    (unless (equal m (caar history))
+      (push m (car history)))))
 
 (defun xref--push-forward (m)
   "Push marker M onto the forward history stack."
-  (unless (equal m (cadr xref--history))
-    (push m (cdr xref--history))))
+  (let ((history (xref--get-history)))
+    (unless (equal m (cadr history))
+      (push m (cdr history)))))
 
 (defun xref-push-marker-stack (&optional m)
   "Add point M (defaults to `point-marker') to the marker stack.
 The future stack is erased."
   (xref--push-backward (or m (point-marker)))
-  (dolist (mk (cdr xref--history))
-    (set-marker mk nil nil))
-  (setcdr xref--history nil))
+  (let ((history (xref--get-history)))
+    (dolist (mk (cdr history))
+      (set-marker mk nil nil))
+    (setcdr history nil)))
 
 ;;;###autoload
 (define-obsolete-function-alias 'xref-pop-marker-stack #'xref-go-back "29.1")
@@ -462,29 +514,31 @@ The future stack is erased."
   "Go back to the previous position in xref history.
 To undo, use \\[xref-go-forward]."
   (interactive)
-  (if (null (car xref--history))
-      (user-error "At start of xref history")
-    (let ((marker (pop (car xref--history))))
-      (xref--push-forward (point-marker))
-      (switch-to-buffer (or (marker-buffer marker)
-                            (user-error "The marked buffer has been deleted")))
-      (goto-char (marker-position marker))
-      (set-marker marker nil nil)
-      (run-hooks 'xref-after-return-hook))))
+  (let ((history (xref--get-history)))
+    (if (null (car history))
+        (user-error "At start of xref history")
+      (let ((marker (pop (car history))))
+        (xref--push-forward (point-marker))
+        (switch-to-buffer (or (marker-buffer marker)
+                              (user-error "The marked buffer has been 
deleted")))
+        (goto-char (marker-position marker))
+        (set-marker marker nil nil)
+        (run-hooks 'xref-after-return-hook)))))
 
 ;;;###autoload
 (defun xref-go-forward ()
   "Got to the point where a previous \\[xref-go-back] was invoked."
   (interactive)
-  (if (null (cdr xref--history))
-      (user-error "At end of xref history")
-    (let ((marker (pop (cdr xref--history))))
-      (xref--push-backward (point-marker))
-      (switch-to-buffer (or (marker-buffer marker)
-                            (user-error "The marked buffer has been deleted")))
-      (goto-char (marker-position marker))
-      (set-marker marker nil nil)
-      (run-hooks 'xref-after-return-hook))))
+  (let ((history (xref--get-history)))
+    (if (null (cdr history))
+        (user-error "At end of xref history")
+      (let ((marker (pop (cdr history))))
+        (xref--push-backward (point-marker))
+        (switch-to-buffer (or (marker-buffer marker)
+                              (user-error "The marked buffer has been 
deleted")))
+        (goto-char (marker-position marker))
+        (set-marker marker nil nil)
+        (run-hooks 'xref-after-return-hook)))))
 
 (define-obsolete-variable-alias
   'xref--current-item
@@ -510,22 +564,23 @@ This can be used from `xref-after-jump-hook', for 
instance.")
 ;; etags.el needs this
 (defun xref-clear-marker-stack ()
   "Discard all markers from the xref history."
-  (dolist (l (list (car xref--history) (cdr xref--history)))
-    (dolist (m l)
-      (set-marker m nil nil)))
-  (setq xref--history (cons nil nil))
+  (let ((history (xref--get-history)))
+    (dolist (l (list (car history) (cdr history)))
+      (dolist (m l)
+        (set-marker m nil nil)))
+    (setq history (cons nil nil)))
   nil)
 
 ;;;###autoload
 (defun xref-marker-stack-empty-p ()
   "Whether the xref back-history is empty."
-  (null (car xref--history)))
+  (null (car (xref--get-history))))
 ;; FIXME: rename this to `xref-back-history-empty-p'.
 
 ;;;###autoload
 (defun xref-forward-history-empty-p ()
   "Whether the xref forward-history is empty."
-  (null (cdr xref--history)))
+  (null (cdr (xref--get-history))))
 
 
 (defun xref--goto-char (pos)
@@ -637,8 +692,8 @@ and finally return the window."
 
 (defun xref--show-location (location &optional select)
   "Help `xref-show-xref' and `xref-goto-xref' do their job.
-Go to LOCATION and if SELECT is non-nil select its window.  If
-SELECT is `quit', also quit the *xref* window."
+Go to LOCATION and if SELECT is non-nil select its window.
+If SELECT is `quit', also quit the *xref* window."
   (condition-case err
       (let* ((marker (xref-location-marker location))
              (buf (marker-buffer marker))
@@ -830,7 +885,12 @@ some of the references to the identifiers."
 
 (defun xref--outdated-p (item)
   "Check that the match location at current position is up-to-date.
-ITEMS is an xref item which " ; FIXME: Expand documentation.
+
+ITEM is an xref item which is expected to be produced by a search
+command and have summary that matches buffer contents near point.
+Depending on whether it's the first of the matches on the line,
+the summary should either start from bol, or only match after
+point."
   ;; FIXME: The check should most likely be a generic function instead
   ;; of the assumption that all matches' summaries relate to the
   ;; buffer text in a particular way.
@@ -919,7 +979,8 @@ ITEMS is an xref item which " ; FIXME: Expand documentation.
     (define-key map (kbd "M-,") #'xref-quit-and-pop-marker-stack)
     map))
 
-(declare-function outline-search-text-property "outline" (property &optional 
value bound move backward looking-at))
+(declare-function outline-search-text-property "outline"
+                 (property &optional value bound move backward looking-at))
 
 (define-derived-mode xref--xref-buffer-mode special-mode "XREF"
   "Mode for displaying cross-references."
@@ -930,8 +991,10 @@ ITEMS is an xref item which " ; FIXME: Expand 
documentation.
         #'xref--imenu-prev-index-position)
   (setq imenu-extract-index-name-function
         #'xref--imenu-extract-index-name)
+  (setq-local add-log-current-defun-function
+             #'xref--add-log-current-defun)
   (setq-local outline-minor-mode-cycle t
-              outline-minor-mode-use-buttons t
+              outline-minor-mode-use-buttons 'insert
               outline-search-function
               (lambda (&optional bound move backward looking-at)
                 (outline-search-text-property
@@ -946,7 +1009,7 @@ ITEMS is an xref item which " ; FIXME: Expand 
documentation.
 
 (define-derived-mode xref--transient-buffer-mode
   xref--xref-buffer-mode
-  "XREF Transient")
+  "XREF Transient.")
 
 (defun xref--imenu-prev-index-position ()
   "Move point to previous line in `xref' buffer.
@@ -964,6 +1027,15 @@ beginning of the line."
   (buffer-substring-no-properties (line-beginning-position)
                                   (line-end-position)))
 
+(defun xref--add-log-current-defun ()
+  "Return the string used to group a set of locations.
+This function is used as a value for `add-log-current-defun-function'."
+  (xref--group-name-for-display
+   (if-let (item (xref--item-at-point))
+       (xref-location-group (xref-match-item-location item))
+     (xref--imenu-extract-index-name))
+   (xref--project-root (project-current))))
+
 (defun xref--next-error-function (n reset?)
   (when reset?
     (goto-char (point-min)))
@@ -1110,7 +1182,7 @@ to that style.  Otherwise it is returned unchanged."
   (cl-ecase xref-file-name-display
     (abs group)
     (nondirectory
-     (if (string-match-p "\\`~?/" group)
+     (if (file-name-absolute-p group)
          (file-name-nondirectory group)
        group))
     (project-relative
@@ -1351,7 +1423,7 @@ FETCHER is a function of no arguments that returns a list 
of xref
 values.  It must not depend on the current buffer or selected
 window.
 
-ALIST can include, but limited to, the following keys:
+ALIST can include, but is not limited to, the following keys:
 
 WINDOW for the window that was selected before the current
 command was called.
@@ -1752,7 +1824,7 @@ IGNORES is a list of glob patterns for files to ignore."
      "xargs -0 rg <C> --null -nH --no-heading --no-messages -g '!*/' -e <R>"
      )
     (ugrep . "xargs -0 ugrep <C> --null -ns -e <R>"))
-  "Associative list mapping program identifiers to command templates.
+  "Association list mapping program identifiers to command templates.
 
 Program identifier should be a symbol, named after the search program.
 
diff --git a/lisp/replace.el b/lisp/replace.el
index c7ae77d128..302cb65543 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1039,7 +1039,10 @@ They are deleted _before_ looking for the next match.  
Hence, a match
 starting on the same line at which another match ended is ignored.
 
 Return the number of deleted matching lines.  When called interactively,
-also print the number."
+also print the number.
+
+If you want to not just delete the lines, but also add them to
+the kill ring, use the \\[kill-matching-lines] command instead."
   (interactive
    (progn
      (barf-if-buffer-read-only)
@@ -1101,7 +1104,10 @@ Hence, a match starting on the same line at which 
another match
 ended is ignored.
 
 Return the number of killed matching lines.  When called
-interactively, also print the number."
+interactively, also print the number.
+
+If you merely want to delete the lines, without adding them to
+the kill ring, the \\[delete-matching-lines] command is faster."
   (interactive
    (progn
      (barf-if-buffer-read-only)
diff --git a/lisp/server.el b/lisp/server.el
index 2973b783e6..8f4ca4cbc6 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -273,6 +273,11 @@ If nil, no instructions are displayed."
   :version "28.1"
   :type 'boolean)
 
+(defvar server-stop-automatically)      ; Defined below to avoid recursive 
load.
+
+(defvar server-stop-automatically--timer nil
+  "The timer object for `server-stop-automatically--maybe-kill-emacs'.")
+
 ;; We do not use `temporary-file-directory' here, because emacsclient
 ;; does not read the init file.
 (defvar server-socket-dir
@@ -287,6 +292,8 @@ If nil, no instructions are displayed."
   "The directory in which to place the server socket.
 If local sockets are not supported, this is nil.")
 
+(define-error 'server-running-external "External server running")
+
 (defun server-clients-with (property value)
   "Return a list of clients with PROPERTY set to VALUE."
   (let (result)
@@ -610,6 +617,58 @@ If the key is not valid, signal an error."
       (error "The key `%s' is invalid" server-auth-key))
     (server-generate-key)))
 
+(defsubst server--file-name ()
+  "Return the file name to use for the server socket."
+  (let ((server-dir (if server-use-tcp server-auth-dir server-socket-dir)))
+    (expand-file-name server-name server-dir)))
+
+(defun server-stop (&optional noframe)
+  "If this Emacs process has a server communication subprocess, stop it.
+If this actually stopped the server, return non-nil.  If the
+server is running in some other Emacs process (see
+`server-running-p'), signal a `server-running-external' error.
+
+If NOFRAME is non-nil, don't delete any existing frames
+associated with a client process.  This is useful, for example,
+when killing Emacs, in which case the frames will get deleted
+anyway."
+  (let ((server-file (server--file-name))
+        stopped-p)
+    (when server-process
+      ;; Kill it dead!
+      (ignore-errors (delete-process server-process))
+      (server-log "Stopped server")
+      (setq stopped-p t
+            server-process nil
+            server-mode nil
+            global-minor-modes (delq 'server-mode global-minor-modes))
+      (server-apply-stop-automatically))
+    (unwind-protect
+        ;; Delete the socket files made by previous server
+        ;; invocations.
+        (if (not (eq t (server-running-p server-name)))
+            ;; Remove any leftover socket or authentication file.
+            (ignore-errors
+              (let (delete-by-moving-to-trash)
+                (delete-file server-file)
+                ;; Also delete the directory that the server file was
+                ;; created in -- but only in /tmp (see bug#44644).
+                ;; There may be other servers running, too, so this may
+                ;; fail.
+                (when (equal (file-name-directory
+                              (directory-file-name
+                               (file-name-directory server-file)))
+                             "/tmp/")
+                  (ignore-errors
+                    (delete-directory (file-name-directory server-file))))))
+            (signal 'server-running-external
+                    (list (format "There is an existing Emacs server, named %S"
+                                  server-name))))
+      ;; If this Emacs already had a server, clear out associated status.
+      (while server-clients
+        (server-delete-client (car server-clients) noframe)))
+    stopped-p))
+
 ;;;###autoload
 (defun server-start (&optional leave-dead inhibit-prompt)
   "Allow this Emacs process to be a server for client processes.
@@ -643,57 +702,31 @@ the `server-process' variable."
             (inhibit-prompt t)
             (t (yes-or-no-p
                 "The current server still has clients; delete them? "))))
-    (let* ((server-dir (if server-use-tcp server-auth-dir server-socket-dir))
-          (server-file (expand-file-name server-name server-dir)))
-      (when server-process
-       ;; kill it dead!
-       (ignore-errors (delete-process server-process)))
-      ;; Check to see if an uninitialized external socket has been
-      ;; passed in, if that is the case, skip checking
-      ;; `server-running-p' as this will return the wrong result.
-      (if (and internal--daemon-sockname
-               (not server--external-socket-initialized))
-          (setq server--external-socket-initialized t)
-        ;; Delete the socket files made by previous server invocations.
-        (if (not (eq t (server-running-p server-name)))
-           ;; Remove any leftover socket or authentication file.
-           (ignore-errors
-             (let (delete-by-moving-to-trash)
-               (delete-file server-file)
-               ;; Also delete the directory that the server file was
-               ;; created in -- but only in /tmp (see bug#44644).
-               ;; There may be other servers running, too, so this may
-               ;; fail.
-               (when (equal (file-name-directory
-                             (directory-file-name
-                              (file-name-directory server-file)))
-                            "/tmp/")
-                 (ignore-errors
-                   (delete-directory (file-name-directory server-file))))))
-         (display-warning
-          'server
-          (concat "Unable to start the Emacs server.\n"
-                  (format "There is an existing Emacs server, named %S.\n"
-                          server-name)
-                  (substitute-command-keys
-                    "To start the server in this Emacs process, stop the 
existing
-server or call `\\[server-force-delete]' to forcibly disconnect it."))
-          :warning)
-         (setq leave-dead t)))
-      ;; If this Emacs already had a server, clear out associated status.
-      (while server-clients
-       (server-delete-client (car server-clients)))
+    ;; If a server is already running, try to stop it.
+    (condition-case err
+        ;; Check to see if an uninitialized external socket has been
+        ;; passed in.  If that is the case, don't try to stop the
+        ;; server.  (`server-stop' checks `server-running-p', which
+        ;; would return the wrong result).
+        (if (and internal--daemon-sockname
+                 (not server--external-socket-initialized))
+            (setq server--external-socket-initialized t)
+          (when (server-stop)
+            (message (if leave-dead "Stopped server" "Restarting server"))))
+      (server-running-external
+       (display-warning
+        'server
+        (concat "Unable to start the Emacs server.\n"
+                (cadr err)
+                (substitute-command-keys
+                 "\nTo start the server in this Emacs process, stop the 
existing server or call `\\[server-force-delete]' to forcibly disconnect it."))
+        :warning)
+       (setq leave-dead t)))
       ;; Now any previous server is properly stopped.
-      (if leave-dead
-         (progn
-           (unless (eq t leave-dead) (server-log (message "Server stopped")))
-            (setq server-mode nil
-                  global-minor-modes (delq 'server-mode global-minor-modes)
-                  server-process nil))
+    (unless leave-dead
+      (let ((server-file (server--file-name)))
        ;; Make sure there is a safe directory in which to place the socket.
-       (server-ensure-safe-dir server-dir)
-       (when server-process
-         (server-log (message "Restarting server")))
+       (server-ensure-safe-dir (file-name-directory server-file))
         (with-file-modes ?\700
          (add-hook 'suspend-tty-functions #'server-handle-suspend-tty)
          (add-hook 'delete-frame-functions #'server-handle-delete-frame)
@@ -730,7 +763,9 @@ server or call `\\[server-force-delete]' to forcibly 
disconnect it."))
                         (list :family 'local
                               :service server-file
                               :plist '(:authenticated t)))))
+          (server-apply-stop-automatically)
          (unless server-process (error "Could not start server process"))
+          (server-log "Started server")
          (process-put server-process :server-file server-file)
           (setq server-mode t)
           (push 'server-mode global-minor-modes)
@@ -748,7 +783,7 @@ server or call `\\[server-force-delete]' to forcibly 
disconnect it."))
 (defun server-force-stop ()
   "Kill all connections to the current server.
 This function is meant to be called from `kill-emacs-hook'."
-  (server-start t t))
+  (ignore-errors (server-stop 'noframe)))
 
 ;;;###autoload
 (defun server-force-delete (&optional name)
@@ -1741,9 +1776,6 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
     (when server-raise-frame
       (select-frame-set-input-focus (window-frame)))))
 
-(defvar server-stop-automatically nil
-  "Internal status variable for `server-stop-automatically'.")
-
 ;;;###autoload
 (defun server-save-buffers-kill-terminal (arg)
   ;; Called from save-buffers-kill-terminal in files.el.
@@ -1751,56 +1783,61 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
 With ARG non-nil, silently save all file-visiting buffers, then kill.
 
 If emacsclient was started with a list of filenames to edit, then
-only these files will be asked to be saved."
-  (if server-stop-automatically
-      (server-stop-automatically--handle-delete-frame (selected-frame))
-    (let ((proc (frame-parameter nil 'client)))
-      (cond ((eq proc 'nowait)
-            ;; Nowait frames have no client buffer list.
-            (if (cdr (frame-list))
-                (progn (save-some-buffers arg)
-                       (delete-frame))
-              ;; If we're the last frame standing, kill Emacs.
-              (save-buffers-kill-emacs arg)))
-           ((processp proc)
-            (let ((buffers (process-get proc 'buffers)))
-              (save-some-buffers
-               arg (if buffers
-                        ;; Only files from emacsclient file list.
-                       (lambda () (memq (current-buffer) buffers))
-                      ;; No emacsclient file list: don't override
-                      ;; `save-some-buffers-default-predicate' (unless
-                      ;; ARG is non-nil), since we're not killing
-                      ;; Emacs (unlike `save-buffers-kill-emacs').
-                     (and arg t)))
-              (server-delete-client proc)))
-           (t (error "Invalid client frame"))))))
-
-(defun server-stop-automatically--handle-delete-frame (frame)
-  "Handle deletion of FRAME when `server-stop-automatically' is used."
-  (when server-stop-automatically
-    (if (if (and (processp (frame-parameter frame 'client))
-                (eq this-command 'save-buffers-kill-terminal))
-           (progn
-             (dolist (f (frame-list))
-               (when (and (eq (frame-parameter frame 'client)
-                              (frame-parameter f 'client))
-                          (not (eq frame f)))
-                 (set-frame-parameter f 'client nil)
-                 (let ((server-stop-automatically nil))
-                   (delete-frame f))))
-             (if (cddr (frame-list))
-                 (let ((server-stop-automatically nil))
-                   (delete-frame frame)
-                   nil)
-               t))
-         (null (cddr (frame-list))))
-       (let ((server-stop-automatically nil))
-         (save-buffers-kill-emacs)
-         (delete-frame frame)))))
+only these files will be asked to be saved.
+
+When running Emacs as a daemon and with
+`server-stop-automatically' (which see) set to `kill-terminal' or
+`delete-frame', this function may call `save-buffers-kill-emacs'
+if there are no other active clients."
+  (let ((stop-automatically
+         (and (daemonp)
+              (memq server-stop-automatically '(kill-terminal delete-frame))))
+        (proc (frame-parameter nil 'client)))
+    (cond ((eq proc 'nowait)
+          ;; Nowait frames have no client buffer list.
+          (if (length> (frame-list) (if stop-automatically 2 1))
+               ;; If there are any other frames, only delete this one.
+               ;; When `server-stop-automatically' is set, don't count
+               ;; the daemon frame.
+              (progn (save-some-buffers arg)
+                     (delete-frame))
+            ;; If we're the last frame standing, kill Emacs.
+            (save-buffers-kill-emacs arg)))
+         ((processp proc)
+           (if (or (not stop-automatically)
+                   (length> server-clients 1)
+                   (seq-some
+                    (lambda (frame)
+                      (when-let ((p (frame-parameter frame 'client)))
+                        (not (eq proc p))))
+                    (frame-list)))
+               ;; If `server-stop-automatically' is not enabled, there
+               ;; are any other clients, or there are frames not owned
+               ;; by the current client (e.g. `nowait' frames), then
+               ;; we just want to delete this client.
+              (let ((buffers (process-get proc 'buffers)))
+                (save-some-buffers
+                 arg (if buffers
+                          ;; Only files from emacsclient file list.
+                         (lambda () (memq (current-buffer) buffers))
+                        ;; No emacsclient file list: don't override
+                        ;; `save-some-buffers-default-predicate' (unless
+                        ;; ARG is non-nil), since we're not killing
+                        ;; Emacs (unlike `save-buffers-kill-emacs').
+                       (and arg t)))
+                (server-delete-client proc))
+             ;; Otherwise, we want to kill Emacs.
+             (save-buffers-kill-emacs arg)))
+         (t (error "Invalid client frame")))))
+
+(defun server-stop-automatically--handle-delete-frame (_frame)
+  "Handle deletion of FRAME when `server-stop-automatically' is 
`delete-frame'."
+  (when (null (cddr (frame-list)))
+    (let ((server-stop-automatically nil))
+      (save-buffers-kill-emacs))))
 
 (defun server-stop-automatically--maybe-kill-emacs ()
-  "Handle closing of Emacs daemon when `server-stop-automatically' is used."
+  "Handle closing of Emacs daemon when `server-stop-automatically' is `empty'."
   (unless (cdr (frame-list))
     (when (and
           (not (memq t (mapcar (lambda (b)
@@ -1814,41 +1851,70 @@ only these files will be asked to be saved."
                                (process-list)))))
       (kill-emacs))))
 
-;;;###autoload
-(defun server-stop-automatically (arg)
-  "Automatically stop server as specified by ARG.
-
-If ARG is the symbol `empty', stop the server when it has no
+(defun server-apply-stop-automatically ()
+  "Apply the current value of `server-stop-automatically'.
+This function adds or removes the necessary helpers to manage
+stopping the Emacs server automatically, depending on the whether
+the server is running or not.  This function only applies when
+running Emacs as a daemon."
+  (when (daemonp)
+    (let (empty-timer-p delete-frame-p)
+      (when server-process
+        (pcase server-stop-automatically
+          ('empty        (setq empty-timer-p t))
+          ('delete-frame (setq delete-frame-p t))))
+      ;; Start or stop the timer.
+      (if empty-timer-p
+          (unless server-stop-automatically--timer
+            (setq server-stop-automatically--timer
+                  (run-with-timer
+                   10 2
+                  #'server-stop-automatically--maybe-kill-emacs)))
+        (when server-stop-automatically--timer
+          (cancel-timer server-stop-automatically--timer)
+          (setq server-stop-automatically--timer nil)))
+      ;; Add or remove the delete-frame hook.
+      (if delete-frame-p
+          (add-hook 'delete-frame-functions
+                   #'server-stop-automatically--handle-delete-frame)
+        (remove-hook 'delete-frame-functions
+                     #'server-stop-automatically--handle-delete-frame))))
+  ;; Return the current value of `server-stop-automatically'.
+  server-stop-automatically)
+
+(defcustom server-stop-automatically nil
+  "If non-nil, stop the server under the requested conditions.
+
+If this is the symbol `empty', stop the server when it has no
 remaining clients, no remaining unsaved file-visiting buffers,
 and no running processes with a `query-on-exit' flag.
 
-If ARG is the symbol `delete-frame', ask the user when the last
+If this is the symbol `delete-frame', ask the user when the last
 frame is deleted whether each unsaved file-visiting buffer must
 be saved and each running process with a `query-on-exit' flag
 can be stopped, and if so, stop the server itself.
 
-If ARG is the symbol `kill-terminal', ask the user when the
+If this is the symbol `kill-terminal', ask the user when the
 terminal is killed with \\[save-buffers-kill-terminal] \
 whether each unsaved file-visiting
 buffer must be saved and each running process with a `query-on-exit'
-flag can be stopped, and if so, stop the server itself.
-
-Any other value of ARG will cause this function to signal an error.
+flag can be stopped, and if so, stop the server itself."
+  :type '(choice
+          (const :tag "Never" nil)
+          (const :tag "When no clients, unsaved files, or processes"
+                 empty)
+          (const :tag "When killing last terminal" kill-terminal)
+          (const :tag "When killing last terminal or frame" delete-frame))
+  :set (lambda (symbol value)
+         (set-default symbol value)
+         (server-apply-stop-automatically))
+  :version "29.1")
 
-This function is meant to be called from the user init file."
-  (when (daemonp)
-    (setq server-stop-automatically arg)
-    (cond
-     ((eq arg 'empty)
-      (setq server-stop-automatically nil)
-      (run-with-timer 10 2
-                     #'server-stop-automatically--maybe-kill-emacs))
-     ((eq arg 'delete-frame)
-      (add-hook 'delete-frame-functions
-               #'server-stop-automatically--handle-delete-frame))
-     ((eq arg 'kill-terminal))
-     (t
-      (error "Unexpected argument")))))
+;;;###autoload
+(defun server-stop-automatically (value)
+  "Automatically stop the Emacs server as specified by VALUE.
+This sets the variable `server-stop-automatically' (which see)."
+  (setopt server-stop-automatically value))
 
 (define-key ctl-x-map "#" 'server-edit)
 
@@ -1870,10 +1936,10 @@ cannot contact the specified server.  For example:
   (server-eval-at \"server\" \\='(emacs-pid))
 returns the process ID of the Emacs instance running \"server\"."
   (let* ((server-dir (if server-use-tcp server-auth-dir server-socket-dir))
-        (server-file (expand-file-name server server-dir))
-        (coding-system-for-read 'binary)
-        (coding-system-for-write 'binary)
-        address port secret process)
+         (server-file (expand-file-name server server-dir))
+         (coding-system-for-read 'binary)
+         (coding-system-for-write 'binary)
+         address port secret process)
     (unless (file-exists-p server-file)
       (error "No such server: %s" server))
     (with-temp-buffer
diff --git a/lisp/shell.el b/lisp/shell.el
index 7c3c925ab8..dadbdcbc03 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -71,7 +71,7 @@
 ;; c-c c-o comint-delete-output                   Delete last batch of process 
output
 ;; c-c c-r comint-show-output             Show last batch of process output
 ;; c-c c-l comint-dynamic-list-input-ring  List input history
-;;         comint-send-invisible           Read line w/o echo & send to proc
+;;         comint-send-invisible           Read line without echo & send to 
proc
 ;;         comint-continue-subjob         Useful if you accidentally suspend
 ;;                                             top-level job
 ;; comint-mode-hook is the comint mode hook.
@@ -1162,6 +1162,7 @@ line output and parses it to form the new directory 
stack."
          (dlsl nil)
          (pos 0)
          (ds nil))
+    (setq dls (string-trim-right dls "[ ]+"))
     ;; Split the dirlist into whitespace and non-whitespace chunks.
     ;; dlsl will be a reversed list of tokens.
     (while (string-match "\\(\\S-+\\|\\s-+\\)" dls pos)
diff --git a/lisp/simple.el b/lisp/simple.el
index 0f44b14948..f85428ca74 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2929,11 +2929,12 @@ that was current when the minibuffer was activated."
                       (window-buffer (minibuffer-selected-window))))
 
 (defun goto-history-element (nabs)
-  "Puts element of the minibuffer history in the minibuffer.
-The argument NABS specifies the absolute history position in
-descending order, where 0 means the current element and a
-positive number N means the Nth previous element.  NABS being a
-negative number -N means the Nth entry of \"future history.\""
+  "Insert into the minibuffer the element of minibuffer history specified by 
NABS.
+Interactively, NABS is the prefix numeric argument, and defaults to 1.
+It specifies the absolute history position in descending order,
+where 0 means the current element and a positive number N means
+the Nth previous element.  NABS that is a negative number -N means
+the Nth entry of \"future history.\""
   (interactive "p")
   (when (and (not minibuffer-default-add-done)
             (functionp minibuffer-default-add-function)
@@ -2989,17 +2990,17 @@ negative number -N means the Nth entry of \"future 
history.\""
     (goto-char (or minibuffer-temporary-goal-position (point-max)))))
 
 (defun next-history-element (n)
-  "Puts next element of the minibuffer history in the minibuffer.
-With argument N, it uses the Nth following element.  The position
-in the history can go beyond the current position and invoke \"future
-history.\""
+  "Insert into the minibuffer the Nth next element of minibuffer history.
+Interactively, N is the prefix numeric argument and defaults to 1.
+The value N can go beyond the current position in the minibuffer
+history,  and invoke \"future history.\""
   (interactive "p")
   (or (zerop n)
       (goto-history-element (- minibuffer-history-position n))))
 
 (defun previous-history-element (n)
-  "Puts previous element of the minibuffer history in the minibuffer.
-With argument N, it uses the Nth previous element."
+  "Insert into the minibuffer the Nth previous element of minibuffer history.
+Interactively, N is the prefix numeric argument and defaults to 1."
   (interactive "p")
   (or (zerop n)
       (goto-history-element (+ minibuffer-history-position n))))
@@ -9184,33 +9185,39 @@ The function should return non-nil if the two tokens do 
not match.")
   "Return the line string that contains the openparen at POS."
   (save-excursion
     (goto-char pos)
-    ;; Show what precedes the open in its line, if anything.
-    (cond
-     ((save-excursion (skip-chars-backward " \t") (not (bolp)))
-      (buffer-substring (line-beginning-position)
-                        (1+ pos)))
-     ;; Show what follows the open in its line, if anything.
-     ((save-excursion
-        (forward-char 1)
-        (skip-chars-forward " \t")
-        (not (eolp)))
-      (buffer-substring pos
-                        (line-end-position)))
-     ;; Otherwise show the previous nonblank line,
-     ;; if there is one.
-     ((save-excursion (skip-chars-backward "\n \t") (not (bobp)))
-      (concat
-       (buffer-substring (progn
-                           (skip-chars-backward "\n \t")
-                           (line-beginning-position))
-                         (progn (end-of-line)
-                                (skip-chars-backward " \t")
-                                (point)))
-       ;; Replace the newline and other whitespace with `...'.
-       "..."
-       (buffer-substring pos (1+ pos))))
-     ;; There is nothing to show except the char itself.
-     (t (buffer-substring pos (1+ pos))))))
+    ;; Capture the regions in terms of (beg . end) conses whose
+    ;; buffer-substrings we want to show as a context string.  Ensure
+    ;; they are font-locked (bug#59527).
+    (let (regions)
+      ;; Show what precedes the open in its line, if anything.
+      (cond
+       ((save-excursion (skip-chars-backward " \t") (not (bolp)))
+        (setq regions (list (cons (line-beginning-position)
+                                  (1+ pos)))))
+       ;; Show what follows the open in its line, if anything.
+       ((save-excursion
+          (forward-char 1)
+          (skip-chars-forward " \t")
+          (not (eolp)))
+        (setq regions (list (cons pos (line-end-position)))))
+       ;; Otherwise show the previous nonblank line,
+       ;; if there is one.
+       ((save-excursion (skip-chars-backward "\n \t") (not (bobp)))
+        (setq regions (list (cons (progn
+                                    (skip-chars-backward "\n \t")
+                                    (line-beginning-position))
+                                  (progn (end-of-line)
+                                         (skip-chars-backward " \t")
+                                         (point)))
+                            (cons pos (1+ pos)))))
+       ;; There is nothing to show except the char itself.
+       (t (setq regions (list (cons pos (1+ pos))))))
+      ;; Ensure we've font-locked the context region.
+      (font-lock-ensure (caar regions) (cdar (last regions)))
+      (mapconcat (lambda (region)
+                   (buffer-substring (car region) (cdr region)))
+                 regions
+                 "..."))))
 
 (defvar blink-paren-function 'blink-matching-open
   "Function called, if non-nil, whenever a close parenthesis is inserted.
@@ -9632,7 +9639,8 @@ Go to the window from which completion was requested."
 (defcustom completion-auto-wrap t
   "Non-nil means to wrap around when selecting completion options.
 This affects the commands `next-completion' and `previous-completion'.
-When `completion-auto-select' is t, it wraps through the minibuffer."
+When `completion-auto-select' is t, it wraps through the minibuffer
+for the commands bound to the TAB key."
   :type 'boolean
   :version "29.1"
   :group 'completion)
diff --git a/lisp/so-long.el b/lisp/so-long.el
index 661f5ee57a..fc99162325 100644
--- a/lisp/so-long.el
+++ b/lisp/so-long.el
@@ -986,7 +986,7 @@ See also `so-long-mode-line-info'."
 ;; Modes that go slowly and line lengths excessive
 ;; Font-lock performance becoming oppressive
 ;; All of my CPU tied up with strings
-;; These are a few of my least-favourite things
+;; These are a few of my least-favorite things
 
 (defvar-local so-long-original-values nil
   "Alist holding the buffer's original `major-mode' value, and other data.
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 515f7d5d75..7a279bdaa0 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -349,7 +349,7 @@ determined automatically."
 
 (defcustom speedbar-sort-tags nil
   "If non-nil, sort tags in the speedbar display.  *Obsolete*.
-Use `semantic-tag-hierarchy-method' instead."
+Use `speedbar-tag-hierarchy-method' instead."
   :group 'speedbar
   :type 'boolean)
 
diff --git a/lisp/startup.el b/lisp/startup.el
index 5e0a47d3f8..6270de2ace 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1259,6 +1259,12 @@ please check its value")
          (setq init-file-user nil))
         ((member argi '("-init-directory"))
          (setq user-emacs-directory (or argval (pop args))
+                user-emacs-directory (if (stringp user-emacs-directory)
+                                         (file-name-as-directory
+                                          (expand-file-name
+                                           user-emacs-directory
+                                           command-line-default-directory))
+                                       user-emacs-directory)
                 argval nil))
         ((member argi '("-u" "-user"))
          (setq init-file-user (or argval (pop args))
diff --git a/lisp/strokes.el b/lisp/strokes.el
index 0f84588a41..e5719dfd5d 100644
--- a/lisp/strokes.el
+++ b/lisp/strokes.el
@@ -1151,7 +1151,7 @@ the stroke as a character in some language."
                                                     strokes-last-stroke)
                                                 31))))
          (lift-flag t)
-         (rainbow-chars (list ?R ?O ?Y ?G ?B ?P))) ; ROYGBIV w/o indigo
+         (rainbow-chars (list ?R ?O ?Y ?G ?B ?P))) ; ROYGBIV without indigo
       (set-buffer buf)
       (erase-buffer)
       (insert strokes-xpm-header)
diff --git a/lisp/subr.el b/lisp/subr.el
index 261ec512d8..4fa63a1f3c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1792,10 +1792,11 @@ and `event-end' functions."
   (or (posn-image position) (posn-string position)))
 
 (defsubst posn-object-x-y (position)
-  "Return the x and y coordinates relative to the object of POSITION.
+  "Return the x and y coordinates relative to the glyph of object of POSITION.
 The return value has the form (DX . DY), where DX and DY are
-given in pixels.  POSITION should be a list of the form returned
-by `event-start' and `event-end'."
+given in pixels, and they are relative to the top-left corner of
+the clicked glyph of object at POSITION.  POSITION should be a
+list of the form returned by `event-start' and `event-end'."
   (nth 8 position))
 
 (defsubst posn-object-width-height (position)
@@ -3854,7 +3855,7 @@ If MESSAGE is nil, instructions to type EXIT-CHAR are 
displayed there."
   (let ((o1 (if (overlay-buffer o)
                 (make-overlay (overlay-start o) (overlay-end o)
                               ;; FIXME: there's no easy way to find the
-                              ;; insertion-type of the two markers.
+                              ;; insertion-type of overlay's start and end.
                               (overlay-buffer o))
               (let ((o1 (make-overlay (point-min) (point-min))))
                 (delete-overlay o1)
@@ -3935,6 +3936,31 @@ See also `locate-user-emacs-file'.")
   "Return non-nil if the current buffer is narrowed."
   (/= (- (point-max) (point-min)) (buffer-size)))
 
+(defmacro with-narrowing (start end &rest rest)
+  "Execute BODY with restrictions set to START and END.
+
+The current restrictions, if any, are restored upon return.
+
+With the optional :locked TAG argument, inside BODY,
+`narrow-to-region' and `widen' can be used only within the START
+and END limits, unless the restrictions are unlocked by calling
+`narrowing-unlock' with TAG.  See `narrowing-lock' for a more
+detailed description.
+
+\(fn START END [:locked TAG] BODY)"
+  (if (eq (car rest) :locked)
+      `(internal--with-narrowing ,start ,end (lambda () ,@(cddr rest))
+                                 ,(cadr rest))
+    `(internal--with-narrowing ,start ,end (lambda () ,@rest))))
+
+(defun internal--with-narrowing (start end body &optional tag)
+  "Helper function for `with-narrowing', which see."
+  (save-restriction
+    (progn
+      (narrow-to-region start end)
+      (if tag (narrowing-lock tag))
+      (funcall body))))
+
 (defun find-tag-default-bounds ()
   "Determine the boundaries of the default tag, based on text at point.
 Return a cons cell with the beginning and end of the found tag.
@@ -5409,9 +5435,11 @@ and replace a sub-expression, e.g.
       (apply #'concat (nreverse matches)))))
 
 (defsubst string-equal-ignore-case (string1 string2)
-  "Like `string-equal', but case-insensitive.
+  "Compare STRING1 and STRING2 case-insensitively.
 Upper-case and lower-case letters are treated as equal.
-Unibyte strings are converted to multibyte for comparison."
+Unibyte strings are converted to multibyte for comparison.
+
+See also `string-equal'."
   (declare (pure t) (side-effect-free t))
   (eq t (compare-strings string1 0 nil string2 0 nil t)))
 
@@ -6056,14 +6084,8 @@ command is called from a keyboard macro?"
              ;; Skip special forms (from non-compiled code).
              (and frame (null (car frame)))
              ;; Skip also `interactive-p' (because we don't want to know if
-             ;; interactive-p was called interactively but if it's caller was)
-             ;; and `byte-code' (idem; this appears in subexpressions of things
-             ;; like condition-case, which are wrapped in a separate bytecode
-             ;; chunk).
-             ;; FIXME: For lexical-binding code, this is much worse,
-             ;; because the frames look like "byte-code -> funcall -> #[...]",
-             ;; which is not a reliable signature.
-             (memq (nth 1 frame) '(interactive-p 'byte-code))
+             ;; interactive-p was called interactively but if it's caller was).
+             (eq (nth 1 frame) 'interactive-p)
              ;; Skip package-specific stack-frames.
              (let ((skip (run-hook-with-args-until-success
                           'called-interactively-p-functions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index eb4cec4861..065116d512 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -105,7 +105,7 @@ For easier selection of tabs by their numbers, consider 
customizing
               (const hyper)
               (const super)
               (const alt))
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          ;; Reenable the tab-bar with new keybindings
@@ -116,23 +116,23 @@ For easier selection of tabs by their numbers, consider 
customizing
   :version "27.1")
 
 (defun tab-bar--define-keys ()
-  "Install key bindings for switching between tabs if the user has configured 
them."
+  "Install key bindings to switch between tabs if so configured."
   (when tab-bar-select-tab-modifiers
     (global-set-key (vector (append tab-bar-select-tab-modifiers (list ?0)))
-                    'tab-recent)
+                    #'tab-recent)
     (dotimes (i 8)
       (global-set-key (vector (append tab-bar-select-tab-modifiers
                                       (list (+ i 1 ?0))))
-                      'tab-bar-select-tab))
+                      #'tab-bar-select-tab))
     (global-set-key (vector (append tab-bar-select-tab-modifiers (list ?9)))
-                    'tab-last))
+                    #'tab-last))
   ;; Don't override user customized key bindings
   (unless (global-key-binding [(control tab)])
-    (global-set-key [(control tab)] 'tab-next))
+    (global-set-key [(control tab)] #'tab-next))
   (unless (global-key-binding [(control shift tab)])
-    (global-set-key [(control shift tab)] 'tab-previous))
+    (global-set-key [(control shift tab)] #'tab-previous))
   (unless (global-key-binding [(control shift iso-lefttab)])
-    (global-set-key [(control shift iso-lefttab)] 'tab-previous))
+    (global-set-key [(control shift iso-lefttab)] #'tab-previous))
 
   ;; Replace default value with a condition that supports displaying
   ;; global-mode-string in the tab bar instead of the mode line.
@@ -157,6 +157,9 @@ For easier selection of tabs by their numbers, consider 
customizing
 (defun tab-bar--load-buttons ()
   "Load the icons for the tab buttons."
   (require 'icons)
+  (declare-function icon-string "icons" (name))
+  (declare-function iconp "icons" (object))
+  (declare-function icons--register "icons")
   (unless (iconp 'tab-bar-new)
     (define-icon tab-bar-new nil
       `((image "tabs/new.xpm"
@@ -189,7 +192,7 @@ For easier selection of tabs by their numbers, consider 
customizing
       '(;; (emoji "🍔")
         (symbol "☰")
         (text "Menu" :face tab-bar-tab-inactive))
-      "Icon for for the menu bar."
+      "Icon for the menu bar."
       :version "29.1"
       :help-echo "Menu bar"))
   (setq tab-bar-menu-bar-button (icon-string 'tab-bar-menu-bar)))
@@ -227,7 +230,8 @@ a list of frames to update."
   ;; Update `default-frame-alist'
   (when (eq frames t)
     (setq default-frame-alist
-          (cons (cons 'tab-bar-lines (if (and tab-bar-mode (eq tab-bar-show 
t)) 1 0))
+          (cons (cons 'tab-bar-lines
+                      (if (and tab-bar-mode (eq tab-bar-show t)) 1 0))
                 (assq-delete-all 'tab-bar-lines default-frame-alist)))))
 
 (define-minor-mode tab-bar-mode
@@ -279,7 +283,8 @@ It returns a list of the form (KEY KEY-BINDING CLOSE-P), 
where:
     ;; This code is used when you click the mouse in the tab bar
     ;; on a console which has no window system but does have a mouse.
     (let* ((x-position (car (posn-x-y posn)))
-           (keymap (lookup-key (cons 'keymap (nreverse (current-active-maps))) 
[tab-bar]))
+           (keymap (lookup-key (cons 'keymap (nreverse (current-active-maps)))
+                               [tab-bar]))
            (column 0))
       (when x-position
         (catch 'done
@@ -416,7 +421,7 @@ at the mouse-down event to the position at mouse-up event."
   "S-<wheel-right>" #'tab-bar-move-tab)
 
 (global-set-key [tab-bar]
-                `(menu-item ,(purecopy "tab bar") ignore
+                `(menu-item ,(purecopy "tab bar") ,(make-sparse-keymap)
                             :filter tab-bar-make-keymap))
 
 (defun tab-bar-make-keymap (&optional _ignore)
@@ -478,7 +483,7 @@ you can use the command `toggle-frame-tab-bar'."
   :type '(choice (const :tag "Always" t)
                  (const :tag "When more than one tab" 1)
                  (const :tag "Never" nil))
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          (if val
@@ -529,7 +534,7 @@ to get the group name."
   "If non-nil, show the \"New tab\" button in the tab bar.
 When this is nil, you can create new tabs with \\[tab-new]."
   :type 'boolean
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          (force-mode-line-update))
@@ -550,7 +555,7 @@ If nil, don't show it at all."
                  (const :tag "On selected tab" selected)
                  (const :tag "On non-selected tabs" non-selected)
                  (const :tag "None" nil))
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          (force-mode-line-update))
@@ -574,7 +579,7 @@ If nil, don't show it at all."
 This helps to select the tab by its number using `tab-bar-select-tab'
 and `tab-bar-select-tab-modifiers'."
   :type 'boolean
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          (force-mode-line-update))
@@ -586,7 +591,7 @@ and `tab-bar-select-tab-modifiers'."
 
 (defun tab-bar-separator ()
   "Separator between tabs."
-  (or tab-bar-separator (if window-system " " "|")))
+  (or tab-bar-separator (if (window-system) " " "|")))
 
 
 (defcustom tab-bar-tab-name-function #'tab-bar-tab-name-current
@@ -604,7 +609,7 @@ from all windows in the window configuration."
                  (const :tag "All window buffers"
                         tab-bar-tab-name-all)
                  (function  :tag "Function"))
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          (force-mode-line-update))
@@ -704,7 +709,7 @@ Function gets one argument: a tab."
 Function gets two arguments, the tab and its number, and should return
 the formatted tab name to display in the tab bar."
   :type 'function
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          (force-mode-line-update))
@@ -753,7 +758,7 @@ of the mode line.  Replacing `tab-bar-format-tabs' with
              tab-bar-format-add-tab
              tab-bar-format-align-right
              tab-bar-format-global)
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          (force-mode-line-update))
@@ -815,7 +820,8 @@ You can hide these buttons by customizing `tab-bar-format' 
and removing
         ,(alist-get 'binding tab)
         :help "Click to visit tab"))))
    (when (alist-get 'close-binding tab)
-     `((,(if (eq (car tab) 'current-tab) 'C-current-tab (intern (format 
"C-tab-%i" i)))
+     `((,(if (eq (car tab) 'current-tab) 'C-current-tab
+           (intern (format "C-tab-%i" i)))
         menu-item ""
         ,(alist-get 'close-binding tab))))))
 
@@ -832,7 +838,7 @@ You can hide these buttons by customizing `tab-bar-format' 
and removing
   "Function to get a tab group name.
 Function gets one argument: a tab."
   :type 'function
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          (force-mode-line-update))
@@ -844,21 +850,22 @@ Function gets one argument: a tab."
 
 (defcustom tab-bar-tab-group-format-function #'tab-bar-tab-group-format-default
   "Function to format a tab group name.
-Function gets two arguments, a tab with a group name and its number,
-and should return the formatted tab group name to display in the tab bar."
+Function gets three arguments, a tab with a group name, its number, and
+an optional value that is non-nil when the tab is from the current group.
+It should return the formatted tab group name to display in the tab bar."
   :type 'function
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          (force-mode-line-update))
   :group 'tab-bar
   :version "28.1")
 
-(defun tab-bar-tab-group-format-default (tab i)
+(defun tab-bar-tab-group-format-default (tab i &optional current-p)
   (propertize
-   (concat (if tab-bar-tab-hints (format "%d " i) "")
+   (concat (if (and tab-bar-tab-hints (not current-p)) (format "%d " i) "")
            (funcall tab-bar-tab-group-function tab))
-   'face 'tab-bar-tab-group-inactive))
+   'face (if current-p 'tab-bar-tab-group-current 
'tab-bar-tab-group-inactive)))
 
 (defcustom tab-bar-tab-group-face-function #'tab-bar-tab-group-face-default
   "Function to define a tab group face.
@@ -882,8 +889,14 @@ when the tab is current.  Return the result as a keymap."
    `((,(intern (format "group-%i" i))
       menu-item
       ,(if current-p
-           (propertize (funcall tab-bar-tab-group-function tab)
-                       'face 'tab-bar-tab-group-current)
+           (condition-case nil
+               (funcall tab-bar-tab-group-format-function tab i current-p)
+             ;; We used to define tab-bar-tab-group-format-function as
+             ;; taking two arguments but after adding the third argument
+             ;; we need to provide backwards-compatibility.
+             (wrong-number-of-arguments
+              (propertize (funcall tab-bar-tab-group-function tab)
+                          'face 'tab-bar-tab-group-current)))
          (funcall tab-bar-tab-group-format-function tab i))
       ,(if current-p 'ignore
          (or
@@ -912,7 +925,8 @@ when the tab is current.  Return the result as a keymap."
                    (when (and (not (equal previous-group tab-group)) tab-group)
                      (tab-bar--format-tab-group tab i t))
                    ;; Override default tab faces to use group faces
-                   (let ((tab-bar-tab-face-function 
tab-bar-tab-group-face-function))
+                   (let ((tab-bar-tab-face-function
+                          tab-bar-tab-group-face-function))
                      (tab-bar--format-tab tab i))))
                  ;; Show first tab of other groups with a group name
                  ((not (equal previous-group tab-group))
@@ -936,7 +950,13 @@ when the tab is current.  Return the result as a keymap."
          (hpos (progn
                  (add-face-text-property 0 (length rest) 'tab-bar t rest)
                  (string-pixel-width rest)))
-         (str (propertize " " 'display `(space :align-to (- right (,hpos))))))
+         (str (propertize " " 'display
+                          ;; The `right' spec doesn't work on TTY frames
+                          ;; when windows are split horizontally (bug#59620)
+                          (if (window-system)
+                              `(space :align-to (- right (,hpos)))
+                            `(space :align-to (,(- (frame-inner-width)
+                                                   hpos)))))))
     `((align-right menu-item ,str ignore))))
 
 (defun tab-bar-format-global ()
@@ -1006,7 +1026,7 @@ This variable has effect only when `tab-bar-auto-width' 
is non-nil."
           (const :tag "No limit" nil)
           (list (integer :tag "Max width (pixels)" :value 220)
                 (integer :tag "Max width (chars)" :value 20)))
-  :initialize 'custom-initialize-default
+  :initialize #'custom-initialize-default
   :set (lambda (sym val)
          (set-default sym val)
          (setq tab-bar--fixed-width-hash nil))
@@ -1055,11 +1075,11 @@ tab bar might wrap to the second line when it 
shouldn't.")
                         (string-pixel-width non-tabs))
                      (length tabs)))
       (when tab-bar-auto-width-min
-        (setq width (max width (if window-system
+        (setq width (max width (if (window-system)
                                    (nth 0 tab-bar-auto-width-min)
                                  (nth 1 tab-bar-auto-width-min)))))
       (when tab-bar-auto-width-max
-        (setq width (min width (if window-system
+        (setq width (min width (if (window-system)
                                    (nth 0 tab-bar-auto-width-max)
                                  (nth 1 tab-bar-auto-width-max)))))
       (dolist (item tabs)
@@ -1075,15 +1095,17 @@ tab bar might wrap to the second line when it 
shouldn't.")
                        curr-width)
                   (cond
                    ((< prev-width width)
-                    (let* ((space (apply 'propertize " "
+                    (let* ((space (apply #'propertize " "
                                          (text-properties-at 0 name)))
                            (ins-pos (- len (if close-p 1 0)))
                            (prev-name name))
                       (while continue
-                        (setf (substring name ins-pos ins-pos) space)
+                        (setq name (concat (substring name 0 ins-pos)
+                                           space
+                                           (substring name ins-pos)))
                         (setq curr-width (string-pixel-width name))
                         (if (and (< curr-width width)
-                                 (not (eq curr-width prev-width)))
+                                 (> curr-width prev-width))
                             (setq prev-width curr-width
                                   prev-name name)
                           ;; Set back a shorter name
@@ -1093,10 +1115,11 @@ tab bar might wrap to the second line when it 
shouldn't.")
                     (let ((del-pos1 (if close-p -2 -1))
                           (del-pos2 (if close-p -1 nil)))
                       (while continue
-                        (setf (substring name del-pos1 del-pos2) "")
+                        (setq name (concat (substring name 0 del-pos1)
+                                           (substring name del-pos2)))
                         (setq curr-width (string-pixel-width name))
                         (if (and (> curr-width width)
-                                 (not (eq curr-width prev-width)))
+                                 (< curr-width prev-width))
                             (setq prev-width curr-width)
                           (setq continue nil)))
                       (let* ((len (length name))
@@ -1297,11 +1320,13 @@ Negative TAB-NUMBER counts tabs from the end of the tab 
bar."
 
             (when tab-bar-history-mode
               (puthash (selected-frame)
-                       (and (window-configuration-p (alist-get 'wc (car 
wc-history-back)))
+                       (and (window-configuration-p
+                             (alist-get 'wc (car wc-history-back)))
                             wc-history-back)
                        tab-bar-history-back)
               (puthash (selected-frame)
-                       (and (window-configuration-p (alist-get 'wc (car 
wc-history-forward)))
+                       (and (window-configuration-p
+                             (alist-get 'wc (car wc-history-forward)))
                             wc-history-forward)
                        tab-bar-history-forward))))
 
@@ -1327,7 +1352,8 @@ Negative TAB-NUMBER counts tabs from the end of the tab 
bar."
 
         (when from-index
           (setf (nth from-index tabs) from-tab))
-        (setf (nth to-index tabs) (tab-bar--current-tab-make (nth to-index 
tabs)))
+        (setf (nth to-index tabs)
+              (tab-bar--current-tab-make (nth to-index tabs)))
 
         (unless tab-bar-mode
           (message "Selected tab '%s'" (alist-get 'name to-tab))))
@@ -1394,7 +1420,7 @@ and rename it to NAME."
       (tab-bar-new-tab)
       (tab-bar-rename-tab name))))
 
-(defalias 'tab-bar-select-tab-by-name 'tab-bar-switch-to-tab)
+(defalias 'tab-bar-select-tab-by-name #'tab-bar-switch-to-tab)
 
 
 (defun tab-bar-move-tab-to (to-number &optional from-number)
@@ -1409,7 +1435,8 @@ where argument addressing is relative."
          (from-number (or from-number (1+ (tab-bar--current-tab-index tabs))))
          (from-tab (nth (1- from-number) tabs))
          (to-number (if to-number (prefix-numeric-value to-number) 1))
-         (to-number (if (< to-number 0) (+ (length tabs) (1+ to-number)) 
to-number))
+         (to-number (if (< to-number 0) (+ (length tabs) (1+ to-number))
+                      to-number))
          (to-index (max 0 (min (1- to-number) (1- (length tabs))))))
     (setq tabs (delq from-tab tabs))
     (cl-pushnew from-tab (nthcdr to-index tabs))
@@ -1435,7 +1462,8 @@ Like `tab-bar-move-tab', but moves in the opposite 
direction."
   (interactive "p")
   (tab-bar-move-tab (- (or arg 1))))
 
-(defun tab-bar-move-tab-to-frame (arg &optional from-frame from-number 
to-frame to-number)
+(defun tab-bar-move-tab-to-frame (arg &optional from-frame from-number
+                                      to-frame to-number)
   "Move tab from FROM-NUMBER position to new position at TO-NUMBER.
 FROM-NUMBER defaults to the current tab number.
 FROM-NUMBER and TO-NUMBER count from 1.
@@ -1451,7 +1479,8 @@ to which to move the tab; ARG defaults to 1."
       (setq to-frame (next-frame to-frame))))
   (unless (eq from-frame to-frame)
     (let* ((from-tabs (funcall tab-bar-tabs-function from-frame))
-           (from-number (or from-number (1+ (tab-bar--current-tab-index 
from-tabs))))
+           (from-number (or from-number
+                            (1+ (tab-bar--current-tab-index from-tabs))))
            (from-tab (nth (1- from-number) from-tabs))
            (to-tabs (funcall tab-bar-tabs-function to-frame))
            (to-index (max 0 (min (1- (or to-number 1)) (1- (length 
to-tabs))))))
@@ -1473,7 +1502,8 @@ to which to move the tab; ARG defaults to 1."
 FROM-NUMBER defaults to the current tab (which happens interactively)."
   (interactive (list (1+ (tab-bar--current-tab-index))))
   (let* ((tabs (funcall tab-bar-tabs-function))
-         (tab-index (1- (or from-number (1+ (tab-bar--current-tab-index 
tabs)))))
+         (tab-index (1- (or from-number
+                            (1+ (tab-bar--current-tab-index tabs)))))
          (tab-name (alist-get 'name (nth tab-index tabs)))
          ;; On some window managers, `make-frame' selects the new frame,
          ;; so previously selected frame is saved to `from-frame'.
@@ -1736,7 +1766,8 @@ for the last tab on a frame is determined by
           ;; Select another tab before deleting the current tab
           (let ((to-index (or (if to-number (1- to-number))
                               (pcase tab-bar-close-tab-select
-                                ('left (1- (if (< current-index 1) 2 
current-index)))
+                                ('left (1- (if (< current-index 1) 2
+                                             current-index)))
                                 ('right (if (> (length tabs) (1+ 
current-index))
                                             (1+ current-index)
                                           (1- current-index)))
@@ -1761,7 +1792,8 @@ for the last tab on a frame is determined by
 
         (force-mode-line-update)
         (unless tab-bar-mode
-          (message "Deleted tab and switched to %s" 
tab-bar-close-tab-select))))))
+          (message "Deleted tab and switched to %s"
+                   tab-bar-close-tab-select))))))
 
 (defun tab-bar-close-tab-by-name (name)
   "Close the tab given its NAME.
@@ -1852,7 +1884,8 @@ If NAME is the empty string, then use the automatic name
 function `tab-bar-tab-name-function'."
   (interactive
    (let* ((tabs (funcall tab-bar-tabs-function))
-          (tab-number (or current-prefix-arg (1+ (tab-bar--current-tab-index 
tabs))))
+          (tab-number (or current-prefix-arg
+                          (1+ (tab-bar--current-tab-index tabs))))
           (tab-name (alist-get 'name (nth (1- tab-number) tabs))))
      (list (read-from-minibuffer
             "New name for tab (leave blank for automatic naming): "
@@ -1920,13 +1953,16 @@ function `tab-bar-tab-name-function'."
     (when pos
       (tab-bar-move-tab-to pos (1+ tab-index)))))
 
-(defcustom tab-bar-tab-post-change-group-functions nil
+(defcustom tab-bar-tab-post-change-group-functions '(tab-bar-move-tab-to-group)
   "List of functions to call after changing a tab group.
-The current tab is supplied as an argument."
+This hook is run at the end of the function `tab-bar-change-tab-group'.
+The current tab is supplied as an argument.  You can use any function,
+but by default it enables the function `tab-bar-move-tab-to-group'
+that moves the tab closer to its group."
   :type 'hook
   :options '(tab-bar-move-tab-to-group)
   :group 'tab-bar
-  :version "28.1")
+  :version "29.1")
 
 (defun tab-bar-change-tab-group (group-name &optional tab-number)
   "Add the tab specified by its absolute position TAB-NUMBER to GROUP-NAME.
@@ -1937,7 +1973,8 @@ TAB-NUMBER counts from 1.
 If GROUP-NAME is the empty string, then remove the tab from any group.
 While using this command, you might also want to replace
 `tab-bar-format-tabs' with `tab-bar-format-tabs-groups' in
-`tab-bar-format' to group tabs on the tab bar."
+`tab-bar-format' to group tabs on the tab bar.
+Runs the hook `tab-bar-tab-post-change-group-functions' at the end."
   (interactive
    (let* ((tabs (funcall tab-bar-tabs-function))
           (tab-number (or current-prefix-arg
@@ -2113,10 +2150,10 @@ and can restore them."
             :version "29.1"))
         (setq tab-bar-forward-button (icon-string 'tab-bar-forward))
 
-        (add-hook 'pre-command-hook 'tab-bar--history-pre-change)
-        (add-hook 'window-configuration-change-hook 'tab-bar--history-change))
-    (remove-hook 'pre-command-hook 'tab-bar--history-pre-change)
-    (remove-hook 'window-configuration-change-hook 'tab-bar--history-change)))
+        (add-hook 'pre-command-hook #'tab-bar--history-pre-change)
+        (add-hook 'window-configuration-change-hook #'tab-bar--history-change))
+    (remove-hook 'pre-command-hook #'tab-bar--history-pre-change)
+    (remove-hook 'window-configuration-change-hook #'tab-bar--history-change)))
 
 
 ;;; Non-graphical access to frame-local tabs (named window configurations)
@@ -2156,8 +2193,9 @@ For more information, see the function `tab-switcher'."
          (tabs (sort tabs (lambda (a b) (< (alist-get 'time b)
                                            (alist-get 'time a))))))
     (with-current-buffer (get-buffer-create
-                          (format " *Tabs*<%s>" (or (frame-parameter nil 
'window-id)
-                                                    (frame-parameter nil 
'name))))
+                          (format " *Tabs*<%s>"
+                                  (or (frame-parameter nil 'window-id)
+                                      (frame-parameter nil 'name))))
       (setq buffer-read-only nil)
       (erase-buffer)
       (tab-switcher-mode)
@@ -2172,7 +2210,8 @@ For more information, see the function `tab-switcher'."
                          (propertize
                           (alist-get 'name tab)
                           'mouse-face 'highlight
-                          'help-echo "mouse-2: select this window 
configuration"))
+                          'help-echo
+                          "mouse-2: select this window configuration"))
                  'tab tab)))
       (goto-char (point-min))
       (goto-char (or (next-single-property-change (point) 'tab) (point-min)))
@@ -2248,8 +2287,8 @@ Interactively, ARG is the prefix numeric argument and 
defaults to 1."
   (move-to-column tab-switcher-column))
 
 (defun tab-switcher-unmark (&optional backup)
-  "Cancel requested operations on window configuration on this line and move 
down.
-With prefix arg, move up instead."
+  "Cancel operations on window configuration on this line and move down.
+With prefix arg BACKUP, move up instead."
   (interactive "P")
   (beginning-of-line)
   (move-to-column tab-switcher-column)
@@ -2260,7 +2299,7 @@ With prefix arg, move up instead."
   (move-to-column tab-switcher-column))
 
 (defun tab-switcher-backup-unmark ()
-  "Move up one line and cancel requested operations on window configuration 
there."
+  "Move up one line and cancel operations on window configuration there."
   (interactive)
   (forward-line -1)
   (tab-switcher-unmark)
@@ -2268,9 +2307,10 @@ With prefix arg, move up instead."
   (move-to-column tab-switcher-column))
 
 (defun tab-switcher-delete (&optional arg)
-  "Mark window configuration on this line to be deleted by 
\\<tab-switcher-mode-map>\\[tab-switcher-execute] command.
+  "Mark window configuration on this line to be deleted.
 Prefix arg says how many window configurations to delete.
-Negative arg means delete backwards."
+Negative arg means delete backwards.
+The deletion will be done by the 
\\<tab-switcher-mode-map>\\[tab-switcher-execute] command."
   (interactive "p")
   (let ((buffer-read-only nil))
     (if (or (null arg) (= arg 0))
@@ -2288,8 +2328,9 @@ Negative arg means delete backwards."
     (move-to-column tab-switcher-column)))
 
 (defun tab-switcher-delete-backwards (&optional arg)
-  "Mark window configuration on this line to be deleted by 
\\<tab-switcher-mode-map>\\[tab-switcher-execute] command.
-Then move up one line.  Prefix arg means move that many lines."
+  "Mark window configuration on this line to be deleted.
+Then move up one line.  Prefix arg means move that many lines.
+The deletion will be done by the 
\\<tab-switcher-mode-map>\\[tab-switcher-execute] command."
   (interactive "p")
   (tab-switcher-delete (- (or arg 1))))
 
@@ -2302,7 +2343,9 @@ Then move up one line.  Prefix arg means move that many 
lines."
   (tab-bar-tabs-set (delq tab (funcall tab-bar-tabs-function))))
 
 (defun tab-switcher-execute ()
-  "Delete window configurations marked with 
\\<tab-switcher-mode-map>\\[tab-switcher-delete] commands."
+  "Delete the marked window configurations.
+Use the \\<tab-switcher-mode-map>\\[tab-switcher-delete] commands
+to set those marks."
   (interactive)
   (save-excursion
     (goto-char (point-min))
@@ -2348,7 +2391,8 @@ with those specified by the selected window 
configuration."
    ((framep all-frames) (list all-frames))
    (t (list (selected-frame)))))
 
-(defun tab-bar-get-buffer-tab (buffer-or-name &optional all-frames 
ignore-current-tab all-tabs)
+(defun tab-bar-get-buffer-tab (buffer-or-name
+                               &optional all-frames ignore-current-tab 
all-tabs)
   "Return the tab that owns the window whose buffer is BUFFER-OR-NAME.
 BUFFER-OR-NAME may be a buffer or a buffer name, and defaults to
 the current buffer.
@@ -2524,7 +2568,7 @@ files will be visited."
         (progn
           (setq value (nreverse value))
           (switch-to-buffer-other-tab (car value))
-          (mapc 'switch-to-buffer (cdr value))
+          (mapc #'switch-to-buffer (cdr value))
           value)
       (switch-to-buffer-other-tab value))))
 
@@ -2566,26 +2610,26 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
 
 ;;; Short aliases and keybindings
 
-(defalias 'tab-new             'tab-bar-new-tab)
-(defalias 'tab-new-to          'tab-bar-new-tab-to)
-(defalias 'tab-duplicate       'tab-bar-duplicate-tab)
-(defalias 'tab-detach          'tab-bar-detach-tab)
-(defalias 'tab-window-detach   'tab-bar-move-window-to-tab)
-(defalias 'tab-close           'tab-bar-close-tab)
-(defalias 'tab-close-other     'tab-bar-close-other-tabs)
-(defalias 'tab-close-group     'tab-bar-close-group-tabs)
-(defalias 'tab-undo            'tab-bar-undo-close-tab)
-(defalias 'tab-select          'tab-bar-select-tab)
-(defalias 'tab-switch          'tab-bar-switch-to-tab)
-(defalias 'tab-next            'tab-bar-switch-to-next-tab)
-(defalias 'tab-previous        'tab-bar-switch-to-prev-tab)
-(defalias 'tab-last            'tab-bar-switch-to-last-tab)
-(defalias 'tab-recent          'tab-bar-switch-to-recent-tab)
-(defalias 'tab-move            'tab-bar-move-tab)
-(defalias 'tab-move-to         'tab-bar-move-tab-to)
-(defalias 'tab-rename          'tab-bar-rename-tab)
-(defalias 'tab-group           'tab-bar-change-tab-group)
-(defalias 'tab-list            'tab-switcher)
+(defalias 'tab-new             #'tab-bar-new-tab)
+(defalias 'tab-new-to          #'tab-bar-new-tab-to)
+(defalias 'tab-duplicate       #'tab-bar-duplicate-tab)
+(defalias 'tab-detach          #'tab-bar-detach-tab)
+(defalias 'tab-window-detach   #'tab-bar-move-window-to-tab)
+(defalias 'tab-close           #'tab-bar-close-tab)
+(defalias 'tab-close-other     #'tab-bar-close-other-tabs)
+(defalias 'tab-close-group     #'tab-bar-close-group-tabs)
+(defalias 'tab-undo            #'tab-bar-undo-close-tab)
+(defalias 'tab-select          #'tab-bar-select-tab)
+(defalias 'tab-switch          #'tab-bar-switch-to-tab)
+(defalias 'tab-next            #'tab-bar-switch-to-next-tab)
+(defalias 'tab-previous        #'tab-bar-switch-to-prev-tab)
+(defalias 'tab-last            #'tab-bar-switch-to-last-tab)
+(defalias 'tab-recent          #'tab-bar-switch-to-recent-tab)
+(defalias 'tab-move            #'tab-bar-move-tab)
+(defalias 'tab-move-to         #'tab-bar-move-tab-to)
+(defalias 'tab-rename          #'tab-bar-rename-tab)
+(defalias 'tab-group           #'tab-bar-change-tab-group)
+(defalias 'tab-list            #'tab-switcher)
 
 (keymap-set tab-prefix-map "n"   #'tab-duplicate)
 (keymap-set tab-prefix-map "N"   #'tab-new-to)
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 99a785ee3e..c4e4a68872 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -504,7 +504,7 @@ which the tab will represent."
 (defun tab-line-format-template (tabs)
   "Template of the format for displaying tab line for selected window.
 This is used by `tab-line-format'."
-  (let* ((separator (or tab-line-separator (if window-system " " "|")))
+  (let* ((separator (or tab-line-separator (if (window-system) " " "|")))
          (hscroll (window-parameter nil 'tab-line-hscroll))
          (strings
           (mapcar
diff --git a/lisp/term.el b/lisp/term.el
index 755c220270..550aa781cc 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -278,7 +278,7 @@
 ;; C-c C-h term-dynamic-list-input-ring  List input history
 ;;
 ;; Not bound by default in term-mode
-;; term-send-invisible                 Read a line w/o echo, and send to proc
+;; term-send-invisible                 Read a line without echo, and send to 
proc
 ;; (These are bound in shell-mode)
 ;; term-dynamic-complete               Complete filename at point.
 ;; term-dynamic-list-completions       List completions in help buffer.
@@ -976,7 +976,7 @@ underlying shell."
                                        'term-mode))
             (buffer-list))))
       (easy-menu-change
-       '("Terminal")
+       nil
        "Terminal Buffers"
        (mapcar
         (lambda (buffer)
@@ -986,7 +986,9 @@ underlying shell."
                   (lambda ()
                     (interactive)
                     (switch-to-buffer buffer))))
-        buffer-list)))))
+        buffer-list)
+       nil
+       term-terminal-menu))))
 
 (easy-menu-define term-signals-menu
  (list term-mode-map term-raw-map term-pager-break-map)
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 08e38c9a05..bcd3907d1e 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -571,6 +571,8 @@ Return the pasted text as a string."
                     (8 62  [?\C-\M->])
                     (8 63  [(control meta ??)])
 
+                    (3 32 [?\M-\s])
+
                     (2 9   [S-tab])
                     (2 13  [S-return])
 
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 734252ee66..822097a86d 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1353,10 +1353,27 @@ for determining whether point is within a selector."
    :language 'css
    '((string_value) @font-lock-string-face)
 
+   :feature 'keyword
+   :language 'css
+   '(["@media"
+      "@import"
+      "@charset"
+      "@namespace"
+      "@keyframes"] @font-lock-builtin-face
+      ["and"
+       "or"
+       "not"
+       "only"
+       "selector"] @font-lock-keyword-face)
+
    :feature 'variable
    :language 'css
    '((plain_value) @font-lock-variable-name-face)
 
+   :language 'css
+   :feature 'operator
+   `(["=" "~=" "^=" "|=" "*=" "$="] @font-lock-operator-face)
+
    :feature 'selector
    :language 'css
    '((class_selector) @css-selector
@@ -1377,7 +1394,18 @@ for determining whether point is within a selector."
    :language 'css
    '((integer_value) @font-lock-number-face
      (float_value) @font-lock-number-face
-     (unit) @font-lock-constant-face)
+     (unit) @font-lock-constant-face
+     (important) @font-lock-builtin-face)
+
+   :feature 'query
+   :language 'css
+   '((keyword_query) @font-lock-property-face
+     (feature_name) @font-lock-property-face)
+
+
+   :feature 'bracket
+   :language 'css
+   '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
 
    :feature 'error
    :language 'css
@@ -1794,6 +1822,7 @@ Use `\\[fill-paragraph]' to reformat CSS declaration 
blocks.  It
 can also be used to fill comments.
 
 \\{css-mode-map}"
+  :syntax-table css-mode-syntax-table
   (when (treesit-ready-p 'css)
     ;; Borrowed from `css-mode'.
     (add-hook 'completion-at-point-functions
@@ -1808,14 +1837,9 @@ can also be used to fill comments.
     (setq-local treesit-defun-type-regexp "rule_set")
     (setq-local treesit-font-lock-settings css--treesit-settings)
     (setq-local treesit-font-lock-feature-list
-                '((selector comment)
+                '((selector comment query keyword)
                   (property constant string)
-                  (error variable function)))
-    ;; Tree-sitter-css, for whatever reason, cannot reliably return
-    ;; the captured nodes in a given range (it instead returns the
-    ;; nodes preceding range).  Before this is fixed in
-    ;; tree-sitter-css, use this heuristic as a temporary fix.
-    (setq-local treesit--font-lock-query-expand-range (cons 80 80))
+                  (error variable function operator bracket)))
     (setq-local imenu-create-index-function #'css--treesit-imenu)
     (setq-local which-func-functions nil)
     (treesit-major-mode-setup)))
diff --git a/lisp/textmodes/emacs-news-mode.el 
b/lisp/textmodes/emacs-news-mode.el
index ebb31da9cf..26f8f610ef 100644
--- a/lisp/textmodes/emacs-news-mode.el
+++ b/lisp/textmodes/emacs-news-mode.el
@@ -226,7 +226,7 @@ untagged NEWS entry."
         ;; Do manual references.
         (goto-char (point-min))
         (search-forward "\f" nil t)
-        (while (re-search-forward "\"\\(([a-z0-9]+)[ \n][^\"]\\{1,80\\}\\)\""
+        (while (re-search-forward "\"\\(([a-z0-9-]+)[ \n][^\"]\\{1,80\\}\\)\""
                                   nil t)
           (buttonize-region (match-beginning 1) (match-end 1)
                             (lambda (node) (info node))
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index e72576cdc7..126b3777f5 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -1004,10 +1004,13 @@ This enforces rescanning the buffer on next use."
                   reftex-section-levels))
 
     ;; Calculate the regular expressions
-    (let* (
-;          (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
-           (wbol "\\(^\\)%?[ \t]*") ; Need to keep the empty group because
-                                    ; match numbers are hard coded
+    (let* (;; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
+           ;; Need to keep the empty group because match numbers are
+           ;; hard coded
+           (wbol (concat "\\(^\\)"
+                         (when (string-suffix-p ".dtx" (buffer-file-name) t)
+                           "%")
+                         "[ \t]*"))
            (label-re (concat "\\(?:"
                             (mapconcat #'identity reftex-label-regexps "\\|")
                             "\\)"))
@@ -2053,7 +2056,8 @@ IGNORE-WORDS List of words which should be removed from 
the string."
          (newname (concat "Fontify-me-" oldname)))
     (unwind-protect
         (progn
-          ;; Rename buffer temporarily to start w/o space (because of 
font-lock)
+          ;; Rename buffer temporarily to start without space (because
+          ;; of font-lock)
           (rename-buffer newname t)
           ;; Good: we have the indirection functions
           (set (make-local-variable 'font-lock-fontify-region-function)
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 98672f42b3..24e93bf001 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -347,6 +347,8 @@ Subexpression 1 is what goes into the corresponding `@end' 
statement.")
 (defun texinfo-flymake (report-fn &rest _)
   "Texinfo checking for Flymake.
 
+It uses either \"makeinfo\" or \"texi2any\", in that order.
+
 REPORT-FN is the callback function."
   (let ((executable (or (executable-find "makeinfo")
                         (executable-find "texi2any")))
diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el
new file mode 100644
index 0000000000..bca6a5e81a
--- /dev/null
+++ b/lisp/textmodes/toml-ts-mode.el
@@ -0,0 +1,187 @@
+;;; toml-ts-mode.el --- tree-sitter support for TOML  -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author     : Jostein Kjønigsen <jostein@kjonigsen.net>
+;; Maintainer : Jostein Kjønigsen <jostein@kjonigsen.net>
+;; Created    : December 2022
+;; Keywords   : toml languages tree-sitter
+
+;; 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 'treesit)
+
+(declare-function treesit-parser-create "treesit.c")
+(declare-function treesit-induce-sparse-tree "treesit.c")
+(declare-function treesit-node-start "treesit.c")
+(declare-function treesit-node-child-by-field-name "treesit.c")
+
+(defcustom toml-ts-mode-indent-offset 2
+  "Number of spaces for each indentation step in `toml-ts-mode'."
+  :version "29.1"
+  :type 'integer
+  :safe 'integerp
+  :group 'toml)
+
+(defvar toml-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?_  "_"     table)
+    (modify-syntax-entry ?\\ "\\"    table)
+    (modify-syntax-entry ?=  "."     table)
+    (modify-syntax-entry ?\' "\""    table)
+    (modify-syntax-entry ?#  "<"   table)
+    (modify-syntax-entry ?\n "> b"  table)
+    (modify-syntax-entry ?\^m "> b" table)
+    table)
+  "Syntax table for `toml-ts-mode'.")
+
+(defvar toml-ts-mode--indent-rules
+  `((toml
+     ((node-is "]") parent-bol 0)
+     ((parent-is "string") parent-bol toml-ts-mode-indent-offset)
+     ((parent-is "array") parent-bol toml-ts-mode-indent-offset))))
+
+(defvar toml-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'toml
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
+
+   :language 'toml
+   :feature 'constant
+   '((boolean) @font-lock-constant-face)
+
+   :language 'toml
+   :feature 'delimiter
+   '((["="]) @font-lock-delimiter-face)
+
+   :language 'toml
+   :feature 'number
+   '([(integer) (float) (local_date) (local_date_time) (local_time)]
+     @font-lock-number-face)
+
+   :language 'toml
+   :feature 'string
+   '((string) @font-lock-string-face)
+
+   :language 'toml
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face)
+
+   :language 'toml
+   :feature 'pair
+   :override t            ; Needed for overriding string face on keys.
+   '((bare_key) @font-lock-property-face
+     (quoted_key) @font-lock-property-face
+     (table ("[" @font-lock-bracket-face
+             (_) @font-lock-type-face
+             "]" @font-lock-bracket-face))
+     (table_array_element ("[[" @font-lock-bracket-face
+                           (_) @font-lock-type-face
+                           "]]" @font-lock-bracket-face))
+     (table (quoted_key) @font-lock-type-face)
+     (table (dotted_key (quoted_key)) @font-lock-type-face))
+
+   :language 'toml
+   :feature 'error
+   :override t
+   '((ERROR) @font-lock-warning-face))
+  "Font-lock settings for TOML.")
+
+(defun toml-ts-mode--get-table-name (node)
+  "Obtains the header-name for the associated tree-sitter `NODE'."
+  (if node
+      (treesit-node-text
+       (car (cdr (treesit-node-children node))))
+    "Root table"))
+
+(defun toml-ts-mode--imenu-1 (node)
+  "Helper for `toml-ts-mode--imenu'.
+Find string representation for NODE and set marker, then recurse
+the subtrees."
+  (let* ((ts-node (car node))
+         (subtrees (mapcan #'toml-ts-mode--imenu-1 (cdr node)))
+         (name (toml-ts-mode--get-table-name ts-node))
+         (marker (when ts-node
+                   (set-marker (make-marker)
+                               (treesit-node-start ts-node)))))
+    (cond
+     ((null ts-node) subtrees)
+     (subtrees
+      `((,name ,(cons name marker) ,@subtrees)))
+     (t
+      `((,name . ,marker))))))
+
+(defun toml-ts-mode--imenu ()
+  "Return Imenu alist for the current buffer."
+  (let* ((node (treesit-buffer-root-node))
+         (table-tree (treesit-induce-sparse-tree
+                      node "^table$" nil 1000))
+         (table-array-tree (treesit-induce-sparse-tree
+                            node "^table_array_element$" nil 1000))
+         (table-index (toml-ts-mode--imenu-1 table-tree))
+         (table-array-index (toml-ts-mode--imenu-1 table-array-tree)))
+    (append
+     (when table-index `(("Headers" . ,table-index)))
+     (when table-array-index `(("Arrays" . ,table-array-index))))))
+
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.toml\\'" . toml-ts-mode))
+
+;;;###autoload
+(define-derived-mode toml-ts-mode text-mode "TOML"
+  "Major mode for editing TOML, powered by tree-sitter."
+  :group 'toml-mode
+  :syntax-table toml-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'toml)
+    (treesit-parser-create 'toml)
+
+    ;; Comments
+    (setq-local comment-start "# ")
+    (setq-local comment-end "")
+
+    ;; Indent.
+    (setq-local treesit-simple-indent-rules toml-ts-mode--indent-rules)
+
+    ;; Navigation.
+    (setq-local treesit-defun-type-regexp
+                (rx (or "table" "table_array_element")))
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings toml-ts-mode--font-lock-settings)
+    (setq-local treesit-font-lock-feature-list
+                '((comment)
+                  (constant number pair string)
+                  (escape-sequence)
+                  (delimiter error)))
+
+    ;; Imenu.
+    (setq-local imenu-create-index-function #'toml-ts-mode--imenu)
+    (setq-local which-func-functions nil) ;; Piggyback on imenu
+
+    (treesit-major-mode-setup)))
+
+(provide 'toml-ts-mode)
+
+;;; toml-ts-mode.el ends here
diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el
new file mode 100644
index 0000000000..6ef6dabb3a
--- /dev/null
+++ b/lisp/textmodes/yaml-ts-mode.el
@@ -0,0 +1,151 @@
+;;; yaml-ts-mode.el --- tree-sitter support for YAML  -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author     : Randy Taylor <dev@rjt.dev>
+;; Maintainer : Randy Taylor <dev@rjt.dev>
+;; Created    : December 2022
+;; Keywords   : yaml languages tree-sitter
+
+;; 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 'treesit)
+
+(declare-function treesit-parser-create "treesit.c")
+
+(defvar yaml-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?#  "<"  table)
+    (modify-syntax-entry ?\n ">"  table)
+    (modify-syntax-entry ?&  "."  table)
+    (modify-syntax-entry ?*  "."  table)
+    (modify-syntax-entry ?\( "."  table)
+    (modify-syntax-entry ?\) "."  table)
+    (modify-syntax-entry ?\' "\"" table)
+    table)
+  "Syntax table for `yaml-ts-mode'.")
+
+(defvar yaml-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'yaml
+   :feature 'bracket
+   '((["[" "]" "{" "}"]) @font-lock-bracket-face)
+
+   :language 'yaml
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
+
+   :language 'yaml
+   :feature 'constant
+   '([(boolean_scalar)
+      (null_scalar)
+      (reserved_directive)
+      (tag_directive)
+      (yaml_directive)] @font-lock-constant-face)
+
+   :language 'yaml
+   :feature 'delimiter
+   '((["," ":" "-" ">" "?" "|"]) @font-lock-delimiter-face)
+
+   :language 'yaml
+   :feature 'misc-punctuation
+   '((["---" "..." "&" "*"]) @font-lock-misc-punctuation-face)
+
+   :language 'yaml
+   :feature 'number
+   '([(float_scalar) (integer_scalar)] @font-lock-number-face)
+
+   :language 'yaml
+   :feature 'type
+   '([(alias_name) (anchor_name) (tag)] @font-lock-type-face)
+
+   :language 'yaml
+   :feature 'string
+   :override t
+   '([(block_scalar)
+      (double_quote_scalar)
+      (single_quote_scalar)
+      (string_scalar)] @font-lock-string-face)
+
+   :language 'yaml
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face)
+
+   :language 'yaml
+   :feature 'property
+   :override t
+   '((block_mapping_pair
+      key: (flow_node (plain_scalar (string_scalar) @font-lock-property-face)))
+     (block_mapping_pair
+      key: (flow_node
+            [(double_quote_scalar) (single_quote_scalar)] 
@font-lock-property-face))
+     (flow_mapping
+      (_ key: (flow_node (plain_scalar (string_scalar) 
@font-lock-property-face))))
+     (flow_mapping
+      (_ key:
+         (flow_node
+          [(double_quote_scalar) (single_quote_scalar)] 
@font-lock-property-face)))
+     (flow_sequence
+      (_ key: (flow_node (plain_scalar (string_scalar) 
@font-lock-property-face))))
+     (flow_sequence
+      (_ key:
+         (flow_node
+          [(double_quote_scalar) (single_quote_scalar)] 
@font-lock-property-face))))
+
+   :language 'yaml
+   :feature 'error
+   :override t
+   '((ERROR) @font-lock-warning-face))
+  "Tree-sitter font-lock settings for `yaml-ts-mode'.")
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.ya?ml\\'" . yaml-ts-mode))
+
+;;;###autoload
+(define-derived-mode yaml-ts-mode text-mode "YAML"
+  "Major mode for editing YAML, powered by tree-sitter."
+  :group 'yaml
+  :syntax-table yaml-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'yaml)
+    (treesit-parser-create 'yaml)
+
+    ;; Comments.
+    (setq-local comment-start "# ")
+    (setq-local comment-end "")
+
+    ;; Indentation.
+    (setq-local indent-tabs-mode nil)
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings yaml-ts-mode--font-lock-settings)
+    (setq-local treesit-font-lock-feature-list
+                '((comment)
+                  (string type)
+                  (constant escape-sequence number property)
+                  (bracket delimiter error misc-punctuation)))
+
+    (treesit-major-mode-setup)))
+
+(provide 'yaml-ts-mode)
+
+;;; yaml-ts-mode.el ends here
diff --git a/lisp/transient.el b/lisp/transient.el
index 0919c2c3ef..01c492c68c 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -6,7 +6,7 @@
 ;; URL: https://github.com/magit/transient
 ;; Keywords: extensions
 
-;; Package-Version: 0.3.7
+;; Package-Version: 0.3.7.50
 ;; Package-Requires: ((emacs "26.1"))
 
 ;; SPDX-License-Identifier: GPL-3.0-or-later
@@ -2199,11 +2199,11 @@ value.  Otherwise return CHILDREN as is."
         (delayed (if transient--exitp
                      (apply-partially #'transient--post-exit this-command)
                    #'transient--resume-override))
-        post-command abort-minibuffer)
+        outside-interactive post-command abort-minibuffer)
     (unless abort-only
       (setq post-command
             (lambda () "@transient--delay-post-command"
-              (let ((act (and (not (eq (this-command-keys-vector) []))
+              (let ((act (and (not (equal (this-command-keys-vector) []))
                               (or (eq this-command command)
                                   ;; `execute-extended-command' was
                                   ;; used to call another command
@@ -2211,7 +2211,9 @@ value.  Otherwise return CHILDREN as is."
                                   (equal
                                    (ignore-errors
                                      (string-to-multibyte (this-command-keys)))
-                                   (format "\M-x%s\r" this-command))))))
+                                   (format "\M-x%s\r" this-command))
+                                  ;; Minibuffer used outside `interactive'.
+                                  (and outside-interactive 'post-cmd)))))
                 (transient--debug 'post-command-hook "act: %s" act)
                 (when act
                   (remove-hook 'transient--post-command-hook post-command)
@@ -2220,12 +2222,15 @@ value.  Otherwise return CHILDREN as is."
       (add-hook 'transient--post-command-hook post-command))
     (setq abort-minibuffer
           (lambda () "@transient--delay-post-command"
-            (let ((act (and (or (memq this-command transient--abort-commands)
-                                (equal (this-command-keys) ""))
-                            (= (minibuffer-depth) depth))))
+            (let ((act (and (= (minibuffer-depth) depth)
+                            (or (memq this-command transient--abort-commands)
+                                (equal (this-command-keys) "")
+                                (prog1 nil
+                                  (setq outside-interactive t))))))
               (transient--debug
                'abort-minibuffer
-               "mini: %s|%s, act %s" (minibuffer-depth) depth act)
+               "mini: %s|%s, act: %s" (minibuffer-depth) depth
+               (or act (and outside-interactive '->post-cmd)))
               (when act
                 (remove-hook 'transient--post-command-hook post-command)
                 (remove-hook 'minibuffer-exit-hook abort-minibuffer)
@@ -2236,7 +2241,7 @@ value.  Otherwise return CHILDREN as is."
   (transient--debug 'post-command)
   (transient--with-emergency-exit
     (cond
-     ((and (eq (this-command-keys-vector) [])
+     ((and (equal (this-command-keys-vector) [])
            (= (minibuffer-depth)
               (1+ transient--minibuffer-depth)))
       (transient--suspend-override)
@@ -2407,6 +2412,10 @@ If there is no parent prefix, then behave like 
`transient--do-exit'."
   (transient--stack-zap)
   transient--exit)
 
+(defun transient--do-leave ()
+  "Call the command without exporting variables and exit the transient."
+  transient--stay)
+
 (defun transient--do-push-button ()
   "Call the command represented by the activated button.
 Use that command's pre-command to determine transient behavior."
@@ -3376,7 +3385,7 @@ have a history of their own.")
                     (insert ?\n)
                   (insert (propertize " " 'display
                                       `(space :align-to (,(nth (1+ c) cc)))))))
-            (insert (make-string (- (nth c cc) (current-column)) ?\s))
+            (insert (make-string (max 1 (- (nth c cc) (current-column))) ?\s))
             (when-let ((cell (nth r (nth c columns))))
               (insert cell))
             (when (= c (1- cs))
@@ -4119,7 +4128,10 @@ we stop there."
               'face 'transient-value))
 
 (cl-defmethod transient-prompt ((obj transient-lisp-variable))
-  (format "Set %s: " (oref obj variable)))
+  (if (and (slot-boundp obj 'prompt)
+           (oref obj prompt))
+      (cl-call-next-method obj)
+    (format "Set %s: " (oref obj variable))))
 
 (defun transient-lisp-variable--reader (prompt initial-input _history)
   (read--expression prompt initial-input))
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 419a705dbf..1f366807ce 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -520,28 +520,41 @@ omitted, default END to BEG."
               "Generic tree-sitter font-lock error"
               'treesit-error)
 
+(defvar-local treesit-font-lock-level 3
+  "Decoration level to be used by tree-sitter fontifications.
+
+Major modes categorize their fontification features into levels,
+from 1 which is the absolute minimum, to 4 that yields the maximum
+fontifications.
+
+Level 1 usually contains only comments and definitions.
+Level 2 usually adds keywords, strings, constants, types, etc.
+Level 3 usually represents a full-blown fontification, including
+assignment, constants, numbers, properties, etc.
+Level 4 adds everything else that can be fontified: delimiters,
+operators, brackets, all functions and variables, etc.
+
+In addition to the decoration level, individual features can be
+turned on/off by calling `treesit-font-lock-recompute-features'.
+Changing the decoration level requires calling
+`treesit-font-lock-recompute-features' to have an effect.")
+
 (defvar-local treesit--font-lock-query-expand-range (cons 0 0)
   "The amount to expand the start and end of the region when fontifying.
 This should be a cons cell (START . END).  When fontifying a
 buffer, Emacs will move the start of the query range backward by
 START amount, and the end of the query range by END amount.  Both
 START and END should be positive integers or 0.  This doesn't
-affect the fontified range.
-
-Sometimes, querying on some parser with a restricted range
-returns nodes not in that range but before it, which breaks
-fontification.  Major modes can adjust this variable as a
-temporarily fix.")
+affect the fontified range.")
 
 (defvar-local treesit-font-lock-feature-list nil
   "A list of lists of feature symbols.
 
 Use `treesit-font-lock-recompute-features' and
-`font-lock-maximum-decoration' to configure enabled features.
+`treesit-font-lock-level' to configure enabled features.
 
 Each sublist represents a decoration level.
-`font-lock-maximum-decoration' controls which levels are
-activated.
+`treesit-font-lock-level' controls which levels are activated.
 
 Inside each sublist are feature symbols, which correspond to the
 :feature value of a query defined in `treesit-font-lock-rules'.
@@ -575,8 +588,8 @@ For SETTING to be activated for font-lock, ENABLE must be 
t.  To
 disable this SETTING, set ENABLE to nil.
 
 FEATURE is the \"feature name\" of the query.  Users can control
-which features are enabled with `font-lock-maximum-decoration'
-and `treesit-font-lock-feature-list'.
+which features are enabled with `treesit-font-lock-level' and
+`treesit-font-lock-feature-list'.
 
 OVERRIDE is the override flag for this query.  Its value can be
 t, nil, append, prepend, keep.  See more in
@@ -718,22 +731,19 @@ REMOVE-LIST.
 
 If both ADD-LIST and REMOVE-LIST are omitted, recompute each
 feature according to `treesit-font-lock-feature-list' and
-`font-lock-maximum-decoration'.  Let N be the value of
-`font-lock-maximum-decoration', features in the first Nth sublist
-of `treesit-font-lock-feature-list' are enabled, and the rest
-features are disabled.  If `font-lock-maximum-decoration' is t,
-all features in `treesit-font-lock-feature-list' are enabled, and
-the rest are disabled.
-
-ADD-LIST and REMOVE-LIST are each a list of feature symbols.  The
+`treesit-font-lock-level'.  If the value of `treesit-font-lock-level',
+is N, then the features in the first N sublists of
+`treesit-font-lock-feature-list' are enabled, and the rest of
+the features are disabled.
+
+ADD-LIST and REMOVE-LIST are lists of feature symbols.  The
 same feature symbol cannot appear in both lists; the function
 signals the `treesit-font-lock-error' error if that happens."
   (when-let ((intersection (cl-intersection add-list remove-list)))
     (signal 'treesit-font-lock-error
             (list "ADD-LIST and REMOVE-LIST contain the same feature"
                   intersection)))
-  (let* ((level (font-lock-value-in-major-mode
-                 font-lock-maximum-decoration))
+  (let* ((level treesit-font-lock-level)
          (base-features (cl-loop
                          for idx = 0 then (1+ idx)
                          for features in treesit-font-lock-feature-list
@@ -759,25 +769,35 @@ signals the `treesit-font-lock-error' error if that 
happens."
                        ((memq feature remove-list) nil)
                        (t current-value))))))
 
-(defun treesit-fontify-with-override (start end face override)
+(defun treesit-fontify-with-override
+    (start end face override &optional bound-start bound-end)
   "Apply FACE to the region between START and END.
 OVERRIDE can be nil, t, `append', `prepend', or `keep'.
-See `treesit-font-lock-rules' for their semantic."
-  (pcase override
-    ('nil (unless (text-property-not-all
-                   start end 'face nil)
-            (put-text-property start end 'face face)))
-    ('t (put-text-property start end 'face face))
-    ('append (font-lock-append-text-property
+See `treesit-font-lock-rules' for their semantic.
+
+If BOUND-START and BOUND-END are non-nil, only fontify the region
+in between them."
+  (when (or (null bound-start) (null bound-end)
+            (and bound-start bound-end
+                 (<= bound-start end)
+                 (>= bound-end start)))
+    (when (and bound-start bound-end)
+      (setq start (max bound-start start)
+            end (min bound-end end)))
+    (pcase override
+      ('nil (unless (text-property-not-all start end 'face nil)
+              (put-text-property start end 'face face)))
+      ('t (put-text-property start end 'face face))
+      ('append (font-lock-append-text-property
+                start end 'face face))
+      ('prepend (font-lock-prepend-text-property
+                 start end 'face face))
+      ('keep (font-lock-fillin-text-property
               start end 'face face))
-    ('prepend (font-lock-prepend-text-property
-               start end 'face face))
-    ('keep (font-lock-fillin-text-property
-            start end 'face face))
-    (_ (signal 'treesit-font-lock-error
-               (list
-                "Unrecognized value of :override option"
-                override)))))
+      (_ (signal 'treesit-font-lock-error
+                 (list
+                  "Unrecognized value of :override option"
+                  override))))))
 
 (defun treesit--set-nonsticky (start end sym &optional remove)
   "Set `rear-nonsticky' property between START and END.
@@ -813,21 +833,28 @@ The range is between START and END."
         (nreverse result))
     (list node)))
 
-(defun treesit--children-covering-range-recurse (node start end threshold)
+(defun treesit--children-covering-range-recurse
+    (node start end threshold &optional limit)
   "Return a list of children of NODE covering a range.
+
 Recursively go down the parse tree and collect children, until
 all nodes in the returned list are smaller than THRESHOLD.  The
-range is between START and END."
+range is between START and END.
+
+LIMIT is the recursion limit, which defaults to 100."
   (let* ((child (treesit-node-first-child-for-pos node start))
+         (limit (or limit 100))
          result)
-    (while (and child (<= (treesit-node-start child) end))
+    ;; If LIMIT is exceeded, we are probably seeing the erroneously
+    ;; tall tree, in that case, just give up.
+    (while (and (> limit 0) child (<= (treesit-node-start child) end))
       ;; If child still too large, recurse down.  Otherwise collect
       ;; child.
       (if (> (- (treesit-node-end child)
                 (treesit-node-start child))
              threshold)
           (dolist (r (treesit--children-covering-range-recurse
-                      child start end threshold))
+                      child start end threshold (1- limit)))
             (push r result))
         (push child result))
       (setq child (treesit-node-next-sibling child)))
@@ -851,6 +878,38 @@ detail.")
 ;; applied by regexp-based font-lock.  The clipped part will be
 ;; fontified fine when Emacs fontifies the region containing it.
 ;;
+;; 2. If you insert an ending quote into a buffer, jit-lock only wants
+;; to fontify that single quote, and (treesit-node-on start end) will
+;; give you that quote node.  We want to capture the string and apply
+;; string face to it, but querying on the quote node will not give us
+;; the string node.  So we don't use treesit-node-on: using the root
+;; node with a restricted range is very fast anyway (even in large
+;; files of size ~10MB).  Plus, querying the result of
+;; `treesit-node-on' could still miss patterns even if we use some
+;; heuristic to enlarge the node (how much to enlarge? to which
+;; extent?), it's much safer to just use the root node.
+;;
+;; Sometimes the source file has some errors that cause tree-sitter to
+;; parse it into a enormously tall tree (10k levels tall).  In that
+;; case querying the root node is very slow.  So we try to get
+;; top-level nodes and query them.  This ensures that querying is fast
+;; everywhere else, except for the problematic region.
+;;
+;; Some other time the source file has a top-level node that contains
+;; a huge number of children (say, 10k children), querying that node
+;; is also very slow, so instead of getting the top-level node, we
+;; recursively go down the tree to find nodes that cover the region
+;; but are reasonably small.
+;;
+;; 3. It is possible to capture a node that's completely outside the
+;; region between START and END: as long as the whole pattern
+;; intersects the region, all the captured nodes in that pattern are
+;; returned.  If the node is outside of that region, (max node-start
+;; start) and friends return bad values, so we filter them out.
+;; However, we don't filter these nodes out if a function will process
+;; the node, because could (and often do) fontify the relatives of the
+;; captured node, not just the node itself.  If we took out those
+;; nodes author of those functions would be very confused.
 (defun treesit-font-lock-fontify-region (start end &optional loudly)
   "Fontify the region between START and END.
 If LOUDLY is non-nil, display some debugging information."
@@ -863,35 +922,18 @@ If LOUDLY is non-nil, display some debugging information."
            (enable (nth 1 setting))
            (override (nth 3 setting))
            (language (treesit-query-language query)))
-      ;; If you insert an ending quote into a buffer, jit-lock only
-      ;; wants to fontify that single quote, and (treesit-node-on
-      ;; start end) will give you that quote node.  We want to capture
-      ;; the string and apply string face to it, but querying on the
-      ;; quote node will not give us the string node.  So we don't use
-      ;; treesit-node-on: using the root node with a restricted range
-      ;; is very fast anyway (even in large files of size ~10MB).
-      ;; Plus, querying the result of `treesit-node-on' could still
-      ;; miss patterns even if we use some heuristic to enlarge the
-      ;; node (how much to enlarge? to which extent?), it's much safer
-      ;; to just use the root node.
-      ;;
-      ;; Sometimes the source file has some errors that cause
-      ;; tree-sitter to parse it into a enormously tall tree (10k
-      ;; levels tall).  In that case querying the root node is very
-      ;; slow.  So we try to get top-level nodes and query them.  This
-      ;; ensures that querying is fast everywhere else, except for the
-      ;; problematic region.
       (when-let ((nodes (list (treesit-buffer-root-node language)))
                  ;; Only activate if ENABLE flag is t.
                  (activate (eq t enable)))
         (ignore activate)
 
         ;; If we run into problematic files, use the "fast mode" to
-        ;; try to recover.
+        ;; try to recover.  See comment #2 above for more explanation.
         (when treesit--font-lock-fast-mode
-          (setq nodes (treesit--children-covering-range
-                       (car nodes) start end)))
+          (setq nodes (treesit--children-covering-range-recurse
+                       (car nodes) start end (* 4 jit-lock-chunk-size))))
 
+        ;; Query each node.
         (dolist (sub-node nodes)
           (let* ((delta-start (car treesit--font-lock-query-expand-range))
                  (delta-end (cdr treesit--font-lock-query-expand-range))
@@ -906,18 +948,20 @@ If LOUDLY is non-nil, display some debugging information."
             (when (> (time-to-seconds (time-subtract end-time start-time))
                      0.01)
               (setq-local treesit--font-lock-fast-mode t))
+
+            ;; For each captured node, fontify that node.
             (with-silent-modifications
               (dolist (capture captures)
                 (let* ((face (car capture))
                        (node (cdr capture))
                        (node-start (treesit-node-start node))
                        (node-end (treesit-node-end node)))
-                  ;; Turns out it is possible to capture a node that's
-                  ;; completely outside the region between START and
-                  ;; END.  If the node is outside of that region, (max
-                  ;; node-start start) and friends return bad values.
-                  (when (and (< start node-end)
-                             (< node-start end))
+                  ;; If node is not in the region, take them out.  See
+                  ;; comment #3 above for more detail.
+                  (if (and (facep face)
+                           (or (>= start node-end) (>= node-start end)))
+                      (when (or loudly treesit--font-lock-verbose)
+                        (message "Captured node %s(%s-%s) but it is outside of 
fontifing region" node node-start node-end))
                     (cond
                      ((facep face)
                       (treesit-fontify-with-override
@@ -947,16 +991,6 @@ parser notifying of the change."
 
 ;;; Indent
 
-;; `comment-start' and `comment-end' assume there is only one type of
-;; comment, and that the comment spans only one line.  So they are not
-;; sufficient for our purpose.
-
-(defvar-local treesit-comment-start nil
-  "Regular expression matching an opening comment token.")
-
-(defvar-local treesit-comment-end nil
-  "Regular expression matching a closing comment token.")
-
 (define-error 'treesit-indent-error
               "Generic tree-sitter indentation error"
               'treesit-error)
@@ -1013,7 +1047,6 @@ See `treesit-simple-indent-presets'.")
                        (or (null node-index-max)
                            (<= (treesit-node-index node)
                                node-index-max))))))
-        ;; TODO: Document if genuinely useful.
         (cons 'n-p-gp
               (lambda (node-t parent-t grand-parent-t)
                 (lambda (node parent &rest _)
@@ -1042,8 +1075,10 @@ See `treesit-simple-indent-presets'.")
                           (lambda (node &rest _)
                             (string-match-p
                              name (or (treesit-node-field-name node) "")))))
-        (cons 'comment-end (lambda (&rest _)
-                             (looking-at-p treesit-comment-end)))
+        (cons 'comment-end (lambda (_node _parent bol &rest _)
+                             (save-excursion
+                               (goto-char bol)
+                               (looking-at-p comment-end-skip))))
         ;; TODO: Document.
         (cons 'catch-all (lambda (&rest _) t))
 
@@ -1069,14 +1104,8 @@ See `treesit-simple-indent-presets'.")
               (lambda (_n parent &rest _)
                 (save-excursion
                   (goto-char (treesit-node-start parent))
-                  (re-search-forward treesit-comment-start)
-                  (point))))
-        (cons 'comment-start-skip
-              (lambda (_n parent &rest _)
-                (save-excursion
-                  (goto-char (treesit-node-start parent))
-                  (re-search-forward treesit-comment-start)
-                  (skip-syntax-forward "-")
+                  (re-search-forward comment-start-skip)
+                  (skip-syntax-backward "-")
                   (point))))
         ;; TODO: Document.
         (cons 'grand-parent
@@ -1152,6 +1181,10 @@ no-node
 
     Checks that NODE's type matches regexp TYPE.
 
+\(n-p-gp NODE-TYPE PARENT-TYPE GRANDPARENT-TYPE)
+
+    Checks that NODE, its parent, and its grandparent's type.
+
 \(query QUERY)
 
     Queries PARENT with QUERY, and checks if NODE is
@@ -1194,14 +1227,9 @@ point-min
 
 comment-start
 
-    Returns the position after a match for `treesit-comment-start'.
-    Assumes PARENT is a comment node.
-
-comment-start-skip
-
-    Goes to the position that comment-start would return, skips
-    whitespace after that, and returns the resulting position.
-    Assumes PARENT is a comment node.")
+    Goes to the position that `comment-start-skip' would return,
+    skips whitespace backwards, and returns the resulting
+    position.  Assumes PARENT is a comment node.")
 
 (defun treesit--simple-indent-eval (exp)
   "Evaluate EXP.
@@ -1492,7 +1520,8 @@ beginning rather than the end of a node.
 
 This function guarantees that the matched node it returns makes
 progress in terms of buffer position: the start/end position of
-the returned node is always greater than that of NODE.
+the returned node is always STRICTLY greater/less than that of
+NODE.
 
 BACKWARD and ALL are the same as in `treesit-search-forward'."
   (when-let* ((start-pos (if start
@@ -1532,52 +1561,284 @@ BACKWARD and ALL are the same as in 
`treesit-search-forward'."
   "A regexp that matches the node type of defun nodes.
 For example, \"(function|class)_definition\".
 
+Sometimes not all nodes matched by the regexp are valid defuns.
+In that case, set this variable to a cons cell of the
+form (REGEXP . FILTER), where FILTER is a function that takes a
+node (the matched node) and returns t if node is valid, or nil
+for invalid node.
+
 This is used by `treesit-beginning-of-defun' and friends.")
 
-(defun treesit-beginning-of-defun (&optional arg)
-  "Tree-sitter `beginning-of-defun' function.
-ARG is the same as in `beginning-of-defun'."
-  (let ((arg (or arg 1))
-        (node (treesit-node-at (point))))
-    (if (> arg 0)
-        ;; Go backward.
-        (while (and (> arg 0)
-                    (setq node (treesit-search-forward-goto
-                                node treesit-defun-type-regexp t t)))
-          (setq node (or (treesit-node-top-level
-                          node treesit-defun-type-regexp)
-                         node))
-          (setq arg (1- arg)))
-      ;; Go forward.
-      (while (and (< arg 0)
-                  (setq node (treesit-search-forward-goto
-                              node treesit-defun-type-regexp)))
-        (setq node (or (treesit-node-top-level
-                        node treesit-defun-type-regexp)
-                       node))
-        (setq arg (1+ arg))))
-    (when node
-      (goto-char (treesit-node-start node))
-      t)))
+(defvar-local treesit-defun-tactic 'nested
+  "Determines how does Emacs treat nested defuns.
+If the value is `top-level', Emacs only moves across top-level
+defuns, if the value is `nested', Emacs recognizes nested defuns.")
+
+(defvar-local treesit-defun-skipper #'treesit-default-defun-skipper
+  "A function called after tree-sitter navigation moved a step.
 
-(defun treesit-end-of-defun ()
-  "Tree-sitter `end-of-defun' function."
-  ;; Why not simply get the largest node at point: when point is at
-  ;; (point-min), that gives us the root node.
-  (let* ((node (treesit-node-at (point)))
-         (top (or (treesit-node-top-level
-                   node
-                   treesit-defun-type-regexp)
-                  node)))
-    (goto-char (treesit-node-end top))))
+It is called with no arguments.  By default, this function tries
+to move to the beginning of a line, either by moving to the empty
+newline after a defun, or the beginning of a defun.
 
-;;; Imenu
+If the value is nil, no skipping is performed.")
+
+(defun treesit-beginning-of-defun (&optional arg)
+  "Move backward to the beginning of a defun.
+
+With argument ARG, do it that many times.  Negative ARG means
+move forward to the ARGth following beginning of defun.
+
+If search is successful, return t, otherwise return nil.
+
+This is a tree-sitter equivalent of `beginning-of-defun'.
+Behavior of this function depends on `treesit-defun-type-regexp'
+and `treesit-defun-skipper'."
+  (interactive "^p")
+  (when-let* ((arg (or arg 1))
+              (dest (treesit--navigate-defun (point) (- arg) 'beg)))
+    (goto-char dest)
+    (when treesit-defun-skipper
+      (funcall treesit-defun-skipper))
+    t))
+
+(defun treesit-end-of-defun (&optional arg _)
+  "Move forward to next end of defun.
+
+With argument ARG, do it that many times.
+Negative argument -N means move back to Nth preceding end of defun.
+
+This is a tree-sitter equivalent of `end-of-defun'.  Behavior of
+this function depends on `treesit-defun-type-regexp' and
+`treesit-defun-skipper'."
+  (interactive "^p\nd")
+  (when-let* ((arg (or arg 1))
+              (dest (treesit--navigate-defun (point) arg 'end)))
+    (goto-char dest)
+    (when treesit-defun-skipper
+      (funcall treesit-defun-skipper))))
+
+(defvar-local treesit-text-type-regexp "\\`comment\\'"
+  "A regexp that matches the node type of textual nodes.
+
+A textual node is a node that is not normal code, such as
+comments and multiline string literals.  For example,
+\"(line|block)_comment\" in the case of a comment, or
+\"text_block\" in the case of a string.  This is used by
+`prog-fill-reindent-defun' and friends.")
+
+(defun treesit-default-defun-skipper ()
+  "Skips spaces after navigating a defun.
+This function tries to move to the beginning of a line, either by
+moving to the empty newline after a defun, or to the beginning of
+the current line if the beginning of the defun is indented."
+  (cond ((and (looking-at (rx (* (or " " "\\t")) "\n"))
+              (not (looking-at (rx bol))))
+         (goto-char (match-end 0)))
+        ((save-excursion
+           (skip-chars-backward " \t")
+           (eq (point) (line-beginning-position)))
+         (goto-char (line-beginning-position)))))
+
+;; prev-sibling:
+;; 1. end-of-node before pos
+;; 2. highest such node
+;;
+;; next-sibling:
+;; 1. beg-of-node after pos
+;; 2. highest such node
+;;
+;; parent:
+;; 1. node covers pos
+;; 2. smallest such node
+(defun treesit--defuns-around (pos regexp &optional pred)
+  "Return the previous, next, and parent defun around POS.
+
+Return a list of (PREV NEXT PARENT), where PREV and NEXT are
+previous and next sibling defuns around POS, and PARENT is the
+parent defun surrounding POS.  All of three could be nil if no
+sound defun exists.
+
+REGEXP and PRED are the same as in `treesit-defun-type-regexp'."
+  (let* ((node (treesit-node-at pos))
+         ;; NODE-BEFORE/AFTER = NODE when POS is completely in NODE,
+         ;; but if not, that means point could be in between two
+         ;; defun, in that case we want to use a node that's actually
+         ;; before/after point.
+         (node-before (if (>= (treesit-node-start node) pos)
+                          (treesit-search-forward-goto node "" t t t)
+                        node))
+         (node-after (if (<= (treesit-node-end node) pos)
+                         (treesit-search-forward-goto node "" nil nil t)
+                       node))
+         (result (list nil nil nil))
+         (pred (or pred (lambda (_) t))))
+    ;; 1. Find previous and next sibling defuns.
+    (cl-loop
+     for idx from 0 to 1
+     for node in (list node-before node-after)
+     for backward in '(t nil)
+     for pos-pred in (list (lambda (n) (<= (treesit-node-end n) pos))
+                           (lambda (n) (>= (treesit-node-start n) pos)))
+     ;; If point is inside a defun, our process below will never
+     ;; return a next/prev sibling outside of that defun, effectively
+     ;; any prev/next sibling is locked inside the smallest defun
+     ;; covering point, which is the correct behavior.  That's because
+     ;; when there exists a defun that covers point,
+     ;; `treesit-search-forward' will first reach that defun, after
+     ;; that we only go upwards in the tree, so other defuns outside
+     ;; of the covering defun is never reached.  (Don't use
+     ;; `treesit-search-forward-goto' as it breaks when NODE-AFTER is
+     ;; the last token of a parent defun: it will skip the parent
+     ;; defun because it wants to ensure progress.)
+     do (cl-loop for cursor = (when node
+                                (save-excursion
+                                  (treesit-search-forward
+                                   node regexp backward backward)))
+                 then (treesit-node-parent cursor)
+                 while cursor
+                 if (and (string-match-p
+                          regexp (treesit-node-type cursor))
+                         (funcall pred cursor)
+                         (funcall pos-pred cursor))
+                 do (setf (nth idx result) cursor)))
+    ;; 2. Find the parent defun.
+    (setf (nth 2 result)
+          (cl-loop for cursor = (or (nth 0 result)
+                                    (nth 1 result)
+                                    node)
+                   then (treesit-node-parent cursor)
+                   while cursor
+                   if (and (string-match-p
+                            regexp (treesit-node-type cursor))
+                           (funcall pred cursor)
+                           (not (member cursor result)))
+                   return cursor))
+    result))
 
-(defvar-local treesit-imenu-function nil
-  "Tree-sitter version of `imenu-create-index-function'.
+(defun treesit--top-level-defun (node regexp &optional pred)
+  "Return the top-level parent defun of NODE.
+REGEXP and PRED are the same as in `treesit-defun-type-regexp'."
+  (let* ((pred (or pred (lambda (_) t))))
+    ;; `treesit-search-forward-goto' will make sure the matched node
+    ;; is before POS.
+    (cl-loop for cursor = node
+             then (treesit-node-parent cursor)
+             while cursor
+             if (and (string-match-p
+                      regexp (treesit-node-type cursor))
+                     (funcall pred cursor))
+             do (setq node cursor))
+    node))
 
-Set this variable to a function and `treesit-mode' will bind it
-to `imenu-create-index-function'.")
+;; The basic idea for nested defun navigation is that we first try to
+;; move across sibling defuns in the same level, if no more siblings
+;; exist, we move to parents's beg/end, rinse and repeat.  We never
+;; move into a defun, only outwards.
+;;
+;; Let me describe roughly what does this function do: there are four
+;; possible operations: prev-beg, next-end, prev-end, next-beg, and
+;; each of (prev-sibling next-sibling and parent) could exist or not
+;; exist.  So there are 4 times 8 = 32 situations.
+;;
+;; I'll only describe the situation when we go backward (prev-beg &
+;; prev-end), and consider only prev-sibling & parent. Deriving the
+;; reverse situations is left as an exercise for the reader.
+;;
+;; prev-beg (easy case):
+;; 1. prev-sibling or parent exists
+;;    -> go the prev-sibling/parent's beg
+;;
+;; prev-end (tricky):
+;; 1. prev-sibling exists
+;;    -> If you think about it, we are already at prev-sibling's end!
+;;       So we need to go one step further, either to
+;;       prev-prev-sibling's end, or parent's prev-sibling's end, etc.
+;; 2. prev-sibling is nil but parent exists
+;;    -> Obviously we don't want to go to parent's end, instead, we
+;;       want to go to parent's prev-sibling's end.  Again, we recurse
+;;       in the function to do that.
+(defun treesit--navigate-defun (pos arg side &optional recursing)
+  "Navigate defun ARG steps from POS.
+
+If ARG is positive, move forward that many steps, if negative,
+move backward.  If SIDE is `beg', stop at the beginning of a
+defun, if SIDE is `end', stop at the end.
+
+This function doesn't actually move point, it just returns the
+position it would move to.  If there aren't enough defuns to move
+across, return nil.
+
+RECURSING is an internal parameter, if non-nil, it means this
+function is called recursively."
+  (pcase-let*
+      ((counter (abs arg))
+       (`(,regexp . ,pred)
+        (if (consp treesit-defun-type-regexp)
+            treesit-defun-type-regexp
+          (cons treesit-defun-type-regexp nil)))
+       ;; Move POS to the beg/end of NODE.  If NODE is nil, terminate.
+       ;; Return the position we moved to.
+       (advance (lambda (node)
+                  (let ((dest (pcase side
+                                ('beg (treesit-node-start node))
+                                ('end (treesit-node-end node)))))
+                    (if (null dest)
+                        (throw 'term nil)
+                      dest)))))
+    (catch 'term
+      (while (> counter 0)
+        (pcase-let
+            ((`(,prev ,next ,parent)
+              (treesit--defuns-around pos regexp pred)))
+          ;; When PARENT is nil, nested and top-level are the same, if
+          ;; there is a PARENT, make PARENT to be the top-level parent
+          ;; and pretend there is no nested PREV and NEXT.
+          (when (and (eq treesit-defun-tactic 'top-level)
+                     parent)
+            (setq parent (treesit--top-level-defun
+                          parent regexp pred)
+                  prev nil
+                  next nil))
+          ;; Move...
+          (if (> arg 0)
+              ;; ...forward.
+              (if (and (eq side 'beg)
+                       ;; Should we skip the defun (recurse)?
+                       (cond (next (not recursing)) ; [1] (see below)
+                             (parent t) ; [2]
+                             (t nil)))
+                  ;; Special case: go to next beg-of-defun.  Set POS
+                  ;; to the end of next-sib/parent defun, and run one
+                  ;; more step.  If there is a next-sib defun, we only
+                  ;; need to recurse once, so we don't need to recurse
+                  ;; if we are already recursing [1]. If there is no
+                  ;; next-sib but a parent, keep stepping out
+                  ;; (recursing) until we got out of the parents until
+                  ;; (1) there is a next sibling defun, or (2) no more
+                  ;; parents [2].
+                  (setq pos (or (treesit--navigate-defun
+                                 (treesit-node-end (or next parent))
+                                 1 'beg t)
+                                (throw 'term nil)))
+                ;; Normal case.
+                (setq pos (funcall advance (or next parent))))
+            ;; ...backward.
+            (if (and (eq side 'end)
+                     (cond (prev (not recursing))
+                           (parent t)
+                           (t nil)))
+                ;; Special case: go to prev end-of-defun.
+                (setq pos (or (treesit--navigate-defun
+                               (treesit-node-start (or prev parent))
+                               -1 'end t)
+                              (throw 'term nil)))
+              ;; Normal case.
+              (setq pos (funcall advance (or prev parent)))))
+          ;; A successful step! Decrement counter.
+          (cl-decf counter))))
+    ;; Counter equal to 0 means we successfully stepped ARG steps.
+    (if (eq counter 0) pos nil)))
 
 ;;; Activating tree-sitter
 
@@ -1660,8 +1921,10 @@ before calling this function."
     (setq-local indent-region-function #'treesit-indent-region))
   ;; Navigation.
   (when treesit-defun-type-regexp
-    (setq-local beginning-of-defun-function #'treesit-beginning-of-defun)
-    (setq-local end-of-defun-function #'treesit-end-of-defun)))
+    (keymap-set (current-local-map) "<remap> <beginning-of-defun>"
+                #'treesit-beginning-of-defun)
+    (keymap-set (current-local-map) "<remap> <end-of-defun>"
+                #'treesit-end-of-defun)))
 
 ;;; Debugging
 
@@ -1685,9 +1948,9 @@ in `treesit-parser-list'."
                    collect node))
          (largest-node (car (last node-list)))
          (parent (treesit-node-parent largest-node))
-         ;; node-list-acending contains all the node bottom-up, then
+         ;; node-list-ascending contains all the node bottom-up, then
          ;; the parent.
-         (node-list-acending
+         (node-list-ascending
           (if (null largest-node)
               ;; If there are no nodes that start at point, just show
               ;; the node at point and its parent.
@@ -1698,7 +1961,7 @@ in `treesit-parser-list'."
          (name ""))
     ;; We draw nodes like (parent field-name: (node)) recursively,
     ;; so it could be (node1 field-name: (node2 field-name: (node3))).
-    (dolist (node node-list-acending)
+    (dolist (node node-list-ascending)
       (setq
        name
        (concat
@@ -1775,10 +2038,23 @@ to the offending pattern and highlight the pattern."
              (goto-char (point-min))
              (insert (format "%s: %d\n" message start))
              (forward-char start)))
-         (pop-to-buffer buf))))))
+         (pop-to-buffer buf)
+         (view-mode))))))
 
 ;;; Explorer
 
+(defface treesit-explorer-anonymous-node
+  (let ((display t)
+        (atts '(:inherit shadow)))
+    `((,display . ,atts)))
+  "Face for anonymous nodes in tree-sitter explorer.")
+
+(defface treesit-explorer-field-name
+  (let ((display t)
+        (atts nil))
+    `((,display . ,atts)))
+  "Face for field names in tree-sitter explorer.")
+
 (defvar-local treesit--explorer-buffer nil
   "Buffer used to display the syntax tree.")
 
@@ -1957,7 +2233,8 @@ leaves point at the end of the last line of NODE."
     ;; draw everything in one line, other wise draw field name and the
     ;; rest of the node in two lines.
     (when field-name
-      (insert field-name ": ")
+      (insert (propertize (concat field-name ": ")
+                          'face 'treesit-explorer-field-name))
       (when (and children (not all-children-inline))
         (insert "\n")
         (indent-to-column (1+ before-field-column))))
@@ -2016,7 +2293,7 @@ leaves point at the end of the last line of NODE."
       (overlay-put ov 'treesit-node node)
       (overlay-put ov 'evaporate t)
       (when (not named)
-        (overlay-put ov 'face 'shadow)))))
+        (overlay-put ov 'face 'treesit-explorer-anonymous-node)))))
 
 (define-derived-mode treesit--explorer-tree-mode special-mode
   "TS Explorer"
@@ -2035,7 +2312,7 @@ window."
         (unless (buffer-live-p treesit--explorer-buffer)
           (setq-local treesit--explorer-buffer
                       (get-buffer-create
-                       (format "*tree-sitter playground for %s*"
+                       (format "*tree-sitter explorer for %s*"
                                (buffer-name))))
           (setq-local treesit--explorer-language
                       (intern (completing-read
diff --git a/lisp/url/url-future.el b/lisp/url/url-future.el
index 56787f7c5e..737eea32c6 100644
--- a/lisp/url/url-future.el
+++ b/lisp/url/url-future.el
@@ -53,7 +53,7 @@
 (define-inline url-future-errored-p (url-future)
   (inline-quote (eq (url-future-status ,url-future) 'error)))
 
-(define-inline url-future-cancelled-p (url-future)
+(define-inline url-future-canceled-p (url-future)
   (inline-quote (eq (url-future-status ,url-future) 'cancel)))
 
 (defun url-future-finish (url-future &optional status)
@@ -96,5 +96,8 @@
       (signal 'error 'url-future-already-done)
     (url-future-finish url-future 'cancel)))
 
+(define-obsolete-function-alias 'url-future-cancelled-p
+  #'url-future-canceled-p "30.1")
+
 (provide 'url-future)
 ;;; url-future.el ends here
diff --git a/lisp/use-package/bind-key.el b/lisp/use-package/bind-key.el
new file mode 100644
index 0000000000..c3890c4d0a
--- /dev/null
+++ b/lisp/use-package/bind-key.el
@@ -0,0 +1,569 @@
+;;; bind-key.el --- A simple way to manage personal keybindings  -*- 
lexical-binding: t; -*-
+
+;; Copyright (c) 2012-2022 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@newartisans.com>
+;; Maintainer: John Wiegley <johnw@newartisans.com>
+;; Created: 16 Jun 2012
+;; Version: 2.4.1
+;; Package-Requires: ((emacs "24.3"))
+;; Keywords: keys keybinding config dotemacs extensions
+;; URL: https://github.com/jwiegley/use-package
+
+;; 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:
+
+;; If you have lots of keybindings set in your init file, it can be
+;; hard to know which ones you haven't set yet, and which may now be
+;; overriding some new default in a new Emacs version.  This module
+;; aims to solve that problem.
+;;
+;; Bind keys as follows in your init file:
+;;
+;;   (bind-key "C-c x" 'my-ctrl-c-x-command)
+;;
+;; If the keybinding argument is a vector, it is passed straight to
+;; `define-key', so remapping a key with `[remap COMMAND]' works as
+;; expected:
+;;
+;;   (bind-key [remap original-ctrl-c-x-command] 'my-ctrl-c-x-command)
+;;
+;; If you want the keybinding to override all minor modes that may also bind
+;; the same key, use the `bind-key*' form:
+;;
+;;   (bind-key* "<C-return>" 'other-window)
+;;
+;; If you want to rebind a key only in a particular keymap, use:
+;;
+;;   (bind-key "C-c x" 'my-ctrl-c-x-command some-other-mode-map)
+;;
+;; To unbind a key within a keymap (for example, to stop your favorite major
+;; mode from changing a binding that you don't want to override everywhere),
+;; use `unbind-key':
+;;
+;;   (unbind-key "C-c x" some-other-mode-map)
+;;
+;; To bind multiple keys at once, or set up a prefix map, a `bind-keys' macro
+;; is provided.  It accepts keyword arguments, please see its documentation
+;; for a detailed description.
+;;
+;; To add keys into a specific map, use :map argument
+;;
+;;    (bind-keys :map dired-mode-map
+;;               ("o" . dired-omit-mode)
+;;               ("a" . some-custom-dired-function))
+;;
+;; To set up a prefix map, use `:prefix-map' and `:prefix' arguments (both are
+;; required)
+;;
+;;    (bind-keys :prefix-map my-customize-prefix-map
+;;               :prefix "C-c c"
+;;               ("f" . customize-face)
+;;               ("v" . customize-variable))
+;;
+;; You can combine all the keywords together.  Additionally,
+;; `:prefix-docstring' can be specified to set documentation of created
+;; `:prefix-map' variable.
+;;
+;; To bind multiple keys in a `bind-key*' way (to be sure that your bindings
+;; will not be overridden by other modes), you may use `bind-keys*' macro:
+;;
+;;    (bind-keys*
+;;     ("C-o" . other-window)
+;;     ("C-M-n" . forward-page)
+;;     ("C-M-p" . backward-page))
+;;
+;; After Emacs loads, you can see a summary of all your personal keybindings
+;; currently in effect with this command:
+;;
+;;   M-x describe-personal-keybindings
+;;
+;; This display will tell you if you've overridden a default keybinding, and
+;; what the default was.  Also, it will tell you if the key was rebound after
+;; your binding it with `bind-key', and what it was rebound it to.
+;;
+;; See the `use-package' info manual for more information.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'easy-mmode)
+
+(defgroup bind-key nil
+  "A simple way to manage personal keybindings."
+  :group 'keyboard
+  :group 'convenience
+  :link '(emacs-commentary-link :tag "Commentary" "bind-key.el")
+  :version "29.1")
+
+(defcustom bind-key-column-widths '(18 . 40)
+  "Width of columns in `describe-personal-keybindings'."
+  :type '(cons integer integer)
+  :group 'bind-key)
+
+(defcustom bind-key-segregation-regexp
+  "\\`\\(\\(C-[chx] \\|M-[gso] \\)\\([CM]-\\)?\\|.+-\\)"
+  "Regexp used by \\[describe-personal-keybindings] to divide key sets."
+  :type 'regexp
+  :group 'bind-key)
+
+(defcustom bind-key-describe-special-forms nil
+  "If non-nil, extract docstrings from lambdas, closures and keymaps if 
possible."
+  :type 'boolean
+  :group 'bind-key)
+
+;; Create override-global-mode to force key remappings
+
+(defvar override-global-map (make-keymap)
+  "Keymap for `override-global-mode'.")
+
+(define-minor-mode override-global-mode
+  "A minor mode for allowing keybindings to override other modes.
+The main purpose of this mode is to simplify bindings keys in
+such a way that they take precedence over other modes.
+
+To achieve this, the keymap `override-global-map' is added to
+`emulation-mode-map-alists', which makes it take precedence over
+keymaps in `minor-mode-map-alist'.  Thereby, key bindings get an
+even higher precedence than global key bindings defined with
+`keymap-global-set' (or, in Emacs 28 or older, `global-set-key').
+
+The macro `bind-key*' (which see) provides a convenient way to
+add keys to that keymap."
+  :init-value t
+  :lighter "")
+
+;; the keymaps in `emulation-mode-map-alists' take precedence over
+;; `minor-mode-map-alist'
+(add-to-list 'emulation-mode-map-alists
+             `((override-global-mode . ,override-global-map)))
+
+(defvar personal-keybindings nil
+  "List of bindings performed by `bind-key'.
+
+Elements have the form ((KEY . [MAP]) CMD ORIGINAL-CMD)")
+
+;;;###autoload
+(defmacro bind-key (key-name command &optional keymap predicate)
+  "Bind KEY-NAME to COMMAND in KEYMAP (`global-map' if not passed).
+
+KEY-NAME may be a vector, in which case it is passed straight to
+`define-key'.  Or it may be a string to be interpreted as
+spelled-out keystrokes, e.g., \"C-c C-z\".  See the documentation
+of `edmacro-mode' for details.
+
+COMMAND must be an interactive function or lambda form.
+
+KEYMAP, if present, should be a keymap variable or symbol.
+For example:
+
+  (bind-key \"M-h\" #\\='some-interactive-function my-mode-map)
+
+  (bind-key \"M-h\" #\\='some-interactive-function \\='my-mode-map)
+
+If PREDICATE is non-nil, it is a form evaluated to determine when
+a key should be bound. It must return non-nil in such cases.
+Emacs can evaluate this form at any time that it does redisplay
+or operates on menu data structures, so you should write it so it
+can safely be called at any time."
+  (let ((namevar (make-symbol "name"))
+        (keyvar (make-symbol "key"))
+        (kmapvar (make-symbol "kmap"))
+        (kdescvar (make-symbol "kdesc"))
+        (bindingvar (make-symbol "binding")))
+    `(let* ((,namevar ,key-name)
+            (,keyvar ,(if (stringp key-name) (read-kbd-macro key-name)
+                        `(if (vectorp ,namevar) ,namevar
+                           (read-kbd-macro ,namevar))))
+            (,kmapvar (or (if (and ,keymap (symbolp ,keymap))
+                              (symbol-value ,keymap) ,keymap)
+                          global-map))
+            (,kdescvar (cons (if (stringp ,namevar) ,namevar
+                               (key-description ,namevar))
+                             (if (symbolp ,keymap) ,keymap (quote ,keymap))))
+            (,bindingvar (lookup-key ,kmapvar ,keyvar)))
+       (let ((entry (assoc ,kdescvar personal-keybindings))
+             (details (list ,command
+                            (unless (numberp ,bindingvar)
+                              ,bindingvar))))
+         (if entry
+             (setcdr entry details)
+           (add-to-list 'personal-keybindings (cons ,kdescvar details))))
+       ,(if predicate
+            `(define-key ,kmapvar ,keyvar
+               '(menu-item "" nil :filter (lambda (&optional _)
+                                            (when ,predicate
+                                              ,command))))
+          `(define-key ,kmapvar ,keyvar ,command)))))
+
+;;;###autoload
+(defmacro unbind-key (key-name &optional keymap)
+  "Unbind the given KEY-NAME, within the KEYMAP (if specified).
+See `bind-key' for more details."
+  (let ((namevar (make-symbol "name"))
+        (kdescvar (make-symbol "kdesc")))
+    `(let* ((,namevar ,key-name)
+            (,kdescvar (cons (if (stringp ,namevar) ,namevar
+                               (key-description ,namevar))
+                             (if (symbolp ,keymap) ,keymap (quote ,keymap)))))
+       (bind-key--remove (if (vectorp ,namevar) ,namevar
+                           (read-kbd-macro ,namevar))
+                         (or (if (and ,keymap (symbolp ,keymap))
+                                 (symbol-value ,keymap) ,keymap)
+                             global-map))
+       (setq personal-keybindings
+             (cl-delete-if (lambda (k) (equal (car k) ,kdescvar))
+                           personal-keybindings))
+       nil)))
+
+(defun bind-key--remove (key keymap)
+  "Remove KEY from KEYMAP.
+
+In contrast to `define-key', this function removes the binding from the 
keymap."
+  (define-key keymap key nil)
+  ;; Split M-key in ESC key
+  (setq key (cl-mapcan (lambda (k)
+                         (if (and (integerp k) (/= (logand k ?\M-\0) 0))
+                             (list ?\e (logxor k ?\M-\0))
+                           (list k)))
+                       key))
+  ;; Delete single keys directly
+  (if (= (length key) 1)
+      (delete key keymap)
+    ;; Lookup submap and delete key from there
+    (let* ((prefix (vconcat (butlast key)))
+           (submap (lookup-key keymap prefix)))
+      (unless (keymapp submap)
+        (error "Not a keymap for %s" key))
+      (when (symbolp submap)
+        (setq submap (symbol-function submap)))
+      (delete (last key) submap)
+      ;; Delete submap if it is empty
+      (when (= 1 (length submap))
+        (bind-key--remove prefix keymap)))))
+
+;;;###autoload
+(defmacro bind-key* (key-name command &optional predicate)
+  "Similar to `bind-key', but overrides any mode-specific bindings."
+  `(bind-key ,key-name ,command override-global-map ,predicate))
+
+(defun bind-keys-form (args keymap)
+  "Bind multiple keys at once.
+
+Accepts keyword arguments:
+:map MAP               - a keymap into which the keybindings should be
+                         added
+:prefix KEY            - prefix key for these bindings
+:prefix-map MAP        - name of the prefix map that should be created
+                         for these bindings
+:prefix-docstring STR  - docstring for the prefix-map variable
+:menu-name NAME        - optional menu string for prefix map
+:repeat-docstring STR  - docstring for the repeat-map variable
+:repeat-map MAP        - name of the repeat map that should be created
+                         for these bindings. If specified, the
+                         `repeat-map' property of each command bound
+                         (within the scope of the `:repeat-map' keyword)
+                         is set to this map.
+:exit BINDINGS         - Within the scope of `:repeat-map' will bind the
+                         key in the repeat map, but will not set the
+                         `repeat-map' property of the bound command.
+:continue BINDINGS     - Within the scope of `:repeat-map' forces the
+                         same behavior as if no special keyword had
+                         been used (that is, the command is bound, and
+                         it's `repeat-map' property set)
+:filter FORM           - optional form to determine when bindings apply
+
+The rest of the arguments are conses of keybinding string and a
+function symbol (unquoted)."
+  (let (map
+        prefix-doc
+        prefix-map
+        prefix
+        repeat-map
+        repeat-doc
+        repeat-type ;; Only used internally
+        filter
+        menu-name
+        pkg)
+
+    ;; Process any initial keyword arguments
+    (let ((cont t)
+          (arg-change-func 'cddr))
+      (while (and cont args)
+        (if (cond ((and (eq :map (car args))
+                        (not prefix-map))
+                   (setq map (cadr args)))
+                  ((eq :prefix-docstring (car args))
+                   (setq prefix-doc (cadr args)))
+                  ((and (eq :prefix-map (car args))
+                        (not (memq map '(global-map
+                                         override-global-map))))
+                   (setq prefix-map (cadr args)))
+                  ((eq :repeat-docstring (car args))
+                   (setq repeat-doc (cadr args)))
+                  ((and (eq :repeat-map (car args))
+                        (not (memq map '(global-map
+                                         override-global-map))))
+                   (setq repeat-map (cadr args))
+                   (setq map repeat-map))
+                  ((eq :continue (car args))
+                   (setq repeat-type :continue
+                         arg-change-func 'cdr))
+                  ((eq :exit (car args))
+                   (setq repeat-type :exit
+                         arg-change-func 'cdr))
+                  ((eq :prefix (car args))
+                   (setq prefix (cadr args)))
+                  ((eq :filter (car args))
+                   (setq filter (cadr args)) t)
+                  ((eq :menu-name (car args))
+                   (setq menu-name (cadr args)))
+                  ((eq :package (car args))
+                   (setq pkg (cadr args))))
+            (setq args (funcall arg-change-func args))
+          (setq cont nil))))
+
+    (when (or (and prefix-map (not prefix))
+              (and prefix (not prefix-map)))
+      (error "Both :prefix-map and :prefix must be supplied"))
+
+    (when repeat-type
+      (unless repeat-map
+        (error ":continue and :exit require specifying :repeat-map")))
+
+    (when (and menu-name (not prefix))
+      (error "If :menu-name is supplied, :prefix must be too"))
+
+    (unless map (setq map keymap))
+
+    ;; Process key binding arguments
+    (let (first next)
+      (while args
+        (if (keywordp (car args))
+            (progn
+              (setq next args)
+              (setq args nil))
+          (if first
+              (nconc first (list (car args)))
+            (setq first (list (car args))))
+          (setq args (cdr args))))
+
+      (cl-flet
+          ((wrap (map bindings)
+                 (if (and map pkg (not (memq map '(global-map
+                                                   override-global-map))))
+                     `((if (boundp ',map)
+                           ,(macroexp-progn bindings)
+                         (eval-after-load
+                             ,(if (symbolp pkg) `',pkg pkg)
+                           ',(macroexp-progn bindings))))
+                   bindings)))
+
+        (append
+         (when prefix-map
+           `((defvar ,prefix-map)
+             ,@(when prefix-doc `((put ',prefix-map 'variable-documentation 
,prefix-doc)))
+             ,@(if menu-name
+                   `((define-prefix-command ',prefix-map nil ,menu-name))
+                 `((define-prefix-command ',prefix-map)))
+             ,@(if (and map (not (eq map 'global-map)))
+                   (wrap map `((bind-key ,prefix ',prefix-map ,map ,filter)))
+                 `((bind-key ,prefix ',prefix-map nil ,filter)))))
+         (when repeat-map
+           `((defvar ,repeat-map (make-sparse-keymap)
+               ,@(when repeat-doc `(,repeat-doc)))))
+         (wrap map
+               (cl-mapcan
+                (lambda (form)
+                  (let ((fun (and (cdr form) (list 'function (cdr form)))))
+                    (if prefix-map
+                        `((bind-key ,(car form) ,fun ,prefix-map ,filter))
+                      (if (and map (not (eq map 'global-map)))
+                          ;; Only needed in this branch, since when
+                          ;; repeat-map is non-nil, map is always
+                          ;; non-nil
+                          `(,@(when (and repeat-map (not (eq repeat-type 
:exit)))
+                                `((put ,fun 'repeat-map ',repeat-map)))
+                            (bind-key ,(car form) ,fun ,map ,filter))
+                        `((bind-key ,(car form) ,fun nil ,filter))))))
+                first))
+         (when next
+           (bind-keys-form `(,@(when repeat-map `(:repeat-map ,repeat-map))
+                             ,@(if pkg
+                                   (cons :package (cons pkg next))
+                                 next)) map)))))))
+
+;;;###autoload
+(defmacro bind-keys (&rest args)
+  "Bind multiple keys at once.
+
+Accepts keyword arguments:
+:map MAP               - a keymap into which the keybindings should be
+                         added
+:prefix KEY            - prefix key for these bindings
+:prefix-map MAP        - name of the prefix map that should be created
+                         for these bindings
+:prefix-docstring STR  - docstring for the prefix-map variable
+:menu-name NAME        - optional menu string for prefix map
+:repeat-docstring STR  - docstring for the repeat-map variable
+:repeat-map MAP        - name of the repeat map that should be created
+                         for these bindings. If specified, the
+                         `repeat-map' property of each command bound
+                         (within the scope of the `:repeat-map' keyword)
+                         is set to this map.
+:exit BINDINGS         - Within the scope of `:repeat-map' will bind the
+                         key in the repeat map, but will not set the
+                         `repeat-map' property of the bound command.
+:continue BINDINGS     - Within the scope of `:repeat-map' forces the
+                         same behavior as if no special keyword had
+                         been used (that is, the command is bound, and
+                         it's `repeat-map' property set)
+:filter FORM           - optional form to determine when bindings apply
+
+The rest of the arguments are conses of keybinding string and a
+function symbol (unquoted)."
+  (macroexp-progn (bind-keys-form args nil)))
+
+;;;###autoload
+(defmacro bind-keys* (&rest args)
+  "Bind multiple keys at once, in `override-global-map'.
+Accepts the same keyword arguments as `bind-keys' (which see).
+
+This binds keys in such a way that bindings are not overridden by
+other modes.  See `override-global-mode'."
+  (macroexp-progn (bind-keys-form args 'override-global-map)))
+
+(defun bind-key--get-binding-description (elem)
+  (cond
+   ((listp elem)
+    (cond
+     ((memq (car elem) '(lambda function))
+      (if (and bind-key-describe-special-forms
+               (stringp (nth 2 elem)))
+          (nth 2 elem)
+        "#<lambda>"))
+     ((eq 'closure (car elem))
+      (if (and bind-key-describe-special-forms
+               (stringp (nth 3 elem)))
+          (nth 3 elem)
+        "#<closure>"))
+     ((eq 'keymap (car elem))
+      "#<keymap>")
+     (t
+      elem)))
+   ;; must be a symbol, non-symbol keymap case covered above
+   ((and bind-key-describe-special-forms (keymapp elem))
+    (let ((doc (get elem 'variable-documentation)))
+      (if (stringp doc) doc elem)))
+   ((symbolp elem)
+    elem)
+   (t
+    "#<byte-compiled lambda>")))
+
+(defun bind-key--compare-keybindings (l r)
+  (let* ((regex bind-key-segregation-regexp)
+         (lgroup (and (string-match regex (caar l))
+                      (match-string 0 (caar l))))
+         (rgroup (and (string-match regex (caar r))
+                      (match-string 0 (caar r))))
+         (lkeymap (cdar l))
+         (rkeymap (cdar r)))
+    (cond
+     ((and (null lkeymap) rkeymap)
+      (cons t t))
+     ((and lkeymap (null rkeymap))
+      (cons nil t))
+     ((and lkeymap rkeymap
+           (not (string= (symbol-name lkeymap) (symbol-name rkeymap))))
+      (cons (string< (symbol-name lkeymap) (symbol-name rkeymap)) t))
+     ((and (null lgroup) rgroup)
+      (cons t t))
+     ((and lgroup (null rgroup))
+      (cons nil t))
+     ((and lgroup rgroup)
+      (if (string= lgroup rgroup)
+          (cons (string< (caar l) (caar r)) nil)
+        (cons (string< lgroup rgroup) t)))
+     (t
+      (cons (string< (caar l) (caar r)) nil)))))
+
+;;;###autoload
+(defun describe-personal-keybindings ()
+  "Display all the personal keybindings defined by `bind-key'."
+  (interactive)
+  (with-output-to-temp-buffer "*Personal Keybindings*"
+    (princ (format (concat "Key name%s Command%s Comments\n%s %s "
+                           "---------------------\n")
+                   (make-string (- (car bind-key-column-widths) 9) ? )
+                   (make-string (- (cdr bind-key-column-widths) 8) ? )
+                   (make-string (1- (car bind-key-column-widths)) ?-)
+                   (make-string (1- (cdr bind-key-column-widths)) ?-)))
+    (let (last-binding)
+      (dolist (binding
+               (setq personal-keybindings
+                     (sort personal-keybindings
+                           (lambda (l r)
+                             (car (bind-key--compare-keybindings l r))))))
+
+        (if (not (eq (cdar last-binding) (cdar binding)))
+            (princ (format "\n\n%s: %s\n%s\n\n"
+                           (cdar binding) (caar binding)
+                           (make-string (+ 21 (car bind-key-column-widths)
+                                           (cdr bind-key-column-widths)) ?-)))
+          (if (and last-binding
+                   (cdr (bind-key--compare-keybindings last-binding binding)))
+              (princ "\n")))
+
+        (let* ((key-name (caar binding))
+               (at-present (lookup-key (or (symbol-value (cdar binding))
+                                           (current-global-map))
+                                       (read-kbd-macro key-name)))
+               (command (nth 1 binding))
+               (was-command (nth 2 binding))
+               (command-desc (bind-key--get-binding-description command))
+               (was-command-desc (and was-command
+                                      (bind-key--get-binding-description 
was-command)))
+               (at-present-desc (bind-key--get-binding-description 
at-present)))
+          (let ((line
+                 (format
+                  (format "%%-%ds%%-%ds%%s\n" (car bind-key-column-widths)
+                          (cdr bind-key-column-widths))
+                  key-name (format "`%s'" command-desc)
+                  (if (string= command-desc at-present-desc)
+                      (if (or (null was-command)
+                              (string= command-desc was-command-desc))
+                          ""
+                        (format "was `%s'" was-command-desc))
+                    (format "[now: `%s']" at-present)))))
+            (princ (if (string-match "[ \t]+\n" line)
+                       (replace-match "\n" t t line)
+                     line))))
+
+        (setq last-binding binding)))))
+
+(define-obsolete-function-alias 'get-binding-description
+  'bind-key--get-binding-description "30.1")
+(define-obsolete-function-alias 'compare-keybindings
+  'bind-key--compare-keybindings "30.1")
+
+(provide 'bind-key)
+
+;; Local Variables:
+;; outline-regexp: ";;;\\(;* [^\s\t\n]\\|###autoload\\)\\|("
+;; End:
+
+;;; bind-key.el ends here
diff --git a/lisp/use-package/use-package-bind-key.el 
b/lisp/use-package/use-package-bind-key.el
new file mode 100644
index 0000000000..4ebf54825c
--- /dev/null
+++ b/lisp/use-package/use-package-bind-key.el
@@ -0,0 +1,176 @@
+;;; use-package-bind-key.el --- Support for the :bind/:bind-keymap keywords  
-*- lexical-binding: t; -*-
+
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@newartisans.com>
+;; Maintainer: John Wiegley <johnw@newartisans.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides support for the :bind, :bind*, :bind-keymap and :bind-keymap*
+;; keywords.  Note that these are currently still baked into
+;; `use-package-keywords' and `use-package-deferring-keywords', although this
+;; is harmless if they are never used.
+;;
+;; These keywords are made available by default by requiring `use-package'.
+;;
+;; See the `use-package' info manual for more information.
+
+;;; Code:
+
+(require 'use-package-core)
+(require 'bind-key)
+
+;;;###autoload
+(defun use-package-autoload-keymap (keymap-symbol package override)
+  "Load PACKAGE and bind key sequence invoking this function to KEYMAP-SYMBOL.
+Then simulate pressing the same key sequence a again, so that the
+next key pressed is routed to the newly loaded keymap.
+
+This function supports use-package's :bind-keymap keyword.  It
+works by binding the given key sequence to an invocation of this
+function for a particular keymap.  The keymap is expected to be
+defined by the package.  In this way, loading the package is
+deferred until the prefix key sequence is pressed."
+  (if (not (require package nil t))
+      (use-package-error (format "Cannot load package.el: %s" package))
+    (if (and (boundp keymap-symbol)
+             (keymapp (symbol-value keymap-symbol)))
+        (let* ((kv (this-command-keys-vector))
+               (key (key-description kv))
+               (keymap (symbol-value keymap-symbol)))
+          (if override
+              (bind-key* key keymap)
+            (bind-key key keymap))
+          (setq unread-command-events
+                (mapcar (lambda (ev) (cons t ev))
+                        (listify-key-sequence kv))))
+      (use-package-error
+       (format "package.el %s failed to define keymap %s"
+               package keymap-symbol)))))
+
+;;;###autoload
+(defun use-package-normalize-binder (name keyword args)
+  (let ((arg args)
+        args*)
+    (while arg
+      (let ((x (car arg)))
+        (cond
+         ;; (KEY . COMMAND)
+         ((and (consp x)
+               (or (stringp (car x))
+                   (vectorp (car x)))
+               (or (use-package-recognize-function (cdr x) t #'stringp)))
+          (setq args* (nconc args* (list x)))
+          (setq arg (cdr arg)))
+         ;; KEYWORD
+         ;;   :map KEYMAP
+         ;;   :prefix-docstring STRING
+         ;;   :prefix-map SYMBOL
+         ;;   :prefix STRING
+        ;;   :repeat-docstring STRING
+         ;;   :repeat-map SYMBOL
+         ;;   :filter SEXP
+         ;;   :menu-name STRING
+         ;;   :package SYMBOL
+        ;;   :continue and :exit are used within :repeat-map
+         ((or (and (eq x :map) (symbolp (cadr arg)))
+              (and (eq x :prefix) (stringp (cadr arg)))
+              (and (eq x :prefix-map) (symbolp (cadr arg)))
+              (and (eq x :prefix-docstring) (stringp (cadr arg)))
+             (and (eq x :repeat-map) (symbolp (cadr arg)))
+             (eq x :continue)
+             (eq x :exit)
+              (and (eq x :repeat-docstring) (stringp (cadr arg)))
+              (eq x :filter)
+              (and (eq x :menu-name) (stringp (cadr arg)))
+              (and (eq x :package) (symbolp (cadr arg))))
+          (setq args* (nconc args* (list x (cadr arg))))
+          (setq arg (cddr arg)))
+         ((listp x)
+          (setq args*
+                (nconc args* (use-package-normalize-binder name keyword x)))
+          (setq arg (cdr arg)))
+         (t
+          ;; Error!
+          (use-package-error
+           (concat (symbol-name name)
+                   " wants arguments acceptable to the `bind-keys' macro,"
+                   " or a list of such values"))))))
+    args*))
+
+;;;; :bind, :bind*
+
+;;;###autoload
+(defalias 'use-package-normalize/:bind 'use-package-normalize-binder)
+;;;###autoload
+(defalias 'use-package-normalize/:bind* 'use-package-normalize-binder)
+
+;; jww (2017-12-07): This is too simplistic. It will fail to determine
+;; autoloads in this situation:
+;;   (use-package foo
+;;     :bind (:map foo-map (("C-a" . func))))
+;;;###autoload
+(defalias 'use-package-autoloads/:bind 'use-package-autoloads-mode)
+;;;###autoload
+(defalias 'use-package-autoloads/:bind* 'use-package-autoloads-mode)
+
+;;;###autoload
+(defun use-package-handler/:bind
+    (name _keyword args rest state &optional bind-macro)
+  (use-package-concat
+   (use-package-process-keywords name rest state)
+   `(,@(mapcar
+        #'(lambda (xs)
+            `(,(if bind-macro bind-macro 'bind-keys)
+              :package ,name ,@(use-package-normalize-commands xs)))
+        (use-package-split-list-at-keys :break args)))))
+
+(defun use-package-handler/:bind* (name keyword arg rest state)
+  (use-package-handler/:bind name keyword arg rest state 'bind-keys*))
+
+;;;; :bind-keymap, :bind-keymap*
+
+;;;###autoload
+(defalias 'use-package-normalize/:bind-keymap 'use-package-normalize-binder)
+;;;###autoload
+(defalias 'use-package-normalize/:bind-keymap* 'use-package-normalize-binder)
+
+;;;###autoload
+(defun use-package-handler/:bind-keymap
+    (name _keyword args rest state &optional override)
+  (use-package-concat
+   (use-package-process-keywords name rest state)
+   (mapcar
+    #'(lambda (binding)
+        `(,(if override 'bind-key* 'bind-key)
+          ,(car binding)
+          #'(lambda ()
+              (interactive)
+              (use-package-autoload-keymap
+               ',(cdr binding) ',(use-package-as-symbol name)
+               ,override))))
+    args)))
+
+;;;###autoload
+(defun use-package-handler/:bind-keymap* (name keyword arg rest state)
+  (use-package-handler/:bind-keymap name keyword arg rest state t))
+
+(provide 'use-package-bind-key)
+
+;;; use-package-bind-key.el ends here
diff --git a/lisp/use-package/use-package-core.el 
b/lisp/use-package/use-package-core.el
new file mode 100644
index 0000000000..1dee08e55b
--- /dev/null
+++ b/lisp/use-package/use-package-core.el
@@ -0,0 +1,1691 @@
+;;; use-package-core.el --- A configuration macro for simplifying your .emacs  
-*- lexical-binding: t; -*-
+
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@newartisans.com>
+;; Maintainer: John Wiegley <johnw@newartisans.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file contains the core implementation of the `use-package'
+;; macro.
+;;
+;; See the `use-package' info manual for more information.
+
+;;; Code:
+
+(require 'bytecomp)
+(require 'cl-lib)
+(require 'tabulated-list)
+
+(eval-and-compile
+  ;; Declare a synthetic theme for :custom variables.
+  ;; Necessary in order to avoid having those variables saved by custom.el.
+  (deftheme use-package))
+
+(enable-theme 'use-package)
+;; Remove the synthetic use-package theme from the enabled themes, so
+;; iterating over them to "disable all themes" won't disable it.
+(setq custom-enabled-themes (remq 'use-package custom-enabled-themes))
+
+(eval-when-compile
+  (if (and (eq emacs-major-version 24) (eq emacs-minor-version 3))
+      (progn
+        (defsubst hash-table-keys (hash-table)
+          "Return a list of keys in HASH-TABLE."
+          (cl-loop for k being the hash-keys of hash-table collect k))
+        (defsubst string-suffix-p (suffix string  &optional ignore-case)
+          (let ((start-pos (- (length string) (length suffix))))
+            (and (>= start-pos 0)
+                 (eq t (compare-strings suffix nil nil
+                                        string start-pos nil ignore-case))))))
+    (require 'subr-x)))
+
+(eval-when-compile
+  (require 'regexp-opt))
+
+(defgroup use-package nil
+  "A `use-package' declaration for simplifying your `.emacs'."
+  :group 'initialization
+  :link '(custom-manual "(use-package) Top")
+  :version "29.1")
+
+(defconst use-package-version "2.4.4"
+  "This version of `use-package'.")
+
+(defcustom use-package-keywords
+  '(:disabled
+    :load-path
+    :requires
+    :defines
+    :functions
+    :preface
+    :if :when :unless
+    :no-require
+    :catch
+    :after
+    :custom
+    :custom-face
+    :bind
+    :bind*
+    :bind-keymap
+    :bind-keymap*
+    :interpreter
+    :mode
+    :magic
+    :magic-fallback
+    :hook
+    ;; Any other keyword that also declares commands to be autoloaded (such as
+    ;; :bind) must appear before this keyword.
+    :commands
+    :autoload
+    :init
+    :defer
+    :demand
+    :load
+    ;; This must occur almost last; the only forms which should appear after
+    ;; are those that must happen directly after the config forms.
+    :config)
+  "The set of valid keywords, in the order they are processed in.
+The order of this list is *very important*, so it is only
+advisable to insert new keywords, never to delete or reorder
+them.  Further, attention should be paid to the NEWS.md if the
+default order ever changes, as they may have subtle effects on
+the semantics of `use-package' declarations and may necessitate
+changing where you had inserted a new keyword earlier.
+
+Note that `:disabled' is special in this list, as it causes
+nothing at all to happen, even if the rest of the `use-package'
+declaration is incorrect."
+  :type '(repeat symbol)
+  :group 'use-package)
+
+(defcustom use-package-deferring-keywords
+  '(:bind-keymap
+    :bind-keymap*
+    :commands
+    :autoload)
+  "Unless `:demand' is used, keywords in this list imply deferred loading.
+The reason keywords like `:hook' are not in this list is that
+they only imply deferred loading if they reference actual
+function symbols that can be autoloaded from the module; whereas
+the default keywords provided here always defer loading unless
+otherwise requested."
+  :type '(repeat symbol)
+  :group 'use-package)
+
+(defcustom use-package-ignore-unknown-keywords nil
+  "If non-nil, warn instead of signaling error for unknown keywords.
+The unknown keyword and its associated arguments will be ignored
+in the `use-package' expansion."
+  :type 'boolean
+  :group 'use-package)
+
+(defcustom use-package-use-theme t
+  "If non-nil, use a custom theme to avoid saving :custom
+variables twice (once in the Custom file, once in the use-package
+call)."
+  :type 'boolean
+  :group 'use-package)
+
+(defcustom use-package-verbose nil
+  "Whether to report about loading and configuration details.
+If you customize this, then you should require the `use-package'
+feature in files that use `use-package', even if these files only
+contain compiled expansions of the macros.  If you don't do so,
+then the expanded macros do their job silently."
+  :type '(choice (const :tag "Quiet, without catching errors" errors)
+                 (const :tag "Quiet" nil)
+                 (const :tag "Verbose" t)
+                 (const :tag "Debug" debug))
+  :group 'use-package)
+
+(defcustom use-package-check-before-init nil
+  "If non-nil, check that package exists before executing its `:init' block.
+This check is performed by calling `locate-library'."
+  :type 'boolean
+  :group 'use-package)
+
+(defcustom use-package-always-defer nil
+  "If non-nil, assume `:defer t' unless `:demand' is used.
+See also `use-package-defaults', which uses this value."
+  :type 'boolean
+  :group 'use-package)
+
+(defcustom use-package-always-demand nil
+  "If non-nil, assume `:demand t' unless `:defer' is used.
+See also `use-package-defaults', which uses this value."
+  :type 'boolean
+  :group 'use-package)
+
+(defcustom use-package-defaults
+  '(;; this '(t) has special meaning; see `use-package-handler/:config'
+    (:config '(t) t)
+    (:init nil t)
+    (:catch t (lambda (name args)
+                (not use-package-expand-minimally)))
+    (:defer use-package-always-defer
+            (lambda (name args)
+              (and use-package-always-defer
+                   (not (plist-member args :defer))
+                   (not (plist-member args :demand)))))
+    (:demand use-package-always-demand
+             (lambda (name args)
+               (and use-package-always-demand
+                    (not (plist-member args :defer))
+                    (not (plist-member args :demand))))))
+  "Default values for specified `use-package' keywords.
+Each entry in the alist is a list of three elements:
+The first element is the `use-package' keyword.
+
+The second is a form that can be evaluated to get the default
+value.  It can also be a function that will receive the name of
+the `use-package' declaration and the keyword plist given to
+`use-package', in normalized form.  The value it returns should
+also be in normalized form (which is sometimes *not* what one
+would normally write in a `use-package' declaration, so use
+caution).
+
+The third element is a form that can be evaluated to determine
+whether or not to assign a default value; if it evaluates to nil,
+then the default value is not assigned even if the keyword is not
+present in the `use-package' form.  This third element may also be
+a function, in which case it receives the name of the package (as
+a symbol) and a list of keywords (in normalized form).  It should
+return nil or non-nil depending on whether defaulting should be
+attempted."
+  :type `(repeat
+          (list (symbol :tag "Keyword")
+                (choice :tag "Default value" sexp function)
+                (choice :tag "Enable if non-nil" sexp function)))
+  :group 'use-package)
+
+(defcustom use-package-merge-key-alist
+  '((:if    . (lambda (new old) `(and ,new ,old)))
+    (:after . (lambda (new old) `(:all ,new ,old)))
+    (:defer . (lambda (new old) old))
+    (:bind  . (lambda (new old) (append new (list :break) old))))
+  "Alist of keys and the functions used to merge multiple values.
+For example, if the following form is provided:
+
+  (use-package foo :if pred1 :if pred2)
+
+Then based on the above defaults, the merged result will be:
+
+  (use-package foo :if (and pred1 pred2))
+
+This is done so that, at the stage of invoking handlers, each
+handler is called only once."
+  :type `(repeat
+          (cons (choice :tag "Keyword"
+                        ,@(mapcar #'(lambda (k) (list 'const k))
+                                  use-package-keywords)
+                        (const :tag "Any" t))
+                function))
+  :group 'use-package)
+
+(defcustom use-package-hook-name-suffix "-hook"
+  "Text append to the name of hooks mentioned by :hook.
+Set to nil if you don't want this to happen; it's only a
+convenience."
+  :type '(choice string (const :tag "No suffix" nil))
+  :group 'use-package)
+
+(defcustom use-package-minimum-reported-time 0.1
+  "Minimal load time that will be reported.
+Note that `use-package-verbose' has to be set to a non-nil value
+for anything to be reported at all."
+  :type 'number
+  :group 'use-package)
+
+(defcustom use-package-inject-hooks nil
+  "If non-nil, add hooks to the `:init' and `:config' sections.
+In particular, for a given package `foo', the following hooks
+become available:
+
+  `use-package--foo--pre-init-hook'
+  `use-package--foo--post-init-hook'
+  `use-package--foo--pre-config-hook'
+  `use-package--foo--post-config-hook'
+
+This way, you can add to these hooks before evaluation of a
+`use-package` declaration, and exercise some control over what
+happens.
+
+NOTE: These hooks are run even if the user does not specify an
+`:init' or `:config' block, and they will happen at the regular
+time when initialization and configuration would have been
+performed.
+
+NOTE: If the `pre-init' hook return a nil value, that block's
+user-supplied configuration is not evaluated, so be certain to
+return t if you only wish to add behavior to what the user had
+specified."
+  :type 'boolean
+  :group 'use-package)
+
+(defcustom use-package-expand-minimally nil
+  "If non-nil, make the expanded code as minimal as possible.
+This disables:
+
+  - Printing to the *Messages* buffer of slowly-evaluating forms
+  - Capturing of load errors (normally redisplayed as warnings)
+  - Conditional loading of packages (load failures become errors)
+
+The main advantage to this variable is that, if you know your
+configuration works, it will make the byte-compiled file as
+minimal as possible.  It can also help with reading macro-expanded
+definitions, to understand the main intent of what's happening."
+  :type 'boolean
+  :group 'use-package)
+
+(defcustom use-package-form-regexp-eval
+  `(concat ,(eval-when-compile
+              (concat "^\\s-*("
+                      (regexp-opt '("use-package" "require") t)
+                      "\\s-+\\("))
+           (or (bound-and-true-p lisp-mode-symbol-regexp)
+               "\\(?:\\sw\\|\\s_\\|\\\\.\\)+") "\\)")
+  "Sexp providing regexp for finding `use-package' forms in user files.
+This is used by `use-package-jump-to-package-form' and
+`use-package-enable-imenu-support'."
+  :type 'sexp
+  :group 'use-package)
+
+(defcustom use-package-enable-imenu-support nil
+  "If non-nil, cause imenu to see `use-package' declarations.
+This is done by adjusting `lisp-imenu-generic-expression' to
+include support for finding `use-package' and `require' forms.
+
+Must be set before loading `use-package'."
+  :type 'boolean
+  :set
+  #'(lambda (sym value)
+      (eval-after-load 'lisp-mode
+        (if value
+            `(add-to-list 'lisp-imenu-generic-expression
+                          (list "Packages" ,use-package-form-regexp-eval 2))
+          `(setq lisp-imenu-generic-expression
+                 (remove (list "Packages" ,use-package-form-regexp-eval 2)
+                         lisp-imenu-generic-expression))))
+      (set-default sym value))
+  :group 'use-package)
+
+(defconst use-package-font-lock-keywords
+  '(("(\\(use-package\\)\\_>[ \t']*\\(\\(?:\\sw\\|\\s_\\)+\\)?"
+     (1 font-lock-keyword-face)
+     (2 font-lock-constant-face nil t))))
+
+(font-lock-add-keywords 'emacs-lisp-mode use-package-font-lock-keywords)
+
+(defcustom use-package-compute-statistics nil
+  "If non-nil, compute statistics concerned `use-package' declarations.
+View the statistical report using `use-package-report'.  Note that
+if this option is enabled, you must require `use-package' in your
+user init file at loadup time, or you will see errors concerning
+undefined variables."
+  :type 'boolean
+  :group 'use-package)
+
+(defvar use-package-statistics (make-hash-table))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Utility functions
+;;
+
+(defsubst use-package-error (msg)
+  "Report MSG as an error, so the user knows it came from this package."
+  (error "use-package: %s" msg))
+
+(defsubst use-package-concat (&rest elems)
+  "Delete all empty lists from ELEMS (nil or (list nil)), and append them."
+  (apply #'append (delete nil (delete (list nil) elems))))
+
+(defsubst use-package-non-nil-symbolp (sym)
+  (and sym (symbolp sym)))
+
+(defsubst use-package-as-symbol (string-or-symbol)
+  "If STRING-OR-SYMBOL is already a symbol, return it.
+Otherwise convert it to a symbol and return that."
+  (if (symbolp string-or-symbol) string-or-symbol
+    (intern string-or-symbol)))
+
+(defsubst use-package-as-string (string-or-symbol)
+  "If STRING-OR-SYMBOL is already a string, return it.
+Otherwise convert it to a string and return that."
+  (if (stringp string-or-symbol) string-or-symbol
+    (symbol-name string-or-symbol)))
+
+(defsubst use-package-regex-p (re)
+  "Return t if RE is some regexp-like thing."
+  (or (and (listp re) (eq (car re) 'rx))
+      (stringp re)))
+
+(defun use-package-normalize-regex (re)
+  "Given some regexp-like thing in RE, resolve to a regular expression."
+  (cond
+   ((and (listp re) (eq (car re) 'rx)) (eval re))
+   ((stringp re) re)
+   (t (error "Not recognized as regular expression: %s" re))))
+
+(defsubst use-package-is-pair (x car-pred cdr-pred)
+  "Return non-nil if X is a cons satisfying the given predicates.
+CAR-PRED and CDR-PRED are applied to X's `car' and `cdr',
+respectively."
+  (and (consp x)
+       (funcall car-pred (car x))
+       (funcall cdr-pred (cdr x))))
+
+(defun use-package-as-mode (string-or-symbol)
+  "If STRING-OR-SYMBOL ends in `-mode' (or its name does), return
+it as a symbol.  Otherwise, return it as a symbol with `-mode'
+appended."
+  (let ((string (use-package-as-string string-or-symbol)))
+    (intern (if (string-match "-mode\\'" string)
+                string
+              (concat string "-mode")))))
+
+(defsubst use-package-load-name (name &optional noerror)
+  "Return a form which will load or require NAME.
+It does the right thing no matter if NAME is a string or symbol.
+Argument NOERROR means to indicate load failures as a warning."
+  (if (stringp name)
+      `(load ,name ,noerror)
+    `(require ',name nil ,noerror)))
+
+(defun use-package-hook-injector (name-string keyword body)
+  "Wrap pre/post hook injections around the given BODY for KEYWORD.
+The BODY is a list of forms, so `((foo))' if only `foo' is being called."
+  (if (not use-package-inject-hooks)
+      body
+    (let ((keyword-name (substring (format "%s" keyword) 1)))
+      `((when (run-hook-with-args-until-failure
+               ',(intern (concat "use-package--" name-string
+                                 "--pre-" keyword-name "-hook")))
+          ,@body
+          (run-hooks
+           ',(intern (concat "use-package--" name-string
+                             "--post-" keyword-name "-hook"))))))))
+
+(defun use-package-with-elapsed-timer (text body)
+  "BODY is a list of forms, so `((foo))' if only `foo' is being called."
+  (declare (indent 1))
+  (if use-package-expand-minimally
+      body
+    (let ((nowvar (make-symbol "now")))
+      (if (bound-and-true-p use-package-verbose)
+          `((let ((,nowvar (current-time)))
+              (message "%s..." ,text)
+              (prog1
+                  ,(macroexp-progn body)
+                (let ((elapsed
+                       (float-time (time-subtract (current-time) ,nowvar))))
+                  (if (> elapsed ,use-package-minimum-reported-time)
+                      (message "%s...done (%.3fs)" ,text elapsed)
+                    (message "%s...done" ,text))))))
+        body))))
+
+(put 'use-package-with-elapsed-timer 'lisp-indent-function 1)
+
+(defun use-package-require (name &optional no-require body)
+  (if use-package-expand-minimally
+      (use-package-concat
+       (unless no-require
+         (list (use-package-load-name name)))
+       body)
+    (if no-require
+        body
+      (use-package-with-elapsed-timer
+          (format "Loading package %s" name)
+        `((if (not ,(use-package-load-name name t))
+              (display-warning 'use-package
+                               (format "Cannot load %s" ',name)
+                               :error)
+            ,@body))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Property lists
+;;
+
+(defun use-package-plist-delete (plist property)
+  "Delete PROPERTY from PLIST.
+This is in contrast to merely setting it to 0."
+  (let (p)
+    (while plist
+      (if (not (eq property (car plist)))
+          (setq p (plist-put p (car plist) (nth 1 plist))))
+      (setq plist (cddr plist)))
+    p))
+
+(defun use-package-plist-delete-first (plist property)
+  "Delete PROPERTY from PLIST.
+This is in contrast to merely setting it to 0."
+  (let (p)
+    (while plist
+      (if (eq property (car plist))
+          (setq p (nconc p (cddr plist))
+                plist nil)
+        (setq p (nconc p (list (car plist) (cadr plist)))
+              plist (cddr plist))))
+    p))
+
+(defsubst use-package-plist-maybe-put (plist property value)
+  "Add a VALUE for PROPERTY to PLIST, if it does not already exist."
+  (if (plist-member plist property)
+      plist
+    (plist-put plist property value)))
+
+(defsubst use-package-plist-cons (plist property value)
+  "Cons VALUE onto the head of the list at PROPERTY in PLIST."
+  (plist-put plist property (cons value (plist-get plist property))))
+
+(defsubst use-package-plist-append (plist property value)
+  "Append VALUE onto the front of the list at PROPERTY in PLIST."
+  (plist-put plist property (append value (plist-get plist property))))
+
+(defun use-package-split-list (pred xs)
+  (let ((ys (list nil)) (zs (list nil)) flip)
+    (cl-dolist (x xs)
+      (if flip
+          (nconc zs (list x))
+        (if (funcall pred x)
+            (progn
+              (setq flip t)
+              (nconc zs (list x)))
+          (nconc ys (list x)))))
+    (cons (cdr ys) (cdr zs))))
+
+(defun use-package-split-list-at-keys (key lst)
+  (and lst
+       (let ((xs (use-package-split-list (apply-partially #'eq key) lst)))
+         (cons (car xs) (use-package-split-list-at-keys key (cddr xs))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Keywords
+;;
+
+(defun use-package-keyword-index (keyword)
+  (cl-loop named outer
+           with index = 0
+           for k in use-package-keywords do
+           (if (eq k keyword)
+               (cl-return-from outer index))
+           (cl-incf index)))
+
+(defun use-package-normalize-plist (name input &optional plist merge-function)
+  "Given a pseudo-plist, normalize it to a regular plist.
+The normalized key/value pairs from input are added to PLIST,
+extending any keys already present."
+  (if (null input)
+      plist
+    (let* ((keyword (car input))
+           (xs (use-package-split-list #'keywordp (cdr input)))
+           (args (car xs))
+           (tail (cdr xs))
+           (normalizer
+            (intern-soft (concat "use-package-normalize/"
+                                 (symbol-name keyword))))
+           (arg (and (functionp normalizer)
+                     (funcall normalizer name keyword args)))
+           (error-string (format "Unrecognized keyword: %s" keyword)))
+      (if (memq keyword use-package-keywords)
+          (progn
+            (setq plist (use-package-normalize-plist
+                         name tail plist merge-function))
+            (plist-put plist keyword
+                       (if (plist-member plist keyword)
+                           (funcall merge-function keyword arg
+                                    (plist-get plist keyword))
+                         arg)))
+        (if use-package-ignore-unknown-keywords
+            (progn
+              (display-warning 'use-package error-string)
+              (use-package-normalize-plist
+               name tail plist merge-function))
+          (use-package-error error-string))))))
+
+(defun use-package-unalias-keywords (_name args)
+  (setq args (cl-nsubstitute :if :when args))
+  (let (temp)
+    (while (setq temp (plist-get args :unless))
+      (setq args (use-package-plist-delete-first args :unless)
+            args (append args `(:if (not ,temp))))))
+  args)
+
+(defun use-package-merge-keys (key new old)
+  (let ((merger (assq key use-package-merge-key-alist)))
+    (if merger
+        (funcall (cdr merger) new old)
+      (append new old))))
+
+(defun use-package-sort-keywords (plist)
+  (let (plist-grouped)
+    (while plist
+      (push (cons (car plist) (cadr plist))
+            plist-grouped)
+      (setq plist (cddr plist)))
+    (let (result)
+      (cl-dolist
+          (x
+           (nreverse
+            (sort plist-grouped
+                  #'(lambda (l r) (< (use-package-keyword-index (car l))
+                                (use-package-keyword-index (car r)))))))
+        (setq result (cons (car x) (cons (cdr x) result))))
+      result)))
+
+(defun use-package-normalize-keywords (name args)
+  (let* ((name-symbol (if (stringp name) (intern name) name))
+         (name-string (symbol-name name-symbol)))
+
+    ;; The function `elisp--local-variables' inserts this unbound variable into
+    ;; macro forms to determine the locally bound variables for
+    ;; `elisp-completion-at-point'. It ends up throwing a lot of errors since 
it
+    ;; can occupy the position of a keyword (or look like a second argument to 
a
+    ;; keyword that takes one). Deleting it when it's at the top level should 
be
+    ;; harmless since there should be no locally bound variables to discover
+    ;; here anyway.
+    (setq args (delq 'elisp--witness--lisp args))
+
+    ;; Reduce the set of keywords down to its most fundamental expression.
+    (setq args (use-package-unalias-keywords name-symbol args))
+
+    ;; Normalize keyword values, coalescing multiple occurrences.
+    (setq args (use-package-normalize-plist name-symbol args nil
+                                            #'use-package-merge-keys))
+
+    ;; Add default values for keywords not specified, when applicable.
+    (cl-dolist (spec use-package-defaults)
+      (when (let ((func (nth 2 spec)))
+              (if (and func (functionp func))
+                  (funcall func name args)
+                (eval func)))
+        (setq args (use-package-plist-maybe-put
+                    args (nth 0 spec)
+                    (let ((func (nth 1 spec)))
+                      (if (and func (functionp func))
+                          (funcall func name args)
+                        (eval func)))))))
+
+    ;; Determine any autoloads implied by the keywords used.
+    (let ((iargs args)
+          commands)
+      (while iargs
+        (when (keywordp (car iargs))
+          (let ((autoloads
+                 (intern-soft (concat "use-package-autoloads/"
+                                      (symbol-name (car iargs))))))
+            (when (functionp autoloads)
+              (setq commands
+                    ;; jww (2017-12-07): Right now we just ignored the type of
+                    ;; the autoload being requested, and assume they are all
+                    ;; `command'.
+                    (append (mapcar
+                             #'car
+                             (funcall autoloads name-symbol (car iargs)
+                                      (cadr iargs)))
+                            commands)))))
+        (setq iargs (cddr iargs)))
+      (when commands
+        (setq args
+              ;; Like `use-package-plist-append', but removing duplicates.
+              (plist-put args :commands
+                         (delete-dups
+                          (append commands (plist-get args :commands)))))))
+
+    ;; If byte-compiling, pre-load the package so all its symbols are in
+    ;; scope. This is done by prepending statements to the :preface.
+    (when (bound-and-true-p byte-compile-current-file)
+      (setq args
+            (use-package-plist-append
+             args :preface
+             (use-package-concat
+              (mapcar #'(lambda (var) `(defvar ,var))
+                      (plist-get args :defines))
+              (mapcar #'(lambda (fn) `(declare-function ,fn ,name-string))
+                      (plist-get args :functions))
+              `((eval-when-compile
+                  (with-demoted-errors
+                      ,(format "Cannot load %s: %%S" name-string)
+                    ,(when (eq use-package-verbose 'debug)
+                       `(message ,(format "Compiling package %s" name-string)))
+                    ,(unless (plist-get args :no-require)
+                       `(unless (featurep ',name-symbol)
+                          (load ,name-string nil t))))))))))
+
+    ;; Certain keywords imply :defer, if :demand was not specified.
+    (when (and (not (plist-member args :demand))
+               (not (plist-member args :defer))
+               (not (or (equal '(t) (plist-get args :load))
+                        (equal (list (use-package-as-string name))
+                               (mapcar #'use-package-as-string
+                                       (plist-get args :load)))))
+               (cl-some #'identity
+                        (mapcar (apply-partially #'plist-member args)
+                                use-package-deferring-keywords)))
+      (setq args (append args '(:defer t))))
+
+    ;; The :load keyword overrides :no-require
+    (when (and (plist-member args :load)
+               (plist-member args :no-require))
+      (setq args (use-package-plist-delete args :no-require)))
+
+    ;; If at this point no :load, :defer or :no-require has been seen, then
+    ;; :load the package itself.
+    (when (and (not (plist-member args :load))
+               (not (plist-member args :defer))
+               (not (plist-member args :no-require)))
+      (setq args (append args `(:load (,name)))))
+
+    ;; Sort the list of keywords based on the order of `use-package-keywords'.
+    (use-package-sort-keywords args)))
+
+(defun use-package-process-keywords (name plist &optional state)
+  "Process the next keyword in the free-form property list PLIST.
+The values in the PLIST have each been normalized by the function
+use-package-normalize/KEYWORD (minus the colon).
+
+STATE is a property list that the function may modify and/or
+query.  This is useful if a package defines multiple keywords and
+wishes them to have some kind of stateful interaction.
+
+Unless the KEYWORD being processed intends to ignore remaining
+keywords, it must call this function recursively, passing in the
+plist with its keyword and argument removed, and passing in the
+next value for the STATE."
+  (declare (indent 1))
+  (unless (null plist)
+    (let* ((keyword (car plist))
+           (arg (cadr plist))
+           (rest (cddr plist)))
+      (unless (keywordp keyword)
+        (use-package-error (format "%s is not a keyword" keyword)))
+      (let* ((handler (concat "use-package-handler/" (symbol-name keyword)))
+             (handler-sym (intern handler)))
+        (if (functionp handler-sym)
+            (funcall handler-sym name keyword arg rest state)
+          (use-package-error
+           (format "Keyword handler not defined: %s" handler)))))))
+
+(put 'use-package-process-keywords 'lisp-indent-function 'defun)
+
+(defun use-package-list-insert (elem xs &optional anchor after test)
+  "Insert ELEM into the list XS.
+If ANCHOR is also a keyword, place the new KEYWORD before that
+one.
+If AFTER is non-nil, insert KEYWORD either at the end of the
+keywords list, or after the ANCHOR if one has been provided.
+If TEST is non-nil, it is the test used to compare ELEM to list
+elements.  The default is `eq'.
+The modified list is returned.  The original list is not modified."
+  (let (result)
+    (dolist (k xs)
+      (if (funcall (or test #'eq) k anchor)
+          (if after
+              (setq result (cons k result)
+                    result (cons elem result))
+            (setq result (cons elem result)
+                  result (cons k result)))
+        (setq result (cons k result))))
+    (if anchor
+        (nreverse result)
+      (if after
+          (nreverse (cons elem result))
+        (cons elem (nreverse result))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Argument Processing
+;;
+
+(defun use-package-only-one (label args f)
+  "Call F on the first member of ARGS if it has exactly one element."
+  (declare (indent 1))
+  (cond
+   ((and (listp args) (listp (cdr args))
+         (= (length args) 1))
+    (funcall f label (car args)))
+   (t
+    (use-package-error
+     (concat label " wants exactly one argument")))))
+
+(put 'use-package-only-one 'lisp-indent-function 'defun)
+
+(defun use-package-as-one (label args f &optional allow-empty)
+  "Call F on the first element of ARGS if it has one element, or all of ARGS.
+If ALLOW-EMPTY is non-nil, it's OK for ARGS to be an empty list."
+  (declare (indent 1))
+  (if (if args
+          (and (listp args) (listp (cdr args)))
+        allow-empty)
+      (if (= (length args) 1)
+          (funcall f label (car args))
+        (funcall f label args))
+    (use-package-error
+     (concat label " wants a non-empty list"))))
+
+(put 'use-package-as-one 'lisp-indent-function 'defun)
+
+(defun use-package-memoize (f arg)
+  "Ensure the macro-expansion of F applied to ARG evaluates ARG
+no more than once."
+  (let ((loaded (cl-gentemp "use-package--loaded"))
+        (result (cl-gentemp "use-package--result"))
+        (next   (cl-gentemp "use-package--next")))
+    `((defvar ,loaded nil)
+      (defvar ,result nil)
+      (defvar ,next #'(lambda () (if ,loaded ,result
+                              (setq ,loaded t ,result ,arg))))
+      ,@(funcall f `((funcall ,next))))))
+
+(defsubst use-package-normalize-value (_label arg)
+  "Normalize the Lisp value given by ARG.
+The argument LABEL is ignored."
+  (cond ((null arg) nil)
+        ((eq t arg) t)
+        ((use-package-non-nil-symbolp arg)
+         `(symbol-value ',arg))
+        ((functionp arg)
+         `(funcall #',arg))
+        (t arg)))
+
+(defun use-package-normalize-symbols (label arg &optional recursed)
+  "Normalize a list of symbols."
+  (cond
+   ((use-package-non-nil-symbolp arg)
+    (list arg))
+   ((and (not recursed) (listp arg) (listp (cdr arg)))
+    (mapcar #'(lambda (x) (car (use-package-normalize-symbols label x t))) 
arg))
+   (t
+    (use-package-error
+     (concat label " wants a symbol, or list of symbols")))))
+
+(defun use-package-normalize-symlist (_name keyword args)
+  (use-package-as-one (symbol-name keyword) args
+    #'use-package-normalize-symbols))
+
+(defun use-package-normalize-recursive-symbols (label arg)
+  "Normalize a list of symbols."
+  (cond
+   ((use-package-non-nil-symbolp arg)
+    arg)
+   ((and (listp arg) (listp (cdr arg)))
+    (mapcar #'(lambda (x) (use-package-normalize-recursive-symbols label x))
+            arg))
+   (t
+    (use-package-error
+     (concat label " wants a symbol, or nested list of symbols")))))
+
+(defun use-package-normalize-recursive-symlist (_name keyword args)
+  (use-package-as-one (symbol-name keyword) args
+    #'use-package-normalize-recursive-symbols))
+
+(defun use-package-normalize-paths (label arg &optional recursed)
+  "Normalize a list of filesystem paths."
+  (cond
+   ((and arg (or (use-package-non-nil-symbolp arg) (functionp arg)))
+    (let ((value (use-package-normalize-value label arg)))
+      (use-package-normalize-paths label (eval value))))
+   ((stringp arg)
+    (let ((path (if (file-name-absolute-p arg)
+                    arg
+                  (expand-file-name arg user-emacs-directory))))
+      (list path)))
+   ((and (not recursed) (listp arg) (listp (cdr arg)))
+    (mapcar #'(lambda (x)
+                (car (use-package-normalize-paths label x t))) arg))
+   (t
+    (use-package-error
+     (concat label " wants a directory path, or list of paths")))))
+
+(defun use-package-normalize-predicate (_name keyword args)
+  (if (null args)
+      t
+    (use-package-only-one (symbol-name keyword) args
+      #'use-package-normalize-value)))
+
+(defun use-package-normalize-form (label args)
+  "Given a list of forms, return it wrapped in `progn'."
+  (unless (listp (car args))
+    (use-package-error (concat label " wants a sexp or list of sexps")))
+  (mapcar #'(lambda (form)
+              (if (and (consp form)
+                       (memq (car form)
+                             '(use-package bind-key bind-key*
+                                unbind-key bind-keys bind-keys*)))
+                  (macroexpand form)
+                form)) args))
+
+(defun use-package-normalize-forms (_name keyword args)
+  (use-package-normalize-form (symbol-name keyword) args))
+
+(defun use-package-normalize-pairs
+    (key-pred val-pred name label arg &optional recursed)
+  "Normalize a list of pairs.
+KEY-PRED and VAL-PRED are predicates recognizing valid keys and
+values, respectively.
+If RECURSED is non-nil, recurse into sublists."
+  (cond
+   ((funcall key-pred arg)
+    (list (cons arg (use-package-as-symbol name))))
+   ((use-package-is-pair arg key-pred val-pred)
+    (list arg))
+   ((and (not recursed) (listp arg) (listp (cdr arg)))
+    (let (last-item)
+      (mapcar
+       #'(lambda (x)
+           (prog1
+               (let ((ret (use-package-normalize-pairs
+                           key-pred val-pred name label x t)))
+                 (if (and (listp ret)
+                          (not (keywordp last-item)))
+                     (car ret)
+                   ret))
+             (setq last-item x))) arg)))
+   (t arg)))
+
+(defun use-package-recognize-function (v &optional binding additional-pred)
+  "A predicate that recognizes functional constructions:
+  nil
+  sym
+  \\='sym
+  (quote sym)
+  #\\='sym
+  (function sym)
+  (lambda () ...)
+  \\='(lambda () ...)
+  (quote (lambda () ...))
+  #\\='(lambda () ...)
+  (function (lambda () ...))"
+  (or (if binding
+          (symbolp v)
+        (use-package-non-nil-symbolp v))
+      (and (listp v)
+           (memq (car v) '(quote function))
+           (use-package-non-nil-symbolp (cadr v)))
+      (if binding (commandp v) (functionp v))
+      (and additional-pred
+           (funcall additional-pred v))))
+
+(defun use-package-normalize-function (v)
+  "Reduce functional constructions to one of two normal forms:
+  sym
+  #\\='(lambda () ...)"
+  (cond ((symbolp v) v)
+        ((and (listp v)
+              (memq (car v) '(quote function))
+              (use-package-non-nil-symbolp (cadr v)))
+         (cadr v))
+        ((and (consp v)
+              (eq 'lambda (car v)))
+         v)
+        ((and (listp v)
+              (memq (car v) '(quote function))
+              (eq 'lambda (car (cadr v))))
+         (cadr v))
+        (t v)))
+
+(defun use-package-normalize-commands (args)
+  "Map over ARGS of the form ((_ . F) ...), normalizing functional F's."
+  (mapcar #'(lambda (x)
+              (if (consp x)
+                  (cons (car x) (use-package-normalize-function (cdr x)))
+                x))
+          args))
+
+(defun use-package-normalize-mode (name keyword args)
+  "Normalize arguments for keywords which add regexp/mode pairs to an alist."
+  (use-package-as-one (symbol-name keyword) args
+    (apply-partially #'use-package-normalize-pairs
+                     #'use-package-regex-p
+                     #'use-package-recognize-function
+                     name)))
+
+(defun use-package-autoloads-mode (_name _keyword args)
+  (mapcar
+   #'(lambda (x) (cons (cdr x) 'command))
+   (cl-remove-if-not #'(lambda (x)
+                         (and (consp x)
+                              (use-package-non-nil-symbolp (cdr x))))
+                     args)))
+
+(defun use-package-handle-mode (name alist args rest state)
+  "Handle keywords which add regexp/mode pairs to an alist."
+  (use-package-concat
+   (use-package-process-keywords name rest state)
+   (mapcar
+    #'(lambda (thing)
+        `(add-to-list
+          ',alist
+          ',(cons (use-package-normalize-regex (car thing))
+                  (cdr thing))))
+    (use-package-normalize-commands args))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Statistics
+;;
+
+(defun use-package-reset-statistics ()
+  "Reset statistics for `use-package'.
+See also `use-package-statistics'."
+  (interactive)
+  (setq use-package-statistics (make-hash-table)))
+
+(defun use-package-statistics-status (package)
+  "Return loading configuration status of PACKAGE statistics."
+  (cond ((gethash :config package)      "Configured")
+        ((gethash :init package)        "Initialized")
+        ((gethash :preface package)     "Prefaced")
+        ((gethash :use-package package) "Declared")))
+
+(defun use-package-statistics-last-event (package)
+  "Return the date when PACKAGE's status last changed.
+The date is returned as a string."
+  (or (gethash :config package)
+      (gethash :init package)
+      (gethash :preface package)
+      (gethash :use-package package)))
+
+(defun use-package-statistics-time (package)
+  "Return the time is took for PACKAGE to load."
+  (+ (float-time (gethash :config-secs package '(0 0 0 0)))
+     (float-time (gethash :init-secs package '(0 0 0 0)))
+     (float-time (gethash :preface-secs package '(0 0 0 0)))
+     (float-time (gethash :use-package-secs package '(0 0 0 0)))))
+
+(defun use-package-statistics-convert (package)
+  "Return information about PACKAGE.
+
+The information is formatted in a way suitable for
+`use-package-statistics-mode'."
+  (let ((statistics (gethash package use-package-statistics)))
+    (list
+     package
+     (vector
+      (symbol-name package)
+      (use-package-statistics-status statistics)
+      (format-time-string
+       "%H:%M:%S.%6N"
+       (use-package-statistics-last-event statistics))
+      (format "%.2f" (use-package-statistics-time statistics))))))
+
+(defun use-package-report ()
+  "Show current statistics gathered about `use-package' declarations.
+In the table that's generated, the status field has the following
+meaning:
+  Configured        :config has been processed (the package is loaded!)
+  Initialized       :init has been processed (load status unknown)
+  Prefaced          :preface has been processed
+  Declared          the use-package declaration was seen"
+  (interactive)
+  (with-current-buffer (get-buffer-create "*use-package statistics*")
+    (setq tabulated-list-entries
+          (mapcar #'use-package-statistics-convert
+                  (hash-table-keys use-package-statistics)))
+    (use-package-statistics-mode)
+    (tabulated-list-print)
+    (display-buffer (current-buffer))))
+
+(defvar use-package-statistics-status-order
+  '(("Declared"    . 0)
+    ("Prefaced"    . 1)
+    ("Initialized" . 2)
+    ("Configured"  . 3)))
+
+(define-derived-mode use-package-statistics-mode tabulated-list-mode
+  "use-package statistics"
+  "Show current statistics gathered about `use-package' declarations."
+  (setq tabulated-list-format
+        ;; The sum of column width is 80 characters:
+        [("Package" 25 t)
+         ("Status" 13
+          (lambda (a b)
+            (< (assoc-default
+                (use-package-statistics-status
+                 (gethash (car a) use-package-statistics))
+                use-package-statistics-status-order)
+               (assoc-default
+                (use-package-statistics-status
+                 (gethash (car b) use-package-statistics))
+                use-package-statistics-status-order))))
+         ("Last Event" 23
+          (lambda (a b)
+            (< (float-time
+                (use-package-statistics-last-event
+                 (gethash (car a) use-package-statistics)))
+               (float-time
+                (use-package-statistics-last-event
+                 (gethash (car b) use-package-statistics))))))
+         ("Time" 10
+          (lambda (a b)
+            (< (use-package-statistics-time
+                (gethash (car a) use-package-statistics))
+               (use-package-statistics-time
+                (gethash (car b) use-package-statistics)))))])
+  (setq tabulated-list-sort-key '("Time" . t))
+  (tabulated-list-init-header))
+
+(defun use-package-statistics-gather (keyword name after)
+  (let* ((hash (gethash name use-package-statistics
+                        (make-hash-table)))
+         (before (and after (gethash keyword hash (current-time)))))
+    (puthash keyword (current-time) hash)
+    (when after
+      (puthash (intern (concat (symbol-name keyword) "-secs"))
+               (time-subtract (current-time) before) hash))
+    (puthash name hash use-package-statistics)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Handlers
+;;
+
+;;;; :disabled
+
+;; Don't alias this to `ignore', as that will cause the resulting
+;; function to be interactive.
+(defun use-package-normalize/:disabled (_name _keyword _arg)
+  "Do nothing, return nil.")
+
+(defun use-package-handler/:disabled (name _keyword _arg rest state)
+  (use-package-process-keywords name rest state))
+
+;;;; :if, :when and :unless
+
+(defun use-package-normalize-test (_name keyword args)
+  (use-package-only-one (symbol-name keyword) args
+    #'use-package-normalize-value))
+
+(defalias 'use-package-normalize/:if 'use-package-normalize-test)
+
+(defun use-package-handler/:if (name _keyword pred rest state)
+  (let ((body (use-package-process-keywords name rest state)))
+    `((when ,pred ,@body))))
+
+(defalias 'use-package-normalize/:when 'use-package-normalize-test)
+
+(defalias 'use-package-handler/:when 'use-package-handler/:if)
+
+(defalias 'use-package-normalize/:unless 'use-package-normalize-test)
+
+(defun use-package-handler/:unless (name _keyword pred rest state)
+  (let ((body (use-package-process-keywords name rest state)))
+    `((unless ,pred ,@body))))
+
+;;;; :requires
+
+(defalias 'use-package-normalize/:requires 'use-package-normalize-symlist)
+
+(defun use-package-handler/:requires (name _keyword requires rest state)
+  (let ((body (use-package-process-keywords name rest state)))
+    (if (null requires)
+        body
+      `((when ,(if (> (length requires) 1)
+                   `(not (member nil (mapcar #'featurep ',requires)))
+                 `(featurep ',(car requires)))
+          ,@body)))))
+
+;;;; :load-path
+
+(defun use-package-normalize/:load-path (_name keyword args)
+  (use-package-as-one (symbol-name keyword) args
+    #'use-package-normalize-paths))
+
+(defun use-package-handler/:load-path (name _keyword arg rest state)
+  (let ((body (use-package-process-keywords name rest state)))
+    (use-package-concat
+     (mapcar #'(lambda (path)
+                 `(eval-and-compile (add-to-list 'load-path ,path)))
+             arg)
+     body)))
+
+;;;; :no-require
+
+(defalias 'use-package-normalize/:no-require 'use-package-normalize-predicate)
+
+(defun use-package-handler/:no-require (name _keyword _arg rest state)
+  (use-package-process-keywords name rest state))
+
+;;;; :defines
+
+(defalias 'use-package-normalize/:defines 'use-package-normalize-symlist)
+
+(defun use-package-handler/:defines (name _keyword _arg rest state)
+  (use-package-process-keywords name rest state))
+
+;;;; :functions
+
+(defalias 'use-package-normalize/:functions 'use-package-normalize-symlist)
+
+(defun use-package-handler/:functions (name _keyword _arg rest state)
+  (use-package-process-keywords name rest state))
+
+;;;; :preface
+
+(defalias 'use-package-normalize/:preface 'use-package-normalize-forms)
+
+(defun use-package-handler/:preface (name _keyword arg rest state)
+  (let ((body (use-package-process-keywords name rest state)))
+    (use-package-concat
+     (when use-package-compute-statistics
+       `((use-package-statistics-gather :preface ',name nil)))
+     (when arg
+       `((eval-and-compile ,@arg)))
+     body
+     (when use-package-compute-statistics
+       `((use-package-statistics-gather :preface ',name t))))))
+
+;;;; :catch
+
+(defvar use-package--form)
+(defvar use-package--hush-function #'(lambda (_keyword body) body))
+
+(defsubst use-package-hush (context keyword body)
+  `((condition-case-unless-debug err
+        ,(macroexp-progn body)
+      (error (funcall ,context ,keyword err)))))
+
+(defun use-package-normalize/:catch (_name keyword args)
+  (if (null args)
+      t
+    (use-package-only-one (symbol-name keyword) args
+      use-package--hush-function)))
+
+(defun use-package-handler/:catch (name keyword arg rest state)
+  (let* ((context (cl-gentemp "use-package--warning")))
+    (cond
+     ((not arg)
+      (use-package-process-keywords name rest state))
+     ((eq arg t)
+      `((defvar ,context
+          #'(lambda (keyword err)
+              (let ((msg (format "%s/%s: %s" ',name keyword
+                                 (error-message-string err))))
+                ,@(when (eq use-package-verbose 'debug)
+                    `((with-current-buffer
+                          (get-buffer-create "*use-package*")
+                        (goto-char (point-max))
+                        (insert "-----\n" msg ,use-package--form)
+                        (emacs-lisp-mode))
+                      (setq msg
+                            (concat msg
+                                    " (see the *use-package* buffer)"))))
+                (display-warning 'use-package msg :error))))
+        ,@(let ((use-package--hush-function
+                 (apply-partially #'use-package-hush context)))
+            (funcall use-package--hush-function keyword
+                     (use-package-process-keywords name rest state)))))
+     ((functionp arg)
+      `((defvar ,context ,arg)
+        ,@(let ((use-package--hush-function
+                 (apply-partially #'use-package-hush context)))
+            (funcall use-package--hush-function keyword
+                     (use-package-process-keywords name rest state)))))
+     (t
+      (use-package-error "The :catch keyword expects 't' or a function")))))
+
+;;;; :interpreter
+
+(defalias 'use-package-normalize/:interpreter 'use-package-normalize-mode)
+(defalias 'use-package-autoloads/:interpreter 'use-package-autoloads-mode)
+
+(defun use-package-handler/:interpreter (name _keyword arg rest state)
+  (use-package-handle-mode name 'interpreter-mode-alist arg rest state))
+
+;;;; :mode
+
+(defalias 'use-package-normalize/:mode 'use-package-normalize-mode)
+(defalias 'use-package-autoloads/:mode 'use-package-autoloads-mode)
+
+(defun use-package-handler/:mode (name _keyword arg rest state)
+  (use-package-handle-mode name 'auto-mode-alist arg rest state))
+
+;;;; :magic
+
+(defalias 'use-package-normalize/:magic 'use-package-normalize-mode)
+(defalias 'use-package-autoloads/:magic 'use-package-autoloads-mode)
+
+(defun use-package-handler/:magic (name _keyword arg rest state)
+  (use-package-handle-mode name 'magic-mode-alist arg rest state))
+
+;;;; :magic-fallback
+
+(defalias 'use-package-normalize/:magic-fallback 'use-package-normalize-mode)
+(defalias 'use-package-autoloads/:magic-fallback 'use-package-autoloads-mode)
+
+(defun use-package-handler/:magic-fallback (name _keyword arg rest state)
+  (use-package-handle-mode name 'magic-fallback-mode-alist arg rest state))
+
+;;;; :hook
+
+(defun use-package-normalize/:hook (name keyword args)
+  (use-package-as-one (symbol-name keyword) args
+    #'(lambda (label arg)
+        (unless (or (use-package-non-nil-symbolp arg) (consp arg))
+          (use-package-error
+           (concat label " a <symbol> or (<symbol or list of symbols> . 
<symbol or function>)"
+                   " or list of these")))
+        (use-package-normalize-pairs
+         #'(lambda (k)
+             (or (use-package-non-nil-symbolp k)
+                 (and k (let ((every t))
+                          (while (and every k)
+                            (if (and (consp k)
+                                     (use-package-non-nil-symbolp (car k)))
+                                (setq k (cdr k))
+                              (setq every nil)))
+                          every))))
+         #'use-package-recognize-function
+         (if (string-suffix-p "-mode" (symbol-name name))
+             name
+           (intern (concat (symbol-name name) "-mode")))
+         label arg))))
+
+(defalias 'use-package-autoloads/:hook 'use-package-autoloads-mode)
+
+(defun use-package-handler/:hook (name _keyword args rest state)
+  "Generate use-package custom keyword code."
+  (use-package-concat
+   (use-package-process-keywords name rest state)
+   (cl-mapcan
+    #'(lambda (def)
+        (let ((syms (car def))
+              (fun (cdr def)))
+          (when fun
+            (mapcar
+             #'(lambda (sym)
+                 `(add-hook
+                   (quote ,(intern
+                            (concat (symbol-name sym)
+                                    use-package-hook-name-suffix)))
+                   (function ,fun)))
+             (use-package-hook-handler-normalize-mode-symbols syms)))))
+    (use-package-normalize-commands args))))
+
+(defun use-package-hook-handler-normalize-mode-symbols (syms)
+  "Ensure that `SYMS' turns into a list of modes."
+  (if (use-package-non-nil-symbolp syms) (list syms) syms))
+
+;;;; :commands
+
+(defalias 'use-package-normalize/:commands 'use-package-normalize-symlist)
+
+(defun use-package-handler/:commands (name _keyword arg rest state)
+  (use-package-concat
+   ;; Since we deferring load, establish any necessary autoloads, and also
+   ;; keep the byte-compiler happy.
+   (let ((name-string (use-package-as-string name)))
+     (cl-mapcan
+      #'(lambda (command)
+          (when (symbolp command)
+            (append
+             (unless (plist-get state :demand)
+               `((unless (fboundp ',command)
+                   (autoload #',command ,name-string nil t))))
+             (when (bound-and-true-p byte-compile-current-file)
+               `((eval-when-compile
+                   (declare-function ,command ,name-string)))))))
+      (delete-dups arg)))
+   (use-package-process-keywords name rest state)))
+
+;;;; :autoload
+
+(defalias 'use-package-normalize/:autoload 'use-package-normalize/:commands)
+
+(defun use-package-handler/:autoload (name _keyword arg rest state)
+  (use-package-concat
+   ;; Since we deferring load, establish any necessary autoloads, and also
+   ;; keep the byte-compiler happy.
+   (let ((name-string (use-package-as-string name)))
+     (cl-mapcan
+      #'(lambda (command)
+          (when (symbolp command)
+            (append
+             (unless (plist-get state :demand)
+               `((unless (fboundp ',command)
+                   (autoload #',command ,name-string))))
+             (when (bound-and-true-p byte-compile-current-file)
+               `((eval-when-compile
+                   (declare-function ,command ,name-string)))))))
+      (delete-dups arg)))
+   (use-package-process-keywords name rest state)))
+
+;;;; :defer
+
+(defalias 'use-package-normalize/:defer 'use-package-normalize-predicate)
+
+(defun use-package-handler/:defer (name _keyword arg rest state)
+  (let ((body (use-package-process-keywords name rest state)))
+    (use-package-concat
+     ;; Load the package after a set amount of idle time, if the argument to
+     ;; `:defer' was a number.
+     (when (numberp arg)
+       `((run-with-idle-timer ,arg nil #'require
+                              ',(use-package-as-symbol name) nil t)))
+     (if (or (not arg) (null body))
+         body
+       `((eval-after-load ',name ',(macroexp-progn body)))))))
+
+;;;; :after
+
+(defun use-package-normalize/:after (name keyword args)
+  (setq args (use-package-normalize-recursive-symlist name keyword args))
+  (if (consp args)
+      args
+    (list args)))
+
+(defun use-package-after-count-uses (features*)
+  "Count the number of time the body would appear in the result."
+  (cond ((use-package-non-nil-symbolp features*)
+         1)
+        ((and (consp features*)
+              (memq (car features*) '(:or :any)))
+         (let ((num 0))
+           (cl-dolist (next (cdr features*))
+             (setq num (+ num (use-package-after-count-uses next))))
+           num))
+        ((and (consp features*)
+              (memq (car features*) '(:and :all)))
+         (apply #'max (mapcar #'use-package-after-count-uses
+                              (cdr features*))))
+        ((listp features*)
+         (use-package-after-count-uses (cons :all features*)))))
+
+(defun use-package-require-after-load (features* body)
+  "Generate `eval-after-load' statements to represents FEATURES*.
+FEATURES* is a list containing keywords `:and' and `:all', where
+no keyword implies `:all'."
+  (cond
+   ((use-package-non-nil-symbolp features*)
+    `((eval-after-load ',features* ',(macroexp-progn body))))
+   ((and (consp features*)
+         (memq (car features*) '(:or :any)))
+    (cl-mapcan #'(lambda (x) (use-package-require-after-load x body))
+               (cdr features*)))
+   ((and (consp features*)
+         (memq (car features*) '(:and :all)))
+    (cl-dolist (next (cdr features*))
+      (setq body (use-package-require-after-load next body)))
+    body)
+   ((listp features*)
+    (use-package-require-after-load (cons :all features*) body))))
+
+(defun use-package-handler/:after (name _keyword arg rest state)
+  (let ((body (use-package-process-keywords name rest state))
+        (uses (use-package-after-count-uses arg)))
+    (if (or (null uses) (null body))
+        body
+      (if (<= uses 1)
+          (use-package-require-after-load arg body)
+        (use-package-memoize
+         (apply-partially #'use-package-require-after-load arg)
+         (macroexp-progn body))))))
+
+;;;; :demand
+
+(defalias 'use-package-normalize/:demand 'use-package-normalize-predicate)
+
+(defun use-package-handler/:demand (name _keyword _arg rest state)
+  (use-package-process-keywords name rest state))
+
+;;;; :custom
+
+(defun use-package-normalize/:custom (_name keyword args)
+  "Normalize use-package custom keyword."
+  (use-package-as-one (symbol-name keyword) args
+    #'(lambda (label arg)
+        (unless (listp arg)
+          (use-package-error
+           (concat label " a (<symbol> <value> [comment])"
+                   " or list of these")))
+        (if (use-package-non-nil-symbolp (car arg))
+            (list arg)
+          arg))))
+
+(defun use-package-handler/:custom (name _keyword args rest state)
+  "Generate use-package custom keyword code."
+  (use-package-concat
+   (if (bound-and-true-p use-package-use-theme)
+       `((let ((custom--inhibit-theme-enable nil))
+           ;; Declare the theme here so use-package can be required inside
+           ;; eval-and-compile without warnings about unknown theme.
+           (unless (memq 'use-package custom-known-themes)
+             (deftheme use-package)
+             (enable-theme 'use-package)
+             (setq custom-enabled-themes (remq 'use-package 
custom-enabled-themes)))
+           (custom-theme-set-variables
+            'use-package
+            ,@(mapcar
+               #'(lambda (def)
+                   (let ((variable (nth 0 def))
+                         (value (nth 1 def))
+                         (comment (nth 2 def)))
+                     (unless (and comment (stringp comment))
+                       (setq comment (format "Customized with use-package %s" 
name)))
+                     `'(,variable ,value nil () ,comment)))
+               args))))
+     (mapcar
+      #'(lambda (def)
+          (let ((variable (nth 0 def))
+                (value (nth 1 def))
+                (comment (nth 2 def)))
+            (unless (and comment (stringp comment))
+              (setq comment (format "Customized with use-package %s" name)))
+            `(customize-set-variable (quote ,variable) ,value ,comment)))
+      args))
+   (use-package-process-keywords name rest state)))
+
+;;;; :custom-face
+
+(defun use-package-normalize/:custom-face (name-symbol _keyword arg)
+  "Normalize use-package custom-face keyword."
+  (let ((error-msg
+         (format "%s wants a (<symbol> <face-spec> [spec-type]) or list of 
these"
+                 name-symbol)))
+    (unless (listp arg)
+      (use-package-error error-msg))
+    (cl-dolist (def arg arg)
+      (unless (listp def)
+        (use-package-error error-msg))
+      (let ((face (nth 0 def))
+            (spec (nth 1 def)))
+        (when (or (not face)
+                  (not spec)
+                  (> (length def) 3))
+          (use-package-error error-msg))))))
+
+(defun use-package-handler/:custom-face (name _keyword args rest state)
+  "Generate use-package custom-face keyword code."
+  (use-package-concat
+   (mapcar #'(lambda (def) `(apply #'face-spec-set (backquote ,def))) args)
+   (use-package-process-keywords name rest state)))
+
+;;;; :init
+
+(defalias 'use-package-normalize/:init 'use-package-normalize-forms)
+
+(defun use-package-handler/:init (name _keyword arg rest state)
+  (use-package-concat
+   (when use-package-compute-statistics
+     `((use-package-statistics-gather :init ',name nil)))
+   (let ((init-body
+          (use-package-hook-injector (use-package-as-string name)
+                                     :init arg)))
+     (when init-body
+       (funcall use-package--hush-function :init
+                (if use-package-check-before-init
+                    `((when (locate-library ,(use-package-as-string name))
+                        ,@init-body))
+                  init-body))))
+   (use-package-process-keywords name rest state)
+   (when use-package-compute-statistics
+     `((use-package-statistics-gather :init ',name t)))))
+
+;;;; :load
+
+(defun use-package-normalize/:load (name keyword args)
+  (setq args (use-package-normalize-recursive-symlist name keyword args))
+  (if (consp args)
+      args
+    (list args)))
+
+(defun use-package-handler/:load (name _keyword arg rest state)
+  (let ((body (use-package-process-keywords name rest state)))
+    (cl-dolist (pkg arg)
+      (setq body (use-package-require (if (eq t pkg) name pkg) nil body)))
+    body))
+
+;;;; :config
+
+(defalias 'use-package-normalize/:config 'use-package-normalize-forms)
+
+(defun use-package-handler/:config (name _keyword arg rest state)
+  (let* ((body (use-package-process-keywords name rest state))
+         (name-symbol (use-package-as-symbol name)))
+    (use-package-concat
+     (when use-package-compute-statistics
+       `((use-package-statistics-gather :config ',name nil)))
+     (if (and (or (null arg) (equal arg '(t))) (not use-package-inject-hooks))
+         body
+       (use-package-with-elapsed-timer
+           (format "Configuring package %s" name-symbol)
+         (funcall use-package--hush-function :config
+                  (use-package-concat
+                   (use-package-hook-injector
+                    (symbol-name name-symbol) :config arg)
+                   body
+                   (list t)))))
+     (when use-package-compute-statistics
+       `((use-package-statistics-gather :config ',name t))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; The main macro
+;;
+
+(defmacro use-package-core (name args)
+  `(let* ((args* (use-package-normalize-keywords ,name ,args))
+          (use-package--form
+           (if (eq use-package-verbose 'debug)
+               (concat "\n\n"
+                       (pp-to-string `(use-package ,name ,@,args))
+                       "\n  -->\n\n"
+                       (pp-to-string `(use-package ,name ,@args*))
+                       "\n  ==>\n\n"
+                       (pp-to-string
+                        (macroexp-progn
+                         (let ((use-package-verbose 'errors)
+                               (use-package-expand-minimally t))
+                           (use-package-process-keywords name args*
+                             (and (plist-get args* :demand)
+                                  (list :demand t)))))))
+             "")))
+     (use-package-process-keywords name args*
+       (and (plist-get args* :demand)
+            (list :demand t)))))
+
+;;;###autoload
+(defmacro use-package (name &rest args)
+  "Declare an Emacs package by specifying a group of configuration options.
+
+For the full documentation, see Info node `(use-package) top'.
+Usage:
+
+  (use-package package-name
+     [:keyword [option]]...)
+
+:init            Code to run before PACKAGE-NAME has been loaded.
+:config          Code to run after PACKAGE-NAME has been loaded.  Note that
+                 if loading is deferred for any reason, this code does not
+                 execute until the lazy load has occurred.
+:preface         Code to be run before everything except `:disabled'; this
+                 can be used to define functions for use in `:if', or that
+                 should be seen by the byte-compiler.
+
+:mode            Form to be added to `auto-mode-alist'.
+:magic           Form to be added to `magic-mode-alist'.
+:magic-fallback  Form to be added to `magic-fallback-mode-alist'.
+:interpreter     Form to be added to `interpreter-mode-alist'.
+
+:commands        Define autoloads for commands that will be defined by the
+                 package.  This is useful if the package is being lazily
+                 loaded, and you wish to conditionally call functions in your
+                 `:init' block that are defined in the package.
+:autoload        Similar to :commands, but it for no-interactive one.
+:hook            Specify hook(s) to attach this package to.
+
+:bind            Bind keys, and define autoloads for the bound commands.
+:bind*           Bind keys, and define autoloads for the bound commands,
+                 *overriding all minor mode bindings*.
+:bind-keymap     Bind a key prefix to an auto-loaded keymap defined in the
+                 package.  This is like `:bind', but for keymaps.
+:bind-keymap*    Like `:bind-keymap', but overrides all minor mode bindings
+
+:defer           Defer loading of a package -- this is implied when using
+                 `:commands', `:bind', `:bind*', `:mode', `:magic', `:hook',
+                 `:magic-fallback', or `:interpreter'.  This can be an integer,
+                 to force loading after N seconds of idle time, if the package
+                 has not already been loaded.
+:demand          Prevent the automatic deferred loading introduced by 
constructs
+                 such as `:bind' (see `:defer' for the complete list).
+
+:after           Delay the effect of the use-package declaration
+                 until after the named libraries have loaded.
+                 Before they have been loaded, no other keyword
+                 has any effect at all, and once they have been
+                 loaded it is as if `:after' was not specified.
+
+:if EXPR         Initialize and load only if EXPR evaluates to a non-nil value.
+:disabled        The package is ignored completely if this keyword is present.
+:defines         Declare certain variables to silence the byte-compiler.
+:functions       Declare certain functions to silence the byte-compiler.
+:load-path       Add to the `load-path' before attempting to load the package.
+:diminish        Support for diminish.el (if installed).
+:delight         Support for delight.el (if installed).
+:custom          Call `Custom-set' or `set-default' with each variable
+                 definition without modifying the Emacs `custom-file'.
+                 (compare with `custom-set-variables').
+:custom-face     Call `custom-set-faces' with each face definition.
+:ensure          Loads the package using package.el if necessary.
+:pin             Pin the package to an archive."
+  (declare (indent defun))
+  (unless (memq :disabled args)
+    (macroexp-progn
+     (use-package-concat
+      (when use-package-compute-statistics
+        `((use-package-statistics-gather :use-package ',name nil)))
+      (if (eq use-package-verbose 'errors)
+          (use-package-core name args)
+        (condition-case-unless-debug err
+            (use-package-core name args)
+          (error
+           (ignore
+            (display-warning
+             'use-package
+             (format "Failed to parse package %s: %s"
+                     name (error-message-string err)) :error)))))
+      (when use-package-compute-statistics
+        `((use-package-statistics-gather :use-package ',name t)))))))
+
+(provide 'use-package-core)
+
+;;; use-package-core.el ends here
diff --git a/lisp/use-package/use-package-delight.el 
b/lisp/use-package/use-package-delight.el
new file mode 100644
index 0000000000..41978b94f4
--- /dev/null
+++ b/lisp/use-package/use-package-delight.el
@@ -0,0 +1,88 @@
+;;; use-package-delight.el --- Support for the :delight keyword  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@newartisans.com>
+;; Maintainer: John Wiegley <johnw@newartisans.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides support for the :delight keyword, which is made available
+;; by default by requiring `use-package'.  Using it requires the
+;; `delight' package to be installed (available on GNU ELPA).
+;;
+;; See the `use-package' info manual for more information.
+
+;;; Code:
+
+(require 'use-package-core)
+
+(defun use-package-normalize-delight (name args)
+  "Normalize ARGS for a single call to `delight'."
+  (when (eq :eval (car args))
+    ;; Handle likely common mistake.
+    (use-package-error ":delight mode line constructs must be quoted"))
+  (cond ((and (= (length args) 1)
+              (use-package-non-nil-symbolp (car args)))
+         `(,(nth 0 args) nil ,name))
+        ((= (length args) 2)
+         `(,(nth 0 args) ,(nth 1 args) ,name))
+        ((= (length args) 3)
+         args)
+        (t
+         (use-package-error
+          ":delight expects `delight' arguments or a list of them"))))
+
+;;;###autoload
+(defun use-package-normalize/:delight (name _keyword args)
+  "Normalize arguments to delight."
+  (cond ((null args)
+         `((,(use-package-as-mode name) nil ,name)))
+        ((and (= (length args) 1)
+              (use-package-non-nil-symbolp (car args)))
+         `((,(car args) nil ,name)))
+        ((and (= (length args) 1)
+              (stringp (car args)))
+         `((,(use-package-as-mode name) ,(car args) ,name)))
+        ((and (= (length args) 1)
+              (listp (car args))
+              (eq 'quote (caar args)))
+         `((,(use-package-as-mode name) ,@(cdar args) ,name)))
+        ((and (= (length args) 2)
+              (listp (nth 1 args))
+              (eq 'quote (car (nth 1 args))))
+         `((,(car args) ,@(cdr (nth 1 args)) ,name)))
+        (t (mapcar
+            (apply-partially #'use-package-normalize-delight name)
+            (if (use-package-non-nil-symbolp (car args))
+                (list args)
+              args)))))
+
+;;;###autoload
+(defun use-package-handler/:delight (name _keyword args rest state)
+  (let ((body (use-package-process-keywords name rest state)))
+    (use-package-concat
+     body
+     `((if (fboundp 'delight)
+           (delight '(,@args)))))))
+
+(add-to-list 'use-package-keywords :delight t)
+
+(provide 'use-package-delight)
+
+;;; use-package-delight.el ends here
diff --git a/lisp/use-package/use-package-diminish.el 
b/lisp/use-package/use-package-diminish.el
new file mode 100644
index 0000000000..7fff93b0e9
--- /dev/null
+++ b/lisp/use-package/use-package-diminish.el
@@ -0,0 +1,77 @@
+;;; use-package-diminish.el --- Support for the :diminish keyword  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@newartisans.com>
+;; Maintainer: John Wiegley <johnw@newartisans.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides support for the :diminish keyword, which is made available
+;; by default by requiring `use-package'.  Using it requires the
+;; `diminish' package to be installed (available on GNU ELPA).
+;;
+;; See the `use-package' info manual for more information.
+
+;;; Code:
+
+(require 'use-package-core)
+
+(defun use-package-normalize-diminish (name label arg &optional recursed)
+  "Normalize the arguments to diminish down to a list of one of two forms:
+     SYMBOL
+     (SYMBOL . STRING)"
+  (cond
+   ((not arg)
+    (list (use-package-as-mode name)))
+   ((use-package-non-nil-symbolp arg)
+    (list arg))
+   ((stringp arg)
+    (list (cons (use-package-as-mode name) arg)))
+   ((and (consp arg) (stringp (cdr arg)))
+    (list arg))
+   ((and (not recursed) (listp arg) (listp (cdr arg)))
+    (mapcar #'(lambda (x) (car (use-package-normalize-diminish
+                           name label x t))) arg))
+   (t
+    (use-package-error
+     (concat label " wants a string, symbol, "
+             "(symbol . string) or list of these")))))
+
+;;;###autoload
+(defun use-package-normalize/:diminish (name keyword args)
+  (use-package-as-one (symbol-name keyword) args
+    (apply-partially #'use-package-normalize-diminish name) t))
+
+;;;###autoload
+(defun use-package-handler/:diminish (name _keyword arg rest state)
+  (let ((body (use-package-process-keywords name rest state)))
+    (use-package-concat
+     (mapcar #'(lambda (var)
+                 `(if (fboundp 'diminish)
+                      ,(if (consp var)
+                           `(diminish ',(car var) ,(cdr var))
+                         `(diminish ',var))))
+             arg)
+     body)))
+
+(add-to-list 'use-package-keywords :diminish t)
+
+(provide 'use-package-diminish)
+
+;;; use-package-diminish.el ends here
diff --git a/lisp/use-package/use-package-ensure-system-package.el 
b/lisp/use-package/use-package-ensure-system-package.el
new file mode 100644
index 0000000000..6681e5afb7
--- /dev/null
+++ b/lisp/use-package/use-package-ensure-system-package.el
@@ -0,0 +1,106 @@
+;;; use-package-ensure-system-package.el --- auto install system packages  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Justin Talbott <justin@waymondo.com>
+;; Keywords: convenience, tools, extensions
+;; URL: https://github.com/waymondo/use-package-ensure-system-package
+;; Version: 0.2
+;; Package-Requires: ((use-package "2.1") (system-packages "1.0.4"))
+;; Filename: use-package-ensure-system-package.el
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; The `:ensure-system-package` keyword allows you to ensure system
+;; binaries exist alongside your `use-package` declarations.  Using it
+;; requires the `system-packages' package to be installed (available
+;; on GNU ELPA).
+;;
+;; See the `use-package' info manual for more information.
+
+;;; Code:
+
+(require 'use-package)
+(require 'system-packages nil t)
+
+(eval-when-compile
+  (declare-function system-packages-get-command "system-packages"))
+
+(defvar use-package-ensure-system-package--custom-packages '()
+  "List of commands used to install custom packages.")
+
+(defun use-package-ensure-system-package-consify (arg)
+  "Turn ARG into a cons of the form (PACKAGE-NAME . INSTALL-COMMAND')."
+  (cond
+   ((stringp arg)
+    (cons arg `(system-packages-install ,arg)))
+   ((symbolp arg)
+    (cons arg `(system-packages-install ,(symbol-name arg))))
+   ((consp arg)
+    (cond
+     ((not (cdr arg))
+      (use-package-ensure-system-package-consify (car arg)))
+     ((stringp (cdr arg))
+      (progn
+       (push (cdr arg) use-package-ensure-system-package--custom-packages)
+       (cons (car arg) `(async-shell-command ,(cdr arg)))))
+     (t
+      (cons (car arg)
+           `(system-packages-install ,(symbol-name (cdr arg)))))))))
+
+(defun use-package-ensure-system-package-update-custom-packages ()
+  "Update custom packages (not installed by system package manager).
+Run the same commands used for installing them."
+  (interactive)
+  (dolist (cmd use-package-ensure-system-package--custom-packages)
+    (async-shell-command cmd)))
+
+;;;###autoload
+(defun use-package-normalize/:ensure-system-package (_name-symbol keyword args)
+  "Turn ARGS into a list of conses of the form (PACKAGE-NAME . 
INSTALL-COMMAND)."
+  (use-package-as-one (symbol-name keyword) args
+    (lambda (_label arg)
+      (cond
+       ((and (listp arg) (listp (cdr arg)))
+        (mapcar #'use-package-ensure-system-package-consify arg))
+       (t
+        (list (use-package-ensure-system-package-consify arg)))))))
+
+(defun use-package-ensure-system-package-exists? (file-or-exe)
+  "If FILE-OR-EXE is a string, ensure the file path exists.
+If it is a symbol, ensure the binary exist."
+  (if (stringp file-or-exe)
+      (file-exists-p file-or-exe)
+    (executable-find (symbol-name file-or-exe))))
+
+
+;;;###autoload
+(defun use-package-handler/:ensure-system-package (name _keyword arg rest 
state)
+  "Execute the handler for `:ensure-system-package' keyword in `use-package'."
+  (let ((body (use-package-process-keywords name rest state)))
+    (use-package-concat
+     (mapcar #'(lambda (cons)
+                 `(unless (use-package-ensure-system-package-exists? ',(car 
cons))
+                   ,(cdr cons))) arg)
+     body)))
+
+(add-to-list 'use-package-keywords :ensure-system-package t)
+
+(provide 'use-package-ensure-system-package)
+
+;;; use-package-ensure-system-package.el ends here
diff --git a/lisp/use-package/use-package-ensure.el 
b/lisp/use-package/use-package-ensure.el
new file mode 100644
index 0000000000..dae0312dba
--- /dev/null
+++ b/lisp/use-package/use-package-ensure.el
@@ -0,0 +1,212 @@
+;;; use-package-ensure.el --- Support for the :ensure and :pin keywords  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@newartisans.com>
+;; Maintainer: John Wiegley <johnw@newartisans.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides support for the :ensure and :pin keywords, which are made
+;; available by default by requiring `use-package'.
+;;
+;; See the `use-package' info manual for more information.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'use-package-core)
+
+(defgroup use-package-ensure nil
+  "Support for :ensure and :pin keywords in `use-package' declarations."
+  :group 'use-package
+  :link '(custom-manual "(use-package) Installing packages")
+  :version "29.1")
+
+(eval-when-compile
+  (declare-function package-installed-p "package")
+  (declare-function package-read-all-archive-contents "package" ()))
+
+(defcustom use-package-always-ensure nil
+  "Treat every package as though it had specified using `:ensure SEXP'.
+See also `use-package-defaults', which uses this value."
+  :type 'sexp
+  :group 'use-package-ensure)
+
+(defcustom use-package-always-pin nil
+  "Treat every package as though it had specified using `:pin SYM'.
+See also `use-package-defaults', which uses this value."
+  :type 'symbol
+  :group 'use-package-ensure)
+
+(defcustom use-package-ensure-function 'use-package-ensure-elpa
+  "Function that ensures a package is installed.
+This function is called with three arguments: the name of the
+package declared in the `use-package' form; the arguments passed
+to all `:ensure' keywords (always a list, even if only one); and
+the current `state' plist created by previous handlers.
+
+Note that this function is called whenever `:ensure' is provided,
+even if it is nil.  It is up to the function to decide on the
+semantics of the various values for `:ensure'.
+
+This function should return non-nil if the package is installed.
+
+The default value uses package.el to install the package."
+  :type '(choice (const :tag "package.el" use-package-ensure-elpa)
+                 (function :tag "Custom"))
+  :group 'use-package-ensure)
+
+;;;; :pin
+
+(defun use-package-normalize/:pin (_name keyword args)
+  (use-package-only-one (symbol-name keyword) args
+    #'(lambda (_label arg)
+        (cond
+         ((stringp arg) arg)
+         ((use-package-non-nil-symbolp arg) (symbol-name arg))
+         (t
+          (use-package-error
+           ":pin wants an archive name (a string)"))))))
+
+(eval-when-compile
+  (defvar package-pinned-packages)
+  (defvar package-archives))
+
+(defun use-package-archive-exists-p (archive)
+  "Check if a given ARCHIVE is enabled.
+
+ARCHIVE can be a string or a symbol or `manual' to indicate a
+manually updated package."
+  (if (member archive '(manual "manual"))
+      't
+    (let ((valid nil))
+      (dolist (pa package-archives)
+        (when (member archive (list (car pa) (intern (car pa))))
+          (setq valid 't)))
+      valid)))
+
+(defun use-package-pin-package (package archive)
+  "Pin PACKAGE to ARCHIVE."
+  (unless (boundp 'package-pinned-packages)
+    (setq package-pinned-packages ()))
+  (let ((archive-symbol (if (symbolp archive) archive (intern archive)))
+        (archive-name   (if (stringp archive) archive (symbol-name archive))))
+    (if (use-package-archive-exists-p archive-symbol)
+        (add-to-list 'package-pinned-packages (cons package archive-name))
+      (error "Archive '%s' requested for package '%s' is not available"
+             archive-name package))
+    (unless (bound-and-true-p package--initialized)
+      (package-initialize t))))
+
+(defun use-package-handler/:pin (name _keyword archive-name rest state)
+  (let ((body (use-package-process-keywords name rest state))
+        (pin-form (if archive-name
+                      `(use-package-pin-package ',(use-package-as-symbol name)
+                                                ,archive-name))))
+    ;; Pinning should occur just before ensuring
+    ;; See `use-package-handler/:ensure'.
+    (if (bound-and-true-p byte-compile-current-file)
+        (eval pin-form)              ; Eval when byte-compiling,
+      (push pin-form body))          ; or else wait until runtime.
+    body))
+
+;;;; :ensure
+
+(defvar package-archive-contents)
+
+;;;###autoload
+(defun use-package-normalize/:ensure (_name keyword args)
+  (if (null args)
+      (list t)
+    (use-package-only-one (symbol-name keyword) args
+      #'(lambda (_label arg)
+          (cond
+           ((symbolp arg)
+            (list arg))
+           ((and (listp arg) (= 3 (length arg))
+                 (symbolp (nth 0 arg))
+                 (eq :pin (nth 1 arg))
+                 (or (stringp (nth 2 arg))
+                     (symbolp (nth 2 arg))))
+            (list (cons (nth 0 arg) (nth 2 arg))))
+           (t
+            (use-package-error
+             (concat ":ensure wants an optional package name "
+                     "(an unquoted symbol name), or (<symbol> :pin 
<string>)"))))))))
+
+(defun use-package-ensure-elpa (name args _state &optional _no-refresh)
+  (dolist (ensure args)
+    (let ((package
+           (or (and (eq ensure t) (use-package-as-symbol name))
+               ensure)))
+      (when package
+        (require 'package)
+        (when (consp package)
+          (use-package-pin-package (car package) (cdr package))
+          (setq package (car package)))
+        (unless (package-installed-p package)
+          (condition-case-unless-debug err
+              (progn
+                (when (assoc package (bound-and-true-p
+                                      package-pinned-packages))
+                  (package-read-all-archive-contents))
+                (if (assoc package package-archive-contents)
+                    (package-install package)
+                  (package-refresh-contents)
+                  (when (assoc package (bound-and-true-p
+                                        package-pinned-packages))
+                    (package-read-all-archive-contents))
+                  (package-install package))
+                t)
+            (error
+             (display-warning 'use-package
+                              (format "Failed to install %s: %s"
+                                      name (error-message-string err))
+                              :error))))))))
+
+;;;###autoload
+(defun use-package-handler/:ensure (name _keyword ensure rest state)
+  (let* ((body (use-package-process-keywords name rest state)))
+    ;; We want to avoid installing packages when the `use-package' macro is
+    ;; being macro-expanded by elisp completion (see `lisp--local-variables'),
+    ;; but still install packages when byte-compiling, to avoid requiring
+    ;; `package' at runtime.
+    (if (bound-and-true-p byte-compile-current-file)
+        ;; Eval when byte-compiling,
+        (funcall use-package-ensure-function name ensure state)
+      ;;  or else wait until runtime.
+      (push `(,use-package-ensure-function ',name ',ensure ',state)
+            body))
+    body))
+
+(add-to-list 'use-package-defaults
+             '(:ensure (list use-package-always-ensure)
+                       (lambda (name args)
+                         (and use-package-always-ensure
+                              (not (plist-member args :load-path))))) t)
+
+(add-to-list 'use-package-defaults
+             '(:pin use-package-always-pin use-package-always-pin) t)
+
+(add-to-list 'use-package-keywords :ensure)
+(add-to-list 'use-package-keywords :pin)
+
+(provide 'use-package-ensure)
+
+;;; use-package-ensure.el ends here
diff --git a/lisp/use-package/use-package-jump.el 
b/lisp/use-package/use-package-jump.el
new file mode 100644
index 0000000000..6fc52afd28
--- /dev/null
+++ b/lisp/use-package/use-package-jump.el
@@ -0,0 +1,74 @@
+;;; use-package-jump.el --- Attempt to jump to a use-package declaration  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@newartisans.com>
+;; Maintainer: John Wiegley <johnw@newartisans.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides the command `M-x use-package-jump-to-package-form'.  However, it
+;; only works if the package being jumped to was required during
+;; initialization.  If it was autoloaded, it will not work.
+;; Improvements are needed.
+;;
+;; See the `use-package' info manual for more information.
+
+;;; Code:
+
+(require 'use-package-core)
+
+(defun use-package-find-require (package)
+  "Find file that required PACKAGE by searching `load-history'.
+Returns an absolute file path or nil if none is found."
+  (catch 'suspect
+    (dolist (filespec load-history)
+      (dolist (entry (cdr filespec))
+        (when (equal entry (cons 'require package))
+          (throw 'suspect (car filespec)))))))
+
+;;;###autoload
+(defun use-package-jump-to-package-form (package)
+  "Attempt to find and jump to the `use-package' form that loaded PACKAGE.
+This will only find the form if that form actually required
+PACKAGE.  If PACKAGE was previously required then this function
+will jump to the file that originally required PACKAGE instead."
+  (interactive (list (completing-read "Package: " features)))
+  (let* ((package (if (stringp package) (intern package) package))
+         (requiring-file (use-package-find-require package))
+         file location)
+    (if (null requiring-file)
+        (user-error "Can't find file requiring file; may have been autoloaded")
+      (setq file (if (string= (file-name-extension requiring-file) "elc")
+                     (concat (file-name-sans-extension requiring-file) ".el")
+                   requiring-file))
+      (when (file-exists-p file)
+        (find-file-other-window file)
+        (save-excursion
+          (goto-char (point-min))
+          (setq location
+                (re-search-forward
+                 (format (eval use-package-form-regexp-eval) package) nil t)))
+        (if (null location)
+            (message "No use-package form found.")
+          (goto-char location)
+          (beginning-of-line))))))
+
+(provide 'use-package-jump)
+
+;;; use-package-jump.el ends here
diff --git a/lisp/use-package/use-package-lint.el 
b/lisp/use-package/use-package-lint.el
new file mode 100644
index 0000000000..498213a76b
--- /dev/null
+++ b/lisp/use-package/use-package-lint.el
@@ -0,0 +1,80 @@
+;;; use-package-lint.el --- Attempt to find errors in use-package declarations 
 -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@newartisans.com>
+;; Maintainer: John Wiegley <johnw@newartisans.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides the command `M-x use-package-lint'.
+;;
+;; See the `use-package' info manual for more information.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'use-package-core)
+
+(defun use-package-lint-declaration (name plist)
+  (dolist (path (plist-get plist :load-path))
+    (unless (file-exists-p path)
+      (display-warning
+       'use-package
+       (format "%s :load-path does not exist: %s"
+               name path) :error)))
+
+  (unless (or (plist-member plist :disabled)
+              (plist-get plist :no-require)
+              (locate-library (use-package-as-string name) nil
+                              (plist-get plist :load-path)))
+    (display-warning
+     'use-package
+     (format "%s module cannot be located" name) :error))
+
+  ;; (dolist (command (plist-get plist :commands))
+  ;;   (unless (string= (find-lisp-object-file-name command nil)
+  ;;                    (locate-library (use-package-as-string name) nil
+  ;;                                    (plist-get plist :load-path)))
+  ;;     (display-warning
+  ;;      'use-package
+  ;;      (format "%s :command is from different path: %s"
+  ;;              name (symbol-name command)) :error)))
+  )
+
+;;;###autoload
+(defun use-package-lint ()
+  "Check for errors in `use-package' declarations.
+For example, if the module's `:if' condition is met, but even
+with the specified `:load-path' the module cannot be found."
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    (let ((re (eval use-package-form-regexp-eval)))
+      (while (re-search-forward re nil t)
+        (goto-char (match-beginning 0))
+        (let ((decl (read (current-buffer))))
+          (when (eq (car decl) 'use-package)
+            (use-package-lint-declaration
+             (use-package-as-string (cadr decl))
+             (use-package-normalize-keywords
+              (cadr decl) (cddr decl)))))))))
+
+(provide 'use-package-lint)
+
+;;; use-package-lint.el ends here
diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el
new file mode 100644
index 0000000000..0929696466
--- /dev/null
+++ b/lisp/use-package/use-package.el
@@ -0,0 +1,53 @@
+;;; use-package.el --- A configuration macro for simplifying your .emacs  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@newartisans.com>
+;; Maintainer: John Wiegley <johnw@newartisans.com>
+;; Created: 17 Jun 2012
+;; Version: 2.4.4
+;; Package-Requires: ((emacs "24.3") (bind-key "2.4"))
+;; Keywords: dotemacs startup speed config package extensions
+;; URL: https://github.com/jwiegley/use-package
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; The `use-package' declaration macro allows you to isolate package
+;; configuration in your init file in a way that is
+;; performance-oriented and, well, just tidy.  I created it because I
+;; have over 80 packages that I use in Emacs, and things were getting
+;; difficult to manage.  Yet with this utility my total load time is
+;; just under 1 second, with no loss of functionality!
+;;
+;; See the `use-package' info manual for more information.
+
+;;; Code:
+
+(require 'use-package-core)
+
+(require 'use-package-bind-key)
+(require 'use-package-diminish)
+(require 'use-package-delight)
+(require 'use-package-ensure)
+
+(declare-function use-package-jump-to-package-form "use-package-jump")
+(autoload #'use-package-jump-to-package-form "use-package-jump" nil t)
+
+(provide 'use-package)
+
+;;; use-package.el ends here
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index a1ff03144b..9f27f759d3 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -136,12 +136,19 @@ If nil, use the value of `vc-annotate-switches'.  If t, 
use no switches."
 ;;;###autoload(put 'vc-git-annotate-switches 'safe-local-variable (lambda 
(switches) (equal switches "-w")))
 
 (defcustom vc-git-log-switches nil
-  "String or list of strings specifying switches for Git log under VC."
+  "String or list of strings giving Git log switches for non-shortlogs."
   :type '(choice (const :tag "None" nil)
                  (string :tag "Argument String")
                  (repeat :tag "Argument List" :value ("") string))
   :version "28.1")
 
+(defcustom vc-git-shortlog-switches nil
+  "String or list of strings giving Git log switches for shortlogs."
+  :type '(choice (const :tag "None" nil)
+                 (string :tag "Argument String")
+                 (repeat :tag "Argument List" :value ("") string))
+  :version "30.1")
+
 (defcustom vc-git-resolve-conflicts t
   "When non-nil, mark conflicted file as resolved upon saving.
 That is performed after all conflict markers in it have been
@@ -1041,7 +1048,7 @@ It is based on `log-edit-mode', and has Git-specific 
extensions."
                         (string-replace file-diff "" vc-git-patch-string))
                 (user-error "Index not empty"))
               (setq pos (point))))))
-      (let ((patch-file (make-temp-file "git-patch")))
+      (let ((patch-file (make-nearby-temp-file "git-patch")))
         (with-temp-file patch-file
           (insert vc-git-patch-string))
         (unwind-protect
@@ -1325,7 +1332,8 @@ If LIMIT is a revision string, use it as an end-revision."
                     ,(format "--pretty=tformat:%s"
                              (car vc-git-root-log-format))
                     "--abbrev-commit"))
-                vc-git-log-switches
+                (ensure-list
+                 (if shortlog vc-git-shortlog-switches vc-git-log-switches))
                 (when (numberp limit)
                   (list "-n" (format "%s" limit)))
                (when start-revision
@@ -1340,16 +1348,16 @@ If LIMIT is a revision string, use it as an 
end-revision."
 
 (defun vc-git-log-outgoing (buffer remote-location)
   (vc-setup-buffer buffer)
-  (vc-git-command
-   buffer 'async nil
-   "log"
-   "--no-color" "--graph" "--decorate" "--date=short"
-   (format "--pretty=tformat:%s" (car vc-git-root-log-format))
-   "--abbrev-commit"
-   (concat (if (string= remote-location "")
-              "@{upstream}"
-            remote-location)
-          "..HEAD")))
+  (apply #'vc-git-command buffer 'async nil
+         `("log"
+           "--no-color" "--graph" "--decorate" "--date=short"
+           ,(format "--pretty=tformat:%s" (car vc-git-root-log-format))
+           "--abbrev-commit"
+           ,@(ensure-list vc-git-shortlog-switches)
+           ,(concat (if (string= remote-location "")
+                       "@{upstream}"
+                     remote-location)
+                   "..HEAD"))))
 
 (defun vc-git-log-incoming (buffer remote-location)
   (vc-setup-buffer buffer)
@@ -1359,15 +1367,15 @@ If LIMIT is a revision string, use it as an 
end-revision."
                     ;; so remove everything except a repository name.
                     (replace-regexp-in-string
                      "/.*" "" remote-location)))
-  (vc-git-command
-   buffer 'async nil
-   "log"
-   "--no-color" "--graph" "--decorate" "--date=short"
-   (format "--pretty=tformat:%s" (car vc-git-root-log-format))
-   "--abbrev-commit"
-   (concat "HEAD.." (if (string= remote-location "")
-                       "@{upstream}"
-                     remote-location))))
+  (apply #'vc-git-command buffer 'async nil
+         `("log"
+           "--no-color" "--graph" "--decorate" "--date=short"
+           ,(format "--pretty=tformat:%s" (car vc-git-root-log-format))
+           "--abbrev-commit"
+           ,@(ensure-list vc-git-shortlog-switches)
+           ,(concat "HEAD.." (if (string= remote-location "")
+                                "@{upstream}"
+                              remote-location)))))
 
 (defun vc-git-log-search (buffer pattern)
   "Search the log of changes for PATTERN and output results into BUFFER.
@@ -1378,6 +1386,7 @@ Display all entries that match log messages in long 
format.
 With a prefix argument, ask for a command to run that will output
 log entries."
   (let ((args `("log" "--no-color" "-i"
+                ,@(ensure-list vc-git-log-switches)
                 ,(format "--grep=%s" (or pattern "")))))
     (when current-prefix-arg
       (setq args (cdr (split-string
@@ -1425,11 +1434,11 @@ log entries."
          `((,log-view-message-re (1 'change-log-acknowledgment)))
          ;; Handle the case:
          ;; user: foo@bar
-         '(("^Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
+         '(("^\\(?:Author\\|Commit\\):[ 
\t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
             (1 'change-log-email))
            ;; Handle the case:
            ;; user: FirstName LastName <foo@bar>
-           ("^Author:[ \t]+\\([^<(]+?\\)[ 
\t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
+           ("^\\(?:Author\\|Commit\\):[ \t]+\\([^<(]+?\\)[ 
\t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
             (1 'change-log-name)
             (2 'change-log-email))
            ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ 
\t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
@@ -1440,7 +1449,7 @@ log entries."
            ("^Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
             (1 'change-log-acknowledgment)
             (2 'change-log-acknowledgment))
-           ("^\\(?:Date:   \\|AuthorDate: \\)\\(.+\\)" (1 'change-log-date))
+           ("^\\(?:Date:   \\|AuthorDate: \\|CommitDate: \\)\\(.+\\)" (1 
'change-log-date))
            ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
 
 
@@ -1462,7 +1471,11 @@ or BRANCH^ (where \"^\" can be repeated)."
 
 (defun vc-git-expanded-log-entry (revision)
   (with-temp-buffer
-    (apply #'vc-git-command t nil nil (list "log" revision "-1"  "--no-color" 
"--"))
+    (apply #'vc-git-command t nil nil
+           `("log"
+             ,revision
+             "-1"  "--no-color" ,@(ensure-list vc-git-log-switches)
+             "--"))
     (goto-char (point-min))
     (unless (eobp)
       ;; Indent the expanded log entry.
@@ -1661,7 +1674,8 @@ This requires git 1.8.4 or later, for the \"-L\" option 
of \"git log\"."
                                  (if branchp "branch" "tag"))))
          (if branchp
              (vc-git-command nil 0 nil "checkout" "-b" name
-                             (when (and start-point (not (eq start-point "")))
+                             (when (and start-point
+                                        (not (equal start-point "")))
                                start-point))
            (vc-git-command nil 0 nil "tag" name)))))
 
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index c41835e19f..bf1d847f1a 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -683,11 +683,11 @@ Optional arg REVISION is a revision to annotate from."
         ;; *BEFORE* editing occurs) to start from, but line numbers
         ;; change as a result of edits.  To DTRT, we apply edits in
         ;; order of descending buffer position so that edits further
-        ;; down in the buffer occur first w/o corrupting specified
+        ;; down in the buffer occur first without corrupting specified
         ;; buffer positions of edits occurring towards the beginning of
         ;; the buffer.  In this way we avoid using markers.  A pleasant
         ;; property of this approach is ability to push instructions
-        ;; onto `path' directly, w/o need to maintain rev boundaries.
+        ;; onto `path' directly, without need to maintain rev boundaries.
         (dolist (insn (cdr (assq :insn meta)))
           (goto-char (point-min))
           (forward-line (1- (pop insn)))
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 328d33040d..130214b840 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1135,7 +1135,7 @@ BEWARE: this function may change the current buffer."
       (vc-dir-deduce-fileset state-model-only-files))
      ((derived-mode-p 'dired-mode)
       (dired-vc-deduce-fileset state-model-only-files not-state-changing))
-     ((derived-mode-p 'diff-mode)
+     ((and (derived-mode-p 'diff-mode) (not buffer-file-name))
       (diff-vc-deduce-fileset))
      ((setq backend (vc-backend buffer-file-name))
       (if state-model-only-files
@@ -3369,7 +3369,7 @@ If nil, no default will be used.  This option may be set 
locally."
 
 (declare-function message--name-table "message" (orig-string))
 (declare-function mml-attach-buffer "mml"
-                  (buffer &optional type description disposition))
+                  (buffer &optional type description disposition filename))
 (declare-function log-view-get-marked "log-view" ())
 
 (defun vc-default-prepare-patch (_backend rev)
@@ -3410,6 +3410,19 @@ of the current file."
        (and-let* ((file (buffer-file-name)))
          (vc-working-revision file)))))
 
+(defun vc--subject-to-file-name (subject)
+  "Generate a file name for a patch with subject line SUBJECT."
+  (let* ((stripped
+          (replace-regexp-in-string "\\`\\[.*PATCH.*\\]\\s-*" ""
+                                    subject))
+         (truncated (if (length> stripped 50)
+                        (substring stripped 0 50)
+                      stripped)))
+    (concat
+     (string-trim (replace-regexp-in-string "\\W" "-" truncated)
+                  "-+" "-+")
+     ".patch")))
+
 ;;;###autoload
 (defun vc-prepare-patch (addressee subject revisions)
   "Compose an Email sending patches for REVISIONS to ADDRESSEE.
@@ -3420,7 +3433,7 @@ revision, with SUBJECT derived from each revision subject.
 When invoked with a numerical prefix argument, use the last N
 revisions.
 When invoked interactively in a Log View buffer with
-marked revisions, use those these."
+marked revisions, use those."
   (interactive
    (let ((revs (vc-prepare-patch-prompt-revisions)) to)
      (require 'message)
@@ -3466,11 +3479,17 @@ marked revisions, use those these."
         (rfc822-goto-eoh)
         (forward-line)
         (save-excursion
-          (dolist (patch patches)
-            (mml-attach-buffer (buffer-name (plist-get patch :buffer))
-                               "text/x-patch"
-                               (plist-get patch :subject)
-                               "attachment")))
+          (let ((i 0))
+            (dolist (patch patches)
+              (let* ((patch-subject (plist-get patch :subject))
+                     (filename
+                      (vc--subject-to-file-name patch-subject)))
+                (mml-attach-buffer
+                 (buffer-name (plist-get patch :buffer))
+                 "text/x-patch"
+                 patch-subject
+                 "attachment"
+                 (format "%04d-%s" (cl-incf i) filename))))))
         (open-line 2)))))
 
 (defun vc-default-responsible-p (_backend _file)
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 4d9663cea9..cc7926c3c5 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -3816,7 +3816,7 @@ thus allowing recursive data structures to be described.
 The :type parameter takes the same arguments as the defcustom
 parameter with the same name.
 
-Most composite widgets, i.e. widgets containing other widgets, does
+Most composite widgets, i.e. widgets containing other widgets, do
 not allow recursion.  That is, when you define a new widget type, none
 of the inferior widgets may be of the same type you are currently
 defining.
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 00e76df0a0..4311f082de 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -776,7 +776,8 @@ Default value of MODIFIERS is `shift-super'."
 (defconst windmove--default-keybindings-type
   `(choice (const :tag "Don't bind" nil)
            (cons :tag "Bind using"
-                 (key-sequence :tag "Prefix")
+                 (choice (key-sequence :tag "Prefix")
+                         (const :tag "No Prefix" nil))
                  (set :tag "Modifier"
                       :greedy t
                       ;; See `(elisp) Keyboard Events'
diff --git a/lisp/window.el b/lisp/window.el
index dd23ab1d39..a4a8421881 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1958,7 +1958,7 @@ Optional argument PIXELWISE non-nil means return number of
 pixels by which WINDOW can be enlarged."
   (setq window (window-normalize-window window))
   (if (and (not nodown) (window-size-fixed-p window horizontal ignore))
-      ;; With IGNORE and NOWDON nil return zero if WINDOW has fixed
+      ;; With IGNORE and NODOWN nil return zero if WINDOW has fixed
       ;; size.
       0
     ;; WINDOW has no fixed size.
@@ -2162,17 +2162,14 @@ the font."
     (let* ((window-width (window-body-width window t))
           (font-width (window-font-width window face))
           (ncols (- (/ window-width font-width)
-                     (ceiling (line-number-display-width 'columns)))))
+                     (ceiling (line-number-display-width 'columns))))
+           (fringes (window-fringes window))
+           (lfringe (car fringes))
+           (rfringe (nth 1 fringes)))
       (if (and (display-graphic-p)
               overflow-newline-into-fringe
-               (not
-                (or (eq left-fringe-width 0)
-                    (and (null left-fringe-width)
-                         (= (frame-parameter nil 'left-fringe) 0))))
-               (not
-                (or (eq right-fringe-width 0)
-                    (and (null right-fringe-width)
-                         (= (frame-parameter nil 'right-fringe) 0)))))
+               (not (eq lfringe 0))
+               (not (eq rfringe 0)))
          ncols
         ;; FIXME: This should remove 1 more column when there are no
         ;; fringes, lines are truncated, and the window is hscrolled,
@@ -4636,7 +4633,7 @@ omitted in calls from `switch-to-next-buffer'."
                     (catch 'found
                       (dolist (regexp switch-to-prev-buffer-skip-regexp)
                         (when (string-match-p regexp (buffer-name buffer))
-                          (throw 'tag t)))))))))
+                          (throw 'found t)))))))))
 
 (defun switch-to-prev-buffer (&optional window bury-or-kill)
   "In WINDOW switch to previous buffer.
diff --git a/m4/assert_h.m4 b/m4/assert_h.m4
index c1306daef4..e892ea2f01 100644
--- a/m4/assert_h.m4
+++ b/m4/assert_h.m4
@@ -57,5 +57,11 @@ AC_DEFUN([gl_ASSERT_H],
              && __GNUG__ < 6 && __clang_major__ < 6)))
  #include <assert.h>
  #undef/**/assert
+ /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments.
+    We need it also to be invocable with a single argument.  */
+ #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus
+  #undef static_assert
+  #define static_assert _Static_assert
+ #endif
 #endif])
 ])
diff --git a/m4/explicit_bzero.m4 b/m4/explicit_bzero.m4
deleted file mode 100644
index 3b4ef8c3cc..0000000000
--- a/m4/explicit_bzero.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-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.
-
-AC_DEFUN([gl_FUNC_EXPLICIT_BZERO],
-[
-  AC_REQUIRE([gl_STRING_H_DEFAULTS])
-
-  dnl Persuade glibc <string.h> to declare explicit_bzero.
-  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
-  AC_CHECK_FUNCS_ONCE([explicit_bzero])
-  if test $ac_cv_func_explicit_bzero = no; then
-    HAVE_EXPLICIT_BZERO=0
-  fi
-])
-
-AC_DEFUN([gl_PREREQ_EXPLICIT_BZERO],
-[
-  AC_CHECK_FUNCS([explicit_memset])
-  AC_CHECK_FUNCS_ONCE([memset_s])
-])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index f1ac499132..9ba977711f 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -77,13 +77,11 @@ AC_DEFUN([gl_EARLY],
   # Code from module dtoastr:
   # Code from module dtotimespec:
   # Code from module dup2:
-  # Code from module dynarray:
   # Code from module eloop-threshold:
   # Code from module environ:
   # Code from module errno:
   # Code from module euidaccess:
   # Code from module execinfo:
-  # Code from module explicit_bzero:
   # Code from module extensions:
   # Code from module extern-inline:
   # Code from module faccessat:
@@ -115,6 +113,8 @@ AC_DEFUN([gl_EARLY],
   # Code from module gettime:
   # Code from module gettimeofday:
   # Code from module gitlog-to-changelog:
+  # Code from module glibc-internal/dynarray:
+  # Code from module glibc-internal/scratch_buffer:
   # Code from module group-member:
   # Code from module idx:
   # Code from module ieee754-h:
@@ -136,6 +136,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module memmem-simple:
   # Code from module mempcpy:
   # Code from module memrchr:
+  # Code from module memset_explicit:
   # Code from module minmax:
   # Code from module mkostemp:
   # Code from module mktime:
@@ -159,7 +160,6 @@ AC_DEFUN([gl_EARLY],
   # Code from module realloc-posix:
   # Code from module regex:
   # Code from module root-uid:
-  # Code from module scratch_buffer:
   # Code from module sig2str:
   # Code from module sigdescr_np:
   # Code from module signal-h:
@@ -285,12 +285,6 @@ AC_DEFUN([gl_INIT],
   gl_CONDITIONAL_HEADER([execinfo.h])
   AC_PROG_MKDIR_P
   gl_CONDITIONAL([GL_COND_OBJ_EXECINFO], [$GL_GENERATE_EXECINFO_H])
-  gl_FUNC_EXPLICIT_BZERO
-  gl_CONDITIONAL([GL_COND_OBJ_EXPLICIT_BZERO], [test $HAVE_EXPLICIT_BZERO = 0])
-  AM_COND_IF([GL_COND_OBJ_EXPLICIT_BZERO], [
-    gl_PREREQ_EXPLICIT_BZERO
-  ])
-  gl_STRING_MODULE_INDICATOR([explicit_bzero])
   AC_REQUIRE([gl_EXTERN_INLINE])
   gl_FUNC_FACCESSAT
   gl_CONDITIONAL([GL_COND_OBJ_FACCESSAT],
@@ -422,6 +416,12 @@ AC_DEFUN([gl_INIT],
     gl_PREREQ_MEMRCHR
   ])
   gl_STRING_MODULE_INDICATOR([memrchr])
+  gl_FUNC_MEMSET_EXPLICIT
+  gl_CONDITIONAL([GL_COND_OBJ_MEMSET_EXPLICIT], [test $HAVE_MEMSET_EXPLICIT = 
0])
+  AM_COND_IF([GL_COND_OBJ_MEMSET_EXPLICIT], [
+    gl_PREREQ_MEMSET_EXPLICIT
+  ])
+  gl_STRING_MODULE_INDICATOR([memset_explicit])
   gl_MINMAX
   gl_FUNC_MKOSTEMP
   gl_CONDITIONAL([GL_COND_OBJ_MKOSTEMP], [test $HAVE_MKOSTEMP = 0])
@@ -492,6 +492,14 @@ AC_DEFUN([gl_INIT],
   gl_CONDITIONAL_HEADER([stdalign.h])
   AC_PROG_MKDIR_P
   gl_C_BOOL
+  AC_CHECK_HEADERS_ONCE([stdckdint.h])
+  if test $ac_cv_header_stdckdint_h = yes; then
+    GL_GENERATE_STDCKDINT_H=false
+  else
+    GL_GENERATE_STDCKDINT_H=true
+  fi
+  gl_CONDITIONAL_HEADER([stdckdint.h])
+  AC_PROG_MKDIR_P
   gl_STDDEF_H
   gl_STDDEF_H_REQUIRE_DEFAULTS
   gl_CONDITIONAL_HEADER([stddef.h])
@@ -620,12 +628,13 @@ AC_DEFUN([gl_INIT],
   gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b=false
   gl_gnulib_enabled_cloexec=false
   gl_gnulib_enabled_dirfd=false
-  gl_gnulib_enabled_dynarray=false
   gl_gnulib_enabled_925677f0343de64b89a9f0c790b4104c=false
   gl_gnulib_enabled_euidaccess=false
   gl_gnulib_enabled_getdtablesize=false
   gl_gnulib_enabled_getgroups=false
   gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
+  gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c=false
+  gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9=false
   gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=false
   gl_gnulib_enabled_lchmod=false
   gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b=false
@@ -637,8 +646,6 @@ AC_DEFUN([gl_INIT],
   gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b=false
   gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4=false
   gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false
-  gl_gnulib_enabled_scratch_buffer=false
-  gl_gnulib_enabled_stdckdint=false
   gl_gnulib_enabled_strtoll=false
   gl_gnulib_enabled_utimens=false
   gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=false
@@ -672,13 +679,6 @@ AC_DEFUN([gl_INIT],
       gl_gnulib_enabled_dirfd=true
     fi
   }
-  func_gl_gnulib_m4code_dynarray ()
-  {
-    if ! $gl_gnulib_enabled_dynarray; then
-      AC_PROG_MKDIR_P
-      gl_gnulib_enabled_dynarray=true
-    fi
-  }
   func_gl_gnulib_m4code_925677f0343de64b89a9f0c790b4104c ()
   {
     if ! $gl_gnulib_enabled_925677f0343de64b89a9f0c790b4104c; then
@@ -735,6 +735,22 @@ AC_DEFUN([gl_INIT],
       gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=true
     fi
   }
+  func_gl_gnulib_m4code_fd38c7e463b54744b77b98aeafb4fa7c ()
+  {
+    if ! $gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c; then
+      AC_PROG_MKDIR_P
+      gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c=true
+    fi
+  }
+  func_gl_gnulib_m4code_8444034ea779b88768865bb60b4fb8c9 ()
+  {
+    if ! $gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9; then
+      AC_PROG_MKDIR_P
+      gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9=true
+      func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866
+      func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4
+    fi
+  }
   func_gl_gnulib_m4code_a9786850e999ae65a836a6041e8e5ed1 ()
   {
     if ! $gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1; then
@@ -751,9 +767,6 @@ AC_DEFUN([gl_INIT],
       if test $HAVE_GROUP_MEMBER = 0; then
         func_gl_gnulib_m4code_d3b2383720ee0e541357aa2aac598e2b
       fi
-      if test $HAVE_GROUP_MEMBER = 0; then
-        func_gl_gnulib_m4code_stdckdint
-      fi
     fi
   }
   func_gl_gnulib_m4code_lchmod ()
@@ -882,29 +895,6 @@ AC_DEFUN([gl_INIT],
       gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=true
     fi
   }
-  func_gl_gnulib_m4code_scratch_buffer ()
-  {
-    if ! $gl_gnulib_enabled_scratch_buffer; then
-      AC_PROG_MKDIR_P
-      gl_gnulib_enabled_scratch_buffer=true
-      func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866
-      func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4
-    fi
-  }
-  func_gl_gnulib_m4code_stdckdint ()
-  {
-    if ! $gl_gnulib_enabled_stdckdint; then
-      AC_CHECK_HEADERS_ONCE([stdckdint.h])
-      if test $ac_cv_header_stdckdint_h = yes; then
-        GL_GENERATE_STDCKDINT_H=false
-      else
-        GL_GENERATE_STDCKDINT_H=true
-      fi
-      gl_CONDITIONAL_HEADER([stdckdint.h])
-      AC_PROG_MKDIR_P
-      gl_gnulib_enabled_stdckdint=true
-    fi
-  }
   func_gl_gnulib_m4code_strtoll ()
   {
     if ! $gl_gnulib_enabled_strtoll; then
@@ -935,10 +925,10 @@ AC_DEFUN([gl_INIT],
     func_gl_gnulib_m4code_925677f0343de64b89a9f0c790b4104c
   fi
   if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test 
$REPLACE_CANONICALIZE_FILE_NAME = 1; then
-    func_gl_gnulib_m4code_rawmemchr
+    func_gl_gnulib_m4code_8444034ea779b88768865bb60b4fb8c9
   fi
   if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test 
$REPLACE_CANONICALIZE_FILE_NAME = 1; then
-    func_gl_gnulib_m4code_scratch_buffer
+    func_gl_gnulib_m4code_rawmemchr
   fi
   if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
     func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b
@@ -992,7 +982,7 @@ AC_DEFUN([gl_INIT],
     func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7
   fi
   if test $ac_use_included_regex = yes; then
-    func_gl_gnulib_m4code_dynarray
+    func_gl_gnulib_m4code_fd38c7e463b54744b77b98aeafb4fa7c
   fi
   if { test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; } && test 
$ac_cv_type_long_long_int = yes; then
     func_gl_gnulib_m4code_strtoll
@@ -1013,12 +1003,13 @@ AC_DEFUN([gl_INIT],
   AM_CONDITIONAL([gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b], 
[$gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_cloexec], [$gl_gnulib_enabled_cloexec])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_dirfd], [$gl_gnulib_enabled_dirfd])
-  AM_CONDITIONAL([gl_GNULIB_ENABLED_dynarray], [$gl_gnulib_enabled_dynarray])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c], 
[$gl_gnulib_enabled_925677f0343de64b89a9f0c790b4104c])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_euidaccess], 
[$gl_gnulib_enabled_euidaccess])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_getdtablesize], 
[$gl_gnulib_enabled_getdtablesize])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], 
[$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36])
+  AM_CONDITIONAL([gl_GNULIB_ENABLED_fd38c7e463b54744b77b98aeafb4fa7c], 
[$gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c])
+  AM_CONDITIONAL([gl_GNULIB_ENABLED_8444034ea779b88768865bb60b4fb8c9], 
[$gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9])
   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])
@@ -1030,8 +1021,6 @@ AC_DEFUN([gl_INIT],
   AM_CONDITIONAL([gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b], 
[$gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4], 
[$gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], 
[$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c])
-  AM_CONDITIONAL([gl_GNULIB_ENABLED_scratch_buffer], 
[$gl_gnulib_enabled_scratch_buffer])
-  AM_CONDITIONAL([gl_GNULIB_ENABLED_stdckdint], [$gl_gnulib_enabled_stdckdint])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_utimens], [$gl_gnulib_enabled_utimens])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec], 
[$gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec])
@@ -1259,7 +1248,6 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/euidaccess.c
   lib/execinfo.c
   lib/execinfo.in.h
-  lib/explicit_bzero.c
   lib/faccessat.c
   lib/fchmodat.c
   lib/fcntl.c
@@ -1320,7 +1308,6 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/malloc/dynarray_resize.c
   lib/malloc/dynarray_resize_clear.c
   lib/malloc/scratch_buffer.h
-  lib/malloc/scratch_buffer_dupfree.c
   lib/malloc/scratch_buffer_grow.c
   lib/malloc/scratch_buffer_grow_preserve.c
   lib/malloc/scratch_buffer_set_array_size.c
@@ -1330,6 +1317,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/memmem.c
   lib/mempcpy.c
   lib/memrchr.c
+  lib/memset_explicit.c
   lib/mini-gmp-gnulib.c
   lib/mini-gmp.c
   lib/mini-gmp.h
@@ -1444,7 +1432,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/errno_h.m4
   m4/euidaccess.m4
   m4/execinfo.m4
-  m4/explicit_bzero.m4
   m4/extensions.m4
   m4/extern-inline.m4
   m4/faccessat.m4
@@ -1488,6 +1475,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/memmem.m4
   m4/mempcpy.m4
   m4/memrchr.m4
+  m4/memset_explicit.m4
   m4/minmax.m4
   m4/mkostemp.m4
   m4/mktime.m4
diff --git a/m4/memset_explicit.m4 b/m4/memset_explicit.m4
new file mode 100644
index 0000000000..3d4dcb3095
--- /dev/null
+++ b/m4/memset_explicit.m4
@@ -0,0 +1,20 @@
+dnl Copyright 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.
+
+AC_DEFUN([gl_FUNC_MEMSET_EXPLICIT],
+[
+  AC_REQUIRE([gl_STRING_H_DEFAULTS])
+
+  AC_CHECK_FUNCS_ONCE([memset_explicit])
+  if test $ac_cv_func_memset_explicit = no; then
+    HAVE_MEMSET_EXPLICIT=0
+  fi
+])
+
+AC_DEFUN([gl_PREREQ_MEMSET_EXPLICIT],
+[
+  AC_CHECK_FUNCS([explicit_memset])
+  AC_CHECK_FUNCS_ONCE([memset_s])
+])
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
index 0aa8c53f9e..8282a371e4 100644
--- a/m4/pthread_sigmask.m4
+++ b/m4/pthread_sigmask.m4
@@ -215,6 +215,7 @@ int main ()
            LIBS="$LIBS $LIBMULTITHREAD"])
         AC_RUN_IFELSE(
           [AC_LANG_SOURCE([[
+#include <limits.h>
 #include <pthread.h>
 #include <signal.h>
 #include <stdio.h>
@@ -230,14 +231,16 @@ sigint_handler (int sig)
 int main ()
 {
   sigset_t set;
-  int pid = getpid ();
+  pid_t pid = getpid ();
   char command[80];
+  if (LONG_MAX < pid)
+    return 6;
   signal (SIGINT, sigint_handler);
   sigemptyset (&set);
   sigaddset (&set, SIGINT);
   if (!(pthread_sigmask (SIG_BLOCK, &set, NULL) == 0))
     return 1;
-  sprintf (command, "sh -c 'sleep 1; kill -%d %d' &", SIGINT, pid);
+  sprintf (command, "sh -c 'sleep 1; kill -INT %ld' &", (long) pid);
   if (!(system (command) == 0))
     return 2;
   sleep (2);
diff --git a/m4/string_h.m4 b/m4/string_h.m4
index 9e09b96e16..6069d4a752 100644
--- a/m4/string_h.m4
+++ b/m4/string_h.m4
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 34
+# serial 35
 
 # Written by Paul Eggert.
 
@@ -21,7 +21,8 @@ AC_DEFUN_ONCE([gl_STRING_H],
   dnl guaranteed by C89.
   gl_WARN_ON_USE_PREPARE([[#include <string.h>
     ]],
-    [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul
+    [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit
+     rawmemchr stpcpy stpncpy strchrnul
      strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
      strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp])
 
@@ -54,6 +55,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMSET_EXPLICIT])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY])
@@ -107,6 +109,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
   HAVE_FFSLL=1;                 AC_SUBST([HAVE_FFSLL])
   HAVE_DECL_MEMMEM=1;           AC_SUBST([HAVE_DECL_MEMMEM])
   HAVE_MEMPCPY=1;               AC_SUBST([HAVE_MEMPCPY])
+  HAVE_MEMSET_EXPLICIT=1;       AC_SUBST([HAVE_MEMSET_EXPLICIT])
   HAVE_DECL_MEMRCHR=1;          AC_SUBST([HAVE_DECL_MEMRCHR])
   HAVE_RAWMEMCHR=1;             AC_SUBST([HAVE_RAWMEMCHR])
   HAVE_STPCPY=1;                AC_SUBST([HAVE_STPCPY])
diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp
index ff6be8d083..9e178ac143 100644
--- a/msdos/sed2v2.inp
+++ b/msdos/sed2v2.inp
@@ -67,7 +67,7 @@
 /^#undef PACKAGE_NAME/s/^.*$/#define PACKAGE_NAME ""/
 /^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/
 /^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/
-/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "29.0.50"/
+/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "30.0.50"/
 /^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/
 /^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/
 /^#undef SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/
diff --git a/nt/README.W32 b/nt/README.W32
index cbb5b12551..30f33ca706 100644
--- a/nt/README.W32
+++ b/nt/README.W32
@@ -1,7 +1,7 @@
 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
+               Emacs version 30.0.50 for MS-Windows
 
   This README file describes how to set up and run a precompiled
   distribution of the latest version of GNU Emacs for MS-Windows.  You
diff --git a/oldXMenu/ChangeLog.1 b/oldXMenu/ChangeLog.1
index ebbbcd2df2..b739a231f5 100644
--- a/oldXMenu/ChangeLog.1
+++ b/oldXMenu/ChangeLog.1
@@ -46,7 +46,7 @@
 
        * Makefile.in (mostlyclean, clean, distclean, maintainer-clean, tags):
        Declare as PHONY.
-       (boostrap-clean): New.
+       (bootstrap-clean): New.
 
 2013-10-24  Glenn Morris  <rgm@gnu.org>
 
diff --git a/src/.lldbinit b/src/.lldbinit
index 358cea5f8b..5fdac34b78 100644
--- a/src/.lldbinit
+++ b/src/.lldbinit
@@ -16,7 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 #
-# Use 'lldb --local-init' or add to your ~/.lldbinit the line
+# Use 'lldb --local-lldbinit' or add to your ~/.lldbinit the line
 #
 # settings set target.load-cwd-lldbinit true
 #
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index a00ca453ca..77180262ac 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -14235,7 +14235,7 @@
        ns_alternate_modifier.  (Bug#1217)
 
        * nsmenu.m (EmacsMenu-parseKeyEquiv:, addItemWithWidgetValue:):
-       Display all shortcuts, including those w/o super modifier.
+       Display all shortcuts, including those without super modifier.
 
        * nsfns.m (ns-read-file-name): Fix typo in assignment statement.
 
diff --git a/src/ChangeLog.12 b/src/ChangeLog.12
index 7f77c0ca07..f455c4de38 100644
--- a/src/ChangeLog.12
+++ b/src/ChangeLog.12
@@ -10836,7 +10836,7 @@
        * gtkutil.c (xg_maybe_add_timer): Port to higher-res time stamps.
 
        * image.c (prepare_image_for_display, clear_image_cache)
-       (lookup_image): Port to higer-resolution time stamps.
+       (lookup_image): Port to higher-resolution time stamps.
 
        * keyboard.c (start_polling, bind_polling_period):
        Check for time stamp overflow.
diff --git a/src/ChangeLog.13 b/src/ChangeLog.13
index 91f8005ac5..0c4e2909ce 100644
--- a/src/ChangeLog.13
+++ b/src/ChangeLog.13
@@ -10579,7 +10579,7 @@
        (../src/$(OLDXMENU), $(OLDXMENU)): Remove.
        (temacs$(EXEEXT)): Depend on $(LIBXMENU), not stamp-oldxmenu.
        ($(lwlibdir)/liblw.a, $(oldXMenudir)/libXMenu11.a, FORCE): New targets.
-       (boostrap-clean): No need to remove stamp-oldxmenu.
+       (bootstrap-clean): No need to remove stamp-oldxmenu.
 
        Fix recently introduced bool vector overrun.
        This was due to an optimization that went awry.
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3
index 4b3675eaa8..d32e894fa5 100644
--- a/src/ChangeLog.3
+++ b/src/ChangeLog.3
@@ -14422,7 +14422,7 @@
        * s-umips.h: Now include either s-usg5-2-2.h or s-bsd4-3.h
        and then override as needed.
        * m-mips.h: System dependence deleted.
-       LD_SWITCH_MACHINE remains w/ options needed on all systems.
+       LD_SWITCH_MACHINE remains with options needed on all systems.
        * m-pmax.h: A little of that (LIBS_DEBUG) moved here.
        No need to undef LIBS_MACHINE.
 
diff --git a/src/alloc.c b/src/alloc.c
index 0a8c182661..0a4323d1ce 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -82,6 +82,37 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <valgrind/memcheck.h>
 #endif
 
+/* AddressSanitizer exposes additional functions for manually marking
+   memory as poisoned/unpoisoned.  When ASan is enabled and the needed
+   header is available, memory is poisoned when:
+
+   * An ablock is freed (lisp_align_free), or ablocks are initially
+   allocated (lisp_align_malloc).
+   * An interval_block is initially allocated (make_interval).
+   * A dead INTERVAL is put on the interval free list
+   (sweep_intervals).
+   * A sdata is marked as dead (sweep_strings, pin_string).
+   * An sblock is initially allocated (allocate_string_data).
+   * A string_block is initially allocated (allocate_string).
+   * A dead string is put on string_free_list (sweep_strings).
+   * A float_block is initially allocated (make_float).
+   * A dead float is put on float_free_list.
+   * A cons_block is initially allocated (Fcons).
+   * A dead cons is put on cons_free_list (sweep_cons).
+   * A dead vector is put on vector_free_list (setup_on_free_list),
+   or a new vector block is allocated (allocate_vector_from_block).
+   Accordingly, objects reused from the free list are unpoisoned.
+
+   This feature can be disabled wtih the run-time flag
+   `allow_user_poisoning' set to zero.  */
+#if ADDRESS_SANITIZER && defined HAVE_SANITIZER_ASAN_INTERFACE_H \
+  && !defined GC_ASAN_POISON_OBJECTS
+# define GC_ASAN_POISON_OBJECTS 1
+# include <sanitizer/asan_interface.h>
+#else
+# define GC_ASAN_POISON_OBJECTS 0
+#endif
+
 /* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects.
    We turn that on by default when ENABLE_CHECKING is defined;
    define GC_CHECK_MARKED_OBJECTS to zero to disable.  */
@@ -1164,6 +1195,16 @@ struct ablocks
   (1 & (intptr_t) ABLOCKS_BUSY (abase) ? abase : ((void **) (abase))[-1])
 #endif
 
+#if GC_ASAN_POISON_OBJECTS
+# define ASAN_POISON_ABLOCK(b) \
+  __asan_poison_memory_region (&(b)->x, sizeof ((b)->x))
+# define ASAN_UNPOISON_ABLOCK(b) \
+  __asan_unpoison_memory_region (&(b)->x, sizeof ((b)->x))
+#else
+# define ASAN_POISON_ABLOCK(b) ((void) 0)
+# define ASAN_UNPOISON_ABLOCK(b) ((void) 0)
+#endif
+
 /* The list of free ablock.   */
 static struct ablock *free_ablock;
 
@@ -1242,6 +1283,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
        {
          abase->blocks[i].abase = abase;
          abase->blocks[i].x.next_free = free_ablock;
+         ASAN_POISON_ABLOCK (&abase->blocks[i]);
          free_ablock = &abase->blocks[i];
        }
       intptr_t ialigned = aligned;
@@ -1254,6 +1296,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
       eassert ((intptr_t) ABLOCKS_BUSY (abase) == aligned);
     }
 
+  ASAN_UNPOISON_ABLOCK (free_ablock);
   abase = ABLOCK_ABASE (free_ablock);
   ABLOCKS_BUSY (abase)
     = (struct ablocks *) (2 + (intptr_t) ABLOCKS_BUSY (abase));
@@ -1285,6 +1328,7 @@ lisp_align_free (void *block)
 #endif
   /* Put on free list.  */
   ablock->x.next_free = free_ablock;
+  ASAN_POISON_ABLOCK (ablock);
   free_ablock = ablock;
   /* Update busy count.  */
   intptr_t busy = (intptr_t) ABLOCKS_BUSY (abase) - 2;
@@ -1297,9 +1341,12 @@ lisp_align_free (void *block)
       bool aligned = busy;
       struct ablock **tem = &free_ablock;
       struct ablock *atop = &abase->blocks[aligned ? ABLOCKS_SIZE : 
ABLOCKS_SIZE - 1];
-
       while (*tem)
        {
+#if GC_ASAN_POISON_OBJECTS
+         __asan_unpoison_memory_region (&(*tem)->x,
+                                        sizeof ((*tem)->x));
+#endif
          if (*tem >= (struct ablock *) abase && *tem < atop)
            {
              i++;
@@ -1428,6 +1475,24 @@ static int interval_block_index = INTERVAL_BLOCK_SIZE;
 
 static INTERVAL interval_free_list;
 
+#if GC_ASAN_POISON_OBJECTS
+# define ASAN_POISON_INTERVAL_BLOCK(b)         \
+  __asan_poison_memory_region ((b)->intervals, \
+                              sizeof ((b)->intervals))
+# define ASAN_UNPOISON_INTERVAL_BLOCK(b)         \
+  __asan_unpoison_memory_region ((b)->intervals, \
+                                sizeof ((b)->intervals))
+# define ASAN_POISON_INTERVAL(i) \
+  __asan_poison_memory_region ((i), sizeof (*(i)))
+# define ASAN_UNPOISON_INTERVAL(i) \
+  __asan_unpoison_memory_region ((i), sizeof (*(i)))
+#else
+# define ASAN_POISON_INTERVAL_BLOCK(b) ((void) 0)
+# define ASAN_UNPOISON_INTERVAL_BLOCK(b) ((void) 0)
+# define ASAN_POISON_INTERVAL(i) ((void) 0)
+# define ASAN_UNPOISON_INTERVAL(i) ((void) 0)
+#endif
+
 /* Return a new interval.  */
 
 INTERVAL
@@ -1440,6 +1505,7 @@ make_interval (void)
   if (interval_free_list)
     {
       val = interval_free_list;
+      ASAN_UNPOISON_INTERVAL (val);
       interval_free_list = INTERVAL_PARENT (interval_free_list);
     }
   else
@@ -1450,10 +1516,12 @@ make_interval (void)
            = lisp_malloc (sizeof *newi, false, MEM_TYPE_NON_LISP);
 
          newi->next = interval_block;
+         ASAN_POISON_INTERVAL_BLOCK (newi);
          interval_block = newi;
          interval_block_index = 0;
        }
       val = &interval_block->intervals[interval_block_index++];
+      ASAN_UNPOISON_INTERVAL (val);
     }
 
   MALLOC_UNBLOCK_INPUT;
@@ -1694,6 +1762,41 @@ init_strings (void)
   staticpro (&empty_multibyte_string);
 }
 
+#if GC_ASAN_POISON_OBJECTS
+/* Prepare s for denoting a free sdata struct, i.e, poison all bytes
+   in the flexible array member, except the first SDATA_OFFSET bytes.
+   This is only effective for strings of size n where n > sdata_size(n).
+ */
+# define ASAN_PREPARE_DEAD_SDATA(s, size)                          \
+  do {                                                             \
+    __asan_poison_memory_region ((s), sdata_size ((size)));        \
+    __asan_unpoison_memory_region (&(((s))->string),                 \
+                                  sizeof (struct Lisp_String *)); \
+    __asan_unpoison_memory_region (&SDATA_NBYTES ((s)),            \
+                                  sizeof (SDATA_NBYTES ((s))));   \
+   } while (false)
+/* Prepare s for storing string data for NBYTES bytes.  */
+# define ASAN_PREPARE_LIVE_SDATA(s, nbytes) \
+  __asan_unpoison_memory_region ((s), sdata_size ((nbytes)))
+# define ASAN_POISON_SBLOCK_DATA(b, size) \
+  __asan_poison_memory_region ((b)->data, (size))
+# define ASAN_POISON_STRING_BLOCK(b) \
+  __asan_poison_memory_region ((b)->strings, STRING_BLOCK_SIZE)
+# define ASAN_UNPOISON_STRING_BLOCK(b) \
+  __asan_unpoison_memory_region ((b)->strings, STRING_BLOCK_SIZE)
+# define ASAN_POISON_STRING(s) \
+  __asan_poison_memory_region ((s), sizeof (*(s)))
+# define ASAN_UNPOISON_STRING(s) \
+  __asan_unpoison_memory_region ((s), sizeof (*(s)))
+#else
+# define ASAN_PREPARE_DEAD_SDATA(s, size) ((void) 0)
+# define ASAN_PREPARE_LIVE_SDATA(s, nbytes) ((void) 0)
+# define ASAN_POISON_SBLOCK_DATA(b, size) ((void) 0)
+# define ASAN_POISON_STRING_BLOCK(b) ((void) 0)
+# define ASAN_UNPOISON_STRING_BLOCK(b) ((void) 0)
+# define ASAN_POISON_STRING(s) ((void) 0)
+# define ASAN_UNPOISON_STRING(s) ((void) 0)
+#endif
 
 #ifdef GC_CHECK_STRING_BYTES
 
@@ -1812,12 +1915,14 @@ allocate_string (void)
          NEXT_FREE_LISP_STRING (s) = string_free_list;
          string_free_list = s;
        }
+      ASAN_POISON_STRING_BLOCK (b);
     }
 
   check_string_free_list ();
 
   /* Pop a Lisp_String off the free-list.  */
   s = string_free_list;
+  ASAN_UNPOISON_STRING (s);
   string_free_list = NEXT_FREE_LISP_STRING (s);
 
   MALLOC_UNBLOCK_INPUT;
@@ -1877,6 +1982,7 @@ allocate_string_data (struct Lisp_String *s,
 #endif
 
       b = lisp_malloc (size + GC_STRING_EXTRA, clearit, MEM_TYPE_NON_LISP);
+      ASAN_POISON_SBLOCK_DATA (b, size);
 
 #ifdef DOUG_LEA_MALLOC
       if (!mmap_lisp_allowed_p ())
@@ -1898,6 +2004,8 @@ allocate_string_data (struct Lisp_String *s,
        {
          /* Not enough room in the current sblock.  */
          b = lisp_malloc (SBLOCK_SIZE, false, MEM_TYPE_NON_LISP);
+         ASAN_POISON_SBLOCK_DATA (b, SBLOCK_SIZE);
+
          data = b->data;
          b->next = NULL;
          b->next_free = data;
@@ -1910,10 +2018,19 @@ allocate_string_data (struct Lisp_String *s,
        }
 
       data = b->next_free;
+
       if (clearit)
-       memset (SDATA_DATA (data), 0, nbytes);
+       {
+#if GC_ASAN_POISON_OBJECTS
+         /* We are accessing SDATA_DATA (data) before it gets
+          * normally unpoisoned, so do it manually.  */
+         __asan_unpoison_memory_region (SDATA_DATA (data), nbytes);
+#endif
+         memset (SDATA_DATA (data), 0, nbytes);
+       }
     }
 
+  ASAN_PREPARE_LIVE_SDATA (data, nbytes);
   data->string = s;
   b->next_free = (sdata *) ((char *) data + needed + GC_STRING_EXTRA);
   eassert ((uintptr_t) b->next_free % alignof (sdata) == 0);
@@ -2005,12 +2122,16 @@ sweep_strings (void)
       int i, nfree = 0;
       struct Lisp_String *free_list_before = string_free_list;
 
+      ASAN_UNPOISON_STRING_BLOCK (b);
+
       next = b->next;
 
       for (i = 0; i < STRING_BLOCK_SIZE; ++i)
        {
          struct Lisp_String *s = b->strings + i;
 
+         ASAN_UNPOISON_STRING (s);
+
          if (s->u.s.data)
            {
              /* String was not on free-list before.  */
@@ -2047,6 +2168,8 @@ sweep_strings (void)
 
                  /* Put the string on the free-list.  */
                  NEXT_FREE_LISP_STRING (s) = string_free_list;
+                 ASAN_POISON_STRING (s);
+                 ASAN_PREPARE_DEAD_SDATA (data, SDATA_NBYTES (data));
                  string_free_list = s;
                  ++nfree;
                }
@@ -2055,6 +2178,8 @@ sweep_strings (void)
            {
              /* S was on the free-list before.  Put it there again.  */
              NEXT_FREE_LISP_STRING (s) = string_free_list;
+             ASAN_POISON_STRING (s);
+
              string_free_list = s;
              ++nfree;
            }
@@ -2181,6 +2306,7 @@ compact_small_strings (void)
                  if (from != to)
                    {
                      eassert (tb != b || to < from);
+                     ASAN_PREPARE_LIVE_SDATA (to, nbytes);
                      memmove (to, from, size + GC_STRING_EXTRA);
                      to->string->u.s.data = SDATA_DATA (to);
                    }
@@ -2537,6 +2663,7 @@ pin_string (Lisp_Object string)
       memcpy (s->u.s.data, data, size);
       old_sdata->string = NULL;
       SDATA_NBYTES (old_sdata) = size;
+      ASAN_PREPARE_DEAD_SDATA (old_sdata, size);
     }
   if (s->u.s.size_byte != -3)
     s->u.s.size_byte = -3;
@@ -2601,6 +2728,24 @@ struct float_block
 #define XFLOAT_UNMARK(fptr) \
   UNSETMARKBIT (FLOAT_BLOCK (fptr), FLOAT_INDEX ((fptr)))
 
+#if GC_ASAN_POISON_OBJECTS
+# define ASAN_POISON_FLOAT_BLOCK(fblk)         \
+  __asan_poison_memory_region ((fblk)->floats, \
+                              sizeof ((fblk)->floats))
+# define ASAN_UNPOISON_FLOAT_BLOCK(fblk)         \
+  __asan_unpoison_memory_region ((fblk)->floats, \
+                                sizeof ((fblk)->floats))
+# define ASAN_POISON_FLOAT(p) \
+  __asan_poison_memory_region ((p), sizeof (struct Lisp_Float))
+# define ASAN_UNPOISON_FLOAT(p) \
+  __asan_unpoison_memory_region ((p), sizeof (struct Lisp_Float))
+#else
+# define ASAN_POISON_FLOAT_BLOCK(fblk) ((void) 0)
+# define ASAN_UNPOISON_FLOAT_BLOCK(fblk) ((void) 0)
+# define ASAN_POISON_FLOAT(p) ((void) 0)
+# define ASAN_UNPOISON_FLOAT(p) ((void) 0)
+#endif
+
 /* Current float_block.  */
 
 static struct float_block *float_block;
@@ -2625,6 +2770,7 @@ make_float (double float_value)
   if (float_free_list)
     {
       XSETFLOAT (val, float_free_list);
+      ASAN_UNPOISON_FLOAT (float_free_list);
       float_free_list = float_free_list->u.chain;
     }
   else
@@ -2635,9 +2781,11 @@ make_float (double float_value)
            = lisp_align_malloc (sizeof *new, MEM_TYPE_FLOAT);
          new->next = float_block;
          memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
+         ASAN_POISON_FLOAT_BLOCK (new);
          float_block = new;
          float_block_index = 0;
        }
+      ASAN_UNPOISON_FLOAT (&float_block->floats[float_block_index]);
       XSETFLOAT (val, &float_block->floats[float_block_index]);
       float_block_index++;
     }
@@ -2715,6 +2863,19 @@ static int cons_block_index = CONS_BLOCK_SIZE;
 
 static struct Lisp_Cons *cons_free_list;
 
+#if GC_ASAN_POISON_OBJECTS
+# define ASAN_POISON_CONS_BLOCK(b) \
+  __asan_poison_memory_region ((b)->conses, sizeof ((b)->conses))
+# define ASAN_POISON_CONS(p) \
+  __asan_poison_memory_region ((p), sizeof (struct Lisp_Cons))
+# define ASAN_UNPOISON_CONS(p) \
+  __asan_unpoison_memory_region ((p), sizeof (struct Lisp_Cons))
+#else
+# define ASAN_POISON_CONS_BLOCK(b) ((void) 0)
+# define ASAN_POISON_CONS(p) ((void) 0)
+# define ASAN_UNPOISON_CONS(p) ((void) 0)
+#endif
+
 /* Explicitly free a cons cell by putting it on the free-list.  */
 
 void
@@ -2725,6 +2886,7 @@ free_cons (struct Lisp_Cons *ptr)
   cons_free_list = ptr;
   ptrdiff_t nbytes = sizeof *ptr;
   tally_consing (-nbytes);
+  ASAN_POISON_CONS (ptr);
 }
 
 DEFUN ("cons", Fcons, Scons, 2, 2, 0,
@@ -2737,6 +2899,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
 
   if (cons_free_list)
     {
+      ASAN_UNPOISON_CONS (cons_free_list);
       XSETCONS (val, cons_free_list);
       cons_free_list = cons_free_list->u.s.u.chain;
     }
@@ -2747,10 +2910,12 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
          struct cons_block *new
            = lisp_align_malloc (sizeof *new, MEM_TYPE_CONS);
          memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
+         ASAN_POISON_CONS_BLOCK (new);
          new->next = cons_block;
          cons_block = new;
          cons_block_index = 0;
        }
+      ASAN_UNPOISON_CONS (&cons_block->conses[cons_block_index]);
       XSETCONS (val, &cons_block->conses[cons_block_index]);
       cons_block_index++;
     }
@@ -3005,6 +3170,19 @@ static struct large_vector *large_vectors;
 
 Lisp_Object zero_vector;
 
+#if GC_ASAN_POISON_OBJECTS
+# define ASAN_POISON_VECTOR_CONTENTS(v, bytes) \
+  __asan_poison_memory_region ((v)->contents, (bytes))
+# define ASAN_UNPOISON_VECTOR_CONTENTS(v, bytes) \
+  __asan_unpoison_memory_region ((v)->contents, (bytes))
+# define ASAN_UNPOISON_VECTOR_BLOCK(b) \
+  __asan_unpoison_memory_region ((b)->data, sizeof ((b)->data))
+#else
+# define ASAN_POISON_VECTOR_CONTENTS(v, bytes) ((void) 0)
+# define ASAN_UNPOISON_VECTOR_CONTENTS(v, bytes) ((void) 0)
+# define ASAN_UNPOISON_VECTOR_BLOCK(b) ((void) 0)
+#endif
+
 /* Common shortcut to setup vector on a free list.  */
 
 static void
@@ -3017,6 +3195,7 @@ setup_on_free_list (struct Lisp_Vector *v, ptrdiff_t 
nbytes)
   ptrdiff_t vindex = VINDEX (nbytes);
   eassert (vindex < VECTOR_MAX_FREE_LIST_INDEX);
   set_next_vector (v, vector_free_lists[vindex]);
+  ASAN_POISON_VECTOR_CONTENTS (v, nbytes - header_size);
   vector_free_lists[vindex] = v;
 }
 
@@ -3064,6 +3243,7 @@ allocate_vector_from_block (ptrdiff_t nbytes)
   if (vector_free_lists[index])
     {
       vector = vector_free_lists[index];
+      ASAN_UNPOISON_VECTOR_CONTENTS (vector, nbytes - header_size);
       vector_free_lists[index] = next_vector (vector);
       return vector;
     }
@@ -3077,12 +3257,18 @@ allocate_vector_from_block (ptrdiff_t nbytes)
       {
        /* This vector is larger than requested.  */
        vector = vector_free_lists[index];
+       ASAN_UNPOISON_VECTOR_CONTENTS (vector, nbytes - header_size);
        vector_free_lists[index] = next_vector (vector);
 
        /* Excess bytes are used for the smaller vector,
           which should be set on an appropriate free list.  */
        restbytes = index * roundup_size + VBLOCK_BYTES_MIN - nbytes;
        eassert (restbytes % roundup_size == 0);
+#if GC_ASAN_POISON_OBJECTS
+       /* Ensure that accessing excess bytes does not trigger ASan.  */
+       __asan_unpoison_memory_region (ADVANCE (vector, nbytes),
+                                      restbytes);
+#endif
        setup_on_free_list (ADVANCE (vector, nbytes), restbytes);
        return vector;
       }
@@ -3258,6 +3444,7 @@ sweep_vectors (void)
       for (vector = (struct Lisp_Vector *) block->data;
           VECTOR_IN_BLOCK (vector, block); vector = next)
        {
+         ASAN_UNPOISON_VECTOR_BLOCK (block);
          if (XVECTOR_MARKED_P (vector))
            {
              XUNMARK_VECTOR (vector);
@@ -3633,6 +3820,23 @@ struct symbol_block
   struct symbol_block *next;
 };
 
+#if GC_ASAN_POISON_OBJECTS
+# define ASAN_POISON_SYMBOL_BLOCK(s) \
+  __asan_poison_memory_region ((s)->symbols, sizeof ((s)->symbols))
+# define ASAN_UNPOISON_SYMBOL_BLOCK(s) \
+  __asan_unpoison_memory_region ((s)->symbols, sizeof ((s)->symbols))
+# define ASAN_POISON_SYMBOL(sym) \
+  __asan_poison_memory_region ((sym), sizeof (*(sym)))
+# define ASAN_UNPOISON_SYMBOL(sym) \
+  __asan_unpoison_memory_region ((sym), sizeof (*(sym)))
+
+#else
+# define ASAN_POISON_SYMBOL_BLOCK(s) ((void) 0)
+# define ASAN_UNPOISON_SYMBOL_BLOCK(s) ((void) 0)
+# define ASAN_POISON_SYMBOL(sym) ((void) 0)
+# define ASAN_UNPOISON_SYMBOL(sym) ((void) 0)
+#endif
+
 /* Current symbol block and index of first unused Lisp_Symbol
    structure in it.  */
 
@@ -3686,6 +3890,7 @@ Its value is void, and its function definition and 
property list are nil.  */)
 
   if (symbol_free_list)
     {
+      ASAN_UNPOISON_SYMBOL (symbol_free_list);
       XSETSYMBOL (val, symbol_free_list);
       symbol_free_list = symbol_free_list->u.s.next;
     }
@@ -3695,10 +3900,13 @@ Its value is void, and its function definition and 
property list are nil.  */)
        {
          struct symbol_block *new
            = lisp_malloc (sizeof *new, false, MEM_TYPE_SYMBOL);
+         ASAN_POISON_SYMBOL_BLOCK (new);
          new->next = symbol_block;
          symbol_block = new;
          symbol_block_index = 0;
        }
+
+      ASAN_UNPOISON_SYMBOL (&symbol_block->symbols[symbol_block_index]);
       XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index]);
       symbol_block_index++;
     }
@@ -4624,6 +4832,11 @@ static struct Lisp_String *
 live_string_holding (struct mem_node *m, void *p)
 {
   eassert (m->type == MEM_TYPE_STRING);
+#if GC_ASAN_POISON_OBJECTS
+  if (__asan_address_is_poisoned (p))
+    return NULL;
+#endif
+
   struct string_block *b = m->start;
   char *cp = p;
   ptrdiff_t offset = cp - (char *) &b->strings[0];
@@ -4640,6 +4853,10 @@ live_string_holding (struct mem_node *m, void *p)
          || off == offsetof (struct Lisp_String, u.s.data))
        {
          struct Lisp_String *s = p = cp -= off;
+#if GC_ASAN_POISON_OBJECTS
+         if (__asan_region_is_poisoned (s, sizeof (*s)))
+           return NULL;
+#endif
          if (s->u.s.data)
            return s;
        }
@@ -4661,6 +4878,11 @@ static struct Lisp_Cons *
 live_cons_holding (struct mem_node *m, void *p)
 {
   eassert (m->type == MEM_TYPE_CONS);
+#if GC_ASAN_POISON_OBJECTS
+  if (__asan_address_is_poisoned (p))
+    return NULL;
+#endif
+
   struct cons_block *b = m->start;
   char *cp = p;
   ptrdiff_t offset = cp - (char *) &b->conses[0];
@@ -4678,6 +4900,10 @@ live_cons_holding (struct mem_node *m, void *p)
          || off == offsetof (struct Lisp_Cons, u.s.u.cdr))
        {
          struct Lisp_Cons *s = p = cp -= off;
+#if GC_ASAN_POISON_OBJECTS
+         if (__asan_region_is_poisoned (s, sizeof (*s)))
+           return NULL;
+#endif
          if (!deadp (s->u.s.car))
            return s;
        }
@@ -4700,6 +4926,10 @@ static struct Lisp_Symbol *
 live_symbol_holding (struct mem_node *m, void *p)
 {
   eassert (m->type == MEM_TYPE_SYMBOL);
+#if GC_ASAN_POISON_OBJECTS
+  if (__asan_address_is_poisoned (p))
+    return NULL;
+#endif
   struct symbol_block *b = m->start;
   char *cp = p;
   ptrdiff_t offset = cp - (char *) &b->symbols[0];
@@ -4725,6 +4955,10 @@ live_symbol_holding (struct mem_node *m, void *p)
          || off == offsetof (struct Lisp_Symbol, u.s.next))
        {
          struct Lisp_Symbol *s = p = cp -= off;
+#if GC_ASAN_POISON_OBJECTS
+         if (__asan_region_is_poisoned (s, sizeof (*s)))
+           return NULL;
+#endif
          if (!deadp (s->u.s.function))
            return s;
        }
@@ -4747,6 +4981,11 @@ static struct Lisp_Float *
 live_float_holding (struct mem_node *m, void *p)
 {
   eassert (m->type == MEM_TYPE_FLOAT);
+#if GC_ASAN_POISON_OBJECTS
+  if (__asan_address_is_poisoned (p))
+    return NULL;
+#endif
+
   struct float_block *b = m->start;
   char *cp = p;
   ptrdiff_t offset = cp - (char *) &b->floats[0];
@@ -4761,8 +5000,12 @@ live_float_holding (struct mem_node *m, void *p)
          && (b != float_block
              || offset / sizeof b->floats[0] < float_block_index))
        {
-         p = cp - off;
-         return p;
+         struct Lisp_Float *f = (struct Lisp_Float *) (cp - off);
+#if GC_ASAN_POISON_OBJECTS
+         if (__asan_region_is_poisoned (f, sizeof (*f)))
+           return NULL;
+#endif
+         return f;
        }
     }
   return NULL;
@@ -5338,7 +5581,8 @@ valid_lisp_object_p (Lisp_Object obj)
       if (valid <= 0)
        return valid;
 
-      if (SUBRP (obj))
+      /* Strings and conses produced by AUTO_STRING etc. all get here.  */
+      if (SUBRP (obj) || STRINGP (obj) || CONSP (obj))
        return 1;
 
 #ifdef HAVE_STATIC_LISP_GLOBALS
@@ -6287,6 +6531,7 @@ garbage_collect (void)
 
 #ifdef HAVE_X_WINDOWS
   mark_xterm ();
+  mark_xselect ();
 #endif
 
 #ifdef HAVE_NS
@@ -6647,7 +6892,7 @@ mark_buffer (struct buffer *buffer)
   if (!BUFFER_LIVE_P (buffer))
       mark_object (BVAR (buffer, undo_list));
 
-  if (buffer->overlays)
+  if (!itree_empty_p (buffer->overlays))
     mark_overlays (buffer->overlays->root);
 
   /* If this is an indirect buffer, mark its base buffer.  */
@@ -7292,11 +7537,13 @@ sweep_conses (void)
                  struct Lisp_Cons *acons = &cblk->conses[pos];
                  if (!XCONS_MARKED_P (acons))
                     {
+                     ASAN_UNPOISON_CONS (&cblk->conses[pos]);
                       this_free++;
                       cblk->conses[pos].u.s.u.chain = cons_free_list;
                       cons_free_list = &cblk->conses[pos];
                       cons_free_list->u.s.car = dead_object ();
-                    }
+                     ASAN_POISON_CONS (&cblk->conses[pos]);
+                   }
                   else
                     {
                       num_used++;
@@ -7314,6 +7561,7 @@ sweep_conses (void)
         {
           *cprev = cblk->next;
           /* Unhook from the free list.  */
+         ASAN_UNPOISON_CONS (&cblk->conses[0]);
           cons_free_list = cblk->conses[0].u.s.u.chain;
           lisp_align_free (cblk);
         }
@@ -7340,6 +7588,7 @@ sweep_floats (void)
   for (struct float_block *fblk; (fblk = *fprev); )
     {
       int this_free = 0;
+      ASAN_UNPOISON_FLOAT_BLOCK (fblk);
       for (int i = 0; i < lim; i++)
        {
          struct Lisp_Float *afloat = &fblk->floats[i];
@@ -7347,6 +7596,7 @@ sweep_floats (void)
            {
              this_free++;
              fblk->floats[i].u.chain = float_free_list;
+             ASAN_POISON_FLOAT (&fblk->floats[i]);
              float_free_list = &fblk->floats[i];
            }
          else
@@ -7363,7 +7613,8 @@ sweep_floats (void)
         {
           *fprev = fblk->next;
           /* Unhook from the free list.  */
-          float_free_list = fblk->floats[0].u.chain;
+         ASAN_UNPOISON_FLOAT (&fblk->floats[0]);
+         float_free_list = fblk->floats[0].u.chain;
           lisp_align_free (fblk);
         }
       else
@@ -7389,13 +7640,14 @@ sweep_intervals (void)
   for (struct interval_block *iblk; (iblk = *iprev); )
     {
       int this_free = 0;
-
+      ASAN_UNPOISON_INTERVAL_BLOCK (iblk);
       for (int i = 0; i < lim; i++)
         {
           if (!iblk->intervals[i].gcmarkbit)
             {
               set_interval_parent (&iblk->intervals[i], interval_free_list);
               interval_free_list = &iblk->intervals[i];
+             ASAN_POISON_INTERVAL (&iblk->intervals[i]);
               this_free++;
             }
           else
@@ -7412,6 +7664,7 @@ sweep_intervals (void)
         {
           *iprev = iblk->next;
           /* Unhook from the free list.  */
+         ASAN_UNPOISON_INTERVAL (&iblk->intervals[0]);
           interval_free_list = INTERVAL_PARENT (&iblk->intervals[0]);
           lisp_free (iblk);
         }
@@ -7441,6 +7694,8 @@ sweep_symbols (void)
 
   for (sblk = symbol_block; sblk; sblk = *sprev)
     {
+      ASAN_UNPOISON_SYMBOL_BLOCK (sblk);
+
       int this_free = 0;
       struct Lisp_Symbol *sym = sblk->symbols;
       struct Lisp_Symbol *end = sym + lim;
@@ -7462,7 +7717,8 @@ sweep_symbols (void)
               sym->u.s.next = symbol_free_list;
               symbol_free_list = sym;
               symbol_free_list->u.s.function = dead_object ();
-              ++this_free;
+             ASAN_POISON_SYMBOL (sym);
+             ++this_free;
             }
           else
             {
@@ -7481,6 +7737,7 @@ sweep_symbols (void)
         {
           *sprev = sblk->next;
           /* Unhook from the free list.  */
+         ASAN_UNPOISON_SYMBOL (&sblk->symbols[0]);
           symbol_free_list = sblk->symbols[0].u.s.next;
           lisp_free (sblk);
         }
@@ -7548,9 +7805,17 @@ DEFUN ("memory-info", Fmemory_info, Smemory_info, 0, 0, 
0,
        doc: /* Return a list of (TOTAL-RAM FREE-RAM TOTAL-SWAP FREE-SWAP).
 All values are in Kbytes.  If there is no swap space,
 last two values are zero.  If the system is not supported
-or memory information can't be obtained, return nil.  */)
+or memory information can't be obtained, return nil.
+If `default-directory’ is remote, return memory information of the
+respective remote host.  */)
   (void)
 {
+  Lisp_Object handler
+    = Ffind_file_name_handler (BVAR (current_buffer, directory),
+                              Qmemory_info);
+  if (!NILP (handler))
+    return call1 (handler, Qmemory_info);
+
 #if defined HAVE_LINUX_SYSINFO
   struct sysinfo si;
   uintmax_t units;
@@ -7972,6 +8237,8 @@ do hash-consing of the objects allocated to pure space.  
*/);
               doc: /* Non-nil means Emacs cannot get much more Lisp memory.  
*/);
   Vmemory_full = Qnil;
 
+  DEFSYM (Qmemory_info, "memory-info");
+
   DEFSYM (Qconses, "conses");
   DEFSYM (Qsymbols, "symbols");
   DEFSYM (Qstrings, "strings");
diff --git a/src/buffer.c b/src/buffer.c
index ac7f4f8e9d..38c3150f2c 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -604,7 +604,6 @@ even if it is dead.  The return value is never nil.  */)
   set_buffer_intervals (b, NULL);
   BUF_UNCHANGED_MODIFIED (b) = 1;
   BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1;
-  BUF_CHARS_UNCHANGED_MODIFIED (b) = 1;
   BUF_END_UNCHANGED (b) = 0;
   BUF_BEG_UNCHANGED (b) = 0;
   *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'.  */
@@ -1748,7 +1747,19 @@ other_buffer_safely (Lisp_Object buffer)
     if (candidate_buffer (buf, buffer))
       return buf;
 
-  return safe_call (1, Qget_scratch_buffer_create);
+  /* This function must return a valid buffer, since it is frequently
+     our last line of defense in the face of the expected buffers
+     becoming dead under our feet.  safe_call below could return nil
+     if recreating *scratch* in Lisp, which does some fancy stuff,
+     signals an error in some weird use case.  */
+  buf = safe_call (1, Qget_scratch_buffer_create);
+  if (NILP (buf))
+    {
+      AUTO_STRING (scratch, "*scratch*");
+      buf = Fget_buffer_create (scratch, Qnil);
+      Fset_buffer_major_mode (buf);
+    }
+  return buf;
 }
 
 DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo,
@@ -3899,11 +3910,11 @@ the value is (point-min).  */)
 /* These functions are for debugging overlays.  */
 
 DEFUN ("overlay-lists", Foverlay_lists, Soverlay_lists, 0, 0, 0,
-       doc: /* Return a pair of lists giving all the overlays of the current 
buffer.
-The car has all the overlays before the overlay center;
-the cdr has all the overlays after the overlay center.
-Recentering overlays moves overlays between these lists.
-The lists you get are copies, so that changing them has no effect.
+       doc: /* Return a list giving all the overlays of the current buffer.
+
+For backward compatibility, the value is actually a list that
+holds another list; the overlays are in the inner list.
+The list you get is a copy, so that changing it has no effect.
 However, the overlays you get are the real objects that the buffer uses. */)
   (void)
 {
@@ -3919,7 +3930,12 @@ However, the overlays you get are the real objects that 
the buffer uses. */)
 DEFUN ("overlay-recenter", Foverlay_recenter, Soverlay_recenter, 1, 1, 0,
        doc: /* Recenter the overlays of the current buffer around position POS.
 That makes overlay lookup faster for positions near POS (but perhaps slower
-for positions far away from POS).  */)
+for positions far away from POS).
+
+Since Emacs 29.1, this function is a no-op, because the implementation
+of overlays changed and their lookup is now fast regardless of their
+position in the buffer.  In particular, this function no longer affects
+the value returned by `overlay-lists'.  */)
   (Lisp_Object pos)
 {
   CHECK_FIXNUM_COERCE_MARKER (pos);
@@ -5898,7 +5914,42 @@ this threshold.
 If nil, these display shortcuts will always remain disabled.
 
 There is no reason to change that value except for debugging purposes.  */);
-  XSETFASTINT (Vlong_line_threshold, 10000);
+  XSETFASTINT (Vlong_line_threshold, 50000);
+
+  DEFVAR_INT ("long-line-locked-narrowing-region-size",
+             long_line_locked_narrowing_region_size,
+             doc: /* Region size for locked narrowing in buffers with long 
lines.
+
+This variable has effect only in buffers which contain one or more
+lines whose length is above `long-line-threshold', which see.  For
+performance reasons, in such buffers, low-level hooks such as
+`fontification-functions' or `post-command-hook' are executed on a
+narrowed buffer, with a narrowing locked with `narrowing-lock'.  This
+variable specifies the size of the narrowed region around point.
+
+To disable that narrowing, set this variable to 0.
+
+See also `long-line-locked-narrowing-bol-search-limit'.
+
+There is no reason to change that value except for debugging purposes.  */);
+  long_line_locked_narrowing_region_size = 500000;
+
+  DEFVAR_INT ("long-line-locked-narrowing-bol-search-limit",
+             long_line_locked_narrowing_bol_search_limit,
+             doc: /* Limit for beginning of line search in buffers with long 
lines.
+
+This variable has effect only in buffers which contain one or more
+lines whose length is above `long-line-threshold', which see.  For
+performance reasons, in such buffers, low-level hooks such as
+`fontification-functions' or `post-command-hook' are executed on a
+narrowed buffer, with a narrowing locked with `narrowing-lock'.  The
+variable `long-line-locked-narrowing-region-size' specifies the size
+of the narrowed region around point.  This variable, which should be a
+small integer, specifies the number of characters by which that region
+can be extended backwards to make it start at the beginning of a line.
+
+There is no reason to change that value except for debugging purposes.  */);
+  long_line_locked_narrowing_bol_search_limit = 128;
 
   DEFVAR_INT ("large-hscroll-threshold", large_hscroll_threshold,
     doc: /* Horizontal scroll of truncated lines above which to use redisplay 
shortcuts.
diff --git a/src/buffer.h b/src/buffer.h
index dded0cd98c..7c3d190314 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -149,18 +149,12 @@ enum { BEG = 1, BEG_BYTE = BEG };
 #define BUF_BEG_UNCHANGED(buf) ((buf)->text->beg_unchanged)
 #define BUF_END_UNCHANGED(buf) ((buf)->text->end_unchanged)
 
-#define BUF_CHARS_UNCHANGED_MODIFIED(buf) \
-  ((buf)->text->chars_unchanged_modified)
-
 #define UNCHANGED_MODIFIED \
   BUF_UNCHANGED_MODIFIED (current_buffer)
 #define OVERLAY_UNCHANGED_MODIFIED \
   BUF_OVERLAY_UNCHANGED_MODIFIED (current_buffer)
 #define BEG_UNCHANGED BUF_BEG_UNCHANGED (current_buffer)
 #define END_UNCHANGED BUF_END_UNCHANGED (current_buffer)
-
-#define CHARS_UNCHANGED_MODIFIED \
-  BUF_CHARS_UNCHANGED_MODIFIED (current_buffer)
 
 /* Functions to set PT in the current buffer, or another buffer.  */
 
@@ -274,11 +268,6 @@ struct buffer_text
        end_unchanged contain no useful information.  */
     modiff_count overlay_unchanged_modified;
 
-    /* CHARS_MODIFF as of last redisplay that finished.  It's used
-       when we only care about changes in actual buffer text, not in
-       any other kind of changes, like properties etc.  */
-    modiff_count chars_unchanged_modified;
-
     /* Properties of this buffer's text.  */
     INTERVAL intervals;
 
@@ -1277,8 +1266,7 @@ set_buffer_intervals (struct buffer *b, INTERVAL i)
 INLINE bool
 buffer_has_overlays (void)
 {
-  return current_buffer->overlays
-         && (current_buffer->overlays->root != NULL);
+  return !itree_empty_p (current_buffer->overlays);
 }
 
 /* Functions for accessing a character or byte,
diff --git a/src/data.c b/src/data.c
index c6b85e17bc..7ad06a9faa 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2619,6 +2619,7 @@ bool-vector.  IDX starts at 0.  */)
     }
   else if (RECORDP (array))
     {
+      CHECK_IMPURE (array, XVECTOR (array));
       if (idxval < 0 || idxval >= PVSIZE (array))
        args_out_of_range (array, idx);
       ASET (array, idxval, newelt);
diff --git a/src/dispextern.h b/src/dispextern.h
index 2afbdeabaa..df6134e68f 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2342,6 +2342,14 @@ struct it
      optimize display.  */
   ptrdiff_t narrowed_zv;
 
+  /* Begin position of the buffer for the locked narrowing around
+     low-level hooks.  */
+  ptrdiff_t locked_narrowing_begv;
+
+  /* End position of the buffer for the locked narrowing around
+     low-level hooks.  */
+  ptrdiff_t locked_narrowing_zv;
+
   /* C string to iterate over.  Non-null means get characters from
      this string, otherwise characters are read from current_buffer
      or it->string.  */
@@ -3405,6 +3413,8 @@ void init_iterator (struct it *, struct window *, 
ptrdiff_t,
 ptrdiff_t get_narrowed_begv (struct window *, ptrdiff_t);
 ptrdiff_t get_narrowed_zv (struct window *, ptrdiff_t);
 ptrdiff_t get_closer_narrowed_begv (struct window *, ptrdiff_t);
+ptrdiff_t get_locked_narrowing_begv (ptrdiff_t);
+ptrdiff_t get_locked_narrowing_zv (ptrdiff_t);
 void init_iterator_to_row_start (struct it *, struct window *,
                                  struct glyph_row *);
 void start_display (struct it *, struct window *, struct text_pos);
diff --git a/src/editfns.c b/src/editfns.c
index 17dca4708e..8d56ef21d9 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2653,88 +2653,216 @@ DEFUN ("delete-and-extract-region", 
Fdelete_and_extract_region,
   return del_range_1 (XFIXNUM (start), XFIXNUM (end), 1, 1);
 }
 
-DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
-       doc: /* Remove restrictions (narrowing) from current buffer.
-This allows the buffer's full text to be seen and edited.
+/* Alist of buffers in which locked narrowing is used.  The car of
+   each list element is a buffer, the cdr is a list of triplets (tag
+   begv-marker zv-marker).  The last element of that list always uses
+   the (uninterned) Qoutermost_narrowing tag and records the narrowing
+   bounds that were set by the user and that are visible on display.
+   This alist is used internally by narrow-to-region, widen,
+   narrowing-lock, narrowing-unlock and save-restriction.  */
+static Lisp_Object narrowing_locks;
+
+/* Add BUF with its LOCKS in the narrowing_locks alist.  */
+static void
+narrowing_locks_add (Lisp_Object buf, Lisp_Object locks)
+{
+  narrowing_locks = nconc2 (list1 (list2 (buf, locks)), narrowing_locks);
+}
 
-Note that, when the current buffer contains one or more lines whose
-length is above `long-line-threshold', Emacs may decide to leave, for
-performance reasons, the accessible portion of the buffer unchanged
-after this function is called from low-level hooks, such as
-`jit-lock-functions' or `post-command-hook'.  */)
-  (void)
+/* Remove BUF and its locks from the narrowing_locks alist.  Do
+   nothing if BUF is not present in narrowing_locks.  */
+static void
+narrowing_locks_remove (Lisp_Object buf)
+{
+  narrowing_locks = Fdelq (Fassoc (buf, narrowing_locks, Qnil),
+                          narrowing_locks);
+}
+
+/* Retrieve one of the BEGV/ZV bounds of a narrowing in BUF from the
+   narrowing_locks alist, as a pointer to a struct Lisp_Marker, or
+   NULL if BUF is not in narrowing_locks or is a killed buffer.  When
+   OUTERMOST is true, the bounds that were set by the user and that
+   are visible on display are returned.  Otherwise the innermost
+   locked narrowing bounds are returned.  */
+static struct Lisp_Marker *
+narrowing_lock_get_bound (Lisp_Object buf, bool begv, bool outermost)
+{
+  if (NILP (Fbuffer_live_p (buf)))
+    return NULL;
+  Lisp_Object buffer_locks = assq_no_quit (buf, narrowing_locks);
+  if (NILP (buffer_locks))
+    return NULL;
+  buffer_locks = XCAR (XCDR (buffer_locks));
+  Lisp_Object bounds
+    = outermost
+      ? XCDR (assq_no_quit (Qoutermost_narrowing, buffer_locks))
+      : XCDR (XCAR (buffer_locks));
+  eassert (! NILP (bounds));
+  Lisp_Object marker = begv ? XCAR (bounds) : XCAR (XCDR (bounds));
+  eassert (EQ (Fmarker_buffer (marker), buf));
+  return XMARKER (marker);
+}
+
+/* Retrieve the tag of the innermost narrowing in BUF.  Return nil if
+   BUF is not in narrowing_locks or is a killed buffer.  */
+static Lisp_Object
+narrowing_lock_peek_tag (Lisp_Object buf)
 {
-  if (! NILP (Vrestrictions_locked))
+  if (NILP (Fbuffer_live_p (buf)))
     return Qnil;
-  if (BEG != BEGV || Z != ZV)
-    current_buffer->clip_changed = 1;
-  BEGV = BEG;
-  BEGV_BYTE = BEG_BYTE;
-  SET_BUF_ZV_BOTH (current_buffer, Z, Z_BYTE);
-  /* Changing the buffer bounds invalidates any recorded current column.  */
-  invalidate_current_column ();
-  return Qnil;
+  Lisp_Object buffer_locks = assq_no_quit (buf, narrowing_locks);
+  if (NILP (buffer_locks))
+    return Qnil;
+  Lisp_Object tag = XCAR (XCAR (XCAR (XCDR (buffer_locks))));
+  eassert (! NILP (tag));
+  return tag;
 }
 
+/* Add a LOCK for BUF in the narrowing_locks alist.  */
 static void
-unwind_locked_begv (Lisp_Object point_min)
+narrowing_lock_push (Lisp_Object buf, Lisp_Object lock)
 {
-  SET_BUF_BEGV (current_buffer, XFIXNUM (point_min));
+  Lisp_Object buffer_locks = assq_no_quit (buf, narrowing_locks);
+  if (NILP (buffer_locks))
+    narrowing_locks_add (buf, list1 (lock));
+  else
+    XSETCDR (buffer_locks, list1 (nconc2 (list1 (lock),
+                                         XCAR (XCDR (buffer_locks)))));
 }
 
+/* Remove the innermost lock in BUF from the narrowing_locks alist.
+   Do nothing if BUF is not present in narrowing_locks.  */
 static void
-unwind_locked_zv (Lisp_Object point_max)
+narrowing_lock_pop (Lisp_Object buf)
 {
-  SET_BUF_ZV (current_buffer, XFIXNUM (point_max));
+  Lisp_Object buffer_locks = assq_no_quit (buf, narrowing_locks);
+  if (NILP (buffer_locks))
+    return;
+  if (EQ (narrowing_lock_peek_tag (buf), Qoutermost_narrowing))
+    narrowing_locks_remove (buf);
+  else
+    XSETCDR (buffer_locks, list1 (XCDR (XCAR (XCDR (buffer_locks)))));
 }
 
-/* Internal function for Fnarrow_to_region, meant to be used with a
-   third argument 'true', in which case it should be followed by "specbind
-   (Qrestrictions_locked, Qt)".  */
-Lisp_Object
-narrow_to_region_internal (Lisp_Object start, Lisp_Object end, bool lock)
+static void
+unwind_reset_outermost_narrowing (Lisp_Object buf)
 {
-  EMACS_INT s = fix_position (start), e = fix_position (end);
-
-  if (e < s)
+  struct Lisp_Marker *begv = narrowing_lock_get_bound (buf, true, false);
+  struct Lisp_Marker *zv = narrowing_lock_get_bound (buf, false, false);
+  if (begv != NULL && zv != NULL)
     {
-      EMACS_INT tem = s; s = e; e = tem;
+      SET_BUF_BEGV_BOTH (XBUFFER (buf), begv->charpos, begv->bytepos);
+      SET_BUF_ZV_BOTH (XBUFFER (buf), zv->charpos, zv->bytepos);
     }
+  else
+    narrowing_locks_remove (buf);
+}
 
-  if (lock)
+/* Restore the narrowing bounds that were set by the user, and restore
+   the bounds of the locked narrowing upon return.
+   In particular, this function is called when redisplay starts, so
+   that if a Lisp function executed during redisplay calls (redisplay)
+   while a locked narrowing is in effect, the locked narrowing will
+   not be visible on display.  */
+void
+reset_outermost_narrowings (void)
+{
+  Lisp_Object val, buf;
+  for (val = narrowing_locks; CONSP (val); val = XCDR (val))
     {
-      if (!(BEGV <= s && s <= e && e <= ZV))
-       args_out_of_range (start, end);
+      buf = XCAR (XCAR (val));
+      eassert (BUFFERP (buf));
+      struct Lisp_Marker *begv = narrowing_lock_get_bound (buf, true, true);
+      struct Lisp_Marker *zv = narrowing_lock_get_bound (buf, false, true);
+      if (begv != NULL && zv != NULL)
+       {
+         SET_BUF_BEGV_BOTH (XBUFFER (buf), begv->charpos, begv->bytepos);
+         SET_BUF_ZV_BOTH (XBUFFER (buf), zv->charpos, zv->bytepos);
+         record_unwind_protect (unwind_reset_outermost_narrowing, buf);
+       }
+      else
+       narrowing_locks_remove (buf);
+    }
+}
 
-      if (BEGV != s || ZV != e)
-       current_buffer->clip_changed = 1;
+/* Helper functions to save and restore the narrowing locks of the
+   current buffer in Fsave_restriction.  */
+static Lisp_Object
+narrowing_locks_save (void)
+{
+  Lisp_Object buf = Fcurrent_buffer ();
+  Lisp_Object locks = assq_no_quit (buf, narrowing_locks);
+  if (NILP (locks))
+    return Qnil;
+  locks = XCAR (XCDR (locks));
+  return Fcons (buf, Fcopy_sequence (locks));
+}
 
-      record_unwind_protect (restore_point_unwind, Fpoint_marker ());
-      record_unwind_protect (unwind_locked_begv, Fpoint_min ());
-      record_unwind_protect (unwind_locked_zv, Fpoint_max ());
+static void
+narrowing_locks_restore (Lisp_Object buf_and_saved_locks)
+{
+  if (NILP (buf_and_saved_locks))
+    return;
+  Lisp_Object buf = XCAR (buf_and_saved_locks);
+  Lisp_Object saved_locks = XCDR (buf_and_saved_locks);
+  narrowing_locks_remove (buf);
+  narrowing_locks_add (buf, saved_locks);
+}
 
-      SET_BUF_BEGV (current_buffer, s);
-      SET_BUF_ZV (current_buffer, e);
+static void
+unwind_narrow_to_region_locked (Lisp_Object tag)
+{
+  Fnarrowing_unlock (tag);
+  Fwiden ();
+}
+
+/* Narrow current_buffer to BEGV-ZV with a narrowing locked with TAG.  */
+void
+narrow_to_region_locked (Lisp_Object begv, Lisp_Object zv, Lisp_Object tag)
+{
+  Fnarrow_to_region (begv, zv);
+  Fnarrowing_lock (tag);
+  record_unwind_protect (restore_point_unwind, Fpoint_marker ());
+  record_unwind_protect (unwind_narrow_to_region_locked, tag);
+}
+
+DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
+       doc: /* Remove restrictions (narrowing) from current buffer.
+
+This allows the buffer's full text to be seen and edited, unless
+restrictions have been locked with `narrowing-lock', which see, in
+which case the narrowing that was current when `narrowing-lock' was
+called is restored.  */)
+  (void)
+{
+  Fset (Qoutermost_narrowing, Qnil);
+  Lisp_Object buf = Fcurrent_buffer ();
+  Lisp_Object tag = narrowing_lock_peek_tag (buf);
+
+  if (NILP (tag))
+    {
+      if (BEG != BEGV || Z != ZV)
+       current_buffer->clip_changed = 1;
+      BEGV = BEG;
+      BEGV_BYTE = BEG_BYTE;
+      SET_BUF_ZV_BOTH (current_buffer, Z, Z_BYTE);
     }
   else
     {
-      if (! NILP (Vrestrictions_locked))
-       return Qnil;
-
-      if (!(BEG <= s && s <= e && e <= Z))
-       args_out_of_range (start, end);
-
-      if (BEGV != s || ZV != e)
+      struct Lisp_Marker *begv = narrowing_lock_get_bound (buf, true, false);
+      struct Lisp_Marker *zv = narrowing_lock_get_bound (buf, false, false);
+      eassert (begv != NULL && zv != NULL);
+      if (begv->charpos != BEGV || zv->charpos != ZV)
        current_buffer->clip_changed = 1;
-
-      SET_BUF_BEGV (current_buffer, s);
-      SET_BUF_ZV (current_buffer, e);
+      SET_BUF_BEGV_BOTH (current_buffer, begv->charpos, begv->bytepos);
+      SET_BUF_ZV_BOTH (current_buffer, zv->charpos, zv->bytepos);
+      /* If the only remaining bounds in narrowing_locks for
+        current_buffer are the bounds that were set by the user, no
+        locked narrowing is in effect in current_buffer anymore:
+        remove it from the narrowing_locks alist.  */
+      if (EQ (tag, Qoutermost_narrowing))
+       narrowing_lock_pop (buf);
     }
-
-  if (PT < s)
-    SET_PT (s);
-  if (e < PT)
-    SET_PT (e);
   /* Changing the buffer bounds invalidates any recorded current column.  */
   invalidate_current_column ();
   return Qnil;
@@ -2751,14 +2879,110 @@ When calling from Lisp, pass two arguments START and 
END:
 positions (integers or markers) bounding the text that should
 remain visible.
 
-Note that, when the current buffer contains one or more lines whose
-length is above `long-line-threshold', Emacs may decide to leave, for
-performance reasons, the accessible portion of the buffer unchanged
-after this function is called from low-level hooks, such as
-`jit-lock-functions' or `post-command-hook'.  */)
+When restrictions have been locked with `narrowing-lock', which see,
+`narrow-to-region' can be used only within the limits of the
+restrictions that were current when `narrowing-lock' was called.  If
+the START or END arguments are outside these limits, the corresponding
+limit of the locked restriction is used instead of the argument.  */)
   (Lisp_Object start, Lisp_Object end)
 {
-  return narrow_to_region_internal (start, end, false);
+  EMACS_INT s = fix_position (start), e = fix_position (end);
+
+  if (e < s)
+    {
+      EMACS_INT tem = s; s = e; e = tem;
+    }
+
+  if (!(BEG <= s && s <= e && e <= Z))
+    args_out_of_range (start, end);
+
+  Lisp_Object buf = Fcurrent_buffer ();
+  if (! NILP (narrowing_lock_peek_tag (buf)))
+    {
+      struct Lisp_Marker *begv = narrowing_lock_get_bound (buf, true, false);
+      struct Lisp_Marker *zv = narrowing_lock_get_bound (buf, false, false);
+      eassert (begv != NULL && zv != NULL);
+      /* Limit the start and end positions to those of the locked
+        narrowing.  */
+      if (s < begv->charpos) s = begv->charpos;
+      if (s > zv->charpos) s = zv->charpos;
+      if (e < begv->charpos) e = begv->charpos;
+      if (e > zv->charpos) e = zv->charpos;
+    }
+
+  /* Record the accessible range of the buffer when narrow-to-region
+     is called, that is, before applying the narrowing.  It is used
+     only by narrowing-lock.  */
+  Fset (Qoutermost_narrowing, list3 (Qoutermost_narrowing,
+                                    Fpoint_min_marker (),
+                                    Fpoint_max_marker ()));
+
+  if (BEGV != s || ZV != e)
+    current_buffer->clip_changed = 1;
+
+  SET_BUF_BEGV (current_buffer, s);
+  SET_BUF_ZV (current_buffer, e);
+
+  if (PT < s)
+    SET_PT (s);
+  if (e < PT)
+    SET_PT (e);
+  /* Changing the buffer bounds invalidates any recorded current column.  */
+  invalidate_current_column ();
+  return Qnil;
+}
+
+DEFUN ("narrowing-lock", Fnarrowing_lock, Snarrowing_lock, 1, 1, 0,
+       doc: /* Lock the current narrowing with TAG.
+
+When restrictions are locked, `narrow-to-region' and `widen' can be
+used only within the limits of the restrictions that were current when
+`narrowing-lock' was called, unless the lock is removed by calling
+`narrowing-unlock' with TAG.
+
+Locking restrictions should be used sparingly, after carefully
+considering the potential adverse effects on the code that will be
+executed within locked restrictions.  It is typically meant to be used
+around portions of code that would become too slow, and make Emacs
+unresponsive, if they were executed in a large buffer.  For example,
+restrictions are locked by Emacs around low-level hooks such as
+`fontification-functions' or `post-command-hook'.
+
+Locked restrictions are never visible on display, and can therefore
+not be used as a stronger variant of normal restrictions.  */)
+  (Lisp_Object tag)
+{
+  Lisp_Object buf = Fcurrent_buffer ();
+  Lisp_Object outermost_narrowing
+    = buffer_local_value (Qoutermost_narrowing, buf);
+  /* If narrowing-lock is called without being preceded by
+     narrow-to-region, do nothing.  */
+  if (NILP (outermost_narrowing))
+    return Qnil;
+  if (NILP (narrowing_lock_peek_tag (buf)))
+    narrowing_lock_push (buf, outermost_narrowing);
+  narrowing_lock_push (buf, list3 (tag,
+                                  Fpoint_min_marker (),
+                                  Fpoint_max_marker ()));
+  return Qnil;
+}
+
+DEFUN ("narrowing-unlock", Fnarrowing_unlock, Snarrowing_unlock, 1, 1, 0,
+       doc: /* Unlock a narrowing locked with (narrowing-lock TAG).
+
+Unlocking restrictions locked with `narrowing-lock' should be used
+sparingly, after carefully considering the reasons why restrictions
+were locked.  Restrictions are typically locked around portions of
+code that would become too slow, and make Emacs unresponsive, if they
+were executed in a large buffer.  For example, restrictions are locked
+by Emacs around low-level hooks such as `fontification-functions' or
+`post-command-hook'.  */)
+  (Lisp_Object tag)
+{
+  Lisp_Object buf = Fcurrent_buffer ();
+  if (EQ (narrowing_lock_peek_tag (buf), tag))
+    narrowing_lock_pop (buf);
+  return Qnil;
 }
 
 Lisp_Object
@@ -2858,11 +3082,12 @@ DEFUN ("save-restriction", Fsave_restriction, 
Ssave_restriction, 0, UNEVALLED, 0
        doc: /* Execute BODY, saving and restoring current buffer's 
restrictions.
 The buffer's restrictions make parts of the beginning and end invisible.
 \(They are set up with `narrow-to-region' and eliminated with `widen'.)
-This special form, `save-restriction', saves the current buffer's restrictions
-when it is entered, and restores them when it is exited.
+This special form, `save-restriction', saves the current buffer's
+restrictions, as well as their locks if they have been locked with
+`narrowing-lock', when it is entered, and restores them when it is exited.
 So any `narrow-to-region' within BODY lasts only until the end of the form.
-The old restrictions settings are restored
-even in case of abnormal exit (throw or error).
+The old restrictions settings are restored even in case of abnormal exit
+\(throw or error).
 
 The value returned is the value of the last form in BODY.
 
@@ -2877,6 +3102,7 @@ usage: (save-restriction &rest BODY)  */)
   specpdl_ref count = SPECPDL_INDEX ();
 
   record_unwind_protect (save_restriction_restore, save_restriction_save ());
+  record_unwind_protect (narrowing_locks_restore, narrowing_locks_save ());
   val = Fprogn (body);
   return unbind_to (count, val);
 }
@@ -3053,18 +3279,18 @@ The other arguments are substituted into it to make the 
result, a string.
 The format control string may contain %-sequences meaning to substitute
 the next available argument, or the argument explicitly specified:
 
-%s means print a string argument.  Actually, prints any object, with `princ'.
-%d means print as signed number in decimal.
-%o means print a number in octal.
-%x means print a number in hex.
+%s means produce a string argument.  Actually, produces any object with 
`princ'.
+%d means produce as signed number in decimal.
+%o means produce a number in octal.
+%x means produce a number in hex.
 %X is like %x, but uses upper case.
-%e means print a number in exponential notation.
-%f means print a number in decimal-point notation.
-%g means print a number in exponential notation if the exponent would be
+%e means produce a number in exponential notation.
+%f means produce a number in decimal-point notation.
+%g means produce a number in exponential notation if the exponent would be
    less than -4 or greater than or equal to the precision (default: 6);
-   otherwise it prints in decimal-point notation.
-%c means print a number as a single character.
-%S means print any object as an s-expression (using `prin1').
+   otherwise it produces in decimal-point notation.
+%c means produce a number as a single character.
+%S means produce any object as an s-expression (using `prin1').
 
 The argument used for %d, %o, %x, %e, %f, %g or %c must be a number.
 %o, %x, and %X treat arguments as unsigned if `binary-as-unsigned' is t
@@ -3099,7 +3325,7 @@ included even if the precision is zero, and also forces 
trailing
 zeros after the decimal point to be left in place.
 
 The width specifier supplies a lower limit for the length of the
-printed representation.  The padding, if any, normally goes on the
+produced representation.  The padding, if any, normally goes on the
 left, but it goes on the right if the - flag is present.  The padding
 character is normally a space, but it is 0 if the 0 flag is present.
 The 0 flag is ignored if the - flag is present, or the format sequence
@@ -3108,7 +3334,7 @@ is something other than %d, %o, %x, %e, %f, and %g.
 For %e and %f sequences, the number after the "." in the precision
 specifier says how many decimal places to show; if zero, the decimal
 point itself is omitted.  For %g, the precision specifies how many
-significant digits to print; zero or omitted are treated as 1.
+significant digits to produce; zero or omitted are treated as 1.
 For %s and %S, the precision specifier truncates the string to the
 given width.
 
@@ -4518,6 +4744,8 @@ syms_of_editfns (void)
   DEFSYM (Qwall, "wall");
   DEFSYM (Qpropertize, "propertize");
 
+  staticpro (&narrowing_locks);
+
   DEFVAR_LISP ("inhibit-field-text-motion", Vinhibit_field_text_motion,
               doc: /* Non-nil means text motion commands don't notice fields.  
*/);
   Vinhibit_field_text_motion = Qnil;
@@ -4577,11 +4805,12 @@ This variable is experimental; email 
32252@debbugs.gnu.org if you need
 it to be non-nil.  */);
   binary_as_unsigned = false;
 
-  DEFSYM (Qrestrictions_locked, "restrictions-locked");
-  DEFVAR_LISP ("restrictions-locked", Vrestrictions_locked,
-              doc: /* If non-nil, restrictions are currently locked.  */);
-  Vrestrictions_locked = Qnil;
-  Funintern (Qrestrictions_locked, Qnil);
+  DEFVAR_LISP ("outermost-narrowing", Voutermost_narrowing,
+              doc: /* Outermost narrowing bounds, if any.  Internal use only.  
*/);
+  Voutermost_narrowing = Qnil;
+  Fmake_variable_buffer_local (Qoutermost_narrowing);
+  DEFSYM (Qoutermost_narrowing, "outermost-narrowing");
+  Funintern (Qoutermost_narrowing, Qnil);
 
   defsubr (&Spropertize);
   defsubr (&Schar_equal);
@@ -4674,6 +4903,8 @@ it to be non-nil.  */);
   defsubr (&Sdelete_and_extract_region);
   defsubr (&Swiden);
   defsubr (&Snarrow_to_region);
+  defsubr (&Snarrowing_lock);
+  defsubr (&Snarrowing_unlock);
   defsubr (&Ssave_restriction);
   defsubr (&Stranspose_regions);
 }
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index bef89b059f..d485de5aa1 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -183,6 +183,21 @@ struct emacs_env_29
 @module_env_snippet_29@
 };
 
+struct emacs_env_30
+{
+@module_env_snippet_25@
+
+@module_env_snippet_26@
+
+@module_env_snippet_27@
+
+@module_env_snippet_28@
+
+@module_env_snippet_29@
+
+@module_env_snippet_30@
+};
+
 /* Every module should define a function as follows.  */
 extern int emacs_module_init (struct emacs_runtime *runtime)
   EMACS_NOEXCEPT
diff --git a/src/emacs.c b/src/emacs.c
index 105539aa19..d8a2863fd9 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -295,6 +295,7 @@ Initialization options:\n\
 --no-site-lisp, -nsl        do not add site-lisp directories to load-path\n\
 --no-splash                 do not display a splash screen on startup\n\
 --no-window-system, -nw     do not communicate with X, ignoring $DISPLAY\n\
+--init-directory=DIR        use DIR when looking for the Emacs init files.\n\
 ",
     "\
 --quick, -Q                 equivalent to:\n\
@@ -1923,6 +1924,12 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
         Vcoding_system_hash_table.  */
       syms_of_coding ();       /* This should be after syms_of_fileio.  */
       init_frame_once ();       /* Before init_window_once.  */
+      /* init_window_once calls make_initial_frame, which calls
+        Fcurrent_time and bset_display_time, both of which allocate
+        bignums.  Without the following call to init_bignums, crashes
+        happen on Windows 9X after dumping when GC tries to free a
+        pointer allocated on the system heap.  */
+      init_bignum ();
       init_window_once ();     /* Init the window system.  */
 #ifdef HAVE_WINDOW_SYSTEM
       init_fringe_once ();     /* Swap bitmaps if necessary.  */
diff --git a/src/fileio.c b/src/fileio.c
index 92335b639c..e7c2af8142 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -134,6 +134,7 @@ static dev_t timestamp_file_system;
    is added here.  */
 static Lisp_Object Vwrite_region_annotation_buffers;
 
+static Lisp_Object emacs_readlinkat (int, char const *);
 static Lisp_Object file_name_directory (Lisp_Object);
 static bool a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
                     Lisp_Object *, struct coding_system *);
@@ -2219,7 +2220,7 @@ permissions.  */)
       report_file_error ("Copying permissions to", newname);
     }
 #else /* not WINDOWSNT */
-  ifd = emacs_open (SSDATA (encoded_file), O_RDONLY, 0);
+  ifd = emacs_open (SSDATA (encoded_file), O_RDONLY | O_NONBLOCK, 0);
 
   if (ifd < 0)
     report_file_error ("Opening input file", file);
@@ -2427,16 +2428,11 @@ DEFUN ("make-directory-internal", 
Fmake_directory_internal,
   (Lisp_Object directory)
 {
   const char *dir;
-  Lisp_Object handler;
   Lisp_Object encoded_dir;
 
   CHECK_STRING (directory);
   directory = Fexpand_file_name (directory, Qnil);
 
-  handler = Ffind_file_name_handler (directory, Qmake_directory_internal);
-  if (!NILP (handler))
-    return call2 (handler, Qmake_directory_internal, directory);
-
   encoded_dir = ENCODE_FILE (directory);
 
   dir = SSDATA (encoded_dir);
@@ -2710,31 +2706,19 @@ This is what happens in interactive use with M-x.  */)
     }
   if (dirp)
     call4 (Qcopy_directory, file, newname, Qt, Qnil);
-  else
-    {
-      Lisp_Object symlink_target
-       = (S_ISLNK (file_st.st_mode)
-          ? check_emacs_readlinkat (AT_FDCWD, file, SSDATA (encoded_file))
-          : Qnil);
-      if (!NILP (symlink_target))
-       Fmake_symbolic_link (symlink_target, newname, ok_if_already_exists);
-      else if (S_ISFIFO (file_st.st_mode))
-       {
-         /* If it's a FIFO, calling `copy-file' will hang if it's a
-            inter-file system move, so do it here.  (It will signal
-            an error in that case, but it won't hang in any case.)  */
-         if (!NILP (ok_if_already_exists))
-           barf_or_query_if_file_exists (newname, false,
-                                         "rename to it",
-                                         FIXNUMP (ok_if_already_exists),
-                                         false);
-         if (rename (SSDATA (encoded_file), SSDATA (encoded_newname)) != 0)
-           report_file_errno ("Renaming", list2 (file, newname), errno);
-         return Qnil;
-       }
+  else if (S_ISREG (file_st.st_mode))
+    Fcopy_file (file, newname, ok_if_already_exists, Qt, Qt, Qt);
+  else if (S_ISLNK (file_st.st_mode))
+    {
+      Lisp_Object target = emacs_readlinkat (AT_FDCWD,
+                                            SSDATA (encoded_file));
+      if (!NILP (target))
+       Fmake_symbolic_link (target, newname, ok_if_already_exists);
       else
-       Fcopy_file (file, newname, ok_if_already_exists, Qt, Qt, Qt);
+       report_file_error ("Renaming", list2 (file, newname));
     }
+  else
+    report_file_errno ("Renaming", list2 (file, newname), rename_errno);
 
   specpdl_ref count = SPECPDL_INDEX ();
   specbind (Qdelete_by_moving_to_trash, Qnil);
diff --git a/src/fns.c b/src/fns.c
index 7cc6d00afe..eeb65cadf3 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -334,7 +334,9 @@ Letter-case is significant, but text properties are 
ignored. */)
 DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0,
        doc: /* Return t if two strings have identical contents.
 Case is significant, but text properties are ignored.
-Symbols are also allowed; their print names are used instead.  */)
+Symbols are also allowed; their print names are used instead.
+
+See also `string-equal-ignore-case'.  */)
   (register Lisp_Object s1, Lisp_Object s2)
 {
   if (SYMBOLP (s1))
@@ -495,8 +497,13 @@ Symbols are also allowed; their print names are used 
instead.  */)
          int ws = sizeof (word_t);
          const word_t *w1 = (const word_t *) SDATA (string1);
          const word_t *w2 = (const word_t *) SDATA (string2);
-         while (b < nb - ws + 1 && w1[b / ws] == w2[b / ws])
-           b += ws;
+         while (b < nb - ws + 1)
+           {
+             if (UNALIGNED_LOAD_SIZE (w1, b / ws)
+                 != UNALIGNED_LOAD_SIZE (w2, b / ws))
+               break;
+             b += ws;
+           }
        }
 
       /* Scan forward to the differing byte.  */
@@ -3936,7 +3943,7 @@ system.
 If the region can't be decoded, signal an error and don't modify the buffer.
 Optional third argument BASE64URL determines whether to use the URL variant
 of the base 64 encoding, as defined in RFC 4648.
-If optional fourth argument INGORE-INVALID is non-nil invalid characters
+If optional fourth argument IGNORE-INVALID is non-nil invalid characters
 are ignored instead of signaling an error.  */)
      (Lisp_Object beg, Lisp_Object end, Lisp_Object base64url,
       Lisp_Object ignore_invalid)
diff --git a/src/frame.c b/src/frame.c
index b57b296be5..7d902dabd4 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1892,12 +1892,61 @@ other_frames (struct frame *f, bool invisible, bool 
force)
 
       if (f != f1)
        {
+         /* The following code is defined out because it is
+            responsible for a performance drop under X connections
+            over a network, and its purpose is unclear.  XSync does
+            not handle events (or call any callbacks defined by
+            Emacs), and as such it should not note any "recent change
+            in visibility".
+
+            When writing new code, please try as hard as possible to
+            avoid calls that require a roundtrip to the X server.
+            When such calls are inevitable, use the XCB library to
+            handle multiple consecutive requests with a data reply in
+            a more asynchronous fashion.  The following code
+            demonstrates why:
+
+              rc = XGetWindowProperty (dpyinfo->display, window, ...
+              status = XGrabKeyboard (dpyinfo->display, ...
+
+            here, `XGetWindowProperty' will wait for a reply from the
+            X server before returning, and thus allowing Emacs to
+            make the XGrabKeyboard request, which in itself also
+            requires waiting a reply.  When XCB is available, this
+            code could be written:
+
+#ifdef HAVE_XCB
+              xcb_get_property_cookie_t cookie1;
+              xcb_get_property_reply_t *reply1;
+              xcb_grab_keyboard_cookie_t cookie2;
+              xcb_grab_keyboard_reply_t *reply2;
+
+              cookie1 = xcb_get_property (dpyinfo->xcb_connection, window, ...
+              cookie2 = xcb_grab_keyboard (dpyinfo->xcb_connection, ...
+              reply1 = xcb_get_property_reply (dpyinfo->xcb_connection,
+                                               cookie1);
+              reply2 = xcb_grab_keyboard_reply (dpyinfo->xcb_connection,
+                                               cookie2);
+#endif
+
+            In this code, the GetProperty and GrabKeyboard requests
+            are made simultaneously, and replies are then obtained
+            from the server at once, avoiding the extraneous
+            roundtrip to the X server after the call to
+            `XGetWindowProperty'.
+
+            However, please keep an alternative implementation
+            available for use when Emacs is built without XCB.  */
+
+#if 0
          /* Verify that we can still talk to the frame's X window, and
             note any recent change in visibility.  */
 #ifdef HAVE_X_WINDOWS
          if (FRAME_WINDOW_P (f1))
            x_sync (f1);
 #endif
+#endif
+
          if (!FRAME_TOOLTIP_P (f1)
              /* Tooltips and child frames count neither for
                 invisibility nor for deletions.  */
@@ -2214,17 +2263,24 @@ 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 || terminal->type == output_pgtk))
+    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)
       {
        Lisp_Object tmp;
        XSETTERMINAL (tmp, terminal);
 
         kb = NULL;
-       Fdelete_terminal (tmp, NILP (force) ? Qt : force);
+
+       /* If force is noelisp, the terminal is going away inside
+          x_delete_terminal, and a recursive call to Fdelete_terminal
+          is unsafe!  */
+       if (!EQ (force, Qnoelisp))
+         Fdelete_terminal (tmp, NILP (force) ? Qt : force);
       }
     else
       kb = terminal->kboard;
diff --git a/src/frame.h b/src/frame.h
index d6fd62b2ac..dcd32036b8 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1718,7 +1718,6 @@ extern void x_wm_set_icon_position (struct frame *, int, 
int);
 #if !defined USE_X_TOOLKIT
 extern const char *x_get_resource_string (const char *, const char *);
 #endif
-extern void x_sync (struct frame *);
 #endif /* HAVE_X_WINDOWS */
 
 #if !defined (HAVE_NS) && !defined (HAVE_PGTK)
diff --git a/src/gnutls.c b/src/gnutls.c
index 7f0aaf85a4..4093865cae 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -2282,7 +2282,7 @@ gnutls_symmetric_aead (bool encrypting, 
gnutls_cipher_algorithm_t gca,
   Lisp_Object output;
   if (GNUTLS_E_SUCCESS <= ret)
     output = make_unibyte_string (storage, storage_length);
-  explicit_bzero (storage, storage_length);
+  memset_explicit (storage, 0, storage_length);
   gnutls_aead_cipher_deinit (acipher);
 
   if (ret < GNUTLS_E_SUCCESS)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index a6bba096a4..592bb49774 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -2103,7 +2103,7 @@ xg_frame_restack (struct frame *f1, struct frame *f2, 
bool above_flag)
 
       gdk_window_restack (gwin1, gwin2, above_flag);
 #ifndef HAVE_PGTK
-      x_sync (f1);
+      XSync (FRAME_X_DISPLAY (f1), False);
 #else
       gdk_flush ();
 #endif
@@ -4793,7 +4793,7 @@ xg_update_scrollbar_pos (struct frame *f,
          here to get some events.  */
 
 #ifndef HAVE_PGTK
-      x_sync (f);
+      XSync (FRAME_X_DISPLAY (f), False);
 #else
       gdk_flush ();
 #endif
@@ -4894,7 +4894,7 @@ xg_update_horizontal_scrollbar_pos (struct frame *f,
       }
 
 #ifndef HAVE_PGTK
-      x_sync (f);
+      XSync (FRAME_X_DISPLAY (f), False);
 #else
       gdk_flush ();
 #endif
diff --git a/src/image.c b/src/image.c
index 600c32571e..b881e43e95 100644
--- a/src/image.c
+++ b/src/image.c
@@ -193,8 +193,8 @@ static void anim_prune_animation_cache (Lisp_Object);
 #ifdef USE_CAIRO
 
 static Emacs_Pix_Container
-image_create_pix_container (struct frame *f, unsigned int width,
-                           unsigned int height, unsigned int depth)
+image_create_pix_container (unsigned int width, unsigned int height,
+                           unsigned int depth)
 {
   Emacs_Pix_Container pimg;
 
@@ -237,7 +237,7 @@ image_pix_container_create_from_bitmap_data (struct frame 
*f,
                                             unsigned long fg,
                                             unsigned long bg)
 {
-  Emacs_Pix_Container pimg = image_create_pix_container (f, width, height, 0);
+  Emacs_Pix_Container pimg = image_create_pix_container (width, height, 0);
   int bytes_per_line = (width + (CHAR_BIT - 1)) / CHAR_BIT;
 
   for (int y = 0; y < height; y++)
@@ -3342,7 +3342,7 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int 
width, int height, int d
   eassert (input_blocked_p ());
 
   /* Allocate a pixmap of the same size.  */
-  *pixmap = image_create_pix_container (f, width, height, depth);
+  *pixmap = image_create_pix_container (width, height, depth);
   if (*pixmap == NO_PIXMAP)
     {
       *pimg = NULL;
@@ -11309,6 +11309,15 @@ svg_load_image (struct frame *f, struct image *img, 
char *contents,
                                                    img->face_font_size);
          viewbox_height = svg_css_length_to_pixels (iheight, dpi,
                                                     img->face_font_size);
+
+         /* Here one dimension could be zero because in percent unit.
+            So calculate this dimension with the other.  */
+         if (! (0 < viewbox_width) && (iwidth.unit == RSVG_UNIT_PERCENT))
+           viewbox_width = (viewbox_height * viewbox.width / viewbox.height)
+             * iwidth.length;
+         else if (! (0 < viewbox_height) && (iheight.unit == 
RSVG_UNIT_PERCENT))
+           viewbox_height = (viewbox_width * viewbox.height / viewbox.width)
+             * iheight.length;
        }
       else if (has_width && has_viewbox)
        {
diff --git a/src/itree.c b/src/itree.c
index 04fa9e827a..688d5c8247 100644
--- a/src/itree.c
+++ b/src/itree.c
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
+along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <math.h>
@@ -1376,7 +1376,7 @@ itree_iterator_first_node (struct itree_tree *tree,
   return node;
 }
 
-/* Start a iterator enumerating all intervals in [BEGIN,END) in the
+/* Start an iterator enumerating all intervals in [BEGIN,END) in the
    given ORDER.  */
 
 struct itree_iterator *
diff --git a/src/itree.h b/src/itree.h
index 291fa53fd3..f1e2bf3bfd 100644
--- a/src/itree.h
+++ b/src/itree.h
@@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
+along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 
 #ifndef ITREE_H
 #define ITREE_H
@@ -25,6 +25,8 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 
+INLINE_HEADER_BEGIN
+
 /* The tree and node structs are mainly here, so they can be
    allocated.
 
@@ -114,6 +116,11 @@ extern void itree_node_set_region (struct itree_tree *, 
struct itree_node *,
                                   ptrdiff_t, ptrdiff_t);
 extern struct itree_tree *itree_create (void);
 extern void itree_destroy (struct itree_tree *);
+INLINE bool
+itree_empty_p (struct itree_tree *tree)
+{
+  return !tree || !tree->root;
+}
 extern intmax_t itree_size (struct itree_tree *);
 extern void itree_clear (struct itree_tree *);
 extern void itree_insert (struct itree_tree *, struct itree_node *,
@@ -178,4 +185,6 @@ struct itree_iterator
 #define ITREE_FOREACH_NARROW(beg, end) \
   itree_iterator_narrow (itree_iter_, beg, end)
 
+INLINE_HEADER_END
+
 #endif
diff --git a/src/keyboard.c b/src/keyboard.c
index 811998823c..d68b50428a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1910,10 +1910,14 @@ safe_run_hooks_maybe_narrowed (Lisp_Object hook, struct 
window *w)
 
   specbind (Qinhibit_quit, Qt);
 
-  if (current_buffer->long_line_optimizations_p)
-    narrow_to_region_internal (make_fixnum (get_narrowed_begv (w, PT)),
-                              make_fixnum (get_narrowed_zv (w, PT)),
-                              true);
+  if (current_buffer->long_line_optimizations_p
+      && long_line_locked_narrowing_region_size > 0)
+    {
+      ptrdiff_t begv = get_locked_narrowing_begv (PT);
+      ptrdiff_t zv = get_locked_narrowing_zv (PT);
+      if (begv != BEG || zv != Z)
+       narrow_to_region_locked (make_fixnum (begv), make_fixnum (zv), hook);
+    }
 
   run_hook_with_args (2, ((Lisp_Object []) {hook, hook}),
                       safe_run_hook_funcall);
@@ -12727,8 +12731,9 @@ the error might happen repeatedly and make Emacs 
nonfunctional.
 
 Note that, when the current buffer contains one or more lines whose
 length is above `long-line-threshold', these hook functions are called
-with the buffer narrowed to a small portion around point, and the
-narrowing is locked (see `narrow-to-region'), so that these hook
+with the buffer narrowed to a small portion around point (whose size
+is specified by `long-line-locked-narrowing-region-size'), and the
+narrowing is locked (see `narrowing-lock'), so that these hook
 functions cannot use `widen' to gain access to other portions of
 buffer text.
 
@@ -12748,8 +12753,9 @@ avoid making Emacs unresponsive while the user types.
 
 Note that, when the current buffer contains one or more lines whose
 length is above `long-line-threshold', these hook functions are called
-with the buffer narrowed to a small portion around point, and the
-narrowing is locked (see `narrow-to-region'), so that these hook
+with the buffer narrowed to a small portion around point (whose size
+is specified by `long-line-locked-narrowing-region-size'), and the
+narrowing is locked (see `narrowing-lock'), so that these hook
 functions cannot use `widen' to gain access to other portions of
 buffer text.
 
diff --git a/src/lisp.h b/src/lisp.h
index 3d9c48449a..3791bf2b0c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4728,7 +4728,8 @@ extern void save_restriction_restore (Lisp_Object);
 extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool);
 extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                            ptrdiff_t, bool);
-extern Lisp_Object narrow_to_region_internal (Lisp_Object, Lisp_Object, bool);
+extern void narrow_to_region_locked (Lisp_Object, Lisp_Object, Lisp_Object);
+extern void reset_outermost_narrowings (void);
 extern void init_editfns (void);
 extern void syms_of_editfns (void);
 
@@ -5336,6 +5337,26 @@ __lsan_ignore_object (void const *p)
 }
 #endif
 
+/* If built with USE_SANITIZER_UNALIGNED_LOAD defined, use compiler
+   provided ASan functions to perform unaligned loads, allowing ASan
+   to catch bugs which it might otherwise miss.  */
+#if defined HAVE_SANITIZER_COMMON_INTERFACE_DEFS_H \
+  && defined ADDRESS_SANITIZER                     \
+  && defined USE_SANITIZER_UNALIGNED_LOAD
+# include <sanitizer/common_interface_defs.h>
+# if (SIZE_MAX == UINT64_MAX)
+#  define UNALIGNED_LOAD_SIZE(a, i) \
+   (size_t) __sanitizer_unaligned_load64 ((void *) ((a) + (i)))
+# elif (SIZE_MAX == UINT32_MAX)
+#  define UNALIGNED_LOAD_SIZE(a, i) \
+   (size_t) __sanitizer_unaligned_load32 ((void *) ((a) + (i)))
+# else
+#  define UNALIGNED_LOAD_SIZE(a, i) *((a) + (i))
+# endif
+#else
+# define UNALIGNED_LOAD_SIZE(a, i) *((a) + (i))
+#endif
+
 extern void xputenv (const char *);
 
 extern char *egetenv_internal (const char *, ptrdiff_t);
diff --git a/src/lread.c b/src/lread.c
index 0a6e4201e4..d838a18de5 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3375,7 +3375,7 @@ read_bool_vector (Lisp_Object readcharfun)
          break;
        }
       if (INT_MULTIPLY_WRAPV (length, 10, &length)
-         | INT_ADD_WRAPV (length, c - '0', &length))
+         || INT_ADD_WRAPV (length, c - '0', &length))
        invalid_syntax ("#&", readcharfun);
     }
 
@@ -3421,7 +3421,7 @@ skip_lazy_string (Lisp_Object readcharfun)
          break;
        }
       if (INT_MULTIPLY_WRAPV (nskip, 10, &nskip)
-         | INT_ADD_WRAPV (nskip, c - '0', &nskip))
+         || INT_ADD_WRAPV (nskip, c - '0', &nskip))
        invalid_syntax ("#@", readcharfun);
       digits++;
       if (digits == 2 && nskip == 0)
@@ -5468,15 +5468,6 @@ to the specified file name if a suffix is allowed or 
required.  */);
   Vload_suffixes =
     Fcons (build_pure_c_string (MODULES_SECONDARY_SUFFIX), Vload_suffixes);
 #endif
-
-  DEFVAR_LISP ("dynamic-library-suffixes", Vdynamic_library_suffixes,
-              doc: /* A list of suffixes for loadable dynamic libraries.  */);
-  Vdynamic_library_suffixes =
-    Fcons (build_pure_c_string (DYNAMIC_LIB_SECONDARY_SUFFIX), Qnil);
-  Vdynamic_library_suffixes =
-    Fcons (build_pure_c_string (DYNAMIC_LIB_SUFFIX),
-          Vdynamic_library_suffixes);
-
 #endif
   DEFVAR_LISP ("module-file-suffix", Vmodule_file_suffix,
               doc: /* Suffix of loadable module file, or nil if modules are 
not supported.  */);
@@ -5485,6 +5476,20 @@ to the specified file name if a suffix is allowed or 
required.  */);
 #else
   Vmodule_file_suffix = Qnil;
 #endif
+
+  DEFVAR_LISP ("dynamic-library-suffixes", Vdynamic_library_suffixes,
+              doc: /* A list of suffixes for loadable dynamic libraries.  */);
+
+#ifndef MSDOS
+  Vdynamic_library_suffixes
+    = Fcons (build_pure_c_string (DYNAMIC_LIB_SECONDARY_SUFFIX), Qnil);
+  Vdynamic_library_suffixes
+    = Fcons (build_pure_c_string (DYNAMIC_LIB_SUFFIX),
+            Vdynamic_library_suffixes);
+#else
+  Vdynamic_library_suffixes = Qnil;
+#endif
+
   DEFVAR_LISP ("load-file-rep-suffixes", Vload_file_rep_suffixes,
               doc: /* List of suffixes that indicate representations of \
 the same file.
diff --git a/src/module-env-29.h b/src/module-env-29.h
index 6ca0377318..e69de29bb2 100644
--- a/src/module-env-29.h
+++ b/src/module-env-29.h
@@ -1,3 +0,0 @@
-  /* Add module environment functions newly added in Emacs 29 here.
-     Before Emacs 29 is released, remove this comment and start
-     module-env-30.h on the master branch.  */
diff --git a/src/module-env-29.h b/src/module-env-30.h
similarity index 100%
copy from src/module-env-29.h
copy to src/module-env-30.h
diff --git a/src/pdumper.c b/src/pdumper.c
index 75fe697dcd..70f90f0d8a 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2748,7 +2748,7 @@ dump_hash_table (struct dump_context *ctx,
 static dump_off
 dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
 {
-#if CHECK_STRUCTS && !defined HASH_buffer_193CAA5E45
+#if CHECK_STRUCTS && !defined HASH_buffer_DB34E5D09F
 # error "buffer changed. See CHECK_STRUCTS comment in config.h."
 #endif
   struct buffer munged_buffer = *in_buffer;
@@ -2811,7 +2811,6 @@ dump_buffer (struct dump_context *ctx, const struct 
buffer *in_buffer)
       DUMP_FIELD_COPY (out, buffer, own_text.end_unchanged);
       DUMP_FIELD_COPY (out, buffer, own_text.unchanged_modified);
       DUMP_FIELD_COPY (out, buffer, own_text.overlay_unchanged_modified);
-      DUMP_FIELD_COPY (out, buffer, own_text.chars_unchanged_modified);
       if (buffer->own_text.intervals)
         dump_field_fixup_later (ctx, out, buffer, &buffer->own_text.intervals);
       dump_field_lv_rawptr (ctx, out, buffer, &buffer->own_text.markers,
@@ -2863,7 +2862,7 @@ dump_buffer (struct dump_context *ctx, const struct 
buffer *in_buffer)
   DUMP_FIELD_COPY (out, buffer, inhibit_buffer_hooks);
   DUMP_FIELD_COPY (out, buffer, long_line_optimizations_p);
 
-  if (buffer->overlays && buffer->overlays->root != NULL)
+  if (!itree_empty_p (buffer->overlays))
     /* We haven't implemented the code to dump overlays.  */
     emacs_abort ();
   else
@@ -3003,7 +3002,7 @@ dump_vectorlike (struct dump_context *ctx,
                  Lisp_Object lv,
                  dump_off offset)
 {
-#if CHECK_STRUCTS && !defined HASH_pvec_type_AFF6FED5BD
+#if CHECK_STRUCTS && !defined HASH_pvec_type_5F2059C47E
 # error "pvec_type changed. See CHECK_STRUCTS comment in config.h."
 #endif
   const struct Lisp_Vector *v = XVECTOR (lv);
diff --git a/src/sqlite.c b/src/sqlite.c
index ac860f55bc..d9b9333fb3 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -55,6 +55,7 @@ DEF_DLL_FN (SQLITE_API const char*, sqlite3_errmsg, 
(sqlite3*));
 #if SQLITE_VERSION_NUMBER >= 3007015
 DEF_DLL_FN (SQLITE_API const char*, sqlite3_errstr, (int));
 #endif
+DEF_DLL_FN (SQLITE_API const char*, sqlite3_libversion, (void));
 DEF_DLL_FN (SQLITE_API int, sqlite3_step, (sqlite3_stmt*));
 DEF_DLL_FN (SQLITE_API int, sqlite3_changes, (sqlite3*));
 DEF_DLL_FN (SQLITE_API int, sqlite3_column_count, (sqlite3_stmt*));
@@ -96,6 +97,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension,
 # if SQLITE_VERSION_NUMBER >= 3007015
 #  undef sqlite3_errstr
 # endif
+# undef sqlite3_libversion
 # undef sqlite3_step
 # undef sqlite3_changes
 # undef sqlite3_column_count
@@ -124,6 +126,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension,
 # if SQLITE_VERSION_NUMBER >= 3007015
 #  define sqlite3_errstr fn_sqlite3_errstr
 # endif
+# define sqlite3_libversion fn_sqlite3_libversion
 # define sqlite3_step fn_sqlite3_step
 # define sqlite3_changes fn_sqlite3_changes
 # define sqlite3_column_count fn_sqlite3_column_count
@@ -155,6 +158,7 @@ load_dll_functions (HMODULE library)
 #if SQLITE_VERSION_NUMBER >= 3007015
   LOAD_DLL_FN (library, sqlite3_errstr);
 #endif
+  LOAD_DLL_FN (library, sqlite3_libversion);
   LOAD_DLL_FN (library, sqlite3_step);
   LOAD_DLL_FN (library, sqlite3_changes);
   LOAD_DLL_FN (library, sqlite3_column_count);
@@ -763,6 +767,16 @@ This will free the resources held by SET.  */)
   return Qt;
 }
 
+DEFUN ("sqlite-version", Fsqlite_version, Ssqlite_version, 0, 0, 0,
+       doc: /* Return the version string of the SQLite library.
+Signal an error if SQLite support is not available.  */)
+  (void)
+{
+  if (!init_sqlite_functions ())
+    error ("sqlite support is not available");
+  return build_string (sqlite3_libversion ());
+}
+
 #endif /* HAVE_SQLITE3 */
 
 DEFUN ("sqlitep", Fsqlitep, Ssqlitep, 1, 1, 0,
@@ -814,6 +828,7 @@ syms_of_sqlite (void)
   defsubr (&Ssqlite_columns);
   defsubr (&Ssqlite_more_p);
   defsubr (&Ssqlite_finalize);
+  defsubr (&Ssqlite_version);
   DEFSYM (Qset, "set");
   DEFSYM (Qfull, "full");
 #endif
diff --git a/src/sysdep.c b/src/sysdep.c
index 736723bdf3..8402ffe308 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2653,10 +2653,11 @@ emacs_perror (char const *message)
 int
 renameat_noreplace (int srcfd, char const *src, int dstfd, char const *dst)
 {
-#if defined SYS_renameat2 && defined RENAME_NOREPLACE
-  return syscall (SYS_renameat2, srcfd, src, dstfd, dst, RENAME_NOREPLACE);
-#elif defined CYGWIN && defined RENAME_NOREPLACE
+#if HAVE_RENAMEAT2 && defined RENAME_NOREPLACE
   return renameat2 (srcfd, src, dstfd, dst, RENAME_NOREPLACE);
+#elif defined SYS_renameat2 && defined RENAME_NOREPLACE
+  /* Linux kernel 3.15 (2014) or later, with glibc 2.27 (2018) or earlier.  */
+  return syscall (SYS_renameat2, srcfd, src, dstfd, dst, RENAME_NOREPLACE);
 #elif defined RENAME_EXCL
   return renameatx_np (srcfd, src, dstfd, dst, RENAME_EXCL);
 #else
diff --git a/src/timefns.c b/src/timefns.c
index eed2edf1cc..dcc6403fd9 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -40,6 +40,10 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 #include <stdlib.h>
 
+#ifdef WINDOWSNT
+extern clock_t sys_clock (void);
+#endif
+
 #ifdef HAVE_TIMEZONE_T
 # include <sys/param.h>
 # if defined __NetBSD_Version__ && __NetBSD_Version__ < 700000000
@@ -1194,7 +1198,7 @@ For example, nil stands for the current time.  */)
      quicker while we're at it.  This means (time-subtract X X) does
      not signal an error if X is not a valid time value, but that's OK.  */
   if (BASE_EQ (a, b))
-    return timespec_to_lisp ((struct timespec) {0});
+    return make_lisp_time ((struct timespec) {0});
 
   return time_arith (a, b, true);
 }
diff --git a/src/treesit.c b/src/treesit.c
index 21e1f866f7..c882d45513 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -52,7 +52,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #undef ts_node_named_descendant_for_byte_range
 #undef ts_node_next_named_sibling
 #undef ts_node_next_sibling
-#undef ts_node_parent
 #undef ts_node_prev_named_sibling
 #undef ts_node_prev_sibling
 #undef ts_node_start_byte
@@ -76,7 +75,9 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #undef ts_query_predicates_for_pattern
 #undef ts_query_string_value_for_id
 #undef ts_set_allocator
+#undef ts_tree_cursor_copy
 #undef ts_tree_cursor_current_node
+#undef ts_tree_cursor_delete
 #undef ts_tree_cursor_goto_first_child
 #undef ts_tree_cursor_goto_next_sibling
 #undef ts_tree_cursor_goto_parent
@@ -109,7 +110,6 @@ DEF_DLL_FN (TSNode, ts_node_named_descendant_for_byte_range,
            (TSNode, uint32_t, uint32_t));
 DEF_DLL_FN (TSNode, ts_node_next_named_sibling, (TSNode));
 DEF_DLL_FN (TSNode, ts_node_next_sibling, (TSNode));
-DEF_DLL_FN (TSNode, ts_node_parent, (TSNode));
 DEF_DLL_FN (TSNode, ts_node_prev_named_sibling, (TSNode));
 DEF_DLL_FN (TSNode, ts_node_prev_sibling, (TSNode));
 DEF_DLL_FN (uint32_t, ts_node_start_byte, (TSNode));
@@ -143,7 +143,9 @@ DEF_DLL_FN (const char *, ts_query_string_value_for_id,
            (const TSQuery *, uint32_t, uint32_t *));
 DEF_DLL_FN (void, ts_set_allocator,
            (void *(*)(size_t), void *(*)(size_t, size_t), void *(*)(void *, 
size_t), void (*)(void *)));
+DEF_DLL_FN (TSTreeCursor, ts_tree_cursor_copy, (const TSTreeCursor *));
 DEF_DLL_FN (TSNode, ts_tree_cursor_current_node, (const TSTreeCursor *));
+DEF_DLL_FN (void, ts_tree_cursor_delete, (const TSTreeCursor *));
 DEF_DLL_FN (bool, ts_tree_cursor_goto_first_child, (TSTreeCursor *));
 DEF_DLL_FN (bool, ts_tree_cursor_goto_next_sibling, (TSTreeCursor *));
 DEF_DLL_FN (bool, ts_tree_cursor_goto_parent, (TSTreeCursor *));
@@ -182,7 +184,6 @@ init_treesit_functions (void)
   LOAD_DLL_FN (library, ts_node_named_descendant_for_byte_range);
   LOAD_DLL_FN (library, ts_node_next_named_sibling);
   LOAD_DLL_FN (library, ts_node_next_sibling);
-  LOAD_DLL_FN (library, ts_node_parent);
   LOAD_DLL_FN (library, ts_node_prev_named_sibling);
   LOAD_DLL_FN (library, ts_node_prev_sibling);
   LOAD_DLL_FN (library, ts_node_start_byte);
@@ -206,7 +207,9 @@ init_treesit_functions (void)
   LOAD_DLL_FN (library, ts_query_predicates_for_pattern);
   LOAD_DLL_FN (library, ts_query_string_value_for_id);
   LOAD_DLL_FN (library, ts_set_allocator);
+  LOAD_DLL_FN (library, ts_tree_cursor_copy);
   LOAD_DLL_FN (library, ts_tree_cursor_current_node);
+  LOAD_DLL_FN (library, ts_tree_cursor_delete);
   LOAD_DLL_FN (library, ts_tree_cursor_goto_first_child);
   LOAD_DLL_FN (library, ts_tree_cursor_goto_next_sibling);
   LOAD_DLL_FN (library, ts_tree_cursor_goto_parent);
@@ -239,7 +242,6 @@ init_treesit_functions (void)
 #define ts_node_named_descendant_for_byte_range 
fn_ts_node_named_descendant_for_byte_range
 #define ts_node_next_named_sibling fn_ts_node_next_named_sibling
 #define ts_node_next_sibling fn_ts_node_next_sibling
-#define ts_node_parent fn_ts_node_parent
 #define ts_node_prev_named_sibling fn_ts_node_prev_named_sibling
 #define ts_node_prev_sibling fn_ts_node_prev_sibling
 #define ts_node_start_byte fn_ts_node_start_byte
@@ -263,7 +265,9 @@ init_treesit_functions (void)
 #define ts_query_predicates_for_pattern fn_ts_query_predicates_for_pattern
 #define ts_query_string_value_for_id fn_ts_query_string_value_for_id
 #define ts_set_allocator fn_ts_set_allocator
+#define ts_tree_cursor_copy fn_ts_tree_cursor_copy
 #define ts_tree_cursor_current_node fn_ts_tree_cursor_current_node
+#define ts_tree_cursor_delete fn_ts_tree_cursor_delete
 #define ts_tree_cursor_goto_first_child fn_ts_tree_cursor_goto_first_child
 #define ts_tree_cursor_goto_next_sibling fn_ts_tree_cursor_goto_next_sibling
 #define ts_tree_cursor_goto_parent fn_ts_tree_cursor_goto_parent
@@ -288,7 +292,7 @@ init_treesit_functions (void)
      slow enough to make insignificant any performance advantages from
      using the cursor.  Not exposing the cursor also minimizes the
      number of new types this adds to Emacs Lisp; currently, this adds
-     only the parser and node types.
+     only the parser, node, and compiled query types.
 
    - Because updating the change is handled on the C level as each
      change is made in the buffer, there is no way for Lisp to update
@@ -314,7 +318,7 @@ init_treesit_functions (void)
      See: https://github.com/tree-sitter/tree-sitter/issues/445
 
    treesit.h has some commentary on the two main data structure for
-   the parser and node.  treesit_ensure_position_synced has some
+   the parser and node.  treesit_sync_visible_region has some
    commentary on how we make tree-sitter play well with narrowing (the
    tree-sitter parser only sees the visible region, so we need to
    translate positions back and forth).  Most action happens in
@@ -384,7 +388,18 @@ init_treesit_functions (void)
    mysteriously drops.  3) what if a user uses so many stuff that the
    default cache size (20) is not enough and we end up thrashing?
    These are all imaginary scenarios but they are not impossible
-   :-) */
+   :-)
+
+   Parsers in indirect buffers: We make indirect buffers to share the
+   parser of its base buffer.  Indirect buffers and their base buffer
+   share the same buffer content but not other buffer attributes.  If
+   they have separate parser lists, changes made in an indirect buffer
+   will only update parsers of that indirect buffer, and not parsers
+   in the base buffer or other indirect buffers, and vice versa.  We
+   could keep track of all the base and indirect buffers, and update
+   all of their parsers, but ultimately decide to take a simpler
+   approach, which is to make indirect buffers share their base
+   buffer's parser list.  The discussion can be found in bug#59693.  */
 
 
 /*** Initialization */
@@ -697,9 +712,10 @@ void
 treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte,
                       ptrdiff_t new_end_byte)
 {
-  Lisp_Object parser_list;
-
-  parser_list = BVAR (current_buffer, ts_parser_list);
+  struct buffer *base_buffer = current_buffer;
+  if (current_buffer->base_buffer)
+    base_buffer = current_buffer->base_buffer;
+  Lisp_Object parser_list = BVAR (base_buffer, ts_parser_list);
 
   FOR_EACH_TAIL_SAFE (parser_list)
     {
@@ -707,6 +723,8 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t 
old_end_byte,
       Lisp_Object lisp_parser = XCAR (parser_list);
       treesit_check_parser (lisp_parser);
       TSTree *tree = XTS_PARSER (lisp_parser)->tree;
+      /* See comment (ref:visible-beg-null) if you wonder why we don't
+      update visible_beg/end when tree is NULL.  */
       if (tree != NULL)
        {
          eassert (start_byte <= old_end_byte);
@@ -742,7 +760,7 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t 
old_end_byte,
          XTS_PARSER (lisp_parser)->timestamp++;
 
          /* VISIBLE_BEG/END records tree-sitter's range of view in
-            the buffer.  Ee need to adjust them when tree-sitter's
+            the buffer.  We need to adjust them when tree-sitter's
             view changes.  */
          ptrdiff_t visi_beg_delta;
          if (old_end_byte > new_end_byte)
@@ -765,20 +783,68 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t 
old_end_byte,
     }
 }
 
-/* Make sure PARSER's visible_beg and visible_end are in sync with
-   BUF_BEGV_BYTE and BUG_ZV_BYTE.  When calling this function you must
-   make sure the current buffer's size is not larger than UINT32_MAX.
-   Basically always call treesit_check_buffer_size before this
-   function.  */
+/* Comment (ref:visible-beg-null) The purpose of visible_beg/end is to
+   keep track of "which part of the buffer does the tree-sitter tree
+   see", in order to update the tree correctly.  Visible_beg/end have
+   two purposes: they "clip" buffer changes within them, and they
+   translate positions in the buffer to positions in the tree
+   (buffer position - visible_beg = tree position).
+
+   Conceptually, visible_beg/end hold the visible region of the buffer
+   when we last reparsed.  In-between two reparses, we don't really
+   care if the visible region of the buffer changes.
+
+   Right before we reparse, we make tree-sitter's visible region
+   match that of the buffer, and update visible_beg/end.
+
+   That is, the whole purpose of visible_beg/end (and also of
+   treesit_record_change and treesit_sync_visible_region) is to update
+   the tree (by ts_tree_edit).  So if the tree is NULL,
+   visible_beg/end are considered uninitialized.  Only when we already
+   have a tree, do we need to keep track of position changes and
+   update it correctly, so it can be fed into ts_parser_parse as the
+   old tree, so that tree-sitter will only parse the changed part,
+   incrementally.
+
+   In a nutshell, tree-sitter incremental parsing in Emacs looks like:
+
+   treesit_record_change (tree)  \
+   treesit_record_change (tree)  | user edits buffer
+   ...                           /
+
+   treesit_sync_visible_region (tree) \ treesit_ensure_parsed
+   ts_parser_parse(tree) -> tree      /
+
+   treesit_record_change (tree)  \
+   treesit_record_change (tree)  | user edits buffer
+   ...                           /
+
+   and so on.  */
+
+/* Make sure the tree's visible range is in sync with the buffer's
+   visible range, and PARSER's visible_beg and visible_end are in sync
+   with BUF_BEGV_BYTE and BUG_ZV_BYTE.  When calling this function you
+   must make sure the current buffer's size in bytes is not larger than
+   UINT32_MAX.  Basically, always call treesit_check_buffer_size before
+   this function.
+
+   If buffer range changed since last parse (visible_beg/end doesn't
+   match buffer visible beginning/end), set need_reparse to true.  */
 static void
-treesit_ensure_position_synced (Lisp_Object parser)
+treesit_sync_visible_region (Lisp_Object parser)
 {
   TSTree *tree = XTS_PARSER (parser)->tree;
+  struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer);
 
+  /* If we are setting visible_beg/end for the first time, we can skip
+  the offset acrobatics and updating the tree below.  */
   if (tree == NULL)
-    return;
+    {
+      XTS_PARSER (parser)->visible_beg = BUF_BEGV_BYTE (buffer);
+      XTS_PARSER (parser)->visible_end = BUF_ZV_BYTE (buffer);
+      return;
+    }
 
-  struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer);
   ptrdiff_t visible_beg = XTS_PARSER (parser)->visible_beg;
   ptrdiff_t visible_end = XTS_PARSER (parser)->visible_end;
   eassert (0 <= visible_beg);
@@ -787,6 +853,12 @@ treesit_ensure_position_synced (Lisp_Object parser)
   eassert (BUF_BEGV_BYTE (buffer) <= UINT32_MAX);
   eassert (BUF_ZV_BYTE (buffer) <= UINT32_MAX);
 
+  /* If buffer restriction changed and user requests for a node (hence
+     this function is called), we need to reparse.  */
+  if (visible_beg != BUF_BEGV_BYTE (buffer)
+      || visible_end != BUF_ZV_BYTE (buffer))
+    XTS_PARSER (parser)->need_reparse = true;
+
   /* Before we parse or set ranges, catch up with the narrowing
      situation.  We change visible_beg and visible_end to match
      BUF_BEGV_BYTE and BUF_ZV_BYTE, and inform tree-sitter of the
@@ -832,6 +904,8 @@ treesit_ensure_position_synced (Lisp_Object parser)
     }
   eassert (0 <= visible_beg);
   eassert (visible_beg <= visible_end);
+  eassert (visible_beg == BUF_BEGV_BYTE (buffer));
+  eassert (visible_end == BUF_ZV_BYTE (buffer));
 
   XTS_PARSER (parser)->visible_beg = visible_beg;
   XTS_PARSER (parser)->visible_end = visible_end;
@@ -875,16 +949,19 @@ treesit_call_after_change_functions (TSTree *old_tree, 
TSTree *new_tree,
 static void
 treesit_ensure_parsed (Lisp_Object parser)
 {
+  struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer);
+
+  /* Before we parse, catch up with the narrowing situation.  */
+  treesit_check_buffer_size (buffer);
+  /* This function has to run before we check for need_reparse flag,
+     because it might set the flag to true.  */
+  treesit_sync_visible_region (parser);
+
   if (!XTS_PARSER (parser)->need_reparse)
     return;
   TSParser *treesit_parser = XTS_PARSER (parser)->parser;
   TSTree *tree = XTS_PARSER (parser)->tree;
   TSInput input = XTS_PARSER (parser)->input;
-  struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer);
-
-  /* Before we parse, catch up with the narrowing situation.  */
-  treesit_check_buffer_size (buffer);
-  treesit_ensure_position_synced (parser);
 
   TSTree *new_tree = ts_parser_parse (treesit_parser, tree, input);
   /* This should be very rare (impossible, really): it only happens
@@ -983,8 +1060,8 @@ make_treesit_parser (Lisp_Object buffer, TSParser *parser,
   TSInput input = {lisp_parser, treesit_read_buffer, TSInputEncodingUTF8};
   lisp_parser->input = input;
   lisp_parser->need_reparse = true;
-  lisp_parser->visible_beg = BUF_BEGV (XBUFFER (buffer));
-  lisp_parser->visible_end = BUF_ZV (XBUFFER (buffer));
+  lisp_parser->visible_beg = BUF_BEGV_BYTE (XBUFFER (buffer));
+  lisp_parser->visible_end = BUF_ZV_BYTE (XBUFFER (buffer));
   lisp_parser->timestamp = 0;
   lisp_parser->deleted = false;
   lisp_parser->has_range = false;
@@ -1191,12 +1268,16 @@ DEFUN ("treesit-parser-create",
        1, 3, 0,
        doc: /* Create and return a parser in BUFFER for LANGUAGE.
 
-The parser is automatically added to BUFFER's parser list, as
-returned by `treesit-parser-list'.
-LANGUAGE is a language symbol.  If BUFFER is nil or omitted, it
-defaults to the current buffer.  If BUFFER already has a parser for
-LANGUAGE, return that parser, but if NO-REUSE is non-nil, always
-create a new parser.  */)
+The parser is automatically added to BUFFER's parser list, as returned
+by `treesit-parser-list'.  LANGUAGE is a language symbol.  If BUFFER
+is nil or omitted, it defaults to the current buffer.  If BUFFER
+already has a parser for LANGUAGE, return that parser, but if NO-REUSE
+is non-nil, always create a new parser.
+
+If that buffer is an indirect buffer, its base buffer is used instead.
+That is, indirect buffers use their base buffer's parsers.  Lisp
+programs should widen as necessary should they want to use a parser in
+an indirect buffer.  */)
   (Lisp_Object language, Lisp_Object buffer, Lisp_Object no_reuse)
 {
   treesit_initialize ();
@@ -1210,16 +1291,21 @@ create a new parser.  */)
       CHECK_BUFFER (buffer);
       buf = XBUFFER (buffer);
     }
+  if (buf->base_buffer)
+    buf = buf->base_buffer;
+
   treesit_check_buffer_size (buf);
 
   /* See if we can reuse a parser.  */
-  for (Lisp_Object tail = BVAR (buf, ts_parser_list);
-       NILP (no_reuse) && !NILP (tail);
-       tail = XCDR (tail))
+  if (NILP (no_reuse))
     {
-      struct Lisp_TS_Parser *parser = XTS_PARSER (XCAR (tail));
-      if (EQ (parser->language_symbol, language))
-       return XCAR (tail);
+      Lisp_Object tail = BVAR (buf, ts_parser_list);
+      FOR_EACH_TAIL (tail)
+      {
+       struct Lisp_TS_Parser *parser = XTS_PARSER (XCAR (tail));
+       if (EQ (parser->language_symbol, language))
+         return XCAR (tail);
+      }
     }
 
   /* Load language.  */
@@ -1268,7 +1354,10 @@ DEFUN ("treesit-parser-list",
        Ftreesit_parser_list, Streesit_parser_list,
        0, 1, 0,
        doc: /* Return BUFFER's parser list.
-BUFFER defaults to the current buffer.  */)
+
+BUFFER defaults to the current buffer.  If that buffer is an indirect
+buffer, its base buffer is used instead.  That is, indirect buffers
+use their base buffer's parsers.  */)
   (Lisp_Object buffer)
 {
   struct buffer *buf;
@@ -1279,6 +1368,9 @@ BUFFER defaults to the current buffer.  */)
       CHECK_BUFFER (buffer);
       buf = XBUFFER (buffer);
     }
+  if (buf->base_buffer)
+    buf = buf->base_buffer;
+
   /* Return a fresh list so messing with that list doesn't affect our
      internal data.  */
   Lisp_Object return_list = Qnil;
@@ -1365,9 +1457,10 @@ treesit_check_range_argument (Lisp_Object ranges)
   CHECK_LIST_END (tail, ranges);
 }
 
-/* Generate a list of ranges in Lisp from RANGES.  This function
-   doesn't take ownership of RANGES.  BUFFER is used to convert
-   between tree-sitter buffer offset and buffer position.  */
+/* Generate a list of ranges in Lisp from RANGES.  Assumes tree-sitter
+   tree and the buffer has the same visible region (wrt narrowing).
+   This function doesn't take ownership of RANGES.  BUFFER is used to
+   convert between tree-sitter buffer offset and buffer position.  */
 static Lisp_Object
 treesit_make_ranges (const TSRange *ranges, uint32_t len,
                     struct buffer *buffer)
@@ -1412,7 +1505,7 @@ buffer.  */)
   treesit_initialize ();
   /* Before we parse, catch up with narrowing/widening.  */
   treesit_check_buffer_size (XBUFFER (XTS_PARSER (parser)->buffer));
-  treesit_ensure_position_synced (parser);
+  treesit_sync_visible_region (parser);
 
   bool success;
   if (NILP (ranges))
@@ -1439,9 +1532,9 @@ buffer.  */)
       for (int idx = 0; !NILP (ranges); idx++, ranges = XCDR (ranges))
        {
          Lisp_Object range = XCAR (ranges);
-         EMACS_INT beg_byte = buf_charpos_to_bytepos (buffer,
+         ptrdiff_t beg_byte = buf_charpos_to_bytepos (buffer,
                                                       XFIXNUM (XCAR (range)));
-         EMACS_INT end_byte = buf_charpos_to_bytepos (buffer,
+         ptrdiff_t end_byte = buf_charpos_to_bytepos (buffer,
                                                       XFIXNUM (XCDR (range)));
          /* Shouldn't violate assertion since we just checked for
             buffer size at the beginning of this function.  */
@@ -1476,8 +1569,8 @@ DEFUN ("treesit-parser-included-ranges",
        Streesit_parser_included_ranges,
        1, 1, 0,
        doc: /* Return the ranges set for PARSER.
-See `treesit-parser-set-ranges'.  If no ranges are set for PARSER,
-return nil.  */)
+If no ranges are set for PARSER, return nil.
+See also `treesit-parser-set-included-ranges'.  */)
   (Lisp_Object parser)
 {
   treesit_check_parser (parser);
@@ -1498,7 +1591,7 @@ return nil.  */)
   /* Our return value depends on the buffer state (BUF_BEGV_BYTE,
      etc), so we need to sync up.  */
   treesit_check_buffer_size (XBUFFER (XTS_PARSER (parser)->buffer));
-  treesit_ensure_position_synced (parser);
+  treesit_sync_visible_region (parser);
 
   struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer);
   return treesit_make_ranges (ranges, len, buffer);
@@ -1580,6 +1673,17 @@ treesit_check_node (Lisp_Object obj)
     xsignal1 (Qtreesit_node_outdated, obj);
 }
 
+/* Checks that OBJ is a positive integer and it is within the visible
+   portion of BUF. */
+static void
+treesit_check_position (Lisp_Object obj, struct buffer *buf)
+{
+  treesit_check_positive_integer (obj);
+  ptrdiff_t pos = XFIXNUM (obj);
+  if (pos < BUF_BEGV (buf) || pos > BUF_ZV (buf))
+    xsignal1 (Qargs_out_of_range, obj);
+}
+
 bool
 treesit_node_uptodate_p (Lisp_Object obj)
 {
@@ -1658,6 +1762,8 @@ If NODE is nil, return nil.  */)
   return build_string (string);
 }
 
+static TSTreeCursor treesit_cursor_helper (TSNode, Lisp_Object);
+
 DEFUN ("treesit-node-parent",
        Ftreesit_node_parent, Streesit_node_parent, 1, 1, 0,
        doc: /* Return the immediate parent of NODE.
@@ -1668,13 +1774,18 @@ Return nil if NODE has no parent.  If NODE is nil, 
return nil.  */)
   treesit_check_node (node);
   treesit_initialize ();
 
-  TSNode treesit_node = XTS_NODE (node)->node;
-  TSNode parent = ts_node_parent (treesit_node);
+  Lisp_Object return_value = Qnil;
 
-  if (ts_node_is_null (parent))
-    return Qnil;
-
-  return make_treesit_node (XTS_NODE (node)->parser, parent);
+  TSNode treesit_node = XTS_NODE (node)->node;
+  Lisp_Object parser = XTS_NODE (node)->parser;
+  TSTreeCursor cursor = treesit_cursor_helper (treesit_node, parser);
+  if (ts_tree_cursor_goto_parent (&cursor))
+  {
+    TSNode parent = ts_tree_cursor_current_node (&cursor);
+    return_value = make_treesit_node (parser, parent);
+  }
+  ts_tree_cursor_delete (&cursor);
+  return return_value;
 }
 
 DEFUN ("treesit-node-child",
@@ -1928,14 +2039,12 @@ Note that this function returns an immediate child, not 
the smallest
   if (NILP (node))
     return Qnil;
   treesit_check_node (node);
-  treesit_check_positive_integer (pos);
 
   struct buffer *buf = XBUFFER (XTS_PARSER (XTS_NODE (node)->parser)->buffer);
   ptrdiff_t visible_beg = XTS_PARSER (XTS_NODE (node)->parser)->visible_beg;
   ptrdiff_t byte_pos = buf_charpos_to_bytepos (buf, XFIXNUM (pos));
 
-  if (byte_pos < BUF_BEGV_BYTE (buf) || byte_pos > BUF_ZV_BYTE (buf))
-    xsignal1 (Qargs_out_of_range, pos);
+  treesit_check_position (pos, buf);
 
   treesit_initialize ();
 
@@ -1966,19 +2075,14 @@ If NODE is nil, return nil.  */)
 {
   if (NILP (node)) return Qnil;
   treesit_check_node (node);
-  CHECK_INTEGER (beg);
-  CHECK_INTEGER (end);
 
   struct buffer *buf = XBUFFER (XTS_PARSER (XTS_NODE (node)->parser)->buffer);
   ptrdiff_t visible_beg = XTS_PARSER (XTS_NODE (node)->parser)->visible_beg;
   ptrdiff_t byte_beg = buf_charpos_to_bytepos (buf, XFIXNUM (beg));
   ptrdiff_t byte_end = buf_charpos_to_bytepos (buf, XFIXNUM (end));
 
-  /* Checks for BUFFER_BEG <= BEG <= END <= BUFFER_END.  */
-  if (!(BUF_BEGV_BYTE (buf) <= byte_beg
-       && byte_beg <= byte_end
-       && byte_end <= BUF_ZV_BYTE (buf)))
-    xsignal2 (Qargs_out_of_range, beg, end);
+  treesit_check_position (beg, buf);
+  treesit_check_position (end, buf);
 
   treesit_initialize ();
 
@@ -2229,8 +2333,6 @@ treesit_predicate_match (Lisp_Object args, struct 
capture_range captures)
 
   Lisp_Object regexp = XCAR (args);
   Lisp_Object capture_name = XCAR (XCDR (args));
-  Lisp_Object text = treesit_predicate_capture_name_to_text (capture_name,
-                                                            captures);
 
   /* It's probably common to get the argument order backwards.  Catch
      this mistake early and show helpful explanation, because Emacs
@@ -2245,6 +2347,9 @@ treesit_predicate_match (Lisp_Object args, struct 
capture_range captures)
              build_pure_c_string ("The second argument to `match' should "
                                   "be a capture name, not a string"));
 
+  Lisp_Object text = treesit_predicate_capture_name_to_text (capture_name,
+                                                            captures);
+
   if (fast_string_match (regexp, text) >= 0)
     return true;
   else
@@ -2363,21 +2468,24 @@ the query.  */)
   (Lisp_Object node, Lisp_Object query,
    Lisp_Object beg, Lisp_Object end, Lisp_Object node_only)
 {
-  if (!NILP (beg))
-    CHECK_INTEGER (beg);
-  if (!NILP (end))
-    CHECK_INTEGER (end);
-
   if (!(TS_COMPILED_QUERY_P (query)
        || CONSP (query) || STRINGP (query)))
     wrong_type_argument (Qtreesit_query_p, query);
 
+  treesit_initialize ();
+
   /* Resolve NODE into an actual node.  */
   Lisp_Object lisp_node;
   if (TS_NODEP (node))
-    lisp_node = node;
+    {
+      treesit_check_node (node); /* Check if up-to-date.  */
+      lisp_node = node;
+    }
   else if (TS_PARSERP (node))
-    lisp_node = Ftreesit_parser_root_node (node);
+    {
+      treesit_check_parser (node); /* Check if deleted.  */
+      lisp_node = Ftreesit_parser_root_node (node);
+    }
   else if (SYMBOLP (node))
     {
       Lisp_Object parser
@@ -2389,8 +2497,6 @@ the query.  */)
              list4 (Qor, Qtreesit_node_p, Qtreesit_parser_p, Qsymbolp),
              node);
 
-  treesit_initialize ();
-
   /* Extract C values from Lisp objects.  */
   TSNode treesit_node
     = XTS_NODE (lisp_node)->node;
@@ -2401,6 +2507,13 @@ the query.  */)
   const TSLanguage *lang
     = ts_parser_language (XTS_PARSER (lisp_parser)->parser);
 
+  /* Check BEG and END.  */
+  struct buffer *buf = XBUFFER (XTS_PARSER (lisp_parser)->buffer);
+  if (!NILP (beg))
+    treesit_check_position (beg, buf);
+  if (!NILP (end))
+    treesit_check_position (end, buf);
+
   /* Initialize query objects.  At the end of this block, we should
      have a working TSQuery and a TSQueryCursor.  */
   TSQuery *treesit_query;
@@ -2444,14 +2557,15 @@ the query.  */)
   /* Set query range.  */
   if (!NILP (beg) && !NILP (end))
     {
-      EMACS_INT beg_byte = XFIXNUM (beg);
-      EMACS_INT end_byte = XFIXNUM (end);
+      ptrdiff_t beg_byte = CHAR_TO_BYTE (XFIXNUM (beg));
+      ptrdiff_t end_byte = CHAR_TO_BYTE (XFIXNUM (end));
       /* We never let tree-sitter run on buffers too large, so these
         assertion should never hit.  */
       eassert (beg_byte - visible_beg <= UINT32_MAX);
       eassert (end_byte - visible_beg <= UINT32_MAX);
-      ts_query_cursor_set_byte_range (cursor, (uint32_t) beg_byte - 
visible_beg,
-                                     (uint32_t) end_byte - visible_beg);
+      ts_query_cursor_set_byte_range (cursor,
+                                     (uint32_t) (beg_byte - visible_beg),
+                                     (uint32_t) (end_byte - visible_beg));
     }
 
   /* Execute query.  */
@@ -2517,62 +2631,210 @@ the query.  */)
 
 /*** Navigation */
 
-/* Return the next/previous named/unnamed sibling of NODE.  FORWARD
-   controls the direction and NAMED controls the nameness.  */
-static TSNode
-treesit_traverse_sibling_helper (TSNode node, bool forward, bool named)
+static inline void
+treesit_assume_true (bool val)
+{
+  eassert (val == true);
+}
+
+/* Create a TSTreeCursor pointing at NODE.  PARSER is the lisp parser
+   that produced NODE.
+
+   The reason we need this instead of simply using ts_tree_cursor_new
+   is that we have to create the cursor on the root node and traverse
+   down to NODE, in order to record the correct stack of parent nodes.
+   Otherwise going to sibling or parent of NODE wouldn't work.
+
+   (Wow perfect filling.)  */
+static TSTreeCursor
+treesit_cursor_helper (TSNode node, Lisp_Object parser)
+{
+  uint32_t end_pos = ts_node_end_byte (node);
+  TSNode root = ts_tree_root_node (XTS_PARSER (parser)->tree);
+  TSTreeCursor cursor = ts_tree_cursor_new (root);
+  TSNode cursor_node = ts_tree_cursor_current_node (&cursor);
+  /* This is like treesit-node-at.  We go down from the root node,
+     either to first child or next sibling, repeatedly, and finally
+     arrive at NODE.  */
+  while (!ts_node_eq (node, cursor_node))
+    {
+      treesit_assume_true (ts_tree_cursor_goto_first_child (&cursor));
+      cursor_node = ts_tree_cursor_current_node (&cursor);
+      /* ts_tree_cursor_goto_first_child_for_byte is not reliable, so
+        we just go through each sibling.  */
+      while (ts_node_is_missing (cursor_node)
+            || ts_node_end_byte (cursor_node) < end_pos)
+       {
+         /* A "missing" node has zero width, so it's possible that
+            its end = NODE.end but it's not NODE, so we skip them.
+            But we need to make sure this missing node is not the
+            node we are looking for before skipping it.  */
+         if (ts_node_is_missing (cursor_node)
+             && ts_node_eq (node, cursor_node))
+           return cursor;
+         treesit_assume_true (ts_tree_cursor_goto_next_sibling (&cursor));
+         cursor_node = ts_tree_cursor_current_node (&cursor);
+       }
+      /* Right now CURSOR.end >= NODE.end.  But what if CURSOR.end =
+        NODE.end, and there are missing nodes after CURSOR, and the
+        missing node after CURSOR is the NODE we are looking for??
+        Well, create a probe and look ahead.  (This is tested by
+        treesit-cursor-helper-with-missing-node.)  */
+      TSTreeCursor probe = ts_tree_cursor_copy (&cursor);
+      TSNode probe_node;
+      while (ts_tree_cursor_goto_next_sibling (&probe))
+       {
+         probe_node = ts_tree_cursor_current_node (&probe);
+         if (!ts_node_is_missing (probe_node))
+           break;
+         if (ts_node_eq (probe_node, node))
+           {
+             ts_tree_cursor_delete (&cursor);
+             return probe;
+           }
+       }
+      ts_tree_cursor_delete (&probe);
+    }
+  return cursor;
+}
+
+/* Move CURSOR to the next/previous sibling.  FORWARD controls the
+   direction.  NAMED controls the namedness.  If there is a valid
+   sibling, move CURSOR to it and return true, otherwise return false.
+   When false is returned, CURSOR points to a sibling node of the node
+   we started at, but exactly which is undefined.  */
+static bool
+treesit_traverse_sibling_helper (TSTreeCursor *cursor,
+                                bool forward, bool named)
 {
   if (forward)
     {
-      if (named)
-       return ts_node_next_named_sibling (node);
-      else
-       return ts_node_next_sibling (node);
+      if (!named)
+       return ts_tree_cursor_goto_next_sibling (cursor);
+      /* Else named...  */
+      while (ts_tree_cursor_goto_next_sibling (cursor))
+       {
+         if (ts_node_is_named (ts_tree_cursor_current_node (cursor)))
+           return true;
+       }
+      return false;
     }
-  else
+  else /* Backward.  */
     {
-      if (named)
-       return ts_node_prev_named_sibling (node);
-      else
-       return ts_node_prev_sibling (node);
+      /* Go to first child and go through each sibling, until we find
+        the one just before the starting node.  */
+      TSNode start = ts_tree_cursor_current_node (cursor);
+      if (!ts_tree_cursor_goto_parent (cursor))
+       return false;
+      treesit_assume_true (ts_tree_cursor_goto_first_child (cursor));
+
+      /* Now CURSOR is at the first child.  If we started at the first
+        child, then there is no further siblings.  */
+      TSNode first_child = ts_tree_cursor_current_node (cursor);
+      if (ts_node_eq (first_child, start))
+       return false;
+
+      /* PROBE is always DELTA siblings ahead of CURSOR. */
+      TSTreeCursor probe = ts_tree_cursor_copy (cursor);
+      /* This is position of PROBE minus position of CURSOR.  */
+      ptrdiff_t delta = 0;
+      TSNode probe_node;
+      TSNode cursor_node;
+      while (ts_tree_cursor_goto_next_sibling (&probe))
+       {
+         /* Move PROBE forward, if it equals to the starting node,
+            CURSOR points to the node we want (prev valid sibling of
+            the starting node).  */
+         delta++;
+         probe_node = ts_tree_cursor_current_node (&probe);
+
+         /* PROBE matched, depending on NAMED, return true/false.  */
+         if (ts_node_eq (probe_node, start))
+           {
+             ts_tree_cursor_delete (&probe);
+             cursor_node = ts_tree_cursor_current_node (cursor);
+             ts_tree_cursor_delete (&probe);
+             return (!named || (named && ts_node_is_named (cursor_node)));
+           }
+
+         /* PROBE didn't match, move CURSOR forward to PROBE's
+            position, but if we are looking for named nodes, only
+            move CURSOR to PROBE if PROBE is at a named node.  */
+         if (!named || (named && ts_node_is_named (probe_node)))
+           for (; delta > 0; delta--)
+             treesit_assume_true (ts_tree_cursor_goto_next_sibling (cursor));
+       }
+      ts_tree_cursor_delete (&probe);
+      return false;
     }
 }
 
-/* Return the first/last named/unnamed child of NODE.  FORWARD controls
-   the direction and NAMED controls the nameness.  */
-static TSNode
-treesit_traverse_child_helper (TSNode node, bool forward, bool named)
+/* Move CURSOR to the first/last child.  FORWARD controls the
+   direction.  NAMED controls the namedness.  If there is a valid
+   child, move CURSOR to it and return true, otherwise don't move
+   CURSOR and return false.  */
+static bool
+treesit_traverse_child_helper (TSTreeCursor *cursor,
+                              bool forward, bool named)
 {
   if (forward)
     {
-      if (named)
-       return ts_node_named_child (node, 0);
+      if (!named)
+       return ts_tree_cursor_goto_first_child (cursor);
       else
-       return ts_node_child (node, 0);
-    }
-  else
-    {
-      if (named)
        {
-         uint32_t count = ts_node_named_child_count (node);
-         uint32_t idx = count == 0 ? 0 : count - 1;
-         return ts_node_named_child (node, idx);
+         if (!ts_tree_cursor_goto_first_child (cursor))
+           return false;
+         /* After this point, if you return false, make sure to go
+            back to parent.  */
+         TSNode first_child = ts_tree_cursor_current_node (cursor);
+         if (ts_node_is_named (first_child))
+           return true;
+
+         if (treesit_traverse_sibling_helper (cursor, true, true))
+           return true;
+         else
+           {
+             treesit_assume_true (ts_tree_cursor_goto_parent (cursor));
+             return false;
+           }
        }
+    }
+  else /* Backward.  */
+    {
+      if (!ts_tree_cursor_goto_first_child (cursor))
+       return false;
+      /* After this point, if you return false, make sure to go
+        back to parent.  */
+
+      /* First go to the last child.  */
+      while (ts_tree_cursor_goto_next_sibling (cursor));
+
+      if (!named)
+       return true;
+      /* Else named... */
+      if (treesit_traverse_sibling_helper(cursor, false, true))
+       return true;
       else
        {
-         uint32_t count = ts_node_child_count (node);
-         uint32_t idx = count == 0 ? 0 : count - 1;
-         return ts_node_child (node, idx);
+         treesit_assume_true (ts_tree_cursor_goto_parent (cursor));
+         return false;
        }
     }
 }
 
-/* Return true if NODE matches PRED.  PRED can be a string or a
-   function.  This function doesn't check for PRED's type.  */
+/* Return true if the node at CURSOR matches PRED.  PRED can be a
+   string or a function.  This function assumes PRED is either a
+   string or a function.  If NAMED is true, also check that the node
+   is named.  */
 static bool
-treesit_traverse_match_predicate (TSNode node, Lisp_Object pred,
-                                 Lisp_Object parser)
+treesit_traverse_match_predicate (TSTreeCursor *cursor, Lisp_Object pred,
+                                 Lisp_Object parser, bool named)
 {
+  TSNode node = ts_tree_cursor_current_node (cursor);
+  if (named && !ts_node_is_named (node))
+    return false;
+
   if (STRINGP (pred))
     {
       const char *type = ts_node_type (node);
@@ -2583,74 +2845,60 @@ treesit_traverse_match_predicate (TSNode node, 
Lisp_Object pred,
       Lisp_Object lisp_node = make_treesit_node (parser, node);
       return !NILP (CALLN (Ffuncall, pred, lisp_node));
     }
-
 }
 
-/* Traverse the parse tree starting from ROOT (but ROOT is not
-   matches against PRED).  PRED can be a function (takes a node and
-   returns nil/non-nil),or a string (treated as regexp matching the
-   node's type, ignores case, must be all single byte characters).  If
-   the node satisfies PRED , terminate, set ROOT to that node, and
-   return true.  If no node satisfies PRED, return FALSE.  PARSER is
-   the parser of ROOT.
+/* Traverse the parse tree starting from CURSOR.  PRED can be a
+   function (takes a node and returns nil/non-nil), or a string
+   (treated as regexp matching the node's type, must be all single
+   byte characters).  If the node satisfies PRED, leave CURSOR on that
+   node and return true.  If no node satisfies PRED, move CURSOR back
+   to starting position and return false.
 
-   LIMIT is the number of levels we descend in the tree.  If NO_LIMIT
-   is true, LIMIT is ignored.  FORWARD controls the direction in which
-   we traverse the tree, true means forward, false backward.  If NAMED
-   is true, only traverse named nodes, if false, all nodes.  If
-   SKIP_ROOT is true, don't match ROOT.  */
+   LIMIT is the number of levels we descend in the tree.  FORWARD
+   controls the direction in which we traverse the tree, true means
+   forward, false backward.  If SKIP_ROOT is true, don't match ROOT.
+   */
 static bool
-treesit_search_dfs (TSNode *root, Lisp_Object pred, Lisp_Object parser,
-                   bool named, bool forward, ptrdiff_t limit, bool no_limit,
+treesit_search_dfs (TSTreeCursor *cursor,
+                   Lisp_Object pred, Lisp_Object parser,
+                   bool forward, bool named, ptrdiff_t limit,
                    bool skip_root)
 {
-  /* TSTreeCursor doesn't allow us to move backward, so we can't use
-     it.  We could use limit == -1 to indicate no_limit == true, but
-     separating them is safer.  */
-  TSNode node = *root;
+  if (!skip_root
+      && treesit_traverse_match_predicate (cursor, pred, parser, named))
+    return true;
 
-  if (!skip_root && treesit_traverse_match_predicate (node, pred, parser))
-    {
-      *root = node;
-      return true;
-    }
+  if (limit == 0)
+    return false;
 
-  if (!no_limit && limit <= 0)
+  if (!treesit_traverse_child_helper (cursor, forward, named))
     return false;
-  else
+  /* After this point, if you return false, make sure to go back to
+     parent.  */
+
+  do /* Iterate through each child.  */
     {
-      int count = (named
-                  ? ts_node_named_child_count (node)
-                  : ts_node_child_count (node));
-      for (int offset = 0; offset < count; offset++)
-       {
-         uint32_t idx = forward ? offset : count - offset - 1;
-         TSNode child = (named
-                         ? ts_node_named_child (node, idx)
-                         : ts_node_child (node, idx));
-
-         if (!ts_node_is_null (child)
-             && treesit_search_dfs (&child, pred, parser, named,
-                                    forward, limit - 1, no_limit, false))
-           {
-             *root = child;
-             return true;
-           }
-       }
-      return false;
+      if (treesit_search_dfs (cursor, pred, parser, forward,
+                             named, limit - 1, false))
+       return true;
     }
+  while (treesit_traverse_sibling_helper (cursor, forward, false));
+
+  /* No match in any child's subtree, go back to starting node.  */
+  treesit_assume_true (ts_tree_cursor_goto_parent (cursor));
+  return false;
 }
 
 /* Go through the whole tree linearly, leaf-first, starting from
    START.  PRED, PARSER, NAMED, FORWARD are the same as in
-   ts_search_subtre.  If UP_ONLY is true, never go to children, only
-   sibling and parents.  */
+   ts_search_subtree.  If a match is found, leave CURSOR at that node,
+   and return true, if no match is found, return false, and CURSOR's
+   position is undefined.  */
 static bool
-treesit_search_forward (TSNode *start, Lisp_Object pred, Lisp_Object parser,
-                       bool named, bool forward)
+treesit_search_forward (TSTreeCursor *cursor,
+                       Lisp_Object pred, Lisp_Object parser,
+                       bool forward, bool named)
 {
-  TSNode node = *start;
-
   /* We don't search for subtree and always search from the leaf
      nodes.  This way repeated call of this function traverses each
      node in the tree once and only once:
@@ -2660,39 +2908,26 @@ treesit_search_forward (TSNode *start, Lisp_Object 
pred, Lisp_Object parser,
   bool initial = true;
   while (true)
     {
-      if (!initial /* We don't match START.  */
-         && treesit_traverse_match_predicate (node, pred, parser))
-       {
-         *start = node;
-         return true;
-       }
+      if (!initial /* We don't match the starting node.  */
+         && treesit_traverse_match_predicate (cursor, pred, parser, named))
+       return true;
       initial = false;
 
-      TSNode next = treesit_traverse_sibling_helper (node, forward, named);
-      while (ts_node_is_null (next))
+      /* Try going to the next sibling, if there is no next sibling,
+        go to parent and try again.  */
+      while (!treesit_traverse_sibling_helper (cursor, forward, named))
        {
          /* There is no next sibling, go to parent.  */
-         node = ts_node_parent (node);
-         if (ts_node_is_null (node))
+         if (!ts_tree_cursor_goto_parent (cursor))
            return false;
 
-         if (treesit_traverse_match_predicate (node, pred, parser))
-           {
-             *start = node;
+         if (treesit_traverse_match_predicate (cursor, pred, parser, named))
              return true;
-           }
-         next = treesit_traverse_sibling_helper (node, forward, named);
        }
       /* We are at the next sibling, deep dive into the first leaf
         node.  */
-      TSNode next_next = treesit_traverse_child_helper (next, forward, named);
-      while (!ts_node_is_null (next_next))
-       {
-         next = next_next;
-         next_next = treesit_traverse_child_helper (next, forward, named);
-       }
-      /* At this point NEXT is a leaf node.  */
-      node = next;
+      while (treesit_traverse_child_helper (cursor, forward, false));
+      /* At this point CURSOR is at a leaf node.  */
     }
 }
 
@@ -2707,7 +2942,8 @@ node's type, or a function that takes a node and returns 
nil/non-nil.
 
 By default, only traverse named nodes, but if ALL is non-nil, traverse
 all nodes.  If BACKWARD is non-nil, traverse backwards.  If LIMIT is
-non-nil, only traverse nodes up to that number of levels down in the tree.
+non-nil, only traverse nodes up to that number of levels down in the
+tree.  If LIMIT is nil, default to 1000.
 
 Return the first matched node, or nil if none matches.  */)
   (Lisp_Object node, Lisp_Object predicate, Lisp_Object backward,
@@ -2719,11 +2955,10 @@ Return the first matched node, or nil if none matches.  
*/)
   CHECK_SYMBOL (all);
   CHECK_SYMBOL (backward);
 
-  ptrdiff_t the_limit = 0;
-  bool no_limit = false;
-  if (NILP (limit))
-    no_limit = true;
-  else
+  /* We use a default limit of 1000.  See bug#59426 for the
+     discussion.  */
+  ptrdiff_t the_limit = 1000;
+  if (!NILP (limit))
     {
       CHECK_FIXNUM (limit);
       the_limit = XFIXNUM (limit);
@@ -2731,13 +2966,17 @@ Return the first matched node, or nil if none matches.  
*/)
 
   treesit_initialize ();
 
-  TSNode treesit_node = XTS_NODE (node)->node;
   Lisp_Object parser = XTS_NODE (node)->parser;
-  if (treesit_search_dfs (&treesit_node, predicate, parser, NILP (all),
-                         NILP (backward), the_limit, no_limit, false))
-    return make_treesit_node (parser, treesit_node);
-  else
-    return Qnil;
+  Lisp_Object return_value = Qnil;
+  TSTreeCursor cursor = treesit_cursor_helper (XTS_NODE (node)->node, parser);
+  if (treesit_search_dfs (&cursor, predicate, parser, NILP (backward),
+                         NILP (all), the_limit, false))
+    {
+      TSNode node = ts_tree_cursor_current_node (&cursor);
+      return_value = make_treesit_node (parser, node);
+    }
+  ts_tree_cursor_delete (&cursor);
+  return return_value;
 }
 
 DEFUN ("treesit-search-forward",
@@ -2781,13 +3020,17 @@ always traverse leaf nodes first, then upwards.  */)
 
   treesit_initialize ();
 
-  TSNode treesit_start = XTS_NODE (start)->node;
   Lisp_Object parser = XTS_NODE (start)->parser;
-  if (treesit_search_forward (&treesit_start, predicate, parser, NILP (all),
-                             NILP (backward)))
-    return make_treesit_node (parser, treesit_start);
-  else
-    return Qnil;
+  Lisp_Object return_value = Qnil;
+  TSTreeCursor cursor = treesit_cursor_helper (XTS_NODE (start)->node, parser);
+  if (treesit_search_forward (&cursor, predicate, parser,
+                             NILP (backward), NILP (all)))
+    {
+      TSNode node = ts_tree_cursor_current_node (&cursor);
+      return_value = make_treesit_node (parser, node);
+    }
+  ts_tree_cursor_delete (&cursor);
+  return return_value;
 }
 
 /* Recursively traverse the tree under CURSOR, and append the result
@@ -2797,15 +3040,14 @@ always traverse leaf nodes first, then upwards.  */)
 static void
 treesit_build_sparse_tree (TSTreeCursor *cursor, Lisp_Object parent,
                           Lisp_Object pred, Lisp_Object process_fn,
-                          ptrdiff_t limit, bool no_limit, Lisp_Object parser)
+                          ptrdiff_t limit, Lisp_Object parser)
 {
-
-  TSNode node = ts_tree_cursor_current_node (cursor);
-  bool match = treesit_traverse_match_predicate (node, pred, parser);
+  bool match = treesit_traverse_match_predicate (cursor, pred, parser, false);
   if (match)
     {
       /* If this node matches pred, add a new node to the parent's
         children list.  */
+      TSNode node = ts_tree_cursor_current_node (cursor);
       Lisp_Object lisp_node = make_treesit_node (parser, node);
       if (!NILP (process_fn))
        lisp_node = CALLN (Ffuncall, process_fn, lisp_node);
@@ -2816,8 +3058,7 @@ treesit_build_sparse_tree (TSTreeCursor *cursor, 
Lisp_Object parent,
       parent = this;
     }
   /* Go through each child.  */
-  if ((no_limit || limit > 0)
-      && ts_tree_cursor_goto_first_child (cursor))
+  if (limit > 0 && ts_tree_cursor_goto_first_child (cursor))
     {
       do
        {
@@ -2825,7 +3066,7 @@ treesit_build_sparse_tree (TSTreeCursor *cursor, 
Lisp_Object parent,
             Then C compilers should be smart enough not to copy NODE
             to stack.  */
          treesit_build_sparse_tree (cursor, parent, pred, process_fn,
-                                    limit - 1, no_limit, parser);
+                                    limit - 1, parser);
        }
       while (ts_tree_cursor_goto_next_sibling (cursor));
       /* Don't forget to come back to this node.  */
@@ -2866,7 +3107,8 @@ If PROCESS-FN is non-nil, it should be a function of one 
argument.  In
 that case, instead of returning the matched nodes, pass each node to
 PROCESS-FN, and use its return value instead.
 
-If non-nil, LIMIT is the number of levels to go down the tree from ROOT.
+If non-nil, LIMIT is the number of levels to go down the tree from
+ROOT.  If LIMIT is nil or omitted, it defaults to 1000.
 
 Each node in the returned tree looks like (NODE . (CHILD ...)).  The
 root of this tree might be nil, if ROOT doesn't match PREDICATE.
@@ -2885,11 +3127,11 @@ a regexp.  */)
 
   if (!NILP (process_fn))
     CHECK_TYPE (FUNCTIONP (process_fn), Qfunctionp, process_fn);
-  ptrdiff_t the_limit = 0;
-  bool no_limit = false;
-  if (NILP (limit))
-    no_limit = true;
-  else
+
+  /* We use a default limit of 1000.  See bug#59426 for the
+     discussion.  */
+  ptrdiff_t the_limit = 1000;
+  if (!NILP (limit))
     {
       CHECK_FIXNUM (limit);
       the_limit = XFIXNUM (limit);
@@ -2897,11 +3139,12 @@ a regexp.  */)
 
   treesit_initialize ();
 
-  TSTreeCursor cursor = ts_tree_cursor_new (XTS_NODE (root)->node);
   Lisp_Object parser = XTS_NODE (root)->parser;
   Lisp_Object parent = Fcons (Qnil, Qnil);
+  TSTreeCursor cursor = treesit_cursor_helper (XTS_NODE (root)->node, parser);
   treesit_build_sparse_tree (&cursor, parent, predicate, process_fn,
-                            the_limit, no_limit, parser);
+                            the_limit, parser);
+  ts_tree_cursor_delete (&cursor);
   Fsetcdr (parent, Fnreverse (Fcdr (parent)));
   if (NILP (Fcdr (parent)))
     return Qnil;
diff --git a/src/treesit.h b/src/treesit.h
index 1473126c5b..6f6423ff47 100644
--- a/src/treesit.h
+++ b/src/treesit.h
@@ -56,13 +56,12 @@ struct Lisp_TS_Parser
      this field to true to force tree-sitter to re-parse.  */
   bool need_reparse;
   /* These two positions record the buffer byte position (1-based) of
-     the "visible region" that tree-sitter sees.  Unlike markers,
-     These two positions do not change as the user inserts and deletes
-     text around them.  Before re-parse, we move these positions to
-     match BUF_BEGV_BYTE and BUF_ZV_BYTE.  Note that we don't need to
-     synchronize these positions when retrieving them in a function
-     that involves a node: if the node is not outdated, these
-     positions are synchronized.  */
+     the "visible region" that tree-sitter sees.  Before re-parse, we
+     move these positions to match BUF_BEGV_BYTE and BUF_ZV_BYTE.
+     Note that we don't need to synchronize these positions when
+     retrieving them in a function that involves a node: if the node
+     is not outdated, these positions are synchronized.  See comment
+     (ref:visible-beg-null) in treesit.c for more explanation.  */
   ptrdiff_t visible_beg;
   ptrdiff_t visible_end;
   /* This counter is incremented every time a change is made to the
diff --git a/src/window.c b/src/window.c
index f116b9a9d7..90fa6ac2df 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2639,7 +2639,7 @@ window_list (void)
          Lisp_Object arglist = Qnil;
 
          /* We are visiting windows in canonical order, and add
-            new windows at the front of args[1], which means we
+            new windows at the front of arglist, which means we
             have to reverse this list at the end.  */
          foreach_window (XFRAME (frame), add_window_to_list, &arglist);
          arglist = Fnreverse (arglist);
@@ -7329,6 +7329,14 @@ the return value is nil.  Otherwise the value is t.  */)
            last_selected_window)
        = selected_window;
 
+      /* We may have deleted windows above.  Then again, maybe we
+        haven't: the functions we call to maybe delete windows can
+        decide a window cannot be deleted.  Force recalculation of
+        Vwindow_list next time it is needed, to make sure stale
+        windows with no buffers don't escape into the wild, which
+        will cause crashes elsewhere.  */
+      Vwindow_list = Qnil;
+
       if (NILP (data->focus_frame)
          || (FRAMEP (data->focus_frame)
              && FRAME_LIVE_P (XFRAME (data->focus_frame))))
diff --git a/src/xdisp.c b/src/xdisp.c
index 5dcf21dc4c..e8df230ef8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3533,6 +3533,33 @@ get_closer_narrowed_begv (struct window *w, ptrdiff_t 
pos)
   return max ((pos / len - 1) * len, BEGV);
 }
 
+ptrdiff_t
+get_locked_narrowing_begv (ptrdiff_t pos)
+{
+  if (long_line_locked_narrowing_region_size <= 0)
+    return BEGV;
+  int len = long_line_locked_narrowing_region_size / 2;
+  int begv = max (pos - len, BEGV);
+  int limit = long_line_locked_narrowing_bol_search_limit;
+  while (limit > 0)
+    {
+      if (begv == BEGV || FETCH_BYTE (CHAR_TO_BYTE (begv) - 1) == '\n')
+       return begv;
+      begv--;
+      limit--;
+    }
+  return begv;
+}
+
+ptrdiff_t
+get_locked_narrowing_zv (ptrdiff_t pos)
+{
+  if (long_line_locked_narrowing_region_size <= 0)
+    return ZV;
+  int len = long_line_locked_narrowing_region_size / 2;
+  return min (pos + len, ZV);
+}
+
 static void
 unwind_narrowed_begv (Lisp_Object point_min)
 {
@@ -4366,18 +4393,20 @@ handle_fontified_prop (struct it *it)
 
       eassert (it->end_charpos == ZV);
 
-      if (current_buffer->long_line_optimizations_p)
+      if (current_buffer->long_line_optimizations_p
+         && long_line_locked_narrowing_region_size > 0)
        {
-         ptrdiff_t begv = it->narrowed_begv;
-         ptrdiff_t zv = it->narrowed_zv;
+         ptrdiff_t begv = it->locked_narrowing_begv;
+         ptrdiff_t zv = it->locked_narrowing_zv;
          ptrdiff_t charpos = IT_CHARPOS (*it);
          if (charpos < begv || charpos > zv)
            {
-             begv = get_narrowed_begv (it->w, charpos);
-             zv = get_narrowed_zv (it->w, charpos);
+             begv = get_locked_narrowing_begv (charpos);
+             zv = get_locked_narrowing_zv (charpos);
            }
-         narrow_to_region_internal (make_fixnum (begv), make_fixnum (zv), 
true);
-         specbind (Qrestrictions_locked, Qt);
+         if (begv != BEG || zv != Z)
+           narrow_to_region_locked (make_fixnum (begv), make_fixnum (zv),
+                                    Qfontification_functions);
        }
 
       /* Don't allow Lisp that runs from 'fontification-functions'
@@ -6252,13 +6281,16 @@ static ptrdiff_t
 string_buffer_position (Lisp_Object string, ptrdiff_t around_charpos)
 {
   const int MAX_DISTANCE = 1000;
+  ptrdiff_t forward_limit = min (around_charpos + MAX_DISTANCE, ZV);
   ptrdiff_t found = string_buffer_position_lim (string, around_charpos,
-                                               around_charpos + MAX_DISTANCE,
-                                               false);
+                                               forward_limit, false);
 
   if (!found)
-    found = string_buffer_position_lim (string, around_charpos,
-                                       around_charpos - MAX_DISTANCE, true);
+    {
+      ptrdiff_t backward_limit = max (around_charpos - MAX_DISTANCE, BEGV);
+      found = string_buffer_position_lim (string, around_charpos,
+                                         backward_limit, true);
+    }
   return found;
 }
 
@@ -7435,12 +7467,20 @@ reseat (struct it *it, struct text_pos pos, bool 
force_p)
        {
          it->narrowed_begv = get_narrowed_begv (it->w, window_point (it->w));
          it->narrowed_zv = get_narrowed_zv (it->w, window_point (it->w));
+         it->locked_narrowing_begv
+           = get_locked_narrowing_begv (window_point (it->w));
+         it->locked_narrowing_zv
+           = get_locked_narrowing_zv (window_point (it->w));
        }
       else if ((pos.charpos < it->narrowed_begv || pos.charpos > 
it->narrowed_zv)
                && (!redisplaying_p || it->line_wrap == TRUNCATE))
        {
          it->narrowed_begv = get_narrowed_begv (it->w, pos.charpos);
          it->narrowed_zv = get_narrowed_zv (it->w, pos.charpos);
+         it->locked_narrowing_begv
+           = get_locked_narrowing_begv (window_point (it->w));
+         it->locked_narrowing_zv
+           = get_locked_narrowing_zv (window_point (it->w));
        }
     }
 
@@ -16266,7 +16306,6 @@ do { if (! polling_stopped_here) stop_polling ();       
\
 do { if (polling_stopped_here) start_polling ();       \
        polling_stopped_here = false; } while (false)
 
-
 /* Perhaps in the future avoid recentering windows if it
    is not necessary; currently that causes some problems.  */
 
@@ -16352,6 +16391,8 @@ redisplay_internal (void)
   FOR_EACH_FRAME (tail, frame)
     XFRAME (frame)->already_hscrolled_p = false;
 
+  reset_outermost_narrowings ();
+
  retry:
   /* Remember the currently selected window.  */
   sw = w;
@@ -17226,7 +17267,6 @@ mark_window_display_accurate_1 (struct window *w, bool 
accurate_p)
 
       BUF_UNCHANGED_MODIFIED (b) = BUF_MODIFF (b);
       BUF_OVERLAY_UNCHANGED_MODIFIED (b) = BUF_OVERLAY_MODIFF (b);
-      BUF_CHARS_UNCHANGED_MODIFIED (b) = BUF_CHARS_MODIFF (b);
       BUF_BEG_UNCHANGED (b) = BUF_GPT (b) - BUF_BEG (b);
       BUF_END_UNCHANGED (b) = BUF_Z (b) - BUF_GPT (b);
 
@@ -19392,6 +19432,13 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
            blank_row (w, row, y);
          goto finish_scroll_bars;
        }
+      else if (minibuf_level >= 1)
+       {
+         /* We could have a message produced by set-minibuffer-message
+            displayed in the mini-window as an overlay, so resize the
+            mini-window if needed.  */
+         resize_mini_window (w, false);
+       }
 
       clear_glyph_matrix (w->desired_matrix);
     }
@@ -19497,7 +19544,8 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
   /* Check whether the buffer to be displayed contains long lines.  */
   if (!NILP (Vlong_line_threshold)
       && !current_buffer->long_line_optimizations_p
-      && CHARS_MODIFF - CHARS_UNCHANGED_MODIFIED > 8)
+      && (CHARS_MODIFF - UNCHANGED_MODIFIED > 8
+         || current_buffer->clip_changed))
     {
       ptrdiff_t cur, next, found, max = 0, threshold;
       threshold = XFIXNUM (Vlong_line_threshold);
@@ -22578,7 +22626,8 @@ usage: (trace-to-stderr STRING &rest OBJECTS)  */)
  ***********************************************************************/
 
 /* Return a temporary glyph row holding the glyphs of an overlay arrow.
-   Used for non-window-redisplay windows, and for windows w/o left fringe.  */
+   Used for non-window-redisplay windows, and for windows without left
+   fringe.  */
 
 static struct glyph_row *
 get_overlay_arrow_glyph_row (struct window *w, Lisp_Object 
overlay_arrow_string)
@@ -26272,16 +26321,17 @@ display_menu_bar (struct window *w)
   it.first_visible_x = 0;
   it.last_visible_x = FRAME_PIXEL_WIDTH (f);
 #elif defined (HAVE_X_WINDOWS) /* X without toolkit.  */
+  struct window *menu_window = NULL;
+  struct face *face = FACE_FROM_ID (f, MENU_FACE_ID);
+
   if (FRAME_WINDOW_P (f))
     {
       /* Menu bar lines are displayed in the desired matrix of the
         dummy window menu_bar_window.  */
-      struct window *menu_w;
-      menu_w = XWINDOW (f->menu_bar_window);
-      init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows,
+      menu_window = XWINDOW (f->menu_bar_window);
+      init_iterator (&it, menu_window, -1, -1,
+                    menu_window->desired_matrix->rows,
                     MENU_FACE_ID);
-      it.first_visible_x = 0;
-      it.last_visible_x = FRAME_PIXEL_WIDTH (f);
     }
   else
 #endif /* not USE_X_TOOLKIT and not USE_GTK */
@@ -26335,6 +26385,50 @@ display_menu_bar (struct window *w)
 
   /* Compute the total height of the lines.  */
   compute_line_metrics (&it);
+  it.glyph_row->full_width_p = true;
+  it.glyph_row->continued_p = false;
+  it.glyph_row->truncated_on_left_p = false;
+  it.glyph_row->truncated_on_right_p = false;
+
+#if defined (HAVE_X_WINDOWS) && !defined (USE_X_TOOLKIT) && !defined (USE_GTK)
+  /* Make a 3D menu bar have a shadow at its right end.  */
+  extend_face_to_end_of_line (&it);
+  if (face->box != FACE_NO_BOX)
+    {
+      struct glyph *last = (it.glyph_row->glyphs[TEXT_AREA]
+                           + it.glyph_row->used[TEXT_AREA] - 1);
+      int box_thickness = face->box_vertical_line_width;
+      last->right_box_line_p = true;
+      /* Add back the space for the right box line we subtracted in
+        init_iterator, since the right_box_line_p flag will make the
+        glyph wider.  We actually add only as much space as is
+        available for the last glyph of the menu bar and whatever
+        space is left beyond it, since that glyph could be only
+        partially visible.  */
+      if (box_thickness > 0)
+       last->pixel_width += max (0, (box_thickness
+                                     - (it.current_x - it.last_visible_x)));
+    }
+
+  /* With the non-toolkit version, modify the menu bar window height
+     accordingly.  */
+  if (FRAME_WINDOW_P (it.f) && menu_window)
+    {
+      struct glyph_row *row;
+      int delta_height;
+
+      row = it.glyph_row;
+      delta_height
+       = ((row->y + row->height)
+          - WINDOW_BOX_HEIGHT_NO_MODE_LINE (menu_window));
+
+      if (delta_height != 0)
+        {
+         FRAME_MENU_BAR_HEIGHT (it.f) += delta_height;
+         adjust_frame_size (it.f, -1, -1, 3, false, Qmenu_bar_lines);
+       }
+    }
+#endif
 }
 
 /* Deep copy of a glyph row, including the glyphs.  */
@@ -36711,10 +36805,11 @@ fontify a region starting at POS in the current 
buffer, and give
 fontified regions the property `fontified' with a non-nil value.
 
 Note that, when the buffer contains one or more lines whose length is
-above `long-line-threshold', these functions are called with the buffer
-narrowed to a small portion around POS, and the narrowing is locked (see
-`narrow-to-region'), so that these functions cannot use `widen' to gain
-access to other portions of buffer text.  */);
+above `long-line-threshold', these functions are called with the
+buffer narrowed to a small portion around POS (whose size is specified
+by `long-line-locked-narrowing-region-size'), and the narrowing is
+locked (see `narrowing-lock'), so that these functions cannot use
+`widen' to gain access to other portions of buffer text.  */);
   Vfontification_functions = Qnil;
   Fmake_variable_buffer_local (Qfontification_functions);
 
diff --git a/src/xfaces.c b/src/xfaces.c
index df078227c8..be4a7ca71c 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6014,6 +6014,23 @@ realize_non_ascii_face (struct frame *f, Lisp_Object 
font_object,
 }
 #endif /* HAVE_WINDOW_SYSTEM */
 
+/* Remove the attribute at INDEX from the font object if SYMBOL
+   appears in `font-fallback-ignored-attributes'.  */
+
+static void
+font_maybe_unset_attribute (Lisp_Object font_object,
+                           enum font_property_index index, Lisp_Object symbol)
+{
+  Lisp_Object tail = Vface_font_lax_matched_attributes;
+
+  eassert (CONSP (tail));
+
+  FOR_EACH_TAIL_SAFE (tail)
+    {
+      if (EQ (XCAR (tail), symbol))
+       ASET (font_object, index, Qnil);
+    }
+}
 
 /* Realize the fully-specified face with attributes ATTRS in face
    cache CACHE for ASCII characters.  Do it for GUI frame CACHE->f.
@@ -6071,8 +6088,48 @@ realize_gui_face (struct face_cache *cache, Lisp_Object 
attrs[LFACE_VECTOR_SIZE]
            emacs_abort ();
        }
       if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
-       attrs[LFACE_FONT_INDEX]
-         = font_load_for_lface (f, attrs, attrs[LFACE_FONT_INDEX]);
+       {
+         Lisp_Object spec = copy_font_spec (attrs[LFACE_FONT_INDEX]);
+
+         /* Maybe unset several values in SPEC, usually the width,
+            slant, and weight.  The best possible values for these
+            attributes are determined in font_find_for_lface, called
+            by font_load_for_lface, when the list of candidate fonts
+            returned by font_list_entities is sorted by font_select_entity
+            (which calls font_sort_entities, which calls font_score).
+            If these attributes are not unset here, the candidate
+            font list returned by font_list_entities only contains
+            fonts that are exact matches for these weight, slant, and
+            width attributes, which could lead to suboptimal or wrong
+            font selection.  (bug#5934) */
+         if (EQ (Vface_font_lax_matched_attributes, Qt))
+           {
+             /* The default case: clear the font attributes that
+                affect its appearance the least, to try to find some
+                font that is close, if not exact, match.  */
+             ASET (spec, FONT_WEIGHT_INDEX, Qnil);
+             ASET (spec, FONT_SLANT_INDEX, Qnil);
+             ASET (spec, FONT_WIDTH_INDEX, Qnil);
+           }
+         else if (!NILP (Vface_font_lax_matched_attributes))
+           {
+             /* Also allow unsetting specific attributes for
+                debugging purposes.  */
+             font_maybe_unset_attribute (spec, FONT_WEIGHT_INDEX, QCweight);
+             font_maybe_unset_attribute (spec, FONT_SLANT_INDEX, QCslant);
+             font_maybe_unset_attribute (spec, FONT_WIDTH_INDEX, QCwidth);
+             font_maybe_unset_attribute (spec, FONT_FAMILY_INDEX, QCfamily);
+             font_maybe_unset_attribute (spec, FONT_FOUNDRY_INDEX, QCfoundry);
+             font_maybe_unset_attribute (spec, FONT_REGISTRY_INDEX, 
QCregistry);
+             font_maybe_unset_attribute (spec, FONT_ADSTYLE_INDEX, QCadstyle);
+             font_maybe_unset_attribute (spec, FONT_SIZE_INDEX, QCsize);
+             font_maybe_unset_attribute (spec, FONT_DPI_INDEX, QCdpi);
+             font_maybe_unset_attribute (spec, FONT_SPACING_INDEX, QCspacing);
+             font_maybe_unset_attribute (spec, FONT_AVGWIDTH_INDEX, 
QCavgwidth);
+           }
+
+         attrs[LFACE_FONT_INDEX] = font_load_for_lface (f, attrs, spec);
+       }
       if (FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
        {
          face->font = XFONT_OBJECT (attrs[LFACE_FONT_INDEX]);
@@ -7360,6 +7417,35 @@ Lisp programs that change the value of this variable 
should also
 clear the face cache, see `clear-face-cache'.  */);
   face_near_same_color_threshold = 30000;
 
+  DEFVAR_LISP ("face-font-lax-matched-attributes",
+              Vface_font_lax_matched_attributes,
+              doc: /* Whether to match some face attributes in lax manner when 
realizing faces.
+
+If non-nil, some font-related face attributes will be matched in a lax
+manner when looking for candidate fonts.
+If the value is t, the default, the search for fonts will not insist
+on exact match for 3 font attributes: weight, width, and slant.
+Instead, it will examine the available fonts with various values of
+these attributes, and select the font that is the closest possible
+match.  (If an exact match is available, it will still be selected,
+as that is the closest match.)  For example, looking for a semi-bold
+font might select a bold or a medium-weight font if no semi-bold font
+matching other attributes can be found.  This is especially important
+when the `default' face specifies unusual values for one or more of
+these 3 attributes, which other installed fonts don't support.
+
+The value can also be a list of font-related face attribute symbols;
+see `set-face-attribute' for the full list of attributes.  Then the
+corresponding face attributes will be treated as "soft" constraints
+in the manner described above, instead of the default 3 attributes.
+
+If the value is nil, candidate fonts might be rejected if the don't
+have exactly the same values of attributes as the face requests.
+
+This variable exists for debugging of the font-selection process,
+and we advise not to change it otherwise.  */);
+  Vface_font_lax_matched_attributes = Qt;
+
 #ifdef HAVE_WINDOW_SYSTEM
   defsubr (&Sbitmap_spec_p);
   defsubr (&Sx_list_fonts);
diff --git a/src/xfns.c b/src/xfns.c
index fa2c0751d9..668f711bdb 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -43,7 +43,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #ifdef USE_XCB
 #include <xcb/xcb.h>
 #include <xcb/xproto.h>
-#include <xcb/xcb_aux.h>
 #endif
 
 #include "bitmaps/gray.xbm"
@@ -1368,7 +1367,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
         XCreateFontCursor is not a request that waits for a reply,
         and as such can return IDs that will not actually be used by
         the server.  */
-      x_ignore_errors_for_next_request (FRAME_DISPLAY_INFO (f));
+      x_ignore_errors_for_next_request (FRAME_DISPLAY_INFO (f), 0);
 
       /* Free any successfully created cursors.  */
       for (i = 0; i < mouse_cursor_max; i++)
@@ -2643,12 +2642,18 @@ append_wm_protocols (struct x_display_info *dpyinfo,
   if (existing)
     XFree (existing);
 
-  if (!found_wm_ping)
-    protos[num_protos++] = dpyinfo->Xatom_net_wm_ping;
+  if (!dpyinfo->untrusted)
+    {
+      /* Untrusted clients cannot use these protocols which require
+        communicating with the window manager.  */
+
+      if (!found_wm_ping)
+       protos[num_protos++] = dpyinfo->Xatom_net_wm_ping;
 #if !defined HAVE_GTK3 && defined HAVE_XSYNC
-  if (!found_wm_sync_request && dpyinfo->xsync_supported_p)
-    protos[num_protos++] = dpyinfo->Xatom_net_wm_sync_request;
+      if (!found_wm_sync_request && dpyinfo->xsync_supported_p)
+       protos[num_protos++] = dpyinfo->Xatom_net_wm_sync_request;
 #endif
+    }
 
   if (num_protos)
     XChangeProperty (dpyinfo->display,
@@ -5723,13 +5728,13 @@ x_get_net_workarea (struct x_display_info *dpyinfo, 
XRectangle *rect)
     = xcb_get_property (dpyinfo->xcb_connection, 0,
                        (xcb_window_t) dpyinfo->root_window,
                        (xcb_atom_t) dpyinfo->Xatom_net_current_desktop,
-                       XCB_ATOM_CARDINAL, 0, 1);
+                       XA_CARDINAL, 0, 1);
 
   workarea_cookie
     = xcb_get_property (dpyinfo->xcb_connection, 0,
                        (xcb_window_t) dpyinfo->root_window,
                        (xcb_atom_t) dpyinfo->Xatom_net_workarea,
-                       XCB_ATOM_CARDINAL, 0, UINT32_MAX);
+                       XA_CARDINAL, 0, UINT32_MAX);
 
   reply = xcb_get_property_reply (dpyinfo->xcb_connection,
                                  current_desktop_cookie, &error);
@@ -5740,7 +5745,7 @@ x_get_net_workarea (struct x_display_info *dpyinfo, 
XRectangle *rect)
   else
     {
       if (xcb_get_property_value_length (reply) != 4
-         || reply->type != XCB_ATOM_CARDINAL || reply->format != 32)
+         || reply->type != XA_CARDINAL || reply->format != 32)
        rc = false;
       else
        current_workspace = *(uint32_t *) xcb_get_property_value (reply);
@@ -5755,7 +5760,7 @@ x_get_net_workarea (struct x_display_info *dpyinfo, 
XRectangle *rect)
     free (error), rc = false;
   else
     {
-      if (rc && reply->type == XCB_ATOM_CARDINAL && reply->format == 32
+      if (rc && reply->type == XA_CARDINAL && reply->format == 32
          && (xcb_get_property_value_length (reply) / sizeof (uint32_t)
              >= current_workspace + 4))
        {
@@ -7079,8 +7084,8 @@ that mouse buttons are being held down, such as 
immediately after a
   /* Catch errors since interning lots of targets can potentially
      generate a BadAlloc error.  */
   x_catch_errors (FRAME_X_DISPLAY (f));
-  XInternAtoms (FRAME_X_DISPLAY (f), target_names,
-               ntargets, False, target_atoms);
+  x_intern_atoms (FRAME_DISPLAY_INFO (f), target_names,
+                 ntargets, target_atoms);
   x_check_errors (FRAME_X_DISPLAY (f),
                  "Failed to intern target atoms: %s");
   x_uncatch_errors_after_check ();
@@ -7377,20 +7382,6 @@ If TERMINAL is omitted or nil, that stands for the 
selected frame's display.  */
   return Qnil;
 }
 
-/* Wait for responses to all X commands issued so far for frame F.  */
-
-void
-x_sync (struct frame *f)
-{
-  block_input ();
-#ifndef USE_XCB
-  XSync (FRAME_X_DISPLAY (f), False);
-#else
-  xcb_aux_sync (FRAME_DISPLAY_INFO (f)->xcb_connection);
-#endif
-  unblock_input ();
-}
-
 
 /***********************************************************************
                            Window properties
@@ -7484,7 +7475,7 @@ silently ignored.  */)
       elsize = element_format == 32 ? sizeof (long) : element_format >> 3;
       data = xnmalloc (nelements, elsize);
 
-      x_fill_property_data (FRAME_X_DISPLAY (f), value, data, nelements,
+      x_fill_property_data (FRAME_DISPLAY_INFO (f), value, data, nelements,
                             element_format);
     }
   else
@@ -8455,10 +8446,10 @@ compute_tip_xy (struct frame *f, Lisp_Object parms, 
Lisp_Object dx,
   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));
+  left = CDR (Fassq (Qleft, parms));
+  top  = CDR (Fassq (Qtop, parms));
+  right = CDR (Fassq (Qright, parms));
+  bottom = CDR (Fassq (Qbottom, parms));
 
   /* Move the tooltip window where the mouse pointer is.  Resize and
      show it.  */
@@ -8824,14 +8815,14 @@ Text larger than the specified size is clipped.  */)
          for (tail = parms; CONSP (tail); tail = XCDR (tail))
            {
              elt = XCAR (tail);
-             parm = Fcar (elt);
+             parm = CAR (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))))
+                 if (NILP (Fequal (CDR (elt), CDR (last))))
                    {
                      /* We lost, delete the old tooltip.  */
                      delete = true;
@@ -8852,9 +8843,9 @@ Text larger than the specified size is clipped.  */)
          for (tail = tip_last_parms; CONSP (tail); tail = XCDR (tail))
            {
              elt = XCAR (tail);
-             parm = Fcar (elt);
+             parm = CAR (elt);
              if (!EQ (parm, Qleft) && !EQ (parm, Qtop) && !EQ (parm, Qright)
-                 && !EQ (parm, Qbottom) && !NILP (Fcdr (elt)))
+                 && !EQ (parm, Qbottom) && !NILP (CDR (elt)))
                {
                  /* We lost, delete the old tooltip.  */
                  delete = true;
@@ -8975,8 +8966,8 @@ Text larger than the specified size is clipped.  */)
                                  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 = XFIXNUM (CAR (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
+  height = XFIXNUM (CDR (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f);
 
   /* Calculate position of tooltip frame.  */
   compute_tip_xy (tip_f, parms, dx, dy, width, height, &root_x, &root_y);
diff --git a/src/xftfont.c b/src/xftfont.c
index 6043ef9f94..b9686db2a7 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -628,6 +628,12 @@ xftfont_shape (Lisp_Object lgstring, Lisp_Object direction)
 static int
 xftfont_end_for_frame (struct frame *f)
 {
+  /* XftDrawDestroy tries to access dpyinfo->display, which could've
+     been destroyed by now, causing Emacs to crash.  The alternative
+     is to leak the XftDraw, but that's better than a crash.  */
+  if (!FRAME_X_DISPLAY (f))
+    return 0;
+
   block_input ();
   XftDraw *xft_draw;
 
diff --git a/src/xselect.c b/src/xselect.c
index a381fa2352..05548be311 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -16,7 +16,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/>.  */
 
-
 /* Rewritten by jwz */
 
 #include <config.h>
@@ -44,7 +43,7 @@ struct prop_location;
 struct selection_data;
 
 static void x_decline_selection_request (struct selection_input_event *);
-static bool x_convert_selection (Lisp_Object, Lisp_Object, Atom, bool,
+static bool x_convert_selection (Lisp_Object, Lisp_Object, Atom,
                                 struct x_display_info *, bool);
 static bool waiting_for_other_props_on_window (Display *, Window);
 static struct prop_location *expect_property_change (Display *, Window,
@@ -77,18 +76,20 @@ static void x_send_client_event (Lisp_Object, Lisp_Object, 
Lisp_Object,
 #define TRACE0(fmt)            (void) 0
 #define TRACE1(fmt, a0)                (void) 0
 #define TRACE2(fmt, a0, a1)    (void) 0
+#define TRACE3(fmt, a0, a1, a2) (void) 0
 #endif
 
 /* Bytes needed to represent 'long' data.  This is as per libX11; it
    is not necessarily sizeof (long).  */
 #define X_LONG_SIZE 4
 
-/* If this is a smaller number than the max-request-size of the display,
-   emacs will use INCR selection transfer when the selection is larger
-   than this.  The max-request-size is usually around 64k, so if you want
-   emacs to use incremental selection transfers when the selection is
-   smaller than that, set this.  I added this mostly for debugging the
-   incremental transfer stuff, but it might improve server performance.
+/* If this is a smaller number than the max-request-size of the
+   display, Emacs will use INCR selection transfer when the selection
+   is larger than this.  The max-request-size is usually around 64k,
+   so if you want emacs to use incremental selection transfers when
+   the selection is smaller than that, set this.  I added this mostly
+   for debugging the incremental transfer stuff, but it might improve
+   server performance.
 
    This value cannot exceed INT_MAX / max (X_LONG_SIZE, sizeof (long))
    because it is multiplied by X_LONG_SIZE and by sizeof (long) in
@@ -101,7 +102,9 @@ static void x_send_client_event (Lisp_Object, Lisp_Object, 
Lisp_Object,
 static int
 selection_quantum (Display *display)
 {
-  long mrs = XExtendedMaxRequestSize (display);
+  long mrs;
+
+  mrs = XExtendedMaxRequestSize (display);
 
   if (!mrs)
     mrs = XMaxRequestSize (display);
@@ -281,10 +284,8 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object 
selection_value,
     timestamp = dpyinfo->last_user_time;
 
   block_input ();
-  x_catch_errors (display);
-  XSetSelectionOwner (display, selection_atom, selecting_window, timestamp);
-  x_check_errors (display, "Can't set selection: %s");
-  x_uncatch_errors_after_check ();
+  XSetSelectionOwner (display, selection_atom, selecting_window,
+                     timestamp);
   unblock_input ();
 
   /* Now update the local cache */
@@ -308,7 +309,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object 
selection_value,
        /* We know it's not the CAR, so it's easy.  */
        Lisp_Object rest = dpyinfo->terminal->Vselection_alist;
        for (; CONSP (rest); rest = XCDR (rest))
-         if (EQ (prev_value, Fcar (XCDR (rest))))
+         if (EQ (prev_value, CAR (XCDR (rest))))
            {
              XSETCDR (rest, XCDR (XCDR (rest)));
              break;
@@ -369,7 +370,7 @@ x_get_local_selection (Lisp_Object selection_symbol, 
Lisp_Object target_type,
        specbind (Qinhibit_quit, Qt);
 
       CHECK_SYMBOL (target_type);
-      handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist));
+      handler_fn = CDR (Fassq (target_type, Vselection_converter_alist));
 
       if (CONSP (handler_fn))
        handler_fn = XCDR (handler_fn);
@@ -459,7 +460,7 @@ x_decline_selection_request (struct selection_input_event 
*event)
   /* The reason for the error may be that the receiver has
      died in the meantime.  Handle that case.  */
   block_input ();
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSendEvent (dpyinfo->display, reply->requestor,
              False, 0, &reply_base);
   x_stop_ignoring_errors (dpyinfo);
@@ -472,19 +473,65 @@ x_decline_selection_request (struct selection_input_event 
*event)
 
 struct selection_data
 {
+  /* Pointer to the selection data.  */
   unsigned char *data;
+
+  /* A Lisp_Object containing the selection data.  This is either
+     Qnil, or `data' is NULL.  If non-nil, then this must be a string
+     whose contents will be written out verbatim.  */
+  Lisp_Object string;
+
+  /* The size, in number of items, of the selection data.
+     The value is meaningless if string is non-nil.  */
   ptrdiff_t size;
+
+  /* The format of the selection data.  */
   int format;
+
+  /* The type of the selection data.  */
   Atom type;
-  bool nofree;
+
+  /* The property describing the selection data.  */
   Atom property;
-  /* This can be set to non-NULL during x_reply_selection_request, if
-     the selection is waiting for an INCR transfer to complete.  Don't
-     free these; that's done by unexpect_property_change.  */
-  struct prop_location *wait_object;
+
+  /* The next piece of selection data in the current selection request
+     stack frame.  This can be NULL.  */
   struct selection_data *next;
 };
 
+/* Structure representing a single outstanding selection request (or
+   subrequest if MULTIPLE is being used.)  */
+
+struct transfer
+{
+  /* The requestor of this transfer.  */
+  Window requestor;
+
+  /* The current offset in items into the selection data, and the
+     number of items to send with each ChangeProperty request.  */
+  size_t offset, items_per_request;
+
+  /* The display info associated with the transfer.  */
+  struct x_display_info *dpyinfo;
+
+  /* The converted selection data.  */
+  struct selection_data data;
+
+  /* The next and last selection transfers on this list.  */
+  struct transfer *next, *last;
+
+  /* The atimer for the timeout.  */
+  struct atimer *timeout;
+
+  /* The selection serial.  */
+  unsigned int serial;
+
+  /* Flags.  */
+  int flags;
+};
+
+#define SELECTED_EVENTS 1
+
 struct x_selection_request
 {
   /* The last element in this stack.  */
@@ -499,8 +546,8 @@ struct x_selection_request
   /* Linked list of the above (in support of MULTIPLE targets).  */
   struct selection_data *converted_selections;
 
-  /* "Data" to send a requestor for a failed MULTIPLE subtarget.  */
-  Atom conversion_fail_tag;
+  /* The serial used to handle X errors.  */
+  unsigned int serial;
 
   /* Whether or not conversion was successful.  */
   bool converted;
@@ -511,6 +558,50 @@ struct x_selection_request
 
 struct x_selection_request *selection_request_stack;
 
+/* List of all outstanding selection transfers which are currently
+   being processed.  */
+
+struct transfer outstanding_transfers;
+
+/* A counter for selection serials.  */
+
+static unsigned int selection_serial;
+
+
+
+struct prop_location
+{
+  int identifier;
+  Display *display;
+  Window window;
+  Atom property;
+  int desired_state;
+  bool arrived;
+  struct prop_location *next;
+};
+
+static int prop_location_identifier;
+
+static Lisp_Object property_change_reply;
+
+static struct prop_location *property_change_reply_object;
+
+static struct prop_location *property_change_wait_list;
+
+static void
+set_property_change_object (struct prop_location *location)
+{
+  /* Input must be blocked so we don't get the event before we set
+     these.  */
+  if (! input_blocked_p ())
+    emacs_abort ();
+
+  XSETCAR (property_change_reply, Qnil);
+  property_change_reply_object = location;
+}
+
+
+
 static void
 x_push_current_selection_request (struct selection_input_event *se,
                                  struct x_display_info *dpyinfo)
@@ -523,7 +614,6 @@ x_push_current_selection_request (struct 
selection_input_event *se,
   frame->request = se;
   frame->dpyinfo = dpyinfo;
   frame->converted_selections = NULL;
-  frame->conversion_fail_tag = None;
 
   selection_request_stack = frame;
 }
@@ -554,7 +644,7 @@ x_selection_request_lisp_error (void)
   for (cs = frame->converted_selections; cs; cs = next)
     {
       next = cs->next;
-      if (! cs->nofree && cs->data)
+      if (cs->data)
        xfree (cs->data);
       xfree (cs);
     }
@@ -564,250 +654,450 @@ x_selection_request_lisp_error (void)
     x_decline_selection_request (frame->request);
 }
 
-static void
-x_catch_errors_unwind (void)
+
+
+static size_t
+c_size_for_format (int format)
 {
-  block_input ();
-  x_uncatch_errors ();
-  unblock_input ();
+  switch (format)
+    {
+    case 8:
+      return sizeof (char);
+
+    case 16:
+      return sizeof (short);
+
+    case 32:
+      return sizeof (long);
+    }
+
+  emacs_abort ();
 }
-
 
-/* This stuff is so that INCR selections are reentrant (that is, so we can
-   be servicing multiple INCR selection requests simultaneously.)  I haven't
-   actually tested that yet.  */
+static size_t
+x_size_for_format (int format)
+{
+  switch (format)
+    {
+    case 8:
+      return 1;
+
+    case 16:
+      return 2;
 
-/* Keep a list of the property changes that are awaited.  */
+    case 32:
+      return 4;
+    }
 
-struct prop_location
+  emacs_abort ();
+}
+
+/* Return a pointer to the remaining part of the selection data, given
+   a pointer to a struct selection_data and an offset in items.  Place
+   the number of items remaining in REMAINING.  Garbage collection
+   must not happen, or the returned pointer becomes invalid.  */
+
+static unsigned char *
+selection_data_for_offset (struct selection_data *data,
+                          long offset, size_t *remaining)
 {
-  int identifier;
-  Display *display;
-  Window window;
-  Atom property;
-  int desired_state;
-  bool arrived;
-  struct prop_location *next;
-};
+  unsigned char *base;
+  size_t size;
 
-static int prop_location_identifier;
+  if (!NILP (data->string))
+    {
+      base = SDATA (data->string);
+      size = SBYTES (data->string);
+    }
+  else
+    {
+      base = data->data;
+      size = data->size;
+    }
 
-static Lisp_Object property_change_reply;
+  if (offset >= size)
+    {
+      *remaining = 0;
+      return NULL;
+    }
 
-static struct prop_location *property_change_reply_object;
+  base += (offset * c_size_for_format (data->format));
+  *remaining = size - offset;
+  return base;
+}
 
-static struct prop_location *property_change_wait_list;
+/* Return the size, in bytes transferred to the X server, of
+   data->size items of selection data in data->format-bit
+   quantities.  */
 
-static void
-set_property_change_object (struct prop_location *location)
+static size_t
+selection_data_size (struct selection_data *data)
 {
-  /* Input must be blocked so we don't get the event before we set these.  */
-  if (! input_blocked_p ())
-    emacs_abort ();
-  XSETCAR (property_change_reply, Qnil);
-  property_change_reply_object = location;
+  size_t scratch;
+
+  if (!NILP (data->string))
+    return SBYTES (data->string);
+
+  switch (data->format)
+    {
+    case 8:
+      return (size_t) data->size;
+
+    case 16:
+      if (INT_MULTIPLY_WRAPV (data->size, 2, &scratch))
+       return SIZE_MAX;
+
+      return scratch;
+
+    case 32:
+      if (INT_MULTIPLY_WRAPV (data->size, 4, &scratch))
+       return SIZE_MAX;
+
+      return scratch;
+    }
+
+  /* The specified format is invalid.  */
+  emacs_abort ();
 }
 
-
-/* Send the reply to a selection request event EVENT.  */
+/* Return whether or not another outstanding selection transfer is
+   still selecting for events on the specified requestor window.  */
 
-#ifdef TRACE_SELECTION
-static int x_reply_selection_request_cnt;
-#endif  /* TRACE_SELECTION */
+static bool
+transfer_selecting_event (struct x_display_info *dpyinfo,
+                         Window requestor)
+{
+  struct transfer *next;
+
+  next = outstanding_transfers.next;
+  for (; next != &outstanding_transfers; next = next->next)
+    {
+      if (next->requestor == requestor
+         && next->dpyinfo == dpyinfo)
+       return true;
+    }
+
+  return false;
+}
+
+/* Cancel the specified selection transfer.  When called by
+   `start_transfer', the transfer may be partially formed.  */
 
 static void
-x_reply_selection_request (struct selection_input_event *event,
-                           struct x_display_info *dpyinfo)
+x_cancel_selection_transfer (struct transfer *transfer)
 {
-  XEvent reply_base;
-  XSelectionEvent *reply = &(reply_base.xselection);
-  Display *display = SELECTION_EVENT_DISPLAY (event);
-  Window window = SELECTION_EVENT_REQUESTOR (event);
-  ptrdiff_t bytes_remaining;
-  int max_bytes = selection_quantum (display);
-  specpdl_ref count = SPECPDL_INDEX ();
-  struct selection_data *cs;
-  struct x_selection_request *frame;
+  xfree (transfer->data.data);
 
-  frame = selection_request_stack;
+  if (transfer->next)
+    {
+      transfer->next->last = transfer->last;
+      transfer->last->next = transfer->next;
+    }
 
-  reply->type = SelectionNotify;
-  reply->display = display;
-  reply->requestor = window;
-  reply->selection = SELECTION_EVENT_SELECTION (event);
-  reply->time = SELECTION_EVENT_TIME (event);
-  reply->target = SELECTION_EVENT_TARGET (event);
-  reply->property = SELECTION_EVENT_PROPERTY (event);
-  if (reply->property == None)
-    reply->property = reply->target;
+  if (transfer->flags & SELECTED_EVENTS
+      && !transfer_selecting_event (transfer->dpyinfo,
+                                   transfer->requestor)
+      /* This can be called from x_delete_display.  */
+      && transfer->dpyinfo->display)
+    {
+      /* Ignore errors generated by the change window request in case
+        the window has gone away.  */
+      block_input ();
+      x_ignore_errors_for_next_request (transfer->dpyinfo, 0);
+      XSelectInput (transfer->dpyinfo->display,
+                   transfer->requestor, NoEventMask);
+      x_stop_ignoring_errors (transfer->dpyinfo);
+      unblock_input ();
+    }
 
-  block_input ();
-  /* The protected block contains wait_for_property_change, which can
-     run random lisp code (process handlers) or signal.  Therefore, we
-     put the x_uncatch_errors call in an unwind.  */
-  record_unwind_protect_void (x_catch_errors_unwind);
-  x_catch_errors (display);
+  cancel_atimer (transfer->timeout);
+  xfree (transfer);
+}
 
-  /* Loop over converted selections, storing them in the requested
-     properties.  If data is large, only store the first N bytes
-     (section 2.7.2 of ICCCM).  Note that we store the data for a
-     MULTIPLE request in the opposite order; the ICCM says only that
-     the conversion itself must be done in the same order. */
-  for (cs = frame->converted_selections; cs; cs = cs->next)
+static void
+x_selection_transfer_timeout (struct atimer *atimer)
+{
+  struct transfer *transfer;
+
+  transfer = atimer->client_data;
+  x_cancel_selection_transfer (transfer);
+}
+
+/* Start a selection transfer to write the specified selection data to
+   its requestor.  If the data is small enough, write it to the
+   requestor window and return.  Otherwise, start INCR transfer and
+   begin listening for PropertyNotify events on the requestor.  */
+
+static void
+x_start_selection_transfer (struct x_display_info *dpyinfo, Window requestor,
+                           struct selection_data *data)
+{
+  struct transfer *transfer;
+  intmax_t timeout;
+  intmax_t secs;
+  int nsecs;
+  size_t remaining, max_size;
+  unsigned char *xdata;
+  unsigned long data_size;
+
+  timeout = max (0, x_selection_timeout);
+  secs = timeout / 1000;
+  nsecs = (timeout % 1000) * 1000000;
+
+  transfer = xzalloc (sizeof *transfer);
+  transfer->requestor = requestor;
+  transfer->dpyinfo = dpyinfo;
+
+  transfer->timeout = start_atimer (ATIMER_RELATIVE,
+                                   make_timespec (secs, nsecs),
+                                   x_selection_transfer_timeout,
+                                   transfer);
+
+  /* Note that DATA is copied into transfer.  DATA->data is then set
+     to NULL, giving the struct transfer ownership over the selection
+     data.  */
+
+  transfer->data = *data;
+  data->data = NULL;
+
+  /* Finally, transfer now holds a reference to data->string, if it is
+     present.  GC cannot be allowed to happen until this function
+     returns.  */
+  data->string = Qnil;
+
+  /* Now, try to write the selection data.  If it is bigger than
+     selection_quantum (dpyinfo->display), start incremental transfer
+     and link the transfer onto the list of pending selections.
+     Otherwise, write the transfer at once.  */
+
+  max_size = selection_quantum (dpyinfo->display);
+
+  TRACE3 (" x_start_selection_transfer: transferring to 0x%lx.  "
+         "transfer consists of %zu bytes, quantum being %zu",
+         requestor, selection_data_size (&transfer->data),
+         max_size);
+
+  if (selection_data_size (&transfer->data) > max_size)
     {
-      if (cs->property == None)
-       continue;
+      /* Begin incremental selection transfer.  First, calculate how
+        many elements it is ok to write for every ChangeProperty
+        request.  */
+      transfer->items_per_request
+       = (max_size / x_size_for_format (transfer->data.format));
+      TRACE1 (" x_start_selection_transfer: starting incremental"
+             " selection transfer, with %zu items per request",
+             transfer->items_per_request);
+
+      /* Next, link the transfer onto the list of pending selection
+        transfers.  */
+      transfer->next = outstanding_transfers.next;
+      transfer->last = &outstanding_transfers;
+      transfer->next->last = transfer;
+      transfer->last->next = transfer;
+
+      /* Find a valid (non-zero) serial for the selection transfer.
+        Any asynchronously trapped errors will then cause the
+        selection transfer to be cancelled.  */
+      transfer->serial = (++selection_serial
+                         ? selection_serial
+                         : ++selection_serial);
+
+      /* Now, write the INCR property to begin incremental selection
+        transfer.  offset is currently 0.  */
+
+      data_size = selection_data_size (&transfer->data);
+
+      /* Set SELECTED_EVENTS before the actual XSelectInput
+        request.  */
+      transfer->flags |= SELECTED_EVENTS;
+
+      x_ignore_errors_for_next_request (dpyinfo, transfer->serial);
+      XChangeProperty (dpyinfo->display, requestor,
+                      transfer->data.property,
+                      dpyinfo->Xatom_INCR, 32, PropModeReplace,
+                      (unsigned char *) &data_size, 1);
+
+      /* This assumes that Emacs is not selecting for any other events
+        from the requestor!
+
+         If the holder of some manager selections (i.e. the settings
+         manager) asks Emacs for selection data, things will subtly go
+         wrong.  */
+      XSelectInput (dpyinfo->display, requestor, PropertyChangeMask);
+      x_stop_ignoring_errors (dpyinfo);
+    }
+  else
+    {
+      /* Write the property data now.  */
+      xdata = selection_data_for_offset (&transfer->data,
+                                        0, &remaining);
+      eassert (remaining <= INT_MAX);
+
+      TRACE1 (" x_start_selection_transfer:  writing"
+             " %zu elements directly to requestor window",
+             remaining);
+
+      x_ignore_errors_for_next_request (dpyinfo, 0);
+      XChangeProperty (dpyinfo->display, requestor,
+                      transfer->data.property,
+                      transfer->data.type,
+                      transfer->data.format,
+                      PropModeReplace, xdata, remaining);
+      x_stop_ignoring_errors (dpyinfo);
+
+      /* Next, get rid of the transfer.  */
+      x_cancel_selection_transfer (transfer);
+    }
+}
 
-      bytes_remaining = cs->size;
-      bytes_remaining *= cs->format >> 3;
-      if (bytes_remaining <= max_bytes)
-       {
-         /* Send all the data at once, with minimal handshaking.  */
-         TRACE1 ("Sending all %"pD"d bytes", bytes_remaining);
-         XChangeProperty (display, window, cs->property,
-                          cs->type, cs->format, PropModeReplace,
-                          cs->data, cs->size);
-       }
-      else
-       {
-         /* Send an INCR tag to initiate incremental transfer.  */
-         long value[1];
-
-         TRACE2 ("Start sending %"pD"d bytes incrementally (%s)",
-                 bytes_remaining, XGetAtomName (display, cs->property));
-         cs->wait_object
-           = expect_property_change (display, window, cs->property,
-                                     PropertyDelete);
-
-         /* XChangeProperty expects an array of long even if long is
-            more than 32 bits.  */
-         value[0] = min (bytes_remaining, X_LONG_MAX);
-         XChangeProperty (display, window, cs->property,
-                          dpyinfo->Xatom_INCR, 32, PropModeReplace,
-                          (unsigned char *) value, 1);
-         XSelectInput (display, window, PropertyChangeMask);
-       }
+/* Write out the next piece of data that is part of the specified
+   selection transfer.  If no more data remains to be written, write
+   the EOF property and complete the transfer.  */
+
+static void
+x_continue_selection_transfer (struct transfer *transfer)
+{
+  size_t remaining;
+  unsigned char *xdata;
+
+  xdata = selection_data_for_offset (&transfer->data,
+                                    transfer->offset,
+                                    &remaining);
+  remaining = min (remaining, transfer->items_per_request);
+
+  if (!remaining)
+    {
+      /* The transfer is finished.  Write zero-length property data to
+        signal EOF and remove the transfer.  */
+      TRACE0 (" x_continue_selection_transfer: writing 0 items to"
+             " indicate EOF");
+      x_ignore_errors_for_next_request (transfer->dpyinfo, 0);
+      XChangeProperty (transfer->dpyinfo->display,
+                      transfer->requestor,
+                      transfer->data.property,
+                      transfer->data.type,
+                      transfer->data.format,
+                      PropModeReplace,
+                      NULL, 0);
+      x_stop_ignoring_errors (transfer->dpyinfo);
+      TRACE0 (" x_continue_selection_transfer: done sending incrementally");
+
+      x_cancel_selection_transfer (transfer);
+    }
+  else
+    {
+      TRACE2 (" x_continue_selection_transfer: writing %zu items"
+             "; current offset is %zu", remaining, transfer->offset);
+      eassert (remaining <= INT_MAX);
+
+      transfer->offset += remaining;
+
+      x_ignore_errors_for_next_request (transfer->dpyinfo,
+                                       transfer->serial);
+      XChangeProperty (transfer->dpyinfo->display,
+                      transfer->requestor,
+                      transfer->data.property,
+                      transfer->data.type,
+                      transfer->data.format,
+                      PropModeReplace, xdata,
+                      remaining);
+      x_stop_ignoring_errors (transfer->dpyinfo);
     }
+}
 
-  /* Now issue the SelectionNotify event.  */
-  XSendEvent (display, window, False, 0, &reply_base);
-  XFlush (display);
+void
+x_remove_selection_transfers (struct x_display_info *dpyinfo)
+{
+  struct transfer *next, *last;
 
-#ifdef TRACE_SELECTION
-  {
-    char *sel = XGetAtomName (display, reply->selection);
-    char *tgt = XGetAtomName (display, reply->target);
-    TRACE3 ("Sent SelectionNotify: %s, target %s (%d)",
-           sel, tgt, ++x_reply_selection_request_cnt);
-    if (sel) XFree (sel);
-    if (tgt) XFree (tgt);
-  }
-#endif /* TRACE_SELECTION */
+  next = outstanding_transfers.next;
+  while (next != &outstanding_transfers)
+    {
+      last = next;
+      next = next->next;
 
-  /* Finish sending the rest of each of the INCR values.  This should
-     be improved; there's a chance of deadlock if more than one
-     subtarget in a MULTIPLE selection requires an INCR transfer, and
-     the requestor and Emacs loop waiting on different transfers.  */
-  for (cs = frame->converted_selections; cs; cs = cs->next)
-    if (cs->wait_object)
-      {
-       int format_bytes = cs->format / 8;
-       bool had_errors_p = x_had_errors_p (display);
+      if (last->dpyinfo == dpyinfo)
+       x_cancel_selection_transfer (last);
+    }
+}
 
-        /* Must set this inside block_input ().  unblock_input may read
-           events and setting property_change_reply in
-           wait_for_property_change is then too late.  */
-        set_property_change_object (cs->wait_object);
-       unblock_input ();
+/* Handle an X error generated trying to write to a window.  SERIAL
+   identifies the outstanding incremental selection transfer, which is
+   immediately removed.  */
 
-       bytes_remaining = cs->size;
-       bytes_remaining *= format_bytes;
+void
+x_handle_selection_error (unsigned int serial, XErrorEvent *error)
+{
+  struct transfer *next, *last;
 
-       /* Wait for the requestor to ack by deleting the property.
-          This can run Lisp code (process handlers) or signal.  */
-       if (! had_errors_p)
-         {
-           TRACE1 ("Waiting for ACK (deletion of %s)",
-                   XGetAtomName (display, cs->property));
-           wait_for_property_change (cs->wait_object);
-         }
-       else
-         unexpect_property_change (cs->wait_object);
+  if (error->error_code != BadWindow)
+    /* The error was not caused by the window going away.  As such,
+       Emacs must deselect for PropertyChangeMask from the requestor
+       window, which isn't safe here.  Return and wait for the timeout
+       to run.  */
+    return;
 
-       while (bytes_remaining)
-         {
-           int i = ((bytes_remaining < max_bytes)
-                    ? bytes_remaining
-                    : max_bytes) / format_bytes;
-           block_input ();
-
-           cs->wait_object
-             = expect_property_change (display, window, cs->property,
-                                       PropertyDelete);
-
-           TRACE1 ("Sending increment of %d elements", i);
-           TRACE1 ("Set %s to increment data",
-                   XGetAtomName (display, cs->property));
-
-           /* Append the next chunk of data to the property.  */
-           XChangeProperty (display, window, cs->property,
-                            cs->type, cs->format, PropModeAppend,
-                            cs->data, i);
-           bytes_remaining -= i * format_bytes;
-           cs->data += i * ((cs->format == 32) ? sizeof (long)
-                            : format_bytes);
-           XFlush (display);
-           had_errors_p = x_had_errors_p (display);
-            /* See comment above about property_change_reply.  */
-            set_property_change_object (cs->wait_object);
-           unblock_input ();
-
-           if (had_errors_p) break;
-
-           /* Wait for the requestor to ack this chunk by deleting
-              the property.  This can run Lisp code or signal.  */
-           TRACE1 ("Waiting for increment ACK (deletion of %s)",
-                   XGetAtomName (display, cs->property));
-           wait_for_property_change (cs->wait_object);
-         }
+  next = outstanding_transfers.next;
+  while (next != &outstanding_transfers)
+    {
+      last = next;
+      next = next->next;
 
-       /* Now write a zero-length chunk to the property to tell the
-          requestor that we're done.  */
-       block_input ();
-       if (! waiting_for_other_props_on_window (display, window))
-         XSelectInput (display, window, 0);
-
-       TRACE1 ("Set %s to a 0-length chunk to indicate EOF",
-               XGetAtomName (display, cs->property));
-       XChangeProperty (display, window, cs->property,
-                        cs->type, cs->format, PropModeReplace,
-                        cs->data, 0);
-       TRACE0 ("Done sending incrementally");
-      }
+      if (last->serial == serial)
+       {
+         /* Clear SELECTED_EVENTS, so x_cancel_selection_transfer
+            will not make X requests.  That is unsafe inside an error
+            handler, and unnecessary because the window has already
+            gone.  */
+         last->flags &= ~SELECTED_EVENTS;
+         x_cancel_selection_transfer (last);
+       }
+    }
+}
 
-  /* rms, 2003-01-03: I think I have fixed this bug.  */
-  /* The window we're communicating with may have been deleted
-     in the meantime (that's a real situation from a bug report).
-     In this case, there may be events in the event queue still
-     referring to the deleted window, and we'll get a BadWindow error
-     in XTread_socket when processing the events.  I don't have
-     an idea how to fix that.  gerd, 2001-01-98.   */
-  /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are
-     delivered before uncatch errors.  */
-  XSync (display, False);
-  unblock_input ();
+/* Send the reply to a selection request event EVENT.  */
+
+static void
+x_reply_selection_request (struct selection_input_event *event,
+                           struct x_display_info *dpyinfo)
+{
+  XEvent message;
+  struct selection_data *cs;
+  struct x_selection_request *frame;
 
-  /* GTK queues events in addition to the queue in Xlib.  So we
-     UNBLOCK to enter the event loop and get possible errors delivered,
-     and then BLOCK again because x_uncatch_errors requires it.  */
   block_input ();
-  /* This calls x_uncatch_errors.  */
-  unbind_to (count, Qnil);
+  frame = selection_request_stack;
+
+  message.xselection.type = SelectionNotify;
+  message.xselection.display = dpyinfo->display;
+  message.xselection.requestor = SELECTION_EVENT_REQUESTOR (event);
+  message.xselection.selection = SELECTION_EVENT_SELECTION (event);
+  message.xselection.time = SELECTION_EVENT_TIME (event);
+  message.xselection.target = SELECTION_EVENT_TARGET (event);
+  message.xselection.property = SELECTION_EVENT_PROPERTY (event);
+
+  if (message.xselection.property == None)
+    message.xselection.property = message.xselection.target;
+
+  /* For each of the converted selections, start a write transfer from
+     Emacs to the requestor.  */
+  for (cs = frame->converted_selections; cs; cs = cs->next)
+    x_start_selection_transfer (dpyinfo,
+                               SELECTION_EVENT_REQUESTOR (event),
+                               cs);
+
+
+  /* Send the SelectionNotify event to the requestor, telling it that
+     the property data has arrived.  */
+  x_ignore_errors_for_next_request (dpyinfo, 0);
+  XSendEvent (dpyinfo->display, SELECTION_EVENT_REQUESTOR (event),
+             False, NoEventMask, &message);
+  x_stop_ignoring_errors (dpyinfo);
   unblock_input ();
 }
-
-/* Handle a SelectionRequest event EVENT.
-   This is called from keyboard.c when such an event is found in the queue.  */
+
+/* Handle a SelectionRequest event EVENT.  This is called from
+   keyboard.c when such an event is found in the queue.  */
 
 static void
 x_handle_selection_request (struct selection_input_event *event)
@@ -892,7 +1182,9 @@ x_handle_selection_request (struct selection_input_event 
*event)
       ptrdiff_t j, nselections;
       struct selection_data cs;
 
-      if (property == None) goto DONE;
+      if (property == None)
+       goto DONE;
+
       multprop
        = x_get_window_property_as_lisp_data (dpyinfo, requestor, property,
                                              QMULTIPLE, selection, true);
@@ -904,23 +1196,24 @@ x_handle_selection_request (struct selection_input_event 
*event)
       /* Perform conversions.  This can signal.  */
       for (j = 0; j < nselections; j++)
        {
-         Lisp_Object subtarget = AREF (multprop, 2*j);
+         Lisp_Object subtarget = AREF (multprop, 2 * j);
          Atom subproperty = symbol_to_x_atom (dpyinfo,
                                               AREF (multprop, 2*j+1));
          bool subsuccess = false;
 
          if (subproperty != None)
            subsuccess = x_convert_selection (selection_symbol, subtarget,
-                                             subproperty, true, dpyinfo,
+                                             subproperty, dpyinfo,
                                              use_alternate);
          if (!subsuccess)
-           ASET (multprop, 2*j+1, Qnil);
+           ASET (multprop, 2 * j + 1, Qnil);
        }
+
       /* Save conversion results */
       lisp_data_to_selection_data (dpyinfo, multprop, &cs);
 
-      /* If cs.type is ATOM, change it to ATOM_PAIR.  This is because
-        the parameters to a MULTIPLE are ATOM_PAIRs.  */
+      /* If cs.type is ATOM, change it to ATOM_PAIR.  This is
+        because the parameters to a MULTIPLE are ATOM_PAIRs.  */
 
       if (cs.type == XA_ATOM)
        cs.type = dpyinfo->Xatom_ATOM_PAIR;
@@ -929,27 +1222,29 @@ x_handle_selection_request (struct selection_input_event 
*event)
                       cs.type, cs.format, PropModeReplace,
                       cs.data, cs.size);
       success = true;
+
+      xfree (cs.data);
     }
   else
     {
       if (property == None)
        property = SELECTION_EVENT_TARGET (event);
+
       success = x_convert_selection (selection_symbol,
                                     target_symbol, property,
-                                    false, dpyinfo,
-                                    use_alternate);
+                                    dpyinfo, use_alternate);
     }
 
  DONE:
 
-  if (pushed)
-    selection_request_stack->converted = true;
-
   if (success)
     x_reply_selection_request (event, dpyinfo);
   else
     x_decline_selection_request (event);
 
+  if (pushed)
+    selection_request_stack->converted = true;
+
   /* Run the `x-sent-selection-functions' abnormal hook.  */
   if (!NILP (Vx_sent_selection_functions)
       && !BASE_EQ (Vx_sent_selection_functions, Qunbound))
@@ -960,19 +1255,18 @@ x_handle_selection_request (struct selection_input_event 
*event)
  REALLY_DONE:
 
   unbind_to (count, Qnil);
+  return;
 }
 
 /* Perform the requested selection conversion, and write the data to
    the converted_selections linked list, where it can be accessed by
-   x_reply_selection_request.  If FOR_MULTIPLE, write out
-   the data even if conversion fails, using conversion_fail_tag.
+   x_reply_selection_request.
 
    Return true if successful.  */
 
 static bool
-x_convert_selection (Lisp_Object selection_symbol,
-                    Lisp_Object target_symbol, Atom property,
-                    bool for_multiple, struct x_display_info *dpyinfo,
+x_convert_selection (Lisp_Object selection_symbol, Lisp_Object target_symbol,
+                    Atom property, struct x_display_info *dpyinfo,
                     bool use_alternate)
 {
   Lisp_Object lisp_selection;
@@ -988,33 +1282,16 @@ x_convert_selection (Lisp_Object selection_symbol,
   /* A nil return value means we can't perform the conversion.  */
   if (NILP (lisp_selection)
       || (CONSP (lisp_selection) && NILP (XCDR (lisp_selection))))
-    {
-      if (for_multiple)
-       {
-         cs = xmalloc (sizeof *cs);
-         cs->data = ((unsigned char *)
-                     &selection_request_stack->conversion_fail_tag);
-         cs->size = 1;
-         cs->format = 32;
-         cs->type = XA_ATOM;
-         cs->nofree = true;
-         cs->property = property;
-         cs->wait_object = NULL;
-         cs->next = frame->converted_selections;
-         frame->converted_selections = cs;
-       }
-
-      return false;
-    }
+    return false;
 
   /* Otherwise, record the converted selection to binary.  */
   cs = xmalloc (sizeof *cs);
   cs->data = NULL;
-  cs->nofree = true;
+  cs->string = Qnil;
   cs->property = property;
-  cs->wait_object = NULL;
   cs->next = frame->converted_selections;
   frame->converted_selections = cs;
+
   lisp_data_to_selection_data (dpyinfo, lisp_selection, cs);
   return true;
 }
@@ -1129,14 +1406,14 @@ x_clear_frame_selections (struct frame *f)
   while (CONSP (t->Vselection_alist)
         && EQ (frame, XCAR (XCDR (XCDR (XCDR (XCAR (t->Vselection_alist)))))))
     {
-      selection = Fcar (Fcar (t->Vselection_alist));
+      selection = CAR (CAR (t->Vselection_alist));
 
       if (!x_should_preserve_selection (selection))
        /* Run the `x-lost-selection-functions' abnormal hook.  */
        CALLN (Frun_hook_with_args, Qx_lost_selection_functions,
               selection);
       else
-       lost = Fcons (Fcar (t->Vselection_alist), lost);
+       lost = Fcons (CAR (t->Vselection_alist), lost);
 
       tset_selection_alist (t, XCDR (t->Vselection_alist));
     }
@@ -1274,6 +1551,10 @@ void
 x_handle_property_notify (const XPropertyEvent *event)
 {
   struct prop_location *rest;
+  struct transfer *next;
+#ifdef TRACE_SELECTION
+  char *name;
+#endif
 
   for (rest = property_change_wait_list; rest; rest = rest->next)
     {
@@ -1283,9 +1564,16 @@ x_handle_property_notify (const XPropertyEvent *event)
          && rest->display == event->display
          && rest->desired_state == event->state)
        {
+#ifdef TRACE_SELECTION
+         name = XGetAtomName (event->display, event->atom);
+
          TRACE2 ("Expected %s of property %s",
                  (event->state == PropertyDelete ? "deletion" : "change"),
-                 XGetAtomName (event->display, event->atom));
+                 name ? name : "unknown");
+
+         if (name)
+           XFree (name);
+#endif
 
          rest->arrived = true;
 
@@ -1297,6 +1585,26 @@ x_handle_property_notify (const XPropertyEvent *event)
          return;
        }
     }
+
+  /* Look for a property change for an outstanding selection
+     transfer.  */
+  next = outstanding_transfers.next;
+  while (next != &outstanding_transfers)
+    {
+      if (next->dpyinfo->display == event->display
+         && next->requestor == event->window
+         && next->data.property == event->atom
+         && event->state == PropertyDelete)
+       {
+         TRACE1 ("Expected PropertyDelete event arrived from the"
+                 " requestor window %lx", next->requestor);
+
+         x_continue_selection_transfer (next);
+         return;
+       }
+
+      next = next->next;
+    }
 }
 
 static void
@@ -1450,10 +1758,10 @@ x_get_window_property (Display *display, Window window, 
Atom property,
   /* Maximum value for TOTAL_SIZE.  It cannot exceed PTRDIFF_MAX - 1
      and SIZE_MAX - 1, for an extra byte at the end.  And it cannot
      exceed LONG_MAX * X_LONG_SIZE, for XGetWindowProperty.  */
-  ptrdiff_t total_size_max =
-    ((min (PTRDIFF_MAX, SIZE_MAX) - 1) / x_long_size < LONG_MAX
-     ? min (PTRDIFF_MAX, SIZE_MAX) - 1
-     : LONG_MAX * x_long_size);
+  ptrdiff_t total_size_max
+    = ((min (PTRDIFF_MAX, SIZE_MAX) - 1) / x_long_size < LONG_MAX
+       ? min (PTRDIFF_MAX, SIZE_MAX) - 1
+       : LONG_MAX * x_long_size);
 
   block_input ();
 
@@ -1946,10 +2254,14 @@ static void
 lisp_data_to_selection_data (struct x_display_info *dpyinfo,
                             Lisp_Object obj, struct selection_data *cs)
 {
-  Lisp_Object type = Qnil;
+  Lisp_Object type;
+  char **name_buffer;
+
+  USE_SAFE_ALLOCA;
+
+  type = Qnil;
 
   eassert (cs != NULL);
-  cs->nofree = false;
 
   if (CONSP (obj) && SYMBOLP (XCAR (obj)))
     {
@@ -1959,8 +2271,10 @@ lisp_data_to_selection_data (struct x_display_info 
*dpyinfo,
        obj = XCAR (obj);
     }
 
+  /* This is not the same as declining.  */
+
   if (EQ (obj, QNULL) || (EQ (type, QNULL)))
-    {                          /* This is not the same as declining */
+    {
       cs->format = 32;
       cs->size = 0;
       cs->data = NULL;
@@ -1971,12 +2285,14 @@ lisp_data_to_selection_data (struct x_display_info 
*dpyinfo,
       if (SCHARS (obj) < SBYTES (obj))
        /* OBJ is a multibyte string containing a non-ASCII char.  */
        signal_error ("Non-ASCII string must be encoded in advance", obj);
+
       if (NILP (type))
        type = QSTRING;
+
       cs->format = 8;
-      cs->size = SBYTES (obj);
-      cs->data = SDATA (obj);
-      cs->nofree = true;
+      cs->size = -1;
+      cs->data = NULL;
+      cs->string = obj;
     }
   else if (SYMBOLP (obj))
     {
@@ -2048,8 +2364,19 @@ lisp_data_to_selection_data (struct x_display_info 
*dpyinfo,
          x_atoms = data;
          cs->format = 32;
          cs->size = size;
-         for (i = 0; i < size; i++)
-           x_atoms[i] = symbol_to_x_atom (dpyinfo, AREF (obj, i));
+
+         if (size == 1)
+           x_atoms[0] = symbol_to_x_atom (dpyinfo, AREF (obj, i));
+         else
+           {
+             SAFE_NALLOCA (name_buffer, sizeof *x_atoms, size);
+
+             for (i = 0; i < size; i++)
+               name_buffer[i] = SSDATA (SYMBOL_NAME (AREF (obj, i)));
+
+             x_intern_atoms (dpyinfo, name_buffer, size,
+                             x_atoms);
+           }
        }
       else
        /* This vector is an INTEGER set, or something like it */
@@ -2091,6 +2418,8 @@ lisp_data_to_selection_data (struct x_display_info 
*dpyinfo,
     signal_error (/* Qselection_error */ "Unrecognized selection data", obj);
 
   cs->type = symbol_to_x_atom (dpyinfo, type);
+
+  SAFE_FREE ();
 }
 
 static Lisp_Object
@@ -2618,8 +2947,8 @@ x_check_property_data (Lisp_Object data)
    XClientMessageEvent).  */
 
 void
-x_fill_property_data (Display *dpy, Lisp_Object data, void *ret,
-                     int nelements_max, int format)
+x_fill_property_data (struct x_display_info *dpyinfo, Lisp_Object data,
+                     void *ret, int nelements_max, int format)
 {
   unsigned long val;
   unsigned long  *d32 = (unsigned long  *) ret;
@@ -2654,7 +2983,7 @@ x_fill_property_data (Display *dpy, Lisp_Object data, 
void *ret,
       else if (STRINGP (o))
         {
           block_input ();
-          val = XInternAtom (dpy, SSDATA (o), False);
+          val = x_intern_cached_atom (dpyinfo, SSDATA (o), false);
           unblock_input ();
         }
       else
@@ -2942,7 +3271,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object 
dest, Lisp_Object from,
 
   memset (event.xclient.data.l, 0, sizeof (event.xclient.data.l));
   /* event.xclient.data can hold 20 chars, 10 shorts, or 5 longs.  */
-  x_fill_property_data (dpyinfo->display, values, event.xclient.data.b,
+  x_fill_property_data (dpyinfo, values, event.xclient.data.b,
                         5 * 32 / event.xclient.format,
                         event.xclient.format);
 
@@ -3002,10 +3331,11 @@ syms_of_xselect (void)
 
   reading_selection_reply = Fcons (Qnil, Qnil);
   staticpro (&reading_selection_reply);
-
   staticpro (&property_change_reply);
 
-  /* FIXME: Duplicate definition in nsselect.c.  */
+  outstanding_transfers.next = &outstanding_transfers;
+  outstanding_transfers.last = &outstanding_transfers;
+
   DEFVAR_LISP ("selection-converter-alist", Vselection_converter_alist,
               doc: /* An alist associating X Windows selection-types with 
functions.
 These functions are called to convert the selection, with three args:
@@ -3120,9 +3450,43 @@ Note that this does not affect setting or owning 
selections.  */);
 static void
 syms_of_xselect_for_pdumper (void)
 {
+  outstanding_transfers.next = &outstanding_transfers;
+  outstanding_transfers.last = &outstanding_transfers;
+
   reading_selection_window = 0;
   reading_which_selection = 0;
   property_change_wait_list = 0;
   prop_location_identifier = 0;
   property_change_reply = Fcons (Qnil, Qnil);
 }
+
+void
+mark_xselect (void)
+{
+  struct transfer *next;
+  struct x_selection_request *frame;
+  struct selection_data *cs;
+
+  /* Mark all the strings being used as selection data.  A string that
+     is still reachable is always reachable via either the selection
+     request stack or the list of outstanding transfers.  */
+
+  next = outstanding_transfers.next;
+
+  if (!next)
+    /* syms_of_xselect has not yet been called.  */
+    return;
+
+  while (next != &outstanding_transfers)
+    {
+      mark_object (next->data.string);
+      next = next->next;
+    }
+
+  frame = selection_request_stack;
+  for (; frame; frame = frame->last)
+    {
+      for (cs = frame->converted_selections; cs; cs = cs->next)
+       mark_object (cs->string);
+    }
+}
diff --git a/src/xterm.c b/src/xterm.c
index cfd8c385d1..60d4816565 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -26,6 +26,22 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
    contains subroutines comprising the redisplay interface, setting up
    scroll bars and widgets, and handling input.
 
+   X WINDOW SYSTEM
+
+   The X Window System is a windowing system for bitmap graphics
+   displays which originated at MIT in 1984.  Version 11, which is
+   currently supported by Emacs, first appeared in September 1987.
+
+   X has a long history and has been developed by many different
+   organizations over the years; at present, it is being primarily
+   developed by the X.Org Foundation.  It is the main window system
+   that Emacs is developed and tested against, and X version 10 was
+   the first window system that Emacs was ported to.  As a consequence
+   of its age and wide availability, X contains many idiosyncrasies,
+   but that has not prevented it from becoming the dominant free
+   window system, and the platform of reference for all GUI code in
+   Emacs.
+
    Some of what is explained below also applies to the other window
    systems that Emacs supports, to varying degrees.  YMMV.
 
@@ -555,7 +571,56 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
   drop happening with the primary selection and synthetic button
   events (see `x_dnd_do_unsupported_drop').  That function implements
   the OffiX drag-and-drop protocol by default.  See
-  `x-dnd-handle-unsupported-drop' in `x-dnd.el' for more details.  */
+  `x-dnd-handle-unsupported-drop' in `x-dnd.el' for more details.
+
+  DISPLAY ERROR HANDLING
+
+  While error handling under X was originally designed solely as a
+  mechanism for the X server to report fatal errors to clients, most
+  clients (including Emacs) have adopted a system of "error traps" to
+  handle or discard these errors as they arrive.  Discarding errors is
+  usually necessary when Emacs performs an X request that might fail:
+  for example, sending a message to a window that may no longer exist,
+  or might not exist at all.  Handling errors is then necessary when
+  the detailed error must be reported to another piece of code: for
+  example, as a Lisp error.
+
+  It is not acceptable for Emacs to crash when it is sent invalid data
+  by another client, or by Lisp.  As a result, errors must be caught
+  around Xlib functions generating requests containing resource
+  identifiers that could potentially be invalid, such as window or
+  atom identifiers provided in a client message from another program,
+  or a child window ID obtained through XTranslateCoordinates that may
+  refer to a window that has been deleted in the meantime.
+
+  There are two sets of functions used to perform this "error
+  trapping".  Which one should be used depends on what kind of
+  processing must be done on the error.  The first consists of the
+  functions `x_ignore_errors_for_next_request' and
+  `x_stop_ignoring_errors', which ignore errors generated by requests
+  made in between a call to the first function and a corresponding
+  call to the second.  They should be used for simple asynchronous
+  requests that do not require a reply from the X server: using them
+  instead of the second set improves performance, as they simply
+  record a range of request serials to ignore errors from, instead of
+  synchronizing with the X server to handle errors.
+
+  The second set consists of the following functions:
+
+    - x_catch_errors_with_handler
+    - x_catch_errors
+    - x_uncatch_errors_after_check
+    - x_uncatch_errors
+    - x_check_errors
+    - x_had_errors_p
+    - x_clear_errors
+
+  Callers using this set should consult the comment(s) on top of the
+  aformentioned functions.  They should not be used when the requests
+  being made do not require roundtrips to the X server, and obtaining
+  the details of any error generated is unecessary, as
+  `x_uncatch_errors' will always synchronize with the X server, which
+  is a potentially slow operation.  */
 
 #include <config.h>
 #include <stdlib.h>
@@ -574,7 +639,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #ifdef USE_XCB
 #include <xcb/xproto.h>
 #include <xcb/xcb.h>
-#include <xcb/xcb_aux.h>
 #endif
 
 /* If we have Xfixes extension, use it for pointer blanking.  */
@@ -1052,6 +1116,20 @@ static const struct x_atom_ref x_atom_refs[] =
     /* Old OffiX (a.k.a. old KDE) drop protocol support.  */
     ATOM_REFS_INIT ("DndProtocol", Xatom_DndProtocol)
     ATOM_REFS_INIT ("_DND_PROTOCOL", Xatom_DND_PROTOCOL)
+    /* Here are some atoms that are not actually used from C, just
+       defined to make replying to selection requests fast.  */
+    ATOM_REFS_INIT ("text/plain;charset=utf-8", Xatom_text_plain_charset_utf_8)
+    ATOM_REFS_INIT ("LENGTH", Xatom_LENGTH)
+    ATOM_REFS_INIT ("FILE_NAME", Xatom_FILE_NAME)
+    ATOM_REFS_INIT ("CHARACTER_POSITION", Xatom_CHARACTER_POSITION)
+    ATOM_REFS_INIT ("LINE_NUMBER", Xatom_LINE_NUMBER)
+    ATOM_REFS_INIT ("COLUMN_NUMBER", Xatom_COLUMN_NUMBER)
+    ATOM_REFS_INIT ("OWNER_OS", Xatom_OWNER_OS)
+    ATOM_REFS_INIT ("HOST_NAME", Xatom_HOST_NAME)
+    ATOM_REFS_INIT ("USER", Xatom_USER)
+    ATOM_REFS_INIT ("CLASS", Xatom_CLASS)
+    ATOM_REFS_INIT ("NAME", Xatom_NAME)
+    ATOM_REFS_INIT ("SAVE_TARGETS", Xatom_SAVE_TARGETS)
   };
 
 enum
@@ -2509,7 +2587,7 @@ xm_send_drop_message (struct x_display_info *dpyinfo, 
Window source,
   *((uint32_t *) &msg.xclient.data.b[12]) = dmsg->index_atom;
   *((uint32_t *) &msg.xclient.data.b[16]) = dmsg->source_window;
 
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSendEvent (dpyinfo->display, target, False, NoEventMask, &msg);
   x_stop_ignoring_errors (dpyinfo);
 }
@@ -2536,7 +2614,7 @@ xm_send_top_level_enter_message (struct x_display_info 
*dpyinfo, Window source,
   msg.xclient.data.b[18] = 0;
   msg.xclient.data.b[19] = 0;
 
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSendEvent (dpyinfo->display, target, False, NoEventMask, &msg);
   x_stop_ignoring_errors (dpyinfo);
 }
@@ -2567,7 +2645,7 @@ xm_send_drag_motion_message (struct x_display_info 
*dpyinfo, Window source,
   msg.xclient.data.b[18] = 0;
   msg.xclient.data.b[19] = 0;
 
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSendEvent (dpyinfo->display, target, False, NoEventMask, &msg);
   x_stop_ignoring_errors (dpyinfo);
 }
@@ -2626,7 +2704,7 @@ xm_send_top_level_leave_message (struct x_display_info 
*dpyinfo, Window source,
   msg.xclient.data.b[18] = 0;
   msg.xclient.data.b[19] = 0;
 
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSendEvent (dpyinfo->display, target, False, NoEventMask, &msg);
   x_stop_ignoring_errors (dpyinfo);
 }
@@ -2921,7 +2999,7 @@ x_dnd_free_toplevels (bool display_alive)
       if (n_windows)
        {
          eassume (dpyinfo);
-         x_ignore_errors_for_next_request (dpyinfo);
+         x_ignore_errors_for_next_request (dpyinfo, 0);
 
          for (i = 0; i < n_windows; ++i)
            {
@@ -3058,7 +3136,7 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo)
                                     0, 0);
       get_property_cookies[i]
        = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) 
toplevels[i],
-                           (xcb_atom_t) dpyinfo->Xatom_wm_state, XCB_ATOM_ANY,
+                           (xcb_atom_t) dpyinfo->Xatom_wm_state, 0,
                            0, 2);
       xm_property_cookies[i]
        = xcb_get_property (dpyinfo->xcb_connection, 0, (xcb_window_t) 
toplevels[i],
@@ -3069,7 +3147,7 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo)
        = xcb_get_property (dpyinfo->xcb_connection, 0,
                            (xcb_window_t) toplevels[i],
                            (xcb_atom_t) dpyinfo->Xatom_net_frame_extents,
-                           XCB_ATOM_CARDINAL, 0, 4);
+                           XA_CARDINAL, 0, 4);
       get_geometry_cookies[i]
        = xcb_get_geometry (dpyinfo->xcb_connection, (xcb_window_t) 
toplevels[i]);
 
@@ -3197,7 +3275,7 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo)
        {
          if (xcb_get_property_value_length (extent_property_reply) == 16
              && extent_property_reply->format == 32
-             && extent_property_reply->type == XCB_ATOM_CARDINAL)
+             && extent_property_reply->type == XA_CARDINAL)
            {
              fextents = xcb_get_property_value (extent_property_reply);
              frame_extents[0] = fextents[0];
@@ -3291,7 +3369,7 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo)
 
          if (dpyinfo->xshape_supported_p)
            {
-             x_ignore_errors_for_next_request (dpyinfo);
+             x_ignore_errors_for_next_request (dpyinfo, 0);
              XShapeSelectInput (dpyinfo->display,
                                 toplevels[i],
                                 ShapeNotifyMask);
@@ -3456,7 +3534,7 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo)
            }
 #endif
 
-         x_ignore_errors_for_next_request (dpyinfo);
+         x_ignore_errors_for_next_request (dpyinfo, 0);
          XSelectInput (dpyinfo->display, toplevels[i],
                        (attrs.your_event_mask
                         | StructureNotifyMask
@@ -3571,13 +3649,13 @@ x_dnd_get_proxy_proto (struct x_display_info *dpyinfo, 
Window wdesc,
     xdnd_proxy_cookie = xcb_get_property (dpyinfo->xcb_connection, 0,
                                          (xcb_window_t) wdesc,
                                          (xcb_atom_t) dpyinfo->Xatom_XdndProxy,
-                                         XCB_ATOM_WINDOW, 0, 1);
+                                         XA_WINDOW, 0, 1);
 
   if (proto_out)
     xdnd_proto_cookie = xcb_get_property (dpyinfo->xcb_connection, 0,
                                          (xcb_window_t) wdesc,
                                          (xcb_atom_t) dpyinfo->Xatom_XdndAware,
-                                         XCB_ATOM_ATOM, 0, 1);
+                                         XA_ATOM, 0, 1);
 
   if (proxy_out)
     {
@@ -3589,7 +3667,7 @@ x_dnd_get_proxy_proto (struct x_display_info *dpyinfo, 
Window wdesc,
       else
        {
          if (reply->format == 32
-             && reply->type == XCB_ATOM_WINDOW
+             && reply->type == XA_WINDOW
              && (xcb_get_property_value_length (reply) >= 4))
            *proxy_out = *(xcb_window_t *) xcb_get_property_value (reply);
 
@@ -3607,7 +3685,7 @@ x_dnd_get_proxy_proto (struct x_display_info *dpyinfo, 
Window wdesc,
       else
        {
          if (reply->format == 32
-             && reply->type == XCB_ATOM_ATOM
+             && reply->type == XA_ATOM
              && (xcb_get_property_value_length (reply) >= 4))
            *proto_out = (int) *(xcb_atom_t *) xcb_get_property_value (reply);
 
@@ -3791,15 +3869,15 @@ x_dnd_get_wm_state_and_proto (struct x_display_info 
*dpyinfo,
   wmstate_cookie = xcb_get_property (dpyinfo->xcb_connection, 0,
                                     (xcb_window_t) window,
                                     (xcb_atom_t) dpyinfo->Xatom_wm_state,
-                                    XCB_ATOM_ANY, 0, 2);
+                                    0, 0, 2);
   xdnd_proto_cookie = xcb_get_property (dpyinfo->xcb_connection, 0,
                                        (xcb_window_t) window,
                                        (xcb_atom_t) dpyinfo->Xatom_XdndAware,
-                                       XCB_ATOM_ATOM, 0, 1);
+                                       XA_ATOM, 0, 1);
   xdnd_proxy_cookie = xcb_get_property (dpyinfo->xcb_connection, 0,
                                        (xcb_window_t) window,
                                        (xcb_atom_t) dpyinfo->Xatom_XdndProxy,
-                                       XCB_ATOM_WINDOW, 0, 1);
+                                       XA_WINDOW, 0, 1);
   xm_style_cookie = xcb_get_property (dpyinfo->xcb_connection, 0,
                                      (xcb_window_t) window,
                                      (xcb_atom_t) 
dpyinfo->Xatom_MOTIF_DRAG_RECEIVER_INFO,
@@ -3846,7 +3924,7 @@ x_dnd_get_wm_state_and_proto (struct x_display_info 
*dpyinfo,
   else
     {
       if (reply->format == 32
-         && reply->type == XCB_ATOM_WINDOW
+         && reply->type == XA_WINDOW
          && (xcb_get_property_value_length (reply) >= 4))
        *proxy_out = *(xcb_window_t *) xcb_get_property_value (reply);
 
@@ -3962,6 +4040,12 @@ x_dnd_do_unsupported_drop (struct x_display_info 
*dpyinfo,
   if (owner != FRAME_X_WINDOW (f))
     return;
 
+  /* mouse-drag-and-drop-region will immediately deactivate the mark
+     after this is set.  Make sure the primary selection is not
+     clobbered in that case by setting `deactivate-mark' to
+     Qdont_save.  */
+  Vdeactivate_mark = Qdont_save;
+
   event.xbutton.window = child;
   event.xbutton.subwindow = None;
   event.xbutton.x = dest_x;
@@ -3975,7 +4059,7 @@ x_dnd_do_unsupported_drop (struct x_display_info *dpyinfo,
   event.xbutton.type = ButtonPress;
   event.xbutton.time = before + 1;
 
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSendEvent (dpyinfo->display, child,
              True, ButtonPressMask, &event);
 
@@ -4487,7 +4571,7 @@ x_dnd_send_enter (struct frame *f, Window target, Window 
toplevel,
      so we don't have to set it again.  */
   x_dnd_init_type_lists = true;
 
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg);
   x_stop_ignoring_errors (dpyinfo);
 }
@@ -4559,7 +4643,7 @@ x_dnd_send_position (struct frame *f, Window target, 
Window toplevel,
            return;
        }
 
-      x_ignore_errors_for_next_request (dpyinfo);
+      x_ignore_errors_for_next_request (dpyinfo, 0);
       XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg);
       x_stop_ignoring_errors (dpyinfo);
 
@@ -4586,7 +4670,7 @@ x_dnd_send_leave (struct frame *f, Window target, Window 
toplevel)
   x_dnd_waiting_for_status_window = None;
   x_dnd_pending_send_position.type = 0;
 
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg);
   x_stop_ignoring_errors (dpyinfo);
 }
@@ -4619,7 +4703,7 @@ x_dnd_send_drop (struct frame *f, Window target, Window 
toplevel,
   if (supported >= 1)
     msg.xclient.data.l[2] = timestamp;
 
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg);
   x_stop_ignoring_errors (dpyinfo);
   return true;
@@ -6731,7 +6815,7 @@ x_set_frame_alpha (struct frame *f)
      Do this unconditionally as this function is called on reparent when
      alpha has not changed on the frame.  */
 
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
 
   if (!FRAME_PARENT_FRAME (f))
     {
@@ -6907,6 +6991,7 @@ static void
 x_sync_wait_for_frame_drawn_event (struct frame *f)
 {
   XEvent event;
+  struct x_display_info *dpyinfo;
 
   if (!FRAME_X_WAITING_FOR_DRAW (f)
       /* The compositing manager can't draw a frame if it is
@@ -6914,21 +6999,42 @@ x_sync_wait_for_frame_drawn_event (struct frame *f)
       || !FRAME_VISIBLE_P (f))
     return;
 
+  dpyinfo = FRAME_DISPLAY_INFO (f);
+
   /* Wait for the frame drawn message to arrive.  */
   if (x_if_event (FRAME_X_DISPLAY (f), &event,
                  x_sync_is_frame_drawn_event, (XPointer) f,
                  make_timespec (1, 0)))
     {
-      /* TODO: display this warning in the echo area.  */
-      fprintf (stderr, "Warning: compositing manager spent more than 1 second "
-              "drawing a frame.  Frame synchronization has been disabled\n");
-      FRAME_X_OUTPUT (f)->use_vsync_p = false;
+      /* The first time a draw hangs, treat it as a random fluctuation
+        on the part of the compositor.  If the next draw continues to
+        hang, disable frame synchronization.  */
+      if (FRAME_X_DRAW_JUST_HUNG (f))
+       {
+         fprintf (stderr, "Warning: compositing manager spent more than 1 "
+                  "second drawing a frame.  Frame synchronization has "
+                  "been disabled\n");
+         FRAME_X_OUTPUT (f)->use_vsync_p = false;
+
+         /* Remove the compositor bypass property from the outer
+            window.  */
+         XDeleteProperty (dpyinfo->display, FRAME_OUTER_WINDOW (f),
+                          dpyinfo->Xatom_net_wm_bypass_compositor);
 
-      /* Also change the frame parameter to reflect the new state.  */
-      store_frame_param (f, Quse_frame_synchronization, Qnil);
+         /* Also change the frame parameter to reflect the new
+            state.  */
+         store_frame_param (f, Quse_frame_synchronization, Qnil);
+       }
+      else
+       {
+         fprintf (stderr, "Warning: compositing manager spent more than 1 "
+                  "second drawing a frame.  Frame synchronization will be "
+                  "disabled if this happens again\n");
+         FRAME_X_DRAW_JUST_HUNG (f) = true;
+       }
     }
   else
-    x_sync_note_frame_times (FRAME_DISPLAY_INFO (f), f, &event);
+    x_sync_note_frame_times (dpyinfo, f, &event);
 
   FRAME_X_WAITING_FOR_DRAW (f) = false;
 }
@@ -7128,8 +7234,26 @@ static void
 x_sync_handle_frame_drawn (struct x_display_info *dpyinfo,
                           XEvent *message, struct frame *f)
 {
+  XSyncValue value, counter;
+
   if (FRAME_OUTER_WINDOW (f) == message->xclient.window)
-    FRAME_X_WAITING_FOR_DRAW (f) = false;
+    {
+      counter = FRAME_X_COUNTER_VALUE (f);
+
+      /* Check that the counter in the message is the same as the
+        counter in the frame.  */
+      XSyncIntsToValue (&value,
+                       message->xclient.data.l[0] & 0xffffffff,
+                       message->xclient.data.l[1] & 0xffffffff);
+
+      if (XSyncValueEqual (value, counter))
+       FRAME_X_WAITING_FOR_DRAW (f) = false;
+
+      /* As long as a _NET_WM_FRAME_DRAWN message arrives, we know
+        that the compositor is still sending events, so avoid timing
+        out.  */
+      FRAME_X_DRAW_JUST_HUNG (f) = false;
+    }
 
   x_sync_note_frame_times (dpyinfo, f, message);
 }
@@ -10959,6 +11083,31 @@ x_clear_frame (struct frame *f)
   unblock_input ();
 }
 
+/* Send a message to frame F telling the event loop to track whether
+   or not an hourglass is being displayed.  This is required to ignore
+   the right events when the hourglass is mapped without callig XSync
+   after displaying or hiding the hourglass.  */
+
+static void
+x_send_hourglass_message (struct frame *f, bool hourglass_enabled)
+{
+  struct x_display_info *dpyinfo;
+  XEvent msg;
+
+  dpyinfo = FRAME_DISPLAY_INFO (f);
+  memset (&msg, 0, sizeof msg);
+
+  msg.xclient.type = ClientMessage;
+  msg.xclient.message_type
+    = dpyinfo->Xatom_EMACS_TMP;
+  msg.xclient.format = 8;
+  msg.xclient.window = FRAME_X_WINDOW (f);
+  msg.xclient.data.b[0] = hourglass_enabled ? 1 : 0;
+
+  XSendEvent (dpyinfo->display, FRAME_X_WINDOW (f),
+             False, NoEventMask, &msg);
+}
+
 /* RIF: Show hourglass cursor on frame F.  */
 
 static void
@@ -10979,14 +11128,14 @@ x_show_hourglass (struct frame *f)
       if (popup_activated ())
        return;
 
+      x_send_hourglass_message (f, true);
+
 #ifdef USE_X_TOOLKIT
       if (x->widget)
 #else
       if (FRAME_OUTER_WINDOW (f))
 #endif
        {
-         x->hourglass_p = true;
-
          if (!x->hourglass_window)
            {
 #ifndef USE_XCB
@@ -11053,15 +11202,11 @@ x_hide_hourglass (struct frame *f)
     {
 #ifndef USE_XCB
       XUnmapWindow (FRAME_X_DISPLAY (f), x->hourglass_window);
-      /* Sync here because XTread_socket looks at the
-        hourglass_p flag that is reset to zero below.  */
-      XSync (FRAME_X_DISPLAY (f), False);
 #else
       xcb_unmap_window (FRAME_DISPLAY_INFO (f)->xcb_connection,
                        (xcb_window_t) x->hourglass_window);
-      xcb_aux_sync (FRAME_DISPLAY_INFO (f)->xcb_connection);
 #endif
-      x->hourglass_p = false;
+      x_send_hourglass_message (f, false);
     }
 }
 
@@ -11185,21 +11330,32 @@ XTflash (struct frame *f)
 static void
 XTring_bell (struct frame *f)
 {
-  if (FRAME_X_DISPLAY (f))
+  struct x_display_info *dpyinfo;
+
+  if (!FRAME_X_DISPLAY (f))
+    return;
+
+  dpyinfo = FRAME_DISPLAY_INFO (f);
+
+  if (visible_bell)
+    XTflash (f);
+  else
     {
-      if (visible_bell)
-       XTflash (f);
-      else
-       {
-         block_input ();
+      /* When Emacs is untrusted, Bell requests sometimes generate
+        Access errors.  This is not in the security extension
+        specification but seems to be a bug in the X consortium XKB
+        implementation.  */
+
+      block_input ();
+      x_ignore_errors_for_next_request (dpyinfo, 0);
 #ifdef HAVE_XKB
-          XkbBell (FRAME_X_DISPLAY (f), None, 0, None);
+      XkbBell (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 0, None);
 #else
-         XBell (FRAME_X_DISPLAY (f), 0);
+      XBell (FRAME_X_DISPLAY (f), 0);
 #endif
-         XFlush (FRAME_X_DISPLAY (f));
-         unblock_input ();
-       }
+      XFlush (FRAME_X_DISPLAY (f));
+      x_stop_ignoring_errors (dpyinfo);
+      unblock_input ();
     }
 }
 
@@ -11445,7 +11601,7 @@ x_frame_highlight (struct frame *f)
      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).  */
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
                    f->output_data.x->border_pixel);
   x_stop_ignoring_errors (dpyinfo);
@@ -11468,7 +11624,7 @@ x_frame_unhighlight (struct frame *f)
 
   block_input ();
   /* Same as above for XSetWindowBorder (bug#9310).  */
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSetWindowBorderPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
                          f->output_data.x->border_tile);
   x_stop_ignoring_errors (dpyinfo);
@@ -11532,7 +11688,7 @@ x_new_focus_frame (struct x_display_info *dpyinfo, 
struct frame *frame)
   x_frame_rehighlight (dpyinfo);
 }
 
-#ifdef HAVE_XFIXES
+#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
 
 /* True if the display in DPYINFO supports a version of Xfixes
    sufficient for pointer blanking.  */
@@ -11544,11 +11700,12 @@ x_fixes_pointer_blanking_supported (struct 
x_display_info *dpyinfo)
          && dpyinfo->xfixes_major >= 4);
 }
 
-#endif /* HAVE_XFIXES */
+#endif /* HAVE_XFIXES && XFIXES_VERSION >= 40000 */
 
 /* Toggle mouse pointer visibility on frame F using the XFixes
    extension.  */
-#ifdef HAVE_XFIXES
+#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
+
 static void
 xfixes_toggle_visible_pointer (struct frame *f, bool invisible)
 
@@ -11559,6 +11716,7 @@ xfixes_toggle_visible_pointer (struct frame *f, bool 
invisible)
     XFixesShowCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
   f->pointer_invisible = invisible;
 }
+
 #endif /* HAVE_XFIXES */
 
 /* Create invisible cursor on the X display referred by DPYINFO.  */
@@ -11607,7 +11765,7 @@ x_toggle_visible_pointer (struct frame *f, bool 
invisible)
   if (dpyinfo->invisible_cursor == None)
     dpyinfo->invisible_cursor = make_invisible_cursor (dpyinfo);
 
-#ifndef HAVE_XFIXES
+#if !defined HAVE_XFIXES || XFIXES_VERSION < 40000
   if (dpyinfo->invisible_cursor == None)
     invisible = false;
 #else
@@ -11640,7 +11798,7 @@ static void
 XTtoggle_invisible_pointer (struct frame *f, bool invisible)
 {
   block_input ();
-#ifdef HAVE_XFIXES
+#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
   if (FRAME_DISPLAY_INFO (f)->fixes_pointer_blanking
       && x_fixes_pointer_blanking_supported (FRAME_DISPLAY_INFO (f)))
     xfixes_toggle_visible_pointer (f, invisible);
@@ -12229,6 +12387,13 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, 
Atom xaction,
   struct xi_device_t *device;
 #endif
 
+  if (FRAME_DISPLAY_INFO (f)->untrusted)
+    /* Untrusted clients cannot send messages to trusted clients or
+       read the window tree, so drag and drop will likely not work at
+       all.  */
+    error ("Drag-and-drop is not possible when the client is"
+          " not trusted by the X server.");
+
   base = SPECPDL_INDEX ();
 
   /* Bind this here to avoid juggling bindings and SAFE_FREE in
@@ -15000,9 +15165,7 @@ x_send_scroll_bar_event (Lisp_Object window, enum 
scroll_bar_part part,
   XClientMessageEvent *ev = &event.xclient;
   struct window *w = XWINDOW (window);
   struct frame *f = XFRAME (w->frame);
-  intptr_t iw = (intptr_t) w;
   verify (INTPTR_WIDTH <= 64);
-  int sign_shift = INTPTR_WIDTH - 32;
 
   /* Don't do anything if too many scroll bar events have been
      sent but not received.  */
@@ -15019,15 +15182,11 @@ x_send_scroll_bar_event (Lisp_Object window, enum 
scroll_bar_part part,
   ev->window = FRAME_X_WINDOW (f);
   ev->format = 32;
 
-  /* A 32-bit X client can pass a window pointer through the X server
-     as-is.
-
-     A 64-bit client is in trouble because a pointer does not fit in
-     the 32 bits given for ClientMessage data and will be truncated by
-     Xlib.  So use two slots and hope that X12 will resolve such
-     issues someday.  */
-  ev->data.l[0] = iw >> 31 >> 1;
-  ev->data.l[1] = sign_shift <= 0 ? iw : iw << sign_shift >> sign_shift;
+  /* These messages formerly contained a pointer to the window, but
+     now that information is kept internally.  The following two
+     fields are thus zero.  */
+  ev->data.l[0] = 0;
+  ev->data.l[1] = 0;
   ev->data.l[2] = part;
   ev->data.l[3] = portion;
   ev->data.l[4] = whole;
@@ -18458,7 +18617,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                      x_dnd_waiting_for_status_window = None;
                    else
                      {
-                       x_ignore_errors_for_next_request (dpyinfo);
+                       x_ignore_errors_for_next_request (dpyinfo, 0);
                        XSendEvent (dpyinfo->display, target,
                                    False, NoEventMask,
                                    &x_dnd_pending_send_position);
@@ -18572,6 +18731,16 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              }
          }
 
+       if (event->xclient.message_type == dpyinfo->Xatom_EMACS_TMP
+           && event->xclient.format == 8)
+         {
+           /* This is actually an hourglass message.  Set whether or
+              not events from here on have the hourglass enabled.  */
+
+           if (any)
+             FRAME_X_OUTPUT (any)->hourglass_p = event->xclient.data.b[0];
+         }
+
         if (event->xclient.message_type == dpyinfo->Xatom_wm_protocols
             && event->xclient.format == 32)
           {
@@ -19160,7 +19329,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                = xcb_get_property (dpyinfo->xcb_connection, 0,
                                    (xcb_window_t) FRAME_OUTER_WINDOW (f),
                                    (xcb_atom_t) 
dpyinfo->Xatom_net_wm_window_opacity,
-                                   XCB_ATOM_CARDINAL, 0, 1);
+                                   XA_CARDINAL, 0, 1);
              opacity_reply
                = xcb_get_property_reply (dpyinfo->xcb_connection,
                                          opacity_cookie, &error);
@@ -19169,9 +19338,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                free (error), rc = false;
              else
                rc = (opacity_reply->format == 32
-                     && (opacity_reply->type == XCB_ATOM_CARDINAL
-                         || opacity_reply->type == XCB_ATOM_ATOM
-                         || opacity_reply->type == XCB_ATOM_WINDOW)
+                     && (opacity_reply->type == XA_CARDINAL
+                         || opacity_reply->type == XA_ATOM
+                         || opacity_reply->type == XA_WINDOW)
                      && (xcb_get_property_value_length (opacity_reply) >= 4));
 
              if (rc)
@@ -21317,7 +21486,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
            if (FRAME_PARENT_FRAME (f) || (hf && frame_ancestor_p (f, hf)))
              {
-               x_ignore_errors_for_next_request (dpyinfo);
+               x_ignore_errors_for_next_request (dpyinfo, 0);
                XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                                RevertToParent, event->xbutton.time);
                x_stop_ignoring_errors (dpyinfo);
@@ -21430,7 +21599,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                  if (!NILP (tab_bar_arg))
                    inev.ie.arg = tab_bar_arg;
                 }
-            if (FRAME_X_EMBEDDED_P (f))
+
+            if (FRAME_X_EMBEDDED_P (f)
+               && !FRAME_NO_ACCEPT_FOCUS (f))
               xembed_send_message (f, event->xbutton.time,
                                    XEMBED_REQUEST_FOCUS, 0, 0, 0);
           }
@@ -23013,7 +23184,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                          /* This can generate XI_BadDevice if the
                             device's attachment was destroyed
                             server-side.  */
-                         x_ignore_errors_for_next_request (dpyinfo);
+                         x_ignore_errors_for_next_request (dpyinfo, 0);
                          XISetFocus (dpyinfo->display, device->attachment,
                                      /* Note that the input extension
                                         only supports RevertToParent-type
@@ -23026,7 +23197,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                         events to handle focus.  Errors are still
                         caught here in case the window is not
                         viewable.  */
-                     x_ignore_errors_for_next_request (dpyinfo);
+                     x_ignore_errors_for_next_request (dpyinfo, 0);
                      XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW 
(f),
                                      RevertToParent, xev->time);
                      x_stop_ignoring_errors (dpyinfo);
@@ -23198,7 +23369,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                        if (!NILP (tab_bar_arg))
                          inev.ie.arg = tab_bar_arg;
                      }
-                 if (FRAME_X_EMBEDDED_P (f))
+
+                 if (FRAME_X_EMBEDDED_P (f)
+                     && !FRAME_NO_ACCEPT_FOCUS (f))
                    xembed_send_message (f, xev->time,
                                         XEMBED_REQUEST_FOCUS, 0, 0, 0);
                }
@@ -24033,7 +24206,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 #ifndef HAVE_GTK3
                  else if (x_input_grab_touch_events)
                    {
-                     x_ignore_errors_for_next_request (dpyinfo);
+                     x_ignore_errors_for_next_request (dpyinfo, 0);
                      XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
                                          xev->detail, xev->event, 
XIRejectTouch);
                      x_stop_ignoring_errors (dpyinfo);
@@ -25461,14 +25634,38 @@ x_clean_failable_requests (struct x_display_info 
*dpyinfo)
                                    + (last - first));
 }
 
+/* Protect a section of X requests: ignore errors generated by X
+   requests made from now until `x_stop_ignoring_errors'.  Each call
+   must be paired with a call to `x_stop_ignoring_errors', and
+   recursive calls inside the protected section are not allowed.
+
+   The advantage over x_catch_errors followed by
+   x_uncatch_errors_after_check is that this function does not sync to
+   catch errors if requests were made.  It should be used instead of
+   those two functions for catching errors around requests that do not
+   require a reply.
+
+   As a special feature intended to support xselect.c,
+   SELECTION_SERIAL may be an arbitrary number greater than zero: when
+   that is the case, x_select_handle_selection_error is called with
+   the specified number to delete the selection request that
+   encountered the error.  */
+
 void
-x_ignore_errors_for_next_request (struct x_display_info *dpyinfo)
+x_ignore_errors_for_next_request (struct x_display_info *dpyinfo,
+                                 unsigned int selection_serial)
 {
   struct x_failable_request *request, *max;
   unsigned long next_request;
 #ifdef HAVE_GTK3
   GdkDisplay *gdpy;
+#endif
 
+  /* This code is not reentrant, so be sure nothing calls it
+     recursively in response to input.  */
+  block_input ();
+
+#ifdef HAVE_GTK3
   /* GTK 3 tends to override our own error handler inside certain
      callbacks, which this can be called from.  Instead of trying to
      restore our own, add a trap for the following requests with
@@ -25510,6 +25707,7 @@ x_ignore_errors_for_next_request (struct x_display_info 
*dpyinfo)
 
   request->start = next_request;
   request->end = 0;
+  request->selection_serial = selection_serial;
 
   dpyinfo->next_failable_request++;
 }
@@ -25537,6 +25735,8 @@ x_stop_ignoring_errors (struct x_display_info *dpyinfo)
   if (gdpy)
     gdk_x11_display_error_trap_pop_ignored (gdpy);
 #endif
+
+  unblock_input ();
 }
 
 /* Undo the last x_catch_errors call.
@@ -25929,9 +26129,11 @@ For details, see etc/PROBLEMS.\n",
          if (!ioerror && dpyinfo)
            {
              /* Dump the list of error handlers for debugging
-                purposes.  */
+                purposes if the list exists.  */
 
-             fprintf (stderr, "X error handlers currently installed:\n");
+             if ((dpyinfo->failable_requests
+                  != dpyinfo->next_failable_request) || x_error_message)
+               fprintf (stderr, "X error handlers currently installed:\n");
 
              for (failable = dpyinfo->failable_requests;
                   failable < dpyinfo->next_failable_request;
@@ -26020,6 +26222,12 @@ x_error_handler (Display *display, XErrorEvent *event)
                                                + (last - fail));
            }
 
+         /* If a selection transfer is the cause of this error,
+            remove the selection transfer now.  */
+         if (fail->selection_serial)
+           x_handle_selection_error (fail->selection_serial,
+                                     event);
+
          return 0;
        }
     }
@@ -26572,38 +26780,43 @@ x_set_offset (struct frame *f, int xoff, int yoff, 
int change_gravity)
               modified_left, modified_top);
 #endif
 
-  /* 'x_sync_with_move' is too costly for dragging child frames.  */
-  if (!FRAME_PARENT_FRAME (f)
-      /* If no window manager exists, just calling XSync will be
-        sufficient to ensure that the window geometry has been
-        updated.  */
-      && NILP (Vx_no_window_manager))
-    {
-      x_sync_with_move (f, f->left_pos, f->top_pos,
-                       FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN);
-
-      /* change_gravity is non-zero when this function is called from Lisp to
-        programmatically move a frame.  In that case, we call
-        x_check_expected_move to discover if we have a "Type A" or "Type B"
-        window manager, and, for a "Type A" window manager, adjust the position
-        of the frame.
-
-        We call x_check_expected_move if a programmatic move occurred, and
-        either the window manager type (A/B) is unknown or it is Type A but we
-        need to compute the top/left offset adjustment for this frame.  */
-
-      if (change_gravity != 0
-         && (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN
-             || (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A
-                 && (FRAME_X_OUTPUT (f)->move_offset_left == 0
-                     && FRAME_X_OUTPUT (f)->move_offset_top == 0))))
-       x_check_expected_move (f, modified_left, modified_top);
-    }
-  /* Instead, just wait for the last ConfigureWindow request to
-     complete.  No window manager is involved when moving child
-     frames.  */
-  else
-    XSync (FRAME_X_DISPLAY (f), False);
+  /* The following code is too slow over a latent network
+     connection.  */
+  if (NILP (Vx_lax_frame_positioning))
+    {
+      /* 'x_sync_with_move' is too costly for dragging child frames.  */
+      if (!FRAME_PARENT_FRAME (f)
+         /* If no window manager exists, just calling XSync will be
+            sufficient to ensure that the window geometry has been
+            updated.  */
+         && NILP (Vx_no_window_manager))
+       {
+         x_sync_with_move (f, f->left_pos, f->top_pos,
+                           FRAME_DISPLAY_INFO (f)->wm_type == 
X_WMTYPE_UNKNOWN);
+
+         /* change_gravity is non-zero when this function is called from Lisp 
to
+            programmatically move a frame.  In that case, we call
+            x_check_expected_move to discover if we have a "Type A" or "Type B"
+            window manager, and, for a "Type A" window manager, adjust the 
position
+            of the frame.
+
+            We call x_check_expected_move if a programmatic move occurred, and
+            either the window manager type (A/B) is unknown or it is Type A 
but we
+            need to compute the top/left offset adjustment for this frame.  */
+
+         if (change_gravity != 0
+             && (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_UNKNOWN
+                 || (FRAME_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A
+                     && (FRAME_X_OUTPUT (f)->move_offset_left == 0
+                         && FRAME_X_OUTPUT (f)->move_offset_top == 0))))
+           x_check_expected_move (f, modified_left, modified_top);
+       }
+      /* Instead, just wait for the last ConfigureWindow request to
+        complete.  No window manager is involved when moving child
+        frames.  */
+      else
+       XSync (FRAME_X_DISPLAY (f), False);
+    }
 
   unblock_input ();
 }
@@ -26663,6 +26876,12 @@ x_wm_supports_1 (struct x_display_info *dpyinfo, Atom 
want_atom)
   if (!NILP (Vx_no_window_manager))
     return false;
 
+  /* If the window system says Emacs is untrusted, there will be no
+     way to send any information to the window manager, making any
+     hints useless.  */
+  if (dpyinfo->untrusted)
+    return false;
+
   block_input ();
 
   x_catch_errors (dpy);
@@ -26713,13 +26932,14 @@ x_wm_supports_1 (struct x_display_info *dpyinfo, Atom 
want_atom)
 
       if (rc != Success || actual_type != XA_ATOM || x_had_errors_p (dpy))
         {
-          if (tmp_data) XFree (tmp_data);
+          if (tmp_data)
+           XFree (tmp_data);
           x_uncatch_errors ();
           unblock_input ();
           return false;
         }
 
-      dpyinfo->net_supported_atoms = (Atom *)tmp_data;
+      dpyinfo->net_supported_atoms = (Atom *) tmp_data;
       dpyinfo->nr_net_supported_atoms = actual_size;
       dpyinfo->net_supported_window = wmcheck_window;
     }
@@ -27132,13 +27352,12 @@ do_ewmh_fullscreen (struct frame *f)
 static void
 XTfullscreen_hook (struct frame *f)
 {
-  if (FRAME_VISIBLE_P (f))
-    {
-      block_input ();
-      x_check_fullscreen (f);
-      x_sync (f);
-      unblock_input ();
-    }
+  if (!FRAME_VISIBLE_P (f))
+    return;
+
+  block_input ();
+  x_check_fullscreen (f);
+  unblock_input ();
 }
 
 
@@ -27232,10 +27451,7 @@ x_check_fullscreen (struct frame *f)
       if (FRAME_VISIBLE_P (f))
        x_wait_for_event (f, ConfigureNotify);
       else
-       {
-         change_frame_size (f, width, height, false, true, false);
-         x_sync (f);
-       }
+       change_frame_size (f, width, height, false, true, false);
     }
 
   /* `x_net_wm_state' might have reset the fullscreen frame parameter,
@@ -27409,6 +27625,12 @@ x_set_window_size_1 (struct frame *f, bool 
change_gravity,
      we have to make sure to do it here.  */
   SET_FRAME_GARBAGED (f);
 
+  /* The following code is too slow over a latent network
+     connection, so skip it when the user says so.  */
+
+  if (!NILP (Vx_lax_frame_positioning))
+    return;
+
   /* Now, strictly speaking, we can't be sure that this is accurate,
      but the window manager will get around to dealing with the size
      change request eventually, and we'll hear how it went when the
@@ -27449,8 +27671,6 @@ x_set_window_size_1 (struct frame *f, bool 
change_gravity,
       adjust_frame_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, width),
                         FRAME_PIXEL_TO_TEXT_HEIGHT (f, height),
                         5, 0, Qx_set_window_size_1);
-
-      x_sync (f);
     }
 }
 
@@ -27504,7 +27724,7 @@ frame_set_mouse_pixel_position (struct frame *f, int 
pix_x, int pix_y)
       && deviceid != -1)
     {
       block_input ();
-      x_ignore_errors_for_next_request (FRAME_DISPLAY_INFO (f));
+      x_ignore_errors_for_next_request (FRAME_DISPLAY_INFO (f), 0);
       XIWarpPointer (FRAME_X_DISPLAY (f), deviceid, None,
                     FRAME_X_WINDOW (f), 0, 0, 0, 0, pix_x, pix_y);
       x_stop_ignoring_errors (FRAME_DISPLAY_INFO (f));
@@ -27801,7 +28021,7 @@ x_set_input_focus (struct x_display_info *dpyinfo, 
Window window,
        {
          eassert (device->use == XIMasterPointer);
 
-         x_ignore_errors_for_next_request (dpyinfo);
+         x_ignore_errors_for_next_request (dpyinfo, 0);
          XISetFocus (dpyinfo->display, device->attachment,
                      /* Note that the input extension
                         only supports RevertToParent-type
@@ -27816,7 +28036,7 @@ x_set_input_focus (struct x_display_info *dpyinfo, 
Window window,
 
   /* Otherwise, use the pointer device that the X server says is the
      client pointer.  */
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_ignore_errors_for_next_request (dpyinfo, 0);
   XSetInputFocus (dpyinfo->display, window, RevertToParent, time);
   x_stop_ignoring_errors (dpyinfo);
 }
@@ -27838,6 +28058,15 @@ x_focus_frame (struct frame *f, bool noactivate)
 
   dpyinfo = FRAME_DISPLAY_INFO (f);
 
+  if (dpyinfo->untrusted)
+    /* The X server ignores all input focus related requests from
+       untrusted clients.  */
+    return;
+
+  /* The code below is not reentrant wrt to dpyinfo->x_focus_frame and
+     friends being set.  */
+  block_input ();
+
   if (FRAME_X_EMBEDDED_P (f))
     /* For Xembedded frames, normally the embedder forwards key
        events.  See XEmbed Protocol Specification at
@@ -27866,7 +28095,7 @@ x_focus_frame (struct frame *f, bool noactivate)
             the current workspace, and mapping it, etc, before moving
             input focus to the frame.  */
          x_ewmh_activate_frame (f);
-         return;
+         goto out;
        }
 
       if (NILP (Vx_no_window_manager))
@@ -27900,6 +28129,9 @@ x_focus_frame (struct frame *f, bool noactivate)
                              matter.  */
                           CurrentTime);
     }
+
+ out:
+  unblock_input ();
 }
 
 
@@ -27946,7 +28178,7 @@ xembed_send_message (struct frame *f, Time t, enum 
xembed_message msg,
      but I don't understand why: there is no way for clients to
      survive the death of the parent anyway.  */
 
-  x_ignore_errors_for_next_request (FRAME_DISPLAY_INFO (f));
+  x_ignore_errors_for_next_request (FRAME_DISPLAY_INFO (f), 0);
   XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_OUTPUT (f)->parent_desc,
              False, NoEventMask, &event);
   x_stop_ignoring_errors (FRAME_DISPLAY_INFO (f));
@@ -28097,6 +28329,7 @@ x_make_frame_visible (struct frame *f)
        && !FRAME_ICONIFIED_P (f)
        && !FRAME_X_EMBEDDED_P (f)
        && !FRAME_PARENT_FRAME (f)
+       && NILP (Vx_lax_frame_positioning)
        && f->win_gravity == NorthWestGravity
        && previously_visible)
       {
@@ -28125,7 +28358,8 @@ x_make_frame_visible (struct frame *f)
       }
 
     /* Try to wait for a MapNotify event (that is what tells us when a
-       frame becomes visible).  */
+       frame becomes visible).  Unless `x-lax-frame-positioning' is
+       non-nil: there, that is a little slow.  */
 
 #ifdef CYGWIN
     /* On Cygwin, which uses input polling, we need to force input to
@@ -28143,7 +28377,8 @@ x_make_frame_visible (struct frame *f)
     poll_suppress_count = old_poll_suppress_count;
 #endif
 
-    if (!FRAME_VISIBLE_P (f))
+    if (!FRAME_VISIBLE_P (f)
+       && NILP (Vx_lax_frame_positioning))
       {
        if (CONSP (frame_size_history))
          frame_size_history_plain
@@ -28200,7 +28435,7 @@ x_make_frame_invisible (struct frame *f)
        error ("Can't notify window manager of window withdrawal");
       }
 
-  x_sync (f);
+  XSync (FRAME_X_DISPLAY (f), False);
 
   /* We can't distinguish this from iconification
      just by the event that we get from the server.
@@ -28798,6 +29033,53 @@ x_get_atom_name (struct x_display_info *dpyinfo, Atom 
atom,
   return value;
 }
 
+/* Intern an array of atoms, and do so quickly, avoiding extraneous
+   roundtrips to the X server.
+
+   Avoid sending atoms that have already been found to the X server.
+   This cannot do anything that will end up triggering garbage
+   collection.  */
+
+void
+x_intern_atoms (struct x_display_info *dpyinfo, char **names, int count,
+               Atom *atoms_return)
+{
+  int i, j, indices[256];
+  char *new_names[256];
+  Atom results[256], candidate;
+
+  if (count > 256)
+    /* Atoms array too big to inspect reasonably, just send it to the
+       server and back.  */
+    XInternAtoms (dpyinfo->display, new_names, count, False, atoms_return);
+  else
+    {
+      for (i = 0, j = 0; i < count; ++i)
+       {
+         candidate = x_intern_cached_atom (dpyinfo, names[i],
+                                           true);
+
+         if (candidate)
+           atoms_return[i] = candidate;
+         else
+           {
+             indices[j++] = i;
+             new_names[j - 1] = names[i];
+           }
+       }
+
+      if (!j)
+       return;
+
+      /* Now, get the results back from the X server.  */
+      XInternAtoms (dpyinfo->display, new_names, j, False,
+                   results);
+
+      for (i = 0; i < j; ++i)
+       atoms_return[indices[i]] = results[i];
+    }
+}
+
 #ifndef USE_GTK
 
 /* Set up XEmbed for F, and change its save set to handle the parent
@@ -29346,6 +29628,7 @@ struct x_display_info *
 x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
 {
   Display *dpy;
+  XKeyboardState keyboard_state;
   struct terminal *terminal;
   struct x_display_info *dpyinfo;
   XrmDatabase xrdb;
@@ -29565,6 +29848,32 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
   dpyinfo = xzalloc (sizeof *dpyinfo);
   terminal = x_create_terminal (dpyinfo);
 
+  if (!NILP (Vx_detect_server_trust))
+    {
+      /* Detect whether or not the X server trusts this client, which
+        is done by making a SetKeyboardControl request and checking
+        for an Access error.  */
+      XGrabServer (dpy);
+      XGetKeyboardControl (dpy, &keyboard_state);
+
+      x_catch_errors (dpy);
+
+      /* At this point, the display is not on x_display_list, so
+        x_uncatch_errors won't sync.  However, that's okay because
+        x_had_errors_p will.  */
+
+      if (keyboard_state.global_auto_repeat
+         == AutoRepeatModeOn)
+       XAutoRepeatOn (dpy);
+      else
+       XAutoRepeatOff (dpy);
+
+      if (x_had_errors_p (dpy))
+       dpyinfo->untrusted = true;
+      x_uncatch_errors_after_check ();
+      XUngrabServer (dpy);
+    }
+
   dpyinfo->next_failable_request = dpyinfo->failable_requests;
 
   {
@@ -29585,13 +29894,17 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
          {
            char *vendor = ServerVendor (dpy);
 
-           /* Temporarily hide the partially initialized terminal.  */
+           /* Temporarily hide the partially initialized terminal.
+              Use safe_call so that if a signal happens, a partially
+              initialized display (and display connection) is not
+              kept around.  */
            terminal_list = terminal->next_terminal;
            unblock_input ();
-           kset_system_key_alist
-             (terminal->kboard,
-              call1 (Qvendor_specific_keysyms,
-                     vendor ? build_string (vendor) : empty_unibyte_string));
+           kset_system_key_alist (terminal->kboard,
+                                  safe_call1 (Qvendor_specific_keysyms,
+                                              (vendor
+                                               ? build_string (vendor)
+                                               : empty_unibyte_string)));
            block_input ();
            terminal->next_terminal = terminal_list;
            terminal_list = terminal;
@@ -30209,7 +30522,7 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
                                   1, 0, 1);
 
   dpyinfo->invisible_cursor = make_invisible_cursor (dpyinfo);
-#ifdef HAVE_XFIXES
+#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
   dpyinfo->fixes_pointer_blanking = egetenv ("EMACS_XFIXES");
 #endif
 
@@ -30537,8 +30850,13 @@ x_delete_display (struct x_display_info *dpyinfo)
       last = ie;
     }
 
+  /* Delete selection requests bound for dpyinfo from the keyboard
+     buffer.  */
   x_delete_selection_requests (dpyinfo);
 
+  /* And remove any outstanding selection transfers.  */
+  x_remove_selection_transfers (dpyinfo);
+
   if (next_noop_dpyinfo == dpyinfo)
     next_noop_dpyinfo = dpyinfo->next;
 
@@ -30568,6 +30886,9 @@ x_delete_display (struct x_display_info *dpyinfo)
        }
     }
 
+  if (dpyinfo->net_supported_atoms)
+    XFree (dpyinfo->net_supported_atoms);
+
   xfree (dpyinfo->color_names);
   xfree (dpyinfo->color_names_length);
   xfree (dpyinfo->x_id_name);
@@ -30679,7 +31000,11 @@ static struct redisplay_interface 
x_redisplay_interface =
 void
 x_delete_terminal (struct terminal *terminal)
 {
-  struct x_display_info *dpyinfo = terminal->display_info.x;
+  struct x_display_info *dpyinfo;
+  struct frame *f;
+  Lisp_Object tail, frame;
+
+  dpyinfo = terminal->display_info.x;
 
   /* Protect against recursive calls.  delete_frame in
      delete_terminal calls us back when it deletes our last frame.  */
@@ -30687,6 +31012,19 @@ x_delete_terminal (struct terminal *terminal)
     return;
 
   block_input ();
+
+  /* Delete all remaining frames on the display that is going away.
+     Otherwise, font backends assume the display is still up, and
+     xftfont_end_for_frame crashes.  */
+  FOR_EACH_FRAME (tail, frame)
+    {
+      f = XFRAME (frame);
+
+      if (FRAME_LIVE_P (f) && f->terminal == terminal)
+       /* Pass Qnoelisp rather than Qt.  */
+       delete_frame (frame, Qnoelisp);
+    }
+
 #ifdef HAVE_X_I18N
   /* We must close our connection to the XIM server before closing the
      X display.  */
@@ -30700,6 +31038,10 @@ x_delete_terminal (struct terminal *terminal)
       image_destroy_all_bitmaps (dpyinfo);
       XSetCloseDownMode (dpyinfo->display, DestroyAll);
 
+      /* Delete the scratch cursor GC, should it exist.  */
+      if (dpyinfo->scratch_cursor_gc)
+       XFreeGC (dpyinfo->display, dpyinfo->scratch_cursor_gc);
+
       /* Get rid of any drag-and-drop operation that might be in
         progress as well.  */
       if ((x_dnd_in_progress || x_dnd_waiting_for_finish)
@@ -31020,7 +31362,7 @@ x_catch_errors_for_lisp (struct x_display_info *dpyinfo)
   if (!x_fast_protocol_requests)
     x_catch_errors (dpyinfo->display);
   else
-    x_ignore_errors_for_next_request (dpyinfo);
+    x_ignore_errors_for_next_request (dpyinfo, 0);
 }
 
 void
@@ -31229,6 +31571,8 @@ syms_of_xterm (void)
   DEFSYM (Qnow, "now");
   DEFSYM (Qx_dnd_targets_list, "x-dnd-targets-list");
   DEFSYM (Qx_auto_preserve_selections, "x-auto-preserve-selections");
+  DEFSYM (Qexpose, "expose");
+  DEFSYM (Qdont_save, "dont-save");
 
 #ifdef USE_GTK
   xg_default_icon_file = build_pure_c_string 
("icons/hicolor/scalable/apps/emacs.svg");
@@ -31398,7 +31742,6 @@ always uses gtk_window_move and ignores the value of 
this variable.  */);
 This option is only effective when Emacs is built with XInput 2
 support. */);
   Vx_scroll_event_delta_factor = make_float (1.0);
-  DEFSYM (Qexpose, "expose");
 
   DEFVAR_BOOL ("x-gtk-use-native-input", x_gtk_use_native_input,
               doc: /* Non-nil means to use GTK for input method support.
@@ -31612,4 +31955,25 @@ select text over slow X connections.
 If that is still too slow, setting this variable to the symbol
 `really-fast' will make Emacs return only cached values.  */);
   Vx_use_fast_mouse_position = Qnil;
+
+  DEFVAR_LISP ("x-detect-server-trust", Vx_detect_server_trust,
+    doc: /* If non-nil, Emacs should detect whether or not it is trusted by X.
+
+If non-nil, Emacs will make an X request at connection startup that is
+prohibited to untrusted clients under the X Security Extension and
+check whether or not a resulting Access error is generated by the X
+server.  If the X server reports the error, Emacs will disable certain
+features that do not work for untrusted clients.  */);
+  Vx_detect_server_trust = Qnil;
+
+  DEFVAR_LISP ("x-lax-frame-positioning", Vx_lax_frame_positioning,
+    doc: /* If non-nil, Emacs won't compensate for WM geometry behavior.
+
+Setting this to non-nil is useful when the compensation proves to be
+too slow, which is usually true when the X server is located over a
+network connection with high latency.  Doing so will make frame
+creation and placement faster at the cost of reducing the accuracy of
+frame placement via frame parameters, `set-frame-position', and
+`set-frame-size'.  */);
+  Vx_lax_frame_positioning = Qnil;
 }
diff --git a/src/xterm.h b/src/xterm.h
index c36920081d..832ffc172b 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -21,6 +21,22 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #define XTERM_H
 
 #include <X11/Xlib.h>
+
+#ifdef HAVE_XFIXES
+#include <X11/extensions/Xfixes.h>
+
+#if defined HAVE_XINPUT2 && XFIXES_MAJOR < 5
+/* XI2 headers need PointerBarrier, which is not defined in old
+   versions of the fixes library.  Define that type here.  */
+typedef XID PointerBarrier;
+#endif
+#if defined HAVE_XCOMPOSITE && XFIXES_MAJOR < 2
+/* Recent Composite headers need XserverRegion, which is not defined
+   in old versions of the fixes library.  Define that type here.  */
+typedef XID XserverRegion;
+#endif
+#endif
+
 #include <X11/cursorfont.h>
 
 /* Include Xutil.h after keysym.h to work around a bug that prevents
@@ -318,6 +334,9 @@ struct x_failable_request
   /* If this is zero, then the request has not yet been made.
      Otherwise, this is the request that ends this sequence.  */
   unsigned long end;
+
+  /* Any selection event serial associated with this error trap.  */
+  unsigned int selection_serial;
 };
 
 #ifdef HAVE_XFIXES
@@ -360,6 +379,10 @@ struct x_display_info
   /* Number of frames that are on this display.  */
   int reference_count;
 
+  /* True if this display connection cannot communicate with the
+     window manager because it is not trusted by the X server.  */
+  bool untrusted;
+
   /* The Screen this connection is connected to.  */
   Screen *screen;
 
@@ -406,7 +429,7 @@ struct x_display_info
      Unused if this display supports Xfixes extension.  */
   Cursor invisible_cursor;
 
-#ifdef HAVE_XFIXES
+#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
   /* Whether or not to use Xfixes for pointer blanking.  */
   bool fixes_pointer_blanking;
 #endif
@@ -537,6 +560,12 @@ struct x_display_info
      KDE" protocol in x-dnd.el). */
   Atom Xatom_DndProtocol, Xatom_DND_PROTOCOL;
 
+  /* Atoms to make x_intern_cached_atom fast.  */
+  Atom Xatom_text_plain_charset_utf_8, Xatom_LENGTH, Xatom_FILE_NAME,
+    Xatom_CHARACTER_POSITION, Xatom_LINE_NUMBER, Xatom_COLUMN_NUMBER,
+    Xatom_OWNER_OS, Xatom_HOST_NAME, Xatom_USER, Xatom_CLASS,
+    Xatom_NAME, Xatom_SAVE_TARGETS;
+
   /* The frame (if any) which has the X window that has keyboard focus.
      Zero if none.  This is examined by Ffocus_frame in xfns.c.  Note
      that a mere EnterNotify event can set this; if you need to know the
@@ -1179,6 +1208,10 @@ struct x_output
      frame.  */
   bool_bf waiting_for_frame_p : 1;
 
+  /* Whether or not Emacs just skipped waiting for a frame due to a
+     timeout.  */
+  bool_bf draw_just_hung_p : 1;
+
 #if !defined USE_GTK && defined HAVE_CLOCK_GETTIME
   /* Whether or not Emacs should wait for the compositing manager to
      draw frames before starting a new frame.  */
@@ -1392,6 +1425,8 @@ extern void x_mark_frame_dirty (struct frame *f);
   FRAME_X_OUTPUT (f)->extended_frame_counter
 #define FRAME_X_WAITING_FOR_DRAW(f)            \
   FRAME_X_OUTPUT (f)->waiting_for_frame_p
+#define FRAME_X_DRAW_JUST_HUNG(f)              \
+  FRAME_X_OUTPUT (f)->draw_just_hung_p
 #define FRAME_X_COUNTER_VALUE(f)               \
   FRAME_X_OUTPUT (f)->current_extended_counter_value
 #endif
@@ -1638,7 +1673,8 @@ extern bool x_had_errors_p (Display *);
 extern void x_unwind_errors_to (int);
 extern void x_uncatch_errors (void);
 extern void x_uncatch_errors_after_check (void);
-extern void x_ignore_errors_for_next_request (struct x_display_info *);
+extern void x_ignore_errors_for_next_request (struct x_display_info *,
+                                             unsigned int);
 extern void x_stop_ignoring_errors (struct x_display_info *);
 extern void x_clear_errors (Display *);
 extern void x_set_window_size (struct frame *, bool, int, int);
@@ -1711,6 +1747,11 @@ extern Lisp_Object x_handle_translate_coordinates 
(struct frame *, Lisp_Object,
 
 extern Bool x_query_pointer (Display *, Window, Window *, Window *, int *,
                             int *, int *, int *, unsigned int *);
+extern Atom x_intern_cached_atom (struct x_display_info *, const char *,
+                                 bool);
+extern void x_intern_atoms (struct x_display_info *, char **, int, Atom *);
+extern char *x_get_atom_name (struct x_display_info *, Atom, bool *)
+  ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC_FREE;
 
 #ifdef HAVE_GTK3
 extern void x_scroll_bar_configure (GdkEvent *);
@@ -1792,6 +1833,9 @@ extern void x_handle_property_notify (const 
XPropertyEvent *);
 extern void x_handle_selection_notify (const XSelectionEvent *);
 extern void x_handle_selection_event (struct selection_input_event *);
 extern void x_clear_frame_selections (struct frame *);
+extern void x_remove_selection_transfers (struct x_display_info *);
+extern void x_handle_selection_error (unsigned int, XErrorEvent *);
+
 extern Lisp_Object x_atom_to_symbol (struct x_display_info *, Atom);
 extern Atom symbol_to_x_atom (struct x_display_info *, Lisp_Object);
 
@@ -1801,11 +1845,8 @@ extern bool x_handle_dnd_message (struct frame *,
                                  struct input_event *,
                                  bool, int, int);
 extern int x_check_property_data (Lisp_Object);
-extern void x_fill_property_data (Display *,
-                                  Lisp_Object,
-                                  void *,
-                                 int,
-                                  int);
+extern void x_fill_property_data (struct x_display_info *, Lisp_Object,
+                                  void *, int, int);
 extern Lisp_Object x_property_data_to_lisp (struct frame *,
                                             const unsigned char *,
                                             Atom,
@@ -1818,10 +1859,10 @@ extern Lisp_Object x_timestamp_for_selection (struct 
x_display_info *,
                                              Lisp_Object);
 extern void x_own_selection (Lisp_Object, Lisp_Object, Lisp_Object,
                             Lisp_Object, Time);
-extern Atom x_intern_cached_atom (struct x_display_info *, const char *,
-                                 bool);
-extern char *x_get_atom_name (struct x_display_info *, Atom, bool *)
-  ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC_FREE;
+
+extern void mark_xselect (void);
+
+/* Misc definitions.  */
 
 #ifdef USE_GTK
 extern bool xg_set_icon (struct frame *, Lisp_Object);
diff --git a/test/README b/test/README
index 17783a4bac..eb6314c74d 100644
--- a/test/README
+++ b/test/README
@@ -118,7 +118,7 @@ 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, dnd-tests.el, filenotify-tests.el,
+(autorevert-tests.el, dnd-tests.el, eglot-tests.el, filenotify-tests.el,
 shadowfile-tests.el and tramp-tests.el).  Per default, a mock-up
 connection method is used (this might not be possible when running on
 MS Windows).  If you want to test a real remote connection, set
diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml
index e034430edc..96fe9e3a1c 100644
--- a/test/infra/gitlab-ci.yml
+++ b/test/infra/gitlab-ci.yml
@@ -155,7 +155,7 @@ default:
 .filenotify-gio-template:
   rules:
     - if: '$CI_PIPELINE_SOURCE == "web"'
-    - if: '$CI_PIPELINE_SOURCE == "schedule"'
+    # - if: '$CI_PIPELINE_SOURCE == "schedule"'
       changes:
         - "**.in"
         - lisp/autorevert.el
@@ -246,17 +246,17 @@ test-gnustep:
     target: emacs-gnustep
     make_params: install
 
-build-native-comp-speed0:
-  stage: native-comp-images
-  extends: [.job-template, .build-template, .native-comp-template]
-  variables:
-    target: emacs-native-comp-speed0
+# build-native-comp-speed0:
+#   stage: native-comp-images
+#   extends: [.job-template, .build-template, .native-comp-template]
+#   variables:
+#     target: emacs-native-comp-speed0
 
-build-native-comp-speed1:
-  stage: native-comp-images
-  extends: [.job-template, .build-template, .native-comp-template]
-  variables:
-    target: emacs-native-comp-speed1
+# build-native-comp-speed1:
+#   stage: native-comp-images
+#   extends: [.job-template, .build-template, .native-comp-template]
+#   variables:
+#     target: emacs-native-comp-speed1
 
 build-native-comp-speed2:
   stage: native-comp-images
@@ -264,14 +264,14 @@ build-native-comp-speed2:
   variables:
     target: emacs-native-comp-speed2
 
-test-native-comp-speed0:
+test-native-comp-speed2:
   stage: native-comp
   extends: [.job-template, .test-template, .native-comp-template]
   needs:
-    - job: build-native-comp-speed0
+    - job: build-native-comp-speed2
       optional: true
   variables:
-    target: emacs-native-comp-speed0
+    target: emacs-native-comp-speed2
     make_params: "-k -C test check SELECTOR='(not (tag :unstable))'"
 
 # Local Variables:
diff --git a/test/infra/test-jobs.yml b/test/infra/test-jobs.yml
index 51707c181b..55ce590af8 100644
--- a/test/infra/test-jobs.yml
+++ b/test/infra/test-jobs.yml
@@ -493,6 +493,23 @@ test-lisp-url-inotify:
     target: emacs-inotify
     make_params: "-k -C test check-lisp-url"
 
+test-lisp-use-package-inotify:
+  stage: normal
+  extends: [.job-template, .test-template]
+  needs:
+    - job: build-image-inotify
+      optional: true
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "schedule"'
+      when: never
+    - changes:
+        - lisp/use-package/*.el
+        - test/lisp/use-package/*.el
+        - test/lisp/use-package/*resources/**
+  variables:
+    target: emacs-inotify
+    make_params: "-k -C test check-lisp-use-package"
+
 test-lisp-vc-inotify:
   stage: normal
   extends: [.job-template, .test-template]
diff --git a/test/lib-src/emacsclient-tests.el 
b/test/lib-src/emacsclient-tests.el
index 1302fbe30c..0fa3c6facf 100644
--- a/test/lib-src/emacsclient-tests.el
+++ b/test/lib-src/emacsclient-tests.el
@@ -19,7 +19,9 @@
 
 ;;; Commentary:
 
-;;
+;; Tests for the emacsclient executable.  For tests involving the
+;; interaction between emacsclient and an Emacs server, see
+;; test/lisp/server-tests.el.
 
 ;;; Code:
 
diff --git a/test/lisp/auth-source-pass-tests.el 
b/test/lisp/auth-source-pass-tests.el
index 6e6671efca..d6d42ce942 100644
--- a/test/lisp/auth-source-pass-tests.el
+++ b/test/lisp/auth-source-pass-tests.el
@@ -175,7 +175,8 @@ HOSTNAME, USER and PORT are passed unchanged to
 (ert-deftest auth-source-pass-any-host ()
   (auth-source-pass--with-store '(("foo" ("port" . "foo-port") ("host" . 
"foo-user"))
                                   ("bar"))
-    (should-not (auth-source-pass-search :host t))))
+    (let ((inhibit-message t)) ; silence "... does not handle host wildcards."
+      (should-not (auth-source-pass-search :host t)))))
 
 (ert-deftest auth-source-pass-undefined-host ()
   (auth-source-pass--with-store '(("foo" ("port" . "foo-port") ("host" . 
"foo-user"))
@@ -697,29 +698,29 @@ machine Libera.Chat password b
 ;; with slightly more realistic and less legible values.
 
 (ert-deftest auth-source-pass-extra-query-keywords--suffixed-user ()
-  (let ((store (sort (copy-sequence '(("x.com:42/bar" (secret . "a"))
-                                      ("bar@x.com" (secret . "b"))
+  (let ((store (sort (copy-sequence '(("x.com:42/s p@m" (secret . "a"))
+                                      ("s p@m@x.com" (secret . "b"))
                                       ("x.com" (secret . "?"))
-                                      ("bar@y.org" (secret . "c"))
-                                      ("fake.com" (secret . "?"))
-                                      ("fake.com/bar" (secret . "d"))
-                                      ("y.org/bar" (secret . "?"))
-                                      ("bar@fake.com" (secret . "e"))))
+                                      ("s p@m@y.org" (secret . "c"))
+                                      ("fa ke" (secret . "?"))
+                                      ("fa ke/s p@m" (secret . "d"))
+                                      ("y.org/s p@m" (secret . "?"))
+                                      ("s p@m@fa ke" (secret . "e"))))
                      (lambda (&rest _) (zerop (random 2))))))
     (auth-source-pass--with-store store
       (auth-source-pass-enable)
       (let* ((auth-source-pass-extra-query-keywords t)
-             (results (auth-source-search :host '("x.com" "fake.com" "y.org")
-                                          :user "bar"
+             (results (auth-source-search :host '("x.com" "fa ke" "y.org")
+                                          :user "s p@m"
                                           :require '(:user) :max 5)))
         (dolist (result results)
           (setf (plist-get result :secret) (auth-info-password result)))
         (should (equal results
-                       '((:host "x.com" :user "bar" :secret "b")
-                         (:host "x.com" :user "bar" :port "42" :secret "a")
-                         (:host "fake.com" :user "bar" :secret "e")
-                         (:host "fake.com" :user "bar" :secret "d")
-                         (:host "y.org" :user "bar" :secret "c"))))))))
+                       '((:host "x.com" :user "s p@m" :secret "b")
+                         (:host "x.com" :user "s p@m" :port "42" :secret "a")
+                         (:host "fa ke" :user "s p@m" :secret "e")
+                         (:host "fa ke" :user "s p@m" :secret "d")
+                         (:host "y.org" :user "s p@m" :secret "c"))))))))
 
 ;; This is a more distilled version of `suffixed-user', above.  It
 ;; better illustrates that search order takes precedence over "/user"
diff --git a/test/lisp/calendar/icalendar-tests.el 
b/test/lisp/calendar/icalendar-tests.el
index 2e9353a09b..baf4846c8f 100644
--- a/test/lisp/calendar/icalendar-tests.el
+++ b/test/lisp/calendar/icalendar-tests.el
@@ -61,6 +61,16 @@
        (ert-resource-file filename))
       (buffer-string))))
 
+(defun icalendar-tests--get-error-string-for-export (diary-string)
+  "Call icalendar-export for DIARY-STRING and return resulting error-string."
+  (ert-with-temp-file file
+    :suffix "-export.ics"
+    (with-temp-buffer
+      (insert diary-string)
+      (icalendar-export-region (point-min) (point-max) file))
+    (with-current-buffer (get-buffer "*icalendar-errors*")
+      (buffer-string))))
+
 ;; ======================================================================
 ;; Tests of functions
 ;; ======================================================================
@@ -981,6 +991,40 @@ END:VALARM
 "
    '(2 ((email ("att.one@email.com" "att.two@email.com")) (audio) (display)))))
 
+;; ======================================================================
+;; #bug56241
+;; ======================================================================
+(defun icalendar-tests--diary-float (&rest args)
+  (apply #'diary-float args))
+
+(ert-deftest icalendar-export-bug-56241-dotted-pair ()
+  "See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56241#5";
+  (let ((icalendar-export-sexp-enumeration-days 366))
+    (mapc (lambda (diary-string)
+            (should (string= "" (icalendar-tests--get-error-string-for-export
+                                 diary-string))))
+          '("%%(diary-float 7 0 1) First Sunday in July 1"
+            "%%(icalendar-tests--diary-float 7 0 1) First Sunday in July 2"))))
+
+
+;; (ert-deftest icalendar-export-bug-56241-sexp-does-not-match ()
+;;   "Reported in #bug56241 -- needs to be fixed!"
+;;   (let ((icalendar-export-sexp-enumeration-days 0))
+;;     (mapc (lambda (diary-string)
+;;             (should (string= "" 
(icalendar-tests--get-error-string-for-export
+;;                                  diary-string))))
+;;           '("%%(diary-float 7 0 1) First Sunday in July 1"
+;;             "%%(icalendar-tests--diary-float 7 0 1) First Sunday in July 
2"))))
+
+(ert-deftest icalendar-export-bug-56241-nested-sexps ()
+  "Reported in #bug56241 -- needs to be fixed!"
+  (let ((icalendar-export-sexp-enumeration-days 366))
+    (mapc (lambda (diary-string)
+            (should (string= "" (icalendar-tests--get-error-string-for-export
+                                 diary-string))))
+          '("%%(= (calendar-day-of-week date) 0) Sunday 1"
+            "%%(= 0 (calendar-day-of-week date)) Sunday 2"))))
+
 ;; ======================================================================
 ;; Import tests
 ;; ======================================================================
@@ -1439,12 +1483,15 @@ DTEND;VALUE=DATE:19570922
 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=21
 SUMMARY:ff birthday (%d years old)")
 
-
-  (icalendar-tests--test-export
-   nil
-   nil
-   "%%(diary-offset '(diary-float t 3 4) 1) asdf"
-   nil)
+  ;; FIXME: this testcase verifies that icalendar-export fails to
+  ;; export the nested sexp. After repairing bug56241 icalendar-export
+  ;; works correctly for this sexp but now the testcase fails.
+  ;; Therefore this testcase is disabled for the time being.
+  ;;  (icalendar-tests--test-export
+  ;;   nil
+  ;;   nil
+  ;;   "%%(diary-offset '(diary-float t 3 4) 1) asdf"
+  ;;   nil)
 
 
   ;; FIXME!
diff --git a/test/lisp/cedet/semantic-utest.el 
b/test/lisp/cedet/semantic-utest.el
index b577b19808..4aaa4c5e3c 100644
--- a/test/lisp/cedet/semantic-utest.el
+++ b/test/lisp/cedet/semantic-utest.el
@@ -593,7 +593,7 @@ INSERTME is the text to be inserted after the deletion."
   )
 
 (ert-deftest semantic-utest-Scheme()
-  (skip-unless nil) ;; There is a bug w/ scheme parser.  Skip this for now.
+  (skip-unless nil) ;; There is a bug with scheme parser.  Skip this for now.
   (semantic-utest-generic (semantic-utest-fname "tst.scm") 
semantic-utest-Scheme-buffer-contents  semantic-utest-Scheme-name-contents   
'("fun2") ";1" ";deleted line")
   )
 
diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el
index 8402c13daf..ce1a6865b6 100644
--- a/test/lisp/comint-tests.el
+++ b/test/lisp/comint-tests.el
@@ -59,9 +59,23 @@
   (dolist (str comint-testsuite-password-strings)
     (should (string-match comint-password-prompt-regexp str))))
 
+(declare-function w32-application-type "w32proc.c")
+(defun w32-native-executable-p (fname)
+  "Predicate to test program FNAME for being a native Windows application."
+  (and (memq (w32-application-type fname) '(w32-native dos))
+       (file-executable-p fname)))
+
+(defun w32-native-executable-find (name)
+  "Find a native MS-Windows application named NAME.
+This is needed to avoid invoking MSYS or Cygwin executables that
+happen to lurk on PATH when running the test suite."
+  (locate-file name exec-path exec-suffixes 'w32-native-executable-p))
+
 (defun comint-tests/test-password-function (password-function)
   "PASSWORD-FUNCTION can return nil or a string."
-  (when-let ((cat (executable-find "cat")))
+  (when-let ((cat (if (eq system-type 'windows-nt)
+                      (w32-native-executable-find "cat")
+                    (executable-find "cat"))))
     (let ((comint-password-function password-function))
       (cl-letf (((symbol-function 'read-passwd)
                  (lambda (&rest _args) "non-nil")))
diff --git a/test/lisp/delim-col-tests.el b/test/lisp/delim-col-tests.el
index 97fa0f1e8f..2bf54d9b44 100644
--- a/test/lisp/delim-col-tests.el
+++ b/test/lisp/delim-col-tests.el
@@ -100,7 +100,7 @@
                             "aaa       [ bbb, cccc    ]        dddd\n"
                             "aa        [ bb,  ccccccc ]        ddd\n"))))))
 
-(ert-deftest delim-col-tests-delimit-colummns-before-after ()
+(ert-deftest delim-col-tests-delimit-columns-before-after ()
   (let ((delimit-columns-before "<")
         (delimit-columns-after ">"))
     (with-temp-buffer
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el 
b/test/lisp/emacs-lisp/bytecomp-tests.el
index e7c308213e..3400128759 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -833,13 +833,19 @@ byte-compiled.  Run with dynamic binding."
     ;; Should not warn that mt--test2 is not known to be defined.
     (should-not (re-search-forward "my--test2" nil t))))
 
-(defmacro bytecomp--with-warning-test (re-warning &rest form)
+(defmacro bytecomp--with-warning-test (re-warning form)
   (declare (indent 1))
   `(with-current-buffer (get-buffer-create "*Compile-Log*")
      (let ((inhibit-read-only t)) (erase-buffer))
-     (byte-compile ,@form)
-     (ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ")
-       (should (re-search-forward ,(string-replace " " "[ \n]+" 
re-warning))))))
+     (let ((text-quoting-style 'grave)
+           (macroexp--warned
+            (make-hash-table :test #'equal :weakness 'key))   ; oh dear
+           (form ,form))
+       (ert-info ((prin1-to-string form) :prefix "form: ")
+         (byte-compile form)
+         (ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ")
+           (should (re-search-forward
+                    (string-replace " " "[ \n]+" ,re-warning))))))))
 
 (ert-deftest bytecomp-warn-wrong-args ()
   (bytecomp--with-warning-test "remq.*3.*2"
@@ -863,6 +869,56 @@ byte-compiled.  Run with dynamic binding."
   (bytecomp--with-warning-test "defvar.*foo.*wider than.*characters"
     `(defvar foo t ,bytecomp-tests--docstring)))
 
+(ert-deftest bytecomp-warn-dodgy-args-eq ()
+  (dolist (fn '(eq eql))
+    (cl-flet ((msg (type arg)
+                (format
+                 "`%s' called with literal %s that may never match (arg %d)"
+                 fn type arg)))
+      (bytecomp--with-warning-test (msg "list" 1)   `(,fn '(a) 'x))
+      (bytecomp--with-warning-test (msg "string" 2) `(,fn 'x "a"))
+      (bytecomp--with-warning-test (msg "vector" 2) `(,fn 'x [a]))
+      (bytecomp--with-warning-test (msg "function" 2) `(,fn 'x (lambda () 1)))
+      (bytecomp--with-warning-test (msg "function" 2) `(,fn 'x #'(lambda () 
1)))
+      (unless (eq fn 'eql)
+        (bytecomp--with-warning-test (msg "integer" 2) `(,fn 'x #x10000000000))
+        (bytecomp--with-warning-test (msg "float" 2)   `(,fn 'x 1.0))))))
+
+(ert-deftest bytecomp-warn-dodgy-args-memq ()
+  (dolist (fn '(memq memql remq delq assq rassq))
+    (cl-labels
+        ((msg1 (type)
+           (format
+            "`%s' called with literal %s that may never match (arg 1)"
+            fn type))
+         (msg2 (type)
+           (format
+            "`%s' called with literal %s that may never match (element 2 of 
arg 2)"
+            fn type))
+         (lst (elt)
+           (cond ((eq fn 'assq)  `((a . 1) (,elt . 2) (c . 3)))
+                 ((eq fn 'rassq) `((1 . a) (2 . ,elt) (3 . c)))
+                 (t              `(a       ,elt       c))))
+         (form2 (elt)
+           `(,fn 'x ',(lst elt))))
+
+    (bytecomp--with-warning-test (msg1 "list")   `(,fn '(a) '(x)))
+    (bytecomp--with-warning-test (msg1 "string") `(,fn "a" '(x)))
+    (bytecomp--with-warning-test (msg1 "vector") `(,fn [a] '(x)))
+    (bytecomp--with-warning-test (msg1 "function") `(,fn (lambda () 1) '(x)))
+    (bytecomp--with-warning-test (msg1 "function") `(,fn #'(lambda () 1) '(x)))
+    (unless (eq fn 'memql)
+      (bytecomp--with-warning-test (msg1 "integer") `(,fn #x10000000000 '(x)))
+      (bytecomp--with-warning-test (msg1 "float")   `(,fn 1.0 '(x))))
+
+    (bytecomp--with-warning-test (msg2 "list")   (form2 '(b)))
+    (bytecomp--with-warning-test (msg2 "list")   (form2 ''b))
+    (bytecomp--with-warning-test (msg2 "string") (form2 "b"))
+    (bytecomp--with-warning-test (msg2 "vector") (form2 [b]))
+    (unless (eq fn 'memql)
+      (bytecomp--with-warning-test (msg2 "integer") (form2 #x10000000000))
+      (bytecomp--with-warning-test (msg2 "float")   (form2 1.0))))))
+
 (defmacro bytecomp--define-warning-file-test (file re-warning &optional 
reverse)
   `(ert-deftest ,(intern (format "bytecomp/%s" file)) ()
      (with-current-buffer (get-buffer-create "*Compile-Log*")
diff --git a/test/lisp/emacs-lisp/cconv-tests.el 
b/test/lisp/emacs-lisp/cconv-tests.el
index e666fe0a4c..537f6bfe72 100644
--- a/test/lisp/emacs-lisp/cconv-tests.el
+++ b/test/lisp/emacs-lisp/cconv-tests.el
@@ -60,7 +60,7 @@
                    "cl-defun documentation"))
   (should (eq (cconv-tests-cl-defun) 'cl-defun-result)))
 
-;; FIXME: The byte-complier croaks on this.  See Bug#28557.
+;; FIXME: The byte-compiler croaks on this.  See Bug#28557.
 ;; (defmacro cconv-tests-defmacro ()
 ;;   (:documentation (concat "defmacro" " documentation"))
 ;;   '(quote defmacro-result))
@@ -70,7 +70,7 @@
 ;;                    "defmacro documentation"))
 ;;   (should (eq (cconv-tests-defmacro) 'defmacro-result)))
 
-;; FIXME: The byte-complier croaks on this.  See Bug#28557.
+;; FIXME: The byte-compiler croaks on this.  See Bug#28557.
 ;; (cl-defmacro cconv-tests-cl-defmacro ()
 ;;   (:documentation (concat "cl-defmacro" " documentation"))
 ;;   '(quote cl-defmacro-result))
diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el 
b/test/lisp/emacs-lisp/checkdoc-tests.el
index 289476f024..c17415cbdd 100644
--- a/test/lisp/emacs-lisp/checkdoc-tests.el
+++ b/test/lisp/emacs-lisp/checkdoc-tests.el
@@ -130,25 +130,25 @@ See the comments in Bug#24998."
     (re-search-forward goto-string)
     (checkdoc-in-abbreviation-p (point))))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/basic-case ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/basic-case ()
   (should (checkdoc-tests--abbrev-test "foo bar e.g. baz" "e.g"))
   (should (checkdoc-tests--abbrev-test "behavior/errors etc. that" "etc"))
   (should (checkdoc-tests--abbrev-test "foo vs. bar" "vs"))
   (should (checkdoc-tests--abbrev-test "spy a.k.a. spy" "a.k.a")))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/with-parens ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/with-parens ()
   (should (checkdoc-tests--abbrev-test "foo bar (e.g. baz)" "e.g")))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/with-escaped-parens ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/with-escaped-parens ()
   (should (checkdoc-tests--abbrev-test "foo\n\\(e.g. baz)" "e.g")))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/single-char ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/single-char ()
   (should (checkdoc-tests--abbrev-test "a. foo bar" "a")))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/with-em-dash ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/with-em-dash ()
   (should (checkdoc-tests--abbrev-test "foo bar baz---e.g." "e.g")))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/incorrect-abbreviation ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/incorrect-abbreviation ()
   (should-not (checkdoc-tests--abbrev-test "foo bar a.b.c." "a.b.c")))
 
 (defun checkdoc-test-error-format-is-good (msg &optional reverse literal)
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el 
b/test/lisp/emacs-lisp/cl-lib-tests.el
index b19494af74..759138569e 100644
--- a/test/lisp/emacs-lisp/cl-lib-tests.el
+++ b/test/lisp/emacs-lisp/cl-lib-tests.el
@@ -404,7 +404,7 @@
 (ert-deftest cl-lib-nth-value-test-multiple-values ()
   "While CL multiple values are an alias to list, these won't work."
   :expected-result :failed
-  (should (eq (cl-nth-value 0 '(2 3)) '(2 3)))
+  (should (equal (cl-nth-value 0 '(2 3)) '(2 3)))
   (should (= (cl-nth-value 0 1) 1))
   (should (null (cl-nth-value 1 1)))
   (should-error (cl-nth-value -1 (cl-values 2 3)) :type 'args-out-of-range)
@@ -431,7 +431,8 @@
     (should (eq nums (cdr (cl-adjoin 3 nums))))
     ;; add only when not already there
     (should (eq nums (cl-adjoin 2 nums)))
-    (should (equal '(2 1 (2)) (cl-adjoin 2 '(1 (2)))))
+    (with-suppressed-warnings ((suspicious eq))
+      (should (equal '(2 1 (2)) (cl-adjoin 2 '(1 (2))))))
     ;; default test function is eql
     (should (equal '(1.0 1 2) (cl-adjoin 1.0 nums)))
     ;; own :test function - returns true if match
diff --git a/test/lisp/emacs-lisp/comp-tests.el 
b/test/lisp/emacs-lisp/comp-tests.el
index 082b641fe3..418c729694 100644
--- a/test/lisp/emacs-lisp/comp-tests.el
+++ b/test/lisp/emacs-lisp/comp-tests.el
@@ -31,25 +31,30 @@
 (defmacro with-test-native-compile-prune-cache (&rest body)
   (declare (indent 0) (debug t))
   `(ert-with-temp-directory testdir
-     (setq testdir (expand-file-name "eln-cache" testdir))
-     (make-directory testdir)
-     (let* ((c1 (expand-file-name "29.0.50-cur" testdir))
-            (c2 (expand-file-name "29.0.50-old" testdir))
-            (native-comp-eln-load-path (list testdir))
-            (comp-native-version-dir "29.0.50-cur"))
-       (dolist (d (list c1 c2))
-         (make-directory d)
-         (with-temp-file (expand-file-name "some.eln" d) (insert "foo"))
-         (with-temp-file (expand-file-name "some.eln.tmp" d) (insert "foo")))
-       ,@body)))
+     (let ((usr-cache (expand-file-name "eln-usr-cache" testdir))
+          (sys-cache (expand-file-name "eln-sys-cache" testdir)))
+       (make-directory usr-cache)
+       (make-directory sys-cache)
+       (let* ((c1 (expand-file-name "29.0.50-cur" usr-cache))
+              (c2 (expand-file-name "29.0.50-old" usr-cache))
+             (s1 (expand-file-name "29.0.50-cur" sys-cache))
+             (s2 (expand-file-name "preloaded" s1))
+              (native-comp-eln-load-path (list usr-cache sys-cache))
+              (comp-native-version-dir "29.0.50-cur"))
+        (dolist (d (list c1 c2 s1 s2))
+           (make-directory d)
+           (with-temp-file (expand-file-name "some.eln" d) (insert "foo"))
+           (with-temp-file (expand-file-name "some.eln.tmp" d) (insert "foo")))
+        ,@body))))
 
 (ert-deftest test-native-compile-prune-cache ()
   (skip-unless (featurep 'native-compile))
   (with-test-native-compile-prune-cache
     (native-compile-prune-cache)
-    (should (file-directory-p c1))
-    (should (file-regular-p (expand-file-name "some.eln" c1)))
-    (should (file-regular-p (expand-file-name "some.eln.tmp" c1)))
+    (dolist (d (list c1 s1 s2))
+      (should (file-directory-p d))
+      (should (file-regular-p (expand-file-name "some.eln" d)))
+      (should (file-regular-p (expand-file-name "some.eln.tmp" d))))
     (should-not (file-directory-p c2))
     (should-not (file-regular-p (expand-file-name "some.eln" c2)))
     (should-not (file-regular-p (expand-file-name "some.eln.tmp" c2)))))
@@ -57,21 +62,23 @@
 (ert-deftest test-native-compile-prune-cache/delete-only-eln ()
   (skip-unless (featurep 'native-compile))
   (with-test-native-compile-prune-cache
-    (with-temp-file (expand-file-name "keep1.txt" c1) (insert "foo"))
-    (with-temp-file (expand-file-name "keep2.txt" c2) (insert "foo"))
+    (dolist (d (list c1 c2 s1 s2))
+      (with-temp-file (expand-file-name "keep.txt" d) (insert "foo")))
     (native-compile-prune-cache)
-    (should (file-regular-p (expand-file-name "keep1.txt" c1)))
-    (should (file-regular-p (expand-file-name "keep2.txt" c2)))))
+    (dolist (d (list c1 c2 s1 s2))
+      (should (file-regular-p (expand-file-name "keep.txt" d))))))
 
 (ert-deftest test-native-compile-prune-cache/dont-delete-in-parent-of-cache ()
   (skip-unless (featurep 'native-compile))
   (with-test-native-compile-prune-cache
-    (let ((f1 (expand-file-name "../some.eln" testdir))
-          (f2 (expand-file-name "some.eln" testdir)))
-      (with-temp-file f1 (insert "foo"))
-      (with-temp-file f2 (insert "foo"))
+    (let ((f1 (expand-file-name "../some.eln" usr-cache))
+          (f2 (expand-file-name "some.eln" usr-cache))
+         (f3 (expand-file-name "../some.eln" sys-cache))
+         (f4 (expand-file-name "some.eln" sys-cache)))
+      (dolist (f (list f1 f2 f3 f4))
+       (with-temp-file f (insert "foo")))
       (native-compile-prune-cache)
-      (should (file-regular-p f1))
-      (should (file-regular-p f2)))))
+      (dolist (f (list f1 f2 f3 f4))
+       (should (file-regular-p f))))))
 
 ;;; comp-tests.el ends here
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 af19c122b9..05d24a8e35 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
@@ -308,7 +308,7 @@
     (setq eieio-test-method-order-list (nreverse eieio-test-method-order-list))
     (eieio-test-match ans)))
 
-;;; Jan's methodinvoke order w/ multiple inheritance and :after methods.
+;;; Jan's methodinvoke order with multiple inheritance and :after methods.
 ;;
 (defclass eitest-Ja ()
   ())
diff --git a/test/lisp/emacs-lisp/find-func-tests.el 
b/test/lisp/emacs-lisp/find-func-tests.el
index d18a9dc1a9..8c432f8720 100644
--- a/test/lisp/emacs-lisp/find-func-tests.el
+++ b/test/lisp/emacs-lisp/find-func-tests.el
@@ -87,7 +87,7 @@ expected function symbol and function library, respectively."
   (test-locate-helper #'forward-char '(forward-char . "cmds.c"))
   (should-error (test-locate-helper 'wrong-function)))
 
-(ert-deftest find-func-tests--locate-adviced-symbols ()
+(ert-deftest find-func-tests--locate-advised-symbols ()
   (defun my-message ()
     (message "Hello!"))
   (advice-add #'mark-sexp :around 'my-message)
diff --git a/test/lisp/emacs-lisp/lisp-mnt-tests.el 
b/test/lisp/emacs-lisp/lisp-mnt-tests.el
index 200be7354a..a4bf834a8e 100644
--- a/test/lisp/emacs-lisp/lisp-mnt-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mnt-tests.el
@@ -4,22 +4,20 @@
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 
-;; 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/>.
-
-;;; Commentary:
-
-;;
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Code:
 
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index 125ddee859..01772e54d8 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -207,6 +207,12 @@
                    (list 'ok z))
                  '(ok "F"))))
 
+(ert-deftest rx-let-pcase ()
+  "Test `rx-let' around `pcase' with `rx' patterns (bug#59814)."
+  (should (equal (rx-let ((tata "ab"))
+                   (pcase "abc" ((rx tata) 'toto)))
+                 'toto)))
+
 (ert-deftest rx-kleene ()
   "Test greedy and non-greedy repetition operators."
   (should (equal (rx (* "a") (+ "b") (\? "c") (?\s "d")
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el 
b/test/lisp/emacs-lisp/subr-x-tests.el
index 7a3efe9db6..e80d2e17e8 100644
--- a/test/lisp/emacs-lisp/subr-x-tests.el
+++ b/test/lisp/emacs-lisp/subr-x-tests.el
@@ -707,7 +707,16 @@
     (should (equal (get-text-property 2 'display) '(raise 0.5)))
     (should (equal (get-text-property 5 'display)
                    [(raise 0.5) (height 2.0)]))
-    (should (equal (get-text-property 9 'display) '(raise 0.5)))))
+    (should (equal (get-text-property 9 'display) '(raise 0.5))))
+  (with-temp-buffer
+    (should (equal (let ((str "some useless string"))
+                     (add-display-text-property 4 8 'height 2.0 str)
+                     (add-display-text-property 2 12 'raise 0.5 str)
+                     str)
+                   #("some useless string"
+                     2 4 (display (raise 0.5))
+                     4 8 (display ((raise 0.5) (height 2.0)))
+                     8 12 (display (raise 0.5)))))))
 
 (ert-deftest subr-x-named-let ()
   (let ((funs ()))
diff --git a/test/lisp/erc/erc-join-tests.el b/test/lisp/erc/erc-join-tests.el
index 8210defbfb..89521ba429 100644
--- a/test/lisp/erc/erc-join-tests.el
+++ b/test/lisp/erc/erc-join-tests.el
@@ -335,7 +335,7 @@
               (start-process "true" (current-buffer) "true")
               erc-server-current-nick "tester"
               erc-server-announced-name "foo.gnu.chat"
-              ;; Assume special case w/o known network
+              ;; Assume special case without known network
               erc-networks--id (make-erc-networks--id))
         (set-process-query-on-exit-flag erc-server-process nil)
         (should-not calls)
diff --git a/test/lisp/erc/erc-networks-tests.el 
b/test/lisp/erc/erc-networks-tests.el
index fc12bf7ce3..0a8b5935df 100644
--- a/test/lisp/erc/erc-networks-tests.el
+++ b/test/lisp/erc/erc-networks-tests.el
@@ -197,6 +197,36 @@
 
   (erc-networks-tests--clean-bufs))
 
+;; A non-ERC buffer exists named "bob", and we're killing one of two
+;; ERC target buffers named "bob@<netid>".  The surviving buffer
+;; retains its suffix.
+
+(ert-deftest erc-networks-rename-surviving-target-buffer--query-non-target ()
+  (should (memq #'erc-networks-rename-surviving-target-buffer
+                erc-kill-buffer-hook))
+
+  (let ((existing (get-buffer-create "bob"))
+        (bob-foonet (get-buffer-create "bob@foonet")))
+
+    (with-current-buffer bob-foonet
+      (erc-mode)
+      (setq erc-networks--id (make-erc-networks--id-qualifying
+                              :parts [foonet "bob"] :len 1)
+            erc--target (erc--target-from-string "bob")))
+
+    (with-current-buffer (get-buffer-create "bob@barnet")
+      (erc-mode)
+      (setq erc-networks--id (make-erc-networks--id-qualifying
+                              :parts [barnet "bob"] :len 1)
+            erc--target (erc--target-from-string "bob")))
+
+    (kill-buffer "bob@barnet")
+    (should (buffer-live-p existing))
+    (should (buffer-live-p bob-foonet))
+    (kill-buffer existing))
+
+  (erc-networks-tests--clean-bufs))
+
 (ert-deftest erc-networks-rename-surviving-target-buffer--multi ()
 
   (ert-info ("Multiple leftover channels untouched")
@@ -1171,6 +1201,8 @@
     (let (erc-server-announced-name
           (erc--isupport-params (make-hash-table))
           erc-network
+          erc-quit-hook
+          (erc-server-process (erc-networks-tests--create-live-proc))
           calls)
       (erc-mode)
 
@@ -1183,10 +1215,7 @@
 
         (ert-info ("Signals when table empty and NETWORK param unset")
           (setq erc-server-announced-name "irc.fake.gnu.org")
-          (let ((err (should-error (erc-networks--set-name
-                                    nil (make-erc-response)))))
-            (should (string-match-p "failed" (cadr err)))
-            (should (eq (car err) 'error)))
+          (should (eq 'error (erc-networks--set-name nil (make-erc-response))))
           (should (string-match-p (rx "*** Failed") (car (pop calls)))))))
 
     (erc-networks-tests--clean-bufs)))
diff --git a/test/lisp/erc/erc-sasl-tests.el b/test/lisp/erc/erc-sasl-tests.el
new file mode 100644
index 0000000000..0e5ea60e5f
--- /dev/null
+++ b/test/lisp/erc/erc-sasl-tests.el
@@ -0,0 +1,359 @@
+;;; erc-sasl-tests.el --- Tests for erc-sasl.  -*- 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/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'ert-x)
+(require 'erc-sasl)
+
+(ert-deftest erc-sasl--mechanism-offered-p ()
+  (let ((erc-sasl--options '((mechanism . external))))
+    (should (erc-sasl--mechanism-offered-p "foo,external"))
+    (should (erc-sasl--mechanism-offered-p "external,bar"))
+    (should (erc-sasl--mechanism-offered-p "foo,external,bar"))
+    (should-not (erc-sasl--mechanism-offered-p "fooexternal"))
+    (should-not (erc-sasl--mechanism-offered-p "externalbar"))))
+
+(ert-deftest erc-sasl--read-password--basic ()
+  (ert-info ("Explicit erc-sasl-password")
+    (let ((erc-sasl--options '((password . "foo"))))
+      (should (string= (erc-sasl--read-password nil) "foo"))))
+
+  (ert-info ("Explicit session password")
+    (let ((erc-session-password "foo")
+          (erc-sasl--options '((password . :password))))
+      (should (string= (erc-sasl--read-password nil) "foo"))))
+
+  (ert-info ("Prompt when no authfn and :password resolves to nil")
+    (let ((erc-session-password nil)
+          (erc-sasl--options
+           '((password . :password) (user . :user) (authfn))))
+      (should (string= (ert-simulate-keys "bar\r"
+                         (erc-sasl--read-password "?"))
+                       "bar"))))
+
+  (ert-info ("Prompt when auth-source fails and `erc-session-password' null")
+    (should-not erc-session-password)
+    (let ((erc-sasl--options '((password) (authfn . ignore))))
+      (should (string= (ert-simulate-keys "baz\r"
+                         (erc-sasl--read-password "pwd:"))
+                       "baz")))))
+
+;; This mainly tests `erc-sasl-auth-source-password-as-host'.
+
+(ert-deftest erc-sasl--read-password--auth-source ()
+  (ert-with-temp-file netrc-file
+    :text (string-join
+           (list
+            ;; If you swap these first 2 lines, *1 below fails
+            "machine FSF.chat port 6697 user bob password sesame"
+            "machine GNU/chat port 6697 user bob password spam"
+            "machine MyHost port irc password 123")
+           "\n")
+    (let* ((auth-sources (list netrc-file))
+           (erc-session-server "irc.gnu.org")
+           (erc-session-port 6697)
+           (erc-networks--id (erc-networks--id-create nil))
+           erc-server-announced-name ; too early
+           auth-source-do-cache
+           ;;
+           (fn #'erc-sasl-auth-source-password-as-host)
+           calls)
+
+      (advice-add 'erc-auth-source-search :before
+                  (lambda (&rest r) (push r calls))
+                  '((name . erc-sasl--read-password--auth-source)))
+
+      (ert-info ("Symbol as password specifies machine")
+        (let ((erc-sasl--options
+               `((user . "bob") (password . FSF.chat) (authfn . ,fn))))
+          (should (string= (erc-sasl--read-password nil) "sesame"))
+          (should (equal (pop calls) '(:user "bob" :host "FSF.chat")))))
+
+      (ert-info (":password as password resolved to machine")
+        (let ((erc-session-password "FSF.chat")
+              (erc-sasl--options
+               `((user . "bob") (password . :password) (authfn . ,fn))))
+          (should (string= (erc-sasl--read-password nil) "sesame"))
+          (should (equal (pop calls) '(:user "bob" :host "FSF.chat")))))
+
+      (ert-info (":user resolved to `erc-session-username'") ; *1
+        (let ((erc-session-username "bob")
+              (erc-sasl--options `((user . :user) (password) (authfn . ,fn)))
+              (erc-networks--id (erc-networks--id-create 'GNU/chat)))
+          (should (string= (erc-sasl--read-password nil) "spam"))
+          (should (equal (pop calls) '(:user "bob")))))
+
+      (ert-info (":user resolved to current nick") ; *1
+        (let ((erc-server-current-nick "bob")
+              (erc-sasl--options `((user . :nick) (password) (authfn . ,fn)))
+              (erc-networks--id (erc-networks--id-create 'GNU/chat)))
+          (should (string= (erc-sasl--read-password nil) "spam"))
+          (should (equal (pop calls) '(:user "bob")))))
+
+      (ert-info ("Symbol as password, entry lacks user field")
+        (let ((erc-server-current-nick "fake")
+              (erc-sasl--options
+               `((user . :nick) (password . MyHost) (authfn . ,fn)))
+              (erc-networks--id (erc-networks--id-create 'GNU/chat)))
+          (should (string= (erc-sasl--read-password nil) "123"))
+          (should (equal (pop calls) '(:user "fake" :host "MyHost")))))
+
+      (advice-remove 'erc-auth-source-search
+                     'erc-sasl--read-password--auth-source))))
+
+(ert-deftest erc-sasl-create-client--plain ()
+  (let* ((erc-session-password "password123")
+         (erc-session-username "tester")
+         (erc-sasl--options '((user . :user) (password . :password)))
+         (erc-session-port 1667)
+         (erc-session-server "localhost")
+         (client (erc-sasl--create-client 'plain))
+         (result (sasl-next-step client nil)))
+    (should (equal (format "%S" [erc-sasl--plain-response
+                                 "\0tester\0password123"])
+                   (format "%S" result)))
+    (should (string= (sasl-step-data result) "\0tester\0password123"))
+    (should-not (sasl-next-step client result)))
+  (should (equal (assoc-default "PLAIN" sasl-mechanism-alist) '(sasl-plain))))
+
+(ert-deftest erc-sasl-create-client--external ()
+  (let* ((erc-server-current-nick "tester")
+         (erc-sasl--options '((user . :nick) (password . :password)))
+         (client (erc-sasl--create-client 'external)) ; unused ^
+         (result (sasl-next-step client nil)))
+    (should (equal (format "%S" [ignore nil]) (format "%S" result)))
+    (should-not (sasl-step-data result))
+    (should-not (sasl-next-step client result)))
+  (should-not (member "EXTERNAL" sasl-mechanisms))
+  (should-not (assoc-default "EXTERNAL" sasl-mechanism-alist)))
+
+(ert-deftest erc-sasl-create-client--scram-sha-1 ()
+  (let* ((erc-sasl--options '((user . "jilles") (password . "sesame")
+                              (authzid . "jilles")))
+         (mock-rvs (list "c5RqLCZy0L4fGkKAZ0hujFBs" ""))
+         (sasl-unique-id-function (lambda () (pop mock-rvs)))
+         (client (erc-sasl--create-client 'scram-sha-1))
+         (step (sasl-next-step client nil)))
+    (ert-info ("Client's initial request")
+      (let ((req "n,a=jilles,n=jilles,r=c5RqLCZy0L4fGkKAZ0hujFBs"))
+        (should (equal (format "%S"
+                               `[erc-compat--29-sasl-scram-client-first-message
+                                 ,req])
+                       (format "%S" step)))
+        (should (string= (sasl-step-data step) req))))
+    (ert-info ("Server's initial response")
+      (let ((resp (concat "r=c5RqLCZy0L4fGkKAZ0hujFBsXQoKcivqCw9iDZPSpb,"
+                          "s=5mJO6d4rjCnsBU1X,"
+                          "i=4096"))
+            (req (concat "c=bixhPWppbGxlcyw=,"
+                         "r=c5RqLCZy0L4fGkKAZ0hujFBsXQoKcivqCw9iDZPSpb,"
+                         "p=OVUhgPu8wEm2cDoVLfaHzVUYPWU=")))
+        (sasl-step-set-data step resp)
+        (setq step (sasl-next-step client step))
+        (should (equal (format "%S"
+                               `[erc-sasl--scram-sha-1-client-final-message
+                                 ,req])
+                       (format "%S" step)))
+        (should (string= (sasl-step-data step) req))))
+    (ert-info ("Server's final message")
+      (let ((resp "v=ZWR23c9MJir0ZgfGf5jEtLOn6Ng="))
+        (sasl-step-set-data step resp)
+        (setq step (sasl-next-step client step))
+        (should-not (sasl-step-data step)))))
+  (should (eq sasl-unique-id-function #'sasl-unique-id-function)))
+
+(ert-deftest erc-sasl-create-client--scram-sha-256 ()
+  (unless (featurep 'sasl-scram-sha256)
+    (ert-skip "Emacs lacks sasl-scram-sha256"))
+  (let* ((erc-server-current-nick "jilles")
+         (erc-session-password "sesame")
+         (erc-sasl--options '((user . :nick) (password . :password)
+                              (authzid . "jilles")))
+         (mock-rvs (list "c5RqLCZy0L4fGkKAZ0hujFBs" ""))
+         (sasl-unique-id-function (lambda () (pop mock-rvs)))
+         (client (erc-sasl--create-client 'scram-sha-256))
+         (step (sasl-next-step client nil)))
+    (ert-info ("Client's initial request")
+      (let ((req "n,a=jilles,n=jilles,r=c5RqLCZy0L4fGkKAZ0hujFBs"))
+        (should (equal (format "%S"
+                               `[erc-compat--29-sasl-scram-client-first-message
+                                 ,req])
+                       (format "%S" step)))
+        (should (string= (sasl-step-data step) req))))
+    (ert-info ("Server's initial response")
+      (let ((resp (concat
+                   
"r=c5RqLCZy0L4fGkKAZ0hujFBse697140729d8445fb95ec94ceacb14b3,"
+                   "s=MTk2M2VkMzM5ZmU0NDRiYmI0MzIyOGVhN2YwNzYwNmI=,"
+                   "i=4096"))
+            (req (concat
+                  "c=bixhPWppbGxlcyw=,"
+                  "r=c5RqLCZy0L4fGkKAZ0hujFBse697140729d8445fb95ec94ceacb14b3,"
+                  "p=1vDesVBzJmv0lX0Ae1kHFtdVHkC6j4gISKVqaR45HFg=")))
+        (sasl-step-set-data step resp)
+        (setq step (sasl-next-step client step))
+        (should (equal (format "%S"
+                               `[erc-sasl--scram-sha-256-client-final-message
+                                 ,req])
+                       (format "%S" step)))
+        (should (string= (sasl-step-data step) req))))
+    (ert-info ("Server's final message")
+      (let ((resp "v=gUePTYSZN9xgcE06KSyKO9fUmSwH26qifoapXyEs75s="))
+        (sasl-step-set-data step resp)
+        (setq step (sasl-next-step client step))
+        (should-not (sasl-step-data step)))))
+  (should (eq sasl-unique-id-function #'sasl-unique-id-function)))
+
+(ert-deftest erc-sasl-create-client--scram-sha-256--no-authzid ()
+  (unless (featurep 'sasl-scram-sha256)
+    (ert-skip "Emacs lacks sasl-scram-sha256"))
+  (let* ((erc-server-current-nick "jilles")
+         (erc-session-password "sesame")
+         (erc-sasl--options '((user . :nick) (password . :password) (authzid)))
+         (mock-rvs (list "c5RqLCZy0L4fGkKAZ0hujFBs" ""))
+         (sasl-unique-id-function (lambda () (pop mock-rvs)))
+         (client (erc-sasl--create-client 'scram-sha-256))
+         (step (sasl-next-step client nil)))
+    (ert-info ("Client's initial request")
+      (let ((req "n,,n=jilles,r=c5RqLCZy0L4fGkKAZ0hujFBs"))
+        (should (equal (format "%S"
+                               `[erc-compat--29-sasl-scram-client-first-message
+                                 ,req])
+                       (format "%S" step)))
+        (should (string= (sasl-step-data step) req))))
+    (ert-info ("Server's initial response")
+      (let ((resp (concat
+                   
"r=c5RqLCZy0L4fGkKAZ0hujFBsd4067f0afdb54c3dbd4fe645b84cae37,"
+                   "s=ZTg1MmE1YmFhZGI1NDcyMjk3NzYwZmRjZDM3Y2I1OTM=,"
+                   "i=4096"))
+            (req (concat
+                  "c=biws,"
+                  "r=c5RqLCZy0L4fGkKAZ0hujFBsd4067f0afdb54c3dbd4fe645b84cae37,"
+                  "p=LP4sjJrjJKp5qTsARyZCppXpKLu4FMM284hNESPvGhI=")))
+        (sasl-step-set-data step resp)
+        (setq step (sasl-next-step client step))
+        (should (equal (format "%S"
+                               `[erc-sasl--scram-sha-256-client-final-message
+                                 ,req])
+                       (format "%S" step)))
+        (should (string= (sasl-step-data step) req))))
+    (ert-info ("Server's final message")
+      (let ((resp "v=847WXfnmReGyE1qlq1And6R4bPBNROTZ7EMS/QrJtUM="))
+        (sasl-step-set-data step resp)
+        (setq step (sasl-next-step client step))
+        (should-not (sasl-step-data step)))))
+  (should (eq sasl-unique-id-function #'sasl-unique-id-function)))
+
+(ert-deftest erc-sasl-create-client--scram-sha-512--no-authzid ()
+  (unless (featurep 'sasl-scram-sha256)
+    (ert-skip "Emacs lacks sasl-scram-sha512"))
+  (let* ((erc-server-current-nick "jilles")
+         (erc-session-password "sesame")
+         (erc-sasl--options '((user . :nick) (password . :password) (authzid)))
+         (mock-rvs (list "c5RqLCZy0L4fGkKAZ0hujFBs" ""))
+         (sasl-unique-id-function (lambda () (pop mock-rvs)))
+         (client (erc-sasl--create-client 'scram-sha-512))
+         (step (sasl-next-step client nil)))
+    (ert-info ("Client's initial request")
+      (let ((req "n,,n=jilles,r=c5RqLCZy0L4fGkKAZ0hujFBs"))
+        (should (equal (format "%S"
+                               `[erc-compat--29-sasl-scram-client-first-message
+                                 ,req])
+                       (format "%S" step)))
+        (should (string= (sasl-step-data step) req))))
+    (ert-info ("Server's initial response")
+      (let ((resp (concat
+                   
"r=c5RqLCZy0L4fGkKAZ0hujFBs54c592745ce14e559fcc3f27b15464f6,"
+                   "s=YzMzOWZiY2U0YzcwNDA0M2I4ZGE2M2ZjOTBjODExZTM=,"
+                   "i=4096"))
+            (req (concat
+                  "c=biws,"
+                  "r=c5RqLCZy0L4fGkKAZ0hujFBs54c592745ce14e559fcc3f27b15464f6,"
+                  "p=vMBb9tKxFAfBtel087/GLbo4objAIYr1wM+mFv/jYLKXE"
+                  "NUF0vynm81qQbywQE5ScqFFdAfwYMZq/lj4s0V1OA==")))
+        (sasl-step-set-data step resp)
+        (setq step (sasl-next-step client step))
+        (should (equal (format
+                        "%S" `[erc-sasl--scram-sha-512-client-final-message
+                               ,req])
+                       (format "%S" step)))
+        (should (string= (sasl-step-data step) req))))
+    (ert-info ("Server's final message")
+      (let ((resp (concat "v=Va7NIvt8wCdhvxnv+bZriSxGoto6On5EVnRHO/ece8zs0"
+                          "qpQassdqir1Zlwh3e3EmBq+kcSy+ClNCsbzBpXe/w==")))
+        (sasl-step-set-data step resp)
+        (setq step (sasl-next-step client step))
+        (should-not (sasl-step-data step)))))
+  (should (eq sasl-unique-id-function #'sasl-unique-id-function)))
+
+(defconst erc-sasl-tests-ecdsa-key-file "
+-----BEGIN EC PARAMETERS-----
+BggqhkjOPQMBBw==
+-----END EC PARAMETERS-----
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEIIJueQ3W2IrGbe9wKdOI75yGS7PYZSj6W4tg854hlsvmoAoGCCqGSM49
+AwEHoUQDQgAEAZmaVhNSMmV5r8FXPvKuMnqDKyIA9pDHN5TNMfiF3mMeikGgK10W
+IRX9cyi2wdYg9mUUYyh9GKdBCYHGUJAiCA==
+-----END EC PRIVATE KEY-----
+")
+
+(ert-deftest erc-sasl-create-client-ecdsa ()
+  :tags '(:unstable)
+  ;; This is currently useless because it just roundtrips shelling out
+  ;; to pkeyutl.
+  (ert-skip "Placeholder")
+  (unless (executable-find "openssl")
+    (ert-skip "System lacks openssl"))
+  (ert-with-temp-file keyfile
+    :prefix "ecdsa_key"
+    :suffix ".pem"
+    :text erc-sasl-tests-ecdsa-key-file
+    (let* ((erc-server-current-nick "jilles")
+           (erc-sasl--options `((password . ,keyfile)))
+           (client (erc-sasl--create-client 'ecdsa-nist256p-challenge))
+           (step (sasl-next-step client nil)))
+      (ert-info ("Client's initial request")
+        (should (equal (format "%S" [erc-sasl--ecdsa-first "jilles"])
+                       (format "%S" step)))
+        (should (string= (sasl-step-data step) "jilles")))
+      (ert-info ("Server's initial response")
+        (let ((resp (concat "\0\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\20"
+                            "\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37")))
+          (sasl-step-set-data step resp)
+          (setq step (sasl-next-step client step))
+          (ert-with-temp-file sigfile
+            :prefix "ecdsa_sig"
+            :suffix ".sig"
+            :text (sasl-step-data step)
+            (with-temp-buffer
+              (set-buffer-multibyte nil)
+              (insert resp)
+              (let ((ec (call-process-region
+                         (point-min) (point-max)
+                         "openssl" 'delete t nil "pkeyutl"
+                         "-inkey" keyfile "-sigfile" sigfile
+                         "-verify")))
+                (unless (zerop ec)
+                  (message "%s" (buffer-string)))
+                (should (zerop ec)))))))
+      (should-not (sasl-next-step client step)))))
+
+;;; erc-sasl-tests.el ends here
diff --git a/test/lisp/erc/erc-scenarios-auth-source.el 
b/test/lisp/erc/erc-scenarios-auth-source.el
index 3d399a1815..20cae9fbcb 100644
--- a/test/lisp/erc/erc-scenarios-auth-source.el
+++ b/test/lisp/erc/erc-scenarios-auth-source.el
@@ -1,28 +1,29 @@
 ;;; erc-scenarios-auth-source.el --- auth-source scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;; Commentary:
-;;
+
 ;; For practical reasons (mainly lack of imagination), this file
 ;; contains tests for both server-password and NickServ contexts.
 
+;;; Code:
+
 (require 'ert-x)
 (eval-and-compile
   (let ((load-path (cons (ert-resource-directory) load-path)))
diff --git a/test/lisp/erc/erc-scenarios-base-association-nick.el 
b/test/lisp/erc/erc-scenarios-base-association-nick.el
index 3e848be4df..7eac9c900a 100644
--- a/test/lisp/erc/erc-scenarios-base-association-nick.el
+++ b/test/lisp/erc/erc-scenarios-base-association-nick.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-association-nick.el --- base assoc scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
@@ -25,13 +26,24 @@
 
 (eval-when-compile (require 'erc-join))
 
-;; You register a new nick, disconnect, and log back in, but your nick
-;; is not granted, so ERC obtains a backtick'd version.  You open a
-;; query buffer for NickServ, and ERC names it using the net-ID (which
-;; includes the backtick'd nick) as a suffix.  The original
-;; (disconnected) NickServ buffer gets renamed with *its* net-ID as
-;; well.  You then identify to NickServ, and the dead session is no
-;; longer considered distinct.
+;; You register a new nick in a dedicated query buffer, disconnect,
+;; and log back in, but your nick is not granted (maybe you just
+;; turned off SASL).  In any case, ERC obtains a backtick'd version.
+;; You open a query buffer for NickServ, and ERC gives you the
+;; existing one.  And after you identify, all buffers retain their
+;; names, although your net ID has changed internally.
+;;
+;; If ERC would've instead failed (or intentionally refused) to make
+;; the association, you would've ended up with a new NickServ buffer
+;; named after the new net ID as a suffix (based on the backtick'd
+;; nick), for example, NickServ@foonet/tester`.  And the original
+;; (disconnected) NickServ buffer would've gotten suffixed with *its*
+;; net-ID as well, e.g., NickServ@foonet/tester.  And after
+;; identifying, you would've seen ERC merge the two as well as their
+;; server buffers.  While this alternate behavior may arguably be a
+;; more honest reflection of reality, it's also quite inconvenient.
+;; For a clearer example, see the original version of this file
+;; introduced by "Add user-oriented test scenarios for ERC".
 
 (ert-deftest erc-scenarios-base-association-nick-bumped ()
   :tags '(:expensive-test)
@@ -67,30 +79,29 @@
           (funcall expect 5 "ERC finished"))))
 
     (with-current-buffer "foonet"
-      (erc-cmd-RECONNECT))
+      (erc-cmd-RECONNECT)
+      (funcall expect 10 "User modes for tester`"))
 
-    (erc-d-t-wait-for 10 "Nick request rejection prevents reassociation (good)"
-      (get-buffer "foonet/tester`"))
+    (ert-info ("Server buffer reassociated with new nick")
+      (should-not (get-buffer "foonet/tester`")))
 
     (ert-info ("Ask NickServ to change nick")
-      (with-current-buffer "foonet/tester`"
-        (funcall expect 3 "already in use")
+      (with-current-buffer "foonet"
         (funcall expect 3 "debug mode")
         (erc-cmd-QUERY "NickServ"))
 
-      (erc-d-t-wait-for 1 "Dead NickServ query buffer renamed, now qualified"
-        (get-buffer "NickServ@foonet/tester"))
+      (ert-info ( "NickServ buffer reassociated")
+        (should-not (get-buffer "NickServ@foonet/tester`"))
+        (should-not (get-buffer "NickServ@foonet/tester")))
 
-      (with-current-buffer "NickServ@foonet/tester`" ; new one
+      (with-current-buffer "NickServ" ; new one
         (erc-scenarios-common-say "IDENTIFY tester changeme")
-        (funcall expect 5 "You're now logged in as tester")
-        (ert-info ("Original buffer found, reused")
-          (erc-d-t-wait-for 2 (equal (buffer-name) "NickServ")))))
+        (funcall expect 5 "You're now logged in as tester")))
 
-    (ert-info ("Ours is the only NickServ buffer that remains")
+    (ert-info ("Still just one NickServ buffer")
       (should-not (cdr (erc-scenarios-common-buflist "NickServ"))))
 
-    (ert-info ("Visible network ID truncated to one component")
+    (ert-info ("As well as one server buffer")
       (should (not (get-buffer "foonet/tester`")))
       (should (not (get-buffer "foonet/tester")))
       (should (get-buffer "foonet")))))
@@ -135,29 +146,29 @@
     ;; Since we use reconnect, a new buffer won't be created
     ;; TODO add variant with clean `erc' invocation
     (with-current-buffer "foonet"
-      (erc-cmd-RECONNECT))
+      (erc-cmd-RECONNECT)
+      (funcall expect 10 "User modes for dummy"))
 
-    (ert-info ("Server-initiated renick")
-      (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "foonet/dummy"))
-        (should-not (get-buffer "foonet/tester"))
-        (funcall expect 15 "debug mode"))
+    (ert-info ("Server-initiated renick associated correctly")
+      (with-current-buffer "foonet"
+        (funcall expect 15 "debug mode")
+        (should-not (get-buffer "foonet/dummy"))
+        (should-not (get-buffer "foonet/tester")))
 
-      (erc-d-t-wait-for 1 "Old query renamed, now qualified"
-        (get-buffer "bob@foonet/tester"))
+      (ert-info ("Old query reassociated")
+        (should (get-buffer "bob"))
+        (should-not (get-buffer "bob@foonet/tester"))
+        (should-not (get-buffer "bob@foonet/dummy")))
 
-      (with-current-buffer (erc-d-t-wait-for 5 (get-buffer "bob@foonet/dummy"))
+      (with-current-buffer "foonet"
         (erc-cmd-NICK "tester")
-        (ert-info ("Buffers combined")
-          (erc-d-t-wait-for 2 (equal (buffer-name) "bob")))))
+        (funcall expect 5 "You're now logged in as tester")))
 
-    (with-current-buffer "foonet"
-      (funcall expect 5 "You're now logged in as tester"))
-
-    (ert-info ("Ours is the only bob buffer that remains")
+    (ert-info ("Ours is still the only bob buffer that remains")
       (should-not (cdr (erc-scenarios-common-buflist "bob"))))
 
-    (ert-info ("Visible network ID truncated to one component")
-      (should (not (get-buffer "foonet/dummy")))
-      (should (get-buffer "foonet")))))
+    (ert-info ("Visible network ID still truncated to one component")
+      (should (not (get-buffer "foonet/tester")))
+      (should (not (get-buffer "foonet/dummy"))))))
 
 ;;; erc-scenarios-base-association-nick.el ends here
diff --git a/test/lisp/erc/erc-scenarios-base-association-query.el 
b/test/lisp/erc/erc-scenarios-base-association-query.el
new file mode 100644
index 0000000000..78b75a530c
--- /dev/null
+++ b/test/lisp/erc/erc-scenarios-base-association-query.el
@@ -0,0 +1,107 @@
+;;; erc-scenarios-base-association-query.el --- assoc query scenarios -*- 
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-x)
+(eval-and-compile
+  (let ((load-path (cons (ert-resource-directory) load-path)))
+    (require 'erc-scenarios-common)))
+
+(eval-when-compile (require 'erc-join))
+
+
+;; Non-ERC buffers exist whose names match the nicknames of query
+;; targets, both newly arriving and outgoing.  No target buffers yet
+;; exist for these, so new ones are created that feature a net-ID
+;; @suffix.
+
+(ert-deftest erc-scenarios-base-association-existing-non-erc-buffer ()
+  :tags '(:expensive-test)
+  (erc-scenarios-common-with-cleanup
+      ((erc-scenarios-common-dialog "base/assoc/queries")
+       (dumb-server (erc-d-run "localhost" t 'non-erc))
+       (port (process-contact dumb-server :service))
+       (expect (erc-d-t-make-expecter))
+       (nitwit (with-current-buffer (get-buffer-create "nitwit")
+                 (prin1 (ert-test-name (ert-running-test)) (current-buffer))
+                 (current-buffer))) ; these are killed on completion by macro
+       (dummy (with-current-buffer (get-buffer-create "dummy")
+                (prin1 (ert-test-name (ert-running-test)) (current-buffer))
+                (current-buffer)))
+       (erc-server-flood-penalty 0.1))
+
+    (ert-info ("Connect to foonet")
+      (with-current-buffer (erc :server "127.0.0.1"
+                                :port port
+                                :nick "tester"
+                                :user "tester"
+                                :full-name "tester")
+        (erc-scenarios-common-assert-initial-buf-name nil port)
+        (erc-d-t-wait-for 5 (eq erc-network 'foonet))
+        (funcall expect 15 "debug mode")))
+
+    (ert-info ("Nick dummy queries us")
+      (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "dummy@foonet"))
+        (should (erc-query-buffer-p))
+        (funcall expect 5 "hi")
+
+        (ert-info ("We query nick nitwit")
+          (with-current-buffer (erc-cmd-QUERY "nitwit")
+            (should (equal (buffer-name) "nitwit@foonet"))
+            (erc-scenarios-common-say "hola")
+            (funcall expect 5 "ciao")))
+
+        (erc-scenarios-common-say "howdy")
+        (funcall expect 5 "bye")
+        (erc-cmd-QUIT "")))))
+
+;; Someone sending you a PM has the same name as the network (bug#59976)
+
+(ert-deftest erc-scenarios-base-association-some-nick-is-network ()
+  :tags '(:expensive-test)
+  (erc-scenarios-common-with-cleanup
+      ((erc-scenarios-common-dialog "base/assoc/queries")
+       (dumb-server (erc-d-run "localhost" t 'netnick))
+       (port (process-contact dumb-server :service))
+       (expect (erc-d-t-make-expecter))
+       (erc-server-flood-penalty 0.5))
+
+    (ert-info ("Connect to foonet")
+      (with-current-buffer (erc :server "127.0.0.1"
+                                :port port
+                                :nick "tester"
+                                :user "tester"
+                                :full-name "tester")
+        (erc-scenarios-common-assert-initial-buf-name nil port)
+        (erc-d-t-wait-for 5 (eq erc-network 'foonet))))
+
+    (ert-info ("Join common channel as nick foonet")
+      (with-current-buffer "foonet"
+        (funcall expect 15 "debug mode")
+        (erc-cmd-JOIN "#chan"))
+      (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan"))
+        (funcall expect 5 "welcome")))
+
+    (ert-info ("Nick foonet PMs us")
+      (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "foonet@foonet"))
+        (should (erc-query-buffer-p))
+        (funcall expect 5 "hi")))))
+
+;;; erc-scenarios-base-association-query.el ends here
diff --git a/test/lisp/erc/erc-scenarios-base-association-samenet.el 
b/test/lisp/erc/erc-scenarios-base-association-samenet.el
index b7c7079df3..a843159824 100644
--- a/test/lisp/erc/erc-scenarios-base-association-samenet.el
+++ b/test/lisp/erc/erc-scenarios-base-association-samenet.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-association-samenet.el --- assoc samenet scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-association.el 
b/test/lisp/erc/erc-scenarios-base-association.el
index 83e5101e3a..a03714aa79 100644
--- a/test/lisp/erc/erc-scenarios-base-association.el
+++ b/test/lisp/erc/erc-scenarios-base-association.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-association.el --- base assoc scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-compat-rename-bouncer.el 
b/test/lisp/erc/erc-scenarios-base-compat-rename-bouncer.el
index 2ffa86aff6..81cbaca558 100644
--- a/test/lisp/erc/erc-scenarios-base-compat-rename-bouncer.el
+++ b/test/lisp/erc/erc-scenarios-base-compat-rename-bouncer.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-compat-rename-bouncer.el --- compat-rename scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-local-modules.el 
b/test/lisp/erc/erc-scenarios-base-local-modules.el
new file mode 100644
index 0000000000..ff92dacb75
--- /dev/null
+++ b/test/lisp/erc/erc-scenarios-base-local-modules.el
@@ -0,0 +1,242 @@
+;;; erc-scenarios-local-modules.el --- Local modules tests for ERC -*- 
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/>.
+
+;;; Commentary:
+
+;; These tests all use `sasl' because, as of ERC 5.5, it's the one
+;; and only local module.
+
+;;; Code:
+
+(require 'ert-x)
+(eval-and-compile
+  (let ((load-path (cons (ert-resource-directory) load-path)))
+    (require 'erc-scenarios-common)))
+
+(require 'erc-sasl)
+
+;; This asserts that a local module's options and its inclusion in
+;; (and absence from) `erc-update-modules' can be let-bound.
+
+(ert-deftest erc-scenarios-base-local-modules--reconnect-let ()
+  :tags '(:expensive-test)
+  (erc-scenarios-common-with-cleanup
+      ((erc-scenarios-common-dialog "sasl")
+       (erc-server-flood-penalty 0.1)
+       (dumb-server (erc-d-run "localhost" t 'plain 'plain))
+       (port (process-contact dumb-server :service))
+       (expect (erc-d-t-make-expecter)))
+
+    (ert-info ("Connect with options let-bound")
+      (with-current-buffer
+          ;; This won't work unless the library is already loaded
+          (let ((erc-modules (cons 'sasl erc-modules))
+                (erc-sasl-mechanism 'plain)
+                (erc-sasl-password "password123"))
+            (erc :server "127.0.0.1"
+                 :port port
+                 :nick "tester"
+                 :user "tester"
+                 :full-name "tester"))
+        (should (string= (buffer-name) (format "127.0.0.1:%d" port)))))
+
+    (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "ExampleOrg"))
+
+      (ert-info ("First connection succeeds")
+        (funcall expect 10 "This server is in debug mode")
+        (erc-cmd-QUIT "")
+        (funcall expect 10 "finished"))
+
+      (should-not (memq 'sasl erc-modules))
+      (erc-d-t-wait-for 10 (not (erc-server-process-alive)))
+      (erc-cmd-RECONNECT)
+
+      (ert-info ("Second connection succeeds")
+        (funcall expect 10 "This server is in debug mode")
+        (erc-cmd-QUIT "")
+        (funcall expect 10 "finished")))))
+
+;; After quitting a session for which `sasl' is enabled, you
+;; disconnect and toggle `erc-sasl-mode' off.  You then reconnect
+;; using an alternate nickname.  You again disconnect and reconnect,
+;; this time immediately, and the mode stays disabled.  Finally, you
+;; once again disconnect, toggle the mode back on, and reconnect.  You
+;; are authenticated successfully, just like in the initial session.
+;;
+;; This is meant to show that a user's local mode settings persist
+;; between sessions.  It also happens to show (in round four, below)
+;; that a server renicking a user on 001 after a 903 is handled just
+;; like a user-initiated renick, although this is not the main thrust.
+
+(ert-deftest erc-scenarios-base-local-modules--mode-persistence ()
+  :tags '(:expensive-test)
+  (erc-scenarios-common-with-cleanup
+      ((erc-scenarios-common-dialog "base/local-modules")
+       (erc-server-flood-penalty 0.1)
+       (dumb-server (erc-d-run "localhost" t 'first 'second 'third 'fourth))
+       (port (process-contact dumb-server :service))
+       (erc-modules (cons 'sasl erc-modules))
+       (expect (erc-d-t-make-expecter))
+       (server-buffer-name (format "127.0.0.1:%d" port)))
+
+    (ert-info ("Round one, initial authentication succeeds as expected")
+      (with-current-buffer (erc :server "127.0.0.1"
+                                :port port
+                                :nick "tester"
+                                :user "tester"
+                                :password "changeme"
+                                :full-name "tester")
+        (should (string= (buffer-name) server-buffer-name))
+        (funcall expect 10 "You are now logged in as tester"))
+
+      (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "foonet"))
+        (funcall expect 10 "This server is in debug mode")
+        (erc-cmd-JOIN "#chan")
+
+        (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan"))
+          (funcall expect 20 "She is Lavinia, therefore must"))
+
+        (erc-cmd-QUIT "")
+        (funcall expect 10 "finished")))
+
+    (ert-info ("Round two, nick rejected, alternate granted")
+      (with-current-buffer "foonet"
+
+        (ert-info ("Toggle mode off, reconnect")
+          (erc-sasl-mode -1)
+          (erc-cmd-RECONNECT))
+
+        (funcall expect 10 "User modes for tester`")
+        (should-not (cdr (erc-scenarios-common-buflist "foonet")))
+        (should (equal (buffer-name) "foonet"))
+        (should-not (cdr (erc-scenarios-common-buflist "#chan")))
+
+        (with-current-buffer "#chan"
+          (funcall expect 10 "Some enigma, some riddle"))
+
+        (erc-cmd-QUIT "")
+        (funcall expect 10 "finished")))
+
+    (ert-info ("Round three, send alternate nick initially")
+      (with-current-buffer "foonet"
+
+        (ert-info ("Keep mode off, reconnect")
+          (should-not erc-sasl-mode)
+          (should (local-variable-p 'erc-sasl-mode))
+          (erc-cmd-RECONNECT))
+
+        (funcall expect 10 "User modes for tester`")
+        (should-not (cdr (erc-scenarios-common-buflist "foonet")))
+        (should (equal (buffer-name) "foonet"))
+        (should-not (cdr (erc-scenarios-common-buflist "#chan")))
+
+        (with-current-buffer "#chan"
+          (funcall expect 10 "Let our reciprocal vows be remembered."))
+
+        (erc-cmd-QUIT "")
+        (funcall expect 10 "finished")))
+
+    (ert-info ("Round four, authenticated successfully again")
+      (with-current-buffer "foonet"
+
+        (ert-info ("Toggle mode on, reconnect")
+          (should-not erc-sasl-mode)
+          (should (local-variable-p 'erc-sasl-mode))
+          (erc-sasl-mode +1)
+          (erc-cmd-RECONNECT))
+
+        (funcall expect 10 "User modes for tester")
+        (should-not (cdr (erc-scenarios-common-buflist "foonet")))
+        (should (equal (buffer-name) "foonet"))
+        (should-not (cdr (erc-scenarios-common-buflist "#chan")))
+
+        (with-current-buffer "#chan"
+          (funcall expect 10 "Well met; good morrow, Titus and Hortensius."))
+
+        (erc-cmd-QUIT "")))))
+
+;; For local modules, the twin toggle commands `erc-FOO-enable' and
+;; `erc-FOO-disable' affect all buffers of a connection, whereas
+;; `erc-FOO-mode' continues to operate only on the current buffer.
+
+(ert-deftest erc-scenarios-base-local-modules--toggle-helpers ()
+  :tags '(:expensive-test)
+  (erc-scenarios-common-with-cleanup
+      ((erc-scenarios-common-dialog "base/local-modules")
+       (erc-server-flood-penalty 0.1)
+       (dumb-server (erc-d-run "localhost" t 'first 'second 'fourth))
+       (port (process-contact dumb-server :service))
+       (erc-modules (cons 'sasl erc-modules))
+       (expect (erc-d-t-make-expecter))
+       (server-buffer-name (format "127.0.0.1:%d" port)))
+
+    (ert-info ("Initial authentication succeeds as expected")
+      (with-current-buffer (erc :server "127.0.0.1"
+                                :port port
+                                :nick "tester"
+                                :user "tester"
+                                :password "changeme"
+                                :full-name "tester")
+        (should (string= (buffer-name) server-buffer-name))
+        (funcall expect 10 "You are now logged in as tester"))
+
+      (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "foonet"))
+        (funcall expect 10 "This server is in debug mode")
+        (erc-cmd-JOIN "#chan")
+
+        (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan"))
+          (funcall expect 20 "She is Lavinia, therefore must"))
+
+        (erc-cmd-QUIT "")
+        (funcall expect 10 "finished")))
+
+    (ert-info ("Disabling works from a target buffer.")
+      (with-current-buffer "#chan"
+        (should erc-sasl-mode)
+        (call-interactively #'erc-sasl-disable)
+        (should-not erc-sasl-mode)
+        (should (local-variable-p 'erc-sasl-mode))
+        (should-not (buffer-local-value 'erc-sasl-mode (get-buffer "foonet")))
+        (erc-cmd-RECONNECT)
+        (with-current-buffer "#chan"
+          (funcall expect 10 "Some enigma, some riddle")
+          (should-not erc-sasl-mode) ; regression
+          (should (local-variable-p 'erc-sasl-mode))))
+
+      (with-current-buffer "foonet"
+        (should (local-variable-p 'erc-sasl-mode))
+        (funcall expect 10 "User modes for tester`")
+        (erc-cmd-QUIT "")
+        (funcall expect 10 "finished")))
+
+    (ert-info ("Enabling works from a target buffer")
+      (with-current-buffer "#chan"
+        (call-interactively #'erc-sasl-enable)
+        (should (local-variable-p 'erc-sasl-mode))
+        (should erc-sasl-mode)
+        (erc-cmd-RECONNECT)
+        (funcall expect 10 "Well met; good morrow, Titus and Hortensius.")
+        (erc-cmd-QUIT ""))
+
+      (with-current-buffer "foonet"
+        (should (local-variable-p 'erc-sasl-mode))
+        (should erc-sasl-mode)
+        (funcall expect 10 "User modes for tester")))))
+
+;;; erc-scenarios-local-modules.el ends here
diff --git a/test/lisp/erc/erc-scenarios-base-misc-regressions.el 
b/test/lisp/erc/erc-scenarios-base-misc-regressions.el
index 8f5700df14..1cad934b6e 100644
--- a/test/lisp/erc/erc-scenarios-base-misc-regressions.el
+++ b/test/lisp/erc/erc-scenarios-base-misc-regressions.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-misc-regressions.el --- misc regressions scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-netid-bouncer-id.el 
b/test/lisp/erc/erc-scenarios-base-netid-bouncer-id.el
index 6c6568cad6..6540d44c4b 100644
--- a/test/lisp/erc/erc-scenarios-base-netid-bouncer-id.el
+++ b/test/lisp/erc/erc-scenarios-base-netid-bouncer-id.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-netid-bouncer-id.el --- net-id bouncer ID scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-base.el 
b/test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-base.el
index f48e1ef394..135d378c7f 100644
--- a/test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-base.el
+++ b/test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-base.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-netid-bouncer-recon-base.el --- net-id base scenarios 
-*- lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-id.el 
b/test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-id.el
index 72510809ab..fb58be9615 100644
--- a/test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-id.el
+++ b/test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-id.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-netid-bouncer-recon-id.el --- recon ID scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-netid-bouncer.el 
b/test/lisp/erc/erc-scenarios-base-netid-bouncer.el
index d171e1f9f9..432a89b997 100644
--- a/test/lisp/erc/erc-scenarios-base-netid-bouncer.el
+++ b/test/lisp/erc/erc-scenarios-base-netid-bouncer.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-netid-bouncer.el --- net-id bouncer scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-netid-samenet.el 
b/test/lisp/erc/erc-scenarios-base-netid-samenet.el
index 248144d6f9..1436712251 100644
--- a/test/lisp/erc/erc-scenarios-base-netid-samenet.el
+++ b/test/lisp/erc/erc-scenarios-base-netid-samenet.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-network-id-samenet.el --- netid-id samenet scenarios 
-*- lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
@@ -39,6 +40,9 @@
        (erc-server-flood-margin 30)
        erc-serv-buf-a erc-serv-buf-b)
 
+    (when (and id-a (zerop (random 2))) (setq id-a (symbol-name id-a)))
+    (when (and id-b (zerop (random 2))) (setq id-b (symbol-name id-b)))
+
     (ert-info ("Connect to foonet with nick tester")
       (with-current-buffer
           (setq erc-serv-buf-a (erc :server "127.0.0.1"
diff --git a/test/lisp/erc/erc-scenarios-base-reconnect.el 
b/test/lisp/erc/erc-scenarios-base-reconnect.el
index 8762f33b30..2a3dac1251 100644
--- a/test/lisp/erc/erc-scenarios-base-reconnect.el
+++ b/test/lisp/erc/erc-scenarios-base-reconnect.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-reconnect.el --- Base-reconnect scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-renick.el 
b/test/lisp/erc/erc-scenarios-base-renick.el
index bf27f61b3f..69ecc0a7da 100644
--- a/test/lisp/erc/erc-scenarios-base-renick.el
+++ b/test/lisp/erc/erc-scenarios-base-renick.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-renick.el --- Re-nicking scenarios -*- lexical-binding: 
t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-reuse-buffers.el 
b/test/lisp/erc/erc-scenarios-base-reuse-buffers.el
index 8e7e939d04..a8575aa55a 100644
--- a/test/lisp/erc/erc-scenarios-base-reuse-buffers.el
+++ b/test/lisp/erc/erc-scenarios-base-reuse-buffers.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-reuse-buffers.el --- base-reuse-buffers scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-unstable.el 
b/test/lisp/erc/erc-scenarios-base-unstable.el
index 2313a15842..f5b8df6f4a 100644
--- a/test/lisp/erc/erc-scenarios-base-unstable.el
+++ b/test/lisp/erc/erc-scenarios-base-unstable.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-base-unstable.el --- base unstable scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-base-upstream-recon-soju.el 
b/test/lisp/erc/erc-scenarios-base-upstream-recon-soju.el
index 5a5b363f31..0e6f4b7a6b 100644
--- a/test/lisp/erc/erc-scenarios-base-upstream-recon-soju.el
+++ b/test/lisp/erc/erc-scenarios-base-upstream-recon-soju.el
@@ -1,27 +1,28 @@
 ;;; erc-scenarios-upstream-recon-soju.el --- Upstream soju -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;; Commentary:
-;;
+
 ;; These concern the loss and recovery of a proxy's IRC-side connection.
 
+;;; Code:
+
 (require 'ert-x)
 (eval-and-compile
   (let ((load-path (cons (ert-resource-directory) load-path)))
diff --git a/test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el 
b/test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el
index 6e9a217245..76cf9f4f76 100644
--- a/test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el
+++ b/test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el
@@ -1,27 +1,28 @@
 ;;; erc-scenarios-upstream-recon-znc.el --- Upstream znc -*- lexical-binding: 
t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;; Commentary:
-;;
+
 ;; These concern the loss and recovery of a proxy's IRC-side connection.
 
+;;; Code:
+
 (require 'ert-x)
 (eval-and-compile
   (let ((load-path (cons (ert-resource-directory) load-path)))
diff --git a/test/lisp/erc/erc-scenarios-internal.el 
b/test/lisp/erc/erc-scenarios-internal.el
index e4e1edb97e..e122443c59 100644
--- a/test/lisp/erc/erc-scenarios-internal.el
+++ b/test/lisp/erc/erc-scenarios-internal.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-internal.el --- Proxy file for erc-d tests -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-join-auth-source.el 
b/test/lisp/erc/erc-scenarios-join-auth-source.el
index 94336db07c..ef200fb6d0 100644
--- a/test/lisp/erc/erc-scenarios-join-auth-source.el
+++ b/test/lisp/erc/erc-scenarios-join-auth-source.el
@@ -1,27 +1,28 @@
 ;;; erc-scenarios-join-auth-source.el --- join-auth-source scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 ;; TODO add another test with autojoin and channel keys
 
+;;; Code:
+
 (require 'ert-x)
 (eval-and-compile
   (let ((load-path (cons (ert-resource-directory) load-path)))
diff --git a/test/lisp/erc/erc-scenarios-join-netid-newcmd-id.el 
b/test/lisp/erc/erc-scenarios-join-netid-newcmd-id.el
index e2e437321d..4c25c3e4f8 100644
--- a/test/lisp/erc/erc-scenarios-join-netid-newcmd-id.el
+++ b/test/lisp/erc/erc-scenarios-join-netid-newcmd-id.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-join-netid-newcmd-id.el --- join netid newcmd scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-join-netid-newcmd.el 
b/test/lisp/erc/erc-scenarios-join-netid-newcmd.el
index 1a541a46b3..e54f5fe9ce 100644
--- a/test/lisp/erc/erc-scenarios-join-netid-newcmd.el
+++ b/test/lisp/erc/erc-scenarios-join-netid-newcmd.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-join-netid-newcmd.el --- join netid newcmd scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-join-netid-recon-id.el 
b/test/lisp/erc/erc-scenarios-join-netid-recon-id.el
index 92bdd643de..9a9e4692b6 100644
--- a/test/lisp/erc/erc-scenarios-join-netid-recon-id.el
+++ b/test/lisp/erc/erc-scenarios-join-netid-recon-id.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-join-netid-recon-id.el --- join-netid-recon scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-join-netid-recon.el 
b/test/lisp/erc/erc-scenarios-join-netid-recon.el
index cbdba07e25..9f9244dad2 100644
--- a/test/lisp/erc/erc-scenarios-join-netid-recon.el
+++ b/test/lisp/erc/erc-scenarios-join-netid-recon.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-join-netid-recon.el --- join-netid-recon scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
diff --git a/test/lisp/erc/erc-scenarios-misc.el 
b/test/lisp/erc/erc-scenarios-misc.el
index 8557a77906..f1696088a4 100644
--- a/test/lisp/erc/erc-scenarios-misc.el
+++ b/test/lisp/erc/erc-scenarios-misc.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-misc.el --- Misc scenarios for ERC -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
@@ -97,11 +98,10 @@
                                 :nick "tester"
                                 :full-name "tester")
         (should (string= (buffer-name) (format "127.0.0.1:%d" port)))
-        (let ((err (should-error (sleep-for 1))))
-          (should (string-match-p "Failed to determine" (cadr err))))
         (funcall expect 1 "Failed to determine")
         (funcall expect 1 "Failed to determine")
-        (should-not erc-network)
+        (funcall expect 1 "Connection failed")
+        (should (string-prefix-p "Unknown" (erc-network-name)))
         (should (string= erc-server-announced-name "irc.foonet.org"))))))
 
 ;; Targets that are host/server masks like $*, $$*, and #* are routed
diff --git a/test/lisp/erc/erc-scenarios-sasl.el 
b/test/lisp/erc/erc-scenarios-sasl.el
new file mode 100644
index 0000000000..1e412d53d5
--- /dev/null
+++ b/test/lisp/erc/erc-scenarios-sasl.el
@@ -0,0 +1,143 @@
+;;; erc-scenarios-sasl.el --- SASL tests for ERC -*- 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-x)
+(eval-and-compile
+  (let ((load-path (cons (ert-resource-directory) load-path)))
+    (require 'erc-scenarios-common)))
+
+(require 'erc-sasl)
+
+(ert-deftest erc-scenarios-sasl--plain ()
+  :tags '(:expensive-test)
+  (erc-scenarios-common-with-cleanup
+      ((erc-scenarios-common-dialog "sasl")
+       (erc-server-flood-penalty 0.1)
+       (dumb-server (erc-d-run "localhost" t 'plain))
+       (port (process-contact dumb-server :service))
+       (erc-modules (cons 'sasl erc-modules))
+       (erc-sasl-password "password123")
+       (expect (erc-d-t-make-expecter)))
+
+    (ert-info ("Connect")
+      (with-current-buffer (erc :server "127.0.0.1"
+                                :port port
+                                :nick "tester"
+                                :user "tester"
+                                :full-name "tester")
+        (should (string= (buffer-name) (format "127.0.0.1:%d" port)))))
+
+    (ert-info ("Notices received")
+      (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "ExampleOrg"))
+        (funcall expect 10 "This server is in debug mode")
+        ;; Regression "\0\0\0\0 ..." caused by (fillarray passphrase 0)
+        (should (string= erc-sasl-password "password123"))))))
+
+(ert-deftest erc-scenarios-sasl--external ()
+  :tags '(:expensive-test)
+  (erc-scenarios-common-with-cleanup
+      ((erc-scenarios-common-dialog "sasl")
+       (erc-server-flood-penalty 0.1)
+       (dumb-server (erc-d-run "localhost" t 'external))
+       (port (process-contact dumb-server :service))
+       (erc-modules (cons 'sasl erc-modules))
+       (erc-sasl-mechanism 'external)
+       (expect (erc-d-t-make-expecter)))
+
+    (ert-info ("Connect")
+      (with-current-buffer (erc :server "127.0.0.1"
+                                :port port
+                                :nick "tester"
+                                :user "tester"
+                                :full-name "tester")
+        (should (string= (buffer-name) (format "127.0.0.1:%d" port)))))
+
+    (ert-info ("Notices received")
+      (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "ExampleOrg"))
+        (funcall expect 10 "Authentication successful")
+        (funcall expect 10 "This server is in debug mode")))))
+
+(ert-deftest erc-scenarios-sasl--plain-fail ()
+  :tags '(:expensive-test)
+  (erc-scenarios-common-with-cleanup
+      ((erc-scenarios-common-dialog "sasl")
+       (erc-server-flood-penalty 0.1)
+       (dumb-server (erc-d-run "localhost" t 'plain-failed))
+       (port (process-contact dumb-server :service))
+       (erc-modules (cons 'sasl erc-modules))
+       (erc-sasl-password "wrong")
+       (erc-sasl-mechanism 'plain)
+       (expect (erc-d-t-make-expecter))
+       (buf nil))
+
+    (ert-info ("Connect")
+      (setq buf (erc :server "127.0.0.1"
+                     :port port
+                     :nick "tester"
+                     :user "tester"
+                     :full-name "tester"))
+      (let ((err (should-error
+                  (with-current-buffer buf
+                    (funcall expect 20 "Connection failed!")))))
+        (should (string-search "please review" (cadr err)))
+        (with-current-buffer buf
+          (funcall expect 10 "Opening connection")
+          (funcall expect 20 "SASL authentication failed")
+          (should-not (erc-server-process-alive)))))))
+
+(defun erc-scenarios--common--sasl (mech)
+  (erc-scenarios-common-with-cleanup
+      ((erc-scenarios-common-dialog "sasl")
+       (erc-server-flood-penalty 0.1)
+       (dumb-server (erc-d-run "localhost" t mech))
+       (port (process-contact dumb-server :service))
+       (erc-modules (cons 'sasl erc-modules))
+       (erc-sasl-user :nick)
+       (erc-sasl-mechanism mech)
+       (mock-rvs (list "c5RqLCZy0L4fGkKAZ0hujFBs" ""))
+       (sasl-unique-id-function (lambda () (pop mock-rvs)))
+       (expect (erc-d-t-make-expecter)))
+
+    (ert-info ("Connect")
+      (with-current-buffer (erc :server "127.0.0.1"
+                                :port port
+                                :nick "jilles"
+                                :password "sesame"
+                                :full-name "jilles")
+        (should (string= (buffer-name) (format "127.0.0.1:%d" port)))))
+
+    (ert-info ("Notices received")
+      (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "jaguar"))
+        (funcall expect 10 "Found your hostname")
+        (funcall expect 20 "marked as being away")))))
+
+(ert-deftest erc-scenarios-sasl--scram-sha-1 ()
+  :tags '(:expensive-test)
+  (let ((erc-sasl-authzid "jilles"))
+    (erc-scenarios--common--sasl 'scram-sha-1)))
+
+(ert-deftest erc-scenarios-sasl--scram-sha-256 ()
+  :tags '(:expensive-test)
+  (unless (featurep 'sasl-scram-sha256)
+    (ert-skip "Emacs lacks sasl-scram-sha256"))
+  (erc-scenarios--common--sasl 'scram-sha-256))
+
+;;; erc-scenarios-sasl.el ends here
diff --git a/test/lisp/erc/erc-scenarios-services-misc.el 
b/test/lisp/erc/erc-scenarios-services-misc.el
index cb1aa6ff32..44e04e5150 100644
--- a/test/lisp/erc/erc-scenarios-services-misc.el
+++ b/test/lisp/erc/erc-scenarios-services-misc.el
@@ -1,22 +1,23 @@
 ;;; erc-scenarios-services-misc.el --- Services-misc scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
 
 (require 'ert-x)
 (eval-and-compile
@@ -83,4 +84,63 @@
 
     (should-not (memq 'services erc-modules))))
 
+;; A user with `services' enabled connects, quits, and reconnects.  An
+;; entry in their netrc matches the network ID, which isn't known when
+;; `erc-auth-source-server-function' runs -- initially *or* on
+;; reconnect.  It's only seen by `erc-auth-source-services-function'.
+
+(ert-deftest erc-scenarios-services-auth-source-reconnect ()
+  :tags '(:expensive-test)
+  (erc-scenarios-common-with-cleanup
+      ((erc-scenarios-common-dialog "services/auth-source")
+       (erc-server-flood-penalty 0.1)
+       (dumb-server (erc-d-run "localhost" t 'recon 'recon))
+       (port (process-contact dumb-server :service))
+       (netrc-file (make-temp-file
+                    "auth-source-test" nil nil
+                    "machine FooNet login tester password changeme\n"))
+       (auth-sources (list netrc-file))
+       (auth-source-do-cache nil)
+       (erc-modules (cons 'services erc-modules))
+       (erc-use-auth-source-for-nickserv-password t) ; do consult
+       (erc-prompt-for-nickserv-password nil) ; don't prompt
+       (erc-nickserv-alist
+        (cons '(FooNet
+                "NickServ!NickServ@services.int"
+                "This nickname is registered. Please choose"
+                "NickServ" "IDENTIFY" nil nil "You are now identified for ")
+              erc-nickserv-alist))
+       (expect (erc-d-t-make-expecter))
+       (erc-scenarios-common-extra-teardown (lambda ()
+                                              (delete-file netrc-file))))
+
+    (ert-info ("Server password omitted from initial connection")
+      (with-current-buffer (erc :server "127.0.0.1"
+                                :port port
+                                :nick "tester"
+                                :user "tester"
+                                :full-name "tester")
+        (should (string= (buffer-name) (format "127.0.0.1:%d" port)))
+        (ert-info ("Services module authenticates")
+          (funcall expect 10 "This nickname is registered.")
+          (funcall expect 3 "You are now identified"))
+        (erc-cmd-JOIN "#chan")
+        (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan"))
+          (funcall expect 10 "the gallants desire it"))
+        (erc-cmd-QUIT "")
+        (funcall expect 3 "finished")))
+
+    (ert-info ("Server password withheld on reconnect")
+      (with-current-buffer "#chan"
+        (erc-cmd-RECONNECT))
+      (with-current-buffer "FooNet"
+        (funcall expect 10 "This nickname is registered.")
+        (funcall expect 3 "You are now identified")
+        (with-current-buffer "#chan" ; autojoined
+          (funcall expect 10 "the gallants desire it"))
+        (erc-cmd-QUIT "")
+        (funcall expect 3 "finished")))
+
+    (erc-services-mode -1)))
+
 ;;; erc-scenarios-services-misc.el ends here
diff --git a/test/lisp/erc/erc-services-tests.el 
b/test/lisp/erc/erc-services-tests.el
index 7ff2e36e77..2547c5e01a 100644
--- a/test/lisp/erc/erc-services-tests.el
+++ b/test/lisp/erc/erc-services-tests.el
@@ -62,9 +62,13 @@
                            :x ("x")
                            :require (:secret))))))
 
+(defun erc-services-tests--wrap-search (s)
+  (lambda (&rest r) (erc--unfun (apply s r))))
+
 ;; Some of the following may be related to bug#23438.
 
 (defun erc-services-tests--auth-source-standard (search)
+  (setq search (erc-services-tests--wrap-search search))
 
   (ert-info ("Session wins")
     (let ((erc-session-server "irc.gnu.org")
@@ -93,6 +97,7 @@
       (should (string= (funcall search :user "#chan") "baz")))))
 
 (defun erc-services-tests--auth-source-announced (search)
+  (setq search (erc-services-tests--wrap-search search))
   (let* ((erc--isupport-params (make-hash-table))
          (erc-server-parameters '(("CHANTYPES" . "&#")))
          (erc--target (erc--target-from-string "&chan")))
@@ -124,6 +129,7 @@
           (should (string= (funcall search :user "#chan") "foo")))))))
 
 (defun erc-services-tests--auth-source-overrides (search)
+  (setq search (erc-services-tests--wrap-search search))
   (let* ((erc-session-server "irc.gnu.org")
          (erc-server-announced-name "my.gnu.org")
          (erc-network 'GNU.chat)
@@ -537,18 +543,20 @@
            (erc-network 'FSF.chat)
            (erc-server-current-nick "tester")
            (erc-networks--id (erc-networks--id-create nil))
-           (erc-session-port 6697))
+           (erc-session-port 6697)
+           (search (erc-services-tests--wrap-search
+                    #'erc-nickserv-get-password)))
 
       (ert-info ("Lookup custom option")
-        (should (string= (erc-nickserv-get-password "alice") "foo")))
+        (should (string= (funcall search "alice") "foo")))
 
       (ert-info ("Auth source")
         (ert-info ("Network")
-          (should (string= (erc-nickserv-get-password "bob") "sesame")))
+          (should (string= (funcall search "bob") "sesame")))
 
         (ert-info ("Network ID")
           (let ((erc-networks--id (erc-networks--id-create 'GNU/chat)))
-            (should (string= (erc-nickserv-get-password "bob") "spam")))))
+            (should (string= (funcall search "bob") "spam")))))
 
       (ert-info ("Read input")
         (should (string=
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index ff5d802697..578b2641a6 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -428,18 +428,21 @@
 
     (ert-info ("ascii")
       (puthash 'CASEMAPPING  '("ascii") erc--isupport-params)
+      (should (equal (erc-downcase "ABC 123 ΔΞΩΣ") "abc 123 ΔΞΩΣ"))
       (should (equal (erc-downcase "Bob[m]`") "bob[m]`"))
       (should (equal (erc-downcase "Tilde~") "tilde~" ))
       (should (equal (erc-downcase "\\O/") "\\o/" )))
 
     (ert-info ("rfc1459")
       (puthash 'CASEMAPPING  '("rfc1459") erc--isupport-params)
+      (should (equal (erc-downcase "ABC 123 ΔΞΩΣ") "abc 123 ΔΞΩΣ"))
       (should (equal (erc-downcase "Bob[m]`") "bob{m}`" ))
       (should (equal (erc-downcase "Tilde~") "tilde^" ))
       (should (equal (erc-downcase "\\O/") "|o/" )))
 
     (ert-info ("rfc1459-strict")
       (puthash 'CASEMAPPING  '("rfc1459-strict") erc--isupport-params)
+      (should (equal (erc-downcase "ABC 123 ΔΞΩΣ") "abc 123 ΔΞΩΣ"))
       (should (equal (erc-downcase "Bob[m]`") "bob{m}`"))
       (should (equal (erc-downcase "Tilde~") "tilde~" ))
       (should (equal (erc-downcase "\\O/") "|o/" )))))
@@ -530,6 +533,28 @@
   (when noninteractive
     (kill-buffer "*#fake*")))
 
+(ert-deftest erc--debug-irc-protocol-mask-secrets ()
+  (should-not erc-debug-irc-protocol)
+  (should erc--debug-irc-protocol-mask-secrets)
+  (with-temp-buffer
+    (setq erc-server-process (start-process "fake" (current-buffer) "true")
+          erc-server-current-nick "tester"
+          erc-session-server "myproxy.localhost"
+          erc-session-port 6667)
+    (let ((inhibit-message noninteractive))
+      (erc-toggle-debug-irc-protocol)
+      (erc-log-irc-protocol
+       (concat "PASS :" (erc--unfun (lambda () "changeme")) "\r\n")
+       'outgoing)
+      (set-process-query-on-exit-flag erc-server-process nil))
+    (with-current-buffer "*erc-protocol*"
+      (goto-char (point-min))
+      (search-forward "\r\n\r\n")
+      (search-forward "myproxy.localhost:6667 >> PASS :????????" (pos-eol)))
+    (when noninteractive
+      (kill-buffer "*erc-protocol*")
+      (should-not erc-debug-irc-protocol))))
+
 (ert-deftest erc-log-irc-protocol ()
   (should-not erc-debug-irc-protocol)
   (with-temp-buffer
@@ -1178,4 +1203,160 @@
     (kill-buffer "baznet")
     (kill-buffer "#chan")))
 
+(ert-deftest erc-migrate-modules ()
+  (should (equal (erc-migrate-modules '(autojoin timestamp button))
+                 '(autojoin stamp button)))
+  ;; Default unchanged
+  (should (equal (erc-migrate-modules erc-modules) erc-modules)))
+
+(ert-deftest erc--update-modules ()
+  (let (calls
+        erc-modules
+        erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook)
+    (cl-letf (((symbol-function 'require)
+               (lambda (s &rest _) (push s calls)))
+
+              ;; Local modules
+              ((symbol-function 'erc-fake-bar-mode)
+               (lambda (n) (push (cons 'fake-bar n) calls)))
+
+              ;; Global modules
+              ((symbol-function 'erc-fake-foo-mode)
+               (lambda (n) (push (cons 'fake-foo n) calls)))
+              ((get 'erc-fake-foo-mode 'standard-value) 'ignore)
+              ((symbol-function 'erc-autojoin-mode)
+               (lambda (n) (push (cons 'autojoin n) calls)))
+              ((get 'erc-autojoin-mode 'standard-value) 'ignore)
+              ((symbol-function 'erc-networks-mode)
+               (lambda (n) (push (cons 'networks n) calls)))
+              ((get 'erc-networks-mode 'standard-value) 'ignore)
+              ((symbol-function 'erc-completion-mode)
+               (lambda (n) (push (cons 'completion n) calls)))
+              ((get 'erc-completion-mode 'standard-value) 'ignore))
+
+      (ert-info ("Local modules")
+        (setq erc-modules '(fake-foo fake-bar))
+        (should (equal (erc--update-modules) '(erc-fake-bar-mode)))
+        ;; Bar the feature is still required but the mode is not activated
+        (should (equal (nreverse calls)
+                       '(erc-fake-foo (fake-foo . 1) erc-fake-bar)))
+        (setq calls nil))
+
+      (ert-info ("Module name overrides")
+        (setq erc-modules '(completion autojoin networks))
+        (should-not (erc--update-modules)) ; no locals
+        (should (equal (nreverse calls) '( erc-pcomplete (completion . 1)
+                                           erc-join (autojoin . 1)
+                                           erc-networks (networks . 1))))
+        (setq calls nil)))))
+
+(ert-deftest erc--merge-local-modes ()
+
+  (ert-info ("No existing modes")
+    (let ((old '((a) (b . t)))
+          (new '(erc-c-mode erc-d-mode)))
+      (should (equal (erc--merge-local-modes new old)
+                     '((erc-c-mode erc-d-mode))))))
+
+  (ert-info ("Active existing added, inactive existing removed, deduped")
+    (let ((old '((a) (erc-b-mode) (c . t) (erc-d-mode . t) (erc-e-mode . t)))
+          (new '(erc-b-mode erc-d-mode)))
+      (should (equal (erc--merge-local-modes new old)
+                     '((erc-d-mode erc-e-mode) . (erc-b-mode)))))))
+
+(ert-deftest define-erc-module--global ()
+  (let ((global-module '(define-erc-module mname malias
+                          "Some docstring"
+                          ((ignore a) (ignore b))
+                          ((ignore c) (ignore d)))))
+
+    (should (equal (macroexpand global-module)
+                   `(progn
+
+                      (define-minor-mode erc-mname-mode
+                        "Toggle ERC mname mode.
+With a prefix argument ARG, enable mname if ARG is positive,
+and disable it otherwise.  If called from Lisp, enable the mode
+if ARG is omitted or nil.
+Some docstring"
+                        :global t
+                        :group 'erc-mname
+                        (if erc-mname-mode
+                            (erc-mname-enable)
+                          (erc-mname-disable)))
+
+                      (defun erc-mname-enable ()
+                        "Enable ERC mname mode."
+                        (interactive)
+                        (cl-pushnew 'mname erc-modules)
+                        (setq erc-mname-mode t)
+                        (ignore a) (ignore b))
+
+                      (defun erc-mname-disable ()
+                        "Disable ERC mname mode."
+                        (interactive)
+                        (setq erc-modules (delq 'mname erc-modules))
+                        (setq erc-mname-mode nil)
+                        (ignore c) (ignore d))
+
+                      (defalias 'erc-malias-mode #'erc-mname-mode)
+
+                      (put 'erc-mname-mode 'definition-name 'mname)
+                      (put 'erc-mname-enable 'definition-name 'mname)
+                      (put 'erc-mname-disable 'definition-name 'mname))))))
+
+(ert-deftest define-erc-module--local ()
+  (let* ((global-module '(define-erc-module mname malias
+                           "Some docstring"
+                           ((ignore a) (ignore b))
+                           ((ignore c) (ignore d))
+                           'local))
+         (got (macroexpand global-module))
+         (arg-en (cadr (nth 2 (nth 2 got))))
+         (arg-dis (cadr (nth 2 (nth 3 got)))))
+
+    (should (equal got
+                   `(progn
+                      (define-minor-mode erc-mname-mode
+                        "Toggle ERC mname mode.
+With a prefix argument ARG, enable mname if ARG is positive,
+and disable it otherwise.  If called from Lisp, enable the mode
+if ARG is omitted or nil.
+Some docstring"
+                        :global nil
+                        :group 'erc-mname
+                        (if erc-mname-mode
+                            (erc-mname-enable)
+                          (erc-mname-disable)))
+
+                      (defun erc-mname-enable (&optional ,arg-en)
+                        "Enable ERC mname mode.
+When called interactively, do so in all buffers for the current connection."
+                        (interactive "p")
+                        (when (derived-mode-p 'erc-mode)
+                          (if ,arg-en
+                              (erc-with-all-buffers-of-server
+                                  erc-server-process nil
+                                (erc-mname-enable))
+                            (setq erc-mname-mode t)
+                            (ignore a) (ignore b))))
+
+                      (defun erc-mname-disable (&optional ,arg-dis)
+                        "Disable ERC mname mode.
+When called interactively, do so in all buffers for the current connection."
+                        (interactive "p")
+                        (when (derived-mode-p 'erc-mode)
+                          (if ,arg-dis
+                              (erc-with-all-buffers-of-server
+                                  erc-server-process nil
+                                (erc-mname-disable))
+                            (setq erc-mname-mode nil)
+                            (ignore c) (ignore d))))
+
+                      (defalias 'erc-malias-mode #'erc-mname-mode)
+
+                      (put 'erc-mname-mode 'definition-name 'mname)
+                      (put 'erc-mname-enable 'definition-name 'mname)
+                      (put 'erc-mname-disable 'definition-name 'mname))))))
+
 ;;; erc-tests.el ends here
diff --git a/test/lisp/erc/resources/base/assoc/queries/netnick.eld 
b/test/lisp/erc/resources/base/assoc/queries/netnick.eld
new file mode 100644
index 0000000000..98dda12690
--- /dev/null
+++ b/test/lisp/erc/resources/base/assoc/queries/netnick.eld
@@ -0,0 +1,42 @@
+;; -*- mode: lisp-data; -*-
+((nick 10 "NICK tester"))
+((user 1 "USER tester 0 * :tester")
+ (0.00 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")
+ (0.00 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running 
version ergo-v2.8.0")
+ (0.00 ":irc.foonet.org 003 tester :This server was created Mon, 12 Dec 2022 
01:25:38 UTC")
+ (0.00 ":irc.foonet.org 004 tester irc.foonet.org ergo-v2.8.0 BERTZios 
CEIMRUabefhiklmnoqstuv Iabefhkloqv")
+ (0.00 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii 
CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# 
ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this 
server")
+ (0.00 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES 
MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ 
TARGMAX=NAMES:1,LIST:1,KICK:,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100
 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server")
+ (0.01 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by 
this server")
+ (0.00 ":irc.foonet.org 251 tester :There are 0 users and 4 invisible on 1 
server(s)")
+ (0.00 ":irc.foonet.org 252 tester 0 :IRC Operators online")
+ (0.00 ":irc.foonet.org 253 tester 0 :unregistered connections")
+ (0.00 ":irc.foonet.org 254 tester 1 :channels formed")
+ (0.00 ":irc.foonet.org 255 tester :I have 4 clients and 0 servers")
+ (0.00 ":irc.foonet.org 265 tester 4 4 :Current local users 4, max 4")
+ (0.01 ":irc.foonet.org 266 tester 4 4 :Current global users 4, max 4")
+ (0.00 ":irc.foonet.org 422 tester :MOTD File is missing"))
+
+((mode 10 "MODE tester +i")
+ (0.00 ":irc.foonet.org 221 tester +i")
+ (0.00 ":irc.foonet.org NOTICE tester :This server is in debug mode and is 
logging all user I/O. If you do not wish for everything you send to be readable 
by the server owner(s), please disconnect."))
+
+((join 10 "JOIN #chan")
+ (0.03 ":tester!~u@z5d6jyn8pwxge.irc JOIN #chan"))
+
+((mode-1 10 "MODE #chan")
+ (0.01 ":irc.foonet.org 353 tester = #chan :@alice bob foonet tester")
+ (0.00 ":irc.foonet.org 366 tester #chan :End of NAMES list")
+ (0.03 ":irc.foonet.org 324 tester #chan +nt")
+ (0.00 ":irc.foonet.org 329 tester #chan 1670808354")
+ (0.00 ":bob!~u@d6ftaiqzk8x2k.irc PRIVMSG #chan :tester, welcome!")
+ (0.00 ":alice!~u@d6ftaiqzk8x2k.irc PRIVMSG #chan :tester, welcome!")
+
+ (0.00 ":foonet!~u@z5d6jyn8pwxge.irc PRIVMSG tester :hi")
+
+ (0.03 ":bob!~u@d6ftaiqzk8x2k.irc PRIVMSG #chan :alice: Forbear it therefore; 
give your cause to heaven.")
+ (0.01 ":alice!~u@d6ftaiqzk8x2k.irc PRIVMSG #chan :bob: Even at thy teat thou 
hadst thy tyranny.")
+ (0.00 ":foonet!~u@z5d6jyn8pwxge.irc QUIT :connection closed"))
+
+((quit 10 "QUIT :\2ERC\2")
+ (0.03 ":tester!~u@z5d6jyn8pwxge.irc QUIT :Quit: \2ERC\2"))
diff --git a/test/lisp/erc/resources/base/assoc/queries/non-erc.eld 
b/test/lisp/erc/resources/base/assoc/queries/non-erc.eld
new file mode 100644
index 0000000000..aecd4922c3
--- /dev/null
+++ b/test/lisp/erc/resources/base/assoc/queries/non-erc.eld
@@ -0,0 +1,33 @@
+;; -*- mode: lisp-data; -*-
+((nick 10 "NICK tester"))
+((user 1 "USER tester 0 * :tester")
+ (0.00 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")
+ (0.00 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running 
version ergo-v2.8.0")
+ (0.00 ":irc.foonet.org 003 tester :This server was created Mon, 12 Dec 2022 
01:25:38 UTC")
+ (0.00 ":irc.foonet.org 004 tester irc.foonet.org ergo-v2.8.0 BERTZios 
CEIMRUabefhiklmnoqstuv Iabefhkloqv")
+ (0.00 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii 
CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# 
ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this 
server")
+ (0.00 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES 
MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ 
TARGMAX=NAMES:1,LIST:1,KICK:,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100
 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server")
+ (0.01 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by 
this server")
+ (0.00 ":irc.foonet.org 251 tester :There are 0 users and 4 invisible on 1 
server(s)")
+ (0.00 ":irc.foonet.org 252 tester 0 :IRC Operators online")
+ (0.00 ":irc.foonet.org 253 tester 0 :unregistered connections")
+ (0.00 ":irc.foonet.org 254 tester 1 :channels formed")
+ (0.00 ":irc.foonet.org 255 tester :I have 4 clients and 0 servers")
+ (0.00 ":irc.foonet.org 265 tester 4 4 :Current local users 4, max 4")
+ (0.01 ":irc.foonet.org 266 tester 4 4 :Current global users 4, max 4")
+ (0.00 ":irc.foonet.org 422 tester :MOTD File is missing"))
+
+((mode 10 "MODE tester +i")
+ (0.00 ":irc.foonet.org 221 tester +i")
+ (0.00 ":irc.foonet.org NOTICE tester :This server is in debug mode and is 
logging all user I/O. If you do not wish for everything you send to be readable 
by the server owner(s), please disconnect.")
+ (0.00 ":dummy!~u@z5d6jyn8pwxge.irc PRIVMSG tester :hi"))
+
+((~privmsg-open 10 "PRIVMSG nitwit :hola")
+ (0.00 ":nitwit!~u@m5q6wla8cjktr.irc PRIVMSG tester :ciao"))
+
+((privmsg 10 "PRIVMSG dummy :howdy")
+ (0.00 ":dummy!~u@z5d6jyn8pwxge.irc PRIVMSG tester :bye")
+ (0.01 ":dummy!~u@z5d6jyn8pwxge.irc QUIT :connection closed"))
+
+((quit 10 "QUIT :\2ERC\2")
+ (0.03 ":tester!~u@z5d6jyn8pwxge.irc QUIT :Quit: \2ERC\2"))
diff --git a/test/lisp/erc/resources/base/local-modules/first.eld 
b/test/lisp/erc/resources/base/local-modules/first.eld
new file mode 100644
index 0000000000..f9181a80fb
--- /dev/null
+++ b/test/lisp/erc/resources/base/local-modules/first.eld
@@ -0,0 +1,53 @@
+;; -*- mode: lisp-data; -*-
+((cap 10 "CAP REQ :sasl"))
+((nick 1 "NICK tester"))
+((user 1 "USER tester 0 * :tester"))
+
+((authenticate 5 "AUTHENTICATE PLAIN")
+ (0.0 ":irc.foonet.org CAP * ACK sasl")
+ (0.0 "AUTHENTICATE +"))
+
+((authenticate 5 "AUTHENTICATE AHRlc3RlcgBjaGFuZ2VtZQ==")
+ (0.0 ":irc.foonet.org 900 * * tester :You are now logged in as tester")
+ (0.01 ":irc.foonet.org 903 * :Authentication successful"))
+
+((cap 3.2 "CAP END")
+ (0.0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")
+ (0.0 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running 
version ergo-v2.8.0")
+ (0.2 ":irc.foonet.org 003 tester :This server was created Sun, 20 Nov 2022 
23:10:36 UTC")
+ (0.0 ":irc.foonet.org 004 tester irc.foonet.org ergo-v2.8.0 BERTZios 
CEIMRUabefhiklmnoqstuv Iabefhkloqv")
+ (0.0 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii 
CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# 
ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this 
server")
+ (0.0 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES 
MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ 
TARGMAX=NAMES:1,LIST:1,KICK:,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100
 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server")
+ (0.0 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by this 
server")
+ (0.0 ":irc.foonet.org 251 tester :There are 0 users and 3 invisible on 1 
server(s)")
+ (0.0 ":irc.foonet.org 252 tester 0 :IRC Operators online")
+ (0.0 ":irc.foonet.org 253 tester 0 :unregistered connections")
+ (0.0 ":irc.foonet.org 254 tester 1 :channels formed")
+ (0.0 ":irc.foonet.org 255 tester :I have 3 clients and 0 servers")
+ (0.0 ":irc.foonet.org 265 tester 3 3 :Current local users 3, max 3")
+ (0.0 ":irc.foonet.org 266 tester 3 3 :Current global users 3, max 3")
+ (0.0 ":irc.foonet.org 422 tester :MOTD File is missing")
+ (0.0 ":irc.foonet.org 221 tester +i")
+ (0.0 ":irc.foonet.org NOTICE tester :This server is in debug mode and is 
logging all user I/O. If you do not wish for everything you send to be readable 
by the server owner(s), please disconnect."))
+
+((mode 10 "MODE tester +i")
+ (0.02 ":irc.foonet.org 221 tester +i"))
+
+((join 10 "JOIN #chan")
+ (0.00 ":tester!~u@u9iqi96sfwk9s.irc JOIN #chan")
+ (0.06 ":irc.foonet.org 353 tester = #chan :@bob alice tester")
+ (0.01 ":irc.foonet.org 366 tester #chan :End of NAMES list")
+ (0.02 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :tester, welcome!")
+ (0.01 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :tester, welcome!")
+ (0.04 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :bob: Either your 
unparagoned mistress is dead, or she's outprized by a trifle."))
+
+((mode 12 "MODE #chan")
+ (0.00 ":irc.foonet.org 324 tester #chan +nt")
+ (0.02 ":irc.foonet.org 329 tester #chan 1668985854")
+ (0.98 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :alice: Come, you are a 
tedious fool: to the purpose. What was done to Elbow's wife, that he hath cause 
to complain of ? Come me to what was done to her.")
+ (0.01 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :bob: She is Lavinia, 
therefore must be lov'd."))
+
+((quit 10 "QUIT :\2ERC\2")
+ (0.02 ":tester!~u@u9iqi96sfwk9s.irc QUIT :Quit"))
+
+((drop 0 DROP))
diff --git a/test/lisp/erc/resources/base/local-modules/fourth.eld 
b/test/lisp/erc/resources/base/local-modules/fourth.eld
new file mode 100644
index 0000000000..4ac5dcbd38
--- /dev/null
+++ b/test/lisp/erc/resources/base/local-modules/fourth.eld
@@ -0,0 +1,53 @@
+;; -*- mode: lisp-data; -*-
+((cap 10 "CAP REQ :sasl"))
+((nick 10 "NICK tester`"))
+((user 10 "USER tester` 0 * :tester"))
+
+((authenticate 10 "AUTHENTICATE PLAIN")
+ (0.0 ":irc.foonet.org CAP * ACK sasl")
+ (0.0 "AUTHENTICATE +"))
+
+((authenticate 10 "AUTHENTICATE AHRlc3RlcgBjaGFuZ2VtZQ==")
+ (0.00 ":irc.foonet.org 900 * * tester :You are now logged in as tester")
+ (0.01 ":irc.foonet.org 903 * :Authentication successful"))
+
+((cap 10 "CAP END")
+ (0.00 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")
+ (0.01 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running 
version ergo-v2.8.0")
+ (0.01 ":irc.foonet.org 003 tester :This server was created Sun, 20 Nov 2022 
23:10:36 UTC")
+ (0.01 ":irc.foonet.org 004 tester irc.foonet.org ergo-v2.8.0 BERTZios 
CEIMRUabefhiklmnoqstuv Iabefhkloqv")
+ (0.13 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii 
CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# 
ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this 
server")
+ (0.01 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES 
MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ 
TARGMAX=NAMES:1,LIST:1,KICK:,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100
 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server")
+ (0.03 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by 
this server")
+ (0.00 ":irc.foonet.org 251 tester :There are 0 users and 3 invisible on 1 
server(s)")
+ (0.00 ":irc.foonet.org 252 tester 0 :IRC Operators online")
+ (0.00 ":irc.foonet.org 253 tester 0 :unregistered connections")
+ (0.00 ":irc.foonet.org 254 tester 1 :channels formed")
+ (0.00 ":irc.foonet.org 255 tester :I have 3 clients and 0 servers")
+ (0.00 ":irc.foonet.org 265 tester 3 3 :Current local users 3, max 3")
+ (0.00 ":irc.foonet.org 266 tester 3 3 :Current global users 3, max 3")
+ (0.03 ":irc.foonet.org 422 tester :MOTD File is missing")
+ (0.02 ":irc.foonet.org 221 tester +i")
+ (0.00 ":irc.foonet.org NOTICE tester :This server is in debug mode and is 
logging all user I/O. If you do not wish for everything you send to be readable 
by the server owner(s), please disconnect."))
+
+((mode 10 "MODE tester +i")
+ (0.0 ":irc.foonet.org 221 tester +i"))
+
+((join 10 "JOIN #chan")
+ (0.00 ":tester!~u@u9iqi96sfwk9s.irc JOIN #chan")
+ (0.09 ":irc.foonet.org 353 tester = #chan :alice tester @bob")
+ (0.01 ":irc.foonet.org 366 tester #chan :End of NAMES list")
+ (0.00 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :tester, welcome!")
+ (0.00 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :tester, welcome!")
+ (0.03 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :bob: And both shall cease, 
without your remedy.")
+ (0.02 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :alice: Nay, tarry; I'll go 
along with thee: I can tell thee pretty tales of the duke."))
+
+((mode 10 "MODE #chan")
+ (0.00 ":irc.foonet.org 324 tester #chan +nt")
+ (0.01 ":irc.foonet.org 329 tester #chan 1668985854")
+ (0.03 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :bob: Do: I'll take the 
sacrament on't, how and which way you will.")
+ (0.00 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :alice: Worthy Macbeth, we 
stay upon your leisure.")
+ (0.00 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :bob: Well met; good morrow, 
Titus and Hortensius."))
+
+((quit 10 "QUIT :\2ERC\2")
+ (0.03 ":tester!~u@u9iqi96sfwk9s.irc QUIT :Quit"))
diff --git a/test/lisp/erc/resources/base/local-modules/second.eld 
b/test/lisp/erc/resources/base/local-modules/second.eld
new file mode 100644
index 0000000000..a96103b2aa
--- /dev/null
+++ b/test/lisp/erc/resources/base/local-modules/second.eld
@@ -0,0 +1,47 @@
+;; -*- mode: lisp-data; -*-
+((pass 10 "PASS :changeme"))
+((nick 1 "NICK tester"))
+((user 1 "USER tester 0 * :tester")
+ (0.0 ":irc.foonet.org 433 * tester :Nickname is reserved by a different 
account"))
+
+((nick 10 "NICK tester`")
+ (0.01 ":irc.foonet.org FAIL NICK NICKNAME_RESERVED tester :Nickname is 
reserved by a different account")
+ (0.06 ":irc.foonet.org 001 tester` :Welcome to the foonet IRC Network 
tester`")
+ (0.01 ":irc.foonet.org 002 tester` :Your host is irc.foonet.org, running 
version ergo-v2.8.0")
+ (0.01 ":irc.foonet.org 003 tester` :This server was created Sun, 20 Nov 2022 
23:10:36 UTC")
+ (0.01 ":irc.foonet.org 004 tester` irc.foonet.org ergo-v2.8.0 BERTZios 
CEIMRUabefhiklmnoqstuv Iabefhkloqv")
+ (0.01 ":irc.foonet.org 005 tester` AWAYLEN=390 BOT=B CASEMAPPING=ascii 
CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# 
ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this 
server")
+ (0.01 ":irc.foonet.org 005 tester` MAXLIST=beI:60 MAXTARGETS=4 MODES 
MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ 
TARGMAX=NAMES:1,LIST:1,KICK:,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100
 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server")
+ (0.01 ":irc.foonet.org 005 tester` draft/CHATHISTORY=100 :are supported by 
this server")
+ (0.00 ":irc.foonet.org 251 tester` :There are 0 users and 3 invisible on 1 
server(s)")
+ (0.00 ":irc.foonet.org 252 tester` 0 :IRC Operators online")
+ (0.02 ":irc.foonet.org 253 tester` 0 :unregistered connections")
+ (0.00 ":irc.foonet.org 254 tester` 1 :channels formed")
+ (0.00 ":irc.foonet.org 255 tester` :I have 3 clients and 0 servers")
+ (0.00 ":irc.foonet.org 265 tester` 3 3 :Current local users 3, max 3")
+ (0.00 ":irc.foonet.org 266 tester` 3 3 :Current global users 3, max 3")
+ (0.00 ":irc.foonet.org 422 tester` :MOTD File is missing")
+ (0.02 ":irc.foonet.org 221 tester` +i")
+ (0.00 ":irc.foonet.org NOTICE tester` :This server is in debug mode and is 
logging all user I/O. If you do not wish for everything you send to be readable 
by the server owner(s), please disconnect."))
+
+((mode 12 "MODE tester` +i")
+ (0.0 ":irc.foonet.org 221 tester` +i"))
+
+((join 10 "JOIN #chan")
+ (0.00 ":tester`!~u@u9iqi96sfwk9s.irc JOIN #chan")
+ (0.08 ":irc.foonet.org 353 tester` = #chan :@bob alice tester`")
+ (0.01 ":irc.foonet.org 366 tester` #chan :End of NAMES list")
+ (0.00 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :tester`, welcome!")
+ (0.01 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :tester`, welcome!")
+ (0.05 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :alice: And Jove, for your 
love, would infringe an oath."))
+
+((mode 10 "MODE #chan")
+ (0.00 ":irc.foonet.org 324 tester` #chan +nt")
+ (0.02 ":irc.foonet.org 329 tester` #chan 1668985854")
+ (0.07 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :bob: To you that know them 
not. This to my mother.")
+ (0.00 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :alice: Some enigma, some 
riddle: come, thy l'envoy; begin."))
+
+((quit 1 "QUIT :\2ERC\2")
+ (0.03 ":tester`!~u@u9iqi96sfwk9s.irc QUIT"))
+
+((drop 0 DROP))
diff --git a/test/lisp/erc/resources/base/local-modules/third.eld 
b/test/lisp/erc/resources/base/local-modules/third.eld
new file mode 100644
index 0000000000..19bdd6efcc
--- /dev/null
+++ b/test/lisp/erc/resources/base/local-modules/third.eld
@@ -0,0 +1,43 @@
+;; -*- mode: lisp-data; -*-
+((pass 10 "PASS :changeme"))
+((nick 1 "NICK tester`"))
+((user 1 "USER tester 0 * :tester")
+ (0.06 ":irc.foonet.org 001 tester` :Welcome to the foonet IRC Network 
tester`")
+ (0.01 ":irc.foonet.org 002 tester` :Your host is irc.foonet.org, running 
version ergo-v2.8.0")
+ (0.01 ":irc.foonet.org 003 tester` :This server was created Sun, 20 Nov 2022 
23:10:36 UTC")
+ (0.01 ":irc.foonet.org 004 tester` irc.foonet.org ergo-v2.8.0 BERTZios 
CEIMRUabefhiklmnoqstuv Iabefhkloqv")
+ (0.01 ":irc.foonet.org 005 tester` AWAYLEN=390 BOT=B CASEMAPPING=ascii 
CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# 
ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this 
server")
+ (0.01 ":irc.foonet.org 005 tester` MAXLIST=beI:60 MAXTARGETS=4 MODES 
MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ 
TARGMAX=NAMES:1,LIST:1,KICK:,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100
 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server")
+ (0.01 ":irc.foonet.org 005 tester` draft/CHATHISTORY=100 :are supported by 
this server")
+ (0.00 ":irc.foonet.org 251 tester` :There are 0 users and 3 invisible on 1 
server(s)")
+ (0.00 ":irc.foonet.org 252 tester` 0 :IRC Operators online")
+ (0.02 ":irc.foonet.org 253 tester` 0 :unregistered connections")
+ (0.00 ":irc.foonet.org 254 tester` 1 :channels formed")
+ (0.00 ":irc.foonet.org 255 tester` :I have 3 clients and 0 servers")
+ (0.00 ":irc.foonet.org 265 tester` 3 3 :Current local users 3, max 3")
+ (0.00 ":irc.foonet.org 266 tester` 3 3 :Current global users 3, max 3")
+ (0.00 ":irc.foonet.org 422 tester` :MOTD File is missing")
+ (0.02 ":irc.foonet.org 221 tester` +i")
+ (0.00 ":irc.foonet.org NOTICE tester` :This server is in debug mode and is 
logging all user I/O. If you do not wish for everything you send to be readable 
by the server owner(s), please disconnect."))
+
+((mode 12 "MODE tester` +i")
+ (0.0 ":irc.foonet.org 221 tester` +i"))
+
+((join 10 "JOIN #chan")
+ (0.00 ":tester`!~u@u9iqi96sfwk9s.irc JOIN #chan")
+ (0.08 ":irc.foonet.org 353 tester` = #chan :@bob alice tester`")
+ (0.01 ":irc.foonet.org 366 tester` #chan :End of NAMES list")
+ (0.00 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :tester`, welcome!")
+ (0.01 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :tester`, welcome!")
+ (0.05 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :alice: With pomp, with 
triumph, and with revelling."))
+
+((mode 10 "MODE #chan")
+ (0.00 ":irc.foonet.org 324 tester` #chan +nt")
+ (0.02 ":irc.foonet.org 329 tester` #chan 1668985854")
+ (0.00 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :bob: No remedy, my lord, 
when walls are so wilful to hear without warning.")
+ (0.01 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :alice: Let our reciprocal 
vows be remembered. You have many opportunities to cut him off; if your will 
want not, time and place will be fruitfully offered. There is nothing done if 
he return the conqueror; then am I the prisoner, and his bed my gaol; from the 
loathed warmth whereof deliver me, and supply the place for your labor."))
+
+((quit 1 "QUIT :\2ERC\2")
+ (0.03 ":tester`!~u@u9iqi96sfwk9s.irc QUIT :Quit"))
+
+((drop 0 DROP))
diff --git a/test/lisp/erc/resources/erc-d/erc-d-i.el 
b/test/lisp/erc/resources/erc-d/erc-d-i.el
index db113335a8..15a0b16bfd 100644
--- a/test/lisp/erc/resources/erc-d/erc-d-i.el
+++ b/test/lisp/erc/resources/erc-d/erc-d-i.el
@@ -1,22 +1,21 @@
 ;;; erc-d-i.el --- IRC helpers for ERC test server -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 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/test/lisp/erc/resources/erc-d/erc-d-t.el 
b/test/lisp/erc/resources/erc-d/erc-d-t.el
index a1a7e7e88d..6d68608a4f 100644
--- a/test/lisp/erc/resources/erc-d/erc-d-t.el
+++ b/test/lisp/erc/resources/erc-d/erc-d-t.el
@@ -1,26 +1,24 @@
 ;;; erc-d-t.el --- ERT helpers for ERC test server -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
 
-;;; Commentary:
+;; 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:
+
 (eval-and-compile
   (let* ((d (file-name-directory (or (macroexp-file-name) buffer-file-name)))
          (load-path (cons (directory-file-name d) load-path)))
diff --git a/test/lisp/erc/resources/erc-d/erc-d-tests.el 
b/test/lisp/erc/resources/erc-d/erc-d-tests.el
index 8dd5cef7aa..feddc4c062 100644
--- a/test/lisp/erc/resources/erc-d/erc-d-tests.el
+++ b/test/lisp/erc/resources/erc-d/erc-d-tests.el
@@ -1,26 +1,24 @@
 ;;; erc-d-tests.el --- tests for erc-d -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
 
-;;; Commentary:
+;; 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-x)
 (eval-and-compile
   (let ((load-path (cons (expand-file-name ".." (ert-resource-directory))
diff --git a/test/lisp/erc/resources/erc-d/erc-d-u.el 
b/test/lisp/erc/resources/erc-d/erc-d-u.el
index ce13efef62..60181cdc8b 100644
--- a/test/lisp/erc/resources/erc-d/erc-d-u.el
+++ b/test/lisp/erc/resources/erc-d/erc-d-u.el
@@ -1,22 +1,21 @@
 ;;; erc-d-u.el --- Helpers for ERC test server -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 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/test/lisp/erc/resources/erc-d/erc-d.el 
b/test/lisp/erc/resources/erc-d/erc-d.el
index d6082227c5..f8704834b9 100644
--- a/test/lisp/erc/resources/erc-d/erc-d.el
+++ b/test/lisp/erc/resources/erc-d/erc-d.el
@@ -1,22 +1,21 @@
 ;;; erc-d.el --- A dumb test server for ERC -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 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/test/lisp/erc/resources/erc-d/resources/proxy-subprocess.el 
b/test/lisp/erc/resources/erc-d/resources/proxy-subprocess.el
index bb8869dff6..f675f67501 100644
--- a/test/lisp/erc/resources/erc-d/resources/proxy-subprocess.el
+++ b/test/lisp/erc/resources/erc-d/resources/proxy-subprocess.el
@@ -1,24 +1,22 @@
 ;;; proxy-subprocess.el --- Example setup file for erc-d  -*- lexical-binding: 
t; -*-
 
 ;; Copyright (C) 2020-2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
-;;; Commentary:
 ;;; Code:
 
 (defvar erc-d-tmpl-vars)
diff --git a/test/lisp/erc/resources/erc-scenarios-common.el 
b/test/lisp/erc/resources/erc-scenarios-common.el
index 601c9e95c8..57d4658e75 100644
--- a/test/lisp/erc/resources/erc-scenarios-common.el
+++ b/test/lisp/erc/resources/erc-scenarios-common.el
@@ -1,22 +1,21 @@
 ;;; erc-scenarios-common.el --- Common helpers for ERC scenarios -*- 
lexical-binding: t -*-
 
 ;; Copyright (C) 2022 Free Software Foundation, Inc.
-;;
+
 ;; This file is part of GNU Emacs.
-;;
-;; This program is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-;;
+
+;; 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 this program.  If not, see
-;; <https://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -186,7 +185,7 @@ Dialog resource directories are located by expanding the 
variable
 (defun erc-scenarios-common-assert-initial-buf-name (id port)
   ;; Assert no limbo period when explicit ID given
   (should (string= (if id
-                       (symbol-name id)
+                       (format "%s" id)
                      (format "127.0.0.1:%d" port))
                    (buffer-name))))
 
diff --git a/test/lisp/erc/resources/networks/announced-missing/foonet.eld 
b/test/lisp/erc/resources/networks/announced-missing/foonet.eld
index 79b0fb462a..4481f27663 100644
--- a/test/lisp/erc/resources/networks/announced-missing/foonet.eld
+++ b/test/lisp/erc/resources/networks/announced-missing/foonet.eld
@@ -3,6 +3,3 @@
 ((user 1 "USER user 0 * :tester")
  (0 ":irc.foonet.org 001 tester :Welcome to the FooNet Internet Relay Chat 
Network tester")
  (0 ":irc.foonet.org 422 tester :MOTD File is missing"))
-
-((mode-user 1.2 "MODE tester +i")
- (0 ":tester MODE tester :+Zi"))
diff --git a/test/lisp/erc/resources/sasl/external.eld 
b/test/lisp/erc/resources/sasl/external.eld
new file mode 100644
index 0000000000..2cd237ec4d
--- /dev/null
+++ b/test/lisp/erc/resources/sasl/external.eld
@@ -0,0 +1,33 @@
+;; -*- mode: lisp-data; -*-
+((cap-req 10 "CAP REQ :sasl"))
+((nick 1 "NICK tester"))
+((user 1 "USER tester 0 * :tester"))
+
+((auth-req 3.2 "AUTHENTICATE EXTERNAL")
+ (0.0 ":irc.example.org CAP * ACK :sasl")
+ (0.0 "AUTHENTICATE +"))
+
+((auth-noop 3.2 "AUTHENTICATE +")
+ (0.0 ":irc.example.org 900 * * tester :You are now logged in as tester")
+ (0.0 ":irc.example.org 903 * :Authentication successful"))
+
+((cap-end 3.2 "CAP END")
+ (0.0 ":irc.example.org 001 tester :Welcome to the ExampleOrg IRC Network 
tester")
+ (0.01 ":irc.example.org 002 tester :Your host is irc.example.org, running 
version oragono-2.6.1")
+ (0.01 ":irc.example.org 003 tester :This server was created Sat, 17 Jul 2021 
09:06:42 UTC")
+ (0.01 ":irc.example.org 004 tester irc.example.org oragono-2.6.1 BERTZios 
CEIMRUabefhiklmnoqstuv Iabefhkloqv")
+ (0.0 ":irc.example.org 005 tester AWAYLEN=200 BOT=B CASEMAPPING=ascii 
CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# 
ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this 
server")
+ (0.01 ":irc.example.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES 
MONITOR=100 NETWORK=ExampleOrg NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ 
TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100
 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY :are supported by this server")
+ (0.01 ":irc.example.org 005 tester draft/CHATHISTORY=100 :are supported by 
this server")
+ (0.0 ":irc.example.org 251 tester :There are 1 users and 0 invisible on 1 
server(s)")
+ (0.0 ":irc.example.org 252 tester 0 :IRC Operators online")
+ (0.0 ":irc.example.org 253 tester 0 :unregistered connections")
+ (0.0 ":irc.example.org 254 tester 0 :channels formed")
+ (0.0 ":irc.example.org 255 tester :I have 1 clients and 0 servers")
+ (0.0 ":irc.example.org 265 tester 1 1 :Current local users 1, max 1")
+ (0.21 ":irc.example.org 266 tester 1 1 :Current global users 1, max 1")
+ (0.0 ":irc.example.org 422 tester :MOTD File is missing"))
+
+((mode-user 1.2 "MODE tester +i")
+ (0.0 ":irc.example.org 221 tester +Zi")
+ (0.0 ":irc.example.org NOTICE tester :This server is in debug mode and is 
logging all user I/O. If you do not wish for everything you send to be readable 
by the server owner(s), please disconnect."))
diff --git a/test/lisp/erc/resources/sasl/plain-failed.eld 
b/test/lisp/erc/resources/sasl/plain-failed.eld
new file mode 100644
index 0000000000..336700290c
--- /dev/null
+++ b/test/lisp/erc/resources/sasl/plain-failed.eld
@@ -0,0 +1,16 @@
+;; -*- mode: lisp-data; -*-
+((cap-req 10 "CAP REQ :sasl"))
+((nick 1 "NICK tester"))
+((user 1 "USER tester 0 * :tester")
+ (0.0 ":irc.foonet.org NOTICE * :*** Looking up your hostname...")
+ (0.0 ":irc.foonet.org NOTICE * :*** Found your hostname")
+ (0.0 ":irc.foonet.org CAP * ACK :cap-notify sasl"))
+
+((authenticate-plain 3.2 "AUTHENTICATE PLAIN")
+ (0.0 ":irc.foonet.org AUTHENTICATE +"))
+
+((authenticate-gimme 3.2 "AUTHENTICATE AHRlc3RlcgB3cm9uZw==")
+ (0.0 ":irc.foonet.org 900 * * tester :You are now logged in as tester")
+ (0.0 ":irc.foonet.org 904 * :SASL authentication failed: Invalid account 
credentials"))
+
+((cap-end 3.2 "CAP END"))
diff --git a/test/lisp/erc/resources/sasl/plain.eld 
b/test/lisp/erc/resources/sasl/plain.eld
new file mode 100644
index 0000000000..1341cd78e5
--- /dev/null
+++ b/test/lisp/erc/resources/sasl/plain.eld
@@ -0,0 +1,39 @@
+;; -*- mode: lisp-data; -*-
+((cap-req 10 "CAP REQ :sasl"))
+((nick 1 "NICK tester"))
+((user 1 "USER tester 0 * :tester")
+ (0.0 ":irc.example.org NOTICE * :*** Looking up your hostname...")
+ (0.0 ":irc.example.org NOTICE * :*** Found your hostname")
+ (0.0 ":irc.example.org CAP * ACK :sasl"))
+
+((authenticate-plain 3.2 "AUTHENTICATE PLAIN")
+ (0.0 ":irc.example.org AUTHENTICATE +"))
+
+((authenticate-gimme 3.2 "AUTHENTICATE AHRlc3RlcgBwYXNzd29yZDEyMw==")
+ (0.0 ":irc.example.org 900 * * tester :You are now logged in as tester")
+ (0.0 ":irc.example.org 903 * :Authentication successful"))
+
+((cap-end 3.2 "CAP END")
+ (0.0 ":irc.example.org 001 tester :Welcome to the ExampleOrg IRC Network 
tester")
+ (0.01 ":irc.example.org 002 tester :Your host is irc.example.org, running 
version oragono-2.6.1")
+ (0.01 ":irc.example.org 003 tester :This server was created Sat, 17 Jul 2021 
09:06:42 UTC")
+ (0.01 ":irc.example.org 004 tester irc.example.org oragono-2.6.1 BERTZios 
CEIMRUabefhiklmnoqstuv Iabefhkloqv")
+ (0.0 ":irc.example.org 005 tester AWAYLEN=200 BOT=B CASEMAPPING=ascii 
CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# 
ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this 
server")
+ (0.01 ":irc.example.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES 
MONITOR=100 NETWORK=ExampleOrg NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ 
TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100
 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY :are supported by this server")
+ (0.01 ":irc.example.org 005 tester draft/CHATHISTORY=100 :are supported by 
this server")
+ (0.0 ":irc.example.org 251 tester :There are 1 users and 0 invisible on 1 
server(s)")
+ (0.0 ":irc.example.org 252 tester 0 :IRC Operators online")
+ (0.0 ":irc.example.org 253 tester 0 :unregistered connections")
+ (0.0 ":irc.example.org 254 tester 0 :channels formed")
+ (0.0 ":irc.example.org 255 tester :I have 1 clients and 0 servers")
+ (0.0 ":irc.example.org 265 tester 1 1 :Current local users 1, max 1")
+ (0.21 ":irc.example.org 266 tester 1 1 :Current global users 1, max 1")
+ (0.0 ":irc.example.org 422 tester :MOTD File is missing"))
+
+((mode-user 1.2 "MODE tester +i")
+ (0.0 ":irc.example.org 221 tester +Zi")
+ (0.0 ":irc.example.org NOTICE tester :This server is in debug mode and is 
logging all user I/O. If you do not wish for everything you send to be readable 
by the server owner(s), please disconnect."))
+
+((quit 5 "QUIT :\2ERC\2")
+ (0 ":tester!~u@yuvqisyu7m7qs.irc QUIT :Quit"))
+((drop 1 DROP))
diff --git a/test/lisp/erc/resources/sasl/scram-sha-1.eld 
b/test/lisp/erc/resources/sasl/scram-sha-1.eld
new file mode 100644
index 0000000000..49980e9e12
--- /dev/null
+++ b/test/lisp/erc/resources/sasl/scram-sha-1.eld
@@ -0,0 +1,47 @@
+;;; -*- mode: lisp-data -*-
+((cap-req 5.2 "CAP REQ :sasl"))
+((nick 10 "NICK jilles"))
+((user 10 "USER user 0 * :jilles")
+ (0 "NOTICE AUTH :*** Processing connection to jaguar.test")
+ (0 "NOTICE AUTH :*** Looking up your hostname...")
+ (0 "NOTICE AUTH :*** Checking Ident")
+ (0 "NOTICE AUTH :*** No Ident response")
+ (0 "NOTICE AUTH :*** Found your hostname")
+ (0 ":jaguar.test CAP jilles ACK :sasl"))
+
+((auth-init 10 "AUTHENTICATE SCRAM-SHA-1")
+ (0 "AUTHENTICATE +"))
+
+((auth-challenge 10 "AUTHENTICATE 
bixhPWppbGxlcyxuPWppbGxlcyxyPWM1UnFMQ1p5MEw0ZkdrS0FaMGh1akZCcw==")
+ (0 "AUTHENTICATE 
cj1jNVJxTENaeTBMNGZHa0tBWjBodWpGQnNYUW9LY2l2cUN3OWlEWlBTcGIscz01bUpPNmQ0cmpDbnNCVTFYLGk9NDA5Ng=="))
+
+((auth-final 10 "AUTHENTICATE 
Yz1iaXhoUFdwcGJHeGxjeXc9LHI9YzVScUxDWnkwTDRmR2tLQVowaHVqRkJzWFFvS2NpdnFDdzlpRFpQU3BiLHA9T1ZVaGdQdTh3RW0yY0RvVkxmYUh6VlVZUFdVPQ==")
+ (0 "AUTHENTICATE dj1aV1IyM2M5TUppcjBaZ2ZHZjVqRXRMT242Tmc9"))
+
+((auth-done 10 "AUTHENTICATE +")
+ (0 ":jaguar.test 900 jilles jilles!jilles@localhost.stack.nl jilles :You are 
now logged in as jilles")
+ (0 ":jaguar.test 903 jilles :SASL authentication successful"))
+
+((cap-end 10.2 "CAP END")
+ (0 ":jaguar.test 001 jilles :Welcome to the jaguar IRC Network 
jilles!~jilles@127.0.0.1")
+ (0 ":jaguar.test 002 jilles :Your host is jaguar.test, running version 
InspIRCd-3")
+ (0 ":jaguar.test 003 jilles :This server was created 09:44:05 Dec 24 2020")
+ (0 ":jaguar.test 004 jilles jaguar.test InspIRCd-3 BILRSWcghiorswz 
ABEFHIJLMNOQRSTXYabcefghijklmnopqrstuvz :BEFHIJLXYabefghjkloqv")
+ (0 ":jaguar.test 005 jilles ACCEPT=30 AWAYLEN=200 BOT=B CALLERID=g 
CASEMAPPING=rfc1459 CHANLIMIT=#:120 
CHANMODES=IXbeg,k,BEFHJLfjl,AMNOQRSTcimnprstuz CHANNELLEN=64 CHANTYPES=# 
ELIST=CMNTU ESILENCE=CcdiNnPpTtx EXCEPTS=e :are supported by this server")
+ (0 ":jaguar.test 005 jilles EXTBAN=,ANOQRSTUacmnprz HOSTLEN=64 INVEX=I 
KEYLEN=32 KICKLEN=255 LINELEN=512 MAXLIST=I:100,X:100,b:100,e:100,g:100 
MAXTARGETS=20 MODES=20 MONITOR=30 NAMELEN=128 NAMESX NETWORK=jaguar :are 
supported by this server")
+ (0 ":jaguar.test 005 jilles NICKLEN=31 PREFIX=(Yqaohv)!~&@%+ REMOVE SAFELIST 
SECURELIST=60 SILENCE=32 STATUSMSG=!~&@%+ TOPICLEN=307 UHNAMES USERIP 
USERLEN=11 USERMODES=,,s,BILRSWcghiorwz WATCH=30 :are supported by this server")
+ (0 ":jaguar.test 005 jilles :are supported by this server")
+ (0 ":jaguar.test 251 jilles :There are 740 users and 108 invisible on 11 
servers")
+ (0 ":jaguar.test 252 jilles 10 :operator(s) online")
+ (0 ":jaguar.test 254 jilles 373 :channels formed")
+ (0 ":jaguar.test 255 jilles :I have 28 clients and 1 servers")
+ (0 ":jaguar.test 265 jilles :Current local users: 28  Max: 29")
+ (0 ":jaguar.test 266 jilles :Current global users: 848  Max: 879")
+ (0 ":jaguar.test 375 jilles :jaguar.test message of the day")
+ (0 ":jaguar.test 372 jilles :   ~~ some message of the day ~~")
+ (0 ":jaguar.test 372 jilles :   ~~ or rkpryyrag gb rnpu bgure ~~")
+ (0 ":jaguar.test 376 jilles :End of message of the day."))
+
+((mode-user 1.2 "MODE jilles +i")
+ (0 ":jilles!~jilles@127.0.0.1 MODE jilles :+ri")
+ (0 ":jaguar.test 306 jilles :You have been marked as being away"))
diff --git a/test/lisp/erc/resources/sasl/scram-sha-256.eld 
b/test/lisp/erc/resources/sasl/scram-sha-256.eld
new file mode 100644
index 0000000000..74de9a23ec
--- /dev/null
+++ b/test/lisp/erc/resources/sasl/scram-sha-256.eld
@@ -0,0 +1,47 @@
+;;; -*- mode: lisp-data -*-
+((cap-req 5.2 "CAP REQ :sasl"))
+((nick 10 "NICK jilles"))
+((user 10 "USER user 0 * :jilles")
+ (0 "NOTICE AUTH :*** Processing connection to jaguar.test")
+ (0 "NOTICE AUTH :*** Looking up your hostname...")
+ (0 "NOTICE AUTH :*** Checking Ident")
+ (0 "NOTICE AUTH :*** No Ident response")
+ (0 "NOTICE AUTH :*** Found your hostname")
+ (0 ":jaguar.test CAP jilles ACK :sasl"))
+
+((auth-init 10 "AUTHENTICATE SCRAM-SHA-256")
+ (0 "AUTHENTICATE +"))
+
+((auth-challenge 10 "AUTHENTICATE 
biwsbj1qaWxsZXMscj1jNVJxTENaeTBMNGZHa0tBWjBodWpGQnM=")
+ (0 "AUTHENTICATE 
cj1jNVJxTENaeTBMNGZHa0tBWjBodWpGQnNkNDA2N2YwYWZkYjU0YzNkYmQ0ZmU2NDViODRjYWUzNyxzPVpUZzFNbUUxWW1GaFpHSTFORGN5TWprM056WXdabVJqWkRNM1kySTFPVE09LGk9NDA5Ng=="))
+
+((auth-final 10 "AUTHENTICATE 
Yz1iaXdzLHI9YzVScUxDWnkwTDRmR2tLQVowaHVqRkJzZDQwNjdmMGFmZGI1NGMzZGJkNGZlNjQ1Yjg0Y2FlMzcscD1MUDRzakpyakpLcDVxVHNBUnlaQ3BwWHBLTHU0Rk1NMjg0aE5FU1B2R2hJPQ==")
+ (0 "AUTHENTICATE 
dj04NDdXWGZubVJlR3lFMXFscTFBbmQ2UjRiUEJOUk9UWjdFTVMvUXJKdFVNPQ=="))
+
+((auth-done 10 "AUTHENTICATE +")
+ (0 ":jaguar.test 900 jilles jilles!jilles@localhost.stack.nl jilles :You are 
now logged in as jilles")
+ (0 ":jaguar.test 903 jilles :SASL authentication successful"))
+
+((cap-end 10.2 "CAP END")
+ (0 ":jaguar.test 001 jilles :Welcome to the jaguar IRC Network 
jilles!~jilles@127.0.0.1")
+ (0 ":jaguar.test 002 jilles :Your host is jaguar.test, running version 
InspIRCd-3")
+ (0 ":jaguar.test 003 jilles :This server was created 09:44:05 Dec 24 2020")
+ (0 ":jaguar.test 004 jilles jaguar.test InspIRCd-3 BILRSWcghiorswz 
ABEFHIJLMNOQRSTXYabcefghijklmnopqrstuvz :BEFHIJLXYabefghjkloqv")
+ (0 ":jaguar.test 005 jilles ACCEPT=30 AWAYLEN=200 BOT=B CALLERID=g 
CASEMAPPING=rfc1459 CHANLIMIT=#:120 
CHANMODES=IXbeg,k,BEFHJLfjl,AMNOQRSTcimnprstuz CHANNELLEN=64 CHANTYPES=# 
ELIST=CMNTU ESILENCE=CcdiNnPpTtx EXCEPTS=e :are supported by this server")
+ (0 ":jaguar.test 005 jilles EXTBAN=,ANOQRSTUacmnprz HOSTLEN=64 INVEX=I 
KEYLEN=32 KICKLEN=255 LINELEN=512 MAXLIST=I:100,X:100,b:100,e:100,g:100 
MAXTARGETS=20 MODES=20 MONITOR=30 NAMELEN=128 NAMESX NETWORK=jaguar :are 
supported by this server")
+ (0 ":jaguar.test 005 jilles NICKLEN=31 PREFIX=(Yqaohv)!~&@%+ REMOVE SAFELIST 
SECURELIST=60 SILENCE=32 STATUSMSG=!~&@%+ TOPICLEN=307 UHNAMES USERIP 
USERLEN=11 USERMODES=,,s,BILRSWcghiorwz WATCH=30 :are supported by this server")
+ (0 ":jaguar.test 005 jilles :are supported by this server")
+ (0 ":jaguar.test 251 jilles :There are 740 users and 108 invisible on 11 
servers")
+ (0 ":jaguar.test 252 jilles 10 :operator(s) online")
+ (0 ":jaguar.test 254 jilles 373 :channels formed")
+ (0 ":jaguar.test 255 jilles :I have 28 clients and 1 servers")
+ (0 ":jaguar.test 265 jilles :Current local users: 28  Max: 29")
+ (0 ":jaguar.test 266 jilles :Current global users: 848  Max: 879")
+ (0 ":jaguar.test 375 jilles :jaguar.test message of the day")
+ (0 ":jaguar.test 372 jilles :   ~~ some message of the day ~~")
+ (0 ":jaguar.test 372 jilles :   ~~ or rkpryyrag gb rnpu bgure ~~")
+ (0 ":jaguar.test 376 jilles :End of message of the day."))
+
+((mode-user 1.2 "MODE jilles +i")
+ (0 ":jilles!~jilles@127.0.0.1 MODE jilles :+ri")
+ (0 ":jaguar.test 306 jilles :You have been marked as being away"))
diff --git a/test/lisp/erc/resources/services/auth-source/recon.eld 
b/test/lisp/erc/resources/services/auth-source/recon.eld
new file mode 100644
index 0000000000..2ab52c9bec
--- /dev/null
+++ b/test/lisp/erc/resources/services/auth-source/recon.eld
@@ -0,0 +1,48 @@
+;; -*- mode: lisp-data; -*-
+((nick 10 "NICK tester"))
+((user 5 "USER tester 0 * :tester")
+ (0.00 ":irc.foonet.net NOTICE * :*** Looking up your hostname...")
+ (0.04 ":irc.foonet.net NOTICE tester :*** Could not resolve your hostname: 
Domain not found; using your IP address (10.0.2.100) instead.")
+ (0.06 ":irc.foonet.net 001 tester :Welcome to the FooNet IRC Network 
tester!tester@10.0.2.100")
+ (0.01 ":irc.foonet.net 002 tester :Your host is irc.foonet.net, running 
version InspIRCd-3")
+ (0.01 ":irc.foonet.net 003 tester :This server was created 08:32:24 Dec 05 
2022")
+ (0.01 ":irc.foonet.net 004 tester irc.foonet.net InspIRCd-3 BIRcgikorsw 
ACHIKMORTXabcefghijklmnopqrstvz :HIXabefghjkloqv")
+ (0.01 ":irc.foonet.net 005 tester ACCEPT=30 AWAYLEN=200 BOT=B CALLERID=g 
CASEMAPPING=ascii CHANLIMIT=#:20 CHANMODES=IXbeg,k,Hfjl,ACKMORTcimnprstz 
CHANNELLEN=64 CHANTYPES=# ELIST=CMNTU ESILENCE=CcdiNnPpTtx EXCEPTS=e :are 
supported by this server")
+ (0.01 ":irc.foonet.net 005 tester EXTBAN=,ACORTUacjrwz HOSTLEN=64 INVEX=I 
KEYLEN=32 KICKLEN=255 LINELEN=512 MAXLIST=I:100,X:100,b:100,e:100,g:100 
MAXTARGETS=20 MODES=20 MONITOR=30 NAMELEN=128 NAMESX NETWORK=FooNet :are 
supported by this server")
+ (0.01 ":irc.foonet.net 005 tester NICKLEN=30 PREFIX=(qaohv)~&@%+ SAFELIST 
SILENCE=32 STATUSMSG=~&@%+ TOPICLEN=307 UHNAMES USERIP USERLEN=10 
USERMODES=,,s,BIRcgikorw WHOX :are supported by this server")
+ (0.01 ":irc.foonet.net 251 tester :There are 2 users and 0 invisible on 2 
servers")
+ (0.00 ":irc.foonet.net 253 tester 1 :unknown connections")
+ (0.00 ":irc.foonet.net 254 tester 1 :channels formed")
+ (0.00 ":irc.foonet.net 255 tester :I have 2 clients and 1 servers")
+ (0.00 ":irc.foonet.net 265 tester :Current local users: 2  Max: 3")
+ (0.00 ":irc.foonet.net 266 tester :Current global users: 2  Max: 3")
+ (0.00 ":irc.foonet.net 375 tester :irc.foonet.net message of the day")
+ (0.00 ":irc.foonet.net 372 tester :Have fun!")
+ (0.00 ":irc.foonet.net 376 tester :End of message of the day."))
+
+((mode-a 10 "MODE tester +i")
+ (0.00 ":irc.foonet.net 501 tester x :is not a recognized user mode.")
+ (0.04 ":tester!tester@10.0.2.100 MODE tester :+i")
+ (0.00 ":NickServ!NickServ@services.int NOTICE tester :This nickname is 
registered. Please choose a different nickname, or identify via \2/msg NickServ 
identify <password>\2."))
+
+((~privmsg 10 "PRIVMSG NickServ :IDENTIFY changeme")
+ (0.00 ":NickServ!NickServ@services.int NOTICE tester :You are now identified 
for \2tester\2.")
+ (0.01 ":irc.foonet.net 900 tester tester!tester@10.0.2.100 tester :You are 
now logged in as tester"))
+
+((~join 10 "JOIN #chan")
+ (0.00 ":tester!tester@10.0.2.100 JOIN :#chan")
+ (0.04 ":irc.foonet.net 353 tester = #chan :@alice bob tester")
+ (0.00 ":irc.foonet.net 366 tester #chan :End of /NAMES list."))
+
+((mode-b 10 "MODE #chan")
+ (0.03 ":irc.foonet.net 324 tester #chan :+nt")
+ (0.01 ":irc.foonet.net 329 tester #chan :1670229160")
+ (0.00 ":alice!alice@0::1 PRIVMSG #chan :tester, welcome!")
+ (0.00 ":bob!bob@0::1 PRIVMSG #chan :tester, welcome!")
+ (0.05 ":alice!alice@0::1 PRIVMSG #chan :bob: Thou art the cap of all the 
fools alive.")
+ (0.06 ":bob!bob@0::1 PRIVMSG #chan :alice: What, man! 'tis a night of revels; 
the gallants desire it."))
+
+((quit 10 "QUIT :\2ERC\2")
+ (0.1 ":tester!tester@10.0.2.100 QUIT :Client Quit"))
+
+((drop 1 DROP))
diff --git a/test/lisp/eshell/em-alias-tests.el 
b/test/lisp/eshell/em-alias-tests.el
index aca622220e..0a26e8d201 100644
--- a/test/lisp/eshell/em-alias-tests.el
+++ b/test/lisp/eshell/em-alias-tests.el
@@ -72,6 +72,15 @@
    (eshell-match-command-output "show-all-args a" "a\n")
    (eshell-match-command-output "show-all-args a b c" "a\nb\nc\n")))
 
+(ert-deftest em-alias-test/alias-all-args-var-splice ()
+  "Test alias with splicing the $* variable"
+  (with-temp-eshell
+   (eshell-insert-command "alias show-all-args 'echo args: $@*'")
+   (eshell-match-command-output "show-all-args" "args:\n")
+   (eshell-match-command-output "show-all-args a" "(\"args:\" \"a\")\n")
+   (eshell-match-command-output "show-all-args a b c"
+                                "(\"args:\" \"a\" \"b\" \"c\")\n")))
+
 (ert-deftest em-alias-test/alias-all-args-var-indices ()
   "Test alias with the $* variable using indices"
   (with-temp-eshell
diff --git a/test/lisp/eshell/esh-arg-tests.el 
b/test/lisp/eshell/esh-arg-tests.el
new file mode 100644
index 0000000000..77f9404d4c
--- /dev/null
+++ b/test/lisp/eshell/esh-arg-tests.el
@@ -0,0 +1,105 @@
+;;; esh-arg-tests.el --- esh-arg test suite  -*- 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/>.
+
+;;; Commentary:
+
+;; Tests for Eshell's argument handling.
+
+;;; Code:
+
+(require 'ert)
+(require 'esh-mode)
+(require 'eshell)
+
+(require 'eshell-tests-helpers
+         (expand-file-name "eshell-tests-helpers"
+                           (file-name-directory (or load-file-name
+                                                    default-directory))))
+
+(defvar eshell-test-value nil)
+
+;;; Tests:
+
+(ert-deftest esh-arg-test/escape/nonspecial ()
+  "Test that \"\\c\" and \"c\" are equivalent when \"c\" is not a
+special character."
+  (with-temp-eshell
+   (eshell-match-command-output "echo he\\llo"
+                                "hello\n")))
+
+(ert-deftest esh-arg-test/escape/nonspecial-unicode ()
+  "Test that \"\\c\" and \"c\" are equivalent when \"c\" is a
+unicode character (unicode characters are nonspecial by
+definition)."
+  (with-temp-eshell
+   (eshell-match-command-output "echo Vid\\éos"
+                                "Vidéos\n")))
+
+(ert-deftest esh-arg-test/escape/special ()
+  "Test that the backslash is not preserved for escaped special
+chars."
+  (with-temp-eshell
+   (eshell-match-command-output "echo he\\\\llo"
+                                ;; Backslashes are doubled for regexp.
+                                "he\\\\llo\n")))
+
+(ert-deftest esh-arg-test/escape/newline ()
+  "Test that an escaped newline is equivalent to the empty string.
+When newlines are *nonspecial*, an escaped newline should be
+treated as just a newline."
+  (with-temp-eshell
+   (eshell-match-command-output "echo hi\\\nthere"
+                                "hithere\n")))
+
+(ert-deftest esh-arg-test/escape/newline-conditional ()
+  "Test invocation of an if/else statement using line continuations."
+  (let ((eshell-test-value t))
+    (eshell-command-result-equal
+     "if $eshell-test-value \\\n{echo yes} \\\n{echo no}"
+     "yes"))
+  (let ((eshell-test-value nil))
+    (eshell-command-result-equal
+     "if $eshell-test-value \\\n{echo yes} \\\n{echo no}"
+     "no")))
+
+(ert-deftest esh-arg-test/escape-quoted/nonspecial ()
+  "Test that the backslash is preserved for escaped nonspecial
+chars."
+  (with-temp-eshell
+   (eshell-match-command-output "echo \"h\\i\""
+                                ;; Backslashes are doubled for regexp.
+                                "h\\\\i\n")))
+
+(ert-deftest esh-arg-test/escape-quoted/special ()
+  "Test that the backslash is not preserved for escaped special
+chars."
+  (with-temp-eshell
+   (eshell-match-command-output "echo \"\\\"hi\\\\\""
+                                ;; Backslashes are doubled for regexp.
+                                "\\\"hi\\\\\n")))
+
+(ert-deftest esh-arg-test/escape-quoted/newline ()
+  "Test that an escaped newline is equivalent to the empty string.
+When newlines are *nonspecial*, an escaped newline should be
+treated literally, as a backslash and a newline."
+  (with-temp-eshell
+   (eshell-match-command-output "echo \"hi\\\nthere\""
+                                "hithere\n")))
+
+;; esh-arg-tests.el ends here
diff --git a/test/lisp/eshell/esh-var-tests.el 
b/test/lisp/eshell/esh-var-tests.el
index 245a8e6a26..d95669fdaf 100644
--- a/test/lisp/eshell/esh-var-tests.el
+++ b/test/lisp/eshell/esh-var-tests.el
@@ -60,6 +60,18 @@
   (eshell-command-result-equal "echo $\"user-login-name\"-foo"
                                (concat user-login-name "-foo")))
 
+(ert-deftest esh-var-test/interp-list-var ()
+  "Interpolate list variable"
+  (let ((eshell-test-value '(1 2 3)))
+    (eshell-command-result-equal "echo $eshell-test-value"
+                                 '(1 2 3))))
+
+(ert-deftest esh-var-test/interp-list-var-concat ()
+  "Interpolate and concat list variable"
+  (let ((eshell-test-value '(1 2 3)))
+    (eshell-command-result-equal "echo a$'eshell-test-value'z"
+                                 '("a1" 2 "3z"))))
+
 (ert-deftest esh-var-test/interp-var-indices ()
   "Interpolate list variable with indices"
   (let ((eshell-test-value '("zero" "one" "two" "three" "four")))
@@ -131,6 +143,26 @@
     (eshell-command-result-equal "echo $#eshell-test-value" 1)
     (eshell-command-result-equal "echo $#eshell-test-value[foo]" 3)))
 
+(ert-deftest esh-var-test/interp-var-splice ()
+  "Splice-interpolate list variable"
+  (let ((eshell-test-value '(1 2 3)))
+    (eshell-command-result-equal "echo a $@eshell-test-value z"
+                                 '("a" 1 2 3 "z"))))
+
+(ert-deftest esh-var-test/interp-var-splice-concat ()
+  "Splice-interpolate and concat list variable"
+  (let ((eshell-test-value '(1 2 3)))
+    (eshell-command-result-equal "echo it is a$@'eshell-test-value'z"
+                                 '("it" "is" "a1" 2 "3z"))
+    ;; This is a tricky case.  We're concatenating a spliced list and
+    ;; a non-spliced list.  The general rule is that splicing should
+    ;; work as though the user typed "$X[0] $X[1] ... $X[N]".  That
+    ;; means that the last value of our splice should get concatenated
+    ;; into the first value of the non-spliced list.
+    (eshell-command-result-equal
+     "echo it is $@'eshell-test-value'$eshell-test-value"
+     '("it" "is" 1 2 (31 2 3)))))
+
 (ert-deftest esh-var-test/interp-lisp ()
   "Interpolate Lisp form evaluation"
   (eshell-command-result-equal "+ $(+ 1 2) 3" 6))
@@ -197,6 +229,9 @@
    (eshell-match-command-output "echo ${echo hi}-${*echo there}"
                                 "hi-there\n")))
 
+
+;; Quoted variable interpolation
+
 (ert-deftest esh-var-test/quoted-interp-var ()
   "Interpolate variable inside double-quotes"
   (eshell-command-result-equal "echo \"$user-login-name\""
@@ -209,6 +244,18 @@
   (eshell-command-result-equal "echo \"hi, $\\\"user-login-name\\\"\""
                                (concat "hi, " user-login-name)))
 
+(ert-deftest esh-var-test/quoted-interp-list-var ()
+  "Interpolate list variable inside double-quotes"
+  (let ((eshell-test-value '(1 2 3)))
+    (eshell-command-result-equal "echo \"$eshell-test-value\""
+                                 "(1 2 3)")))
+
+(ert-deftest esh-var-test/quoted-interp-list-var-concat ()
+  "Interpolate and concat list variable inside double-quotes"
+  (let ((eshell-test-value '(1 2 3)))
+    (eshell-command-result-equal "echo \"a$'eshell-test-value'z\""
+                                 "a(1 2 3)z")))
+
 (ert-deftest esh-var-test/quoted-interp-var-indices ()
   "Interpolate string variable with indices inside double-quotes"
   (let ((eshell-test-value '("zero" "one" "two" "three" "four")))
@@ -289,7 +336,19 @@ inside double-quotes"
     (eshell-command-result-equal "echo \"$#eshell-test-value\""
                                  "1")
     (eshell-command-result-equal "echo \"$#eshell-test-value[foo]\""
-                                 "3"))
+                                 "3")))
+
+(ert-deftest esh-var-test/quoted-interp-var-splice ()
+  "Splice-interpolate list variable inside double-quotes"
+  (let ((eshell-test-value '(1 2 3)))
+    (eshell-command-result-equal "echo a \"$@eshell-test-value\" z"
+                                 '("a" "1 2 3" "z"))))
+
+(ert-deftest esh-var-test/quoted-interp-var-splice-concat ()
+  "Splice-interpolate and concat list variable inside double-quotes"
+  (let ((eshell-test-value '(1 2 3)))
+    (eshell-command-result-equal "echo \"a$@'eshell-test-value'z\""
+                                 "a1 2 3z")))
 
 (ert-deftest esh-var-test/quoted-interp-lisp ()
   "Interpolate Lisp form evaluation inside double-quotes"
@@ -316,7 +375,7 @@ inside double-quotes"
   (let ((temporary-file-directory
          (file-name-as-directory (make-temp-file "esh-vars-tests" t))))
     (unwind-protect
-        (eshell-command-result-equal "cat \"$<echo hi>\"" "hi"))
+        (eshell-command-result-equal "cat \"$<echo hi>\"" "hi")
       (delete-directory temporary-file-directory t))))
 
 (ert-deftest esh-var-test/quoted-interp-concat-cmd ()
@@ -325,6 +384,21 @@ inside double-quotes"
                                "foo\nbar baz"))
 
 
+;; Interpolating commands
+
+(ert-deftest esh-var-test/command-interp ()
+  "Interpolate a variable as a command name"
+  (let ((eshell-test-value "printnl"))
+    (eshell-command-result-equal "$eshell-test-value hello there"
+                                 "hello\nthere\n")))
+
+(ert-deftest esh-var-test/command-interp-splice ()
+  "Interpolate a splice variable as a command name with arguments"
+  (let ((eshell-test-value '("printnl" "hello" "there")))
+    (eshell-command-result-equal "$@eshell-test-value"
+                                 "hello\nthere\n")))
+
+
 ;; Interpolated variable conversion
 
 (ert-deftest esh-var-test/interp-convert-var-number ()
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el
index d5112146c2..c67ac67fd3 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -105,37 +105,6 @@
      (format template "format \"%s\" eshell-in-pipeline-p")
      "nil")))
 
-(ert-deftest eshell-test/escape-nonspecial ()
-  "Test that \"\\c\" and \"c\" are equivalent when \"c\" is not a
-special character."
-  (with-temp-eshell
-   (eshell-match-command-output "echo he\\llo"
-                                "hello\n")))
-
-(ert-deftest eshell-test/escape-nonspecial-unicode ()
-  "Test that \"\\c\" and \"c\" are equivalent when \"c\" is a
-unicode character (unicode characters are nonspecial by
-definition)."
-  (with-temp-eshell
-   (eshell-match-command-output "echo Vid\\éos"
-                                "Vidéos\n")))
-
-(ert-deftest eshell-test/escape-nonspecial-quoted ()
-  "Test that the backslash is preserved for escaped nonspecial
-chars"
-  (with-temp-eshell
-   (eshell-match-command-output "echo \"h\\i\""
-                                ;; Backslashes are doubled for regexp.
-                                "h\\\\i\n")))
-
-(ert-deftest eshell-test/escape-special-quoted ()
-  "Test that the backslash is not preserved for escaped special
-chars"
-  (with-temp-eshell
-   (eshell-match-command-output "echo \"\\\"hi\\\\\""
-                                ;; Backslashes are doubled for regexp.
-                                "\\\"hi\\\\\n")))
-
 (ert-deftest eshell-test/command-running-p ()
   "Modeline should show no command running"
   (with-temp-eshell
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index d82e2dae7a..724cd63e22 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -1590,8 +1590,8 @@ the file watch."
   (unwind-protect
       (progn
        (write-region "any text" nil file-notify--test-tmpfile1 nil 'no-message)
-        ;; Some systems, like MS Windows w/o sufficient privileges, do
-        ;; not allow creation of symbolic links.
+        ;; Some systems, like MS Windows without sufficient
+        ;; privileges, do not allow creation of symbolic links.
         (condition-case nil
             (make-symbolic-link
              file-notify--test-tmpfile1 file-notify--test-tmpfile)
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 682b5cdb44..011bfa67cc 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -1038,17 +1038,6 @@ unquoted file names."
     (let ((default-directory nospecial-dir))
       (should-error (make-directory "dir")))))
 
-(ert-deftest files-tests-file-name-non-special-make-directory-internal ()
-  (files-tests--with-temp-non-special (tmpdir nospecial-dir t)
-    (let ((default-directory nospecial-dir))
-      (make-directory-internal "dir")
-      (should (file-directory-p "dir"))
-      (delete-directory "dir")))
-  (files-tests--with-temp-non-special-and-file-name-handler
-      (tmpdir nospecial-dir t)
-    (let ((default-directory nospecial-dir))
-      (should-error (make-directory-internal "dir")))))
-
 (ert-deftest files-tests-file-name-non-special-make-nearby-temp-file ()
   (let* ((default-directory (file-name-quote temporary-file-directory))
          (near-tmpfile (make-nearby-temp-file "file")))
@@ -1272,11 +1261,11 @@ works as expected if the default directory is quoted."
            (a/b (concat dirname "a/b")))
       (write-region "" nil file)
       (should-error (make-directory "/"))
-      (should-not (make-directory "/" t))
+      (should (make-directory "/" t))
       (should-error (make-directory dir))
-      (should-not (make-directory dir t))
+      (should (make-directory dir t))
       (should-error (make-directory dirname))
-      (should-not (make-directory dirname t))
+      (should (make-directory dirname t))
       (should-error (make-directory file))
       (should-error (make-directory file t))
       (should-not (make-directory subdir1))
@@ -1357,7 +1346,9 @@ name (Bug#28412)."
            (dest (concat dirname "dest/new/directory/"))
            (file (concat (file-name-as-directory source) "file"))
            (source2 (concat dirname "source2"))
-           (dest2 (concat dirname "dest/new2")))
+           (dest2 (concat dirname "dest/new2"))
+           (source3 (concat dirname "source3/d"))
+           (dest3 (concat dirname "dest3/d")))
       (make-directory source)
       (write-region "" nil file)
       (copy-directory source dest t t t)
@@ -1365,6 +1356,11 @@ name (Bug#28412)."
       (make-directory (concat (file-name-as-directory source2) "a") t)
       (copy-directory source2 dest2)
       (should (file-directory-p (concat (file-name-as-directory dest2) "a")))
+      (make-directory source3 t)
+      (write-region "x\n" nil (concat (file-name-as-directory source3) "file"))
+      (make-directory dest3 t)
+      (write-region "y\n" nil (concat (file-name-as-directory dest3) "file"))
+      (copy-directory source3 (file-name-directory dest3) t)
       (delete-directory dir 'recursive))))
 
 (ert-deftest files-tests-abbreviate-file-name-homedir ()
diff --git a/test/lisp/gnus/mml-sec-tests.el b/test/lisp/gnus/mml-sec-tests.el
index e4e607b70e..f8ebf2f3a9 100644
--- a/test/lisp/gnus/mml-sec-tests.el
+++ b/test/lisp/gnus/mml-sec-tests.el
@@ -789,7 +789,7 @@ With Ma Gnus v0.14 and earlier a signature would be created 
with a wrong key."
 
 ;; TODO Passphrase passing and caching in Emacs does not seem to work
 ;; with gpgsm at all.
-;; Independently of caching settings, a pinentry dialogue is displayed.
+;; Independently of caching settings, a pinentry dialog is displayed.
 ;; Thus, the following tests require the user to enter the correct gpgsm
 ;; passphrases at the correct points in time.  (Either empty string or
 ;; "Passphrase".)
diff --git a/test/lisp/international/ucs-normalize-tests.el 
b/test/lisp/international/ucs-normalize-tests.el
index 9e359d5022..380140308a 100644
--- a/test/lisp/international/ucs-normalize-tests.el
+++ b/test/lisp/international/ucs-normalize-tests.el
@@ -59,7 +59,7 @@ And NORM is one of the symbols `NFC', `NFD', `NFKC', `NFKD' 
for brevity."
                       (NFD . ucs-normalize-NFD-region)
                       (NFKC . ucs-normalize-NFKC-region)
                       (NFKD . ucs-normalize-NFKD-region))))
-    `(with-current-buffer ucs-normalize-tests--norm-buf
+    `(progn
        (erase-buffer)
        (insert ,str)
        (,(cdr (assq norm norm-alist)) (point-min) (point-max))
@@ -74,7 +74,7 @@ And NORM is one of the symbols `NFC', `NFD', `NFKC', `NFKD' 
for brevity."
                       (NFD . ucs-normalize-NFD-region)
                       (NFKC . ucs-normalize-NFKC-region)
                       (NFKD . ucs-normalize-NFKD-region))))
-    `(with-current-buffer ucs-normalize-tests--norm-buf
+    `(progn
        (erase-buffer)
        (insert ,char)
        (,(cdr (assq norm norm-alist)) (point-min) (point-max))
@@ -90,36 +90,37 @@ The following invariants must be true for all conformant 
implementations..."
     ;; See `ucs-normalize-tests--rule2-holds-p'.
     (aset ucs-normalize-tests--chars-part1
           (aref source 0) 1))
-  (and
-   ;; c2 ==  toNFC(c1) ==  toNFC(c2) ==  toNFC(c3)
-   (ucs-normalize-tests--normalization-equal-p NFC source nfc)
-   (ucs-normalize-tests--normalization-equal-p NFC nfc nfc)
-   (ucs-normalize-tests--normalization-equal-p NFC nfd nfc)
-   ;; c4 ==  toNFC(c4) ==  toNFC(c5)
-   (ucs-normalize-tests--normalization-equal-p NFC nfkc nfkc)
-   (ucs-normalize-tests--normalization-equal-p NFC nfkd nfkc)
-
-   ;; c3 ==  toNFD(c1) ==  toNFD(c2) ==  toNFD(c3)
-   (ucs-normalize-tests--normalization-equal-p NFD source nfd)
-   (ucs-normalize-tests--normalization-equal-p NFD nfc nfd)
-   (ucs-normalize-tests--normalization-equal-p NFD nfd nfd)
-   ;; c5 ==  toNFD(c4) ==  toNFD(c5)
-   (ucs-normalize-tests--normalization-equal-p NFD nfkc nfkd)
-   (ucs-normalize-tests--normalization-equal-p NFD nfkd nfkd)
-
-   ;; c4 == toNFKC(c1) == toNFKC(c2) == toNFKC(c3) == toNFKC(c4) == toNFKC(c5)
-   (ucs-normalize-tests--normalization-equal-p NFKC source nfkc)
-   (ucs-normalize-tests--normalization-equal-p NFKC nfc nfkc)
-   (ucs-normalize-tests--normalization-equal-p NFKC nfd nfkc)
-   (ucs-normalize-tests--normalization-equal-p NFKC nfkc nfkc)
-   (ucs-normalize-tests--normalization-equal-p NFKC nfkd nfkc)
-
-   ;; c5 == toNFKD(c1) == toNFKD(c2) == toNFKD(c3) == toNFKD(c4) == toNFKD(c5)
-   (ucs-normalize-tests--normalization-equal-p NFKD source nfkd)
-   (ucs-normalize-tests--normalization-equal-p NFKD nfc nfkd)
-   (ucs-normalize-tests--normalization-equal-p NFKD nfd nfkd)
-   (ucs-normalize-tests--normalization-equal-p NFKD nfkc nfkd)
-   (ucs-normalize-tests--normalization-equal-p NFKD nfkd nfkd)))
+  (with-current-buffer ucs-normalize-tests--norm-buf
+    (and
+     ;; c2 ==  toNFC(c1) ==  toNFC(c2) ==  toNFC(c3)
+     (ucs-normalize-tests--normalization-equal-p NFC source nfc)
+     (ucs-normalize-tests--normalization-equal-p NFC nfc nfc)
+     (ucs-normalize-tests--normalization-equal-p NFC nfd nfc)
+     ;; c4 ==  toNFC(c4) ==  toNFC(c5)
+     (ucs-normalize-tests--normalization-equal-p NFC nfkc nfkc)
+     (ucs-normalize-tests--normalization-equal-p NFC nfkd nfkc)
+
+     ;; c3 ==  toNFD(c1) ==  toNFD(c2) ==  toNFD(c3)
+     (ucs-normalize-tests--normalization-equal-p NFD source nfd)
+     (ucs-normalize-tests--normalization-equal-p NFD nfc nfd)
+     (ucs-normalize-tests--normalization-equal-p NFD nfd nfd)
+     ;; c5 ==  toNFD(c4) ==  toNFD(c5)
+     (ucs-normalize-tests--normalization-equal-p NFD nfkc nfkd)
+     (ucs-normalize-tests--normalization-equal-p NFD nfkd nfkd)
+
+     ;; c4 == toNFKC(c1) == toNFKC(c2) == toNFKC(c3) == toNFKC(c4) == 
toNFKC(c5)
+     (ucs-normalize-tests--normalization-equal-p NFKC source nfkc)
+     (ucs-normalize-tests--normalization-equal-p NFKC nfc nfkc)
+     (ucs-normalize-tests--normalization-equal-p NFKC nfd nfkc)
+     (ucs-normalize-tests--normalization-equal-p NFKC nfkc nfkc)
+     (ucs-normalize-tests--normalization-equal-p NFKC nfkd nfkc)
+
+     ;; c5 == toNFKD(c1) == toNFKD(c2) == toNFKD(c3) == toNFKD(c4) == 
toNFKD(c5)
+     (ucs-normalize-tests--normalization-equal-p NFKD source nfkd)
+     (ucs-normalize-tests--normalization-equal-p NFKD nfc nfkd)
+     (ucs-normalize-tests--normalization-equal-p NFKD nfd nfkd)
+     (ucs-normalize-tests--normalization-equal-p NFKD nfkc nfkd)
+     (ucs-normalize-tests--normalization-equal-p NFKD nfkd nfkd))))
 
 (defsubst ucs-normalize-tests--rule2-holds-p (X)
  "Check 2nd conformance rule.
@@ -127,7 +128,9 @@ For every code point X assigned in this version of Unicode 
that
 is not specifically listed in Part 1, the following invariants
 must be true for all conformant implementations:
 
-  X == toNFC(X) == toNFD(X) == toNFKC(X) == toNFKD(X)"
+  X == toNFC(X) == toNFD(X) == toNFKC(X) == toNFKD(X)
+
+Must be called with `ucs-normalize-tests--norm-buf' as current buffer."
  (and (ucs-normalize-tests--normalization-chareq-p NFC X X)
       (ucs-normalize-tests--normalization-chareq-p NFD X X)
       (ucs-normalize-tests--normalization-chareq-p NFKC X X)
@@ -230,26 +233,30 @@ must be true for all conformant implementations:
 
 (defun ucs-normalize-tests--part1-rule2 (chars-part1)
   (let ((reporter (make-progress-reporter "UCS Normalize Test Part1, rule 2"
-                                          0 (max-char)))
-        (failed-chars nil))
-    (map-char-table
-     (lambda (char-range listed-in-part)
-       (unless (eq listed-in-part 1)
-         (if (characterp char-range)
-             (progn (unless (ucs-normalize-tests--rule2-holds-p char-range)
-                      (push char-range failed-chars))
-                    (progress-reporter-update reporter char-range))
-           (cl-loop for char from (car char-range) to (cdr char-range)
-                    unless (ucs-normalize-tests--rule2-holds-p char)
-                    do (push char failed-chars)
-                    do (progress-reporter-update reporter char)))))
-     chars-part1)
+                                          0 (max-char t)))
+        (failed-chars nil)
+        (unicode-max (max-char t)))
+    (with-current-buffer ucs-normalize-tests--norm-buf
+      (map-char-table
+       (lambda (char-range listed-in-part)
+         (unless (eq listed-in-part 1)
+           (if (characterp char-range)
+               (progn (unless (ucs-normalize-tests--rule2-holds-p char-range)
+                        (push char-range failed-chars))
+                      (progress-reporter-update reporter char-range))
+             (cl-loop for char from (car char-range) to (min (cdr char-range)
+                                                             unicode-max)
+                      unless (ucs-normalize-tests--rule2-holds-p char)
+                      do (push char failed-chars)
+                      do (progress-reporter-update reporter char)))))
+       chars-part1))
     (progress-reporter-done reporter)
     failed-chars))
 
 (ert-deftest ucs-normalize-part1 ()
   :tags '(:expensive-test)
-  (skip-unless (not (getenv "EMACS_HYDRA_CI"))) ; SLOW ~ 1800s
+  (skip-unless (not (or (getenv "EMACS_HYDRA_CI")
+                        (getenv "EMACS_EMBA_CI")))) ; SLOW ~ 1800s
   ;; This takes a long time, so make sure we're compiled.
   (dolist (fun '(ucs-normalize-tests--part1-rule2
                  ucs-normalize-tests--rule1-failing-for-partX
diff --git a/test/lisp/loadhist-resources/loadhist--bar.el 
b/test/lisp/loadhist-resources/loadhist--bar.el
index 5c8914ed57..94e82c1b18 100644
--- a/test/lisp/loadhist-resources/loadhist--bar.el
+++ b/test/lisp/loadhist-resources/loadhist--bar.el
@@ -4,18 +4,20 @@
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 
-;; 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/>.
 
 ;;; Code:
 
diff --git a/test/lisp/loadhist-resources/loadhist--foo.el 
b/test/lisp/loadhist-resources/loadhist--foo.el
index 3574c22013..8d48c3683d 100644
--- a/test/lisp/loadhist-resources/loadhist--foo.el
+++ b/test/lisp/loadhist-resources/loadhist--foo.el
@@ -4,18 +4,20 @@
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 
-;; 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:
 
diff --git a/test/lisp/net/eudc-resources/bbdb 
b/test/lisp/net/eudc-resources/bbdb
index b730bb51cc..782da56e9f 100644
--- a/test/lisp/net/eudc-resources/bbdb
+++ b/test/lisp/net/eudc-resources/bbdb
@@ -1,3 +1,4 @@
 ;; -*- mode: Emacs-Lisp; coding: utf-8; -*-
 ;;; file-format: 9
 ["Emacs" "ERT3" nil nil nil nil nil ("emacs-ert-test-3@bbdb.gnu.org") ((notes 
. " ")) "c8bd3a63-3a83-48a7-a95b-be118a923e00" "2022-11-19 16:36:04 +0000" 
"2022-11-19 16:36:04 +0000" nil]
+["Emacs" "ERT4" nil nil nil nil nil ("emacs-ert-test-4@bbdb.gnu.org") ((notes 
. " ")) "5a93c3c5-9270-4e10-8b28-d28cfa2562cf" "2022-11-19 16:47:49 +0000" 
"2022-11-19 16:47:49 +0000" nil]
diff --git a/test/lisp/net/eudc-tests.el b/test/lisp/net/eudc-tests.el
index 212db65cb2..0da51b7c36 100644
--- a/test/lisp/net/eudc-tests.el
+++ b/test/lisp/net/eudc-tests.el
@@ -281,7 +281,12 @@ Karl Fogel <kfogel@mail-abbrev.com")))))))))
                                        base "dc=gnu,dc=org" auth simple)))
         (eudc-server-hotlist '(("ldap://localhost:3899"; . ldap)))
         (eudc-ignore-options-file t))
-    (sleep-for 1) ; Wait for slapd to start.
+    (catch 'sldapd-up
+      (dotimes (_tries 20)
+        (when (eudc-query-with-words '("emacs-ert-test-1"))
+          (throw 'sldapd-up nil)))
+      (kill-process ldap-process)
+      (error "Failed to confirm slapd is running"))
     (should (equal (with-temp-buffer
                      (insert "emacs-ert-test-1")
                      (eudc-expand-try-all)
diff --git a/test/lisp/net/tramp-archive-tests.el 
b/test/lisp/net/tramp-archive-tests.el
index f8a0aa03e3..d9eafc47ad 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -123,7 +123,7 @@ the origin of the temporary TMPFILE, have no write 
permissions."
 
 (defun tramp-archive--test-emacs27-p ()
   "Check for Emacs version >= 27.1.
-Some semantics has been changed for there, w/o new functions or
+Some semantics has been changed for there, without new functions or
 variables, so we check the Emacs version directly."
   (>= emacs-major-version 27))
 
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index a79c47be72..79b2fc803d 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -5388,6 +5388,21 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
       ;; Cleanup.
       (ignore-errors (delete-process proc)))))
 
+(ert-deftest tramp-test31-memory-info ()
+  "Check `memory-info'."
+  :tags '(:expensive-test)
+  (skip-unless (tramp--test-enabled))
+  (skip-unless (tramp--test-supports-processes-p))
+  ;; `memory-info' is supported since Emacs 29.1.
+  (skip-unless (tramp--test-emacs29-p))
+
+  (when-let ((default-directory ert-remote-temporary-file-directory)
+             (mi (memory-info)))
+    (should (consp mi))
+    (should (= (length mi) 4))
+    (dotimes (i (length mi))
+      (should (natnump (nth i mi))))))
+
 (defun tramp--test-async-shell-command
     (command output-buffer &optional error-buffer input)
   "Like `async-shell-command', reading the output.
@@ -6582,20 +6597,20 @@ INPUT, if non-nil, is a string sent to the process."
 
 (defun tramp--test-emacs27-p ()
   "Check for Emacs version >= 27.1.
-Some semantics has been changed for there, w/o new functions or
-variables, so we check the Emacs version directly."
+Some semantics has been changed for there, without new functions
+or variables, so we check the Emacs version directly."
   (>= emacs-major-version 27))
 
 (defun tramp--test-emacs28-p ()
   "Check for Emacs version >= 28.1.
-Some semantics has been changed for there, w/o new functions or
-variables, so we check the Emacs version directly."
+Some semantics has been changed for there, without new functions
+or variables, so we check the Emacs version directly."
   (>= emacs-major-version 28))
 
 (defun tramp--test-emacs29-p ()
   "Check for Emacs version >= 29.1.
-Some semantics has been changed for there, w/o new functions or
-variables, so we check the Emacs version directly."
+Some semantics has been changed for there, without new functions
+or variables, so we check the Emacs version directly."
   (>= emacs-major-version 29))
 
 (defun tramp--test-adb-p ()
diff --git a/test/lisp/proced-tests.el b/test/lisp/proced-tests.el
new file mode 100644
index 0000000000..3c1f5493e7
--- /dev/null
+++ b/test/lisp/proced-tests.el
@@ -0,0 +1,105 @@
+;;; proced-tests.el --- Test suite for proced.el -*- 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)
+(require 'proced)
+(require 'thingatpt)
+
+(cl-defmacro proced--within-buffer (format filter &body body)
+  "Execute BODY within a proced buffer using format FORMAT and filter FILTER."
+  `(let ((proced-format ,format)
+         (proced-filter ,filter)
+         (proced-auto-update-flag nil)
+         (inhibit-message t))
+     (proced)
+     (unwind-protect
+         (with-current-buffer "*Proced*"
+           ,@body)
+       (kill-buffer "*Proced*"))))
+
+(defun proced--assert-emacs-pid-in-buffer ()
+  "Fail unless the process ID of the current Emacs process exists in buffer."
+  (should (string-match-p
+           (number-to-string (emacs-pid))
+           (buffer-substring-no-properties (point-min) (point-max)))))
+
+(defun proced--move-to-column (attribute)
+  "Move to the column under ATTRIBUTE in the current proced buffer."
+  (move-to-column (string-match attribute proced-header-line)))
+
+(ert-deftest proced-format-test ()
+  (dolist (format '(short medium long verbose))
+    (proced--within-buffer
+     format
+     'user
+     (proced--assert-emacs-pid-in-buffer))))
+
+(ert-deftest proced-update-test ()
+  (proced--within-buffer
+   'short
+   'user
+   (proced-update)
+   (proced--assert-emacs-pid-in-buffer)))
+
+(ert-deftest proced-revert-test ()
+  (proced--within-buffer
+   'short
+   'user
+   (proced-revert)
+   (proced--assert-emacs-pid-in-buffer)))
+
+(ert-deftest proced-color-test ()
+  (let ((proced-enable-color-flag t))
+    (proced--within-buffer
+     'short
+     'user
+     (proced--assert-emacs-pid-in-buffer))))
+
+(ert-deftest proced-refine-test ()
+  ;;(skip-unless (memq system-type '(gnu/linux gnu/kfreebsd darwin)))
+  (proced--within-buffer
+   'medium
+   'user
+   ;; When refining on PID for process A, a process is kept if and only
+   ;; if its PID are the same as process A, which more or less guarentees
+   ;; the refinement will remove some processes.
+   (proced--move-to-column "PID")
+   (let ((pid (word-at-point)))
+     (proced-refine)
+     (while (not (eobp))
+       (proced--move-to-column "PID")
+       (should (string= pid (word-at-point)))
+       (forward-line)))))
+
+(ert-deftest proced-refine-with-update-test ()
+  (proced--within-buffer
+   'medium
+   'user
+   (proced--move-to-column "PID")
+   (let ((pid (word-at-point)))
+     (proced-refine)
+     (proced-update t)
+     (while (not (eobp))
+       (proced--move-to-column "PID")
+       (should (string= pid (word-at-point)))
+       (forward-line)))))
+
+(provide 'proced-tests)
+;;; proced-tests.el ends here
diff --git a/test/lisp/progmodes/eglot-tests.el 
b/test/lisp/progmodes/eglot-tests.el
new file mode 100644
index 0000000000..d8c9560f5b
--- /dev/null
+++ b/test/lisp/progmodes/eglot-tests.el
@@ -0,0 +1,1320 @@
+;;; eglot-tests.el --- Tests for eglot.el            -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
+
+;; Author: João Távora <joaotavora@gmail.com>
+;; Keywords: tests
+
+;; 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:
+
+;; Tests for lisp/progmodes/eglot.el
+;;
+;; Many of these tests rely on the availability of third-party LSP
+;; servers.  They are automatically skipped if the program is not
+;; available.
+;;
+;; Some of these tests rely on the GNU ELPA package company.el and
+;; yasnippet.el being available.
+
+;; Some of the tests require access to a remote host files.  Since
+;; this could be problematic, a mock-up connection method "mock" is
+;; used.  Emulating a remote connection, it simply calls "sh -i".
+;; Tramp's file name handlers still run, so this test is sufficient
+;; except for connection establishing.
+
+;; If you want to test a real Tramp connection, set
+;; $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable value in order to
+;; overwrite the default value.  If you want to skip tests accessing a
+;; remote host, set this environment variable to "/dev/null" or
+;; whatever is appropriate on your system.
+
+;;; Code:
+(require 'eglot)
+(require 'cl-lib)
+(require 'ert)
+(require 'tramp) ; must be prior ert-x
+(require 'ert-x) ; ert-simulate-command
+(require 'edebug)
+(require 'python) ; some tests use pylsp
+(require 'cc-mode) ; c-mode-hook
+(require 'company nil t)
+(require 'yasnippet nil t)
+(require 'subr-x)
+(require 'flymake) ; project-diagnostics
+
+;;; Helpers
+
+(defmacro eglot--with-fixture (fixture &rest body)
+  "Setup FIXTURE, call BODY, teardown FIXTURE.
+FIXTURE is a list.  Its elements are of the form (FILE . CONTENT)
+to create a readable FILE with CONTENT.  FILE may be a directory
+name and CONTENT another (FILE . CONTENT) list to specify a
+directory hierarchy.  FIXTURE's elements can also be (SYMBOL
+VALUE) meaning SYMBOL should be bound to VALUE during BODY and
+then restored."
+  (declare (indent 1) (debug t))
+  `(eglot--call-with-fixture
+    ,fixture #'(lambda () ,@body)))
+
+(defun eglot--make-file-or-dir (ass)
+  (let ((file-or-dir-name (car ass))
+        (content (cdr ass)))
+    (cond ((listp content)
+           (make-directory file-or-dir-name 'parents)
+           (let ((default-directory (concat default-directory "/" 
file-or-dir-name)))
+             (mapcan #'eglot--make-file-or-dir content)))
+          ((stringp content)
+           (with-temp-buffer
+             (insert content)
+             (write-region nil nil file-or-dir-name nil 'nomessage))
+           (list (expand-file-name file-or-dir-name)))
+          (t
+           (eglot--error "Expected a string or a directory spec")))))
+
+(defun eglot--call-with-fixture (fixture fn)
+  "Helper for `eglot--with-fixture'.  Run FN under FIXTURE."
+  (let* ((fixture-directory (make-nearby-temp-file "eglot--fixture" t))
+         (default-directory fixture-directory)
+         file-specs created-files
+         syms-to-restore
+         new-servers
+         test-body-successful-p)
+    (dolist (spec fixture)
+      (cond ((symbolp spec)
+             (push (cons spec (symbol-value spec)) syms-to-restore)
+             (set spec nil))
+            ((symbolp (car spec))
+             (push (cons (car spec) (symbol-value (car spec))) syms-to-restore)
+             (set (car spec) (cadr spec)))
+            ((stringp (car spec)) (push spec file-specs))))
+    (unwind-protect
+        (let* ((home (getenv "HOME"))
+               (process-environment
+                (append
+                 `(;; Set XDF_CONFIG_HOME to /dev/null to prevent
+                   ;; user-configuration to have an influence on
+                   ;; language servers. (See github#441)
+                   "XDG_CONFIG_HOME=/dev/null"
+                   ;; ... on the flip-side, a similar technique by
+                   ;; Emacs's test makefiles means that HOME is set to
+                   ;; /nonexistent.  This breaks some common
+                   ;; installations for LSP servers like pylsp, making
+                   ;; these tests mostly useless, so we hack around it
+                   ;; here with a great big hack.
+                   ,(format "HOME=%s"
+                            (if (file-exists-p home) home
+                              (format "/home/%s" (getenv "USER")))))
+                 process-environment))
+               ;; Prevent "Can't guess python-indent-offset ..." messages.
+               (python-indent-guess-indent-offset-verbose . nil)
+               (eglot-server-initialized-hook
+                (lambda (server) (push server new-servers))))
+          (setq created-files (mapcan #'eglot--make-file-or-dir file-specs))
+          (prog1 (funcall fn)
+            (setq test-body-successful-p t)))
+      (eglot--message
+       "Test body was %s" (if test-body-successful-p "OK" "A FAILURE"))
+      (unwind-protect
+          (let ((eglot-autoreconnect nil))
+            (dolist (server new-servers)
+              (when (jsonrpc-running-p server)
+                (condition-case oops
+                    (eglot-shutdown
+                     server nil 3 (not test-body-successful-p))
+                  (error
+                   (eglot--message "Non-critical shutdown error after test: %S"
+                                   oops))))
+              (when (not test-body-successful-p)
+                ;; We want to do this after the sockets have
+                ;; shut down such that any pending data has been
+                ;; consumed and is available in the process
+                ;; buffers.
+                (let ((buffers (delq nil (list
+                                          ;; FIXME: Accessing "internal" 
symbol here.
+                                          (process-buffer (jsonrpc--process 
server))
+                                          (jsonrpc-stderr-buffer server)
+                                          (jsonrpc-events-buffer server)))))
+                  (cond (noninteractive
+                         (dolist (buffer buffers)
+                           (eglot--message "%s:" (buffer-name buffer))
+                           (princ (with-current-buffer buffer (buffer-string))
+                                  'external-debugging-output)))
+                        (t
+                         (eglot--message "Preserved for inspection: %s"
+                                         (mapconcat #'buffer-name buffers ", 
"))))))))
+        (eglot--cleanup-after-test fixture-directory created-files 
syms-to-restore)))))
+
+(defun eglot--cleanup-after-test (fixture-directory created-files 
syms-to-restore)
+  (let ((buffers-to-delete
+         (delete nil (mapcar #'find-buffer-visiting created-files))))
+    (eglot--message "Killing %s, wiping %s, restoring %s"
+                    buffers-to-delete
+                    fixture-directory
+                    (mapcar #'car syms-to-restore))
+    (cl-loop for (sym . val) in syms-to-restore
+             do (set sym val))
+    (dolist (buf buffers-to-delete) ;; have to save otherwise will get prompted
+      (with-current-buffer buf (save-buffer) (kill-buffer)))
+    (delete-directory fixture-directory 'recursive)
+    ;; Delete Tramp buffers if needed.
+    (when (file-remote-p temporary-file-directory)
+      (tramp-cleanup-connection
+       (tramp-dissect-file-name temporary-file-directory) nil 
'keep-password))))
+
+(cl-defmacro eglot--with-timeout (timeout &body body)
+  (declare (indent 1) (debug t))
+  `(eglot--call-with-timeout ,timeout (lambda () ,@body)))
+
+(defun eglot--call-with-timeout (timeout fn)
+  (let* ((tag (gensym "eglot-test-timeout"))
+         (timed-out (make-symbol "timeout"))
+         (timeout-and-message
+          (if (listp timeout) timeout
+            (list timeout "waiting for test to finish")))
+         (timeout (car timeout-and-message))
+         (message (cadr timeout-and-message))
+         (timer)
+         (retval))
+    (unwind-protect
+        (setq retval
+              (catch tag
+                (setq timer
+                      (run-with-timer timeout nil
+                                      (lambda ()
+                                        (unless edebug-active
+                                          (throw tag timed-out)))))
+                (funcall fn)))
+      (cancel-timer timer)
+      (when (eq retval timed-out)
+        (error "%s" (concat "Timed out " message))))))
+
+(defun eglot--find-file-noselect (file &optional noerror)
+  (unless (or noerror
+              (file-readable-p file)) (error "%s does not exist" file))
+  (find-file-noselect file))
+
+(cl-defmacro eglot--sniffing ((&key server-requests
+                                    server-notifications
+                                    server-replies
+                                    client-requests
+                                    client-notifications
+                                    client-replies)
+                              &rest body)
+  "Run BODY saving LSP JSON messages in variables, most recent first."
+  (declare (indent 1) (debug (sexp &rest form)))
+  (let ((log-event-ad-sym (make-symbol "eglot--event-sniff")))
+    `(unwind-protect
+         (let ,(delq nil (list server-requests
+                               server-notifications
+                               server-replies
+                               client-requests
+                               client-notifications
+                               client-replies))
+           (advice-add
+            #'jsonrpc--log-event :before
+            (lambda (_proc message &optional type)
+              (cl-destructuring-bind (&key method id _error &allow-other-keys)
+                  message
+                (let ((req-p (and method id))
+                      (notif-p method)
+                      (reply-p id))
+                  (cond
+                   ((eq type 'server)
+                    (cond (req-p ,(when server-requests
+                                    `(push message ,server-requests)))
+                          (notif-p ,(when server-notifications
+                                      `(push message ,server-notifications)))
+                          (reply-p ,(when server-replies
+                                      `(push message ,server-replies)))))
+                   ((eq type 'client)
+                    (cond (req-p ,(when client-requests
+                                    `(push message ,client-requests)))
+                          (notif-p ,(when client-notifications
+                                      `(push message ,client-notifications)))
+                          (reply-p ,(when client-replies
+                                      `(push message ,client-replies)))))))))
+            '((name . ,log-event-ad-sym)))
+           ,@body)
+       (advice-remove #'jsonrpc--log-event ',log-event-ad-sym))))
+
+(cl-defmacro eglot--wait-for ((events-sym &optional (timeout 1) message) args 
&body body)
+  "Spin until FN match in EVENTS-SYM, flush events after it.
+Pass TIMEOUT to `eglot--with-timeout'."
+  (declare (indent 2) (debug (sexp sexp sexp &rest form)))
+  `(eglot--with-timeout '(,timeout ,(or message
+                                        (format "waiting for:\n%s" 
(pp-to-string body))))
+     (let ((event
+            (cl-loop thereis (cl-loop for json in ,events-sym
+                                      for method = (plist-get json :method)
+                                      when (keywordp method)
+                                      do (plist-put json :method
+                                                    (substring
+                                                     (symbol-name method)
+                                                     1))
+                                      when (funcall
+                                            (jsonrpc-lambda ,args ,@body) json)
+                                      return (cons json before)
+                                      collect json into before)
+                     for i from 0
+                     when (zerop (mod i 5))
+                     ;; do (eglot--message "still struggling to find in %s"
+                     ;;                    ,events-sym)
+                     do
+                     ;; `read-event' is essential to have the file
+                     ;; watchers come through.
+                     (read-event "[eglot] Waiting a bit..." nil 0.1)
+                     (accept-process-output nil 0.1))))
+       (setq ,events-sym (cdr event))
+       (eglot--message "Event detected:\n%s"
+                       (pp-to-string (car event))))))
+
+;; `rust-mode' is not a part of Emacs, so we define these two shims
+;; which should be more than enough for testing.
+(unless (functionp 'rust-mode)
+  (define-derived-mode rust-mode prog-mode "Rust")
+  (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)))
+
+;; `typescript-mode' is not a part of Emacs, so we define these two
+;; shims which should be more than enough for testing.
+(unless (functionp 'typescript-mode)
+  (define-derived-mode typescript-mode prog-mode "TypeScript")
+  (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode)))
+
+(defun eglot--tests-connect (&optional timeout)
+  (let* ((timeout (or timeout 10))
+         (eglot-sync-connect t)
+         (eglot-connect-timeout timeout))
+    (apply #'eglot--connect (eglot--guess-contact))))
+
+(defun eglot--simulate-key-event (char)
+  "Like (execute-kbd-macro (vector char)), but with `call-interactively'."
+  ;; Also, this is a bit similar to what electric-tests.el does.
+  (setq last-input-event char)
+  (setq last-command-event char)
+  (call-interactively (key-binding (vector char))))
+
+
+;;; Unit tests
+
+(ert-deftest eglot-test-eclipse-connect ()
+  "Connect to eclipse.jdt.ls server."
+  (skip-unless (executable-find "jdtls"))
+  (eglot--with-fixture
+      '(("project/src/main/java/foo" . (("Main.java" . "")))
+        ("project/.git/" . nil))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/src/main/java/foo/Main.java")
+      (eglot--sniffing (:server-notifications s-notifs)
+        (should (eglot--tests-connect 20))
+        (eglot--wait-for (s-notifs 10)
+            (&key _id method &allow-other-keys)
+          (string= method "language/status"))))))
+
+(defun eglot-tests--auto-detect-running-server-1 ()
+  (let (server)
+    (eglot--with-fixture
+     `(("project" . (("coiso.c" . "bla")
+                     ("merdix.c" . "bla")))
+       ("anotherproject" . (("cena.c" . "bla"))))
+     (with-current-buffer
+         (eglot--find-file-noselect "project/coiso.c")
+       (should (setq server (eglot--tests-connect)))
+       (should (eglot-current-server)))
+     (with-current-buffer
+         (eglot--find-file-noselect "project/merdix.c")
+       (should (eglot-current-server))
+       (should (eq (eglot-current-server) server)))
+     (with-current-buffer
+         (eglot--find-file-noselect "anotherproject/cena.c")
+       (should-error (eglot--current-server-or-lose))))))
+
+(ert-deftest eglot-test-auto-detect-running-server ()
+  "Visit a file and \\[eglot], then visit a neighbor."
+  (skip-unless (executable-find "clangd"))
+  (eglot-tests--auto-detect-running-server-1))
+
+(ert-deftest eglot-test-auto-shutdown ()
+  "Visit a file and \\[eglot], then kill buffer."
+  (skip-unless (executable-find "clangd"))
+  (let (server
+        buffer)
+    (eglot--with-fixture
+        `(("project" . (("thingy.c" . "int main() {return 0;}"))))
+      (with-current-buffer
+          (setq buffer (eglot--find-file-noselect "project/thingy.c"))
+        (should (setq server (eglot--tests-connect)))
+        (should (eglot-current-server))
+        (let ((eglot-autoshutdown nil)) (kill-buffer buffer))
+        (should (jsonrpc-running-p server))
+        ;; re-find file...
+        (setq buffer (eglot--find-file-noselect (buffer-file-name buffer)))
+        ;; ;; but now kill it with `eglot-autoshutdown' set to t
+        (let ((eglot-autoshutdown t)) (kill-buffer buffer))
+        (should (not (jsonrpc-running-p server)))))))
+
+(ert-deftest eglot-test-auto-reconnect ()
+  "Start a server.  Kill it.  Watch it reconnect."
+  (skip-unless (executable-find "clangd"))
+  (let (server (eglot-autoreconnect 1))
+    (eglot--with-fixture
+        `(("project" . (("thingy.c" . "bla")
+                        ("thingy2.c" . "bla"))))
+      (with-current-buffer
+          (eglot--find-file-noselect "project/thingy.c")
+        (should (setq server (eglot--tests-connect)))
+        ;; In 1.2 seconds > `eglot-autoreconnect' kill servers. We
+        ;; should have a automatic reconnection.
+        (run-with-timer 1.2 nil (lambda () (delete-process
+                                            (jsonrpc--process server))))
+        (while (jsonrpc-running-p server) (accept-process-output nil 0.5))
+        (should (eglot-current-server))
+        ;; Now try again too quickly
+        (setq server (eglot-current-server))
+        (let ((proc (jsonrpc--process server)))
+          (run-with-timer 0.5 nil (lambda () (delete-process proc)))
+          (while (process-live-p proc) (accept-process-output nil 0.5)))
+        (should (not (eglot-current-server)))))))
+
+(ert-deftest eglot-test-rust-analyzer-watches-files ()
+  "Start rust-analyzer.  Notify it when a critical file changes."
+  (skip-unless (executable-find "rust-analyzer"))
+  (skip-unless (executable-find "cargo"))
+  (let ((eglot-autoreconnect 1))
+    (eglot--with-fixture
+        '(("watch-project" . (("coiso.rs" . "bla")
+                              ("merdix.rs" . "bla"))))
+      (with-current-buffer
+          (eglot--find-file-noselect "watch-project/coiso.rs")
+        (should (zerop (shell-command "cargo init")))
+        (eglot--sniffing (
+                          :server-requests s-requests
+                          :client-notifications c-notifs
+                          :client-replies c-replies
+                          )
+          (should (eglot--tests-connect))
+          (let (register-id)
+            (eglot--wait-for (s-requests 1)
+                (&key id method &allow-other-keys)
+              (setq register-id id)
+              (string= method "client/registerCapability"))
+            (eglot--wait-for (c-replies 1)
+                (&key id error &allow-other-keys)
+              (and (eq id register-id) (null error))))
+          (delete-file "Cargo.toml")
+          (eglot--wait-for
+              (c-notifs 3 "waiting for didChangeWatchedFiles notification")
+              (&key method params &allow-other-keys)
+            (and (string= method "workspace/didChangeWatchedFiles")
+                 (cl-destructuring-bind (&key uri type)
+                     (elt (plist-get params :changes) 0)
+                   (and (string= (eglot--path-to-uri "Cargo.toml") uri)
+                        (= type 3))))))))))
+
+(ert-deftest eglot-test-basic-diagnostics ()
+  "Test basic diagnostics."
+  (skip-unless (executable-find "clangd"))
+  (eglot--with-fixture
+      `(("diag-project" .
+         (("main.c" . "int main(){froat a = 42.2; return 0;}"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "diag-project/main.c")
+      (eglot--sniffing (:server-notifications s-notifs)
+        (eglot--tests-connect)
+        (eglot--wait-for (s-notifs 2)
+            (&key _id method &allow-other-keys)
+          (string= method "textDocument/publishDiagnostics"))
+        (flymake-start)
+        (goto-char (point-min))
+        (flymake-goto-next-error 1 '() t)
+        (should (eq 'flymake-error (face-at-point)))))))
+
+(ert-deftest eglot-test-diagnostic-tags-unnecessary-code ()
+  "Test rendering of diagnostics tagged \"unnecessary\"."
+  (skip-unless (executable-find "rust-analyzer"))
+  (skip-unless (executable-find "cargo"))
+  (eglot--with-fixture
+      '(("diagnostic-tag-project" .
+         (("main.rs" .
+           "fn main() -> () { let test=3; }"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "diagnostic-tag-project/main.rs")
+      (let ((eglot-server-programs '((rust-mode . ("rust-analyzer")))))
+        (should (zerop (shell-command "cargo init")))
+        (eglot--sniffing (:server-notifications s-notifs)
+          (eglot--tests-connect)
+          (eglot--wait-for (s-notifs 10)
+              (&key _id method &allow-other-keys)
+            (string= method "textDocument/publishDiagnostics"))
+          (flymake-start)
+          (goto-char (point-min))
+          (flymake-goto-next-error 1 '() t)
+          (should (eq 'eglot-diagnostic-tag-unnecessary-face 
(face-at-point))))))))
+
+(defun eglot--eldoc-on-demand ()
+  ;; Trick Eldoc 1.1.0 into accepting on-demand calls.
+  (eldoc t))
+
+(defun eglot--tests-force-full-eldoc ()
+  ;; FIXME: This uses some Eldoc implementation defatils.
+  (when (buffer-live-p eldoc--doc-buffer)
+    (with-current-buffer eldoc--doc-buffer
+      (let ((inhibit-read-only t))
+        (erase-buffer))))
+  (eglot--eldoc-on-demand)
+  (cl-loop
+   repeat 10
+   for retval = (and (buffer-live-p eldoc--doc-buffer)
+                     (with-current-buffer eldoc--doc-buffer
+                       (let ((bs (buffer-string)))
+                         (unless (zerop (length bs)) bs))))
+   when retval return retval
+   do (sit-for 0.5)
+   finally (error "eglot--tests-force-full-eldoc didn't deliver")))
+
+(ert-deftest eglot-test-rust-analyzer-hover-after-edit ()
+  "Hover and highlightChanges."
+  (skip-unless (executable-find "rust-analyzer"))
+  (skip-unless (executable-find "cargo"))
+  (eglot--with-fixture
+      '(("hover-project" .
+         (("main.rs" .
+           "fn test() -> i32 { let test=3; return te; }"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "hover-project/main.rs")
+      (should (zerop (shell-command "cargo init")))
+      (eglot--sniffing (
+                        :server-replies s-replies
+                        :client-requests c-reqs
+                        )
+        (eglot--tests-connect)
+        (goto-char (point-min))
+        (search-forward "return te")
+        (insert "st")
+        (progn
+          ;; simulate these two which don't happen when buffer isn't
+          ;; visible in a window.
+          (eglot--signal-textDocument/didChange)
+          (eglot--eldoc-on-demand))
+        (let (pending-id)
+          (eglot--wait-for (c-reqs 2)
+              (&key id method &allow-other-keys)
+            (setq pending-id id)
+            (string= method "textDocument/documentHighlight"))
+          (eglot--wait-for (s-replies 2)
+              (&key id &allow-other-keys)
+            (eq id pending-id)))))))
+
+(ert-deftest eglot-test-rename-a-symbol ()
+  "Test basic symbol renaming."
+  (skip-unless (executable-find "clangd"))
+  (eglot--with-fixture
+      `(("rename-project"
+         . (("main.c" .
+             "int foo() {return 42;} int main() {return foo();}"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "rename-project/main.c")
+      (eglot--tests-connect)
+      (goto-char (point-min)) (search-forward "foo")
+      (eglot-rename "bar")
+      (should (equal (buffer-string)
+                     "int bar() {return 42;} int main() {return bar();}")))))
+
+(ert-deftest eglot-test-basic-completions ()
+  "Test basic autocompletion in a python LSP."
+  (skip-unless (executable-find "pylsp"))
+  (eglot--with-fixture
+      `(("project" . (("something.py" . "import sys\nsys.exi"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.py")
+      (should (eglot--tests-connect))
+      (goto-char (point-max))
+      (completion-at-point)
+      (should (looking-back "sys.exit")))))
+
+(ert-deftest eglot-test-non-unique-completions ()
+  "Test completion resulting in 'Complete, but not unique'."
+  (skip-unless (executable-find "pylsp"))
+  (eglot--with-fixture
+      '(("project" . (("something.py" . "foo=1\nfoobar=2\nfoo"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.py")
+      (should (eglot--tests-connect))
+      (goto-char (point-max))
+      (completion-at-point))
+    ;; FIXME: `current-message' doesn't work here :-(
+    (with-current-buffer (messages-buffer)
+      (save-excursion
+        (goto-char (point-max))
+        (forward-line -1)
+        (should (looking-at "Complete, but not unique"))))))
+
+(ert-deftest eglot-test-basic-xref ()
+  "Test basic xref functionality in a python LSP."
+  (skip-unless (executable-find "pylsp"))
+  (eglot--with-fixture
+      `(("project" . (("something.py" . "def foo(): pass\ndef bar(): foo()"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.py")
+      (should (eglot--tests-connect))
+      (search-forward "bar(): f")
+      (call-interactively 'xref-find-definitions)
+      (should (looking-at "foo(): pass")))))
+
+(defvar eglot--test-python-buffer
+  "\
+def foobarquux(a, b, c=True): pass
+def foobazquuz(d, e, f): pass
+")
+
+(declare-function yas-minor-mode nil)
+
+(ert-deftest eglot-test-snippet-completions ()
+  "Test simple snippet completion in a python LSP."
+  (skip-unless (and (executable-find "pylsp")
+                    (functionp 'yas-minor-mode)))
+  (eglot--with-fixture
+      `(("project" . (("something.py" . ,eglot--test-python-buffer))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.py")
+      (yas-minor-mode 1)
+      (let ((eglot-workspace-configuration
+             `((:pylsp . (:plugins (:jedi_completion (:include_params t)))))))
+        (should (eglot--tests-connect)))
+      (goto-char (point-max))
+      (insert "foobar")
+      (completion-at-point)
+      (should (looking-back "foobarquux("))
+      (should (looking-at "a, b)")))))
+
+(defvar company-candidates)
+(declare-function company-mode nil)
+(declare-function company-complete nil)
+
+(ert-deftest eglot-test-snippet-completions-with-company ()
+  "Test simple snippet completion in a python LSP."
+  (skip-unless (and (executable-find "pylsp")
+                    (functionp 'yas-minor-mode)
+                    (functionp 'company-complete)))
+  (eglot--with-fixture
+      `(("project" . (("something.py" . ,eglot--test-python-buffer))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.py")
+      (yas-minor-mode 1)
+      (let ((eglot-workspace-configuration
+             `((:pylsp . (:plugins (:jedi_completion (:include_params t)))))))
+        (should (eglot--tests-connect)))
+      (goto-char (point-max))
+      (insert "foo")
+      (company-mode)
+      (company-complete)
+      (should (looking-back "fooba"))
+      (should (= 2 (length company-candidates)))
+      ;; this last one is brittle, since there it is possible that
+      ;; pylsp will change the representation of this candidate
+      (should (member "foobazquuz(d, e, f)" company-candidates)))))
+
+(ert-deftest eglot-test-eldoc-after-completions ()
+  "Test documentation echo in a python LSP."
+  (skip-unless (executable-find "pylsp"))
+  (eglot--with-fixture
+      `(("project" . (("something.py" . "import sys\nsys.exi"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.py")
+      (should (eglot--tests-connect))
+      (goto-char (point-max))
+      (completion-at-point)
+      (should (looking-back "sys.exit"))
+      (should (string-match "^exit" (eglot--tests-force-full-eldoc))))))
+
+(ert-deftest eglot-test-multiline-eldoc ()
+  "Test if suitable amount of lines of hover info are shown."
+  (skip-unless (executable-find "pylsp"))
+  (eglot--with-fixture
+      `(("project" . (("hover-first.py" . "from datetime import datetime"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/hover-first.py")
+      (should (eglot--tests-connect))
+      (goto-char (point-max))
+      ;; one-line
+      (let* ((eldoc-echo-area-use-multiline-p t)
+             (captured-message (eglot--tests-force-full-eldoc)))
+        (should (string-match "datetim" captured-message))
+        (should (cl-find ?\n captured-message))))))
+
+(ert-deftest eglot-test-single-line-eldoc ()
+  "Test if suitable amount of lines of hover info are shown."
+  (skip-unless (executable-find "pylsp"))
+  (eglot--with-fixture
+      `(("project" . (("hover-first.py" . "from datetime import datetime"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/hover-first.py")
+      (should (eglot--tests-connect))
+      (goto-char (point-max))
+      ;; one-line
+      (let* ((eldoc-echo-area-use-multiline-p nil)
+             (captured-message (eglot--tests-force-full-eldoc)))
+        (should (string-match "datetim" captured-message))
+        (should (not (cl-find ?\n eldoc-last-message)))))))
+
+(ert-deftest eglot-test-python-autopep-formatting ()
+  "Test formatting in the pylsp python LSP.
+pylsp prefers autopep over yafp, despite its README stating the contrary."
+  ;; Beware, default autopep rules can change over time, which may
+  ;; affect this test.
+  (skip-unless (and (executable-find "pylsp")
+                    (executable-find "autopep8")))
+  (eglot--with-fixture
+      `(("project" . (("something.py" . "def a():pass\n\ndef b():pass"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.py")
+      (should (eglot--tests-connect))
+      ;; Try to format just the second line
+      (search-forward "b():pa")
+      (eglot-format (line-beginning-position) (line-end-position))
+      (should (looking-at "ss"))
+      (should
+       (or (string= (buffer-string) "def a():pass\n\n\ndef b(): pass\n")
+           ;; autopep8 2.0.0 (pycodestyle: 2.9.1)
+           (string= (buffer-string) "def a():pass\n\ndef b(): pass")))
+      ;; now format the whole buffer
+      (eglot-format-buffer)
+      (should
+       (string= (buffer-string) "def a(): pass\n\n\ndef b(): pass\n")))))
+
+(ert-deftest eglot-test-python-yapf-formatting ()
+  "Test formatting in the pylsp python LSP."
+  (skip-unless (and (executable-find "pylsp")
+                    (not (executable-find "autopep8"))
+                    (or (executable-find "yapf")
+                        (executable-find "yapf3"))))
+  (eglot--with-fixture
+      `(("project" . (("something.py" . "def a():pass\ndef b():pass"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.py")
+      (should (eglot--tests-connect))
+      ;; Try to format just the second line
+      (search-forward "b():pa")
+      (eglot-format (line-beginning-position) (line-end-position))
+      (should (looking-at "ss"))
+      (should
+       (string= (buffer-string) "def a():pass\n\n\ndef b():\n    pass\n"))
+      ;; now format the whole buffer
+      (eglot-format-buffer)
+      (should
+       (string= (buffer-string) "def a():\n    pass\n\n\ndef b():\n    
pass\n")))))
+
+(ert-deftest eglot-test-rust-on-type-formatting ()
+  "Test textDocument/onTypeFormatting against rust-analyzer."
+  (skip-unless (executable-find "rust-analyzer"))
+  (skip-unless (executable-find "cargo"))
+  (eglot--with-fixture
+      '(("on-type-formatting-project" .
+         (("main.rs" .
+           "fn main() -> () {\n  foo\n    .bar()\n  "))))
+    (with-current-buffer
+        (eglot--find-file-noselect "on-type-formatting-project/main.rs")
+      (let ((eglot-server-programs '((rust-mode . ("rust-analyzer")))))
+        (should (zerop (shell-command "cargo init")))
+        (eglot--sniffing (:server-notifications s-notifs)
+          (should (eglot--tests-connect))
+          (eglot--wait-for (s-notifs 10) (&key method &allow-other-keys)
+             (string= method "textDocument/publishDiagnostics")))
+        (goto-char (point-max))
+        (eglot--simulate-key-event ?.)
+        (should (looking-back "^    \\."))))))
+
+(ert-deftest eglot-test-javascript-basic ()
+  "Test basic autocompletion in a JavaScript LSP."
+  (skip-unless (and (executable-find "typescript-language-server")
+                    (executable-find "tsserver")))
+  (eglot--with-fixture
+      '(("project" . (("hello.js" . "console.log('Hello world!');"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/hello.js")
+      (let ((eglot-server-programs
+             '((js-mode . ("typescript-language-server" "--stdio")))))
+        (goto-char (point-max))
+        (eglot--sniffing (:server-notifications
+                          s-notifs
+                          :client-notifications
+                          c-notifs)
+          (should (eglot--tests-connect))
+          (eglot--wait-for (s-notifs 2) (&key method &allow-other-keys)
+            (string= method "textDocument/publishDiagnostics"))
+          (should (not (eq 'flymake-error (face-at-point))))
+          (insert "{")
+          (eglot--signal-textDocument/didChange)
+          (eglot--wait-for (c-notifs 1) (&key method &allow-other-keys)
+            (string= method "textDocument/didChange"))
+          (eglot--wait-for (s-notifs 2) (&key params method &allow-other-keys)
+            (and (string= method "textDocument/publishDiagnostics")
+                 (cl-destructuring-bind (&key _uri diagnostics) params
+                   (cl-find-if (jsonrpc-lambda (&key severity 
&allow-other-keys)
+                                 (= severity 1))
+                               diagnostics)))))))))
+
+(ert-deftest eglot-test-project-wide-diagnostics-typescript ()
+  "Test diagnostics through multiple files in a TypeScript LSP."
+  (skip-unless (and (executable-find "typescript-language-server")
+                    (executable-find "tsserver")))
+  (eglot--with-fixture
+      '(("project" . (("hello.ts" . "const thing = 5;\nexport { thin }")
+                      ("hello2.ts" . "import { thing } from './hello'"))))
+    (eglot--make-file-or-dir '(".git"))
+    (let ((eglot-server-programs
+           '((typescript-mode . ("typescript-language-server" "--stdio")))))
+      ;; Check both files because typescript-language-server doesn't
+      ;; report all errors on startup, at least not with such a simple
+      ;; setup.
+      (with-current-buffer (eglot--find-file-noselect "project/hello2.ts")
+        (eglot--sniffing (:server-notifications s-notifs)
+          (eglot--tests-connect)
+          (flymake-start)
+          (eglot--wait-for (s-notifs 10)
+              (&key _id method &allow-other-keys)
+            (string= method "textDocument/publishDiagnostics"))
+          (should (= 2 (length (flymake--project-diagnostics)))))
+        (with-current-buffer (eglot--find-file-noselect "hello.ts")
+          (eglot--sniffing (:server-notifications s-notifs)
+            (flymake-start)
+            (eglot--wait-for (s-notifs 10)
+                (&key _id method &allow-other-keys)
+              (string= method "textDocument/publishDiagnostics"))
+            (should (= 4 (length (flymake--project-diagnostics))))))))))
+
+(ert-deftest eglot-test-project-wide-diagnostics-rust-analyzer ()
+  "Test diagnostics through multiple files in a TypeScript LSP."
+  (skip-unless (executable-find "rust-analyzer"))
+  (skip-unless (executable-find "cargo"))
+  (eglot--with-fixture
+      '(("project" .
+         (("main.rs" .
+           "fn main() -> () { let test=3; }")
+          ("other-file.rs" .
+           "fn foo() -> () { let hi=3; }"))))
+    (eglot--make-file-or-dir '(".git"))
+    (let ((eglot-server-programs '((rust-mode . ("rust-analyzer")))))
+      ;; Open other-file, and see diagnostics arrive for main.rs
+      (with-current-buffer (eglot--find-file-noselect "project/other-file.rs")
+        (should (zerop (shell-command "cargo init")))
+        (eglot--sniffing (:server-notifications s-notifs)
+          (eglot--tests-connect)
+          (flymake-start)
+          (eglot--wait-for (s-notifs 10)
+              (&key _id method &allow-other-keys)
+            (string= method "textDocument/publishDiagnostics"))
+          (let ((diags (flymake--project-diagnostics)))
+            (should (= 2 (length diags)))
+            ;; Check that we really get a diagnostic from main.rs, and
+            ;; not from other-file.rs
+            (should (string-suffix-p
+                     "main.rs"
+                     (flymake-diagnostic-buffer (car diags))))))))))
+
+(ert-deftest eglot-test-json-basic ()
+  "Test basic autocompletion in vscode-json-languageserver."
+  (skip-unless (executable-find "vscode-json-languageserver"))
+  (eglot--with-fixture
+      '(("project" .
+         (("p.json" . "{\"foo.b")
+          ("s.json" . "{\"properties\":{\"foo.bar\":{\"default\":\"fb\"}}}")
+          (".git" . nil))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/p.json")
+      (yas-minor-mode)
+      (goto-char 2)
+      (insert "\"$schema\": \"file://"
+              (file-name-directory buffer-file-name) "s.json\",")
+      (let ((eglot-server-programs
+             '((js-mode . ("vscode-json-languageserver" "--stdio")))))
+        (goto-char (point-max))
+        (should (eglot--tests-connect))
+        (completion-at-point)
+        (should (looking-back "\"foo.bar\": \""))
+        (should (looking-at "fb\"$"))))))
+
+(defun eglot-tests--lsp-abiding-column-1 ()
+  (eglot--with-fixture
+      '(("project" .
+         (("foo.c" . "const char write_data[] = 
u8\"🚂🚃🚄🚅🚆🚈🚇🚈🚉🚊🚋🚌🚎🚝🚞🚟🚠🚡🛤🛲\";"))))
+    (let ((eglot-server-programs
+           '((c-mode . ("clangd")))))
+      (with-current-buffer
+          (eglot--find-file-noselect "project/foo.c")
+        (setq-local eglot-move-to-column-function 
#'eglot-move-to-lsp-abiding-column)
+        (setq-local eglot-current-column-function #'eglot-lsp-abiding-column)
+        (eglot--sniffing (:client-notifications c-notifs)
+          (eglot--tests-connect)
+          (end-of-line)
+          (insert "p ")
+          (eglot--signal-textDocument/didChange)
+          (eglot--wait-for (c-notifs 2) (&key params &allow-other-keys)
+            (should (equal 71 (cadddr (cadadr (aref (cadddr params) 0))))))
+          (beginning-of-line)
+          (should (eq eglot-move-to-column-function 
#'eglot-move-to-lsp-abiding-column))
+          (funcall eglot-move-to-column-function 71)
+          (should (looking-at "p")))))))
+
+(ert-deftest eglot-test-lsp-abiding-column ()
+  "Test basic `eglot-lsp-abiding-column' and 
`eglot-move-to-lsp-abiding-column'."
+  (skip-unless (executable-find "clangd"))
+  (eglot-tests--lsp-abiding-column-1))
+
+(ert-deftest eglot-test-ensure ()
+  "Test basic `eglot-ensure' functionality."
+  (skip-unless (executable-find "clangd"))
+  (eglot--with-fixture
+      `(("project" . (("foo.c" . "int foo() {return 42;}")
+                      ("bar.c" . "int bar() {return 42;}")))
+        (c-mode-hook (eglot-ensure)))
+    (let (server)
+      ;; need `ert-simulate-command' because `eglot-ensure'
+      ;; relies on `post-command-hook'.
+      (with-current-buffer
+          (ert-simulate-command
+           '(find-file "project/foo.c"))
+        ;; FIXME: This test fails without this sleep on my machine.
+        ;; Figure out why and solve this more cleanly.
+        (sleep-for 0.1)
+        (should (setq server (eglot-current-server))))
+      (with-current-buffer
+          (ert-simulate-command
+           '(find-file "project/bar.c"))
+        (should (eq server (eglot-current-server)))))))
+
+(ert-deftest eglot-test-slow-sync-connection-wait ()
+  "Connect with `eglot-sync-connect' set to t."
+  (skip-unless (executable-find "clangd"))
+  (eglot--with-fixture
+      `(("project" . (("something.c" . "int foo() {return 42;}"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.c")
+      (let ((eglot-sync-connect t)
+            (eglot-server-programs
+             `((c-mode . ("sh" "-c" "sleep 1 && clangd")))))
+        (should (eglot--tests-connect 3))))))
+
+(ert-deftest eglot-test-slow-sync-connection-intime ()
+  "Connect synchronously with `eglot-sync-connect' set to 2."
+  (skip-unless (executable-find "clangd"))
+  (eglot--with-fixture
+      `(("project" . (("something.c" . "int foo() {return 42;}"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.c")
+      (let ((eglot-sync-connect 2)
+            (eglot-server-programs
+             `((c-mode . ("sh" "-c" "sleep 1 && clangd")))))
+        (should (eglot--tests-connect 3))))))
+
+(ert-deftest eglot-test-slow-async-connection ()
+  "Connect asynchronously with `eglot-sync-connect' set to 2."
+  (skip-unless (executable-find "clangd"))
+  (eglot--with-fixture
+      `(("project" . (("something.c" . "int foo() {return 42;}"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.c")
+      (let ((eglot-sync-connect 1)
+            (eglot-server-programs
+             `((c-mode . ("sh" "-c" "sleep 2 && clangd")))))
+        (should-not (apply #'eglot--connect (eglot--guess-contact)))
+        (eglot--with-timeout 3
+          (while (not (eglot-current-server))
+            (accept-process-output nil 0.2))
+          (should (eglot-current-server)))))))
+
+(ert-deftest eglot-test-slow-sync-timeout ()
+  "Failed attempt at connection synchronously."
+  (skip-unless (executable-find "clangd"))
+  (eglot--with-fixture
+      `(("project" . (("something.c" . "int foo() {return 42;}"))))
+    (with-current-buffer
+        (eglot--find-file-noselect "project/something.c")
+      (let ((eglot-sync-connect t)
+            (eglot-connect-timeout 1)
+            (eglot-server-programs
+             `((c-mode . ("sh" "-c" "sleep 2 && clangd")))))
+        (should-error (apply #'eglot--connect (eglot--guess-contact)))))))
+
+(ert-deftest eglot-test-capabilities ()
+  "Unit test for `eglot--server-capable'."
+  (cl-letf (((symbol-function 'eglot--capabilities)
+             (lambda (_dummy)
+               ;; test data lifted from Golangserver example at
+               ;; https://github.com/joaotavora/eglot/pull/74
+               (list :textDocumentSync 2 :hoverProvider t
+                     :completionProvider '(:triggerCharacters ["."])
+                     :signatureHelpProvider '(:triggerCharacters ["(" ","])
+                     :definitionProvider t :typeDefinitionProvider t
+                     :referencesProvider t :documentSymbolProvider t
+                     :workspaceSymbolProvider t :implementationProvider t
+                     :documentFormattingProvider t 
:xworkspaceReferencesProvider t
+                     :xdefinitionProvider t :xworkspaceSymbolByProperties t)))
+            ((symbol-function 'eglot--current-server-or-lose)
+             (lambda () nil)))
+    (should (eql 2 (eglot--server-capable :textDocumentSync)))
+    (should (eglot--server-capable :completionProvider :triggerCharacters))
+    (should (equal '(:triggerCharacters ["."]) (eglot--server-capable 
:completionProvider)))
+    (should-not (eglot--server-capable :foobarbaz))
+    (should-not (eglot--server-capable :textDocumentSync :foobarbaz))))
+
+(defmacro eglot--without-interface-warnings (&rest body)
+  (let ((eglot-strict-mode nil))
+    (macroexpand-all (macroexp-progn body) macroexpand-all-environment)))
+
+(ert-deftest eglot-test-strict-interfaces ()
+  (let ((eglot--lsp-interface-alist
+         `((FooObject . ((:foo :bar) (:baz))))))
+    (eglot--without-interface-warnings
+     (should
+      (equal '("foo" . "bar")
+             (let ((eglot-strict-mode nil))
+               (eglot--dbind (foo bar) `(:foo "foo" :bar "bar")
+                 (cons foo bar)))))
+     (should-error
+      (let ((eglot-strict-mode '(disallow-non-standard-keys)))
+        (eglot--dbind (foo bar) `(:foo "foo" :bar "bar" :fotrix bargh)
+          (cons foo bar))))
+     (should
+      (equal '("foo" . "bar")
+             (let ((eglot-strict-mode nil))
+               (eglot--dbind (foo bar) `(:foo "foo" :bar "bar" :fotrix bargh)
+                 (cons foo bar)))))
+     (should-error
+      (let ((eglot-strict-mode '(disallow-non-standard-keys)))
+        (eglot--dbind ((FooObject) foo bar) `(:foo "foo" :bar "bar" :fotrix 
bargh)
+          (cons foo bar))))
+     (should
+      (equal '("foo" . "bar")
+             (let ((eglot-strict-mode '(disallow-non-standard-keys)))
+               (eglot--dbind ((FooObject) foo bar) `(:foo "foo" :bar "bar" 
:baz bargh)
+                 (cons foo bar)))))
+     (should
+      (equal '("foo" . nil)
+             (let ((eglot-strict-mode nil))
+               (eglot--dbind ((FooObject) foo bar) `(:foo "foo" :baz bargh)
+                 (cons foo bar)))))
+     (should
+      (equal '("foo" . "bar")
+             (let ((eglot-strict-mode '(enforce-required-keys)))
+               (eglot--dbind ((FooObject) foo bar) `(:foo "foo" :bar "bar" 
:baz bargh)
+                 (cons foo bar)))))
+     (should-error
+      (let ((eglot-strict-mode '(enforce-required-keys)))
+        (eglot--dbind ((FooObject) foo bar) `(:foo "foo" :baz bargh)
+          (cons foo bar)))))))
+
+(ert-deftest eglot-test-dcase ()
+  (eglot--without-interface-warnings
+   (let ((eglot--lsp-interface-alist
+          `((FooObject . ((:foo :bar) (:baz)))
+            (CodeAction (:title) (:kind :diagnostics :edit :command))
+            (Command ((:title . string) (:command . string)) (:arguments)))))
+     (should
+      (equal
+       "foo"
+       (eglot--dcase `(:foo "foo" :bar "bar")
+         (((FooObject) foo)
+          foo))))
+     (should
+      (equal
+       (list "foo" '(:title "hey" :command "ho") "some edit")
+       (eglot--dcase '(:title "foo"
+                              :command (:title "hey" :command "ho")
+                              :edit "some edit")
+         (((Command) _title _command _arguments)
+          (ert-fail "Shouldn't have destructured this object as a Command"))
+         (((CodeAction) title edit command)
+          (list title command edit)))))
+     (should
+      (equal
+       (list "foo" "some command" nil)
+       (eglot--dcase '(:title "foo" :command "some command")
+         (((Command) title command arguments)
+          (list title command arguments))
+         (((CodeAction) _title _edit _command)
+          (ert-fail "Shouldn't have destructured this object as a 
CodeAction"))))))))
+
+(ert-deftest eglot-test-dcase-issue-452 ()
+  (let ((eglot--lsp-interface-alist
+         `((FooObject . ((:foo :bar) (:baz)))
+           (CodeAction (:title) (:kind :diagnostics :edit :command))
+           (Command ((string . :title) (:command . string)) (:arguments)))))
+    (should
+     (equal
+      (list "foo" '(:command "cmd" :title "alsofoo"))
+      (eglot--dcase '(:title "foo" :command (:command "cmd" :title "alsofoo"))
+        (((Command) _title _command _arguments)
+         (ert-fail "Shouldn't have destructured this object as a Command"))
+        (((CodeAction) title command)
+         (list title command)))))))
+
+(cl-defmacro eglot--guessing-contact ((interactive-sym
+                                       prompt-args-sym
+                                       guessed-class-sym guessed-contact-sym
+                                       &optional guessed-lang-id-sym)
+                                      &body body)
+  "Guess LSP contact with `eglot--guessing-contact', evaluate BODY.
+
+BODY is evaluated twice, with INTERACTIVE bound to the boolean passed to
+`eglot--guess-contact' each time.
+
+If the user would have been prompted, PROMPT-ARGS-SYM is bound to
+the list of arguments that would have been passed to
+`read-shell-command', else nil.  GUESSED-CLASS-SYM,
+GUESSED-CONTACT-SYM and GUESSED-LANG-ID-SYM are bound to the
+useful return values of `eglot--guess-contact'.  Unless the
+server program evaluates to \"a-missing-executable.exe\", this
+macro will assume it exists."
+  (declare (indent 1) (debug t))
+  (let ((i-sym (cl-gensym)))
+    `(dolist (,i-sym '(nil t))
+       (let ((,interactive-sym ,i-sym)
+             (buffer-file-name "_")
+             ,@(when prompt-args-sym `((,prompt-args-sym nil))))
+         (cl-letf (((symbol-function 'executable-find)
+                    (lambda (name &optional _remote)
+                      (unless (string-equal name "a-missing-executable.exe")
+                        (format "/totally-mock-bin/%s" name))))
+                   ((symbol-function 'read-shell-command)
+                    ,(if prompt-args-sym
+                         `(lambda (&rest args) (setq ,prompt-args-sym args) "")
+                       `(lambda (&rest _dummy) ""))))
+           (cl-destructuring-bind
+               (_ _ ,guessed-class-sym ,guessed-contact-sym
+                  ,(or guessed-lang-id-sym '_))
+               (eglot--guess-contact ,i-sym)
+             ,@body))))))
+
+(ert-deftest eglot-test-server-programs-simple-executable ()
+  (let ((eglot-server-programs '((foo-mode "some-executable")))
+        (major-mode 'foo-mode))
+    (eglot--guessing-contact (_ prompt-args guessed-class guessed-contact)
+      (should (not prompt-args))
+      (should (equal guessed-class 'eglot-lsp-server))
+      (should (equal guessed-contact '("some-executable"))))))
+
+(ert-deftest eglot-test-server-programs-simple-missing-executable ()
+  (let ((eglot-server-programs '((foo-mode "a-missing-executable.exe")))
+        (major-mode 'foo-mode))
+    (eglot--guessing-contact (interactive-p prompt-args guessed-class 
guessed-contact)
+      (should (equal (not prompt-args) (not interactive-p)))
+      (should (equal guessed-class 'eglot-lsp-server))
+      (should (or prompt-args
+                  (equal guessed-contact '("a-missing-executable.exe")))))))
+
+(ert-deftest eglot-test-server-programs-executable-multiple-major-modes ()
+  (let ((eglot-server-programs '(((bar-mode foo-mode) "some-executable")))
+        (major-mode 'foo-mode))
+    (eglot--guessing-contact (_ prompt-args guessed-class guessed-contact)
+      (should (not prompt-args))
+      (should (equal guessed-class 'eglot-lsp-server))
+      (should (equal guessed-contact '("some-executable"))))))
+
+(ert-deftest eglot-test-server-programs-executable-with-arg ()
+  (let ((eglot-server-programs '((foo-mode "some-executable" "arg1")))
+        (major-mode 'foo-mode))
+    (eglot--guessing-contact (_ prompt-args guessed-class guessed-contact)
+      (should (not prompt-args))
+      (should (equal guessed-class 'eglot-lsp-server))
+      (should (equal guessed-contact '("some-executable" "arg1"))))))
+
+(ert-deftest eglot-test-server-programs-executable-with-args-and-autoport ()
+  (let ((eglot-server-programs '((foo-mode "some-executable" "arg1"
+                                           :autoport "arg2")))
+        (major-mode 'foo-mode))
+    (eglot--guessing-contact (_ prompt-args guessed-class guessed-contact)
+      (should (not prompt-args))
+      (should (equal guessed-class 'eglot-lsp-server))
+      (should (equal guessed-contact '("some-executable" "arg1"
+                                       :autoport "arg2"))))))
+
+(ert-deftest eglot-test-server-programs-host-and-port ()
+  (let ((eglot-server-programs '((foo-mode "somehost.example.com" 7777)))
+        (major-mode 'foo-mode))
+    (eglot--guessing-contact (_ prompt-args guessed-class guessed-contact)
+      (should (not prompt-args))
+      (should (equal guessed-class 'eglot-lsp-server))
+      (should (equal guessed-contact '("somehost.example.com" 7777))))))
+
+(ert-deftest eglot-test-server-programs-host-and-port-and-tcp-args ()
+  (let ((eglot-server-programs '((foo-mode "somehost.example.com" 7777
+                                           :type network)))
+        (major-mode 'foo-mode))
+    (eglot--guessing-contact (_ prompt-args guessed-class guessed-contact)
+      (should (not prompt-args))
+      (should (equal guessed-class 'eglot-lsp-server))
+      (should (equal guessed-contact '("somehost.example.com" 7777
+                                       :type network))))))
+
+(ert-deftest eglot-test-server-programs-class-name-and-plist ()
+  (let ((eglot-server-programs '((foo-mode bar-class :init-key init-val)))
+        (major-mode 'foo-mode))
+    (eglot--guessing-contact (_ prompt-args guessed-class guessed-contact)
+      (should (not prompt-args))
+      (should (equal guessed-class 'bar-class))
+      (should (equal guessed-contact '(:init-key init-val))))))
+
+(ert-deftest eglot-test-server-programs-class-name-and-contact-spec ()
+  (let ((eglot-server-programs '((foo-mode bar-class "some-executable" "arg1"
+                                           :autoport "arg2")))
+        (major-mode 'foo-mode))
+    (eglot--guessing-contact (_ prompt-args guessed-class guessed-contact)
+      (should (not prompt-args))
+      (should (equal guessed-class 'bar-class))
+      (should (equal guessed-contact '("some-executable" "arg1"
+                                       :autoport "arg2"))))))
+
+(ert-deftest eglot-test-server-programs-function ()
+  (let ((eglot-server-programs '((foo-mode . (lambda (&optional _)
+                                               '("some-executable")))))
+        (major-mode 'foo-mode))
+    (eglot--guessing-contact (_ prompt-args guessed-class guessed-contact)
+      (should (not prompt-args))
+      (should (equal guessed-class 'eglot-lsp-server))
+      (should (equal guessed-contact '("some-executable"))))))
+
+(ert-deftest eglot-test-server-programs-guess-lang ()
+  (let ((major-mode 'foo-mode))
+    (let ((eglot-server-programs '((foo-mode . ("prog-executable")))))
+      (eglot--guessing-contact (_ nil _ _ guessed-lang)
+        (should (equal guessed-lang "foo"))))
+    (let ((eglot-server-programs '(((foo-mode :language-id "bar")
+                                    . ("prog-executable")))))
+      (eglot--guessing-contact (_ nil _ _ guessed-lang)
+        (should (equal guessed-lang "bar"))))
+    (let ((eglot-server-programs '(((baz-mode (foo-mode :language-id "bar"))
+                                    . ("prog-executable")))))
+      (eglot--guessing-contact (_ nil _ _ guessed-lang)
+        (should (equal guessed-lang "bar"))))))
+
+(defun eglot--glob-match (glob str)
+  (funcall (eglot--glob-compile glob t t) str))
+
+(ert-deftest eglot-test-glob-test ()
+  (should (eglot--glob-match "foo/**/baz" "foo/bar/baz"))
+  (should (eglot--glob-match "foo/**/baz" "foo/baz"))
+  (should-not (eglot--glob-match "foo/**/baz" "foo/bar"))
+  (should (eglot--glob-match "foo/**/baz/**/quuz" "foo/baz/foo/quuz"))
+  (should (eglot--glob-match "foo/**/baz/**/quuz" "foo/foo/foo/baz/foo/quuz"))
+  (should-not (eglot--glob-match "foo/**/baz/**/quuz" 
"foo/foo/foo/ding/foo/quuz"))
+  (should (eglot--glob-match "*.js" "foo.js"))
+  (should-not (eglot--glob-match "*.js" "foo.jsx"))
+  (should (eglot--glob-match "foo/**/*.js" "foo/bar/baz/foo.js"))
+  (should-not (eglot--glob-match "foo/**/*.js" "foo/bar/baz/foo.jsx"))
+  (should (eglot--glob-match "*.{js,ts}" "foo.js"))
+  (should-not (eglot--glob-match "*.{js,ts}" "foo.xs"))
+  (should (eglot--glob-match "foo/**/*.{js,ts}" "foo/bar/baz/foo.ts"))
+  (should (eglot--glob-match "foo/**/*.{js,ts}x" "foo/bar/baz/foo.tsx"))
+  (should (eglot--glob-match "?oo.js" "foo.js"))
+  (should (eglot--glob-match "foo/**/*.{js,ts}?" "foo/bar/baz/foo.tsz"))
+  (should (eglot--glob-match "foo/**/*.{js,ts}?" "foo/bar/baz/foo.tsz"))
+  (should (eglot--glob-match "example.[!0-9]" "example.a"))
+  (should-not (eglot--glob-match "example.[!0-9]" "example.0"))
+  (should (eglot--glob-match "example.[0-9]" "example.0"))
+  (should-not (eglot--glob-match "example.[0-9]" "example.a"))
+  (should (eglot--glob-match "**/bar/" "foo/bar/"))
+  (should-not (eglot--glob-match "foo.hs" "fooxhs"))
+
+  ;; Some more tests
+  (should (eglot--glob-match "**/.*" ".git"))
+  (should (eglot--glob-match ".?" ".o"))
+  (should (eglot--glob-match "**/.*" ".hidden.txt"))
+  (should (eglot--glob-match "**/.*" "path/.git"))
+  (should (eglot--glob-match "**/.*" "path/.hidden.txt"))
+  (should (eglot--glob-match "**/node_modules/**" "node_modules/"))
+  (should (eglot--glob-match "{foo,bar}/**" "foo/test"))
+  (should (eglot--glob-match "{foo,bar}/**" "bar/test"))
+  (should (eglot--glob-match "some/**/*" "some/foo.js"))
+  (should (eglot--glob-match "some/**/*" "some/folder/foo.js"))
+
+  ;; VSCode supposedly supports this, not sure if good idea.
+  ;;
+  ;; (should (eglot--glob-match "**/node_modules/**" "node_modules"))
+  ;; (should (eglot--glob-match "{foo,bar}/**" "foo"))
+  ;; (should (eglot--glob-match "{foo,bar}/**" "bar"))
+
+  ;; VSCode also supports nested blobs.  Do we care?
+  ;;
+  ;; (should (eglot--glob-match "{**/*.d.ts,**/*.js}" "/testing/foo.js"))
+  ;; (should (eglot--glob-match "{**/*.d.ts,**/*.js}" "testing/foo.d.ts"))
+  ;; (should (eglot--glob-match "{**/*.d.ts,**/*.js,foo.[0-9]}" "foo.5"))
+  ;; (should (eglot--glob-match "prefix/{**/*.d.ts,**/*.js,foo.[0-9]}" 
"prefix/foo.8"))
+  )
+
+(defvar tramp-histfile-override)
+(defun eglot--call-with-tramp-test (fn)
+  ;; Set up a Tramp method that’s just a shell so the remote host is
+  ;; really just the local host.
+  (let* ((tramp-remote-path (cons 'tramp-own-remote-path tramp-remote-path))
+         (tramp-histfile-override t)
+         (tramp-verbose 1)
+         (temporary-file-directory ert-remote-temporary-file-directory)
+         (default-directory temporary-file-directory))
+    ;; We must check the remote LSP server.  So far, just "clangd" is used.
+    (unless (executable-find "clangd" 'remote)
+      (ert-skip "Remote clangd not found"))
+    (funcall fn)))
+
+(ert-deftest eglot-test-tramp-test ()
+  "Ensure LSP servers can be used over TRAMP."
+  :tags '(:expensive-test)
+  (eglot--call-with-tramp-test #'eglot-tests--auto-detect-running-server-1))
+
+(ert-deftest eglot-test-tramp-test-2 ()
+  "Ensure LSP servers can be used over TRAMP."
+  :tags '(:expensive-test)
+  (eglot--call-with-tramp-test #'eglot-tests--lsp-abiding-column-1))
+
+(ert-deftest eglot-test-path-to-uri-windows ()
+  (skip-unless (eq system-type 'windows-nt))
+  (should (string-prefix-p "file:///"
+                             (eglot--path-to-uri "c:/Users/Foo/bar.lisp")))
+  (should (string-suffix-p "c%3A/Users/Foo/bar.lisp"
+                           (eglot--path-to-uri "c:/Users/Foo/bar.lisp"))))
+
+(ert-deftest eglot-test-same-server-multi-mode ()
+  "Check single LSP instance manages multiple modes in same project."
+  (skip-unless (executable-find "clangd"))
+  (let (server)
+    (eglot--with-fixture
+        `(("project" . (("foo.cpp" .
+                         "#include \"foolib.h\"
+                        int main() { return foo(); }")
+                        ("foolib.h" .
+                         "#ifdef __cplusplus\nextern \"C\" {\n#endif
+                        int foo();
+                        #ifdef __cplusplus\n}\n#endif")
+                        ("foolib.c" .
+                         "#include \"foolib.h\"
+                        int foo() {return 42;}"))))
+      (with-current-buffer
+          (eglot--find-file-noselect "project/foo.cpp")
+        (should (setq server (eglot--tests-connect))))
+      (with-current-buffer
+          (eglot--find-file-noselect "project/foolib.h")
+        (should (eq (eglot-current-server) server)))
+      (with-current-buffer
+          (eglot--find-file-noselect "project/foolib.c")
+        (should (eq (eglot-current-server) server))))))
+
+(provide 'eglot-tests)
+;;; eglot-tests.el ends here
+
+;; Local Variables:
+;; checkdoc-force-docstrings-flag: nil
+;; End:
diff --git a/test/lisp/progmodes/project-resources/.dir-locals.el 
b/test/lisp/progmodes/project-resources/.dir-locals.el
new file mode 100644
index 0000000000..a311b7efa9
--- /dev/null
+++ b/test/lisp/progmodes/project-resources/.dir-locals.el
@@ -0,0 +1 @@
+((nil . ((project-vc-ignores . ("etc")))))
diff --git a/test/lisp/progmodes/project-resources/etc 
b/test/lisp/progmodes/project-resources/etc
new file mode 100644
index 0000000000..dd7999bd3d
--- /dev/null
+++ b/test/lisp/progmodes/project-resources/etc
@@ -0,0 +1 @@
+etc
\ No newline at end of file
diff --git a/test/lisp/progmodes/project-resources/foo 
b/test/lisp/progmodes/project-resources/foo
new file mode 100644
index 0000000000..1910281566
--- /dev/null
+++ b/test/lisp/progmodes/project-resources/foo
@@ -0,0 +1 @@
+foo
\ No newline at end of file
diff --git a/test/lisp/progmodes/project-tests.el 
b/test/lisp/progmodes/project-tests.el
index d4b6bca7e8..8814f30b04 100644
--- a/test/lisp/progmodes/project-tests.el
+++ b/test/lisp/progmodes/project-tests.el
@@ -41,7 +41,7 @@ quoted directory names (Bug#47799)."
   (skip-unless (executable-find "grep"))
   (ert-with-temp-directory directory
     (let ((default-directory directory)
-          (project-current-inhibit-prompt t)
+          (project-current-directory-override t)
           (project-find-functions nil)
           (project-list-file
            (expand-file-name "projects" directory))
@@ -110,4 +110,46 @@ When `project-ignores' includes a name matching project 
dir."
                      (list
                       (expand-file-name "some-file" dir)))))))
 
+(defvar project-tests--this-file (or (bound-and-true-p 
byte-compile-current-file)
+                                     (and load-in-progress load-file-name)
+                                     buffer-file-name))
+
+(ert-deftest project-vc-recognizes-git ()
+  "Check that Git repository is detected."
+  (skip-unless (eq (vc-responsible-backend default-directory) 'Git))
+  (let* ((vc-handled-backends '(Git))
+         (dir (file-name-directory project-tests--this-file))
+         (_ (vc-file-clearprops dir))
+         (project-vc-extra-root-markers nil)
+         (project (project-current nil dir)))
+    (should-not (null project))
+    (should (string-match-p
+             "\\`test/lisp/progmodes/project-tests\\.elc?"
+             (file-relative-name
+              project-tests--this-file
+              (project-root project))))))
+
+(ert-deftest project-vc-extra-root-markers-supports-wildcards ()
+  "Check that one can add wildcard entries."
+  (skip-unless (eq (vc-responsible-backend default-directory) 'Git))
+  (let* ((dir (file-name-directory project-tests--this-file))
+         (_ (vc-file-clearprops dir))
+         (project-vc-extra-root-markers '("files-x-tests.*"))
+         (project (project-current nil dir)))
+    (should-not (null project))
+    (should (string-match-p "/test/lisp/\\'" (project-root project)))))
+
+(ert-deftest project-vc-supports-project-in-different-dir ()
+  "Check that it picks up dir-locals settings from somewhere else."
+  (skip-unless (eq (vc-responsible-backend default-directory) 'Git))
+  (let* ((dir (ert-resource-directory))
+         (_ (vc-file-clearprops dir))
+         (project-vc-extra-root-markers '(".dir-locals.el"))
+         (project (project-current nil dir)))
+    (should-not (null project))
+    (should (string-match-p "/test/lisp/progmodes/project-resources/\\'" 
(project-root project)))
+    (should (member "etc" (project-ignores project dir)))
+    (should (equal '(".dir-locals.el" "foo")
+                   (mapcar #'file-name-nondirectory (project-files 
project))))))
+
 ;;; project-tests.el ends here
diff --git a/test/lisp/progmodes/python-tests.el 
b/test/lisp/progmodes/python-tests.el
index f871b7bc7d..17d6d8aa70 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -280,28 +280,33 @@ aliqua."
    "a, b, c = 1, 2, 3"
    '((1 . font-lock-variable-name-face) (2)
      (4 . font-lock-variable-name-face) (5)
-     (7 . font-lock-variable-name-face) (8))))
+     (7 . font-lock-variable-name-face) (8)
+     (9 . font-lock-operator-face) (10))))
 
 (ert-deftest python-font-lock-assignment-statement-2 ()
   (python-tests-assert-faces
    "a, *b, c = 1, 2, 3, 4, 5"
    '((1 . font-lock-variable-name-face) (2)
+     (4 . font-lock-operator-face)
      (5 . font-lock-variable-name-face) (6)
-     (8 . font-lock-variable-name-face) (9))))
+     (8 . font-lock-variable-name-face) (9)
+     (10 . font-lock-operator-face) (11))))
 
 (ert-deftest python-font-lock-assignment-statement-3 ()
   (python-tests-assert-faces
    "[a, b] = (1, 2)"
    '((1)
      (2 . font-lock-variable-name-face) (3)
-     (5 . font-lock-variable-name-face) (6))))
+     (5 . font-lock-variable-name-face) (6)
+     (8 . font-lock-operator-face) (9))))
 
 (ert-deftest python-font-lock-assignment-statement-4 ()
   (python-tests-assert-faces
    "(l[1], l[2]) = (10, 11)"
    '((1)
      (2 . font-lock-variable-name-face) (3)
-     (8 . font-lock-variable-name-face) (9))))
+     (8 . font-lock-variable-name-face) (9)
+     (14 . font-lock-operator-face) (15))))
 
 (ert-deftest python-font-lock-assignment-statement-5 ()
   (python-tests-assert-faces
@@ -310,22 +315,29 @@ aliqua."
      (2 . font-lock-variable-name-face) (3)
      (5 . font-lock-variable-name-face) (6)
      (8 . font-lock-variable-name-face) (9)
+     (11 . font-lock-operator-face)
      (12 . font-lock-variable-name-face) (13)
+     (15 . font-lock-operator-face) (16)
+     (17 . font-lock-operator-face)
      (18 . font-lock-variable-name-face) (19)
-     (21 . font-lock-variable-name-face) (22))))
+     (21 . font-lock-variable-name-face) (22)
+     (23 . font-lock-operator-face) (24))))
 
 (ert-deftest python-font-lock-assignment-statement-6 ()
   (python-tests-assert-faces
    "(a,) = 'foo',"
    '((1)
      (2 . font-lock-variable-name-face) (3)
+     (6 . font-lock-operator-face) (7)
      (8 . font-lock-string-face) (13))))
 
 (ert-deftest python-font-lock-assignment-statement-7 ()
   (python-tests-assert-faces
    "(*a,) = ['foo', 'bar', 'baz']"
    '((1)
+     (2 . font-lock-operator-face)
      (3 . font-lock-variable-name-face) (4)
+     (7 . font-lock-operator-face) (8)
      (10 . font-lock-string-face) (15)
      (17 . font-lock-string-face) (22)
      (24 . font-lock-string-face) (29))))
@@ -334,6 +346,7 @@ aliqua."
   (python-tests-assert-faces
    "d = D('a', ['b'], 'c')"
    '((1 . font-lock-variable-name-face) (2)
+     (3 . font-lock-operator-face) (4)
      (7 . font-lock-string-face) (10)
      (13 . font-lock-string-face) (16)
      (19 . font-lock-string-face) (22))))
@@ -344,7 +357,9 @@ aliqua."
    '((1)
      (3 . font-lock-variable-name-face) (4)
      (8 . font-lock-variable-name-face) (9)
+     (14 . font-lock-operator-face) (15)
      (17 . font-lock-variable-name-face) (18)
+     (19 . font-lock-operator-face) (20)
      (21 . font-lock-string-face) (24)
      (26 . font-lock-string-face) (29)
      (31 . font-lock-string-face) (34)
@@ -355,7 +370,8 @@ aliqua."
   (python-tests-assert-faces
    "a: int = 5"
    '((1 . font-lock-variable-name-face) (2)
-     (4 . font-lock-builtin-face) (7))))
+     (4 . font-lock-builtin-face) (7)
+     (8 . font-lock-operator-face) (9))))
 
 (ert-deftest python-font-lock-assignment-statement-11 ()
   (python-tests-assert-faces
@@ -364,13 +380,15 @@ aliqua."
      (19 . font-lock-builtin-face) (22)
      (40 . font-lock-builtin-face) (43)
      (46 . font-lock-builtin-face) (49)
+     (52 . font-lock-operator-face) (53)
      (55 . font-lock-constant-face) (59)
      (61 . font-lock-string-face) (66))))
 
 (ert-deftest python-font-lock-assignment-statement-12 ()
   (python-tests-assert-faces
    "c: Collection = {1, 2, 3}"
-   '((1 . font-lock-variable-name-face) (2))))
+   '((1 . font-lock-variable-name-face) (2)
+     (15 . font-lock-operator-face) (16))))
 
 (ert-deftest python-font-lock-assignment-statement-13 ()
   (python-tests-assert-faces
@@ -378,6 +396,7 @@ aliqua."
    '((1 . font-lock-variable-name-face) (2)
      (12 . font-lock-builtin-face) (15)
      (17 . font-lock-builtin-face) (20)
+     (22 . font-lock-operator-face) (23)
      (28 . font-lock-string-face) (33)
      (38 . font-lock-string-face) (43))))
 
@@ -386,28 +405,38 @@ aliqua."
    "(a) = 5; (b) = 6"
    '((1)
      (2 . font-lock-variable-name-face) (3)
-     (11 . font-lock-variable-name-face) (12))))
+     (5 . font-lock-operator-face) (6)
+     (11 . font-lock-variable-name-face) (12)
+     (14 . font-lock-operator-face) (15))))
 
 (ert-deftest python-font-lock-assignment-statement-15 ()
   (python-tests-assert-faces
    "[a] = 5,; [b] = 6,"
    '((1)
      (2 . font-lock-variable-name-face) (3)
-     (12 . font-lock-variable-name-face) (13))))
+     (5 . font-lock-operator-face) (6)
+     (12 . font-lock-variable-name-face) (13)
+     (15 . font-lock-operator-face) (16))))
 
 (ert-deftest python-font-lock-assignment-statement-16 ()
   (python-tests-assert-faces
    "[*a] = 5, 6; [*b] = 7, 8"
    '((1)
+     (2 . font-lock-operator-face)
      (3 . font-lock-variable-name-face) (4)
-     (16 . font-lock-variable-name-face) (17))))
+     (6 . font-lock-operator-face) (7)
+     (15 . font-lock-operator-face)
+     (16 . font-lock-variable-name-face) (17)
+     (19 . font-lock-operator-face) (20))))
 
 (ert-deftest python-font-lock-assignment-statement-17 ()
   (python-tests-assert-faces
    "(a) = (b) = 1"
-   `((1)
+   '((1)
      (2 . font-lock-variable-name-face) (3)
-     (8 . font-lock-variable-name-face) (9))))
+     (5 . font-lock-operator-face) (6)
+     (8 . font-lock-variable-name-face) (9)
+     (11 . font-lock-operator-face) (12))))
 
 (ert-deftest python-font-lock-assignment-statement-18 ()
   (python-tests-assert-faces
@@ -420,13 +449,21 @@ def f(x: CustomInt) -> CustomInt:
     return res
 "
    '((1 . font-lock-variable-name-face) (10)
+     (11 . font-lock-operator-face) (12)
      (13 . font-lock-builtin-face) (16)
      (18 . font-lock-keyword-face) (21)
      (22 . font-lock-function-name-face) (23)
+     (38 . font-lock-operator-face) (40)
      (56 . font-lock-variable-name-face) (57)
+     (58 . font-lock-operator-face) (59)
+     (62 . font-lock-operator-face) (63)
      (70 . font-lock-variable-name-face) (72)
+     (94 . font-lock-operator-face) (95)
+     (102 . font-lock-operator-face) (103)
      (111 . font-lock-variable-name-face) (114)
+     (126 . font-lock-operator-face) (127)
      (128 . font-lock-builtin-face) (131)
+     (136 . font-lock-operator-face) (137)
      (144 . font-lock-keyword-face) (150))))
 
 (ert-deftest python-font-lock-assignment-statement-multiline-1 ()
@@ -442,7 +479,8 @@ def f(x: CustomInt) -> CustomInt:
 "
    '((1)
      (8 . font-lock-variable-name-face) (9)
-     (15 . font-lock-variable-name-face) (16))
+     (15 . font-lock-variable-name-face) (16)
+     (19 . font-lock-operator-face) (20))
    "#" "="))
 
 (ert-deftest python-font-lock-assignment-statement-multiline-2 ()
@@ -453,7 +491,9 @@ def f(x: CustomInt) -> CustomInt:
 ] # 5, 6
 "
    '((1)
-     (9 . font-lock-variable-name-face) (10))
+     (8 . font-lock-operator-face)
+     (9 . font-lock-variable-name-face) (10)
+     (13 . font-lock-operator-face) (14))
    "#" "="))
 
 (ert-deftest python-font-lock-assignment-statement-multiline-3 ()
@@ -471,7 +511,8 @@ def f(x: CustomInt) -> CustomInt:
     3"
    '((1 . font-lock-variable-name-face) (2)
      (15 . font-lock-variable-name-face) (16)
-     (29 . font-lock-variable-name-face) (30))
+     (29 . font-lock-variable-name-face) (30)
+     (36 . font-lock-operator-face) (37))
    "#" "="))
 
 (ert-deftest python-font-lock-assignment-statement-multiline-4 ()
@@ -482,7 +523,8 @@ def f(x: CustomInt) -> CustomInt:
     #\\
     5"
    '((1 . font-lock-variable-name-face) (2)
-     (15 . font-lock-builtin-face) (18))
+     (15 . font-lock-builtin-face) (18)
+     (24 . font-lock-operator-face) (25))
    "#" "="))
 
 (ert-deftest python-font-lock-assignment-statement-multiline-5 ()
@@ -500,7 +542,9 @@ def f(x: CustomInt) -> CustomInt:
     6"
    '((1)
      (8 . font-lock-variable-name-face) (9)
-     (46 . font-lock-variable-name-face) (47))
+     (18 . font-lock-operator-face) (19)
+     (46 . font-lock-variable-name-face) (47)
+     (60 . font-lock-operator-face) (61))
    "#" "="))
 
 (ert-deftest python-font-lock-assignment-statement-multiline-6 ()
@@ -518,9 +562,33 @@ def f(x: CustomInt) -> CustomInt:
     6"
    '((1)
      (7 . font-lock-variable-name-face) (8)
-     (43 . font-lock-variable-name-face) (44))
+     (16 . font-lock-operator-face) (17)
+     (43 . font-lock-variable-name-face) (44)
+     (56 . font-lock-operator-face) (57))
    "#" "="))
 
+(ert-deftest python-font-lock-operator-1 ()
+  (python-tests-assert-faces
+   "1 << 2 ** 3 == +4%-5|~6&7^8%9"
+   '((1)
+     (3 . font-lock-operator-face) (5)
+     (8 . font-lock-operator-face) (10)
+     (13 . font-lock-operator-face) (15)
+     (16 . font-lock-operator-face) (17)
+     (18 . font-lock-operator-face) (20)
+     (21 . font-lock-operator-face) (23)
+     (24 . font-lock-operator-face) (25)
+     (26 . font-lock-operator-face) (27)
+     (28 . font-lock-operator-face) (29))))
+
+(ert-deftest python-font-lock-operator-2 ()
+  "Keyword operators are font-locked as keywords."
+  (python-tests-assert-faces
+   "is_ is None"
+   '((1)
+     (5 . font-lock-keyword-face) (7)
+     (8 . font-lock-constant-face))))
+
 (ert-deftest python-font-lock-escape-sequence-string-newline ()
   (python-tests-assert-faces
    "'\\n'
@@ -603,12 +671,16 @@ u\"\\n\""
      (196 . font-lock-constant-face)
      (215 . font-lock-string-face) (218)
      (221 . font-lock-string-face) (254)
+     (259 . font-lock-operator-face) (260)
      (271 . font-lock-string-face) (274)
      (277 . font-lock-string-face) (310)
+     (315 . font-lock-operator-face) (316)
      (327 . font-lock-string-face) (330)
      (333 . font-lock-string-face) (366)
+     (371 . font-lock-operator-face) (372)
      (383 . font-lock-string-face) (386)
      (389 . font-lock-string-face) (422)
+     (427 . font-lock-operator-face) (428)
      (439 . font-lock-string-face) (442)
      (444 . font-lock-string-face) (497)
      (499 . font-lock-string-face) (552)
@@ -4566,6 +4638,11 @@ import abc
 
 (ert-deftest python-ffap-module-path-1 ()
   (skip-unless (executable-find python-tests-shell-interpreter))
+  ;; Skip the test on macOS, since the standard Python installation uses
+  ;; libedit rather than readline which confuses the running of an inferior
+  ;; interpreter in this case (see bug#59477 and bug#25753).
+  (skip-unless (not (eq system-type 'darwin)))
+  (trace-function 'python-shell-output-filter)
   (python-tests-with-temp-buffer-with-shell
    "
 import abc
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb 
b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
index f39489071e..2451edaee2 100644
--- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb
+++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
@@ -174,6 +174,12 @@ qux :+,
     bar,
     :a
 
+zzz @abc,
+    4
+
+foo a = 5,
+    b
+
 b = $:
 c = ??
 
@@ -500,3 +506,35 @@ def resolve(**args)
 
   member.call(**args)
 end
+
+# Endless methods.
+class Bar
+  def foo(abc) = bar +
+                 baz
+
+  def self.bar =
+    123 +
+    4
+
+  def foo(...) = z
+
+  def request_params = {
+    headers: request_headers,
+    body: request_body
+  }
+
+  def self.foo(
+        baz,
+        bar
+      ) =
+    what
+
+  def foo=(
+        baz,
+        bar
+      )
+    def baz.full_name = "#{bar} 3"
+
+    baz
+  end
+end
diff --git a/test/lisp/progmodes/ruby-mode-tests.el 
b/test/lisp/progmodes/ruby-mode-tests.el
index 33fded5a59..9be01dc78f 100644
--- a/test/lisp/progmodes/ruby-mode-tests.el
+++ b/test/lisp/progmodes/ruby-mode-tests.el
@@ -578,6 +578,45 @@ VALUES-PLIST is a list with alternating index and value 
elements."
     (search-backward "_")
     (should (string= (ruby-add-log-current-method) "M::C#foo"))))
 
+(ert-deftest ruby-add-log-current-method-after-inner-class-outside-methods ()
+  (ruby-with-temp-buffer (ruby-test-string
+                          "module M
+                          |  class C
+                          |    class D
+                          |    end
+                          |
+                          |_
+                          |  end
+                          |end")
+    (search-backward "_")
+    (delete-char 1)
+    (should (string= (ruby-add-log-current-method) "M::C"))))
+
+(ert-deftest 
ruby-add-log-current-method-after-inner-class-outside-methods-with-text ()
+  (ruby-with-temp-buffer (ruby-test-string
+                          "module M
+                          |  class C
+                          |    class D
+                          |    end
+                          |
+                          |    FOO = 5
+                          |  end
+                          |end")
+    (search-backward "FOO")
+    (should (string= (ruby-add-log-current-method) "M::C"))))
+
+(ert-deftest ruby-add-log-current-method-after-endless-method ()
+  (ruby-with-temp-buffer (ruby-test-string
+                          "module M
+                          |  class C
+                          |    def foo =
+                          |      4_
+                          |  end
+                          |end")
+    (search-backward "_")
+    (delete-char 1)
+    (should (string= (ruby-add-log-current-method) "M::C#foo"))))
+
 (defvar ruby-block-test-example
   (ruby-test-string
    "class C
diff --git a/test/lisp/server-tests.el b/test/lisp/server-tests.el
index 351b8ef8d1..5ef66052c8 100644
--- a/test/lisp/server-tests.el
+++ b/test/lisp/server-tests.el
@@ -21,21 +21,205 @@
 
 (require 'ert)
 (require 'server)
+(require 'cl-lib)
+
+(defconst server-tests/can-create-frames-p
+  (and (not (memq system-type '(windows-nt ms-dos)))
+       (not (member (getenv "TERM") '("dumb" "" nil))))
+  "Non-nil if we can create a new frame in the tests.
+Some tests below need to create new frames for the emacsclient.
+However, this doesn't work on all platforms.  In particular,
+MS-Windows fails to create frames from a batch Emacs session.  In
+cases like that, we just skip the test.")
+
+(defconst server-tests/max-wait-time 5
+  "The maximum time to wait in `server-tests/wait-until', in seconds.")
+
+(defconst server-tests/emacsclient
+  (if installation-directory
+      (expand-file-name "lib-src/emacsclient" installation-directory)
+    "emacsclient")
+  "The emacsclient binary to test.")
+
+(defmacro server-tests/wait-until (form)
+  "Wait until FORM is non-nil, timing out and failing if it takes too long."
+  `(let ((start (current-time)))
+    (while (not ,form)
+      (when (> (float-time (time-since start))
+               server-tests/max-wait-time)
+        (ert-fail (format "timed out waiting for %S to be non-nil" ',form)))
+      (sit-for 0.1))))
+
+(defun server-tests/start-client (args)
+  "Run emacsclient, passing ARGS as arguments to it."
+  (let ((server-file (process-get server-process :server-file))
+        (buffer (generate-new-buffer "emacsclient")))
+    (make-process
+     :name server-tests/emacsclient
+     :buffer buffer
+     :command (append (list server-tests/emacsclient
+                            (if server-use-tcp
+                                "--server-file"
+                              "--socket-name")
+                            server-file)
+                      args))))
+
+(defmacro server-tests/with-server (&rest body)
+  "Start the Emacs server, evaluate BODY, and then stop the server."
+  (declare (indent 0))
+  ;; Override the `server-name' so that these tests don't interfere
+  ;; with any existing Emacs servers on the system.
+  `(let* ((temporary-file-directory (file-name-as-directory
+                                     (make-temp-file "server-tests" t)))
+          (server-name (expand-file-name
+                        "test-server" temporary-file-directory))
+          (server-log t))
+     (server-start)
+     (ert-info ((lambda ()
+                  (with-current-buffer (get-buffer-create server-buffer)
+                    (buffer-string)))
+                :prefix "Server logs: ")
+       (unwind-protect
+           (progn (should (processp server-process))
+                  ,@body)
+         (let ((inhibit-message t))
+           (server-start t t))
+         (delete-directory temporary-file-directory t)
+         (should (null server-process))
+         (should (null server-clients))))))
+
+(defmacro server-tests/with-client (client-symbol args exit-status &rest body)
+  "Start an Emacs client with ARGS and evaluate BODY.
+This binds the client process to CLIENT-SYMBOL.  If EXIT-STATUS is
+non-nil, then after BODY is evaluated, make sure the client
+process's status matches it."
+  (declare (indent 3))
+  (let ((exit-status-symbol (make-symbol "exit-status"))
+        (starting-client-count-symbol (make-symbol "starting-client-count")))
+    `(let ((,starting-client-count-symbol (length server-clients))
+           (,exit-status-symbol ,exit-status)
+           (,client-symbol (server-tests/start-client ,args)))
+       (ert-info ((lambda ()
+                    (with-current-buffer (process-buffer ,client-symbol)
+                      (buffer-string)))
+                  :prefix "Client output: ")
+         (server-tests/wait-until
+          (or (= (length server-clients)
+                 (1+ ,starting-client-count-symbol))
+              (eq (process-status ,client-symbol) ,exit-status-symbol)))
+         ,@body
+         (when ,exit-status-symbol
+           (server-tests/wait-until (eq (process-status ,client-symbol)
+                                        ,exit-status-symbol)))))))
+
+(defvar server-tests/variable nil)
 
 ;;; Tests:
 
-(ert-deftest server-test/server-start-sets-minor-mode ()
+(ert-deftest server-tests/server-start/sets-minor-mode ()
   "Ensure that calling `server-start' also sets `server-mode' properly."
-  (server-start)
-  (unwind-protect
-      (progn
-        ;; Make sure starting the server activates the minor mode.
-        (should (eq server-mode t))
-        (should (memq 'server-mode global-minor-modes)))
-    ;; Always stop the server, even if the above checks fail.
-    (server-start t))
+  (server-tests/with-server
+    ;; Make sure starting the server activates the minor mode.
+    (should (eq server-mode t))
+    (should (memq 'server-mode global-minor-modes)))
   ;; Make sure stopping the server deactivates the minor mode.
   (should (eq server-mode nil))
   (should-not (memq 'server-mode global-minor-modes)))
 
+(ert-deftest server-tests/server-start/stop-prompt-with-client ()
+  "Ensure that stopping the server prompts when there are clients."
+  (skip-unless server-tests/can-create-frames-p)
+  (server-tests/with-server
+    (server-tests/with-client emacsclient '("-c") 'exit
+      (should (length= (frame-list) 2))
+      (cl-letf* ((yes-or-no-p-called nil)
+                 ((symbol-function 'yes-or-no-p)
+                  (lambda (_prompt)
+                    (setq yes-or-no-p-called t))))
+        (server-start t)
+        (should yes-or-no-p-called)))))
+
+(ert-deftest server-tests/server-start/no-stop-prompt-without-client ()
+  "Ensure that stopping the server doesn't prompt when there are no clients."
+  (server-tests/with-server
+    (cl-letf* ((inhibit-message t)
+               (yes-or-no-p-called nil)
+               ((symbol-function 'yes-or-no-p)
+                (lambda (_prompt)
+                  (setq yes-or-no-p-called t))))
+      (server-start t)
+      (should-not yes-or-no-p-called))))
+
+(ert-deftest server-tests/emacsclient/server-edit ()
+  "Test that calling `server-edit' from a client buffer exits the client."
+  (server-tests/with-server
+    (server-tests/with-client emacsclient '("file.txt") 'exit
+      (server-tests/wait-until (get-buffer "file.txt"))
+      (should (eq (process-status emacsclient) 'run))
+      (with-current-buffer "file.txt"
+        (server-edit)))))
+
+(ert-deftest server-tests/emacsclient/create-frame ()
+  "Test that \"emacsclient -c\" creates a frame."
+  (skip-unless server-tests/can-create-frames-p)
+  (let ((starting-frame-count (length (frame-list))))
+    (server-tests/with-server
+      (server-tests/with-client emacsclient '("-c") nil
+      (should (length= (frame-list) (1+ starting-frame-count)))
+      (should (eq (process-status emacsclient) 'run))
+      (should (eq (frame-parameter (car (frame-list)) 'client)
+                  (car server-clients)))))
+    ;; The client frame should go away after the server stops.
+    (should (length= (frame-list) starting-frame-count))))
+
+(ert-deftest server-tests/emacsclient/eval ()
+  "Test that \"emacsclient --eval\" works correctly."
+  (server-tests/with-server
+    (let ((value (random)))
+      (server-tests/with-client emacsclient
+          (list "--eval" (format "(setq server-tests/variable %d)" value))
+          'exit
+        (should (= server-tests/variable value))))))
+
+(ert-deftest server-tests/server-force-stop/keeps-frames ()
+  "Ensure that `server-force-stop' doesn't delete frames.  See bug#58877.
+Note: since that bug is about a behavior when killing Emacs, this
+test is somewhat indirect. (Killing the current Emacs instance
+would make it hard to check test results!)  Instead, it only
+tests that `server-force-stop' doesn't delete frames (and even
+then, requires a few tricks to run as a regression test).  So
+long as this works, the problem in bug#58877 shouldn't occur."
+  (skip-unless server-tests/can-create-frames-p)
+  (let* ((starting-frames (frame-list))
+         (starting-frame-count (length starting-frames))
+         terminal)
+    (unwind-protect
+        (server-tests/with-server
+          (server-tests/with-client emacsclient '("-c") 'exit
+            (should (eq (process-status emacsclient) 'run))
+            (should (length= (frame-list) (1+ starting-frame-count)))
+
+            ;; Don't delete the terminal for the client; that would
+            ;; kill its frame immediately too.  (This is only an issue
+            ;; when running these tests via the command line;
+            ;; normally, in an interactive session, we don't need to
+            ;; worry about this.  But since we want to check that
+            ;; `server-force-stop' doesn't delete frames under normal
+            ;; circumstances, we need to bypass terminal deletion
+            ;; here.)
+            (setq terminal (process-get (car server-clients) 'terminal))
+            (process-put (car server-clients) 'no-delete-terminal t)
+
+            (server-force-stop))
+          ;; Ensure we didn't delete the frame.
+          (should (length= (frame-list) (1+ starting-frame-count))))
+      ;; Clean up after ourselves and delete the terminal.
+      (when (and terminal
+                 (eq (terminal-live-p terminal) t)
+                 (not (eq system-type 'windows-nt)))
+        (delete-terminal terminal)))
+    ;; If there are any new frames remaining, delete them.
+    (mapc (lambda (frame) (delete-frame frame t))
+          (cl-set-difference (frame-list) starting-frames))))
+
 ;;; server-tests.el ends here
diff --git a/test/lisp/url/url-future-tests.el 
b/test/lisp/url/url-future-tests.el
index 5083fc5aba..ec1796f767 100644
--- a/test/lisp/url/url-future-tests.el
+++ b/test/lisp/url/url-future-tests.el
@@ -52,7 +52,7 @@
     (should (equal (url-future-cancel tocancel) tocancel))
     (should-error (url-future-call tocancel))
     (should (null url-future-tests--saver))
-    (should (url-future-cancelled-p tocancel))))
+    (should (url-future-canceled-p tocancel))))
 
 (provide 'url-future-tests)
 
diff --git a/test/lisp/use-package/use-package-tests.el 
b/test/lisp/use-package/use-package-tests.el
new file mode 100644
index 0000000000..e4586b04f2
--- /dev/null
+++ b/test/lisp/use-package/use-package-tests.el
@@ -0,0 +1,1959 @@
+;;; use-package-tests.el --- Tests for use-package.el  -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2014-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 'cl-lib)
+(require 'ert)
+(require 'use-package)
+
+(setq use-package-always-ensure nil
+      use-package-verbose 'errors
+      use-package-expand-minimally t
+      ;; These are needed for certain tests below where the `pcase' match
+      ;; expression is large and contains holes, such as the :after tests.
+      max-lisp-eval-depth 8000
+      max-specpdl-size 8000)
+
+(unless (fboundp 'macroexpand-1)
+  (defun macroexpand-1 (form &optional environment)
+    "Perform (at most) one step of macroexpansion."
+    (cond
+     ((consp form)
+      (let* ((head (car form))
+             (env-expander (assq head environment)))
+        (if env-expander
+            (if (cdr env-expander)
+                (apply (cdr env-expander) (cdr form))
+              form)
+          (if (not (and (symbolp head) (fboundp head)))
+              form
+            (let ((def (autoload-do-load (symbol-function head) head 'macro)))
+              (cond
+               ;; Follow alias, but only for macros, otherwise we may end up
+               ;; skipping an important compiler-macro (e.g. 
cl--block-wrapper).
+               ((and (symbolp def) (macrop def)) (cons def (cdr form)))
+               ((not (consp def)) form)
+               (t
+                (if (eq 'macro (car def))
+                    (apply (cdr def) (cdr form))
+                  form))))))))
+     (t form))))
+
+(defmacro expand-minimally (form)
+  `(let ((use-package-verbose 'errors)
+         (use-package-expand-minimally t))
+     (macroexpand-1 ',form)))
+
+(defmacro expand-maximally (form)
+  `(let ((use-package-verbose 'debug)
+         (use-package-expand-minimally nil))
+     (macroexpand-1 ',form)))
+
+(defmacro match-expansion (form &rest value)
+  `(should (pcase (expand-minimally ,form)
+             ,@(mapcar #'(lambda (x) (list x t)) value))))
+
+(defun fix-expansion ()
+  (interactive)
+  (save-excursion
+    (unless (looking-at "(match-expansion")
+      (backward-up-list))
+    (when (looking-at "(match-expansion")
+      (re-search-forward "(\\(use-package\\|bind-key\\)")
+      (goto-char (match-beginning 0))
+      (let ((decl (read (current-buffer))))
+        (kill-sexp)
+        (let (vars)
+          (catch 'exit
+            (save-excursion
+              (while (ignore-errors (backward-up-list) t)
+                (when (looking-at "(let\\s-+")
+                  (goto-char (match-end 0))
+                  (setq vars (read (current-buffer)))
+                  (throw 'exit t)))))
+          (eval
+           `(let (,@ (append vars
+                             '((use-package-verbose 'errors)
+                               (use-package-expand-minimally t))))
+              (insert ?\n ?\` (pp-to-string (macroexpand-1 decl))))))))))
+
+(bind-key "C-c C-u" #'fix-expansion emacs-lisp-mode-map)
+
+(ert-deftest use-package-test-recognize-function ()
+  (should (use-package-recognize-function nil t))
+  (should-not (use-package-recognize-function nil))
+  (should (use-package-recognize-function t))
+  (should (use-package-recognize-function 'sym))
+  (should (use-package-recognize-function #'sym))
+  (should (use-package-recognize-function (lambda () ...)))
+  (should (use-package-recognize-function '(lambda () ...)))
+  (should (use-package-recognize-function #'(lambda () ...)))
+
+  (should-not (use-package-recognize-function 1))
+  (should-not (use-package-recognize-function "Hello"))
+  (should-not (use-package-recognize-function '(nil . nil))))
+
+(ert-deftest use-package-test-normalize-function ()
+  (should (equal (use-package-normalize-function nil) nil))
+  (should (equal (use-package-normalize-function t) t))
+  (should (equal (use-package-normalize-function 'sym) 'sym))
+  (should (equal (use-package-normalize-function #'sym) 'sym))
+  (should (equal (use-package-normalize-function '(lambda () ...)) '(lambda () 
...)))
+  (should (equal (use-package-normalize-function ''(lambda () ...)) '(lambda 
() ...)))
+  (should (equal (use-package-normalize-function '#'(lambda () ...)) '(lambda 
() ...)))
+
+  (should (equal (use-package-normalize-function 1) 1))
+  (should (equal (use-package-normalize-function "Hello") "Hello"))
+  (should (equal (use-package-normalize-function '(nil . nil)) '(nil . nil))))
+
+(ert-deftest use-package-test/:disabled-1 ()
+  (match-expansion
+   (use-package foo :disabled t)
+   `()))
+
+(ert-deftest use-package-test/:preface-1 ()
+  (match-expansion
+   (use-package foo :preface (t))
+   `(progn
+      (eval-and-compile
+        (t))
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:preface-2 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :preface (t))
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors
+                "Cannot load foo: %S" nil
+                (unless (featurep 'foo)
+                  (load "foo" nil t))))
+          (t))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:preface-3 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo
+       :preface (preface)
+       :init (init)
+       :config (config)
+       :functions func
+       :defines def)
+     `(progn
+        (eval-and-compile
+          (defvar def)
+          (declare-function func "foo")
+          (eval-when-compile
+            (with-demoted-errors
+                "Cannot load foo: %S" nil
+                (unless (featurep 'foo)
+                  (load "foo" nil t))))
+          (preface))
+        (init)
+        (require 'foo nil nil)
+        (config)
+        t))))
+
+(ert-deftest use-package-test/:preface-4 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo
+       :preface (preface)
+       :init (init)
+       :config (config)
+       :functions func
+       :defines def
+       :defer t)
+     `(progn
+        (eval-and-compile
+          (defvar def)
+          (declare-function func "foo")
+          (eval-when-compile
+            (with-demoted-errors
+                "Cannot load foo: %S" nil
+                (unless (featurep 'foo)
+                  (load "foo" nil t))))
+          (preface))
+        (init)
+        (eval-after-load 'foo
+          '(progn
+             (config)
+             t))))))
+
+(ert-deftest use-package-test/:pin-1 ()
+  (match-expansion
+   (use-package foo :pin foo)
+   `(progn
+      (use-package-pin-package 'foo "foo")
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:pin-2 ()
+  (match-expansion
+   (use-package foo :pin "foo")
+   `(progn
+      (use-package-pin-package 'foo "foo")
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test-normalize/:ensure ()
+  (cl-flet ((norm (&rest args)
+                  (apply #'use-package-normalize/:ensure
+                         'foopkg :ensure args)))
+    (should (equal (norm '(t)) '(t)))
+    (should (equal (norm '(nil)) '(nil)))
+    (should (equal (norm '(sym)) '(sym)))
+    (should-error (norm '(1)))
+    (should-error (norm '("Hello")))))
+
+(ert-deftest use-package-test/:ensure-1 ()
+  (let ((use-package-always-ensure nil))
+    (match-expansion
+     (use-package foo :ensure t)
+     `(progn
+        (use-package-ensure-elpa 'foo '(t) 'nil)
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-2 ()
+  (let ((use-package-always-ensure t))
+    (match-expansion
+     (use-package foo :ensure t)
+     `(progn
+        (use-package-ensure-elpa 'foo '(t) 'nil)
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-3 ()
+  (let ((use-package-always-ensure nil))
+    (match-expansion
+     (use-package foo :ensure nil)
+     `(progn
+        (use-package-ensure-elpa 'foo '(nil) 'nil)
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-4 ()
+  (let ((use-package-always-ensure t))
+    (match-expansion
+     (use-package foo :ensure nil)
+     `(progn
+        (use-package-ensure-elpa 'foo '(nil) 'nil)
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-5 ()
+  (let ((use-package-always-ensure nil))
+    (match-expansion
+     (use-package foo :load-path "foo")
+     `(progn
+        (eval-and-compile
+          (add-to-list 'load-path ,(pred stringp)))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-6 ()
+  (let ((use-package-always-ensure t))
+    (match-expansion
+     (use-package foo :load-path "foo")
+     `(progn
+        (eval-and-compile
+          (add-to-list 'load-path ,(pred stringp)))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-7 ()
+  (let ((use-package-always-ensure nil))
+    (match-expansion
+     (use-package foo :ensure nil :load-path "foo")
+     `(progn
+        (use-package-ensure-elpa 'foo '(nil) 'nil)
+        (eval-and-compile
+          (add-to-list 'load-path ,(pred stringp)))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-8 ()
+  (let ((use-package-always-ensure t))
+    (match-expansion
+     (use-package foo :ensure nil :load-path "foo")
+     `(progn
+        (use-package-ensure-elpa 'foo '(nil) 'nil)
+        (eval-and-compile
+          (add-to-list 'load-path ,(pred stringp)))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-9 ()
+  (let ((use-package-always-ensure nil))
+    (match-expansion
+     (use-package foo :ensure t :load-path "foo")
+     `(progn
+        (use-package-ensure-elpa 'foo '(t) 'nil)
+        (eval-and-compile
+          (add-to-list 'load-path ,(pred stringp)))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-10 ()
+  (let ((use-package-always-ensure t))
+    (match-expansion
+     (use-package foo :ensure t :load-path "foo")
+     `(progn
+        (use-package-ensure-elpa 'foo '(t) 'nil)
+        (eval-and-compile
+          (add-to-list 'load-path ,(pred stringp)))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-11 ()
+  (let (tried-to-install)
+    (cl-letf (((symbol-function #'use-package-ensure-elpa)
+               (lambda (name ensure state &optional no-refresh)
+                 (when ensure
+                   (setq tried-to-install name))))
+              ((symbol-function #'require) #'ignore))
+      (use-package foo :ensure t)
+      (should (eq tried-to-install 'foo)))))
+
+(ert-deftest use-package-test/:ensure-12 ()
+  (let ((use-package-always-ensure t))
+    (match-expansion
+     (use-package foo :ensure bar)
+     `(progn
+        (use-package-ensure-elpa 'foo '(bar) 'nil)
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-13 ()
+  (let ((use-package-always-ensure t))
+    (match-expansion
+     (use-package foo :ensure bar :ensure quux)
+     `(progn
+        (use-package-ensure-elpa 'foo '(bar quux) 'nil)
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:ensure-14 ()
+  (match-expansion
+   (use-package ess-site
+     :ensure ess1
+     :ensure ess2
+     :ensure (ess3 :pin "melpa-unstable")
+     :pin melpa-stable)
+   `(progn
+      (use-package-pin-package 'ess-site "melpa-stable")
+      (use-package-ensure-elpa 'ess-site
+                               '(ess1 ess2
+                                      (ess3 . "melpa-unstable"))
+                               'nil)
+      (require 'ess-site nil nil))))
+
+(ert-deftest use-package-test/:ensure-15 ()
+  (let ((use-package-always-ensure t))
+    (match-expansion
+     (use-package foo
+       :pin "elpa"
+       :ensure bar
+       :ensure (quux :pin "melpa"))
+     `(progn
+        (use-package-pin-package 'foo "elpa")
+        (use-package-ensure-elpa 'foo
+                                 '(bar
+                                   (quux . "melpa"))
+                                 'nil)
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:if-1 ()
+  (match-expansion
+   (use-package foo :if t)
+   `(when t
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:if-2 ()
+  (match-expansion
+   (use-package foo :if (and t t))
+   `(when (and t t)
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:if-3 ()
+  (match-expansion
+   (use-package foo :if nil)
+   `(when nil
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:when-1 ()
+  (match-expansion
+   (use-package foo :when t)
+   `(when t
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:when-2 ()
+  (match-expansion
+   (use-package foo :when (and t t))
+   `(when (and t t)
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:when-3 ()
+  (match-expansion
+   (use-package foo :when nil)
+   `(when nil
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:unless-1 ()
+  (match-expansion
+   (use-package foo :unless t)
+   `(when (not t)
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:unless-2 ()
+  (match-expansion
+   (use-package foo :unless (and t t))
+   `(when (not (and t t))
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:unless-3 ()
+  (match-expansion
+   (use-package foo :unless nil)
+   `(unless nil
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:requires-1 ()
+  (match-expansion
+   (use-package foo :requires bar)
+   `(when (featurep 'bar)
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:requires-2 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :requires bar)
+     `(when (featurep 'bar)
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors
+                "Cannot load foo: %S" nil
+                (unless (featurep 'foo)
+                  (load "foo" nil t)))))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:requires-3 ()
+  (match-expansion
+   (use-package foo :requires (bar quux))
+   `(when (not (member nil (mapcar #'featurep '(bar quux))))
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:requires-4 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :requires bar)
+     `(when (featurep 'bar)
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:load-path-1 ()
+  (match-expansion
+   (use-package foo :load-path "bar")
+   `(progn
+      (eval-and-compile
+        (add-to-list 'load-path
+                     ,(pred (apply-partially
+                             #'string=
+                             (expand-file-name
+                              "bar" user-emacs-directory)))))
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:load-path-2 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :load-path "bar")
+     `(progn
+        (eval-and-compile
+          (add-to-list 'load-path
+                       ,(pred (apply-partially
+                               #'string=
+                               (expand-file-name
+                                "bar" user-emacs-directory)))))
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:load-path-3 ()
+  (match-expansion
+   (use-package foo :load-path ("bar" "quux"))
+   `(progn
+      (eval-and-compile
+        (add-to-list 'load-path
+                     ,(pred (apply-partially
+                             #'string=
+                             (expand-file-name
+                              "bar" user-emacs-directory)))))
+      (eval-and-compile
+        (add-to-list 'load-path
+                     ,(pred (apply-partially
+                             #'string=
+                             (expand-file-name
+                              "quux" user-emacs-directory)))))
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:load-path-4 ()
+  (match-expansion
+   (use-package foo :load-path (lambda () (list "bar" "quux")))
+   `(progn
+      (eval-and-compile
+        (add-to-list 'load-path
+                     ,(pred (apply-partially
+                             #'string=
+                             (expand-file-name
+                              "bar" user-emacs-directory)))))
+      (eval-and-compile
+        (add-to-list 'load-path
+                     ,(pred (apply-partially
+                             #'string=
+                             (expand-file-name
+                              "quux" user-emacs-directory)))))
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:no-require-1 ()
+  (match-expansion
+   (use-package foo :no-require t)
+   `nil))
+
+(ert-deftest use-package-test/:no-require-2 ()
+  (match-expansion
+   (use-package foo :no-require t :config (config))
+   `(progn
+      (config)
+      t)))
+
+(ert-deftest use-package-test/:no-require-3 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :no-require t)
+     `(eval-and-compile
+        (eval-when-compile
+          (with-demoted-errors "Cannot load foo: %S" nil nil))))))
+
+(defun use-package-test-normalize-bind (&rest args)
+  (apply #'use-package-normalize-binder 'foo :bind args))
+
+(ert-deftest use-package-test-normalize/:bind-1 ()
+  (should (equal (use-package-test-normalize-bind
+                  '(("C-a" . alpha)))
+                 '(("C-a" . alpha)))))
+
+(ert-deftest use-package-test-normalize/:bind-2 ()
+  (should (equal (use-package-test-normalize-bind
+                  '(("C-a" . alpha)
+                    :map foo-map
+                    ("C-b" . beta)))
+                 '(("C-a" . alpha)
+                   :map foo-map
+                   ("C-b" . beta)))))
+
+(ert-deftest use-package-test-normalize/:bind-3 ()
+  (should (equal (use-package-test-normalize-bind
+                  '(:map foo-map
+                         ("C-a" . alpha)
+                         ("C-b" . beta)))
+                 '(:map foo-map
+                        ("C-a" . alpha)
+                        ("C-b" . beta)))))
+
+(ert-deftest use-package-test/:bind-1 ()
+  (match-expansion
+   (use-package foo :bind ("C-k" . key1) ("C-u" . key2))
+   `(progn
+      (unless
+          (fboundp 'key1)
+        (autoload #'key1 "foo" nil t))
+      (unless
+          (fboundp 'key2)
+        (autoload #'key2 "foo" nil t))
+      (bind-keys :package foo
+                 ("C-k" . key1)
+                 ("C-u" . key2)))))
+
+(ert-deftest use-package-test/:bind-2 ()
+  (match-expansion
+   (use-package foo :bind (("C-k" . key1) ("C-u" . key2)))
+   `(progn
+      (unless (fboundp 'key1)
+        (autoload #'key1 "foo" nil t))
+      (unless (fboundp 'key2)
+        (autoload #'key2 "foo" nil t))
+      (bind-keys :package foo
+                 ("C-k" . key1)
+                 ("C-u" . key2)))))
+
+(ert-deftest use-package-test/:bind-3 ()
+  (match-expansion
+   (use-package foo :bind (:map my-map ("C-k" . key1) ("C-u" . key2)))
+   `(progn
+      (unless
+          (fboundp 'key1)
+        (autoload #'key1 "foo" nil t))
+      (unless
+          (fboundp 'key2)
+        (autoload #'key2 "foo" nil t))
+      (bind-keys :package foo :map my-map
+                 ("C-k" . key1)
+                 ("C-u" . key2)))))
+
+(ert-deftest use-package-test/:bind-4 ()
+  (should-error
+   (match-expansion
+    (use-package foo :bind :map my-map ("C-k" . key1) ("C-u" . key2))
+    `(bind-keys :package foo))))
+
+(ert-deftest use-package-test/:bind-5 ()
+  (match-expansion
+   (use-package foo :bind ("C-k" . key1) (:map my-map ("C-u" . key2)))
+   `(progn
+      (unless (fboundp 'key1)
+        (autoload #'key1 "foo" nil t))
+      (unless (fboundp 'key2)
+        (autoload #'key2 "foo" nil t))
+      (bind-keys :package foo
+                 ("C-k" . key1)
+                 :map my-map
+                 ("C-u" . key2)))))
+
+(ert-deftest use-package-test/:bind-6 ()
+  (match-expansion
+   (use-package foo
+     :bind
+     ("C-k" . key1)
+     (:map my-map ("C-u" . key2))
+     (:map my-map2 ("C-u" . key3)))
+   `(progn
+      (unless (fboundp 'key1)
+        (autoload #'key1 "foo" nil t))
+      (unless (fboundp 'key2)
+        (autoload #'key2 "foo" nil t))
+      (unless (fboundp 'key3)
+        (autoload #'key3 "foo" nil t))
+      (bind-keys :package foo
+                 ("C-k" . key1)
+                 :map my-map ("C-u" . key2)
+                 :map my-map2 ("C-u" . key3)))))
+
+(ert-deftest use-package-test/:bind-7 ()
+  (match-expansion
+   (use-package foo
+     :ensure
+     :bind ("C-c r" . browse-at-remote))
+   `(progn
+      (use-package-ensure-elpa 'foo '(t) 'nil)
+      (unless (fboundp 'browse-at-remote)
+        (autoload #'browse-at-remote "foo" nil t))
+      (bind-keys :package foo ("C-c r" . browse-at-remote)))))
+
+(ert-deftest use-package-test/:bind-8 ()
+  (match-expansion
+   (use-package foo
+     :ensure
+     :bind (:map foo-map
+                 (("C-c r" . foo)
+                  ("C-c r" . bar))))
+   `(progn
+      (use-package-ensure-elpa 'foo '(t) 'nil)
+      (unless (fboundp 'foo)
+        (autoload #'foo "foo" nil t))
+      (unless (fboundp 'bar)
+        (autoload #'bar "foo" nil t))
+      (bind-keys :package foo :map foo-map
+                 ("C-c r" . foo)
+                 ("C-c r" . bar)))))
+
+(ert-deftest use-package-test/:bind*-1 ()
+  (match-expansion
+   (use-package foo :bind* ("C-k" . key))
+   `(progn
+      (unless (fboundp 'key)
+        (autoload #'key "foo" nil t))
+      (bind-keys* :package foo ("C-k" . key)))))
+
+(ert-deftest use-package-test/:bind-keymap-1 ()
+  (match-expansion
+   (use-package foo :bind-keymap ("C-k" . key))
+   `(bind-key "C-k"
+              #'(lambda nil
+                  (interactive)
+                  (use-package-autoload-keymap 'key 'foo nil)))))
+
+(ert-deftest use-package-test/:bind-keymap*-1 ()
+  (match-expansion
+   (use-package foo :bind-keymap* ("C-k" . key))
+   `(bind-key* "C-k"
+               #'(lambda ()
+                   (interactive)
+                   (use-package-autoload-keymap 'key 'foo t)))))
+
+(ert-deftest use-package-test/:interpreter-1 ()
+  (match-expansion
+   (use-package foo :interpreter "interp")
+   `(progn
+      (unless (fboundp 'foo)
+        (autoload #'foo "foo" nil t))
+      (add-to-list 'interpreter-mode-alist '("interp" . foo)))))
+
+(ert-deftest use-package-test/:interpreter-2 ()
+  (match-expansion
+   (use-package foo :interpreter ("interp" . fun))
+   `(progn
+      (unless (fboundp 'fun)
+        (autoload #'fun "foo" nil t))
+      (add-to-list 'interpreter-mode-alist '("interp" . fun)))))
+
+(ert-deftest use-package-test-normalize/:mode ()
+  (cl-flet ((norm (&rest args)
+                  (apply #'use-package-normalize/:mode
+                         'foopkg :mode args)))
+    (should (equal (norm '(".foo"))
+                   '((".foo" . foopkg))))
+    (should (equal (norm '(".foo" ".bar"))
+                   '((".foo" . foopkg) (".bar" . foopkg))))
+    (should (equal (norm '((".foo" ".bar")))
+                   '((".foo" . foopkg) (".bar" . foopkg))))
+    (should (equal (norm '((".foo")))
+                   '((".foo" . foopkg))))
+    (should (equal (norm '((".foo" . foo) (".bar" . bar)))
+                   '((".foo" . foo) (".bar" . bar))))))
+
+(ert-deftest use-package-test/:mode-1 ()
+  (match-expansion
+   (use-package foo :mode "interp")
+   `(progn
+      (unless (fboundp 'foo)
+        (autoload #'foo "foo" nil t))
+      (add-to-list 'auto-mode-alist '("interp" . foo)))))
+
+(ert-deftest use-package-test/:mode-2 ()
+  (match-expansion
+   (use-package foo :mode ("interp" . fun))
+   `(progn
+      (unless (fboundp 'fun)
+        (autoload #'fun "foo" nil t))
+      (add-to-list 'auto-mode-alist '("interp" . fun)))))
+
+(ert-deftest use-package-test/:magic-1 ()
+  (match-expansion
+   (use-package foo :magic "interp")
+   `(progn
+      (unless (fboundp 'foo)
+        (autoload #'foo "foo" nil t))
+      (add-to-list 'magic-mode-alist '("interp" . foo)))))
+
+(ert-deftest use-package-test/:magic-2 ()
+  (match-expansion
+   (use-package foo :magic ("interp" . fun))
+   `(progn
+      (unless (fboundp 'fun)
+        (autoload #'fun "foo" nil t))
+      (add-to-list 'magic-mode-alist '("interp" . fun)))))
+
+(ert-deftest use-package-test/:magic-fallback-1 ()
+  (match-expansion
+   (use-package foo :magic-fallback "interp")
+   `(progn
+      (unless (fboundp 'foo)
+        (autoload #'foo "foo" nil t))
+      (add-to-list 'magic-fallback-mode-alist '("interp" . foo)))))
+
+(ert-deftest use-package-test/:magic-fallback-2 ()
+  (match-expansion
+   (use-package foo :magic-fallback ("interp" . fun))
+   `(progn
+      (unless (fboundp 'fun)
+        (autoload #'fun "foo" nil t))
+      (add-to-list 'magic-fallback-mode-alist '("interp" . fun)))))
+
+(ert-deftest use-package-test/:commands-1 ()
+  (match-expansion
+   (use-package foo :commands bar)
+   `(unless (fboundp 'bar)
+      (autoload #'bar "foo" nil t))))
+
+(ert-deftest use-package-test/:commands-2 ()
+  (match-expansion
+   (use-package foo :commands (bar quux))
+   `(progn
+      (unless (fboundp 'bar)
+        (autoload #'bar "foo" nil t))
+      (unless (fboundp 'quux)
+        (autoload #'quux "foo" nil t)))))
+
+(ert-deftest use-package-test/:commands-3 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :commands (bar quux))
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (unless (fboundp 'bar)
+          (autoload #'bar "foo" nil t))
+        (eval-when-compile
+          (declare-function bar "foo"))
+        (unless (fboundp 'quux)
+          (autoload #'quux "foo" nil t))
+        (eval-when-compile
+          (declare-function quux "foo"))))))
+
+(ert-deftest use-package-test/:commands-4 ()
+  (match-expansion
+   (use-package foo :commands bar :init (bar))
+   `(progn
+      (unless
+          (fboundp 'bar)
+        (autoload #'bar "foo" nil t))
+      (bar))))
+
+(ert-deftest use-package-test/:commands-5 ()
+  (match-expansion
+   (use-package gnus-harvest
+     :load-path "foo"
+     :commands gnus-harvest-install
+     :demand t
+     :config
+     (if (featurep 'message-x)
+         (gnus-harvest-install 'message-x)
+       (gnus-harvest-install)))
+   `(progn
+      (eval-and-compile
+        (add-to-list 'load-path ,(pred stringp)))
+      (require 'gnus-harvest nil nil)
+      (if (featurep 'message-x)
+          (gnus-harvest-install 'message-x)
+        (gnus-harvest-install))
+      t)))
+
+(ert-deftest use-package-test/:commands-6 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package gnus-harvest
+       :load-path "foo"
+       :commands gnus-harvest-install
+       :demand t
+       :config
+       (if (featurep 'message-x)
+           (gnus-harvest-install 'message-x)
+         (gnus-harvest-install)))
+     `(progn
+        (eval-and-compile
+          (add-to-list 'load-path ,(pred stringp)))
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load gnus-harvest: %S" nil
+                                 (unless (featurep 'gnus-harvest)
+                                   (load "gnus-harvest" nil t)))))
+        (eval-when-compile
+          (declare-function gnus-harvest-install "gnus-harvest"))
+        (require 'gnus-harvest nil nil)
+        (if
+            (featurep 'message-x)
+            (gnus-harvest-install 'message-x)
+          (gnus-harvest-install))
+        t))))
+
+(ert-deftest use-package-test/:autoload-1 ()
+  (match-expansion
+   (use-package foo :autoload bar)
+   `(unless (fboundp 'bar)
+      (autoload #'bar "foo"))))
+
+(ert-deftest use-package-test/:defines-1 ()
+  (match-expansion
+   (use-package foo :defines bar)
+   `(require 'foo nil nil)))
+
+(ert-deftest use-package-test/:defines-2 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :defines bar)
+     `(progn
+        (eval-and-compile
+          (defvar bar)
+          (eval-when-compile
+            (with-demoted-errors
+                "Cannot load foo: %S" nil
+                (unless (featurep 'foo)
+                  (load "foo" nil t)))))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:functions-1 ()
+  (match-expansion
+   (use-package foo :functions bar)
+   `(require 'foo nil nil)))
+
+(ert-deftest use-package-test/:functions-2 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :functions bar)
+     `(progn
+        (eval-and-compile
+          (declare-function bar "foo")
+          (eval-when-compile
+            (with-demoted-errors
+                "Cannot load foo: %S" nil
+                (unless (featurep 'foo)
+                  (load "foo" nil t)))))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:functions-3 ()
+  (match-expansion
+   (use-package foo :defer t :functions bar)
+   `nil))
+
+(ert-deftest use-package-test/:functions-4 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :defer t :functions bar)
+     `(eval-and-compile
+        (declare-function bar "foo")
+        (eval-when-compile
+          (with-demoted-errors "Cannot load foo: %S" nil
+                               (unless (featurep 'foo)
+                                 (load "foo" nil t))))))))
+
+(ert-deftest use-package-test/:functions-5 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :defer t :config (config) :functions bar)
+     `(progn
+        (eval-and-compile
+          (declare-function bar "foo")
+          (eval-when-compile
+            (with-demoted-errors
+                "Cannot load foo: %S" nil
+                (unless (featurep 'foo)
+                  (load "foo" nil t)))))
+        (eval-after-load 'foo
+          '(progn
+             (config)
+             t))))))
+
+(ert-deftest use-package-test/:defer-1 ()
+  (match-expansion
+   (use-package foo)
+   `(require 'foo nil nil)))
+
+(ert-deftest use-package-test/:defer-2 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo)
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:defer-3 ()
+  (match-expansion
+   (use-package foo :defer t)
+   `nil))
+
+(ert-deftest use-package-test/:defer-4 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :defer t)
+     `(eval-and-compile
+        (eval-when-compile
+          (with-demoted-errors "Cannot load foo: %S" nil
+                               (unless (featurep 'foo)
+                                 (load "foo" nil t))))))))
+
+(ert-deftest use-package-test-normalize/:hook ()
+  (cl-flet ((norm (&rest args)
+                  (apply #'use-package-normalize/:hook
+                         'foopkg :hook args)))
+    (should-error (norm nil))
+    (should (equal (norm '(bar))
+                   '((bar . foopkg-mode))))
+    (should (equal (norm '((bar . foopkg)))
+                   '((bar . foopkg))))
+    (should (equal (norm '((bar . baz)))
+                   '((bar . baz))))
+    (should (equal (norm '(((bar baz) . quux)))
+                   '(((bar baz) . quux))))
+    (should (equal (norm '(bar baz))
+                   '(((bar baz) . foopkg-mode))))
+    (should (equal (norm '((bar baz) (quux bow)))
+                   '(((bar baz) . foopkg-mode) ((quux bow) . foopkg-mode))))
+    (should (equal (norm '((bar . baz) (quux . bow)))
+                   '((bar . baz) (quux . bow))))
+    (should (equal (norm '(((bar1 bar2) . baz) ((quux1 quux2) . bow)))
+                   '(((bar1 bar2) . baz) ((quux1 quux2) . bow))))))
+
+(ert-deftest use-package-test/:hook-1 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo
+       :bind (("C-a" . key))
+       :hook (hook . fun))
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors
+                "Cannot load foo: %S" nil
+                (unless (featurep 'foo)
+                  (load "foo" nil t)))))
+        (unless
+            (fboundp 'key)
+          (autoload #'key "foo" nil t))
+        (eval-when-compile
+          (declare-function key "foo"))
+        (unless
+            (fboundp 'fun)
+          (autoload #'fun "foo" nil t))
+        (eval-when-compile
+          (declare-function fun "foo"))
+        (add-hook 'hook-hook #'fun)
+        (bind-keys :package foo ("C-a" . key))))))
+
+(ert-deftest use-package-test/:hook-2 ()
+  (match-expansion
+   (use-package foo
+     :hook (hook . fun))
+   `(progn
+      (unless (fboundp 'fun)
+        (autoload #'fun "foo" nil t))
+      (add-hook 'hook-hook #'fun))))
+
+(ert-deftest use-package-test/:hook-3 ()
+  (let ((use-package-hook-name-suffix nil))
+    (match-expansion
+     (use-package foo
+       :hook (hook . fun))
+     `(progn
+        (unless (fboundp 'fun)
+          (autoload #'fun "foo" nil t))
+        (add-hook 'hook #'fun)))))
+
+(ert-deftest use-package-test/:hook-4 ()
+  (let ((use-package-hook-name-suffix "-special"))
+    (match-expansion
+     (use-package foo
+       :hook (hook . fun))
+     `(progn
+        (unless (fboundp 'fun)
+          (autoload #'fun "foo" nil t))
+        (add-hook 'hook-special #'fun)))))
+
+(ert-deftest use-package-test/:hook-5 ()
+  (match-expansion
+   (use-package erefactor
+     :load-path "foo"
+     :after elisp-mode
+     :load t
+     :hook (emacs-lisp-mode
+            . (lambda ()
+                (bind-key "\C-c\C-v" erefactor-map emacs-lisp-mode-map))))
+   `(progn
+      (eval-and-compile
+        (add-to-list 'load-path ,(pred stringp)))
+      (eval-after-load 'elisp-mode
+        '(progn
+           (require 'erefactor nil nil)
+           (add-hook
+            'emacs-lisp-mode-hook
+            #'(lambda nil
+                (bind-key "" erefactor-map emacs-lisp-mode-map))))))))
+
+(ert-deftest use-package-test/:hook-6 ()
+  (match-expansion
+   (use-package erefactor
+     :load-path "foo"
+     :after elisp-mode
+     :hook (emacs-lisp-mode . function))
+   `(progn
+      (eval-and-compile
+        (add-to-list 'load-path ,(pred stringp)))
+      (eval-after-load 'elisp-mode
+        '(progn
+           (unless (fboundp 'function)
+             (autoload #'function "erefactor" nil t))
+           (add-hook 'emacs-lisp-mode-hook #'function))))))
+
+(ert-deftest use-package-test/:hook-7 ()
+  (match-expansion
+   (use-package erefactor
+     :load-path "foo"
+     :after elisp-mode
+     :hook (emacs-lisp-mode . (lambda () (function))))
+   `(progn
+      (eval-and-compile
+        (add-to-list 'load-path ,(pred stringp)))
+      (eval-after-load 'elisp-mode
+        '(progn
+           (require 'erefactor nil nil)
+           (add-hook 'emacs-lisp-mode-hook #'(lambda nil (function))))))))
+
+(ert-deftest use-package-test-normalize/:custom ()
+  (cl-flet ((norm (&rest args)
+                  (apply #'use-package-normalize/:custom
+                         'foopkg :custom args)))
+    (should-error (norm nil))
+    (should-error (norm '(bar)))
+    ;; (should-error (norm '((foo bar baz quux))))
+    (should (equal (norm '(foo bar)) '((foo bar))))
+    ;; (should-error (norm '(foo bar baz)))
+    ;; (should (equal (norm '(foo bar "baz"))
+    ;;                '((foo bar baz))))
+    ))
+
+
+(ert-deftest use-package-test/:custom-1 ()
+  (match-expansion
+   (use-package foo :custom (foo bar))
+   `(progn
+      (let
+          ((custom--inhibit-theme-enable nil))
+        (unless (memq 'use-package custom-known-themes)
+          (deftheme use-package)
+          (enable-theme 'use-package)
+          (setq custom-enabled-themes (remq 'use-package 
custom-enabled-themes)))
+        (custom-theme-set-variables 'use-package
+                                    '(foo bar nil nil "Customized with 
use-package foo")))
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:custom-with-comment1 ()
+  (match-expansion
+   (use-package foo :custom (foo bar "commented"))
+   `(progn
+      (let
+          ((custom--inhibit-theme-enable nil))
+        (unless (memq 'use-package custom-known-themes)
+          (deftheme use-package)
+          (enable-theme 'use-package)
+          (setq custom-enabled-themes (remq 'use-package 
custom-enabled-themes)))
+        (custom-theme-set-variables 'use-package
+                                    '(foo bar nil nil "commented")))
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:custom-face-1 ()
+  (match-expansion
+   (use-package foo :custom-face (foo ((t (:background "#e4edfc")))))
+   `(progn
+      (apply #'face-spec-set (backquote (foo ((t (:background "#e4edfc"))))))
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:custom-face-2 ()
+  (match-expansion
+   (use-package example
+     :custom-face
+     (example-1-face ((t (:foreground "LightPink"))))
+     (example-2-face ((t (:foreground "LightGreen")))))
+   `(progn
+      (apply #'face-spec-set
+             (backquote (example-1-face ((t (:foreground "LightPink"))))))
+      (apply #'face-spec-set
+             (backquote (example-2-face ((t (:foreground "LightGreen"))))))
+      (require 'example nil nil))))
+
+(ert-deftest use-package-test/:custom-face-3 ()
+  (match-expansion
+   (use-package foo :custom-face (foo ((t (:background "#e4edfc"))) 
face-defspec-spec))
+   `(progn
+      (apply #'face-spec-set (backquote (foo ((t (:background "#e4edfc"))) 
face-defspec-spec)))
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:init-1 ()
+  (match-expansion
+   (use-package foo :init (init))
+   `(progn
+      (init)
+      (require 'foo nil nil))))
+
+(ert-deftest use-package-test/:init-2 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :init (init))
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (init)
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:catch-1 ()
+  (match-expansion
+   (use-package foo :catch t)
+   `(progn
+      (defvar ,_
+        #'(lambda (keyword err)
+            (let ((msg (format "%s/%s: %s" 'foo keyword
+                               (error-message-string err))))
+              (display-warning 'use-package msg :error))))
+      (condition-case-unless-debug err
+          (require 'foo nil nil)
+        (error
+         (funcall ,_ :catch err))))))
+
+(ert-deftest use-package-test/:catch-2 ()
+  (match-expansion
+   (use-package foo :catch nil)
+   `(require 'foo nil nil)))
+
+(ert-deftest use-package-test/:catch-3 ()
+  (match-expansion
+   (use-package foo :catch (lambda (keyword error)))
+   `(progn
+      (defvar ,_ (lambda (keyword error)))
+      (condition-case-unless-debug err
+          (require 'foo nil nil)
+        (error
+         (funcall ,_ :catch err))))))
+
+(ert-deftest use-package-test/:after-1 ()
+  (match-expansion
+   (use-package foo :after bar)
+   `(eval-after-load 'bar
+      '(require 'foo nil nil))))
+
+(ert-deftest use-package-test/:after-2 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :after bar)
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (eval-after-load 'bar
+          '(require 'foo nil nil))))))
+
+(ert-deftest use-package-test/:after-3 ()
+  (match-expansion
+   (use-package foo :after (bar quux))
+   `(eval-after-load 'quux
+      '(eval-after-load 'bar
+         '(require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:after-4 ()
+  (match-expansion
+   (use-package foo :after (:all bar quux))
+   `(eval-after-load 'quux
+      '(eval-after-load 'bar
+         '(require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:after-5 ()
+  (match-expansion
+   (use-package foo :after (:any bar quux))
+   `(progn
+      (defvar ,_ nil)
+      (defvar ,_ nil)
+      (defvar ,_
+        #'(lambda nil
+            (if ,_ ,_
+              (setq ,_ t ,_
+                    (require 'foo nil nil)))))
+      (eval-after-load 'bar
+        '(funcall ,_))
+      (eval-after-load 'quux
+        '(funcall ,_)))))
+
+(ert-deftest use-package-test/:after-6 ()
+  (match-expansion
+   (use-package foo :after (:all (:any bar quux) bow))
+   `(progn
+      (defvar ,_ nil)
+      (defvar ,_ nil)
+      (defvar ,_
+        #'(lambda nil
+            (if ,_ ,_
+              (setq ,_ t ,_
+                    (require 'foo nil nil)))))
+      (eval-after-load 'bow
+        '(progn
+           (eval-after-load 'bar
+             '(funcall ,_))
+           (eval-after-load 'quux
+             '(funcall ,_)))))))
+
+(ert-deftest use-package-test/:after-7 ()
+  (match-expansion
+   (use-package foo :after (:any (:all bar quux) bow))
+   `(progn
+      (defvar ,_ nil)
+      (defvar ,_ nil)
+      (defvar ,_
+        #'(lambda nil
+            (if ,_ ,_
+              (setq ,_ t ,_
+                    (require 'foo nil nil)))))
+      (eval-after-load 'quux
+        '(eval-after-load 'bar
+           '(funcall ,_)))
+      (eval-after-load 'bow
+        '(funcall ,_)))))
+
+(ert-deftest use-package-test/:after-8 ()
+  (match-expansion
+   (use-package foo :after (:all (:any bar quux) (:any bow baz)))
+   `(progn
+      (defvar ,_ nil)
+      (defvar ,_ nil)
+      (defvar ,_
+        #'(lambda nil
+            (if ,_ ,_
+              (setq ,_ t ,_
+                    (require 'foo nil nil)))))
+      (eval-after-load 'bow
+        '(progn
+           (eval-after-load 'bar
+             '(funcall ,_))
+           (eval-after-load 'quux
+             '(funcall ,_))))
+      (eval-after-load 'baz
+        '(progn
+           (eval-after-load 'bar
+             '(funcall ,_))
+           (eval-after-load 'quux
+             '(funcall ,_)))))))
+
+(ert-deftest use-package-test/:after-9 ()
+  (match-expansion
+   (use-package foo :after (:any (:all bar quux) (:all bow baz)))
+   `(progn
+      (defvar ,_ nil)
+      (defvar ,_ nil)
+      (defvar ,_
+        #'(lambda nil
+            (if ,_ ,_
+              (setq ,_ t ,_
+                    (require 'foo nil nil)))))
+      (eval-after-load 'quux
+        '(eval-after-load 'bar
+           '(funcall ,_)))
+      (eval-after-load 'baz
+        '(eval-after-load 'bow
+           '(funcall ,_))))))
+
+(ert-deftest use-package-test/:after-10 ()
+  (match-expansion
+   (use-package foo :after (:any (:all bar quux) (:any bow baz)))
+   `(progn
+      (defvar ,_ nil)
+      (defvar ,_ nil)
+      (defvar ,_
+        #'(lambda nil
+            (if ,_ ,_
+              (setq ,_ t ,_
+                    (require 'foo nil nil)))))
+      (eval-after-load 'quux
+        '(eval-after-load 'bar
+           '(funcall ,_)))
+      (eval-after-load 'bow
+        '(funcall ,_))
+      (eval-after-load 'baz
+        '(funcall ,_)))))
+
+(ert-deftest use-package-test/:demand-1 ()
+  (match-expansion
+   (use-package foo :demand t)
+   `(require 'foo nil nil)))
+
+(ert-deftest use-package-test/:demand-2 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :demand t)
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (require 'foo nil nil)))))
+
+(ert-deftest use-package-test/:demand-3 ()
+  (match-expansion
+   (use-package foo :demand t :config (config))
+   `(progn
+      (require 'foo nil nil)
+      (config)
+      t)))
+
+(ert-deftest use-package-test/:demand-4 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :demand t :config (config))
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (require 'foo nil nil)
+        (config)
+        t))))
+
+(ert-deftest use-package-test/:demand-5 ()
+  ;; #529 - :demand should not override an explicit use of :after
+  (match-expansion
+   (use-package foo :demand t :after bar)
+   `(eval-after-load 'bar
+      '(require 'foo nil nil))))
+
+(ert-deftest use-package-test/:demand-6 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :demand t :after bar)
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (eval-after-load 'bar
+          '(require 'foo nil nil))))))
+
+(ert-deftest use-package-test/:demand-7 ()
+  (match-expansion
+   (use-package counsel
+     :load-path "foo"
+     :after ivy
+     :demand t
+     :diminish
+     :bind (("C-*" . counsel-org-agenda-headlines)
+            ("M-x" . counsel-M-x))
+     :commands (counsel-minibuffer-history
+                counsel-find-library
+                counsel-unicode-char)
+     :preface (preface-code)
+     :init
+     ;; This is actually wrong, but it's just part of the example.
+     (define-key minibuffer-local-map (kbd "M-r")
+       'counsel-minibuffer-history))
+   `(progn
+      (eval-and-compile
+        (add-to-list 'load-path ,(pred stringp)))
+      (eval-and-compile
+        (preface-code))
+      (eval-after-load 'ivy
+        '(progn
+           (define-key minibuffer-local-map (kbd "M-r")
+             'counsel-minibuffer-history)
+           (require 'counsel nil nil)
+           (if (fboundp 'diminish)
+               (diminish 'counsel-mode))
+           (bind-keys :package counsel
+                      ("C-*" . counsel-org-agenda-headlines)
+                      ("M-x" . counsel-M-x)))))))
+
+(ert-deftest use-package-test/:config-1 ()
+  (match-expansion
+   (use-package foo :config (config))
+   `(progn
+      (require 'foo nil nil)
+      (config)
+      t)))
+
+(ert-deftest use-package-test/:config-2 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :config (config))
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (require 'foo nil nil)
+        (config)
+        t))))
+
+(ert-deftest use-package-test/:config-3 ()
+  (match-expansion
+   (use-package foo :defer t :config (config))
+   `(eval-after-load 'foo
+      '(progn
+         (config)
+         t))))
+
+(ert-deftest use-package-test/:config-4 ()
+  (let ((byte-compile-current-file t))
+    (match-expansion
+     (use-package foo :defer t :config (config))
+     `(progn
+        (eval-and-compile
+          (eval-when-compile
+            (with-demoted-errors "Cannot load foo: %S" nil
+                                 (unless (featurep 'foo)
+                                   (load "foo" nil t)))))
+        (eval-after-load 'foo
+          '(progn
+             (config)
+             t))))))
+
+(ert-deftest use-package-test-normalize/:diminish ()
+  (should (equal (use-package-normalize-diminish 'foopkg :diminish nil)
+                 '(foopkg-mode)))
+  (should (equal (use-package-normalize-diminish 'foopkg :diminish 'bar)
+                 '(bar)))
+  (should (equal (use-package-normalize-diminish 'foopkg :diminish "bar")
+                 '((foopkg-mode . "bar"))))
+  (should (equal (use-package-normalize-diminish 'foopkg :diminish 'foo-mode)
+                 '(foo-mode)))
+  (should (equal (use-package-normalize-diminish 'foopkg :diminish '(foo . 
"bar"))
+                 '((foo . "bar")))))
+
+(ert-deftest use-package-test/:diminish-1 ()
+  (match-expansion
+   (use-package foo :diminish nil)
+   `(progn
+      (require 'foo nil nil)
+      (if (fboundp 'diminish)
+          (diminish 'foo-mode)))))
+
+(ert-deftest use-package-test/:diminish-2 ()
+  (match-expansion
+   (use-package foo :diminish bar)
+   `(progn
+      (require 'foo nil nil)
+      (if (fboundp 'diminish)
+          (diminish 'bar)))))
+
+(ert-deftest use-package-test/:diminish-3 ()
+  (match-expansion
+   (use-package foo :diminish "bar")
+   `(progn
+      (require 'foo nil nil)
+      (if (fboundp 'diminish)
+          (diminish 'foo-mode "bar")))))
+
+(ert-deftest use-package-test/:diminish-4 ()
+  (match-expansion
+   (use-package foo :diminish (foo . "bar"))
+   `(progn
+      (require 'foo nil nil)
+      (if (fboundp 'diminish)
+          (diminish 'foo "bar")))))
+
+(ert-deftest use-package-test-normalize/:delight ()
+  (should (equal `((foo-mode nil foo))
+                 (use-package-normalize/:delight 'foo :delight nil)))
+  (should (equal `((foo-mode nil foo-mode))
+                 (use-package-normalize/:delight 'foo-mode :delight nil)))
+  (should (equal `((bar-mode nil foo))
+                 (use-package-normalize/:delight 'foo :delight '(bar-mode))))
+  (should (equal `((bar-mode nil :major))
+                 (use-package-normalize/:delight 'foo :delight '((bar-mode nil 
:major)))))
+  (should (equal `((foo-mode "abc" foo))
+                 (use-package-normalize/:delight 'foo :delight '("abc"))))
+  (should (equal `((foo-mode (:eval 1) foo))
+                 (use-package-normalize/:delight 'foo :delight '('(:eval 1)))))
+  (should (equal (use-package-normalize/:delight 'foo :delight '((a-mode) 
(b-mode " b")))
+                 `((a-mode nil foo) (b-mode " b" foo))))
+  (should-error (use-package-normalize/:delight 'foo :delight '((:eval 1)))))
+
+(ert-deftest use-package-test/:delight-1 ()
+  (match-expansion
+   (use-package foo :delight)
+   `(progn
+      (require 'foo nil nil)
+      (if (fboundp 'delight)
+          (delight '((foo-mode nil foo)))))))
+
+(ert-deftest use-package-test/:delight-2 ()
+  (should-error
+   (match-expansion
+    (use-package foo :delight nil)
+    `(progn
+       (require 'foo nil nil)
+       (if (fboundp 'diminish)
+           (diminish 'foo-mode))))))
+
+(ert-deftest use-package-test/:delight-3 ()
+  (match-expansion
+   (use-package foo :delight bar)
+   `(progn
+      (require 'foo nil nil)
+      (if (fboundp 'delight)
+          (delight '((bar nil foo)))))))
+
+(ert-deftest use-package-test/:delight-4 ()
+  (match-expansion
+   (use-package foo :delight "bar")
+   `(progn
+      (require 'foo nil nil)
+      (if (fboundp 'delight)
+          (delight '((foo-mode "bar" foo)))))))
+
+(ert-deftest use-package-test/:delight-5 ()
+  (should-error
+   (match-expansion
+    (use-package foo :delight (foo . "bar"))
+    `(progn
+       (require 'foo nil nil)
+       (if (fboundp 'diminish)
+           (diminish 'foo "bar"))))))
+
+(ert-deftest use-package-test/:delight-6 ()
+  (match-expansion
+   (use-package foo :delight (foo "bar"))
+   `(progn
+      (require 'foo nil nil)
+      (if (fboundp 'delight)
+          (delight '((foo "bar" foo)))))))
+
+(ert-deftest use-package-test/334-1 ()
+  (let (foo1-map foo2-map
+                 bar1-func1
+                 bar1-func2
+                 bar2-func1
+                 bar2-func2
+                 bar3-func1
+                 bar3-func2
+                 bar4-func1
+                 bar4-func2)
+    (match-expansion
+     (bind-keys :map foo1-map
+                ("Y" . foo1)
+                :prefix "y"
+                :prefix-map bar1-prefix-map
+                ("y" . bar1-func1)
+                ("f" . bar1-func2)
+                :prefix "y"
+                :prefix-map bar2-prefix-map
+                ("y" . bar2-func1)
+                ("f" . bar2-func2)
+                :map foo2-map
+                ("Y" . foo2)
+                :prefix "y"
+                :prefix-map bar3-prefix-map
+                ("y" . bar3-func1)
+                ("f" . bar3-func2)
+                :prefix "y"
+                :prefix-map bar4-prefix-map
+                ("y" . bar4-func1)
+                ("f" . bar4-func2))
+     `(progn
+        (bind-key "Y" #'foo1 foo1-map nil)
+        (defvar bar1-prefix-map)
+        (define-prefix-command 'bar1-prefix-map)
+        (bind-key "y" 'bar1-prefix-map foo1-map nil)
+        (bind-key "y" #'bar1-func1 bar1-prefix-map nil)
+        (bind-key "f" #'bar1-func2 bar1-prefix-map nil)
+        (defvar bar2-prefix-map)
+        (define-prefix-command 'bar2-prefix-map)
+        (bind-key "y" 'bar2-prefix-map foo1-map nil)
+        (bind-key "y" #'bar2-func1 bar2-prefix-map nil)
+        (bind-key "f" #'bar2-func2 bar2-prefix-map nil)
+        (bind-key "Y" #'foo2 foo2-map nil)
+        (defvar bar3-prefix-map)
+        (define-prefix-command 'bar3-prefix-map)
+        (bind-key "y" 'bar3-prefix-map foo2-map nil)
+        (bind-key "y" #'bar3-func1 bar3-prefix-map nil)
+        (bind-key "f" #'bar3-func2 bar3-prefix-map nil)
+        (defvar bar4-prefix-map)
+        (define-prefix-command 'bar4-prefix-map)
+        (bind-key "y" 'bar4-prefix-map foo2-map nil)
+        (bind-key "y" #'bar4-func1 bar4-prefix-map nil)
+        (bind-key "f" #'bar4-func2 bar4-prefix-map nil)))))
+
+(ert-deftest use-package-test/334-2 ()
+  (let (w3m-lnum-mode-map
+        w3m-print-current-url
+        w3m-lnum-print-this-url
+        w3m-print-this-url)
+    (match-expansion
+     (bind-keys :map w3m-lnum-mode-map
+                :prefix "y"
+                :prefix-map w3m-y-prefix-map
+                ("y" . w3m-print-current-url)
+                ("f" . w3m-lnum-print-this-url)
+                ("t" . w3m-print-this-url))
+     `(progn
+        (defvar w3m-y-prefix-map)
+        (define-prefix-command 'w3m-y-prefix-map)
+        (bind-key "y" 'w3m-y-prefix-map w3m-lnum-mode-map nil)
+        (bind-key "y" #'w3m-print-current-url w3m-y-prefix-map nil)
+        (bind-key "f" #'w3m-lnum-print-this-url w3m-y-prefix-map nil)
+        (bind-key "t" #'w3m-print-this-url w3m-y-prefix-map nil)))))
+
+(ert-deftest use-package-test/482-1 ()
+  (match-expansion
+   (use-package simple
+     :bind-keymap ("C-t " . my/transpose-map)
+     :bind (:map my/transpose-map
+                ("w" . transpose-words)))
+   `(progn
+      (unless (fboundp 'transpose-words)
+        (autoload #'transpose-words "simple" nil t))
+      (bind-key "C-t "
+                #'(lambda nil
+                    (interactive)
+                    (use-package-autoload-keymap 'my/transpose-map 'simple 
nil)))
+      (bind-keys :package simple :map my/transpose-map
+                 ("w" . transpose-words)))))
+
+(ert-deftest use-package-test/482-2 ()
+  (match-expansion
+   (use-package simple
+     :bind (:prefix-map my/transpose-map
+                        :prefix "C-t"
+                        ("w" . transpose-words)))
+   `(progn
+      (unless (fboundp 'transpose-words)
+        (autoload #'transpose-words "simple" nil t))
+      (bind-keys :package simple
+                 :prefix-map my/transpose-map
+                 :prefix "C-t"
+                 ("w" . transpose-words)))))
+
+(ert-deftest use-package-test/482-3 ()
+  (match-expansion
+   (bind-keys :package simple
+              :prefix-map my/transpose-map
+              :prefix "C-t"
+              ("w" . transpose-words))
+   `(progn
+      (defvar my/transpose-map)
+      (define-prefix-command 'my/transpose-map)
+      (bind-key "C-t" 'my/transpose-map nil nil)
+      (bind-key "w" #'transpose-words my/transpose-map nil))))
+
+(ert-deftest use-package-test/538 ()
+  (match-expansion
+   (use-package mu4e
+     :commands (mu4e)
+     :bind (("<f9>" . mu4e))
+     :init
+     :config
+     (config))
+   `(progn
+      (unless (fboundp 'mu4e)
+        (autoload #'mu4e "mu4e" nil t))
+      (eval-after-load 'mu4e
+        '(progn (config) t))
+      (bind-keys :package mu4e ("<f9>" . mu4e)))))
+
+(ert-deftest use-package-test/543 ()
+  (match-expansion
+   (use-package hydra
+     :ensure)
+   `(progn
+      (use-package-ensure-elpa 'hydra '(t) 'nil)
+      (require 'hydra nil nil))))
+
+(ert-deftest use-package-test/545 ()
+  (match-expansion
+   (use-package spacemacs-theme
+     :ensure t
+     :init                                 ; or :config
+     (load-theme 'spacemacs-dark t)
+     )
+   `(progn
+      (use-package-ensure-elpa 'spacemacs-theme '(t) 'nil)
+      (load-theme 'spacemacs-dark t)
+      (require 'spacemacs-theme nil nil))
+   ))
+
+(ert-deftest use-package-test/550 ()
+  (match-expansion
+   (use-package company-try-hard
+     :ensure t
+     :bind
+     ("C-c M-/" . company-try-hard)
+     (:map company-active-map
+           ("C-c M-/" . company-try-hard)))
+   `(progn
+      (use-package-ensure-elpa 'company-try-hard
+                               '(t)
+                               'nil)
+      (unless
+          (fboundp 'company-try-hard)
+        (autoload #'company-try-hard "company-try-hard" nil t))
+      (bind-keys :package company-try-hard
+                 ("C-c M-/" . company-try-hard)
+                 :map company-active-map
+                 ("C-c M-/" . company-try-hard)))))
+
+(ert-deftest use-package-test/558 ()
+  (match-expansion
+   (bind-keys* :package org-ref
+               ("C-c C-r" . org-ref-helm-insert-cite-link))
+   `(bind-key "C-c C-r" #'org-ref-helm-insert-cite-link override-global-map 
nil)))
+
+(ert-deftest use-package-test/560 ()
+  (cl-letf (((symbol-function #'executable-find) #'ignore))
+    (let (notmuch-command)
+      (match-expansion
+       (use-package notmuch
+         :preface (setq-default notmuch-command (executable-find "notmuch"))
+         :if notmuch-command
+         :requires foo
+         :load-path "foo"
+         :defines var)
+       `(progn
+          (eval-and-compile
+            (add-to-list 'load-path ,(pred stringp)))
+          (when (featurep 'foo)
+            (eval-and-compile
+              (setq-default notmuch-command
+                            (executable-find "notmuch")))
+            (when (symbol-value 'notmuch-command)
+              (require 'notmuch nil nil))))))))
+
+(ert-deftest use-package-test/572-1 ()
+  (let ((use-package-always-defer t))
+    (match-expansion
+     (use-package auth-password-store
+       :after auth-source
+       :init
+       (setq auth-sources '(password-store)))
+     `(eval-after-load 'auth-source
+        '(setq auth-sources '(password-store))))))
+
+(ert-deftest use-package-test/572-2 ()
+  (let ((use-package-always-defer t))
+    (match-expansion
+     (use-package ivy-hydra :after ivy)
+     `nil)))
+
+(ert-deftest use-package-test/572-3 ()
+  (let ((use-package-always-defer t)
+        (use-package-defaults
+         (let ((defaults (copy-alist use-package-defaults)))
+           (setcdr (assq :defer defaults)
+                   '(use-package-always-defer
+                     (lambda (name args)
+                       (and use-package-always-defer
+                            (not (plist-member args :after))
+                            (not (plist-member args :defer))
+                            (not (plist-member args :demand))))))
+           defaults)))
+    (match-expansion
+     (use-package ivy-hydra :after ivy)
+     `(eval-after-load 'ivy
+        '(require 'ivy-hydra nil nil)))))
+
+(ert-deftest use-package-test/575-1 ()
+  (match-expansion
+   (use-package helm
+     :defer t
+     :after (:any ido dired)
+     :config
+     (message "test. helm start"))
+   `(progn
+      (defvar ,_ nil)
+      (defvar ,_ nil)
+      (defvar ,_
+        #'(lambda nil
+            (if ,_ ,_
+              (setq ,_ t ,_
+                    (eval-after-load 'helm
+                      '(progn
+                         (message "test. helm start")
+                         t))))))
+      (eval-after-load 'ido
+        '(funcall ,_))
+      (eval-after-load 'dired
+        '(funcall ,_)))))
+
+(ert-deftest use-package-test/575-2 ()
+  (match-expansion
+   (use-package helm
+     :defer t
+     :bind ("C-c d" . helm-mini)
+     :config
+     (message "test. helm start"))
+   `(progn
+      (unless (fboundp 'helm-mini)
+        (autoload #'helm-mini "helm" nil t))
+      (eval-after-load 'helm
+        '(progn
+           (message "test. helm start")
+           t))
+      (bind-keys :package helm ("C-c d" . helm-mini)))))
+
+(ert-deftest use-package-test/585 ()
+  (match-expansion
+   (use-package bug
+     :bind (:map bug-map ("C-a" . alpha))
+     :bind (("C-b" . beta)))
+   `(progn
+      (unless (fboundp 'alpha)
+        (autoload #'alpha "bug" nil t))
+      (unless (fboundp 'beta)
+        (autoload #'beta "bug" nil t))
+      (bind-keys :package bug :map bug-map
+                 ("C-a" . alpha))
+      (bind-keys :package bug
+                 ("C-b" . beta)))))
+
+(ert-deftest use-package-test/589 ()
+  (let ((use-package-verbose t)
+        (use-package-expand-minimally t)
+        debug-on-error
+        warnings)
+    (cl-letf (((symbol-function #'display-warning)
+               (lambda (_ msg _) (push msg warnings))))
+      (progn
+        (macroexpand-1
+         '(use-package ediff :defer t (setq my-var t)))
+        (should (= (and (> (length warnings) 0)
+                        (string-match ":defer wants exactly one argument"
+                                      (car warnings))) 44))))))
+
+(ert-deftest use-package-test/591 ()
+  (let ((use-package-defaults
+         (cons '(:if (lambda (name _) `(locate-library ,name)) t)
+               use-package-defaults)))
+    (match-expansion
+     (use-package nonexistent
+       :hook lisp-mode)
+     `(when (locate-library nonexistent)
+        (unless (fboundp 'nonexistent-mode)
+          (autoload #'nonexistent-mode "nonexistent" nil t))
+        (add-hook 'lisp-mode-hook #'nonexistent-mode)))))
+
+(ert-deftest bind-key/:prefix-map ()
+  (match-expansion
+   (bind-keys :prefix "<f1>"
+              :prefix-map my/map)
+   `(progn
+      (defvar my/map)
+      (define-prefix-command 'my/map)
+      (bind-key "<f1>" 'my/map nil nil))))
+
+
+(ert-deftest bind-key/845 ()
+  (defvar test-map (make-keymap))
+  (bind-key "<f1>" 'ignore 'test-map)
+  (should (eq (lookup-key test-map (kbd "<f1>")) 'ignore))
+  (let ((binding (cl-find "<f1>" personal-keybindings :test 'string= :key 
'caar)))
+    (message "test-map %s" test-map)
+    (message "binding %s" binding)
+    (should (eq (cdar binding) 'test-map))
+    (should (eq (nth 1 binding) 'ignore))
+    (should (eq (nth 2 binding) nil))))
+
+;; Local Variables:
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+
+;;; use-package-tests.el ends here
diff --git a/test/manual/cedet/cedet-utests.el 
b/test/manual/cedet/cedet-utests.el
index b365908c63..2c5ba46855 100644
--- a/test/manual/cedet/cedet-utests.el
+++ b/test/manual/cedet/cedet-utests.el
@@ -333,7 +333,8 @@ ERRORCONDITION is some error that may have occurred during 
testing."
   "Add into the log that the last item is done.
 Apply NOTES to the doneness of the log.
 Apply ERR if there was an error in previous item.
-Optional argument PRECR indicates to prefix the done msg w/ a newline."
+Optional argument PRECR indicates to prefix the done message with
+a newline."
   (if noninteractive
       ;; Non-interactive-mode - show a message.
       (if notes
diff --git a/test/manual/cedet/semantic-tests.el 
b/test/manual/cedet/semantic-tests.el
index dcdeb45b0a..1d0e668d96 100644
--- a/test/manual/cedet/semantic-tests.el
+++ b/test/manual/cedet/semantic-tests.el
@@ -87,7 +87,8 @@ run the test again")))
 (defun semanticdb-test-gnu-global (searchfor &optional standardfile)
   "Test the GNU Global semanticdb.
 Argument SEARCHFOR is the text to search for.
-If optional arg STANDARDFILE is non-nil, use a standard file w/ global 
enabled."
+If optional arg STANDARDFILE is non-nil, use a standard file with
+global enabled."
   (interactive "sSearch For Tag: \nP")
 
   (require 'data-debug)
diff --git a/test/manual/cedet/tests/testpolymorph.cpp 
b/test/manual/cedet/tests/testpolymorph.cpp
index ba64e39a7a..cfe44ecc4d 100644
--- a/test/manual/cedet/tests/testpolymorph.cpp
+++ b/test/manual/cedet/tests/testpolymorph.cpp
@@ -22,7 +22,7 @@
 
 #include <cmath>
 
-// Test 1 - Functions w/ prototypes
+// Test 1 - Functions with prototypes
 namespace proto {
 
   int pt_func1(int arg1);
@@ -32,7 +32,7 @@ namespace proto {
 
 }
 
-// Test 2 - Functions w/ different arg lists.
+// Test 2 - Functions with different arg lists.
 namespace fcn_poly {
 
   int pm_func(void) {
@@ -50,7 +50,7 @@ namespace fcn_poly {
 
 }
 
-// Test 3 - Methods w/ different arg lists.
+// Test 3 - Methods with different arg lists.
 class meth_poly {
 public:
   int pm_meth(void) {
@@ -68,7 +68,7 @@ public:
 
 };
 
-// Test 4 - Templates w/ partial specifiers.
+// Test 4 - Templates with partial specifiers.
 namespace template_partial_spec {
   template <typename T> class test
   {
@@ -83,7 +83,7 @@ namespace template_partial_spec {
   };
 }
 
-// Test 5 - Templates w/ full specialization which may or may not share
+// Test 5 - Templates with full specialization which may or may not share
 // common functions.
 namespace template_full_spec {
   template <typename T> class test
diff --git a/test/manual/cedet/tests/testsppreplace.c 
b/test/manual/cedet/tests/testsppreplace.c
index 54ae3f0323..d255c202d3 100644
--- a/test/manual/cedet/tests/testsppreplace.c
+++ b/test/manual/cedet/tests/testsppreplace.c
@@ -66,7 +66,7 @@ int myFcn3 (int a, int b);
 
 MULTI_ARGS(ma_struct, moose, penguin, emu);
 
-/* TEST: Macro w/ args, but no body. */
+/* TEST: Macro with args, but no body. */
 #define NO_BODY(name)
 
 NO_BODY(Moose);
@@ -78,7 +78,7 @@ int not_with_args_fcn NOT_WITH_ARGS
 {
 }
 
-/* TEST: macro w/ continuation. */
+/* TEST: macro with continuation. */
 #define WITH_CONT \
   continuation_symbol
 
diff --git a/test/manual/cedet/tests/testsppreplaced.c 
b/test/manual/cedet/tests/testsppreplaced.c
index c359fa7d69..c98349174e 100644
--- a/test/manual/cedet/tests/testsppreplaced.c
+++ b/test/manual/cedet/tests/testsppreplaced.c
@@ -55,14 +55,14 @@ int myFcn3 (int a, int b);
 /* TEST: Multiple args to a macro. */
 struct ma_struct { int moose; int penguin; int emu; };
 
-/* TEST: Macro w/ args, but no body. */
+/* TEST: Macro with args, but no body. */
 
 /* TEST: Not a macro with args, but close. */
 int not_with_args_fcn (moose)
 {
 }
 
-/* TEST: macro w/ continuation. */
+/* TEST: macro with continuation. */
 int continuation_symbol () { };
 
 /* TEST: macros in a macro - tail processing */
diff --git a/test/manual/etags/CTAGS.good_crlf 
b/test/manual/etags/CTAGS.good_crlf
new file mode 100644
index 0000000000..3d64fa63c7
--- /dev/null
+++ b/test/manual/etags/CTAGS.good_crlf
@@ -0,0 +1,4484 @@
+#a-defer-word  forth-src/test-forth.fth        /^defer #a-defer-word$/
+#some-storage  forth-src/test-forth.fth        /^2000 buffer: #some-storage$/
+$0x80  c-src/sysdep.h  32
+$SYS_##syscall_na      c-src/sysdep.h  31
+$domain        php-src/lce_functions.php       175
+$filename      php-src/lce_functions.php       174
+$ignore_ws     php-src/lce_functions.php       171
+$memassign     php-src/ptest.php       9
+$memassign_space       php-src/ptest.php       10
+$member        php-src/ptest.php       8
+$msgid php-src/lce_functions.php       107
+$msgid php-src/lce_functions.php       165
+$msgid_lc      php-src/lce_functions.php       113
+$msgstr        php-src/lce_functions.php       108
+$msgstr        php-src/lce_functions.php       166
+$msgstr_lc     php-src/lce_functions.php       114
+$po_entries    php-src/lce_functions.php       172
+$poe_num       php-src/lce_functions.php       173
+$por_a php-src/lce_functions.php       500
+$prefix        php-src/lce_functions.php       72
+$state php-src/lce_functions.php       170
+$sys_comment   php-src/lce_functions.php       110
+$sys_comment   php-src/lce_functions.php       168
+$sys_comment_lc        php-src/lce_functions.php       116
+$test  php-src/ptest.php       12
+$unk_comment   php-src/lce_functions.php       111
+$unk_comment   php-src/lce_functions.php       169
+$unk_comment_lc        php-src/lce_functions.php       117
+$user_comment  php-src/lce_functions.php       109
+$user_comment  php-src/lce_functions.php       167
+$user_comment_lc       php-src/lce_functions.php       115
+${CHECKOBJS}   make-src/Makefile       /^${CHECKOBJS}: CFLAGS=-g3 
-DNULLFREECHECK=0$/
+%cdiff make-src/Makefile       /^%cdiff: CTAGS% CTAGS ${infiles}$/
+%ediff make-src/Makefile       /^%ediff: ETAGS% ETAGS ${infiles}$/
+($_,$flag,$opt,$f,$r,@temp     perl-src/yagrip.pl      8
+($prog,$_,@list        perl-src/yagrip.pl      39
+($string,$flag,@string,@temp,@last     perl-src/yagrip.pl      40
+(a-forth-constant      forth-src/test-forth.fth        /^constant 
(a-forth-constant$/
+(another-forth-word)   forth-src/test-forth.fth        /^: 
(another-forth-word) ( -- )$/
+(foo)  forth-src/test-forth.fth        /^: (foo) 1 ;$/
++      ruby-src/test.rb        /^        def +(y)$/
++      tex-src/texinfo.tex     /^\\def+{{\\tt \\char 43}}$/
+.PRECIOUS      make-src/Makefile       /^.PRECIOUS: ETAGS CTAGS ETAGS16 
CTAGS16 ETAGS17 CTA/
+/.notdef       ps-src/rfc1245.ps       /^\/.notdef \/.notdef \/.notdef 
\/.notdef \/.notdef \/.not/
+/.notdef       ps-src/rfc1245.ps       /^\/.notdef \/.notdef \/.notdef 
\/.notdef \/space \/exclam/
+/A     ps-src/rfc1245.ps       /^\/A { $/
+/Acircumflex   ps-src/rfc1245.ps       /^\/Acircumflex \/Ecircumflex \/Aacute 
\/Edieresis \/Egra/
+/B     ps-src/rfc1245.ps       /^\/B { $/
+/BEGINBITMAP2BIT       ps-src/rfc1245.ps       /^\/BEGINBITMAP2BIT { $/
+/BEGINBITMAP2BITc      ps-src/rfc1245.ps       /^\/BEGINBITMAP2BITc { $/
+/BEGINBITMAPBW ps-src/rfc1245.ps       /^\/BEGINBITMAPBW { $/
+/BEGINBITMAPBWc        ps-src/rfc1245.ps       /^\/BEGINBITMAPBWc { $/
+/BEGINBITMAPGRAY       ps-src/rfc1245.ps       /^\/BEGINBITMAPGRAY { $/
+/BEGINBITMAPGRAYc      ps-src/rfc1245.ps       /^\/BEGINBITMAPGRAYc { $/
+/BEGINPRINTCODE        ps-src/rfc1245.ps       /^\/BEGINPRINTCODE { $/
+/BF    ps-src/rfc1245.ps       /^\/BF { $/
+/BITMAPCOLOR   ps-src/rfc1245.ps       /^\/BITMAPCOLOR { $/
+/BITMAPCOLORc  ps-src/rfc1245.ps       /^\/BITMAPCOLORc { $/
+/BITMAPGRAY    ps-src/rfc1245.ps       /^\/BITMAPGRAY { $/
+/BITMAPGRAYc   ps-src/rfc1245.ps       /^\/BITMAPGRAYc { $/
+/C     ps-src/rfc1245.ps       /^\/C { $/
+/COMMONBITMAP  ps-src/rfc1245.ps       /^\/COMMONBITMAP { $/
+/COMMONBITMAPc ps-src/rfc1245.ps       /^\/COMMONBITMAPc { $/
+/D     ps-src/rfc1245.ps       /^\/D {curveto} bind def$/
+/DiacriticEncoding     ps-src/rfc1245.ps       /^\/DiacriticEncoding [$/
+/E     ps-src/rfc1245.ps       /^\/E {lineto} bind def$/
+/ENDBITMAP     ps-src/rfc1245.ps       /^\/ENDBITMAP {$/
+/ENDPRINTCODE  ps-src/rfc1245.ps       /^\/ENDPRINTCODE {$/
+/F     ps-src/rfc1245.ps       /^\/F { $/
+/FMBEGINEPSF   ps-src/rfc1245.ps       /^\/FMBEGINEPSF { $/
+/FMBEGINPAGE   ps-src/rfc1245.ps       /^\/FMBEGINPAGE { $/
+/FMDEFINEFONT  ps-src/rfc1245.ps       /^\/FMDEFINEFONT { $/
+/FMDOCUMENT    ps-src/rfc1245.ps       /^\/FMDOCUMENT { $/
+/FMENDEPSF     ps-src/rfc1245.ps       /^\/FMENDEPSF {$/
+/FMENDPAGE     ps-src/rfc1245.ps       /^\/FMENDPAGE {$/
+/FMLOCAL       ps-src/rfc1245.ps       /^\/FMLOCAL {$/
+/FMNORMALIZEGRAPHICS   ps-src/rfc1245.ps       /^\/FMNORMALIZEGRAPHICS { $/
+/FMVERSION     ps-src/rfc1245.ps       /^\/FMVERSION {$/
+/FMversion     ps-src/rfc1245.ps       /^\/FMversion (2.0) def $/
+/Fmcc  ps-src/rfc1245.ps       /^\/Fmcc {$/
+/FrameDict     ps-src/rfc1245.ps       /^\/FrameDict 190 dict def $/
+/G     ps-src/rfc1245.ps       /^\/G { $/
+/H     ps-src/rfc1245.ps       /^\/H { $/
+/Icircumflex   ps-src/rfc1245.ps       /^\/Icircumflex \/Idieresis \/Igrave 
\/Oacute \/Ocircumfl/
+/L     ps-src/rfc1245.ps       /^\/L \/M \/N \/O \/P \/Q \/R \/S \/T \/U \/V 
\/W \/X \/Y \/Z \/brac/
+/L     ps-src/rfc1245.ps       /^\/L { $/
+/M     ps-src/rfc1245.ps       /^\/M {newpath moveto} bind def$/
+/N     ps-src/rfc1245.ps       /^\/N { $/
+/Ntilde        ps-src/rfc1245.ps       /^\/Ntilde \/Odieresis \/Udieresis 
\/aacute \/agrave \/aci/
+/O     ps-src/rfc1245.ps       /^\/O {closepath} bind def$/
+/Otilde        ps-src/rfc1245.ps       /^\/Otilde \/OE \/oe \/endash \/emdash 
\/quotedblleft \/quo/
+/P     ps-src/rfc1245.ps       /^\/P { $/
+/PF    ps-src/rfc1245.ps       /^\/PF { $/
+/R     ps-src/rfc1245.ps       /^\/R { $/
+/RF    ps-src/rfc1245.ps       /^\/RF { $/
+/RR    ps-src/rfc1245.ps       /^\/RR { $/
+/ReEncode      ps-src/rfc1245.ps       /^\/ReEncode { $/
+/S     ps-src/rfc1245.ps       /^\/S { $/
+/SF    ps-src/rfc1245.ps       /^\/SF { $/
+/T     ps-src/rfc1245.ps       /^\/T { $/
+/TF    ps-src/rfc1245.ps       /^\/TF { $/
+/U     ps-src/rfc1245.ps       /^\/U { $/
+/Uacute        ps-src/rfc1245.ps       /^\/Uacute \/Ucircumflex \/Ugrave 
\/dotlessi \/circumflex/
+/V     ps-src/rfc1245.ps       /^\/V { $/
+/W     ps-src/rfc1245.ps       /^\/W { $/
+/X     ps-src/rfc1245.ps       /^\/X { $/
+/Y     ps-src/rfc1245.ps       /^\/Y { $/
+/Z     ps-src/rfc1245.ps       /^\/Z {$/
+/atilde        ps-src/rfc1245.ps       /^\/atilde \/aring \/ccedilla \/eacute 
\/egrave \/ecircumf/
+/bl    ps-src/rfc1245.ps       /^\/bl { $/
+/braceright    ps-src/rfc1245.ps       /^\/braceright \/asciitilde \/.notdef 
\/Adieresis \/Aring/
+/bracketright  ps-src/rfc1245.ps       /^\/bracketright \/asciicircum 
\/underscore \/grave \/a \//
+/breve ps-src/rfc1245.ps       /^\/breve \/dotaccent \/ring \/cedilla 
\/hungarumlaut \/og/
+/cfs   ps-src/rfc1245.ps       /^\/cfs { $/
+/colorsetup    ps-src/rfc1245.ps       /^\/colorsetup {$/
+/desperatepapersize    ps-src/rfc1245.ps       /^\/desperatepapersize {$/
+/dieresis      ps-src/rfc1245.ps       /^\/dieresis \/.notdef \/AE \/Oslash 
\/.notdef \/.notdef \//
+/dmatrix       ps-src/rfc1245.ps       /^\/dmatrix matrix def$/
+/dnormalize    ps-src/rfc1245.ps       /^\/dnormalize {$/
+/dpi   ps-src/rfc1245.ps       /^\/dpi    72 0 dmatrix defaultmatrix 
dtransform$/
+/exclamdown    ps-src/rfc1245.ps       /^\/exclamdown \/logicalnot \/.notdef 
\/florin \/.notdef /
+/fakecolorsetup        ps-src/rfc1245.ps       /^\/fakecolorsetup {$/
+/fillprocs     ps-src/rfc1245.ps       /^\/fillprocs 32 array def$/
+/fl    ps-src/rfc1245.ps       /^\/fl { $/
+/fraction      ps-src/rfc1245.ps       /^\/fraction \/currency \/guilsinglleft 
\/guilsinglright/
+/freq  ps-src/rfc1245.ps       /^\/freq dpi 18.75 div 8 div round dup 0 eq 
{pop 1} i/
+/gn    ps-src/rfc1245.ps       /^\/gn { $/
+/graymode      ps-src/rfc1245.ps       /^\/graymode true def$/
+/grayness      ps-src/rfc1245.ps       /^\/grayness {$/
+/guillemotleft ps-src/rfc1245.ps       /^\/guillemotleft \/guillemotright 
\/ellipsis \/.notdef /
+/home/www/pub/etags.c.gz       make-src/Makefile       
/^\/home\/www\/pub\/etags.c.gz: etags.c$/
+/home/www/pub/software/unix/etags.tar.gz       make-src/Makefile       
/^\/home\/www\/pub\/software\/unix\/etags.tar.gz: Makefile/
+/hx    ps-src/rfc1245.ps       /^\/hx { $/
+/i     ps-src/rfc1245.ps       /^\/i \/j \/k \/l \/m \/n \/o \/p \/q \/r \/s 
\/t \/u \/v \/w \/x \/y/
+/iacute        ps-src/rfc1245.ps       /^\/iacute \/igrave \/icircumflex 
\/idieresis \/ntilde \/o/
+/ic    ps-src/rfc1245.ps       /^\/ic [ $/
+/inch  ps-src/rfc1245.ps       /^\/inch {72 mul} def$/
+/ip    ps-src/rfc1245.ps       /^\/ip { $/
+/less  ps-src/rfc1245.ps       /^\/less \/equal \/greater \/question \/at \/A 
\/B \/C \/D \/E/
+/lnormalize    ps-src/rfc1245.ps       /^\/lnormalize { $/
+/manualpapersize       ps-src/rfc1245.ps       /^\/manualpapersize {$/
+/max   ps-src/rfc1245.ps       /^\/max {2 copy lt {exch} if pop} bind def$/
+/min   ps-src/rfc1245.ps       /^\/min {2 copy gt {exch} if pop} bind def$/
+/ms    ps-src/rfc1245.ps       /^\/ms { $/
+/nbluet        ps-src/rfc1245.ps       /^\/nbluet 256 array def$/
+/ngrayt        ps-src/rfc1245.ps       /^\/ngrayt 256 array def$/
+/ngreent       ps-src/rfc1245.ps       /^\/ngreent 256 array def$/
+/normalize     ps-src/rfc1245.ps       /^\/normalize {$/
+/nredt ps-src/rfc1245.ps       /^\/nredt 256 array def$/
+/numbersign    ps-src/rfc1245.ps       /^\/numbersign \/dollar \/percent 
\/ampersand \/quotesing/
+/ocircumflex   ps-src/rfc1245.ps       /^\/ocircumflex \/odieresis \/otilde 
\/uacute \/ugrave \/u/
+/ordfeminine   ps-src/rfc1245.ps       /^\/ordfeminine \/ordmasculine 
\/.notdef \/ae \/oslash \/q/
+/pagedimen     ps-src/rfc1245.ps       /^\/pagedimen { $/
+/papersize     ps-src/rfc1245.ps       /^\/papersize {$/
+/paragraph     ps-src/rfc1245.ps       /^\/paragraph \/germandbls \/registered 
\/copyright \/tra/
+/parenright    ps-src/rfc1245.ps       /^\/parenright \/asterisk \/plus 
\/comma \/hyphen \/period/
+/periodcentered        ps-src/rfc1245.ps       /^\/periodcentered 
\/quotesinglbase \/quotedblbase \/per/
+/quoteleft     ps-src/rfc1245.ps       /^\/quoteleft \/quoteright \/.notdef 
\/.notdef \/ydieresi/
+/restorematrix ps-src/rfc1245.ps       /^\/restorematrix {$/
+/s1    ps-src/rfc1245.ps       /^\/s1 1 string def$/
+/sangle        ps-src/rfc1245.ps       /^\/sangle 1 0 dmatrix defaultmatrix 
dtransform exch /
+/savematrix    ps-src/rfc1245.ps       /^\/savematrix {$/
+/setmanualfeed ps-src/rfc1245.ps       /^\/setmanualfeed {$/
+/setpapername  ps-src/rfc1245.ps       /^\/setpapername { $/
+/setpattern    ps-src/rfc1245.ps       /^\/setpattern {$/
+/two   ps-src/rfc1245.ps       /^\/two \/three \/four \/five \/six \/seven 
\/eight \/nine \//
+/udieresis     ps-src/rfc1245.ps       /^\/udieresis \/dagger \/.notdef \/cent 
\/sterling \/secti/
+/wbytes        ps-src/rfc1245.ps       /^\/wbytes { $/
+/wh    ps-src/rfc1245.ps       /^\/wh { $/
+/yen   ps-src/rfc1245.ps       /^\/yen \/.notdef \/.notdef \/.notdef \/.notdef 
\/.notdef /
+2const forth-src/test-forth.fth        /^3 4 2constant 2const$/
+2val   forth-src/test-forth.fth        /^2const 2value 2val$/
+2var   forth-src/test-forth.fth        /^2variable 2var$/
+:a-forth-dictionary-entry      forth-src/test-forth.fth        /^create 
:a-forth-dictionary-entry$/
+<      tex-src/texinfo.tex     /^\\def<{{\\tt \\less}}$/
+<<     ruby-src/test.rb        /^        def <<(y)$/
+<=     ruby-src/test.rb        /^        def <=(y)$/
+<=>    ruby-src/test.rb        /^        def <=>(y)$/
+=      tex-src/texinfo.tex     /^\\global\\def={{\\tt \\char 61}}}$/
+=      tex-src/texinfo.tex     /^\\global\\let\\section = \\appendixsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\section = \\numberedsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\section = \\unnumberedsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsection = \\appendixsubsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsection = \\numberedsubsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsection = 
\\unnumberedsubsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsubsection = 
\\appendixsubsubsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsubsection = 
\\numberedsubsubsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsubsection = 
\\unnumberedsubsubsec$/
+=/f    ada-src/etags-test-for.ada      /^   function "=" (L, R : 
System.Address) return Boo/
+==     ruby-src/test.rb        /^        def ==(y)$/
+===    ruby-src/test.rb        /^        def ===(y)$/
+=\indexdummyfont       tex-src/texinfo.tex     /^\\let\\cite=\\indexdummyfont$/
+=\relax        tex-src/texinfo.tex     /^\\let\\appendix=\\relax$/
+=\relax        tex-src/texinfo.tex     /^\\let\\chapter=\\relax$/
+=\relax        tex-src/texinfo.tex     /^\\let\\section=\\relax$/
+=\relax        tex-src/texinfo.tex     /^\\let\\subsection=\\relax$/
+=\relax        tex-src/texinfo.tex     /^\\let\\subsubsection=\\relax$/
+=\smartitalic  tex-src/texinfo.tex     /^\\let\\cite=\\smartitalic$/
+=starts-with-equals!   scm-src/test.scm        /^(define =starts-with-equals! 
#t)$/
+>      tex-src/texinfo.tex     /^\\def>{{\\tt \\gtr}}$/
+>field1        forth-src/test-forth.fth        /^   9   field   >field1$/
+>field2        forth-src/test-forth.fth        /^   5   field   >field2$/
+A      c.c     162
+A      cp-src/c.C      /^void A::A() {}$/
+A      cp-src/c.C      117
+A      cp-src/c.C      39
+A      cp-src/c.C      56
+A      cp-src/c.C      57
+A      cp-src/c.C      73
+A      cp-src/fail.C   23
+A      cp-src/fail.C   7
+A      ruby-src/test1.ru       /^class A$/
+A      ruby-src/test1.ru       /^module A$/
+ABC    ruby-src/test1.ru       11
+ADASRC make-src/Makefile       /^ADASRC=etags-test-for.ada 2ataspri.adb 
2ataspri.ad/
+ADDRESS        c-src/emacs/src/gmalloc.c       /^#define ADDRESS(B)    ((void 
*) (((B) - 1) * BLOCKSIZ/
+ALIGNOF_STRUCT_LISP_VECTOR     c-src/emacs/src/lisp.h  1378
+ALLOCATED_BEFORE_DUMPING       c-src/emacs/src/gmalloc.c       /^#define 
ALLOCATED_BEFORE_DUMPING(P) \\$/
+ALLOCATE_PSEUDOVECTOR  c-src/emacs/src/lisp.h  /^#define 
ALLOCATE_PSEUDOVECTOR(type, field, tag)                       /
+ALLOCATE_ZEROED_PSEUDOVECTOR   c-src/emacs/src/lisp.h  /^#define 
ALLOCATE_ZEROED_PSEUDOVECTOR(type, field, /
+AND    y-src/cccp.c    11
+ANSIC  c-src/h.h       84
+ANSIC  c-src/h.h       85
+AREF   c-src/emacs/src/lisp.h  /^AREF (Lisp_Object array, ptrdiff_t idx)$/
+ARGS   make-src/Makefile       /^ARGS=- < srclist$/
+ARITH_EQUAL    c-src/emacs/src/lisp.h  3498
+ARITH_GRTR     c-src/emacs/src/lisp.h  3501
+ARITH_GRTR_OR_EQUAL    c-src/emacs/src/lisp.h  3503
+ARITH_LESS     c-src/emacs/src/lisp.h  3500
+ARITH_LESS_OR_EQUAL    c-src/emacs/src/lisp.h  3502
+ARITH_NOTEQUAL c-src/emacs/src/lisp.h  3499
+ARRAYELTS      c-src/emacs/src/lisp.h  /^#define ARRAYELTS(arr) (sizeof (arr) 
\/ sizeof (arr/
+ARRAYP c-src/emacs/src/lisp.h  /^ARRAYP (Lisp_Object x)$/
+ARRAY_MARK_FLAG        c-src/emacs/src/lisp.h  768
+ASCII_CHAR_P   c-src/emacs/src/lisp.h  /^#define ASCII_CHAR_P(c) UNSIGNED_CMP 
(c, <, 0x80)$/
+ASET   c-src/emacs/src/lisp.h  /^ASET (Lisp_Object array, ptrdiff_t idx, 
Lisp_Objec/
+ASIZE  c-src/emacs/src/lisp.h  /^ASIZE (Lisp_Object array)$/
+ASRC   make-src/Makefile       /^ASRC=empty.zz empty.zz.gz$/
+AST_Array::AST_Array   cp-src/c.C      /^AST_Array::AST_Array(UTL_ScopedName 
*n, unsigned l/
+AST_ConcreteType::AST_ConcreteType     cp-src/c.C      
/^AST_ConcreteType::AST_ConcreteType(AST_Decl::NodeT/
+AST_Root       cp-src/c.C      92
+AT     cp-src/c.C      52
+AU     cp-src/c.C      53
+AUTOLOADP      c-src/emacs/src/lisp.h  /^AUTOLOADP (Lisp_Object x)$/
+AUTO_CONS      c-src/emacs/src/lisp.h  /^#define AUTO_CONS(name, a, b) 
Lisp_Object name = A/
+AUTO_CONS_EXPR c-src/emacs/src/lisp.h  /^#define AUTO_CONS_EXPR(a, b) \\$/
+AUTO_LIST1     c-src/emacs/src/lisp.h  /^#define AUTO_LIST1(name, a)           
                                \\$/
+AUTO_LIST2     c-src/emacs/src/lisp.h  /^#define AUTO_LIST2(name, a, b)        
                                        \\$/
+AUTO_LIST3     c-src/emacs/src/lisp.h  /^#define AUTO_LIST3(name, a, b, c)     
                                \\$/
+AUTO_LIST4     c-src/emacs/src/lisp.h  /^#define AUTO_LIST4(name, a, b, c, d)  
                                \\$/
+AUTO_STRING    c-src/emacs/src/lisp.h  /^#define AUTO_STRING(name, str)        
                                        \\$/
+AVAIL_ALLOCA   c-src/emacs/src/lisp.h  /^#define AVAIL_ALLOCA(size) (sa_avail 
-= (size), al/
+Abort_Handler_Pointer/t        ada-src/2ataspri.ads    /^   type 
Abort_Handler_Pointer is access procedure /
+Abort_Task/p   ada-src/2ataspri.adb    /^   procedure Abort_Task (T : TCB_Ptr) 
is$/
+Abort_Task/p   ada-src/2ataspri.ads    /^   procedure Abort_Task (T : 
TCB_Ptr);$/
+Abort_Wrapper/p        ada-src/2ataspri.adb    /^   procedure Abort_Wrapper$/
+Ada_funcs      c-src/etags.c   /^Ada_funcs (FILE *inf)$/
+Ada_getit      c-src/etags.c   /^Ada_getit (FILE *inf, const char 
*name_qualifier)$/
+Ada_help       c-src/etags.c   475
+Ada_suffixes   c-src/etags.c   473
+AddNullToNmStr pas-src/common.pas      /^function AddNullToNmStr; (*($/
+Address_To_Call_State/f        ada-src/2ataspri.adb    /^      function 
Address_To_Call_State is new$/
+Address_To_TCB_Ptr/f   ada-src/2ataspri.ads    /^   function 
Address_To_TCB_Ptr is new$/
+Advanced usage tex-src/gzip.texi       /^@node Advanced usage, Environment, 
Invoking gzip, /
+Aligned_Cons   c-src/emacs/src/lisp.h  4670
+Aligned_String c-src/emacs/src/lisp.h  4676
+AppendTextString       pas-src/common.pas      /^function 
AppendTextString;(*($/
+Arith_Comparison       c-src/emacs/src/lisp.h  3497
+Asm_help       c-src/etags.c   504
+Asm_labels     c-src/etags.c   /^Asm_labels (FILE *inf)$/
+Asm_suffixes   c-src/etags.c   493
+B      cp-src/c.C      /^void B::B() {}$/
+B      cp-src/c.C      122
+B      cp-src/c.C      54
+B      cp-src/c.C      56
+B      cp-src/c.C      74
+B      cp-src/fail.C   24
+B      cp-src/fail.C   8
+B      ruby-src/test1.ru       /^  class B$/
+BE_Node        cp-src/c.C      /^void BE_Node::BE_Node() {}$/
+BE_Node        cp-src/c.C      77
+BITS_PER_BITS_WORD     c-src/emacs/src/lisp.h  125
+BITS_PER_BITS_WORD     c-src/emacs/src/lisp.h  129
+BITS_PER_CHAR  c-src/emacs/src/lisp.h  136
+BITS_PER_EMACS_INT     c-src/emacs/src/lisp.h  139
+BITS_PER_LONG  c-src/emacs/src/lisp.h  138
+BITS_PER_SHORT c-src/emacs/src/lisp.h  137
+BITS_WORD_MAX  c-src/emacs/src/lisp.h  124
+BITS_WORD_MAX  c-src/emacs/src/lisp.h  128
+BLACK  cp-src/screen.hpp       12
+BLOCK  c-src/emacs/src/gmalloc.c       /^#define BLOCK(A)      (((char *) (A) 
- _heapbase) \/ BLO/
+BLOCKIFY       c-src/emacs/src/gmalloc.c       /^#define BLOCKIFY(SIZE)        
(((SIZE) + BLOCKSIZE - 1) \//
+BLOCKLOG       c-src/emacs/src/gmalloc.c       125
+BLOCKSIZE      c-src/emacs/src/gmalloc.c       126
+BLUE   cp-src/screen.hpp       13
+BOOL_VECTOR_BITS_PER_CHAR      c-src/emacs/src/lisp.h  114
+BOOL_VECTOR_BITS_PER_CHAR      c-src/emacs/src/lisp.h  115
+BOOL_VECTOR_P  c-src/emacs/src/lisp.h  /^BOOL_VECTOR_P (Lisp_Object a)$/
+BROWN  cp-src/screen.hpp       18
+BUFFERP        c-src/emacs/src/lisp.h  /^BUFFERP (Lisp_Object a)$/
+BUFFERSIZE     objc-src/Subprocess.h   43
+BUFFER_OBJFWDP c-src/emacs/src/lisp.h  /^BUFFER_OBJFWDP (union Lisp_Fwd *a)$/
+BYTE_MARK_STACK        c-src/emacs/src/lisp.h  3181
+Bar    lua-src/test.lua        /^function Square.something:Bar ()$/
+Bar    perl-src/kai-test.pl    /^package Bar;$/
+Barrier_Function_Pointer/t     ada-src/etags-test-for.ada      /^   type 
Barrier_Function_Pointer is access$/
+Bidule/b       ada-src/etags-test-for.ada      /^  protected body Bidule is$/
+Bidule/b       ada-src/waroquiers.ada  /^  protected body Bidule is$/
+Bidule/t       ada-src/etags-test-for.ada      /^  protected Bidule is$/
+Bidule/t       ada-src/waroquiers.ada  /^  protected Bidule is$/
+Body_Required/f        ada-src/etags-test-for.ada      /^   function 
Body_Required$/
+Boo    cp-src/c.C      /^    Boo(int _i, int _a, int _b) : i(_i), a(_a), b(/
+Boo    cp-src/c.C      129
+Boo::Boo       cp-src/c.C      /^Boo::Boo(Boo) :$/
+ButtonBar      pyt-src/server.py       /^def ButtonBar(frame, legend, ref, 
alternatives, co/
+C      cp-src/fail.C   /^                         C(int i) {x = i;}$/
+C      cp-src/fail.C   25
+C      cp-src/fail.C   9
+CALLMANY       c-src/emacs/src/lisp.h  /^#define CALLMANY(f, array) (f) 
(ARRAYELTS (array),/
+CALLN  c-src/emacs/src/lisp.h  /^#define CALLN(f, ...) CALLMANY (f, 
((Lisp_Object [/
+CAR    c-src/emacs/src/lisp.h  /^CAR (Lisp_Object c)$/
+CAR_SAFE       c-src/emacs/src/lisp.h  /^CAR_SAFE (Lisp_Object c)$/
+CATCHER        c-src/emacs/src/lisp.h  3021
+CDR    c-src/emacs/src/lisp.h  /^CDR (Lisp_Object c)$/
+CDR_SAFE       c-src/emacs/src/lisp.h  /^CDR_SAFE (Lisp_Object c)$/
+CFLAGS make-src/Makefile       /^CFLAGS=${WARNINGS} -ansi -g3 # -pg -O$/
+CHAR   c-src/etags.c   /^#define CHAR(x)               ((unsigned int)(x) & 
(CHARS - 1))/
+CHAR   y-src/cccp.c    7
+CHARACTERBITS  c-src/emacs/src/lisp.h  2457
+CHARS  c-src/etags.c   157
+CHARTAB_SIZE_BITS      c-src/emacs/src/lisp.h  1565
+CHARTAB_SIZE_BITS_0    c-src/emacs/src/lisp.h  1567
+CHARTAB_SIZE_BITS_1    c-src/emacs/src/lisp.h  1568
+CHARTAB_SIZE_BITS_2    c-src/emacs/src/lisp.h  1569
+CHARTAB_SIZE_BITS_3    c-src/emacs/src/lisp.h  1570
+CHAR_ALT       c-src/emacs/src/lisp.h  2445
+CHAR_BIT       c-src/emacs/src/lisp.h  2957
+CHAR_BIT       c-src/emacs/src/lisp.h  2959
+CHAR_BIT       c-src/emacs/src/lisp.h  2964
+CHAR_BIT       c-src/emacs/src/lisp.h  2969
+CHAR_BIT       c-src/emacs/src/lisp.h  2974
+CHAR_BIT       c-src/emacs/src/lisp.h  2978
+CHAR_BIT       c-src/emacs/src/lisp.h  2983
+CHAR_CLASS_MAX_LENGTH  c-src/emacs/src/regex.h 593
+CHAR_CLASS_MAX_LENGTH  c-src/emacs/src/regex.h 597
+CHAR_CLASS_MAX_LENGTH  c-src/emacs/src/regex.h 605
+CHAR_CTL       c-src/emacs/src/lisp.h  2449
+CHAR_HYPER     c-src/emacs/src/lisp.h  2447
+CHAR_META      c-src/emacs/src/lisp.h  2450
+CHAR_MODIFIER_MASK     c-src/emacs/src/lisp.h  2452
+CHAR_SHIFT     c-src/emacs/src/lisp.h  2448
+CHAR_SUPER     c-src/emacs/src/lisp.h  2446
+CHAR_TABLE_EXTRA_SLOTS c-src/emacs/src/lisp.h  /^CHAR_TABLE_EXTRA_SLOTS 
(struct Lisp_Char_Table *ct/
+CHAR_TABLE_P   c-src/emacs/src/lisp.h  /^CHAR_TABLE_P (Lisp_Object a)$/
+CHAR_TABLE_REF c-src/emacs/src/lisp.h  /^CHAR_TABLE_REF (Lisp_Object ct, int 
idx)$/
+CHAR_TABLE_REF_ASCII   c-src/emacs/src/lisp.h  /^CHAR_TABLE_REF_ASCII 
(Lisp_Object ct, ptrdiff_t id/
+CHAR_TABLE_SET c-src/emacs/src/lisp.h  /^CHAR_TABLE_SET (Lisp_Object ct, int 
idx, Lisp_Obje/
+CHAR_TABLE_STANDARD_SLOTS      c-src/emacs/src/lisp.h  1697
+CHAR_TYPE_SIZE y-src/cccp.y    87
+CHECKFLAGS     make-src/Makefile       /^CHECKFLAGS=-DDEBUG 
-Wno-unused-function$/
+CHECKOBJS      make-src/Makefile       /^CHECKOBJS=chkmalloc.o chkxm.o$/
+CHECK_ARRAY    c-src/emacs/src/lisp.h  /^CHECK_ARRAY (Lisp_Object x, 
Lisp_Object predicate)/
+CHECK_BOOL_VECTOR      c-src/emacs/src/lisp.h  /^CHECK_BOOL_VECTOR 
(Lisp_Object x)$/
+CHECK_BUFFER   c-src/emacs/src/lisp.h  /^CHECK_BUFFER (Lisp_Object x)$/
+CHECK_CONS     c-src/emacs/src/lisp.h  /^CHECK_CONS (Lisp_Object x)$/
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h  571
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h  572
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h  579
+CHECK_LIST     c-src/emacs/src/lisp.h  /^CHECK_LIST (Lisp_Object x)$/
+CHECK_LIST_CONS        c-src/emacs/src/lisp.h  /^# define CHECK_LIST_CONS(x, 
y) lisp_h_CHECK_LIST_C/
+CHECK_NATNUM   c-src/emacs/src/lisp.h  /^CHECK_NATNUM (Lisp_Object x)$/
+CHECK_NUMBER   c-src/emacs/src/lisp.h  /^# define CHECK_NUMBER(x) 
lisp_h_CHECK_NUMBER (x)$/
+CHECK_NUMBER_CAR       c-src/emacs/src/lisp.h  /^CHECK_NUMBER_CAR (Lisp_Object 
x)$/
+CHECK_NUMBER_CDR       c-src/emacs/src/lisp.h  /^CHECK_NUMBER_CDR (Lisp_Object 
x)$/
+CHECK_NUMBER_COERCE_MARKER     c-src/emacs/src/lisp.h  /^#define 
CHECK_NUMBER_COERCE_MARKER(x)                                 \\$/
+CHECK_NUMBER_OR_FLOAT  c-src/emacs/src/lisp.h  /^CHECK_NUMBER_OR_FLOAT 
(Lisp_Object x)$/
+CHECK_NUMBER_OR_FLOAT_COERCE_MARKER    c-src/emacs/src/lisp.h  /^#define 
CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x)                                /
+CHECK_PROCESS  c-src/emacs/src/lisp.h  /^CHECK_PROCESS (Lisp_Object x)$/
+CHECK_RANGED_INTEGER   c-src/emacs/src/lisp.h  /^#define 
CHECK_RANGED_INTEGER(x, lo, hi)                                       \\$/
+CHECK_STRING_CAR       c-src/emacs/src/lisp.h  /^CHECK_STRING_CAR (Lisp_Object 
x)$/
+CHECK_SYMBOL   c-src/emacs/src/lisp.h  /^# define CHECK_SYMBOL(x) 
lisp_h_CHECK_SYMBOL (x)$/
+CHECK_TYPE     c-src/emacs/src/lisp.h  /^# define CHECK_TYPE(ok, predicate, x) 
lisp_h_CHECK/
+CHECK_TYPE_RANGED_INTEGER      c-src/emacs/src/lisp.h  /^#define 
CHECK_TYPE_RANGED_INTEGER(type, x) \\$/
+CHECK_VECTOR   c-src/emacs/src/lisp.h  /^CHECK_VECTOR (Lisp_Object x)$/
+CHECK_VECTOR_OR_STRING c-src/emacs/src/lisp.h  /^CHECK_VECTOR_OR_STRING 
(Lisp_Object x)$/
+CHECK_WINDOW   c-src/emacs/src/lisp.h  /^CHECK_WINDOW (Lisp_Object x)$/
+CK_ABS_C       y-src/parse.y   /^#define CK_ABS_C(x)   if((x)<MIN_COL || 
(x)>MAX_COL)/
+CK_ABS_R       y-src/parse.y   /^#define CK_ABS_R(x)   if((x)<MIN_ROW || 
(x)>MAX_ROW)/
+CK_REL_C       y-src/parse.y   /^#define CK_REL_C(x)   if(   ((x)>0 && 
MAX_COL-(x)<cu/
+CK_REL_R       y-src/parse.y   /^#define CK_REL_R(x)   if(   ((x)>0 && 
MAX_ROW-(x)<cu/
+CMultiChannelCSC19_3D  cp-src/c.C      2
+CNL    c-src/etags.c   /^#define CNL()                                         
                \\$/
+CNL_SAVE_DEFINEDEF     c-src/etags.c   /^#define CNL_SAVE_DEFINEDEF()          
                                \\$/
+COBOLFLAGS     make-src/Makefile       /^COBOLFLAGS=--language=none 
--regex='\/.......[a-zA-/
+COLORS cp-src/screen.hpp       11
+COMPILEDP      c-src/emacs/src/lisp.h  /^COMPILEDP (Lisp_Object a)$/
+COMPILED_ARGLIST       c-src/emacs/src/lisp.h  2431
+COMPILED_BYTECODE      c-src/emacs/src/lisp.h  2432
+COMPILED_CONSTANTS     c-src/emacs/src/lisp.h  2433
+COMPILED_DOC_STRING    c-src/emacs/src/lisp.h  2435
+COMPILED_INTERACTIVE   c-src/emacs/src/lisp.h  2436
+COMPILED_STACK_DEPTH   c-src/emacs/src/lisp.h  2434
+CONDITION_CASE c-src/emacs/src/lisp.h  3021
+CONSP  c-src/emacs/src/lisp.h  /^# define CONSP(x) lisp_h_CONSP (x)$/
+CONSTYPE_HEAP  c-src/emacs/src/lisp.h  3739
+CONSTYPE_PURE  c-src/emacs/src/lisp.h  3739
+CONS_TO_INTEGER        c-src/emacs/src/lisp.h  /^#define CONS_TO_INTEGER(cons, 
type, var)                              \\$/
+CONVERT_CHARSTRING_TO_VALUE    pas-src/common.pas      /^procedure 
CONVERT_CHARSTRING_TO_VALUE;(*($/
+CPPFLAGS       make-src/Makefile       /^CPPFLAGS=${CHECKFLAGS} -DSTDC_HEADERS 
-DHAVE_GETCW/
+CPSRC  make-src/Makefile       /^CPSRC=c.C abstract.C abstract.H cfront.H 
burton.cp/
+CSRC   make-src/Makefile       /^CSRC=abbrev.c ..\/etags\/h.h .\/\/c.c 
torture.c getopt/
+CTAGS  c-src/etags.c   146
+CTAGS  c-src/etags.c   147
+CTAGS  c-src/etags.c   149
+CTAGS  make-src/Makefile       /^CTAGS: ctags ${infiles}$/
+CTAGS% make-src/Makefile       /^CTAGS%: ctags% ${infiles}$/
+CTAGS13 CTAGS14 CTAGS15        make-src/Makefile       /^CTAGS13 CTAGS14 
CTAGS15: ctags% ${infiles}$/
+CYAN   cp-src/screen.hpp       15
+C_AUTO c-src/etags.c   2198
+C_EXT  c-src/etags.c   2193
+C_JAVA c-src/etags.c   2197
+C_PLAIN        c-src/etags.c   2194
+C_PLPL c-src/etags.c   2195
+C_STAR c-src/etags.c   2196
+C_entries      c-src/etags.c   /^C_entries (int c_ext, FILE *inf)$/
+C_stab_entry   c-src/etags.c   2271
+C_symtype      c-src/etags.c   /^C_symtype (char *str, int len, int c_ext)$/
+ChangeFileType pas-src/common.pas      /^function ChangeFileType; (*(FileName 
: NameString;/
+Circle.getPos  lua-src/test.lua        /^function Circle.getPos ()$/
+Cjava_entries  c-src/etags.c   /^Cjava_entries (FILE *inf)$/
+Cjava_help     c-src/etags.c   551
+Cjava_suffixes c-src/etags.c   549
+ClassExample   ruby-src/test.rb        /^    class ClassExample$/
+Clear/p        ada-src/2ataspri.adb    /^   procedure Clear (Cell : in out 
TAS_Cell) is$/
+Clear/p        ada-src/2ataspri.ads    /^   procedure Clear        (Cell : in 
out TAS_Cell)/
+Cobol_help     c-src/etags.c   558
+Cobol_paragraphs       c-src/etags.c   /^Cobol_paragraphs (FILE *inf)$/
+Cobol_suffixes c-src/etags.c   556
+CommentAD      php-src/lce_functions.php       /^      function CommentAD($/
+CommentAD      php-src/lce_functions.php       70
+ConcatT        pas-src/common.pas      /^function ConcatT;(*($/
+Concept Index  tex-src/gzip.texi       /^@node Concept Index, , Problems, Top$/
+Cond_Signal/p  ada-src/2ataspri.adb    /^   procedure Cond_Signal (Cond : in 
out Condition_/
+Cond_Signal/p  ada-src/2ataspri.ads    /^   procedure Cond_Signal (Cond : in 
out Condition_/
+Cond_Timed_Wait/p      ada-src/2ataspri.adb    /^   procedure Cond_Timed_Wait$/
+Cond_Timed_Wait/p      ada-src/2ataspri.ads    /^   procedure Cond_Timed_Wait$/
+Cond_Wait/p    ada-src/2ataspri.adb    /^   procedure Cond_Wait (Cond : in out 
Condition_Va/
+Cond_Wait/p    ada-src/2ataspri.ads    /^   procedure Cond_Wait (Cond : in out 
Condition_Va/
+Condition_Variable/t   ada-src/2ataspri.ads    /^   type Condition_Variable is 
private;$/
+Condition_Variable/t   ada-src/2ataspri.ads    /^   type Condition_Variable 
is$/
+Configure      pyt-src/server.py       /^class Configure(Frame, ControlEdit):$/
+ConfirmQuit    pyt-src/server.py       /^def ConfirmQuit(frame, context):$/
+Constant       ruby-src/test1.ru       42
+ControlEdit    pyt-src/server.py       /^class ControlEdit(Frame):$/
+Controls       pyt-src/server.py       /^class Controls:$/
+CopyTextString pas-src/common.pas      /^function CopyTextString;(*($/
+Copying        tex-src/gzip.texi       /^@node Copying, Overview, , Top$/
+Cplusplus_entries      c-src/etags.c   /^Cplusplus_entries (FILE *inf)$/
+Cplusplus_help c-src/etags.c   540
+Cplusplus_suffixes     c-src/etags.c   535
+Create_LL_Task/p       ada-src/2ataspri.adb    /^   procedure Create_LL_Task$/
+Create_LL_Task/p       ada-src/2ataspri.ads    /^   procedure Create_LL_Task$/
+Cstar_entries  c-src/etags.c   /^Cstar_entries (FILE *inf)$/
+Cstar_suffixes c-src/etags.c   562
+Cube.data.getFoo       lua-src/test.lua        /^function Cube.data.getFoo ()$/
+D      cp-src/fail.C   /^              D() : ::A::T2::T(97), x(1066) {}$/
+D      cp-src/fail.C   41
+DAEMON_RUNNING c-src/emacs/src/lisp.h  4258
+DAEMON_RUNNING c-src/emacs/src/lisp.h  4262
+DARKGRAY       cp-src/screen.hpp       20
+DEAFUN c.c     /^DEAFUN ("expand-file-name", Fexpand_file_name, Sex/
+DEBUG  c-src/etags.c   84
+DEBUG  c-src/etags.c   85
+DEBUG  c-src/etags.c   87
+DEBUG  objc-src/PackInsp.m     37
+DECLARE_GDB_SYM        c-src/emacs/src/lisp.h  /^#define DECLARE_GDB_SYM(type, 
id) type const id EX/
+DEFAULT_HASH_SIZE      c-src/emacs/src/lisp.h  1940
+DEFAULT_REHASH_SIZE    c-src/emacs/src/lisp.h  1950
+DEFAULT_REHASH_THRESHOLD       c-src/emacs/src/lisp.h  1946
+DEFINE_GDB_SYMBOL_BEGIN        c-src/emacs/src/lisp.h  /^# define 
DEFINE_GDB_SYMBOL_BEGIN(type, id) DECLARE/
+DEFINE_GDB_SYMBOL_BEGIN        c-src/emacs/src/lisp.h  /^# define 
DEFINE_GDB_SYMBOL_BEGIN(type, id) extern /
+DEFINE_GDB_SYMBOL_END  c-src/emacs/src/lisp.h  /^# define 
DEFINE_GDB_SYMBOL_END(id) = id;$/
+DEFINE_GDB_SYMBOL_END  c-src/emacs/src/lisp.h  /^# define 
DEFINE_GDB_SYMBOL_END(val) ;$/
+DEFINE_LISP_SYMBOL     c-src/emacs/src/lisp.h  /^#define 
DEFINE_LISP_SYMBOL(name) \\$/
+DEFINE_NON_NIL_Q_SYMBOL_MACROS c-src/emacs/src/lisp.h  755
+DEFSYM c-src/emacs/src/lisp.h  /^#define DEFSYM(sym, name) \/* empty *\/$/
+DEFSYM c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (SYMBOL_CONSTANT_P, int, 
(Lisp_Ob/
+DEFUN  c-src/emacs/src/lisp.h  /^#define DEFUN(lname, fnname, sname, minargs, 
maxar/
+DEFUN_ARGS_0   c-src/emacs/src/lisp.h  714
+DEFUN_ARGS_1   c-src/emacs/src/lisp.h  715
+DEFUN_ARGS_2   c-src/emacs/src/lisp.h  716
+DEFUN_ARGS_3   c-src/emacs/src/lisp.h  717
+DEFUN_ARGS_4   c-src/emacs/src/lisp.h  718
+DEFUN_ARGS_5   c-src/emacs/src/lisp.h  719
+DEFUN_ARGS_6   c-src/emacs/src/lisp.h  721
+DEFUN_ARGS_7   c-src/emacs/src/lisp.h  723
+DEFUN_ARGS_8   c-src/emacs/src/lisp.h  725
+DEFUN_ARGS_MANY        c-src/emacs/src/lisp.h  712
+DEFUN_ARGS_UNEVALLED   c-src/emacs/src/lisp.h  713
+DEFUN_func2    c.c     /^DEFUN_func2()$/
+DEFVAR_BOOL    c-src/emacs/src/lisp.h  /^#define DEFVAR_BOOL(lname, vname, 
doc)                \\$/
+DEFVAR_BUFFER_DEFAULTS c-src/emacs/src/lisp.h  /^#define 
DEFVAR_BUFFER_DEFAULTS(lname, vname, doc)     /
+DEFVAR_INT     c-src/emacs/src/lisp.h  /^#define DEFVAR_INT(lname, vname, doc) 
        \\$/
+DEFVAR_KBOARD  c-src/emacs/src/lisp.h  /^#define DEFVAR_KBOARD(lname, vname, 
doc)                      \\$/
+DEFVAR_LISP    c-src/emacs/src/lisp.h  /^#define DEFVAR_LISP(lname, vname, 
doc)                \\$/
+DEFVAR_LISP_NOPRO      c-src/emacs/src/lisp.h  /^#define 
DEFVAR_LISP_NOPRO(lname, vname, doc)  \\$/
+DEVICE_LAST    c-src/h.h       24
+DEVICE_SWP     c-src/h.h       23
+DOS_NT c-src/etags.c   117
+DOS_NT c-src/etags.c   118
+DUMPED c-src/emacs/src/gmalloc.c       80
+Debug  cp-src/functions.cpp    /^void Debug ( int lineno, int level, char* 
func , c/
+Def_   ruby-src/test1.ru       12
+DisposeANameList       pas-src/common.pas      /^procedure DisposeANameList( $/
+DisposeNameList        pas-src/common.pas      /^procedure DisposeNameList;$/
+ELEM_I c-src/h.h       3
+ELSRC  make-src/Makefile       /^ELSRC=TAGTEST.EL 
emacs\/lisp\/progmodes\/etags.el$/
+EMACS_INT      c-src/emacs/src/lisp.h  103
+EMACS_INT      c-src/emacs/src/lisp.h  91
+EMACS_INT      c-src/emacs/src/lisp.h  96
+EMACS_INT_MAX  c-src/emacs/src/lisp.h  105
+EMACS_INT_MAX  c-src/emacs/src/lisp.h  93
+EMACS_INT_MAX  c-src/emacs/src/lisp.h  98
+EMACS_LISP_H   c-src/emacs/src/lisp.h  22
+EMACS_NAME     c-src/etags.c   786
+EMACS_UINT     c-src/emacs/src/lisp.h  104
+EMACS_UINT     c-src/emacs/src/lisp.h  92
+EMACS_UINT     c-src/emacs/src/lisp.h  97
+ENTRY  c-src/sysdep.h  /^#define       ENTRY(name)                             
                              \\$/
+ENUM_BF        c-src/emacs/src/lisp.h  /^#define ENUM_BF(TYPE) enum TYPE$/
+ENUM_BF        c-src/emacs/src/lisp.h  /^#define ENUM_BF(TYPE) unsigned int$/
+EQ     c-src/emacs/src/lisp.h  /^# define EQ(x, y) lisp_h_EQ (x, y)$/
+EQUAL  y-src/cccp.c    12
+ERLSRC make-src/Makefile       /^ERLSRC=gs_dialog.erl lines.erl lists.erl$/
+ERROR  y-src/cccp.c    9
+ERROR  y-src/parse.y   304
+ETAGS  make-src/Makefile       /^ETAGS: FRC etags ${infiles}$/
+ETAGS% make-src/Makefile       /^ETAGS%: FRC etags% ${infiles}$/
+ETAGS12        make-src/Makefile       /^ETAGS12: etags12 ${infiles}$/
+ETAGS13 ETAGS14 ETAGS15        make-src/Makefile       /^ETAGS13 ETAGS14 
ETAGS15: etags% ${infiles}$/
+EXFUN  c-src/emacs/src/lisp.h  /^#define EXFUN(fnname, maxargs) \\$/
+EXTAGS make-src/Makefile       /^EXTAGS: extags ${infiles} Makefile$/
+EXTERNALLY_VISIBLE     c-src/emacs/src/keyboard.c      3497
+EXTERNALLY_VISIBLE     c-src/emacs/src/keyboard.c      4372
+EmptyNmStr     pas-src/common.pas      /^function EmptyNmStr(* : 
NameString*);$/
+Environment    tex-src/gzip.texi       /^@node Environment, Tapes, Advanced 
usage, Top$/
+Erlang_functions       c-src/etags.c   /^Erlang_functions (FILE *inf)$/
+Erlang_help    c-src/etags.c   567
+Erlang_suffixes        c-src/etags.c   565
+ErrStrToNmStr  pas-src/common.pas      /^function ErrStrToNmStr;(*($/
+Error_Information/t    ada-src/2ataspri.ads    /^   type Error_Information is 
new Interfaces.C.POSI/
+Exit_LL_Task/p ada-src/2ataspri.adb    /^   procedure Exit_LL_Task is$/
+Exit_LL_Task/p ada-src/2ataspri.ads    /^   procedure Exit_LL_Task;$/
+ExtractCommentInfo     pas-src/common.pas      /^procedure ExtractCommentInfo; 
(*($/
+FASTCFLAGS     make-src/Makefile       /^FASTCFLAGS=-O3 -finline-functions 
-ffast-math -fun/
+FASTCFLAGSWARN make-src/Makefile       /^FASTCFLAGSWARN=${WARNINGS} -Werror 
${FASTCFLAGS}$/
+FILTER make-src/Makefile       /^FILTER=grep -v 
'\\.[Cchefy][lor]*,[1-9][0-9]*' || t/
+FINALIZERP     c-src/emacs/src/lisp.h  /^FINALIZERP (Lisp_Object x)$/
+FINAL_FREE_BLOCKS      c-src/emacs/src/gmalloc.c       135
+FIXNUM_BITS    c-src/emacs/src/lisp.h  252
+FIXNUM_OVERFLOW_P      c-src/emacs/src/lisp.h  /^#define FIXNUM_OVERFLOW_P(i) 
\\$/
+FIXNUM_OVERFLOW_P      c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (EQ, bool, 
(Lisp_Object x, Lisp_O/
+FLOATP c-src/emacs/src/lisp.h  /^# define FLOATP(x) lisp_h_FLOATP (x)$/
+FLOAT_TO_STRING_BUFSIZE        c-src/emacs/src/lisp.h  3927
+FORTHSRC       make-src/Makefile       /^FORTHSRC=test-forth.fth$/
+FOR_EACH_ALIST_VALUE   c-src/emacs/src/lisp.h  /^#define 
FOR_EACH_ALIST_VALUE(head_var, list_var, v/
+FOR_EACH_TAIL  c-src/emacs/src/lisp.h  /^#define FOR_EACH_TAIL(hare, list, 
tortoise, n)        \\$/
+FRAMEP c-src/emacs/src/lisp.h  /^FRAMEP (Lisp_Object a)$/
+FRC    make-src/Makefile       /^FRC:;$/
+FREEFLOOD      c-src/emacs/src/gmalloc.c       1858
+FSRC   make-src/Makefile       /^FSRC=entry.for entry.strange_suffix 
entry.strange$/
+FUN0   y-src/parse.y   /^yylex FUN0()$/
+FUN1   y-src/parse.y   /^str_to_col FUN1(char **,str)$/
+FUN1   y-src/parse.y   /^yyerror FUN1(char *, s)$/
+FUN2   y-src/parse.y   /^make_list FUN2(YYSTYPE, car, YYSTYPE, cdr)$/
+FUN2   y-src/parse.y   /^parse_cell_or_range FUN2(char **,ptr, struct rng */
+FUNCTIONP      c-src/emacs/src/lisp.h  /^FUNCTIONP (Lisp_Object obj)$/
+FUNCTION_KEY_OFFSET    c-src/emacs/src/keyboard.c      4766
+FUNCTION_KEY_OFFSET    c-src/emacs/src/keyboard.c      5061
+F_getit        c-src/etags.c   /^F_getit (FILE *inf)$/
+F_takeprec     c-src/etags.c   /^F_takeprec (void)$/
+Fabbrev_expansion      c-src/abbrev.c  /^DEFUN ("abbrev-expansion", 
Fabbrev_expansion, Sabb/
+Fabbrev_symbol c-src/abbrev.c  /^DEFUN ("abbrev-symbol", Fabbrev_symbol, 
Sabbrev_sy/
+Fabort_recursive_edit  c-src/emacs/src/keyboard.c      /^DEFUN 
("abort-recursive-edit", Fabort_recursive_ed/
+Fails_t        c-src/h.h       5
+Fclear_abbrev_table    c-src/abbrev.c  /^DEFUN ("clear-abbrev-table", 
Fclear_abbrev_table, /
+Fclear_this_command_keys       c-src/emacs/src/keyboard.c      /^DEFUN 
("clear-this-command-keys", Fclear_this_comm/
+Fcommand_error_default_function        c-src/emacs/src/keyboard.c      /^DEFUN 
("command-error-default-function", Fcommand_/
+Fcurrent_idle_time     c-src/emacs/src/keyboard.c      /^DEFUN 
("current-idle-time", Fcurrent_idle_time, Sc/
+Fcurrent_input_mode    c-src/emacs/src/keyboard.c      /^DEFUN 
("current-input-mode", Fcurrent_input_mode, /
+Fdefine_abbrev c-src/abbrev.c  /^DEFUN ("define-abbrev", Fdefine_abbrev, 
Sdefine_ab/
+Fdefine_abbrev_table   c-src/abbrev.c  /^DEFUN ("define-abbrev-table", 
Fdefine_abbrev_table/
+Fdefine_global_abbrev  c-src/abbrev.c  /^DEFUN ("define-global-abbrev", 
Fdefine_global_abbr/
+Fdefine_mode_abbrev    c-src/abbrev.c  /^DEFUN ("define-mode-abbrev", 
Fdefine_mode_abbrev, /
+Fdiscard_input c-src/emacs/src/keyboard.c      /^DEFUN ("discard-input", 
Fdiscard_input, Sdiscard_i/
+Fevent_convert_list    c-src/emacs/src/keyboard.c      /^DEFUN 
("event-convert-list", Fevent_convert_list, /
+Fevent_symbol_parse_modifiers  c-src/emacs/src/keyboard.c      /^DEFUN 
("internal-event-symbol-parse-modifiers", Fe/
+Fexit_recursive_edit   c-src/emacs/src/keyboard.c      /^DEFUN 
("exit-recursive-edit", Fexit_recursive_edit/
+Fexpand_abbrev c-src/abbrev.c  /^DEFUN ("expand-abbrev", Fexpand_abbrev, 
Sexpand_ab/
+Finalize_Cond/p        ada-src/2ataspri.adb    /^   procedure Finalize_Cond 
(Cond : in out Conditio/
+Finalize_Cond/p        ada-src/2ataspri.ads    /^   procedure Finalize_Cond 
(Cond : in out Conditio/
+Finalize_Lock/p        ada-src/2ataspri.adb    /^   procedure Finalize_Lock (L 
: in out Lock) is$/
+Finalize_Lock/p        ada-src/2ataspri.ads    /^   procedure Finalize_Lock (L 
: in out Lock);$/
+Finalize_TAS_Cell/p    ada-src/2ataspri.adb    /^   procedure 
Finalize_TAS_Cell (Cell : in out TAS_/
+Finalize_TAS_Cell/p    ada-src/2ataspri.ads    /^   procedure 
Finalize_TAS_Cell   (Cell : in out TA/
+Finput_pending_p       c-src/emacs/src/keyboard.c      /^DEFUN 
("input-pending-p", Finput_pending_p, Sinput/
+Finsert_abbrev_table_description       c-src/abbrev.c  /^DEFUN 
("insert-abbrev-table-description", Finsert_/
+First100Chars  pas-src/common.pas      /^procedure First100Chars; (*($/
+Fmake_abbrev_table     c-src/abbrev.c  /^DEFUN ("make-abbrev-table", 
Fmake_abbrev_table, Sm/
+Foo    perl-src/kai-test.pl    /^package Foo;$/
+Foo::Bar       perl-src/kai-test.pl    /^package Foo::Bar;$/
+Fopen_dribble_file     c-src/emacs/src/keyboard.c      /^DEFUN 
("open-dribble-file", Fopen_dribble_file, So/
+Forth_help     c-src/etags.c   573
+Forth_suffixes c-src/etags.c   571
+Forth_words    c-src/etags.c   /^Forth_words (FILE *inf)$/
+Fortran_functions      c-src/etags.c   /^Fortran_functions (FILE *inf)$/
+Fortran_help   c-src/etags.c   579
+Fortran_suffixes       c-src/etags.c   577
+Fposn_at_point c-src/emacs/src/keyboard.c      /^DEFUN ("posn-at-point", 
Fposn_at_point, Sposn_at_p/
+Fposn_at_x_y   c-src/emacs/src/keyboard.c      /^DEFUN ("posn-at-x-y", 
Fposn_at_x_y, Sposn_at_x_y, /
+Fread_key_sequence     c-src/emacs/src/keyboard.c      /^DEFUN 
("read-key-sequence", Fread_key_sequence, Sr/
+Fread_key_sequence_vector      c-src/emacs/src/keyboard.c      /^DEFUN 
("read-key-sequence-vector", Fread_key_seque/
+Frecent_keys   c-src/emacs/src/keyboard.c      /^DEFUN ("recent-keys", 
Frecent_keys, Srecent_keys, /
+Frecursion_depth       c-src/emacs/src/keyboard.c      /^DEFUN 
("recursion-depth", Frecursion_depth, Srecur/
+Frecursive_edit        c-src/emacs/src/keyboard.c      /^DEFUN 
("recursive-edit", Frecursive_edit, Srecursi/
+Freset_this_command_lengths    c-src/emacs/src/keyboard.c      /^DEFUN 
("reset-this-command-lengths", Freset_this_c/
+Fset_input_interrupt_mode      c-src/emacs/src/keyboard.c      /^DEFUN 
("set-input-interrupt-mode", Fset_input_inte/
+Fset_input_meta_mode   c-src/emacs/src/keyboard.c      /^DEFUN 
("set-input-meta-mode", Fset_input_meta_mode/
+Fset_input_mode        c-src/emacs/src/keyboard.c      /^DEFUN 
("set-input-mode", Fset_input_mode, Sset_inp/
+Fset_output_flow_control       c-src/emacs/src/keyboard.c      /^DEFUN 
("set-output-flow-control", Fset_output_flow/
+Fset_quit_char c-src/emacs/src/keyboard.c      /^DEFUN ("set-quit-char", 
Fset_quit_char, Sset_quit_/
+Fsuspend_emacs c-src/emacs/src/keyboard.c      /^DEFUN ("suspend-emacs", 
Fsuspend_emacs, Ssuspend_e/
+Fthis_command_keys     c-src/emacs/src/keyboard.c      /^DEFUN 
("this-command-keys", Fthis_command_keys, St/
+Fthis_command_keys_vector      c-src/emacs/src/keyboard.c      /^DEFUN 
("this-command-keys-vector", Fthis_command_k/
+Fthis_single_command_keys      c-src/emacs/src/keyboard.c      /^DEFUN 
("this-single-command-keys", Fthis_single_co/
+Fthis_single_command_raw_keys  c-src/emacs/src/keyboard.c      /^DEFUN 
("this-single-command-raw-keys", Fthis_singl/
+Ftop_level     c-src/emacs/src/keyboard.c      /^DEFUN ("top-level", 
Ftop_level, Stop_level, 0, 0, /
+Ftrack_mouse   c-src/emacs/src/keyboard.c      /^DEFUN 
("internal--track-mouse", Ftrack_mouse, Stra/
+Funexpand_abbrev       c-src/abbrev.c  /^DEFUN ("unexpand-abbrev", 
Funexpand_abbrev, Sunexp/
+Fx_get_selection_internal      c.c     /^       Fx_get_selection_internal, 
Sx_get_selection/
+Fx_get_selection_internal      c.c     /^DEFUN ("x-get-selection-internal", 
Fx_get_selectio/
+Fy_get_selection_internal      c.c     /^      Fy_get_selection_internal, 
Sy_get_selection_/
+GCALIGNED      c-src/emacs/src/lisp.h  288
+GCALIGNED      c-src/emacs/src/lisp.h  290
+GCALIGNMENT    c-src/emacs/src/lisp.h  243
+GCPRO1 c-src/emacs/src/lisp.h  /^#define GCPRO1(a)                             
                        \\$/
+GCPRO1 c-src/emacs/src/lisp.h  /^#define GCPRO1(varname) ((void) gcpro1)$/
+GCPRO2 c-src/emacs/src/lisp.h  /^#define GCPRO2(a, b)                          
                        \\$/
+GCPRO2 c-src/emacs/src/lisp.h  /^#define GCPRO2(varname1, varname2) ((void) 
gcpro2,/
+GCPRO3 c-src/emacs/src/lisp.h  /^#define GCPRO3(a, b, c)                       
                                \\$/
+GCPRO3 c-src/emacs/src/lisp.h  /^#define GCPRO3(varname1, varname2, varname3) 
\\$/
+GCPRO4 c-src/emacs/src/lisp.h  /^#define GCPRO4(a, b, c, d)                    
                        \\$/
+GCPRO4 c-src/emacs/src/lisp.h  /^#define GCPRO4(varname1, varname2, varname3, 
varna/
+GCPRO5 c-src/emacs/src/lisp.h  /^#define GCPRO5(a, b, c, d, e)                 
                        \\$/
+GCPRO5 c-src/emacs/src/lisp.h  /^#define GCPRO5(varname1, varname2, varname3, 
varna/
+GCPRO6 c-src/emacs/src/lisp.h  /^#define GCPRO6(a, b, c, d, e, f)              
                        \\$/
+GCPRO6 c-src/emacs/src/lisp.h  /^#define GCPRO6(varname1, varname2, varname3, 
varna/
+GCPRO7 c-src/emacs/src/lisp.h  /^#define GCPRO7(a, b, c, d, e, f, g)           
                        \\$/
+GCPRO7 c-src/emacs/src/lisp.h  /^#define GCPRO7(a, b, c, d, e, f, g) (GCPRO6 
(a, b,/
+GCTYPEBITS     c-src/emacs/src/lisp.h  /^DEFINE_GDB_SYMBOL_BEGIN (int, 
GCTYPEBITS)$/
+GCTYPEBITS     c-src/emacs/src/lisp.h  67
+GC_MAKE_GCPROS_NOOPS   c-src/emacs/src/lisp.h  3172
+GC_MARK_STACK  c-src/emacs/src/lisp.h  3177
+GC_MARK_STACK_CHECK_GCPROS     c-src/emacs/src/lisp.h  3173
+GC_USE_GCPROS_AS_BEFORE        c-src/emacs/src/lisp.h  3171
+GC_USE_GCPROS_CHECK_ZOMBIES    c-src/emacs/src/lisp.h  3174
+GE     y-src/parse.c   8
+GENERIC_PTR    y-src/cccp.y    56
+GENERIC_PTR    y-src/cccp.y    58
+GEQ    y-src/cccp.c    15
+GETOPTOBJS     make-src/Makefile       /^GETOPTOBJS= #getopt.o getopt1.o$/
+GREEN  cp-src/screen.hpp       14
+GROW_RAW_KEYBUF        c-src/emacs/src/keyboard.c      119
+GatherControls pyt-src/server.py       /^    def GatherControls(self):$/
+GetLayerByName lua-src/allegro.lua     /^function GetLayerByName (name)$/
+GetNameList    pas-src/common.pas      /^function GetNameList; (* : 
BinNodePointer;*)$/
+GetNewNameListNode     pas-src/common.pas      /^function 
GetNewNameListNode;(*($/
+GetTextRef     pas-src/common.pas      /^function GetTextRef;(*($/
+GetUniqueLayerName     lua-src/allegro.lua     /^function GetUniqueLayerName 
()$/
+Get_Own_Priority/f     ada-src/2ataspri.adb    /^   function Get_Own_Priority 
return System.Any_Pri/
+Get_Own_Priority/f     ada-src/2ataspri.ads    /^   function Get_Own_Priority 
return System.Any_Pri/
+Get_Priority/f ada-src/2ataspri.adb    /^   function Get_Priority (T : 
TCB_Ptr) return Syst/
+Get_Priority/f ada-src/2ataspri.ads    /^   function Get_Priority (T : 
TCB_Ptr) return Syst/
+HASH_HASH      c-src/emacs/src/lisp.h  /^HASH_HASH (struct Lisp_Hash_Table *h, 
ptrdiff_t id/
+HASH_INDEX     c-src/emacs/src/lisp.h  /^HASH_INDEX (struct Lisp_Hash_Table 
*h, ptrdiff_t i/
+HASH_KEY       c-src/emacs/src/lisp.h  /^HASH_KEY (struct Lisp_Hash_Table *h, 
ptrdiff_t idx/
+HASH_NEXT      c-src/emacs/src/lisp.h  /^HASH_NEXT (struct Lisp_Hash_Table *h, 
ptrdiff_t id/
+HASH_TABLE_P   c-src/emacs/src/lisp.h  /^HASH_TABLE_P (Lisp_Object a)$/
+HASH_TABLE_SIZE        c-src/emacs/src/lisp.h  /^HASH_TABLE_SIZE (struct 
Lisp_Hash_Table *h)$/
+HASH_VALUE     c-src/emacs/src/lisp.h  /^HASH_VALUE (struct Lisp_Hash_Table 
*h, ptrdiff_t i/
+HAVE_NTGUI     c-src/etags.c   116
+HEAP   c-src/emacs/src/gmalloc.c       131
+HTMLSRC        make-src/Makefile       /^HTMLSRC=softwarelibero.html 
index.shtml algrthms.h/
+HTML_help      c-src/etags.c   584
+HTML_labels    c-src/etags.c   /^HTML_labels (FILE *inf)$/
+HTML_suffixes  c-src/etags.c   582
+IEEE_FLOATING_POINT    c-src/emacs/src/lisp.h  2415
+IMAGEP c-src/emacs/src/lisp.h  /^IMAGEP (Lisp_Object x)$/
+INPUT_EVENT_POS_MAX    c-src/emacs/src/keyboard.c      3698
+INPUT_EVENT_POS_MIN    c-src/emacs/src/keyboard.c      3701
+INSERT_TREE_NODE       pas-src/common.pas      /^procedure 
INSERT_TREE_NODE;(*( $/
+INSTANTIATE_MDIAGARRAY_FRIENDS cp-src/MDiagArray2.h    /^#define 
INSTANTIATE_MDIAGARRAY_FRIENDS(T) \\$/
+INT    c-src/h.h       32
+INT    y-src/cccp.c    6
+INTEGERP       c-src/emacs/src/lisp.h  /^# define INTEGERP(x) lisp_h_INTEGERP 
(x)$/
+INTEGER_TO_CONS        c-src/emacs/src/lisp.h  /^#define INTEGER_TO_CONS(i)    
                                    \\$/
+INTERVAL       c-src/emacs/src/lisp.h  1149
+INTMASK        c-src/emacs/src/lisp.h  437
+INTTYPEBITS    c-src/emacs/src/lisp.h  249
+INT_BIT        c-src/emacs/src/gmalloc.c       124
+INT_TYPE_SIZE  y-src/cccp.y    91
+ISALNUM        c-src/etags.c   /^#define ISALNUM(c)    isalnum (CHAR (c))$/
+ISALPHA        c-src/etags.c   /^#define ISALPHA(c)    isalpha (CHAR (c))$/
+ISDIGIT        c-src/etags.c   /^#define ISDIGIT(c)    isdigit (CHAR (c))$/
+ISLOWER        c-src/etags.c   /^#define ISLOWER(c)    islower (CHAR (c))$/
+ISO_FUNCTION_KEY_OFFSET        c-src/emacs/src/keyboard.c      5149
+ISUPPER        c-src/etags.c   /^# define ISUPPER(c)   isupper (CHAR (c))$/
+IS_DAEMON      c-src/emacs/src/lisp.h  4257
+IS_DAEMON      c-src/emacs/src/lisp.h  4261
+InitNameList   pas-src/common.pas      /^procedure InitNameList;$/
+InitNameStringPool     pas-src/common.pas      /^procedure 
InitNameStringPool;$/
+InitializeStringPackage        pas-src/common.pas      /^procedure 
InitializeStringPackage;$/
+Initialize_Cond/p      ada-src/2ataspri.adb    /^   procedure Initialize_Cond 
(Cond : in out Condit/
+Initialize_Cond/p      ada-src/2ataspri.ads    /^   procedure Initialize_Cond 
(Cond : in out Condit/
+Initialize_LL_Tasks/p  ada-src/2ataspri.adb    /^   procedure 
Initialize_LL_Tasks (T : TCB_Ptr) is$/
+Initialize_LL_Tasks/p  ada-src/2ataspri.ads    /^   procedure 
Initialize_LL_Tasks (T : TCB_Ptr);$/
+Initialize_Lock/p      ada-src/2ataspri.adb    /^   procedure Initialize_Lock$/
+Initialize_Lock/p      ada-src/2ataspri.ads    /^   procedure Initialize_Lock 
(Prio : System.Any_Pr/
+Initialize_TAS_Cell/p  ada-src/2ataspri.adb    /^   procedure 
Initialize_TAS_Cell (Cell : out TAS_C/
+Initialize_TAS_Cell/p  ada-src/2ataspri.ads    /^   procedure 
Initialize_TAS_Cell (Cell :    out TA/
+Inner1/b       ada-src/etags-test-for.ada      /^  package body Inner1 is$/
+Inner1/b       ada-src/waroquiers.ada  /^  package body Inner1 is$/
+Inner1/s       ada-src/etags-test-for.ada      /^  package Inner1 is$/
+Inner1/s       ada-src/waroquiers.ada  /^  package Inner1 is$/
+Inner2/b       ada-src/etags-test-for.ada      /^  package body Inner2 is$/
+Inner2/b       ada-src/waroquiers.ada  /^  package body Inner2 is$/
+Inner2/s       ada-src/etags-test-for.ada      /^  package Inner2 is$/
+Inner2/s       ada-src/waroquiers.ada  /^  package Inner2 is$/
+Install_Abort_Handler/p        ada-src/2ataspri.adb    /^   procedure 
Install_Abort_Handler (Handler : Abor/
+Install_Abort_Handler/p        ada-src/2ataspri.ads    /^   procedure 
Install_Abort_Handler (Handler : Abor/
+Install_Error_Handler/p        ada-src/2ataspri.adb    /^   procedure 
Install_Error_Handler (Handler : Syst/
+Install_Error_Handler/p        ada-src/2ataspri.ads    /^   procedure 
Install_Error_Handler (Handler : Syst/
+Invoking gzip  tex-src/gzip.texi       /^@node Invoking gzip, Advanced usage, 
Sample, Top$/
+IpAddrKind     rs-src/test.rs  3
+IsControlChar  pas-src/common.pas      /^function IsControlChar; (*($/
+IsControlCharName      pas-src/common.pas      /^function IsControlCharName($/
+Is_Set/f       ada-src/2ataspri.adb    /^   function  Is_Set (Cell : in 
TAS_Cell) return Bo/
+Is_Set/f       ada-src/2ataspri.ads    /^   function  Is_Set       (Cell : in  
   TAS_Cell)/
+JAVASRC        make-src/Makefile       /^JAVASRC=AWTEMul.java KeyEve.java 
SMan.java SysCol./
+KBD_BUFFER_SIZE        c-src/emacs/src/keyboard.c      82
+KBYTES objc-src/PackInsp.m     58
+KEY_TO_CHAR    c-src/emacs/src/keyboard.c      /^#define KEY_TO_CHAR(k) (XINT 
(k) & ((1 << CHARACTE/
+LATEST make-src/Makefile       /^LATEST=17$/
+LCE_COMMENT    php-src/lce_functions.php       13
+LCE_COMMENT_TOOL       php-src/lce_functions.php       17
+LCE_COMMENT_USER       php-src/lce_functions.php       15
+LCE_FUNCTIONS  php-src/lce_functions.php       4
+LCE_MSGID      php-src/lce_functions.php       19
+LCE_MSGSTR     php-src/lce_functions.php       21
+LCE_TEXT       php-src/lce_functions.php       23
+LCE_UNKNOWN    php-src/lce_functions.php       9
+LCE_WS php-src/lce_functions.php       11
+LDFLAGS        make-src/Makefile       /^LDFLAGS=#-static -lc_p$/
+LE     y-src/parse.c   7
+LEQ    y-src/cccp.c    14
+LIGHTBLUE      cp-src/screen.hpp       21
+LIGHTCYAN      cp-src/screen.hpp       23
+LIGHTGRAY      cp-src/screen.hpp       19
+LIGHTGREEN     cp-src/screen.hpp       22
+LIGHTMAGENTA   cp-src/screen.hpp       25
+LIGHTRED       cp-src/screen.hpp       24
+LISP_INITIALLY c-src/emacs/src/lisp.h  /^#define LISP_INITIALLY(i) (i)$/
+LISP_INITIALLY c-src/emacs/src/lisp.h  /^#define LISP_INITIALLY(i) {i}$/
+LISP_INITIALLY_ZERO    c-src/emacs/src/lisp.h  582
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^#define 
LISP_MACRO_DEFUN(name, type, argdecls, arg/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (CONSP, 
bool, (Lisp_Object x), (x/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (NILP, bool, 
(Lisp_Object x), (x)/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (SYMBOL_VAL, 
Lisp_Object, (struct/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (XCAR, 
Lisp_Object, (Lisp_Object /
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (XCONS, 
struct Lisp_Cons *, (Lisp/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (XHASH, 
EMACS_INT, (Lisp_Object a/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (XLI, 
EMACS_INT, (Lisp_Object o),/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (XPNTR, void 
*, (Lisp_Object a), /
+LISP_MACRO_DEFUN_VOID  c-src/emacs/src/lisp.h  /^#define 
LISP_MACRO_DEFUN_VOID(name, argdecls, args/
+LISP_MACRO_DEFUN_VOID  c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN_VOID 
(CHECK_LIST_CONS, (Lisp_Obje/
+LISP_MACRO_DEFUN_VOID  c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN_VOID 
(CHECK_TYPE,$/
+LISP_MACRO_DEFUN_VOID  c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN_VOID 
(SET_SYMBOL_VAL,$/
+LISTCONTENTS   objc-src/PackInsp.m     39
+LISTCONTENTSBUTTON     objc-src/PackInsp.m     48
+LISTDESCRIPTIONBUTTON  objc-src/PackInsp.m     49
+LL_Assert/p    ada-src/2ataspri.adb    /^   procedure LL_Assert (B : Boolean; 
M : String) i/
+LL_Assert/p    ada-src/2ataspri.ads    /^   procedure LL_Assert (B : Boolean; 
M : String);$/
+LL_Task_Procedure_Access/t     ada-src/2ataspri.ads    /^   type 
LL_Task_Procedure_Access is access procedu/
+LL_Task_Procedure_Access/t     ada-src/etags-test-for.ada      /^   type 
LL_Task_Procedure_Access is access procedu/
+LL_Wrapper/p   ada-src/2ataspri.adb    /^   procedure LL_Wrapper (T : TCB_Ptr) 
is$/
+LL_Wrapper/p   ada-src/2ataspri.adb    /^   procedure LL_Wrapper (T : 
TCB_Ptr);$/
+LL_Wrapper/p   ada-src/etags-test-for.ada      /^   procedure LL_Wrapper (T : 
TCB_Ptr);$/
+LOCALIZE       objc-src/PackInsp.m     /^#define LOCALIZE(s)           
NXLoadLocalizedStringFromTabl/
+LOCALIZE_ARCH  objc-src/PackInsp.m     /^#define LOCALIZE_ARCH(s)      
NXLoadLocalizedStringFrom/
+LOCK   c-src/emacs/src/gmalloc.c       /^#define LOCK()                        
                \\$/
+LOCK   c-src/emacs/src/gmalloc.c       /^#define LOCK()$/
+LOCK_ALIGNED_BLOCKS    c-src/emacs/src/gmalloc.c       /^#define 
LOCK_ALIGNED_BLOCKS()                         \\$/
+LOCK_ALIGNED_BLOCKS    c-src/emacs/src/gmalloc.c       /^#define 
LOCK_ALIGNED_BLOCKS()$/
+LONG_TYPE_SIZE y-src/cccp.y    95
+LOOKING_AT     c-src/etags.c   /^#define LOOKING_AT(cp, kw)  \/* kw is the 
keyword, /
+LOOKING_AT_NOCASE      c-src/etags.c   /^#define LOOKING_AT_NOCASE(cp, kw) \/* 
the keyword i/
+LOOKUP objc-src/PackInsp.m     /^#define LOOKUP(key, notfound) ([table 
isKey:key] ?/
+LOOKUP objc-src/PackInsp.m     176
+LOOP_ON_INPUT_LINES    c-src/etags.c   /^#define 
LOOP_ON_INPUT_LINES(file_pointer, line_buf/
+LSH    y-src/cccp.c    16
+LTGT   cp-src/MDiagArray2.h    144
+LTGT   cp-src/MDiagArray2.h    35
+LTGT   cp-src/MDiagArray2.h    39
+LTGT   cp-src/MDiagArray2.h    42
+LUASRC make-src/Makefile       /^LUASRC=allegro.lua$/
+L_CELL y-src/parse.c   10
+L_CONST        y-src/parse.c   13
+L_FN0  y-src/parse.c   14
+L_FN1  y-src/parse.c   15
+L_FN1R y-src/parse.c   20
+L_FN2  y-src/parse.c   16
+L_FN2R y-src/parse.c   21
+L_FN3  y-src/parse.c   17
+L_FN3R y-src/parse.c   22
+L_FN4  y-src/parse.c   18
+L_FN4R y-src/parse.c   23
+L_FNN  y-src/parse.c   19
+L_FNNR y-src/parse.c   24
+L_GE   y-src/parse.c   27
+L_LE   y-src/parse.c   25
+L_NE   y-src/parse.c   26
+L_RANGE        y-src/parse.c   11
+L_VAR  y-src/parse.c   12
+L_getit        c-src/etags.c   /^L_getit (void)$/
+LabeledEntry   pyt-src/server.py       /^class LabeledEntry(Frame):$/
+Lang_function  c-src/etags.c   182
+Lang_function  c-src/h.h       6
+Lisp_Bits      c-src/emacs/src/lisp.h  239
+Lisp_Bool_Vector       c-src/emacs/src/lisp.h  1384
+Lisp_Boolfwd   c-src/emacs/src/lisp.h  2284
+Lisp_Buffer_Local_Value        c-src/emacs/src/lisp.h  2334
+Lisp_Buffer_Objfwd     c-src/emacs/src/lisp.h  2302
+Lisp_Char_Table        c-src/emacs/src/lisp.h  1575
+Lisp_Compiled  c-src/emacs/src/lisp.h  2429
+Lisp_Cons      c-src/emacs/src/lisp.h  475
+Lisp_Finalizer c-src/emacs/src/lisp.h  2186
+Lisp_Float     c-src/emacs/src/lisp.h  2391
+Lisp_Float     c-src/emacs/src/lisp.h  477
+Lisp_Free      c-src/emacs/src/lisp.h  2201
+Lisp_Fwd       c-src/emacs/src/lisp.h  2368
+Lisp_Fwd_Bool  c-src/emacs/src/lisp.h  505
+Lisp_Fwd_Buffer_Obj    c-src/emacs/src/lisp.h  507
+Lisp_Fwd_Int   c-src/emacs/src/lisp.h  504
+Lisp_Fwd_Kboard_Obj    c-src/emacs/src/lisp.h  508
+Lisp_Fwd_Obj   c-src/emacs/src/lisp.h  506
+Lisp_Fwd_Type  c-src/emacs/src/lisp.h  502
+Lisp_Hash_Table        c-src/emacs/src/lisp.h  1823
+Lisp_Int0      c-src/emacs/src/lisp.h  461
+Lisp_Int1      c-src/emacs/src/lisp.h  462
+Lisp_Intfwd    c-src/emacs/src/lisp.h  2274
+Lisp_Kboard_Objfwd     c-src/emacs/src/lisp.h  2362
+Lisp_Marker    c-src/emacs/src/lisp.h  1978
+Lisp_Misc      c-src/emacs/src/lisp.h  2212
+Lisp_Misc      c-src/emacs/src/lisp.h  458
+Lisp_Misc_Any  c-src/emacs/src/lisp.h  1971
+Lisp_Misc_Finalizer    c-src/emacs/src/lisp.h  491
+Lisp_Misc_Float        c-src/emacs/src/lisp.h  494
+Lisp_Misc_Free c-src/emacs/src/lisp.h  487
+Lisp_Misc_Limit        c-src/emacs/src/lisp.h  496
+Lisp_Misc_Marker       c-src/emacs/src/lisp.h  488
+Lisp_Misc_Overlay      c-src/emacs/src/lisp.h  489
+Lisp_Misc_Save_Value   c-src/emacs/src/lisp.h  490
+Lisp_Misc_Type c-src/emacs/src/lisp.h  485
+Lisp_Object    c-src/emacs/src/lisp.h  567
+Lisp_Object    c-src/emacs/src/lisp.h  577
+Lisp_Objfwd    c-src/emacs/src/lisp.h  2294
+Lisp_Overlay   c-src/emacs/src/lisp.h  2021
+Lisp_Save_Type c-src/emacs/src/lisp.h  2064
+Lisp_Save_Value        c-src/emacs/src/lisp.h  2110
+Lisp_String    c-src/emacs/src/lisp.h  466
+Lisp_Sub_Char_Table    c-src/emacs/src/lisp.h  1606
+Lisp_Subr      c-src/emacs/src/lisp.h  1670
+Lisp_Symbol    c-src/emacs/src/lisp.h  454
+Lisp_Symbol    c-src/emacs/src/lisp.h  654
+Lisp_Type      c-src/emacs/src/lisp.h  451
+Lisp_Vector    c-src/emacs/src/lisp.h  1369
+Lisp_Vectorlike        c-src/emacs/src/lisp.h  472
+Lisp_functions c-src/etags.c   /^Lisp_functions (FILE *inf)$/
+Lisp_help      c-src/etags.c   591
+Lisp_suffixes  c-src/etags.c   589
+ListEdit       pyt-src/server.py       /^class ListEdit(Frame):$/
+Locate pas-src/common.pas      /^function Locate; (*($/
+Lock/t ada-src/2ataspri.ads    /^   type Lock is private;$/
+Lock/t ada-src/2ataspri.ads    /^   type Lock is$/
+LowerCaseNmStr pas-src/common.pas      /^function LowerCaseNmStr; (*($/
+Lua_functions  c-src/etags.c   /^Lua_functions (FILE *inf)$/
+Lua_help       c-src/etags.c   600
+Lua_suffixes   c-src/etags.c   598
+MAGENTA        cp-src/screen.hpp       17
+MAGICBYTE      c-src/emacs/src/gmalloc.c       1856
+MAGICFREE      c-src/emacs/src/gmalloc.c       1855
+MAGICWORD      c-src/emacs/src/gmalloc.c       1854
+MAKE   make-src/Makefile       /^MAKE:=$(MAKE) --no-print-directory$/
+MAKESRC        make-src/Makefile       /^MAKESRC=Makefile$/
+MALLOCFLOOD    c-src/emacs/src/gmalloc.c       1857
+MANY   c-src/emacs/src/lisp.h  2833
+MARKERP        c-src/emacs/src/lisp.h  /^# define MARKERP(x) lisp_h_MARKERP 
(x)$/
+MAXPATHLEN     c-src/etags.c   115
+MAX_ALLOCA     c-src/emacs/src/lisp.h  4556
+MAX_ENCODED_BYTES      c-src/emacs/src/keyboard.c      2254
+MAX_HASH_VALUE c-src/etags.c   2329
+MAX_WORD_LENGTH        c-src/etags.c   2327
+MAYBEREL       y-src/parse.y   /^#define MAYBEREL(p) (*(p)=='[' && 
(isdigit((p)[1])/
+MBYTES objc-src/PackInsp.m     59
+MCHECK_DISABLED        c-src/emacs/src/gmalloc.c       285
+MCHECK_FREE    c-src/emacs/src/gmalloc.c       287
+MCHECK_HEAD    c-src/emacs/src/gmalloc.c       288
+MCHECK_OK      c-src/emacs/src/gmalloc.c       286
+MCHECK_TAIL    c-src/emacs/src/gmalloc.c       289
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (T *d, int r, int c) : 
DiagArray2<T>/
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (const Array<T>& a) : 
DiagArray2<T> /
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (const DiagArray2<T>& 
a) : DiagArray/
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (const MDiagArray2<T>& 
a) : DiagArra/
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (int r, int c) : 
DiagArray2<T> (r, c/
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (int r, int c, const T& 
val) : DiagA/
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (void) : DiagArray2<T> 
() { }$/
+MDiagArray2    cp-src/MDiagArray2.h    78
+MIN_HASH_VALUE c-src/etags.c   2328
+MIN_WORD_LENGTH        c-src/etags.c   2326
+MISCP  c-src/emacs/src/lisp.h  /^# define MISCP(x) lisp_h_MISCP (x)$/
+MOST_NEGATIVE_FIXNUM   c-src/emacs/src/lisp.h  835
+MOST_POSITIVE_FIXNUM   c-src/emacs/src/lisp.h  834
+MOVE   c-src/sysdep.h  /^#define MOVE(x,y)     movl x, y$/
+MSDOS  c-src/etags.c   100
+MSDOS  c-src/etags.c   106
+MSDOS  c-src/etags.c   107
+MSDOS  c-src/etags.c   110
+MSGSEL f-src/entry.for /^       ENTRY  MSGSEL ( TYPE )$/
+MSGSEL f-src/entry.strange     /^       ENTRY  MSGSEL ( TYPE )$/
+MSGSEL f-src/entry.strange_suffix      /^       ENTRY  MSGSEL ( TYPE )$/
+MULTI_LETTER_MOD       c-src/emacs/src/keyboard.c      /^#define 
MULTI_LETTER_MOD(BIT, NAME, LEN)                      \\$/
+MULTI_LETTER_MOD       c-src/emacs/src/keyboard.c      /^#define 
MULTI_LETTER_MOD(BIT, NAME, LEN)              \\$/
+MULTI_LETTER_MOD       c-src/emacs/src/keyboard.c      6231
+MULTI_LETTER_MOD       c-src/emacs/src/keyboard.c      6764
+Machin_T/b     ada-src/waroquiers.ada  /^  protected body Machin_T is$/
+Machin_T/t     ada-src/etags-test-for.ada      /^  protected Machin_T is$/
+Machin_T/t     ada-src/etags-test-for.ada      /^  protected type Machin_T is$/
+Machin_T/t     ada-src/waroquiers.ada  /^  protected type Machin_T is$/
+Machine_Exceptions/t   ada-src/2ataspri.ads    /^   type Machine_Exceptions is 
new Interfaces.C.POS/
+MakeDispose    pyt-src/server.py       /^    def MakeDispose(self):$/
+MakeSitelist   pyt-src/server.py       /^    def MakeSitelist(self, master):$/
+Makefile_filenames     c-src/etags.c   603
+Makefile_help  c-src/etags.c   605
+Makefile_targets       c-src/etags.c   /^Makefile_targets (FILE *inf)$/
+Mc     cp-src/c.C      /^int main (void) { my_function0(0); my_function1(1)/
+Mcccp  y-src/cccp.y    /^main ()$/
+Mconway.cpp    cp-src/conway.cpp       /^void main(void)$/
+Metags c-src/etags.c   /^main (int argc, char **argv)$/
+Mfail  cp-src/fail.C   /^main()$/
+Mkai-test.pl   perl-src/kai-test.pl    /^package main;$/
+ModuleExample  ruby-src/test.rb        /^module ModuleExample$/
+More_Lisp_Bits c-src/emacs/src/lisp.h  801
+MoveLayerAfter lua-src/allegro.lua     /^function MoveLayerAfter (this_one)$/
+MoveLayerBefore        lua-src/allegro.lua     /^function MoveLayerBefore 
(this_one)$/
+MoveLayerBottom        lua-src/allegro.lua     /^function MoveLayerBottom ()$/
+MoveLayerTop   lua-src/allegro.lua     /^function MoveLayerTop ()$/
+Mtest.go       go-src/test.go  /^func main() {$/
+Mtest.go       go-src/test.go  1
+Mtest.rs       rs-src/test.rs  /^fn main() {$/
+Mtest1.go      go-src/test1.go /^func main() {$/
+Mtest1.go      go-src/test1.go 1
+Mx.cc  cp-src/x.cc     /^main(int argc, char *argv[])$/
+NAME   y-src/cccp.c    8
+NATNUMP        c-src/emacs/src/lisp.h  /^NATNUMP (Lisp_Object x)$/
+NDEBUG c-src/etags.c   88
+NE     y-src/parse.c   6
+NEG    y-src/parse.c   9
+NEXT_ALMOST_PRIME_LIMIT        c-src/emacs/src/lisp.h  3573
+NILP   c-src/emacs/src/lisp.h  /^# define NILP(x) lisp_h_NILP (x)$/
+NIL_IS_ZERO    c-src/emacs/src/lisp.h  1515
+NONPOINTER_BITS        c-src/emacs/src/lisp.h  78
+NONPOINTER_BITS        c-src/emacs/src/lisp.h  80
+NONSRCS        make-src/Makefile       /^NONSRCS=entry.strange lists.erl 
clheir.hpp.gz$/
+NOTEQUAL       y-src/cccp.c    13
+NULL   y-src/cccp.y    51
+NULL_PTR       y-src/cccp.y    63
+NUMSTATS       objc-src/PackInsp.h     36
+NUM_MOD_NAMES  c-src/emacs/src/keyboard.c      6325
+NUM_RECENT_KEYS        c-src/emacs/src/keyboard.c      91
+NameHasChar    pas-src/common.pas      /^function NameHasChar; (* (TheName : 
NameString; Th/
+NameStringLess pas-src/common.pas      /^function NameStringLess;(*(var 
Name1,Name2 : NameS/
+NewLayer       lua-src/allegro.lua     /^function NewLayer (name, x, y, w, h)$/
+NewLayerSet    lua-src/allegro.lua     /^function NewLayerSet (name)$/
+NewNameString  pas-src/common.pas      /^procedure NewNameString; (* (var NSP: 
NameStringPo/
+NmStrToErrStr  pas-src/common.pas      /^function NmStrToErrStr;(*($/
+NmStrToInteger pas-src/common.pas      /^function NmStrToInteger; (* (Str : 
NameString) : i/
+OBJCPPSRC      make-src/Makefile       /^OBJCPPSRC=SimpleCalc.H SimpleCalc.M$/
+OBJCSRC        make-src/Makefile       /^OBJCSRC=Subprocess.h Subprocess.m 
PackInsp.h PackI/
+OBJS   make-src/Makefile       /^OBJS=${GETOPTOBJS} ${REGEXOBJS} ${CHECKOBJS}$/
+OPENBUTTON     objc-src/PackInsp.m     47
+OPTIONS        make-src/Makefile       /^OPTIONS=--members --declarations 
--regex=@regexfil/
+OR     y-src/cccp.c    10
+OTAGS  make-src/Makefile       /^OTAGS: oetags ${SRCS} srclist$/
+OVERLAYP       c-src/emacs/src/lisp.h  /^OVERLAYP (Lisp_Object x)$/
+Objc_help      c-src/etags.c   613
+Objc_suffixes  c-src/etags.c   609
+OperatorFun    c-src/h.h       88
+Overview       tex-src/gzip.texi       /^@node Overview, Sample, Copying, Top$/
+PASSRC make-src/Makefile       /^PASSRC=common.pas$/
+PDT    c-src/h.h       /^  Date 04 May 87 235311 PDT (Mon)$/
+PERLSRC        make-src/Makefile       /^PERLSRC=htlmify-cystic yagrip.pl 
kai-test.pl mirro/
+PHPSRC make-src/Makefile       /^PHPSRC=lce_functions.php ptest.php 
sendmail.php$/
+PHP_functions  c-src/etags.c   /^PHP_functions (FILE *inf)$/
+PHP_help       c-src/etags.c   639
+PHP_suffixes   c-src/etags.c   637
+POEntry        php-src/lce_functions.php       /^      function POEntry()$/
+POEntry        php-src/lce_functions.php       105
+POEntryAD      php-src/lce_functions.php       29
+PORManager     php-src/lce_functions.php       /^      function PORManager()$/
+PORManager     php-src/lce_functions.php       498
+POReader       php-src/lce_functions.php       /^      function 
POReader($domain, $filename)$/
+POReader       php-src/lce_functions.php       163
+POSTSCRIPTFLAGS        make-src/Makefile       
/^POSTSCRIPTFLAGS=--language=none --regex='#\/[^ \\t{]/
+PRINT_UNDOCUMENTED_OPTIONS_HELP        c-src/etags.c   804
+PROCESSP       c-src/emacs/src/lisp.h  /^PROCESSP (Lisp_Object a)$/
+PROLSRC        make-src/Makefile       /^PROLSRC=ordsets.prolog natded.prolog$/
+PROP   c-src/emacs/src/keyboard.c      /^#define PROP(IDX) AREF 
(tool_bar_item_properties, /
+PROP   c-src/emacs/src/keyboard.c      8379
+PROTECT_MALLOC_STATE   c-src/emacs/src/gmalloc.c       /^#define 
PROTECT_MALLOC_STATE(PROT)    \/* empty *\/$/
+PROTECT_MALLOC_STATE   c-src/emacs/src/gmalloc.c       /^#define 
PROTECT_MALLOC_STATE(PROT) protect_malloc_/
+PRTPKG f-src/entry.for /^      LOGICAL FUNCTION PRTPKG ( SHORT, LONG, EXPL,/
+PRTPKG f-src/entry.strange     /^      LOGICAL FUNCTION PRTPKG ( SHORT, LONG, 
EXPL,/
+PRTPKG f-src/entry.strange_suffix      /^      LOGICAL FUNCTION PRTPKG ( 
SHORT, LONG, EXPL,/
+PSEUDO c-src/sysdep.h  /^#define       PSEUDO(name, syscall_name, args)        
                              /
+PSEUDOVECSIZE  c-src/emacs/src/lisp.h  /^#define PSEUDOVECSIZE(type, 
nonlispfield)                     \\$/
+PSEUDOVECTORP  c-src/emacs/src/lisp.h  /^PSEUDOVECTORP (Lisp_Object a, int 
code)$/
+PSEUDOVECTOR_AREA_BITS c-src/emacs/src/lisp.h  818
+PSEUDOVECTOR_FLAG      c-src/emacs/src/lisp.h  774
+PSEUDOVECTOR_REST_BITS c-src/emacs/src/lisp.h  813
+PSEUDOVECTOR_REST_MASK c-src/emacs/src/lisp.h  814
+PSEUDOVECTOR_SIZE_BITS c-src/emacs/src/lisp.h  808
+PSEUDOVECTOR_SIZE_MASK c-src/emacs/src/lisp.h  809
+PSEUDOVECTOR_TYPEP     c-src/emacs/src/lisp.h  /^PSEUDOVECTOR_TYPEP (struct 
vectorlike_header *a, i/
+PSSRC  make-src/Makefile       /^PSSRC=rfc1245.ps$/
+PS_functions   c-src/etags.c   /^PS_functions (FILE *inf)$/
+PS_help        c-src/etags.c   649
+PS_suffixes    c-src/etags.c   647
+PTY_LENGTH     objc-src/Subprocess.m   21
+PTY_TEMPLATE   objc-src/Subprocess.m   20
+PUSH_C_STR     c-src/emacs/src/keyboard.c      /^#define PUSH_C_STR(str, 
listvar) \\$/
+PUSH_HANDLER   c-src/emacs/src/lisp.h  /^#define PUSH_HANDLER(c, tag_ch_val, 
handlertype)      \\/
+PVEC_BOOL_VECTOR       c-src/emacs/src/lisp.h  787
+PVEC_BUFFER    c-src/emacs/src/lisp.h  788
+PVEC_CHAR_TABLE        c-src/emacs/src/lisp.h  796
+PVEC_COMPILED  c-src/emacs/src/lisp.h  795
+PVEC_FONT      c-src/emacs/src/lisp.h  798
+PVEC_FRAME     c-src/emacs/src/lisp.h  785
+PVEC_FREE      c-src/emacs/src/lisp.h  783
+PVEC_HASH_TABLE        c-src/emacs/src/lisp.h  789
+PVEC_NORMAL_VECTOR     c-src/emacs/src/lisp.h  782
+PVEC_OTHER     c-src/emacs/src/lisp.h  793
+PVEC_PROCESS   c-src/emacs/src/lisp.h  784
+PVEC_SUBR      c-src/emacs/src/lisp.h  792
+PVEC_SUB_CHAR_TABLE    c-src/emacs/src/lisp.h  797
+PVEC_TERMINAL  c-src/emacs/src/lisp.h  790
+PVEC_TYPE_MASK c-src/emacs/src/lisp.h  819
+PVEC_WINDOW    c-src/emacs/src/lisp.h  786
+PVEC_WINDOW_CONFIGURATION      c-src/emacs/src/lisp.h  791
+PYTSRC make-src/Makefile       /^PYTSRC=server.py$/
+PackageInspector       objc-src/PackInsp.h     /^@interface 
PackageInspector:WMInspector$/
+Pascal_functions       c-src/etags.c   /^Pascal_functions (FILE *inf)$/
+Pascal_help    c-src/etags.c   621
+Pascal_suffixes        c-src/etags.c   619
+Perl_functions c-src/etags.c   /^Perl_functions (FILE *inf)$/
+Perl_help      c-src/etags.c   630
+Perl_interpreters      c-src/etags.c   628
+Perl_suffixes  c-src/etags.c   626
+Pkg1/b ada-src/etags-test-for.ada      /^package body Pkg1 is$/
+Pkg1/b ada-src/waroquiers.ada  /^package body Pkg1 is$/
+Pkg1/s ada-src/etags-test-for.ada      /^package Pkg1 is$/
+Pkg1/s ada-src/waroquiers.ada  /^package Pkg1 is$/
+Pkg1_Func1/f   ada-src/etags-test-for.ada      /^  function Pkg1_Func1 return 
Boolean is separate;$/
+Pkg1_Func1/f   ada-src/etags-test-for.ada      /^  function Pkg1_Func1 return 
Boolean;$/
+Pkg1_Func1/f   ada-src/etags-test-for.ada      /^function  Pkg1_Func1 return 
Boolean is$/
+Pkg1_Func1/f   ada-src/waroquiers.ada  /^  function Pkg1_Func1 return Boolean 
is separate;$/
+Pkg1_Func1/f   ada-src/waroquiers.ada  /^  function Pkg1_Func1 return 
Boolean;$/
+Pkg1_Func1/f   ada-src/waroquiers.ada  /^function  Pkg1_Func1 return Boolean 
is$/
+Pkg1_Func2/f   ada-src/etags-test-for.ada      /^  function Pkg1_Func2 (Ijk : 
Integer; Z : Integer)/
+Pkg1_Func2/f   ada-src/waroquiers.ada  /^  function Pkg1_Func2 (Ijk : Integer; 
Z : Integer)/
+Pkg1_Pkg1/b    ada-src/etags-test-for.ada      /^  package body Pkg1_Pkg1 is 
separate;$/
+Pkg1_Pkg1/b    ada-src/etags-test-for.ada      /^package body Pkg1_Pkg1 is$/
+Pkg1_Pkg1/b    ada-src/waroquiers.ada  /^  package body Pkg1_Pkg1 is 
separate;$/
+Pkg1_Pkg1/b    ada-src/waroquiers.ada  /^package body Pkg1_Pkg1 is$/
+Pkg1_Pkg1/s    ada-src/etags-test-for.ada      /^  package Pkg1_Pkg1 is$/
+Pkg1_Pkg1/s    ada-src/waroquiers.ada  /^  package Pkg1_Pkg1 is$/
+Pkg1_Pkg1_Proc1/p      ada-src/etags-test-for.ada      /^    procedure 
Pkg1_Pkg1_Proc1;$/
+Pkg1_Pkg1_Proc1/p      ada-src/etags-test-for.ada      /^  procedure 
Pkg1_Pkg1_Proc1 is$/
+Pkg1_Pkg1_Proc1/p      ada-src/waroquiers.ada  /^    procedure 
Pkg1_Pkg1_Proc1;$/
+Pkg1_Pkg1_Proc1/p      ada-src/waroquiers.ada  /^  procedure Pkg1_Pkg1_Proc1 
is$/
+Pkg1_Proc1/p   ada-src/etags-test-for.ada      /^  procedure Pkg1_Proc1 is$/
+Pkg1_Proc1/p   ada-src/etags-test-for.ada      /^  procedure Pkg1_Proc1;$/
+Pkg1_Proc1/p   ada-src/waroquiers.ada  /^  procedure Pkg1_Proc1 is$/
+Pkg1_Proc1/p   ada-src/waroquiers.ada  /^  procedure Pkg1_Proc1;$/
+Pkg1_Proc2/p   ada-src/etags-test-for.ada      /^  procedure Pkg1_Proc2 (I : 
Integer) is$/
+Pkg1_Proc2/p   ada-src/etags-test-for.ada      /^  procedure Pkg1_Proc2 (I : 
Integer);$/
+Pkg1_Proc2/p   ada-src/waroquiers.ada  /^  procedure Pkg1_Proc2 (I : Integer) 
is$/
+Pkg1_Proc2/p   ada-src/waroquiers.ada  /^  procedure Pkg1_Proc2 (I : 
Integer);$/
+PostControls   pyt-src/server.py       /^    def PostControls(self):$/
+Pre_Call_State/t       ada-src/2ataspri.ads    /^   type Pre_Call_State is new 
System.Address;$/
+PrintAdd       go-src/test1.go /^func (n intNumber) PrintAdd() {$/
+PrintAdd       go-src/test1.go /^func (s str) PrintAdd() {$/
+Private        objc-src/Subprocess.m   /^@interface Subprocess(Private)$/
+Private_T/b    ada-src/etags-test-for.ada      /^    task body Private_T is$/
+Private_T/b    ada-src/waroquiers.ada  /^    task body Private_T is$/
+Private_T/k    ada-src/etags-test-for.ada      /^    task Private_T;$/
+Private_T/k    ada-src/waroquiers.ada  /^    task Private_T;$/
+Private_T/p    ada-src/etags-test-for.ada      /^    procedure Private_T is$/
+Private_T/p    ada-src/etags-test-for.ada      /^    procedure Private_T;$/
+Private_T/p    ada-src/waroquiers.ada  /^    procedure Private_T is$/
+Private_T/p    ada-src/waroquiers.ada  /^    procedure Private_T;$/
+Private_T/t    ada-src/etags-test-for.ada      /^  type Private_T is private;$/
+Private_T/t    ada-src/etags-test-for.ada      /^  type Private_T is$/
+Private_T/t    ada-src/waroquiers.ada  /^  type Private_T is private;$/
+Private_T/t    ada-src/waroquiers.ada  /^  type Private_T is$/
+Problems       tex-src/gzip.texi       /^@node Problems, Concept Index, Tapes, 
Top$/
+Proc/t ada-src/2ataspri.ads    /^   type Proc is access procedure (Addr : 
System.Ad/
+Prolog_functions       c-src/etags.c   /^Prolog_functions (FILE *inf)$/
+Prolog_help    c-src/etags.c   654
+Prolog_suffixes        c-src/etags.c   652
+Public_T/t     ada-src/etags-test-for.ada      /^  type Public_T is$/
+Public_T/t     ada-src/waroquiers.ada  /^  type Public_T is$/
+Python_functions       c-src/etags.c   /^Python_functions (FILE *inf)$/
+Python_help    c-src/etags.c   660
+Python_suffixes        c-src/etags.c   658
+QUIT   c-src/emacs/src/lisp.h  3101
+QUITP  c-src/emacs/src/lisp.h  3112
+RANGED_INTEGERP        c-src/emacs/src/lisp.h  /^RANGED_INTEGERP (intmax_t lo, 
Lisp_Object x, intma/
+RCSid  objc-src/PackInsp.m     30
+READABLE_EVENTS_DO_TIMERS_NOW  c-src/emacs/src/keyboard.c      346
+READABLE_EVENTS_FILTER_EVENTS  c-src/emacs/src/keyboard.c      347
+READABLE_EVENTS_IGNORE_SQUEEZABLES     c-src/emacs/src/keyboard.c      348
+RECC_ALNUM     c-src/emacs/src/regex.h 610
+RECC_ALPHA     c-src/emacs/src/regex.h 610
+RECC_ASCII     c-src/emacs/src/regex.h 617
+RECC_BLANK     c-src/emacs/src/regex.h 615
+RECC_CNTRL     c-src/emacs/src/regex.h 613
+RECC_DIGIT     c-src/emacs/src/regex.h 614
+RECC_ERROR     c-src/emacs/src/regex.h 609
+RECC_GRAPH     c-src/emacs/src/regex.h 611
+RECC_LOWER     c-src/emacs/src/regex.h 612
+RECC_MULTIBYTE c-src/emacs/src/regex.h 616
+RECC_NONASCII  c-src/emacs/src/regex.h 616
+RECC_PRINT     c-src/emacs/src/regex.h 611
+RECC_PUNCT     c-src/emacs/src/regex.h 613
+RECC_SPACE     c-src/emacs/src/regex.h 615
+RECC_UNIBYTE   c-src/emacs/src/regex.h 617
+RECC_UPPER     c-src/emacs/src/regex.h 612
+RECC_WORD      c-src/emacs/src/regex.h 610
+RECC_XDIGIT    c-src/emacs/src/regex.h 614
+RED    cp-src/screen.hpp       16
+REGEX  make-src/Makefile       /^REGEX=\/[ \\t]*DEFVAR_[A-Z_ 
\\t\\n(]+"\\([^"]+\\)"\/$/
+REGEXOBJS      make-src/Makefile       /^REGEXOBJS=regex.o$/
+REGS_FIXED     c-src/emacs/src/regex.h 378
+REGS_REALLOCATE        c-src/emacs/src/regex.h 377
+REGS_UNALLOCATED       c-src/emacs/src/regex.h 376
+REG_BADBR      c-src/emacs/src/regex.h 313
+REG_BADPAT     c-src/emacs/src/regex.h 305
+REG_BADRPT     c-src/emacs/src/regex.h 316
+REG_EBRACE     c-src/emacs/src/regex.h 312
+REG_EBRACK     c-src/emacs/src/regex.h 310
+REG_ECOLLATE   c-src/emacs/src/regex.h 306
+REG_ECTYPE     c-src/emacs/src/regex.h 307
+REG_EEND       c-src/emacs/src/regex.h 319
+REG_EESCAPE    c-src/emacs/src/regex.h 308
+REG_ENOSYS     c-src/emacs/src/regex.h 297
+REG_ENOSYS     c.c     279
+REG_EPAREN     c-src/emacs/src/regex.h 311
+REG_ERANGE     c-src/emacs/src/regex.h 314
+REG_ERANGEX    c-src/emacs/src/regex.h 322
+REG_ERPAREN    c-src/emacs/src/regex.h 321
+REG_ESIZE      c-src/emacs/src/regex.h 320
+REG_ESPACE     c-src/emacs/src/regex.h 315
+REG_ESUBREG    c-src/emacs/src/regex.h 309
+REG_EXTENDED   c-src/emacs/src/regex.h 263
+REG_ICASE      c-src/emacs/src/regex.h 267
+REG_NEWLINE    c-src/emacs/src/regex.h 272
+REG_NOERROR    c-src/emacs/src/regex.h 300
+REG_NOMATCH    c-src/emacs/src/regex.h 301
+REG_NOSUB      c-src/emacs/src/regex.h 276
+REG_NOTBOL     c-src/emacs/src/regex.h 286
+REG_NOTEOL     c-src/emacs/src/regex.h 289
+RELEASELIST    make-src/Makefile       /^RELEASELIST=pot@gnu.org 
xemacs-review@xemacs.org j/
+RESUME_POLLING c-src/emacs/src/keyboard.c      2170
+RETURN_UNGCPRO c-src/emacs/src/lisp.h  /^#define RETURN_UNGCPRO(expr)          
        \\$/
+RE_BACKSLASH_ESCAPE_IN_LISTS   c-src/emacs/src/regex.h 47
+RE_BK_PLUS_QM  c-src/emacs/src/regex.h 52
+RE_CHAR_CLASSES        c-src/emacs/src/regex.h 58
+RE_CONTEXT_INDEP_ANCHORS       c-src/emacs/src/regex.h 72
+RE_CONTEXT_INDEP_OPS   c-src/emacs/src/regex.h 80
+RE_CONTEXT_INVALID_OPS c-src/emacs/src/regex.h 84
+RE_DEBUG       c-src/emacs/src/regex.h 161
+RE_DOT_NEWLINE c-src/emacs/src/regex.h 88
+RE_DOT_NOT_NULL        c-src/emacs/src/regex.h 92
+RE_DUP_MAX     c-src/emacs/src/regex.h 253
+RE_DUP_MAX     c-src/emacs/src/regex.h 256
+RE_FRUGAL      c-src/emacs/src/regex.h 147
+RE_HAT_LISTS_NOT_NEWLINE       c-src/emacs/src/regex.h 96
+RE_INTERVALS   c-src/emacs/src/regex.h 101
+RE_LIMITED_OPS c-src/emacs/src/regex.h 105
+RE_NEWLINE_ALT c-src/emacs/src/regex.h 109
+RE_NO_BK_BRACES        c-src/emacs/src/regex.h 114
+RE_NO_BK_PARENS        c-src/emacs/src/regex.h 118
+RE_NO_BK_REFS  c-src/emacs/src/regex.h 122
+RE_NO_BK_VBAR  c-src/emacs/src/regex.h 126
+RE_NO_EMPTY_RANGES     c-src/emacs/src/regex.h 132
+RE_NO_GNU_OPS  c-src/emacs/src/regex.h 144
+RE_NO_NEWLINE_ANCHOR   c-src/emacs/src/regex.h 153
+RE_NO_POSIX_BACKTRACKING       c-src/emacs/src/regex.h 140
+RE_NREGS       c-src/emacs/src/regex.h 440
+RE_SHY_GROUPS  c-src/emacs/src/regex.h 150
+RE_SYNTAX_AWK  c-src/emacs/src/regex.h 186
+RE_SYNTAX_ED   c-src/emacs/src/regex.h 216
+RE_SYNTAX_EGREP        c-src/emacs/src/regex.h 206
+RE_SYNTAX_EMACS        c-src/emacs/src/regex.h 183
+RE_SYNTAX_GNU_AWK      c-src/emacs/src/regex.h 193
+RE_SYNTAX_GREP c-src/emacs/src/regex.h 201
+RE_SYNTAX_POSIX_AWK    c-src/emacs/src/regex.h 197
+RE_SYNTAX_POSIX_BASIC  c-src/emacs/src/regex.h 225
+RE_SYNTAX_POSIX_EGREP  c-src/emacs/src/regex.h 212
+RE_SYNTAX_POSIX_EXTENDED       c-src/emacs/src/regex.h 234
+RE_SYNTAX_POSIX_MINIMAL_BASIC  c-src/emacs/src/regex.h 231
+RE_SYNTAX_POSIX_MINIMAL_EXTENDED       c-src/emacs/src/regex.h 242
+RE_SYNTAX_SED  c-src/emacs/src/regex.h 218
+RE_TRANSLATE_TYPE      c-src/emacs/src/regex.h 332
+RE_UNMATCHED_RIGHT_PAREN_ORD   c-src/emacs/src/regex.h 136
+RSH    y-src/cccp.c    17
+RTE/s  ada-src/2ataspri.adb    /^   package RTE renames 
Interfaces.C.POSIX_RTE;$/
+RUN    make-src/Makefile       /^RUN=$/
+RUN    make-src/Makefile       /^RUN=time --quiet --format '%U + %S: %E'$/
+RXINCLUDE      make-src/Makefile       /^RXINCLUDE=-Iemacs\/src$/
+Range  cp-src/Range.h  /^  Range (const Range& r)$/
+Range  cp-src/Range.h  /^  Range (double b, double l)$/
+Range  cp-src/Range.h  /^  Range (double b, double l, double i)$/
+Range  cp-src/Range.h  /^  Range (void)$/
+Range  cp-src/Range.h  35
+ReadVacation   cp-src/functions.cpp    /^void ReadVacation ( char *filename ) 
{$/
+Read_Lock/p    ada-src/2ataspri.adb    /^   procedure Read_Lock (L : in out 
Lock; Ceiling_V/
+Read_Lock/p    ada-src/2ataspri.ads    /^   procedure Read_Lock (L : in out 
Lock; Ceiling_V/
+Rectangle.getPos       lua-src/test.lua        /^function Rectangle.getPos ()$/
+ReleaseNameString      pas-src/common.pas      /^procedure ReleaseNameString; 
(* (var NSP: NameStri/
+RemoveLayer    lua-src/allegro.lua     /^function RemoveLayer ()$/
+RemoveUnderlineControl pas-src/common.pas      /^function 
RemoveUnderlineControl; (*($/
+ReprOfChar     pas-src/common.pas      /^function ReprOfChar; (*( ch : char) : 
NameString;*/
+S      c.c     156
+SAFE_ALLOCA    c-src/emacs/src/lisp.h  /^#define SAFE_ALLOCA(size) ((size) <= 
sa_avail                         \\/
+SAFE_ALLOCA_LISP       c-src/emacs/src/lisp.h  /^#define SAFE_ALLOCA_LISP(buf, 
nelt)                          \\$/
+SAFE_ALLOCA_STRING     c-src/emacs/src/lisp.h  /^#define 
SAFE_ALLOCA_STRING(ptr, string)                       \\$/
+SAFE_FREE      c-src/emacs/src/lisp.h  /^#define SAFE_FREE()                   
\\$/
+SAFE_NALLOCA   c-src/emacs/src/lisp.h  /^#define SAFE_NALLOCA(buf, multiplier, 
nitems)                  \\/
+SAVE_FUNCPOINTER       c-src/emacs/src/lisp.h  2049
+SAVE_INTEGER   c-src/emacs/src/lisp.h  2048
+SAVE_OBJECT    c-src/emacs/src/lisp.h  2051
+SAVE_POINTER   c-src/emacs/src/lisp.h  2050
+SAVE_SLOT_BITS c-src/emacs/src/lisp.h  2055
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h  2062
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h  2114
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h  2123
+SAVE_TYPE_FUNCPTR_PTR_OBJ      c-src/emacs/src/lisp.h  2076
+SAVE_TYPE_INT_INT      c-src/emacs/src/lisp.h  2066
+SAVE_TYPE_INT_INT_INT  c-src/emacs/src/lisp.h  2067
+SAVE_TYPE_MEMORY       c-src/emacs/src/lisp.h  2080
+SAVE_TYPE_OBJ_OBJ      c-src/emacs/src/lisp.h  2069
+SAVE_TYPE_OBJ_OBJ_OBJ  c-src/emacs/src/lisp.h  2070
+SAVE_TYPE_OBJ_OBJ_OBJ_OBJ      c-src/emacs/src/lisp.h  2071
+SAVE_TYPE_PTR_INT      c-src/emacs/src/lisp.h  2073
+SAVE_TYPE_PTR_OBJ      c-src/emacs/src/lisp.h  2074
+SAVE_TYPE_PTR_PTR      c-src/emacs/src/lisp.h  2075
+SAVE_UNUSED    c-src/emacs/src/lisp.h  2047
+SAVE_VALUEP    c-src/emacs/src/lisp.h  /^SAVE_VALUEP (Lisp_Object x)$/
+SAVE_VALUE_SLOTS       c-src/emacs/src/lisp.h  2058
+SBYTES c-src/emacs/src/lisp.h  /^SBYTES (Lisp_Object string)$/
+SCHARS c-src/emacs/src/lisp.h  /^SCHARS (Lisp_Object string)$/
+SCREEN_FP      cp-src/screen.hpp       /^#define SCREEN_FP(x,y) \\$/
+SCREEN_START   cp-src/screen.hpp       33
+SDATA  c-src/emacs/src/lisp.h  /^SDATA (Lisp_Object string)$/
+SDTrefGetInteger       pas-src/common.pas      /^function SDTrefGetInteger : 
integer;$/
+SDTrefIsEnd    pas-src/common.pas      /^function SDTrefIsEnd : Boolean;$/
+SDTrefRecToString      pas-src/common.pas      /^procedure SDTrefRecToString  
(* ($/
+SDTrefSkipSpaces       pas-src/common.pas      /^procedure SDTrefSkipSpaces;$/
+SDTrefStringToRec      pas-src/common.pas      /^procedure SDTrefStringToRec 
(* ($/
+SETPRT f-src/entry.for /^       ENTRY  SETPRT ( SHORT, EXPL, LONG, TRACE, D/
+SETPRT f-src/entry.strange     /^       ENTRY  SETPRT ( SHORT, EXPL, LONG, 
TRACE, D/
+SETPRT f-src/entry.strange_suffix      /^       ENTRY  SETPRT ( SHORT, EXPL, 
LONG, TRACE, D/
+SET_SYMBOL_BLV c-src/emacs/src/lisp.h  /^SET_SYMBOL_BLV (struct Lisp_Symbol 
*sym, struct Li/
+SET_SYMBOL_FWD c-src/emacs/src/lisp.h  /^SET_SYMBOL_FWD (struct Lisp_Symbol 
*sym, union Lis/
+SET_SYMBOL_VAL c-src/emacs/src/lisp.h  /^# define SET_SYMBOL_VAL(sym, v) 
lisp_h_SET_SYMBOL_/
+SINGLE_LETTER_MOD      c-src/emacs/src/keyboard.c      /^#define 
SINGLE_LETTER_MOD(BIT)                                \\$/
+SINGLE_LETTER_MOD      c-src/emacs/src/keyboard.c      6212
+SINGLE_LETTER_MOD      c-src/emacs/src/keyboard.c      6763
+SIZEFORMAT     objc-src/PackInsp.m     57
+SPECPDL_BACKTRACE      c-src/emacs/src/lisp.h  2948
+SPECPDL_INDEX  c-src/emacs/src/lisp.h  /^SPECPDL_INDEX (void)$/
+SPECPDL_LET    c-src/emacs/src/lisp.h  2949
+SPECPDL_LET_DEFAULT    c-src/emacs/src/lisp.h  2952
+SPECPDL_LET_LOCAL      c-src/emacs/src/lisp.h  2951
+SPECPDL_UNWIND c-src/emacs/src/lisp.h  2944
+SPECPDL_UNWIND_INT     c-src/emacs/src/lisp.h  2946
+SPECPDL_UNWIND_PTR     c-src/emacs/src/lisp.h  2945
+SPECPDL_UNWIND_VOID    c-src/emacs/src/lisp.h  2947
+SRCS   make-src/Makefile       /^SRCS=Makefile ${ADASRC} ${ASRC} ${CSRC} 
${CPSRC} $/
+SREF   c-src/emacs/src/lisp.h  /^SREF (Lisp_Object string, ptrdiff_t index)$/
+SSDATA c-src/emacs/src/lisp.h  /^SSDATA (Lisp_Object string)$/
+SSET   c-src/emacs/src/lisp.h  /^SSET (Lisp_Object string, ptrdiff_t index, 
unsigne/
+STACK_CONS     c-src/emacs/src/lisp.h  /^#define STACK_CONS(a, b) \\$/
+STATE_ABORT    php-src/lce_functions.php       25
+STATE_COMPRESSD        objc-src/PackInsp.m     54
+STATE_INSTALLED        objc-src/PackInsp.m     53
+STATE_LOOP     php-src/lce_functions.php       27
+STATE_OK       php-src/lce_functions.php       26
+STATE_UNINSTALLED      objc-src/PackInsp.m     52
+STAT_EQ        objc-src/PackInsp.m     /^#define STAT_EQ(s1, s2)       
((s1)->st_ino == (s2)->st_/
+STDIN  c-src/etags.c   408
+STDIN  c-src/etags.c   411
+STOP_POLLING   c-src/emacs/src/keyboard.c      2166
+STRING_BYTES   c-src/emacs/src/lisp.h  /^STRING_BYTES (struct Lisp_String *s)$/
+STRING_BYTES_BOUND     c-src/emacs/src/lisp.h  1261
+STRING_MULTIBYTE       c-src/emacs/src/lisp.h  /^STRING_MULTIBYTE (Lisp_Object 
str)$/
+STRING_SET_CHARS       c-src/emacs/src/lisp.h  /^STRING_SET_CHARS (Lisp_Object 
string, ptrdiff_t ne/
+STRING_SET_MULTIBYTE   c-src/emacs/src/lisp.h  /^#define 
STRING_SET_MULTIBYTE(STR)                     \\$/
+STRING_SET_UNIBYTE     c-src/emacs/src/lisp.h  /^#define 
STRING_SET_UNIBYTE(STR)                               \\$/
+SUBRP  c-src/emacs/src/lisp.h  /^SUBRP (Lisp_Object a)$/
+SUB_CHAR_TABLE_OFFSET  c-src/emacs/src/lisp.h  1701
+SUB_CHAR_TABLE_P       c-src/emacs/src/lisp.h  /^SUB_CHAR_TABLE_P (Lisp_Object 
a)$/
+SXHASH_REDUCE  c-src/emacs/src/lisp.h  /^SXHASH_REDUCE (EMACS_UINT x)$/
+SYMBOLP        c-src/emacs/src/lisp.h  /^# define SYMBOLP(x) lisp_h_SYMBOLP 
(x)$/
+SYMBOL_BLV     c-src/emacs/src/lisp.h  /^SYMBOL_BLV (struct Lisp_Symbol *sym)$/
+SYMBOL_CONSTANT_P      c-src/emacs/src/lisp.h  /^# define 
SYMBOL_CONSTANT_P(sym) lisp_h_SYMBOL_CONS/
+SYMBOL_FORWARDED       c-src/emacs/src/lisp.h  651
+SYMBOL_FWD     c-src/emacs/src/lisp.h  /^SYMBOL_FWD (struct Lisp_Symbol *sym)$/
+SYMBOL_INDEX   c-src/emacs/src/lisp.h  /^#define SYMBOL_INDEX(sym) i##sym$/
+SYMBOL_INTERNED        c-src/emacs/src/lisp.h  642
+SYMBOL_INTERNED_IN_INITIAL_OBARRAY     c-src/emacs/src/lisp.h  643
+SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P   c-src/emacs/src/lisp.h  
/^SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (Lisp_Object /
+SYMBOL_INTERNED_P      c-src/emacs/src/lisp.h  /^SYMBOL_INTERNED_P 
(Lisp_Object sym)$/
+SYMBOL_LOCALIZED       c-src/emacs/src/lisp.h  650
+SYMBOL_NAME    c-src/emacs/src/lisp.h  /^SYMBOL_NAME (Lisp_Object sym)$/
+SYMBOL_PLAINVAL        c-src/emacs/src/lisp.h  648
+SYMBOL_UNINTERNED      c-src/emacs/src/lisp.h  641
+SYMBOL_VAL     c-src/emacs/src/lisp.h  /^# define SYMBOL_VAL(sym) 
lisp_h_SYMBOL_VAL (sym)$/
+SYMBOL_VARALIAS        c-src/emacs/src/lisp.h  649
+SYSCALL        c-src/machsyscalls.c    /^#define       SYSCALL(name, number, 
type, args, typed_ar/
+Sample tex-src/gzip.texi       /^@node Sample, Invoking gzip, Overview, Top$/
+Scheme_functions       c-src/etags.c   /^Scheme_functions (FILE *inf)$/
+Scheme_help    c-src/etags.c   667
+Scheme_suffixes        c-src/etags.c   665
+SelectLayer    lua-src/allegro.lua     /^function SelectLayer (layer)$/
+Self/f ada-src/2ataspri.adb    /^   function Self return TCB_Ptr is$/
+Self/f ada-src/2ataspri.ads    /^   function Self return TCB_Ptr;$/
+Server pyt-src/server.py       /^class Server:$/
+ServerEdit     pyt-src/server.py       /^class ServerEdit(Frame):$/
+Set_Own_Priority/p     ada-src/2ataspri.adb    /^   procedure Set_Own_Priority 
(Prio : System.Any_P/
+Set_Own_Priority/p     ada-src/2ataspri.ads    /^   procedure Set_Own_Priority 
(Prio : System.Any_P/
+Set_Priority/p ada-src/2ataspri.adb    /^   procedure Set_Priority$/
+Set_Priority/p ada-src/2ataspri.ads    /^   procedure Set_Priority (T : 
TCB_Ptr; Prio : Sys/
+SimpleCalc     objcpp-src/SimpleCalc.H /^@interface SimpleCalc:Object$/
+SkipBlanks     pas-src/common.pas      /^function SkipBlanks; (*($/
+SkipChars      pas-src/common.pas      /^function SkipChars; (*($/
+SkipSpaces     pas-src/common.pas      /^procedure SkipSpaces; (* (Str : 
NameString; var I /
+Square.something:Bar   lua-src/test.lua        /^function Square.something:Bar 
()$/
+StartDay       cp-src/functions.cpp    /^Date StartDay(Date a,int 
days){\/\/Function to calcu/
+StripPath      pas-src/common.pas      /^function StripPath; (*($/
+SubString      pas-src/common.pas      /^function SubString; (*($/
+Subprocess     objc-src/Subprocess.h   /^@interface Subprocess:Object$/
+Subprocess     objc-src/Subprocess.h   41
+System.Task_Primitives/b       ada-src/2ataspri.adb    /^package body 
System.Task_Primitives is$/
+System.Task_Primitives/s       ada-src/2ataspri.ads    /^package 
System.Task_Primitives is$/
+T      cp-src/fail.C   14
+T2     cp-src/fail.C   16
+T3     c.c     163
+TAGS   make-src/Makefile       /^TAGS: etags.c$/
+TAG_PTR        c-src/emacs/src/lisp.h  /^#define TAG_PTR(tag, ptr) \\$/
+TAG_SYMOFFSET  c-src/emacs/src/lisp.h  /^#define TAG_SYMOFFSET(offset)         
                    \\$/
+TAS_Cell/t     ada-src/2ataspri.ads    /^   type TAS_Cell is private;$/
+TAS_Cell/t     ada-src/2ataspri.ads    /^   type TAS_Cell is$/
+TCB_Ptr/t      ada-src/2ataspri.ads    /^   type TCB_Ptr is access all 
Task_Control_Block;$/
+TCLFLAGS       make-src/Makefile       /^TCLFLAGS=--lang=none --regex='\/proc[ 
\\t]+\\([^ \\t]+/
+TERMINALP      c-src/emacs/src/lisp.h  /^TERMINALP (Lisp_Object a)$/
+TEST   php-src/ptest.php       1
+TEXSRC make-src/Makefile       /^TEXSRC=testenv.tex gzip.texi texinfo.tex 
nonewline/
+TEX_LESC       c-src/etags.c   4986
+TEX_SESC       c-src/etags.c   4987
+TEX_clgrp      c-src/etags.c   4922
+TEX_decode_env c-src/etags.c   /^TEX_decode_env (const char *evarname, const 
char */
+TEX_defenv     c-src/etags.c   4912
+TEX_esc        c-src/etags.c   4920
+TEX_mode       c-src/etags.c   /^TEX_mode (FILE *inf)$/
+TEX_opgrp      c-src/etags.c   4921
+TEX_toktab     c-src/etags.c   4908
+TOTAL_KEYWORDS c-src/etags.c   2325
+TSL/s  ada-src/2ataspri.adb    /^   package TSL renames 
System.Tasking_Soft_Links;$/
+TYPESTOSTAT    objc-src/PackInsp.h     37
+TYPE_RANGED_INTEGERP   c-src/emacs/src/lisp.h  /^#define 
TYPE_RANGED_INTEGERP(type, x) \\$/
+Tapes  tex-src/gzip.texi       /^@node Tapes, Problems, Environment, Top$/
+Task_Control_Block/t   ada-src/2ataspri.ads    /^   type Task_Control_Block is 
record$/
+Task_Storage_Size/t    ada-src/2ataspri.ads    /^   type Task_Storage_Size is 
new Interfaces.C.size/
+Task_Type/b    ada-src/etags-test-for.ada      /^  task body Task_Type is$/
+Task_Type/b    ada-src/waroquiers.ada  /^  task body Task_Type is$/
+Task_Type/k    ada-src/etags-test-for.ada      /^  task type Task_Type is$/
+Task_Type/k    ada-src/waroquiers.ada  /^  task type Task_Type is$/
+TeX_commands   c-src/etags.c   /^TeX_commands (FILE *inf)$/
+TeX_help       c-src/etags.c   674
+TeX_suffixes   c-src/etags.c   672
+Test_Abort/p   ada-src/2ataspri.adb    /^   procedure Test_Abort is$/
+Test_Abort/p   ada-src/2ataspri.ads    /^   procedure Test_Abort;$/
+Test_And_Set/p ada-src/2ataspri.adb    /^   procedure Test_And_Set (Cell : in 
out TAS_Cell;/
+Test_And_Set/p ada-src/2ataspri.ads    /^   procedure Test_And_Set (Cell : in 
out TAS_Cell;/
+Texinfo_help   c-src/etags.c   688
+Texinfo_nodes  c-src/etags.c   /^Texinfo_nodes (FILE *inf)$/
+Texinfo_suffixes       c-src/etags.c   686
+Time_to_position       c-src/emacs/src/keyboard.c      /^Time_to_position 
(Time encoded_pos)$/
+To_Lower       pas-src/common.pas      /^function To_Lower;(*(ch:char) : 
char;*)$/
+To_Start_Addr/f        ada-src/2ataspri.adb    /^      function To_Start_Addr 
is new$/
+To_TCB_Ptr/f   ada-src/2ataspri.adb    /^   function To_TCB_Ptr is new$/
+To_Upper       pas-src/common.pas      /^function To_Upper;(*(ch:char) : 
char;*)$/
+To_void_ptr/f  ada-src/2ataspri.adb    /^   function To_void_ptr is new$/
+Top    tex-src/gzip.texi       /^@node Top, , , (dir)$/
+Truc.Bidule/b  ada-src/etags-test-for.ada      /^package body Truc.Bidule is$/
+Truc.Bidule/b  ada-src/waroquiers.ada  /^package body Truc.Bidule is$/
+Truc.Bidule/s  ada-src/etags-test-for.ada      /^package Truc.Bidule is$/
+Truc.Bidule/s  ada-src/waroquiers.ada  /^package Truc.Bidule is$/
+Truc/s ada-src/etags-test-for.ada      /^package Truc is$/
+Truc/s ada-src/waroquiers.ada  /^package Truc is$/
+Type_Specific_Data/t   ada-src/etags-test-for.ada      /^   type 
Type_Specific_Data is record$/
+UCHAR  c-src/emacs/src/lisp.h  2424
+UNARY  y-src/cccp.c    18
+UNDEFINED      c-src/h.h       118
+UNEVALLED      c-src/emacs/src/lisp.h  2834
+UNGCPRO        c-src/emacs/src/lisp.h  3202
+UNGCPRO        c-src/emacs/src/lisp.h  3257
+UNGCPRO        c-src/emacs/src/lisp.h  3353
+UNLOCK c-src/emacs/src/gmalloc.c       /^#define UNLOCK()                      
        \\$/
+UNLOCK c-src/emacs/src/gmalloc.c       /^#define UNLOCK()$/
+UNLOCK_ALIGNED_BLOCKS  c-src/emacs/src/gmalloc.c       /^#define 
UNLOCK_ALIGNED_BLOCKS()                               \\$/
+UNLOCK_ALIGNED_BLOCKS  c-src/emacs/src/gmalloc.c       /^#define 
UNLOCK_ALIGNED_BLOCKS()$/
+UNSIGNED_CMP   c-src/emacs/src/lisp.h  /^#define UNSIGNED_CMP(a, op, b)        
                                        \\$/
+USE_LSB_TAG    c-src/emacs/src/lisp.h  /^DEFINE_GDB_SYMBOL_BEGIN (bool, 
USE_LSB_TAG)$/
+USE_LSB_TAG    c-src/emacs/src/lisp.h  271
+USE_PTHREAD    c-src/emacs/src/gmalloc.c       25
+USE_SAFE_ALLOCA        c-src/emacs/src/lisp.h  4560
+USE_STACK_CONS c-src/emacs/src/lisp.h  4689
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h  4652
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h  4658
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h  4659
+USE_STACK_STRING       c-src/emacs/src/lisp.h  4691
+U_CHAR y-src/cccp.y    38
+Unlock/p       ada-src/2ataspri.adb    /^   procedure Unlock (L : in out Lock) 
is$/
+Unlock/p       ada-src/2ataspri.ads    /^   procedure Unlock (L : in out 
Lock);$/
+User   pyt-src/server.py       /^class User:$/
+UserEdit       pyt-src/server.py       /^class UserEdit(Frame):$/
+VALBITS        c-src/emacs/src/lisp.h  246
+VALMASK        c-src/emacs/src/lisp.h  /^DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, 
VALMASK)$/
+VALMASK        c-src/emacs/src/lisp.h  829
+VAL_MAX        c-src/emacs/src/lisp.h  263
+VECSIZE        c-src/emacs/src/lisp.h  /^#define VECSIZE(type)                 
                        \\$/
+VECTORLIKEP    c-src/emacs/src/lisp.h  /^# define VECTORLIKEP(x) 
lisp_h_VECTORLIKEP (x)$/
+VECTORP        c-src/emacs/src/lisp.h  /^VECTORP (Lisp_Object x)$/
+VERSION        c-src/etags.c   789
+VERSION        erl-src/gs_dialog.erl   /^-define(VERSION, '2001.1101').$/
+VERSION        objc-src/PackInsp.m     34
+VHDLFLAGS      make-src/Makefile       /^VHDLFLAGS=--language=none 
--regex='\/[ \\t]*\\(ARCHIT/
+Vabbrev_start_location c-src/abbrev.c  63
+Vabbrev_start_location_buffer  c-src/abbrev.c  66
+Vabbrev_table_name_list        c-src/abbrev.c  43
+ValToNmStr     pas-src/common.pas      /^function ValToNmStr; (*($/
+Vfundamental_mode_abbrev_table c-src/abbrev.c  52
+Vglobal_abbrev_table   c-src/abbrev.c  48
+Vlast_abbrev   c-src/abbrev.c  70
+Vlast_abbrev_text      c-src/abbrev.c  75
+Vlispy_mouse_stem      c-src/emacs/src/keyboard.c      5172
+WAIT_READING_MAX       c-src/emacs/src/lisp.h  4281
+WAIT_READING_MAX       c-src/emacs/src/lisp.h  4283
+WARNINGS       make-src/Makefile       /^WARNINGS=-pedantic -Wall 
-Wpointer-arith -Winline /
+WCHAR_TYPE_SIZE        y-src/cccp.y    99
+WHITE  cp-src/screen.hpp       27
+WINDOWP        c-src/emacs/src/lisp.h  /^WINDOWP (Lisp_Object a)$/
+WINDOWSNT      c-src/etags.c   101
+WINDOWSNT      c-src/etags.c   102
+WINDOW_CONFIGURATIONP  c-src/emacs/src/lisp.h  /^WINDOW_CONFIGURATIONP 
(Lisp_Object a)$/
+WORKING        objc-src/PackInsp.m     368
+WorkingDays    cp-src/functions.cpp    /^int WorkingDays(Date a, Date b){$/
+Write_Lock/p   ada-src/2ataspri.adb    /^   procedure Write_Lock (L : in out 
Lock; Ceiling_/
+Write_Lock/p   ada-src/2ataspri.ads    /^   procedure Write_Lock (L : in out 
Lock; Ceiling_/
+X      c-src/h.h       100
+XBOOL_VECTOR   c-src/emacs/src/lisp.h  /^XBOOL_VECTOR (Lisp_Object a)$/
+XBUFFER        c-src/emacs/src/lisp.h  /^XBUFFER (Lisp_Object a)$/
+XBUFFER_OBJFWD c-src/emacs/src/lisp.h  /^XBUFFER_OBJFWD (union Lisp_Fwd *a)$/
+XCAR   c-src/emacs/src/lisp.h  /^# define XCAR(c) lisp_h_XCAR (c)$/
+XCDR   c-src/emacs/src/lisp.h  /^# define XCDR(c) lisp_h_XCDR (c)$/
+XCHAR_TABLE    c-src/emacs/src/lisp.h  /^XCHAR_TABLE (Lisp_Object a)$/
+XCHG_0 c-src/sysdep.h  47
+XCHG_1 c-src/sysdep.h  48
+XCHG_2 c-src/sysdep.h  49
+XCHG_3 c-src/sysdep.h  50
+XCHG_4 c-src/sysdep.h  51
+XCHG_5 c-src/sysdep.h  52
+XCONS  c-src/emacs/src/lisp.h  /^# define XCONS(a) lisp_h_XCONS (a)$/
+XDEFUN c.c     /^XDEFUN ("x-get-selection-internal", Fx_get_selecti/
+XFASTINT       c-src/emacs/src/lisp.h  /^#  define XFASTINT(a) lisp_h_XFASTINT 
(a)$/
+XFASTINT       c-src/emacs/src/lisp.h  /^XFASTINT (Lisp_Object a)$/
+XFINALIZER     c-src/emacs/src/lisp.h  /^XFINALIZER (Lisp_Object a)$/
+XFLOAT c-src/emacs/src/lisp.h  /^XFLOAT (Lisp_Object a)$/
+XFLOATINT      c-src/emacs/src/lisp.h  /^XFLOATINT (Lisp_Object n)$/
+XFLOAT_DATA    c-src/emacs/src/lisp.h  /^XFLOAT_DATA (Lisp_Object f)$/
+XFWDTYPE       c-src/emacs/src/lisp.h  /^XFWDTYPE (union Lisp_Fwd *a)$/
+XHASH  c-src/emacs/src/lisp.h  /^# define XHASH(a) lisp_h_XHASH (a)$/
+XHASH_TABLE    c-src/emacs/src/lisp.h  /^XHASH_TABLE (Lisp_Object a)$/
+XIL    c-src/emacs/src/lisp.h  /^# define XIL(i) lisp_h_XIL (i)$/
+XINT   c-src/emacs/src/lisp.h  /^#  define XINT(a) lisp_h_XINT (a)$/
+XINT   c-src/emacs/src/lisp.h  /^XINT (Lisp_Object a)$/
+XINTPTR        c-src/emacs/src/lisp.h  /^XINTPTR (Lisp_Object a)$/
+XLI    c-src/emacs/src/lisp.h  /^# define XLI(o) lisp_h_XLI (o)$/
+XLI_BUILTIN_LISPSYM    c-src/emacs/src/lisp.h  /^#define 
XLI_BUILTIN_LISPSYM(iname) TAG_SYMOFFSET (/
+XMARKER        c-src/emacs/src/lisp.h  /^XMARKER (Lisp_Object a)$/
+XMISC  c-src/emacs/src/lisp.h  /^XMISC (Lisp_Object a)$/
+XMISCANY       c-src/emacs/src/lisp.h  /^XMISCANY (Lisp_Object a)$/
+XMISCTYPE      c-src/emacs/src/lisp.h  /^XMISCTYPE (Lisp_Object a)$/
+XOVERLAY       c-src/emacs/src/lisp.h  /^XOVERLAY (Lisp_Object a)$/
+XPNTR  c-src/emacs/src/lisp.h  /^# define XPNTR(a) lisp_h_XPNTR (a)$/
+XPROCESS       c-src/emacs/src/lisp.h  /^XPROCESS (Lisp_Object a)$/
+XSAVE_FUNCPOINTER      c-src/emacs/src/lisp.h  /^XSAVE_FUNCPOINTER 
(Lisp_Object obj, int n)$/
+XSAVE_INTEGER  c-src/emacs/src/lisp.h  /^XSAVE_INTEGER (Lisp_Object obj, int 
n)$/
+XSAVE_OBJECT   c-src/emacs/src/lisp.h  /^XSAVE_OBJECT (Lisp_Object obj, int 
n)$/
+XSAVE_POINTER  c-src/emacs/src/lisp.h  /^XSAVE_POINTER (Lisp_Object obj, int 
n)$/
+XSAVE_VALUE    c-src/emacs/src/lisp.h  /^XSAVE_VALUE (Lisp_Object a)$/
+XSETBOOL_VECTOR        c-src/emacs/src/lisp.h  /^#define XSETBOOL_VECTOR(a, b) 
(XSETPSEUDOVECTOR (a/
+XSETBUFFER     c-src/emacs/src/lisp.h  /^#define XSETBUFFER(a, b) 
(XSETPSEUDOVECTOR (a, b, /
+XSETCDR        c-src/emacs/src/lisp.h  /^XSETCDR (Lisp_Object c, Lisp_Object 
n)$/
+XSETCHAR_TABLE c-src/emacs/src/lisp.h  /^#define XSETCHAR_TABLE(a, b) 
(XSETPSEUDOVECTOR (a,/
+XSETCOMPILED   c-src/emacs/src/lisp.h  /^#define XSETCOMPILED(a, b) 
(XSETPSEUDOVECTOR (a, b/
+XSETCONS       c-src/emacs/src/lisp.h  /^#define XSETCONS(a, b) ((a) = 
make_lisp_ptr (b, Li/
+XSETFASTINT    c-src/emacs/src/lisp.h  /^#define XSETFASTINT(a, b) ((a) = 
make_natnum (b))$/
+XSETFLOAT      c-src/emacs/src/lisp.h  /^#define XSETFLOAT(a, b) ((a) = 
make_lisp_ptr (b, L/
+XSETINT        c-src/emacs/src/lisp.h  /^#define XSETINT(a, b) ((a) = 
make_number (b))$/
+XSETMISC       c-src/emacs/src/lisp.h  /^#define XSETMISC(a, b) ((a) = 
make_lisp_ptr (b, Li/
+XSETPROCESS    c-src/emacs/src/lisp.h  /^#define XSETPROCESS(a, b) 
(XSETPSEUDOVECTOR (a, b,/
+XSETPSEUDOVECTOR       c-src/emacs/src/lisp.h  /^#define XSETPSEUDOVECTOR(a, 
b, code) \\$/
+XSETPVECTYPE   c-src/emacs/src/lisp.h  /^#define XSETPVECTYPE(v, code)         
                                \\$/
+XSETPVECTYPESIZE       c-src/emacs/src/lisp.h  /^#define XSETPVECTYPESIZE(v, 
code, lispsize, restsi/
+XSETSTRING     c-src/emacs/src/lisp.h  /^#define XSETSTRING(a, b) ((a) = 
make_lisp_ptr (b, /
+XSETSUBR       c-src/emacs/src/lisp.h  /^#define XSETSUBR(a, b) 
(XSETPSEUDOVECTOR (a, b, PV/
+XSETSUB_CHAR_TABLE     c-src/emacs/src/lisp.h  /^#define XSETSUB_CHAR_TABLE(a, 
b) (XSETPSEUDOVECTOR/
+XSETSYMBOL     c-src/emacs/src/lisp.h  /^#define XSETSYMBOL(a, b) ((a) = 
make_lisp_symbol (/
+XSETTERMINAL   c-src/emacs/src/lisp.h  /^#define XSETTERMINAL(a, b) 
(XSETPSEUDOVECTOR (a, b/
+XSETTYPED_PSEUDOVECTOR c-src/emacs/src/lisp.h  /^#define 
XSETTYPED_PSEUDOVECTOR(a, b, size, code)              /
+XSETVECTOR     c-src/emacs/src/lisp.h  /^#define XSETVECTOR(a, b) ((a) = 
make_lisp_ptr (b, /
+XSETWINDOW     c-src/emacs/src/lisp.h  /^#define XSETWINDOW(a, b) 
(XSETPSEUDOVECTOR (a, b, /
+XSETWINDOW_CONFIGURATION       c-src/emacs/src/lisp.h  /^#define 
XSETWINDOW_CONFIGURATION(a, b) \\$/
+XSET_HASH_TABLE        c-src/emacs/src/lisp.h  /^#define XSET_HASH_TABLE(VAR, 
PTR) \\$/
+XSTRING        c-src/emacs/src/lisp.h  /^XSTRING (Lisp_Object a)$/
+XSUBR  c-src/emacs/src/lisp.h  /^XSUBR (Lisp_Object a)$/
+XSUB_CHAR_TABLE        c-src/emacs/src/lisp.h  /^XSUB_CHAR_TABLE (Lisp_Object 
a)$/
+XSYMBOL        c-src/emacs/src/lisp.h  /^#  define XSYMBOL(a) lisp_h_XSYMBOL 
(a)$/
+XSYMBOL        c-src/emacs/src/lisp.h  /^XSYMBOL (Lisp_Object a)$/
+XTERMINAL      c-src/emacs/src/lisp.h  /^XTERMINAL (Lisp_Object a)$/
+XTYPE  c-src/emacs/src/lisp.h  /^#  define XTYPE(a) lisp_h_XTYPE (a)$/
+XTYPE  c-src/emacs/src/lisp.h  /^XTYPE (Lisp_Object a)$/
+XUNTAG c-src/emacs/src/lisp.h  /^#  define XUNTAG(a, type) lisp_h_XUNTAG (a, 
type)$/
+XUNTAG c-src/emacs/src/lisp.h  /^XUNTAG (Lisp_Object a, int type)$/
+XWINDOW        c-src/emacs/src/lisp.h  /^XWINDOW (Lisp_Object a)$/
+XX     cp-src/x.cc     1
+Xyzzy  ruby-src/test1.ru       13
+Y      c-src/h.h       100
+YACC   c-src/etags.c   2199
+YELLOW cp-src/screen.hpp       26
+YSRC   make-src/Makefile       /^YSRC=parse.y parse.c atest.y cccp.c cccp.y$/
+YYABORT        /usr/share/bison/bison.simple   153
+YYABORT        /usr/share/bison/bison.simple   154
+YYACCEPT       /usr/share/bison/bison.simple   152
+YYACCEPT       /usr/share/bison/bison.simple   153
+YYBACKUP       /usr/share/bison/bison.simple   /^#define YYBACKUP(Token, 
Value)                                        \\$/
+YYBISON        y-src/cccp.c    4
+YYBISON        y-src/parse.c   4
+YYDPRINTF      /usr/share/bison/bison.simple   /^# define YYDPRINTF(Args)      
                \\$/
+YYDPRINTF      /usr/share/bison/bison.simple   /^# define YYDPRINTF(Args)$/
+YYEMPTY        /usr/share/bison/bison.simple   150
+YYEMPTY        /usr/share/bison/bison.simple   151
+YYEOF  /usr/share/bison/bison.simple   151
+YYEOF  /usr/share/bison/bison.simple   152
+YYERRCODE      /usr/share/bison/bison.simple   178
+YYERRCODE      /usr/share/bison/bison.simple   179
+YYERROR        /usr/share/bison/bison.simple   154
+YYERROR        /usr/share/bison/bison.simple   155
+YYFAIL /usr/share/bison/bison.simple   158
+YYFAIL /usr/share/bison/bison.simple   159
+YYFPRINTF      /usr/share/bison/bison.simple   225
+YYFPRINTF      /usr/share/bison/bison.simple   226
+YYINITDEPTH    /usr/share/bison/bison.simple   244
+YYINITDEPTH    /usr/share/bison/bison.simple   245
+YYLEX  /usr/share/bison/bison.simple   200
+YYLEX  /usr/share/bison/bison.simple   201
+YYLEX  /usr/share/bison/bison.simple   202
+YYLEX  /usr/share/bison/bison.simple   203
+YYLEX  /usr/share/bison/bison.simple   206
+YYLEX  /usr/share/bison/bison.simple   207
+YYLEX  /usr/share/bison/bison.simple   208
+YYLEX  /usr/share/bison/bison.simple   209
+YYLEX  /usr/share/bison/bison.simple   212
+YYLEX  /usr/share/bison/bison.simple   213
+YYLLOC_DEFAULT /usr/share/bison/bison.simple   /^# define 
YYLLOC_DEFAULT(Current, Rhs, N)              \\$/
+YYMAXDEPTH     /usr/share/bison/bison.simple   255
+YYMAXDEPTH     /usr/share/bison/bison.simple   256
+YYMAXDEPTH     /usr/share/bison/bison.simple   259
+YYMAXDEPTH     /usr/share/bison/bison.simple   260
+YYPARSE_PARAM_ARG      /usr/share/bison/bison.simple   351
+YYPARSE_PARAM_ARG      /usr/share/bison/bison.simple   354
+YYPARSE_PARAM_ARG      /usr/share/bison/bison.simple   358
+YYPARSE_PARAM_DECL     /usr/share/bison/bison.simple   352
+YYPARSE_PARAM_DECL     /usr/share/bison/bison.simple   355
+YYPARSE_PARAM_DECL     /usr/share/bison/bison.simple   359
+YYPOPSTACK     /usr/share/bison/bison.simple   445
+YYPOPSTACK     /usr/share/bison/bison.simple   447
+YYRECOVERING   /usr/share/bison/bison.simple   /^#define YYRECOVERING()  
(!!yyerrstatus)$/
+YYSIZE_T       /usr/share/bison/bison.simple   128
+YYSIZE_T       /usr/share/bison/bison.simple   129
+YYSIZE_T       /usr/share/bison/bison.simple   131
+YYSIZE_T       /usr/share/bison/bison.simple   132
+YYSIZE_T       /usr/share/bison/bison.simple   136
+YYSIZE_T       /usr/share/bison/bison.simple   137
+YYSIZE_T       /usr/share/bison/bison.simple   140
+YYSIZE_T       /usr/share/bison/bison.simple   141
+YYSIZE_T       /usr/share/bison/bison.simple   145
+YYSIZE_T       /usr/share/bison/bison.simple   146
+YYSIZE_T       /usr/share/bison/bison.simple   51
+YYSIZE_T       /usr/share/bison/bison.simple   52
+YYSIZE_T       /usr/share/bison/bison.simple   56
+YYSIZE_T       /usr/share/bison/bison.simple   57
+YYSIZE_T       /usr/share/bison/bison.simple   71
+YYSIZE_T       /usr/share/bison/bison.simple   72
+YYSIZE_T       /usr/share/bison/bison.simple   75
+YYSIZE_T       /usr/share/bison/bison.simple   76
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   50
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   51
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   55
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   56
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   59
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   60
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   78
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   79
+YYSTACK_BYTES  /usr/share/bison/bison.simple   /^#  define YYSTACK_BYTES(N) 
\\$/
+YYSTACK_FREE   /usr/share/bison/bison.simple   /^#  define YYSTACK_FREE(Ptr) 
do { \/* empty *\/; } wh/
+YYSTACK_FREE   /usr/share/bison/bison.simple   79
+YYSTACK_FREE   /usr/share/bison/bison.simple   80
+YYSTACK_GAP_MAX        /usr/share/bison/bison.simple   93
+YYSTACK_GAP_MAX        /usr/share/bison/bison.simple   94
+YYSTACK_RELOCATE       /usr/share/bison/bison.simple   /^# define 
YYSTACK_RELOCATE(Type, Stack)                                        \\$/
+YYSTACK_RELOCATE       /usr/share/bison/bison.simple   548
+YYSTD  /usr/share/bison/bison.simple   /^# define YYSTD(x) std::x$/
+YYSTD  /usr/share/bison/bison.simple   /^# define YYSTD(x) x$/
+YYSTYPE        y-src/parse.y   72
+YYSTYPE        y-src/parse.y   73
+YYTERROR       /usr/share/bison/bison.simple   177
+YYTERROR       /usr/share/bison/bison.simple   178
+YY_DECL_NON_LSP_VARIABLES      /usr/share/bison/bison.simple   374
+YY_DECL_VARIABLES      /usr/share/bison/bison.simple   385
+YY_DECL_VARIABLES      /usr/share/bison/bison.simple   391
+Yacc_entries   c-src/etags.c   /^Yacc_entries (FILE *inf)$/
+Yacc_help      c-src/etags.c   693
+Yacc_suffixes  c-src/etags.c   691
+Z      c-src/h.h       100
+[]     ruby-src/test.rb        /^        def [](y)$/
+[]=    ruby-src/test.rb        /^        def []=(y, val)$/
+\      tex-src/texinfo.tex     /^\\def\\ {{\\fontdimen2\\font=\\tclosesave{} 
}}%$/
+\      tex-src/texinfo.tex     /^\\gdef\\sepspaces{\\def {\\ }}}$/
+\'     tex-src/texinfo.tex     /^\\def\\'{{'}}$/
+\*     tex-src/texinfo.tex     
/^\\def\\*{\\hfil\\break\\hbox{}\\ignorespaces}$/
+\.     tex-src/texinfo.tex     /^\\def\\.{.\\spacefactor=3000 }$/
+\:     tex-src/texinfo.tex     /^\\def\\:{\\spacefactor=1000 }$/
+\@     tex-src/texinfo.tex     /^\\def\\@{@}%$/
+\@     tex-src/texinfo.tex     /^\\def\\@{{\\tt \\char '100}}$/
+\CHAPFopen     tex-src/texinfo.tex     /^\\def\\CHAPFopen{$/
+\CHAPFplain    tex-src/texinfo.tex     /^\\def\\CHAPFplain{$/
+\CHAPPAGodd    tex-src/texinfo.tex     /^\\def\\CHAPPAGodd{$/
+\CHAPPAGoff    tex-src/texinfo.tex     /^\\def\\CHAPPAGoff{$/
+\CHAPPAGon     tex-src/texinfo.tex     /^\\def\\CHAPPAGon{$/
+\ENVcheck      tex-src/texinfo.tex     /^\\def\\ENVcheck{%$/
+\Ealphaenumerate       tex-src/texinfo.tex     
/^\\def\\Ealphaenumerate{\\Eenumerate}$/
+\Ecapsenumerate        tex-src/texinfo.tex     
/^\\def\\Ecapsenumerate{\\Eenumerate}$/
+\Ecartouche    tex-src/texinfo.tex     /^\\def\\Ecartouche{%$/
+\Edescription  tex-src/texinfo.tex     /^\\def\\Edescription{\\Etable}% 
Necessary kludge.$/
+\Edisplay      tex-src/texinfo.tex     
/^\\def\\Edisplay{\\endgroup\\afterenvbreak}%$/
+\Eexample      tex-src/texinfo.tex     /^\\def\\Eexample{\\Elisp}$/
+\Eflushleft    tex-src/texinfo.tex     
/^\\def\\Eflushleft{\\endgroup\\afterenvbreak}%$/
+\Eflushright   tex-src/texinfo.tex     
/^\\def\\Eflushright{\\endgroup\\afterenvbreak}%$/
+\Eformat       tex-src/texinfo.tex     
/^\\def\\Eformat{\\endgroup\\afterenvbreak}$/
+\Eftable       tex-src/texinfo.tex     
/^\\def\\Eftable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\Egroup        tex-src/texinfo.tex     /^  \\def\\Egroup{\\egroup\\endgroup}%$/
+\Eifclear      tex-src/texinfo.tex     /^\\def\\Eifclear{}$/
+\Eifset        tex-src/texinfo.tex     /^\\def\\Eifset{}$/
+\Eiftex        tex-src/texinfo.tex     /^\\def\\Eiftex{}$/
+\Elisp tex-src/texinfo.tex     /^\\def\\Elisp{\\endgroup\\afterenvbreak}%$/
+\Equotation    tex-src/texinfo.tex     
/^\\def\\Equotation{\\par\\endgroup\\afterenvbreak}%$/
+\Esmallexample tex-src/texinfo.tex     /^\\def\\Esmallexample{\\Elisp}$/
+\Esmallexample tex-src/texinfo.tex     
/^\\global\\def\\Esmallexample{\\Esmalllisp}$/
+\Esmalllisp    tex-src/texinfo.tex     
/^\\def\\Esmalllisp{\\endgroup\\afterenvbreak}%$/
+\Etable        tex-src/texinfo.tex     
/^\\def\\Etable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\Etitlepage    tex-src/texinfo.tex     /^\\def\\Etitlepage{%$/
+\Evtable       tex-src/texinfo.tex     
/^\\def\\Evtable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\HEADINGSafter tex-src/texinfo.tex     
/^\\def\\HEADINGSafter{\\let\\HEADINGShook=\\HEADINGSdoub/
+\HEADINGSdouble        tex-src/texinfo.tex     /^\\def\\HEADINGSdouble{$/
+\HEADINGSdoublex       tex-src/texinfo.tex     /^\\def\\HEADINGSdoublex{%$/
+\HEADINGSoff   tex-src/texinfo.tex     /^\\def\\HEADINGSoff{$/
+\HEADINGSon    tex-src/texinfo.tex     /^\\def\\HEADINGSon{\\HEADINGSdouble}$/
+\HEADINGSon    tex-src/texinfo.tex     
/^\\global\\def\\HEADINGSon{\\HEADINGSdouble}}$/
+\HEADINGSon    tex-src/texinfo.tex     
/^\\global\\def\\HEADINGSon{\\HEADINGSsingle}}$/
+\HEADINGSsingle        tex-src/texinfo.tex     /^\\def\\HEADINGSsingle{$/
+\HEADINGSsingleafter   tex-src/texinfo.tex     
/^\\def\\HEADINGSsingleafter{\\let\\HEADINGShook=\\HEADIN/
+\HEADINGSsinglex       tex-src/texinfo.tex     /^\\def\\HEADINGSsinglex{%$/
+\TeX   tex-src/texinfo.tex     /^\\def\\TeX{\\realbackslash TeX}$/
+\TeX   tex-src/texinfo.tex     /^\\def\\TeX{\\realbackslash TeX}%$/
+\Yappendixletterandtype        tex-src/texinfo.tex     
/^\\def\\Yappendixletterandtype{%$/
+\Ynothing      tex-src/texinfo.tex     /^\\def\\Ynothing{}$/
+\Ypagenumber   tex-src/texinfo.tex     /^\\def\\Ypagenumber{\\folio}$/
+\Ysectionnumberandtype tex-src/texinfo.tex     
/^\\def\\Ysectionnumberandtype{%$/
+\Ytitle        tex-src/texinfo.tex     /^\\def\\Ytitle{\\thischapter}$/
+\_     tex-src/texinfo.tex     /^\\def\\_{\\lvvmode \\kern.06em \\vbox{\\hrule 
width.3em /
+\_     tex-src/texinfo.tex     /^\\def\\_{{\\realbackslash _}}%$/
+\`     tex-src/texinfo.tex     /^\\def\\`{{`}}$/
+\aboveenvbreak tex-src/texinfo.tex     
/^\\def\\aboveenvbreak{{\\advance\\aboveenvskipamount by/
+\activedoublequote     tex-src/texinfo.tex     
/^\\def\\activedoublequote{{\\tt \\char '042}}$/
+\activeparens  tex-src/texinfo.tex     /^\\def\\activeparens{%$/
+\afourpaper    tex-src/texinfo.tex     /^\\def\\afourpaper{$/
+\afterenvbreak tex-src/texinfo.tex     /^\\def\\afterenvbreak{\\endgraf 
\\ifdim\\lastskip<\\above/
+\alphaenumerate        tex-src/texinfo.tex     
/^\\def\\alphaenumerate{\\enumerate{a}}$/
+\appendix      tex-src/texinfo.tex     
/^\\outer\\def\\appendix{\\parsearg\\appendixzzz}$/
+\appendixletter        tex-src/texinfo.tex     
/^\\def\\appendixletter{\\char\\the\\appendixno}$/
+\appendixnoderef       tex-src/texinfo.tex     
/^\\def\\appendixnoderef{\\ifx\\lastnode\\relax\\else$/
+\appendixsec   tex-src/texinfo.tex     
/^\\outer\\def\\appendixsec{\\parsearg\\appendixsectionzz/
+\appendixsection       tex-src/texinfo.tex     
/^\\outer\\def\\appendixsection{\\parsearg\\appendixsecti/
+\appendixsectionzzz    tex-src/texinfo.tex     /^\\def\\appendixsectionzzz 
#1{\\seccheck{appendixsecti/
+\appendixsetref        tex-src/texinfo.tex     /^\\def\\appendixsetref#1{%$/
+\appendixsubsec        tex-src/texinfo.tex     
/^\\outer\\def\\appendixsubsec{\\parsearg\\appendixsubsec/
+\appendixsubseczzz     tex-src/texinfo.tex     /^\\def\\appendixsubseczzz 
#1{\\seccheck{appendixsubsec/
+\appendixsubsubsec     tex-src/texinfo.tex     
/^\\outer\\def\\appendixsubsubsec{\\parsearg\\appendixsub/
+\appendixsubsubseczzz  tex-src/texinfo.tex     /^\\def\\appendixsubsubseczzz 
#1{\\seccheck{appendixsub/
+\appendixzzz   tex-src/texinfo.tex     /^\\def\\appendixzzz 
#1{\\seccheck{appendix}%$/
+\asis  tex-src/texinfo.tex     /^\\def\\asis#1{#1}$/
+\author        tex-src/texinfo.tex     /^   
\\def\\author{\\parsearg\\authorzzz}%$/
+\authorfont    tex-src/texinfo.tex     /^   \\def\\authorfont{\\authorrm 
\\normalbaselineskip =/
+\authorzzz     tex-src/texinfo.tex     /^   
\\def\\authorzzz##1{\\ifseenauthor\\else\\vskip 0pt /
+\b     tex-src/texinfo.tex     /^\\def\\b##1{\\realbackslash b {##1}}$/
+\b     tex-src/texinfo.tex     /^\\def\\b##1{\\realbackslash b {##1}}%$/
+\b     tex-src/texinfo.tex     /^\\def\\b#1{{\\bf #1}}$/
+\balancecolumns        tex-src/texinfo.tex     /^\\def\\balancecolumns{%$/
+\begin tex-src/texinfo.tex     /^\\outer\\def\\begin{\\parsearg\\beginxxx}$/
+\begindoublecolumns    tex-src/texinfo.tex     
/^\\def\\begindoublecolumns{\\begingroup$/
+\beginxxx      tex-src/texinfo.tex     /^\\def\\beginxxx #1{%$/
+\bf    tex-src/texinfo.tex     /^\\def\\bf{\\realbackslash bf }$/
+\bf    tex-src/texinfo.tex     /^\\def\\bf{\\realbackslash bf }%$/
+\bullet        tex-src/texinfo.tex     /^\\def\\bullet{$\\ptexbullet$}$/
+\bye   tex-src/texinfo.tex     
/^\\outer\\def\\bye{\\pagealignmacro\\tracingstats=1\\ptex/
+\capsenumerate tex-src/texinfo.tex     /^\\def\\capsenumerate{\\enumerate{A}}$/
+\cartbot       tex-src/texinfo.tex     /^\\def\\cartbot{\\hbox to 
\\cartouter{\\hskip\\lskip$/
+\cartouche     tex-src/texinfo.tex     /^\\long\\def\\cartouche{%$/
+\carttop       tex-src/texinfo.tex     /^\\def\\carttop{\\hbox to 
\\cartouter{\\hskip\\lskip$/
+\cbl   tex-src/texinfo.tex     /^\\def\\cbl{{\\circle\\char'012\\hskip -6pt}}$/
+\cbr   tex-src/texinfo.tex     /^\\def\\cbr{{\\hskip 6pt\\circle\\char'011}}$/
+\center        tex-src/texinfo.tex     /^\\def\\center{\\parsearg\\centerzzz}$/
+\centerzzz     tex-src/texinfo.tex     /^\\def\\centerzzz #1{{\\advance\\hsize 
by -\\leftskip$/
+\chapbreak     tex-src/texinfo.tex     /^\\def\\chapbreak{\\dobreak 
\\chapheadingskip {-4000}}$/
+\chapentry     tex-src/texinfo.tex     
/^\\def\\chapentry#1#2#3{\\dochapentry{#2\\labelspace#1}/
+\chapentryfonts        tex-src/texinfo.tex     
/^\\def\\chapentryfonts{\\secfonts \\rm}$/
+\chapfonts     tex-src/texinfo.tex     /^\\def\\chapfonts{%$/
+\chapheading   tex-src/texinfo.tex     
/^\\def\\chapheading{\\parsearg\\chapheadingzzz}$/
+\chapheadingzzz        tex-src/texinfo.tex     /^\\def\\chapheadingzzz 
#1{\\chapbreak %$/
+\chapoddpage   tex-src/texinfo.tex     /^\\def\\chapoddpage{\\chappager 
\\ifodd\\pageno \\else \\h/
+\chappager     tex-src/texinfo.tex     
/^\\def\\chappager{\\par\\vfill\\supereject}$/
+\chapter       tex-src/texinfo.tex     
/^\\outer\\def\\chapter{\\parsearg\\chapterzzz}$/
+\chapternofonts        tex-src/texinfo.tex     /^\\def\\chapternofonts{%$/
+\chapterzzz    tex-src/texinfo.tex     /^\\def\\chapterzzz 
#1{\\seccheck{chapter}%$/
+\char  tex-src/texinfo.tex     /^\\def\\char{\\realbackslash char}$/
+\char  tex-src/texinfo.tex     /^\\def\\char{\\realbackslash char}%$/
+\chfopen       tex-src/texinfo.tex     /^\\def\\chfopen #1#2{\\chapoddpage 
{\\chapfonts$/
+\chfplain      tex-src/texinfo.tex     /^\\def\\chfplain #1#2{%$/
+\cindex        tex-src/texinfo.tex     /^\\def\\cindex {\\cpindex}$/
+\cindexsub     tex-src/texinfo.tex     /^\\def\\cindexsub 
{\\begingroup\\obeylines\\cindexsub}$/
+\cite  tex-src/texinfo.tex     /^\\def\\cite##1{\\realbackslash cite {##1}}$/
+\cite  tex-src/texinfo.tex     /^\\def\\cite##1{\\realbackslash cite {##1}}%$/
+\clear tex-src/texinfo.tex     /^\\def\\clear{\\parsearg\\clearxxx}$/
+\clearxxx      tex-src/texinfo.tex     /^\\def\\clearxxx #1{$/
+\code  tex-src/texinfo.tex     /^\\def\\code##1{\\realbackslash code {##1}}$/
+\code  tex-src/texinfo.tex     /^\\def\\code##1{\\realbackslash code {##1}}%$/
+\comment       tex-src/texinfo.tex     /^\\def\\comment{\\catcode 64=\\other 
\\catcode 123=\\othe/
+\commentxxx    tex-src/texinfo.tex     /^\\def\\commentxxx #1{\\catcode 64=0 
\\catcode 123=1 \\c/
+\contents      tex-src/texinfo.tex     /^\\outer\\def\\contents{%$/
+\copyright     tex-src/texinfo.tex     /^\\def\\copyright{\\realbackslash 
copyright }%$/
+\copyright     tex-src/texinfo.tex     /^\\def\\copyright{\\realbackslash 
copyright}$/
+\cropmarks     tex-src/texinfo.tex     
/^\\def\\cropmarks{\\let\\onepageout=\\croppageout }$/
+\croppageout   tex-src/texinfo.tex     /^\\def\\croppageout#1{\\hoffset=0pt % 
make sure this d/
+\ctl   tex-src/texinfo.tex     /^\\def\\ctl{{\\circle\\char'013\\hskip -6pt}}% 
6pt from /
+\ctr   tex-src/texinfo.tex     /^\\def\\ctr{{\\hskip 6pt\\circle\\char'010}}$/
+\ctrl  tex-src/texinfo.tex     /^\\def\\ctrl #1{{\\tt \\rawbackslash 
\\hat}#1}$/
+\defcodeindex  tex-src/texinfo.tex     
/^\\def\\defcodeindex{\\parsearg\\newcodeindex}$/
+\defcv tex-src/texinfo.tex     /^\\def\\defcv #1 {\\def\\defcvtype{#1}%$/
+\defcvarheader tex-src/texinfo.tex     /^\\def\\defcvarheader #1#2#3{%$/
+\defcvx        tex-src/texinfo.tex     /^\\def\\defcvx #1 
{\\errmessage{@defcvx in invalid con/
+\deffn tex-src/texinfo.tex     
/^\\def\\deffn{\\defmethparsebody\\Edeffn\\deffnx\\deffnhe/
+\deffnheader   tex-src/texinfo.tex     /^\\def\\deffnheader #1#2#3{\\doind 
{fn}{\\code{#2}}%$/
+\deffnx        tex-src/texinfo.tex     /^\\def\\deffnx #1 
{\\errmessage{@deffnx in invalid con/
+\defindex      tex-src/texinfo.tex     
/^\\def\\defindex{\\parsearg\\newindex}$/
+\defivar       tex-src/texinfo.tex     
/^\\def\\defivar{\\defvrparsebody\\Edefivar\\defivarx\\def/
+\defivarheader tex-src/texinfo.tex     /^\\def\\defivarheader #1#2#3{%$/
+\defivarx      tex-src/texinfo.tex     /^\\def\\defivarx #1 
{\\errmessage{@defivarx in invalid/
+\defmac        tex-src/texinfo.tex     
/^\\def\\defmac{\\defparsebody\\Edefmac\\defmacx\\defmache/
+\defmacheader  tex-src/texinfo.tex     /^\\def\\defmacheader #1#2{\\doind 
{fn}{\\code{#1}}% Mak/
+\defmacx       tex-src/texinfo.tex     /^\\def\\defmacx #1 
{\\errmessage{@defmacx in invalid c/
+\defmethod     tex-src/texinfo.tex     
/^\\def\\defmethod{\\defmethparsebody\\Edefmethod\\defmet/
+\defmethodheader       tex-src/texinfo.tex     /^\\def\\defmethodheader 
#1#2#3{%$/
+\defmethodx    tex-src/texinfo.tex     /^\\def\\defmethodx #1 
{\\errmessage{@defmethodx in inv/
+\defmethparsebody      tex-src/texinfo.tex     /^\\def\\defmethparsebody 
#1#2#3#4 {\\begingroup\\inENV /
+\defname       tex-src/texinfo.tex     /^\\def\\defname #1#2{%$/
+\defop tex-src/texinfo.tex     /^\\def\\defop #1 {\\def\\defoptype{#1}%$/
+\defopheader   tex-src/texinfo.tex     /^\\def\\defopheader #1#2#3{%$/
+\defopparsebody        tex-src/texinfo.tex     /^\\def\\defopparsebody 
#1#2#3#4#5 {\\begingroup\\inENV /
+\defopt        tex-src/texinfo.tex     
/^\\def\\defopt{\\defvarparsebody\\Edefopt\\defoptx\\defop/
+\defoptheader  tex-src/texinfo.tex     /^\\def\\defoptheader #1#2{\\doind 
{vr}{\\code{#1}}% Mak/
+\defoptx       tex-src/texinfo.tex     /^\\def\\defoptx #1 
{\\errmessage{@defoptx in invalid c/
+\defopvarparsebody     tex-src/texinfo.tex     /^\\def\\defopvarparsebody 
#1#2#3#4#5 {\\begingroup\\inE/
+\defopx        tex-src/texinfo.tex     /^\\def\\defopx #1 
{\\errmessage{@defopx in invalid con/
+\defparsebody  tex-src/texinfo.tex     /^\\def\\defparsebody 
#1#2#3{\\begingroup\\inENV% Enviro/
+\defspec       tex-src/texinfo.tex     
/^\\def\\defspec{\\defparsebody\\Edefspec\\defspecx\\defsp/
+\defspecheader tex-src/texinfo.tex     /^\\def\\defspecheader #1#2{\\doind 
{fn}{\\code{#1}}% Ma/
+\defspecx      tex-src/texinfo.tex     /^\\def\\defspecx #1 
{\\errmessage{@defspecx in invalid/
+\deftp tex-src/texinfo.tex     
/^\\def\\deftp{\\defvrparsebody\\Edeftp\\deftpx\\deftphead/
+\deftpargs     tex-src/texinfo.tex     /^\\def\\deftpargs #1{\\bf 
\\defvarargs{#1}}$/
+\deftpheader   tex-src/texinfo.tex     /^\\def\\deftpheader #1#2#3{\\doind 
{tp}{\\code{#2}}%$/
+\deftpx        tex-src/texinfo.tex     /^\\def\\deftpx #1 
{\\errmessage{@deftpx in invalid con/
+\deftypefn     tex-src/texinfo.tex     
/^\\def\\deftypefn{\\defmethparsebody\\Edeftypefn\\deftyp/
+\deftypefnheader       tex-src/texinfo.tex     /^\\def\\deftypefnheader 
#1#2#3{\\deftypefnheaderx{#1}{/
+\deftypefnheaderx      tex-src/texinfo.tex     /^\\def\\deftypefnheaderx 
#1#2#3 #4\\relax{%$/
+\deftypefnx    tex-src/texinfo.tex     /^\\def\\deftypefnx #1 
{\\errmessage{@deftypefnx in inv/
+\deftypefun    tex-src/texinfo.tex     
/^\\def\\deftypefun{\\defparsebody\\Edeftypefun\\deftypef/
+\deftypefunargs        tex-src/texinfo.tex     /^\\def\\deftypefunargs #1{%$/
+\deftypefunheader      tex-src/texinfo.tex     /^\\def\\deftypefunheader 
#1#2{\\deftypefunheaderx{#1}#/
+\deftypefunheaderx     tex-src/texinfo.tex     /^\\def\\deftypefunheaderx #1#2 
#3\\relax{%$/
+\deftypeunx    tex-src/texinfo.tex     /^\\def\\deftypeunx #1 
{\\errmessage{@deftypeunx in inv/
+\deftypevar    tex-src/texinfo.tex     
/^\\def\\deftypevar{\\defvarparsebody\\Edeftypevar\\defty/
+\deftypevarheader      tex-src/texinfo.tex     /^\\def\\deftypevarheader 
#1#2{%$/
+\deftypevarx   tex-src/texinfo.tex     /^\\def\\deftypevarx #1 
{\\errmessage{@deftypevarx in i/
+\deftypevr     tex-src/texinfo.tex     
/^\\def\\deftypevr{\\defvrparsebody\\Edeftypevr\\deftypev/
+\deftypevrheader       tex-src/texinfo.tex     /^\\def\\deftypevrheader 
#1#2#3{\\doind {vr}{\\code{#3}}/
+\deftypevrx    tex-src/texinfo.tex     /^\\def\\deftypevrx #1 
{\\errmessage{@deftypevrx in inv/
+\defun tex-src/texinfo.tex     
/^\\def\\defun{\\defparsebody\\Edefun\\defunx\\defunheader/
+\defunargs     tex-src/texinfo.tex     /^\\def\\defunargs #1{\\functionparens 
\\sl$/
+\defunheader   tex-src/texinfo.tex     /^\\def\\defunheader #1#2{\\doind 
{fn}{\\code{#1}}% Make/
+\defunx        tex-src/texinfo.tex     /^\\def\\defunx #1 
{\\errmessage{@defunx in invalid con/
+\defvar        tex-src/texinfo.tex     
/^\\def\\defvar{\\defvarparsebody\\Edefvar\\defvarx\\defva/
+\defvarargs    tex-src/texinfo.tex     /^\\def\\defvarargs #1{\\normalparens 
#1%$/
+\defvarheader  tex-src/texinfo.tex     /^\\def\\defvarheader #1#2{\\doind 
{vr}{\\code{#1}}% Mak/
+\defvarparsebody       tex-src/texinfo.tex     /^\\def\\defvarparsebody 
#1#2#3{\\begingroup\\inENV% Env/
+\defvarx       tex-src/texinfo.tex     /^\\def\\defvarx #1 
{\\errmessage{@defvarx in invalid c/
+\defvr tex-src/texinfo.tex     
/^\\def\\defvr{\\defvrparsebody\\Edefvr\\defvrx\\defvrhead/
+\defvrheader   tex-src/texinfo.tex     /^\\def\\defvrheader #1#2#3{\\doind 
{vr}{\\code{#2}}%$/
+\defvrparsebody        tex-src/texinfo.tex     /^\\def\\defvrparsebody 
#1#2#3#4 {\\begingroup\\inENV %$/
+\defvrx        tex-src/texinfo.tex     /^\\def\\defvrx #1 
{\\errmessage{@defvrx in invalid con/
+\description   tex-src/texinfo.tex     
/^\\def\\description{\\tablez{\\dontindex}{1}{}{}{}{}}$/
+\df    tex-src/texinfo.tex     /^\\def\\df{\\let\\tentt=\\deftt \\let\\tenbf = 
\\defbf \\bf}/
+\dfn   tex-src/texinfo.tex     /^\\def\\dfn##1{\\realbackslash dfn {##1}}$/
+\direntry      tex-src/texinfo.tex     
/^\\def\\direntry{\\begingroup\\direntryxxx}$/
+\direntryxxx   tex-src/texinfo.tex     /^\\long\\def\\direntryxxx #1\\end 
direntry{\\endgroup\\ig/
+\display       tex-src/texinfo.tex     /^\\def\\display{\\begingroup\\inENV 
%This group ends at/
+\dmn   tex-src/texinfo.tex     /^\\def\\dmn#1{\\thinspace #1}$/
+\dobreak       tex-src/texinfo.tex     
/^\\def\\dobreak#1#2{\\par\\ifdim\\lastskip<#1\\removelast/
+\dochapentry   tex-src/texinfo.tex     /^\\def\\dochapentry#1#2{%$/
+\docodeindex   tex-src/texinfo.tex     
/^\\def\\docodeindex#1{\\edef\\indexname{#1}\\parsearg\\si/
+\doind tex-src/texinfo.tex     /^\\def\\doind #1#2{%$/
+\doindex       tex-src/texinfo.tex     
/^\\def\\doindex#1{\\edef\\indexname{#1}\\parsearg\\single/
+\donoderef     tex-src/texinfo.tex     
/^\\def\\donoderef{\\ifx\\lastnode\\relax\\else$/
+\dontindex     tex-src/texinfo.tex     /^\\def\\dontindex #1{}$/
+\dopageno      tex-src/texinfo.tex     /^\\def\\dopageno#1{{\\rm #1}}$/
+\doprintindex  tex-src/texinfo.tex     /^\\def\\doprintindex#1{%$/
+\dosecentry    tex-src/texinfo.tex     /^\\def\\dosecentry#1#2{%$/
+\dosetq        tex-src/texinfo.tex     /^\\def\\dosetq #1#2{{\\let\\folio=0 
\\turnoffactive%$/
+\doshortpageno tex-src/texinfo.tex     /^\\def\\doshortpageno#1{{\\rm #1}}$/
+\dosubind      tex-src/texinfo.tex     /^\\def\\dosubind #1#2#3{%$/
+\dosubsecentry tex-src/texinfo.tex     /^\\def\\dosubsecentry#1#2{%$/
+\dosubsubsecentry      tex-src/texinfo.tex     
/^\\def\\dosubsubsecentry#1#2{%$/
+\dots  tex-src/texinfo.tex     /^\\def\\dots{$\\ldots$}$/
+\dots  tex-src/texinfo.tex     /^\\def\\dots{\\realbackslash dots }%$/
+\dots  tex-src/texinfo.tex     /^\\def\\dots{\\realbackslash dots}$/
+\doublecolumnout       tex-src/texinfo.tex     
/^\\def\\doublecolumnout{\\splittopskip=\\topskip \\split/
+\emph  tex-src/texinfo.tex     /^\\def\\emph##1{\\realbackslash emph {##1}}$/
+\end   tex-src/texinfo.tex     /^\\def\\end{\\parsearg\\endxxx}$/
+\enddoublecolumns      tex-src/texinfo.tex     
/^\\def\\enddoublecolumns{\\output={\\balancecolumns}\\ej/
+\endxxx        tex-src/texinfo.tex     /^\\def\\endxxx #1{%$/
+\entry tex-src/texinfo.tex     /^\\def\\entry #1#2{\\begingroup$/
+\enumerate     tex-src/texinfo.tex     
/^\\def\\enumerate{\\parsearg\\enumeratezzz}$/
+\enumeratey    tex-src/texinfo.tex     /^\\def\\enumeratey #1 
#2\\endenumeratey{%$/
+\enumeratezzz  tex-src/texinfo.tex     /^\\def\\enumeratezzz #1{\\enumeratey 
#1  \\endenumerate/
+\equiv tex-src/texinfo.tex     /^\\def\\equiv{\\leavevmode\\lower.1ex\\hbox to 
1em{\\hfil/
+\equiv tex-src/texinfo.tex     /^\\def\\equiv{\\realbackslash equiv}$/
+\error tex-src/texinfo.tex     
/^\\def\\error{\\leavevmode\\lower.7ex\\copy\\errorbox}$/
+\errorE        tex-src/texinfo.tex     /^\\def\\errorE#1{$/
+\evenfooting   tex-src/texinfo.tex     
/^\\def\\evenfooting{\\parsearg\\evenfootingxxx}$/
+\evenheading   tex-src/texinfo.tex     
/^\\def\\evenheading{\\parsearg\\evenheadingxxx}$/
+\everyfooting  tex-src/texinfo.tex     
/^\\def\\everyfooting{\\parsearg\\everyfootingxxx}$/
+\everyheading  tex-src/texinfo.tex     
/^\\def\\everyheading{\\parsearg\\everyheadingxxx}$/
+\ewbot tex-src/texinfo.tex     /^\\def\\ewbot{\\vrule height0pt 
depth\\cornerthick widt/
+\ewtop tex-src/texinfo.tex     /^\\def\\ewtop{\\vrule height\\cornerthick 
depth0pt widt/
+\exdent        tex-src/texinfo.tex     /^\\def\\exdent{\\parsearg\\exdentyyy}$/
+\exdentyyy     tex-src/texinfo.tex     /^\\def\\exdentyyy 
#1{{\\hfil\\break\\hbox{\\kern -\\exdent/
+\expansion     tex-src/texinfo.tex     
/^\\def\\expansion{\\leavevmode\\raise.1ex\\hbox to 1em{\\/
+\expansion     tex-src/texinfo.tex     /^\\def\\expansion{\\realbackslash 
expansion}$/
+\file  tex-src/texinfo.tex     /^\\def\\file##1{\\realbackslash file {##1}}$/
+\file  tex-src/texinfo.tex     /^\\def\\file##1{\\realbackslash file {##1}}%$/
+\finalout      tex-src/texinfo.tex     /^\\def\\finalout{\\overfullrule=0pt}$/
+\findex        tex-src/texinfo.tex     /^\\def\\findex {\\fnindex}$/
+\finishtitlepage       tex-src/texinfo.tex     /^\\def\\finishtitlepage{%$/
+\flushcr       tex-src/texinfo.tex     /^\\def\\flushcr{\\ifx\\par\\lisppar 
\\def\\next##1{}\\else /
+\flushleft     tex-src/texinfo.tex     /^\\def\\flushleft{%$/
+\flushright    tex-src/texinfo.tex     /^\\def\\flushright{%$/
+\fnitemindex   tex-src/texinfo.tex     /^\\def\\fnitemindex #1{\\doind 
{fn}{\\code{#1}}}%$/
+\format        tex-src/texinfo.tex     /^\\def\\format{\\begingroup\\inENV 
%This group ends at /
+\frenchspacing tex-src/texinfo.tex     /^\\def\\frenchspacing{\\sfcode46=1000 
\\sfcode63=1000 \\/
+\ftable        tex-src/texinfo.tex     
/^\\def\\ftable{\\begingroup\\inENV\\obeylines\\obeyspaces/
+\gloggingall   tex-src/texinfo.tex     /^\\def\\gloggingall{\\begingroup 
\\globaldefs = 1 \\logg/
+\group tex-src/texinfo.tex     /^\\def\\group{\\begingroup$/
+\gtr   tex-src/texinfo.tex     /^\\def\\gtr{\\realbackslash gtr}$/
+\gtr   tex-src/texinfo.tex     /^\\def\\gtr{\\realbackslash gtr}%$/
+\hat   tex-src/texinfo.tex     /^\\def\\hat{\\realbackslash hat}$/
+\hat   tex-src/texinfo.tex     /^\\def\\hat{\\realbackslash hat}%$/
+\heading       tex-src/texinfo.tex     
/^\\def\\heading{\\parsearg\\secheadingi}$/
+\headings      tex-src/texinfo.tex     /^\\def\\headings #1 {\\csname 
HEADINGS#1\\endcsname}$/
+\i     tex-src/texinfo.tex     /^\\def\\i##1{\\realbackslash i {##1}}$/
+\i     tex-src/texinfo.tex     /^\\def\\i##1{\\realbackslash i {##1}}%$/
+\ifclear       tex-src/texinfo.tex     
/^\\def\\ifclear{\\begingroup\\ignoresections\\parsearg\\i/
+\ifclearfail   tex-src/texinfo.tex     
/^\\def\\ifclearfail{\\begingroup\\ignoresections\\ifclea/
+\ifclearfailxxx        tex-src/texinfo.tex     /^\\long\\def\\ifclearfailxxx 
#1\\end ifclear{\\endgroup\\/
+\ifclearxxx    tex-src/texinfo.tex     /^\\def\\ifclearxxx #1{\\endgroup$/
+\ifinfo        tex-src/texinfo.tex     
/^\\def\\ifinfo{\\begingroup\\ignoresections\\ifinfoxxx}$/
+\ifinfoxxx     tex-src/texinfo.tex     /^\\long\\def\\ifinfoxxx #1\\end 
ifinfo{\\endgroup\\ignore/
+\ifset tex-src/texinfo.tex     
/^\\def\\ifset{\\begingroup\\ignoresections\\parsearg\\ifs/
+\ifsetfail     tex-src/texinfo.tex     
/^\\def\\ifsetfail{\\begingroup\\ignoresections\\ifsetfai/
+\ifsetfailxxx  tex-src/texinfo.tex     /^\\long\\def\\ifsetfailxxx #1\\end 
ifset{\\endgroup\\igno/
+\ifsetxxx      tex-src/texinfo.tex     /^\\def\\ifsetxxx #1{\\endgroup$/
+\iftex tex-src/texinfo.tex     /^\\def\\iftex{}$/
+\ifusingtt     tex-src/texinfo.tex     /^\\def\\ifusingtt#1#2{\\ifdim 
\\fontdimen3\\the\\font=0pt/
+\ignore        tex-src/texinfo.tex     
/^\\def\\ignore{\\begingroup\\ignoresections$/
+\ignoresections        tex-src/texinfo.tex     /^\\def\\ignoresections{%$/
+\ignorexxx     tex-src/texinfo.tex     /^\\long\\def\\ignorexxx #1\\end 
ignore{\\endgroup\\ignore/
+\ii    tex-src/texinfo.tex     /^\\def\\ii#1{{\\it #1}}                % 
italic font$/
+\inENV tex-src/texinfo.tex     /^\\newif\\ifENV \\ENVfalse 
\\def\\inENV{\\ifENV\\relax\\els/
+\include       tex-src/texinfo.tex     
/^\\def\\include{\\parsearg\\includezzz}$/
+\includezzz    tex-src/texinfo.tex     /^\\def\\includezzz 
#1{{\\def\\thisfile{#1}\\input #1$/
+\indexbackslash        tex-src/texinfo.tex     /^  
\\def\\indexbackslash{\\rawbackslashxx}$/
+\indexdotfill  tex-src/texinfo.tex     /^\\def\\indexdotfill{\\cleaders$/
+\indexdummies  tex-src/texinfo.tex     /^\\def\\indexdummies{%$/
+\indexdummydots        tex-src/texinfo.tex     /^\\def\\indexdummydots{...}$/
+\indexdummyfont        tex-src/texinfo.tex     /^\\def\\indexdummyfont#1{#1}$/
+\indexdummytex tex-src/texinfo.tex     /^\\def\\indexdummytex{TeX}$/
+\indexfonts    tex-src/texinfo.tex     /^\\def\\indexfonts{%$/
+\indexnofonts  tex-src/texinfo.tex     /^\\def\\indexnofonts{%$/
+\infoappendix  tex-src/texinfo.tex     
/^\\def\\infoappendix{\\parsearg\\appendixzzz}$/
+\infoappendixsec       tex-src/texinfo.tex     
/^\\def\\infoappendixsec{\\parsearg\\appendixseczzz}$/
+\infoappendixsubsec    tex-src/texinfo.tex     
/^\\def\\infoappendixsubsec{\\parsearg\\appendixsubseczz/
+\infoappendixsubsubsec tex-src/texinfo.tex     
/^\\def\\infoappendixsubsubsec{\\parsearg\\appendixsubsu/
+\infochapter   tex-src/texinfo.tex     
/^\\def\\infochapter{\\parsearg\\chapterzzz}$/
+\inforef       tex-src/texinfo.tex     /^\\def\\inforef #1{\\inforefzzz 
#1,,,,**}$/
+\inforefzzz    tex-src/texinfo.tex     /^\\def\\inforefzzz #1,#2,#3,#4**{See 
Info file \\file{/
+\infosection   tex-src/texinfo.tex     
/^\\def\\infosection{\\parsearg\\sectionzzz}$/
+\infosubsection        tex-src/texinfo.tex     
/^\\def\\infosubsection{\\parsearg\\subsectionzzz}$/
+\infosubsubsection     tex-src/texinfo.tex     
/^\\def\\infosubsubsection{\\parsearg\\subsubsectionzzz}/
+\infotop       tex-src/texinfo.tex     
/^\\def\\infotop{\\parsearg\\unnumberedzzz}$/
+\infounnumbered        tex-src/texinfo.tex     
/^\\def\\infounnumbered{\\parsearg\\unnumberedzzz}$/
+\infounnumberedsec     tex-src/texinfo.tex     
/^\\def\\infounnumberedsec{\\parsearg\\unnumberedseczzz}/
+\infounnumberedsubsec  tex-src/texinfo.tex     
/^\\def\\infounnumberedsubsec{\\parsearg\\unnumberedsubs/
+\infounnumberedsubsubsec       tex-src/texinfo.tex     
/^\\def\\infounnumberedsubsubsec{\\parsearg\\unnumbereds/
+\initial       tex-src/texinfo.tex     /^\\def\\initial #1{%$/
+\internalBitem tex-src/texinfo.tex     /^\\def\\internalBitem{\\smallbreak 
\\parsearg\\itemzzz}$/
+\internalBitemx        tex-src/texinfo.tex     /^\\def\\internalBitemx{\\par 
\\parsearg\\itemzzz}$/
+\internalBkitem        tex-src/texinfo.tex     
/^\\def\\internalBkitem{\\smallbreak \\parsearg\\kitemzzz/
+\internalBkitemx       tex-src/texinfo.tex     /^\\def\\internalBkitemx{\\par 
\\parsearg\\kitemzzz}$/
+\internalBxitem        tex-src/texinfo.tex     /^\\def\\internalBxitem 
"#1"{\\def\\xitemsubtopix{#1} \\s/
+\internalBxitemx       tex-src/texinfo.tex     /^\\def\\internalBxitemx 
"#1"{\\def\\xitemsubtopix{#1} \\/
+\internalsetq  tex-src/texinfo.tex     /^\\def\\internalsetq #1#2{'xrdef 
{#1}{\\csname #2\\endc/
+\item  tex-src/texinfo.tex     /^\\def\\item{\\errmessage{@item while not in a 
table}}/
+\itemcontents  tex-src/texinfo.tex     /^\\def\\itemcontents{#1}%$/
+\itemfont      tex-src/texinfo.tex     /^\\def\\itemfont{#2}%$/
+\itemize       tex-src/texinfo.tex     
/^\\def\\itemize{\\parsearg\\itemizezzz}$/
+\itemizeitem   tex-src/texinfo.tex     /^\\def\\itemizeitem{%$/
+\itemizey      tex-src/texinfo.tex     /^\\def\\itemizey #1#2{%$/
+\itemizezzz    tex-src/texinfo.tex     /^\\def\\itemizezzz #1{%$/
+\itemx tex-src/texinfo.tex     /^\\def\\itemx{\\errmessage{@itemx while not in 
a table/
+\itemzzz       tex-src/texinfo.tex     /^\\def\\itemzzz #1{\\begingroup %$/
+\kbd   tex-src/texinfo.tex     /^\\def\\kbd##1{\\realbackslash kbd {##1}}$/
+\kbd   tex-src/texinfo.tex     /^\\def\\kbd##1{\\realbackslash kbd {##1}}%$/
+\kbd   tex-src/texinfo.tex     
/^\\def\\kbd#1{\\def\\look{#1}\\expandafter\\kbdfoo\\look??/
+\kbdfoo        tex-src/texinfo.tex     
/^\\def\\kbdfoo#1#2#3\\par{\\def\\one{#1}\\def\\three{#3}\\d/
+\key   tex-src/texinfo.tex     /^\\def\\key #1{{\\tt 
\\exhyphenpenalty=10000\\uppercase{/
+\key   tex-src/texinfo.tex     /^\\def\\key##1{\\realbackslash key {##1}}$/
+\key   tex-src/texinfo.tex     /^\\def\\key##1{\\realbackslash key {##1}}%$/
+\kindex        tex-src/texinfo.tex     /^\\def\\kindex {\\kyindex}$/
+\kitem tex-src/texinfo.tex     /^\\def\\kitem{\\errmessage{@kitem while not in 
a table/
+\kitemx        tex-src/texinfo.tex     /^\\def\\kitemx{\\errmessage{@kitemx 
while not in a tab/
+\kitemzzz      tex-src/texinfo.tex     /^\\def\\kitemzzz #1{\\dosubind 
{kw}{\\code{#1}}{for {\\b/
+\l     tex-src/texinfo.tex     /^\\def\\l#1{{\\li #1}\\null}           % $/
+\labelspace    tex-src/texinfo.tex     /^\\def\\labelspace{\\hskip1em 
\\relax}$/
+\lbrb  tex-src/texinfo.tex     /^\\def\\lbrb{{\\bf\\char`\\[}} 
\\def\\rbrb{{\\bf\\char`\\]}}$/
+\less  tex-src/texinfo.tex     /^\\def\\less{\\realbackslash less}$/
+\less  tex-src/texinfo.tex     /^\\def\\less{\\realbackslash less}%$/
+\linenumber    tex-src/texinfo.tex     /^  
\\def\\linenumber{\\the\\inputlineno:\\space}$/
+\lisp  tex-src/texinfo.tex     /^\\def\\lisp{\\aboveenvbreak$/
+\loggingall    tex-src/texinfo.tex     /^\\def\\loggingall{\\tracingcommands2 
\\tracingstats2 $/
+\losespace     tex-src/texinfo.tex     /^\\def\\losespace #1{#1}$/
+\lowercaseenumerate    tex-src/texinfo.tex     /^\\def\\lowercaseenumerate{%$/
+\lvvmode       tex-src/texinfo.tex     /^\\def\\lvvmode{\\vbox to 0pt{}}$/
+\majorheading  tex-src/texinfo.tex     
/^\\def\\majorheading{\\parsearg\\majorheadingzzz}$/
+\majorheadingzzz       tex-src/texinfo.tex     /^\\def\\majorheadingzzz #1{%$/
+\math  tex-src/texinfo.tex     /^\\def\\math#1{\\implicitmath 
#1\\implicitmath}$/
+\menu  tex-src/texinfo.tex     /^\\long\\def\\menu #1\\end menu{}$/
+\minus tex-src/texinfo.tex     /^\\def\\minus{$-$}$/
+\mylbrace      tex-src/texinfo.tex     /^\\def\\mylbrace {{\\tt \\char '173}}$/
+\myrbrace      tex-src/texinfo.tex     /^\\def\\myrbrace {{\\tt \\char '175}}$/
+\need  tex-src/texinfo.tex     /^\\def\\need{\\parsearg\\needx}$/
+\needx tex-src/texinfo.tex     /^\\def\\needx#1{%$/
+\newcodeindex  tex-src/texinfo.tex     /^\\def\\newcodeindex #1{$/
+\newindex      tex-src/texinfo.tex     /^\\def\\newindex #1{$/
+\next  tex-src/texinfo.tex     /^\\def\\next##1{}\\next}$/
+\nm    tex-src/testenv.tex     
/^\\newcommand{\\nm}[2]{\\nomenclature{#1}{#2}}$/
+\node  tex-src/texinfo.tex     /^\\def\\node{\\ENVcheck\\parsearg\\nodezzz}$/
+\nodexxx[      tex-src/texinfo.tex     
/^\\def\\nodexxx[#1,#2]{\\gdef\\lastnode{#1}}$/
+\nodezzz       tex-src/texinfo.tex     /^\\def\\nodezzz#1{\\nodexxx [#1,]}$/
+\nofillexdent  tex-src/texinfo.tex     
/^\\def\\nofillexdent{\\parsearg\\nofillexdentyyy}$/
+\nofillexdentyyy       tex-src/texinfo.tex     /^\\def\\nofillexdentyyy 
#1{{\\advance \\leftskip by -\\e/
+\normalbackslash       tex-src/texinfo.tex     
/^\\def\\normalbackslash{{\\tt\\rawbackslashxx}}$/
+\normalcaret   tex-src/texinfo.tex     /^\\def\\normalcaret{^}$/
+\normaldoublequote     tex-src/texinfo.tex     /^\\def\\normaldoublequote{"}$/
+\normalgreater tex-src/texinfo.tex     /^\\def\\normalgreater{>}$/
+\normalless    tex-src/texinfo.tex     /^\\def\\normalless{<}$/
+\normalplus    tex-src/texinfo.tex     /^\\def\\normalplus{+}$/
+\normaltilde   tex-src/texinfo.tex     /^\\def\\normaltilde{~}$/
+\normalunderscore      tex-src/texinfo.tex     /^\\def\\normalunderscore{_}$/
+\normalverticalbar     tex-src/texinfo.tex     /^\\def\\normalverticalbar{|}$/
+\nsbot tex-src/texinfo.tex     /^\\def\\nsbot{\\vbox$/
+\nstop tex-src/texinfo.tex     /^\\def\\nstop{\\vbox$/
+\numberedsec   tex-src/texinfo.tex     
/^\\outer\\def\\numberedsec{\\parsearg\\seczzz}$/
+\numberedsubsec        tex-src/texinfo.tex     
/^\\outer\\def\\numberedsubsec{\\parsearg\\numberedsubsec/
+\numberedsubseczzz     tex-src/texinfo.tex     /^\\def\\numberedsubseczzz 
#1{\\seccheck{subsection}%$/
+\numberedsubsubsec     tex-src/texinfo.tex     
/^\\outer\\def\\numberedsubsubsec{\\parsearg\\numberedsub/
+\numberedsubsubseczzz  tex-src/texinfo.tex     /^\\def\\numberedsubsubseczzz 
#1{\\seccheck{subsubsecti/
+\numericenumerate      tex-src/texinfo.tex     /^\\def\\numericenumerate{%$/
+\oddfooting    tex-src/texinfo.tex     
/^\\def\\oddfooting{\\parsearg\\oddfootingxxx}$/
+\oddheading    tex-src/texinfo.tex     
/^\\def\\oddheading{\\parsearg\\oddheadingxxx}$/
+\onepageout    tex-src/texinfo.tex     
/^\\def\\onepageout#1{\\hoffset=\\normaloffset$/
+\opencontents  tex-src/texinfo.tex     /^\\def\\opencontents{\\openout 
\\contentsfile = \\jobnam/
+\openindices   tex-src/texinfo.tex     /^\\def\\openindices{%$/
+\opnr  tex-src/texinfo.tex     /^\\def\\opnr{{\\sf\\char`\\(}} 
\\def\\clnr{{\\sf\\char`\\)}} /
+\page  tex-src/texinfo.tex     /^   \\def\\page{%$/
+\page  tex-src/texinfo.tex     /^\\def\\page{\\par\\vfill\\supereject}$/
+\pagebody      tex-src/texinfo.tex     /^\\def\\pagebody#1{\\vbox 
to\\pageheight{\\boxmaxdepth=\\/
+\pagesofar     tex-src/texinfo.tex     
/^\\def\\pagesofar{\\unvbox\\partialpage %$/
+\parsearg      tex-src/texinfo.tex     /^\\def\\parsearg 
#1{\\let\\next=#1\\begingroup\\obeylines/
+\parseargline  tex-src/texinfo.tex     /^\\def\\parseargline{\\begingroup 
\\obeylines \\parsearg/
+\parseargx     tex-src/texinfo.tex     /^\\def\\parseargx{%$/
+\pindex        tex-src/texinfo.tex     /^\\def\\pindex {\\pgindex}$/
+\plainsecheading       tex-src/texinfo.tex     /^\\def\\plainsecheading 
#1{\\secheadingi {#1}}$/
+\point tex-src/texinfo.tex     /^\\def\\point{$\\star$}$/
+\primary       tex-src/texinfo.tex     /^\\def\\primary #1{\\line{#1\\hfil}}$/
+\print tex-src/texinfo.tex     /^\\def\\print{\\leavevmode\\lower.1ex\\hbox to 
1em{\\hfil/
+\print tex-src/texinfo.tex     /^\\def\\print{\\realbackslash print}$/
+\printedmanual tex-src/texinfo.tex     /^\\def\\printedmanual{\\ignorespaces 
#5}%$/
+\printedmanual tex-src/texinfo.tex     /^section ``\\printednodename'' in 
\\cite{\\printedmanu/
+\printednodename       tex-src/texinfo.tex     
/^\\def\\printednodename{\\ignorespaces #1}%$/
+\printednodename       tex-src/texinfo.tex     
/^\\def\\printednodename{\\ignorespaces #3}%$/
+\printindex    tex-src/texinfo.tex     
/^\\def\\printindex{\\parsearg\\doprintindex}$/
+\pxref tex-src/texinfo.tex     /^\\def\\pxref#1{see \\xrefX[#1,,,,,,,]}$/
+\quotation     tex-src/texinfo.tex     /^\\def\\quotation{%$/
+\r     tex-src/texinfo.tex     /^\\def\\r##1{\\realbackslash r {##1}}$/
+\r     tex-src/texinfo.tex     /^\\def\\r##1{\\realbackslash r {##1}}%$/
+\r     tex-src/texinfo.tex     /^\\def\\r#1{{\\rm #1}}         % roman font$/
+\rawbackslashxx        tex-src/texinfo.tex     
/^\\def\\rawbackslashxx{\\indexbackslash}% \\indexbacksl/
+\rawbackslashxx        tex-src/texinfo.tex     
/^\\def\\rawbackslashxx{\\indexbackslash}%$/
+\readauxfile   tex-src/texinfo.tex     /^\\def\\readauxfile{%$/
+\ref   tex-src/texinfo.tex     /^\\def\\ref#1{\\xrefX[#1,,,,,,,]}$/
+\refx  tex-src/texinfo.tex     /^\\def\\refx#1#2{%$/
+\resetmathfonts        tex-src/texinfo.tex     /^\\def\\resetmathfonts{%$/
+\result        tex-src/texinfo.tex     
/^\\def\\result{\\leavevmode\\raise.15ex\\hbox to 1em{\\hf/
+\result        tex-src/texinfo.tex     /^\\def\\result{\\realbackslash 
result}$/
+\rm    tex-src/texinfo.tex     /^\\def\\rm{\\realbackslash rm }%$/
+\samp  tex-src/texinfo.tex     /^\\def\\samp #1{`\\tclose{#1}'\\null}$/
+\samp  tex-src/texinfo.tex     /^\\def\\samp##1{\\realbackslash samp {##1}}$/
+\samp  tex-src/texinfo.tex     /^\\def\\samp##1{\\realbackslash samp {##1}}%$/
+\sc    tex-src/texinfo.tex     /^\\def\\sc#1{{\\smallcaps#1}}  % smallcaps 
font$/
+\seccheck      tex-src/texinfo.tex     /^\\def\\seccheck#1{\\if \\pageno<0 %$/
+\secentry      tex-src/texinfo.tex     /^      \\def\\secentry ##1##2##3##4{}$/
+\secentry      tex-src/texinfo.tex     
/^\\def\\secentry#1#2#3#4{\\dosecentry{#2.#3\\labelspace/
+\secentryfonts tex-src/texinfo.tex     /^\\def\\secentryfonts{\\textfonts}$/
+\secfonts      tex-src/texinfo.tex     /^\\def\\secfonts{%$/
+\secheading    tex-src/texinfo.tex     /^\\def\\secheading 
#1#2#3{\\secheadingi {#2.#3\\enspace/
+\secheadingbreak       tex-src/texinfo.tex     
/^\\def\\secheadingbreak{\\dobreak \\secheadingskip {-10/
+\secheadingi   tex-src/texinfo.tex     /^\\def\\secheadingi #1{{\\advance 
\\secheadingskip by \\/
+\secondary     tex-src/texinfo.tex     /^\\def\\secondary #1#2{$/
+\seczzz        tex-src/texinfo.tex     /^\\def\\seczzz 
#1{\\seccheck{section}%$/
+\set   tex-src/texinfo.tex     /^\\def\\set{\\parsearg\\setxxx}$/
+\setchapternewpage     tex-src/texinfo.tex     /^\\def\\setchapternewpage #1 
{\\csname CHAPPAG#1\\endcs/
+\setchapterstyle       tex-src/texinfo.tex     /^\\def\\setchapterstyle #1 
{\\csname CHAPF#1\\endcsname/
+\setdeffont    tex-src/texinfo.tex     /^\\def\\setdeffont #1 {\\csname 
DEF#1\\endcsname}$/
+\setfilename   tex-src/texinfo.tex     /^\\def\\setfilename{%$/
+\setref        tex-src/texinfo.tex     /^\\def\\setref#1{%$/
+\settitle      tex-src/texinfo.tex     
/^\\def\\settitle{\\parsearg\\settitlezzz}$/
+\settitlezzz   tex-src/texinfo.tex     /^\\def\\settitlezzz 
#1{\\gdef\\thistitle{#1}}$/
+\setxxx        tex-src/texinfo.tex     /^\\def\\setxxx #1{$/
+\sf    tex-src/texinfo.tex     /^\\def\\sf{\\fam=\\sffam \\tensf}$/
+\sf    tex-src/texinfo.tex     /^\\def\\sf{\\realbackslash sf}%$/
+\shortchapentry        tex-src/texinfo.tex     
/^\\def\\shortchapentry#1#2#3{%$/
+\shortunnumberedentry  tex-src/texinfo.tex     
/^\\def\\shortunnumberedentry#1#2{%$/
+\singlecodeindexer     tex-src/texinfo.tex     /^\\def\\singlecodeindexer 
#1{\\doind{\\indexname}{\\code/
+\singleindexer tex-src/texinfo.tex     /^\\def\\singleindexer 
#1{\\doind{\\indexname}{#1}}$/
+\singlespace   tex-src/texinfo.tex     /^\\def\\singlespace{%$/
+\sl    tex-src/texinfo.tex     /^\\def\\sl{\\realbackslash sl }%$/
+\smallbook     tex-src/texinfo.tex     /^\\def\\smallbook{$/
+\smalllispx    tex-src/texinfo.tex     
/^\\def\\smalllispx{\\aboveenvbreak\\begingroup\\inENV$/
+\smartitalic   tex-src/texinfo.tex     /^\\def\\smartitalic#1{{\\sl 
#1}\\futurelet\\next\\smartit/
+\smartitalicx  tex-src/texinfo.tex     
/^\\def\\smartitalicx{\\ifx\\next,\\else\\ifx\\next-\\else\\i/
+\sp    tex-src/texinfo.tex     /^\\def\\sp{\\parsearg\\spxxx}$/
+\splitoff      tex-src/texinfo.tex     
/^\\def\\splitoff#1#2\\endmark{\\def\\first{#1}\\def\\rest{/
+\spxxx tex-src/texinfo.tex     /^\\def\\spxxx #1{\\par \\vskip 
#1\\baselineskip}$/
+\startcontents tex-src/texinfo.tex     /^\\def\\startcontents#1{%$/
+\startenumeration      tex-src/texinfo.tex     /^\\def\\startenumeration#1{%$/
+\subheading    tex-src/texinfo.tex     
/^\\def\\subheading{\\parsearg\\subsecheadingi}$/
+\subsecentry   tex-src/texinfo.tex     /^      \\def\\subsecentry 
##1##2##3##4##5{}$/
+\subsecentry   tex-src/texinfo.tex     
/^\\def\\subsecentry#1#2#3#4#5{\\dosubsecentry{#2.#3.#4/
+\subsecfonts   tex-src/texinfo.tex     /^\\def\\subsecfonts{%$/
+\subsecheading tex-src/texinfo.tex     /^\\def\\subsecheading 
#1#2#3#4{\\subsecheadingi {#2.#3/
+\subsecheadingbreak    tex-src/texinfo.tex     
/^\\def\\subsecheadingbreak{\\dobreak \\subsecheadingski/
+\subsecheadingi        tex-src/texinfo.tex     /^\\def\\subsecheadingi 
#1{{\\advance \\subsecheadingski/
+\subsubheading tex-src/texinfo.tex     
/^\\def\\subsubheading{\\parsearg\\subsubsecheadingi}$/
+\subsubsecentry        tex-src/texinfo.tex     /^      \\def\\subsubsecentry 
##1##2##3##4##5##6{}$/
+\subsubsecentry        tex-src/texinfo.tex     
/^\\def\\subsubsecentry#1#2#3#4#5#6{%$/
+\subsubsecfonts        tex-src/texinfo.tex     
/^\\def\\subsubsecfonts{\\subsecfonts} % Maybe this sho/
+\subsubsecheading      tex-src/texinfo.tex     /^\\def\\subsubsecheading 
#1#2#3#4#5{\\subsubsecheading/
+\subsubsecheadingi     tex-src/texinfo.tex     /^\\def\\subsubsecheadingi 
#1{{\\advance \\subsecheading/
+\subtitle      tex-src/texinfo.tex     /^   
\\def\\subtitle{\\parsearg\\subtitlezzz}%$/
+\subtitlefont  tex-src/texinfo.tex     /^   \\def\\subtitlefont{\\subtitlerm 
\\normalbaselinesk/
+\subtitlezzz   tex-src/texinfo.tex     /^   
\\def\\subtitlezzz##1{{\\subtitlefont \\rightline{#/
+\summarycontents       tex-src/texinfo.tex     
/^\\outer\\def\\summarycontents{%$/
+\supereject    tex-src/texinfo.tex     /^\\def\\supereject{\\par\\penalty 
-20000\\footnoteno =0 /
+\syncodeindex  tex-src/texinfo.tex     /^\\def\\syncodeindex #1 #2 {%$/
+\synindex      tex-src/texinfo.tex     /^\\def\\synindex #1 #2 {%$/
+\t     tex-src/texinfo.tex     /^\\def\\t##1{\\realbackslash r {##1}}%$/
+\t     tex-src/texinfo.tex     /^\\def\\t#1{{\\tt 
\\exhyphenpenalty=10000\\rawbackslash /
+\table tex-src/texinfo.tex     
/^\\def\\table{\\begingroup\\inENV\\obeylines\\obeyspaces\\/
+\tablez        tex-src/texinfo.tex     /^\\def\\tablez #1#2#3#4#5#6{%$/
+\tclose        tex-src/texinfo.tex     /^\\def\\tclose##1{\\realbackslash 
tclose {##1}}$/
+\tclose        tex-src/texinfo.tex     /^\\def\\tclose##1{\\realbackslash 
tclose {##1}}%$/
+\tclose        tex-src/texinfo.tex     /^\\def\\tclose#1{{\\rm 
\\tcloserm=\\fontdimen2\\font \\tt /
+\tex   tex-src/texinfo.tex     /^\\def\\tex{\\begingroup$/
+\texinfoversion        tex-src/texinfo.tex     /^\\def\\texinfoversion{2.73}$/
+\textfonts     tex-src/texinfo.tex     /^\\def\\textfonts{%$/
+\thearg        tex-src/texinfo.tex     /^  \\def\\thearg{#1}%$/
+\thearg        tex-src/texinfo.tex     /^  \\ifx\\thearg\\empty 
\\def\\thearg{1}\\fi$/
+\thischapter   tex-src/texinfo.tex     /^   
\\unnumbchapmacro{#1}\\def\\thischapter{}%$/
+\thischapter   tex-src/texinfo.tex     /^\\def\\thischapter{} 
\\def\\thissection{}$/
+\thischaptername       tex-src/texinfo.tex     /^\\def\\thischaptername{No 
Chapter Title}$/
+\thisfile      tex-src/texinfo.tex     /^\\def\\thisfile{}$/
+\thistitle     tex-src/texinfo.tex     /^\\def\\thistitle{No Title}$/
+\tie   tex-src/texinfo.tex     /^\\def\\tie{\\penalty 10000\\ }     % Save 
plain tex de/
+\tindex        tex-src/texinfo.tex     /^\\def\\tindex {\\tpindex}$/
+\title tex-src/texinfo.tex     /^   \\def\\title{\\parsearg\\titlezzz}%$/
+\titlefont     tex-src/texinfo.tex     /^\\def\\titlefont#1{{\\titlerm #1}}$/
+\titlepage     tex-src/texinfo.tex     /^\\def\\titlepage{\\begingroup 
\\parindent=0pt \\textfon/
+\titlezzz      tex-src/texinfo.tex     /^   
\\def\\titlezzz##1{\\leftline{\\titlefont{##1}}$/
+\today tex-src/texinfo.tex     /^\\def\\today{\\number\\day\\space$/
+\top   tex-src/texinfo.tex     /^\\outer\\def\\top{\\parsearg\\unnumberedzzz}$/
+\tt    tex-src/texinfo.tex     /^\\def\\tt{\\realbackslash tt}$/
+\tt    tex-src/texinfo.tex     /^\\def\\tt{\\realbackslash tt}%$/
+\turnoffactive tex-src/texinfo.tex     
/^\\def\\turnoffactive{\\let"=\\normaldoublequote$/
+\unnchfopen    tex-src/texinfo.tex     /^\\def\\unnchfopen #1{%$/
+\unnchfplain   tex-src/texinfo.tex     /^\\def\\unnchfplain #1{%$/
+\unnumbchapentry       tex-src/texinfo.tex     
/^\\def\\unnumbchapentry#1#2{\\dochapentry{#1}{#2}}$/
+\unnumbered    tex-src/texinfo.tex     
/^\\outer\\def\\unnumbered{\\parsearg\\unnumberedzzz}$/
+\unnumberedsec tex-src/texinfo.tex     
/^\\outer\\def\\unnumberedsec{\\parsearg\\unnumberedseczz/
+\unnumberedseczzz      tex-src/texinfo.tex     /^\\def\\unnumberedseczzz 
#1{\\seccheck{unnumberedsec}%/
+\unnumberedsubsec      tex-src/texinfo.tex     
/^\\outer\\def\\unnumberedsubsec{\\parsearg\\unnumberedsu/
+\unnumberedsubseczzz   tex-src/texinfo.tex     /^\\def\\unnumberedsubseczzz 
#1{\\seccheck{unnumberedsu/
+\unnumberedsubsubsec   tex-src/texinfo.tex     
/^\\outer\\def\\unnumberedsubsubsec{\\parsearg\\unnumbere/
+\unnumberedsubsubseczzz        tex-src/texinfo.tex     
/^\\def\\unnumberedsubsubseczzz #1{\\seccheck{unnumbere/
+\unnumberedzzz tex-src/texinfo.tex     /^\\def\\unnumberedzzz 
#1{\\seccheck{unnumbered}%$/
+\unnumbnoderef tex-src/texinfo.tex     
/^\\def\\unnumbnoderef{\\ifx\\lastnode\\relax\\else$/
+\unnumbsecentry        tex-src/texinfo.tex     /^      \\def\\unnumbsecentry 
##1##2{}$/
+\unnumbsecentry        tex-src/texinfo.tex     
/^\\def\\unnumbsecentry#1#2{\\dosecentry{#1}{#2}}$/
+\unnumbsetref  tex-src/texinfo.tex     /^\\def\\unnumbsetref#1{%$/
+\unnumbsubsecentry     tex-src/texinfo.tex     /^      
\\def\\unnumbsubsecentry ##1##2{}$/
+\unnumbsubsecentry     tex-src/texinfo.tex     
/^\\def\\unnumbsubsecentry#1#2{\\dosubsecentry{#1}{#2}}/
+\unnumbsubsubsecentry  tex-src/texinfo.tex     /^      
\\def\\unnumbsubsubsecentry ##1##2{}$/
+\unnumbsubsubsecentry  tex-src/texinfo.tex     
/^\\def\\unnumbsubsubsecentry#1#2{\\dosubsubsecentry{#1/
+\uppercaseenumerate    tex-src/texinfo.tex     /^\\def\\uppercaseenumerate{%$/
+\var   tex-src/texinfo.tex     /^\\def\\var##1{\\realbackslash var {##1}}$/
+\var   tex-src/texinfo.tex     /^\\def\\var##1{\\realbackslash var {##1}}%$/
+\vindex        tex-src/texinfo.tex     /^\\def\\vindex {\\vrindex}$/
+\vritemindex   tex-src/texinfo.tex     /^\\def\\vritemindex #1{\\doind 
{vr}{\\code{#1}}}%$/
+\vtable        tex-src/texinfo.tex     
/^\\def\\vtable{\\begingroup\\inENV\\obeylines\\obeyspaces/
+\w     tex-src/texinfo.tex     /^\\def\\w#1{\\leavevmode\\hbox{#1}}$/
+\w     tex-src/texinfo.tex     /^\\def\\w{\\realbackslash w }%$/
+\w     tex-src/texinfo.tex     /^\\def\\w{\\realbackslash w}$/
+\xitem tex-src/texinfo.tex     /^\\def\\xitem{\\errmessage{@xitem while not in 
a table/
+\xitemx        tex-src/texinfo.tex     /^\\def\\xitemx{\\errmessage{@xitemx 
while not in a tab/
+\xitemzzz      tex-src/texinfo.tex     /^\\def\\xitemzzz #1{\\dosubind 
{kw}{\\code{#1}}{for {\\b/
+\xkey  tex-src/texinfo.tex     /^\\def\\xkey{\\key}$/
+\xrdef tex-src/texinfo.tex     /^\\def\\xrdef #1#2{$/
+\xref  tex-src/texinfo.tex     /^\\def\\xref#1{See \\xrefX[#1,,,,,,,]}$/
+\xrefX[        tex-src/texinfo.tex     
/^\\def\\xrefX[#1,#2,#3,#4,#5,#6]{\\begingroup%$/
+^      tex-src/texinfo.tex     /^\\def^{{\\tt \\hat}}$/
+_      tex-src/texinfo.tex     /^\\def_{\\ifusingtt\\normalunderscore\\_}$/
+_GETOPT_H      c-src/getopt.h  19
+_GNU_SOURCE    c-src/etags.c   94
+_REGEX_H       c-src/emacs/src/regex.h 21
+_RE_SYNTAX_POSIX_COMMON        c-src/emacs/src/regex.h 221
+_Restrict_     c-src/emacs/src/regex.h 540
+_Restrict_     c-src/emacs/src/regex.h 542
+_Restrict_     c-src/emacs/src/regex.h 544
+_Restrict_arr_ c-src/emacs/src/regex.h 555
+_Restrict_arr_ c-src/emacs/src/regex.h 557
+_UCHAR_T       c-src/emacs/src/lisp.h  2423
+__COLORS       cp-src/screen.hpp       9
+__default_morecore     c-src/emacs/src/gmalloc.c       /^__default_morecore 
(ptrdiff_t increment)$/
+__init__       pyt-src/server.py       /^    def __init__(self):$/
+__init__       pyt-src/server.py       /^    def __init__(self, Master, text, 
textvar, widt/
+__init__       pyt-src/server.py       /^    def __init__(self, host, 
sitelist, master=None/
+__init__       pyt-src/server.py       /^    def __init__(self, master=None):$/
+__init__       pyt-src/server.py       /^    def __init__(self, newlegend, 
list, editor, ma/
+__init__       pyt-src/server.py       /^    def __init__(self, user, 
userlist, master=None/
+__ip   c.c     159
+__libc_atexit  c-src/exit.c    30
+__libc_atexit  c-src/exit.strange_suffix       30
+__malloc_extra_blocks  c-src/emacs/src/gmalloc.c       381
+__malloc_initialize    c-src/emacs/src/gmalloc.c       /^__malloc_initialize 
(void)$/
+__malloc_initialized   c-src/emacs/src/gmalloc.c       379
+__repr__       pyt-src/server.py       /^    def __repr__(self):$/
+__sbrk c-src/emacs/src/gmalloc.c       1513
+__str__        pyt-src/server.py       /^    def __str__(self):$/
+__up   c.c     160
+_aligned_blocks        c-src/emacs/src/gmalloc.c       1004
+_aligned_blocks_mutex  c-src/emacs/src/gmalloc.c       518
+_bar?  ruby-src/test1.ru       /^    def self._bar?(abc)$/
+_bytes_free    c-src/emacs/src/gmalloc.c       376
+_bytes_used    c-src/emacs/src/gmalloc.c       374
+_chunks_free   c-src/emacs/src/gmalloc.c       375
+_chunks_used   c-src/emacs/src/gmalloc.c       373
+_fraghead      c-src/emacs/src/gmalloc.c       370
+_free  c-src/emacs/src/gmalloc.c       /^_free (void *ptr)$/
+_free_internal c-src/emacs/src/gmalloc.c       /^_free_internal (void *ptr)$/
+_free_internal_nolock  c-src/emacs/src/gmalloc.c       /^_free_internal_nolock 
(void *ptr)$/
+_heapbase      c-src/emacs/src/gmalloc.c       355
+_heapindex     c-src/emacs/src/gmalloc.c       364
+_heapinfo      c-src/emacs/src/gmalloc.c       358
+_heaplimit     c-src/emacs/src/gmalloc.c       367
+_malloc        c-src/emacs/src/gmalloc.c       /^_malloc (size_t size)$/
+_malloc_internal       c-src/emacs/src/gmalloc.c       /^_malloc_internal 
(size_t size)$/
+_malloc_internal_nolock        c-src/emacs/src/gmalloc.c       
/^_malloc_internal_nolock (size_t size)$/
+_malloc_mutex  c-src/emacs/src/gmalloc.c       517
+_malloc_thread_enabled_p       c-src/emacs/src/gmalloc.c       519
+_realloc       c-src/emacs/src/gmalloc.c       /^_realloc (void *ptr, size_t 
size)$/
+_realloc_internal      c-src/emacs/src/gmalloc.c       /^_realloc_internal 
(void *ptr, size_t size)$/
+_realloc_internal_nolock       c-src/emacs/src/gmalloc.c       
/^_realloc_internal_nolock (void *ptr, size_t size)$/
+`      ruby-src/test.rb        /^        def `(command)$/
+a      c-src/h.h       103
+a      c-src/h.h       40
+a      c.c     /^a ()$/
+a      c.c     /^a()$/
+a      c.c     152
+a      c.c     180
+a      cp-src/c.C      132
+a      ruby-src/test1.ru       /^ def a()$/
+a-forth-constant!      forth-src/test-forth.fth        /^99 constant 
a-forth-constant!$/
+a-forth-value? forth-src/test-forth.fth        /^55 value a-forth-value?$/
+a-forth-word   forth-src/test-forth.fth        /^: a-forth-word ( a b c -- )$/
+a-forth-word   forth-src/test-forth.fth        /^: a-forth-word ( a b c -- 
a*b+c )  + * ;$/
+a0     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a0) (void);$/
+a1     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a1) (Lisp_Object);$/
+a2     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a2) (Lisp_Object, 
Lisp_Object)/
+a3     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a3) (Lisp_Object, 
Lisp_Object,/
+a4     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a4) (Lisp_Object, 
Lisp_Object,/
+a5     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a5) (Lisp_Object, 
Lisp_Object,/
+a6     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a6) (Lisp_Object, 
Lisp_Object,/
+a7     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a7) (Lisp_Object, 
Lisp_Object,/
+a8     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a8) (Lisp_Object, 
Lisp_Object,/
+aMANY  c-src/emacs/src/lisp.h  /^      Lisp_Object (*aMANY) (ptrdiff_t, 
Lisp_Object/
+aUNEVALLED     c-src/emacs/src/lisp.h  /^      Lisp_Object (*aUNEVALLED) 
(Lisp_Object args)/
+aa     c.c     269
+aa     c.c     279
+aaa    c.c     249
+aaa    c.c     269
+aaaaaa c-src/h.h       111
+abbrev-expansion       c-src/abbrev.c  /^DEFUN ("abbrev-expansion", 
Fabbrev_expansion, Sabb/
+abbrev-symbol  c-src/abbrev.c  /^DEFUN ("abbrev-symbol", Fabbrev_symbol, 
Sabbrev_sy/
+abbrev_all_caps        c-src/abbrev.c  58
+abbrevs_changed        c-src/abbrev.c  56
+abc    c-src/h.h       33
+abc    c-src/h.h       37
+abort-recursive-edit   c-src/emacs/src/keyboard.c      /^DEFUN 
("abort-recursive-edit", Fabort_recursive_ed/
+abs/f  ada-src/etags-test-for.ada      /^   function "abs"   (Right : Complex) 
return Real'/
+absolute_dirname       c-src/etags.c   /^absolute_dirname (char *file, char 
*dir)$/
+absolute_filename      c-src/etags.c   /^absolute_filename (char *file, char 
*dir)$/
+abt    cp-src/c.C      55
+acc_pred_info  merc-src/accumulator.m  /^:- pred 
acc_pred_info(list(mer_type)::in, list(pro/
+acc_proc_info  merc-src/accumulator.m  /^:- pred 
acc_proc_info(list(prog_var)::in, prog_var/
+acc_unification        merc-src/accumulator.m  /^:- pred 
acc_unification(pair(prog_var)::in, hlds_g/
+acc_var_subst_init     merc-src/accumulator.m  /^:- pred 
acc_var_subst_init(list(prog_var)::in,$/
+accent_key_syms        c-src/emacs/src/keyboard.c      4625
+access_keymap_keyremap c-src/emacs/src/keyboard.c      
/^access_keymap_keyremap (Lisp_Object map, Lisp_Obje/
+accu_assoc     merc-src/accumulator.m  /^:- pred accu_assoc(module_info::in, 
vartypes::in, /
+accu_assoc     merc-src/accumulator.m  /^:- type accu_assoc$/
+accu_base      merc-src/accumulator.m  /^:- type accu_base$/
+accu_before    merc-src/accumulator.m  /^:- pred accu_before(module_info::in, 
vartypes::in,/
+accu_case      merc-src/accumulator.m  /^:- type accu_case$/
+accu_construct merc-src/accumulator.m  /^:- pred 
accu_construct(module_info::in, vartypes::/
+accu_construct_assoc   merc-src/accumulator.m  /^:- pred 
accu_construct_assoc(module_info::in, vart/
+accu_create_goal       merc-src/accumulator.m  /^:- pred 
accu_create_goal(accu_goal_id::in, list(pr/
+accu_divide_base_case  merc-src/accumulator.m  /^:- pred 
accu_divide_base_case(module_info::in, var/
+accu_goal_id   merc-src/accumulator.m  /^:- type accu_goal_id$/
+accu_goal_list merc-src/accumulator.m  /^:- func 
accu_goal_list(list(accu_goal_id), accu_go/
+accu_goal_store        merc-src/accumulator.m  /^:- type accu_goal_store == 
goal_store(accu_goal_id/
+accu_has_heuristic     merc-src/accumulator.m  /^:- pred 
accu_has_heuristic(module_name::in, string/
+accu_heuristic merc-src/accumulator.m  /^:- pred 
accu_heuristic(module_name::in, string::in/
+accu_is_associative    merc-src/accumulator.m  /^:- pred 
accu_is_associative(module_info::in, pred_/
+accu_is_update merc-src/accumulator.m  /^:- pred 
accu_is_update(module_info::in, pred_id::i/
+accu_process_assoc_set merc-src/accumulator.m  /^:- pred 
accu_process_assoc_set(module_info::in, ac/
+accu_process_update_set        merc-src/accumulator.m  /^:- pred 
accu_process_update_set(module_info::in, a/
+accu_related   merc-src/accumulator.m  /^:- pred accu_related(module_info::in, 
vartypes::in/
+accu_rename    merc-src/accumulator.m  /^:- func 
accu_rename(list(accu_goal_id), accu_subst/
+accu_sets      merc-src/accumulator.m  /^:- type accu_sets$/
+accu_sets_init merc-src/accumulator.m  /^:- pred 
accu_sets_init(accu_sets::out) is det.$/
+accu_stage1    merc-src/accumulator.m  /^:- pred accu_stage1(module_info::in, 
vartypes::in,/
+accu_stage1_2  merc-src/accumulator.m  /^:- pred 
accu_stage1_2(module_info::in, vartypes::i/
+accu_stage2    merc-src/accumulator.m  /^:- pred accu_stage2(module_info::in, 
proc_info::in/
+accu_stage3    merc-src/accumulator.m  /^:- pred accu_stage3(accu_goal_id::in, 
list(prog_va/
+accu_standardize       merc-src/accumulator.m  /^:- pred 
accu_standardize(hlds_goal::in, hlds_goal:/
+accu_store     merc-src/accumulator.m  /^:- pred accu_store(accu_case::in, 
hlds_goal::in,$/
+accu_subst     merc-src/accumulator.m  /^:- type accu_subst == map(prog_var, 
prog_var).$/
+accu_substs    merc-src/accumulator.m  /^:- type accu_substs$/
+accu_substs_init       merc-src/accumulator.m  /^:- pred 
accu_substs_init(list(prog_var)::in, prog_/
+accu_top_level merc-src/accumulator.m  /^:- pred accu_top_level(top_level::in, 
hlds_goal::i/
+accu_transform_proc    merc-src/accumulator.m  /^:- pred 
accu_transform_proc(pred_proc_id::in, pred/
+accu_update    merc-src/accumulator.m  /^:- pred accu_update(module_info::in, 
vartypes::in,/
+accu_warning   merc-src/accumulator.m  /^:- type accu_warning$/
+act    prol-src/natded.prolog  /^act(OutForm,OutSyn,Ws):-$/
+action prol-src/natded.prolog  /^action(KeyVals):-$/
+active_maps    c-src/emacs/src/keyboard.c      /^active_maps (Lisp_Object 
first_event)$/
+actout prol-src/natded.prolog  /^actout('Text',Trees):-$/
+addArchs       objc-src/PackInsp.m     /^-(void)addArchs:(const char *)string$/
+addPOReader    php-src/lce_functions.php       /^      function 
addPOReader($d_name, &$por)$/
+add_active     prol-src/natded.prolog  /^add_active([],Cat,Goal):-$/
+add_command_key        c-src/emacs/src/keyboard.c      /^add_command_key 
(Lisp_Object key)$/
+add_edge       prol-src/natded.prolog  /^add_edge(Left,Right,Cat):-$/
+add_node       c-src/etags.c   /^add_node (node *np, node **cur_node_p)$/
+add_regex      c-src/etags.c   /^add_regex (char *regexp_pattern, language 
*lang)$/
+add_user_signal        c-src/emacs/src/keyboard.c      /^add_user_signal (int 
sig, const char *name)$/
+addnoise       html-src/algrthms.html  /^Adding Noise to the$/
+address        y-src/cccp.y    113
+adjust_point_for_property      c-src/emacs/src/keyboard.c      
/^adjust_point_for_property (ptrdiff_t last_pt, bool/
+agent  cp-src/clheir.hpp       75
+algorithms     html-src/algrthms.html  /^Description$/
+alias  c-src/emacs/src/lisp.h  688
+align  c-src/emacs/src/gmalloc.c       /^align (size_t size)$/
+alignas        c-src/emacs/src/lisp.h  /^# define alignas(alignment) \/* empty 
*\/$/
+aligned        c-src/emacs/src/gmalloc.c       199
+aligned_alloc  c-src/emacs/src/gmalloc.c       /^aligned_alloc (size_t 
alignment, size_t size)$/
+aligned_alloc  c-src/emacs/src/gmalloc.c       1718
+aligned_alloc  c-src/emacs/src/gmalloc.c       71
+alignlist      c-src/emacs/src/gmalloc.c       196
+alive  cp-src/conway.hpp       7
+all_kboards    c-src/emacs/src/keyboard.c      86
+allocate_kboard        c-src/emacs/src/keyboard.c      /^allocate_kboard 
(Lisp_Object type)$/
+allocated      c-src/emacs/src/regex.h 344
+an_extern_linkage      c-src/h.h       44
+an_extern_linkage      c-src/h.h       56
+an_extern_linkage_ptr  c-src/h.h       43
+analyze_regex  c-src/etags.c   /^analyze_regex (char *regex_arg)$/
+andkeyvalseq   prol-src/natded.prolog  /^andkeyvalseq(KeyVals) --> ['&'], 
keyvalseq(KeyVals/
+animals        c-src/h.h       81
+animals        cp-src/c.C      126
+animals        cp-src/c.C      130
+any_kboard_state       c-src/emacs/src/keyboard.c      /^any_kboard_state ()$/
+appDidInit     objcpp-src/SimpleCalc.M /^- appDidInit:sender$/
+append prol-src/natded.prolog  /^append([],Xs,Xs).$/
+appendToDisplay        objcpp-src/SimpleCalc.M /^- appendToDisplay:(const char 
*)theDigit$/
+append_list    prol-src/natded.prolog  /^append_list([],[]).$/
+append_string  pas-src/common.pas      /^procedure append_string;(*($/
+append_tool_bar_item   c-src/emacs/src/keyboard.c      /^append_tool_bar_item 
(void)$/
+appendix       perl-src/htlmify-cystic 24
+appendix_name  perl-src/htlmify-cystic 13
+appendix_toc   perl-src/htlmify-cystic 16
+apply_modifiers        c-src/emacs/src/keyboard.c      /^apply_modifiers (int 
modifiers, Lisp_Object base)$/
+apply_modifiers_uncached       c-src/emacs/src/keyboard.c      
/^apply_modifiers_uncached (int modifiers, char *bas/
+aref_addr      c-src/emacs/src/lisp.h  /^aref_addr (Lisp_Object array, 
ptrdiff_t idx)$/
+arg    c-src/emacs/src/lisp.h  2961
+arg    c-src/emacs/src/lisp.h  2966
+arg    c-src/emacs/src/lisp.h  2971
+arg    c-src/h.h       13
+arg_type       c-src/etags.c   250
+arglist        y-src/cccp.y    41
+argno  y-src/cccp.y    45
+args   c-src/emacs/src/lisp.h  2986
+args   c-src/h.h       30
+argsindent     tex-src/texinfo.tex     /^\\dimen1=\\hsize \\advance \\dimen1 
by -\\defargsindent/
+argsindent     tex-src/texinfo.tex     /^\\newskip\\defargsindent 
\\defargsindent=50pt$/
+argsindent     tex-src/texinfo.tex     /^\\parshape 2 0in \\dimen0 
\\defargsindent \\dimen1    /
+argument       c-src/etags.c   253
+argvals        prol-src/natded.prolog  /^argvals([]) --> [].$/
+array  c.c     190
+ascii  c-src/emacs/src/lisp.h  1598
+asort  cp-src/functions.cpp    /^void asort(int *a, int num){$/
+assemby-code-word      forth-src/test-forth.fth        /^code 
assemby-code-word ( dunno what it does )$/
+assert c-src/etags.c   /^# define assert(x) ((void) 0)$/
+assert c-src/etags.c   135
+assign_neighbor        cp-src/clheir.hpp       /^    void assign_neighbor(int 
direction, location */
+assoc_list     merc-src/accumulator.m  /^:- import_module assoc_list.$/
+associativity_assertion        merc-src/accumulator.m  /^:- pred 
associativity_assertion(module_info::in, l/
+at_end c-src/etags.c   249
+at_filename    c-src/etags.c   247
+at_language    c-src/etags.c   245
+at_least_one_member    prol-src/natded.prolog  
/^at_least_one_member(X,[X|_]):-!.$/
+at_regexp      c-src/etags.c   246
+at_stdin       c-src/etags.c   248
+atom   prol-src/natded.prolog  /^atom(X) --> [X], {atomic(X)}.$/
+atomval        prol-src/natded.prolog  /^atomval(X) --> atom(X).$/
+aultparindent  tex-src/texinfo.tex     /^\\newdimen\\defaultparindent 
\\defaultparindent = 15p/
+aultparindent  tex-src/texinfo.tex     /^\\parindent = \\defaultparindent$/
+aultparindent\hang\textindent  tex-src/texinfo.tex     
/^\\footstrut\\parindent=\\defaultparindent\\hang\\textin/
+auto_help      c-src/etags.c   699
+b      c-src/h.h       103
+b      c-src/h.h       104
+b      c-src/h.h       41
+b      c.c     /^b ()$/
+b      c.c     180
+b      c.c     259
+b      c.c     260
+b      c.c     262
+b      cp-src/c.C      132
+b      ruby-src/test1.ru       /^ def b()$/
+backslash=0    tex-src/texinfo.tex     /^\\let\\indexbackslash=0  %overridden 
during \\printin/
+bar    c-src/c.c       /^void bar() {while(0) {}}$/
+bar    c-src/h.h       19
+bar    c.c     143
+bar    cp-src/x.cc     /^XX::bar()$/
+bar1   ruby-src/test1.ru       /^    attr_reader(:foo1, :bar1, # comment$/
+bar=   ruby-src/test1.ru       /^    attr_writer :bar,$/
+bas_syn        prol-src/natded.prolog  /^bas_syn(n(_)).$/
+base   c-src/emacs/src/lisp.h  2188
+base   cp-src/Range.h  /^  double base (void) const { return rng_base;  }$/
+base   cp-src/c.C      /^double base (void) const { return rng_base;  }$/
+base_case_ids  merc-src/accumulator.m  /^:- func 
base_case_ids(accu_goal_store) = list(accu/
+base_case_ids_set      merc-src/accumulator.m  /^:- func 
base_case_ids_set(accu_goal_store) = set(a/
+baz=   ruby-src/test1.ru       /^                :baz,$/
+bb     c.c     275
+bbb    c.c     251
+bbbbbb c-src/h.h       113
+been_warned    c-src/etags.c   222
+before_command_echo_length     c-src/emacs/src/keyboard.c      130
+before_command_key_count       c-src/emacs/src/keyboard.c      129
+begtoken       c-src/etags.c   /^#define       begtoken(c)     (_btk[CHAR 
(c)]) \/* c can star/
+behaviour_info erl-src/gs_dialog.erl   /^behaviour_info(callbacks) ->$/
+bf=cmbx10      tex-src/texinfo.tex     /^\\font\\defbf=cmbx10 scaled 
\\magstep1 %was 1314$/
+bind   pyt-src/server.py       /^    def bind(self, key, action):$/
+bind_polling_period    c-src/emacs/src/keyboard.c      /^bind_polling_period 
(int n)$/
+bits_word      c-src/emacs/src/lisp.h  123
+bits_word      c-src/emacs/src/lisp.h  127
+bla    c.c     /^int bla ()$/
+blah   tex-src/testenv.tex     /^\\section{blah}$/
+bletch el-src/TAGTEST.EL       /^(foo::defmumble bletch beuarghh)$/
+blv    c-src/emacs/src/lisp.h  689
+blv_found      c-src/emacs/src/lisp.h  /^blv_found (struct 
Lisp_Buffer_Local_Value *blv)$/
+bodyindent     tex-src/texinfo.tex     /^\\advance\\dimen2 by 
-\\defbodyindent$/
+bodyindent     tex-src/texinfo.tex     /^\\advance\\dimen3 by 
-\\defbodyindent$/
+bodyindent     tex-src/texinfo.tex     /^\\advance\\leftskip by 
-\\defbodyindent$/
+bodyindent     tex-src/texinfo.tex     /^\\advance\\leftskip by 
\\defbodyindent \\advance \\righ/
+bodyindent     tex-src/texinfo.tex     /^\\exdentamount=\\defbodyindent$/
+bodyindent     tex-src/texinfo.tex     /^\\newskip\\defbodyindent 
\\defbodyindent=.4in$/
+bool   c.c     222
+bool   merc-src/accumulator.m  /^:- import_module bool.$/
+bool_header_size       c-src/emacs/src/lisp.h  1472
+bool_vector_bitref     c-src/emacs/src/lisp.h  /^bool_vector_bitref 
(Lisp_Object a, EMACS_INT i)$/
+bool_vector_bytes      c-src/emacs/src/lisp.h  /^bool_vector_bytes (EMACS_INT 
size)$/
+bool_vector_data       c-src/emacs/src/lisp.h  /^bool_vector_data (Lisp_Object 
a)$/
+bool_vector_ref        c-src/emacs/src/lisp.h  /^bool_vector_ref (Lisp_Object 
a, EMACS_INT i)$/
+bool_vector_set        c-src/emacs/src/lisp.h  /^bool_vector_set (Lisp_Object 
a, EMACS_INT i, bool /
+bool_vector_size       c-src/emacs/src/lisp.h  /^bool_vector_size (Lisp_Object 
a)$/
+bool_vector_uchar_data c-src/emacs/src/lisp.h  /^bool_vector_uchar_data 
(Lisp_Object a)$/
+bool_vector_words      c-src/emacs/src/lisp.h  /^bool_vector_words (EMACS_INT 
size)$/
+boolvar        c-src/emacs/src/lisp.h  2287
+bracelev       c-src/etags.c   2520
+bsp_DevId      c-src/h.h       25
+bt     c-src/emacs/src/lisp.h  2988
+btowc  c-src/emacs/src/regex.h /^# define btowc(c) c$/
+buffer c-src/emacs/src/lisp.h  2000
+buffer c-src/emacs/src/regex.h 341
+buffer c-src/etags.c   238
+buffer c-src/h.h       119
+build  prol-src/natded.prolog  /^build([],Left,Left).$/
+build_pure_c_string    c-src/emacs/src/lisp.h  /^build_pure_c_string (const 
char *str)$/
+build_string   c-src/emacs/src/lisp.h  /^build_string (const char *str)$/
+buildact       prol-src/natded.prolog  /^buildact([SynIn],Right,RightPlus1):-$/
+builtin_lisp_symbol    c-src/emacs/src/lisp.h  /^builtin_lisp_symbol (int 
index)$/
+burst  c-src/h.h       28
+busy   c-src/emacs/src/gmalloc.c       158
+button_down_location   c-src/emacs/src/keyboard.c      5210
+button_down_time       c-src/emacs/src/keyboard.c      5218
+byte_stack     c-src/emacs/src/lisp.h  3049
+bytecode_dest  c-src/emacs/src/lisp.h  3037
+bytecode_top   c-src/emacs/src/lisp.h  3036
+bytepos        c-src/emacs/src/lisp.h  2016
+bytes_free     c-src/emacs/src/gmalloc.c       314
+bytes_total    c-src/emacs/src/gmalloc.c       310
+bytes_used     c-src/emacs/src/gmalloc.c       312
+c      c-src/h.h       /^#define c() d$/
+c      c-src/h.h       106
+c      c.c     180
+c_ext  c-src/etags.c   2271
+caccacacca     c.c     /^caccacacca (a,b,c,d,e,f,g)$/
+cacheLRUEntry_s        c.c     172
+cacheLRUEntry_t        c.c     177
+calculate_goal_info    merc-src/accumulator.m  /^:- pred 
calculate_goal_info(hlds_goal_expr::in, hl/
+calloc c-src/emacs/src/gmalloc.c       /^calloc (size_t nmemb, size_t size)$/
+calloc c-src/emacs/src/gmalloc.c       1717
+calloc c-src/emacs/src/gmalloc.c       66
+calloc c-src/emacs/src/gmalloc.c       70
+can_be_null    c-src/emacs/src/regex.h 370
+cancel_echoing c-src/emacs/src/keyboard.c      /^cancel_echoing (void)$/
+canonicalize_filename  c-src/etags.c   /^canonicalize_filename (register char 
*fn)$/
+case_Lisp_Int  c-src/emacs/src/lisp.h  438
+cat    c-src/h.h       81
+cat    cp-src/c.C      126
+cat    cp-src/c.C      130
+cat    prol-src/natded.prolog  /^cat(A, Alpha@Beta, Ass3, Qs3, 
tree(fe,A:Alpha@Beta/
+cat_atoms      prol-src/natded.prolog  /^cat_atoms(A1,A2,A3):-$/
+cccccccccc     c-src/h.h       115
+cdr    c-src/emacs/src/lisp.h  1159
+cell   y-src/parse.y   279
+cgrep  html-src/software.html  /^cgrep$/
+chain  c-src/emacs/src/lisp.h  1162
+chain  c-src/emacs/src/lisp.h  2206
+chain  c-src/emacs/src/lisp.h  2396
+chain_subst    merc-src/accumulator.m  /^:- func chain_subst(accu_subst, 
accu_subst) = accu/
+chain_subst_2  merc-src/accumulator.m  /^:- pred chain_subst_2(list(A)::in, 
map(A, B)::in, /
+char_bits      c-src/emacs/src/lisp.h  2443
+char_table_specials    c-src/emacs/src/lisp.h  1692
+charpos        c-src/emacs/src/lisp.h  2011
+charset_unibyte        c-src/emacs/src/regex.h 410
+chartonmstr    pas-src/common.pas      /^function chartonmstr; (*($/
+checkQuotation php-src/lce_functions.php       /^      function 
checkQuotation($str)$/
+check_cons_list        c-src/emacs/src/lisp.h  /^#  define check_cons_list() 
lisp_h_check_cons_list/
+checker        make-src/Makefile       /^checker:$/
+checkhdr       c-src/emacs/src/gmalloc.c       /^checkhdr (const struct hdr 
*hdr)$/
+checkiso       html-src/software.html  /^checkiso$/
+childDidExit   objc-src/Subprocess.m   /^- childDidExit$/
+chunks_free    c-src/emacs/src/gmalloc.c       313
+chunks_used    c-src/emacs/src/gmalloc.c       311
+cjava  c-src/etags.c   2936
+class_method   ruby-src/test.rb        /^        def 
ClassExample.class_method$/
+classifyLine   php-src/lce_functions.php       /^      function 
classifyLine($line)$/
+clean  make-src/Makefile       /^clean:$/
+clear  cp-src/conway.hpp       /^    void clear(void) { alive = 0; }$/
+clear-abbrev-table     c-src/abbrev.c  /^DEFUN ("clear-abbrev-table", 
Fclear_abbrev_table, /
+clear-this-command-keys        c-src/emacs/src/keyboard.c      /^DEFUN 
("clear-this-command-keys", Fclear_this_comm/
+clearAllKey    objcpp-src/SimpleCalc.M /^- clearAllKey:sender$/
+clearKey       objcpp-src/SimpleCalc.M /^- clearKey:sender$/
+clear_event    c-src/emacs/src/keyboard.c      /^clear_event (struct 
input_event *event)$/
+clear_input_pending    c-src/emacs/src/keyboard.c      /^clear_input_pending 
(void)$/
+clear_neighbors        cp-src/clheir.cpp       /^void 
discrete_location::clear_neighbors(void)$/
+clear_screen   cp-src/screen.cpp       /^void clear_screen(void)$/
+clear_waiting_for_input        c-src/emacs/src/keyboard.c      
/^clear_waiting_for_input (void)$/
+cmd_error      c-src/emacs/src/keyboard.c      /^cmd_error (Lisp_Object data)$/
+cmd_error_internal     c-src/emacs/src/keyboard.c      /^cmd_error_internal 
(Lisp_Object data, const char */
+cmpfn  c-src/emacs/src/lisp.h  /^  bool (*cmpfn) (struct hash_table_test *t, 
Lisp_O/
+cmt    prol-src/natded.prolog  /^cmt:-$/
+cname  c-src/etags.c   2519
+cno    c-src/etags.c   224
+colori cp-src/c.C      40
+commaargvals   prol-src/natded.prolog  /^commaargvals(Args) -->$/
+command        c-src/etags.c   187
+command-error-default-function c-src/emacs/src/keyboard.c      /^DEFUN 
("command-error-default-function", Fcommand_/
+command_loop   c-src/emacs/src/keyboard.c      /^command_loop (void)$/
+command_loop_1 c-src/emacs/src/keyboard.c      /^command_loop_1 (void)$/
+command_loop_2 c-src/emacs/src/keyboard.c      /^command_loop_2 (Lisp_Object 
ignore)$/
+command_loop_level     c-src/emacs/src/keyboard.c      195
+comment        php-src/lce_functions.php       /^      function comment($line, 
$class)$/
+commutativity_assertion        merc-src/accumulator.m  /^:- pred 
commutativity_assertion(module_info::in,li/
+compile_empty  prol-src/natded.prolog  /^compile_empty:-$/
+compile_lex    prol-src/natded.prolog  /^compile_lex(File):-$/
+complete       prol-src/natded.prolog  /^complete(Cat):-$/
+complete-tag   el-src/emacs/lisp/progmodes/etags.el    /^(defun complete-tag 
()$/
+compressor     c-src/etags.c   188
+compressors    c-src/etags.c   457
+compute_next_state     cp-src/clheir.hpp       /^    virtual void 
compute_next_state(void) { }$/
+compute_next_state     cp-src/conway.hpp       /^    void 
compute_next_state(void)$/
+conalgorithm   html-src/algrthms.html  /^Convolutionally$/
+concat c-src/etags.c   /^concat (const char *s1, const char *s2, const char/
+concatenatenamestrings pas-src/common.pas      /^function 
concatenatenamestrings; (*($/
+consider_token c-src/etags.c   /^consider_token (char *str, int len, int c, 
int *c_/
+constant       c-src/emacs/src/lisp.h  668
+constant       c-src/h.h       29
+constant       y-src/cccp.y    112
+constant_args  c-src/h.h       27
+constype       c-src/emacs/src/lisp.h  3739
+consult_lex    prol-src/natded.prolog  /^consult_lex:-$/
+contents       c-src/emacs/src/lisp.h  1372
+contents       c-src/emacs/src/lisp.h  1600
+contents       c-src/emacs/src/lisp.h  1624
+count  c-src/emacs/src/lisp.h  1863
+count_layers   lua-src/allegro.lua     /^local function count_layers (layer)$/
+count_words    c-src/tab.c     /^static int            count_words(char *str, 
char delim)$/
+counter        cp-src/c.C      33
+counter        cp-src/c.C      36
+cow    cp-src/c.C      127
+cow    cp-src/c.C      131
+cplpl  c-src/etags.c   2935
+create-bar     forth-src/test-forth.fth        /^: create-bar foo ;$/
+createPOEntries        php-src/lce_functions.php       /^      function 
createPOEntries()$/
+createWidgets  pyt-src/server.py       /^    def createWidgets(self):$/
+createWidgets  pyt-src/server.py       /^    def createWidgets(self, host):$/
+create_acc_call        merc-src/accumulator.m  /^:- func 
create_acc_call(hlds_goal::in(goal_plain_c/
+create_acc_goal        merc-src/accumulator.m  /^:- pred 
create_acc_goal(hlds_goal::in, accu_substs/
+create_new_base_goals  merc-src/accumulator.m  /^:- func 
create_new_base_goals(set(accu_goal_id), a/
+create_new_orig_recursive_goals        merc-src/accumulator.m  /^:- func 
create_new_orig_recursive_goals(set(accu_g/
+create_new_recursive_goals     merc-src/accumulator.m  /^:- func 
create_new_recursive_goals(set(accu_goal_i/
+create_new_var merc-src/accumulator.m  /^:- pred create_new_var(prog_var::in, 
string::in, p/
+create_orig_goal       merc-src/accumulator.m  /^:- pred 
create_orig_goal(hlds_goal::in, accu_subst/
+cscInitTime    cp-src/c.C      7
+cscSegmentationTime    cp-src/c.C      8
+cstack c-src/etags.c   2523
+ctags  make-src/Makefile       /^ctags: etags.c ${OBJS}$/
+curlb  c-src/etags.c   2929
+curlinepos     c-src/etags.c   2931
+current-idle-time      c-src/emacs/src/keyboard.c      /^DEFUN 
("current-idle-time", Fcurrent_idle_time, Sc/
+current-input-mode     c-src/emacs/src/keyboard.c      /^DEFUN 
("current-input-mode", Fcurrent_input_mode, /
+current_kboard c-src/emacs/src/keyboard.c      85
+current_lb_is_new      c-src/etags.c   2926
+curry-test     scm-src/test.scm        /^(define (((((curry-test a) b) c) d) 
e)$/
+cursor_position        cp-src/screen.cpp       /^void cursor_position(void)$/
+cursor_x       cp-src/screen.cpp       15
+cursor_y       cp-src/screen.cpp       15
+d      c-src/emacs/src/lisp.h  4673
+d      c-src/emacs/src/lisp.h  4679
+d      c.c     180
+data   c-src/emacs/src/lisp.h  1395
+data   c-src/emacs/src/lisp.h  2129
+data   c-src/emacs/src/lisp.h  2395
+ddefineseen    c-src/etags.c   2462
+debian-bug     html-src/software.html  /^debian-bug.el$/
+debug_on_exit  c-src/emacs/src/lisp.h  2984
+decimalKey     objcpp-src/SimpleCalc.M /^- decimalKey:sender$/
+declared_special       c-src/emacs/src/lisp.h  676
+decode_timer   c-src/emacs/src/keyboard.c      /^decode_timer (Lisp_Object 
timer, struct timespec */
+def    c-src/h.h       35
+def    c-src/h.h       38
+defalt c-src/emacs/src/lisp.h  1585
+default-tags-table-function    el-src/emacs/lisp/progmodes/etags.el    
/^(defvar default-tags-table-function nil$/
+default_C_entries      c-src/etags.c   /^default_C_entries (FILE *inf)$/
+default_C_help c-src/etags.c   515
+default_C_help c-src/etags.c   523
+default_C_suffixes     c-src/etags.c   512
+defcell        c-src/emacs/src/lisp.h  2351
+define-abbrev  c-src/abbrev.c  /^DEFUN ("define-abbrev", Fdefine_abbrev, 
Sdefine_ab/
+define-abbrev-table    c-src/abbrev.c  /^DEFUN ("define-abbrev-table", 
Fdefine_abbrev_table/
+define-global-abbrev   c-src/abbrev.c  /^DEFUN ("define-global-abbrev", 
Fdefine_global_abbr/
+define-mode-abbrev     c-src/abbrev.c  /^DEFUN ("define-mode-abbrev", 
Fdefine_mode_abbrev, /
+defined_GC_CHECK_STRING_BYTES  c-src/emacs/src/lisp.h  4663
+defined_GC_CHECK_STRING_BYTES  c-src/emacs/src/lisp.h  4665
+definedef      c-src/etags.c   2464
+defun_func1    c.c     /^defun_func1()$/
+delegate       objc-src/Subprocess.m   /^- delegate$/
+deleteItem     pyt-src/server.py       /^    def deleteItem(self):$/
+delete_kboard  c-src/emacs/src/keyboard.c      /^delete_kboard (KBOARD *kb)$/
+deliver_input_available_signal c-src/emacs/src/keyboard.c      
/^deliver_input_available_signal (int sig)$/
+deliver_interrupt_signal       c-src/emacs/src/keyboard.c      
/^deliver_interrupt_signal (int sig)$/
+deliver_user_signal    c-src/emacs/src/keyboard.c      /^deliver_user_signal 
(int sig)$/
+depth  c-src/emacs/src/lisp.h  1618
+derived_analyses       prol-src/natded.prolog  /^derived_analyses([],[]).$/
+describe_abbrev        c-src/abbrev.c  /^describe_abbrev (sym, stream)$/
+detect_input_pending   c-src/emacs/src/keyboard.c      /^detect_input_pending 
(void)$/
+detect_input_pending_ignore_squeezables        c-src/emacs/src/keyboard.c      
/^detect_input_pending_ignore_squeezables (void)$/
+detect_input_pending_run_timers        c-src/emacs/src/keyboard.c      
/^detect_input_pending_run_timers (bool do_display)$/
+dialog_loop    erl-src/gs_dialog.erl   /^dialog_loop(Module, Window, Frame, 
Extra, Args) ->/
+dignorerest    c-src/etags.c   2463
+discard-input  c-src/emacs/src/keyboard.c      /^DEFUN ("discard-input", 
Fdiscard_input, Sdiscard_i/
+discard_mouse_events   c-src/emacs/src/keyboard.c      /^discard_mouse_events 
(void)$/
+discrete_location      cp-src/clheir.hpp       /^    discrete_location(int xi, 
int yi, int zi):$/
+discrete_location      cp-src/clheir.hpp       56
+display        cp-src/conway.cpp       /^void display(void)$/
+disposetextstring      pas-src/common.pas      /^procedure 
disposetextstring;(*($/
+dnone  c-src/etags.c   2460
+doc    c-src/emacs/src/lisp.h  1689
+dog    c-src/h.h       81
+dog    cp-src/c.C      126
+dog    cp-src/c.C      130
+dotfill        tex-src/texinfo.tex     /^  \\null\\nobreak\\indexdotfill % 
Have leaders before/
+dotfill        tex-src/texinfo.tex     
/^\\noindent\\hskip\\secondaryindent\\hbox{#1}\\indexdotf/
+double_click_count     c-src/emacs/src/keyboard.c      5222
+drag_n_drop_syms       c-src/emacs/src/keyboard.c      4629
+dribble        c-src/emacs/src/keyboard.c      236
+dsharpseen     c-src/etags.c   2461
+dummies        tex-src/texinfo.tex     /^{\\indexdummies % Must do this here, 
since \\bf, etc/
+dummy1 cp-src/burton.cpp       /^::dummy::dummy test::dummy1(void)$/
+dummy2 cp-src/burton.cpp       /^::dummy::dummy test::dummy2(::CORBA::Long 
dummy)$/
+dummy3 cp-src/burton.cpp       /^::dummy::dummy test::dummy3(char* name, 
::CORBA::L/
+dummydots      tex-src/texinfo.tex     /^\\let\\dots=\\indexdummydots$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\b=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\code=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\emph=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\file=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\i=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\kbd=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\key=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\r=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\samp=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\sc=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\strong=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\t=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\tclose=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\var=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\w=\\indexdummyfont$/
+dummytex       tex-src/texinfo.tex     /^\\let\\TeX=\\indexdummytex$/
+dump   pyt-src/server.py       /^    def dump(self, folded):$/
+eabs   c-src/emacs/src/lisp.h  /^#define eabs(x)         ((x) < 0 ? -(x) : 
(x))$/
+eassert        c-src/emacs/src/lisp.h  /^# define eassert(cond)                
                                \\$/
+eassert        c-src/emacs/src/lisp.h  /^# define eassert(cond) ((void) (false 
&& (cond))) /
+eassume        c-src/emacs/src/lisp.h  /^# define eassume(cond)                
                                \\$/
+eassume        c-src/emacs/src/lisp.h  /^# define eassume(cond) assume (cond)$/
+eax    c-src/sysdep.h  31
+eax    c-src/sysdep.h  33
+echo_add_key   c-src/emacs/src/keyboard.c      /^echo_add_key (Lisp_Object c)$/
+echo_char      c-src/emacs/src/keyboard.c      /^echo_char (Lisp_Object c)$/
+echo_dash      c-src/emacs/src/keyboard.c      /^echo_dash (void)$/
+echo_kboard    c-src/emacs/src/keyboard.c      166
+echo_keystrokes_p      c-src/emacs/src/keyboard.c      /^echo_keystrokes_p 
(void)$/
+echo_length    c-src/emacs/src/keyboard.c      /^echo_length (void)$/
+echo_message_buffer    c-src/emacs/src/keyboard.c      171
+echo_now       c-src/emacs/src/keyboard.c      /^echo_now (void)$/
+echo_truncate  c-src/emacs/src/keyboard.c      /^echo_truncate (ptrdiff_t 
nchars)$/
+echoing        c-src/emacs/src/keyboard.c      154
+editItem       pyt-src/server.py       /^    def editItem(self):$/
+editsite       pyt-src/server.py       /^    def editsite(self, site):$/
+edituser       pyt-src/server.py       /^    def edituser(self, user):$/
+egetenv        c-src/emacs/src/lisp.h  /^egetenv (const char *var)$/
+emacs_abort    c-src/emacs/src/lisp.h  /^extern _Noreturn void emacs_abort 
(void) NO_INLINE/
+end    c-src/emacs/src/keyboard.c      8753
+end    c-src/emacs/src/lisp.h  2039
+end    c-src/emacs/src/regex.h 432
+endtoken       c-src/etags.c   /^#define       endtoken(c)     (_etk[CHAR 
(c)]) \/* c ends tok/
+enter_critical_section c-src/h.h       116
+entry  perl-src/htlmify-cystic 218
+entry  perl-src/htlmify-cystic 234
+entry  perl-src/htlmify-cystic 245
+entry  perl-src/htlmify-cystic 252
+entry  perl-src/htlmify-cystic 268
+entry  perl-src/htlmify-cystic 276
+entry  perl-src/htlmify-cystic 281
+entry  perl-src/htlmify-cystic 296
+equalsKey      objcpp-src/SimpleCalc.M /^- equalsKey:sender$/
+erlang_atom    c-src/etags.c   /^erlang_atom (char *s)$/
+erlang_attribute       c-src/etags.c   /^erlang_attribute (char *s)$/
+erlang_func    c-src/etags.c   /^erlang_func (char *s, char *last)$/
+error  c-src/emacs/src/lisp.h  /^extern _Noreturn void error (const char *, 
...) AT/
+error  c-src/etags.c   /^error (const char *format, ...)$/
+error  c-src/etags.c   /^static void error (const char *, ...) ATTRIBUTE_FO/
+error  y-src/cccp.y    /^error (msg)$/
+error_signaled c-src/etags.c   264
+etags  el-src/emacs/lisp/progmodes/etags.el    /^(defgroup etags nil "Tags 
tables."$/
+etags  html-src/software.html  /^Etags$/
+etags  make-src/Makefile       /^etags: etags.c ${OBJS}$/
+etags--xref-find-definitions   el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags--xref-find-definitions (pattern &opti/
+etags--xref-limit      el-src/emacs/lisp/progmodes/etags.el    /^(defconst 
etags--xref-limit 1000)$/
+etags-file-of-tag      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-file-of-tag (&optional relative) ; Do/
+etags-goto-tag-location        el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-goto-tag-location (tag-info)$/
+etags-list-tags        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-list-tags (file) ; Doc string?$/
+etags-recognize-tags-table     el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-recognize-tags-table ()$/
+etags-snarf-tag        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-snarf-tag (&optional use-explicit) ; /
+etags-tags-apropos     el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-tags-apropos (string) ; Doc string?$/
+etags-tags-apropos-additional  el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-tags-apropos-additional (regexp)$/
+etags-tags-completion-table    el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-tags-completion-table () ; Doc string/
+etags-tags-included-tables     el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-tags-included-tables () ; Doc string?/
+etags-tags-table-files el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-tags-table-files () ; Doc string?$/
+etags-verify-tags-table        el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-verify-tags-table ()$/
+etags-xref-find        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-xref-find (action id)$/
+etags-xref-find-definitions-tag-order  el-src/emacs/lisp/progmodes/etags.el    
/^(defvar etags-xref-find-definitions-tag-order '(ta/
+etags.1.man    make-src/Makefile       /^etags.1.man: etags.1$/
+etags_getcwd   c-src/etags.c   /^etags_getcwd (void)$/
+eval_dyn       c-src/emacs/src/keyboard.c      /^eval_dyn (Lisp_Object form)$/
+event-convert-list     c-src/emacs/src/keyboard.c      /^DEFUN 
("event-convert-list", Fevent_convert_list, /
+event-symbol-parse-modifiers   c-src/emacs/src/keyboard.c      /^DEFUN 
("internal-event-symbol-parse-modifiers", Fe/
+event_head     c-src/emacs/src/keyboard.c      11021
+event_to_kboard        c-src/emacs/src/keyboard.c      /^event_to_kboard 
(struct input_event *event)$/
+exact  c-src/emacs/src/gmalloc.c       200
+execute        cp-src/c.C      /^        void execute(CPluginCSCState& p, int 
w, in/
+exit   c-src/exit.c    /^DEFUN(exit, (status), int status)$/
+exit   c-src/exit.strange_suffix       /^DEFUN(exit, (status), int status)$/
+exit-recursive-edit    c-src/emacs/src/keyboard.c      /^DEFUN 
("exit-recursive-edit", Fexit_recursive_edit/
+exit_critical_to_previous      c-src/h.h       117
+exp    y-src/atest.y   2
+exp    y-src/cccp.y    156
+exp    y-src/cccp.y    185
+exp    y-src/parse.y   95
+exp1   y-src/cccp.y    148
+exp_list       y-src/parse.y   263
+expand-abbrev  c-src/abbrev.c  /^DEFUN ("expand-abbrev", Fexpand_abbrev, 
Sexpand_ab/
+expandmng      prol-src/natded.prolog  /^expandmng(var(V),var(V)).$/
+expandmng_tree prol-src/natded.prolog  
/^expandmng_tree(tree(Rule,Syn:Sem,Trees),$/
+expandmng_trees        prol-src/natded.prolog  /^expandmng_trees([],[]).$/
+expandsyn      prol-src/natded.prolog  /^expandsyn(Syn,Syn):-$/
+explicitly-quoted-pending-delete-mode  el-src/TAGTEST.EL       /^(defalias 
(quote explicitly-quoted-pending-delete-/
+expression_value       y-src/cccp.y    68
+extras c-src/emacs/src/lisp.h  1603
+extvar c-src/h.h       109
+f      c-src/c.c       /^T f(){if(x){}$/
+f      c-src/h.h       89
+f      c.c     /^int f$/
+f      c.c     145
+f      c.c     156
+f      c.c     168
+f      cp-src/c.C      /^     void f() {}$/
+f      cp-src/c.C      /^  int f(){return 0;};         \/\/ first comment$/
+f      cp-src/c.C      /^A<float,B<int> > A<B<float>,int>::f(A<int>* x) {}$/
+f      cp-src/c.C      /^A<int>* f() {}$/
+f      cp-src/c.C      /^class B<int> { void f() {} };$/
+f      cp-src/c.C      /^int A<int>::f(A<int>* x) {}$/
+f      cp-src/c.C      /^int f(A<int> x) {}$/
+f      cp-src/fail.C   /^              int f() { return 5; }$/
+f      cp-src/fail.C   /^int A::B::f() { return 2; }$/
+f1     c.c     /^     f1 () { \/* Do something. *\/; }$/
+f1     perl-src/kai-test.pl    /^sub f1 {$/
+f2     c.c     /^void f2 () { \/* Do something. *\/; }$/
+f2     perl-src/kai-test.pl    /^sub main::f2 {$/
+f3     perl-src/kai-test.pl    /^sub f3 {$/
+f4     perl-src/kai-test.pl    /^sub Bar::f4 {$/
+f5     perl-src/kai-test.pl    /^sub f5 {$/
+f6     perl-src/kai-test.pl    /^sub f6 {$/
+f7     perl-src/kai-test.pl    /^sub f7 {$/
+fast_string_match_ignore_case  c-src/emacs/src/lisp.h  
/^fast_string_match_ignore_case (Lisp_Object regexp,/
+fastctags      make-src/Makefile       /^fastctags:$/
+fastetags      make-src/Makefile       /^fastetags:$/
+fastmap        c-src/emacs/src/regex.h 355
+fastmap_accurate       c-src/emacs/src/regex.h 383
+fatal  c-src/etags.c   /^fatal (const char *s1, const char *s2)$/
+fatala c.c     /^void fatala () __attribute__ ((noreturn));$/
+fconst forth-src/test-forth.fth        /^3.1415e fconstant fconst$/
+fdHandler      objc-src/Subprocess.m   /^- fdHandler:(int)theFd$/
+fdHandler      objc-src/Subprocess.m   /^fdHandler (int theFd, id self)$/
+fdefunkey      c-src/etags.c   2409
+fdefunname     c-src/etags.c   2410
+fdesc  c-src/etags.c   201
+fdesc  c-src/etags.c   212
+fdp    c-src/etags.c   217
+ff     cp-src/c.C      /^  int ff(){return 1;};$/
+field_of_play  cp-src/conway.cpp       18
+fignore        c-src/etags.c   2416
+file-of-tag    el-src/emacs/lisp/progmodes/etags.el    /^(defun file-of-tag 
(&optional relative)$/
+file-of-tag-function   el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
file-of-tag-function nil$/
+fileJoin       php-src/lce_functions.php       /^  function fileJoin()$/
+file_end       perl-src/htlmify-cystic /^sub file_end ()$/
+file_index     perl-src/htlmify-cystic 33
+file_tocs      perl-src/htlmify-cystic 30
+filename_is_absolute   c-src/etags.c   /^filename_is_absolute (char *fn)$/
+filenames      c-src/etags.c   196
+find-tag       el-src/emacs/lisp/progmodes/etags.el    /^(defun find-tag 
(tagname &optional next-p regexp-p/
+find-tag-default-function      el-src/emacs/lisp/progmodes/etags.el    
/^(defcustom find-tag-default-function nil$/
+find-tag-history       el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
find-tag-history nil) ; Doc string?$/
+find-tag-hook  el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
find-tag-hook nil$/
+find-tag-in-order      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-in-order (pattern$/
+find-tag-interactive   el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-interactive (prompt &optional no-d/
+find-tag-marker-ring   el-src/emacs/lisp/progmodes/etags.el    /^(defvaralias 
'find-tag-marker-ring 'xref--marker-r/
+find-tag-marker-ring-length    el-src/emacs/lisp/progmodes/etags.el    
/^(define-obsolete-variable-alias 'find-tag-marker-r/
+find-tag-next-line-after-failure-p     el-src/emacs/lisp/progmodes/etags.el    
/^(defvar find-tag-next-line-after-failure-p nil$/
+find-tag-noselect      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-noselect (tagname &optional next-p/
+find-tag-other-frame   el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-other-frame (tagname &optional nex/
+find-tag-other-window  el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-other-window (tagname &optional ne/
+find-tag-regexp        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-regexp (regexp &optional next-p ot/
+find-tag-regexp-next-line-after-failure-p      
el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
find-tag-regexp-next-line-after-failure-p /
+find-tag-regexp-search-function        el-src/emacs/lisp/progmodes/etags.el    
/^(defvar find-tag-regexp-search-function nil$/
+find-tag-regexp-tag-order      el-src/emacs/lisp/progmodes/etags.el    
/^(defvar find-tag-regexp-tag-order nil$/
+find-tag-search-function       el-src/emacs/lisp/progmodes/etags.el    
/^(defvar find-tag-search-function nil$/
+find-tag-tag   el-src/emacs/lisp/progmodes/etags.el    /^(defun find-tag-tag 
(string)$/
+find-tag-tag-order     el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
find-tag-tag-order nil$/
+find_entries   c-src/etags.c   /^find_entries (FILE *inf)$/
+find_user_signal_name  c-src/emacs/src/keyboard.c      /^find_user_signal_name 
(int sig)$/
+findcats       prol-src/natded.prolog  /^findcats([],Left,Left).$/
+finish_appendices      perl-src/htlmify-cystic /^sub finish_appendices ()$/
+finish_sections        perl-src/htlmify-cystic /^sub finish_sections ()$/
+finish_subsections     perl-src/htlmify-cystic /^sub finish_subsections ()$/
+finish_subsubsections  perl-src/htlmify-cystic /^sub finish_subsubsections ()$/
+finlist        c-src/etags.c   2414
+first  c-src/emacs/src/gmalloc.c       151
+fitchtreelist  prol-src/natded.prolog  /^fitchtreelist([]).$/
+fixup_locale   c-src/emacs/src/lisp.h  /^INLINE void fixup_locale (void) {}$/
+flag   c-src/getopt.h  83
+flag2str       pyt-src/server.py       /^def flag2str(value, string):$/
+flistseen      c-src/etags.c   2415
+fn     c-src/exit.c    /^    void EXFUN((*fn[1]), (NOARGS));$/
+fn     c-src/exit.strange_suffix       /^    void EXFUN((*fn[1]), (NOARGS));$/
+fnin   y-src/parse.y   68
+focus_set      pyt-src/server.py       /^    def focus_set(self):$/
+follow_key     c-src/emacs/src/keyboard.c      /^follow_key (Lisp_Object 
keymap, Lisp_Object key)$/
+fonts  tex-src/texinfo.tex     /^\\obeyspaces \\obeylines \\ninett 
\\indexfonts \\rawbac/
+fonts\rm       tex-src/texinfo.tex     /^  \\indexfonts\\rm \\tolerance=9500 
\\advance\\baseline/
+foo    c-src/h.h       18
+foo    c.c     150
+foo    c.c     166
+foo    c.c     167
+foo    c.c     178
+foo    c.c     189
+foo    cp-src/c.C      /^    foo() {$/
+foo    cp-src/c.C      68
+foo    cp-src/c.C      79
+foo    cp-src/x.cc     /^XX::foo()$/
+foo    f-src/entry.for /^       character*(*) function foo()$/
+foo    f-src/entry.strange     /^       character*(*) function foo()$/
+foo    f-src/entry.strange_suffix      /^       character*(*) function foo()$/
+foo    forth-src/test-forth.fth        /^: foo (foo) ;$/
+foo    php-src/ptest.php       /^foo()$/
+foo    ruby-src/test1.ru       /^    attr_reader :foo$/
+foo!   ruby-src/test1.ru       /^    def foo!$/
+foo1   ruby-src/test1.ru       /^    attr_reader(:foo1, :bar1, # comment$/
+foo2   ruby-src/test1.ru       /^    alias_method ( :foo2, #cmmt$/
+foo==bar       el-src/TAGTEST.EL       /^(defun foo==bar () (message "hi"))  ; 
Bug#5624$/
+foobar c-src/c.c       /^int foobar() {;}$/
+foobar c.c     /^extern void foobar (void) __attribute__ ((section /
+foobar2        c-src/h.h       20
+foobar2_       c-src/h.h       16
+foperator      c-src/etags.c   2411
+force_auto_save_soon   c-src/emacs/src/keyboard.c      /^force_auto_save_soon 
(void)$/
+force_explicit_name    c-src/etags.c   265
+force_quit_count       c-src/emacs/src/keyboard.c      10387
+foreign_export merc-src/accumulator.m  /^:- pragma foreign_export("C", 
unravel_univ(in, out/
+formatSize     objc-src/PackInsp.m     /^-(const char *)formatSize:(const char 
*)size inBuf/
+found  c-src/emacs/src/lisp.h  2344
+fracas html-src/software.html  /^Fracas$/
+frag   c-src/emacs/src/gmalloc.c       152
+frame_local    c-src/emacs/src/lisp.h  2341
+free   c-src/emacs/src/gmalloc.c       /^free (void *ptr)$/
+free   c-src/emacs/src/gmalloc.c       166
+free   c-src/emacs/src/gmalloc.c       1719
+free   c-src/emacs/src/gmalloc.c       67
+free   c-src/emacs/src/gmalloc.c       72
+free_fdesc     c-src/etags.c   /^free_fdesc (register fdesc *fdp)$/
+free_for       prol-src/natded.prolog  /^free_for(var(_),_,_).$/
+free_regexps   c-src/etags.c   /^free_regexps (void)$/
+free_tree      c-src/etags.c   /^free_tree (register node *np)$/
+free_var       prol-src/natded.prolog  /^free_var(var(V),var(V)).$/
+freehook       c-src/emacs/src/gmalloc.c       /^freehook (void *ptr)$/
+fresh_vars     prol-src/natded.prolog  /^fresh_vars(var(V),var(V)).$/
+fstartlist     c-src/etags.c   2413
+func   c-src/emacs/src/lisp.h  /^      void (*func) (Lisp_Object);$/
+func   c-src/emacs/src/lisp.h  /^      void (*func) (int);$/
+func   c-src/emacs/src/lisp.h  /^      void (*func) (void *);$/
+func   c-src/emacs/src/lisp.h  /^      void (*func) (void);$/
+func1  c.c     /^int func1$/
+func2  c.c     /^int func2 (a,b$/
+func_key_syms  c-src/emacs/src/keyboard.c      4626
+funcboo        c.c     /^bool funcboo ()$/
+funcpointer    c-src/emacs/src/lisp.h  2126
+funcptr        c-src/h.h       /^    fu   int (*funcptr) (void *ptr);$/
+function       c-src/emacs/src/lisp.h  1685
+function       c-src/emacs/src/lisp.h  2197
+function       c-src/emacs/src/lisp.h  2985
+function       c-src/emacs/src/lisp.h  694
+function       c-src/etags.c   194
+functionp      c-src/emacs/src/lisp.h  /^functionp (Lisp_Object object)$/
+fval   forth-src/test-forth.fth        /^fconst fvalue fval$/
+fvar   forth-src/test-forth.fth        /^fvariable fvar$/
+fvdef  c-src/etags.c   2418
+fvextern       c-src/etags.c   2420
+fvnameseen     c-src/etags.c   2412
+fvnone c-src/etags.c   2408
+fwd    c-src/emacs/src/lisp.h  2346
+fwd    c-src/emacs/src/lisp.h  690
+g      cp-src/c.C      /^  int g(){return 2;};$/
+galileo        html-src/software.html  /^GaliLEO$/
+gather pyt-src/server.py       /^    def gather(self):$/
+gc_aset        c-src/emacs/src/lisp.h  /^gc_aset (Lisp_Object array, ptrdiff_t 
idx, Lisp_Ob/
+gcmarkbit      c-src/emacs/src/lisp.h  1974
+gcmarkbit      c-src/emacs/src/lisp.h  1981
+gcmarkbit      c-src/emacs/src/lisp.h  2035
+gcmarkbit      c-src/emacs/src/lisp.h  2113
+gcmarkbit      c-src/emacs/src/lisp.h  2204
+gcmarkbit      c-src/emacs/src/lisp.h  656
+gcpro  c-src/emacs/src/lisp.h  3042
+gcpro  c-src/emacs/src/lisp.h  3132
+gen_help_event c-src/emacs/src/keyboard.c      /^gen_help_event (Lisp_Object 
help, Lisp_Object fram/
+genalgorithm   html-src/algrthms.html  /^Generating the 
Data<\/font><\/i><\/b>$/
+generate_warning       merc-src/accumulator.m  /^:- pred 
generate_warning(module_info::in, prog_var/
+generate_warnings      merc-src/accumulator.m  /^:- pred 
generate_warnings(module_info::in, prog_va/
+generic_object cp-src/clheir.cpp       /^generic_object::generic_object(void)$/
+generic_object cp-src/clheir.hpp       13
+getArchs       objc-src/PackInsp.m     /^-(void)getArchs$/
+getDomainNames php-src/lce_functions.php       /^      function 
getDomainNames()$/
+getFoo lua-src/test.lua        /^function Cube.data.getFoo ()$/
+getPOReader    php-src/lce_functions.php       /^      function 
&getPOReader($domain)$/
+getPath        objc-src/PackInsp.m     /^-(const char *)getPath:(char *)buf 
forType:(const /
+getPos lua-src/test.lua        /^function Circle.getPos ()$/
+getPos lua-src/test.lua        /^function Rectangle.getPos ()$/
+getTextDomains php-src/lce_functions.php       /^  function 
getTextDomains($lines)$/
+get_compressor_from_suffix     c-src/etags.c   /^get_compressor_from_suffix 
(char *file, char **ext/
+get_contiguous_space   c-src/emacs/src/gmalloc.c       /^get_contiguous_space 
(ptrdiff_t size, void *positi/
+get_current_dir_name   c-src/emacs/src/gmalloc.c       33
+get_input_pending      c-src/emacs/src/keyboard.c      /^get_input_pending 
(int flags)$/
+get_language_from_filename     c-src/etags.c   /^get_language_from_filename 
(char *file, int case_s/
+get_language_from_interpreter  c-src/etags.c   /^get_language_from_interpreter 
(char *interpreter)$/
+get_language_from_langname     c-src/etags.c   /^get_language_from_langname 
(const char *name)$/
+get_layer_by_name      lua-src/allegro.lua     /^local function 
get_layer_by_name (sprite, layer, n/
+get_tag        c-src/etags.c   /^get_tag (register char *bp, char **namepp)$/
+get_word       c-src/tab.c     /^static char           *get_word(char **str, 
char delim)$/
+getcjmp        c-src/emacs/src/keyboard.c      147
+getopt perl-src/yagrip.pl      /^sub getopt {$/
+getopt.o       make-src/Makefile       /^getopt.o: emacs\/lib-src\/getopt.c$/
+getopt1.o      make-src/Makefile       /^getopt1.o: emacs\/lib-src\/getopt1.c$/
+getptys        objc-src/Subprocess.m   /^getptys (int *master, int *slave)$/
+gettext        php-src/lce_functions.php       /^      function 
gettext($msgid)$/
+ggg    c-src/h.h       10
+ghi1   c-src/h.h       36
+ghi2   c-src/h.h       39
+giallo cp-src/c.C      40
+glider cp-src/conway.cpp       /^void glider(int x, int y)$/
+gnu    html-src/software.html  /^Free software that I wrote for the GNU 
project or /
+gobble_input   c-src/emacs/src/keyboard.c      /^gobble_input (void)$/
+goto-tag-location-function     el-src/emacs/lisp/progmodes/etags.el    
/^(defvar goto-tag-location-function nil$/
+goto_xy        cp-src/screen.cpp       /^void goto_xy(unsigned char x, 
unsigned char y)$/
+handleList     pyt-src/server.py       /^    def handleList(self, event):$/
+handleNew      pyt-src/server.py       /^    def handleNew(self, event):$/
+handle_async_input     c-src/emacs/src/keyboard.c      /^handle_async_input 
(void)$/
+handle_input_available_signal  c-src/emacs/src/keyboard.c      
/^handle_input_available_signal (int sig)$/
+handle_interrupt       c-src/emacs/src/keyboard.c      /^handle_interrupt 
(bool in_signal_handler)$/
+handle_interrupt_signal        c-src/emacs/src/keyboard.c      
/^handle_interrupt_signal (int sig)$/
+handle_user_signal     c-src/emacs/src/keyboard.c      /^handle_user_signal 
(int sig)$/
+handler        c-src/emacs/src/lisp.h  3023
+handlertype    c-src/emacs/src/lisp.h  3021
+has_arg        c-src/getopt.h  82
+hash   c-src/emacs/src/lisp.h  1843
+hash   c-src/etags.c   /^hash (const char *str, int len)$/
+hash_table_test        c-src/emacs/src/lisp.h  1805
+hashfn c-src/emacs/src/lisp.h  /^  EMACS_UINT (*hashfn) (struct 
hash_table_test *t,/
+hdr    c-src/emacs/src/gmalloc.c       1860
+head_table     c-src/emacs/src/keyboard.c      11027
+header c-src/emacs/src/lisp.h  1371
+header c-src/emacs/src/lisp.h  1388
+header c-src/emacs/src/lisp.h  1581
+header c-src/emacs/src/lisp.h  1610
+header c-src/emacs/src/lisp.h  1672
+header c-src/emacs/src/lisp.h  1826
+header_size    c-src/emacs/src/lisp.h  1471
+heapsize       c-src/emacs/src/gmalloc.c       361
+hello  scm-src/test.scm        /^(define hello "Hello, Emacs!")$/
+hello  scm-src/test.scm        /^(set! hello "Hello, world!")$/
+hello-world    scm-src/test.scm        /^(define (hello-world)$/
+help   c-src/etags.c   193
+helpPanel      objcpp-src/SimpleCalc.M /^- helpPanel:sender$/
+help_char_p    c-src/emacs/src/keyboard.c      /^help_char_p (Lisp_Object c)$/
+help_form_saved_window_configs c-src/emacs/src/keyboard.c      2156
+helpwin        pyt-src/server.py       /^def helpwin(helpdict):$/
+hide_cursor    cp-src/screen.cpp       /^void hide_cursor(void)$/
+hlds   merc-src/accumulator.m  /^:- import_module hlds.$/
+htmltreelist   prol-src/natded.prolog  /^htmltreelist([]).$/
+hybrid_aligned_alloc   c-src/emacs/src/gmalloc.c       /^hybrid_aligned_alloc 
(size_t alignment, size_t siz/
+hybrid_calloc  c-src/emacs/src/gmalloc.c       /^hybrid_calloc (size_t nmemb, 
size_t size)$/
+hybrid_free    c-src/emacs/src/gmalloc.c       /^hybrid_free (void *ptr)$/
+hybrid_get_current_dir_name    c-src/emacs/src/gmalloc.c       
/^hybrid_get_current_dir_name (void)$/
+hybrid_malloc  c-src/emacs/src/gmalloc.c       /^hybrid_malloc (size_t size)$/
+hybrid_realloc c-src/emacs/src/gmalloc.c       /^hybrid_realloc (void *ptr, 
size_t size)$/
+hypothetical_mem       prol-src/natded.prolog  
/^hypothetical_mem(fi(N),Ass,_):-$/
+i      c-src/c.c       2
+i      c-src/emacs/src/lisp.h  4673
+i      c-src/emacs/src/lisp.h  4679
+i      c-src/emacs/src/lisp.h  567
+i      c.c     169
+i      cp-src/c.C      132
+ialpage        tex-src/texinfo.tex     /^     \\dimen@=\\pageheight 
\\advance\\dimen@ by-\\ht\\pa/
+ialpage        tex-src/texinfo.tex     /^  \\availdimen@=\\pageheight 
\\advance\\availdimen@ by/
+ialpage        tex-src/texinfo.tex     /^  \\dimen@=\\pageheight 
\\advance\\dimen@ by-\\ht\\parti/
+ialpage        tex-src/texinfo.tex     /^\\newbox\\partialpage$/
+ialpage=       tex-src/texinfo.tex     /^  
\\output={\\global\\setbox\\partialpage=$/
+identify_goal_type     merc-src/accumulator.m  /^:- pred 
identify_goal_type(pred_id::in, proc_id::i/
+identify_out_and_out_prime     merc-src/accumulator.m  /^:- pred 
identify_out_and_out_prime(module_info::in/
+identify_recursive_calls       merc-src/accumulator.m  /^:- pred 
identify_recursive_calls(pred_id::in, proc/
+idx    c-src/emacs/src/lisp.h  3150
+ignore_case    c-src/etags.c   266
+ignore_mouse_drag_p    c-src/emacs/src/keyboard.c      1256
+ill=\relax     tex-src/texinfo.tex     /^\\let\\refill=\\relax$/
+immediate_quit c-src/emacs/src/keyboard.c      174
+impatto        html-src/softwarelibero.html    /^Impatto pratico del software 
libero$/
+implementation merc-src/accumulator.m  /^:- implementation.$/
+in_word_set    c-src/etags.c   /^in_word_set (register const char *str, 
register un/
+inattribute    c-src/etags.c   2400
+inc    cp-src/Range.h  /^  double inc (void) const { return rng_inc;   }$/
+index  c-src/emacs/src/lisp.h  1856
+infabsdir      c-src/etags.c   206
+infabsname     c-src/etags.c   205
+infiles        make-src/Makefile       /^infiles = $(filter-out 
${NONSRCS},${SRCS}) srclist/
+infname        c-src/etags.c   204
+info   c-src/emacs/src/gmalloc.c       157
+infoPanel      objcpp-src/SimpleCalc.M /^- infoPanel:sender$/
+init   c-src/etags.c   /^init (void)$/
+init   objc-src/Subprocess.m   /^    andStdErr:(BOOL)wantsStdErr$/
+init   objc-src/Subprocess.m   /^- init:(const char *)subprocessString$/
+init   objcpp-src/SimpleCalc.M /^- init$/
+init_control   c.c     239
+init_kboard    c-src/emacs/src/keyboard.c      /^init_kboard (KBOARD *kb, 
Lisp_Object type)$/
+init_keyboard  c-src/emacs/src/keyboard.c      /^init_keyboard (void)$/
+init_registry  cp-src/clheir.cpp       /^void init_registry(void)$/
+init_tool_bar_items    c-src/emacs/src/keyboard.c      /^init_tool_bar_items 
(Lisp_Object reuse)$/
+inita  c.c     /^static void inita () {}$/
+initb  c.c     /^static void initb () {}$/
+initial_kboard c-src/emacs/src/keyboard.c      84
+initialize-new-tags-table      el-src/emacs/lisp/progmodes/etags.el    
/^(defun initialize-new-tags-table ()$/
+initialize_goal_store  merc-src/accumulator.m  /^:- func 
initialize_goal_store(list(hlds_goal), ins/
+initialize_random_junk y-src/cccp.y    /^initialize_random_junk ()$/
+input-pending-p        c-src/emacs/src/keyboard.c      /^DEFUN 
("input-pending-p", Finput_pending_p, Sinput/
+input_available_clear_time     c-src/emacs/src/keyboard.c      324
+input_pending  c-src/emacs/src/keyboard.c      239
+input_polling_used     c-src/emacs/src/keyboard.c      /^input_polling_used 
(void)$/
+input_was_pending      c-src/emacs/src/keyboard.c      287
+insert-abbrev-table-description        c-src/abbrev.c  /^DEFUN 
("insert-abbrev-table-description", Finsert_/
+insertion_type c-src/emacs/src/lisp.h  1989
+insertname     pas-src/common.pas      /^function insertname;(*($/
+instance_method        ruby-src/test.rb        /^        def instance_method$/
+instance_method_equals=        ruby-src/test.rb        /^        def 
instance_method_equals=$/
+instance_method_exclamation!   ruby-src/test.rb        /^        def 
instance_method_exclamation!$/
+instance_method_question?      ruby-src/test.rb        /^        def 
instance_method_question?$/
+instr  y-src/parse.y   81
+instruct       c-src/etags.c   2527
+int    merc-src/accumulator.m  /^:- import_module int.$/
+intNumber      go-src/test1.go 13
+integer        c-src/emacs/src/lisp.h  2127
+integer        y-src/cccp.y    112
+integer_overflow       y-src/cccp.y    /^integer_overflow ()$/
+integertonmstr pas-src/common.pas      /^function integertonmstr; (* 
(TheInteger : integer)/
+intensity1     f-src/entry.for /^     & 
intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+intensity1     f-src/entry.strange     /^     & 
intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+intensity1     f-src/entry.strange_suffix      /^     & 
intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+interface      merc-src/accumulator.m  /^:- interface.$/
+interface_locate       c-src/c.c       /^interface_locate(void)$/
+intern c-src/emacs/src/lisp.h  /^intern (const char *str)$/
+intern_c_string        c-src/emacs/src/lisp.h  /^intern_c_string (const char 
*str)$/
+internal_last_event_frame      c-src/emacs/src/keyboard.c      228
+interned       c-src/emacs/src/lisp.h  672
+interpreters   c-src/etags.c   197
+interrupt_input        c-src/emacs/src/keyboard.c      328
+interrupt_input_blocked        c-src/emacs/src/keyboard.c      76
+interrupt_input_blocked        c-src/emacs/src/lisp.h  3048
+interrupts_deferred    c-src/emacs/src/keyboard.c      331
+intoken        c-src/etags.c   /^#define       intoken(c)      (_itk[CHAR 
(c)]) \/* c can be in/
+intspec        c-src/emacs/src/lisp.h  1688
+intvar c-src/emacs/src/lisp.h  2277
+invalidate_nodes       c-src/etags.c   /^invalidate_nodes (fdesc *badfdp, node 
**npp)$/
+io     merc-src/accumulator.m  /^:- import_module io.$/
+ipc3dCSC19     cp-src/c.C      6
+ipc3dChannelType       cp-src/c.C      1
+ipc3dIslandHierarchy   cp-src/c.C      1
+ipc3dLinkControl       cp-src/c.C      1
+irregular_location     cp-src/clheir.hpp       /^    irregular_location(double 
xi, double yi, doubl/
+irregular_location     cp-src/clheir.hpp       47
+isComment      php-src/lce_functions.php       /^      function 
isComment($class)$/
+isHoliday      cp-src/functions.cpp    /^bool isHoliday ( Date d ){$/
+isLeap cp-src/functions.cpp    /^bool isLeap ( int year ){$/
+is_associative_construction    merc-src/accumulator.m  /^:- pred 
is_associative_construction(module_info::i/
+is_curly_brace_form    c-src/h.h       54
+is_explicit    c-src/h.h       49
+is_func        c-src/etags.c   221
+is_hor_space   y-src/cccp.y    953
+is_idchar      y-src/cccp.y    948
+is_idstart     y-src/cccp.y    950
+is_muldiv_operation    cp-src/c.C      /^is_muldiv_operation(pc)$/
+is_ordset      prol-src/ordsets.prolog /^is_ordset(X) :- var(X), !, fail.$/
+is_recursive_case      merc-src/accumulator.m  /^:- pred 
is_recursive_case(list(hlds_goal)::in, pre/
+iso_lispy_function_keys        c-src/emacs/src/keyboard.c      5151
+isoperator     prol-src/natded.prolog  /^isoperator(Char):-$/
+isoptab        prol-src/natded.prolog  /^isoptab('%').$/
+iswhite        c-src/etags.c   /^#define       iswhite(c)      (_wht[CHAR 
(c)]) \/* c is white /
+item_properties        c-src/emacs/src/keyboard.c      7568
+jmp    c-src/emacs/src/lisp.h  3044
+just_read_file c-src/etags.c   /^just_read_file (FILE *inf)$/
+kbd_buffer     c-src/emacs/src/keyboard.c      291
+kbd_buffer_events_waiting      c-src/emacs/src/keyboard.c      
/^kbd_buffer_events_waiting (void)$/
+kbd_buffer_get_event   c-src/emacs/src/keyboard.c      /^kbd_buffer_get_event 
(KBOARD **kbp,$/
+kbd_buffer_nr_stored   c-src/emacs/src/keyboard.c      /^kbd_buffer_nr_stored 
(void)$/
+kbd_buffer_store_event c-src/emacs/src/keyboard.c      
/^kbd_buffer_store_event (register struct input_even/
+kbd_buffer_store_event_hold    c-src/emacs/src/keyboard.c      
/^kbd_buffer_store_event_hold (register struct input/
+kbd_buffer_store_help_event    c-src/emacs/src/keyboard.c      
/^kbd_buffer_store_help_event (Lisp_Object frame, Li/
+kbd_buffer_unget_event c-src/emacs/src/keyboard.c      
/^kbd_buffer_unget_event (register struct input_even/
+kbd_fetch_ptr  c-src/emacs/src/keyboard.c      297
+kbd_store_ptr  c-src/emacs/src/keyboard.c      302
+kboard c-src/emacs/src/keyboard.c      860
+kboard_stack   c-src/emacs/src/keyboard.c      858
+kboard_stack   c-src/emacs/src/keyboard.c      864
+key_and_value  c-src/emacs/src/lisp.h  1868
+keyremap       c-src/emacs/src/keyboard.c      8742
+keyremap       c-src/emacs/src/keyboard.c      8754
+keyremap_step  c-src/emacs/src/keyboard.c      /^keyremap_step (Lisp_Object 
*keybuf, int bufsize, v/
+keys_of_keyboard       c-src/emacs/src/keyboard.c      /^keys_of_keyboard 
(void)$/
+keyval prol-src/natded.prolog  /^keyval(key(Key,Val)) --> [Key,'='], 
valseq(Val).$/
+keyvalcgi      prol-src/natded.prolog  /^keyvalcgi(Key,Val):-$/
+keyvalscgi     prol-src/natded.prolog  /^keyvalscgi(KeyVals),$/
+keyvalseq      prol-src/natded.prolog  /^keyvalseq([KeyVal|KeyVals]) --> $/
+keyword_parsing        y-src/cccp.y    73
+keywords       y-src/cccp.y    114
+keywords       y-src/cccp.y    306
+kind   c-src/emacs/src/keyboard.c      11024
+kind   c-src/h.h       46
+kset_echo_string       c-src/emacs/src/keyboard.c      /^kset_echo_string 
(struct kboard *kb, Lisp_Object v/
+kset_kbd_queue c-src/emacs/src/keyboard.c      /^kset_kbd_queue (struct kboard 
*kb, Lisp_Object val/
+kset_keyboard_translate_table  c-src/emacs/src/keyboard.c      
/^kset_keyboard_translate_table (struct kboard *kb, /
+kset_last_prefix_arg   c-src/emacs/src/keyboard.c      /^kset_last_prefix_arg 
(struct kboard *kb, Lisp_Obje/
+kset_last_repeatable_command   c-src/emacs/src/keyboard.c      
/^kset_last_repeatable_command (struct kboard *kb, L/
+kset_local_function_key_map    c-src/emacs/src/keyboard.c      
/^kset_local_function_key_map (struct kboard *kb, Li/
+kset_overriding_terminal_local_map     c-src/emacs/src/keyboard.c      
/^kset_overriding_terminal_local_map (struct kboard /
+kset_real_last_command c-src/emacs/src/keyboard.c      
/^kset_real_last_command (struct kboard *kb, Lisp_Ob/
+kset_system_key_syms   c-src/emacs/src/keyboard.c      /^kset_system_key_syms 
(struct kboard *kb, Lisp_Obje/
+lang   c-src/etags.c   208
+lang   c-src/etags.c   251
+lang   c-src/etags.c   259
+lang_names     c-src/etags.c   718
+language       c-src/etags.c   199
+last-tag       el-src/emacs/lisp/progmodes/etags.el    /^(defvar last-tag nil$/
+last_abbrev_point      c-src/abbrev.c  79
+last_auto_save c-src/emacs/src/keyboard.c      214
+last_heapinfo  c-src/emacs/src/gmalloc.c       402
+last_mouse_button      c-src/emacs/src/keyboard.c      5215
+last_mouse_x   c-src/emacs/src/keyboard.c      5216
+last_mouse_y   c-src/emacs/src/keyboard.c      5217
+last_non_minibuf_size  c-src/emacs/src/keyboard.c      207
+last_point_position    c-src/emacs/src/keyboard.c      217
+last_state_size        c-src/emacs/src/gmalloc.c       401
+last_undo_boundary     c-src/emacs/src/keyboard.c      1287
+lasta  c.c     272
+lastargmargin  tex-src/texinfo.tex     /^\\newskip\\deflastargmargin 
\\deflastargmargin=18pt$/
+lastargmargin  tex-src/texinfo.tex     /^\\setbox0=\\hbox{\\hskip 
\\deflastargmargin{\\rm #2}\\hs/
+lastb  c.c     278
+lb     c-src/etags.c   2923
+lbs    c-src/etags.c   2924
+lce    php-src/lce_functions.php       /^      function lce()$/
+lce_bindtextdomain     php-src/lce_functions.php       /^      function 
lce_bindtextdomain($d_name, $d_path/
+lce_bindtextdomain     php-src/lce_functions.php       /^      function 
lce_bindtextdomain($domain, $path)$/
+lce_dgettext   php-src/lce_functions.php       /^      function 
lce_dgettext($domain, $msgid)$/
+lce_geteditcode        php-src/lce_functions.php       /^  function 
lce_geteditcode($type, $name, $text, $r/
+lce_gettext    php-src/lce_functions.php       /^      function 
lce_gettext($msgid)$/
+lce_textdomain php-src/lce_functions.php       /^      function 
lce_textdomain($domain)$/
+leasqr html-src/software.html  /^Leasqr$/
+left   c-src/etags.c   216
+left_shift     y-src/cccp.y    /^left_shift (a, b)$/
+len    c-src/etags.c   237
+length c-src/etags.c   2495
+length y-src/cccp.y    113
+length y-src/cccp.y    44
+let    c-src/emacs/src/lisp.h  2981
+letter tex-src/texinfo.tex     /^  {#1}{Appendix 
\\appendixletter}{\\noexpand\\folio}}/
+letter tex-src/texinfo.tex     /^  {\\appendixletter}$/
+letter tex-src/texinfo.tex     /^  
{\\appendixletter}{\\the\\secno}{\\the\\subsecno}{\\th/
+letter tex-src/texinfo.tex     /^\\chapmacro {#1}{Appendix \\appendixletter}%$/
+letter tex-src/texinfo.tex     /^\\gdef\\thissection{#1}\\secheading 
{#1}{\\appendixlet/
+letter tex-src/texinfo.tex     /^\\subsecheading 
{#1}{\\appendixletter}{\\the\\secno}{\\/
+letter tex-src/texinfo.tex     
/^{#1}{\\appendixletter}{\\the\\secno}{\\noexpand\\folio}/
+letter tex-src/texinfo.tex     
/^{#1}{\\appendixletter}{\\the\\secno}{\\the\\subsecno}{\\/
+letter:        tex-src/texinfo.tex     /^\\xdef\\thischapter{Appendix 
\\appendixletter: \\noexp/
+level  c-src/emacs/src/lisp.h  3153
+lex    prol-src/natded.prolog  /^lex(W,SynOut,Sem):-$/
+lexptr y-src/cccp.y    332
+libs   merc-src/accumulator.m  /^:- import_module libs.$/
+licenze        html-src/softwarelibero.html    /^Licenze d'uso di un 
programma$/
+limit  cp-src/Range.h  /^  double limit (void) const { return rng_limit; }$/
+line   c-src/etags.c   2493
+line   perl-src/htlmify-cystic 37
+line   y-src/parse.y   87
+lineCount      php-src/lce_functions.php       /^      function 
lineCount($entry)$/
+linebuffer     c-src/etags.c   239
+linebuffer_init        c-src/etags.c   /^linebuffer_init (linebuffer *lbp)$/
+linebuffer_setlen      c-src/etags.c   /^linebuffer_setlen (linebuffer *lbp, 
int toksize)$/
+lineno c-src/emacs/src/lisp.h  3147
+lineno c-src/etags.c   2506
+linepos        c-src/etags.c   2507
+linepos        c-src/etags.c   2922
+links  html-src/software.html  /^Links to interesting software$/
+lisp_eval_depth        c-src/emacs/src/lisp.h  3045
+lisp_h_CHECK_LIST_CONS c-src/emacs/src/lisp.h  /^#define 
lisp_h_CHECK_LIST_CONS(x, y) CHECK_TYPE (C/
+lisp_h_CHECK_NUMBER    c-src/emacs/src/lisp.h  /^#define 
lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGER/
+lisp_h_CHECK_SYMBOL    c-src/emacs/src/lisp.h  /^#define 
lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP/
+lisp_h_CHECK_TYPE      c-src/emacs/src/lisp.h  /^#define lisp_h_CHECK_TYPE(ok, 
predicate, x) \\$/
+lisp_h_CONSP   c-src/emacs/src/lisp.h  /^#define lisp_h_CONSP(x) (XTYPE (x) == 
Lisp_Cons)$/
+lisp_h_EQ      c-src/emacs/src/lisp.h  /^#define lisp_h_EQ(x, y) (XLI (x) == 
XLI (y))$/
+lisp_h_FLOATP  c-src/emacs/src/lisp.h  /^#define lisp_h_FLOATP(x) (XTYPE (x) 
== Lisp_Float)/
+lisp_h_INTEGERP        c-src/emacs/src/lisp.h  /^#define lisp_h_INTEGERP(x) 
((XTYPE (x) & (Lisp_Int/
+lisp_h_MARKERP c-src/emacs/src/lisp.h  /^#define lisp_h_MARKERP(x) (MISCP (x) 
&& XMISCTYPE /
+lisp_h_MISCP   c-src/emacs/src/lisp.h  /^#define lisp_h_MISCP(x) (XTYPE (x) == 
Lisp_Misc)$/
+lisp_h_NILP    c-src/emacs/src/lisp.h  /^#define lisp_h_NILP(x) EQ (x, Qnil)$/
+lisp_h_SET_SYMBOL_VAL  c-src/emacs/src/lisp.h  /^#define 
lisp_h_SET_SYMBOL_VAL(sym, v) \\$/
+lisp_h_SYMBOLP c-src/emacs/src/lisp.h  /^#define lisp_h_SYMBOLP(x) (XTYPE (x) 
== Lisp_Symbo/
+lisp_h_SYMBOL_CONSTANT_P       c-src/emacs/src/lisp.h  /^#define 
lisp_h_SYMBOL_CONSTANT_P(sym) (XSYMBOL (sy/
+lisp_h_SYMBOL_VAL      c-src/emacs/src/lisp.h  /^#define 
lisp_h_SYMBOL_VAL(sym) \\$/
+lisp_h_VECTORLIKEP     c-src/emacs/src/lisp.h  /^#define lisp_h_VECTORLIKEP(x) 
(XTYPE (x) == Lisp_V/
+lisp_h_XCAR    c-src/emacs/src/lisp.h  /^#define lisp_h_XCAR(c) XCONS 
(c)->car$/
+lisp_h_XCDR    c-src/emacs/src/lisp.h  /^#define lisp_h_XCDR(c) XCONS 
(c)->u.cdr$/
+lisp_h_XCONS   c-src/emacs/src/lisp.h  /^#define lisp_h_XCONS(a) \\$/
+lisp_h_XFASTINT        c-src/emacs/src/lisp.h  /^# define lisp_h_XFASTINT(a) 
XINT (a)$/
+lisp_h_XHASH   c-src/emacs/src/lisp.h  /^#define lisp_h_XHASH(a) XUINT (a)$/
+lisp_h_XIL     c-src/emacs/src/lisp.h  /^# define lisp_h_XIL(i) ((Lisp_Object) 
{ i })$/
+lisp_h_XIL     c-src/emacs/src/lisp.h  /^# define lisp_h_XIL(i) (i)$/
+lisp_h_XINT    c-src/emacs/src/lisp.h  /^# define lisp_h_XINT(a) (XLI (a) >> 
INTTYPEBITS)$/
+lisp_h_XLI     c-src/emacs/src/lisp.h  /^# define lisp_h_XLI(o) ((o).i)$/
+lisp_h_XLI     c-src/emacs/src/lisp.h  /^# define lisp_h_XLI(o) (o)$/
+lisp_h_XPNTR   c-src/emacs/src/lisp.h  /^#define lisp_h_XPNTR(a) \\$/
+lisp_h_XSYMBOL c-src/emacs/src/lisp.h  /^# define lisp_h_XSYMBOL(a) \\$/
+lisp_h_XTYPE   c-src/emacs/src/lisp.h  /^# define lisp_h_XTYPE(a) ((enum 
Lisp_Type) (XLI (a/
+lisp_h_XUNTAG  c-src/emacs/src/lisp.h  /^# define lisp_h_XUNTAG(a, type) 
((void *) (intptr_/
+lisp_h_check_cons_list c-src/emacs/src/lisp.h  /^# define 
lisp_h_check_cons_list() ((void) 0)$/
+lisp_h_make_number     c-src/emacs/src/lisp.h  /^# define 
lisp_h_make_number(n) \\$/
+lispy_accent_codes     c-src/emacs/src/keyboard.c      4634
+lispy_accent_keys      c-src/emacs/src/keyboard.c      4741
+lispy_drag_n_drop_names        c-src/emacs/src/keyboard.c      5181
+lispy_function_keys    c-src/emacs/src/keyboard.c      4768
+lispy_function_keys    c-src/emacs/src/keyboard.c      5065
+lispy_kana_keys        c-src/emacs/src/keyboard.c      5026
+lispy_modifier_list    c-src/emacs/src/keyboard.c      /^lispy_modifier_list 
(int modifiers)$/
+lispy_multimedia_keys  c-src/emacs/src/keyboard.c      4962
+lispy_wheel_names      c-src/emacs/src/keyboard.c      5174
+list   c-src/emacs/src/gmalloc.c       186
+list   merc-src/accumulator.m  /^:- import_module list.$/
+list-tags      el-src/emacs/lisp/progmodes/etags.el    /^(defun list-tags 
(file &optional _next-match)$/
+list-tags-function     el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
list-tags-function nil$/
+list2i c-src/emacs/src/lisp.h  /^list2i (EMACS_INT x, EMACS_INT y)$/
+list3i c-src/emacs/src/lisp.h  /^list3i (EMACS_INT x, EMACS_INT y, EMACS_INT 
w)$/
+list4i c-src/emacs/src/lisp.h  /^list4i (EMACS_INT x, EMACS_INT y, EMACS_INT 
w, EMA/
+list_to_ord_set        prol-src/ordsets.prolog /^list_to_ord_set(List, Set) 
:-$/
+lno    c-src/etags.c   223
+load   objc-src/PackInsp.m     /^-load$/
+loadContentsOf objc-src/PackInsp.m     /^-loadContentsOf:(const char *)type 
inTable:(HashTa/
+loadImage      objc-src/PackInsp.m     /^-loadImage$/
+loadKeyValuesFrom      objc-src/PackInsp.m     /^-loadKeyValuesFrom:(const 
char *)type inTable:(Has/
+loadPORManager php-src/lce_functions.php       /^  function &loadPORManager()$/
+local_if_set   c-src/emacs/src/lisp.h  2338
+location       cp-src/clheir.hpp       /^    location() { }$/
+location       cp-src/clheir.hpp       33
+lookup y-src/cccp.y    /^lookup (name, len, hash)$/
+lookup_call    merc-src/accumulator.m  /^:- pred 
lookup_call(accu_goal_store::in, accu_goal/
+lowcase        c-src/etags.c   /^#define lowcase(c)    tolower (CHAR (c))$/
+lucid_event_type_list_p        c-src/emacs/src/keyboard.c      
/^lucid_event_type_list_p (Lisp_Object object)$/
+mabort c-src/emacs/src/gmalloc.c       /^mabort (enum mcheck_status status)$/
+mach_host_self c-src/machsyscalls.h    /^SYSCALL (mach_host_self, -29,$/
+mach_msg_trap  c-src/machsyscalls.h    /^SYSCALL (mach_msg_trap, -25,$/
+mach_reply_port        c-src/machsyscalls.h    /^SYSCALL (mach_reply_port, 
-26,$/
+mach_task_self c-src/machsyscalls.h    /^SYSCALL (mach_task_self, -28,$/
+mach_thread_self       c-src/machsyscalls.h    /^SYSCALL (mach_thread_self, 
-27,$/
+magic  c-src/emacs/src/gmalloc.c       1863
+maintaining.info       make-src/Makefile       /^maintaining.info: 
maintaining.texi$/
+make-abbrev-table      c-src/abbrev.c  /^DEFUN ("make-abbrev-table", 
Fmake_abbrev_table, Sm/
+make_C_tag     c-src/etags.c   /^make_C_tag (bool isfun)$/
+make_coor      prol-src/natded.prolog  
/^make_coor(s(_),Alpha,Sem1,Sem2,Alpha@Sem1@Sem2).$/
+make_ctrl_char c-src/emacs/src/keyboard.c      /^make_ctrl_char (int c)$/
+make_fixnum_or_float   c-src/emacs/src/lisp.h  /^#define 
make_fixnum_or_float(val) \\$/
+make_formatted_string  c-src/emacs/src/lisp.h  /^extern Lisp_Object 
make_formatted_string (char *, /
+make_lisp_ptr  c-src/emacs/src/lisp.h  /^make_lisp_ptr (void *ptr, enum 
Lisp_Type type)$/
+make_lisp_symbol       c-src/emacs/src/lisp.h  /^make_lisp_symbol (struct 
Lisp_Symbol *sym)$/
+make_lispy_event       c-src/emacs/src/keyboard.c      /^make_lispy_event 
(struct input_event *event)$/
+make_lispy_focus_in    c-src/emacs/src/keyboard.c      /^make_lispy_focus_in 
(Lisp_Object frame)$/
+make_lispy_focus_out   c-src/emacs/src/keyboard.c      /^make_lispy_focus_out 
(Lisp_Object frame)$/
+make_lispy_movement    c-src/emacs/src/keyboard.c      /^make_lispy_movement 
(struct frame *frame, Lisp_Obj/
+make_lispy_position    c-src/emacs/src/keyboard.c      /^make_lispy_position 
(struct frame *f, Lisp_Object /
+make_lispy_switch_frame        c-src/emacs/src/keyboard.c      
/^make_lispy_switch_frame (Lisp_Object frame)$/
+make_number    c-src/emacs/src/lisp.h  /^#  define make_number(n) 
lisp_h_make_number (n)$/
+make_pointer_integer   c-src/emacs/src/lisp.h  /^make_pointer_integer (void 
*p)$/
+make_scroll_bar_position       c-src/emacs/src/keyboard.c      
/^make_scroll_bar_position (struct input_event *ev, /
+make_tag       c-src/etags.c   /^make_tag (const char *name,   \/* tag name, 
or NULL /
+make_uninit_sub_char_table     c-src/emacs/src/lisp.h  
/^make_uninit_sub_char_table (int depth, int min_cha/
+make_uninit_vector     c-src/emacs/src/lisp.h  /^make_uninit_vector (ptrdiff_t 
size)$/
+malloc c-src/emacs/src/gmalloc.c       /^extern void *malloc (size_t size) 
ATTRIBUTE_MALLOC/
+malloc c-src/emacs/src/gmalloc.c       /^malloc (size_t size)$/
+malloc c-src/emacs/src/gmalloc.c       1715
+malloc c-src/emacs/src/gmalloc.c       64
+malloc c-src/emacs/src/gmalloc.c       68
+malloc_atfork_handler_child    c-src/emacs/src/gmalloc.c       
/^malloc_atfork_handler_child (void)$/
+malloc_atfork_handler_parent   c-src/emacs/src/gmalloc.c       
/^malloc_atfork_handler_parent (void)$/
+malloc_atfork_handler_prepare  c-src/emacs/src/gmalloc.c       
/^malloc_atfork_handler_prepare (void)$/
+malloc_enable_thread   c-src/emacs/src/gmalloc.c       /^malloc_enable_thread 
(void)$/
+malloc_info    c-src/emacs/src/gmalloc.c       167
+malloc_initialize_1    c-src/emacs/src/gmalloc.c       /^malloc_initialize_1 
(void)$/
+mallochook     c-src/emacs/src/gmalloc.c       /^mallochook (size_t size)$/
+man manpage    make-src/Makefile       /^man manpage: etags.1.man$/
+mao    c-src/h.h       101
+map    c-src/emacs/src/keyboard.c      8748
+map    merc-src/accumulator.m  /^:- import_module map.$/
+map_word       prol-src/natded.prolog  /^map_word([[_]|Ws],Exp):-$/
+mapping        html-src/algrthms.html  /^Mapping the Channel Symbols$/
+mapsyn prol-src/natded.prolog  /^mapsyn(A\/B,AM\/BM):-$/
+mark_kboards   c-src/emacs/src/keyboard.c      /^mark_kboards (void)$/
+max    c-src/emacs/src/lisp.h  /^#define max(a, b) ((a) > (b) ? (a) : (b))$/
+max    c-src/emacs/src/lisp.h  58
+max    c.c     /^__attribute__ ((always_inline)) max (int a, int b)/
+max    c.c     /^max (int a, int b)$/
+max    cp-src/conway.cpp       /^#define max(x,y)  ((x > y) ? x : y)$/
+max_args       c-src/emacs/src/lisp.h  1686
+max_num_directions     cp-src/clheir.hpp       31
+max_num_generic_objects        cp-src/clheir.cpp       9
+maxargs        c-src/emacs/src/lisp.h  2831
+maybe  merc-src/accumulator.m  /^:- import_module maybe.$/
+maybe_gc       c-src/emacs/src/lisp.h  /^maybe_gc (void)$/
+mcCSC  cp-src/c.C      6
+mcheck c-src/emacs/src/gmalloc.c       /^mcheck (void (*func) (enum 
mcheck_status))$/
+mcheck_status  c-src/emacs/src/gmalloc.c       283
+mcheck_used    c-src/emacs/src/gmalloc.c       2012
+mdbcomp        merc-src/accumulator.m  /^:- import_module mdbcomp.$/
+me22b  lua-src/test.lua        /^   local function test.me22b (one)$/
+me_22a lua-src/test.lua        /^   function test.me_22a(one, two)$/
+memalign       c-src/emacs/src/gmalloc.c       /^memalign (size_t alignment, 
size_t size)$/
+member prol-src/natded.prolog  /^member(X,[X|_]).$/
+member_lessthan_goalid merc-src/accumulator.m  /^:- pred 
member_lessthan_goalid(accu_goal_store::in/
+memclear       c-src/emacs/src/lisp.h  /^memclear (void *p, ptrdiff_t nbytes)$/
+menu_bar_item  c-src/emacs/src/keyboard.c      /^menu_bar_item (Lisp_Object 
key, Lisp_Object item, /
+menu_bar_items c-src/emacs/src/keyboard.c      /^menu_bar_items (Lisp_Object 
old)$/
+menu_bar_items_index   c-src/emacs/src/keyboard.c      7369
+menu_bar_items_vector  c-src/emacs/src/keyboard.c      7368
+menu_bar_one_keymap_changed_items      c-src/emacs/src/keyboard.c      7363
+menu_item_eval_property        c-src/emacs/src/keyboard.c      
/^menu_item_eval_property (Lisp_Object sexpr)$/
+menu_item_eval_property_1      c-src/emacs/src/keyboard.c      
/^menu_item_eval_property_1 (Lisp_Object arg)$/
+menu_separator_name_p  c-src/emacs/src/keyboard.c      /^menu_separator_name_p 
(const char *label)$/
+metasource     c-src/etags.c   198
+min    c-src/emacs/src/gmalloc.c       /^#define min(a, b) ((a) < (b) ? (a) : 
(b))$/
+min    c-src/emacs/src/lisp.h  /^#define min(a, b) ((a) < (b) ? (a) : (b))$/
+min    c-src/emacs/src/lisp.h  57
+min    cp-src/conway.cpp       /^#define min(x,y)  ((x > y) ? y : x)$/
+min_args       c-src/emacs/src/lisp.h  1686
+min_char       c-src/emacs/src/lisp.h  1621
+minus  cp-src/functions.cpp    /^void Date::minus ( int days , int month , int 
year/
+miti   html-src/softwarelibero.html    /^Sfatiamo alcuni miti$/
+modifier_names c-src/emacs/src/keyboard.c      6319
+modifier_symbols       c-src/emacs/src/keyboard.c      6327
+modify_event_symbol    c-src/emacs/src/keyboard.c      /^modify_event_symbol 
(ptrdiff_t symbol_num, int mod/
+module_class_method    ruby-src/test.rb        /^    def 
ModuleExample.module_class_method$/
+module_instance_method ruby-src/test.rb        /^    def 
module_instance_method$/
+more=  ruby-src/test1.ru       /^                :more$/
+more_aligned_int       c.c     165
+morecore_nolock        c-src/emacs/src/gmalloc.c       /^morecore_nolock 
(size_t size)$/
+morecore_recursing     c-src/emacs/src/gmalloc.c       604
+mouse_syms     c-src/emacs/src/keyboard.c      4627
+move   cp-src/clheir.cpp       /^void agent::move(int direction)$/
+mprobe c-src/emacs/src/gmalloc.c       /^mprobe (void *ptr)$/
+msgid  php-src/lce_functions.php       /^      function msgid($line, $class)$/
+msgstr php-src/lce_functions.php       /^      function msgstr($line, $class)$/
+mstats c-src/emacs/src/gmalloc.c       308
+mt     prol-src/natded.prolog  /^mt:-$/
+mtg    html-src/software.html  /^MTG$/
+multi_line     c-src/etags.c   267
+multibyte      c-src/emacs/src/regex.h 403
+my_printf      c.c     /^my_printf (void *my_object, const char *my_format,/
+my_struct      c-src/h.h       91
+my_struct      c.c     226
+my_typedef     c-src/h.h       93
+my_typedef     c.c     228
+mypi   forth-src/test-forth.fth        /^synonym mypi fconst$/
+n      c-src/exit.c    28
+n      c-src/exit.strange_suffix       28
+name   c-src/emacs/src/keyboard.c      7241
+name   c-src/emacs/src/lisp.h  1808
+name   c-src/emacs/src/lisp.h  3144
+name   c-src/emacs/src/lisp.h  682
+name   c-src/etags.c   192
+name   c-src/etags.c   218
+name   c-src/etags.c   2271
+name   c-src/etags.c   261
+name   c-src/getopt.h  76
+name   c-src/getopt.h  78
+name   perl-src/htlmify-cystic 357
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#1}{Function}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#1}{Macro}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#1}{Special Form}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#1}{User Option}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#1}{Variable}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname 
{#2}{#1}\\deftpargs{#3}\\endgrou/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname 
{#2}{#1}\\defunargs{#3}\\endgrou/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname 
{#2}{#1}\\defvarargs{#3}\\endgro/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#2}{Instance Variable 
of #1}%/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#2}{Method on #1}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#2}{\\defcvtype{} of 
#1}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#2}{\\defoptype{} on 
#1}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {\\code{#1} 
#2}{Function}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {\\code{#1} 
#2}{Variable}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {\\code{#2} #3}{#1}$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {\\code{#2} #3}{#1}%$/
+name   y-src/cccp.y    113
+name   y-src/cccp.y    43
+named  c-src/etags.c   2505
+namestringequal        pas-src/common.pas      /^function 
namestringequal;(*(var Name1,Name2 : Name/
+nargs  c-src/emacs/src/lisp.h  2987
+need_adjustment        c-src/emacs/src/lisp.h  1986
+neighbors      cp-src/clheir.hpp       59
+nelem  cp-src/Range.h  /^  int nelem (void) const { return rng_nelem; }$/
+nestlev        c-src/etags.c   2525
+new    objc-src/PackInsp.m     /^+new$/
+new    perl-src/htlmify-cystic 163
+new_tag        perl-src/htlmify-cystic 18
+newlb  c-src/etags.c   2930
+newlinepos     c-src/etags.c   2932
+newtextstring  pas-src/common.pas      /^function newtextstring; (*: 
TextString;*)$/
+next   c-src/emacs/src/gmalloc.c       164
+next   c-src/emacs/src/gmalloc.c       188
+next   c-src/emacs/src/gmalloc.c       198
+next   c-src/emacs/src/keyboard.c      7246
+next   c-src/emacs/src/keyboard.c      861
+next   c-src/emacs/src/lisp.h  1848
+next   c-src/emacs/src/lisp.h  2009
+next   c-src/emacs/src/lisp.h  2037
+next   c-src/emacs/src/lisp.h  2192
+next   c-src/emacs/src/lisp.h  3028
+next   c-src/emacs/src/lisp.h  3134
+next   c-src/emacs/src/lisp.h  700
+next   c-src/etags.c   203
+next   c.c     174
+next   y-src/cccp.y    42
+next-file      el-src/emacs/lisp/progmodes/etags.el    /^(defun next-file 
(&optional initialize novisit)$/
+next-file-list el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
next-file-list nil$/
+next_alive     cp-src/conway.hpp       7
+next_almost_prime      c-src/emacs/src/lisp.h  /^extern EMACS_INT 
next_almost_prime (EMACS_INT) ATT/
+next_free      c-src/emacs/src/lisp.h  1851
+next_weak      c-src/emacs/src/lisp.h  1875
+nextfree       c-src/emacs/src/lisp.h  3029
+nfree  c-src/emacs/src/gmalloc.c       150
+nl     c-src/etags.c   2521
+no     tex-src/texinfo.tex     /^\\global\\advance \\appendixno by 1 
\\message{Appendix/
+no     tex-src/texinfo.tex     /^\\ifnum\\secno=0 
Appendix\\xreftie'char\\the\\appendixn/
+no     tex-src/texinfo.tex     /^\\newcount \\appendixno  \\appendixno = `\\@$/
+no.\the\secno  tex-src/texinfo.tex     /^\\else \\ifnum \\subsecno=0 
Section\\xreftie'char\\the\\/
+no.\the\secno.\the\subsecno    tex-src/texinfo.tex     
/^Section\\xreftie'char\\the\\appendixno.\\the\\secno.\\th/
+no.\the\secno.\the\subsecno.\the\subsubsecno   tex-src/texinfo.tex     
/^Section\\xreftie'char\\the\\appendixno.\\the\\secno.\\th/
+no_argument    c-src/getopt.h  89
+no_lang_help   c-src/etags.c   707
+no_sub c-src/emacs/src/regex.h 387
+nocase_tail    c-src/etags.c   /^nocase_tail (const char *cp)$/
+node   c-src/etags.c   225
+node_st        c-src/etags.c   214
+noderef        tex-src/texinfo.tex     /^\\appendixnoderef %$/
+nofonts        tex-src/texinfo.tex     /^{\\indexnofonts$/
+nofonts%       tex-src/texinfo.tex     /^{\\chapternofonts%$/
+none_help      c-src/etags.c   703
+normalize      prol-src/natded.prolog  /^normalize(M,MNorm):-$/
+normalize_fresh        prol-src/natded.prolog  /^normalize_fresh(M,N):-$/
+normalize_tree prol-src/natded.prolog  
/^normalize_tree(tree(Rule,Syn:Sem,Trees),$/
+normalize_trees        prol-src/natded.prolog  /^normalize_trees([],[]).$/
+nosave pyt-src/server.py       /^    def nosave(self):$/
+not_bol        c-src/emacs/src/regex.h 391
+not_eol        c-src/emacs/src/regex.h 394
+not_single_kboard_state        c-src/emacs/src/keyboard.c      
/^not_single_kboard_state (KBOARD *kboard)$/
+notag2 c-src/dostorture.c      26
+notag2 c-src/torture.c 26
+notag4 c-src/dostorture.c      45
+notag4 c-src/torture.c 45
+notinname      c-src/etags.c   /^#define notinname(c)  (_nin[CHAR (c)]) \/* c 
is not /
+npending       c-src/emacs/src/keyboard.c      7244
+ntool_bar_items        c-src/emacs/src/keyboard.c      7974
+numOfChannels  cp-src/c.C      1
+num_columns    cp-src/conway.cpp       16
+num_input_events       c-src/emacs/src/keyboard.c      210
+num_regs       c-src/emacs/src/regex.h 430
+num_rows       cp-src/conway.cpp       15
+numberKeys     objcpp-src/SimpleCalc.M /^- numberKeys:sender$/
+number_len     c-src/etags.c   /^static int number_len (long) 
ATTRIBUTE_CONST;$/
+numbervars     prol-src/natded.prolog  /^numbervars(X):-$/
+nvars  c-src/emacs/src/lisp.h  3140
+objdef c-src/etags.c   2484
+object c-src/emacs/src/lisp.h  2128
+object_registry        cp-src/clheir.cpp       10
+objtag c-src/etags.c   2453
+objvar c-src/emacs/src/lisp.h  2297
+obstack_chunk_alloc    y-src/parse.y   47
+obstack_chunk_free     y-src/parse.y   48
+ocatseen       c-src/etags.c   2477
+octave_MDiagArray2_h   cp-src/MDiagArray2.h    29
+octave_Range_h cp-src/Range.h  24
+oediff make-src/Makefile       /^oediff: OTAGS ETAGS ${infiles}$/
+offset c-src/emacs/src/lisp.h  2305
+offset c-src/emacs/src/lisp.h  2365
+offset c-src/etags.c   2494
+oignore        c-src/etags.c   2483
+oimplementation        c-src/etags.c   2474
+oinbody        c-src/etags.c   2478
+ok     objc-src/PackInsp.m     /^-ok:sender$/
+ok_to_echo_at_next_pause       c-src/emacs/src/keyboard.c      159
+old_value      c-src/emacs/src/lisp.h  2980
+omethodcolon   c-src/etags.c   2481
+omethodparm    c-src/etags.c   2482
+omethodsign    c-src/etags.c   2479
+omethodtag     c-src/etags.c   2480
+onone  c-src/etags.c   2472
+oparenseen     c-src/etags.c   2476
+open   objc-src/PackInsp.m     /^-open:sender$/
+open-dribble-file      c-src/emacs/src/keyboard.c      /^DEFUN 
("open-dribble-file", Fopen_dribble_file, So/
+openInWorkspace        objc-src/PackInsp.m     /^static void 
openInWorkspace(const char *filename)$/
+operationKeys  objcpp-src/SimpleCalc.M /^- operationKeys:sender$/
+operator       y-src/cccp.y    438
+operator ++    cp-src/functions.cpp    /^Date & Date::operator ++ ( void ){$/
+operator +=    cp-src/functions.cpp    /^Date & Date::operator += ( int days 
){$/
+operator -     cp-src/c.C      /^void operator -(int, int) {}$/
+operator -     cp-src/functions.cpp    /^int Date::operator - ( Date d ){$/
+operator --    cp-src/functions.cpp    /^Date & Date::operator -- ( void ){$/
+operator -=    cp-src/functions.cpp    /^Date & Date::operator -= ( int days 
){$/
+operator <     cp-src/functions.cpp    /^int Date::operator < ( Date d ) {$/
+operator <<    cp-src/functions.cpp    /^ostream& operator <<  ( ostream &c, 
Date d ) {$/
+operator =     cp-src/MDiagArray2.h    /^  MDiagArray2<T>& operator = (const 
MDiagArray2<T>/
+operator =     cp-src/functions.cpp    /^Date & Date::operator = ( Date d ){$/
+operator ==    cp-src/functions.cpp    /^int Date::operator == ( Date d ) {$/
+operator >     cp-src/functions.cpp    /^int Date::operator > ( Date d ) {$/
+operator >>    cp-src/functions.cpp    /^istream& operator >> ( istream &i, 
Date & dd ){$/
+operator MArray2<T>    cp-src/MDiagArray2.h    /^  operator MArray2<T> () 
const$/
+operator int   cp-src/c.C      /^void operator int(int, int) {}$/
+operator int   cp-src/fail.C   /^                         operator int() const 
{return x;}$/
+operator+      cp-src/c.C      /^  A operator+(A& a) {};$/
+operator+      cp-src/c.C      /^const A& A::operator+(const A&) { }$/
+operator+      cp-src/c.C      /^void operator+(int, int) {}$/
+opparsebody\Edefop\defopx\defopheader\defoptype        tex-src/texinfo.tex     
/^\\defopparsebody\\Edefop\\defopx\\defopheader\\defoptyp/
+oprotocol      c-src/etags.c   2473
+option c-src/getopt.h  73
+optional_argument      c-src/getopt.h  91
+opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype   tex-src/texinfo.tex     
/^\\defopvarparsebody\\Edefcv\\defcvx\\defcvarheader\\def/
+ord_add_element        prol-src/ordsets.prolog /^ord_add_element([], Element, 
[Element]).$/
+ord_del_element        prol-src/ordsets.prolog /^ord_del_element([], _, []).$/
+ord_disjoint   prol-src/ordsets.prolog /^ord_disjoint(Set1, Set2) :-$/
+ord_intersect  prol-src/ordsets.prolog /^ord_intersect([Head1|Tail1], 
[Head2|Tail2]) :-$/
+ord_intersection       prol-src/ordsets.prolog /^ord_intersection(Sets, 
Intersection) :- $/
+ord_intersection       prol-src/ordsets.prolog /^ord_intersection([], Set2, 
[], Set2).$/
+ord_intersection       prol-src/ordsets.prolog /^ord_intersection([], _, []).$/
+ord_intersection2      prol-src/ordsets.prolog /^ord_intersection2(1, 
[Set|Sets], Set0, Sets0) :- !/
+ord_intersection3      prol-src/ordsets.prolog /^ord_intersection3(<, _, Set1, 
Head2, Tail2, Inters/
+ord_intersection4      prol-src/ordsets.prolog /^ord_intersection4(<, _, Set1, 
Head2, Tail2, Inters/
+ord_member     prol-src/ordsets.prolog /^ord_member(X, [E|Es]) :-$/
+ord_seteq      prol-src/ordsets.prolog /^ord_seteq(Set1, Set2) :-$/
+ord_setproduct prol-src/ordsets.prolog /^ord_setproduct([], _, []).$/
+ord_subset     prol-src/ordsets.prolog /^ord_subset([], _).$/
+ord_subtract   prol-src/ordsets.prolog /^ord_subtract(Set1, Set2, Union) :-$/
+ord_symdiff    prol-src/ordsets.prolog /^ord_symdiff([], Set2, Set2).$/
+ord_union      prol-src/ordsets.prolog /^ord_union(Set1, Set2, Union) :-$/
+ord_union      prol-src/ordsets.prolog /^ord_union([], Union) :- !, Union = 
[].$/
+ord_union4     prol-src/ordsets.prolog /^ord_union4(<, Head, Set1, Head2, 
Tail2, [Head|Unio/
+ord_union_all  prol-src/ordsets.prolog /^ord_union_all(1, [Set|Sets], Set, 
Sets) :- !.$/
+oss    html-src/softwarelibero.html    /^Il movimento open source$/
+otagseen       c-src/etags.c   2475
+outputTime     cp-src/c.C      9
+output_file    perl-src/htlmify-cystic 35
+output_files   perl-src/htlmify-cystic 32
+outputtable    html-src/algrthms.html  /^Output$/
+outsyn prol-src/natded.prolog  /^outsyn(['Any'],_).$/
+p      c-src/emacs/src/lisp.h  4673
+p      c-src/emacs/src/lisp.h  4679
+p.x    forth-src/test-forth.fth        /^  1 CELLS +FIELD p.x    \\ A single 
cell filed name/
+p.y    forth-src/test-forth.fth        /^  1 CELLS +FIELD p.y    \\ A single 
cell field name/
+p/f    ada-src/etags-test-for.ada      /^   function p pragma Import (C,$/
+p/f    ada-src/etags-test-for.ada      /^function p ("p");$/
+pD     c-src/emacs/src/lisp.h  165
+pD     c-src/emacs/src/lisp.h  167
+pD     c-src/emacs/src/lisp.h  169
+pD     c-src/emacs/src/lisp.h  171
+pI     c-src/emacs/src/lisp.h  106
+pI     c-src/emacs/src/lisp.h  94
+pI     c-src/emacs/src/lisp.h  99
+pMd    c-src/emacs/src/lisp.h  150
+pMd    c-src/emacs/src/lisp.h  155
+pMu    c-src/emacs/src/lisp.h  151
+pMu    c-src/emacs/src/lisp.h  156
+p_next c-src/etags.c   258
+pagesize       c-src/emacs/src/gmalloc.c       1703
+pair   merc-src/accumulator.m  /^:- import_module pair.$/
+parent c-src/emacs/src/keyboard.c      8745
+parent c-src/emacs/src/lisp.h  1590
+parse  prol-src/natded.prolog  /^parse(Ws,Cat):-$/
+parseFromVars  php-src/lce_functions.php       /^      function 
parseFromVars($prefix)$/
+parse_c_expression     y-src/cccp.y    /^parse_c_expression (string)$/
+parse_cgi      prol-src/natded.prolog  /^parse_cgi(TokenList,KeyVals):-$/
+parse_error    y-src/parse.y   82
+parse_escape   y-src/cccp.y    /^parse_escape (string_ptr)$/
+parse_hash     y-src/parse.y   64
+parse_menu_item        c-src/emacs/src/keyboard.c      /^parse_menu_item 
(Lisp_Object item, int inmenubar)$/
+parse_modifiers        c-src/emacs/src/keyboard.c      /^parse_modifiers 
(Lisp_Object symbol)$/
+parse_modifiers_uncached       c-src/emacs/src/keyboard.c      
/^parse_modifiers_uncached (Lisp_Object symbol, ptrd/
+parse_number   y-src/cccp.y    /^parse_number (olen)$/
+parse_return   y-src/parse.y   74
+parse_return_error     y-src/cccp.y    70
+parse_solitary_modifier        c-src/emacs/src/keyboard.c      
/^parse_solitary_modifier (Lisp_Object symbol)$/
+parse_tool_bar_item    c-src/emacs/src/keyboard.c      /^parse_tool_bar_item 
(Lisp_Object key, Lisp_Object /
+parse_tree     merc-src/accumulator.m  /^:- import_module parse_tree.$/
+pat    c-src/etags.c   262
+pattern        c-src/etags.c   260
+pdlcount       c-src/emacs/src/lisp.h  3046
+pending-delete-mode    el-src/TAGTEST.EL       /^(defalias 
'pending-delete-mode 'delete-selection-m/
+pending_funcalls       c-src/emacs/src/keyboard.c      4377
+pending_signals        c-src/emacs/src/keyboard.c      80
+pfatal c-src/etags.c   /^pfatal (const char *s1)$/
+pfdset c-src/h.h       57
+pfnote c-src/etags.c   /^pfnote (char *name, bool is_func, char *linestart,/
+pinned c-src/emacs/src/lisp.h  679
+plain_C_entries        c-src/etags.c   /^plain_C_entries (FILE *inf)$/
+plain_C_suffixes       c-src/etags.c   643
+plainc c-src/etags.c   2934
+plist  c-src/emacs/src/lisp.h  2040
+plist  c-src/emacs/src/lisp.h  697
+plus   cp-src/functions.cpp    /^void Date::plus ( int days , int month , int 
year /
+plus   go-src/test1.go 5
+plusvalseq     prol-src/natded.prolog  /^plusvalseq([]) --> [].$/
+point  forth-src/test-forth.fth        /^BEGIN-STRUCTURE point \\ create the 
named structure/
+pointer        c-src/emacs/src/lisp.h  2125
+poll_for_input c-src/emacs/src/keyboard.c      /^poll_for_input (struct atimer 
*timer)$/
+poll_for_input_1       c-src/emacs/src/keyboard.c      /^poll_for_input_1 
(void)$/
+poll_suppress_count    c-src/emacs/src/keyboard.c      1908
+poll_suppress_count    c-src/emacs/src/lisp.h  3047
+poll_timer     c-src/emacs/src/keyboard.c      1915
+pop-tag-mark   el-src/emacs/lisp/progmodes/etags.el    /^(defalias 
'pop-tag-mark 'xref-pop-marker-stack)$/
+pop_kboard     c-src/emacs/src/keyboard.c      /^pop_kboard (void)$/
+popclass_above c-src/etags.c   /^popclass_above (int bracelev)$/
+position_to_Time       c-src/emacs/src/keyboard.c      /^position_to_Time 
(ptrdiff_t pos)$/
+posix_memalign c-src/emacs/src/gmalloc.c       /^posix_memalign (void 
**memptr, size_t alignment, s/
+posn-at-point  c-src/emacs/src/keyboard.c      /^DEFUN ("posn-at-point", 
Fposn_at_point, Sposn_at_p/
+posn-at-x-y    c-src/emacs/src/keyboard.c      /^DEFUN ("posn-at-x-y", 
Fposn_at_x_y, Sposn_at_x_y, /
+possible_sum_sign      y-src/cccp.y    /^#define possible_sum_sign(a, b, sum) 
((((a) ^ (b))/
+post   pyt-src/server.py       /^    def post(self):$/
+pot_etags_version      c-src/etags.c   81
+pp1    c-src/dostorture.c      /^int pp1($/
+pp1    c-src/torture.c /^int pp1($/
+pp2    c-src/dostorture.c      /^pp2$/
+pp2    c-src/torture.c /^pp2$/
+pp3    c-src/dostorture.c      /^pp3(int bar)$/
+pp3    c-src/torture.c /^pp3(int bar)$/
+pp_bas_cat     prol-src/natded.prolog  /^pp_bas_cat(Cat):-$/
+pp_cat prol-src/natded.prolog  /^pp_cat(Syn:Sem):-$/
+pp_exp prol-src/natded.prolog  /^pp_exp('NIL'):-$/
+pp_exps        prol-src/natded.prolog  /^pp_exps([]).$/
+pp_html_fitch_tree     prol-src/natded.prolog  
/^pp_html_fitch_tree(tree(der,Root,[ders(Words)]),M,/
+pp_html_table_fitch_tree       prol-src/natded.prolog  
/^pp_html_table_fitch_tree(T):-$/
+pp_html_table_tree     prol-src/natded.prolog  /^pp_html_table_tree(T):-$/
+pp_html_tree   prol-src/natded.prolog  /^pp_html_tree(ass(Syn,V,'$VAR'(N))):-$/
+pp_html_trees  prol-src/natded.prolog  /^pp_html_trees([T|Ts],N,M):-$/
+pp_lam prol-src/natded.prolog  /^pp_lam(Var^Alpha):-$/
+pp_lam_bracket prol-src/natded.prolog  /^pp_lam_bracket(A^B):-$/
+pp_lam_paren   prol-src/natded.prolog  /^pp_lam_paren(Var^Alpha):-$/
+pp_paren       prol-src/natded.prolog  /^pp_paren(C):-$/
+pp_rule        prol-src/natded.prolog  /^pp_rule(fe):-write('\/E').$/
+pp_syn prol-src/natded.prolog  /^pp_syn(A\/B):-$/
+pp_syn_back    prol-src/natded.prolog  /^pp_syn_back(A\/B):-$/
+pp_syn_paren   prol-src/natded.prolog  /^pp_syn_paren(A\/B):-$/
+pp_tree        prol-src/natded.prolog  /^pp_tree(T):-$/
+pp_trees       prol-src/natded.prolog  /^pp_trees([T|Ts],Column):-$/
+pp_word        prol-src/natded.prolog  /^pp_word(W):-$/
+pp_word_list   prol-src/natded.prolog  /^pp_word_list([]).$/
+pp_word_list_rest      prol-src/natded.prolog  /^pp_word_list_rest([]).$/
+predicate      c-src/emacs/src/lisp.h  2307
+prev   c-src/emacs/src/gmalloc.c       165
+prev   c-src/emacs/src/gmalloc.c       189
+prev   c-src/emacs/src/lisp.h  2191
+prev   c.c     175
+printClassification    php-src/lce_functions.php       /^      function 
printClassification()$/
+print_help     c-src/etags.c   /^print_help (argument *argbuffer)$/
+print_language_names   c-src/etags.c   /^print_language_names (void)$/
+print_version  c-src/etags.c   /^print_version (void)$/
+printmax_t     c-src/emacs/src/lisp.h  148
+printmax_t     c-src/emacs/src/lisp.h  153
+proc   c-src/h.h       87
+process_file   c-src/etags.c   /^process_file (FILE *fh, char *fn, language 
*lang)$/
+process_file_name      c-src/etags.c   /^process_file_name (char *file, 
language *lang)$/
+process_pending_signals        c-src/emacs/src/keyboard.c      
/^process_pending_signals (void)$/
+process_special_events c-src/emacs/src/keyboard.c      
/^process_special_events (void)$/
+process_tool_bar_item  c-src/emacs/src/keyboard.c      /^process_tool_bar_item 
(Lisp_Object key, Lisp_Objec/
+prof   make-src/Makefile       /^prof: ETAGS$/
+prolog_atom    c-src/etags.c   /^prolog_atom (char *s, size_t pos)$/
+prolog_pr      c-src/etags.c   /^prolog_pr (char *s, char *last)$/
+prolog_skip_comment    c-src/etags.c   /^prolog_skip_comment (linebuffer *plb, 
FILE *inf)$/
+prop   c-src/etags.c   209
+protect_malloc_state   c-src/emacs/src/gmalloc.c       /^protect_malloc_state 
(int protect_p)$/
+pthread_mutexattr_setprio_ceiling/f    ada-src/2ataspri.adb    /^   function 
pthread_mutexattr_setprio_ceiling$/
+pthread_mutexattr_setprotocol/f        ada-src/2ataspri.adb    /^   function 
pthread_mutexattr_setprotocol$/
+purpose        c-src/emacs/src/lisp.h  1594
+push_kboard    c-src/emacs/src/keyboard.c      /^push_kboard (struct kboard 
*k)$/
+pushclass_above        c-src/etags.c   /^pushclass_above (int bracelev, char 
*str, int len)/
+put_entries    c-src/etags.c   /^put_entries (register node *np)$/
+pvec_type      c-src/emacs/src/lisp.h  780
+quantizing     html-src/algrthms.html  /^Quantizing the Received$/
+questo ../c/c.web      34
+quiettest      make-src/Makefile       /^quiettest:$/
+quit_char      c-src/emacs/src/keyboard.c      192
+quit_throw_to_read_char        c-src/emacs/src/keyboard.c      
/^quit_throw_to_read_char (bool from_signal)$/
+qux    ruby-src/test1.ru       /^    alias_method :qux, :tee, 
attr_accessor(:bogus)/
+qux1   ruby-src/test1.ru       /^                :qux1)$/
+qux=   ruby-src/test1.ru       /^      def qux=(tee)$/
+r0     c-src/sysdep.h  54
+r1     c-src/sysdep.h  55
+r_alloc        c-src/emacs/src/lisp.h  /^extern void *r_alloc (void **, 
size_t) ATTRIBUTE_A/
+range_exp      y-src/parse.y   269
+range_exp_list y-src/parse.y   273
+raw_keybuf     c-src/emacs/src/keyboard.c      116
+raw_keybuf_count       c-src/emacs/src/keyboard.c      117
+rbtp   c.c     240
+re_iswctype    c-src/emacs/src/regex.h 602
+re_nsub        c-src/emacs/src/regex.h 364
+re_pattern_buffer      c-src/emacs/src/regex.h 335
+re_pattern_buffer      c-src/h.h       119
+re_registers   c-src/emacs/src/regex.h 428
+re_wchar_t     c-src/emacs/src/regex.h 600
+re_wchar_t     c-src/emacs/src/regex.h 623
+re_wctype      c-src/emacs/src/regex.h 601
+re_wctype_t    c-src/emacs/src/regex.h 599
+re_wctype_t    c-src/emacs/src/regex.h 618
+re_wctype_to_bit       c-src/emacs/src/regex.h /^# define re_wctype_to_bit(cc) 
0$/
+read   cp-src/conway.hpp       /^    char read() { return alive; }$/
+read   php-src/lce_functions.php       /^      function read()$/
+read-key-sequence      c-src/emacs/src/keyboard.c      /^DEFUN 
("read-key-sequence", Fread_key_sequence, Sr/
+read-key-sequence-vector       c-src/emacs/src/keyboard.c      /^DEFUN 
("read-key-sequence-vector", Fread_key_seque/
+read1  ruby-src/test1.ru       /^    attr_reader :read1 , :read2; attr_writer 
:writ/
+read2  ruby-src/test1.ru       /^    attr_reader :read1 , :read2; attr_writer 
:writ/
+read_char      c-src/emacs/src/keyboard.c      /^read_char (int commandflag, 
Lisp_Object map,$/
+read_char_help_form_unwind     c-src/emacs/src/keyboard.c      
/^read_char_help_form_unwind (void)$/
+read_char_minibuf_menu_prompt  c-src/emacs/src/keyboard.c      
/^read_char_minibuf_menu_prompt (int commandflag,$/
+read_char_x_menu_prompt        c-src/emacs/src/keyboard.c      
/^read_char_x_menu_prompt (Lisp_Object map,$/
+read_decoded_event_from_main_queue     c-src/emacs/src/keyboard.c      
/^read_decoded_event_from_main_queue (struct timespe/
+read_event_from_main_queue     c-src/emacs/src/keyboard.c      
/^read_event_from_main_queue (struct timespec *end_t/
+read_key_sequence      c-src/emacs/src/keyboard.c      /^read_key_sequence 
(Lisp_Object *keybuf, int bufsiz/
+read_key_sequence_cmd  c-src/emacs/src/keyboard.c      232
+read_key_sequence_remapped     c-src/emacs/src/keyboard.c      233
+read_key_sequence_vs   c-src/emacs/src/keyboard.c      /^read_key_sequence_vs 
(Lisp_Object prompt, Lisp_Obj/
+read_menu_command      c-src/emacs/src/keyboard.c      /^read_menu_command 
(void)$/
+read_toc       perl-src/htlmify-cystic /^sub read_toc ()$/
+readable_events        c-src/emacs/src/keyboard.c      /^readable_events (int 
flags)$/
+readline       c-src/etags.c   /^readline (linebuffer *lbp, FILE *stream)$/
+readline_internal      c-src/etags.c   /^readline_internal (linebuffer *lbp, 
register FILE /
+realloc        c-src/emacs/src/gmalloc.c       /^realloc (void *ptr, size_t 
size)$/
+realloc        c-src/emacs/src/gmalloc.c       1716
+realloc        c-src/emacs/src/gmalloc.c       65
+realloc        c-src/emacs/src/gmalloc.c       69
+reallochook    c-src/emacs/src/gmalloc.c       /^reallochook (void *ptr, 
size_t size)$/
+recent-keys    c-src/emacs/src/keyboard.c      /^DEFUN ("recent-keys", 
Frecent_keys, Srecent_keys, /
+recent_keys    c-src/emacs/src/keyboard.c      100
+recent_keys_index      c-src/emacs/src/keyboard.c      94
+record_asynch_buffer_change    c-src/emacs/src/keyboard.c      
/^record_asynch_buffer_change (void)$/
+record_auto_save       c-src/emacs/src/keyboard.c      /^record_auto_save 
(void)$/
+record_char    c-src/emacs/src/keyboard.c      /^record_char (Lisp_Object c)$/
+record_menu_key        c-src/emacs/src/keyboard.c      /^record_menu_key 
(Lisp_Object c)$/
+record_single_kboard_state     c-src/emacs/src/keyboard.c      
/^record_single_kboard_state ()$/
+record_xmalloc c-src/emacs/src/lisp.h  /^extern void *record_xmalloc (size_t) 
ATTRIBUTE_ALL/
+recover_top_level_message      c-src/emacs/src/keyboard.c      138
+recursion-depth        c-src/emacs/src/keyboard.c      /^DEFUN 
("recursion-depth", Frecursion_depth, Srecur/
+recursive-edit c-src/emacs/src/keyboard.c      /^DEFUN ("recursive-edit", 
Frecursive_edit, Srecursi/
+recursive_edit_1       c-src/emacs/src/keyboard.c      /^recursive_edit_1 
(void)$/
+recursive_edit_unwind  c-src/emacs/src/keyboard.c      /^recursive_edit_unwind 
(Lisp_Object buffer)$/
+redirect       c-src/emacs/src/lisp.h  663
+reduce prol-src/natded.prolog  /^reduce((X^M)@N,L):-     % beta reduction$/
+reduce_subterm prol-src/natded.prolog  /^reduce_subterm(M,M2):-$/
+refreshPort    pyt-src/server.py       /^    def refreshPort(self):$/
+reg_errcode_t  c-src/emacs/src/regex.h 323
+reg_errcode_t  c.c     279
+reg_syntax_t   c-src/emacs/src/regex.h 43
+regex  c-src/etags.c   219
+regex.o        make-src/Makefile       /^regex.o: emacs\/src\/regex.c$/
+regex_t        c-src/emacs/src/regex.h 416
+regex_tag_multiline    c-src/etags.c   /^regex_tag_multiline (void)$/
+regexfile      make-src/Makefile       /^regexfile: Makefile$/
+regexp c-src/etags.c   256
+regexp c-src/etags.c   268
+registerAction objcpp-src/SimpleCalc.M /^- registerAction:(SEL)action$/
+register_heapinfo      c-src/emacs/src/gmalloc.c       /^register_heapinfo 
(void)$/
+regmatch_t     c-src/emacs/src/regex.h 451
+regoff_t       c-src/emacs/src/regex.h 423
+regs   c-src/etags.c   263
+regs   cp-src/screen.cpp       16
+regs_allocated c-src/emacs/src/regex.h 379
+regset c-src/h.h       31
+regular_top_level_message      c-src/emacs/src/keyboard.c      143
+rehash_size    c-src/emacs/src/lisp.h  1835
+rehash_threshold       c-src/emacs/src/lisp.h  1839
+relative_filename      c-src/etags.c   /^relative_filename (char *file, char 
*dir)$/
+release distrib        make-src/Makefile       /^release distrib: web$/
+removeexp      prol-src/natded.prolog  /^removeexp(E,E,'NIL'):-!.$/
+reorder_modifiers      c-src/emacs/src/keyboard.c      /^reorder_modifiers 
(Lisp_Object symbol)$/
+request        c.c     /^request request (a, b)$/
+requeued_events_pending_p      c-src/emacs/src/keyboard.c      
/^requeued_events_pending_p (void)$/
+require        merc-src/accumulator.m  /^:- import_module require.$/
+required_argument      c-src/getopt.h  90
+reset-this-command-lengths     c-src/emacs/src/keyboard.c      /^DEFUN 
("reset-this-command-lengths", Freset_this_c/
+restore_getcjmp        c-src/emacs/src/keyboard.c      /^restore_getcjmp 
(sys_jmp_buf temp)$/
+restore_kboard_configuration   c-src/emacs/src/keyboard.c      
/^restore_kboard_configuration (int was_locked)$/
+return_to_command_loop c-src/emacs/src/keyboard.c      135
+reverse        prol-src/natded.prolog  /^reverse([],Ws,Ws).$/
+revert objc-src/PackInsp.m     /^-revert:sender$/
+right  c-src/etags.c   216
+right_shift    y-src/cccp.y    /^right_shift (a, b)$/
+ring1  c.c     241
+ring2  c.c     242
+rm_eo  c-src/emacs/src/regex.h 450
+rm_so  c-src/emacs/src/regex.h 449
+rng_base       cp-src/Range.h  79
+rng_inc        cp-src/Range.h  81
+rng_limit      cp-src/Range.h  80
+rng_nelem      cp-src/Range.h  83
+rosso  cp-src/c.C      40
+rsyncfromfly   make-src/Makefile       /^rsyncfromfly:$/
+rsynctofly     make-src/Makefile       /^rsynctofly:$/
+rtint  c-src/h.h       60
+rtint  c-src/h.h       68
+rtstr  c-src/h.h       61
+rtstr  c-src/h.h       69
+rtunion_def    c-src/h.h       58
+rtunion_def    c-src/h.h       64
+rtx    c-src/h.h       62
+rtxnp  c-src/h.h       71
+rtxp   c-src/h.h       70
+s      c-src/emacs/src/lisp.h  4672
+s      c-src/emacs/src/lisp.h  4678
+s1     cp-src/c.C      32
+s2     cp-src/c.C      35
+safe_run_hook_funcall  c-src/emacs/src/keyboard.c      /^safe_run_hook_funcall 
(ptrdiff_t nargs, Lisp_Objec/
+safe_run_hooks c-src/emacs/src/keyboard.c      /^safe_run_hooks (Lisp_Object 
hook)$/
+safe_run_hooks_1       c-src/emacs/src/keyboard.c      /^safe_run_hooks_1 
(ptrdiff_t nargs, Lisp_Object *ar/
+safe_run_hooks_error   c-src/emacs/src/keyboard.c      /^safe_run_hooks_error 
(Lisp_Object error, ptrdiff_t/
+save   pyt-src/server.py       /^    def save(self):$/
+save_getcjmp   c-src/emacs/src/keyboard.c      /^save_getcjmp (sys_jmp_buf 
temp)$/
+save_type      c-src/emacs/src/lisp.h  /^save_type (struct Lisp_Save_Value *v, 
int n)$/
+savenstr       c-src/etags.c   /^savenstr (const char *cp, int len)$/
+savestr        c-src/etags.c   /^savestr (const char *cp)$/
+say    go-src/test.go  /^func say(msg string) {$/
+scan_separators        c-src/etags.c   /^scan_separators (char *name)$/
+scolonseen     c-src/etags.c   2447
+scratch        c-src/sysdep.h  56
+scroll_bar_parts       c-src/emacs/src/keyboard.c      5189
+sec=\relax     tex-src/texinfo.tex     /^\\let\\appendixsec=\\relax$/
+section        perl-src/htlmify-cystic 25
+section=\relax tex-src/texinfo.tex     /^\\let\\appendixsection=\\relax$/
+section_href   perl-src/htlmify-cystic /^sub section_href ($)$/
+section_name   perl-src/htlmify-cystic /^sub section_name ($)$/
+section_name   perl-src/htlmify-cystic 12
+section_toc    perl-src/htlmify-cystic 15
+section_url    perl-src/htlmify-cystic /^sub section_url ()$/
+section_url_base       perl-src/htlmify-cystic /^sub section_url_base ()$/
+section_url_name       perl-src/htlmify-cystic /^sub section_url_name ()$/
+select prol-src/natded.prolog  /^select(X,[X|Xs],Xs).$/
+select-tags-table      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
select-tags-table ()$/
+select-tags-table-mode el-src/emacs/lisp/progmodes/etags.el    
/^(define-derived-mode select-tags-table-mode specia/
+select-tags-table-mode-map     el-src/emacs/lisp/progmodes/etags.el    
/^(defvar select-tags-table-mode-map ; Doc string?$/
+select-tags-table-quit el-src/emacs/lisp/progmodes/etags.el    /^(defun 
select-tags-table-quit ()$/
+select-tags-table-select       el-src/emacs/lisp/progmodes/etags.el    
/^(defun select-tags-table-select (button)$/
+select_last    prol-src/natded.prolog  /^select_last([X],X,[]).$/
+send   objc-src/Subprocess.m   /^- send:(const char *)string 
withNewline:(BOOL)want/
+send   objc-src/Subprocess.m   /^- send:(const char *)string$/
+separator_names        c-src/emacs/src/keyboard.c      7372
+serializeToVars        php-src/lce_functions.php       /^      function 
serializeToVars($prefix)$/
+set    cp-src/conway.hpp       /^    void set(void) { alive = 1; }$/
+set    merc-src/accumulator.m  /^:- import_module set.$/
+set-input-interrupt-mode       c-src/emacs/src/keyboard.c      /^DEFUN 
("set-input-interrupt-mode", Fset_input_inte/
+set-input-meta-mode    c-src/emacs/src/keyboard.c      /^DEFUN 
("set-input-meta-mode", Fset_input_meta_mode/
+set-input-mode c-src/emacs/src/keyboard.c      /^DEFUN ("set-input-mode", 
Fset_input_mode, Sset_inp/
+set-output-flow-control        c-src/emacs/src/keyboard.c      /^DEFUN 
("set-output-flow-control", Fset_output_flow/
+set-quit-char  c-src/emacs/src/keyboard.c      /^DEFUN ("set-quit-char", 
Fset_quit_char, Sset_quit_/
+setDate        cp-src/functions.cpp    /^void Date::setDate ( int d , int m , 
int y ){$/
+setDelegate    objc-src/Subprocess.m   /^- setDelegate:anObject$/
+setRevertButtonTitle   objc-src/PackInsp.m     /^-setRevertButtonTitle$/
+set_base       cp-src/Range.h  /^  void set_base (double b) { rng_base = b;  
}$/
+set_char_table_contents        c-src/emacs/src/lisp.h  
/^set_char_table_contents (Lisp_Object table, ptrdif/
+set_char_table_defalt  c-src/emacs/src/lisp.h  /^set_char_table_defalt 
(Lisp_Object table, Lisp_Obj/
+set_char_table_extras  c-src/emacs/src/lisp.h  /^set_char_table_extras 
(Lisp_Object table, ptrdiff_/
+set_char_table_purpose c-src/emacs/src/lisp.h  /^set_char_table_purpose 
(Lisp_Object table, Lisp_Ob/
+set_hash_key_slot      c-src/emacs/src/lisp.h  /^set_hash_key_slot (struct 
Lisp_Hash_Table *h, ptrd/
+set_hash_value_slot    c-src/emacs/src/lisp.h  /^set_hash_value_slot (struct 
Lisp_Hash_Table *h, pt/
+set_inc        cp-src/Range.h  /^  void set_inc (double i) { rng_inc = i;   }$/
+set_limit      cp-src/Range.h  /^  void set_limit (double l) { rng_limit = l; 
}$/
+set_overlay_plist      c-src/emacs/src/lisp.h  /^set_overlay_plist 
(Lisp_Object overlay, Lisp_Objec/
+set_poll_suppress_count        c-src/emacs/src/keyboard.c      
/^set_poll_suppress_count (int count)$/
+set_prop       c-src/emacs/src/keyboard.c      /^set_prop (ptrdiff_t idx, 
Lisp_Object val)$/
+set_save_integer       c-src/emacs/src/lisp.h  /^set_save_integer (Lisp_Object 
obj, int n, ptrdiff_/
+set_save_pointer       c-src/emacs/src/lisp.h  /^set_save_pointer (Lisp_Object 
obj, int n, void *va/
+set_string_intervals   c-src/emacs/src/lisp.h  /^set_string_intervals 
(Lisp_Object s, INTERVAL i)$/
+set_sub_char_table_contents    c-src/emacs/src/lisp.h  
/^set_sub_char_table_contents (Lisp_Object table, pt/
+set_symbol_function    c-src/emacs/src/lisp.h  /^set_symbol_function 
(Lisp_Object sym, Lisp_Object /
+set_symbol_next        c-src/emacs/src/lisp.h  /^set_symbol_next (Lisp_Object 
sym, struct Lisp_Symb/
+set_symbol_plist       c-src/emacs/src/lisp.h  /^set_symbol_plist (Lisp_Object 
sym, Lisp_Object pli/
+set_upto       merc-src/accumulator.m  /^:- func set_upto(accu_case, int) = 
set(accu_goal_i/
+set_waiting_for_input  c-src/emacs/src/keyboard.c      /^set_waiting_for_input 
(struct timespec *time_to_cl/
+setref tex-src/texinfo.tex     
/^\\expandafter\\expandafter\\expandafter\\appendixsetre/
+setup  cp-src/c.C      5
+shift  cp-src/functions.cpp    /^void Date::shift ( void ){\/\/Shift this date 
to pre/
+shouldLoad     objc-src/PackInsp.m     /^-(BOOL)shouldLoad$/
+should_attempt_accu_transform  merc-src/accumulator.m  /^:- pred 
should_attempt_accu_transform(module_info:/
+should_attempt_accu_transform_2        merc-src/accumulator.m  /^:- pred 
should_attempt_accu_transform_2(module_inf/
+should_see_this_array_type     cp-src/c.C      156
+should_see_this_function_pointer       cp-src/c.C      153
+should_see_this_one_enclosed_in_extern_C       cp-src/c.C      149
+show   erl-src/gs_dialog.erl   /^show(Module, Title, Message, Args) ->$/
+showError      objc-src/Subprocess.m   /^showError (const char *errorString, 
id theDelegate/
+showInfo       objc-src/PackInsp.m     /^-showInfo:sender$/
+show_help_echo c-src/emacs/src/keyboard.c      /^show_help_echo (Lisp_Object 
help, Lisp_Object wind/
+sig    c-src/emacs/src/keyboard.c      7238
+signal_handler c-src/h.h       82
+signal_handler1        c-src/h.h       83
+signal_handler_t       c-src/h.h       94
+simulation     html-src/software.html  /^Software that I wrote for supporting 
my research a/
+single_kboard  c-src/emacs/src/keyboard.c      89
+single_kboard_state    c-src/emacs/src/keyboard.c      /^single_kboard_state 
()$/
+site   cp-src/conway.hpp       /^    site(int xi, int yi): x(xi), y(yi), 
alive(0) {/
+site   cp-src/conway.hpp       5
+size   c-src/emacs/src/gmalloc.c       156
+size   c-src/emacs/src/gmalloc.c       163
+size   c-src/emacs/src/gmalloc.c       1862
+size   c-src/emacs/src/lisp.h  1364
+size   c-src/emacs/src/lisp.h  1390
+size   c-src/etags.c   236
+size   c-src/etags.c   2522
+skeyseen       c-src/etags.c   2445
+skip_name      c-src/etags.c   /^skip_name (char *cp)$/
+skip_non_spaces        c-src/etags.c   /^skip_non_spaces (char *cp)$/
+skip_spaces    c-src/etags.c   /^skip_spaces (char *cp)$/
+snarf-tag-function     el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
snarf-tag-function nil$/
+snone  c-src/etags.c   2443
+solutions      merc-src/accumulator.m  /^:- import_module solutions.$/
+some_mouse_moved       c-src/emacs/src/keyboard.c      /^some_mouse_moved 
(void)$/
+space  tex-src/texinfo.tex     /^    {#2\\labelspace 
#1}\\dotfill\\doshortpageno{#3}}%/
+space  tex-src/texinfo.tex     /^  
\\dosubsubsecentry{#2.#3.#4.#5\\labelspace#1}{#6}}/
+spacer c-src/emacs/src/lisp.h  1975
+spacer c-src/emacs/src/lisp.h  1982
+spacer c-src/emacs/src/lisp.h  2036
+spacer c-src/emacs/src/lisp.h  2205
+specbind_tag   c-src/emacs/src/lisp.h  2943
+specbinding    c-src/emacs/src/lisp.h  2955
+specialsymbol  prol-src/natded.prolog  /^specialsymbol(C1,C2,S):-$/
+splitexp       prol-src/natded.prolog  /^splitexp(E,E,('NIL','NIL')):-!.$/
+srclist        make-src/Makefile       /^srclist: Makefile$/
+ss3    c.c     255
+sss1   c.c     252
+sss2   c.c     253
+sstab  prol-src/natded.prolog  /^sstab(2,'C',',').$/
+st_C_attribute c-src/etags.c   2209
+st_C_class     c-src/etags.c   2212
+st_C_define    c-src/etags.c   2213
+st_C_enum      c-src/etags.c   2213
+st_C_extern    c-src/etags.c   2213
+st_C_gnumacro  c-src/etags.c   2208
+st_C_ignore    c-src/etags.c   2209
+st_C_javastruct        c-src/etags.c   2210
+st_C_objend    c-src/etags.c   2207
+st_C_objimpl   c-src/etags.c   2207
+st_C_objprot   c-src/etags.c   2207
+st_C_operator  c-src/etags.c   2211
+st_C_struct    c-src/etags.c   2213
+st_C_template  c-src/etags.c   2212
+st_C_typedef   c-src/etags.c   2213
+st_none        c-src/etags.c   2206
+stack  c.c     155
+stagseen       c-src/etags.c   2446
+standalone     make-src/Makefile       /^standalone:$/
+start  c-src/emacs/src/keyboard.c      8753
+start  c-src/emacs/src/lisp.h  2038
+start  c-src/emacs/src/regex.h 431
+start  php-src/lce_functions.php       /^      function start($line, $class)$/
+start  y-src/cccp.y    143
+start_polling  c-src/emacs/src/keyboard.c      /^start_polling (void)$/
+start_up       prol-src/natded.prolog  /^start_up:-$/
+state_protected_p      c-src/emacs/src/gmalloc.c       400
+statetable     html-src/algrthms.html  /^Next$/
+staticetags    make-src/Makefile       /^staticetags:$/
+step   cp-src/clheir.hpp       /^    virtual void step(void) { }$/
+step   cp-src/conway.hpp       /^    void step(void) { alive = next_alive; }$/
+step_everybody cp-src/clheir.cpp       /^void step_everybody(void)$/
+stop_polling   c-src/emacs/src/keyboard.c      /^stop_polling (void)$/
+store_info     merc-src/accumulator.m  /^:- type store_info$/
+store_user_signal_events       c-src/emacs/src/keyboard.c      
/^store_user_signal_events (void)$/
+stored_goal_plain_call merc-src/accumulator.m  /^:- inst 
stored_goal_plain_call for goal_store.stor/
+str    go-src/test1.go 9
+strcaseeq      c-src/etags.c   /^#define strcaseeq(s,t)        (assert 
((s)!=NULL && (t)!=/
+streq  c-src/etags.c   /^#define streq(s,t)    (assert ((s)!=NULL || (t)!=NULL/
+string merc-src/accumulator.m  /^:- import_module string.$/
+string_intervals       c-src/emacs/src/lisp.h  /^string_intervals (Lisp_Object 
s)$/
+stripLine      php-src/lce_functions.php       /^      function 
stripLine($line, $class)$/
+stripname      pas-src/common.pas      /^function stripname; (* ($/
+strncaseeq     c-src/etags.c   /^#define strncaseeq(s,t,n) (assert ((s)!=NULL 
&& (t/
+strneq c-src/etags.c   /^#define strneq(s,t,n) (assert ((s)!=NULL || (t)!=N/
+structdef      c-src/etags.c   2448
+stuff_buffered_input   c-src/emacs/src/keyboard.c      /^stuff_buffered_input 
(Lisp_Object stuffstring)$/
+subprocess     objc-src/PackInsp.m     /^-subprocess:(Subprocess *)sender 
output:(char *)bu/
+subprocessDone objc-src/PackInsp.m     /^-subprocessDone:(Subprocess *)sender$/
+subsec=\relax  tex-src/texinfo.tex     /^\\let\\appendixsubsec=\\relax$/
+subsection     perl-src/htlmify-cystic 26
+subsection=\relax      tex-src/texinfo.tex     
/^\\let\\appendixsubsection=\\relax$/
+subsection_marker      perl-src/htlmify-cystic 161
+subst  prol-src/natded.prolog  /^subst(var(Y),var(X),M,N):-$/
+substitute     c-src/etags.c   /^substitute (char *in, char *out, struct 
re_registe/
+subsubsec=\relax       tex-src/texinfo.tex     
/^\\let\\appendixsubsubsec=\\relax$/
+subsubsection  perl-src/htlmify-cystic 27
+subsubsection=\relax   tex-src/texinfo.tex     
/^\\let\\appendixsubsubsection=\\relax$/
+subtle ruby-src/test1.ru       /^                 :tee ; attr_reader :subtle$/
+subtree        prol-src/natded.prolog  /^subtree(T,T).$/
+suffix c-src/etags.c   186
+suffixes       c-src/etags.c   195
+suggest_asking_for_help        c-src/etags.c   /^suggest_asking_for_help 
(void)$/
+suspend-emacs  c-src/emacs/src/keyboard.c      /^DEFUN ("suspend-emacs", 
Fsuspend_emacs, Ssuspend_e/
+sval   y-src/cccp.y    116
+swallow_events c-src/emacs/src/keyboard.c      /^swallow_events (bool 
do_display)$/
+switch_line_buffers    c-src/etags.c   /^#define switch_line_buffers() (curndx 
= 1 - curndx/
+sxhash_combine c-src/emacs/src/lisp.h  /^sxhash_combine (EMACS_UINT x, 
EMACS_UINT y)$/
+sym_type       c-src/etags.c   2204
+symbol c-src/emacs/src/lisp.h  2980
+symbol_interned        c-src/emacs/src/lisp.h  639
+symbol_name    c-src/emacs/src/lisp.h  1687
+symbol_redirect        c-src/emacs/src/lisp.h  646
+syms_of_abbrev c-src/abbrev.c  /^syms_of_abbrev ()$/
+syms_of_keyboard       c-src/emacs/src/keyboard.c      /^syms_of_keyboard 
(void)$/
+synchronize_system_messages_locale     c-src/emacs/src/lisp.h  /^INLINE void 
synchronize_system_messages_locale (vo/
+synchronize_system_time_locale c-src/emacs/src/lisp.h  /^INLINE void 
synchronize_system_time_locale (void) /
+syntax c-src/emacs/src/regex.h 350
+sys_jmp_buf    c-src/emacs/src/lisp.h  2906
+sys_jmp_buf    c-src/emacs/src/lisp.h  2910
+sys_jmp_buf    c-src/emacs/src/lisp.h  2916
+sys_longjmp    c-src/emacs/src/lisp.h  /^# define sys_longjmp(j, v) _longjmp 
(j, v)$/
+sys_longjmp    c-src/emacs/src/lisp.h  /^# define sys_longjmp(j, v) longjmp 
(j, v)$/
+sys_longjmp    c-src/emacs/src/lisp.h  /^# define sys_longjmp(j, v) siglongjmp 
(j, v)$/
+sys_setjmp     c-src/emacs/src/lisp.h  /^# define sys_setjmp(j) _setjmp (j)$/
+sys_setjmp     c-src/emacs/src/lisp.h  /^# define sys_setjmp(j) setjmp (j)$/
+sys_setjmp     c-src/emacs/src/lisp.h  /^# define sys_setjmp(j) sigsetjmp (j, 
0)$/
+syscall_error  c-src/sysdep.h  34
+t      cp-src/c.C      52
+t1     cp-src/c.C      34
+t2     cp-src/c.C      38
+tab_count_words        c-src/tab.c     /^int                   
tab_count_words(char **tab)$/
+tab_delete_first       c-src/tab.c     /^int                   
tab_delete_first(char **tab)$/
+tab_fill       c-src/tab.c     /^char                  **tab_fill(char *str, 
char delim)$/
+tab_free       c-src/tab.c     /^void                  tab_free(char **tab)$/
+tag-any-match-p        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-any-match-p (_tag)$/
+tag-exact-file-name-match-p    el-src/emacs/lisp/progmodes/etags.el    
/^(defun tag-exact-file-name-match-p (tag)$/
+tag-exact-match-p      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-exact-match-p (tag)$/
+tag-file-name-match-p  el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-file-name-match-p (tag)$/
+tag-find-file-of-tag   el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-find-file-of-tag (file) ; Doc string?$/
+tag-find-file-of-tag-noselect  el-src/emacs/lisp/progmodes/etags.el    
/^(defun tag-find-file-of-tag-noselect (file)$/
+tag-implicit-name-match-p      el-src/emacs/lisp/progmodes/etags.el    
/^(defun tag-implicit-name-match-p (tag)$/
+tag-lines-already-matched      el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tag-lines-already-matched nil$/
+tag-partial-file-name-match-p  el-src/emacs/lisp/progmodes/etags.el    
/^(defun tag-partial-file-name-match-p (_tag)$/
+tag-re-match-p el-src/emacs/lisp/progmodes/etags.el    /^(defun tag-re-match-p 
(re)$/
+tag-symbol-match-p     el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-symbol-match-p (tag)$/
+tag-word-match-p       el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-word-match-p (tag)$/
+tag1   c-src/dostorture.c      /^(*tag1 (sig, handler)) ()$/
+tag1   c-src/h.h       110
+tag1   c-src/torture.c /^(*tag1 (sig, handler)) ()$/
+tag2   c-src/dostorture.c      /^(*tag2 (sig, handler)) ()$/
+tag2   c-src/torture.c /^(*tag2 (sig, handler)) ()$/
+tag3   c-src/dostorture.c      /^(*tag3 (int sig, void (*handler) (int))) 
(int)$/
+tag3   c-src/torture.c /^(*tag3 (int sig, void (*handler) (int))) (int)$/
+tag4   c-src/dostorture.c      /^(*tag4 (int sig, void (*handler) (int))) 
(int)$/
+tag4   c-src/torture.c /^(*tag4 (int sig, void (*handler) (int))) (int)$/
+tag5   c-src/dostorture.c      /^tag5 (handler, arg)$/
+tag5   c-src/torture.c /^tag5 (handler, arg)$/
+tag6   c-src/dostorture.c      /^tag6 (void (*handler) (void *), void *arg)$/
+tag6   c-src/torture.c /^tag6 (void (*handler) (void *), void *arg)$/
+tag_or_ch      c-src/emacs/src/lisp.h  3026
+taggedfname    c-src/etags.c   207
+tags   make-src/Makefile       /^tags: TAGS$/
+tags-add-tables        el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
tags-add-tables 'ask-user$/
+tags-apropos   el-src/emacs/lisp/progmodes/etags.el    /^(defun tags-apropos 
(regexp)$/
+tags-apropos-additional-actions        el-src/emacs/lisp/progmodes/etags.el    
/^(defcustom tags-apropos-additional-actions nil$/
+tags-apropos-function  el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-apropos-function nil$/
+tags-apropos-verbose   el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
tags-apropos-verbose nil$/
+tags-case-fold-search  el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
tags-case-fold-search 'default$/
+tags-complete-tags-table-file  el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-complete-tags-table-file (string predi/
+tags-completion-at-point-function      el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-completion-at-point-function ()$/
+tags-completion-table  el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-completion-table ()$/
+tags-completion-table  el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-completion-table nil$/
+tags-completion-table-function el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-completion-table-function nil$/
+tags-compression-info-list     el-src/emacs/lisp/progmodes/etags.el    
/^(defcustom tags-compression-info-list$/
+tags-expand-table-name el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-expand-table-name (file)$/
+tags-file-name el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-file-name nil$/
+tags-included-tables   el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-included-tables ()$/
+tags-included-tables   el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-included-tables nil$/
+tags-included-tables-function  el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-included-tables-function nil$/
+tags-lazy-completion-table     el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-lazy-completion-table ()$/
+tags-location-ring     el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-location-ring (make-ring xref-marker-/
+tags-loop-continue     el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-loop-continue (&optional first-time)$/
+tags-loop-eval el-src/emacs/lisp/progmodes/etags.el    /^(defun tags-loop-eval 
(form)$/
+tags-loop-operate      el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-loop-operate nil$/
+tags-loop-revert-buffers       el-src/emacs/lisp/progmodes/etags.el    
/^(defcustom tags-loop-revert-buffers nil$/
+tags-loop-scan el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-loop-scan$/
+tags-next-table        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-next-table ()$/
+tags-query-replace     el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-query-replace (from to &optional delim/
+tags-recognize-empty-tags-table        el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-recognize-empty-tags-table ()$/
+tags-reset-tags-tables el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-reset-tags-tables ()$/
+tags-revert-without-query      el-src/emacs/lisp/progmodes/etags.el    
/^(defcustom tags-revert-without-query nil$/
+tags-search    el-src/emacs/lisp/progmodes/etags.el    /^(defun tags-search 
(regexp &optional file-list-for/
+tags-select-tags-table el-src/emacs/lisp/progmodes/etags.el    
/^(define-button-type 'tags-select-tags-table$/
+tags-table-check-computed-list el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-table-check-computed-list ()$/
+tags-table-computed-list       el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-computed-list nil$/
+tags-table-computed-list-for   el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-computed-list-for nil$/
+tags-table-extend-computed-list        el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-table-extend-computed-list ()$/
+tags-table-files       el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-table-files ()$/
+tags-table-files       el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-table-files nil$/
+tags-table-files-function      el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-files-function nil$/
+tags-table-format-functions    el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-format-functions '(etags-recogn/
+tags-table-including   el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-table-including (this-file core-only)$/
+tags-table-list        el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
tags-table-list nil$/
+tags-table-list-member el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-table-list-member (file list)$/
+tags-table-list-pointer        el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-list-pointer nil$/
+tags-table-list-started-at     el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-list-started-at nil$/
+tags-table-mode        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-table-mode ()$/
+tags-table-set-list    el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-table-set-list nil$/
+tags-tag-face  el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
tags-tag-face 'default$/
+tags-verify-table      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-verify-table (file)$/
+tags-with-face el-src/emacs/lisp/progmodes/etags.el    /^(defmacro 
tags-with-face (face &rest body)$/
+target_multibyte       c-src/emacs/src/regex.h 407
+tcpdump        html-src/software.html  /^tcpdump$/
+teats  cp-src/c.C      127
+tee    ruby-src/test1.ru       /^    attr_accessor :tee$/
+tee=   ruby-src/test1.ru       /^    attr_accessor :tee$/
+temporarily_switch_to_single_kboard    c-src/emacs/src/keyboard.c      
/^temporarily_switch_to_single_kboard (struct frame /
+tend   c-src/etags.c   2432
+term   merc-src/accumulator.m  /^:- import_module term.$/
+terminate      objc-src/Subprocess.m   /^- terminate:sender$/
+terminateInput objc-src/Subprocess.m   /^- terminateInput$/
+test   c-src/emacs/src/lisp.h  1871
+test   cp-src/c.C      86
+test   erl-src/gs_dialog.erl   /^test() ->$/
+test   go-src/test1.go /^func test(p plus) {$/
+test   make-src/Makefile       /^test:$/
+test   php-src/ptest.php       /^test $/
+test-begin     scm-src/test.scm        /^(define-syntax test-begin$/
+test.me22b     lua-src/test.lua        /^   local function test.me22b (one)$/
+test.me_22a    lua-src/test.lua        /^   function test.me_22a(one, two)$/
+test1  rs-src/test.rs  /^fn test1() {$/
+test_crlf1     test_crlf.c     /^void test_crlf1()$/
+test_crlf2     tset_crlf.c     /^void test_crlf2()$/
+test_undefined c-src/emacs/src/keyboard.c      /^test_undefined (Lisp_Object 
binding)$/
+texttreelist   prol-src/natded.prolog  /^texttreelist([]).$/
+there-is-a-=-in-the-middle!    scm-src/test.scm        /^(define 
(there-is-a-=-in-the-middle!) #t)$/
+this   c-src/a/b/b.c   1
+this-command-keys      c-src/emacs/src/keyboard.c      /^DEFUN 
("this-command-keys", Fthis_command_keys, St/
+this-command-keys-vector       c-src/emacs/src/keyboard.c      /^DEFUN 
("this-command-keys-vector", Fthis_command_k/
+this-single-command-keys       c-src/emacs/src/keyboard.c      /^DEFUN 
("this-single-command-keys", Fthis_single_co/
+this-single-command-raw-keys   c-src/emacs/src/keyboard.c      /^DEFUN 
("this-single-command-raw-keys", Fthis_singl/
+this_command_key_count c-src/emacs/src/keyboard.c      108
+this_command_key_count_reset   c-src/emacs/src/keyboard.c      112
+this_command_keys      c-src/emacs/src/keyboard.c      107
+this_file_toc  perl-src/htlmify-cystic 29
+this_single_command_key_start  c-src/emacs/src/keyboard.c      125
+tignore        c-src/etags.c   2433
+timer_check    c-src/emacs/src/keyboard.c      /^timer_check (void)$/
+timer_check_2  c-src/emacs/src/keyboard.c      /^timer_check_2 (Lisp_Object 
timers, Lisp_Object idl/
+timer_idleness_start_time      c-src/emacs/src/keyboard.c      335
+timer_last_idleness_start_time c-src/emacs/src/keyboard.c      340
+timer_resume_idle      c-src/emacs/src/keyboard.c      /^timer_resume_idle 
(void)$/
+timer_start_idle       c-src/emacs/src/keyboard.c      /^timer_start_idle 
(void)$/
+timer_stop_idle        c-src/emacs/src/keyboard.c      /^timer_stop_idle 
(void)$/
+timers_run     c-src/emacs/src/keyboard.c      320
+tinbody        c-src/etags.c   2431
+tkeyseen       c-src/etags.c   2429
+tnone  c-src/etags.c   2428
+toc_line       perl-src/htlmify-cystic /^sub toc_line ($)$/
+toggleDescription      objc-src/PackInsp.m     /^-toggleDescription$/
+tok    c-src/etags.c   2491
+token  c-src/etags.c   2508
+token  y-src/cccp.y    437
+token  y-src/cccp.y    439
+tokenize       prol-src/natded.prolog  
/^tokenize([C1,C2,C3|Cs],Xs-Ys,TsResult):-     % spe/
+tokenizeatom   prol-src/natded.prolog  /^tokenizeatom(Atom,Ws):-$/
+tokentab2      y-src/cccp.y    442
+tool_bar_item_properties       c-src/emacs/src/keyboard.c      7970
+tool_bar_items c-src/emacs/src/keyboard.c      /^tool_bar_items (Lisp_Object 
reuse, int *nitems)$/
+tool_bar_items_vector  c-src/emacs/src/keyboard.c      7965
+toolkit_menubar_in_use c-src/emacs/src/keyboard.c      
/^toolkit_menubar_in_use (struct frame *f)$/
+top-level      c-src/emacs/src/keyboard.c      /^DEFUN ("top-level", 
Ftop_level, Stop_level, 0, 0, /
+top_level      merc-src/accumulator.m  /^:- type top_level$/
+top_level_1    c-src/emacs/src/keyboard.c      /^top_level_1 (Lisp_Object 
ignore)$/
+top_level_2    c-src/emacs/src/keyboard.c      /^top_level_2 (void)$/
+total_keys     c-src/emacs/src/keyboard.c      97
+total_size_of_entries  c-src/etags.c   /^total_size_of_entries (register node 
*np)$/
+total_surrounding      cp-src/conway.cpp       /^int 
site::total_surrounding(void)$/
+totally_unblock_input  c-src/emacs/src/keyboard.c      /^totally_unblock_input 
(void)$/
+tpcmd  c-src/h.h       15
+tpcmd  c-src/h.h       8
+track-mouse    c-src/emacs/src/keyboard.c      /^DEFUN 
("internal--track-mouse", Ftrack_mouse, Stra/
+tracking_off   c-src/emacs/src/keyboard.c      /^tracking_off (Lisp_Object 
old_value)$/
+traffic_light  cp-src/conway.cpp       /^void traffic_light(int x, int y)$/
+translate      c-src/emacs/src/regex.h 361
+treats cp-src/c.C      131
+tt     prol-src/natded.prolog  /^tt:-$/
+tt=cmtt10      tex-src/texinfo.tex     /^\\font\\deftt=cmtt10 scaled 
\\magstep1$/
+tty_read_avail_input   c-src/emacs/src/keyboard.c      /^tty_read_avail_input 
(struct terminal *terminal,$/
+ttypeseen      c-src/etags.c   2430
+typdef c-src/etags.c   2434
+type   c-src/emacs/src/gmalloc.c       145
+type   c-src/emacs/src/lisp.h  1973
+type   c-src/emacs/src/lisp.h  1980
+type   c-src/emacs/src/lisp.h  2034
+type   c-src/emacs/src/lisp.h  2112
+type   c-src/emacs/src/lisp.h  2203
+type   c-src/emacs/src/lisp.h  2276
+type   c-src/emacs/src/lisp.h  2286
+type   c-src/emacs/src/lisp.h  2296
+type   c-src/emacs/src/lisp.h  2304
+type   c-src/emacs/src/lisp.h  2364
+type   c-src/emacs/src/lisp.h  3025
+type   c-src/etags.c   2271
+typefunargs    tex-src/texinfo.tex     /^\\deftypefunargs {#3}\\endgroup %$/
+typefunargs    tex-src/texinfo.tex     /^\\deftypefunargs {#4}\\endgroup %$/
+typemargin     tex-src/texinfo.tex     /^\\newskip\\deftypemargin 
\\deftypemargin=12pt$/
+typemargin     tex-src/texinfo.tex     /^\\rlap{\\rightline{{\\rm #2}\\hskip 
\\deftypemargin}}}%/
+u      c-src/emacs/src/lisp.h  2397
+u_any  c-src/emacs/src/lisp.h  2214
+u_boolfwd      c-src/emacs/src/lisp.h  2371
+u_buffer_objfwd        c-src/emacs/src/lisp.h  2373
+u_finalizer    c-src/emacs/src/lisp.h  2219
+u_free c-src/emacs/src/lisp.h  2215
+u_intfwd       c-src/emacs/src/lisp.h  2370
+u_kboard_objfwd        c-src/emacs/src/lisp.h  2374
+u_marker       c-src/emacs/src/lisp.h  2216
+u_objfwd       c-src/emacs/src/lisp.h  2372
+u_overlay      c-src/emacs/src/lisp.h  2217
+u_save_value   c-src/emacs/src/lisp.h  2218
+unargs tex-src/texinfo.tex     /^\\defunargs {#2}\\endgroup %$/
+unargs tex-src/texinfo.tex     /^\\defunargs {#3}\\endgroup %$/
+unblock_input  c-src/emacs/src/keyboard.c      /^unblock_input (void)$/
+unblock_input_to       c-src/emacs/src/keyboard.c      /^unblock_input_to (int 
level)$/
+unchar c-src/h.h       99
+unexpand-abbrev        c-src/abbrev.c  /^DEFUN ("unexpand-abbrev", 
Funexpand_abbrev, Sunexp/
+univ   merc-src/accumulator.m  /^:- import_module univ.$/
+unravel_univ   merc-src/accumulator.m  /^:- some [T] pred 
unravel_univ(univ::in, T::out) is/
+unread_switch_frame    c-src/emacs/src/keyboard.c      204
+unsignedp      y-src/cccp.y    112
+unwind c-src/emacs/src/lisp.h  2962
+unwind_int     c-src/emacs/src/lisp.h  2972
+unwind_ptr     c-src/emacs/src/lisp.h  2967
+unwind_void    c-src/emacs/src/lisp.h  2976
+update_accumulator_pred        merc-src/accumulator.m  /^:- pred 
update_accumulator_pred(pred_id::in, proc_/
+uprintmax_t    c-src/emacs/src/lisp.h  149
+uprintmax_t    c-src/emacs/src/lisp.h  154
+usage  perl-src/yagrip.pl      /^sub usage {$/
+usecharno      c-src/etags.c   210
+used   c-src/emacs/src/regex.h 347
+used_syntax    c-src/emacs/src/regex.h 398
+user_cmp_function      c-src/emacs/src/lisp.h  1814
+user_error     c-src/emacs/src/keyboard.c      /^user_error (const char *msg)$/
+user_hash_function     c-src/emacs/src/lisp.h  1811
+user_signal_info       c-src/emacs/src/keyboard.c      7235
+user_signals   c-src/emacs/src/keyboard.c      7250
+usfreelock_ptr/t       ada-src/etags-test-for.ada      /^   type 
usfreelock_ptr is access$/
+val    c-src/emacs/src/lisp.h  3027
+val    c-src/emacs/src/lisp.h  691
+val    c-src/getopt.h  84
+val    prol-src/natded.prolog  /^val(X) --> ['['], valseq(X), [']'].$/
+valcell        c-src/emacs/src/lisp.h  2357
+valid  c-src/etags.c   220
+valid  c-src/etags.c   2502
+validate       php-src/lce_functions.php       /^      function 
validate($value)$/
+valloc c-src/emacs/src/gmalloc.c       /^valloc (size_t size)$/
+valseq prol-src/natded.prolog  /^valseq([Val|Vals]) --> val(Val), 
plusvalseq(Vals)./
+value  c-src/emacs/src/lisp.h  687
+value  y-src/cccp.y    112
+var    c-src/emacs/src/keyboard.c      11023
+var    c-src/emacs/src/lisp.h  3137
+varargs        tex-src/texinfo.tex     /^\\defvarargs {#2}\\endgroup %$/
+varargs        tex-src/texinfo.tex     /^\\defvarargs {#3}\\endgroup %$/
+varset merc-src/accumulator.m  /^:- import_module varset.$/
+vcopy  c-src/emacs/src/lisp.h  /^vcopy (Lisp_Object v, ptrdiff_t offset, 
Lisp_Objec/
+vectorlike_header      c-src/emacs/src/lisp.h  1343
+verde  cp-src/c.C      40
+verify-tags-table-function     el-src/emacs/lisp/progmodes/etags.el    
/^(defvar verify-tags-table-function nil$/
+verify_ascii   c-src/emacs/src/lisp.h  /^# define verify_ascii(str) (str)$/
+vignore        c-src/etags.c   2417
+visit-tags-table       el-src/emacs/lisp/progmodes/etags.el    /^(defun 
visit-tags-table (file &optional local)$/
+visit-tags-table-buffer        el-src/emacs/lisp/progmodes/etags.el    
/^(defun visit-tags-table-buffer (&optional cont)$/
+void   c-src/emacs/src/lisp.h  /^INLINE void (check_cons_list) (void) { 
lisp_h_chec/
+voidfuncptr    c-src/emacs/src/lisp.h  2108
+voidval        y-src/cccp.y    115
+wait_status_ptr_t      c.c     161
+waiting_for_input      c-src/emacs/src/keyboard.c      150
+warning        y-src/cccp.y    /^warning (msg)$/
+weak   c-src/emacs/src/lisp.h  1830
+weak_alias     c-src/emacs/src/gmalloc.c       /^weak_alias (free, cfree)$/
+web ftp publish        make-src/Makefile       /^web ftp publish:$/
+what   c-src/etags.c   252
+wheel_syms     c-src/emacs/src/keyboard.c      4628
+where  c-src/emacs/src/lisp.h  2348
+where  c-src/emacs/src/lisp.h  2980
+where  cp-src/clheir.hpp       77
+where_in_registry      cp-src/clheir.hpp       15
+windowWillClose        objcpp-src/SimpleCalc.M /^- windowWillClose:sender$/
+wipe_kboard    c-src/emacs/src/keyboard.c      /^wipe_kboard (KBOARD *kb)$/
+womboid        c-src/h.h       63
+womboid        c-src/h.h       75
+word_size      c-src/emacs/src/lisp.h  1473
+write  php-src/lce_functions.php       /^      function write($save="yes")$/
+write  php-src/lce_functions.php       /^      function write()$/
+write1=        ruby-src/test1.ru       /^    attr_reader :read1 , :read2; 
attr_writer :writ/
+write2=        ruby-src/test1.ru       /^    attr_reader :read1 , :read2; 
attr_writer :writ/
+write_abbrev   c-src/abbrev.c  /^write_abbrev (sym, stream)$/
+write_classname        c-src/etags.c   /^write_classname (linebuffer *cn, 
const char *quali/
+write_lex      prol-src/natded.prolog  /^write_lex(File):-$/
+write_lex_cat  prol-src/natded.prolog  /^write_lex_cat(File):-$/
+write_xyc      cp-src/screen.cpp       /^void write_xyc(int x, int y, char c)$/
+writebreak     prol-src/natded.prolog  /^writebreak([]).$/
+writebreaklex  prol-src/natded.prolog  /^writebreaklex([]).$/
+writecat       prol-src/natded.prolog  
/^writecat(np(ind(sng),nm(_)),np,[],[]):-!.$/
+writelist      prol-src/natded.prolog  /^writelist([der(Ws)|Ws2]):-$/
+writelistsubs  prol-src/natded.prolog  /^writelistsubs([],X):-$/
+writenamestring        pas-src/common.pas      /^procedure 
writenamestring;(*($/
+writesubs      prol-src/natded.prolog  /^writesubs([]).$/
+writesups      prol-src/natded.prolog  /^writesups([]).$/
+written        c-src/etags.c   211
+x      c.c     153
+x      c.c     179
+x      c.c     188
+x      c.c     189
+x      cp-src/c.C      53
+x      cp-src/c.C      80
+x      cp-src/clheir.hpp       49
+x      cp-src/clheir.hpp       58
+x      cp-src/conway.hpp       7
+x      cp-src/fail.C   10
+x      cp-src/fail.C   44
+x      tex-src/texinfo.tex     /^\\refx{#1-snt}{} [\\printednodename], 
page\\tie\\refx{/
+x-get-selection-internal       c.c     /^       Fx_get_selection_internal, 
Sx_get_selection/
+x-get-selection-internal       c.c     /^DEFUN ("x-get-selection-internal", 
Fx_get_selectio/
+xcar_addr      c-src/emacs/src/lisp.h  /^xcar_addr (Lisp_Object c)$/
+xcdr_addr      c-src/emacs/src/lisp.h  /^xcdr_addr (Lisp_Object c)$/
+xdiff  make-src/Makefile       /^xdiff: ETAGS EXTAGS ${infiles}$/
+xmalloc        c-src/etags.c   /^xmalloc (size_t size)$/
+xnew   c-src/etags.c   /^#define xnew(n, Type)      ((Type *) xmalloc ((n) /
+xrealloc       c-src/etags.c   /^xrealloc (void *ptr, size_t size)$/
+xref-etags-location    el-src/emacs/lisp/progmodes/etags.el    /^(defclass 
xref-etags-location (xref-location)$/
+xref-location-line     el-src/emacs/lisp/progmodes/etags.el    /^(cl-defmethod 
xref-location-line ((l xref-etags-lo/
+xref-location-marker   el-src/emacs/lisp/progmodes/etags.el    /^(cl-defmethod 
xref-location-marker ((l xref-etags-/
+xref-make-etags-location       el-src/emacs/lisp/progmodes/etags.el    
/^(defun xref-make-etags-location (tag-info file)$/
+xrnew  c-src/etags.c   /^#define xrnew(op, n, Type) ((op) = (Type *) xreall/
+xx     make-src/Makefile       /^xx="this line is here because of a fontlock 
bug$/
+xyz    ruby-src/test1.ru       /^    alias_method :xyz,$/
+y      cp-src/clheir.hpp       49
+y      cp-src/clheir.hpp       58
+y      cp-src/conway.hpp       7
+y-get-selection-internal       c.c     /^      Fy_get_selection_internal, 
Sy_get_selection_/
+yyalloc        /usr/share/bison/bison.simple   83
+yyalloc        /usr/share/bison/bison.simple   84
+yyclearin      /usr/share/bison/bison.simple   149
+yyclearin      /usr/share/bison/bison.simple   150
+yydebug        /usr/share/bison/bison.simple   237
+yydebug        /usr/share/bison/bison.simple   238
+yyerrhandle    /usr/share/bison/bison.simple   848
+yyerrlab1      /usr/share/bison/bison.simple   823
+yyerrok        /usr/share/bison/bison.simple   148
+yyerrok        /usr/share/bison/bison.simple   149
+yyerror        y-src/cccp.y    /^yyerror (s)$/
+yyerrstatus    /usr/share/bison/bison.simple   846
+yylex  y-src/cccp.y    /^yylex ()$/
+yyls   /usr/share/bison/bison.simple   88
+yyls   /usr/share/bison/bison.simple   89
+yylsp  /usr/share/bison/bison.simple   748
+yylsp  /usr/share/bison/bison.simple   921
+yymemcpy       /usr/share/bison/bison.simple   /^yymemcpy (char *yyto, const 
char *yyfrom, YYSIZE_T/
+yymemcpy       /usr/share/bison/bison.simple   264
+yymemcpy       /usr/share/bison/bison.simple   265
+yyn    /usr/share/bison/bison.simple   755
+yyn    /usr/share/bison/bison.simple   861
+yyn    /usr/share/bison/bison.simple   895
+yyn    /usr/share/bison/bison.simple   903
+yynewstate     /usr/share/bison/bison.simple   763
+yynewstate     /usr/share/bison/bison.simple   925
+yyparse        /usr/share/bison/bison.simple   /^yyparse (YYPARSE_PARAM_ARG)$/
+yyresult       /usr/share/bison/bison.simple   932
+yyresult       /usr/share/bison/bison.simple   939
+yyresult       /usr/share/bison/bison.simple   947
+yyreturn       /usr/share/bison/bison.simple   933
+yyreturn       /usr/share/bison/bison.simple   940
+yyss   /usr/share/bison/bison.simple   85
+yyss   /usr/share/bison/bison.simple   86
+yystate        /usr/share/bison/bison.simple   757
+yystate        /usr/share/bison/bison.simple   761
+yystate        /usr/share/bison/bison.simple   875
+yystate        /usr/share/bison/bison.simple   924
+yystpcpy       /usr/share/bison/bison.simple   /^yystpcpy (char *yydest, const 
char *yysrc)$/
+yystpcpy       /usr/share/bison/bison.simple   316
+yystpcpy       /usr/share/bison/bison.simple   317
+yystrlen       /usr/share/bison/bison.simple   /^yystrlen (const char *yystr)$/
+yystrlen       /usr/share/bison/bison.simple   293
+yystrlen       /usr/share/bison/bison.simple   294
+yyvs   /usr/share/bison/bison.simple   86
+yyvs   /usr/share/bison/bison.simple   87
+yyvsp  /usr/share/bison/bison.simple   746
+yyvsp  /usr/share/bison/bison.simple   919
+z      c.c     144
+z      c.c     164
+z      cp-src/clheir.hpp       49
+z      cp-src/clheir.hpp       58
+|      tex-src/texinfo.tex     /^\\def|{{\\tt \\char '174}}$/
+~      tex-src/texinfo.tex     /^\\def~{{\\tt \\char '176}}$/
+~A     cp-src/c.C      /^A::~A() {}$/
+~B     cp-src/c.C      /^    ~B() {};$/
+~MDiagArray2   cp-src/MDiagArray2.h    /^  ~MDiagArray2 (void) { }$/
+~generic_object        cp-src/clheir.cpp       
/^generic_object::~generic_object(void)$/
diff --git a/test/manual/etags/CTAGS.good_update 
b/test/manual/etags/CTAGS.good_update
new file mode 100644
index 0000000000..c618b9582d
--- /dev/null
+++ b/test/manual/etags/CTAGS.good_update
@@ -0,0 +1,4483 @@
+
+#a-defer-word  forth-src/test-forth.fth        /^defer #a-defer-word$/
+#some-storage  forth-src/test-forth.fth        /^2000 buffer: #some-storage$/
+$0x80  c-src/sysdep.h  32
+$SYS_##syscall_na      c-src/sysdep.h  31
+$domain        php-src/lce_functions.php       175
+$filename      php-src/lce_functions.php       174
+$ignore_ws     php-src/lce_functions.php       171
+$memassign     php-src/ptest.php       9
+$memassign_space       php-src/ptest.php       10
+$member        php-src/ptest.php       8
+$msgid php-src/lce_functions.php       107
+$msgid php-src/lce_functions.php       165
+$msgid_lc      php-src/lce_functions.php       113
+$msgstr        php-src/lce_functions.php       108
+$msgstr        php-src/lce_functions.php       166
+$msgstr_lc     php-src/lce_functions.php       114
+$po_entries    php-src/lce_functions.php       172
+$poe_num       php-src/lce_functions.php       173
+$por_a php-src/lce_functions.php       500
+$prefix        php-src/lce_functions.php       72
+$state php-src/lce_functions.php       170
+$sys_comment   php-src/lce_functions.php       110
+$sys_comment   php-src/lce_functions.php       168
+$sys_comment_lc        php-src/lce_functions.php       116
+$test  php-src/ptest.php       12
+$unk_comment   php-src/lce_functions.php       111
+$unk_comment   php-src/lce_functions.php       169
+$unk_comment_lc        php-src/lce_functions.php       117
+$user_comment  php-src/lce_functions.php       109
+$user_comment  php-src/lce_functions.php       167
+$user_comment_lc       php-src/lce_functions.php       115
+${CHECKOBJS}   make-src/Makefile       /^${CHECKOBJS}: CFLAGS=-g3 
-DNULLFREECHECK=0$/
+%cdiff make-src/Makefile       /^%cdiff: CTAGS% CTAGS ${infiles}$/
+%ediff make-src/Makefile       /^%ediff: ETAGS% ETAGS ${infiles}$/
+($_,$flag,$opt,$f,$r,@temp     perl-src/yagrip.pl      8
+($prog,$_,@list        perl-src/yagrip.pl      39
+($string,$flag,@string,@temp,@last     perl-src/yagrip.pl      40
+(a-forth-constant      forth-src/test-forth.fth        /^constant 
(a-forth-constant$/
+(another-forth-word)   forth-src/test-forth.fth        /^: 
(another-forth-word) ( -- )$/
+(foo)  forth-src/test-forth.fth        /^: (foo) 1 ;$/
++      ruby-src/test.rb        /^        def +(y)$/
++      tex-src/texinfo.tex     /^\\def+{{\\tt \\char 43}}$/
+.PRECIOUS      make-src/Makefile       /^.PRECIOUS: ETAGS CTAGS ETAGS16 
CTAGS16 ETAGS17 CTA/
+/.notdef       ps-src/rfc1245.ps       /^\/.notdef \/.notdef \/.notdef 
\/.notdef \/.notdef \/.not/
+/.notdef       ps-src/rfc1245.ps       /^\/.notdef \/.notdef \/.notdef 
\/.notdef \/space \/exclam/
+/A     ps-src/rfc1245.ps       /^\/A { $/
+/Acircumflex   ps-src/rfc1245.ps       /^\/Acircumflex \/Ecircumflex \/Aacute 
\/Edieresis \/Egra/
+/B     ps-src/rfc1245.ps       /^\/B { $/
+/BEGINBITMAP2BIT       ps-src/rfc1245.ps       /^\/BEGINBITMAP2BIT { $/
+/BEGINBITMAP2BITc      ps-src/rfc1245.ps       /^\/BEGINBITMAP2BITc { $/
+/BEGINBITMAPBW ps-src/rfc1245.ps       /^\/BEGINBITMAPBW { $/
+/BEGINBITMAPBWc        ps-src/rfc1245.ps       /^\/BEGINBITMAPBWc { $/
+/BEGINBITMAPGRAY       ps-src/rfc1245.ps       /^\/BEGINBITMAPGRAY { $/
+/BEGINBITMAPGRAYc      ps-src/rfc1245.ps       /^\/BEGINBITMAPGRAYc { $/
+/BEGINPRINTCODE        ps-src/rfc1245.ps       /^\/BEGINPRINTCODE { $/
+/BF    ps-src/rfc1245.ps       /^\/BF { $/
+/BITMAPCOLOR   ps-src/rfc1245.ps       /^\/BITMAPCOLOR { $/
+/BITMAPCOLORc  ps-src/rfc1245.ps       /^\/BITMAPCOLORc { $/
+/BITMAPGRAY    ps-src/rfc1245.ps       /^\/BITMAPGRAY { $/
+/BITMAPGRAYc   ps-src/rfc1245.ps       /^\/BITMAPGRAYc { $/
+/C     ps-src/rfc1245.ps       /^\/C { $/
+/COMMONBITMAP  ps-src/rfc1245.ps       /^\/COMMONBITMAP { $/
+/COMMONBITMAPc ps-src/rfc1245.ps       /^\/COMMONBITMAPc { $/
+/D     ps-src/rfc1245.ps       /^\/D {curveto} bind def$/
+/DiacriticEncoding     ps-src/rfc1245.ps       /^\/DiacriticEncoding [$/
+/E     ps-src/rfc1245.ps       /^\/E {lineto} bind def$/
+/ENDBITMAP     ps-src/rfc1245.ps       /^\/ENDBITMAP {$/
+/ENDPRINTCODE  ps-src/rfc1245.ps       /^\/ENDPRINTCODE {$/
+/F     ps-src/rfc1245.ps       /^\/F { $/
+/FMBEGINEPSF   ps-src/rfc1245.ps       /^\/FMBEGINEPSF { $/
+/FMBEGINPAGE   ps-src/rfc1245.ps       /^\/FMBEGINPAGE { $/
+/FMDEFINEFONT  ps-src/rfc1245.ps       /^\/FMDEFINEFONT { $/
+/FMDOCUMENT    ps-src/rfc1245.ps       /^\/FMDOCUMENT { $/
+/FMENDEPSF     ps-src/rfc1245.ps       /^\/FMENDEPSF {$/
+/FMENDPAGE     ps-src/rfc1245.ps       /^\/FMENDPAGE {$/
+/FMLOCAL       ps-src/rfc1245.ps       /^\/FMLOCAL {$/
+/FMNORMALIZEGRAPHICS   ps-src/rfc1245.ps       /^\/FMNORMALIZEGRAPHICS { $/
+/FMVERSION     ps-src/rfc1245.ps       /^\/FMVERSION {$/
+/FMversion     ps-src/rfc1245.ps       /^\/FMversion (2.0) def $/
+/Fmcc  ps-src/rfc1245.ps       /^\/Fmcc {$/
+/FrameDict     ps-src/rfc1245.ps       /^\/FrameDict 190 dict def $/
+/G     ps-src/rfc1245.ps       /^\/G { $/
+/H     ps-src/rfc1245.ps       /^\/H { $/
+/Icircumflex   ps-src/rfc1245.ps       /^\/Icircumflex \/Idieresis \/Igrave 
\/Oacute \/Ocircumfl/
+/L     ps-src/rfc1245.ps       /^\/L \/M \/N \/O \/P \/Q \/R \/S \/T \/U \/V 
\/W \/X \/Y \/Z \/brac/
+/L     ps-src/rfc1245.ps       /^\/L { $/
+/M     ps-src/rfc1245.ps       /^\/M {newpath moveto} bind def$/
+/N     ps-src/rfc1245.ps       /^\/N { $/
+/Ntilde        ps-src/rfc1245.ps       /^\/Ntilde \/Odieresis \/Udieresis 
\/aacute \/agrave \/aci/
+/O     ps-src/rfc1245.ps       /^\/O {closepath} bind def$/
+/Otilde        ps-src/rfc1245.ps       /^\/Otilde \/OE \/oe \/endash \/emdash 
\/quotedblleft \/quo/
+/P     ps-src/rfc1245.ps       /^\/P { $/
+/PF    ps-src/rfc1245.ps       /^\/PF { $/
+/R     ps-src/rfc1245.ps       /^\/R { $/
+/RF    ps-src/rfc1245.ps       /^\/RF { $/
+/RR    ps-src/rfc1245.ps       /^\/RR { $/
+/ReEncode      ps-src/rfc1245.ps       /^\/ReEncode { $/
+/S     ps-src/rfc1245.ps       /^\/S { $/
+/SF    ps-src/rfc1245.ps       /^\/SF { $/
+/T     ps-src/rfc1245.ps       /^\/T { $/
+/TF    ps-src/rfc1245.ps       /^\/TF { $/
+/U     ps-src/rfc1245.ps       /^\/U { $/
+/Uacute        ps-src/rfc1245.ps       /^\/Uacute \/Ucircumflex \/Ugrave 
\/dotlessi \/circumflex/
+/V     ps-src/rfc1245.ps       /^\/V { $/
+/W     ps-src/rfc1245.ps       /^\/W { $/
+/X     ps-src/rfc1245.ps       /^\/X { $/
+/Y     ps-src/rfc1245.ps       /^\/Y { $/
+/Z     ps-src/rfc1245.ps       /^\/Z {$/
+/atilde        ps-src/rfc1245.ps       /^\/atilde \/aring \/ccedilla \/eacute 
\/egrave \/ecircumf/
+/bl    ps-src/rfc1245.ps       /^\/bl { $/
+/braceright    ps-src/rfc1245.ps       /^\/braceright \/asciitilde \/.notdef 
\/Adieresis \/Aring/
+/bracketright  ps-src/rfc1245.ps       /^\/bracketright \/asciicircum 
\/underscore \/grave \/a \//
+/breve ps-src/rfc1245.ps       /^\/breve \/dotaccent \/ring \/cedilla 
\/hungarumlaut \/og/
+/cfs   ps-src/rfc1245.ps       /^\/cfs { $/
+/colorsetup    ps-src/rfc1245.ps       /^\/colorsetup {$/
+/desperatepapersize    ps-src/rfc1245.ps       /^\/desperatepapersize {$/
+/dieresis      ps-src/rfc1245.ps       /^\/dieresis \/.notdef \/AE \/Oslash 
\/.notdef \/.notdef \//
+/dmatrix       ps-src/rfc1245.ps       /^\/dmatrix matrix def$/
+/dnormalize    ps-src/rfc1245.ps       /^\/dnormalize {$/
+/dpi   ps-src/rfc1245.ps       /^\/dpi    72 0 dmatrix defaultmatrix 
dtransform$/
+/exclamdown    ps-src/rfc1245.ps       /^\/exclamdown \/logicalnot \/.notdef 
\/florin \/.notdef /
+/fakecolorsetup        ps-src/rfc1245.ps       /^\/fakecolorsetup {$/
+/fillprocs     ps-src/rfc1245.ps       /^\/fillprocs 32 array def$/
+/fl    ps-src/rfc1245.ps       /^\/fl { $/
+/fraction      ps-src/rfc1245.ps       /^\/fraction \/currency \/guilsinglleft 
\/guilsinglright/
+/freq  ps-src/rfc1245.ps       /^\/freq dpi 18.75 div 8 div round dup 0 eq 
{pop 1} i/
+/gn    ps-src/rfc1245.ps       /^\/gn { $/
+/graymode      ps-src/rfc1245.ps       /^\/graymode true def$/
+/grayness      ps-src/rfc1245.ps       /^\/grayness {$/
+/guillemotleft ps-src/rfc1245.ps       /^\/guillemotleft \/guillemotright 
\/ellipsis \/.notdef /
+/home/www/pub/etags.c.gz       make-src/Makefile       
/^\/home\/www\/pub\/etags.c.gz: etags.c$/
+/home/www/pub/software/unix/etags.tar.gz       make-src/Makefile       
/^\/home\/www\/pub\/software\/unix\/etags.tar.gz: Makefile/
+/hx    ps-src/rfc1245.ps       /^\/hx { $/
+/i     ps-src/rfc1245.ps       /^\/i \/j \/k \/l \/m \/n \/o \/p \/q \/r \/s 
\/t \/u \/v \/w \/x \/y/
+/iacute        ps-src/rfc1245.ps       /^\/iacute \/igrave \/icircumflex 
\/idieresis \/ntilde \/o/
+/ic    ps-src/rfc1245.ps       /^\/ic [ $/
+/inch  ps-src/rfc1245.ps       /^\/inch {72 mul} def$/
+/ip    ps-src/rfc1245.ps       /^\/ip { $/
+/less  ps-src/rfc1245.ps       /^\/less \/equal \/greater \/question \/at \/A 
\/B \/C \/D \/E/
+/lnormalize    ps-src/rfc1245.ps       /^\/lnormalize { $/
+/manualpapersize       ps-src/rfc1245.ps       /^\/manualpapersize {$/
+/max   ps-src/rfc1245.ps       /^\/max {2 copy lt {exch} if pop} bind def$/
+/min   ps-src/rfc1245.ps       /^\/min {2 copy gt {exch} if pop} bind def$/
+/ms    ps-src/rfc1245.ps       /^\/ms { $/
+/nbluet        ps-src/rfc1245.ps       /^\/nbluet 256 array def$/
+/ngrayt        ps-src/rfc1245.ps       /^\/ngrayt 256 array def$/
+/ngreent       ps-src/rfc1245.ps       /^\/ngreent 256 array def$/
+/normalize     ps-src/rfc1245.ps       /^\/normalize {$/
+/nredt ps-src/rfc1245.ps       /^\/nredt 256 array def$/
+/numbersign    ps-src/rfc1245.ps       /^\/numbersign \/dollar \/percent 
\/ampersand \/quotesing/
+/ocircumflex   ps-src/rfc1245.ps       /^\/ocircumflex \/odieresis \/otilde 
\/uacute \/ugrave \/u/
+/ordfeminine   ps-src/rfc1245.ps       /^\/ordfeminine \/ordmasculine 
\/.notdef \/ae \/oslash \/q/
+/pagedimen     ps-src/rfc1245.ps       /^\/pagedimen { $/
+/papersize     ps-src/rfc1245.ps       /^\/papersize {$/
+/paragraph     ps-src/rfc1245.ps       /^\/paragraph \/germandbls \/registered 
\/copyright \/tra/
+/parenright    ps-src/rfc1245.ps       /^\/parenright \/asterisk \/plus 
\/comma \/hyphen \/period/
+/periodcentered        ps-src/rfc1245.ps       /^\/periodcentered 
\/quotesinglbase \/quotedblbase \/per/
+/quoteleft     ps-src/rfc1245.ps       /^\/quoteleft \/quoteright \/.notdef 
\/.notdef \/ydieresi/
+/restorematrix ps-src/rfc1245.ps       /^\/restorematrix {$/
+/s1    ps-src/rfc1245.ps       /^\/s1 1 string def$/
+/sangle        ps-src/rfc1245.ps       /^\/sangle 1 0 dmatrix defaultmatrix 
dtransform exch /
+/savematrix    ps-src/rfc1245.ps       /^\/savematrix {$/
+/setmanualfeed ps-src/rfc1245.ps       /^\/setmanualfeed {$/
+/setpapername  ps-src/rfc1245.ps       /^\/setpapername { $/
+/setpattern    ps-src/rfc1245.ps       /^\/setpattern {$/
+/two   ps-src/rfc1245.ps       /^\/two \/three \/four \/five \/six \/seven 
\/eight \/nine \//
+/udieresis     ps-src/rfc1245.ps       /^\/udieresis \/dagger \/.notdef \/cent 
\/sterling \/secti/
+/wbytes        ps-src/rfc1245.ps       /^\/wbytes { $/
+/wh    ps-src/rfc1245.ps       /^\/wh { $/
+/yen   ps-src/rfc1245.ps       /^\/yen \/.notdef \/.notdef \/.notdef \/.notdef 
\/.notdef /
+2const forth-src/test-forth.fth        /^3 4 2constant 2const$/
+2val   forth-src/test-forth.fth        /^2const 2value 2val$/
+2var   forth-src/test-forth.fth        /^2variable 2var$/
+:a-forth-dictionary-entry      forth-src/test-forth.fth        /^create 
:a-forth-dictionary-entry$/
+<      tex-src/texinfo.tex     /^\\def<{{\\tt \\less}}$/
+<<     ruby-src/test.rb        /^        def <<(y)$/
+<=     ruby-src/test.rb        /^        def <=(y)$/
+<=>    ruby-src/test.rb        /^        def <=>(y)$/
+=      tex-src/texinfo.tex     /^\\global\\def={{\\tt \\char 61}}}$/
+=      tex-src/texinfo.tex     /^\\global\\let\\section = \\appendixsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\section = \\numberedsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\section = \\unnumberedsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsection = \\appendixsubsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsection = \\numberedsubsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsection = 
\\unnumberedsubsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsubsection = 
\\appendixsubsubsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsubsection = 
\\numberedsubsubsec$/
+=      tex-src/texinfo.tex     /^\\global\\let\\subsubsection = 
\\unnumberedsubsubsec$/
+=/f    ada-src/etags-test-for.ada      /^   function "=" (L, R : 
System.Address) return Boo/
+==     ruby-src/test.rb        /^        def ==(y)$/
+===    ruby-src/test.rb        /^        def ===(y)$/
+=\indexdummyfont       tex-src/texinfo.tex     /^\\let\\cite=\\indexdummyfont$/
+=\relax        tex-src/texinfo.tex     /^\\let\\appendix=\\relax$/
+=\relax        tex-src/texinfo.tex     /^\\let\\chapter=\\relax$/
+=\relax        tex-src/texinfo.tex     /^\\let\\section=\\relax$/
+=\relax        tex-src/texinfo.tex     /^\\let\\subsection=\\relax$/
+=\relax        tex-src/texinfo.tex     /^\\let\\subsubsection=\\relax$/
+=\smartitalic  tex-src/texinfo.tex     /^\\let\\cite=\\smartitalic$/
+=starts-with-equals!   scm-src/test.scm        /^(define =starts-with-equals! 
#t)$/
+>      tex-src/texinfo.tex     /^\\def>{{\\tt \\gtr}}$/
+>field1        forth-src/test-forth.fth        /^   9   field   >field1$/
+>field2        forth-src/test-forth.fth        /^   5   field   >field2$/
+A      c.c     162
+A      cp-src/c.C      /^void A::A() {}$/
+A      cp-src/c.C      117
+A      cp-src/c.C      39
+A      cp-src/c.C      56
+A      cp-src/c.C      57
+A      cp-src/c.C      73
+A      cp-src/fail.C   23
+A      cp-src/fail.C   7
+A      ruby-src/test1.ru       /^class A$/
+A      ruby-src/test1.ru       /^module A$/
+ABC    ruby-src/test1.ru       11
+ADASRC make-src/Makefile       /^ADASRC=etags-test-for.ada 2ataspri.adb 
2ataspri.ad/
+ADDRESS        c-src/emacs/src/gmalloc.c       /^#define ADDRESS(B)    ((void 
*) (((B) - 1) * BLOCKSIZ/
+ALIGNOF_STRUCT_LISP_VECTOR     c-src/emacs/src/lisp.h  1378
+ALLOCATED_BEFORE_DUMPING       c-src/emacs/src/gmalloc.c       /^#define 
ALLOCATED_BEFORE_DUMPING(P) \\$/
+ALLOCATE_PSEUDOVECTOR  c-src/emacs/src/lisp.h  /^#define 
ALLOCATE_PSEUDOVECTOR(type, field, tag)                       /
+ALLOCATE_ZEROED_PSEUDOVECTOR   c-src/emacs/src/lisp.h  /^#define 
ALLOCATE_ZEROED_PSEUDOVECTOR(type, field, /
+AND    y-src/cccp.c    11
+ANSIC  c-src/h.h       84
+ANSIC  c-src/h.h       85
+AREF   c-src/emacs/src/lisp.h  /^AREF (Lisp_Object array, ptrdiff_t idx)$/
+ARGS   make-src/Makefile       /^ARGS=- < srclist$/
+ARITH_EQUAL    c-src/emacs/src/lisp.h  3498
+ARITH_GRTR     c-src/emacs/src/lisp.h  3501
+ARITH_GRTR_OR_EQUAL    c-src/emacs/src/lisp.h  3503
+ARITH_LESS     c-src/emacs/src/lisp.h  3500
+ARITH_LESS_OR_EQUAL    c-src/emacs/src/lisp.h  3502
+ARITH_NOTEQUAL c-src/emacs/src/lisp.h  3499
+ARRAYELTS      c-src/emacs/src/lisp.h  /^#define ARRAYELTS(arr) (sizeof (arr) 
\/ sizeof (arr/
+ARRAYP c-src/emacs/src/lisp.h  /^ARRAYP (Lisp_Object x)$/
+ARRAY_MARK_FLAG        c-src/emacs/src/lisp.h  768
+ASCII_CHAR_P   c-src/emacs/src/lisp.h  /^#define ASCII_CHAR_P(c) UNSIGNED_CMP 
(c, <, 0x80)$/
+ASET   c-src/emacs/src/lisp.h  /^ASET (Lisp_Object array, ptrdiff_t idx, 
Lisp_Objec/
+ASIZE  c-src/emacs/src/lisp.h  /^ASIZE (Lisp_Object array)$/
+ASRC   make-src/Makefile       /^ASRC=empty.zz empty.zz.gz$/
+AST_Array::AST_Array   cp-src/c.C      /^AST_Array::AST_Array(UTL_ScopedName 
*n, unsigned l/
+AST_ConcreteType::AST_ConcreteType     cp-src/c.C      
/^AST_ConcreteType::AST_ConcreteType(AST_Decl::NodeT/
+AST_Root       cp-src/c.C      92
+AT     cp-src/c.C      52
+AU     cp-src/c.C      53
+AUTOLOADP      c-src/emacs/src/lisp.h  /^AUTOLOADP (Lisp_Object x)$/
+AUTO_CONS      c-src/emacs/src/lisp.h  /^#define AUTO_CONS(name, a, b) 
Lisp_Object name = A/
+AUTO_CONS_EXPR c-src/emacs/src/lisp.h  /^#define AUTO_CONS_EXPR(a, b) \\$/
+AUTO_LIST1     c-src/emacs/src/lisp.h  /^#define AUTO_LIST1(name, a)           
                                \\$/
+AUTO_LIST2     c-src/emacs/src/lisp.h  /^#define AUTO_LIST2(name, a, b)        
                                        \\$/
+AUTO_LIST3     c-src/emacs/src/lisp.h  /^#define AUTO_LIST3(name, a, b, c)     
                                \\$/
+AUTO_LIST4     c-src/emacs/src/lisp.h  /^#define AUTO_LIST4(name, a, b, c, d)  
                                \\$/
+AUTO_STRING    c-src/emacs/src/lisp.h  /^#define AUTO_STRING(name, str)        
                                        \\$/
+AVAIL_ALLOCA   c-src/emacs/src/lisp.h  /^#define AVAIL_ALLOCA(size) (sa_avail 
-= (size), al/
+Abort_Handler_Pointer/t        ada-src/2ataspri.ads    /^   type 
Abort_Handler_Pointer is access procedure /
+Abort_Task/p   ada-src/2ataspri.adb    /^   procedure Abort_Task (T : TCB_Ptr) 
is$/
+Abort_Task/p   ada-src/2ataspri.ads    /^   procedure Abort_Task (T : 
TCB_Ptr);$/
+Abort_Wrapper/p        ada-src/2ataspri.adb    /^   procedure Abort_Wrapper$/
+Ada_funcs      c-src/etags.c   /^Ada_funcs (FILE *inf)$/
+Ada_getit      c-src/etags.c   /^Ada_getit (FILE *inf, const char 
*name_qualifier)$/
+Ada_help       c-src/etags.c   475
+Ada_suffixes   c-src/etags.c   473
+AddNullToNmStr pas-src/common.pas      /^function AddNullToNmStr; (*($/
+Address_To_Call_State/f        ada-src/2ataspri.adb    /^      function 
Address_To_Call_State is new$/
+Address_To_TCB_Ptr/f   ada-src/2ataspri.ads    /^   function 
Address_To_TCB_Ptr is new$/
+Advanced usage tex-src/gzip.texi       /^@node Advanced usage, Environment, 
Invoking gzip, /
+Aligned_Cons   c-src/emacs/src/lisp.h  4670
+Aligned_String c-src/emacs/src/lisp.h  4676
+AppendTextString       pas-src/common.pas      /^function 
AppendTextString;(*($/
+Arith_Comparison       c-src/emacs/src/lisp.h  3497
+Asm_help       c-src/etags.c   504
+Asm_labels     c-src/etags.c   /^Asm_labels (FILE *inf)$/
+Asm_suffixes   c-src/etags.c   493
+B      cp-src/c.C      /^void B::B() {}$/
+B      cp-src/c.C      122
+B      cp-src/c.C      54
+B      cp-src/c.C      56
+B      cp-src/c.C      74
+B      cp-src/fail.C   24
+B      cp-src/fail.C   8
+B      ruby-src/test1.ru       /^  class B$/
+BE_Node        cp-src/c.C      /^void BE_Node::BE_Node() {}$/
+BE_Node        cp-src/c.C      77
+BITS_PER_BITS_WORD     c-src/emacs/src/lisp.h  125
+BITS_PER_BITS_WORD     c-src/emacs/src/lisp.h  129
+BITS_PER_CHAR  c-src/emacs/src/lisp.h  136
+BITS_PER_EMACS_INT     c-src/emacs/src/lisp.h  139
+BITS_PER_LONG  c-src/emacs/src/lisp.h  138
+BITS_PER_SHORT c-src/emacs/src/lisp.h  137
+BITS_WORD_MAX  c-src/emacs/src/lisp.h  124
+BITS_WORD_MAX  c-src/emacs/src/lisp.h  128
+BLACK  cp-src/screen.hpp       12
+BLOCK  c-src/emacs/src/gmalloc.c       /^#define BLOCK(A)      (((char *) (A) 
- _heapbase) \/ BLO/
+BLOCKIFY       c-src/emacs/src/gmalloc.c       /^#define BLOCKIFY(SIZE)        
(((SIZE) + BLOCKSIZE - 1) \//
+BLOCKLOG       c-src/emacs/src/gmalloc.c       125
+BLOCKSIZE      c-src/emacs/src/gmalloc.c       126
+BLUE   cp-src/screen.hpp       13
+BOOL_VECTOR_BITS_PER_CHAR      c-src/emacs/src/lisp.h  114
+BOOL_VECTOR_BITS_PER_CHAR      c-src/emacs/src/lisp.h  115
+BOOL_VECTOR_P  c-src/emacs/src/lisp.h  /^BOOL_VECTOR_P (Lisp_Object a)$/
+BROWN  cp-src/screen.hpp       18
+BUFFERP        c-src/emacs/src/lisp.h  /^BUFFERP (Lisp_Object a)$/
+BUFFERSIZE     objc-src/Subprocess.h   43
+BUFFER_OBJFWDP c-src/emacs/src/lisp.h  /^BUFFER_OBJFWDP (union Lisp_Fwd *a)$/
+BYTE_MARK_STACK        c-src/emacs/src/lisp.h  3181
+Bar    lua-src/test.lua        /^function Square.something:Bar ()$/
+Bar    perl-src/kai-test.pl    /^package Bar;$/
+Barrier_Function_Pointer/t     ada-src/etags-test-for.ada      /^   type 
Barrier_Function_Pointer is access$/
+Bidule/b       ada-src/etags-test-for.ada      /^  protected body Bidule is$/
+Bidule/b       ada-src/waroquiers.ada  /^  protected body Bidule is$/
+Bidule/t       ada-src/etags-test-for.ada      /^  protected Bidule is$/
+Bidule/t       ada-src/waroquiers.ada  /^  protected Bidule is$/
+Body_Required/f        ada-src/etags-test-for.ada      /^   function 
Body_Required$/
+Boo    cp-src/c.C      /^    Boo(int _i, int _a, int _b) : i(_i), a(_a), b(/
+Boo    cp-src/c.C      129
+Boo::Boo       cp-src/c.C      /^Boo::Boo(Boo) :$/
+ButtonBar      pyt-src/server.py       /^def ButtonBar(frame, legend, ref, 
alternatives, co/
+C      cp-src/fail.C   /^                         C(int i) {x = i;}$/
+C      cp-src/fail.C   25
+C      cp-src/fail.C   9
+CALLMANY       c-src/emacs/src/lisp.h  /^#define CALLMANY(f, array) (f) 
(ARRAYELTS (array),/
+CALLN  c-src/emacs/src/lisp.h  /^#define CALLN(f, ...) CALLMANY (f, 
((Lisp_Object [/
+CAR    c-src/emacs/src/lisp.h  /^CAR (Lisp_Object c)$/
+CAR_SAFE       c-src/emacs/src/lisp.h  /^CAR_SAFE (Lisp_Object c)$/
+CATCHER        c-src/emacs/src/lisp.h  3021
+CDR    c-src/emacs/src/lisp.h  /^CDR (Lisp_Object c)$/
+CDR_SAFE       c-src/emacs/src/lisp.h  /^CDR_SAFE (Lisp_Object c)$/
+CFLAGS make-src/Makefile       /^CFLAGS=${WARNINGS} -ansi -g3 # -pg -O$/
+CHAR   c-src/etags.c   /^#define CHAR(x)               ((unsigned int)(x) & 
(CHARS - 1))/
+CHAR   y-src/cccp.c    7
+CHARACTERBITS  c-src/emacs/src/lisp.h  2457
+CHARS  c-src/etags.c   157
+CHARTAB_SIZE_BITS      c-src/emacs/src/lisp.h  1565
+CHARTAB_SIZE_BITS_0    c-src/emacs/src/lisp.h  1567
+CHARTAB_SIZE_BITS_1    c-src/emacs/src/lisp.h  1568
+CHARTAB_SIZE_BITS_2    c-src/emacs/src/lisp.h  1569
+CHARTAB_SIZE_BITS_3    c-src/emacs/src/lisp.h  1570
+CHAR_ALT       c-src/emacs/src/lisp.h  2445
+CHAR_BIT       c-src/emacs/src/lisp.h  2957
+CHAR_BIT       c-src/emacs/src/lisp.h  2959
+CHAR_BIT       c-src/emacs/src/lisp.h  2964
+CHAR_BIT       c-src/emacs/src/lisp.h  2969
+CHAR_BIT       c-src/emacs/src/lisp.h  2974
+CHAR_BIT       c-src/emacs/src/lisp.h  2978
+CHAR_BIT       c-src/emacs/src/lisp.h  2983
+CHAR_CLASS_MAX_LENGTH  c-src/emacs/src/regex.h 593
+CHAR_CLASS_MAX_LENGTH  c-src/emacs/src/regex.h 597
+CHAR_CLASS_MAX_LENGTH  c-src/emacs/src/regex.h 605
+CHAR_CTL       c-src/emacs/src/lisp.h  2449
+CHAR_HYPER     c-src/emacs/src/lisp.h  2447
+CHAR_META      c-src/emacs/src/lisp.h  2450
+CHAR_MODIFIER_MASK     c-src/emacs/src/lisp.h  2452
+CHAR_SHIFT     c-src/emacs/src/lisp.h  2448
+CHAR_SUPER     c-src/emacs/src/lisp.h  2446
+CHAR_TABLE_EXTRA_SLOTS c-src/emacs/src/lisp.h  /^CHAR_TABLE_EXTRA_SLOTS 
(struct Lisp_Char_Table *ct/
+CHAR_TABLE_P   c-src/emacs/src/lisp.h  /^CHAR_TABLE_P (Lisp_Object a)$/
+CHAR_TABLE_REF c-src/emacs/src/lisp.h  /^CHAR_TABLE_REF (Lisp_Object ct, int 
idx)$/
+CHAR_TABLE_REF_ASCII   c-src/emacs/src/lisp.h  /^CHAR_TABLE_REF_ASCII 
(Lisp_Object ct, ptrdiff_t id/
+CHAR_TABLE_SET c-src/emacs/src/lisp.h  /^CHAR_TABLE_SET (Lisp_Object ct, int 
idx, Lisp_Obje/
+CHAR_TABLE_STANDARD_SLOTS      c-src/emacs/src/lisp.h  1697
+CHAR_TYPE_SIZE y-src/cccp.y    87
+CHECKFLAGS     make-src/Makefile       /^CHECKFLAGS=-DDEBUG 
-Wno-unused-function$/
+CHECKOBJS      make-src/Makefile       /^CHECKOBJS=chkmalloc.o chkxm.o$/
+CHECK_ARRAY    c-src/emacs/src/lisp.h  /^CHECK_ARRAY (Lisp_Object x, 
Lisp_Object predicate)/
+CHECK_BOOL_VECTOR      c-src/emacs/src/lisp.h  /^CHECK_BOOL_VECTOR 
(Lisp_Object x)$/
+CHECK_BUFFER   c-src/emacs/src/lisp.h  /^CHECK_BUFFER (Lisp_Object x)$/
+CHECK_CONS     c-src/emacs/src/lisp.h  /^CHECK_CONS (Lisp_Object x)$/
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h  571
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h  572
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h  579
+CHECK_LIST     c-src/emacs/src/lisp.h  /^CHECK_LIST (Lisp_Object x)$/
+CHECK_LIST_CONS        c-src/emacs/src/lisp.h  /^# define CHECK_LIST_CONS(x, 
y) lisp_h_CHECK_LIST_C/
+CHECK_NATNUM   c-src/emacs/src/lisp.h  /^CHECK_NATNUM (Lisp_Object x)$/
+CHECK_NUMBER   c-src/emacs/src/lisp.h  /^# define CHECK_NUMBER(x) 
lisp_h_CHECK_NUMBER (x)$/
+CHECK_NUMBER_CAR       c-src/emacs/src/lisp.h  /^CHECK_NUMBER_CAR (Lisp_Object 
x)$/
+CHECK_NUMBER_CDR       c-src/emacs/src/lisp.h  /^CHECK_NUMBER_CDR (Lisp_Object 
x)$/
+CHECK_NUMBER_COERCE_MARKER     c-src/emacs/src/lisp.h  /^#define 
CHECK_NUMBER_COERCE_MARKER(x)                                 \\$/
+CHECK_NUMBER_OR_FLOAT  c-src/emacs/src/lisp.h  /^CHECK_NUMBER_OR_FLOAT 
(Lisp_Object x)$/
+CHECK_NUMBER_OR_FLOAT_COERCE_MARKER    c-src/emacs/src/lisp.h  /^#define 
CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x)                                /
+CHECK_PROCESS  c-src/emacs/src/lisp.h  /^CHECK_PROCESS (Lisp_Object x)$/
+CHECK_RANGED_INTEGER   c-src/emacs/src/lisp.h  /^#define 
CHECK_RANGED_INTEGER(x, lo, hi)                                       \\$/
+CHECK_STRING_CAR       c-src/emacs/src/lisp.h  /^CHECK_STRING_CAR (Lisp_Object 
x)$/
+CHECK_SYMBOL   c-src/emacs/src/lisp.h  /^# define CHECK_SYMBOL(x) 
lisp_h_CHECK_SYMBOL (x)$/
+CHECK_TYPE     c-src/emacs/src/lisp.h  /^# define CHECK_TYPE(ok, predicate, x) 
lisp_h_CHECK/
+CHECK_TYPE_RANGED_INTEGER      c-src/emacs/src/lisp.h  /^#define 
CHECK_TYPE_RANGED_INTEGER(type, x) \\$/
+CHECK_VECTOR   c-src/emacs/src/lisp.h  /^CHECK_VECTOR (Lisp_Object x)$/
+CHECK_VECTOR_OR_STRING c-src/emacs/src/lisp.h  /^CHECK_VECTOR_OR_STRING 
(Lisp_Object x)$/
+CHECK_WINDOW   c-src/emacs/src/lisp.h  /^CHECK_WINDOW (Lisp_Object x)$/
+CK_ABS_C       y-src/parse.y   /^#define CK_ABS_C(x)   if((x)<MIN_COL || 
(x)>MAX_COL)/
+CK_ABS_R       y-src/parse.y   /^#define CK_ABS_R(x)   if((x)<MIN_ROW || 
(x)>MAX_ROW)/
+CK_REL_C       y-src/parse.y   /^#define CK_REL_C(x)   if(   ((x)>0 && 
MAX_COL-(x)<cu/
+CK_REL_R       y-src/parse.y   /^#define CK_REL_R(x)   if(   ((x)>0 && 
MAX_ROW-(x)<cu/
+CMultiChannelCSC19_3D  cp-src/c.C      2
+CNL    c-src/etags.c   /^#define CNL()                                         
                \\$/
+CNL_SAVE_DEFINEDEF     c-src/etags.c   /^#define CNL_SAVE_DEFINEDEF()          
                                \\$/
+COBOLFLAGS     make-src/Makefile       /^COBOLFLAGS=--language=none 
--regex='\/.......[a-zA-/
+COLORS cp-src/screen.hpp       11
+COMPILEDP      c-src/emacs/src/lisp.h  /^COMPILEDP (Lisp_Object a)$/
+COMPILED_ARGLIST       c-src/emacs/src/lisp.h  2431
+COMPILED_BYTECODE      c-src/emacs/src/lisp.h  2432
+COMPILED_CONSTANTS     c-src/emacs/src/lisp.h  2433
+COMPILED_DOC_STRING    c-src/emacs/src/lisp.h  2435
+COMPILED_INTERACTIVE   c-src/emacs/src/lisp.h  2436
+COMPILED_STACK_DEPTH   c-src/emacs/src/lisp.h  2434
+CONDITION_CASE c-src/emacs/src/lisp.h  3021
+CONSP  c-src/emacs/src/lisp.h  /^# define CONSP(x) lisp_h_CONSP (x)$/
+CONSTYPE_HEAP  c-src/emacs/src/lisp.h  3739
+CONSTYPE_PURE  c-src/emacs/src/lisp.h  3739
+CONS_TO_INTEGER        c-src/emacs/src/lisp.h  /^#define CONS_TO_INTEGER(cons, 
type, var)                              \\$/
+CONVERT_CHARSTRING_TO_VALUE    pas-src/common.pas      /^procedure 
CONVERT_CHARSTRING_TO_VALUE;(*($/
+CPPFLAGS       make-src/Makefile       /^CPPFLAGS=${CHECKFLAGS} -DSTDC_HEADERS 
-DHAVE_GETCW/
+CPSRC  make-src/Makefile       /^CPSRC=c.C abstract.C abstract.H cfront.H 
burton.cp/
+CSRC   make-src/Makefile       /^CSRC=abbrev.c ..\/etags\/h.h .\/\/c.c 
torture.c getopt/
+CTAGS  c-src/etags.c   146
+CTAGS  c-src/etags.c   147
+CTAGS  c-src/etags.c   149
+CTAGS  make-src/Makefile       /^CTAGS: ctags ${infiles}$/
+CTAGS% make-src/Makefile       /^CTAGS%: ctags% ${infiles}$/
+CTAGS13 CTAGS14 CTAGS15        make-src/Makefile       /^CTAGS13 CTAGS14 
CTAGS15: ctags% ${infiles}$/
+CYAN   cp-src/screen.hpp       15
+C_AUTO c-src/etags.c   2198
+C_EXT  c-src/etags.c   2193
+C_JAVA c-src/etags.c   2197
+C_PLAIN        c-src/etags.c   2194
+C_PLPL c-src/etags.c   2195
+C_STAR c-src/etags.c   2196
+C_entries      c-src/etags.c   /^C_entries (int c_ext, FILE *inf)$/
+C_stab_entry   c-src/etags.c   2271
+C_symtype      c-src/etags.c   /^C_symtype (char *str, int len, int c_ext)$/
+ChangeFileType pas-src/common.pas      /^function ChangeFileType; (*(FileName 
: NameString;/
+Circle.getPos  lua-src/test.lua        /^function Circle.getPos ()$/
+Cjava_entries  c-src/etags.c   /^Cjava_entries (FILE *inf)$/
+Cjava_help     c-src/etags.c   551
+Cjava_suffixes c-src/etags.c   549
+ClassExample   ruby-src/test.rb        /^    class ClassExample$/
+Clear/p        ada-src/2ataspri.adb    /^   procedure Clear (Cell : in out 
TAS_Cell) is$/
+Clear/p        ada-src/2ataspri.ads    /^   procedure Clear        (Cell : in 
out TAS_Cell)/
+Cobol_help     c-src/etags.c   558
+Cobol_paragraphs       c-src/etags.c   /^Cobol_paragraphs (FILE *inf)$/
+Cobol_suffixes c-src/etags.c   556
+CommentAD      php-src/lce_functions.php       /^      function CommentAD($/
+CommentAD      php-src/lce_functions.php       70
+ConcatT        pas-src/common.pas      /^function ConcatT;(*($/
+Concept Index  tex-src/gzip.texi       /^@node Concept Index, , Problems, Top$/
+Cond_Signal/p  ada-src/2ataspri.adb    /^   procedure Cond_Signal (Cond : in 
out Condition_/
+Cond_Signal/p  ada-src/2ataspri.ads    /^   procedure Cond_Signal (Cond : in 
out Condition_/
+Cond_Timed_Wait/p      ada-src/2ataspri.adb    /^   procedure Cond_Timed_Wait$/
+Cond_Timed_Wait/p      ada-src/2ataspri.ads    /^   procedure Cond_Timed_Wait$/
+Cond_Wait/p    ada-src/2ataspri.adb    /^   procedure Cond_Wait (Cond : in out 
Condition_Va/
+Cond_Wait/p    ada-src/2ataspri.ads    /^   procedure Cond_Wait (Cond : in out 
Condition_Va/
+Condition_Variable/t   ada-src/2ataspri.ads    /^   type Condition_Variable is 
private;$/
+Condition_Variable/t   ada-src/2ataspri.ads    /^   type Condition_Variable 
is$/
+Configure      pyt-src/server.py       /^class Configure(Frame, ControlEdit):$/
+ConfirmQuit    pyt-src/server.py       /^def ConfirmQuit(frame, context):$/
+Constant       ruby-src/test1.ru       42
+ControlEdit    pyt-src/server.py       /^class ControlEdit(Frame):$/
+Controls       pyt-src/server.py       /^class Controls:$/
+CopyTextString pas-src/common.pas      /^function CopyTextString;(*($/
+Copying        tex-src/gzip.texi       /^@node Copying, Overview, , Top$/
+Cplusplus_entries      c-src/etags.c   /^Cplusplus_entries (FILE *inf)$/
+Cplusplus_help c-src/etags.c   540
+Cplusplus_suffixes     c-src/etags.c   535
+Create_LL_Task/p       ada-src/2ataspri.adb    /^   procedure Create_LL_Task$/
+Create_LL_Task/p       ada-src/2ataspri.ads    /^   procedure Create_LL_Task$/
+Cstar_entries  c-src/etags.c   /^Cstar_entries (FILE *inf)$/
+Cstar_suffixes c-src/etags.c   562
+Cube.data.getFoo       lua-src/test.lua        /^function Cube.data.getFoo ()$/
+D      cp-src/fail.C   /^              D() : ::A::T2::T(97), x(1066) {}$/
+D      cp-src/fail.C   41
+DAEMON_RUNNING c-src/emacs/src/lisp.h  4258
+DAEMON_RUNNING c-src/emacs/src/lisp.h  4262
+DARKGRAY       cp-src/screen.hpp       20
+DEAFUN c.c     /^DEAFUN ("expand-file-name", Fexpand_file_name, Sex/
+DEBUG  c-src/etags.c   84
+DEBUG  c-src/etags.c   85
+DEBUG  c-src/etags.c   87
+DEBUG  objc-src/PackInsp.m     37
+DECLARE_GDB_SYM        c-src/emacs/src/lisp.h  /^#define DECLARE_GDB_SYM(type, 
id) type const id EX/
+DEFAULT_HASH_SIZE      c-src/emacs/src/lisp.h  1940
+DEFAULT_REHASH_SIZE    c-src/emacs/src/lisp.h  1950
+DEFAULT_REHASH_THRESHOLD       c-src/emacs/src/lisp.h  1946
+DEFINE_GDB_SYMBOL_BEGIN        c-src/emacs/src/lisp.h  /^# define 
DEFINE_GDB_SYMBOL_BEGIN(type, id) DECLARE/
+DEFINE_GDB_SYMBOL_BEGIN        c-src/emacs/src/lisp.h  /^# define 
DEFINE_GDB_SYMBOL_BEGIN(type, id) extern /
+DEFINE_GDB_SYMBOL_END  c-src/emacs/src/lisp.h  /^# define 
DEFINE_GDB_SYMBOL_END(id) = id;$/
+DEFINE_GDB_SYMBOL_END  c-src/emacs/src/lisp.h  /^# define 
DEFINE_GDB_SYMBOL_END(val) ;$/
+DEFINE_LISP_SYMBOL     c-src/emacs/src/lisp.h  /^#define 
DEFINE_LISP_SYMBOL(name) \\$/
+DEFINE_NON_NIL_Q_SYMBOL_MACROS c-src/emacs/src/lisp.h  755
+DEFSYM c-src/emacs/src/lisp.h  /^#define DEFSYM(sym, name) \/* empty *\/$/
+DEFSYM c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (SYMBOL_CONSTANT_P, int, 
(Lisp_Ob/
+DEFUN  c-src/emacs/src/lisp.h  /^#define DEFUN(lname, fnname, sname, minargs, 
maxar/
+DEFUN_ARGS_0   c-src/emacs/src/lisp.h  714
+DEFUN_ARGS_1   c-src/emacs/src/lisp.h  715
+DEFUN_ARGS_2   c-src/emacs/src/lisp.h  716
+DEFUN_ARGS_3   c-src/emacs/src/lisp.h  717
+DEFUN_ARGS_4   c-src/emacs/src/lisp.h  718
+DEFUN_ARGS_5   c-src/emacs/src/lisp.h  719
+DEFUN_ARGS_6   c-src/emacs/src/lisp.h  721
+DEFUN_ARGS_7   c-src/emacs/src/lisp.h  723
+DEFUN_ARGS_8   c-src/emacs/src/lisp.h  725
+DEFUN_ARGS_MANY        c-src/emacs/src/lisp.h  712
+DEFUN_ARGS_UNEVALLED   c-src/emacs/src/lisp.h  713
+DEFUN_func2    c.c     /^DEFUN_func2()$/
+DEFVAR_BOOL    c-src/emacs/src/lisp.h  /^#define DEFVAR_BOOL(lname, vname, 
doc)                \\$/
+DEFVAR_BUFFER_DEFAULTS c-src/emacs/src/lisp.h  /^#define 
DEFVAR_BUFFER_DEFAULTS(lname, vname, doc)     /
+DEFVAR_INT     c-src/emacs/src/lisp.h  /^#define DEFVAR_INT(lname, vname, doc) 
        \\$/
+DEFVAR_KBOARD  c-src/emacs/src/lisp.h  /^#define DEFVAR_KBOARD(lname, vname, 
doc)                      \\$/
+DEFVAR_LISP    c-src/emacs/src/lisp.h  /^#define DEFVAR_LISP(lname, vname, 
doc)                \\$/
+DEFVAR_LISP_NOPRO      c-src/emacs/src/lisp.h  /^#define 
DEFVAR_LISP_NOPRO(lname, vname, doc)  \\$/
+DEVICE_LAST    c-src/h.h       24
+DEVICE_SWP     c-src/h.h       23
+DOS_NT c-src/etags.c   117
+DOS_NT c-src/etags.c   118
+DUMPED c-src/emacs/src/gmalloc.c       80
+Debug  cp-src/functions.cpp    /^void Debug ( int lineno, int level, char* 
func , c/
+Def_   ruby-src/test1.ru       12
+DisposeANameList       pas-src/common.pas      /^procedure DisposeANameList( $/
+DisposeNameList        pas-src/common.pas      /^procedure DisposeNameList;$/
+ELEM_I c-src/h.h       3
+ELSRC  make-src/Makefile       /^ELSRC=TAGTEST.EL 
emacs\/lisp\/progmodes\/etags.el$/
+EMACS_INT      c-src/emacs/src/lisp.h  103
+EMACS_INT      c-src/emacs/src/lisp.h  91
+EMACS_INT      c-src/emacs/src/lisp.h  96
+EMACS_INT_MAX  c-src/emacs/src/lisp.h  105
+EMACS_INT_MAX  c-src/emacs/src/lisp.h  93
+EMACS_INT_MAX  c-src/emacs/src/lisp.h  98
+EMACS_LISP_H   c-src/emacs/src/lisp.h  22
+EMACS_NAME     c-src/etags.c   786
+EMACS_UINT     c-src/emacs/src/lisp.h  104
+EMACS_UINT     c-src/emacs/src/lisp.h  92
+EMACS_UINT     c-src/emacs/src/lisp.h  97
+ENTRY  c-src/sysdep.h  /^#define       ENTRY(name)                             
                              \\$/
+ENUM_BF        c-src/emacs/src/lisp.h  /^#define ENUM_BF(TYPE) enum TYPE$/
+ENUM_BF        c-src/emacs/src/lisp.h  /^#define ENUM_BF(TYPE) unsigned int$/
+EQ     c-src/emacs/src/lisp.h  /^# define EQ(x, y) lisp_h_EQ (x, y)$/
+EQUAL  y-src/cccp.c    12
+ERLSRC make-src/Makefile       /^ERLSRC=gs_dialog.erl lines.erl lists.erl$/
+ERROR  y-src/cccp.c    9
+ERROR  y-src/parse.y   304
+ETAGS  make-src/Makefile       /^ETAGS: FRC etags ${infiles}$/
+ETAGS% make-src/Makefile       /^ETAGS%: FRC etags% ${infiles}$/
+ETAGS12        make-src/Makefile       /^ETAGS12: etags12 ${infiles}$/
+ETAGS13 ETAGS14 ETAGS15        make-src/Makefile       /^ETAGS13 ETAGS14 
ETAGS15: etags% ${infiles}$/
+EXFUN  c-src/emacs/src/lisp.h  /^#define EXFUN(fnname, maxargs) \\$/
+EXTAGS make-src/Makefile       /^EXTAGS: extags ${infiles} Makefile$/
+EXTERNALLY_VISIBLE     c-src/emacs/src/keyboard.c      3497
+EXTERNALLY_VISIBLE     c-src/emacs/src/keyboard.c      4372
+EmptyNmStr     pas-src/common.pas      /^function EmptyNmStr(* : 
NameString*);$/
+Environment    tex-src/gzip.texi       /^@node Environment, Tapes, Advanced 
usage, Top$/
+Erlang_functions       c-src/etags.c   /^Erlang_functions (FILE *inf)$/
+Erlang_help    c-src/etags.c   567
+Erlang_suffixes        c-src/etags.c   565
+ErrStrToNmStr  pas-src/common.pas      /^function ErrStrToNmStr;(*($/
+Error_Information/t    ada-src/2ataspri.ads    /^   type Error_Information is 
new Interfaces.C.POSI/
+Exit_LL_Task/p ada-src/2ataspri.adb    /^   procedure Exit_LL_Task is$/
+Exit_LL_Task/p ada-src/2ataspri.ads    /^   procedure Exit_LL_Task;$/
+ExtractCommentInfo     pas-src/common.pas      /^procedure ExtractCommentInfo; 
(*($/
+FASTCFLAGS     make-src/Makefile       /^FASTCFLAGS=-O3 -finline-functions 
-ffast-math -fun/
+FASTCFLAGSWARN make-src/Makefile       /^FASTCFLAGSWARN=${WARNINGS} -Werror 
${FASTCFLAGS}$/
+FILTER make-src/Makefile       /^FILTER=grep -v 
'\\.[Cchefy][lor]*,[1-9][0-9]*' || t/
+FINALIZERP     c-src/emacs/src/lisp.h  /^FINALIZERP (Lisp_Object x)$/
+FINAL_FREE_BLOCKS      c-src/emacs/src/gmalloc.c       135
+FIXNUM_BITS    c-src/emacs/src/lisp.h  252
+FIXNUM_OVERFLOW_P      c-src/emacs/src/lisp.h  /^#define FIXNUM_OVERFLOW_P(i) 
\\$/
+FIXNUM_OVERFLOW_P      c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (EQ, bool, 
(Lisp_Object x, Lisp_O/
+FLOATP c-src/emacs/src/lisp.h  /^# define FLOATP(x) lisp_h_FLOATP (x)$/
+FLOAT_TO_STRING_BUFSIZE        c-src/emacs/src/lisp.h  3927
+FORTHSRC       make-src/Makefile       /^FORTHSRC=test-forth.fth$/
+FOR_EACH_ALIST_VALUE   c-src/emacs/src/lisp.h  /^#define 
FOR_EACH_ALIST_VALUE(head_var, list_var, v/
+FOR_EACH_TAIL  c-src/emacs/src/lisp.h  /^#define FOR_EACH_TAIL(hare, list, 
tortoise, n)        \\$/
+FRAMEP c-src/emacs/src/lisp.h  /^FRAMEP (Lisp_Object a)$/
+FRC    make-src/Makefile       /^FRC:;$/
+FREEFLOOD      c-src/emacs/src/gmalloc.c       1858
+FSRC   make-src/Makefile       /^FSRC=entry.for entry.strange_suffix 
entry.strange$/
+FUN0   y-src/parse.y   /^yylex FUN0()$/
+FUN1   y-src/parse.y   /^str_to_col FUN1(char **,str)$/
+FUN1   y-src/parse.y   /^yyerror FUN1(char *, s)$/
+FUN2   y-src/parse.y   /^make_list FUN2(YYSTYPE, car, YYSTYPE, cdr)$/
+FUN2   y-src/parse.y   /^parse_cell_or_range FUN2(char **,ptr, struct rng */
+FUNCTIONP      c-src/emacs/src/lisp.h  /^FUNCTIONP (Lisp_Object obj)$/
+FUNCTION_KEY_OFFSET    c-src/emacs/src/keyboard.c      4766
+FUNCTION_KEY_OFFSET    c-src/emacs/src/keyboard.c      5061
+F_getit        c-src/etags.c   /^F_getit (FILE *inf)$/
+F_takeprec     c-src/etags.c   /^F_takeprec (void)$/
+Fabbrev_expansion      c-src/abbrev.c  /^DEFUN ("abbrev-expansion", 
Fabbrev_expansion, Sabb/
+Fabbrev_symbol c-src/abbrev.c  /^DEFUN ("abbrev-symbol", Fabbrev_symbol, 
Sabbrev_sy/
+Fabort_recursive_edit  c-src/emacs/src/keyboard.c      /^DEFUN 
("abort-recursive-edit", Fabort_recursive_ed/
+Fails_t        c-src/h.h       5
+Fclear_abbrev_table    c-src/abbrev.c  /^DEFUN ("clear-abbrev-table", 
Fclear_abbrev_table, /
+Fclear_this_command_keys       c-src/emacs/src/keyboard.c      /^DEFUN 
("clear-this-command-keys", Fclear_this_comm/
+Fcommand_error_default_function        c-src/emacs/src/keyboard.c      /^DEFUN 
("command-error-default-function", Fcommand_/
+Fcurrent_idle_time     c-src/emacs/src/keyboard.c      /^DEFUN 
("current-idle-time", Fcurrent_idle_time, Sc/
+Fcurrent_input_mode    c-src/emacs/src/keyboard.c      /^DEFUN 
("current-input-mode", Fcurrent_input_mode, /
+Fdefine_abbrev c-src/abbrev.c  /^DEFUN ("define-abbrev", Fdefine_abbrev, 
Sdefine_ab/
+Fdefine_abbrev_table   c-src/abbrev.c  /^DEFUN ("define-abbrev-table", 
Fdefine_abbrev_table/
+Fdefine_global_abbrev  c-src/abbrev.c  /^DEFUN ("define-global-abbrev", 
Fdefine_global_abbr/
+Fdefine_mode_abbrev    c-src/abbrev.c  /^DEFUN ("define-mode-abbrev", 
Fdefine_mode_abbrev, /
+Fdiscard_input c-src/emacs/src/keyboard.c      /^DEFUN ("discard-input", 
Fdiscard_input, Sdiscard_i/
+Fevent_convert_list    c-src/emacs/src/keyboard.c      /^DEFUN 
("event-convert-list", Fevent_convert_list, /
+Fevent_symbol_parse_modifiers  c-src/emacs/src/keyboard.c      /^DEFUN 
("internal-event-symbol-parse-modifiers", Fe/
+Fexit_recursive_edit   c-src/emacs/src/keyboard.c      /^DEFUN 
("exit-recursive-edit", Fexit_recursive_edit/
+Fexpand_abbrev c-src/abbrev.c  /^DEFUN ("expand-abbrev", Fexpand_abbrev, 
Sexpand_ab/
+Finalize_Cond/p        ada-src/2ataspri.adb    /^   procedure Finalize_Cond 
(Cond : in out Conditio/
+Finalize_Cond/p        ada-src/2ataspri.ads    /^   procedure Finalize_Cond 
(Cond : in out Conditio/
+Finalize_Lock/p        ada-src/2ataspri.adb    /^   procedure Finalize_Lock (L 
: in out Lock) is$/
+Finalize_Lock/p        ada-src/2ataspri.ads    /^   procedure Finalize_Lock (L 
: in out Lock);$/
+Finalize_TAS_Cell/p    ada-src/2ataspri.adb    /^   procedure 
Finalize_TAS_Cell (Cell : in out TAS_/
+Finalize_TAS_Cell/p    ada-src/2ataspri.ads    /^   procedure 
Finalize_TAS_Cell   (Cell : in out TA/
+Finput_pending_p       c-src/emacs/src/keyboard.c      /^DEFUN 
("input-pending-p", Finput_pending_p, Sinput/
+Finsert_abbrev_table_description       c-src/abbrev.c  /^DEFUN 
("insert-abbrev-table-description", Finsert_/
+First100Chars  pas-src/common.pas      /^procedure First100Chars; (*($/
+Fmake_abbrev_table     c-src/abbrev.c  /^DEFUN ("make-abbrev-table", 
Fmake_abbrev_table, Sm/
+Foo    perl-src/kai-test.pl    /^package Foo;$/
+Foo::Bar       perl-src/kai-test.pl    /^package Foo::Bar;$/
+Fopen_dribble_file     c-src/emacs/src/keyboard.c      /^DEFUN 
("open-dribble-file", Fopen_dribble_file, So/
+Forth_help     c-src/etags.c   573
+Forth_suffixes c-src/etags.c   571
+Forth_words    c-src/etags.c   /^Forth_words (FILE *inf)$/
+Fortran_functions      c-src/etags.c   /^Fortran_functions (FILE *inf)$/
+Fortran_help   c-src/etags.c   579
+Fortran_suffixes       c-src/etags.c   577
+Fposn_at_point c-src/emacs/src/keyboard.c      /^DEFUN ("posn-at-point", 
Fposn_at_point, Sposn_at_p/
+Fposn_at_x_y   c-src/emacs/src/keyboard.c      /^DEFUN ("posn-at-x-y", 
Fposn_at_x_y, Sposn_at_x_y, /
+Fread_key_sequence     c-src/emacs/src/keyboard.c      /^DEFUN 
("read-key-sequence", Fread_key_sequence, Sr/
+Fread_key_sequence_vector      c-src/emacs/src/keyboard.c      /^DEFUN 
("read-key-sequence-vector", Fread_key_seque/
+Frecent_keys   c-src/emacs/src/keyboard.c      /^DEFUN ("recent-keys", 
Frecent_keys, Srecent_keys, /
+Frecursion_depth       c-src/emacs/src/keyboard.c      /^DEFUN 
("recursion-depth", Frecursion_depth, Srecur/
+Frecursive_edit        c-src/emacs/src/keyboard.c      /^DEFUN 
("recursive-edit", Frecursive_edit, Srecursi/
+Freset_this_command_lengths    c-src/emacs/src/keyboard.c      /^DEFUN 
("reset-this-command-lengths", Freset_this_c/
+Fset_input_interrupt_mode      c-src/emacs/src/keyboard.c      /^DEFUN 
("set-input-interrupt-mode", Fset_input_inte/
+Fset_input_meta_mode   c-src/emacs/src/keyboard.c      /^DEFUN 
("set-input-meta-mode", Fset_input_meta_mode/
+Fset_input_mode        c-src/emacs/src/keyboard.c      /^DEFUN 
("set-input-mode", Fset_input_mode, Sset_inp/
+Fset_output_flow_control       c-src/emacs/src/keyboard.c      /^DEFUN 
("set-output-flow-control", Fset_output_flow/
+Fset_quit_char c-src/emacs/src/keyboard.c      /^DEFUN ("set-quit-char", 
Fset_quit_char, Sset_quit_/
+Fsuspend_emacs c-src/emacs/src/keyboard.c      /^DEFUN ("suspend-emacs", 
Fsuspend_emacs, Ssuspend_e/
+Fthis_command_keys     c-src/emacs/src/keyboard.c      /^DEFUN 
("this-command-keys", Fthis_command_keys, St/
+Fthis_command_keys_vector      c-src/emacs/src/keyboard.c      /^DEFUN 
("this-command-keys-vector", Fthis_command_k/
+Fthis_single_command_keys      c-src/emacs/src/keyboard.c      /^DEFUN 
("this-single-command-keys", Fthis_single_co/
+Fthis_single_command_raw_keys  c-src/emacs/src/keyboard.c      /^DEFUN 
("this-single-command-raw-keys", Fthis_singl/
+Ftop_level     c-src/emacs/src/keyboard.c      /^DEFUN ("top-level", 
Ftop_level, Stop_level, 0, 0, /
+Ftrack_mouse   c-src/emacs/src/keyboard.c      /^DEFUN 
("internal--track-mouse", Ftrack_mouse, Stra/
+Funexpand_abbrev       c-src/abbrev.c  /^DEFUN ("unexpand-abbrev", 
Funexpand_abbrev, Sunexp/
+Fx_get_selection_internal      c.c     /^       Fx_get_selection_internal, 
Sx_get_selection/
+Fx_get_selection_internal      c.c     /^DEFUN ("x-get-selection-internal", 
Fx_get_selectio/
+Fy_get_selection_internal      c.c     /^      Fy_get_selection_internal, 
Sy_get_selection_/
+GCALIGNED      c-src/emacs/src/lisp.h  288
+GCALIGNED      c-src/emacs/src/lisp.h  290
+GCALIGNMENT    c-src/emacs/src/lisp.h  243
+GCPRO1 c-src/emacs/src/lisp.h  /^#define GCPRO1(a)                             
                        \\$/
+GCPRO1 c-src/emacs/src/lisp.h  /^#define GCPRO1(varname) ((void) gcpro1)$/
+GCPRO2 c-src/emacs/src/lisp.h  /^#define GCPRO2(a, b)                          
                        \\$/
+GCPRO2 c-src/emacs/src/lisp.h  /^#define GCPRO2(varname1, varname2) ((void) 
gcpro2,/
+GCPRO3 c-src/emacs/src/lisp.h  /^#define GCPRO3(a, b, c)                       
                                \\$/
+GCPRO3 c-src/emacs/src/lisp.h  /^#define GCPRO3(varname1, varname2, varname3) 
\\$/
+GCPRO4 c-src/emacs/src/lisp.h  /^#define GCPRO4(a, b, c, d)                    
                        \\$/
+GCPRO4 c-src/emacs/src/lisp.h  /^#define GCPRO4(varname1, varname2, varname3, 
varna/
+GCPRO5 c-src/emacs/src/lisp.h  /^#define GCPRO5(a, b, c, d, e)                 
                        \\$/
+GCPRO5 c-src/emacs/src/lisp.h  /^#define GCPRO5(varname1, varname2, varname3, 
varna/
+GCPRO6 c-src/emacs/src/lisp.h  /^#define GCPRO6(a, b, c, d, e, f)              
                        \\$/
+GCPRO6 c-src/emacs/src/lisp.h  /^#define GCPRO6(varname1, varname2, varname3, 
varna/
+GCPRO7 c-src/emacs/src/lisp.h  /^#define GCPRO7(a, b, c, d, e, f, g)           
                        \\$/
+GCPRO7 c-src/emacs/src/lisp.h  /^#define GCPRO7(a, b, c, d, e, f, g) (GCPRO6 
(a, b,/
+GCTYPEBITS     c-src/emacs/src/lisp.h  /^DEFINE_GDB_SYMBOL_BEGIN (int, 
GCTYPEBITS)$/
+GCTYPEBITS     c-src/emacs/src/lisp.h  67
+GC_MAKE_GCPROS_NOOPS   c-src/emacs/src/lisp.h  3172
+GC_MARK_STACK  c-src/emacs/src/lisp.h  3177
+GC_MARK_STACK_CHECK_GCPROS     c-src/emacs/src/lisp.h  3173
+GC_USE_GCPROS_AS_BEFORE        c-src/emacs/src/lisp.h  3171
+GC_USE_GCPROS_CHECK_ZOMBIES    c-src/emacs/src/lisp.h  3174
+GE     y-src/parse.c   8
+GENERIC_PTR    y-src/cccp.y    56
+GENERIC_PTR    y-src/cccp.y    58
+GEQ    y-src/cccp.c    15
+GETOPTOBJS     make-src/Makefile       /^GETOPTOBJS= #getopt.o getopt1.o$/
+GREEN  cp-src/screen.hpp       14
+GROW_RAW_KEYBUF        c-src/emacs/src/keyboard.c      119
+GatherControls pyt-src/server.py       /^    def GatherControls(self):$/
+GetLayerByName lua-src/allegro.lua     /^function GetLayerByName (name)$/
+GetNameList    pas-src/common.pas      /^function GetNameList; (* : 
BinNodePointer;*)$/
+GetNewNameListNode     pas-src/common.pas      /^function 
GetNewNameListNode;(*($/
+GetTextRef     pas-src/common.pas      /^function GetTextRef;(*($/
+GetUniqueLayerName     lua-src/allegro.lua     /^function GetUniqueLayerName 
()$/
+Get_Own_Priority/f     ada-src/2ataspri.adb    /^   function Get_Own_Priority 
return System.Any_Pri/
+Get_Own_Priority/f     ada-src/2ataspri.ads    /^   function Get_Own_Priority 
return System.Any_Pri/
+Get_Priority/f ada-src/2ataspri.adb    /^   function Get_Priority (T : 
TCB_Ptr) return Syst/
+Get_Priority/f ada-src/2ataspri.ads    /^   function Get_Priority (T : 
TCB_Ptr) return Syst/
+HASH_HASH      c-src/emacs/src/lisp.h  /^HASH_HASH (struct Lisp_Hash_Table *h, 
ptrdiff_t id/
+HASH_INDEX     c-src/emacs/src/lisp.h  /^HASH_INDEX (struct Lisp_Hash_Table 
*h, ptrdiff_t i/
+HASH_KEY       c-src/emacs/src/lisp.h  /^HASH_KEY (struct Lisp_Hash_Table *h, 
ptrdiff_t idx/
+HASH_NEXT      c-src/emacs/src/lisp.h  /^HASH_NEXT (struct Lisp_Hash_Table *h, 
ptrdiff_t id/
+HASH_TABLE_P   c-src/emacs/src/lisp.h  /^HASH_TABLE_P (Lisp_Object a)$/
+HASH_TABLE_SIZE        c-src/emacs/src/lisp.h  /^HASH_TABLE_SIZE (struct 
Lisp_Hash_Table *h)$/
+HASH_VALUE     c-src/emacs/src/lisp.h  /^HASH_VALUE (struct Lisp_Hash_Table 
*h, ptrdiff_t i/
+HAVE_NTGUI     c-src/etags.c   116
+HEAP   c-src/emacs/src/gmalloc.c       131
+HTMLSRC        make-src/Makefile       /^HTMLSRC=softwarelibero.html 
index.shtml algrthms.h/
+HTML_help      c-src/etags.c   584
+HTML_labels    c-src/etags.c   /^HTML_labels (FILE *inf)$/
+HTML_suffixes  c-src/etags.c   582
+IEEE_FLOATING_POINT    c-src/emacs/src/lisp.h  2415
+IMAGEP c-src/emacs/src/lisp.h  /^IMAGEP (Lisp_Object x)$/
+INPUT_EVENT_POS_MAX    c-src/emacs/src/keyboard.c      3698
+INPUT_EVENT_POS_MIN    c-src/emacs/src/keyboard.c      3701
+INSERT_TREE_NODE       pas-src/common.pas      /^procedure 
INSERT_TREE_NODE;(*( $/
+INSTANTIATE_MDIAGARRAY_FRIENDS cp-src/MDiagArray2.h    /^#define 
INSTANTIATE_MDIAGARRAY_FRIENDS(T) \\$/
+INT    c-src/h.h       32
+INT    y-src/cccp.c    6
+INTEGERP       c-src/emacs/src/lisp.h  /^# define INTEGERP(x) lisp_h_INTEGERP 
(x)$/
+INTEGER_TO_CONS        c-src/emacs/src/lisp.h  /^#define INTEGER_TO_CONS(i)    
                                    \\$/
+INTERVAL       c-src/emacs/src/lisp.h  1149
+INTMASK        c-src/emacs/src/lisp.h  437
+INTTYPEBITS    c-src/emacs/src/lisp.h  249
+INT_BIT        c-src/emacs/src/gmalloc.c       124
+INT_TYPE_SIZE  y-src/cccp.y    91
+ISALNUM        c-src/etags.c   /^#define ISALNUM(c)    isalnum (CHAR (c))$/
+ISALPHA        c-src/etags.c   /^#define ISALPHA(c)    isalpha (CHAR (c))$/
+ISDIGIT        c-src/etags.c   /^#define ISDIGIT(c)    isdigit (CHAR (c))$/
+ISLOWER        c-src/etags.c   /^#define ISLOWER(c)    islower (CHAR (c))$/
+ISO_FUNCTION_KEY_OFFSET        c-src/emacs/src/keyboard.c      5149
+ISUPPER        c-src/etags.c   /^# define ISUPPER(c)   isupper (CHAR (c))$/
+IS_DAEMON      c-src/emacs/src/lisp.h  4257
+IS_DAEMON      c-src/emacs/src/lisp.h  4261
+InitNameList   pas-src/common.pas      /^procedure InitNameList;$/
+InitNameStringPool     pas-src/common.pas      /^procedure 
InitNameStringPool;$/
+InitializeStringPackage        pas-src/common.pas      /^procedure 
InitializeStringPackage;$/
+Initialize_Cond/p      ada-src/2ataspri.adb    /^   procedure Initialize_Cond 
(Cond : in out Condit/
+Initialize_Cond/p      ada-src/2ataspri.ads    /^   procedure Initialize_Cond 
(Cond : in out Condit/
+Initialize_LL_Tasks/p  ada-src/2ataspri.adb    /^   procedure 
Initialize_LL_Tasks (T : TCB_Ptr) is$/
+Initialize_LL_Tasks/p  ada-src/2ataspri.ads    /^   procedure 
Initialize_LL_Tasks (T : TCB_Ptr);$/
+Initialize_Lock/p      ada-src/2ataspri.adb    /^   procedure Initialize_Lock$/
+Initialize_Lock/p      ada-src/2ataspri.ads    /^   procedure Initialize_Lock 
(Prio : System.Any_Pr/
+Initialize_TAS_Cell/p  ada-src/2ataspri.adb    /^   procedure 
Initialize_TAS_Cell (Cell : out TAS_C/
+Initialize_TAS_Cell/p  ada-src/2ataspri.ads    /^   procedure 
Initialize_TAS_Cell (Cell :    out TA/
+Inner1/b       ada-src/etags-test-for.ada      /^  package body Inner1 is$/
+Inner1/b       ada-src/waroquiers.ada  /^  package body Inner1 is$/
+Inner1/s       ada-src/etags-test-for.ada      /^  package Inner1 is$/
+Inner1/s       ada-src/waroquiers.ada  /^  package Inner1 is$/
+Inner2/b       ada-src/etags-test-for.ada      /^  package body Inner2 is$/
+Inner2/b       ada-src/waroquiers.ada  /^  package body Inner2 is$/
+Inner2/s       ada-src/etags-test-for.ada      /^  package Inner2 is$/
+Inner2/s       ada-src/waroquiers.ada  /^  package Inner2 is$/
+Install_Abort_Handler/p        ada-src/2ataspri.adb    /^   procedure 
Install_Abort_Handler (Handler : Abor/
+Install_Abort_Handler/p        ada-src/2ataspri.ads    /^   procedure 
Install_Abort_Handler (Handler : Abor/
+Install_Error_Handler/p        ada-src/2ataspri.adb    /^   procedure 
Install_Error_Handler (Handler : Syst/
+Install_Error_Handler/p        ada-src/2ataspri.ads    /^   procedure 
Install_Error_Handler (Handler : Syst/
+Invoking gzip  tex-src/gzip.texi       /^@node Invoking gzip, Advanced usage, 
Sample, Top$/
+IpAddrKind     rs-src/test.rs  3
+IsControlChar  pas-src/common.pas      /^function IsControlChar; (*($/
+IsControlCharName      pas-src/common.pas      /^function IsControlCharName($/
+Is_Set/f       ada-src/2ataspri.adb    /^   function  Is_Set (Cell : in 
TAS_Cell) return Bo/
+Is_Set/f       ada-src/2ataspri.ads    /^   function  Is_Set       (Cell : in  
   TAS_Cell)/
+JAVASRC        make-src/Makefile       /^JAVASRC=AWTEMul.java KeyEve.java 
SMan.java SysCol./
+KBD_BUFFER_SIZE        c-src/emacs/src/keyboard.c      82
+KBYTES objc-src/PackInsp.m     58
+KEY_TO_CHAR    c-src/emacs/src/keyboard.c      /^#define KEY_TO_CHAR(k) (XINT 
(k) & ((1 << CHARACTE/
+LATEST make-src/Makefile       /^LATEST=17$/
+LCE_COMMENT    php-src/lce_functions.php       13
+LCE_COMMENT_TOOL       php-src/lce_functions.php       17
+LCE_COMMENT_USER       php-src/lce_functions.php       15
+LCE_FUNCTIONS  php-src/lce_functions.php       4
+LCE_MSGID      php-src/lce_functions.php       19
+LCE_MSGSTR     php-src/lce_functions.php       21
+LCE_TEXT       php-src/lce_functions.php       23
+LCE_UNKNOWN    php-src/lce_functions.php       9
+LCE_WS php-src/lce_functions.php       11
+LDFLAGS        make-src/Makefile       /^LDFLAGS=#-static -lc_p$/
+LE     y-src/parse.c   7
+LEQ    y-src/cccp.c    14
+LIGHTBLUE      cp-src/screen.hpp       21
+LIGHTCYAN      cp-src/screen.hpp       23
+LIGHTGRAY      cp-src/screen.hpp       19
+LIGHTGREEN     cp-src/screen.hpp       22
+LIGHTMAGENTA   cp-src/screen.hpp       25
+LIGHTRED       cp-src/screen.hpp       24
+LISP_INITIALLY c-src/emacs/src/lisp.h  /^#define LISP_INITIALLY(i) (i)$/
+LISP_INITIALLY c-src/emacs/src/lisp.h  /^#define LISP_INITIALLY(i) {i}$/
+LISP_INITIALLY_ZERO    c-src/emacs/src/lisp.h  582
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^#define 
LISP_MACRO_DEFUN(name, type, argdecls, arg/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (CONSP, 
bool, (Lisp_Object x), (x/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (NILP, bool, 
(Lisp_Object x), (x)/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (SYMBOL_VAL, 
Lisp_Object, (struct/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (XCAR, 
Lisp_Object, (Lisp_Object /
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (XCONS, 
struct Lisp_Cons *, (Lisp/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (XHASH, 
EMACS_INT, (Lisp_Object a/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (XLI, 
EMACS_INT, (Lisp_Object o),/
+LISP_MACRO_DEFUN       c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN (XPNTR, void 
*, (Lisp_Object a), /
+LISP_MACRO_DEFUN_VOID  c-src/emacs/src/lisp.h  /^#define 
LISP_MACRO_DEFUN_VOID(name, argdecls, args/
+LISP_MACRO_DEFUN_VOID  c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN_VOID 
(CHECK_LIST_CONS, (Lisp_Obje/
+LISP_MACRO_DEFUN_VOID  c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN_VOID 
(CHECK_TYPE,$/
+LISP_MACRO_DEFUN_VOID  c-src/emacs/src/lisp.h  /^LISP_MACRO_DEFUN_VOID 
(SET_SYMBOL_VAL,$/
+LISTCONTENTS   objc-src/PackInsp.m     39
+LISTCONTENTSBUTTON     objc-src/PackInsp.m     48
+LISTDESCRIPTIONBUTTON  objc-src/PackInsp.m     49
+LL_Assert/p    ada-src/2ataspri.adb    /^   procedure LL_Assert (B : Boolean; 
M : String) i/
+LL_Assert/p    ada-src/2ataspri.ads    /^   procedure LL_Assert (B : Boolean; 
M : String);$/
+LL_Task_Procedure_Access/t     ada-src/2ataspri.ads    /^   type 
LL_Task_Procedure_Access is access procedu/
+LL_Task_Procedure_Access/t     ada-src/etags-test-for.ada      /^   type 
LL_Task_Procedure_Access is access procedu/
+LL_Wrapper/p   ada-src/2ataspri.adb    /^   procedure LL_Wrapper (T : TCB_Ptr) 
is$/
+LL_Wrapper/p   ada-src/2ataspri.adb    /^   procedure LL_Wrapper (T : 
TCB_Ptr);$/
+LL_Wrapper/p   ada-src/etags-test-for.ada      /^   procedure LL_Wrapper (T : 
TCB_Ptr);$/
+LOCALIZE       objc-src/PackInsp.m     /^#define LOCALIZE(s)           
NXLoadLocalizedStringFromTabl/
+LOCALIZE_ARCH  objc-src/PackInsp.m     /^#define LOCALIZE_ARCH(s)      
NXLoadLocalizedStringFrom/
+LOCK   c-src/emacs/src/gmalloc.c       /^#define LOCK()                        
                \\$/
+LOCK   c-src/emacs/src/gmalloc.c       /^#define LOCK()$/
+LOCK_ALIGNED_BLOCKS    c-src/emacs/src/gmalloc.c       /^#define 
LOCK_ALIGNED_BLOCKS()                         \\$/
+LOCK_ALIGNED_BLOCKS    c-src/emacs/src/gmalloc.c       /^#define 
LOCK_ALIGNED_BLOCKS()$/
+LONG_TYPE_SIZE y-src/cccp.y    95
+LOOKING_AT     c-src/etags.c   /^#define LOOKING_AT(cp, kw)  \/* kw is the 
keyword, /
+LOOKING_AT_NOCASE      c-src/etags.c   /^#define LOOKING_AT_NOCASE(cp, kw) \/* 
the keyword i/
+LOOKUP objc-src/PackInsp.m     /^#define LOOKUP(key, notfound) ([table 
isKey:key] ?/
+LOOKUP objc-src/PackInsp.m     176
+LOOP_ON_INPUT_LINES    c-src/etags.c   /^#define 
LOOP_ON_INPUT_LINES(file_pointer, line_buf/
+LSH    y-src/cccp.c    16
+LTGT   cp-src/MDiagArray2.h    144
+LTGT   cp-src/MDiagArray2.h    35
+LTGT   cp-src/MDiagArray2.h    39
+LTGT   cp-src/MDiagArray2.h    42
+LUASRC make-src/Makefile       /^LUASRC=allegro.lua$/
+L_CELL y-src/parse.c   10
+L_CONST        y-src/parse.c   13
+L_FN0  y-src/parse.c   14
+L_FN1  y-src/parse.c   15
+L_FN1R y-src/parse.c   20
+L_FN2  y-src/parse.c   16
+L_FN2R y-src/parse.c   21
+L_FN3  y-src/parse.c   17
+L_FN3R y-src/parse.c   22
+L_FN4  y-src/parse.c   18
+L_FN4R y-src/parse.c   23
+L_FNN  y-src/parse.c   19
+L_FNNR y-src/parse.c   24
+L_GE   y-src/parse.c   27
+L_LE   y-src/parse.c   25
+L_NE   y-src/parse.c   26
+L_RANGE        y-src/parse.c   11
+L_VAR  y-src/parse.c   12
+L_getit        c-src/etags.c   /^L_getit (void)$/
+LabeledEntry   pyt-src/server.py       /^class LabeledEntry(Frame):$/
+Lang_function  c-src/etags.c   182
+Lang_function  c-src/h.h       6
+Lisp_Bits      c-src/emacs/src/lisp.h  239
+Lisp_Bool_Vector       c-src/emacs/src/lisp.h  1384
+Lisp_Boolfwd   c-src/emacs/src/lisp.h  2284
+Lisp_Buffer_Local_Value        c-src/emacs/src/lisp.h  2334
+Lisp_Buffer_Objfwd     c-src/emacs/src/lisp.h  2302
+Lisp_Char_Table        c-src/emacs/src/lisp.h  1575
+Lisp_Compiled  c-src/emacs/src/lisp.h  2429
+Lisp_Cons      c-src/emacs/src/lisp.h  475
+Lisp_Finalizer c-src/emacs/src/lisp.h  2186
+Lisp_Float     c-src/emacs/src/lisp.h  2391
+Lisp_Float     c-src/emacs/src/lisp.h  477
+Lisp_Free      c-src/emacs/src/lisp.h  2201
+Lisp_Fwd       c-src/emacs/src/lisp.h  2368
+Lisp_Fwd_Bool  c-src/emacs/src/lisp.h  505
+Lisp_Fwd_Buffer_Obj    c-src/emacs/src/lisp.h  507
+Lisp_Fwd_Int   c-src/emacs/src/lisp.h  504
+Lisp_Fwd_Kboard_Obj    c-src/emacs/src/lisp.h  508
+Lisp_Fwd_Obj   c-src/emacs/src/lisp.h  506
+Lisp_Fwd_Type  c-src/emacs/src/lisp.h  502
+Lisp_Hash_Table        c-src/emacs/src/lisp.h  1823
+Lisp_Int0      c-src/emacs/src/lisp.h  461
+Lisp_Int1      c-src/emacs/src/lisp.h  462
+Lisp_Intfwd    c-src/emacs/src/lisp.h  2274
+Lisp_Kboard_Objfwd     c-src/emacs/src/lisp.h  2362
+Lisp_Marker    c-src/emacs/src/lisp.h  1978
+Lisp_Misc      c-src/emacs/src/lisp.h  2212
+Lisp_Misc      c-src/emacs/src/lisp.h  458
+Lisp_Misc_Any  c-src/emacs/src/lisp.h  1971
+Lisp_Misc_Finalizer    c-src/emacs/src/lisp.h  491
+Lisp_Misc_Float        c-src/emacs/src/lisp.h  494
+Lisp_Misc_Free c-src/emacs/src/lisp.h  487
+Lisp_Misc_Limit        c-src/emacs/src/lisp.h  496
+Lisp_Misc_Marker       c-src/emacs/src/lisp.h  488
+Lisp_Misc_Overlay      c-src/emacs/src/lisp.h  489
+Lisp_Misc_Save_Value   c-src/emacs/src/lisp.h  490
+Lisp_Misc_Type c-src/emacs/src/lisp.h  485
+Lisp_Object    c-src/emacs/src/lisp.h  567
+Lisp_Object    c-src/emacs/src/lisp.h  577
+Lisp_Objfwd    c-src/emacs/src/lisp.h  2294
+Lisp_Overlay   c-src/emacs/src/lisp.h  2021
+Lisp_Save_Type c-src/emacs/src/lisp.h  2064
+Lisp_Save_Value        c-src/emacs/src/lisp.h  2110
+Lisp_String    c-src/emacs/src/lisp.h  466
+Lisp_Sub_Char_Table    c-src/emacs/src/lisp.h  1606
+Lisp_Subr      c-src/emacs/src/lisp.h  1670
+Lisp_Symbol    c-src/emacs/src/lisp.h  454
+Lisp_Symbol    c-src/emacs/src/lisp.h  654
+Lisp_Type      c-src/emacs/src/lisp.h  451
+Lisp_Vector    c-src/emacs/src/lisp.h  1369
+Lisp_Vectorlike        c-src/emacs/src/lisp.h  472
+Lisp_functions c-src/etags.c   /^Lisp_functions (FILE *inf)$/
+Lisp_help      c-src/etags.c   591
+Lisp_suffixes  c-src/etags.c   589
+ListEdit       pyt-src/server.py       /^class ListEdit(Frame):$/
+Locate pas-src/common.pas      /^function Locate; (*($/
+Lock/t ada-src/2ataspri.ads    /^   type Lock is private;$/
+Lock/t ada-src/2ataspri.ads    /^   type Lock is$/
+LowerCaseNmStr pas-src/common.pas      /^function LowerCaseNmStr; (*($/
+Lua_functions  c-src/etags.c   /^Lua_functions (FILE *inf)$/
+Lua_help       c-src/etags.c   600
+Lua_suffixes   c-src/etags.c   598
+MAGENTA        cp-src/screen.hpp       17
+MAGICBYTE      c-src/emacs/src/gmalloc.c       1856
+MAGICFREE      c-src/emacs/src/gmalloc.c       1855
+MAGICWORD      c-src/emacs/src/gmalloc.c       1854
+MAKE   make-src/Makefile       /^MAKE:=$(MAKE) --no-print-directory$/
+MAKESRC        make-src/Makefile       /^MAKESRC=Makefile$/
+MALLOCFLOOD    c-src/emacs/src/gmalloc.c       1857
+MANY   c-src/emacs/src/lisp.h  2833
+MARKERP        c-src/emacs/src/lisp.h  /^# define MARKERP(x) lisp_h_MARKERP 
(x)$/
+MAXPATHLEN     c-src/etags.c   115
+MAX_ALLOCA     c-src/emacs/src/lisp.h  4556
+MAX_ENCODED_BYTES      c-src/emacs/src/keyboard.c      2254
+MAX_HASH_VALUE c-src/etags.c   2329
+MAX_WORD_LENGTH        c-src/etags.c   2327
+MAYBEREL       y-src/parse.y   /^#define MAYBEREL(p) (*(p)=='[' && 
(isdigit((p)[1])/
+MBYTES objc-src/PackInsp.m     59
+MCHECK_DISABLED        c-src/emacs/src/gmalloc.c       285
+MCHECK_FREE    c-src/emacs/src/gmalloc.c       287
+MCHECK_HEAD    c-src/emacs/src/gmalloc.c       288
+MCHECK_OK      c-src/emacs/src/gmalloc.c       286
+MCHECK_TAIL    c-src/emacs/src/gmalloc.c       289
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (T *d, int r, int c) : 
DiagArray2<T>/
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (const Array<T>& a) : 
DiagArray2<T> /
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (const DiagArray2<T>& 
a) : DiagArray/
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (const MDiagArray2<T>& 
a) : DiagArra/
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (int r, int c) : 
DiagArray2<T> (r, c/
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (int r, int c, const T& 
val) : DiagA/
+MDiagArray2    cp-src/MDiagArray2.h    /^  MDiagArray2 (void) : DiagArray2<T> 
() { }$/
+MDiagArray2    cp-src/MDiagArray2.h    78
+MIN_HASH_VALUE c-src/etags.c   2328
+MIN_WORD_LENGTH        c-src/etags.c   2326
+MISCP  c-src/emacs/src/lisp.h  /^# define MISCP(x) lisp_h_MISCP (x)$/
+MOST_NEGATIVE_FIXNUM   c-src/emacs/src/lisp.h  835
+MOST_POSITIVE_FIXNUM   c-src/emacs/src/lisp.h  834
+MOVE   c-src/sysdep.h  /^#define MOVE(x,y)     movl x, y$/
+MSDOS  c-src/etags.c   100
+MSDOS  c-src/etags.c   106
+MSDOS  c-src/etags.c   107
+MSDOS  c-src/etags.c   110
+MSGSEL f-src/entry.for /^       ENTRY  MSGSEL ( TYPE )$/
+MSGSEL f-src/entry.strange     /^       ENTRY  MSGSEL ( TYPE )$/
+MSGSEL f-src/entry.strange_suffix      /^       ENTRY  MSGSEL ( TYPE )$/
+MULTI_LETTER_MOD       c-src/emacs/src/keyboard.c      /^#define 
MULTI_LETTER_MOD(BIT, NAME, LEN)                      \\$/
+MULTI_LETTER_MOD       c-src/emacs/src/keyboard.c      /^#define 
MULTI_LETTER_MOD(BIT, NAME, LEN)              \\$/
+MULTI_LETTER_MOD       c-src/emacs/src/keyboard.c      6231
+MULTI_LETTER_MOD       c-src/emacs/src/keyboard.c      6764
+Machin_T/b     ada-src/waroquiers.ada  /^  protected body Machin_T is$/
+Machin_T/t     ada-src/etags-test-for.ada      /^  protected Machin_T is$/
+Machin_T/t     ada-src/etags-test-for.ada      /^  protected type Machin_T is$/
+Machin_T/t     ada-src/waroquiers.ada  /^  protected type Machin_T is$/
+Machine_Exceptions/t   ada-src/2ataspri.ads    /^   type Machine_Exceptions is 
new Interfaces.C.POS/
+MakeDispose    pyt-src/server.py       /^    def MakeDispose(self):$/
+MakeSitelist   pyt-src/server.py       /^    def MakeSitelist(self, master):$/
+Makefile_filenames     c-src/etags.c   603
+Makefile_help  c-src/etags.c   605
+Makefile_targets       c-src/etags.c   /^Makefile_targets (FILE *inf)$/
+Mc     cp-src/c.C      /^int main (void) { my_function0(0); my_function1(1)/
+Mcccp  y-src/cccp.y    /^main ()$/
+Mconway.cpp    cp-src/conway.cpp       /^void main(void)$/
+Metags c-src/etags.c   /^main (int argc, char **argv)$/
+Mfail  cp-src/fail.C   /^main()$/
+Mkai-test.pl   perl-src/kai-test.pl    /^package main;$/
+ModuleExample  ruby-src/test.rb        /^module ModuleExample$/
+More_Lisp_Bits c-src/emacs/src/lisp.h  801
+MoveLayerAfter lua-src/allegro.lua     /^function MoveLayerAfter (this_one)$/
+MoveLayerBefore        lua-src/allegro.lua     /^function MoveLayerBefore 
(this_one)$/
+MoveLayerBottom        lua-src/allegro.lua     /^function MoveLayerBottom ()$/
+MoveLayerTop   lua-src/allegro.lua     /^function MoveLayerTop ()$/
+Mtest.go       go-src/test.go  /^func main() {$/
+Mtest.go       go-src/test.go  1
+Mtest.rs       rs-src/test.rs  /^fn main() {$/
+Mtest1.go      go-src/test1.go /^func main() {$/
+Mtest1.go      go-src/test1.go 1
+Mx.cc  cp-src/x.cc     /^main(int argc, char *argv[])$/
+NAME   y-src/cccp.c    8
+NATNUMP        c-src/emacs/src/lisp.h  /^NATNUMP (Lisp_Object x)$/
+NDEBUG c-src/etags.c   88
+NE     y-src/parse.c   6
+NEG    y-src/parse.c   9
+NEXT_ALMOST_PRIME_LIMIT        c-src/emacs/src/lisp.h  3573
+NILP   c-src/emacs/src/lisp.h  /^# define NILP(x) lisp_h_NILP (x)$/
+NIL_IS_ZERO    c-src/emacs/src/lisp.h  1515
+NONPOINTER_BITS        c-src/emacs/src/lisp.h  78
+NONPOINTER_BITS        c-src/emacs/src/lisp.h  80
+NONSRCS        make-src/Makefile       /^NONSRCS=entry.strange lists.erl 
clheir.hpp.gz$/
+NOTEQUAL       y-src/cccp.c    13
+NULL   y-src/cccp.y    51
+NULL_PTR       y-src/cccp.y    63
+NUMSTATS       objc-src/PackInsp.h     36
+NUM_MOD_NAMES  c-src/emacs/src/keyboard.c      6325
+NUM_RECENT_KEYS        c-src/emacs/src/keyboard.c      91
+NameHasChar    pas-src/common.pas      /^function NameHasChar; (* (TheName : 
NameString; Th/
+NameStringLess pas-src/common.pas      /^function NameStringLess;(*(var 
Name1,Name2 : NameS/
+NewLayer       lua-src/allegro.lua     /^function NewLayer (name, x, y, w, h)$/
+NewLayerSet    lua-src/allegro.lua     /^function NewLayerSet (name)$/
+NewNameString  pas-src/common.pas      /^procedure NewNameString; (* (var NSP: 
NameStringPo/
+NmStrToErrStr  pas-src/common.pas      /^function NmStrToErrStr;(*($/
+NmStrToInteger pas-src/common.pas      /^function NmStrToInteger; (* (Str : 
NameString) : i/
+OBJCPPSRC      make-src/Makefile       /^OBJCPPSRC=SimpleCalc.H SimpleCalc.M$/
+OBJCSRC        make-src/Makefile       /^OBJCSRC=Subprocess.h Subprocess.m 
PackInsp.h PackI/
+OBJS   make-src/Makefile       /^OBJS=${GETOPTOBJS} ${REGEXOBJS} ${CHECKOBJS}$/
+OPENBUTTON     objc-src/PackInsp.m     47
+OPTIONS        make-src/Makefile       /^OPTIONS=--members --declarations 
--regex=@regexfil/
+OR     y-src/cccp.c    10
+OTAGS  make-src/Makefile       /^OTAGS: oetags ${SRCS} srclist$/
+OVERLAYP       c-src/emacs/src/lisp.h  /^OVERLAYP (Lisp_Object x)$/
+Objc_help      c-src/etags.c   613
+Objc_suffixes  c-src/etags.c   609
+OperatorFun    c-src/h.h       88
+Overview       tex-src/gzip.texi       /^@node Overview, Sample, Copying, Top$/
+PASSRC make-src/Makefile       /^PASSRC=common.pas$/
+PDT    c-src/h.h       /^  Date 04 May 87 235311 PDT (Mon)$/
+PERLSRC        make-src/Makefile       /^PERLSRC=htlmify-cystic yagrip.pl 
kai-test.pl mirro/
+PHPSRC make-src/Makefile       /^PHPSRC=lce_functions.php ptest.php 
sendmail.php$/
+PHP_functions  c-src/etags.c   /^PHP_functions (FILE *inf)$/
+PHP_help       c-src/etags.c   639
+PHP_suffixes   c-src/etags.c   637
+POEntry        php-src/lce_functions.php       /^      function POEntry()$/
+POEntry        php-src/lce_functions.php       105
+POEntryAD      php-src/lce_functions.php       29
+PORManager     php-src/lce_functions.php       /^      function PORManager()$/
+PORManager     php-src/lce_functions.php       498
+POReader       php-src/lce_functions.php       /^      function 
POReader($domain, $filename)$/
+POReader       php-src/lce_functions.php       163
+POSTSCRIPTFLAGS        make-src/Makefile       
/^POSTSCRIPTFLAGS=--language=none --regex='#\/[^ \\t{]/
+PRINT_UNDOCUMENTED_OPTIONS_HELP        c-src/etags.c   804
+PROCESSP       c-src/emacs/src/lisp.h  /^PROCESSP (Lisp_Object a)$/
+PROLSRC        make-src/Makefile       /^PROLSRC=ordsets.prolog natded.prolog$/
+PROP   c-src/emacs/src/keyboard.c      /^#define PROP(IDX) AREF 
(tool_bar_item_properties, /
+PROP   c-src/emacs/src/keyboard.c      8379
+PROTECT_MALLOC_STATE   c-src/emacs/src/gmalloc.c       /^#define 
PROTECT_MALLOC_STATE(PROT)    \/* empty *\/$/
+PROTECT_MALLOC_STATE   c-src/emacs/src/gmalloc.c       /^#define 
PROTECT_MALLOC_STATE(PROT) protect_malloc_/
+PRTPKG f-src/entry.for /^      LOGICAL FUNCTION PRTPKG ( SHORT, LONG, EXPL,/
+PRTPKG f-src/entry.strange     /^      LOGICAL FUNCTION PRTPKG ( SHORT, LONG, 
EXPL,/
+PRTPKG f-src/entry.strange_suffix      /^      LOGICAL FUNCTION PRTPKG ( 
SHORT, LONG, EXPL,/
+PSEUDO c-src/sysdep.h  /^#define       PSEUDO(name, syscall_name, args)        
                              /
+PSEUDOVECSIZE  c-src/emacs/src/lisp.h  /^#define PSEUDOVECSIZE(type, 
nonlispfield)                     \\$/
+PSEUDOVECTORP  c-src/emacs/src/lisp.h  /^PSEUDOVECTORP (Lisp_Object a, int 
code)$/
+PSEUDOVECTOR_AREA_BITS c-src/emacs/src/lisp.h  818
+PSEUDOVECTOR_FLAG      c-src/emacs/src/lisp.h  774
+PSEUDOVECTOR_REST_BITS c-src/emacs/src/lisp.h  813
+PSEUDOVECTOR_REST_MASK c-src/emacs/src/lisp.h  814
+PSEUDOVECTOR_SIZE_BITS c-src/emacs/src/lisp.h  808
+PSEUDOVECTOR_SIZE_MASK c-src/emacs/src/lisp.h  809
+PSEUDOVECTOR_TYPEP     c-src/emacs/src/lisp.h  /^PSEUDOVECTOR_TYPEP (struct 
vectorlike_header *a, i/
+PSSRC  make-src/Makefile       /^PSSRC=rfc1245.ps$/
+PS_functions   c-src/etags.c   /^PS_functions (FILE *inf)$/
+PS_help        c-src/etags.c   649
+PS_suffixes    c-src/etags.c   647
+PTY_LENGTH     objc-src/Subprocess.m   21
+PTY_TEMPLATE   objc-src/Subprocess.m   20
+PUSH_C_STR     c-src/emacs/src/keyboard.c      /^#define PUSH_C_STR(str, 
listvar) \\$/
+PUSH_HANDLER   c-src/emacs/src/lisp.h  /^#define PUSH_HANDLER(c, tag_ch_val, 
handlertype)      \\/
+PVEC_BOOL_VECTOR       c-src/emacs/src/lisp.h  787
+PVEC_BUFFER    c-src/emacs/src/lisp.h  788
+PVEC_CHAR_TABLE        c-src/emacs/src/lisp.h  796
+PVEC_COMPILED  c-src/emacs/src/lisp.h  795
+PVEC_FONT      c-src/emacs/src/lisp.h  798
+PVEC_FRAME     c-src/emacs/src/lisp.h  785
+PVEC_FREE      c-src/emacs/src/lisp.h  783
+PVEC_HASH_TABLE        c-src/emacs/src/lisp.h  789
+PVEC_NORMAL_VECTOR     c-src/emacs/src/lisp.h  782
+PVEC_OTHER     c-src/emacs/src/lisp.h  793
+PVEC_PROCESS   c-src/emacs/src/lisp.h  784
+PVEC_SUBR      c-src/emacs/src/lisp.h  792
+PVEC_SUB_CHAR_TABLE    c-src/emacs/src/lisp.h  797
+PVEC_TERMINAL  c-src/emacs/src/lisp.h  790
+PVEC_TYPE_MASK c-src/emacs/src/lisp.h  819
+PVEC_WINDOW    c-src/emacs/src/lisp.h  786
+PVEC_WINDOW_CONFIGURATION      c-src/emacs/src/lisp.h  791
+PYTSRC make-src/Makefile       /^PYTSRC=server.py$/
+PackageInspector       objc-src/PackInsp.h     /^@interface 
PackageInspector:WMInspector$/
+Pascal_functions       c-src/etags.c   /^Pascal_functions (FILE *inf)$/
+Pascal_help    c-src/etags.c   621
+Pascal_suffixes        c-src/etags.c   619
+Perl_functions c-src/etags.c   /^Perl_functions (FILE *inf)$/
+Perl_help      c-src/etags.c   630
+Perl_interpreters      c-src/etags.c   628
+Perl_suffixes  c-src/etags.c   626
+Pkg1/b ada-src/etags-test-for.ada      /^package body Pkg1 is$/
+Pkg1/b ada-src/waroquiers.ada  /^package body Pkg1 is$/
+Pkg1/s ada-src/etags-test-for.ada      /^package Pkg1 is$/
+Pkg1/s ada-src/waroquiers.ada  /^package Pkg1 is$/
+Pkg1_Func1/f   ada-src/etags-test-for.ada      /^  function Pkg1_Func1 return 
Boolean is separate;$/
+Pkg1_Func1/f   ada-src/etags-test-for.ada      /^  function Pkg1_Func1 return 
Boolean;$/
+Pkg1_Func1/f   ada-src/etags-test-for.ada      /^function  Pkg1_Func1 return 
Boolean is$/
+Pkg1_Func1/f   ada-src/waroquiers.ada  /^  function Pkg1_Func1 return Boolean 
is separate;$/
+Pkg1_Func1/f   ada-src/waroquiers.ada  /^  function Pkg1_Func1 return 
Boolean;$/
+Pkg1_Func1/f   ada-src/waroquiers.ada  /^function  Pkg1_Func1 return Boolean 
is$/
+Pkg1_Func2/f   ada-src/etags-test-for.ada      /^  function Pkg1_Func2 (Ijk : 
Integer; Z : Integer)/
+Pkg1_Func2/f   ada-src/waroquiers.ada  /^  function Pkg1_Func2 (Ijk : Integer; 
Z : Integer)/
+Pkg1_Pkg1/b    ada-src/etags-test-for.ada      /^  package body Pkg1_Pkg1 is 
separate;$/
+Pkg1_Pkg1/b    ada-src/etags-test-for.ada      /^package body Pkg1_Pkg1 is$/
+Pkg1_Pkg1/b    ada-src/waroquiers.ada  /^  package body Pkg1_Pkg1 is 
separate;$/
+Pkg1_Pkg1/b    ada-src/waroquiers.ada  /^package body Pkg1_Pkg1 is$/
+Pkg1_Pkg1/s    ada-src/etags-test-for.ada      /^  package Pkg1_Pkg1 is$/
+Pkg1_Pkg1/s    ada-src/waroquiers.ada  /^  package Pkg1_Pkg1 is$/
+Pkg1_Pkg1_Proc1/p      ada-src/etags-test-for.ada      /^    procedure 
Pkg1_Pkg1_Proc1;$/
+Pkg1_Pkg1_Proc1/p      ada-src/etags-test-for.ada      /^  procedure 
Pkg1_Pkg1_Proc1 is$/
+Pkg1_Pkg1_Proc1/p      ada-src/waroquiers.ada  /^    procedure 
Pkg1_Pkg1_Proc1;$/
+Pkg1_Pkg1_Proc1/p      ada-src/waroquiers.ada  /^  procedure Pkg1_Pkg1_Proc1 
is$/
+Pkg1_Proc1/p   ada-src/etags-test-for.ada      /^  procedure Pkg1_Proc1 is$/
+Pkg1_Proc1/p   ada-src/etags-test-for.ada      /^  procedure Pkg1_Proc1;$/
+Pkg1_Proc1/p   ada-src/waroquiers.ada  /^  procedure Pkg1_Proc1 is$/
+Pkg1_Proc1/p   ada-src/waroquiers.ada  /^  procedure Pkg1_Proc1;$/
+Pkg1_Proc2/p   ada-src/etags-test-for.ada      /^  procedure Pkg1_Proc2 (I : 
Integer) is$/
+Pkg1_Proc2/p   ada-src/etags-test-for.ada      /^  procedure Pkg1_Proc2 (I : 
Integer);$/
+Pkg1_Proc2/p   ada-src/waroquiers.ada  /^  procedure Pkg1_Proc2 (I : Integer) 
is$/
+Pkg1_Proc2/p   ada-src/waroquiers.ada  /^  procedure Pkg1_Proc2 (I : 
Integer);$/
+PostControls   pyt-src/server.py       /^    def PostControls(self):$/
+Pre_Call_State/t       ada-src/2ataspri.ads    /^   type Pre_Call_State is new 
System.Address;$/
+PrintAdd       go-src/test1.go /^func (n intNumber) PrintAdd() {$/
+PrintAdd       go-src/test1.go /^func (s str) PrintAdd() {$/
+Private        objc-src/Subprocess.m   /^@interface Subprocess(Private)$/
+Private_T/b    ada-src/etags-test-for.ada      /^    task body Private_T is$/
+Private_T/b    ada-src/waroquiers.ada  /^    task body Private_T is$/
+Private_T/k    ada-src/etags-test-for.ada      /^    task Private_T;$/
+Private_T/k    ada-src/waroquiers.ada  /^    task Private_T;$/
+Private_T/p    ada-src/etags-test-for.ada      /^    procedure Private_T is$/
+Private_T/p    ada-src/etags-test-for.ada      /^    procedure Private_T;$/
+Private_T/p    ada-src/waroquiers.ada  /^    procedure Private_T is$/
+Private_T/p    ada-src/waroquiers.ada  /^    procedure Private_T;$/
+Private_T/t    ada-src/etags-test-for.ada      /^  type Private_T is private;$/
+Private_T/t    ada-src/etags-test-for.ada      /^  type Private_T is$/
+Private_T/t    ada-src/waroquiers.ada  /^  type Private_T is private;$/
+Private_T/t    ada-src/waroquiers.ada  /^  type Private_T is$/
+Problems       tex-src/gzip.texi       /^@node Problems, Concept Index, Tapes, 
Top$/
+Proc/t ada-src/2ataspri.ads    /^   type Proc is access procedure (Addr : 
System.Ad/
+Prolog_functions       c-src/etags.c   /^Prolog_functions (FILE *inf)$/
+Prolog_help    c-src/etags.c   654
+Prolog_suffixes        c-src/etags.c   652
+Public_T/t     ada-src/etags-test-for.ada      /^  type Public_T is$/
+Public_T/t     ada-src/waroquiers.ada  /^  type Public_T is$/
+Python_functions       c-src/etags.c   /^Python_functions (FILE *inf)$/
+Python_help    c-src/etags.c   660
+Python_suffixes        c-src/etags.c   658
+QUIT   c-src/emacs/src/lisp.h  3101
+QUITP  c-src/emacs/src/lisp.h  3112
+RANGED_INTEGERP        c-src/emacs/src/lisp.h  /^RANGED_INTEGERP (intmax_t lo, 
Lisp_Object x, intma/
+RCSid  objc-src/PackInsp.m     30
+READABLE_EVENTS_DO_TIMERS_NOW  c-src/emacs/src/keyboard.c      346
+READABLE_EVENTS_FILTER_EVENTS  c-src/emacs/src/keyboard.c      347
+READABLE_EVENTS_IGNORE_SQUEEZABLES     c-src/emacs/src/keyboard.c      348
+RECC_ALNUM     c-src/emacs/src/regex.h 610
+RECC_ALPHA     c-src/emacs/src/regex.h 610
+RECC_ASCII     c-src/emacs/src/regex.h 617
+RECC_BLANK     c-src/emacs/src/regex.h 615
+RECC_CNTRL     c-src/emacs/src/regex.h 613
+RECC_DIGIT     c-src/emacs/src/regex.h 614
+RECC_ERROR     c-src/emacs/src/regex.h 609
+RECC_GRAPH     c-src/emacs/src/regex.h 611
+RECC_LOWER     c-src/emacs/src/regex.h 612
+RECC_MULTIBYTE c-src/emacs/src/regex.h 616
+RECC_NONASCII  c-src/emacs/src/regex.h 616
+RECC_PRINT     c-src/emacs/src/regex.h 611
+RECC_PUNCT     c-src/emacs/src/regex.h 613
+RECC_SPACE     c-src/emacs/src/regex.h 615
+RECC_UNIBYTE   c-src/emacs/src/regex.h 617
+RECC_UPPER     c-src/emacs/src/regex.h 612
+RECC_WORD      c-src/emacs/src/regex.h 610
+RECC_XDIGIT    c-src/emacs/src/regex.h 614
+RED    cp-src/screen.hpp       16
+REGEX  make-src/Makefile       /^REGEX=\/[ \\t]*DEFVAR_[A-Z_ 
\\t\\n(]+"\\([^"]+\\)"\/$/
+REGEXOBJS      make-src/Makefile       /^REGEXOBJS=regex.o$/
+REGS_FIXED     c-src/emacs/src/regex.h 378
+REGS_REALLOCATE        c-src/emacs/src/regex.h 377
+REGS_UNALLOCATED       c-src/emacs/src/regex.h 376
+REG_BADBR      c-src/emacs/src/regex.h 313
+REG_BADPAT     c-src/emacs/src/regex.h 305
+REG_BADRPT     c-src/emacs/src/regex.h 316
+REG_EBRACE     c-src/emacs/src/regex.h 312
+REG_EBRACK     c-src/emacs/src/regex.h 310
+REG_ECOLLATE   c-src/emacs/src/regex.h 306
+REG_ECTYPE     c-src/emacs/src/regex.h 307
+REG_EEND       c-src/emacs/src/regex.h 319
+REG_EESCAPE    c-src/emacs/src/regex.h 308
+REG_ENOSYS     c-src/emacs/src/regex.h 297
+REG_ENOSYS     c.c     279
+REG_EPAREN     c-src/emacs/src/regex.h 311
+REG_ERANGE     c-src/emacs/src/regex.h 314
+REG_ERANGEX    c-src/emacs/src/regex.h 322
+REG_ERPAREN    c-src/emacs/src/regex.h 321
+REG_ESIZE      c-src/emacs/src/regex.h 320
+REG_ESPACE     c-src/emacs/src/regex.h 315
+REG_ESUBREG    c-src/emacs/src/regex.h 309
+REG_EXTENDED   c-src/emacs/src/regex.h 263
+REG_ICASE      c-src/emacs/src/regex.h 267
+REG_NEWLINE    c-src/emacs/src/regex.h 272
+REG_NOERROR    c-src/emacs/src/regex.h 300
+REG_NOMATCH    c-src/emacs/src/regex.h 301
+REG_NOSUB      c-src/emacs/src/regex.h 276
+REG_NOTBOL     c-src/emacs/src/regex.h 286
+REG_NOTEOL     c-src/emacs/src/regex.h 289
+RELEASELIST    make-src/Makefile       /^RELEASELIST=pot@gnu.org 
xemacs-review@xemacs.org j/
+RESUME_POLLING c-src/emacs/src/keyboard.c      2170
+RETURN_UNGCPRO c-src/emacs/src/lisp.h  /^#define RETURN_UNGCPRO(expr)          
        \\$/
+RE_BACKSLASH_ESCAPE_IN_LISTS   c-src/emacs/src/regex.h 47
+RE_BK_PLUS_QM  c-src/emacs/src/regex.h 52
+RE_CHAR_CLASSES        c-src/emacs/src/regex.h 58
+RE_CONTEXT_INDEP_ANCHORS       c-src/emacs/src/regex.h 72
+RE_CONTEXT_INDEP_OPS   c-src/emacs/src/regex.h 80
+RE_CONTEXT_INVALID_OPS c-src/emacs/src/regex.h 84
+RE_DEBUG       c-src/emacs/src/regex.h 161
+RE_DOT_NEWLINE c-src/emacs/src/regex.h 88
+RE_DOT_NOT_NULL        c-src/emacs/src/regex.h 92
+RE_DUP_MAX     c-src/emacs/src/regex.h 253
+RE_DUP_MAX     c-src/emacs/src/regex.h 256
+RE_FRUGAL      c-src/emacs/src/regex.h 147
+RE_HAT_LISTS_NOT_NEWLINE       c-src/emacs/src/regex.h 96
+RE_INTERVALS   c-src/emacs/src/regex.h 101
+RE_LIMITED_OPS c-src/emacs/src/regex.h 105
+RE_NEWLINE_ALT c-src/emacs/src/regex.h 109
+RE_NO_BK_BRACES        c-src/emacs/src/regex.h 114
+RE_NO_BK_PARENS        c-src/emacs/src/regex.h 118
+RE_NO_BK_REFS  c-src/emacs/src/regex.h 122
+RE_NO_BK_VBAR  c-src/emacs/src/regex.h 126
+RE_NO_EMPTY_RANGES     c-src/emacs/src/regex.h 132
+RE_NO_GNU_OPS  c-src/emacs/src/regex.h 144
+RE_NO_NEWLINE_ANCHOR   c-src/emacs/src/regex.h 153
+RE_NO_POSIX_BACKTRACKING       c-src/emacs/src/regex.h 140
+RE_NREGS       c-src/emacs/src/regex.h 440
+RE_SHY_GROUPS  c-src/emacs/src/regex.h 150
+RE_SYNTAX_AWK  c-src/emacs/src/regex.h 186
+RE_SYNTAX_ED   c-src/emacs/src/regex.h 216
+RE_SYNTAX_EGREP        c-src/emacs/src/regex.h 206
+RE_SYNTAX_EMACS        c-src/emacs/src/regex.h 183
+RE_SYNTAX_GNU_AWK      c-src/emacs/src/regex.h 193
+RE_SYNTAX_GREP c-src/emacs/src/regex.h 201
+RE_SYNTAX_POSIX_AWK    c-src/emacs/src/regex.h 197
+RE_SYNTAX_POSIX_BASIC  c-src/emacs/src/regex.h 225
+RE_SYNTAX_POSIX_EGREP  c-src/emacs/src/regex.h 212
+RE_SYNTAX_POSIX_EXTENDED       c-src/emacs/src/regex.h 234
+RE_SYNTAX_POSIX_MINIMAL_BASIC  c-src/emacs/src/regex.h 231
+RE_SYNTAX_POSIX_MINIMAL_EXTENDED       c-src/emacs/src/regex.h 242
+RE_SYNTAX_SED  c-src/emacs/src/regex.h 218
+RE_TRANSLATE_TYPE      c-src/emacs/src/regex.h 332
+RE_UNMATCHED_RIGHT_PAREN_ORD   c-src/emacs/src/regex.h 136
+RSH    y-src/cccp.c    17
+RTE/s  ada-src/2ataspri.adb    /^   package RTE renames 
Interfaces.C.POSIX_RTE;$/
+RUN    make-src/Makefile       /^RUN=$/
+RUN    make-src/Makefile       /^RUN=time --quiet --format '%U + %S: %E'$/
+RXINCLUDE      make-src/Makefile       /^RXINCLUDE=-Iemacs\/src$/
+Range  cp-src/Range.h  /^  Range (const Range& r)$/
+Range  cp-src/Range.h  /^  Range (double b, double l)$/
+Range  cp-src/Range.h  /^  Range (double b, double l, double i)$/
+Range  cp-src/Range.h  /^  Range (void)$/
+Range  cp-src/Range.h  35
+ReadVacation   cp-src/functions.cpp    /^void ReadVacation ( char *filename ) 
{$/
+Read_Lock/p    ada-src/2ataspri.adb    /^   procedure Read_Lock (L : in out 
Lock; Ceiling_V/
+Read_Lock/p    ada-src/2ataspri.ads    /^   procedure Read_Lock (L : in out 
Lock; Ceiling_V/
+Rectangle.getPos       lua-src/test.lua        /^function Rectangle.getPos ()$/
+ReleaseNameString      pas-src/common.pas      /^procedure ReleaseNameString; 
(* (var NSP: NameStri/
+RemoveLayer    lua-src/allegro.lua     /^function RemoveLayer ()$/
+RemoveUnderlineControl pas-src/common.pas      /^function 
RemoveUnderlineControl; (*($/
+ReprOfChar     pas-src/common.pas      /^function ReprOfChar; (*( ch : char) : 
NameString;*/
+S      c.c     156
+SAFE_ALLOCA    c-src/emacs/src/lisp.h  /^#define SAFE_ALLOCA(size) ((size) <= 
sa_avail                         \\/
+SAFE_ALLOCA_LISP       c-src/emacs/src/lisp.h  /^#define SAFE_ALLOCA_LISP(buf, 
nelt)                          \\$/
+SAFE_ALLOCA_STRING     c-src/emacs/src/lisp.h  /^#define 
SAFE_ALLOCA_STRING(ptr, string)                       \\$/
+SAFE_FREE      c-src/emacs/src/lisp.h  /^#define SAFE_FREE()                   
\\$/
+SAFE_NALLOCA   c-src/emacs/src/lisp.h  /^#define SAFE_NALLOCA(buf, multiplier, 
nitems)                  \\/
+SAVE_FUNCPOINTER       c-src/emacs/src/lisp.h  2049
+SAVE_INTEGER   c-src/emacs/src/lisp.h  2048
+SAVE_OBJECT    c-src/emacs/src/lisp.h  2051
+SAVE_POINTER   c-src/emacs/src/lisp.h  2050
+SAVE_SLOT_BITS c-src/emacs/src/lisp.h  2055
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h  2062
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h  2114
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h  2123
+SAVE_TYPE_FUNCPTR_PTR_OBJ      c-src/emacs/src/lisp.h  2076
+SAVE_TYPE_INT_INT      c-src/emacs/src/lisp.h  2066
+SAVE_TYPE_INT_INT_INT  c-src/emacs/src/lisp.h  2067
+SAVE_TYPE_MEMORY       c-src/emacs/src/lisp.h  2080
+SAVE_TYPE_OBJ_OBJ      c-src/emacs/src/lisp.h  2069
+SAVE_TYPE_OBJ_OBJ_OBJ  c-src/emacs/src/lisp.h  2070
+SAVE_TYPE_OBJ_OBJ_OBJ_OBJ      c-src/emacs/src/lisp.h  2071
+SAVE_TYPE_PTR_INT      c-src/emacs/src/lisp.h  2073
+SAVE_TYPE_PTR_OBJ      c-src/emacs/src/lisp.h  2074
+SAVE_TYPE_PTR_PTR      c-src/emacs/src/lisp.h  2075
+SAVE_UNUSED    c-src/emacs/src/lisp.h  2047
+SAVE_VALUEP    c-src/emacs/src/lisp.h  /^SAVE_VALUEP (Lisp_Object x)$/
+SAVE_VALUE_SLOTS       c-src/emacs/src/lisp.h  2058
+SBYTES c-src/emacs/src/lisp.h  /^SBYTES (Lisp_Object string)$/
+SCHARS c-src/emacs/src/lisp.h  /^SCHARS (Lisp_Object string)$/
+SCREEN_FP      cp-src/screen.hpp       /^#define SCREEN_FP(x,y) \\$/
+SCREEN_START   cp-src/screen.hpp       33
+SDATA  c-src/emacs/src/lisp.h  /^SDATA (Lisp_Object string)$/
+SDTrefGetInteger       pas-src/common.pas      /^function SDTrefGetInteger : 
integer;$/
+SDTrefIsEnd    pas-src/common.pas      /^function SDTrefIsEnd : Boolean;$/
+SDTrefRecToString      pas-src/common.pas      /^procedure SDTrefRecToString  
(* ($/
+SDTrefSkipSpaces       pas-src/common.pas      /^procedure SDTrefSkipSpaces;$/
+SDTrefStringToRec      pas-src/common.pas      /^procedure SDTrefStringToRec 
(* ($/
+SETPRT f-src/entry.for /^       ENTRY  SETPRT ( SHORT, EXPL, LONG, TRACE, D/
+SETPRT f-src/entry.strange     /^       ENTRY  SETPRT ( SHORT, EXPL, LONG, 
TRACE, D/
+SETPRT f-src/entry.strange_suffix      /^       ENTRY  SETPRT ( SHORT, EXPL, 
LONG, TRACE, D/
+SET_SYMBOL_BLV c-src/emacs/src/lisp.h  /^SET_SYMBOL_BLV (struct Lisp_Symbol 
*sym, struct Li/
+SET_SYMBOL_FWD c-src/emacs/src/lisp.h  /^SET_SYMBOL_FWD (struct Lisp_Symbol 
*sym, union Lis/
+SET_SYMBOL_VAL c-src/emacs/src/lisp.h  /^# define SET_SYMBOL_VAL(sym, v) 
lisp_h_SET_SYMBOL_/
+SINGLE_LETTER_MOD      c-src/emacs/src/keyboard.c      /^#define 
SINGLE_LETTER_MOD(BIT)                                \\$/
+SINGLE_LETTER_MOD      c-src/emacs/src/keyboard.c      6212
+SINGLE_LETTER_MOD      c-src/emacs/src/keyboard.c      6763
+SIZEFORMAT     objc-src/PackInsp.m     57
+SPECPDL_BACKTRACE      c-src/emacs/src/lisp.h  2948
+SPECPDL_INDEX  c-src/emacs/src/lisp.h  /^SPECPDL_INDEX (void)$/
+SPECPDL_LET    c-src/emacs/src/lisp.h  2949
+SPECPDL_LET_DEFAULT    c-src/emacs/src/lisp.h  2952
+SPECPDL_LET_LOCAL      c-src/emacs/src/lisp.h  2951
+SPECPDL_UNWIND c-src/emacs/src/lisp.h  2944
+SPECPDL_UNWIND_INT     c-src/emacs/src/lisp.h  2946
+SPECPDL_UNWIND_PTR     c-src/emacs/src/lisp.h  2945
+SPECPDL_UNWIND_VOID    c-src/emacs/src/lisp.h  2947
+SRCS   make-src/Makefile       /^SRCS=Makefile ${ADASRC} ${ASRC} ${CSRC} 
${CPSRC} $/
+SREF   c-src/emacs/src/lisp.h  /^SREF (Lisp_Object string, ptrdiff_t index)$/
+SSDATA c-src/emacs/src/lisp.h  /^SSDATA (Lisp_Object string)$/
+SSET   c-src/emacs/src/lisp.h  /^SSET (Lisp_Object string, ptrdiff_t index, 
unsigne/
+STACK_CONS     c-src/emacs/src/lisp.h  /^#define STACK_CONS(a, b) \\$/
+STATE_ABORT    php-src/lce_functions.php       25
+STATE_COMPRESSD        objc-src/PackInsp.m     54
+STATE_INSTALLED        objc-src/PackInsp.m     53
+STATE_LOOP     php-src/lce_functions.php       27
+STATE_OK       php-src/lce_functions.php       26
+STATE_UNINSTALLED      objc-src/PackInsp.m     52
+STAT_EQ        objc-src/PackInsp.m     /^#define STAT_EQ(s1, s2)       
((s1)->st_ino == (s2)->st_/
+STDIN  c-src/etags.c   408
+STDIN  c-src/etags.c   411
+STOP_POLLING   c-src/emacs/src/keyboard.c      2166
+STRING_BYTES   c-src/emacs/src/lisp.h  /^STRING_BYTES (struct Lisp_String *s)$/
+STRING_BYTES_BOUND     c-src/emacs/src/lisp.h  1261
+STRING_MULTIBYTE       c-src/emacs/src/lisp.h  /^STRING_MULTIBYTE (Lisp_Object 
str)$/
+STRING_SET_CHARS       c-src/emacs/src/lisp.h  /^STRING_SET_CHARS (Lisp_Object 
string, ptrdiff_t ne/
+STRING_SET_MULTIBYTE   c-src/emacs/src/lisp.h  /^#define 
STRING_SET_MULTIBYTE(STR)                     \\$/
+STRING_SET_UNIBYTE     c-src/emacs/src/lisp.h  /^#define 
STRING_SET_UNIBYTE(STR)                               \\$/
+SUBRP  c-src/emacs/src/lisp.h  /^SUBRP (Lisp_Object a)$/
+SUB_CHAR_TABLE_OFFSET  c-src/emacs/src/lisp.h  1701
+SUB_CHAR_TABLE_P       c-src/emacs/src/lisp.h  /^SUB_CHAR_TABLE_P (Lisp_Object 
a)$/
+SXHASH_REDUCE  c-src/emacs/src/lisp.h  /^SXHASH_REDUCE (EMACS_UINT x)$/
+SYMBOLP        c-src/emacs/src/lisp.h  /^# define SYMBOLP(x) lisp_h_SYMBOLP 
(x)$/
+SYMBOL_BLV     c-src/emacs/src/lisp.h  /^SYMBOL_BLV (struct Lisp_Symbol *sym)$/
+SYMBOL_CONSTANT_P      c-src/emacs/src/lisp.h  /^# define 
SYMBOL_CONSTANT_P(sym) lisp_h_SYMBOL_CONS/
+SYMBOL_FORWARDED       c-src/emacs/src/lisp.h  651
+SYMBOL_FWD     c-src/emacs/src/lisp.h  /^SYMBOL_FWD (struct Lisp_Symbol *sym)$/
+SYMBOL_INDEX   c-src/emacs/src/lisp.h  /^#define SYMBOL_INDEX(sym) i##sym$/
+SYMBOL_INTERNED        c-src/emacs/src/lisp.h  642
+SYMBOL_INTERNED_IN_INITIAL_OBARRAY     c-src/emacs/src/lisp.h  643
+SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P   c-src/emacs/src/lisp.h  
/^SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (Lisp_Object /
+SYMBOL_INTERNED_P      c-src/emacs/src/lisp.h  /^SYMBOL_INTERNED_P 
(Lisp_Object sym)$/
+SYMBOL_LOCALIZED       c-src/emacs/src/lisp.h  650
+SYMBOL_NAME    c-src/emacs/src/lisp.h  /^SYMBOL_NAME (Lisp_Object sym)$/
+SYMBOL_PLAINVAL        c-src/emacs/src/lisp.h  648
+SYMBOL_UNINTERNED      c-src/emacs/src/lisp.h  641
+SYMBOL_VAL     c-src/emacs/src/lisp.h  /^# define SYMBOL_VAL(sym) 
lisp_h_SYMBOL_VAL (sym)$/
+SYMBOL_VARALIAS        c-src/emacs/src/lisp.h  649
+SYSCALL        c-src/machsyscalls.c    /^#define       SYSCALL(name, number, 
type, args, typed_ar/
+Sample tex-src/gzip.texi       /^@node Sample, Invoking gzip, Overview, Top$/
+Scheme_functions       c-src/etags.c   /^Scheme_functions (FILE *inf)$/
+Scheme_help    c-src/etags.c   667
+Scheme_suffixes        c-src/etags.c   665
+SelectLayer    lua-src/allegro.lua     /^function SelectLayer (layer)$/
+Self/f ada-src/2ataspri.adb    /^   function Self return TCB_Ptr is$/
+Self/f ada-src/2ataspri.ads    /^   function Self return TCB_Ptr;$/
+Server pyt-src/server.py       /^class Server:$/
+ServerEdit     pyt-src/server.py       /^class ServerEdit(Frame):$/
+Set_Own_Priority/p     ada-src/2ataspri.adb    /^   procedure Set_Own_Priority 
(Prio : System.Any_P/
+Set_Own_Priority/p     ada-src/2ataspri.ads    /^   procedure Set_Own_Priority 
(Prio : System.Any_P/
+Set_Priority/p ada-src/2ataspri.adb    /^   procedure Set_Priority$/
+Set_Priority/p ada-src/2ataspri.ads    /^   procedure Set_Priority (T : 
TCB_Ptr; Prio : Sys/
+SimpleCalc     objcpp-src/SimpleCalc.H /^@interface SimpleCalc:Object$/
+SkipBlanks     pas-src/common.pas      /^function SkipBlanks; (*($/
+SkipChars      pas-src/common.pas      /^function SkipChars; (*($/
+SkipSpaces     pas-src/common.pas      /^procedure SkipSpaces; (* (Str : 
NameString; var I /
+Square.something:Bar   lua-src/test.lua        /^function Square.something:Bar 
()$/
+StartDay       cp-src/functions.cpp    /^Date StartDay(Date a,int 
days){\/\/Function to calcu/
+StripPath      pas-src/common.pas      /^function StripPath; (*($/
+SubString      pas-src/common.pas      /^function SubString; (*($/
+Subprocess     objc-src/Subprocess.h   /^@interface Subprocess:Object$/
+Subprocess     objc-src/Subprocess.h   41
+System.Task_Primitives/b       ada-src/2ataspri.adb    /^package body 
System.Task_Primitives is$/
+System.Task_Primitives/s       ada-src/2ataspri.ads    /^package 
System.Task_Primitives is$/
+T      cp-src/fail.C   14
+T2     cp-src/fail.C   16
+T3     c.c     163
+TAGS   make-src/Makefile       /^TAGS: etags.c$/
+TAG_PTR        c-src/emacs/src/lisp.h  /^#define TAG_PTR(tag, ptr) \\$/
+TAG_SYMOFFSET  c-src/emacs/src/lisp.h  /^#define TAG_SYMOFFSET(offset)         
                    \\$/
+TAS_Cell/t     ada-src/2ataspri.ads    /^   type TAS_Cell is private;$/
+TAS_Cell/t     ada-src/2ataspri.ads    /^   type TAS_Cell is$/
+TCB_Ptr/t      ada-src/2ataspri.ads    /^   type TCB_Ptr is access all 
Task_Control_Block;$/
+TCLFLAGS       make-src/Makefile       /^TCLFLAGS=--lang=none --regex='\/proc[ 
\\t]+\\([^ \\t]+/
+TERMINALP      c-src/emacs/src/lisp.h  /^TERMINALP (Lisp_Object a)$/
+TEST   php-src/ptest.php       1
+TEXSRC make-src/Makefile       /^TEXSRC=testenv.tex gzip.texi texinfo.tex 
nonewline/
+TEX_LESC       c-src/etags.c   4986
+TEX_SESC       c-src/etags.c   4987
+TEX_clgrp      c-src/etags.c   4922
+TEX_decode_env c-src/etags.c   /^TEX_decode_env (const char *evarname, const 
char */
+TEX_defenv     c-src/etags.c   4912
+TEX_esc        c-src/etags.c   4920
+TEX_mode       c-src/etags.c   /^TEX_mode (FILE *inf)$/
+TEX_opgrp      c-src/etags.c   4921
+TEX_toktab     c-src/etags.c   4908
+TOTAL_KEYWORDS c-src/etags.c   2325
+TSL/s  ada-src/2ataspri.adb    /^   package TSL renames 
System.Tasking_Soft_Links;$/
+TYPESTOSTAT    objc-src/PackInsp.h     37
+TYPE_RANGED_INTEGERP   c-src/emacs/src/lisp.h  /^#define 
TYPE_RANGED_INTEGERP(type, x) \\$/
+Tapes  tex-src/gzip.texi       /^@node Tapes, Problems, Environment, Top$/
+Task_Control_Block/t   ada-src/2ataspri.ads    /^   type Task_Control_Block is 
record$/
+Task_Storage_Size/t    ada-src/2ataspri.ads    /^   type Task_Storage_Size is 
new Interfaces.C.size/
+Task_Type/b    ada-src/etags-test-for.ada      /^  task body Task_Type is$/
+Task_Type/b    ada-src/waroquiers.ada  /^  task body Task_Type is$/
+Task_Type/k    ada-src/etags-test-for.ada      /^  task type Task_Type is$/
+Task_Type/k    ada-src/waroquiers.ada  /^  task type Task_Type is$/
+TeX_commands   c-src/etags.c   /^TeX_commands (FILE *inf)$/
+TeX_help       c-src/etags.c   674
+TeX_suffixes   c-src/etags.c   672
+Test_Abort/p   ada-src/2ataspri.adb    /^   procedure Test_Abort is$/
+Test_Abort/p   ada-src/2ataspri.ads    /^   procedure Test_Abort;$/
+Test_And_Set/p ada-src/2ataspri.adb    /^   procedure Test_And_Set (Cell : in 
out TAS_Cell;/
+Test_And_Set/p ada-src/2ataspri.ads    /^   procedure Test_And_Set (Cell : in 
out TAS_Cell;/
+Texinfo_help   c-src/etags.c   688
+Texinfo_nodes  c-src/etags.c   /^Texinfo_nodes (FILE *inf)$/
+Texinfo_suffixes       c-src/etags.c   686
+Time_to_position       c-src/emacs/src/keyboard.c      /^Time_to_position 
(Time encoded_pos)$/
+To_Lower       pas-src/common.pas      /^function To_Lower;(*(ch:char) : 
char;*)$/
+To_Start_Addr/f        ada-src/2ataspri.adb    /^      function To_Start_Addr 
is new$/
+To_TCB_Ptr/f   ada-src/2ataspri.adb    /^   function To_TCB_Ptr is new$/
+To_Upper       pas-src/common.pas      /^function To_Upper;(*(ch:char) : 
char;*)$/
+To_void_ptr/f  ada-src/2ataspri.adb    /^   function To_void_ptr is new$/
+Top    tex-src/gzip.texi       /^@node Top, , , (dir)$/
+Truc.Bidule/b  ada-src/etags-test-for.ada      /^package body Truc.Bidule is$/
+Truc.Bidule/b  ada-src/waroquiers.ada  /^package body Truc.Bidule is$/
+Truc.Bidule/s  ada-src/etags-test-for.ada      /^package Truc.Bidule is$/
+Truc.Bidule/s  ada-src/waroquiers.ada  /^package Truc.Bidule is$/
+Truc/s ada-src/etags-test-for.ada      /^package Truc is$/
+Truc/s ada-src/waroquiers.ada  /^package Truc is$/
+Type_Specific_Data/t   ada-src/etags-test-for.ada      /^   type 
Type_Specific_Data is record$/
+UCHAR  c-src/emacs/src/lisp.h  2424
+UNARY  y-src/cccp.c    18
+UNDEFINED      c-src/h.h       118
+UNEVALLED      c-src/emacs/src/lisp.h  2834
+UNGCPRO        c-src/emacs/src/lisp.h  3202
+UNGCPRO        c-src/emacs/src/lisp.h  3257
+UNGCPRO        c-src/emacs/src/lisp.h  3353
+UNLOCK c-src/emacs/src/gmalloc.c       /^#define UNLOCK()                      
        \\$/
+UNLOCK c-src/emacs/src/gmalloc.c       /^#define UNLOCK()$/
+UNLOCK_ALIGNED_BLOCKS  c-src/emacs/src/gmalloc.c       /^#define 
UNLOCK_ALIGNED_BLOCKS()                               \\$/
+UNLOCK_ALIGNED_BLOCKS  c-src/emacs/src/gmalloc.c       /^#define 
UNLOCK_ALIGNED_BLOCKS()$/
+UNSIGNED_CMP   c-src/emacs/src/lisp.h  /^#define UNSIGNED_CMP(a, op, b)        
                                        \\$/
+USE_LSB_TAG    c-src/emacs/src/lisp.h  /^DEFINE_GDB_SYMBOL_BEGIN (bool, 
USE_LSB_TAG)$/
+USE_LSB_TAG    c-src/emacs/src/lisp.h  271
+USE_PTHREAD    c-src/emacs/src/gmalloc.c       25
+USE_SAFE_ALLOCA        c-src/emacs/src/lisp.h  4560
+USE_STACK_CONS c-src/emacs/src/lisp.h  4689
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h  4652
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h  4658
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h  4659
+USE_STACK_STRING       c-src/emacs/src/lisp.h  4691
+U_CHAR y-src/cccp.y    38
+Unlock/p       ada-src/2ataspri.adb    /^   procedure Unlock (L : in out Lock) 
is$/
+Unlock/p       ada-src/2ataspri.ads    /^   procedure Unlock (L : in out 
Lock);$/
+User   pyt-src/server.py       /^class User:$/
+UserEdit       pyt-src/server.py       /^class UserEdit(Frame):$/
+VALBITS        c-src/emacs/src/lisp.h  246
+VALMASK        c-src/emacs/src/lisp.h  /^DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, 
VALMASK)$/
+VALMASK        c-src/emacs/src/lisp.h  829
+VAL_MAX        c-src/emacs/src/lisp.h  263
+VECSIZE        c-src/emacs/src/lisp.h  /^#define VECSIZE(type)                 
                        \\$/
+VECTORLIKEP    c-src/emacs/src/lisp.h  /^# define VECTORLIKEP(x) 
lisp_h_VECTORLIKEP (x)$/
+VECTORP        c-src/emacs/src/lisp.h  /^VECTORP (Lisp_Object x)$/
+VERSION        c-src/etags.c   789
+VERSION        erl-src/gs_dialog.erl   /^-define(VERSION, '2001.1101').$/
+VERSION        objc-src/PackInsp.m     34
+VHDLFLAGS      make-src/Makefile       /^VHDLFLAGS=--language=none 
--regex='\/[ \\t]*\\(ARCHIT/
+Vabbrev_start_location c-src/abbrev.c  63
+Vabbrev_start_location_buffer  c-src/abbrev.c  66
+Vabbrev_table_name_list        c-src/abbrev.c  43
+ValToNmStr     pas-src/common.pas      /^function ValToNmStr; (*($/
+Vfundamental_mode_abbrev_table c-src/abbrev.c  52
+Vglobal_abbrev_table   c-src/abbrev.c  48
+Vlast_abbrev   c-src/abbrev.c  70
+Vlast_abbrev_text      c-src/abbrev.c  75
+Vlispy_mouse_stem      c-src/emacs/src/keyboard.c      5172
+WAIT_READING_MAX       c-src/emacs/src/lisp.h  4281
+WAIT_READING_MAX       c-src/emacs/src/lisp.h  4283
+WARNINGS       make-src/Makefile       /^WARNINGS=-pedantic -Wall 
-Wpointer-arith -Winline /
+WCHAR_TYPE_SIZE        y-src/cccp.y    99
+WHITE  cp-src/screen.hpp       27
+WINDOWP        c-src/emacs/src/lisp.h  /^WINDOWP (Lisp_Object a)$/
+WINDOWSNT      c-src/etags.c   101
+WINDOWSNT      c-src/etags.c   102
+WINDOW_CONFIGURATIONP  c-src/emacs/src/lisp.h  /^WINDOW_CONFIGURATIONP 
(Lisp_Object a)$/
+WORKING        objc-src/PackInsp.m     368
+WorkingDays    cp-src/functions.cpp    /^int WorkingDays(Date a, Date b){$/
+Write_Lock/p   ada-src/2ataspri.adb    /^   procedure Write_Lock (L : in out 
Lock; Ceiling_/
+Write_Lock/p   ada-src/2ataspri.ads    /^   procedure Write_Lock (L : in out 
Lock; Ceiling_/
+X      c-src/h.h       100
+XBOOL_VECTOR   c-src/emacs/src/lisp.h  /^XBOOL_VECTOR (Lisp_Object a)$/
+XBUFFER        c-src/emacs/src/lisp.h  /^XBUFFER (Lisp_Object a)$/
+XBUFFER_OBJFWD c-src/emacs/src/lisp.h  /^XBUFFER_OBJFWD (union Lisp_Fwd *a)$/
+XCAR   c-src/emacs/src/lisp.h  /^# define XCAR(c) lisp_h_XCAR (c)$/
+XCDR   c-src/emacs/src/lisp.h  /^# define XCDR(c) lisp_h_XCDR (c)$/
+XCHAR_TABLE    c-src/emacs/src/lisp.h  /^XCHAR_TABLE (Lisp_Object a)$/
+XCHG_0 c-src/sysdep.h  47
+XCHG_1 c-src/sysdep.h  48
+XCHG_2 c-src/sysdep.h  49
+XCHG_3 c-src/sysdep.h  50
+XCHG_4 c-src/sysdep.h  51
+XCHG_5 c-src/sysdep.h  52
+XCONS  c-src/emacs/src/lisp.h  /^# define XCONS(a) lisp_h_XCONS (a)$/
+XDEFUN c.c     /^XDEFUN ("x-get-selection-internal", Fx_get_selecti/
+XFASTINT       c-src/emacs/src/lisp.h  /^#  define XFASTINT(a) lisp_h_XFASTINT 
(a)$/
+XFASTINT       c-src/emacs/src/lisp.h  /^XFASTINT (Lisp_Object a)$/
+XFINALIZER     c-src/emacs/src/lisp.h  /^XFINALIZER (Lisp_Object a)$/
+XFLOAT c-src/emacs/src/lisp.h  /^XFLOAT (Lisp_Object a)$/
+XFLOATINT      c-src/emacs/src/lisp.h  /^XFLOATINT (Lisp_Object n)$/
+XFLOAT_DATA    c-src/emacs/src/lisp.h  /^XFLOAT_DATA (Lisp_Object f)$/
+XFWDTYPE       c-src/emacs/src/lisp.h  /^XFWDTYPE (union Lisp_Fwd *a)$/
+XHASH  c-src/emacs/src/lisp.h  /^# define XHASH(a) lisp_h_XHASH (a)$/
+XHASH_TABLE    c-src/emacs/src/lisp.h  /^XHASH_TABLE (Lisp_Object a)$/
+XIL    c-src/emacs/src/lisp.h  /^# define XIL(i) lisp_h_XIL (i)$/
+XINT   c-src/emacs/src/lisp.h  /^#  define XINT(a) lisp_h_XINT (a)$/
+XINT   c-src/emacs/src/lisp.h  /^XINT (Lisp_Object a)$/
+XINTPTR        c-src/emacs/src/lisp.h  /^XINTPTR (Lisp_Object a)$/
+XLI    c-src/emacs/src/lisp.h  /^# define XLI(o) lisp_h_XLI (o)$/
+XLI_BUILTIN_LISPSYM    c-src/emacs/src/lisp.h  /^#define 
XLI_BUILTIN_LISPSYM(iname) TAG_SYMOFFSET (/
+XMARKER        c-src/emacs/src/lisp.h  /^XMARKER (Lisp_Object a)$/
+XMISC  c-src/emacs/src/lisp.h  /^XMISC (Lisp_Object a)$/
+XMISCANY       c-src/emacs/src/lisp.h  /^XMISCANY (Lisp_Object a)$/
+XMISCTYPE      c-src/emacs/src/lisp.h  /^XMISCTYPE (Lisp_Object a)$/
+XOVERLAY       c-src/emacs/src/lisp.h  /^XOVERLAY (Lisp_Object a)$/
+XPNTR  c-src/emacs/src/lisp.h  /^# define XPNTR(a) lisp_h_XPNTR (a)$/
+XPROCESS       c-src/emacs/src/lisp.h  /^XPROCESS (Lisp_Object a)$/
+XSAVE_FUNCPOINTER      c-src/emacs/src/lisp.h  /^XSAVE_FUNCPOINTER 
(Lisp_Object obj, int n)$/
+XSAVE_INTEGER  c-src/emacs/src/lisp.h  /^XSAVE_INTEGER (Lisp_Object obj, int 
n)$/
+XSAVE_OBJECT   c-src/emacs/src/lisp.h  /^XSAVE_OBJECT (Lisp_Object obj, int 
n)$/
+XSAVE_POINTER  c-src/emacs/src/lisp.h  /^XSAVE_POINTER (Lisp_Object obj, int 
n)$/
+XSAVE_VALUE    c-src/emacs/src/lisp.h  /^XSAVE_VALUE (Lisp_Object a)$/
+XSETBOOL_VECTOR        c-src/emacs/src/lisp.h  /^#define XSETBOOL_VECTOR(a, b) 
(XSETPSEUDOVECTOR (a/
+XSETBUFFER     c-src/emacs/src/lisp.h  /^#define XSETBUFFER(a, b) 
(XSETPSEUDOVECTOR (a, b, /
+XSETCDR        c-src/emacs/src/lisp.h  /^XSETCDR (Lisp_Object c, Lisp_Object 
n)$/
+XSETCHAR_TABLE c-src/emacs/src/lisp.h  /^#define XSETCHAR_TABLE(a, b) 
(XSETPSEUDOVECTOR (a,/
+XSETCOMPILED   c-src/emacs/src/lisp.h  /^#define XSETCOMPILED(a, b) 
(XSETPSEUDOVECTOR (a, b/
+XSETCONS       c-src/emacs/src/lisp.h  /^#define XSETCONS(a, b) ((a) = 
make_lisp_ptr (b, Li/
+XSETFASTINT    c-src/emacs/src/lisp.h  /^#define XSETFASTINT(a, b) ((a) = 
make_natnum (b))$/
+XSETFLOAT      c-src/emacs/src/lisp.h  /^#define XSETFLOAT(a, b) ((a) = 
make_lisp_ptr (b, L/
+XSETINT        c-src/emacs/src/lisp.h  /^#define XSETINT(a, b) ((a) = 
make_number (b))$/
+XSETMISC       c-src/emacs/src/lisp.h  /^#define XSETMISC(a, b) ((a) = 
make_lisp_ptr (b, Li/
+XSETPROCESS    c-src/emacs/src/lisp.h  /^#define XSETPROCESS(a, b) 
(XSETPSEUDOVECTOR (a, b,/
+XSETPSEUDOVECTOR       c-src/emacs/src/lisp.h  /^#define XSETPSEUDOVECTOR(a, 
b, code) \\$/
+XSETPVECTYPE   c-src/emacs/src/lisp.h  /^#define XSETPVECTYPE(v, code)         
                                \\$/
+XSETPVECTYPESIZE       c-src/emacs/src/lisp.h  /^#define XSETPVECTYPESIZE(v, 
code, lispsize, restsi/
+XSETSTRING     c-src/emacs/src/lisp.h  /^#define XSETSTRING(a, b) ((a) = 
make_lisp_ptr (b, /
+XSETSUBR       c-src/emacs/src/lisp.h  /^#define XSETSUBR(a, b) 
(XSETPSEUDOVECTOR (a, b, PV/
+XSETSUB_CHAR_TABLE     c-src/emacs/src/lisp.h  /^#define XSETSUB_CHAR_TABLE(a, 
b) (XSETPSEUDOVECTOR/
+XSETSYMBOL     c-src/emacs/src/lisp.h  /^#define XSETSYMBOL(a, b) ((a) = 
make_lisp_symbol (/
+XSETTERMINAL   c-src/emacs/src/lisp.h  /^#define XSETTERMINAL(a, b) 
(XSETPSEUDOVECTOR (a, b/
+XSETTYPED_PSEUDOVECTOR c-src/emacs/src/lisp.h  /^#define 
XSETTYPED_PSEUDOVECTOR(a, b, size, code)              /
+XSETVECTOR     c-src/emacs/src/lisp.h  /^#define XSETVECTOR(a, b) ((a) = 
make_lisp_ptr (b, /
+XSETWINDOW     c-src/emacs/src/lisp.h  /^#define XSETWINDOW(a, b) 
(XSETPSEUDOVECTOR (a, b, /
+XSETWINDOW_CONFIGURATION       c-src/emacs/src/lisp.h  /^#define 
XSETWINDOW_CONFIGURATION(a, b) \\$/
+XSET_HASH_TABLE        c-src/emacs/src/lisp.h  /^#define XSET_HASH_TABLE(VAR, 
PTR) \\$/
+XSTRING        c-src/emacs/src/lisp.h  /^XSTRING (Lisp_Object a)$/
+XSUBR  c-src/emacs/src/lisp.h  /^XSUBR (Lisp_Object a)$/
+XSUB_CHAR_TABLE        c-src/emacs/src/lisp.h  /^XSUB_CHAR_TABLE (Lisp_Object 
a)$/
+XSYMBOL        c-src/emacs/src/lisp.h  /^#  define XSYMBOL(a) lisp_h_XSYMBOL 
(a)$/
+XSYMBOL        c-src/emacs/src/lisp.h  /^XSYMBOL (Lisp_Object a)$/
+XTERMINAL      c-src/emacs/src/lisp.h  /^XTERMINAL (Lisp_Object a)$/
+XTYPE  c-src/emacs/src/lisp.h  /^#  define XTYPE(a) lisp_h_XTYPE (a)$/
+XTYPE  c-src/emacs/src/lisp.h  /^XTYPE (Lisp_Object a)$/
+XUNTAG c-src/emacs/src/lisp.h  /^#  define XUNTAG(a, type) lisp_h_XUNTAG (a, 
type)$/
+XUNTAG c-src/emacs/src/lisp.h  /^XUNTAG (Lisp_Object a, int type)$/
+XWINDOW        c-src/emacs/src/lisp.h  /^XWINDOW (Lisp_Object a)$/
+XX     cp-src/x.cc     1
+Xyzzy  ruby-src/test1.ru       13
+Y      c-src/h.h       100
+YACC   c-src/etags.c   2199
+YELLOW cp-src/screen.hpp       26
+YSRC   make-src/Makefile       /^YSRC=parse.y parse.c atest.y cccp.c cccp.y$/
+YYABORT        /usr/share/bison/bison.simple   153
+YYABORT        /usr/share/bison/bison.simple   154
+YYACCEPT       /usr/share/bison/bison.simple   152
+YYACCEPT       /usr/share/bison/bison.simple   153
+YYBACKUP       /usr/share/bison/bison.simple   /^#define YYBACKUP(Token, 
Value)                                        \\$/
+YYBISON        y-src/cccp.c    4
+YYBISON        y-src/parse.c   4
+YYDPRINTF      /usr/share/bison/bison.simple   /^# define YYDPRINTF(Args)      
                \\$/
+YYDPRINTF      /usr/share/bison/bison.simple   /^# define YYDPRINTF(Args)$/
+YYEMPTY        /usr/share/bison/bison.simple   150
+YYEMPTY        /usr/share/bison/bison.simple   151
+YYEOF  /usr/share/bison/bison.simple   151
+YYEOF  /usr/share/bison/bison.simple   152
+YYERRCODE      /usr/share/bison/bison.simple   178
+YYERRCODE      /usr/share/bison/bison.simple   179
+YYERROR        /usr/share/bison/bison.simple   154
+YYERROR        /usr/share/bison/bison.simple   155
+YYFAIL /usr/share/bison/bison.simple   158
+YYFAIL /usr/share/bison/bison.simple   159
+YYFPRINTF      /usr/share/bison/bison.simple   225
+YYFPRINTF      /usr/share/bison/bison.simple   226
+YYINITDEPTH    /usr/share/bison/bison.simple   244
+YYINITDEPTH    /usr/share/bison/bison.simple   245
+YYLEX  /usr/share/bison/bison.simple   200
+YYLEX  /usr/share/bison/bison.simple   201
+YYLEX  /usr/share/bison/bison.simple   202
+YYLEX  /usr/share/bison/bison.simple   203
+YYLEX  /usr/share/bison/bison.simple   206
+YYLEX  /usr/share/bison/bison.simple   207
+YYLEX  /usr/share/bison/bison.simple   208
+YYLEX  /usr/share/bison/bison.simple   209
+YYLEX  /usr/share/bison/bison.simple   212
+YYLEX  /usr/share/bison/bison.simple   213
+YYLLOC_DEFAULT /usr/share/bison/bison.simple   /^# define 
YYLLOC_DEFAULT(Current, Rhs, N)              \\$/
+YYMAXDEPTH     /usr/share/bison/bison.simple   255
+YYMAXDEPTH     /usr/share/bison/bison.simple   256
+YYMAXDEPTH     /usr/share/bison/bison.simple   259
+YYMAXDEPTH     /usr/share/bison/bison.simple   260
+YYPARSE_PARAM_ARG      /usr/share/bison/bison.simple   351
+YYPARSE_PARAM_ARG      /usr/share/bison/bison.simple   354
+YYPARSE_PARAM_ARG      /usr/share/bison/bison.simple   358
+YYPARSE_PARAM_DECL     /usr/share/bison/bison.simple   352
+YYPARSE_PARAM_DECL     /usr/share/bison/bison.simple   355
+YYPARSE_PARAM_DECL     /usr/share/bison/bison.simple   359
+YYPOPSTACK     /usr/share/bison/bison.simple   445
+YYPOPSTACK     /usr/share/bison/bison.simple   447
+YYRECOVERING   /usr/share/bison/bison.simple   /^#define YYRECOVERING()  
(!!yyerrstatus)$/
+YYSIZE_T       /usr/share/bison/bison.simple   128
+YYSIZE_T       /usr/share/bison/bison.simple   129
+YYSIZE_T       /usr/share/bison/bison.simple   131
+YYSIZE_T       /usr/share/bison/bison.simple   132
+YYSIZE_T       /usr/share/bison/bison.simple   136
+YYSIZE_T       /usr/share/bison/bison.simple   137
+YYSIZE_T       /usr/share/bison/bison.simple   140
+YYSIZE_T       /usr/share/bison/bison.simple   141
+YYSIZE_T       /usr/share/bison/bison.simple   145
+YYSIZE_T       /usr/share/bison/bison.simple   146
+YYSIZE_T       /usr/share/bison/bison.simple   51
+YYSIZE_T       /usr/share/bison/bison.simple   52
+YYSIZE_T       /usr/share/bison/bison.simple   56
+YYSIZE_T       /usr/share/bison/bison.simple   57
+YYSIZE_T       /usr/share/bison/bison.simple   71
+YYSIZE_T       /usr/share/bison/bison.simple   72
+YYSIZE_T       /usr/share/bison/bison.simple   75
+YYSIZE_T       /usr/share/bison/bison.simple   76
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   50
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   51
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   55
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   56
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   59
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   60
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   78
+YYSTACK_ALLOC  /usr/share/bison/bison.simple   79
+YYSTACK_BYTES  /usr/share/bison/bison.simple   /^#  define YYSTACK_BYTES(N) 
\\$/
+YYSTACK_FREE   /usr/share/bison/bison.simple   /^#  define YYSTACK_FREE(Ptr) 
do { \/* empty *\/; } wh/
+YYSTACK_FREE   /usr/share/bison/bison.simple   79
+YYSTACK_FREE   /usr/share/bison/bison.simple   80
+YYSTACK_GAP_MAX        /usr/share/bison/bison.simple   93
+YYSTACK_GAP_MAX        /usr/share/bison/bison.simple   94
+YYSTACK_RELOCATE       /usr/share/bison/bison.simple   /^# define 
YYSTACK_RELOCATE(Type, Stack)                                        \\$/
+YYSTACK_RELOCATE       /usr/share/bison/bison.simple   548
+YYSTD  /usr/share/bison/bison.simple   /^# define YYSTD(x) std::x$/
+YYSTD  /usr/share/bison/bison.simple   /^# define YYSTD(x) x$/
+YYSTYPE        y-src/parse.y   72
+YYSTYPE        y-src/parse.y   73
+YYTERROR       /usr/share/bison/bison.simple   177
+YYTERROR       /usr/share/bison/bison.simple   178
+YY_DECL_NON_LSP_VARIABLES      /usr/share/bison/bison.simple   374
+YY_DECL_VARIABLES      /usr/share/bison/bison.simple   385
+YY_DECL_VARIABLES      /usr/share/bison/bison.simple   391
+Yacc_entries   c-src/etags.c   /^Yacc_entries (FILE *inf)$/
+Yacc_help      c-src/etags.c   693
+Yacc_suffixes  c-src/etags.c   691
+Z      c-src/h.h       100
+[]     ruby-src/test.rb        /^        def [](y)$/
+[]=    ruby-src/test.rb        /^        def []=(y, val)$/
+\      tex-src/texinfo.tex     /^\\def\\ {{\\fontdimen2\\font=\\tclosesave{} 
}}%$/
+\      tex-src/texinfo.tex     /^\\gdef\\sepspaces{\\def {\\ }}}$/
+\'     tex-src/texinfo.tex     /^\\def\\'{{'}}$/
+\*     tex-src/texinfo.tex     
/^\\def\\*{\\hfil\\break\\hbox{}\\ignorespaces}$/
+\.     tex-src/texinfo.tex     /^\\def\\.{.\\spacefactor=3000 }$/
+\:     tex-src/texinfo.tex     /^\\def\\:{\\spacefactor=1000 }$/
+\@     tex-src/texinfo.tex     /^\\def\\@{@}%$/
+\@     tex-src/texinfo.tex     /^\\def\\@{{\\tt \\char '100}}$/
+\CHAPFopen     tex-src/texinfo.tex     /^\\def\\CHAPFopen{$/
+\CHAPFplain    tex-src/texinfo.tex     /^\\def\\CHAPFplain{$/
+\CHAPPAGodd    tex-src/texinfo.tex     /^\\def\\CHAPPAGodd{$/
+\CHAPPAGoff    tex-src/texinfo.tex     /^\\def\\CHAPPAGoff{$/
+\CHAPPAGon     tex-src/texinfo.tex     /^\\def\\CHAPPAGon{$/
+\ENVcheck      tex-src/texinfo.tex     /^\\def\\ENVcheck{%$/
+\Ealphaenumerate       tex-src/texinfo.tex     
/^\\def\\Ealphaenumerate{\\Eenumerate}$/
+\Ecapsenumerate        tex-src/texinfo.tex     
/^\\def\\Ecapsenumerate{\\Eenumerate}$/
+\Ecartouche    tex-src/texinfo.tex     /^\\def\\Ecartouche{%$/
+\Edescription  tex-src/texinfo.tex     /^\\def\\Edescription{\\Etable}% 
Necessary kludge.$/
+\Edisplay      tex-src/texinfo.tex     
/^\\def\\Edisplay{\\endgroup\\afterenvbreak}%$/
+\Eexample      tex-src/texinfo.tex     /^\\def\\Eexample{\\Elisp}$/
+\Eflushleft    tex-src/texinfo.tex     
/^\\def\\Eflushleft{\\endgroup\\afterenvbreak}%$/
+\Eflushright   tex-src/texinfo.tex     
/^\\def\\Eflushright{\\endgroup\\afterenvbreak}%$/
+\Eformat       tex-src/texinfo.tex     
/^\\def\\Eformat{\\endgroup\\afterenvbreak}$/
+\Eftable       tex-src/texinfo.tex     
/^\\def\\Eftable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\Egroup        tex-src/texinfo.tex     /^  \\def\\Egroup{\\egroup\\endgroup}%$/
+\Eifclear      tex-src/texinfo.tex     /^\\def\\Eifclear{}$/
+\Eifset        tex-src/texinfo.tex     /^\\def\\Eifset{}$/
+\Eiftex        tex-src/texinfo.tex     /^\\def\\Eiftex{}$/
+\Elisp tex-src/texinfo.tex     /^\\def\\Elisp{\\endgroup\\afterenvbreak}%$/
+\Equotation    tex-src/texinfo.tex     
/^\\def\\Equotation{\\par\\endgroup\\afterenvbreak}%$/
+\Esmallexample tex-src/texinfo.tex     /^\\def\\Esmallexample{\\Elisp}$/
+\Esmallexample tex-src/texinfo.tex     
/^\\global\\def\\Esmallexample{\\Esmalllisp}$/
+\Esmalllisp    tex-src/texinfo.tex     
/^\\def\\Esmalllisp{\\endgroup\\afterenvbreak}%$/
+\Etable        tex-src/texinfo.tex     
/^\\def\\Etable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\Etitlepage    tex-src/texinfo.tex     /^\\def\\Etitlepage{%$/
+\Evtable       tex-src/texinfo.tex     
/^\\def\\Evtable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\HEADINGSafter tex-src/texinfo.tex     
/^\\def\\HEADINGSafter{\\let\\HEADINGShook=\\HEADINGSdoub/
+\HEADINGSdouble        tex-src/texinfo.tex     /^\\def\\HEADINGSdouble{$/
+\HEADINGSdoublex       tex-src/texinfo.tex     /^\\def\\HEADINGSdoublex{%$/
+\HEADINGSoff   tex-src/texinfo.tex     /^\\def\\HEADINGSoff{$/
+\HEADINGSon    tex-src/texinfo.tex     /^\\def\\HEADINGSon{\\HEADINGSdouble}$/
+\HEADINGSon    tex-src/texinfo.tex     
/^\\global\\def\\HEADINGSon{\\HEADINGSdouble}}$/
+\HEADINGSon    tex-src/texinfo.tex     
/^\\global\\def\\HEADINGSon{\\HEADINGSsingle}}$/
+\HEADINGSsingle        tex-src/texinfo.tex     /^\\def\\HEADINGSsingle{$/
+\HEADINGSsingleafter   tex-src/texinfo.tex     
/^\\def\\HEADINGSsingleafter{\\let\\HEADINGShook=\\HEADIN/
+\HEADINGSsinglex       tex-src/texinfo.tex     /^\\def\\HEADINGSsinglex{%$/
+\TeX   tex-src/texinfo.tex     /^\\def\\TeX{\\realbackslash TeX}$/
+\TeX   tex-src/texinfo.tex     /^\\def\\TeX{\\realbackslash TeX}%$/
+\Yappendixletterandtype        tex-src/texinfo.tex     
/^\\def\\Yappendixletterandtype{%$/
+\Ynothing      tex-src/texinfo.tex     /^\\def\\Ynothing{}$/
+\Ypagenumber   tex-src/texinfo.tex     /^\\def\\Ypagenumber{\\folio}$/
+\Ysectionnumberandtype tex-src/texinfo.tex     
/^\\def\\Ysectionnumberandtype{%$/
+\Ytitle        tex-src/texinfo.tex     /^\\def\\Ytitle{\\thischapter}$/
+\_     tex-src/texinfo.tex     /^\\def\\_{\\lvvmode \\kern.06em \\vbox{\\hrule 
width.3em /
+\_     tex-src/texinfo.tex     /^\\def\\_{{\\realbackslash _}}%$/
+\`     tex-src/texinfo.tex     /^\\def\\`{{`}}$/
+\aboveenvbreak tex-src/texinfo.tex     
/^\\def\\aboveenvbreak{{\\advance\\aboveenvskipamount by/
+\activedoublequote     tex-src/texinfo.tex     
/^\\def\\activedoublequote{{\\tt \\char '042}}$/
+\activeparens  tex-src/texinfo.tex     /^\\def\\activeparens{%$/
+\afourpaper    tex-src/texinfo.tex     /^\\def\\afourpaper{$/
+\afterenvbreak tex-src/texinfo.tex     /^\\def\\afterenvbreak{\\endgraf 
\\ifdim\\lastskip<\\above/
+\alphaenumerate        tex-src/texinfo.tex     
/^\\def\\alphaenumerate{\\enumerate{a}}$/
+\appendix      tex-src/texinfo.tex     
/^\\outer\\def\\appendix{\\parsearg\\appendixzzz}$/
+\appendixletter        tex-src/texinfo.tex     
/^\\def\\appendixletter{\\char\\the\\appendixno}$/
+\appendixnoderef       tex-src/texinfo.tex     
/^\\def\\appendixnoderef{\\ifx\\lastnode\\relax\\else$/
+\appendixsec   tex-src/texinfo.tex     
/^\\outer\\def\\appendixsec{\\parsearg\\appendixsectionzz/
+\appendixsection       tex-src/texinfo.tex     
/^\\outer\\def\\appendixsection{\\parsearg\\appendixsecti/
+\appendixsectionzzz    tex-src/texinfo.tex     /^\\def\\appendixsectionzzz 
#1{\\seccheck{appendixsecti/
+\appendixsetref        tex-src/texinfo.tex     /^\\def\\appendixsetref#1{%$/
+\appendixsubsec        tex-src/texinfo.tex     
/^\\outer\\def\\appendixsubsec{\\parsearg\\appendixsubsec/
+\appendixsubseczzz     tex-src/texinfo.tex     /^\\def\\appendixsubseczzz 
#1{\\seccheck{appendixsubsec/
+\appendixsubsubsec     tex-src/texinfo.tex     
/^\\outer\\def\\appendixsubsubsec{\\parsearg\\appendixsub/
+\appendixsubsubseczzz  tex-src/texinfo.tex     /^\\def\\appendixsubsubseczzz 
#1{\\seccheck{appendixsub/
+\appendixzzz   tex-src/texinfo.tex     /^\\def\\appendixzzz 
#1{\\seccheck{appendix}%$/
+\asis  tex-src/texinfo.tex     /^\\def\\asis#1{#1}$/
+\author        tex-src/texinfo.tex     /^   
\\def\\author{\\parsearg\\authorzzz}%$/
+\authorfont    tex-src/texinfo.tex     /^   \\def\\authorfont{\\authorrm 
\\normalbaselineskip =/
+\authorzzz     tex-src/texinfo.tex     /^   
\\def\\authorzzz##1{\\ifseenauthor\\else\\vskip 0pt /
+\b     tex-src/texinfo.tex     /^\\def\\b##1{\\realbackslash b {##1}}$/
+\b     tex-src/texinfo.tex     /^\\def\\b##1{\\realbackslash b {##1}}%$/
+\b     tex-src/texinfo.tex     /^\\def\\b#1{{\\bf #1}}$/
+\balancecolumns        tex-src/texinfo.tex     /^\\def\\balancecolumns{%$/
+\begin tex-src/texinfo.tex     /^\\outer\\def\\begin{\\parsearg\\beginxxx}$/
+\begindoublecolumns    tex-src/texinfo.tex     
/^\\def\\begindoublecolumns{\\begingroup$/
+\beginxxx      tex-src/texinfo.tex     /^\\def\\beginxxx #1{%$/
+\bf    tex-src/texinfo.tex     /^\\def\\bf{\\realbackslash bf }$/
+\bf    tex-src/texinfo.tex     /^\\def\\bf{\\realbackslash bf }%$/
+\bullet        tex-src/texinfo.tex     /^\\def\\bullet{$\\ptexbullet$}$/
+\bye   tex-src/texinfo.tex     
/^\\outer\\def\\bye{\\pagealignmacro\\tracingstats=1\\ptex/
+\capsenumerate tex-src/texinfo.tex     /^\\def\\capsenumerate{\\enumerate{A}}$/
+\cartbot       tex-src/texinfo.tex     /^\\def\\cartbot{\\hbox to 
\\cartouter{\\hskip\\lskip$/
+\cartouche     tex-src/texinfo.tex     /^\\long\\def\\cartouche{%$/
+\carttop       tex-src/texinfo.tex     /^\\def\\carttop{\\hbox to 
\\cartouter{\\hskip\\lskip$/
+\cbl   tex-src/texinfo.tex     /^\\def\\cbl{{\\circle\\char'012\\hskip -6pt}}$/
+\cbr   tex-src/texinfo.tex     /^\\def\\cbr{{\\hskip 6pt\\circle\\char'011}}$/
+\center        tex-src/texinfo.tex     /^\\def\\center{\\parsearg\\centerzzz}$/
+\centerzzz     tex-src/texinfo.tex     /^\\def\\centerzzz #1{{\\advance\\hsize 
by -\\leftskip$/
+\chapbreak     tex-src/texinfo.tex     /^\\def\\chapbreak{\\dobreak 
\\chapheadingskip {-4000}}$/
+\chapentry     tex-src/texinfo.tex     
/^\\def\\chapentry#1#2#3{\\dochapentry{#2\\labelspace#1}/
+\chapentryfonts        tex-src/texinfo.tex     
/^\\def\\chapentryfonts{\\secfonts \\rm}$/
+\chapfonts     tex-src/texinfo.tex     /^\\def\\chapfonts{%$/
+\chapheading   tex-src/texinfo.tex     
/^\\def\\chapheading{\\parsearg\\chapheadingzzz}$/
+\chapheadingzzz        tex-src/texinfo.tex     /^\\def\\chapheadingzzz 
#1{\\chapbreak %$/
+\chapoddpage   tex-src/texinfo.tex     /^\\def\\chapoddpage{\\chappager 
\\ifodd\\pageno \\else \\h/
+\chappager     tex-src/texinfo.tex     
/^\\def\\chappager{\\par\\vfill\\supereject}$/
+\chapter       tex-src/texinfo.tex     
/^\\outer\\def\\chapter{\\parsearg\\chapterzzz}$/
+\chapternofonts        tex-src/texinfo.tex     /^\\def\\chapternofonts{%$/
+\chapterzzz    tex-src/texinfo.tex     /^\\def\\chapterzzz 
#1{\\seccheck{chapter}%$/
+\char  tex-src/texinfo.tex     /^\\def\\char{\\realbackslash char}$/
+\char  tex-src/texinfo.tex     /^\\def\\char{\\realbackslash char}%$/
+\chfopen       tex-src/texinfo.tex     /^\\def\\chfopen #1#2{\\chapoddpage 
{\\chapfonts$/
+\chfplain      tex-src/texinfo.tex     /^\\def\\chfplain #1#2{%$/
+\cindex        tex-src/texinfo.tex     /^\\def\\cindex {\\cpindex}$/
+\cindexsub     tex-src/texinfo.tex     /^\\def\\cindexsub 
{\\begingroup\\obeylines\\cindexsub}$/
+\cite  tex-src/texinfo.tex     /^\\def\\cite##1{\\realbackslash cite {##1}}$/
+\cite  tex-src/texinfo.tex     /^\\def\\cite##1{\\realbackslash cite {##1}}%$/
+\clear tex-src/texinfo.tex     /^\\def\\clear{\\parsearg\\clearxxx}$/
+\clearxxx      tex-src/texinfo.tex     /^\\def\\clearxxx #1{$/
+\code  tex-src/texinfo.tex     /^\\def\\code##1{\\realbackslash code {##1}}$/
+\code  tex-src/texinfo.tex     /^\\def\\code##1{\\realbackslash code {##1}}%$/
+\comment       tex-src/texinfo.tex     /^\\def\\comment{\\catcode 64=\\other 
\\catcode 123=\\othe/
+\commentxxx    tex-src/texinfo.tex     /^\\def\\commentxxx #1{\\catcode 64=0 
\\catcode 123=1 \\c/
+\contents      tex-src/texinfo.tex     /^\\outer\\def\\contents{%$/
+\copyright     tex-src/texinfo.tex     /^\\def\\copyright{\\realbackslash 
copyright }%$/
+\copyright     tex-src/texinfo.tex     /^\\def\\copyright{\\realbackslash 
copyright}$/
+\cropmarks     tex-src/texinfo.tex     
/^\\def\\cropmarks{\\let\\onepageout=\\croppageout }$/
+\croppageout   tex-src/texinfo.tex     /^\\def\\croppageout#1{\\hoffset=0pt % 
make sure this d/
+\ctl   tex-src/texinfo.tex     /^\\def\\ctl{{\\circle\\char'013\\hskip -6pt}}% 
6pt from /
+\ctr   tex-src/texinfo.tex     /^\\def\\ctr{{\\hskip 6pt\\circle\\char'010}}$/
+\ctrl  tex-src/texinfo.tex     /^\\def\\ctrl #1{{\\tt \\rawbackslash 
\\hat}#1}$/
+\defcodeindex  tex-src/texinfo.tex     
/^\\def\\defcodeindex{\\parsearg\\newcodeindex}$/
+\defcv tex-src/texinfo.tex     /^\\def\\defcv #1 {\\def\\defcvtype{#1}%$/
+\defcvarheader tex-src/texinfo.tex     /^\\def\\defcvarheader #1#2#3{%$/
+\defcvx        tex-src/texinfo.tex     /^\\def\\defcvx #1 
{\\errmessage{@defcvx in invalid con/
+\deffn tex-src/texinfo.tex     
/^\\def\\deffn{\\defmethparsebody\\Edeffn\\deffnx\\deffnhe/
+\deffnheader   tex-src/texinfo.tex     /^\\def\\deffnheader #1#2#3{\\doind 
{fn}{\\code{#2}}%$/
+\deffnx        tex-src/texinfo.tex     /^\\def\\deffnx #1 
{\\errmessage{@deffnx in invalid con/
+\defindex      tex-src/texinfo.tex     
/^\\def\\defindex{\\parsearg\\newindex}$/
+\defivar       tex-src/texinfo.tex     
/^\\def\\defivar{\\defvrparsebody\\Edefivar\\defivarx\\def/
+\defivarheader tex-src/texinfo.tex     /^\\def\\defivarheader #1#2#3{%$/
+\defivarx      tex-src/texinfo.tex     /^\\def\\defivarx #1 
{\\errmessage{@defivarx in invalid/
+\defmac        tex-src/texinfo.tex     
/^\\def\\defmac{\\defparsebody\\Edefmac\\defmacx\\defmache/
+\defmacheader  tex-src/texinfo.tex     /^\\def\\defmacheader #1#2{\\doind 
{fn}{\\code{#1}}% Mak/
+\defmacx       tex-src/texinfo.tex     /^\\def\\defmacx #1 
{\\errmessage{@defmacx in invalid c/
+\defmethod     tex-src/texinfo.tex     
/^\\def\\defmethod{\\defmethparsebody\\Edefmethod\\defmet/
+\defmethodheader       tex-src/texinfo.tex     /^\\def\\defmethodheader 
#1#2#3{%$/
+\defmethodx    tex-src/texinfo.tex     /^\\def\\defmethodx #1 
{\\errmessage{@defmethodx in inv/
+\defmethparsebody      tex-src/texinfo.tex     /^\\def\\defmethparsebody 
#1#2#3#4 {\\begingroup\\inENV /
+\defname       tex-src/texinfo.tex     /^\\def\\defname #1#2{%$/
+\defop tex-src/texinfo.tex     /^\\def\\defop #1 {\\def\\defoptype{#1}%$/
+\defopheader   tex-src/texinfo.tex     /^\\def\\defopheader #1#2#3{%$/
+\defopparsebody        tex-src/texinfo.tex     /^\\def\\defopparsebody 
#1#2#3#4#5 {\\begingroup\\inENV /
+\defopt        tex-src/texinfo.tex     
/^\\def\\defopt{\\defvarparsebody\\Edefopt\\defoptx\\defop/
+\defoptheader  tex-src/texinfo.tex     /^\\def\\defoptheader #1#2{\\doind 
{vr}{\\code{#1}}% Mak/
+\defoptx       tex-src/texinfo.tex     /^\\def\\defoptx #1 
{\\errmessage{@defoptx in invalid c/
+\defopvarparsebody     tex-src/texinfo.tex     /^\\def\\defopvarparsebody 
#1#2#3#4#5 {\\begingroup\\inE/
+\defopx        tex-src/texinfo.tex     /^\\def\\defopx #1 
{\\errmessage{@defopx in invalid con/
+\defparsebody  tex-src/texinfo.tex     /^\\def\\defparsebody 
#1#2#3{\\begingroup\\inENV% Enviro/
+\defspec       tex-src/texinfo.tex     
/^\\def\\defspec{\\defparsebody\\Edefspec\\defspecx\\defsp/
+\defspecheader tex-src/texinfo.tex     /^\\def\\defspecheader #1#2{\\doind 
{fn}{\\code{#1}}% Ma/
+\defspecx      tex-src/texinfo.tex     /^\\def\\defspecx #1 
{\\errmessage{@defspecx in invalid/
+\deftp tex-src/texinfo.tex     
/^\\def\\deftp{\\defvrparsebody\\Edeftp\\deftpx\\deftphead/
+\deftpargs     tex-src/texinfo.tex     /^\\def\\deftpargs #1{\\bf 
\\defvarargs{#1}}$/
+\deftpheader   tex-src/texinfo.tex     /^\\def\\deftpheader #1#2#3{\\doind 
{tp}{\\code{#2}}%$/
+\deftpx        tex-src/texinfo.tex     /^\\def\\deftpx #1 
{\\errmessage{@deftpx in invalid con/
+\deftypefn     tex-src/texinfo.tex     
/^\\def\\deftypefn{\\defmethparsebody\\Edeftypefn\\deftyp/
+\deftypefnheader       tex-src/texinfo.tex     /^\\def\\deftypefnheader 
#1#2#3{\\deftypefnheaderx{#1}{/
+\deftypefnheaderx      tex-src/texinfo.tex     /^\\def\\deftypefnheaderx 
#1#2#3 #4\\relax{%$/
+\deftypefnx    tex-src/texinfo.tex     /^\\def\\deftypefnx #1 
{\\errmessage{@deftypefnx in inv/
+\deftypefun    tex-src/texinfo.tex     
/^\\def\\deftypefun{\\defparsebody\\Edeftypefun\\deftypef/
+\deftypefunargs        tex-src/texinfo.tex     /^\\def\\deftypefunargs #1{%$/
+\deftypefunheader      tex-src/texinfo.tex     /^\\def\\deftypefunheader 
#1#2{\\deftypefunheaderx{#1}#/
+\deftypefunheaderx     tex-src/texinfo.tex     /^\\def\\deftypefunheaderx #1#2 
#3\\relax{%$/
+\deftypeunx    tex-src/texinfo.tex     /^\\def\\deftypeunx #1 
{\\errmessage{@deftypeunx in inv/
+\deftypevar    tex-src/texinfo.tex     
/^\\def\\deftypevar{\\defvarparsebody\\Edeftypevar\\defty/
+\deftypevarheader      tex-src/texinfo.tex     /^\\def\\deftypevarheader 
#1#2{%$/
+\deftypevarx   tex-src/texinfo.tex     /^\\def\\deftypevarx #1 
{\\errmessage{@deftypevarx in i/
+\deftypevr     tex-src/texinfo.tex     
/^\\def\\deftypevr{\\defvrparsebody\\Edeftypevr\\deftypev/
+\deftypevrheader       tex-src/texinfo.tex     /^\\def\\deftypevrheader 
#1#2#3{\\doind {vr}{\\code{#3}}/
+\deftypevrx    tex-src/texinfo.tex     /^\\def\\deftypevrx #1 
{\\errmessage{@deftypevrx in inv/
+\defun tex-src/texinfo.tex     
/^\\def\\defun{\\defparsebody\\Edefun\\defunx\\defunheader/
+\defunargs     tex-src/texinfo.tex     /^\\def\\defunargs #1{\\functionparens 
\\sl$/
+\defunheader   tex-src/texinfo.tex     /^\\def\\defunheader #1#2{\\doind 
{fn}{\\code{#1}}% Make/
+\defunx        tex-src/texinfo.tex     /^\\def\\defunx #1 
{\\errmessage{@defunx in invalid con/
+\defvar        tex-src/texinfo.tex     
/^\\def\\defvar{\\defvarparsebody\\Edefvar\\defvarx\\defva/
+\defvarargs    tex-src/texinfo.tex     /^\\def\\defvarargs #1{\\normalparens 
#1%$/
+\defvarheader  tex-src/texinfo.tex     /^\\def\\defvarheader #1#2{\\doind 
{vr}{\\code{#1}}% Mak/
+\defvarparsebody       tex-src/texinfo.tex     /^\\def\\defvarparsebody 
#1#2#3{\\begingroup\\inENV% Env/
+\defvarx       tex-src/texinfo.tex     /^\\def\\defvarx #1 
{\\errmessage{@defvarx in invalid c/
+\defvr tex-src/texinfo.tex     
/^\\def\\defvr{\\defvrparsebody\\Edefvr\\defvrx\\defvrhead/
+\defvrheader   tex-src/texinfo.tex     /^\\def\\defvrheader #1#2#3{\\doind 
{vr}{\\code{#2}}%$/
+\defvrparsebody        tex-src/texinfo.tex     /^\\def\\defvrparsebody 
#1#2#3#4 {\\begingroup\\inENV %$/
+\defvrx        tex-src/texinfo.tex     /^\\def\\defvrx #1 
{\\errmessage{@defvrx in invalid con/
+\description   tex-src/texinfo.tex     
/^\\def\\description{\\tablez{\\dontindex}{1}{}{}{}{}}$/
+\df    tex-src/texinfo.tex     /^\\def\\df{\\let\\tentt=\\deftt \\let\\tenbf = 
\\defbf \\bf}/
+\dfn   tex-src/texinfo.tex     /^\\def\\dfn##1{\\realbackslash dfn {##1}}$/
+\direntry      tex-src/texinfo.tex     
/^\\def\\direntry{\\begingroup\\direntryxxx}$/
+\direntryxxx   tex-src/texinfo.tex     /^\\long\\def\\direntryxxx #1\\end 
direntry{\\endgroup\\ig/
+\display       tex-src/texinfo.tex     /^\\def\\display{\\begingroup\\inENV 
%This group ends at/
+\dmn   tex-src/texinfo.tex     /^\\def\\dmn#1{\\thinspace #1}$/
+\dobreak       tex-src/texinfo.tex     
/^\\def\\dobreak#1#2{\\par\\ifdim\\lastskip<#1\\removelast/
+\dochapentry   tex-src/texinfo.tex     /^\\def\\dochapentry#1#2{%$/
+\docodeindex   tex-src/texinfo.tex     
/^\\def\\docodeindex#1{\\edef\\indexname{#1}\\parsearg\\si/
+\doind tex-src/texinfo.tex     /^\\def\\doind #1#2{%$/
+\doindex       tex-src/texinfo.tex     
/^\\def\\doindex#1{\\edef\\indexname{#1}\\parsearg\\single/
+\donoderef     tex-src/texinfo.tex     
/^\\def\\donoderef{\\ifx\\lastnode\\relax\\else$/
+\dontindex     tex-src/texinfo.tex     /^\\def\\dontindex #1{}$/
+\dopageno      tex-src/texinfo.tex     /^\\def\\dopageno#1{{\\rm #1}}$/
+\doprintindex  tex-src/texinfo.tex     /^\\def\\doprintindex#1{%$/
+\dosecentry    tex-src/texinfo.tex     /^\\def\\dosecentry#1#2{%$/
+\dosetq        tex-src/texinfo.tex     /^\\def\\dosetq #1#2{{\\let\\folio=0 
\\turnoffactive%$/
+\doshortpageno tex-src/texinfo.tex     /^\\def\\doshortpageno#1{{\\rm #1}}$/
+\dosubind      tex-src/texinfo.tex     /^\\def\\dosubind #1#2#3{%$/
+\dosubsecentry tex-src/texinfo.tex     /^\\def\\dosubsecentry#1#2{%$/
+\dosubsubsecentry      tex-src/texinfo.tex     
/^\\def\\dosubsubsecentry#1#2{%$/
+\dots  tex-src/texinfo.tex     /^\\def\\dots{$\\ldots$}$/
+\dots  tex-src/texinfo.tex     /^\\def\\dots{\\realbackslash dots }%$/
+\dots  tex-src/texinfo.tex     /^\\def\\dots{\\realbackslash dots}$/
+\doublecolumnout       tex-src/texinfo.tex     
/^\\def\\doublecolumnout{\\splittopskip=\\topskip \\split/
+\emph  tex-src/texinfo.tex     /^\\def\\emph##1{\\realbackslash emph {##1}}$/
+\end   tex-src/texinfo.tex     /^\\def\\end{\\parsearg\\endxxx}$/
+\enddoublecolumns      tex-src/texinfo.tex     
/^\\def\\enddoublecolumns{\\output={\\balancecolumns}\\ej/
+\endxxx        tex-src/texinfo.tex     /^\\def\\endxxx #1{%$/
+\entry tex-src/texinfo.tex     /^\\def\\entry #1#2{\\begingroup$/
+\enumerate     tex-src/texinfo.tex     
/^\\def\\enumerate{\\parsearg\\enumeratezzz}$/
+\enumeratey    tex-src/texinfo.tex     /^\\def\\enumeratey #1 
#2\\endenumeratey{%$/
+\enumeratezzz  tex-src/texinfo.tex     /^\\def\\enumeratezzz #1{\\enumeratey 
#1  \\endenumerate/
+\equiv tex-src/texinfo.tex     /^\\def\\equiv{\\leavevmode\\lower.1ex\\hbox to 
1em{\\hfil/
+\equiv tex-src/texinfo.tex     /^\\def\\equiv{\\realbackslash equiv}$/
+\error tex-src/texinfo.tex     
/^\\def\\error{\\leavevmode\\lower.7ex\\copy\\errorbox}$/
+\errorE        tex-src/texinfo.tex     /^\\def\\errorE#1{$/
+\evenfooting   tex-src/texinfo.tex     
/^\\def\\evenfooting{\\parsearg\\evenfootingxxx}$/
+\evenheading   tex-src/texinfo.tex     
/^\\def\\evenheading{\\parsearg\\evenheadingxxx}$/
+\everyfooting  tex-src/texinfo.tex     
/^\\def\\everyfooting{\\parsearg\\everyfootingxxx}$/
+\everyheading  tex-src/texinfo.tex     
/^\\def\\everyheading{\\parsearg\\everyheadingxxx}$/
+\ewbot tex-src/texinfo.tex     /^\\def\\ewbot{\\vrule height0pt 
depth\\cornerthick widt/
+\ewtop tex-src/texinfo.tex     /^\\def\\ewtop{\\vrule height\\cornerthick 
depth0pt widt/
+\exdent        tex-src/texinfo.tex     /^\\def\\exdent{\\parsearg\\exdentyyy}$/
+\exdentyyy     tex-src/texinfo.tex     /^\\def\\exdentyyy 
#1{{\\hfil\\break\\hbox{\\kern -\\exdent/
+\expansion     tex-src/texinfo.tex     
/^\\def\\expansion{\\leavevmode\\raise.1ex\\hbox to 1em{\\/
+\expansion     tex-src/texinfo.tex     /^\\def\\expansion{\\realbackslash 
expansion}$/
+\file  tex-src/texinfo.tex     /^\\def\\file##1{\\realbackslash file {##1}}$/
+\file  tex-src/texinfo.tex     /^\\def\\file##1{\\realbackslash file {##1}}%$/
+\finalout      tex-src/texinfo.tex     /^\\def\\finalout{\\overfullrule=0pt}$/
+\findex        tex-src/texinfo.tex     /^\\def\\findex {\\fnindex}$/
+\finishtitlepage       tex-src/texinfo.tex     /^\\def\\finishtitlepage{%$/
+\flushcr       tex-src/texinfo.tex     /^\\def\\flushcr{\\ifx\\par\\lisppar 
\\def\\next##1{}\\else /
+\flushleft     tex-src/texinfo.tex     /^\\def\\flushleft{%$/
+\flushright    tex-src/texinfo.tex     /^\\def\\flushright{%$/
+\fnitemindex   tex-src/texinfo.tex     /^\\def\\fnitemindex #1{\\doind 
{fn}{\\code{#1}}}%$/
+\format        tex-src/texinfo.tex     /^\\def\\format{\\begingroup\\inENV 
%This group ends at /
+\frenchspacing tex-src/texinfo.tex     /^\\def\\frenchspacing{\\sfcode46=1000 
\\sfcode63=1000 \\/
+\ftable        tex-src/texinfo.tex     
/^\\def\\ftable{\\begingroup\\inENV\\obeylines\\obeyspaces/
+\gloggingall   tex-src/texinfo.tex     /^\\def\\gloggingall{\\begingroup 
\\globaldefs = 1 \\logg/
+\group tex-src/texinfo.tex     /^\\def\\group{\\begingroup$/
+\gtr   tex-src/texinfo.tex     /^\\def\\gtr{\\realbackslash gtr}$/
+\gtr   tex-src/texinfo.tex     /^\\def\\gtr{\\realbackslash gtr}%$/
+\hat   tex-src/texinfo.tex     /^\\def\\hat{\\realbackslash hat}$/
+\hat   tex-src/texinfo.tex     /^\\def\\hat{\\realbackslash hat}%$/
+\heading       tex-src/texinfo.tex     
/^\\def\\heading{\\parsearg\\secheadingi}$/
+\headings      tex-src/texinfo.tex     /^\\def\\headings #1 {\\csname 
HEADINGS#1\\endcsname}$/
+\i     tex-src/texinfo.tex     /^\\def\\i##1{\\realbackslash i {##1}}$/
+\i     tex-src/texinfo.tex     /^\\def\\i##1{\\realbackslash i {##1}}%$/
+\ifclear       tex-src/texinfo.tex     
/^\\def\\ifclear{\\begingroup\\ignoresections\\parsearg\\i/
+\ifclearfail   tex-src/texinfo.tex     
/^\\def\\ifclearfail{\\begingroup\\ignoresections\\ifclea/
+\ifclearfailxxx        tex-src/texinfo.tex     /^\\long\\def\\ifclearfailxxx 
#1\\end ifclear{\\endgroup\\/
+\ifclearxxx    tex-src/texinfo.tex     /^\\def\\ifclearxxx #1{\\endgroup$/
+\ifinfo        tex-src/texinfo.tex     
/^\\def\\ifinfo{\\begingroup\\ignoresections\\ifinfoxxx}$/
+\ifinfoxxx     tex-src/texinfo.tex     /^\\long\\def\\ifinfoxxx #1\\end 
ifinfo{\\endgroup\\ignore/
+\ifset tex-src/texinfo.tex     
/^\\def\\ifset{\\begingroup\\ignoresections\\parsearg\\ifs/
+\ifsetfail     tex-src/texinfo.tex     
/^\\def\\ifsetfail{\\begingroup\\ignoresections\\ifsetfai/
+\ifsetfailxxx  tex-src/texinfo.tex     /^\\long\\def\\ifsetfailxxx #1\\end 
ifset{\\endgroup\\igno/
+\ifsetxxx      tex-src/texinfo.tex     /^\\def\\ifsetxxx #1{\\endgroup$/
+\iftex tex-src/texinfo.tex     /^\\def\\iftex{}$/
+\ifusingtt     tex-src/texinfo.tex     /^\\def\\ifusingtt#1#2{\\ifdim 
\\fontdimen3\\the\\font=0pt/
+\ignore        tex-src/texinfo.tex     
/^\\def\\ignore{\\begingroup\\ignoresections$/
+\ignoresections        tex-src/texinfo.tex     /^\\def\\ignoresections{%$/
+\ignorexxx     tex-src/texinfo.tex     /^\\long\\def\\ignorexxx #1\\end 
ignore{\\endgroup\\ignore/
+\ii    tex-src/texinfo.tex     /^\\def\\ii#1{{\\it #1}}                % 
italic font$/
+\inENV tex-src/texinfo.tex     /^\\newif\\ifENV \\ENVfalse 
\\def\\inENV{\\ifENV\\relax\\els/
+\include       tex-src/texinfo.tex     
/^\\def\\include{\\parsearg\\includezzz}$/
+\includezzz    tex-src/texinfo.tex     /^\\def\\includezzz 
#1{{\\def\\thisfile{#1}\\input #1$/
+\indexbackslash        tex-src/texinfo.tex     /^  
\\def\\indexbackslash{\\rawbackslashxx}$/
+\indexdotfill  tex-src/texinfo.tex     /^\\def\\indexdotfill{\\cleaders$/
+\indexdummies  tex-src/texinfo.tex     /^\\def\\indexdummies{%$/
+\indexdummydots        tex-src/texinfo.tex     /^\\def\\indexdummydots{...}$/
+\indexdummyfont        tex-src/texinfo.tex     /^\\def\\indexdummyfont#1{#1}$/
+\indexdummytex tex-src/texinfo.tex     /^\\def\\indexdummytex{TeX}$/
+\indexfonts    tex-src/texinfo.tex     /^\\def\\indexfonts{%$/
+\indexnofonts  tex-src/texinfo.tex     /^\\def\\indexnofonts{%$/
+\infoappendix  tex-src/texinfo.tex     
/^\\def\\infoappendix{\\parsearg\\appendixzzz}$/
+\infoappendixsec       tex-src/texinfo.tex     
/^\\def\\infoappendixsec{\\parsearg\\appendixseczzz}$/
+\infoappendixsubsec    tex-src/texinfo.tex     
/^\\def\\infoappendixsubsec{\\parsearg\\appendixsubseczz/
+\infoappendixsubsubsec tex-src/texinfo.tex     
/^\\def\\infoappendixsubsubsec{\\parsearg\\appendixsubsu/
+\infochapter   tex-src/texinfo.tex     
/^\\def\\infochapter{\\parsearg\\chapterzzz}$/
+\inforef       tex-src/texinfo.tex     /^\\def\\inforef #1{\\inforefzzz 
#1,,,,**}$/
+\inforefzzz    tex-src/texinfo.tex     /^\\def\\inforefzzz #1,#2,#3,#4**{See 
Info file \\file{/
+\infosection   tex-src/texinfo.tex     
/^\\def\\infosection{\\parsearg\\sectionzzz}$/
+\infosubsection        tex-src/texinfo.tex     
/^\\def\\infosubsection{\\parsearg\\subsectionzzz}$/
+\infosubsubsection     tex-src/texinfo.tex     
/^\\def\\infosubsubsection{\\parsearg\\subsubsectionzzz}/
+\infotop       tex-src/texinfo.tex     
/^\\def\\infotop{\\parsearg\\unnumberedzzz}$/
+\infounnumbered        tex-src/texinfo.tex     
/^\\def\\infounnumbered{\\parsearg\\unnumberedzzz}$/
+\infounnumberedsec     tex-src/texinfo.tex     
/^\\def\\infounnumberedsec{\\parsearg\\unnumberedseczzz}/
+\infounnumberedsubsec  tex-src/texinfo.tex     
/^\\def\\infounnumberedsubsec{\\parsearg\\unnumberedsubs/
+\infounnumberedsubsubsec       tex-src/texinfo.tex     
/^\\def\\infounnumberedsubsubsec{\\parsearg\\unnumbereds/
+\initial       tex-src/texinfo.tex     /^\\def\\initial #1{%$/
+\internalBitem tex-src/texinfo.tex     /^\\def\\internalBitem{\\smallbreak 
\\parsearg\\itemzzz}$/
+\internalBitemx        tex-src/texinfo.tex     /^\\def\\internalBitemx{\\par 
\\parsearg\\itemzzz}$/
+\internalBkitem        tex-src/texinfo.tex     
/^\\def\\internalBkitem{\\smallbreak \\parsearg\\kitemzzz/
+\internalBkitemx       tex-src/texinfo.tex     /^\\def\\internalBkitemx{\\par 
\\parsearg\\kitemzzz}$/
+\internalBxitem        tex-src/texinfo.tex     /^\\def\\internalBxitem 
"#1"{\\def\\xitemsubtopix{#1} \\s/
+\internalBxitemx       tex-src/texinfo.tex     /^\\def\\internalBxitemx 
"#1"{\\def\\xitemsubtopix{#1} \\/
+\internalsetq  tex-src/texinfo.tex     /^\\def\\internalsetq #1#2{'xrdef 
{#1}{\\csname #2\\endc/
+\item  tex-src/texinfo.tex     /^\\def\\item{\\errmessage{@item while not in a 
table}}/
+\itemcontents  tex-src/texinfo.tex     /^\\def\\itemcontents{#1}%$/
+\itemfont      tex-src/texinfo.tex     /^\\def\\itemfont{#2}%$/
+\itemize       tex-src/texinfo.tex     
/^\\def\\itemize{\\parsearg\\itemizezzz}$/
+\itemizeitem   tex-src/texinfo.tex     /^\\def\\itemizeitem{%$/
+\itemizey      tex-src/texinfo.tex     /^\\def\\itemizey #1#2{%$/
+\itemizezzz    tex-src/texinfo.tex     /^\\def\\itemizezzz #1{%$/
+\itemx tex-src/texinfo.tex     /^\\def\\itemx{\\errmessage{@itemx while not in 
a table/
+\itemzzz       tex-src/texinfo.tex     /^\\def\\itemzzz #1{\\begingroup %$/
+\kbd   tex-src/texinfo.tex     /^\\def\\kbd##1{\\realbackslash kbd {##1}}$/
+\kbd   tex-src/texinfo.tex     /^\\def\\kbd##1{\\realbackslash kbd {##1}}%$/
+\kbd   tex-src/texinfo.tex     
/^\\def\\kbd#1{\\def\\look{#1}\\expandafter\\kbdfoo\\look??/
+\kbdfoo        tex-src/texinfo.tex     
/^\\def\\kbdfoo#1#2#3\\par{\\def\\one{#1}\\def\\three{#3}\\d/
+\key   tex-src/texinfo.tex     /^\\def\\key #1{{\\tt 
\\exhyphenpenalty=10000\\uppercase{/
+\key   tex-src/texinfo.tex     /^\\def\\key##1{\\realbackslash key {##1}}$/
+\key   tex-src/texinfo.tex     /^\\def\\key##1{\\realbackslash key {##1}}%$/
+\kindex        tex-src/texinfo.tex     /^\\def\\kindex {\\kyindex}$/
+\kitem tex-src/texinfo.tex     /^\\def\\kitem{\\errmessage{@kitem while not in 
a table/
+\kitemx        tex-src/texinfo.tex     /^\\def\\kitemx{\\errmessage{@kitemx 
while not in a tab/
+\kitemzzz      tex-src/texinfo.tex     /^\\def\\kitemzzz #1{\\dosubind 
{kw}{\\code{#1}}{for {\\b/
+\l     tex-src/texinfo.tex     /^\\def\\l#1{{\\li #1}\\null}           % $/
+\labelspace    tex-src/texinfo.tex     /^\\def\\labelspace{\\hskip1em 
\\relax}$/
+\lbrb  tex-src/texinfo.tex     /^\\def\\lbrb{{\\bf\\char`\\[}} 
\\def\\rbrb{{\\bf\\char`\\]}}$/
+\less  tex-src/texinfo.tex     /^\\def\\less{\\realbackslash less}$/
+\less  tex-src/texinfo.tex     /^\\def\\less{\\realbackslash less}%$/
+\linenumber    tex-src/texinfo.tex     /^  
\\def\\linenumber{\\the\\inputlineno:\\space}$/
+\lisp  tex-src/texinfo.tex     /^\\def\\lisp{\\aboveenvbreak$/
+\loggingall    tex-src/texinfo.tex     /^\\def\\loggingall{\\tracingcommands2 
\\tracingstats2 $/
+\losespace     tex-src/texinfo.tex     /^\\def\\losespace #1{#1}$/
+\lowercaseenumerate    tex-src/texinfo.tex     /^\\def\\lowercaseenumerate{%$/
+\lvvmode       tex-src/texinfo.tex     /^\\def\\lvvmode{\\vbox to 0pt{}}$/
+\majorheading  tex-src/texinfo.tex     
/^\\def\\majorheading{\\parsearg\\majorheadingzzz}$/
+\majorheadingzzz       tex-src/texinfo.tex     /^\\def\\majorheadingzzz #1{%$/
+\math  tex-src/texinfo.tex     /^\\def\\math#1{\\implicitmath 
#1\\implicitmath}$/
+\menu  tex-src/texinfo.tex     /^\\long\\def\\menu #1\\end menu{}$/
+\minus tex-src/texinfo.tex     /^\\def\\minus{$-$}$/
+\mylbrace      tex-src/texinfo.tex     /^\\def\\mylbrace {{\\tt \\char '173}}$/
+\myrbrace      tex-src/texinfo.tex     /^\\def\\myrbrace {{\\tt \\char '175}}$/
+\need  tex-src/texinfo.tex     /^\\def\\need{\\parsearg\\needx}$/
+\needx tex-src/texinfo.tex     /^\\def\\needx#1{%$/
+\newcodeindex  tex-src/texinfo.tex     /^\\def\\newcodeindex #1{$/
+\newindex      tex-src/texinfo.tex     /^\\def\\newindex #1{$/
+\next  tex-src/texinfo.tex     /^\\def\\next##1{}\\next}$/
+\nm    tex-src/testenv.tex     
/^\\newcommand{\\nm}[2]{\\nomenclature{#1}{#2}}$/
+\node  tex-src/texinfo.tex     /^\\def\\node{\\ENVcheck\\parsearg\\nodezzz}$/
+\nodexxx[      tex-src/texinfo.tex     
/^\\def\\nodexxx[#1,#2]{\\gdef\\lastnode{#1}}$/
+\nodezzz       tex-src/texinfo.tex     /^\\def\\nodezzz#1{\\nodexxx [#1,]}$/
+\nofillexdent  tex-src/texinfo.tex     
/^\\def\\nofillexdent{\\parsearg\\nofillexdentyyy}$/
+\nofillexdentyyy       tex-src/texinfo.tex     /^\\def\\nofillexdentyyy 
#1{{\\advance \\leftskip by -\\e/
+\normalbackslash       tex-src/texinfo.tex     
/^\\def\\normalbackslash{{\\tt\\rawbackslashxx}}$/
+\normalcaret   tex-src/texinfo.tex     /^\\def\\normalcaret{^}$/
+\normaldoublequote     tex-src/texinfo.tex     /^\\def\\normaldoublequote{"}$/
+\normalgreater tex-src/texinfo.tex     /^\\def\\normalgreater{>}$/
+\normalless    tex-src/texinfo.tex     /^\\def\\normalless{<}$/
+\normalplus    tex-src/texinfo.tex     /^\\def\\normalplus{+}$/
+\normaltilde   tex-src/texinfo.tex     /^\\def\\normaltilde{~}$/
+\normalunderscore      tex-src/texinfo.tex     /^\\def\\normalunderscore{_}$/
+\normalverticalbar     tex-src/texinfo.tex     /^\\def\\normalverticalbar{|}$/
+\nsbot tex-src/texinfo.tex     /^\\def\\nsbot{\\vbox$/
+\nstop tex-src/texinfo.tex     /^\\def\\nstop{\\vbox$/
+\numberedsec   tex-src/texinfo.tex     
/^\\outer\\def\\numberedsec{\\parsearg\\seczzz}$/
+\numberedsubsec        tex-src/texinfo.tex     
/^\\outer\\def\\numberedsubsec{\\parsearg\\numberedsubsec/
+\numberedsubseczzz     tex-src/texinfo.tex     /^\\def\\numberedsubseczzz 
#1{\\seccheck{subsection}%$/
+\numberedsubsubsec     tex-src/texinfo.tex     
/^\\outer\\def\\numberedsubsubsec{\\parsearg\\numberedsub/
+\numberedsubsubseczzz  tex-src/texinfo.tex     /^\\def\\numberedsubsubseczzz 
#1{\\seccheck{subsubsecti/
+\numericenumerate      tex-src/texinfo.tex     /^\\def\\numericenumerate{%$/
+\oddfooting    tex-src/texinfo.tex     
/^\\def\\oddfooting{\\parsearg\\oddfootingxxx}$/
+\oddheading    tex-src/texinfo.tex     
/^\\def\\oddheading{\\parsearg\\oddheadingxxx}$/
+\onepageout    tex-src/texinfo.tex     
/^\\def\\onepageout#1{\\hoffset=\\normaloffset$/
+\opencontents  tex-src/texinfo.tex     /^\\def\\opencontents{\\openout 
\\contentsfile = \\jobnam/
+\openindices   tex-src/texinfo.tex     /^\\def\\openindices{%$/
+\opnr  tex-src/texinfo.tex     /^\\def\\opnr{{\\sf\\char`\\(}} 
\\def\\clnr{{\\sf\\char`\\)}} /
+\page  tex-src/texinfo.tex     /^   \\def\\page{%$/
+\page  tex-src/texinfo.tex     /^\\def\\page{\\par\\vfill\\supereject}$/
+\pagebody      tex-src/texinfo.tex     /^\\def\\pagebody#1{\\vbox 
to\\pageheight{\\boxmaxdepth=\\/
+\pagesofar     tex-src/texinfo.tex     
/^\\def\\pagesofar{\\unvbox\\partialpage %$/
+\parsearg      tex-src/texinfo.tex     /^\\def\\parsearg 
#1{\\let\\next=#1\\begingroup\\obeylines/
+\parseargline  tex-src/texinfo.tex     /^\\def\\parseargline{\\begingroup 
\\obeylines \\parsearg/
+\parseargx     tex-src/texinfo.tex     /^\\def\\parseargx{%$/
+\pindex        tex-src/texinfo.tex     /^\\def\\pindex {\\pgindex}$/
+\plainsecheading       tex-src/texinfo.tex     /^\\def\\plainsecheading 
#1{\\secheadingi {#1}}$/
+\point tex-src/texinfo.tex     /^\\def\\point{$\\star$}$/
+\primary       tex-src/texinfo.tex     /^\\def\\primary #1{\\line{#1\\hfil}}$/
+\print tex-src/texinfo.tex     /^\\def\\print{\\leavevmode\\lower.1ex\\hbox to 
1em{\\hfil/
+\print tex-src/texinfo.tex     /^\\def\\print{\\realbackslash print}$/
+\printedmanual tex-src/texinfo.tex     /^\\def\\printedmanual{\\ignorespaces 
#5}%$/
+\printedmanual tex-src/texinfo.tex     /^section ``\\printednodename'' in 
\\cite{\\printedmanu/
+\printednodename       tex-src/texinfo.tex     
/^\\def\\printednodename{\\ignorespaces #1}%$/
+\printednodename       tex-src/texinfo.tex     
/^\\def\\printednodename{\\ignorespaces #3}%$/
+\printindex    tex-src/texinfo.tex     
/^\\def\\printindex{\\parsearg\\doprintindex}$/
+\pxref tex-src/texinfo.tex     /^\\def\\pxref#1{see \\xrefX[#1,,,,,,,]}$/
+\quotation     tex-src/texinfo.tex     /^\\def\\quotation{%$/
+\r     tex-src/texinfo.tex     /^\\def\\r##1{\\realbackslash r {##1}}$/
+\r     tex-src/texinfo.tex     /^\\def\\r##1{\\realbackslash r {##1}}%$/
+\r     tex-src/texinfo.tex     /^\\def\\r#1{{\\rm #1}}         % roman font$/
+\rawbackslashxx        tex-src/texinfo.tex     
/^\\def\\rawbackslashxx{\\indexbackslash}% \\indexbacksl/
+\rawbackslashxx        tex-src/texinfo.tex     
/^\\def\\rawbackslashxx{\\indexbackslash}%$/
+\readauxfile   tex-src/texinfo.tex     /^\\def\\readauxfile{%$/
+\ref   tex-src/texinfo.tex     /^\\def\\ref#1{\\xrefX[#1,,,,,,,]}$/
+\refx  tex-src/texinfo.tex     /^\\def\\refx#1#2{%$/
+\resetmathfonts        tex-src/texinfo.tex     /^\\def\\resetmathfonts{%$/
+\result        tex-src/texinfo.tex     
/^\\def\\result{\\leavevmode\\raise.15ex\\hbox to 1em{\\hf/
+\result        tex-src/texinfo.tex     /^\\def\\result{\\realbackslash 
result}$/
+\rm    tex-src/texinfo.tex     /^\\def\\rm{\\realbackslash rm }%$/
+\samp  tex-src/texinfo.tex     /^\\def\\samp #1{`\\tclose{#1}'\\null}$/
+\samp  tex-src/texinfo.tex     /^\\def\\samp##1{\\realbackslash samp {##1}}$/
+\samp  tex-src/texinfo.tex     /^\\def\\samp##1{\\realbackslash samp {##1}}%$/
+\sc    tex-src/texinfo.tex     /^\\def\\sc#1{{\\smallcaps#1}}  % smallcaps 
font$/
+\seccheck      tex-src/texinfo.tex     /^\\def\\seccheck#1{\\if \\pageno<0 %$/
+\secentry      tex-src/texinfo.tex     /^      \\def\\secentry ##1##2##3##4{}$/
+\secentry      tex-src/texinfo.tex     
/^\\def\\secentry#1#2#3#4{\\dosecentry{#2.#3\\labelspace/
+\secentryfonts tex-src/texinfo.tex     /^\\def\\secentryfonts{\\textfonts}$/
+\secfonts      tex-src/texinfo.tex     /^\\def\\secfonts{%$/
+\secheading    tex-src/texinfo.tex     /^\\def\\secheading 
#1#2#3{\\secheadingi {#2.#3\\enspace/
+\secheadingbreak       tex-src/texinfo.tex     
/^\\def\\secheadingbreak{\\dobreak \\secheadingskip {-10/
+\secheadingi   tex-src/texinfo.tex     /^\\def\\secheadingi #1{{\\advance 
\\secheadingskip by \\/
+\secondary     tex-src/texinfo.tex     /^\\def\\secondary #1#2{$/
+\seczzz        tex-src/texinfo.tex     /^\\def\\seczzz 
#1{\\seccheck{section}%$/
+\set   tex-src/texinfo.tex     /^\\def\\set{\\parsearg\\setxxx}$/
+\setchapternewpage     tex-src/texinfo.tex     /^\\def\\setchapternewpage #1 
{\\csname CHAPPAG#1\\endcs/
+\setchapterstyle       tex-src/texinfo.tex     /^\\def\\setchapterstyle #1 
{\\csname CHAPF#1\\endcsname/
+\setdeffont    tex-src/texinfo.tex     /^\\def\\setdeffont #1 {\\csname 
DEF#1\\endcsname}$/
+\setfilename   tex-src/texinfo.tex     /^\\def\\setfilename{%$/
+\setref        tex-src/texinfo.tex     /^\\def\\setref#1{%$/
+\settitle      tex-src/texinfo.tex     
/^\\def\\settitle{\\parsearg\\settitlezzz}$/
+\settitlezzz   tex-src/texinfo.tex     /^\\def\\settitlezzz 
#1{\\gdef\\thistitle{#1}}$/
+\setxxx        tex-src/texinfo.tex     /^\\def\\setxxx #1{$/
+\sf    tex-src/texinfo.tex     /^\\def\\sf{\\fam=\\sffam \\tensf}$/
+\sf    tex-src/texinfo.tex     /^\\def\\sf{\\realbackslash sf}%$/
+\shortchapentry        tex-src/texinfo.tex     
/^\\def\\shortchapentry#1#2#3{%$/
+\shortunnumberedentry  tex-src/texinfo.tex     
/^\\def\\shortunnumberedentry#1#2{%$/
+\singlecodeindexer     tex-src/texinfo.tex     /^\\def\\singlecodeindexer 
#1{\\doind{\\indexname}{\\code/
+\singleindexer tex-src/texinfo.tex     /^\\def\\singleindexer 
#1{\\doind{\\indexname}{#1}}$/
+\singlespace   tex-src/texinfo.tex     /^\\def\\singlespace{%$/
+\sl    tex-src/texinfo.tex     /^\\def\\sl{\\realbackslash sl }%$/
+\smallbook     tex-src/texinfo.tex     /^\\def\\smallbook{$/
+\smalllispx    tex-src/texinfo.tex     
/^\\def\\smalllispx{\\aboveenvbreak\\begingroup\\inENV$/
+\smartitalic   tex-src/texinfo.tex     /^\\def\\smartitalic#1{{\\sl 
#1}\\futurelet\\next\\smartit/
+\smartitalicx  tex-src/texinfo.tex     
/^\\def\\smartitalicx{\\ifx\\next,\\else\\ifx\\next-\\else\\i/
+\sp    tex-src/texinfo.tex     /^\\def\\sp{\\parsearg\\spxxx}$/
+\splitoff      tex-src/texinfo.tex     
/^\\def\\splitoff#1#2\\endmark{\\def\\first{#1}\\def\\rest{/
+\spxxx tex-src/texinfo.tex     /^\\def\\spxxx #1{\\par \\vskip 
#1\\baselineskip}$/
+\startcontents tex-src/texinfo.tex     /^\\def\\startcontents#1{%$/
+\startenumeration      tex-src/texinfo.tex     /^\\def\\startenumeration#1{%$/
+\subheading    tex-src/texinfo.tex     
/^\\def\\subheading{\\parsearg\\subsecheadingi}$/
+\subsecentry   tex-src/texinfo.tex     /^      \\def\\subsecentry 
##1##2##3##4##5{}$/
+\subsecentry   tex-src/texinfo.tex     
/^\\def\\subsecentry#1#2#3#4#5{\\dosubsecentry{#2.#3.#4/
+\subsecfonts   tex-src/texinfo.tex     /^\\def\\subsecfonts{%$/
+\subsecheading tex-src/texinfo.tex     /^\\def\\subsecheading 
#1#2#3#4{\\subsecheadingi {#2.#3/
+\subsecheadingbreak    tex-src/texinfo.tex     
/^\\def\\subsecheadingbreak{\\dobreak \\subsecheadingski/
+\subsecheadingi        tex-src/texinfo.tex     /^\\def\\subsecheadingi 
#1{{\\advance \\subsecheadingski/
+\subsubheading tex-src/texinfo.tex     
/^\\def\\subsubheading{\\parsearg\\subsubsecheadingi}$/
+\subsubsecentry        tex-src/texinfo.tex     /^      \\def\\subsubsecentry 
##1##2##3##4##5##6{}$/
+\subsubsecentry        tex-src/texinfo.tex     
/^\\def\\subsubsecentry#1#2#3#4#5#6{%$/
+\subsubsecfonts        tex-src/texinfo.tex     
/^\\def\\subsubsecfonts{\\subsecfonts} % Maybe this sho/
+\subsubsecheading      tex-src/texinfo.tex     /^\\def\\subsubsecheading 
#1#2#3#4#5{\\subsubsecheading/
+\subsubsecheadingi     tex-src/texinfo.tex     /^\\def\\subsubsecheadingi 
#1{{\\advance \\subsecheading/
+\subtitle      tex-src/texinfo.tex     /^   
\\def\\subtitle{\\parsearg\\subtitlezzz}%$/
+\subtitlefont  tex-src/texinfo.tex     /^   \\def\\subtitlefont{\\subtitlerm 
\\normalbaselinesk/
+\subtitlezzz   tex-src/texinfo.tex     /^   
\\def\\subtitlezzz##1{{\\subtitlefont \\rightline{#/
+\summarycontents       tex-src/texinfo.tex     
/^\\outer\\def\\summarycontents{%$/
+\supereject    tex-src/texinfo.tex     /^\\def\\supereject{\\par\\penalty 
-20000\\footnoteno =0 /
+\syncodeindex  tex-src/texinfo.tex     /^\\def\\syncodeindex #1 #2 {%$/
+\synindex      tex-src/texinfo.tex     /^\\def\\synindex #1 #2 {%$/
+\t     tex-src/texinfo.tex     /^\\def\\t##1{\\realbackslash r {##1}}%$/
+\t     tex-src/texinfo.tex     /^\\def\\t#1{{\\tt 
\\exhyphenpenalty=10000\\rawbackslash /
+\table tex-src/texinfo.tex     
/^\\def\\table{\\begingroup\\inENV\\obeylines\\obeyspaces\\/
+\tablez        tex-src/texinfo.tex     /^\\def\\tablez #1#2#3#4#5#6{%$/
+\tclose        tex-src/texinfo.tex     /^\\def\\tclose##1{\\realbackslash 
tclose {##1}}$/
+\tclose        tex-src/texinfo.tex     /^\\def\\tclose##1{\\realbackslash 
tclose {##1}}%$/
+\tclose        tex-src/texinfo.tex     /^\\def\\tclose#1{{\\rm 
\\tcloserm=\\fontdimen2\\font \\tt /
+\tex   tex-src/texinfo.tex     /^\\def\\tex{\\begingroup$/
+\texinfoversion        tex-src/texinfo.tex     /^\\def\\texinfoversion{2.73}$/
+\textfonts     tex-src/texinfo.tex     /^\\def\\textfonts{%$/
+\thearg        tex-src/texinfo.tex     /^  \\def\\thearg{#1}%$/
+\thearg        tex-src/texinfo.tex     /^  \\ifx\\thearg\\empty 
\\def\\thearg{1}\\fi$/
+\thischapter   tex-src/texinfo.tex     /^   
\\unnumbchapmacro{#1}\\def\\thischapter{}%$/
+\thischapter   tex-src/texinfo.tex     /^\\def\\thischapter{} 
\\def\\thissection{}$/
+\thischaptername       tex-src/texinfo.tex     /^\\def\\thischaptername{No 
Chapter Title}$/
+\thisfile      tex-src/texinfo.tex     /^\\def\\thisfile{}$/
+\thistitle     tex-src/texinfo.tex     /^\\def\\thistitle{No Title}$/
+\tie   tex-src/texinfo.tex     /^\\def\\tie{\\penalty 10000\\ }     % Save 
plain tex de/
+\tindex        tex-src/texinfo.tex     /^\\def\\tindex {\\tpindex}$/
+\title tex-src/texinfo.tex     /^   \\def\\title{\\parsearg\\titlezzz}%$/
+\titlefont     tex-src/texinfo.tex     /^\\def\\titlefont#1{{\\titlerm #1}}$/
+\titlepage     tex-src/texinfo.tex     /^\\def\\titlepage{\\begingroup 
\\parindent=0pt \\textfon/
+\titlezzz      tex-src/texinfo.tex     /^   
\\def\\titlezzz##1{\\leftline{\\titlefont{##1}}$/
+\today tex-src/texinfo.tex     /^\\def\\today{\\number\\day\\space$/
+\top   tex-src/texinfo.tex     /^\\outer\\def\\top{\\parsearg\\unnumberedzzz}$/
+\tt    tex-src/texinfo.tex     /^\\def\\tt{\\realbackslash tt}$/
+\tt    tex-src/texinfo.tex     /^\\def\\tt{\\realbackslash tt}%$/
+\turnoffactive tex-src/texinfo.tex     
/^\\def\\turnoffactive{\\let"=\\normaldoublequote$/
+\unnchfopen    tex-src/texinfo.tex     /^\\def\\unnchfopen #1{%$/
+\unnchfplain   tex-src/texinfo.tex     /^\\def\\unnchfplain #1{%$/
+\unnumbchapentry       tex-src/texinfo.tex     
/^\\def\\unnumbchapentry#1#2{\\dochapentry{#1}{#2}}$/
+\unnumbered    tex-src/texinfo.tex     
/^\\outer\\def\\unnumbered{\\parsearg\\unnumberedzzz}$/
+\unnumberedsec tex-src/texinfo.tex     
/^\\outer\\def\\unnumberedsec{\\parsearg\\unnumberedseczz/
+\unnumberedseczzz      tex-src/texinfo.tex     /^\\def\\unnumberedseczzz 
#1{\\seccheck{unnumberedsec}%/
+\unnumberedsubsec      tex-src/texinfo.tex     
/^\\outer\\def\\unnumberedsubsec{\\parsearg\\unnumberedsu/
+\unnumberedsubseczzz   tex-src/texinfo.tex     /^\\def\\unnumberedsubseczzz 
#1{\\seccheck{unnumberedsu/
+\unnumberedsubsubsec   tex-src/texinfo.tex     
/^\\outer\\def\\unnumberedsubsubsec{\\parsearg\\unnumbere/
+\unnumberedsubsubseczzz        tex-src/texinfo.tex     
/^\\def\\unnumberedsubsubseczzz #1{\\seccheck{unnumbere/
+\unnumberedzzz tex-src/texinfo.tex     /^\\def\\unnumberedzzz 
#1{\\seccheck{unnumbered}%$/
+\unnumbnoderef tex-src/texinfo.tex     
/^\\def\\unnumbnoderef{\\ifx\\lastnode\\relax\\else$/
+\unnumbsecentry        tex-src/texinfo.tex     /^      \\def\\unnumbsecentry 
##1##2{}$/
+\unnumbsecentry        tex-src/texinfo.tex     
/^\\def\\unnumbsecentry#1#2{\\dosecentry{#1}{#2}}$/
+\unnumbsetref  tex-src/texinfo.tex     /^\\def\\unnumbsetref#1{%$/
+\unnumbsubsecentry     tex-src/texinfo.tex     /^      
\\def\\unnumbsubsecentry ##1##2{}$/
+\unnumbsubsecentry     tex-src/texinfo.tex     
/^\\def\\unnumbsubsecentry#1#2{\\dosubsecentry{#1}{#2}}/
+\unnumbsubsubsecentry  tex-src/texinfo.tex     /^      
\\def\\unnumbsubsubsecentry ##1##2{}$/
+\unnumbsubsubsecentry  tex-src/texinfo.tex     
/^\\def\\unnumbsubsubsecentry#1#2{\\dosubsubsecentry{#1/
+\uppercaseenumerate    tex-src/texinfo.tex     /^\\def\\uppercaseenumerate{%$/
+\var   tex-src/texinfo.tex     /^\\def\\var##1{\\realbackslash var {##1}}$/
+\var   tex-src/texinfo.tex     /^\\def\\var##1{\\realbackslash var {##1}}%$/
+\vindex        tex-src/texinfo.tex     /^\\def\\vindex {\\vrindex}$/
+\vritemindex   tex-src/texinfo.tex     /^\\def\\vritemindex #1{\\doind 
{vr}{\\code{#1}}}%$/
+\vtable        tex-src/texinfo.tex     
/^\\def\\vtable{\\begingroup\\inENV\\obeylines\\obeyspaces/
+\w     tex-src/texinfo.tex     /^\\def\\w#1{\\leavevmode\\hbox{#1}}$/
+\w     tex-src/texinfo.tex     /^\\def\\w{\\realbackslash w }%$/
+\w     tex-src/texinfo.tex     /^\\def\\w{\\realbackslash w}$/
+\xitem tex-src/texinfo.tex     /^\\def\\xitem{\\errmessage{@xitem while not in 
a table/
+\xitemx        tex-src/texinfo.tex     /^\\def\\xitemx{\\errmessage{@xitemx 
while not in a tab/
+\xitemzzz      tex-src/texinfo.tex     /^\\def\\xitemzzz #1{\\dosubind 
{kw}{\\code{#1}}{for {\\b/
+\xkey  tex-src/texinfo.tex     /^\\def\\xkey{\\key}$/
+\xrdef tex-src/texinfo.tex     /^\\def\\xrdef #1#2{$/
+\xref  tex-src/texinfo.tex     /^\\def\\xref#1{See \\xrefX[#1,,,,,,,]}$/
+\xrefX[        tex-src/texinfo.tex     
/^\\def\\xrefX[#1,#2,#3,#4,#5,#6]{\\begingroup%$/
+^      tex-src/texinfo.tex     /^\\def^{{\\tt \\hat}}$/
+_      tex-src/texinfo.tex     /^\\def_{\\ifusingtt\\normalunderscore\\_}$/
+_GETOPT_H      c-src/getopt.h  19
+_GNU_SOURCE    c-src/etags.c   94
+_REGEX_H       c-src/emacs/src/regex.h 21
+_RE_SYNTAX_POSIX_COMMON        c-src/emacs/src/regex.h 221
+_Restrict_     c-src/emacs/src/regex.h 540
+_Restrict_     c-src/emacs/src/regex.h 542
+_Restrict_     c-src/emacs/src/regex.h 544
+_Restrict_arr_ c-src/emacs/src/regex.h 555
+_Restrict_arr_ c-src/emacs/src/regex.h 557
+_UCHAR_T       c-src/emacs/src/lisp.h  2423
+__COLORS       cp-src/screen.hpp       9
+__default_morecore     c-src/emacs/src/gmalloc.c       /^__default_morecore 
(ptrdiff_t increment)$/
+__init__       pyt-src/server.py       /^    def __init__(self):$/
+__init__       pyt-src/server.py       /^    def __init__(self, Master, text, 
textvar, widt/
+__init__       pyt-src/server.py       /^    def __init__(self, host, 
sitelist, master=None/
+__init__       pyt-src/server.py       /^    def __init__(self, master=None):$/
+__init__       pyt-src/server.py       /^    def __init__(self, newlegend, 
list, editor, ma/
+__init__       pyt-src/server.py       /^    def __init__(self, user, 
userlist, master=None/
+__ip   c.c     159
+__libc_atexit  c-src/exit.c    30
+__libc_atexit  c-src/exit.strange_suffix       30
+__malloc_extra_blocks  c-src/emacs/src/gmalloc.c       381
+__malloc_initialize    c-src/emacs/src/gmalloc.c       /^__malloc_initialize 
(void)$/
+__malloc_initialized   c-src/emacs/src/gmalloc.c       379
+__repr__       pyt-src/server.py       /^    def __repr__(self):$/
+__sbrk c-src/emacs/src/gmalloc.c       1513
+__str__        pyt-src/server.py       /^    def __str__(self):$/
+__up   c.c     160
+_aligned_blocks        c-src/emacs/src/gmalloc.c       1004
+_aligned_blocks_mutex  c-src/emacs/src/gmalloc.c       518
+_bar?  ruby-src/test1.ru       /^    def self._bar?(abc)$/
+_bytes_free    c-src/emacs/src/gmalloc.c       376
+_bytes_used    c-src/emacs/src/gmalloc.c       374
+_chunks_free   c-src/emacs/src/gmalloc.c       375
+_chunks_used   c-src/emacs/src/gmalloc.c       373
+_fraghead      c-src/emacs/src/gmalloc.c       370
+_free  c-src/emacs/src/gmalloc.c       /^_free (void *ptr)$/
+_free_internal c-src/emacs/src/gmalloc.c       /^_free_internal (void *ptr)$/
+_free_internal_nolock  c-src/emacs/src/gmalloc.c       /^_free_internal_nolock 
(void *ptr)$/
+_heapbase      c-src/emacs/src/gmalloc.c       355
+_heapindex     c-src/emacs/src/gmalloc.c       364
+_heapinfo      c-src/emacs/src/gmalloc.c       358
+_heaplimit     c-src/emacs/src/gmalloc.c       367
+_malloc        c-src/emacs/src/gmalloc.c       /^_malloc (size_t size)$/
+_malloc_internal       c-src/emacs/src/gmalloc.c       /^_malloc_internal 
(size_t size)$/
+_malloc_internal_nolock        c-src/emacs/src/gmalloc.c       
/^_malloc_internal_nolock (size_t size)$/
+_malloc_mutex  c-src/emacs/src/gmalloc.c       517
+_malloc_thread_enabled_p       c-src/emacs/src/gmalloc.c       519
+_realloc       c-src/emacs/src/gmalloc.c       /^_realloc (void *ptr, size_t 
size)$/
+_realloc_internal      c-src/emacs/src/gmalloc.c       /^_realloc_internal 
(void *ptr, size_t size)$/
+_realloc_internal_nolock       c-src/emacs/src/gmalloc.c       
/^_realloc_internal_nolock (void *ptr, size_t size)$/
+`      ruby-src/test.rb        /^        def `(command)$/
+a      c-src/h.h       103
+a      c-src/h.h       40
+a      c.c     /^a ()$/
+a      c.c     /^a()$/
+a      c.c     152
+a      c.c     180
+a      cp-src/c.C      132
+a      ruby-src/test1.ru       /^ def a()$/
+a-forth-constant!      forth-src/test-forth.fth        /^99 constant 
a-forth-constant!$/
+a-forth-value? forth-src/test-forth.fth        /^55 value a-forth-value?$/
+a-forth-word   forth-src/test-forth.fth        /^: a-forth-word ( a b c -- )$/
+a-forth-word   forth-src/test-forth.fth        /^: a-forth-word ( a b c -- 
a*b+c )  + * ;$/
+a0     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a0) (void);$/
+a1     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a1) (Lisp_Object);$/
+a2     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a2) (Lisp_Object, 
Lisp_Object)/
+a3     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a3) (Lisp_Object, 
Lisp_Object,/
+a4     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a4) (Lisp_Object, 
Lisp_Object,/
+a5     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a5) (Lisp_Object, 
Lisp_Object,/
+a6     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a6) (Lisp_Object, 
Lisp_Object,/
+a7     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a7) (Lisp_Object, 
Lisp_Object,/
+a8     c-src/emacs/src/lisp.h  /^      Lisp_Object (*a8) (Lisp_Object, 
Lisp_Object,/
+aMANY  c-src/emacs/src/lisp.h  /^      Lisp_Object (*aMANY) (ptrdiff_t, 
Lisp_Object/
+aUNEVALLED     c-src/emacs/src/lisp.h  /^      Lisp_Object (*aUNEVALLED) 
(Lisp_Object args)/
+aa     c.c     269
+aa     c.c     279
+aaa    c.c     249
+aaa    c.c     269
+aaaaaa c-src/h.h       111
+abbrev-expansion       c-src/abbrev.c  /^DEFUN ("abbrev-expansion", 
Fabbrev_expansion, Sabb/
+abbrev-symbol  c-src/abbrev.c  /^DEFUN ("abbrev-symbol", Fabbrev_symbol, 
Sabbrev_sy/
+abbrev_all_caps        c-src/abbrev.c  58
+abbrevs_changed        c-src/abbrev.c  56
+abc    c-src/h.h       33
+abc    c-src/h.h       37
+abort-recursive-edit   c-src/emacs/src/keyboard.c      /^DEFUN 
("abort-recursive-edit", Fabort_recursive_ed/
+abs/f  ada-src/etags-test-for.ada      /^   function "abs"   (Right : Complex) 
return Real'/
+absolute_dirname       c-src/etags.c   /^absolute_dirname (char *file, char 
*dir)$/
+absolute_filename      c-src/etags.c   /^absolute_filename (char *file, char 
*dir)$/
+abt    cp-src/c.C      55
+acc_pred_info  merc-src/accumulator.m  /^:- pred 
acc_pred_info(list(mer_type)::in, list(pro/
+acc_proc_info  merc-src/accumulator.m  /^:- pred 
acc_proc_info(list(prog_var)::in, prog_var/
+acc_unification        merc-src/accumulator.m  /^:- pred 
acc_unification(pair(prog_var)::in, hlds_g/
+acc_var_subst_init     merc-src/accumulator.m  /^:- pred 
acc_var_subst_init(list(prog_var)::in,$/
+accent_key_syms        c-src/emacs/src/keyboard.c      4625
+access_keymap_keyremap c-src/emacs/src/keyboard.c      
/^access_keymap_keyremap (Lisp_Object map, Lisp_Obje/
+accu_assoc     merc-src/accumulator.m  /^:- pred accu_assoc(module_info::in, 
vartypes::in, /
+accu_assoc     merc-src/accumulator.m  /^:- type accu_assoc$/
+accu_base      merc-src/accumulator.m  /^:- type accu_base$/
+accu_before    merc-src/accumulator.m  /^:- pred accu_before(module_info::in, 
vartypes::in,/
+accu_case      merc-src/accumulator.m  /^:- type accu_case$/
+accu_construct merc-src/accumulator.m  /^:- pred 
accu_construct(module_info::in, vartypes::/
+accu_construct_assoc   merc-src/accumulator.m  /^:- pred 
accu_construct_assoc(module_info::in, vart/
+accu_create_goal       merc-src/accumulator.m  /^:- pred 
accu_create_goal(accu_goal_id::in, list(pr/
+accu_divide_base_case  merc-src/accumulator.m  /^:- pred 
accu_divide_base_case(module_info::in, var/
+accu_goal_id   merc-src/accumulator.m  /^:- type accu_goal_id$/
+accu_goal_list merc-src/accumulator.m  /^:- func 
accu_goal_list(list(accu_goal_id), accu_go/
+accu_goal_store        merc-src/accumulator.m  /^:- type accu_goal_store == 
goal_store(accu_goal_id/
+accu_has_heuristic     merc-src/accumulator.m  /^:- pred 
accu_has_heuristic(module_name::in, string/
+accu_heuristic merc-src/accumulator.m  /^:- pred 
accu_heuristic(module_name::in, string::in/
+accu_is_associative    merc-src/accumulator.m  /^:- pred 
accu_is_associative(module_info::in, pred_/
+accu_is_update merc-src/accumulator.m  /^:- pred 
accu_is_update(module_info::in, pred_id::i/
+accu_process_assoc_set merc-src/accumulator.m  /^:- pred 
accu_process_assoc_set(module_info::in, ac/
+accu_process_update_set        merc-src/accumulator.m  /^:- pred 
accu_process_update_set(module_info::in, a/
+accu_related   merc-src/accumulator.m  /^:- pred accu_related(module_info::in, 
vartypes::in/
+accu_rename    merc-src/accumulator.m  /^:- func 
accu_rename(list(accu_goal_id), accu_subst/
+accu_sets      merc-src/accumulator.m  /^:- type accu_sets$/
+accu_sets_init merc-src/accumulator.m  /^:- pred 
accu_sets_init(accu_sets::out) is det.$/
+accu_stage1    merc-src/accumulator.m  /^:- pred accu_stage1(module_info::in, 
vartypes::in,/
+accu_stage1_2  merc-src/accumulator.m  /^:- pred 
accu_stage1_2(module_info::in, vartypes::i/
+accu_stage2    merc-src/accumulator.m  /^:- pred accu_stage2(module_info::in, 
proc_info::in/
+accu_stage3    merc-src/accumulator.m  /^:- pred accu_stage3(accu_goal_id::in, 
list(prog_va/
+accu_standardize       merc-src/accumulator.m  /^:- pred 
accu_standardize(hlds_goal::in, hlds_goal:/
+accu_store     merc-src/accumulator.m  /^:- pred accu_store(accu_case::in, 
hlds_goal::in,$/
+accu_subst     merc-src/accumulator.m  /^:- type accu_subst == map(prog_var, 
prog_var).$/
+accu_substs    merc-src/accumulator.m  /^:- type accu_substs$/
+accu_substs_init       merc-src/accumulator.m  /^:- pred 
accu_substs_init(list(prog_var)::in, prog_/
+accu_top_level merc-src/accumulator.m  /^:- pred accu_top_level(top_level::in, 
hlds_goal::i/
+accu_transform_proc    merc-src/accumulator.m  /^:- pred 
accu_transform_proc(pred_proc_id::in, pred/
+accu_update    merc-src/accumulator.m  /^:- pred accu_update(module_info::in, 
vartypes::in,/
+accu_warning   merc-src/accumulator.m  /^:- type accu_warning$/
+act    prol-src/natded.prolog  /^act(OutForm,OutSyn,Ws):-$/
+action prol-src/natded.prolog  /^action(KeyVals):-$/
+active_maps    c-src/emacs/src/keyboard.c      /^active_maps (Lisp_Object 
first_event)$/
+actout prol-src/natded.prolog  /^actout('Text',Trees):-$/
+addArchs       objc-src/PackInsp.m     /^-(void)addArchs:(const char *)string$/
+addPOReader    php-src/lce_functions.php       /^      function 
addPOReader($d_name, &$por)$/
+add_active     prol-src/natded.prolog  /^add_active([],Cat,Goal):-$/
+add_command_key        c-src/emacs/src/keyboard.c      /^add_command_key 
(Lisp_Object key)$/
+add_edge       prol-src/natded.prolog  /^add_edge(Left,Right,Cat):-$/
+add_node       c-src/etags.c   /^add_node (node *np, node **cur_node_p)$/
+add_regex      c-src/etags.c   /^add_regex (char *regexp_pattern, language 
*lang)$/
+add_user_signal        c-src/emacs/src/keyboard.c      /^add_user_signal (int 
sig, const char *name)$/
+addnoise       html-src/algrthms.html  /^Adding Noise to the$/
+address        y-src/cccp.y    113
+adjust_point_for_property      c-src/emacs/src/keyboard.c      
/^adjust_point_for_property (ptrdiff_t last_pt, bool/
+agent  cp-src/clheir.hpp       75
+algorithms     html-src/algrthms.html  /^Description$/
+alias  c-src/emacs/src/lisp.h  688
+align  c-src/emacs/src/gmalloc.c       /^align (size_t size)$/
+alignas        c-src/emacs/src/lisp.h  /^# define alignas(alignment) \/* empty 
*\/$/
+aligned        c-src/emacs/src/gmalloc.c       199
+aligned_alloc  c-src/emacs/src/gmalloc.c       /^aligned_alloc (size_t 
alignment, size_t size)$/
+aligned_alloc  c-src/emacs/src/gmalloc.c       1718
+aligned_alloc  c-src/emacs/src/gmalloc.c       71
+alignlist      c-src/emacs/src/gmalloc.c       196
+alive  cp-src/conway.hpp       7
+all_kboards    c-src/emacs/src/keyboard.c      86
+allocate_kboard        c-src/emacs/src/keyboard.c      /^allocate_kboard 
(Lisp_Object type)$/
+allocated      c-src/emacs/src/regex.h 344
+an_extern_linkage      c-src/h.h       44
+an_extern_linkage      c-src/h.h       56
+an_extern_linkage_ptr  c-src/h.h       43
+analyze_regex  c-src/etags.c   /^analyze_regex (char *regex_arg)$/
+andkeyvalseq   prol-src/natded.prolog  /^andkeyvalseq(KeyVals) --> ['&'], 
keyvalseq(KeyVals/
+animals        c-src/h.h       81
+animals        cp-src/c.C      126
+animals        cp-src/c.C      130
+any_kboard_state       c-src/emacs/src/keyboard.c      /^any_kboard_state ()$/
+appDidInit     objcpp-src/SimpleCalc.M /^- appDidInit:sender$/
+append prol-src/natded.prolog  /^append([],Xs,Xs).$/
+appendToDisplay        objcpp-src/SimpleCalc.M /^- appendToDisplay:(const char 
*)theDigit$/
+append_list    prol-src/natded.prolog  /^append_list([],[]).$/
+append_string  pas-src/common.pas      /^procedure append_string;(*($/
+append_tool_bar_item   c-src/emacs/src/keyboard.c      /^append_tool_bar_item 
(void)$/
+appendix       perl-src/htlmify-cystic 24
+appendix_name  perl-src/htlmify-cystic 13
+appendix_toc   perl-src/htlmify-cystic 16
+apply_modifiers        c-src/emacs/src/keyboard.c      /^apply_modifiers (int 
modifiers, Lisp_Object base)$/
+apply_modifiers_uncached       c-src/emacs/src/keyboard.c      
/^apply_modifiers_uncached (int modifiers, char *bas/
+aref_addr      c-src/emacs/src/lisp.h  /^aref_addr (Lisp_Object array, 
ptrdiff_t idx)$/
+arg    c-src/emacs/src/lisp.h  2961
+arg    c-src/emacs/src/lisp.h  2966
+arg    c-src/emacs/src/lisp.h  2971
+arg    c-src/h.h       13
+arg_type       c-src/etags.c   250
+arglist        y-src/cccp.y    41
+argno  y-src/cccp.y    45
+args   c-src/emacs/src/lisp.h  2986
+args   c-src/h.h       30
+argsindent     tex-src/texinfo.tex     /^\\dimen1=\\hsize \\advance \\dimen1 
by -\\defargsindent/
+argsindent     tex-src/texinfo.tex     /^\\newskip\\defargsindent 
\\defargsindent=50pt$/
+argsindent     tex-src/texinfo.tex     /^\\parshape 2 0in \\dimen0 
\\defargsindent \\dimen1    /
+argument       c-src/etags.c   253
+argvals        prol-src/natded.prolog  /^argvals([]) --> [].$/
+array  c.c     190
+ascii  c-src/emacs/src/lisp.h  1598
+asort  cp-src/functions.cpp    /^void asort(int *a, int num){$/
+assemby-code-word      forth-src/test-forth.fth        /^code 
assemby-code-word ( dunno what it does )$/
+assert c-src/etags.c   /^# define assert(x) ((void) 0)$/
+assert c-src/etags.c   135
+assign_neighbor        cp-src/clheir.hpp       /^    void assign_neighbor(int 
direction, location */
+assoc_list     merc-src/accumulator.m  /^:- import_module assoc_list.$/
+associativity_assertion        merc-src/accumulator.m  /^:- pred 
associativity_assertion(module_info::in, l/
+at_end c-src/etags.c   249
+at_filename    c-src/etags.c   247
+at_language    c-src/etags.c   245
+at_least_one_member    prol-src/natded.prolog  
/^at_least_one_member(X,[X|_]):-!.$/
+at_regexp      c-src/etags.c   246
+at_stdin       c-src/etags.c   248
+atom   prol-src/natded.prolog  /^atom(X) --> [X], {atomic(X)}.$/
+atomval        prol-src/natded.prolog  /^atomval(X) --> atom(X).$/
+aultparindent  tex-src/texinfo.tex     /^\\newdimen\\defaultparindent 
\\defaultparindent = 15p/
+aultparindent  tex-src/texinfo.tex     /^\\parindent = \\defaultparindent$/
+aultparindent\hang\textindent  tex-src/texinfo.tex     
/^\\footstrut\\parindent=\\defaultparindent\\hang\\textin/
+auto_help      c-src/etags.c   699
+b      c-src/h.h       103
+b      c-src/h.h       104
+b      c-src/h.h       41
+b      c.c     /^b ()$/
+b      c.c     180
+b      c.c     259
+b      c.c     260
+b      c.c     262
+b      cp-src/c.C      132
+b      ruby-src/test1.ru       /^ def b()$/
+backslash=0    tex-src/texinfo.tex     /^\\let\\indexbackslash=0  %overridden 
during \\printin/
+bar    c-src/c.c       /^void bar() {while(0) {}}$/
+bar    c-src/h.h       19
+bar    c.c     143
+bar    cp-src/x.cc     /^XX::bar()$/
+bar1   ruby-src/test1.ru       /^    attr_reader(:foo1, :bar1, # comment$/
+bar=   ruby-src/test1.ru       /^    attr_writer :bar,$/
+bas_syn        prol-src/natded.prolog  /^bas_syn(n(_)).$/
+base   c-src/emacs/src/lisp.h  2188
+base   cp-src/Range.h  /^  double base (void) const { return rng_base;  }$/
+base   cp-src/c.C      /^double base (void) const { return rng_base;  }$/
+base_case_ids  merc-src/accumulator.m  /^:- func 
base_case_ids(accu_goal_store) = list(accu/
+base_case_ids_set      merc-src/accumulator.m  /^:- func 
base_case_ids_set(accu_goal_store) = set(a/
+baz=   ruby-src/test1.ru       /^                :baz,$/
+bb     c.c     275
+bbb    c.c     251
+bbbbbb c-src/h.h       113
+been_warned    c-src/etags.c   222
+before_command_echo_length     c-src/emacs/src/keyboard.c      130
+before_command_key_count       c-src/emacs/src/keyboard.c      129
+begtoken       c-src/etags.c   /^#define       begtoken(c)     (_btk[CHAR 
(c)]) \/* c can star/
+behaviour_info erl-src/gs_dialog.erl   /^behaviour_info(callbacks) ->$/
+bf=cmbx10      tex-src/texinfo.tex     /^\\font\\defbf=cmbx10 scaled 
\\magstep1 %was 1314$/
+bind   pyt-src/server.py       /^    def bind(self, key, action):$/
+bind_polling_period    c-src/emacs/src/keyboard.c      /^bind_polling_period 
(int n)$/
+bits_word      c-src/emacs/src/lisp.h  123
+bits_word      c-src/emacs/src/lisp.h  127
+bla    c.c     /^int bla ()$/
+blah   tex-src/testenv.tex     /^\\section{blah}$/
+bletch el-src/TAGTEST.EL       /^(foo::defmumble bletch beuarghh)$/
+blv    c-src/emacs/src/lisp.h  689
+blv_found      c-src/emacs/src/lisp.h  /^blv_found (struct 
Lisp_Buffer_Local_Value *blv)$/
+bodyindent     tex-src/texinfo.tex     /^\\advance\\dimen2 by 
-\\defbodyindent$/
+bodyindent     tex-src/texinfo.tex     /^\\advance\\dimen3 by 
-\\defbodyindent$/
+bodyindent     tex-src/texinfo.tex     /^\\advance\\leftskip by 
-\\defbodyindent$/
+bodyindent     tex-src/texinfo.tex     /^\\advance\\leftskip by 
\\defbodyindent \\advance \\righ/
+bodyindent     tex-src/texinfo.tex     /^\\exdentamount=\\defbodyindent$/
+bodyindent     tex-src/texinfo.tex     /^\\newskip\\defbodyindent 
\\defbodyindent=.4in$/
+bool   c.c     222
+bool   merc-src/accumulator.m  /^:- import_module bool.$/
+bool_header_size       c-src/emacs/src/lisp.h  1472
+bool_vector_bitref     c-src/emacs/src/lisp.h  /^bool_vector_bitref 
(Lisp_Object a, EMACS_INT i)$/
+bool_vector_bytes      c-src/emacs/src/lisp.h  /^bool_vector_bytes (EMACS_INT 
size)$/
+bool_vector_data       c-src/emacs/src/lisp.h  /^bool_vector_data (Lisp_Object 
a)$/
+bool_vector_ref        c-src/emacs/src/lisp.h  /^bool_vector_ref (Lisp_Object 
a, EMACS_INT i)$/
+bool_vector_set        c-src/emacs/src/lisp.h  /^bool_vector_set (Lisp_Object 
a, EMACS_INT i, bool /
+bool_vector_size       c-src/emacs/src/lisp.h  /^bool_vector_size (Lisp_Object 
a)$/
+bool_vector_uchar_data c-src/emacs/src/lisp.h  /^bool_vector_uchar_data 
(Lisp_Object a)$/
+bool_vector_words      c-src/emacs/src/lisp.h  /^bool_vector_words (EMACS_INT 
size)$/
+boolvar        c-src/emacs/src/lisp.h  2287
+bracelev       c-src/etags.c   2520
+bsp_DevId      c-src/h.h       25
+bt     c-src/emacs/src/lisp.h  2988
+btowc  c-src/emacs/src/regex.h /^# define btowc(c) c$/
+buffer c-src/emacs/src/lisp.h  2000
+buffer c-src/emacs/src/regex.h 341
+buffer c-src/etags.c   238
+buffer c-src/h.h       119
+build  prol-src/natded.prolog  /^build([],Left,Left).$/
+build_pure_c_string    c-src/emacs/src/lisp.h  /^build_pure_c_string (const 
char *str)$/
+build_string   c-src/emacs/src/lisp.h  /^build_string (const char *str)$/
+buildact       prol-src/natded.prolog  /^buildact([SynIn],Right,RightPlus1):-$/
+builtin_lisp_symbol    c-src/emacs/src/lisp.h  /^builtin_lisp_symbol (int 
index)$/
+burst  c-src/h.h       28
+busy   c-src/emacs/src/gmalloc.c       158
+button_down_location   c-src/emacs/src/keyboard.c      5210
+button_down_time       c-src/emacs/src/keyboard.c      5218
+byte_stack     c-src/emacs/src/lisp.h  3049
+bytecode_dest  c-src/emacs/src/lisp.h  3037
+bytecode_top   c-src/emacs/src/lisp.h  3036
+bytepos        c-src/emacs/src/lisp.h  2016
+bytes_free     c-src/emacs/src/gmalloc.c       314
+bytes_total    c-src/emacs/src/gmalloc.c       310
+bytes_used     c-src/emacs/src/gmalloc.c       312
+c      c-src/h.h       /^#define c() d$/
+c      c-src/h.h       106
+c      c.c     180
+c_ext  c-src/etags.c   2271
+caccacacca     c.c     /^caccacacca (a,b,c,d,e,f,g)$/
+cacheLRUEntry_s        c.c     172
+cacheLRUEntry_t        c.c     177
+calculate_goal_info    merc-src/accumulator.m  /^:- pred 
calculate_goal_info(hlds_goal_expr::in, hl/
+calloc c-src/emacs/src/gmalloc.c       /^calloc (size_t nmemb, size_t size)$/
+calloc c-src/emacs/src/gmalloc.c       1717
+calloc c-src/emacs/src/gmalloc.c       66
+calloc c-src/emacs/src/gmalloc.c       70
+can_be_null    c-src/emacs/src/regex.h 370
+cancel_echoing c-src/emacs/src/keyboard.c      /^cancel_echoing (void)$/
+canonicalize_filename  c-src/etags.c   /^canonicalize_filename (register char 
*fn)$/
+case_Lisp_Int  c-src/emacs/src/lisp.h  438
+cat    c-src/h.h       81
+cat    cp-src/c.C      126
+cat    cp-src/c.C      130
+cat    prol-src/natded.prolog  /^cat(A, Alpha@Beta, Ass3, Qs3, 
tree(fe,A:Alpha@Beta/
+cat_atoms      prol-src/natded.prolog  /^cat_atoms(A1,A2,A3):-$/
+cccccccccc     c-src/h.h       115
+cdr    c-src/emacs/src/lisp.h  1159
+cell   y-src/parse.y   279
+cgrep  html-src/software.html  /^cgrep$/
+chain  c-src/emacs/src/lisp.h  1162
+chain  c-src/emacs/src/lisp.h  2206
+chain  c-src/emacs/src/lisp.h  2396
+chain_subst    merc-src/accumulator.m  /^:- func chain_subst(accu_subst, 
accu_subst) = accu/
+chain_subst_2  merc-src/accumulator.m  /^:- pred chain_subst_2(list(A)::in, 
map(A, B)::in, /
+char_bits      c-src/emacs/src/lisp.h  2443
+char_table_specials    c-src/emacs/src/lisp.h  1692
+charpos        c-src/emacs/src/lisp.h  2011
+charset_unibyte        c-src/emacs/src/regex.h 410
+chartonmstr    pas-src/common.pas      /^function chartonmstr; (*($/
+checkQuotation php-src/lce_functions.php       /^      function 
checkQuotation($str)$/
+check_cons_list        c-src/emacs/src/lisp.h  /^#  define check_cons_list() 
lisp_h_check_cons_list/
+checker        make-src/Makefile       /^checker:$/
+checkhdr       c-src/emacs/src/gmalloc.c       /^checkhdr (const struct hdr 
*hdr)$/
+checkiso       html-src/software.html  /^checkiso$/
+childDidExit   objc-src/Subprocess.m   /^- childDidExit$/
+chunks_free    c-src/emacs/src/gmalloc.c       313
+chunks_used    c-src/emacs/src/gmalloc.c       311
+cjava  c-src/etags.c   2936
+class_method   ruby-src/test.rb        /^        def 
ClassExample.class_method$/
+classifyLine   php-src/lce_functions.php       /^      function 
classifyLine($line)$/
+clean  make-src/Makefile       /^clean:$/
+clear  cp-src/conway.hpp       /^    void clear(void) { alive = 0; }$/
+clear-abbrev-table     c-src/abbrev.c  /^DEFUN ("clear-abbrev-table", 
Fclear_abbrev_table, /
+clear-this-command-keys        c-src/emacs/src/keyboard.c      /^DEFUN 
("clear-this-command-keys", Fclear_this_comm/
+clearAllKey    objcpp-src/SimpleCalc.M /^- clearAllKey:sender$/
+clearKey       objcpp-src/SimpleCalc.M /^- clearKey:sender$/
+clear_event    c-src/emacs/src/keyboard.c      /^clear_event (struct 
input_event *event)$/
+clear_input_pending    c-src/emacs/src/keyboard.c      /^clear_input_pending 
(void)$/
+clear_neighbors        cp-src/clheir.cpp       /^void 
discrete_location::clear_neighbors(void)$/
+clear_screen   cp-src/screen.cpp       /^void clear_screen(void)$/
+clear_waiting_for_input        c-src/emacs/src/keyboard.c      
/^clear_waiting_for_input (void)$/
+cmd_error      c-src/emacs/src/keyboard.c      /^cmd_error (Lisp_Object data)$/
+cmd_error_internal     c-src/emacs/src/keyboard.c      /^cmd_error_internal 
(Lisp_Object data, const char */
+cmpfn  c-src/emacs/src/lisp.h  /^  bool (*cmpfn) (struct hash_table_test *t, 
Lisp_O/
+cmt    prol-src/natded.prolog  /^cmt:-$/
+cname  c-src/etags.c   2519
+cno    c-src/etags.c   224
+colori cp-src/c.C      40
+commaargvals   prol-src/natded.prolog  /^commaargvals(Args) -->$/
+command        c-src/etags.c   187
+command-error-default-function c-src/emacs/src/keyboard.c      /^DEFUN 
("command-error-default-function", Fcommand_/
+command_loop   c-src/emacs/src/keyboard.c      /^command_loop (void)$/
+command_loop_1 c-src/emacs/src/keyboard.c      /^command_loop_1 (void)$/
+command_loop_2 c-src/emacs/src/keyboard.c      /^command_loop_2 (Lisp_Object 
ignore)$/
+command_loop_level     c-src/emacs/src/keyboard.c      195
+comment        php-src/lce_functions.php       /^      function comment($line, 
$class)$/
+commutativity_assertion        merc-src/accumulator.m  /^:- pred 
commutativity_assertion(module_info::in,li/
+compile_empty  prol-src/natded.prolog  /^compile_empty:-$/
+compile_lex    prol-src/natded.prolog  /^compile_lex(File):-$/
+complete       prol-src/natded.prolog  /^complete(Cat):-$/
+complete-tag   el-src/emacs/lisp/progmodes/etags.el    /^(defun complete-tag 
()$/
+compressor     c-src/etags.c   188
+compressors    c-src/etags.c   457
+compute_next_state     cp-src/clheir.hpp       /^    virtual void 
compute_next_state(void) { }$/
+compute_next_state     cp-src/conway.hpp       /^    void 
compute_next_state(void)$/
+conalgorithm   html-src/algrthms.html  /^Convolutionally$/
+concat c-src/etags.c   /^concat (const char *s1, const char *s2, const char/
+concatenatenamestrings pas-src/common.pas      /^function 
concatenatenamestrings; (*($/
+consider_token c-src/etags.c   /^consider_token (char *str, int len, int c, 
int *c_/
+constant       c-src/emacs/src/lisp.h  668
+constant       c-src/h.h       29
+constant       y-src/cccp.y    112
+constant_args  c-src/h.h       27
+constype       c-src/emacs/src/lisp.h  3739
+consult_lex    prol-src/natded.prolog  /^consult_lex:-$/
+contents       c-src/emacs/src/lisp.h  1372
+contents       c-src/emacs/src/lisp.h  1600
+contents       c-src/emacs/src/lisp.h  1624
+count  c-src/emacs/src/lisp.h  1863
+count_layers   lua-src/allegro.lua     /^local function count_layers (layer)$/
+count_words    c-src/tab.c     /^static int            count_words(char *str, 
char delim)$/
+counter        cp-src/c.C      33
+counter        cp-src/c.C      36
+cow    cp-src/c.C      127
+cow    cp-src/c.C      131
+cplpl  c-src/etags.c   2935
+create-bar     forth-src/test-forth.fth        /^: create-bar foo ;$/
+createPOEntries        php-src/lce_functions.php       /^      function 
createPOEntries()$/
+createWidgets  pyt-src/server.py       /^    def createWidgets(self):$/
+createWidgets  pyt-src/server.py       /^    def createWidgets(self, host):$/
+create_acc_call        merc-src/accumulator.m  /^:- func 
create_acc_call(hlds_goal::in(goal_plain_c/
+create_acc_goal        merc-src/accumulator.m  /^:- pred 
create_acc_goal(hlds_goal::in, accu_substs/
+create_new_base_goals  merc-src/accumulator.m  /^:- func 
create_new_base_goals(set(accu_goal_id), a/
+create_new_orig_recursive_goals        merc-src/accumulator.m  /^:- func 
create_new_orig_recursive_goals(set(accu_g/
+create_new_recursive_goals     merc-src/accumulator.m  /^:- func 
create_new_recursive_goals(set(accu_goal_i/
+create_new_var merc-src/accumulator.m  /^:- pred create_new_var(prog_var::in, 
string::in, p/
+create_orig_goal       merc-src/accumulator.m  /^:- pred 
create_orig_goal(hlds_goal::in, accu_subst/
+cscInitTime    cp-src/c.C      7
+cscSegmentationTime    cp-src/c.C      8
+cstack c-src/etags.c   2523
+ctags  make-src/Makefile       /^ctags: etags.c ${OBJS}$/
+curlb  c-src/etags.c   2929
+curlinepos     c-src/etags.c   2931
+current-idle-time      c-src/emacs/src/keyboard.c      /^DEFUN 
("current-idle-time", Fcurrent_idle_time, Sc/
+current-input-mode     c-src/emacs/src/keyboard.c      /^DEFUN 
("current-input-mode", Fcurrent_input_mode, /
+current_kboard c-src/emacs/src/keyboard.c      85
+current_lb_is_new      c-src/etags.c   2926
+curry-test     scm-src/test.scm        /^(define (((((curry-test a) b) c) d) 
e)$/
+cursor_position        cp-src/screen.cpp       /^void cursor_position(void)$/
+cursor_x       cp-src/screen.cpp       15
+cursor_y       cp-src/screen.cpp       15
+d      c-src/emacs/src/lisp.h  4673
+d      c-src/emacs/src/lisp.h  4679
+d      c.c     180
+data   c-src/emacs/src/lisp.h  1395
+data   c-src/emacs/src/lisp.h  2129
+data   c-src/emacs/src/lisp.h  2395
+ddefineseen    c-src/etags.c   2462
+debian-bug     html-src/software.html  /^debian-bug.el$/
+debug_on_exit  c-src/emacs/src/lisp.h  2984
+decimalKey     objcpp-src/SimpleCalc.M /^- decimalKey:sender$/
+declared_special       c-src/emacs/src/lisp.h  676
+decode_timer   c-src/emacs/src/keyboard.c      /^decode_timer (Lisp_Object 
timer, struct timespec */
+def    c-src/h.h       35
+def    c-src/h.h       38
+defalt c-src/emacs/src/lisp.h  1585
+default-tags-table-function    el-src/emacs/lisp/progmodes/etags.el    
/^(defvar default-tags-table-function nil$/
+default_C_entries      c-src/etags.c   /^default_C_entries (FILE *inf)$/
+default_C_help c-src/etags.c   515
+default_C_help c-src/etags.c   523
+default_C_suffixes     c-src/etags.c   512
+defcell        c-src/emacs/src/lisp.h  2351
+define-abbrev  c-src/abbrev.c  /^DEFUN ("define-abbrev", Fdefine_abbrev, 
Sdefine_ab/
+define-abbrev-table    c-src/abbrev.c  /^DEFUN ("define-abbrev-table", 
Fdefine_abbrev_table/
+define-global-abbrev   c-src/abbrev.c  /^DEFUN ("define-global-abbrev", 
Fdefine_global_abbr/
+define-mode-abbrev     c-src/abbrev.c  /^DEFUN ("define-mode-abbrev", 
Fdefine_mode_abbrev, /
+defined_GC_CHECK_STRING_BYTES  c-src/emacs/src/lisp.h  4663
+defined_GC_CHECK_STRING_BYTES  c-src/emacs/src/lisp.h  4665
+definedef      c-src/etags.c   2464
+defun_func1    c.c     /^defun_func1()$/
+delegate       objc-src/Subprocess.m   /^- delegate$/
+deleteItem     pyt-src/server.py       /^    def deleteItem(self):$/
+delete_kboard  c-src/emacs/src/keyboard.c      /^delete_kboard (KBOARD *kb)$/
+deliver_input_available_signal c-src/emacs/src/keyboard.c      
/^deliver_input_available_signal (int sig)$/
+deliver_interrupt_signal       c-src/emacs/src/keyboard.c      
/^deliver_interrupt_signal (int sig)$/
+deliver_user_signal    c-src/emacs/src/keyboard.c      /^deliver_user_signal 
(int sig)$/
+depth  c-src/emacs/src/lisp.h  1618
+derived_analyses       prol-src/natded.prolog  /^derived_analyses([],[]).$/
+describe_abbrev        c-src/abbrev.c  /^describe_abbrev (sym, stream)$/
+detect_input_pending   c-src/emacs/src/keyboard.c      /^detect_input_pending 
(void)$/
+detect_input_pending_ignore_squeezables        c-src/emacs/src/keyboard.c      
/^detect_input_pending_ignore_squeezables (void)$/
+detect_input_pending_run_timers        c-src/emacs/src/keyboard.c      
/^detect_input_pending_run_timers (bool do_display)$/
+dialog_loop    erl-src/gs_dialog.erl   /^dialog_loop(Module, Window, Frame, 
Extra, Args) ->/
+dignorerest    c-src/etags.c   2463
+discard-input  c-src/emacs/src/keyboard.c      /^DEFUN ("discard-input", 
Fdiscard_input, Sdiscard_i/
+discard_mouse_events   c-src/emacs/src/keyboard.c      /^discard_mouse_events 
(void)$/
+discrete_location      cp-src/clheir.hpp       /^    discrete_location(int xi, 
int yi, int zi):$/
+discrete_location      cp-src/clheir.hpp       56
+display        cp-src/conway.cpp       /^void display(void)$/
+disposetextstring      pas-src/common.pas      /^procedure 
disposetextstring;(*($/
+dnone  c-src/etags.c   2460
+doc    c-src/emacs/src/lisp.h  1689
+dog    c-src/h.h       81
+dog    cp-src/c.C      126
+dog    cp-src/c.C      130
+dotfill        tex-src/texinfo.tex     /^  \\null\\nobreak\\indexdotfill % 
Have leaders before/
+dotfill        tex-src/texinfo.tex     
/^\\noindent\\hskip\\secondaryindent\\hbox{#1}\\indexdotf/
+double_click_count     c-src/emacs/src/keyboard.c      5222
+drag_n_drop_syms       c-src/emacs/src/keyboard.c      4629
+dribble        c-src/emacs/src/keyboard.c      236
+dsharpseen     c-src/etags.c   2461
+dummies        tex-src/texinfo.tex     /^{\\indexdummies % Must do this here, 
since \\bf, etc/
+dummy1 cp-src/burton.cpp       /^::dummy::dummy test::dummy1(void)$/
+dummy2 cp-src/burton.cpp       /^::dummy::dummy test::dummy2(::CORBA::Long 
dummy)$/
+dummy3 cp-src/burton.cpp       /^::dummy::dummy test::dummy3(char* name, 
::CORBA::L/
+dummydots      tex-src/texinfo.tex     /^\\let\\dots=\\indexdummydots$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\b=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\code=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\emph=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\file=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\i=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\kbd=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\key=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\r=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\samp=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\sc=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\strong=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\t=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\tclose=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\var=\\indexdummyfont$/
+dummyfont      tex-src/texinfo.tex     /^\\let\\w=\\indexdummyfont$/
+dummytex       tex-src/texinfo.tex     /^\\let\\TeX=\\indexdummytex$/
+dump   pyt-src/server.py       /^    def dump(self, folded):$/
+eabs   c-src/emacs/src/lisp.h  /^#define eabs(x)         ((x) < 0 ? -(x) : 
(x))$/
+eassert        c-src/emacs/src/lisp.h  /^# define eassert(cond)                
                                \\$/
+eassert        c-src/emacs/src/lisp.h  /^# define eassert(cond) ((void) (false 
&& (cond))) /
+eassume        c-src/emacs/src/lisp.h  /^# define eassume(cond)                
                                \\$/
+eassume        c-src/emacs/src/lisp.h  /^# define eassume(cond) assume (cond)$/
+eax    c-src/sysdep.h  31
+eax    c-src/sysdep.h  33
+echo_add_key   c-src/emacs/src/keyboard.c      /^echo_add_key (Lisp_Object c)$/
+echo_char      c-src/emacs/src/keyboard.c      /^echo_char (Lisp_Object c)$/
+echo_dash      c-src/emacs/src/keyboard.c      /^echo_dash (void)$/
+echo_kboard    c-src/emacs/src/keyboard.c      166
+echo_keystrokes_p      c-src/emacs/src/keyboard.c      /^echo_keystrokes_p 
(void)$/
+echo_length    c-src/emacs/src/keyboard.c      /^echo_length (void)$/
+echo_message_buffer    c-src/emacs/src/keyboard.c      171
+echo_now       c-src/emacs/src/keyboard.c      /^echo_now (void)$/
+echo_truncate  c-src/emacs/src/keyboard.c      /^echo_truncate (ptrdiff_t 
nchars)$/
+echoing        c-src/emacs/src/keyboard.c      154
+editItem       pyt-src/server.py       /^    def editItem(self):$/
+editsite       pyt-src/server.py       /^    def editsite(self, site):$/
+edituser       pyt-src/server.py       /^    def edituser(self, user):$/
+egetenv        c-src/emacs/src/lisp.h  /^egetenv (const char *var)$/
+emacs_abort    c-src/emacs/src/lisp.h  /^extern _Noreturn void emacs_abort 
(void) NO_INLINE/
+end    c-src/emacs/src/keyboard.c      8753
+end    c-src/emacs/src/lisp.h  2039
+end    c-src/emacs/src/regex.h 432
+endtoken       c-src/etags.c   /^#define       endtoken(c)     (_etk[CHAR 
(c)]) \/* c ends tok/
+enter_critical_section c-src/h.h       116
+entry  perl-src/htlmify-cystic 218
+entry  perl-src/htlmify-cystic 234
+entry  perl-src/htlmify-cystic 245
+entry  perl-src/htlmify-cystic 252
+entry  perl-src/htlmify-cystic 268
+entry  perl-src/htlmify-cystic 276
+entry  perl-src/htlmify-cystic 281
+entry  perl-src/htlmify-cystic 296
+equalsKey      objcpp-src/SimpleCalc.M /^- equalsKey:sender$/
+erlang_atom    c-src/etags.c   /^erlang_atom (char *s)$/
+erlang_attribute       c-src/etags.c   /^erlang_attribute (char *s)$/
+erlang_func    c-src/etags.c   /^erlang_func (char *s, char *last)$/
+error  c-src/emacs/src/lisp.h  /^extern _Noreturn void error (const char *, 
...) AT/
+error  c-src/etags.c   /^error (const char *format, ...)$/
+error  c-src/etags.c   /^static void error (const char *, ...) ATTRIBUTE_FO/
+error  y-src/cccp.y    /^error (msg)$/
+error_signaled c-src/etags.c   264
+etags  el-src/emacs/lisp/progmodes/etags.el    /^(defgroup etags nil "Tags 
tables."$/
+etags  html-src/software.html  /^Etags$/
+etags  make-src/Makefile       /^etags: etags.c ${OBJS}$/
+etags--xref-find-definitions   el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags--xref-find-definitions (pattern &opti/
+etags--xref-limit      el-src/emacs/lisp/progmodes/etags.el    /^(defconst 
etags--xref-limit 1000)$/
+etags-file-of-tag      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-file-of-tag (&optional relative) ; Do/
+etags-goto-tag-location        el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-goto-tag-location (tag-info)$/
+etags-list-tags        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-list-tags (file) ; Doc string?$/
+etags-recognize-tags-table     el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-recognize-tags-table ()$/
+etags-snarf-tag        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-snarf-tag (&optional use-explicit) ; /
+etags-tags-apropos     el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-tags-apropos (string) ; Doc string?$/
+etags-tags-apropos-additional  el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-tags-apropos-additional (regexp)$/
+etags-tags-completion-table    el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-tags-completion-table () ; Doc string/
+etags-tags-included-tables     el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-tags-included-tables () ; Doc string?/
+etags-tags-table-files el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-tags-table-files () ; Doc string?$/
+etags-verify-tags-table        el-src/emacs/lisp/progmodes/etags.el    
/^(defun etags-verify-tags-table ()$/
+etags-xref-find        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
etags-xref-find (action id)$/
+etags-xref-find-definitions-tag-order  el-src/emacs/lisp/progmodes/etags.el    
/^(defvar etags-xref-find-definitions-tag-order '(ta/
+etags.1.man    make-src/Makefile       /^etags.1.man: etags.1$/
+etags_getcwd   c-src/etags.c   /^etags_getcwd (void)$/
+eval_dyn       c-src/emacs/src/keyboard.c      /^eval_dyn (Lisp_Object form)$/
+event-convert-list     c-src/emacs/src/keyboard.c      /^DEFUN 
("event-convert-list", Fevent_convert_list, /
+event-symbol-parse-modifiers   c-src/emacs/src/keyboard.c      /^DEFUN 
("internal-event-symbol-parse-modifiers", Fe/
+event_head     c-src/emacs/src/keyboard.c      11021
+event_to_kboard        c-src/emacs/src/keyboard.c      /^event_to_kboard 
(struct input_event *event)$/
+exact  c-src/emacs/src/gmalloc.c       200
+execute        cp-src/c.C      /^        void execute(CPluginCSCState& p, int 
w, in/
+exit   c-src/exit.c    /^DEFUN(exit, (status), int status)$/
+exit   c-src/exit.strange_suffix       /^DEFUN(exit, (status), int status)$/
+exit-recursive-edit    c-src/emacs/src/keyboard.c      /^DEFUN 
("exit-recursive-edit", Fexit_recursive_edit/
+exit_critical_to_previous      c-src/h.h       117
+exp    y-src/atest.y   2
+exp    y-src/cccp.y    156
+exp    y-src/cccp.y    185
+exp    y-src/parse.y   95
+exp1   y-src/cccp.y    148
+exp_list       y-src/parse.y   263
+expand-abbrev  c-src/abbrev.c  /^DEFUN ("expand-abbrev", Fexpand_abbrev, 
Sexpand_ab/
+expandmng      prol-src/natded.prolog  /^expandmng(var(V),var(V)).$/
+expandmng_tree prol-src/natded.prolog  
/^expandmng_tree(tree(Rule,Syn:Sem,Trees),$/
+expandmng_trees        prol-src/natded.prolog  /^expandmng_trees([],[]).$/
+expandsyn      prol-src/natded.prolog  /^expandsyn(Syn,Syn):-$/
+explicitly-quoted-pending-delete-mode  el-src/TAGTEST.EL       /^(defalias 
(quote explicitly-quoted-pending-delete-/
+expression_value       y-src/cccp.y    68
+extras c-src/emacs/src/lisp.h  1603
+extvar c-src/h.h       109
+f      c-src/c.c       /^T f(){if(x){}$/
+f      c-src/h.h       89
+f      c.c     /^int f$/
+f      c.c     145
+f      c.c     156
+f      c.c     168
+f      cp-src/c.C      /^     void f() {}$/
+f      cp-src/c.C      /^  int f(){return 0;};         \/\/ first comment$/
+f      cp-src/c.C      /^A<float,B<int> > A<B<float>,int>::f(A<int>* x) {}$/
+f      cp-src/c.C      /^A<int>* f() {}$/
+f      cp-src/c.C      /^class B<int> { void f() {} };$/
+f      cp-src/c.C      /^int A<int>::f(A<int>* x) {}$/
+f      cp-src/c.C      /^int f(A<int> x) {}$/
+f      cp-src/fail.C   /^              int f() { return 5; }$/
+f      cp-src/fail.C   /^int A::B::f() { return 2; }$/
+f1     c.c     /^     f1 () { \/* Do something. *\/; }$/
+f1     perl-src/kai-test.pl    /^sub f1 {$/
+f2     c.c     /^void f2 () { \/* Do something. *\/; }$/
+f2     perl-src/kai-test.pl    /^sub main::f2 {$/
+f3     perl-src/kai-test.pl    /^sub f3 {$/
+f4     perl-src/kai-test.pl    /^sub Bar::f4 {$/
+f5     perl-src/kai-test.pl    /^sub f5 {$/
+f6     perl-src/kai-test.pl    /^sub f6 {$/
+f7     perl-src/kai-test.pl    /^sub f7 {$/
+fast_string_match_ignore_case  c-src/emacs/src/lisp.h  
/^fast_string_match_ignore_case (Lisp_Object regexp,/
+fastctags      make-src/Makefile       /^fastctags:$/
+fastetags      make-src/Makefile       /^fastetags:$/
+fastmap        c-src/emacs/src/regex.h 355
+fastmap_accurate       c-src/emacs/src/regex.h 383
+fatal  c-src/etags.c   /^fatal (const char *s1, const char *s2)$/
+fatala c.c     /^void fatala () __attribute__ ((noreturn));$/
+fconst forth-src/test-forth.fth        /^3.1415e fconstant fconst$/
+fdHandler      objc-src/Subprocess.m   /^- fdHandler:(int)theFd$/
+fdHandler      objc-src/Subprocess.m   /^fdHandler (int theFd, id self)$/
+fdefunkey      c-src/etags.c   2409
+fdefunname     c-src/etags.c   2410
+fdesc  c-src/etags.c   201
+fdesc  c-src/etags.c   212
+fdp    c-src/etags.c   217
+ff     cp-src/c.C      /^  int ff(){return 1;};$/
+field_of_play  cp-src/conway.cpp       18
+fignore        c-src/etags.c   2416
+file-of-tag    el-src/emacs/lisp/progmodes/etags.el    /^(defun file-of-tag 
(&optional relative)$/
+file-of-tag-function   el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
file-of-tag-function nil$/
+fileJoin       php-src/lce_functions.php       /^  function fileJoin()$/
+file_end       perl-src/htlmify-cystic /^sub file_end ()$/
+file_index     perl-src/htlmify-cystic 33
+file_tocs      perl-src/htlmify-cystic 30
+filename_is_absolute   c-src/etags.c   /^filename_is_absolute (char *fn)$/
+filenames      c-src/etags.c   196
+find-tag       el-src/emacs/lisp/progmodes/etags.el    /^(defun find-tag 
(tagname &optional next-p regexp-p/
+find-tag-default-function      el-src/emacs/lisp/progmodes/etags.el    
/^(defcustom find-tag-default-function nil$/
+find-tag-history       el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
find-tag-history nil) ; Doc string?$/
+find-tag-hook  el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
find-tag-hook nil$/
+find-tag-in-order      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-in-order (pattern$/
+find-tag-interactive   el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-interactive (prompt &optional no-d/
+find-tag-marker-ring   el-src/emacs/lisp/progmodes/etags.el    /^(defvaralias 
'find-tag-marker-ring 'xref--marker-r/
+find-tag-marker-ring-length    el-src/emacs/lisp/progmodes/etags.el    
/^(define-obsolete-variable-alias 'find-tag-marker-r/
+find-tag-next-line-after-failure-p     el-src/emacs/lisp/progmodes/etags.el    
/^(defvar find-tag-next-line-after-failure-p nil$/
+find-tag-noselect      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-noselect (tagname &optional next-p/
+find-tag-other-frame   el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-other-frame (tagname &optional nex/
+find-tag-other-window  el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-other-window (tagname &optional ne/
+find-tag-regexp        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
find-tag-regexp (regexp &optional next-p ot/
+find-tag-regexp-next-line-after-failure-p      
el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
find-tag-regexp-next-line-after-failure-p /
+find-tag-regexp-search-function        el-src/emacs/lisp/progmodes/etags.el    
/^(defvar find-tag-regexp-search-function nil$/
+find-tag-regexp-tag-order      el-src/emacs/lisp/progmodes/etags.el    
/^(defvar find-tag-regexp-tag-order nil$/
+find-tag-search-function       el-src/emacs/lisp/progmodes/etags.el    
/^(defvar find-tag-search-function nil$/
+find-tag-tag   el-src/emacs/lisp/progmodes/etags.el    /^(defun find-tag-tag 
(string)$/
+find-tag-tag-order     el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
find-tag-tag-order nil$/
+find_entries   c-src/etags.c   /^find_entries (FILE *inf)$/
+find_user_signal_name  c-src/emacs/src/keyboard.c      /^find_user_signal_name 
(int sig)$/
+findcats       prol-src/natded.prolog  /^findcats([],Left,Left).$/
+finish_appendices      perl-src/htlmify-cystic /^sub finish_appendices ()$/
+finish_sections        perl-src/htlmify-cystic /^sub finish_sections ()$/
+finish_subsections     perl-src/htlmify-cystic /^sub finish_subsections ()$/
+finish_subsubsections  perl-src/htlmify-cystic /^sub finish_subsubsections ()$/
+finlist        c-src/etags.c   2414
+first  c-src/emacs/src/gmalloc.c       151
+fitchtreelist  prol-src/natded.prolog  /^fitchtreelist([]).$/
+fixup_locale   c-src/emacs/src/lisp.h  /^INLINE void fixup_locale (void) {}$/
+flag   c-src/getopt.h  83
+flag2str       pyt-src/server.py       /^def flag2str(value, string):$/
+flistseen      c-src/etags.c   2415
+fn     c-src/exit.c    /^    void EXFUN((*fn[1]), (NOARGS));$/
+fn     c-src/exit.strange_suffix       /^    void EXFUN((*fn[1]), (NOARGS));$/
+fnin   y-src/parse.y   68
+focus_set      pyt-src/server.py       /^    def focus_set(self):$/
+follow_key     c-src/emacs/src/keyboard.c      /^follow_key (Lisp_Object 
keymap, Lisp_Object key)$/
+fonts  tex-src/texinfo.tex     /^\\obeyspaces \\obeylines \\ninett 
\\indexfonts \\rawbac/
+fonts\rm       tex-src/texinfo.tex     /^  \\indexfonts\\rm \\tolerance=9500 
\\advance\\baseline/
+foo    c-src/h.h       18
+foo    c.c     150
+foo    c.c     166
+foo    c.c     167
+foo    c.c     178
+foo    c.c     189
+foo    cp-src/c.C      /^    foo() {$/
+foo    cp-src/c.C      68
+foo    cp-src/c.C      79
+foo    cp-src/x.cc     /^XX::foo()$/
+foo    f-src/entry.for /^       character*(*) function foo()$/
+foo    f-src/entry.strange     /^       character*(*) function foo()$/
+foo    f-src/entry.strange_suffix      /^       character*(*) function foo()$/
+foo    forth-src/test-forth.fth        /^: foo (foo) ;$/
+foo    php-src/ptest.php       /^foo()$/
+foo    ruby-src/test1.ru       /^    attr_reader :foo$/
+foo!   ruby-src/test1.ru       /^    def foo!$/
+foo1   ruby-src/test1.ru       /^    attr_reader(:foo1, :bar1, # comment$/
+foo2   ruby-src/test1.ru       /^    alias_method ( :foo2, #cmmt$/
+foo==bar       el-src/TAGTEST.EL       /^(defun foo==bar () (message "hi"))  ; 
Bug#5624$/
+foobar c-src/c.c       /^int foobar() {;}$/
+foobar c.c     /^extern void foobar (void) __attribute__ ((section /
+foobar2        c-src/h.h       20
+foobar2_       c-src/h.h       16
+foperator      c-src/etags.c   2411
+force_auto_save_soon   c-src/emacs/src/keyboard.c      /^force_auto_save_soon 
(void)$/
+force_explicit_name    c-src/etags.c   265
+force_quit_count       c-src/emacs/src/keyboard.c      10387
+foreign_export merc-src/accumulator.m  /^:- pragma foreign_export("C", 
unravel_univ(in, out/
+formatSize     objc-src/PackInsp.m     /^-(const char *)formatSize:(const char 
*)size inBuf/
+found  c-src/emacs/src/lisp.h  2344
+fracas html-src/software.html  /^Fracas$/
+frag   c-src/emacs/src/gmalloc.c       152
+frame_local    c-src/emacs/src/lisp.h  2341
+free   c-src/emacs/src/gmalloc.c       /^free (void *ptr)$/
+free   c-src/emacs/src/gmalloc.c       166
+free   c-src/emacs/src/gmalloc.c       1719
+free   c-src/emacs/src/gmalloc.c       67
+free   c-src/emacs/src/gmalloc.c       72
+free_fdesc     c-src/etags.c   /^free_fdesc (register fdesc *fdp)$/
+free_for       prol-src/natded.prolog  /^free_for(var(_),_,_).$/
+free_regexps   c-src/etags.c   /^free_regexps (void)$/
+free_tree      c-src/etags.c   /^free_tree (register node *np)$/
+free_var       prol-src/natded.prolog  /^free_var(var(V),var(V)).$/
+freehook       c-src/emacs/src/gmalloc.c       /^freehook (void *ptr)$/
+fresh_vars     prol-src/natded.prolog  /^fresh_vars(var(V),var(V)).$/
+fstartlist     c-src/etags.c   2413
+func   c-src/emacs/src/lisp.h  /^      void (*func) (Lisp_Object);$/
+func   c-src/emacs/src/lisp.h  /^      void (*func) (int);$/
+func   c-src/emacs/src/lisp.h  /^      void (*func) (void *);$/
+func   c-src/emacs/src/lisp.h  /^      void (*func) (void);$/
+func1  c.c     /^int func1$/
+func2  c.c     /^int func2 (a,b$/
+func_key_syms  c-src/emacs/src/keyboard.c      4626
+funcboo        c.c     /^bool funcboo ()$/
+funcpointer    c-src/emacs/src/lisp.h  2126
+funcptr        c-src/h.h       /^    fu   int (*funcptr) (void *ptr);$/
+function       c-src/emacs/src/lisp.h  1685
+function       c-src/emacs/src/lisp.h  2197
+function       c-src/emacs/src/lisp.h  2985
+function       c-src/emacs/src/lisp.h  694
+function       c-src/etags.c   194
+functionp      c-src/emacs/src/lisp.h  /^functionp (Lisp_Object object)$/
+fval   forth-src/test-forth.fth        /^fconst fvalue fval$/
+fvar   forth-src/test-forth.fth        /^fvariable fvar$/
+fvdef  c-src/etags.c   2418
+fvextern       c-src/etags.c   2420
+fvnameseen     c-src/etags.c   2412
+fvnone c-src/etags.c   2408
+fwd    c-src/emacs/src/lisp.h  2346
+fwd    c-src/emacs/src/lisp.h  690
+g      cp-src/c.C      /^  int g(){return 2;};$/
+galileo        html-src/software.html  /^GaliLEO$/
+gather pyt-src/server.py       /^    def gather(self):$/
+gc_aset        c-src/emacs/src/lisp.h  /^gc_aset (Lisp_Object array, ptrdiff_t 
idx, Lisp_Ob/
+gcmarkbit      c-src/emacs/src/lisp.h  1974
+gcmarkbit      c-src/emacs/src/lisp.h  1981
+gcmarkbit      c-src/emacs/src/lisp.h  2035
+gcmarkbit      c-src/emacs/src/lisp.h  2113
+gcmarkbit      c-src/emacs/src/lisp.h  2204
+gcmarkbit      c-src/emacs/src/lisp.h  656
+gcpro  c-src/emacs/src/lisp.h  3042
+gcpro  c-src/emacs/src/lisp.h  3132
+gen_help_event c-src/emacs/src/keyboard.c      /^gen_help_event (Lisp_Object 
help, Lisp_Object fram/
+genalgorithm   html-src/algrthms.html  /^Generating the 
Data<\/font><\/i><\/b>$/
+generate_warning       merc-src/accumulator.m  /^:- pred 
generate_warning(module_info::in, prog_var/
+generate_warnings      merc-src/accumulator.m  /^:- pred 
generate_warnings(module_info::in, prog_va/
+generic_object cp-src/clheir.cpp       /^generic_object::generic_object(void)$/
+generic_object cp-src/clheir.hpp       13
+getArchs       objc-src/PackInsp.m     /^-(void)getArchs$/
+getDomainNames php-src/lce_functions.php       /^      function 
getDomainNames()$/
+getFoo lua-src/test.lua        /^function Cube.data.getFoo ()$/
+getPOReader    php-src/lce_functions.php       /^      function 
&getPOReader($domain)$/
+getPath        objc-src/PackInsp.m     /^-(const char *)getPath:(char *)buf 
forType:(const /
+getPos lua-src/test.lua        /^function Circle.getPos ()$/
+getPos lua-src/test.lua        /^function Rectangle.getPos ()$/
+getTextDomains php-src/lce_functions.php       /^  function 
getTextDomains($lines)$/
+get_compressor_from_suffix     c-src/etags.c   /^get_compressor_from_suffix 
(char *file, char **ext/
+get_contiguous_space   c-src/emacs/src/gmalloc.c       /^get_contiguous_space 
(ptrdiff_t size, void *positi/
+get_current_dir_name   c-src/emacs/src/gmalloc.c       33
+get_input_pending      c-src/emacs/src/keyboard.c      /^get_input_pending 
(int flags)$/
+get_language_from_filename     c-src/etags.c   /^get_language_from_filename 
(char *file, int case_s/
+get_language_from_interpreter  c-src/etags.c   /^get_language_from_interpreter 
(char *interpreter)$/
+get_language_from_langname     c-src/etags.c   /^get_language_from_langname 
(const char *name)$/
+get_layer_by_name      lua-src/allegro.lua     /^local function 
get_layer_by_name (sprite, layer, n/
+get_tag        c-src/etags.c   /^get_tag (register char *bp, char **namepp)$/
+get_word       c-src/tab.c     /^static char           *get_word(char **str, 
char delim)$/
+getcjmp        c-src/emacs/src/keyboard.c      147
+getopt perl-src/yagrip.pl      /^sub getopt {$/
+getopt.o       make-src/Makefile       /^getopt.o: emacs\/lib-src\/getopt.c$/
+getopt1.o      make-src/Makefile       /^getopt1.o: emacs\/lib-src\/getopt1.c$/
+getptys        objc-src/Subprocess.m   /^getptys (int *master, int *slave)$/
+gettext        php-src/lce_functions.php       /^      function 
gettext($msgid)$/
+ggg    c-src/h.h       10
+ghi1   c-src/h.h       36
+ghi2   c-src/h.h       39
+giallo cp-src/c.C      40
+glider cp-src/conway.cpp       /^void glider(int x, int y)$/
+gnu    html-src/software.html  /^Free software that I wrote for the GNU 
project or /
+gobble_input   c-src/emacs/src/keyboard.c      /^gobble_input (void)$/
+goto-tag-location-function     el-src/emacs/lisp/progmodes/etags.el    
/^(defvar goto-tag-location-function nil$/
+goto_xy        cp-src/screen.cpp       /^void goto_xy(unsigned char x, 
unsigned char y)$/
+handleList     pyt-src/server.py       /^    def handleList(self, event):$/
+handleNew      pyt-src/server.py       /^    def handleNew(self, event):$/
+handle_async_input     c-src/emacs/src/keyboard.c      /^handle_async_input 
(void)$/
+handle_input_available_signal  c-src/emacs/src/keyboard.c      
/^handle_input_available_signal (int sig)$/
+handle_interrupt       c-src/emacs/src/keyboard.c      /^handle_interrupt 
(bool in_signal_handler)$/
+handle_interrupt_signal        c-src/emacs/src/keyboard.c      
/^handle_interrupt_signal (int sig)$/
+handle_user_signal     c-src/emacs/src/keyboard.c      /^handle_user_signal 
(int sig)$/
+handler        c-src/emacs/src/lisp.h  3023
+handlertype    c-src/emacs/src/lisp.h  3021
+has_arg        c-src/getopt.h  82
+hash   c-src/emacs/src/lisp.h  1843
+hash   c-src/etags.c   /^hash (const char *str, int len)$/
+hash_table_test        c-src/emacs/src/lisp.h  1805
+hashfn c-src/emacs/src/lisp.h  /^  EMACS_UINT (*hashfn) (struct 
hash_table_test *t,/
+hdr    c-src/emacs/src/gmalloc.c       1860
+head_table     c-src/emacs/src/keyboard.c      11027
+header c-src/emacs/src/lisp.h  1371
+header c-src/emacs/src/lisp.h  1388
+header c-src/emacs/src/lisp.h  1581
+header c-src/emacs/src/lisp.h  1610
+header c-src/emacs/src/lisp.h  1672
+header c-src/emacs/src/lisp.h  1826
+header_size    c-src/emacs/src/lisp.h  1471
+heapsize       c-src/emacs/src/gmalloc.c       361
+hello  scm-src/test.scm        /^(define hello "Hello, Emacs!")$/
+hello  scm-src/test.scm        /^(set! hello "Hello, world!")$/
+hello-world    scm-src/test.scm        /^(define (hello-world)$/
+help   c-src/etags.c   193
+helpPanel      objcpp-src/SimpleCalc.M /^- helpPanel:sender$/
+help_char_p    c-src/emacs/src/keyboard.c      /^help_char_p (Lisp_Object c)$/
+help_form_saved_window_configs c-src/emacs/src/keyboard.c      2156
+helpwin        pyt-src/server.py       /^def helpwin(helpdict):$/
+hide_cursor    cp-src/screen.cpp       /^void hide_cursor(void)$/
+hlds   merc-src/accumulator.m  /^:- import_module hlds.$/
+htmltreelist   prol-src/natded.prolog  /^htmltreelist([]).$/
+hybrid_aligned_alloc   c-src/emacs/src/gmalloc.c       /^hybrid_aligned_alloc 
(size_t alignment, size_t siz/
+hybrid_calloc  c-src/emacs/src/gmalloc.c       /^hybrid_calloc (size_t nmemb, 
size_t size)$/
+hybrid_free    c-src/emacs/src/gmalloc.c       /^hybrid_free (void *ptr)$/
+hybrid_get_current_dir_name    c-src/emacs/src/gmalloc.c       
/^hybrid_get_current_dir_name (void)$/
+hybrid_malloc  c-src/emacs/src/gmalloc.c       /^hybrid_malloc (size_t size)$/
+hybrid_realloc c-src/emacs/src/gmalloc.c       /^hybrid_realloc (void *ptr, 
size_t size)$/
+hypothetical_mem       prol-src/natded.prolog  
/^hypothetical_mem(fi(N),Ass,_):-$/
+i      c-src/c.c       2
+i      c-src/emacs/src/lisp.h  4673
+i      c-src/emacs/src/lisp.h  4679
+i      c-src/emacs/src/lisp.h  567
+i      c.c     169
+i      cp-src/c.C      132
+ialpage        tex-src/texinfo.tex     /^     \\dimen@=\\pageheight 
\\advance\\dimen@ by-\\ht\\pa/
+ialpage        tex-src/texinfo.tex     /^  \\availdimen@=\\pageheight 
\\advance\\availdimen@ by/
+ialpage        tex-src/texinfo.tex     /^  \\dimen@=\\pageheight 
\\advance\\dimen@ by-\\ht\\parti/
+ialpage        tex-src/texinfo.tex     /^\\newbox\\partialpage$/
+ialpage=       tex-src/texinfo.tex     /^  
\\output={\\global\\setbox\\partialpage=$/
+identify_goal_type     merc-src/accumulator.m  /^:- pred 
identify_goal_type(pred_id::in, proc_id::i/
+identify_out_and_out_prime     merc-src/accumulator.m  /^:- pred 
identify_out_and_out_prime(module_info::in/
+identify_recursive_calls       merc-src/accumulator.m  /^:- pred 
identify_recursive_calls(pred_id::in, proc/
+idx    c-src/emacs/src/lisp.h  3150
+ignore_case    c-src/etags.c   266
+ignore_mouse_drag_p    c-src/emacs/src/keyboard.c      1256
+ill=\relax     tex-src/texinfo.tex     /^\\let\\refill=\\relax$/
+immediate_quit c-src/emacs/src/keyboard.c      174
+impatto        html-src/softwarelibero.html    /^Impatto pratico del software 
libero$/
+implementation merc-src/accumulator.m  /^:- implementation.$/
+in_word_set    c-src/etags.c   /^in_word_set (register const char *str, 
register un/
+inattribute    c-src/etags.c   2400
+inc    cp-src/Range.h  /^  double inc (void) const { return rng_inc;   }$/
+index  c-src/emacs/src/lisp.h  1856
+infabsdir      c-src/etags.c   206
+infabsname     c-src/etags.c   205
+infiles        make-src/Makefile       /^infiles = $(filter-out 
${NONSRCS},${SRCS}) srclist/
+infname        c-src/etags.c   204
+info   c-src/emacs/src/gmalloc.c       157
+infoPanel      objcpp-src/SimpleCalc.M /^- infoPanel:sender$/
+init   c-src/etags.c   /^init (void)$/
+init   objc-src/Subprocess.m   /^    andStdErr:(BOOL)wantsStdErr$/
+init   objc-src/Subprocess.m   /^- init:(const char *)subprocessString$/
+init   objcpp-src/SimpleCalc.M /^- init$/
+init_control   c.c     239
+init_kboard    c-src/emacs/src/keyboard.c      /^init_kboard (KBOARD *kb, 
Lisp_Object type)$/
+init_keyboard  c-src/emacs/src/keyboard.c      /^init_keyboard (void)$/
+init_registry  cp-src/clheir.cpp       /^void init_registry(void)$/
+init_tool_bar_items    c-src/emacs/src/keyboard.c      /^init_tool_bar_items 
(Lisp_Object reuse)$/
+inita  c.c     /^static void inita () {}$/
+initb  c.c     /^static void initb () {}$/
+initial_kboard c-src/emacs/src/keyboard.c      84
+initialize-new-tags-table      el-src/emacs/lisp/progmodes/etags.el    
/^(defun initialize-new-tags-table ()$/
+initialize_goal_store  merc-src/accumulator.m  /^:- func 
initialize_goal_store(list(hlds_goal), ins/
+initialize_random_junk y-src/cccp.y    /^initialize_random_junk ()$/
+input-pending-p        c-src/emacs/src/keyboard.c      /^DEFUN 
("input-pending-p", Finput_pending_p, Sinput/
+input_available_clear_time     c-src/emacs/src/keyboard.c      324
+input_pending  c-src/emacs/src/keyboard.c      239
+input_polling_used     c-src/emacs/src/keyboard.c      /^input_polling_used 
(void)$/
+input_was_pending      c-src/emacs/src/keyboard.c      287
+insert-abbrev-table-description        c-src/abbrev.c  /^DEFUN 
("insert-abbrev-table-description", Finsert_/
+insertion_type c-src/emacs/src/lisp.h  1989
+insertname     pas-src/common.pas      /^function insertname;(*($/
+instance_method        ruby-src/test.rb        /^        def instance_method$/
+instance_method_equals=        ruby-src/test.rb        /^        def 
instance_method_equals=$/
+instance_method_exclamation!   ruby-src/test.rb        /^        def 
instance_method_exclamation!$/
+instance_method_question?      ruby-src/test.rb        /^        def 
instance_method_question?$/
+instr  y-src/parse.y   81
+instruct       c-src/etags.c   2527
+int    merc-src/accumulator.m  /^:- import_module int.$/
+intNumber      go-src/test1.go 13
+integer        c-src/emacs/src/lisp.h  2127
+integer        y-src/cccp.y    112
+integer_overflow       y-src/cccp.y    /^integer_overflow ()$/
+integertonmstr pas-src/common.pas      /^function integertonmstr; (* 
(TheInteger : integer)/
+intensity1     f-src/entry.for /^     & 
intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+intensity1     f-src/entry.strange     /^     & 
intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+intensity1     f-src/entry.strange_suffix      /^     & 
intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+interface      merc-src/accumulator.m  /^:- interface.$/
+interface_locate       c-src/c.c       /^interface_locate(void)$/
+intern c-src/emacs/src/lisp.h  /^intern (const char *str)$/
+intern_c_string        c-src/emacs/src/lisp.h  /^intern_c_string (const char 
*str)$/
+internal_last_event_frame      c-src/emacs/src/keyboard.c      228
+interned       c-src/emacs/src/lisp.h  672
+interpreters   c-src/etags.c   197
+interrupt_input        c-src/emacs/src/keyboard.c      328
+interrupt_input_blocked        c-src/emacs/src/keyboard.c      76
+interrupt_input_blocked        c-src/emacs/src/lisp.h  3048
+interrupts_deferred    c-src/emacs/src/keyboard.c      331
+intoken        c-src/etags.c   /^#define       intoken(c)      (_itk[CHAR 
(c)]) \/* c can be in/
+intspec        c-src/emacs/src/lisp.h  1688
+intvar c-src/emacs/src/lisp.h  2277
+invalidate_nodes       c-src/etags.c   /^invalidate_nodes (fdesc *badfdp, node 
**npp)$/
+io     merc-src/accumulator.m  /^:- import_module io.$/
+ipc3dCSC19     cp-src/c.C      6
+ipc3dChannelType       cp-src/c.C      1
+ipc3dIslandHierarchy   cp-src/c.C      1
+ipc3dLinkControl       cp-src/c.C      1
+irregular_location     cp-src/clheir.hpp       /^    irregular_location(double 
xi, double yi, doubl/
+irregular_location     cp-src/clheir.hpp       47
+isComment      php-src/lce_functions.php       /^      function 
isComment($class)$/
+isHoliday      cp-src/functions.cpp    /^bool isHoliday ( Date d ){$/
+isLeap cp-src/functions.cpp    /^bool isLeap ( int year ){$/
+is_associative_construction    merc-src/accumulator.m  /^:- pred 
is_associative_construction(module_info::i/
+is_curly_brace_form    c-src/h.h       54
+is_explicit    c-src/h.h       49
+is_func        c-src/etags.c   221
+is_hor_space   y-src/cccp.y    953
+is_idchar      y-src/cccp.y    948
+is_idstart     y-src/cccp.y    950
+is_muldiv_operation    cp-src/c.C      /^is_muldiv_operation(pc)$/
+is_ordset      prol-src/ordsets.prolog /^is_ordset(X) :- var(X), !, fail.$/
+is_recursive_case      merc-src/accumulator.m  /^:- pred 
is_recursive_case(list(hlds_goal)::in, pre/
+iso_lispy_function_keys        c-src/emacs/src/keyboard.c      5151
+isoperator     prol-src/natded.prolog  /^isoperator(Char):-$/
+isoptab        prol-src/natded.prolog  /^isoptab('%').$/
+iswhite        c-src/etags.c   /^#define       iswhite(c)      (_wht[CHAR 
(c)]) \/* c is white /
+item_properties        c-src/emacs/src/keyboard.c      7568
+jmp    c-src/emacs/src/lisp.h  3044
+just_read_file c-src/etags.c   /^just_read_file (FILE *inf)$/
+kbd_buffer     c-src/emacs/src/keyboard.c      291
+kbd_buffer_events_waiting      c-src/emacs/src/keyboard.c      
/^kbd_buffer_events_waiting (void)$/
+kbd_buffer_get_event   c-src/emacs/src/keyboard.c      /^kbd_buffer_get_event 
(KBOARD **kbp,$/
+kbd_buffer_nr_stored   c-src/emacs/src/keyboard.c      /^kbd_buffer_nr_stored 
(void)$/
+kbd_buffer_store_event c-src/emacs/src/keyboard.c      
/^kbd_buffer_store_event (register struct input_even/
+kbd_buffer_store_event_hold    c-src/emacs/src/keyboard.c      
/^kbd_buffer_store_event_hold (register struct input/
+kbd_buffer_store_help_event    c-src/emacs/src/keyboard.c      
/^kbd_buffer_store_help_event (Lisp_Object frame, Li/
+kbd_buffer_unget_event c-src/emacs/src/keyboard.c      
/^kbd_buffer_unget_event (register struct input_even/
+kbd_fetch_ptr  c-src/emacs/src/keyboard.c      297
+kbd_store_ptr  c-src/emacs/src/keyboard.c      302
+kboard c-src/emacs/src/keyboard.c      860
+kboard_stack   c-src/emacs/src/keyboard.c      858
+kboard_stack   c-src/emacs/src/keyboard.c      864
+key_and_value  c-src/emacs/src/lisp.h  1868
+keyremap       c-src/emacs/src/keyboard.c      8742
+keyremap       c-src/emacs/src/keyboard.c      8754
+keyremap_step  c-src/emacs/src/keyboard.c      /^keyremap_step (Lisp_Object 
*keybuf, int bufsize, v/
+keys_of_keyboard       c-src/emacs/src/keyboard.c      /^keys_of_keyboard 
(void)$/
+keyval prol-src/natded.prolog  /^keyval(key(Key,Val)) --> [Key,'='], 
valseq(Val).$/
+keyvalcgi      prol-src/natded.prolog  /^keyvalcgi(Key,Val):-$/
+keyvalscgi     prol-src/natded.prolog  /^keyvalscgi(KeyVals),$/
+keyvalseq      prol-src/natded.prolog  /^keyvalseq([KeyVal|KeyVals]) --> $/
+keyword_parsing        y-src/cccp.y    73
+keywords       y-src/cccp.y    114
+keywords       y-src/cccp.y    306
+kind   c-src/emacs/src/keyboard.c      11024
+kind   c-src/h.h       46
+kset_echo_string       c-src/emacs/src/keyboard.c      /^kset_echo_string 
(struct kboard *kb, Lisp_Object v/
+kset_kbd_queue c-src/emacs/src/keyboard.c      /^kset_kbd_queue (struct kboard 
*kb, Lisp_Object val/
+kset_keyboard_translate_table  c-src/emacs/src/keyboard.c      
/^kset_keyboard_translate_table (struct kboard *kb, /
+kset_last_prefix_arg   c-src/emacs/src/keyboard.c      /^kset_last_prefix_arg 
(struct kboard *kb, Lisp_Obje/
+kset_last_repeatable_command   c-src/emacs/src/keyboard.c      
/^kset_last_repeatable_command (struct kboard *kb, L/
+kset_local_function_key_map    c-src/emacs/src/keyboard.c      
/^kset_local_function_key_map (struct kboard *kb, Li/
+kset_overriding_terminal_local_map     c-src/emacs/src/keyboard.c      
/^kset_overriding_terminal_local_map (struct kboard /
+kset_real_last_command c-src/emacs/src/keyboard.c      
/^kset_real_last_command (struct kboard *kb, Lisp_Ob/
+kset_system_key_syms   c-src/emacs/src/keyboard.c      /^kset_system_key_syms 
(struct kboard *kb, Lisp_Obje/
+lang   c-src/etags.c   208
+lang   c-src/etags.c   251
+lang   c-src/etags.c   259
+lang_names     c-src/etags.c   718
+language       c-src/etags.c   199
+last-tag       el-src/emacs/lisp/progmodes/etags.el    /^(defvar last-tag nil$/
+last_abbrev_point      c-src/abbrev.c  79
+last_auto_save c-src/emacs/src/keyboard.c      214
+last_heapinfo  c-src/emacs/src/gmalloc.c       402
+last_mouse_button      c-src/emacs/src/keyboard.c      5215
+last_mouse_x   c-src/emacs/src/keyboard.c      5216
+last_mouse_y   c-src/emacs/src/keyboard.c      5217
+last_non_minibuf_size  c-src/emacs/src/keyboard.c      207
+last_point_position    c-src/emacs/src/keyboard.c      217
+last_state_size        c-src/emacs/src/gmalloc.c       401
+last_undo_boundary     c-src/emacs/src/keyboard.c      1287
+lasta  c.c     272
+lastargmargin  tex-src/texinfo.tex     /^\\newskip\\deflastargmargin 
\\deflastargmargin=18pt$/
+lastargmargin  tex-src/texinfo.tex     /^\\setbox0=\\hbox{\\hskip 
\\deflastargmargin{\\rm #2}\\hs/
+lastb  c.c     278
+lb     c-src/etags.c   2923
+lbs    c-src/etags.c   2924
+lce    php-src/lce_functions.php       /^      function lce()$/
+lce_bindtextdomain     php-src/lce_functions.php       /^      function 
lce_bindtextdomain($d_name, $d_path/
+lce_bindtextdomain     php-src/lce_functions.php       /^      function 
lce_bindtextdomain($domain, $path)$/
+lce_dgettext   php-src/lce_functions.php       /^      function 
lce_dgettext($domain, $msgid)$/
+lce_geteditcode        php-src/lce_functions.php       /^  function 
lce_geteditcode($type, $name, $text, $r/
+lce_gettext    php-src/lce_functions.php       /^      function 
lce_gettext($msgid)$/
+lce_textdomain php-src/lce_functions.php       /^      function 
lce_textdomain($domain)$/
+leasqr html-src/software.html  /^Leasqr$/
+left   c-src/etags.c   216
+left_shift     y-src/cccp.y    /^left_shift (a, b)$/
+len    c-src/etags.c   237
+length c-src/etags.c   2495
+length y-src/cccp.y    113
+length y-src/cccp.y    44
+let    c-src/emacs/src/lisp.h  2981
+letter tex-src/texinfo.tex     /^  {#1}{Appendix 
\\appendixletter}{\\noexpand\\folio}}/
+letter tex-src/texinfo.tex     /^  {\\appendixletter}$/
+letter tex-src/texinfo.tex     /^  
{\\appendixletter}{\\the\\secno}{\\the\\subsecno}{\\th/
+letter tex-src/texinfo.tex     /^\\chapmacro {#1}{Appendix \\appendixletter}%$/
+letter tex-src/texinfo.tex     /^\\gdef\\thissection{#1}\\secheading 
{#1}{\\appendixlet/
+letter tex-src/texinfo.tex     /^\\subsecheading 
{#1}{\\appendixletter}{\\the\\secno}{\\/
+letter tex-src/texinfo.tex     
/^{#1}{\\appendixletter}{\\the\\secno}{\\noexpand\\folio}/
+letter tex-src/texinfo.tex     
/^{#1}{\\appendixletter}{\\the\\secno}{\\the\\subsecno}{\\/
+letter:        tex-src/texinfo.tex     /^\\xdef\\thischapter{Appendix 
\\appendixletter: \\noexp/
+level  c-src/emacs/src/lisp.h  3153
+lex    prol-src/natded.prolog  /^lex(W,SynOut,Sem):-$/
+lexptr y-src/cccp.y    332
+libs   merc-src/accumulator.m  /^:- import_module libs.$/
+licenze        html-src/softwarelibero.html    /^Licenze d'uso di un 
programma$/
+limit  cp-src/Range.h  /^  double limit (void) const { return rng_limit; }$/
+line   c-src/etags.c   2493
+line   perl-src/htlmify-cystic 37
+line   y-src/parse.y   87
+lineCount      php-src/lce_functions.php       /^      function 
lineCount($entry)$/
+linebuffer     c-src/etags.c   239
+linebuffer_init        c-src/etags.c   /^linebuffer_init (linebuffer *lbp)$/
+linebuffer_setlen      c-src/etags.c   /^linebuffer_setlen (linebuffer *lbp, 
int toksize)$/
+lineno c-src/emacs/src/lisp.h  3147
+lineno c-src/etags.c   2506
+linepos        c-src/etags.c   2507
+linepos        c-src/etags.c   2922
+links  html-src/software.html  /^Links to interesting software$/
+lisp_eval_depth        c-src/emacs/src/lisp.h  3045
+lisp_h_CHECK_LIST_CONS c-src/emacs/src/lisp.h  /^#define 
lisp_h_CHECK_LIST_CONS(x, y) CHECK_TYPE (C/
+lisp_h_CHECK_NUMBER    c-src/emacs/src/lisp.h  /^#define 
lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGER/
+lisp_h_CHECK_SYMBOL    c-src/emacs/src/lisp.h  /^#define 
lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP/
+lisp_h_CHECK_TYPE      c-src/emacs/src/lisp.h  /^#define lisp_h_CHECK_TYPE(ok, 
predicate, x) \\$/
+lisp_h_CONSP   c-src/emacs/src/lisp.h  /^#define lisp_h_CONSP(x) (XTYPE (x) == 
Lisp_Cons)$/
+lisp_h_EQ      c-src/emacs/src/lisp.h  /^#define lisp_h_EQ(x, y) (XLI (x) == 
XLI (y))$/
+lisp_h_FLOATP  c-src/emacs/src/lisp.h  /^#define lisp_h_FLOATP(x) (XTYPE (x) 
== Lisp_Float)/
+lisp_h_INTEGERP        c-src/emacs/src/lisp.h  /^#define lisp_h_INTEGERP(x) 
((XTYPE (x) & (Lisp_Int/
+lisp_h_MARKERP c-src/emacs/src/lisp.h  /^#define lisp_h_MARKERP(x) (MISCP (x) 
&& XMISCTYPE /
+lisp_h_MISCP   c-src/emacs/src/lisp.h  /^#define lisp_h_MISCP(x) (XTYPE (x) == 
Lisp_Misc)$/
+lisp_h_NILP    c-src/emacs/src/lisp.h  /^#define lisp_h_NILP(x) EQ (x, Qnil)$/
+lisp_h_SET_SYMBOL_VAL  c-src/emacs/src/lisp.h  /^#define 
lisp_h_SET_SYMBOL_VAL(sym, v) \\$/
+lisp_h_SYMBOLP c-src/emacs/src/lisp.h  /^#define lisp_h_SYMBOLP(x) (XTYPE (x) 
== Lisp_Symbo/
+lisp_h_SYMBOL_CONSTANT_P       c-src/emacs/src/lisp.h  /^#define 
lisp_h_SYMBOL_CONSTANT_P(sym) (XSYMBOL (sy/
+lisp_h_SYMBOL_VAL      c-src/emacs/src/lisp.h  /^#define 
lisp_h_SYMBOL_VAL(sym) \\$/
+lisp_h_VECTORLIKEP     c-src/emacs/src/lisp.h  /^#define lisp_h_VECTORLIKEP(x) 
(XTYPE (x) == Lisp_V/
+lisp_h_XCAR    c-src/emacs/src/lisp.h  /^#define lisp_h_XCAR(c) XCONS 
(c)->car$/
+lisp_h_XCDR    c-src/emacs/src/lisp.h  /^#define lisp_h_XCDR(c) XCONS 
(c)->u.cdr$/
+lisp_h_XCONS   c-src/emacs/src/lisp.h  /^#define lisp_h_XCONS(a) \\$/
+lisp_h_XFASTINT        c-src/emacs/src/lisp.h  /^# define lisp_h_XFASTINT(a) 
XINT (a)$/
+lisp_h_XHASH   c-src/emacs/src/lisp.h  /^#define lisp_h_XHASH(a) XUINT (a)$/
+lisp_h_XIL     c-src/emacs/src/lisp.h  /^# define lisp_h_XIL(i) ((Lisp_Object) 
{ i })$/
+lisp_h_XIL     c-src/emacs/src/lisp.h  /^# define lisp_h_XIL(i) (i)$/
+lisp_h_XINT    c-src/emacs/src/lisp.h  /^# define lisp_h_XINT(a) (XLI (a) >> 
INTTYPEBITS)$/
+lisp_h_XLI     c-src/emacs/src/lisp.h  /^# define lisp_h_XLI(o) ((o).i)$/
+lisp_h_XLI     c-src/emacs/src/lisp.h  /^# define lisp_h_XLI(o) (o)$/
+lisp_h_XPNTR   c-src/emacs/src/lisp.h  /^#define lisp_h_XPNTR(a) \\$/
+lisp_h_XSYMBOL c-src/emacs/src/lisp.h  /^# define lisp_h_XSYMBOL(a) \\$/
+lisp_h_XTYPE   c-src/emacs/src/lisp.h  /^# define lisp_h_XTYPE(a) ((enum 
Lisp_Type) (XLI (a/
+lisp_h_XUNTAG  c-src/emacs/src/lisp.h  /^# define lisp_h_XUNTAG(a, type) 
((void *) (intptr_/
+lisp_h_check_cons_list c-src/emacs/src/lisp.h  /^# define 
lisp_h_check_cons_list() ((void) 0)$/
+lisp_h_make_number     c-src/emacs/src/lisp.h  /^# define 
lisp_h_make_number(n) \\$/
+lispy_accent_codes     c-src/emacs/src/keyboard.c      4634
+lispy_accent_keys      c-src/emacs/src/keyboard.c      4741
+lispy_drag_n_drop_names        c-src/emacs/src/keyboard.c      5181
+lispy_function_keys    c-src/emacs/src/keyboard.c      4768
+lispy_function_keys    c-src/emacs/src/keyboard.c      5065
+lispy_kana_keys        c-src/emacs/src/keyboard.c      5026
+lispy_modifier_list    c-src/emacs/src/keyboard.c      /^lispy_modifier_list 
(int modifiers)$/
+lispy_multimedia_keys  c-src/emacs/src/keyboard.c      4962
+lispy_wheel_names      c-src/emacs/src/keyboard.c      5174
+list   c-src/emacs/src/gmalloc.c       186
+list   merc-src/accumulator.m  /^:- import_module list.$/
+list-tags      el-src/emacs/lisp/progmodes/etags.el    /^(defun list-tags 
(file &optional _next-match)$/
+list-tags-function     el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
list-tags-function nil$/
+list2i c-src/emacs/src/lisp.h  /^list2i (EMACS_INT x, EMACS_INT y)$/
+list3i c-src/emacs/src/lisp.h  /^list3i (EMACS_INT x, EMACS_INT y, EMACS_INT 
w)$/
+list4i c-src/emacs/src/lisp.h  /^list4i (EMACS_INT x, EMACS_INT y, EMACS_INT 
w, EMA/
+list_to_ord_set        prol-src/ordsets.prolog /^list_to_ord_set(List, Set) 
:-$/
+lno    c-src/etags.c   223
+load   objc-src/PackInsp.m     /^-load$/
+loadContentsOf objc-src/PackInsp.m     /^-loadContentsOf:(const char *)type 
inTable:(HashTa/
+loadImage      objc-src/PackInsp.m     /^-loadImage$/
+loadKeyValuesFrom      objc-src/PackInsp.m     /^-loadKeyValuesFrom:(const 
char *)type inTable:(Has/
+loadPORManager php-src/lce_functions.php       /^  function &loadPORManager()$/
+local_if_set   c-src/emacs/src/lisp.h  2338
+location       cp-src/clheir.hpp       /^    location() { }$/
+location       cp-src/clheir.hpp       33
+lookup y-src/cccp.y    /^lookup (name, len, hash)$/
+lookup_call    merc-src/accumulator.m  /^:- pred 
lookup_call(accu_goal_store::in, accu_goal/
+lowcase        c-src/etags.c   /^#define lowcase(c)    tolower (CHAR (c))$/
+lucid_event_type_list_p        c-src/emacs/src/keyboard.c      
/^lucid_event_type_list_p (Lisp_Object object)$/
+mabort c-src/emacs/src/gmalloc.c       /^mabort (enum mcheck_status status)$/
+mach_host_self c-src/machsyscalls.h    /^SYSCALL (mach_host_self, -29,$/
+mach_msg_trap  c-src/machsyscalls.h    /^SYSCALL (mach_msg_trap, -25,$/
+mach_reply_port        c-src/machsyscalls.h    /^SYSCALL (mach_reply_port, 
-26,$/
+mach_task_self c-src/machsyscalls.h    /^SYSCALL (mach_task_self, -28,$/
+mach_thread_self       c-src/machsyscalls.h    /^SYSCALL (mach_thread_self, 
-27,$/
+magic  c-src/emacs/src/gmalloc.c       1863
+maintaining.info       make-src/Makefile       /^maintaining.info: 
maintaining.texi$/
+make-abbrev-table      c-src/abbrev.c  /^DEFUN ("make-abbrev-table", 
Fmake_abbrev_table, Sm/
+make_C_tag     c-src/etags.c   /^make_C_tag (bool isfun)$/
+make_coor      prol-src/natded.prolog  
/^make_coor(s(_),Alpha,Sem1,Sem2,Alpha@Sem1@Sem2).$/
+make_ctrl_char c-src/emacs/src/keyboard.c      /^make_ctrl_char (int c)$/
+make_fixnum_or_float   c-src/emacs/src/lisp.h  /^#define 
make_fixnum_or_float(val) \\$/
+make_formatted_string  c-src/emacs/src/lisp.h  /^extern Lisp_Object 
make_formatted_string (char *, /
+make_lisp_ptr  c-src/emacs/src/lisp.h  /^make_lisp_ptr (void *ptr, enum 
Lisp_Type type)$/
+make_lisp_symbol       c-src/emacs/src/lisp.h  /^make_lisp_symbol (struct 
Lisp_Symbol *sym)$/
+make_lispy_event       c-src/emacs/src/keyboard.c      /^make_lispy_event 
(struct input_event *event)$/
+make_lispy_focus_in    c-src/emacs/src/keyboard.c      /^make_lispy_focus_in 
(Lisp_Object frame)$/
+make_lispy_focus_out   c-src/emacs/src/keyboard.c      /^make_lispy_focus_out 
(Lisp_Object frame)$/
+make_lispy_movement    c-src/emacs/src/keyboard.c      /^make_lispy_movement 
(struct frame *frame, Lisp_Obj/
+make_lispy_position    c-src/emacs/src/keyboard.c      /^make_lispy_position 
(struct frame *f, Lisp_Object /
+make_lispy_switch_frame        c-src/emacs/src/keyboard.c      
/^make_lispy_switch_frame (Lisp_Object frame)$/
+make_number    c-src/emacs/src/lisp.h  /^#  define make_number(n) 
lisp_h_make_number (n)$/
+make_pointer_integer   c-src/emacs/src/lisp.h  /^make_pointer_integer (void 
*p)$/
+make_scroll_bar_position       c-src/emacs/src/keyboard.c      
/^make_scroll_bar_position (struct input_event *ev, /
+make_tag       c-src/etags.c   /^make_tag (const char *name,   \/* tag name, 
or NULL /
+make_uninit_sub_char_table     c-src/emacs/src/lisp.h  
/^make_uninit_sub_char_table (int depth, int min_cha/
+make_uninit_vector     c-src/emacs/src/lisp.h  /^make_uninit_vector (ptrdiff_t 
size)$/
+malloc c-src/emacs/src/gmalloc.c       /^extern void *malloc (size_t size) 
ATTRIBUTE_MALLOC/
+malloc c-src/emacs/src/gmalloc.c       /^malloc (size_t size)$/
+malloc c-src/emacs/src/gmalloc.c       1715
+malloc c-src/emacs/src/gmalloc.c       64
+malloc c-src/emacs/src/gmalloc.c       68
+malloc_atfork_handler_child    c-src/emacs/src/gmalloc.c       
/^malloc_atfork_handler_child (void)$/
+malloc_atfork_handler_parent   c-src/emacs/src/gmalloc.c       
/^malloc_atfork_handler_parent (void)$/
+malloc_atfork_handler_prepare  c-src/emacs/src/gmalloc.c       
/^malloc_atfork_handler_prepare (void)$/
+malloc_enable_thread   c-src/emacs/src/gmalloc.c       /^malloc_enable_thread 
(void)$/
+malloc_info    c-src/emacs/src/gmalloc.c       167
+malloc_initialize_1    c-src/emacs/src/gmalloc.c       /^malloc_initialize_1 
(void)$/
+mallochook     c-src/emacs/src/gmalloc.c       /^mallochook (size_t size)$/
+man manpage    make-src/Makefile       /^man manpage: etags.1.man$/
+mao    c-src/h.h       101
+map    c-src/emacs/src/keyboard.c      8748
+map    merc-src/accumulator.m  /^:- import_module map.$/
+map_word       prol-src/natded.prolog  /^map_word([[_]|Ws],Exp):-$/
+mapping        html-src/algrthms.html  /^Mapping the Channel Symbols$/
+mapsyn prol-src/natded.prolog  /^mapsyn(A\/B,AM\/BM):-$/
+mark_kboards   c-src/emacs/src/keyboard.c      /^mark_kboards (void)$/
+max    c-src/emacs/src/lisp.h  /^#define max(a, b) ((a) > (b) ? (a) : (b))$/
+max    c-src/emacs/src/lisp.h  58
+max    c.c     /^__attribute__ ((always_inline)) max (int a, int b)/
+max    c.c     /^max (int a, int b)$/
+max    cp-src/conway.cpp       /^#define max(x,y)  ((x > y) ? x : y)$/
+max_args       c-src/emacs/src/lisp.h  1686
+max_num_directions     cp-src/clheir.hpp       31
+max_num_generic_objects        cp-src/clheir.cpp       9
+maxargs        c-src/emacs/src/lisp.h  2831
+maybe  merc-src/accumulator.m  /^:- import_module maybe.$/
+maybe_gc       c-src/emacs/src/lisp.h  /^maybe_gc (void)$/
+mcCSC  cp-src/c.C      6
+mcheck c-src/emacs/src/gmalloc.c       /^mcheck (void (*func) (enum 
mcheck_status))$/
+mcheck_status  c-src/emacs/src/gmalloc.c       283
+mcheck_used    c-src/emacs/src/gmalloc.c       2012
+mdbcomp        merc-src/accumulator.m  /^:- import_module mdbcomp.$/
+me22b  lua-src/test.lua        /^   local function test.me22b (one)$/
+me_22a lua-src/test.lua        /^   function test.me_22a(one, two)$/
+memalign       c-src/emacs/src/gmalloc.c       /^memalign (size_t alignment, 
size_t size)$/
+member prol-src/natded.prolog  /^member(X,[X|_]).$/
+member_lessthan_goalid merc-src/accumulator.m  /^:- pred 
member_lessthan_goalid(accu_goal_store::in/
+memclear       c-src/emacs/src/lisp.h  /^memclear (void *p, ptrdiff_t nbytes)$/
+menu_bar_item  c-src/emacs/src/keyboard.c      /^menu_bar_item (Lisp_Object 
key, Lisp_Object item, /
+menu_bar_items c-src/emacs/src/keyboard.c      /^menu_bar_items (Lisp_Object 
old)$/
+menu_bar_items_index   c-src/emacs/src/keyboard.c      7369
+menu_bar_items_vector  c-src/emacs/src/keyboard.c      7368
+menu_bar_one_keymap_changed_items      c-src/emacs/src/keyboard.c      7363
+menu_item_eval_property        c-src/emacs/src/keyboard.c      
/^menu_item_eval_property (Lisp_Object sexpr)$/
+menu_item_eval_property_1      c-src/emacs/src/keyboard.c      
/^menu_item_eval_property_1 (Lisp_Object arg)$/
+menu_separator_name_p  c-src/emacs/src/keyboard.c      /^menu_separator_name_p 
(const char *label)$/
+metasource     c-src/etags.c   198
+min    c-src/emacs/src/gmalloc.c       /^#define min(a, b) ((a) < (b) ? (a) : 
(b))$/
+min    c-src/emacs/src/lisp.h  /^#define min(a, b) ((a) < (b) ? (a) : (b))$/
+min    c-src/emacs/src/lisp.h  57
+min    cp-src/conway.cpp       /^#define min(x,y)  ((x > y) ? y : x)$/
+min_args       c-src/emacs/src/lisp.h  1686
+min_char       c-src/emacs/src/lisp.h  1621
+minus  cp-src/functions.cpp    /^void Date::minus ( int days , int month , int 
year/
+miti   html-src/softwarelibero.html    /^Sfatiamo alcuni miti$/
+modifier_names c-src/emacs/src/keyboard.c      6319
+modifier_symbols       c-src/emacs/src/keyboard.c      6327
+modify_event_symbol    c-src/emacs/src/keyboard.c      /^modify_event_symbol 
(ptrdiff_t symbol_num, int mod/
+module_class_method    ruby-src/test.rb        /^    def 
ModuleExample.module_class_method$/
+module_instance_method ruby-src/test.rb        /^    def 
module_instance_method$/
+more=  ruby-src/test1.ru       /^                :more$/
+more_aligned_int       c.c     165
+morecore_nolock        c-src/emacs/src/gmalloc.c       /^morecore_nolock 
(size_t size)$/
+morecore_recursing     c-src/emacs/src/gmalloc.c       604
+mouse_syms     c-src/emacs/src/keyboard.c      4627
+move   cp-src/clheir.cpp       /^void agent::move(int direction)$/
+mprobe c-src/emacs/src/gmalloc.c       /^mprobe (void *ptr)$/
+msgid  php-src/lce_functions.php       /^      function msgid($line, $class)$/
+msgstr php-src/lce_functions.php       /^      function msgstr($line, $class)$/
+mstats c-src/emacs/src/gmalloc.c       308
+mt     prol-src/natded.prolog  /^mt:-$/
+mtg    html-src/software.html  /^MTG$/
+multi_line     c-src/etags.c   267
+multibyte      c-src/emacs/src/regex.h 403
+my_printf      c.c     /^my_printf (void *my_object, const char *my_format,/
+my_struct      c-src/h.h       91
+my_struct      c.c     226
+my_typedef     c-src/h.h       93
+my_typedef     c.c     228
+mypi   forth-src/test-forth.fth        /^synonym mypi fconst$/
+n      c-src/exit.c    28
+n      c-src/exit.strange_suffix       28
+name   c-src/emacs/src/keyboard.c      7241
+name   c-src/emacs/src/lisp.h  1808
+name   c-src/emacs/src/lisp.h  3144
+name   c-src/emacs/src/lisp.h  682
+name   c-src/etags.c   192
+name   c-src/etags.c   218
+name   c-src/etags.c   2271
+name   c-src/etags.c   261
+name   c-src/getopt.h  76
+name   c-src/getopt.h  78
+name   perl-src/htlmify-cystic 357
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#1}{Function}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#1}{Macro}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#1}{Special Form}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#1}{User Option}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#1}{Variable}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname 
{#2}{#1}\\deftpargs{#3}\\endgrou/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname 
{#2}{#1}\\defunargs{#3}\\endgrou/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname 
{#2}{#1}\\defvarargs{#3}\\endgro/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#2}{Instance Variable 
of #1}%/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#2}{Method on #1}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#2}{\\defcvtype{} of 
#1}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {#2}{\\defoptype{} on 
#1}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {\\code{#1} 
#2}{Function}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {\\code{#1} 
#2}{Variable}%$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {\\code{#2} #3}{#1}$/
+name   tex-src/texinfo.tex     /^\\begingroup\\defname {\\code{#2} #3}{#1}%$/
+name   y-src/cccp.y    113
+name   y-src/cccp.y    43
+named  c-src/etags.c   2505
+namestringequal        pas-src/common.pas      /^function 
namestringequal;(*(var Name1,Name2 : Name/
+nargs  c-src/emacs/src/lisp.h  2987
+need_adjustment        c-src/emacs/src/lisp.h  1986
+neighbors      cp-src/clheir.hpp       59
+nelem  cp-src/Range.h  /^  int nelem (void) const { return rng_nelem; }$/
+nestlev        c-src/etags.c   2525
+new    objc-src/PackInsp.m     /^+new$/
+new    perl-src/htlmify-cystic 163
+new_tag        perl-src/htlmify-cystic 18
+newlb  c-src/etags.c   2930
+newlinepos     c-src/etags.c   2932
+newtextstring  pas-src/common.pas      /^function newtextstring; (*: 
TextString;*)$/
+next   c-src/emacs/src/gmalloc.c       164
+next   c-src/emacs/src/gmalloc.c       188
+next   c-src/emacs/src/gmalloc.c       198
+next   c-src/emacs/src/keyboard.c      7246
+next   c-src/emacs/src/keyboard.c      861
+next   c-src/emacs/src/lisp.h  1848
+next   c-src/emacs/src/lisp.h  2009
+next   c-src/emacs/src/lisp.h  2037
+next   c-src/emacs/src/lisp.h  2192
+next   c-src/emacs/src/lisp.h  3028
+next   c-src/emacs/src/lisp.h  3134
+next   c-src/emacs/src/lisp.h  700
+next   c-src/etags.c   203
+next   c.c     174
+next   y-src/cccp.y    42
+next-file      el-src/emacs/lisp/progmodes/etags.el    /^(defun next-file 
(&optional initialize novisit)$/
+next-file-list el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
next-file-list nil$/
+next_alive     cp-src/conway.hpp       7
+next_almost_prime      c-src/emacs/src/lisp.h  /^extern EMACS_INT 
next_almost_prime (EMACS_INT) ATT/
+next_free      c-src/emacs/src/lisp.h  1851
+next_weak      c-src/emacs/src/lisp.h  1875
+nextfree       c-src/emacs/src/lisp.h  3029
+nfree  c-src/emacs/src/gmalloc.c       150
+nl     c-src/etags.c   2521
+no     tex-src/texinfo.tex     /^\\global\\advance \\appendixno by 1 
\\message{Appendix/
+no     tex-src/texinfo.tex     /^\\ifnum\\secno=0 
Appendix\\xreftie'char\\the\\appendixn/
+no     tex-src/texinfo.tex     /^\\newcount \\appendixno  \\appendixno = `\\@$/
+no.\the\secno  tex-src/texinfo.tex     /^\\else \\ifnum \\subsecno=0 
Section\\xreftie'char\\the\\/
+no.\the\secno.\the\subsecno    tex-src/texinfo.tex     
/^Section\\xreftie'char\\the\\appendixno.\\the\\secno.\\th/
+no.\the\secno.\the\subsecno.\the\subsubsecno   tex-src/texinfo.tex     
/^Section\\xreftie'char\\the\\appendixno.\\the\\secno.\\th/
+no_argument    c-src/getopt.h  89
+no_lang_help   c-src/etags.c   707
+no_sub c-src/emacs/src/regex.h 387
+nocase_tail    c-src/etags.c   /^nocase_tail (const char *cp)$/
+node   c-src/etags.c   225
+node_st        c-src/etags.c   214
+noderef        tex-src/texinfo.tex     /^\\appendixnoderef %$/
+nofonts        tex-src/texinfo.tex     /^{\\indexnofonts$/
+nofonts%       tex-src/texinfo.tex     /^{\\chapternofonts%$/
+none_help      c-src/etags.c   703
+normalize      prol-src/natded.prolog  /^normalize(M,MNorm):-$/
+normalize_fresh        prol-src/natded.prolog  /^normalize_fresh(M,N):-$/
+normalize_tree prol-src/natded.prolog  
/^normalize_tree(tree(Rule,Syn:Sem,Trees),$/
+normalize_trees        prol-src/natded.prolog  /^normalize_trees([],[]).$/
+nosave pyt-src/server.py       /^    def nosave(self):$/
+not_bol        c-src/emacs/src/regex.h 391
+not_eol        c-src/emacs/src/regex.h 394
+not_single_kboard_state        c-src/emacs/src/keyboard.c      
/^not_single_kboard_state (KBOARD *kboard)$/
+notag2 c-src/dostorture.c      26
+notag2 c-src/torture.c 26
+notag4 c-src/dostorture.c      45
+notag4 c-src/torture.c 45
+notinname      c-src/etags.c   /^#define notinname(c)  (_nin[CHAR (c)]) \/* c 
is not /
+npending       c-src/emacs/src/keyboard.c      7244
+ntool_bar_items        c-src/emacs/src/keyboard.c      7974
+numOfChannels  cp-src/c.C      1
+num_columns    cp-src/conway.cpp       16
+num_input_events       c-src/emacs/src/keyboard.c      210
+num_regs       c-src/emacs/src/regex.h 430
+num_rows       cp-src/conway.cpp       15
+numberKeys     objcpp-src/SimpleCalc.M /^- numberKeys:sender$/
+number_len     c-src/etags.c   /^static int number_len (long) 
ATTRIBUTE_CONST;$/
+numbervars     prol-src/natded.prolog  /^numbervars(X):-$/
+nvars  c-src/emacs/src/lisp.h  3140
+objdef c-src/etags.c   2484
+object c-src/emacs/src/lisp.h  2128
+object_registry        cp-src/clheir.cpp       10
+objtag c-src/etags.c   2453
+objvar c-src/emacs/src/lisp.h  2297
+obstack_chunk_alloc    y-src/parse.y   47
+obstack_chunk_free     y-src/parse.y   48
+ocatseen       c-src/etags.c   2477
+octave_MDiagArray2_h   cp-src/MDiagArray2.h    29
+octave_Range_h cp-src/Range.h  24
+oediff make-src/Makefile       /^oediff: OTAGS ETAGS ${infiles}$/
+offset c-src/emacs/src/lisp.h  2305
+offset c-src/emacs/src/lisp.h  2365
+offset c-src/etags.c   2494
+oignore        c-src/etags.c   2483
+oimplementation        c-src/etags.c   2474
+oinbody        c-src/etags.c   2478
+ok     objc-src/PackInsp.m     /^-ok:sender$/
+ok_to_echo_at_next_pause       c-src/emacs/src/keyboard.c      159
+old_value      c-src/emacs/src/lisp.h  2980
+omethodcolon   c-src/etags.c   2481
+omethodparm    c-src/etags.c   2482
+omethodsign    c-src/etags.c   2479
+omethodtag     c-src/etags.c   2480
+onone  c-src/etags.c   2472
+oparenseen     c-src/etags.c   2476
+open   objc-src/PackInsp.m     /^-open:sender$/
+open-dribble-file      c-src/emacs/src/keyboard.c      /^DEFUN 
("open-dribble-file", Fopen_dribble_file, So/
+openInWorkspace        objc-src/PackInsp.m     /^static void 
openInWorkspace(const char *filename)$/
+operationKeys  objcpp-src/SimpleCalc.M /^- operationKeys:sender$/
+operator       y-src/cccp.y    438
+operator ++    cp-src/functions.cpp    /^Date & Date::operator ++ ( void ){$/
+operator +=    cp-src/functions.cpp    /^Date & Date::operator += ( int days 
){$/
+operator -     cp-src/c.C      /^void operator -(int, int) {}$/
+operator -     cp-src/functions.cpp    /^int Date::operator - ( Date d ){$/
+operator --    cp-src/functions.cpp    /^Date & Date::operator -- ( void ){$/
+operator -=    cp-src/functions.cpp    /^Date & Date::operator -= ( int days 
){$/
+operator <     cp-src/functions.cpp    /^int Date::operator < ( Date d ) {$/
+operator <<    cp-src/functions.cpp    /^ostream& operator <<  ( ostream &c, 
Date d ) {$/
+operator =     cp-src/MDiagArray2.h    /^  MDiagArray2<T>& operator = (const 
MDiagArray2<T>/
+operator =     cp-src/functions.cpp    /^Date & Date::operator = ( Date d ){$/
+operator ==    cp-src/functions.cpp    /^int Date::operator == ( Date d ) {$/
+operator >     cp-src/functions.cpp    /^int Date::operator > ( Date d ) {$/
+operator >>    cp-src/functions.cpp    /^istream& operator >> ( istream &i, 
Date & dd ){$/
+operator MArray2<T>    cp-src/MDiagArray2.h    /^  operator MArray2<T> () 
const$/
+operator int   cp-src/c.C      /^void operator int(int, int) {}$/
+operator int   cp-src/fail.C   /^                         operator int() const 
{return x;}$/
+operator+      cp-src/c.C      /^  A operator+(A& a) {};$/
+operator+      cp-src/c.C      /^const A& A::operator+(const A&) { }$/
+operator+      cp-src/c.C      /^void operator+(int, int) {}$/
+opparsebody\Edefop\defopx\defopheader\defoptype        tex-src/texinfo.tex     
/^\\defopparsebody\\Edefop\\defopx\\defopheader\\defoptyp/
+oprotocol      c-src/etags.c   2473
+option c-src/getopt.h  73
+optional_argument      c-src/getopt.h  91
+opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype   tex-src/texinfo.tex     
/^\\defopvarparsebody\\Edefcv\\defcvx\\defcvarheader\\def/
+ord_add_element        prol-src/ordsets.prolog /^ord_add_element([], Element, 
[Element]).$/
+ord_del_element        prol-src/ordsets.prolog /^ord_del_element([], _, []).$/
+ord_disjoint   prol-src/ordsets.prolog /^ord_disjoint(Set1, Set2) :-$/
+ord_intersect  prol-src/ordsets.prolog /^ord_intersect([Head1|Tail1], 
[Head2|Tail2]) :-$/
+ord_intersection       prol-src/ordsets.prolog /^ord_intersection(Sets, 
Intersection) :- $/
+ord_intersection       prol-src/ordsets.prolog /^ord_intersection([], Set2, 
[], Set2).$/
+ord_intersection       prol-src/ordsets.prolog /^ord_intersection([], _, []).$/
+ord_intersection2      prol-src/ordsets.prolog /^ord_intersection2(1, 
[Set|Sets], Set0, Sets0) :- !/
+ord_intersection3      prol-src/ordsets.prolog /^ord_intersection3(<, _, Set1, 
Head2, Tail2, Inters/
+ord_intersection4      prol-src/ordsets.prolog /^ord_intersection4(<, _, Set1, 
Head2, Tail2, Inters/
+ord_member     prol-src/ordsets.prolog /^ord_member(X, [E|Es]) :-$/
+ord_seteq      prol-src/ordsets.prolog /^ord_seteq(Set1, Set2) :-$/
+ord_setproduct prol-src/ordsets.prolog /^ord_setproduct([], _, []).$/
+ord_subset     prol-src/ordsets.prolog /^ord_subset([], _).$/
+ord_subtract   prol-src/ordsets.prolog /^ord_subtract(Set1, Set2, Union) :-$/
+ord_symdiff    prol-src/ordsets.prolog /^ord_symdiff([], Set2, Set2).$/
+ord_union      prol-src/ordsets.prolog /^ord_union(Set1, Set2, Union) :-$/
+ord_union      prol-src/ordsets.prolog /^ord_union([], Union) :- !, Union = 
[].$/
+ord_union4     prol-src/ordsets.prolog /^ord_union4(<, Head, Set1, Head2, 
Tail2, [Head|Unio/
+ord_union_all  prol-src/ordsets.prolog /^ord_union_all(1, [Set|Sets], Set, 
Sets) :- !.$/
+oss    html-src/softwarelibero.html    /^Il movimento open source$/
+otagseen       c-src/etags.c   2475
+outputTime     cp-src/c.C      9
+output_file    perl-src/htlmify-cystic 35
+output_files   perl-src/htlmify-cystic 32
+outputtable    html-src/algrthms.html  /^Output$/
+outsyn prol-src/natded.prolog  /^outsyn(['Any'],_).$/
+p      c-src/emacs/src/lisp.h  4673
+p      c-src/emacs/src/lisp.h  4679
+p.x    forth-src/test-forth.fth        /^  1 CELLS +FIELD p.x    \\ A single 
cell filed name/
+p.y    forth-src/test-forth.fth        /^  1 CELLS +FIELD p.y    \\ A single 
cell field name/
+p/f    ada-src/etags-test-for.ada      /^   function p pragma Import (C,$/
+p/f    ada-src/etags-test-for.ada      /^function p ("p");$/
+pD     c-src/emacs/src/lisp.h  165
+pD     c-src/emacs/src/lisp.h  167
+pD     c-src/emacs/src/lisp.h  169
+pD     c-src/emacs/src/lisp.h  171
+pI     c-src/emacs/src/lisp.h  106
+pI     c-src/emacs/src/lisp.h  94
+pI     c-src/emacs/src/lisp.h  99
+pMd    c-src/emacs/src/lisp.h  150
+pMd    c-src/emacs/src/lisp.h  155
+pMu    c-src/emacs/src/lisp.h  151
+pMu    c-src/emacs/src/lisp.h  156
+p_next c-src/etags.c   258
+pagesize       c-src/emacs/src/gmalloc.c       1703
+pair   merc-src/accumulator.m  /^:- import_module pair.$/
+parent c-src/emacs/src/keyboard.c      8745
+parent c-src/emacs/src/lisp.h  1590
+parse  prol-src/natded.prolog  /^parse(Ws,Cat):-$/
+parseFromVars  php-src/lce_functions.php       /^      function 
parseFromVars($prefix)$/
+parse_c_expression     y-src/cccp.y    /^parse_c_expression (string)$/
+parse_cgi      prol-src/natded.prolog  /^parse_cgi(TokenList,KeyVals):-$/
+parse_error    y-src/parse.y   82
+parse_escape   y-src/cccp.y    /^parse_escape (string_ptr)$/
+parse_hash     y-src/parse.y   64
+parse_menu_item        c-src/emacs/src/keyboard.c      /^parse_menu_item 
(Lisp_Object item, int inmenubar)$/
+parse_modifiers        c-src/emacs/src/keyboard.c      /^parse_modifiers 
(Lisp_Object symbol)$/
+parse_modifiers_uncached       c-src/emacs/src/keyboard.c      
/^parse_modifiers_uncached (Lisp_Object symbol, ptrd/
+parse_number   y-src/cccp.y    /^parse_number (olen)$/
+parse_return   y-src/parse.y   74
+parse_return_error     y-src/cccp.y    70
+parse_solitary_modifier        c-src/emacs/src/keyboard.c      
/^parse_solitary_modifier (Lisp_Object symbol)$/
+parse_tool_bar_item    c-src/emacs/src/keyboard.c      /^parse_tool_bar_item 
(Lisp_Object key, Lisp_Object /
+parse_tree     merc-src/accumulator.m  /^:- import_module parse_tree.$/
+pat    c-src/etags.c   262
+pattern        c-src/etags.c   260
+pdlcount       c-src/emacs/src/lisp.h  3046
+pending-delete-mode    el-src/TAGTEST.EL       /^(defalias 
'pending-delete-mode 'delete-selection-m/
+pending_funcalls       c-src/emacs/src/keyboard.c      4377
+pending_signals        c-src/emacs/src/keyboard.c      80
+pfatal c-src/etags.c   /^pfatal (const char *s1)$/
+pfdset c-src/h.h       57
+pfnote c-src/etags.c   /^pfnote (char *name, bool is_func, char *linestart,/
+pinned c-src/emacs/src/lisp.h  679
+plain_C_entries        c-src/etags.c   /^plain_C_entries (FILE *inf)$/
+plain_C_suffixes       c-src/etags.c   643
+plainc c-src/etags.c   2934
+plist  c-src/emacs/src/lisp.h  2040
+plist  c-src/emacs/src/lisp.h  697
+plus   cp-src/functions.cpp    /^void Date::plus ( int days , int month , int 
year /
+plus   go-src/test1.go 5
+plusvalseq     prol-src/natded.prolog  /^plusvalseq([]) --> [].$/
+point  forth-src/test-forth.fth        /^BEGIN-STRUCTURE point \\ create the 
named structure/
+pointer        c-src/emacs/src/lisp.h  2125
+poll_for_input c-src/emacs/src/keyboard.c      /^poll_for_input (struct atimer 
*timer)$/
+poll_for_input_1       c-src/emacs/src/keyboard.c      /^poll_for_input_1 
(void)$/
+poll_suppress_count    c-src/emacs/src/keyboard.c      1908
+poll_suppress_count    c-src/emacs/src/lisp.h  3047
+poll_timer     c-src/emacs/src/keyboard.c      1915
+pop-tag-mark   el-src/emacs/lisp/progmodes/etags.el    /^(defalias 
'pop-tag-mark 'xref-pop-marker-stack)$/
+pop_kboard     c-src/emacs/src/keyboard.c      /^pop_kboard (void)$/
+popclass_above c-src/etags.c   /^popclass_above (int bracelev)$/
+position_to_Time       c-src/emacs/src/keyboard.c      /^position_to_Time 
(ptrdiff_t pos)$/
+posix_memalign c-src/emacs/src/gmalloc.c       /^posix_memalign (void 
**memptr, size_t alignment, s/
+posn-at-point  c-src/emacs/src/keyboard.c      /^DEFUN ("posn-at-point", 
Fposn_at_point, Sposn_at_p/
+posn-at-x-y    c-src/emacs/src/keyboard.c      /^DEFUN ("posn-at-x-y", 
Fposn_at_x_y, Sposn_at_x_y, /
+possible_sum_sign      y-src/cccp.y    /^#define possible_sum_sign(a, b, sum) 
((((a) ^ (b))/
+post   pyt-src/server.py       /^    def post(self):$/
+pot_etags_version      c-src/etags.c   81
+pp1    c-src/dostorture.c      /^int pp1($/
+pp1    c-src/torture.c /^int pp1($/
+pp2    c-src/dostorture.c      /^pp2$/
+pp2    c-src/torture.c /^pp2$/
+pp3    c-src/dostorture.c      /^pp3(int bar)$/
+pp3    c-src/torture.c /^pp3(int bar)$/
+pp_bas_cat     prol-src/natded.prolog  /^pp_bas_cat(Cat):-$/
+pp_cat prol-src/natded.prolog  /^pp_cat(Syn:Sem):-$/
+pp_exp prol-src/natded.prolog  /^pp_exp('NIL'):-$/
+pp_exps        prol-src/natded.prolog  /^pp_exps([]).$/
+pp_html_fitch_tree     prol-src/natded.prolog  
/^pp_html_fitch_tree(tree(der,Root,[ders(Words)]),M,/
+pp_html_table_fitch_tree       prol-src/natded.prolog  
/^pp_html_table_fitch_tree(T):-$/
+pp_html_table_tree     prol-src/natded.prolog  /^pp_html_table_tree(T):-$/
+pp_html_tree   prol-src/natded.prolog  /^pp_html_tree(ass(Syn,V,'$VAR'(N))):-$/
+pp_html_trees  prol-src/natded.prolog  /^pp_html_trees([T|Ts],N,M):-$/
+pp_lam prol-src/natded.prolog  /^pp_lam(Var^Alpha):-$/
+pp_lam_bracket prol-src/natded.prolog  /^pp_lam_bracket(A^B):-$/
+pp_lam_paren   prol-src/natded.prolog  /^pp_lam_paren(Var^Alpha):-$/
+pp_paren       prol-src/natded.prolog  /^pp_paren(C):-$/
+pp_rule        prol-src/natded.prolog  /^pp_rule(fe):-write('\/E').$/
+pp_syn prol-src/natded.prolog  /^pp_syn(A\/B):-$/
+pp_syn_back    prol-src/natded.prolog  /^pp_syn_back(A\/B):-$/
+pp_syn_paren   prol-src/natded.prolog  /^pp_syn_paren(A\/B):-$/
+pp_tree        prol-src/natded.prolog  /^pp_tree(T):-$/
+pp_trees       prol-src/natded.prolog  /^pp_trees([T|Ts],Column):-$/
+pp_word        prol-src/natded.prolog  /^pp_word(W):-$/
+pp_word_list   prol-src/natded.prolog  /^pp_word_list([]).$/
+pp_word_list_rest      prol-src/natded.prolog  /^pp_word_list_rest([]).$/
+predicate      c-src/emacs/src/lisp.h  2307
+prev   c-src/emacs/src/gmalloc.c       165
+prev   c-src/emacs/src/gmalloc.c       189
+prev   c-src/emacs/src/lisp.h  2191
+prev   c.c     175
+printClassification    php-src/lce_functions.php       /^      function 
printClassification()$/
+print_help     c-src/etags.c   /^print_help (argument *argbuffer)$/
+print_language_names   c-src/etags.c   /^print_language_names (void)$/
+print_version  c-src/etags.c   /^print_version (void)$/
+printmax_t     c-src/emacs/src/lisp.h  148
+printmax_t     c-src/emacs/src/lisp.h  153
+proc   c-src/h.h       87
+process_file   c-src/etags.c   /^process_file (FILE *fh, char *fn, language 
*lang)$/
+process_file_name      c-src/etags.c   /^process_file_name (char *file, 
language *lang)$/
+process_pending_signals        c-src/emacs/src/keyboard.c      
/^process_pending_signals (void)$/
+process_special_events c-src/emacs/src/keyboard.c      
/^process_special_events (void)$/
+process_tool_bar_item  c-src/emacs/src/keyboard.c      /^process_tool_bar_item 
(Lisp_Object key, Lisp_Objec/
+prof   make-src/Makefile       /^prof: ETAGS$/
+prolog_atom    c-src/etags.c   /^prolog_atom (char *s, size_t pos)$/
+prolog_pr      c-src/etags.c   /^prolog_pr (char *s, char *last)$/
+prolog_skip_comment    c-src/etags.c   /^prolog_skip_comment (linebuffer *plb, 
FILE *inf)$/
+prop   c-src/etags.c   209
+protect_malloc_state   c-src/emacs/src/gmalloc.c       /^protect_malloc_state 
(int protect_p)$/
+pthread_mutexattr_setprio_ceiling/f    ada-src/2ataspri.adb    /^   function 
pthread_mutexattr_setprio_ceiling$/
+pthread_mutexattr_setprotocol/f        ada-src/2ataspri.adb    /^   function 
pthread_mutexattr_setprotocol$/
+purpose        c-src/emacs/src/lisp.h  1594
+push_kboard    c-src/emacs/src/keyboard.c      /^push_kboard (struct kboard 
*k)$/
+pushclass_above        c-src/etags.c   /^pushclass_above (int bracelev, char 
*str, int len)/
+put_entries    c-src/etags.c   /^put_entries (register node *np)$/
+pvec_type      c-src/emacs/src/lisp.h  780
+quantizing     html-src/algrthms.html  /^Quantizing the Received$/
+questo ../c/c.web      34
+quiettest      make-src/Makefile       /^quiettest:$/
+quit_char      c-src/emacs/src/keyboard.c      192
+quit_throw_to_read_char        c-src/emacs/src/keyboard.c      
/^quit_throw_to_read_char (bool from_signal)$/
+qux    ruby-src/test1.ru       /^    alias_method :qux, :tee, 
attr_accessor(:bogus)/
+qux1   ruby-src/test1.ru       /^                :qux1)$/
+qux=   ruby-src/test1.ru       /^      def qux=(tee)$/
+r0     c-src/sysdep.h  54
+r1     c-src/sysdep.h  55
+r_alloc        c-src/emacs/src/lisp.h  /^extern void *r_alloc (void **, 
size_t) ATTRIBUTE_A/
+range_exp      y-src/parse.y   269
+range_exp_list y-src/parse.y   273
+raw_keybuf     c-src/emacs/src/keyboard.c      116
+raw_keybuf_count       c-src/emacs/src/keyboard.c      117
+rbtp   c.c     240
+re_iswctype    c-src/emacs/src/regex.h 602
+re_nsub        c-src/emacs/src/regex.h 364
+re_pattern_buffer      c-src/emacs/src/regex.h 335
+re_pattern_buffer      c-src/h.h       119
+re_registers   c-src/emacs/src/regex.h 428
+re_wchar_t     c-src/emacs/src/regex.h 600
+re_wchar_t     c-src/emacs/src/regex.h 623
+re_wctype      c-src/emacs/src/regex.h 601
+re_wctype_t    c-src/emacs/src/regex.h 599
+re_wctype_t    c-src/emacs/src/regex.h 618
+re_wctype_to_bit       c-src/emacs/src/regex.h /^# define re_wctype_to_bit(cc) 
0$/
+read   cp-src/conway.hpp       /^    char read() { return alive; }$/
+read   php-src/lce_functions.php       /^      function read()$/
+read-key-sequence      c-src/emacs/src/keyboard.c      /^DEFUN 
("read-key-sequence", Fread_key_sequence, Sr/
+read-key-sequence-vector       c-src/emacs/src/keyboard.c      /^DEFUN 
("read-key-sequence-vector", Fread_key_seque/
+read1  ruby-src/test1.ru       /^    attr_reader :read1 , :read2; attr_writer 
:writ/
+read2  ruby-src/test1.ru       /^    attr_reader :read1 , :read2; attr_writer 
:writ/
+read_char      c-src/emacs/src/keyboard.c      /^read_char (int commandflag, 
Lisp_Object map,$/
+read_char_help_form_unwind     c-src/emacs/src/keyboard.c      
/^read_char_help_form_unwind (void)$/
+read_char_minibuf_menu_prompt  c-src/emacs/src/keyboard.c      
/^read_char_minibuf_menu_prompt (int commandflag,$/
+read_char_x_menu_prompt        c-src/emacs/src/keyboard.c      
/^read_char_x_menu_prompt (Lisp_Object map,$/
+read_decoded_event_from_main_queue     c-src/emacs/src/keyboard.c      
/^read_decoded_event_from_main_queue (struct timespe/
+read_event_from_main_queue     c-src/emacs/src/keyboard.c      
/^read_event_from_main_queue (struct timespec *end_t/
+read_key_sequence      c-src/emacs/src/keyboard.c      /^read_key_sequence 
(Lisp_Object *keybuf, int bufsiz/
+read_key_sequence_cmd  c-src/emacs/src/keyboard.c      232
+read_key_sequence_remapped     c-src/emacs/src/keyboard.c      233
+read_key_sequence_vs   c-src/emacs/src/keyboard.c      /^read_key_sequence_vs 
(Lisp_Object prompt, Lisp_Obj/
+read_menu_command      c-src/emacs/src/keyboard.c      /^read_menu_command 
(void)$/
+read_toc       perl-src/htlmify-cystic /^sub read_toc ()$/
+readable_events        c-src/emacs/src/keyboard.c      /^readable_events (int 
flags)$/
+readline       c-src/etags.c   /^readline (linebuffer *lbp, FILE *stream)$/
+readline_internal      c-src/etags.c   /^readline_internal (linebuffer *lbp, 
register FILE /
+realloc        c-src/emacs/src/gmalloc.c       /^realloc (void *ptr, size_t 
size)$/
+realloc        c-src/emacs/src/gmalloc.c       1716
+realloc        c-src/emacs/src/gmalloc.c       65
+realloc        c-src/emacs/src/gmalloc.c       69
+reallochook    c-src/emacs/src/gmalloc.c       /^reallochook (void *ptr, 
size_t size)$/
+recent-keys    c-src/emacs/src/keyboard.c      /^DEFUN ("recent-keys", 
Frecent_keys, Srecent_keys, /
+recent_keys    c-src/emacs/src/keyboard.c      100
+recent_keys_index      c-src/emacs/src/keyboard.c      94
+record_asynch_buffer_change    c-src/emacs/src/keyboard.c      
/^record_asynch_buffer_change (void)$/
+record_auto_save       c-src/emacs/src/keyboard.c      /^record_auto_save 
(void)$/
+record_char    c-src/emacs/src/keyboard.c      /^record_char (Lisp_Object c)$/
+record_menu_key        c-src/emacs/src/keyboard.c      /^record_menu_key 
(Lisp_Object c)$/
+record_single_kboard_state     c-src/emacs/src/keyboard.c      
/^record_single_kboard_state ()$/
+record_xmalloc c-src/emacs/src/lisp.h  /^extern void *record_xmalloc (size_t) 
ATTRIBUTE_ALL/
+recover_top_level_message      c-src/emacs/src/keyboard.c      138
+recursion-depth        c-src/emacs/src/keyboard.c      /^DEFUN 
("recursion-depth", Frecursion_depth, Srecur/
+recursive-edit c-src/emacs/src/keyboard.c      /^DEFUN ("recursive-edit", 
Frecursive_edit, Srecursi/
+recursive_edit_1       c-src/emacs/src/keyboard.c      /^recursive_edit_1 
(void)$/
+recursive_edit_unwind  c-src/emacs/src/keyboard.c      /^recursive_edit_unwind 
(Lisp_Object buffer)$/
+redirect       c-src/emacs/src/lisp.h  663
+reduce prol-src/natded.prolog  /^reduce((X^M)@N,L):-     % beta reduction$/
+reduce_subterm prol-src/natded.prolog  /^reduce_subterm(M,M2):-$/
+refreshPort    pyt-src/server.py       /^    def refreshPort(self):$/
+reg_errcode_t  c-src/emacs/src/regex.h 323
+reg_errcode_t  c.c     279
+reg_syntax_t   c-src/emacs/src/regex.h 43
+regex  c-src/etags.c   219
+regex.o        make-src/Makefile       /^regex.o: emacs\/src\/regex.c$/
+regex_t        c-src/emacs/src/regex.h 416
+regex_tag_multiline    c-src/etags.c   /^regex_tag_multiline (void)$/
+regexfile      make-src/Makefile       /^regexfile: Makefile$/
+regexp c-src/etags.c   256
+regexp c-src/etags.c   268
+registerAction objcpp-src/SimpleCalc.M /^- registerAction:(SEL)action$/
+register_heapinfo      c-src/emacs/src/gmalloc.c       /^register_heapinfo 
(void)$/
+regmatch_t     c-src/emacs/src/regex.h 451
+regoff_t       c-src/emacs/src/regex.h 423
+regs   c-src/etags.c   263
+regs   cp-src/screen.cpp       16
+regs_allocated c-src/emacs/src/regex.h 379
+regset c-src/h.h       31
+regular_top_level_message      c-src/emacs/src/keyboard.c      143
+rehash_size    c-src/emacs/src/lisp.h  1835
+rehash_threshold       c-src/emacs/src/lisp.h  1839
+relative_filename      c-src/etags.c   /^relative_filename (char *file, char 
*dir)$/
+release distrib        make-src/Makefile       /^release distrib: web$/
+removeexp      prol-src/natded.prolog  /^removeexp(E,E,'NIL'):-!.$/
+reorder_modifiers      c-src/emacs/src/keyboard.c      /^reorder_modifiers 
(Lisp_Object symbol)$/
+request        c.c     /^request request (a, b)$/
+requeued_events_pending_p      c-src/emacs/src/keyboard.c      
/^requeued_events_pending_p (void)$/
+require        merc-src/accumulator.m  /^:- import_module require.$/
+required_argument      c-src/getopt.h  90
+reset-this-command-lengths     c-src/emacs/src/keyboard.c      /^DEFUN 
("reset-this-command-lengths", Freset_this_c/
+restore_getcjmp        c-src/emacs/src/keyboard.c      /^restore_getcjmp 
(sys_jmp_buf temp)$/
+restore_kboard_configuration   c-src/emacs/src/keyboard.c      
/^restore_kboard_configuration (int was_locked)$/
+return_to_command_loop c-src/emacs/src/keyboard.c      135
+reverse        prol-src/natded.prolog  /^reverse([],Ws,Ws).$/
+revert objc-src/PackInsp.m     /^-revert:sender$/
+right  c-src/etags.c   216
+right_shift    y-src/cccp.y    /^right_shift (a, b)$/
+ring1  c.c     241
+ring2  c.c     242
+rm_eo  c-src/emacs/src/regex.h 450
+rm_so  c-src/emacs/src/regex.h 449
+rng_base       cp-src/Range.h  79
+rng_inc        cp-src/Range.h  81
+rng_limit      cp-src/Range.h  80
+rng_nelem      cp-src/Range.h  83
+rosso  cp-src/c.C      40
+rsyncfromfly   make-src/Makefile       /^rsyncfromfly:$/
+rsynctofly     make-src/Makefile       /^rsynctofly:$/
+rtint  c-src/h.h       60
+rtint  c-src/h.h       68
+rtstr  c-src/h.h       61
+rtstr  c-src/h.h       69
+rtunion_def    c-src/h.h       58
+rtunion_def    c-src/h.h       64
+rtx    c-src/h.h       62
+rtxnp  c-src/h.h       71
+rtxp   c-src/h.h       70
+s      c-src/emacs/src/lisp.h  4672
+s      c-src/emacs/src/lisp.h  4678
+s1     cp-src/c.C      32
+s2     cp-src/c.C      35
+safe_run_hook_funcall  c-src/emacs/src/keyboard.c      /^safe_run_hook_funcall 
(ptrdiff_t nargs, Lisp_Objec/
+safe_run_hooks c-src/emacs/src/keyboard.c      /^safe_run_hooks (Lisp_Object 
hook)$/
+safe_run_hooks_1       c-src/emacs/src/keyboard.c      /^safe_run_hooks_1 
(ptrdiff_t nargs, Lisp_Object *ar/
+safe_run_hooks_error   c-src/emacs/src/keyboard.c      /^safe_run_hooks_error 
(Lisp_Object error, ptrdiff_t/
+save   pyt-src/server.py       /^    def save(self):$/
+save_getcjmp   c-src/emacs/src/keyboard.c      /^save_getcjmp (sys_jmp_buf 
temp)$/
+save_type      c-src/emacs/src/lisp.h  /^save_type (struct Lisp_Save_Value *v, 
int n)$/
+savenstr       c-src/etags.c   /^savenstr (const char *cp, int len)$/
+savestr        c-src/etags.c   /^savestr (const char *cp)$/
+say    go-src/test.go  /^func say(msg string) {$/
+scan_separators        c-src/etags.c   /^scan_separators (char *name)$/
+scolonseen     c-src/etags.c   2447
+scratch        c-src/sysdep.h  56
+scroll_bar_parts       c-src/emacs/src/keyboard.c      5189
+sec=\relax     tex-src/texinfo.tex     /^\\let\\appendixsec=\\relax$/
+section        perl-src/htlmify-cystic 25
+section=\relax tex-src/texinfo.tex     /^\\let\\appendixsection=\\relax$/
+section_href   perl-src/htlmify-cystic /^sub section_href ($)$/
+section_name   perl-src/htlmify-cystic /^sub section_name ($)$/
+section_name   perl-src/htlmify-cystic 12
+section_toc    perl-src/htlmify-cystic 15
+section_url    perl-src/htlmify-cystic /^sub section_url ()$/
+section_url_base       perl-src/htlmify-cystic /^sub section_url_base ()$/
+section_url_name       perl-src/htlmify-cystic /^sub section_url_name ()$/
+select prol-src/natded.prolog  /^select(X,[X|Xs],Xs).$/
+select-tags-table      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
select-tags-table ()$/
+select-tags-table-mode el-src/emacs/lisp/progmodes/etags.el    
/^(define-derived-mode select-tags-table-mode specia/
+select-tags-table-mode-map     el-src/emacs/lisp/progmodes/etags.el    
/^(defvar select-tags-table-mode-map ; Doc string?$/
+select-tags-table-quit el-src/emacs/lisp/progmodes/etags.el    /^(defun 
select-tags-table-quit ()$/
+select-tags-table-select       el-src/emacs/lisp/progmodes/etags.el    
/^(defun select-tags-table-select (button)$/
+select_last    prol-src/natded.prolog  /^select_last([X],X,[]).$/
+send   objc-src/Subprocess.m   /^- send:(const char *)string 
withNewline:(BOOL)want/
+send   objc-src/Subprocess.m   /^- send:(const char *)string$/
+separator_names        c-src/emacs/src/keyboard.c      7372
+serializeToVars        php-src/lce_functions.php       /^      function 
serializeToVars($prefix)$/
+set    cp-src/conway.hpp       /^    void set(void) { alive = 1; }$/
+set    merc-src/accumulator.m  /^:- import_module set.$/
+set-input-interrupt-mode       c-src/emacs/src/keyboard.c      /^DEFUN 
("set-input-interrupt-mode", Fset_input_inte/
+set-input-meta-mode    c-src/emacs/src/keyboard.c      /^DEFUN 
("set-input-meta-mode", Fset_input_meta_mode/
+set-input-mode c-src/emacs/src/keyboard.c      /^DEFUN ("set-input-mode", 
Fset_input_mode, Sset_inp/
+set-output-flow-control        c-src/emacs/src/keyboard.c      /^DEFUN 
("set-output-flow-control", Fset_output_flow/
+set-quit-char  c-src/emacs/src/keyboard.c      /^DEFUN ("set-quit-char", 
Fset_quit_char, Sset_quit_/
+setDate        cp-src/functions.cpp    /^void Date::setDate ( int d , int m , 
int y ){$/
+setDelegate    objc-src/Subprocess.m   /^- setDelegate:anObject$/
+setRevertButtonTitle   objc-src/PackInsp.m     /^-setRevertButtonTitle$/
+set_base       cp-src/Range.h  /^  void set_base (double b) { rng_base = b;  
}$/
+set_char_table_contents        c-src/emacs/src/lisp.h  
/^set_char_table_contents (Lisp_Object table, ptrdif/
+set_char_table_defalt  c-src/emacs/src/lisp.h  /^set_char_table_defalt 
(Lisp_Object table, Lisp_Obj/
+set_char_table_extras  c-src/emacs/src/lisp.h  /^set_char_table_extras 
(Lisp_Object table, ptrdiff_/
+set_char_table_purpose c-src/emacs/src/lisp.h  /^set_char_table_purpose 
(Lisp_Object table, Lisp_Ob/
+set_hash_key_slot      c-src/emacs/src/lisp.h  /^set_hash_key_slot (struct 
Lisp_Hash_Table *h, ptrd/
+set_hash_value_slot    c-src/emacs/src/lisp.h  /^set_hash_value_slot (struct 
Lisp_Hash_Table *h, pt/
+set_inc        cp-src/Range.h  /^  void set_inc (double i) { rng_inc = i;   }$/
+set_limit      cp-src/Range.h  /^  void set_limit (double l) { rng_limit = l; 
}$/
+set_overlay_plist      c-src/emacs/src/lisp.h  /^set_overlay_plist 
(Lisp_Object overlay, Lisp_Objec/
+set_poll_suppress_count        c-src/emacs/src/keyboard.c      
/^set_poll_suppress_count (int count)$/
+set_prop       c-src/emacs/src/keyboard.c      /^set_prop (ptrdiff_t idx, 
Lisp_Object val)$/
+set_save_integer       c-src/emacs/src/lisp.h  /^set_save_integer (Lisp_Object 
obj, int n, ptrdiff_/
+set_save_pointer       c-src/emacs/src/lisp.h  /^set_save_pointer (Lisp_Object 
obj, int n, void *va/
+set_string_intervals   c-src/emacs/src/lisp.h  /^set_string_intervals 
(Lisp_Object s, INTERVAL i)$/
+set_sub_char_table_contents    c-src/emacs/src/lisp.h  
/^set_sub_char_table_contents (Lisp_Object table, pt/
+set_symbol_function    c-src/emacs/src/lisp.h  /^set_symbol_function 
(Lisp_Object sym, Lisp_Object /
+set_symbol_next        c-src/emacs/src/lisp.h  /^set_symbol_next (Lisp_Object 
sym, struct Lisp_Symb/
+set_symbol_plist       c-src/emacs/src/lisp.h  /^set_symbol_plist (Lisp_Object 
sym, Lisp_Object pli/
+set_upto       merc-src/accumulator.m  /^:- func set_upto(accu_case, int) = 
set(accu_goal_i/
+set_waiting_for_input  c-src/emacs/src/keyboard.c      /^set_waiting_for_input 
(struct timespec *time_to_cl/
+setref tex-src/texinfo.tex     
/^\\expandafter\\expandafter\\expandafter\\appendixsetre/
+setup  cp-src/c.C      5
+shift  cp-src/functions.cpp    /^void Date::shift ( void ){\/\/Shift this date 
to pre/
+shouldLoad     objc-src/PackInsp.m     /^-(BOOL)shouldLoad$/
+should_attempt_accu_transform  merc-src/accumulator.m  /^:- pred 
should_attempt_accu_transform(module_info:/
+should_attempt_accu_transform_2        merc-src/accumulator.m  /^:- pred 
should_attempt_accu_transform_2(module_inf/
+should_see_this_array_type     cp-src/c.C      156
+should_see_this_function_pointer       cp-src/c.C      153
+should_see_this_one_enclosed_in_extern_C       cp-src/c.C      149
+show   erl-src/gs_dialog.erl   /^show(Module, Title, Message, Args) ->$/
+showError      objc-src/Subprocess.m   /^showError (const char *errorString, 
id theDelegate/
+showInfo       objc-src/PackInsp.m     /^-showInfo:sender$/
+show_help_echo c-src/emacs/src/keyboard.c      /^show_help_echo (Lisp_Object 
help, Lisp_Object wind/
+sig    c-src/emacs/src/keyboard.c      7238
+signal_handler c-src/h.h       82
+signal_handler1        c-src/h.h       83
+signal_handler_t       c-src/h.h       94
+simulation     html-src/software.html  /^Software that I wrote for supporting 
my research a/
+single_kboard  c-src/emacs/src/keyboard.c      89
+single_kboard_state    c-src/emacs/src/keyboard.c      /^single_kboard_state 
()$/
+site   cp-src/conway.hpp       /^    site(int xi, int yi): x(xi), y(yi), 
alive(0) {/
+site   cp-src/conway.hpp       5
+size   c-src/emacs/src/gmalloc.c       156
+size   c-src/emacs/src/gmalloc.c       163
+size   c-src/emacs/src/gmalloc.c       1862
+size   c-src/emacs/src/lisp.h  1364
+size   c-src/emacs/src/lisp.h  1390
+size   c-src/etags.c   236
+size   c-src/etags.c   2522
+skeyseen       c-src/etags.c   2445
+skip_name      c-src/etags.c   /^skip_name (char *cp)$/
+skip_non_spaces        c-src/etags.c   /^skip_non_spaces (char *cp)$/
+skip_spaces    c-src/etags.c   /^skip_spaces (char *cp)$/
+snarf-tag-function     el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
snarf-tag-function nil$/
+snone  c-src/etags.c   2443
+solutions      merc-src/accumulator.m  /^:- import_module solutions.$/
+some_mouse_moved       c-src/emacs/src/keyboard.c      /^some_mouse_moved 
(void)$/
+space  tex-src/texinfo.tex     /^    {#2\\labelspace 
#1}\\dotfill\\doshortpageno{#3}}%/
+space  tex-src/texinfo.tex     /^  
\\dosubsubsecentry{#2.#3.#4.#5\\labelspace#1}{#6}}/
+spacer c-src/emacs/src/lisp.h  1975
+spacer c-src/emacs/src/lisp.h  1982
+spacer c-src/emacs/src/lisp.h  2036
+spacer c-src/emacs/src/lisp.h  2205
+specbind_tag   c-src/emacs/src/lisp.h  2943
+specbinding    c-src/emacs/src/lisp.h  2955
+specialsymbol  prol-src/natded.prolog  /^specialsymbol(C1,C2,S):-$/
+splitexp       prol-src/natded.prolog  /^splitexp(E,E,('NIL','NIL')):-!.$/
+srclist        make-src/Makefile       /^srclist: Makefile$/
+ss3    c.c     255
+sss1   c.c     252
+sss2   c.c     253
+sstab  prol-src/natded.prolog  /^sstab(2,'C',',').$/
+st_C_attribute c-src/etags.c   2209
+st_C_class     c-src/etags.c   2212
+st_C_define    c-src/etags.c   2213
+st_C_enum      c-src/etags.c   2213
+st_C_extern    c-src/etags.c   2213
+st_C_gnumacro  c-src/etags.c   2208
+st_C_ignore    c-src/etags.c   2209
+st_C_javastruct        c-src/etags.c   2210
+st_C_objend    c-src/etags.c   2207
+st_C_objimpl   c-src/etags.c   2207
+st_C_objprot   c-src/etags.c   2207
+st_C_operator  c-src/etags.c   2211
+st_C_struct    c-src/etags.c   2213
+st_C_template  c-src/etags.c   2212
+st_C_typedef   c-src/etags.c   2213
+st_none        c-src/etags.c   2206
+stack  c.c     155
+stagseen       c-src/etags.c   2446
+standalone     make-src/Makefile       /^standalone:$/
+start  c-src/emacs/src/keyboard.c      8753
+start  c-src/emacs/src/lisp.h  2038
+start  c-src/emacs/src/regex.h 431
+start  php-src/lce_functions.php       /^      function start($line, $class)$/
+start  y-src/cccp.y    143
+start_polling  c-src/emacs/src/keyboard.c      /^start_polling (void)$/
+start_up       prol-src/natded.prolog  /^start_up:-$/
+state_protected_p      c-src/emacs/src/gmalloc.c       400
+statetable     html-src/algrthms.html  /^Next$/
+staticetags    make-src/Makefile       /^staticetags:$/
+step   cp-src/clheir.hpp       /^    virtual void step(void) { }$/
+step   cp-src/conway.hpp       /^    void step(void) { alive = next_alive; }$/
+step_everybody cp-src/clheir.cpp       /^void step_everybody(void)$/
+stop_polling   c-src/emacs/src/keyboard.c      /^stop_polling (void)$/
+store_info     merc-src/accumulator.m  /^:- type store_info$/
+store_user_signal_events       c-src/emacs/src/keyboard.c      
/^store_user_signal_events (void)$/
+stored_goal_plain_call merc-src/accumulator.m  /^:- inst 
stored_goal_plain_call for goal_store.stor/
+str    go-src/test1.go 9
+strcaseeq      c-src/etags.c   /^#define strcaseeq(s,t)        (assert 
((s)!=NULL && (t)!=/
+streq  c-src/etags.c   /^#define streq(s,t)    (assert ((s)!=NULL || (t)!=NULL/
+string merc-src/accumulator.m  /^:- import_module string.$/
+string_intervals       c-src/emacs/src/lisp.h  /^string_intervals (Lisp_Object 
s)$/
+stripLine      php-src/lce_functions.php       /^      function 
stripLine($line, $class)$/
+stripname      pas-src/common.pas      /^function stripname; (* ($/
+strncaseeq     c-src/etags.c   /^#define strncaseeq(s,t,n) (assert ((s)!=NULL 
&& (t/
+strneq c-src/etags.c   /^#define strneq(s,t,n) (assert ((s)!=NULL || (t)!=N/
+structdef      c-src/etags.c   2448
+stuff_buffered_input   c-src/emacs/src/keyboard.c      /^stuff_buffered_input 
(Lisp_Object stuffstring)$/
+subprocess     objc-src/PackInsp.m     /^-subprocess:(Subprocess *)sender 
output:(char *)bu/
+subprocessDone objc-src/PackInsp.m     /^-subprocessDone:(Subprocess *)sender$/
+subsec=\relax  tex-src/texinfo.tex     /^\\let\\appendixsubsec=\\relax$/
+subsection     perl-src/htlmify-cystic 26
+subsection=\relax      tex-src/texinfo.tex     
/^\\let\\appendixsubsection=\\relax$/
+subsection_marker      perl-src/htlmify-cystic 161
+subst  prol-src/natded.prolog  /^subst(var(Y),var(X),M,N):-$/
+substitute     c-src/etags.c   /^substitute (char *in, char *out, struct 
re_registe/
+subsubsec=\relax       tex-src/texinfo.tex     
/^\\let\\appendixsubsubsec=\\relax$/
+subsubsection  perl-src/htlmify-cystic 27
+subsubsection=\relax   tex-src/texinfo.tex     
/^\\let\\appendixsubsubsection=\\relax$/
+subtle ruby-src/test1.ru       /^                 :tee ; attr_reader :subtle$/
+subtree        prol-src/natded.prolog  /^subtree(T,T).$/
+suffix c-src/etags.c   186
+suffixes       c-src/etags.c   195
+suggest_asking_for_help        c-src/etags.c   /^suggest_asking_for_help 
(void)$/
+suspend-emacs  c-src/emacs/src/keyboard.c      /^DEFUN ("suspend-emacs", 
Fsuspend_emacs, Ssuspend_e/
+sval   y-src/cccp.y    116
+swallow_events c-src/emacs/src/keyboard.c      /^swallow_events (bool 
do_display)$/
+switch_line_buffers    c-src/etags.c   /^#define switch_line_buffers() (curndx 
= 1 - curndx/
+sxhash_combine c-src/emacs/src/lisp.h  /^sxhash_combine (EMACS_UINT x, 
EMACS_UINT y)$/
+sym_type       c-src/etags.c   2204
+symbol c-src/emacs/src/lisp.h  2980
+symbol_interned        c-src/emacs/src/lisp.h  639
+symbol_name    c-src/emacs/src/lisp.h  1687
+symbol_redirect        c-src/emacs/src/lisp.h  646
+syms_of_abbrev c-src/abbrev.c  /^syms_of_abbrev ()$/
+syms_of_keyboard       c-src/emacs/src/keyboard.c      /^syms_of_keyboard 
(void)$/
+synchronize_system_messages_locale     c-src/emacs/src/lisp.h  /^INLINE void 
synchronize_system_messages_locale (vo/
+synchronize_system_time_locale c-src/emacs/src/lisp.h  /^INLINE void 
synchronize_system_time_locale (void) /
+syntax c-src/emacs/src/regex.h 350
+sys_jmp_buf    c-src/emacs/src/lisp.h  2906
+sys_jmp_buf    c-src/emacs/src/lisp.h  2910
+sys_jmp_buf    c-src/emacs/src/lisp.h  2916
+sys_longjmp    c-src/emacs/src/lisp.h  /^# define sys_longjmp(j, v) _longjmp 
(j, v)$/
+sys_longjmp    c-src/emacs/src/lisp.h  /^# define sys_longjmp(j, v) longjmp 
(j, v)$/
+sys_longjmp    c-src/emacs/src/lisp.h  /^# define sys_longjmp(j, v) siglongjmp 
(j, v)$/
+sys_setjmp     c-src/emacs/src/lisp.h  /^# define sys_setjmp(j) _setjmp (j)$/
+sys_setjmp     c-src/emacs/src/lisp.h  /^# define sys_setjmp(j) setjmp (j)$/
+sys_setjmp     c-src/emacs/src/lisp.h  /^# define sys_setjmp(j) sigsetjmp (j, 
0)$/
+syscall_error  c-src/sysdep.h  34
+t      cp-src/c.C      52
+t1     cp-src/c.C      34
+t2     cp-src/c.C      38
+tab_count_words        c-src/tab.c     /^int                   
tab_count_words(char **tab)$/
+tab_delete_first       c-src/tab.c     /^int                   
tab_delete_first(char **tab)$/
+tab_fill       c-src/tab.c     /^char                  **tab_fill(char *str, 
char delim)$/
+tab_free       c-src/tab.c     /^void                  tab_free(char **tab)$/
+tag-any-match-p        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-any-match-p (_tag)$/
+tag-exact-file-name-match-p    el-src/emacs/lisp/progmodes/etags.el    
/^(defun tag-exact-file-name-match-p (tag)$/
+tag-exact-match-p      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-exact-match-p (tag)$/
+tag-file-name-match-p  el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-file-name-match-p (tag)$/
+tag-find-file-of-tag   el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-find-file-of-tag (file) ; Doc string?$/
+tag-find-file-of-tag-noselect  el-src/emacs/lisp/progmodes/etags.el    
/^(defun tag-find-file-of-tag-noselect (file)$/
+tag-implicit-name-match-p      el-src/emacs/lisp/progmodes/etags.el    
/^(defun tag-implicit-name-match-p (tag)$/
+tag-lines-already-matched      el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tag-lines-already-matched nil$/
+tag-partial-file-name-match-p  el-src/emacs/lisp/progmodes/etags.el    
/^(defun tag-partial-file-name-match-p (_tag)$/
+tag-re-match-p el-src/emacs/lisp/progmodes/etags.el    /^(defun tag-re-match-p 
(re)$/
+tag-symbol-match-p     el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-symbol-match-p (tag)$/
+tag-word-match-p       el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tag-word-match-p (tag)$/
+tag1   c-src/dostorture.c      /^(*tag1 (sig, handler)) ()$/
+tag1   c-src/h.h       110
+tag1   c-src/torture.c /^(*tag1 (sig, handler)) ()$/
+tag2   c-src/dostorture.c      /^(*tag2 (sig, handler)) ()$/
+tag2   c-src/torture.c /^(*tag2 (sig, handler)) ()$/
+tag3   c-src/dostorture.c      /^(*tag3 (int sig, void (*handler) (int))) 
(int)$/
+tag3   c-src/torture.c /^(*tag3 (int sig, void (*handler) (int))) (int)$/
+tag4   c-src/dostorture.c      /^(*tag4 (int sig, void (*handler) (int))) 
(int)$/
+tag4   c-src/torture.c /^(*tag4 (int sig, void (*handler) (int))) (int)$/
+tag5   c-src/dostorture.c      /^tag5 (handler, arg)$/
+tag5   c-src/torture.c /^tag5 (handler, arg)$/
+tag6   c-src/dostorture.c      /^tag6 (void (*handler) (void *), void *arg)$/
+tag6   c-src/torture.c /^tag6 (void (*handler) (void *), void *arg)$/
+tag_or_ch      c-src/emacs/src/lisp.h  3026
+taggedfname    c-src/etags.c   207
+tags   make-src/Makefile       /^tags: TAGS$/
+tags-add-tables        el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
tags-add-tables 'ask-user$/
+tags-apropos   el-src/emacs/lisp/progmodes/etags.el    /^(defun tags-apropos 
(regexp)$/
+tags-apropos-additional-actions        el-src/emacs/lisp/progmodes/etags.el    
/^(defcustom tags-apropos-additional-actions nil$/
+tags-apropos-function  el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-apropos-function nil$/
+tags-apropos-verbose   el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
tags-apropos-verbose nil$/
+tags-case-fold-search  el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
tags-case-fold-search 'default$/
+tags-complete-tags-table-file  el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-complete-tags-table-file (string predi/
+tags-completion-at-point-function      el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-completion-at-point-function ()$/
+tags-completion-table  el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-completion-table ()$/
+tags-completion-table  el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-completion-table nil$/
+tags-completion-table-function el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-completion-table-function nil$/
+tags-compression-info-list     el-src/emacs/lisp/progmodes/etags.el    
/^(defcustom tags-compression-info-list$/
+tags-expand-table-name el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-expand-table-name (file)$/
+tags-file-name el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-file-name nil$/
+tags-included-tables   el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-included-tables ()$/
+tags-included-tables   el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-included-tables nil$/
+tags-included-tables-function  el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-included-tables-function nil$/
+tags-lazy-completion-table     el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-lazy-completion-table ()$/
+tags-location-ring     el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-location-ring (make-ring xref-marker-/
+tags-loop-continue     el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-loop-continue (&optional first-time)$/
+tags-loop-eval el-src/emacs/lisp/progmodes/etags.el    /^(defun tags-loop-eval 
(form)$/
+tags-loop-operate      el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-loop-operate nil$/
+tags-loop-revert-buffers       el-src/emacs/lisp/progmodes/etags.el    
/^(defcustom tags-loop-revert-buffers nil$/
+tags-loop-scan el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-loop-scan$/
+tags-next-table        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-next-table ()$/
+tags-query-replace     el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-query-replace (from to &optional delim/
+tags-recognize-empty-tags-table        el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-recognize-empty-tags-table ()$/
+tags-reset-tags-tables el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-reset-tags-tables ()$/
+tags-revert-without-query      el-src/emacs/lisp/progmodes/etags.el    
/^(defcustom tags-revert-without-query nil$/
+tags-search    el-src/emacs/lisp/progmodes/etags.el    /^(defun tags-search 
(regexp &optional file-list-for/
+tags-select-tags-table el-src/emacs/lisp/progmodes/etags.el    
/^(define-button-type 'tags-select-tags-table$/
+tags-table-check-computed-list el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-table-check-computed-list ()$/
+tags-table-computed-list       el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-computed-list nil$/
+tags-table-computed-list-for   el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-computed-list-for nil$/
+tags-table-extend-computed-list        el-src/emacs/lisp/progmodes/etags.el    
/^(defun tags-table-extend-computed-list ()$/
+tags-table-files       el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-table-files ()$/
+tags-table-files       el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-table-files nil$/
+tags-table-files-function      el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-files-function nil$/
+tags-table-format-functions    el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-format-functions '(etags-recogn/
+tags-table-including   el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-table-including (this-file core-only)$/
+tags-table-list        el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
tags-table-list nil$/
+tags-table-list-member el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-table-list-member (file list)$/
+tags-table-list-pointer        el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-list-pointer nil$/
+tags-table-list-started-at     el-src/emacs/lisp/progmodes/etags.el    
/^(defvar tags-table-list-started-at nil$/
+tags-table-mode        el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-table-mode ()$/
+tags-table-set-list    el-src/emacs/lisp/progmodes/etags.el    /^(defvar 
tags-table-set-list nil$/
+tags-tag-face  el-src/emacs/lisp/progmodes/etags.el    /^(defcustom 
tags-tag-face 'default$/
+tags-verify-table      el-src/emacs/lisp/progmodes/etags.el    /^(defun 
tags-verify-table (file)$/
+tags-with-face el-src/emacs/lisp/progmodes/etags.el    /^(defmacro 
tags-with-face (face &rest body)$/
+target_multibyte       c-src/emacs/src/regex.h 407
+tcpdump        html-src/software.html  /^tcpdump$/
+teats  cp-src/c.C      127
+tee    ruby-src/test1.ru       /^    attr_accessor :tee$/
+tee=   ruby-src/test1.ru       /^    attr_accessor :tee$/
+temporarily_switch_to_single_kboard    c-src/emacs/src/keyboard.c      
/^temporarily_switch_to_single_kboard (struct frame /
+tend   c-src/etags.c   2432
+term   merc-src/accumulator.m  /^:- import_module term.$/
+terminate      objc-src/Subprocess.m   /^- terminate:sender$/
+terminateInput objc-src/Subprocess.m   /^- terminateInput$/
+test   c-src/emacs/src/lisp.h  1871
+test   cp-src/c.C      86
+test   erl-src/gs_dialog.erl   /^test() ->$/
+test   go-src/test1.go /^func test(p plus) {$/
+test   make-src/Makefile       /^test:$/
+test   php-src/ptest.php       /^test $/
+test-begin     scm-src/test.scm        /^(define-syntax test-begin$/
+test.me22b     lua-src/test.lua        /^   local function test.me22b (one)$/
+test.me_22a    lua-src/test.lua        /^   function test.me_22a(one, two)$/
+test1  rs-src/test.rs  /^fn test1() {$/
+test_undefined c-src/emacs/src/keyboard.c      /^test_undefined (Lisp_Object 
binding)$/
+texttreelist   prol-src/natded.prolog  /^texttreelist([]).$/
+there-is-a-=-in-the-middle!    scm-src/test.scm        /^(define 
(there-is-a-=-in-the-middle!) #t)$/
+this   c-src/a/b/b.c   1
+this-command-keys      c-src/emacs/src/keyboard.c      /^DEFUN 
("this-command-keys", Fthis_command_keys, St/
+this-command-keys-vector       c-src/emacs/src/keyboard.c      /^DEFUN 
("this-command-keys-vector", Fthis_command_k/
+this-single-command-keys       c-src/emacs/src/keyboard.c      /^DEFUN 
("this-single-command-keys", Fthis_single_co/
+this-single-command-raw-keys   c-src/emacs/src/keyboard.c      /^DEFUN 
("this-single-command-raw-keys", Fthis_singl/
+this_command_key_count c-src/emacs/src/keyboard.c      108
+this_command_key_count_reset   c-src/emacs/src/keyboard.c      112
+this_command_keys      c-src/emacs/src/keyboard.c      107
+this_file_toc  perl-src/htlmify-cystic 29
+this_single_command_key_start  c-src/emacs/src/keyboard.c      125
+tignore        c-src/etags.c   2433
+timer_check    c-src/emacs/src/keyboard.c      /^timer_check (void)$/
+timer_check_2  c-src/emacs/src/keyboard.c      /^timer_check_2 (Lisp_Object 
timers, Lisp_Object idl/
+timer_idleness_start_time      c-src/emacs/src/keyboard.c      335
+timer_last_idleness_start_time c-src/emacs/src/keyboard.c      340
+timer_resume_idle      c-src/emacs/src/keyboard.c      /^timer_resume_idle 
(void)$/
+timer_start_idle       c-src/emacs/src/keyboard.c      /^timer_start_idle 
(void)$/
+timer_stop_idle        c-src/emacs/src/keyboard.c      /^timer_stop_idle 
(void)$/
+timers_run     c-src/emacs/src/keyboard.c      320
+tinbody        c-src/etags.c   2431
+tkeyseen       c-src/etags.c   2429
+tnone  c-src/etags.c   2428
+toc_line       perl-src/htlmify-cystic /^sub toc_line ($)$/
+toggleDescription      objc-src/PackInsp.m     /^-toggleDescription$/
+tok    c-src/etags.c   2491
+token  c-src/etags.c   2508
+token  y-src/cccp.y    437
+token  y-src/cccp.y    439
+tokenize       prol-src/natded.prolog  
/^tokenize([C1,C2,C3|Cs],Xs-Ys,TsResult):-     % spe/
+tokenizeatom   prol-src/natded.prolog  /^tokenizeatom(Atom,Ws):-$/
+tokentab2      y-src/cccp.y    442
+tool_bar_item_properties       c-src/emacs/src/keyboard.c      7970
+tool_bar_items c-src/emacs/src/keyboard.c      /^tool_bar_items (Lisp_Object 
reuse, int *nitems)$/
+tool_bar_items_vector  c-src/emacs/src/keyboard.c      7965
+toolkit_menubar_in_use c-src/emacs/src/keyboard.c      
/^toolkit_menubar_in_use (struct frame *f)$/
+top-level      c-src/emacs/src/keyboard.c      /^DEFUN ("top-level", 
Ftop_level, Stop_level, 0, 0, /
+top_level      merc-src/accumulator.m  /^:- type top_level$/
+top_level_1    c-src/emacs/src/keyboard.c      /^top_level_1 (Lisp_Object 
ignore)$/
+top_level_2    c-src/emacs/src/keyboard.c      /^top_level_2 (void)$/
+total_keys     c-src/emacs/src/keyboard.c      97
+total_size_of_entries  c-src/etags.c   /^total_size_of_entries (register node 
*np)$/
+total_surrounding      cp-src/conway.cpp       /^int 
site::total_surrounding(void)$/
+totally_unblock_input  c-src/emacs/src/keyboard.c      /^totally_unblock_input 
(void)$/
+tpcmd  c-src/h.h       15
+tpcmd  c-src/h.h       8
+track-mouse    c-src/emacs/src/keyboard.c      /^DEFUN 
("internal--track-mouse", Ftrack_mouse, Stra/
+tracking_off   c-src/emacs/src/keyboard.c      /^tracking_off (Lisp_Object 
old_value)$/
+traffic_light  cp-src/conway.cpp       /^void traffic_light(int x, int y)$/
+translate      c-src/emacs/src/regex.h 361
+treats cp-src/c.C      131
+tt     prol-src/natded.prolog  /^tt:-$/
+tt=cmtt10      tex-src/texinfo.tex     /^\\font\\deftt=cmtt10 scaled 
\\magstep1$/
+tty_read_avail_input   c-src/emacs/src/keyboard.c      /^tty_read_avail_input 
(struct terminal *terminal,$/
+ttypeseen      c-src/etags.c   2430
+typdef c-src/etags.c   2434
+type   c-src/emacs/src/gmalloc.c       145
+type   c-src/emacs/src/lisp.h  1973
+type   c-src/emacs/src/lisp.h  1980
+type   c-src/emacs/src/lisp.h  2034
+type   c-src/emacs/src/lisp.h  2112
+type   c-src/emacs/src/lisp.h  2203
+type   c-src/emacs/src/lisp.h  2276
+type   c-src/emacs/src/lisp.h  2286
+type   c-src/emacs/src/lisp.h  2296
+type   c-src/emacs/src/lisp.h  2304
+type   c-src/emacs/src/lisp.h  2364
+type   c-src/emacs/src/lisp.h  3025
+type   c-src/etags.c   2271
+typefunargs    tex-src/texinfo.tex     /^\\deftypefunargs {#3}\\endgroup %$/
+typefunargs    tex-src/texinfo.tex     /^\\deftypefunargs {#4}\\endgroup %$/
+typemargin     tex-src/texinfo.tex     /^\\newskip\\deftypemargin 
\\deftypemargin=12pt$/
+typemargin     tex-src/texinfo.tex     /^\\rlap{\\rightline{{\\rm #2}\\hskip 
\\deftypemargin}}}%/
+u      c-src/emacs/src/lisp.h  2397
+u_any  c-src/emacs/src/lisp.h  2214
+u_boolfwd      c-src/emacs/src/lisp.h  2371
+u_buffer_objfwd        c-src/emacs/src/lisp.h  2373
+u_finalizer    c-src/emacs/src/lisp.h  2219
+u_free c-src/emacs/src/lisp.h  2215
+u_intfwd       c-src/emacs/src/lisp.h  2370
+u_kboard_objfwd        c-src/emacs/src/lisp.h  2374
+u_marker       c-src/emacs/src/lisp.h  2216
+u_objfwd       c-src/emacs/src/lisp.h  2372
+u_overlay      c-src/emacs/src/lisp.h  2217
+u_save_value   c-src/emacs/src/lisp.h  2218
+unargs tex-src/texinfo.tex     /^\\defunargs {#2}\\endgroup %$/
+unargs tex-src/texinfo.tex     /^\\defunargs {#3}\\endgroup %$/
+unblock_input  c-src/emacs/src/keyboard.c      /^unblock_input (void)$/
+unblock_input_to       c-src/emacs/src/keyboard.c      /^unblock_input_to (int 
level)$/
+unchar c-src/h.h       99
+unexpand-abbrev        c-src/abbrev.c  /^DEFUN ("unexpand-abbrev", 
Funexpand_abbrev, Sunexp/
+univ   merc-src/accumulator.m  /^:- import_module univ.$/
+unravel_univ   merc-src/accumulator.m  /^:- some [T] pred 
unravel_univ(univ::in, T::out) is/
+unread_switch_frame    c-src/emacs/src/keyboard.c      204
+unsignedp      y-src/cccp.y    112
+unwind c-src/emacs/src/lisp.h  2962
+unwind_int     c-src/emacs/src/lisp.h  2972
+unwind_ptr     c-src/emacs/src/lisp.h  2967
+unwind_void    c-src/emacs/src/lisp.h  2976
+update_accumulator_pred        merc-src/accumulator.m  /^:- pred 
update_accumulator_pred(pred_id::in, proc_/
+uprintmax_t    c-src/emacs/src/lisp.h  149
+uprintmax_t    c-src/emacs/src/lisp.h  154
+usage  perl-src/yagrip.pl      /^sub usage {$/
+usecharno      c-src/etags.c   210
+used   c-src/emacs/src/regex.h 347
+used_syntax    c-src/emacs/src/regex.h 398
+user_cmp_function      c-src/emacs/src/lisp.h  1814
+user_error     c-src/emacs/src/keyboard.c      /^user_error (const char *msg)$/
+user_hash_function     c-src/emacs/src/lisp.h  1811
+user_signal_info       c-src/emacs/src/keyboard.c      7235
+user_signals   c-src/emacs/src/keyboard.c      7250
+usfreelock_ptr/t       ada-src/etags-test-for.ada      /^   type 
usfreelock_ptr is access$/
+val    c-src/emacs/src/lisp.h  3027
+val    c-src/emacs/src/lisp.h  691
+val    c-src/getopt.h  84
+val    prol-src/natded.prolog  /^val(X) --> ['['], valseq(X), [']'].$/
+valcell        c-src/emacs/src/lisp.h  2357
+valid  c-src/etags.c   220
+valid  c-src/etags.c   2502
+validate       php-src/lce_functions.php       /^      function 
validate($value)$/
+valloc c-src/emacs/src/gmalloc.c       /^valloc (size_t size)$/
+valseq prol-src/natded.prolog  /^valseq([Val|Vals]) --> val(Val), 
plusvalseq(Vals)./
+value  c-src/emacs/src/lisp.h  687
+value  y-src/cccp.y    112
+var    c-src/emacs/src/keyboard.c      11023
+var    c-src/emacs/src/lisp.h  3137
+varargs        tex-src/texinfo.tex     /^\\defvarargs {#2}\\endgroup %$/
+varargs        tex-src/texinfo.tex     /^\\defvarargs {#3}\\endgroup %$/
+varset merc-src/accumulator.m  /^:- import_module varset.$/
+vcopy  c-src/emacs/src/lisp.h  /^vcopy (Lisp_Object v, ptrdiff_t offset, 
Lisp_Objec/
+vectorlike_header      c-src/emacs/src/lisp.h  1343
+verde  cp-src/c.C      40
+verify-tags-table-function     el-src/emacs/lisp/progmodes/etags.el    
/^(defvar verify-tags-table-function nil$/
+verify_ascii   c-src/emacs/src/lisp.h  /^# define verify_ascii(str) (str)$/
+vignore        c-src/etags.c   2417
+visit-tags-table       el-src/emacs/lisp/progmodes/etags.el    /^(defun 
visit-tags-table (file &optional local)$/
+visit-tags-table-buffer        el-src/emacs/lisp/progmodes/etags.el    
/^(defun visit-tags-table-buffer (&optional cont)$/
+void   c-src/emacs/src/lisp.h  /^INLINE void (check_cons_list) (void) { 
lisp_h_chec/
+voidfuncptr    c-src/emacs/src/lisp.h  2108
+voidval        y-src/cccp.y    115
+wait_status_ptr_t      c.c     161
+waiting_for_input      c-src/emacs/src/keyboard.c      150
+warning        y-src/cccp.y    /^warning (msg)$/
+weak   c-src/emacs/src/lisp.h  1830
+weak_alias     c-src/emacs/src/gmalloc.c       /^weak_alias (free, cfree)$/
+web ftp publish        make-src/Makefile       /^web ftp publish:$/
+what   c-src/etags.c   252
+wheel_syms     c-src/emacs/src/keyboard.c      4628
+where  c-src/emacs/src/lisp.h  2348
+where  c-src/emacs/src/lisp.h  2980
+where  cp-src/clheir.hpp       77
+where_in_registry      cp-src/clheir.hpp       15
+windowWillClose        objcpp-src/SimpleCalc.M /^- windowWillClose:sender$/
+wipe_kboard    c-src/emacs/src/keyboard.c      /^wipe_kboard (KBOARD *kb)$/
+womboid        c-src/h.h       63
+womboid        c-src/h.h       75
+word_size      c-src/emacs/src/lisp.h  1473
+write  php-src/lce_functions.php       /^      function write($save="yes")$/
+write  php-src/lce_functions.php       /^      function write()$/
+write1=        ruby-src/test1.ru       /^    attr_reader :read1 , :read2; 
attr_writer :writ/
+write2=        ruby-src/test1.ru       /^    attr_reader :read1 , :read2; 
attr_writer :writ/
+write_abbrev   c-src/abbrev.c  /^write_abbrev (sym, stream)$/
+write_classname        c-src/etags.c   /^write_classname (linebuffer *cn, 
const char *quali/
+write_lex      prol-src/natded.prolog  /^write_lex(File):-$/
+write_lex_cat  prol-src/natded.prolog  /^write_lex_cat(File):-$/
+write_xyc      cp-src/screen.cpp       /^void write_xyc(int x, int y, char c)$/
+writebreak     prol-src/natded.prolog  /^writebreak([]).$/
+writebreaklex  prol-src/natded.prolog  /^writebreaklex([]).$/
+writecat       prol-src/natded.prolog  
/^writecat(np(ind(sng),nm(_)),np,[],[]):-!.$/
+writelist      prol-src/natded.prolog  /^writelist([der(Ws)|Ws2]):-$/
+writelistsubs  prol-src/natded.prolog  /^writelistsubs([],X):-$/
+writenamestring        pas-src/common.pas      /^procedure 
writenamestring;(*($/
+writesubs      prol-src/natded.prolog  /^writesubs([]).$/
+writesups      prol-src/natded.prolog  /^writesups([]).$/
+written        c-src/etags.c   211
+x      c.c     153
+x      c.c     179
+x      c.c     188
+x      c.c     189
+x      cp-src/c.C      53
+x      cp-src/c.C      80
+x      cp-src/clheir.hpp       49
+x      cp-src/clheir.hpp       58
+x      cp-src/conway.hpp       7
+x      cp-src/fail.C   10
+x      cp-src/fail.C   44
+x      tex-src/texinfo.tex     /^\\refx{#1-snt}{} [\\printednodename], 
page\\tie\\refx{/
+x-get-selection-internal       c.c     /^       Fx_get_selection_internal, 
Sx_get_selection/
+x-get-selection-internal       c.c     /^DEFUN ("x-get-selection-internal", 
Fx_get_selectio/
+xcar_addr      c-src/emacs/src/lisp.h  /^xcar_addr (Lisp_Object c)$/
+xcdr_addr      c-src/emacs/src/lisp.h  /^xcdr_addr (Lisp_Object c)$/
+xdiff  make-src/Makefile       /^xdiff: ETAGS EXTAGS ${infiles}$/
+xmalloc        c-src/etags.c   /^xmalloc (size_t size)$/
+xnew   c-src/etags.c   /^#define xnew(n, Type)      ((Type *) xmalloc ((n) /
+xrealloc       c-src/etags.c   /^xrealloc (void *ptr, size_t size)$/
+xref-etags-location    el-src/emacs/lisp/progmodes/etags.el    /^(defclass 
xref-etags-location (xref-location)$/
+xref-location-line     el-src/emacs/lisp/progmodes/etags.el    /^(cl-defmethod 
xref-location-line ((l xref-etags-lo/
+xref-location-marker   el-src/emacs/lisp/progmodes/etags.el    /^(cl-defmethod 
xref-location-marker ((l xref-etags-/
+xref-make-etags-location       el-src/emacs/lisp/progmodes/etags.el    
/^(defun xref-make-etags-location (tag-info file)$/
+xrnew  c-src/etags.c   /^#define xrnew(op, n, Type) ((op) = (Type *) xreall/
+xx     make-src/Makefile       /^xx="this line is here because of a fontlock 
bug$/
+xyz    ruby-src/test1.ru       /^    alias_method :xyz,$/
+y      cp-src/clheir.hpp       49
+y      cp-src/clheir.hpp       58
+y      cp-src/conway.hpp       7
+y-get-selection-internal       c.c     /^      Fy_get_selection_internal, 
Sy_get_selection_/
+yyalloc        /usr/share/bison/bison.simple   83
+yyalloc        /usr/share/bison/bison.simple   84
+yyclearin      /usr/share/bison/bison.simple   149
+yyclearin      /usr/share/bison/bison.simple   150
+yydebug        /usr/share/bison/bison.simple   237
+yydebug        /usr/share/bison/bison.simple   238
+yyerrhandle    /usr/share/bison/bison.simple   848
+yyerrlab1      /usr/share/bison/bison.simple   823
+yyerrok        /usr/share/bison/bison.simple   148
+yyerrok        /usr/share/bison/bison.simple   149
+yyerror        y-src/cccp.y    /^yyerror (s)$/
+yyerrstatus    /usr/share/bison/bison.simple   846
+yylex  y-src/cccp.y    /^yylex ()$/
+yyls   /usr/share/bison/bison.simple   88
+yyls   /usr/share/bison/bison.simple   89
+yylsp  /usr/share/bison/bison.simple   748
+yylsp  /usr/share/bison/bison.simple   921
+yymemcpy       /usr/share/bison/bison.simple   /^yymemcpy (char *yyto, const 
char *yyfrom, YYSIZE_T/
+yymemcpy       /usr/share/bison/bison.simple   264
+yymemcpy       /usr/share/bison/bison.simple   265
+yyn    /usr/share/bison/bison.simple   755
+yyn    /usr/share/bison/bison.simple   861
+yyn    /usr/share/bison/bison.simple   895
+yyn    /usr/share/bison/bison.simple   903
+yynewstate     /usr/share/bison/bison.simple   763
+yynewstate     /usr/share/bison/bison.simple   925
+yyparse        /usr/share/bison/bison.simple   /^yyparse (YYPARSE_PARAM_ARG)$/
+yyresult       /usr/share/bison/bison.simple   932
+yyresult       /usr/share/bison/bison.simple   939
+yyresult       /usr/share/bison/bison.simple   947
+yyreturn       /usr/share/bison/bison.simple   933
+yyreturn       /usr/share/bison/bison.simple   940
+yyss   /usr/share/bison/bison.simple   85
+yyss   /usr/share/bison/bison.simple   86
+yystate        /usr/share/bison/bison.simple   757
+yystate        /usr/share/bison/bison.simple   761
+yystate        /usr/share/bison/bison.simple   875
+yystate        /usr/share/bison/bison.simple   924
+yystpcpy       /usr/share/bison/bison.simple   /^yystpcpy (char *yydest, const 
char *yysrc)$/
+yystpcpy       /usr/share/bison/bison.simple   316
+yystpcpy       /usr/share/bison/bison.simple   317
+yystrlen       /usr/share/bison/bison.simple   /^yystrlen (const char *yystr)$/
+yystrlen       /usr/share/bison/bison.simple   293
+yystrlen       /usr/share/bison/bison.simple   294
+yyvs   /usr/share/bison/bison.simple   86
+yyvs   /usr/share/bison/bison.simple   87
+yyvsp  /usr/share/bison/bison.simple   746
+yyvsp  /usr/share/bison/bison.simple   919
+z      c.c     144
+z      c.c     164
+z      cp-src/clheir.hpp       49
+z      cp-src/clheir.hpp       58
+|      tex-src/texinfo.tex     /^\\def|{{\\tt \\char '174}}$/
+~      tex-src/texinfo.tex     /^\\def~{{\\tt \\char '176}}$/
+~A     cp-src/c.C      /^A::~A() {}$/
+~B     cp-src/c.C      /^    ~B() {};$/
+~MDiagArray2   cp-src/MDiagArray2.h    /^  ~MDiagArray2 (void) { }$/
+~generic_object        cp-src/clheir.cpp       
/^generic_object::~generic_object(void)$/
diff --git a/test/manual/etags/Makefile b/test/manual/etags/Makefile
index b3a82fdba8..81b5c3ca72 100644
--- a/test/manual/etags/Makefile
+++ b/test/manual/etags/Makefile
@@ -60,6 +60,7 @@ check:
        @$(MAKE) OPTIONS='nonexistent --members --declarations 
--regex=@regexfile' ediff_5
        @$(MAKE) OPTIONS='--class-qualify --members --declarations 
--regex=@regexfile' ediff_6
        @$(MAKE) cdiff
+       @$(MAKE) ctags_update
 
 ediff%: ETAGS.good% ETAGS ${infiles}
        diff -u --suppress-common-lines --width=80 ETAGS.good$* ETAGS
@@ -67,6 +68,20 @@ ediff%: ETAGS.good% ETAGS ${infiles}
 cdiff: CTAGS.good CTAGS ${infiles}
        diff -u --suppress-common-lines --width=80 CTAGS.good CTAGS
 
+ctags_update: CTAGS.good_update ${infiles}
+       head -n 100 CTAGS.good_update > CTAGS
+       tail -n 100 CTAGS.good_update >> CTAGS
+       ${RUN} ${CTAGS_PROG} -o CTAGS -u ${ARGS}
+       sort CTAGS > CTAGS.sorted
+       sort CTAGS.good_update > CTAGS.good_update.sorted
+       diff -u --suppress-common-lines --width=80 CTAGS.good_update.sorted 
CTAGS.sorted
+
+       cp crlf CTAGS
+       ${RUN} ${CTAGS_PROG} -o CTAGS -u ${ARGS}
+       sort CTAGS > CTAGS.sorted
+       sort CTAGS.good_crlf > CTAGS.good_crlf.sorted
+       diff -u --suppress-common-lines --width=80 CTAGS.good_crlf.sorted 
CTAGS.sorted
+
 ETAGS: ${infiles}
        ${RUN} ${ETAGS_PROG} ${OPTIONS} -o $@ ${ARGS}
 
diff --git a/test/manual/etags/crlf b/test/manual/etags/crlf
new file mode 100644
index 0000000000..d677595f01
--- /dev/null
+++ b/test/manual/etags/crlf
@@ -0,0 +1,2 @@
+test_crlf1     test_crlf.c     /^void test_crlf1()$/
+test_crlf2     tset_crlf.c     /^void test_crlf2()$/
diff --git a/test/manual/noverlay/itree-tests.c 
b/test/manual/noverlay/itree-tests.c
index 278e65f9bf..8cab7bf84d 100644
--- a/test/manual/noverlay/itree-tests.c
+++ b/test/manual/noverlay/itree-tests.c
@@ -26,7 +26,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "emacs-compat.h"
 
 #define EMACS_LISP_H            /* lisp.h inclusion guard */
-#define ITREE_DEBUG 1
 #define ITREE_TESTING
 #include "itree.c"
 
@@ -53,7 +52,7 @@ test_insert1_setup (void)
   enum { N = 6 };
   const int values[N] = {50, 30, 20, 10, 15, 5};
   struct itree_node *nodes[N] = {&N_50, &N_30, &N_20, &N_10, &N_15, &N_05};
-  interval_tree_init (&tree);
+  itree_init (&tree);
   for (int i = 0; i < N; ++i)
     {
       nodes[i]->begin = nodes[i]->end = values[i];
@@ -67,7 +66,7 @@ START_TEST (test_insert_1)
    *                 [50]
    */
 
-  interval_tree_insert (&tree, &N_50);
+  itree_insert_node (&tree, &N_50);
   ck_assert (! N_50.red);
   ck_assert_ptr_eq (&N_50, tree.root);
 }
@@ -81,8 +80,8 @@ START_TEST (test_insert_2)
    *              (30)
    */
 
-  interval_tree_insert (&tree, &N_50);
-  interval_tree_insert (&tree, &N_30);
+  itree_insert_node (&tree, &N_50);
+  itree_insert_node (&tree, &N_30);
   ck_assert (! N_50.red);
   ck_assert (N_30.red);
   ck_assert_ptr_eq (&N_50, tree.root);
@@ -102,9 +101,9 @@ START_TEST (test_insert_3)
    *             (20)   (50)
    */
 
-  interval_tree_insert (&tree, &N_50);
-  interval_tree_insert (&tree, &N_30);
-  interval_tree_insert (&tree, &N_20);
+  itree_insert_node (&tree, &N_50);
+  itree_insert_node (&tree, &N_30);
+  itree_insert_node (&tree, &N_20);
   ck_assert (N_50.red);
   ck_assert (! N_30.red);
   ck_assert (N_20.red);
@@ -128,10 +127,10 @@ START_TEST (test_insert_4)
    *           (10)
    */
 
-  interval_tree_insert (&tree, &N_50);
-  interval_tree_insert (&tree, &N_30);
-  interval_tree_insert (&tree, &N_20);
-  interval_tree_insert (&tree, &N_10);
+  itree_insert_node (&tree, &N_50);
+  itree_insert_node (&tree, &N_30);
+  itree_insert_node (&tree, &N_20);
+  itree_insert_node (&tree, &N_10);
   ck_assert (! N_50.red);
   ck_assert (! N_30.red);
   ck_assert (! N_20.red);
@@ -159,11 +158,11 @@ START_TEST (test_insert_5)
    *           (10) (20)
    */
 
-  interval_tree_insert (&tree, &N_50);
-  interval_tree_insert (&tree, &N_30);
-  interval_tree_insert (&tree, &N_20);
-  interval_tree_insert (&tree, &N_10);
-  interval_tree_insert (&tree, &N_15);
+  itree_insert_node (&tree, &N_50);
+  itree_insert_node (&tree, &N_30);
+  itree_insert_node (&tree, &N_20);
+  itree_insert_node (&tree, &N_10);
+  itree_insert_node (&tree, &N_15);
   ck_assert (! N_50.red);
   ck_assert (! N_30.red);
   ck_assert (N_20.red);
@@ -197,12 +196,12 @@ START_TEST (test_insert_6)
    *         (5)
    */
 
-  interval_tree_insert (&tree, &N_50);
-  interval_tree_insert (&tree, &N_30);
-  interval_tree_insert (&tree, &N_20);
-  interval_tree_insert (&tree, &N_10);
-  interval_tree_insert (&tree, &N_15);
-  interval_tree_insert (&tree, &N_05);
+  itree_insert_node (&tree, &N_50);
+  itree_insert_node (&tree, &N_30);
+  itree_insert_node (&tree, &N_20);
+  itree_insert_node (&tree, &N_10);
+  itree_insert_node (&tree, &N_15);
+  itree_insert_node (&tree, &N_05);
   ck_assert (! N_50.red);
   ck_assert (! N_30.red);
   ck_assert (! N_20.red);
@@ -238,7 +237,7 @@ test_insert2_setup (void)
   enum { N = 6 };
   const int values[] = {50, 70, 80, 90, 85, 95};
   struct itree_node *nodes[N] = {&N_50, &N_70, &N_80, &N_90, &N_85, &N_95};
-  interval_tree_init (&tree);
+  itree_init (&tree);
   for (int i = 0; i < N; ++i)
     {
       nodes[i]->begin = nodes[i]->end = values[i];
@@ -252,7 +251,7 @@ START_TEST (test_insert_7)
    *                 [50]
    */
 
-  interval_tree_insert (&tree, &N_50);
+  itree_insert_node (&tree, &N_50);
   ck_assert (! N_50.red);
   ck_assert_ptr_eq (&N_50, tree.root);
 }
@@ -266,8 +265,8 @@ START_TEST (test_insert_8)
    *                   (70)
    */
 
-  interval_tree_insert (&tree, &N_50);
-  interval_tree_insert (&tree, &N_70);
+  itree_insert_node (&tree, &N_50);
+  itree_insert_node (&tree, &N_70);
   ck_assert (! N_50.red);
   ck_assert (N_70.red);
   ck_assert_ptr_eq (&N_50, tree.root);
@@ -287,9 +286,9 @@ START_TEST (test_insert_9)
    *             (50)   (80)
    */
 
-  interval_tree_insert (&tree, &N_50);
-  interval_tree_insert (&tree, &N_70);
-  interval_tree_insert (&tree, &N_80);
+  itree_insert_node (&tree, &N_50);
+  itree_insert_node (&tree, &N_70);
+  itree_insert_node (&tree, &N_80);
   ck_assert (N_50.red);
   ck_assert (! N_70.red);
   ck_assert (N_80.red);
@@ -313,10 +312,10 @@ START_TEST (test_insert_10)
    *                      (90)
    */
 
-  interval_tree_insert (&tree, &N_50);
-  interval_tree_insert (&tree, &N_70);
-  interval_tree_insert (&tree, &N_80);
-  interval_tree_insert (&tree, &N_90);
+  itree_insert_node (&tree, &N_50);
+  itree_insert_node (&tree, &N_70);
+  itree_insert_node (&tree, &N_80);
+  itree_insert_node (&tree, &N_90);
   ck_assert (! N_50.red);
   ck_assert (! N_70.red);
   ck_assert (! N_80.red);
@@ -344,11 +343,11 @@ START_TEST (test_insert_11)
    *                  (80) (90)
    */
 
-  interval_tree_insert (&tree, &N_50);
-  interval_tree_insert (&tree, &N_70);
-  interval_tree_insert (&tree, &N_80);
-  interval_tree_insert (&tree, &N_90);
-  interval_tree_insert (&tree, &N_85);
+  itree_insert_node (&tree, &N_50);
+  itree_insert_node (&tree, &N_70);
+  itree_insert_node (&tree, &N_80);
+  itree_insert_node (&tree, &N_90);
+  itree_insert_node (&tree, &N_85);
   ck_assert (! N_50.red);
   ck_assert (! N_70.red);
   ck_assert (N_80.red);
@@ -383,12 +382,12 @@ START_TEST (test_insert_12)
    *                        (95)
    */
 
-  interval_tree_insert (&tree, &N_50);
-  interval_tree_insert (&tree, &N_70);
-  interval_tree_insert (&tree, &N_80);
-  interval_tree_insert (&tree, &N_90);
-  interval_tree_insert (&tree, &N_85);
-  interval_tree_insert (&tree, &N_95);
+  itree_insert_node (&tree, &N_50);
+  itree_insert_node (&tree, &N_70);
+  itree_insert_node (&tree, &N_80);
+  itree_insert_node (&tree, &N_90);
+  itree_insert_node (&tree, &N_85);
+  itree_insert_node (&tree, &N_95);
   ck_assert (! N_50.red);
   ck_assert (! N_70.red);
   ck_assert (! N_80.red);
@@ -419,7 +418,7 @@ START_TEST (test_insert_13)
   enum { N = 4 };
   const int values[N] = {10, 20, 30, 40};
   struct itree_node *nodes[N] = {&N_10, &N_20, &N_30, &N_40};
-  interval_tree_init (&tree);
+  itree_init (&tree);
   for (int i = 0; i < N; ++i)
     itree_insert (&tree, nodes[i], values[i], values[i]);
 
@@ -437,13 +436,13 @@ END_TEST
 START_TEST (test_insert_14)
 {
   enum { N = 3 };
-  struct itree_node nodes[N];
-  interval_tree_init (&tree);
+  struct itree_node nodes[N] = {0};
+  itree_init (&tree);
 
   for (int i = 0; i < N; ++i)
     itree_insert (&tree, &nodes[i], 10, 10);
   for (int i = 0; i < N; ++i)
-    ck_assert (interval_tree_contains (&tree, &nodes[i]));
+    ck_assert (itree_contains (&tree, &nodes[i]));
 }
 END_TEST
 
@@ -458,7 +457,7 @@ END_TEST
 static void
 test_remove1_setup (void)
 {
-  interval_tree_init (&tree);
+  itree_init (&tree);
   tree.root = &B;
   A.parent = &B; B.parent = NULL; C.parent = &D; D.parent = &B; E.parent = &D;
   A.left = A.right = C.left = C.right = E.left = E.right = NULL;
@@ -480,7 +479,7 @@ START_TEST (test_remove_1)
 {
   B.red = A.red = C.red = E.red = false;
   D.red = true;
-  interval_tree_remove_fix (&tree, &A, &B);
+  itree_remove_fix (&tree, &A, &B);
 
   ck_assert (! A.red);
   ck_assert (! B.red);
@@ -502,7 +501,7 @@ END_TEST
 START_TEST (test_remove_2)
 {
   B.red = D.red = A.red = C.red = E.red = false;
-  interval_tree_remove_fix (&tree, &A, &B);
+  itree_remove_fix (&tree, &A, &B);
 
   ck_assert (! A.red);
   ck_assert (! B.red);
@@ -523,7 +522,7 @@ START_TEST (test_remove_3)
 {
   D.red = A.red = E.red = false;
   B.red = C.red = true;
-  interval_tree_remove_fix (&tree, &A, &B);
+  itree_remove_fix (&tree, &A, &B);
 
   ck_assert (! A.red);
   ck_assert (! B.red);
@@ -546,7 +545,7 @@ START_TEST (test_remove_4)
 {
   B.red = C.red = E.red = true;
   A.red = D.red = false;
-  interval_tree_remove_fix (&tree, &A, &B);
+  itree_remove_fix (&tree, &A, &B);
 
   ck_assert (! A.red);
   ck_assert (! B.red);
@@ -569,7 +568,7 @@ END_TEST
 static void
 test_remove2_setup (void)
 {
-  interval_tree_init (&tree);
+  itree_init (&tree);
   tree.root = &B;
   A.parent = &B; B.parent = NULL; C.parent = &D; D.parent = &B; E.parent = &D;
   A.right = A.left = C.right = C.left = E.right = E.left = NULL;
@@ -589,7 +588,7 @@ START_TEST (test_remove_5)
 {
   B.red = A.red = C.red = E.red = false;
   D.red = true;
-  interval_tree_remove_fix (&tree, &A, &B);
+  itree_remove_fix (&tree, &A, &B);
 
   ck_assert (! A.red);
   ck_assert (! B.red);
@@ -611,7 +610,7 @@ END_TEST
 START_TEST (test_remove_6)
 {
   B.red = D.red = A.red = C.red = E.red = false;
-  interval_tree_remove_fix (&tree, &A, &B);
+  itree_remove_fix (&tree, &A, &B);
 
   ck_assert (! A.red);
   ck_assert (! B.red);
@@ -632,7 +631,7 @@ START_TEST (test_remove_7)
 {
   D.red = A.red = E.red = false;
   B.red = C.red = true;
-  interval_tree_remove_fix (&tree, &A, &B);
+  itree_remove_fix (&tree, &A, &B);
 
   ck_assert (! A.red);
   ck_assert (! B.red);
@@ -655,7 +654,7 @@ START_TEST (test_remove_8)
 {
   B.red = C.red = E.red = true;
   A.red = D.red = false;
-  interval_tree_remove_fix (&tree, &A, &B);
+  itree_remove_fix (&tree, &A, &B);
 
   ck_assert (! A.red);
   ck_assert (! B.red);
@@ -676,7 +675,7 @@ START_TEST (test_remove_9)
   enum { N = 4 };
   const int values[N] = {10, 20, 30, 40};
   struct itree_node *nodes[N] = {&N_10, &N_20, &N_30, &N_40};
-  interval_tree_init (&tree);
+  itree_init (&tree);
   for (int i = 0; i < N; ++i)
     itree_insert (&tree, nodes[i], values[i], values[i]);
 
@@ -722,8 +721,8 @@ START_TEST (test_remove_10)
   srand (42);
   shuffle (index, N);
 
-  interval_tree_init (&tree);
-  struct itree_node nodes[N];
+  itree_init (&tree);
+  struct itree_node nodes[N] = {0};
   for (int i = 0; i < N; ++i)
     {
       ptrdiff_t pos = (i + 1) * 10;
@@ -733,10 +732,10 @@ START_TEST (test_remove_10)
   shuffle (index, N);
   for (int i = 0; i < N; ++i)
     {
-      ck_assert (interval_tree_contains (&tree, &nodes[index[i]]));
+      ck_assert (itree_contains (&tree, &nodes[index[i]]));
       itree_remove (&tree, &nodes[index[i]]);
     }
-  ck_assert_ptr_null (tree.root);
+  ck_assert (itree_empty_p (&tree));
   ck_assert_int_eq (tree.size, 0);
 }
 END_TEST
@@ -748,12 +747,12 @@ END_TEST
 
 START_TEST (test_generator_1)
 {
-  struct itree_node node, *n;
-  struct itree_iterator *g;
-  interval_tree_init (&tree);
+  struct itree_node node = {0}, *n;
+  struct itree_iterator it, *g;
+  itree_init (&tree);
 
   itree_insert (&tree, &node, 10, 20);
-  g = itree_iterator_start (&tree, 0, 30, ITREE_ASCENDING, NULL, 0);
+  g = itree_iterator_start (&it, &tree, 0, 30, ITREE_ASCENDING);
   n = itree_iterator_next (g);
   ck_assert_ptr_eq (n, &node);
   ck_assert_int_eq (n->begin, 10);
@@ -761,13 +760,11 @@ START_TEST (test_generator_1)
   ck_assert_ptr_null (itree_iterator_next (g));
   ck_assert_ptr_null (itree_iterator_next (g));
   ck_assert_ptr_null (itree_iterator_next (g));
-  itree_iterator_finish (g);
 
-  g = itree_iterator_start (&tree, 30, 50, ITREE_ASCENDING, NULL, 0);
+  g = itree_iterator_start (&it, &tree, 30, 50, ITREE_ASCENDING);
   ck_assert_ptr_null (itree_iterator_next (g));
   ck_assert_ptr_null (itree_iterator_next (g));
   ck_assert_ptr_null (itree_iterator_next (g));
-  itree_iterator_finish (g);
 }
 END_TEST
 
@@ -777,8 +774,8 @@ test_check_generator (struct itree_tree *tree,
                       int n, ...)
 {
   va_list ap;
-  struct itree_iterator *g =
-    itree_iterator_start (tree, begin, end, ITREE_ASCENDING, NULL, 0);
+  struct itree_iterator it, *g =
+    itree_iterator_start (&it, tree, begin, end, ITREE_ASCENDING);
 
   va_start (ap, n);
   for (int i = 0; i < n; ++i)
@@ -790,13 +787,12 @@ test_check_generator (struct itree_tree *tree,
   va_end (ap);
   ck_assert_ptr_null (itree_iterator_next (g));
   ck_assert_ptr_null (itree_iterator_next (g));
-  itree_iterator_finish (g);
 }
 
 START_TEST (test_generator_2)
 {
-  interval_tree_init (&tree);
-  struct itree_node nodes[3];
+  itree_init (&tree);
+  struct itree_node nodes[3] = {0};
   for (int i = 0; i < 3; ++i)
     itree_insert (&tree, &nodes[i], 10 * (i + 1), 10 * (i + 2));
 
@@ -830,7 +826,7 @@ test_create_tree (struct itree_node *nodes, int n, bool 
doshuffle)
       shuffle (index, n);
     }
 
-  interval_tree_init (&tree);
+  itree_init (&tree);
   for (int i = 0; i < n; ++i)
     {
       struct itree_node *node = &nodes[index[i]];
@@ -862,8 +858,8 @@ START_TEST (test_generator_5)
                                 {.begin = 30, .end = 50},
                                 {.begin = 40, .end = 60}};
   test_create_tree (nodes, N, false);
-  struct itree_iterator *g =
-    itree_iterator_start (&tree, 0, 100, ITREE_PRE_ORDER, NULL, 0);
+  struct itree_iterator it, *g =
+    itree_iterator_start (&it, &tree, 0, 100, ITREE_PRE_ORDER);
   for (int i = 0; i < N; ++i)
     {
       struct itree_node *n = itree_iterator_next (g);
@@ -876,7 +872,6 @@ START_TEST (test_generator_5)
         case 3: ck_assert_int_eq (40, n->begin); break;
         }
     }
-  itree_iterator_finish (g);
 }
 END_TEST
 
@@ -888,8 +883,8 @@ START_TEST (test_generator_6)
                                 {.begin = 30, .end = 50},
                                 {.begin = 40, .end = 60}};
   test_create_tree (nodes, N, true);
-  struct itree_iterator *g =
-    itree_iterator_start (&tree, 0, 100, ITREE_ASCENDING, NULL, 0);
+  struct itree_iterator it, *g =
+    itree_iterator_start (&it, &tree, 0, 100, ITREE_ASCENDING);
   for (int i = 0; i < N; ++i)
     {
       struct itree_node *n = itree_iterator_next (g);
@@ -902,7 +897,6 @@ START_TEST (test_generator_6)
         case 3: ck_assert_int_eq (40, n->begin); break;
         }
     }
-  itree_iterator_finish (g);
 }
 END_TEST
 
@@ -914,8 +908,8 @@ START_TEST (test_generator_7)
                                 {.begin = 30, .end = 50},
                                 {.begin = 40, .end = 60}};
   test_create_tree (nodes, N, true);
-  struct itree_iterator *g =
-    itree_iterator_start (&tree, 0, 100, ITREE_DESCENDING, NULL, 0);
+  struct itree_iterator it, *g =
+    itree_iterator_start (&it, &tree, 0, 100, ITREE_DESCENDING);
   for (int i = 0; i < N; ++i)
     {
       struct itree_node *n = itree_iterator_next (g);
@@ -928,7 +922,6 @@ START_TEST (test_generator_7)
         case 3: ck_assert_int_eq (10, n->begin); break;
         }
     }
-  itree_iterator_finish (g);
 }
 END_TEST
 
@@ -938,14 +931,13 @@ START_TEST (test_generator_8)
   struct itree_node nodes[N] = {{.begin = 20, .end = 30},
                                 {.begin = 40, .end = 50}};
   test_create_tree (nodes, N, false);
-  struct itree_iterator *g =
-    itree_iterator_start (&tree, 1, 60, ITREE_DESCENDING, NULL, 0);
+  struct itree_iterator it, *g =
+    itree_iterator_start (&it, &tree, 1, 60, ITREE_DESCENDING);
   struct itree_node *n = itree_iterator_next (g);
   ck_assert_int_eq (n->begin, 40);
   itree_iterator_narrow (g, 50, 60);
   n = itree_iterator_next (g);
   ck_assert_ptr_null (n);
-  itree_iterator_finish (g);
 }
 END_TEST
 
@@ -955,14 +947,13 @@ START_TEST (test_generator_9)
   struct itree_node nodes[N] = {{.begin = 25, .end = 25},
                                 {.begin = 20, .end = 30}};
   test_create_tree (nodes, N, false);
-  struct itree_iterator *g =
-    itree_iterator_start (&tree, 1, 30, ITREE_DESCENDING, NULL, 0);
+  struct itree_iterator it, *g =
+    itree_iterator_start (&it, &tree, 1, 30, ITREE_DESCENDING);
   struct itree_node *n = itree_iterator_next (g);
   ck_assert_int_eq (n->begin, 25);
   itree_iterator_narrow (g, 25, 30);
   n = itree_iterator_next (g);
   ck_assert_int_eq (n->begin, 20);
-  itree_iterator_finish (g);
 }
 END_TEST
 
@@ -981,7 +972,7 @@ static void
 test_setup_gap_node (ptrdiff_t begin, ptrdiff_t end,
                      bool front_advance, bool rear_advance)
 {
-  interval_tree_init (&gap_tree);
+  itree_init (&gap_tree);
   gap_node.front_advance = front_advance;
   gap_node.rear_advance = rear_advance;
   itree_insert (&gap_tree, &gap_node, begin, end);
@@ -1281,9 +1272,8 @@ main (void)
   Suite *s = basic_suite ();
   SRunner *sr = srunner_create (s);
 
-  init_itree ();
   srunner_run_all (sr, CK_ENV);
-  int nfailed = srunner_ntests_failed (sr);
+  int failed = srunner_ntests_failed (sr);
   srunner_free (sr);
-  return (nfailed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+  return failed ? EXIT_FAILURE : EXIT_SUCCESS;
 }
diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el
index be4f60ab57..a2472c43da 100644
--- a/test/src/sqlite-tests.el
+++ b/test/src/sqlite-tests.el
@@ -36,6 +36,7 @@
 (declare-function sqlite-select "sqlite.c")
 (declare-function sqlite-open "sqlite.c")
 (declare-function sqlite-load-extension "sqlite.c")
+(declare-function sqlite-version "sqlite.c")
 
 (ert-deftest sqlite-select ()
   (skip-unless (sqlite-available-p))
@@ -243,6 +244,7 @@
 
 (ert-deftest sqlite-returning ()
   (skip-unless (sqlite-available-p))
+  (skip-unless (version<= "3.35" (sqlite-version)))
   (let (db)
     (progn
       (setq db (sqlite-open))
diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el
index 80fde408cd..48b61cf3dc 100644
--- a/test/src/treesit-tests.el
+++ b/test/src/treesit-tests.el
@@ -54,6 +54,7 @@
 (declare-function treesit-node-descendant-for-range "treesit.c")
 (declare-function treesit-node-eq "treesit.c")
 
+;;; Basic API
 
 (ert-deftest treesit-basic-parsing ()
   "Test basic parsing routines."
@@ -143,6 +144,8 @@
                      (treesit-node-string
                       (treesit-node-first-child-for-pos
                        doc-node 3))))
+      (should-error (treesit-node-first-child-for-pos doc-node 100)
+                    :type 'args-out-of-range)
       ;; `treesit-node-descendant-for-range'.
       (should (equal "(\"{\")"
                      (treesit-node-string
@@ -152,10 +155,186 @@
                      (treesit-node-string
                       (treesit-node-descendant-for-range
                        root-node 6 7 t))))
+      (should-error (treesit-node-descendant-for-range
+                     root-node 100 101)
+                    :type 'args-out-of-range)
       ;; `treesit-node-eq'.
       (should (treesit-node-eq root-node root-node))
       (should (not (treesit-node-eq root-node doc-node))))))
 
+;;; Indirect buffer
+
+(ert-deftest treesit-indirect-buffer ()
+  "Tests for indirect buffers."
+  (skip-unless (treesit-language-available-p 'json))
+  (let ((base (get-buffer-create "*treesit test*"))
+        parser indirect)
+    (unwind-protect
+        (progn
+          (with-current-buffer base
+            (setq indirect (clone-indirect-buffer "*treesit test 1*" nil)))
+          (with-current-buffer indirect
+            (setq parser (treesit-parser-create 'json)))
+          ;; 1. Parser created in the indirect buffer should be
+          ;; actually be created in the base buffer.
+          (with-current-buffer base
+            (should (equal (list parser)
+                           (treesit-parser-list)))
+            (insert "[1,2,3]"))
+          ;; Change in the base buffer should be reflected in the
+          ;; indirect buffer.
+          (with-current-buffer indirect
+            (should (eq (treesit-node-end
+                         (treesit-buffer-root-node))
+                        8))
+            (erase-buffer))
+          ;; Change in the indirect buffer should be reflected in the
+          ;; base buffer.
+          (with-current-buffer base
+            (should (eq (treesit-node-end
+                         (treesit-buffer-root-node))
+                        1))
+            (erase-buffer)))
+      (kill-buffer base)
+      (kill-buffer indirect))))
+
+;;; Tree traversal
+
+(ert-deftest treesit-search-subtree ()
+  "Test `treesit-search-subtree'."
+  (skip-unless (treesit-language-available-p 'json))
+  (with-temp-buffer
+    (let (parser root array)
+      (progn
+        (insert "[[1,2,3], [1,2,3], [1,2,3]]")
+        (setq parser (treesit-parser-create 'json))
+        (setq root (treesit-parser-root-node parser))
+        (setq array (treesit-node-child root 0)))
+      (dolist (subarray (treesit-node-children array t))
+        ;; Find named node forward.
+        (should (equal "1" (treesit-node-text
+                            (treesit-search-subtree
+                             subarray "number"))))
+        ;; Find named node backward.
+        (should (equal "3" (treesit-node-text
+                            (treesit-search-subtree
+                             subarray "number" t))))
+        ;; Find anonymous node forward.
+        (should (equal "[" (treesit-node-text
+                            (treesit-search-subtree
+                             subarray "\\[" nil t))))
+        ;; Find anonymous node backward.
+        (should (equal "]" (treesit-node-text
+                            (treesit-search-subtree
+                             subarray "\\]" t t))))
+        ;; If ALL=nil, it shouldn't find anonymous node.
+        (should (eq nil (treesit-node-text
+                         (treesit-search-subtree
+                          subarray "\\["))))
+        ;; If ALL=nil, searching for number should still find the
+        ;; numbers.
+        (should (equal "1" (treesit-node-text
+                            (treesit-search-subtree
+                             subarray "number" nil t))))
+        ;; Find named node backward.
+        (should (equal "3" (treesit-node-text
+                            (treesit-search-subtree
+                             subarray "number" t t))))
+        ))))
+
+(defmacro treesit--ert-search-setup (&rest body)
+  "Setup macro used by `treesit-search-forward' and friends.
+BODY is the test body."
+  `(with-temp-buffer
+     (let (parser root array)
+       (progn
+         (insert "[[1,2,3], [4,5,6], [7,8,9]]")
+         (setq parser (treesit-parser-create 'json))
+         (setq root (treesit-parser-root-node
+                     parser))
+         (setq array (treesit-node-child root 0))
+         ;; First bracket.
+         (setq cursor (treesit-node-child array 0)))
+       ,@body)))
+
+(ert-deftest treesit-search-forward ()
+  "Test `treesit-search-forward'."
+  (skip-unless (treesit-language-available-p 'json))
+  (treesit--ert-search-setup
+   (cl-loop for cursor = (treesit-node-child array 0)
+            then (treesit-search-forward cursor "" nil t)
+            for text in '("[" "[" "1" "," "2" "," "3" "]"
+                          "[1,2,3]" ","
+                          "[" "4" "," "5" "," "6" "]"
+                          "[4,5,6]" ","
+                          "[" "7" "," "8" "," "9" "]"
+                          "[7,8,9]" "]"
+                          "[[1,2,3], [4,5,6], [7,8,9]]")
+            while cursor
+            do (should (equal (treesit-node-text cursor)
+                              text)))))
+
+(ert-deftest treesit-search-forward-named-only ()
+  "Test `treesit-search-forward'."
+  (skip-unless (treesit-language-available-p 'json))
+  (treesit--ert-search-setup
+   (cl-loop for cursor = (treesit-node-child
+                          (treesit-node-child array 1) 1)
+            then (treesit-search-forward cursor "")
+            for text in '("1" "2"  "3" "[1,2,3]"
+                          "4" "5" "6" "[4,5,6]"
+                          "7" "8"  "9" "[7,8,9]"
+                          "[[1,2,3], [4,5,6], [7,8,9]]")
+            while cursor
+            do (should (equal (treesit-node-text cursor)
+                              text)))))
+
+(ert-deftest treesit-search-backward ()
+  "Test `treesit-search-forward'."
+  (skip-unless (treesit-language-available-p 'json))
+  (treesit--ert-search-setup
+   (cl-loop for cursor = (treesit-node-child array -1)
+            then (treesit-search-forward cursor "" t t)
+            for text in (reverse '("[[1,2,3], [4,5,6], [7,8,9]]"
+                                   "[" "[1,2,3]"
+                                   "[" "1" "," "2" "," "3" "]"
+                                   "," "[4,5,6]"
+                                   "[" "4" "," "5" "," "6" "]"
+                                   "," "[7,8,9]"
+                                   "[" "7" "," "8" "," "9" "]"
+                                   "]"))
+            while cursor
+            do (should (equal (treesit-node-text cursor)
+                              text)))))
+
+(ert-deftest treesit-search-backward-named-only ()
+  "Test `treesit-search-forward'."
+  (skip-unless (treesit-language-available-p 'json))
+  (treesit--ert-search-setup
+   (cl-loop for cursor = (treesit-node-child
+                          (treesit-node-child array -1 t) -1 t)
+            then (treesit-search-forward cursor "" t)
+            for text in (reverse '("[[1,2,3], [4,5,6], [7,8,9]]"
+                                   "[1,2,3]" "1" "2"  "3"
+                                   "[4,5,6]" "4" "5" "6"
+                                   "[7,8,9]" "7" "8"  "9"))
+            while cursor
+            do (should (equal (treesit-node-text cursor)
+                              text)))))
+
+(ert-deftest treesit-cursor-helper-with-missing-node ()
+  "Test treesit_cursor_helper with a missing node."
+  (skip-unless (treesit-language-available-p 'json))
+  (treesit--ert-search-setup
+   (delete-char -1)
+   (setq root (treesit-buffer-root-node))
+   (setq array (treesit-node-child root 0))
+   ;; If everything works, this should not hang.
+   (let ((missing-bracket (treesit-node-child array -1)))
+     (treesit-search-forward missing-bracket "" t))))
+
+;;; Query
+
 (ert-deftest treesit-query-api ()
   "Tests for query API."
   (skip-unless (treesit-language-available-p 'json))
@@ -167,6 +346,9 @@
         (setq root-node (treesit-parser-root-node
                          parser)))
 
+      (should-error (treesit-query-capture root-node "" 100 101)
+                    :type 'args-out-of-range)
+
       ;; Test `treesit-query-capture' on string, sexp and compiled
       ;; queries.
       (dolist (query1
@@ -207,6 +389,8 @@
          '((type field: (_) @capture :anchor)
            :? :* :+ "return")))))))
 
+;;; Narrow
+
 (ert-deftest treesit-narrow ()
   "Tests if narrowing works."
   (skip-unless (treesit-language-available-p 'json))
@@ -343,6 +527,8 @@ visible_end.)"
       ;; that calls that.
       )))
 
+;;; Range
+
 (ert-deftest treesit-range ()
   "Tests if range works."
   (skip-unless (treesit-language-available-p 'json))
@@ -396,6 +582,8 @@ visible_end.)"
       ;; TODO: More tests.
       )))
 
+;;; Multiple language
+
 (ert-deftest treesit-multi-lang ()
   "Tests if parsing multiple language works."
   (skip-unless (and (treesit-language-available-p 'html)
@@ -432,6 +620,8 @@ visible_end.)"
       ;; TODO: More tests.
       )))
 
+;;; Supplemental functions
+
 (ert-deftest treesit-parser-supplemental ()
   "Supplemental node functions."
   (skip-unless (treesit-language-available-p 'json))
@@ -552,6 +742,288 @@ visible_end.)"
     (insert "]")
     (should (treesit-node-check array-node 'outdated))))
 
+;;; Defun navigation
+;;
+;; I've setup a framework for easier testing of defun navigation.
+;;
+;; To use it for a particular language, first write a test program
+;; similar to `treesit--ert-defun-navigation-python-program', and
+;; insert markers.  Markers that marks BOLs are defined as follows:
+;;
+;; 100 Before 1st parent
+;; 101 Beg of 1st parent
+;; 102 End of 1st parent
+;; 103 Beg of 2nd parent
+;; 104 Beg of 1st method
+;; 105 End of 1st method
+;; 106 Beg of 2nd method
+;; 107 End of 2nd method
+;; 108 End of 2nd parent
+;; 109 Beg of 3rd parent
+;; 110 End of 3rd parent
+;; 999 Dummy markers
+;;
+;; Then add marker 0-9 following the definition given in
+;; `treesit--ert-defun-navigation-nested-master'.  Then you can use
+;; `treesit--ert-test-defun-navigation', pass the test program you
+;; just wrote, and the appropriate master:
+;;
+;; - `treesit--ert-defun-navigation-nested-master' for nested defun
+;; - `treesit--ert-defun-navigation-top-level-master' for top-level
+
+
+(defun treesit--ert-insert-and-parse-marker (opening closing text)
+  "Insert TEXT and parse the marker positions in it.
+
+TEXT should be a string in which contains position markings
+like (1).  OPENING and CLOSING are position marking's delimiters,
+for (1), OPENING and CLOSING should be \"(\" and \")\",
+respectively.
+
+This function inserts TEXT, parses and removes all the markings,
+and returns an alist of (NUMBER . POS), where number is each
+marking's number, and POS is each marking's position."
+  (declare (indent 2))
+  (let (result)
+    (insert text)
+    (goto-char (point-min))
+    (while (re-search-forward
+            (rx-to-string `(seq ,opening (group (+ digit)) ,closing))
+            nil t)
+      (let ((idx (string-to-number (match-string 1))))
+        (push (cons idx (match-beginning 0)) result)
+        (delete-region (match-beginning 0) (match-end 0))))
+    (nreverse result)))
+
+(defun treesit--ert-collect-positions (positions functions)
+  "Collect positions after calling each function in FUNCTIONS.
+
+POSITIONS should be a list of buffer positions, FUNCTIONS should
+be a list of functions.  This function collects the return value
+of each function in FUNCTIONS starting at each position in
+POSITIONS.
+
+Return a list of (POS...) where each POS corresponds to a
+function in FUNCTIONS.  For example, if buffer content is
+\"123\", POSITIONS is (2 3), FUNCTIONS is (point-min point-max),
+the return value is ((1 3) (1 3))."
+  (cl-loop for pos in positions
+           collect (cl-loop for fn in functions
+                            collect (progn
+                                      (goto-char pos)
+                                      (funcall fn)))))
+
+(defun treesit--ert-test-defun-navigation
+    (init program master &optional opening closing)
+  "Run defun navigation tests on PROGRAM and MASTER.
+
+INIT is a setup function that runs right after this function
+creates a temporary buffer.  It should take no argument.
+
+PROGRAM is a program source in string, MASTER is a list of
+\(START PREV-BEG NEXT-END PREV-END NEXT-BEG), where START is the
+starting marker position, and the rest are marker positions the
+corresponding navigation should stop at (after running
+`treesit-defun-skipper').
+
+OPENING and CLOSING are the same as in
+`treesit--ert-insert-and-parse-marker', by default they are \"[\"
+and \"]\"."
+  (with-temp-buffer
+    (funcall init)
+    (let* ((opening (or opening "["))
+           (closing (or closing "]"))
+           ;; Insert program and parse marker positions.
+           (marker-alist (treesit--ert-insert-and-parse-marker
+                             opening closing program))
+           ;; Translate marker positions into buffer positions.
+           (decoded-master
+            (cl-loop for record in master
+                     collect
+                     (cl-loop for pos in record
+                              collect (alist-get pos marker-alist))))
+           ;; Collect positions each function returns.
+           (positions
+            (treesit--ert-collect-positions
+             ;; The first column of DECODED-MASTER.
+             (mapcar #'car decoded-master)
+             ;; Four functions: next-end, prev-beg, next-beg, prev-end.
+             (mapcar (lambda (conf)
+                       (lambda ()
+                         (if-let ((pos (funcall
+                                        #'treesit--navigate-defun
+                                        (point) (car conf) (cdr conf))))
+                             (save-excursion
+                               (goto-char pos)
+                               (funcall treesit-defun-skipper)
+                               (point)))))
+                     '((-1 . beg)
+                       (1 . end)
+                       (-1 . end)
+                       (1 . beg))))))
+      ;; Verify each position.
+      (cl-loop for record in decoded-master
+               for orig-record in master
+               for poss in positions
+               for name = (format "marker %d" (car orig-record))
+               do (should (equal (cons name (cdr record))
+                                 (cons name poss)))))))
+
+(defvar treesit--ert-defun-navigation-python-program
+  "[100]
+[101]class Class1():
+[999]    prop = 0
+[102]
+[103]class Class2():[0]
+[104]    [1]def method1():
+[999]        [2]return 0[3]
+[105]    [4]
+[106]    [5]def method2():
+[999]        [6]return 0[7]
+[107]    [8]
+[999]    prop = 0[9]
+[108]
+[109]class Class3():
+[999]    prop = 0[10]
+[110]
+"
+  "Python source for navigation test.")
+
+(defvar treesit--ert-defun-navigation-js-program
+  "[100]
+[101]class Class1 {
+[999]}
+[102]
+[103]class Class2 {[0]
+[104]  [1]method1() {
+[999]    [2]return 0;
+[999]  }[3]
+[105]  [4]
+[106]  [5]method2() {
+[999]    [6]return 0;
+[999]  }[7]
+[107][8]
+[999]}[9]
+[108]
+[109]class class3 {
+[999]}[10]
+[110]
+"
+  "Javascript source for navigation test.")
+
+(defvar treesit--ert-defun-navigation-bash-program
+  "[100]
+[101]parent1 () {
+[999]}
+[102]
+[103]parent2 () {[0]
+[104]    [1]sibling1 () {
+[999]        [2]echo hi
+[999]    }[3]
+[105]    [4]
+[106]    [5]sibling2 () {
+[999]        [6]echo hi
+[999]    }[7]
+[107][8]
+[999]}[9]
+[108]
+[109]parent3 () {
+[999]}
+[110]
+"
+  "Javascript source for navigation test.")
+
+(defvar treesit--ert-defun-navigation-nested-master
+  ;; START PREV-BEG NEXT-END PREV-END NEXT-BEG
+  '((0 103 105 102 106) ; Between Beg of parent & 1st sibling.
+    (1 103 105 102 106) ; Beg of 1st sibling.
+    (2 104 105 102 106) ; Inside 1st sibling.
+    (3 104 107 102 109) ; End of 1st sibling.
+    (4 104 107 102 109) ; Between 1st sibling & 2nd sibling.
+    (5 104 107 102 109) ; Beg of 2nd sibling.
+    (6 106 107 105 109) ; Inside 2nd sibling.
+    (7 106 108 105 109) ; End of 2nd sibling.
+    (8 106 108 105 109) ; Between 2nd sibling & end of parent.
+    (9 103 110 102 nil) ; End of parent.
+
+    (100 nil 102 nil 103) ; Before 1st parent.
+    (101 nil 102 nil 103) ; Beg of 1st parent.
+    (102 101 108 nil 109) ; Between 1st & 2nd parent.
+    (103 101 108 nil 109) ; Beg of 2nd parent.
+    (110 109 nil 108 nil) ; After 3rd parent.
+    )
+  "Master of nested navigation test.
+
+This basically says, e.g., \"start with point on marker 0, go to
+the prev-beg, now point should be at marker 103\", etc.")
+
+(defvar treesit--ert-defun-navigation-top-level-master
+  ;; START PREV-BEG NEXT-END NEXT-BEG PREV-END
+  '((0 103 108 102 109) ; Between Beg of parent & 1st sibling.
+    (1 103 108 102 109) ; Beg of 1st sibling.
+    (2 103 108 102 109) ; Inside 1st sibling.
+    (3 103 108 102 109) ; End of 1st sibling.
+    (4 103 108 102 109) ; Between 1st sibling & 2nd sibling.
+    (5 103 108 102 109) ; Beg of 2nd sibling.
+    (6 103 108 102 109) ; Inside 2nd sibling.
+    (7 103 108 102 109) ; End of 2nd sibling.
+    (8 103 108 102 109) ; Between 2nd sibling & end of parent.
+    (9 103 110 102 nil) ; End of parent.
+
+    ;; Top-level defuns should be identical to the nested test.
+    (100 nil 102 nil 103) ; Before 1st parent.
+    (101 nil 102 nil 103) ; Beg of 1st parent.
+    (102 101 108 nil 109) ; Between 1st & 2nd parent.
+    (103 101 108 nil 109) ; Beg of 2nd parent.
+    (110 109 nil 108 nil) ; After 3rd parent.
+    )
+  "Master of top-level navigation test.")
+
+(ert-deftest treesit-defun-navigation-nested-1 ()
+  "Test defun navigation."
+  (skip-unless (treesit-language-available-p 'python))
+  ;; Nested defun navigation
+  (let ((treesit-defun-tactic 'nested))
+    (require 'python)
+    (treesit--ert-test-defun-navigation
+     'python-ts-mode
+     treesit--ert-defun-navigation-python-program
+     treesit--ert-defun-navigation-nested-master)))
+
+(ert-deftest treesit-defun-navigation-nested-2 ()
+  "Test defun navigation using `js-ts-mode'."
+  (skip-unless (treesit-language-available-p 'javascript))
+  ;; Nested defun navigation
+  (let ((treesit-defun-tactic 'nested))
+    (require 'js)
+    (treesit--ert-test-defun-navigation
+     'js-ts-mode
+     treesit--ert-defun-navigation-js-program
+     treesit--ert-defun-navigation-nested-master)))
+
+(ert-deftest treesit-defun-navigation-nested-3 ()
+  "Test defun navigation using `bash-ts-mode'."
+  (skip-unless (treesit-language-available-p 'bash))
+  ;; Nested defun navigation
+  (let ((treesit-defun-tactic 'nested))
+    (treesit--ert-test-defun-navigation
+     (lambda ()
+       (treesit-parser-create 'bash)
+       (setq-local treesit-defun-type-regexp "function_definition"))
+     treesit--ert-defun-navigation-bash-program
+     treesit--ert-defun-navigation-nested-master)))
+
+(ert-deftest treesit-defun-navigation-top-level ()
+  "Test top-level only defun navigation."
+  (skip-unless (treesit-language-available-p 'python))
+  ;; Nested defun navigation
+  (let ((treesit-defun-tactic 'top-level))
+    (require 'python)
+    (treesit--ert-test-defun-navigation
+     'python-ts-mode
+     treesit--ert-defun-navigation-python-program
+     treesit--ert-defun-navigation-top-level-master)))
+
 ;; TODO
 ;; - Functions in treesit.el
 ;; - treesit-load-name-override-list



reply via email to

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