emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/replace-region-contents 8e4cdf8: Merge branch 'ori


From: Tassilo Horn
Subject: [Emacs-diffs] scratch/replace-region-contents 8e4cdf8: Merge branch 'origin/master' into scratch/replace-region-contents
Date: Sat, 23 Feb 2019 13:31:11 -0500 (EST)

branch: scratch/replace-region-contents
commit 8e4cdf8db471ee13673f5a3123cdbd6b413ca55a
Merge: e5c99a1 5f640bf
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Merge branch 'origin/master' into scratch/replace-region-contents
---
 ChangeLog.3                      | 497 ++++++++++++++++++++++++++++++++++++++-
 doc/emacs/ack.texi               |   4 +-
 doc/lispref/abbrevs.texi         |   2 +-
 doc/lispref/os.texi              |   2 +-
 doc/lispref/syntax.texi          |   4 +-
 doc/misc/emacs-mime.texi         |  64 ++---
 doc/misc/eshell.texi             |  12 +-
 doc/misc/gnus-coding.texi        |   2 +-
 doc/misc/gnus.texi               |  35 +--
 doc/misc/sc.texi                 |   3 +-
 etc/AUTHORS                      |  67 ++++--
 etc/NEWS                         |   3 +
 lisp/battery.el                  |  30 +--
 lisp/calendar/cal-dst.el         |   2 +-
 lisp/calendar/icalendar.el       |  20 +-
 lisp/calendar/parse-time.el      |   2 +-
 lisp/calendar/timeclock.el       |  57 ++---
 lisp/cedet/ede/detect.el         |   2 +-
 lisp/completion.el               |   7 +-
 lisp/desktop.el                  |   8 +-
 lisp/ecomplete.el                |   2 +-
 lisp/emacs-lisp/benchmark.el     |   2 +-
 lisp/emacs-lisp/debug.el         |   2 +-
 lisp/emacs-lisp/ert.el           |   4 +-
 lisp/emacs-lisp/timer-list.el    |  16 +-
 lisp/emacs-lisp/timer.el         |   8 +-
 lisp/erc/erc-backend.el          |  30 ++-
 lisp/erc/erc-dcc.el              |   2 +-
 lisp/erc/erc-match.el            |   2 +-
 lisp/erc/erc-track.el            |   4 +-
 lisp/erc/erc.el                  |  41 ++--
 lisp/eshell/em-pred.el           |  15 +-
 lisp/eshell/em-unix.el           |   3 +-
 lisp/gnus/gnus-art.el            |  35 +--
 lisp/gnus/gnus-cite.el           |   2 +-
 lisp/gnus/gnus-demon.el          |  10 +-
 lisp/gnus/gnus-diary.el          |  45 ++--
 lisp/gnus/gnus-group.el          |   2 +-
 lisp/gnus/gnus-icalendar.el      |   9 +-
 lisp/gnus/gnus-int.el            |   3 +-
 lisp/gnus/gnus-score.el          |   4 +-
 lisp/gnus/gnus-sum.el            |  14 +-
 lisp/gnus/gnus-util.el           |   2 +-
 lisp/gnus/mail-source.el         |   6 +-
 lisp/gnus/message.el             |  16 +-
 lisp/gnus/mm-bodies.el           |   2 +-
 lisp/gnus/nneething.el           |   2 +-
 lisp/gnus/nnheader.el            |   2 +-
 lisp/gnus/nnimap.el              |  12 +-
 lisp/gnus/nnmail.el              |   2 +-
 lisp/gnus/nnmaildir.el           |  11 +-
 lisp/gnus/nnrss.el               |   6 +-
 lisp/ibuf-ext.el                 |   7 +-
 lisp/image.el                    |  17 +-
 lisp/ldefs-boot.el               |  19 +-
 lisp/mail/feedmail.el            |  10 +-
 lisp/mail/ietf-drums.el          |  10 +-
 lisp/mail/mail-extr.el           |  31 +--
 lisp/mail/mail-utils.el          |   4 +-
 lisp/mail/mailclient.el          |   2 +-
 lisp/mail/mailheader.el          |   2 +-
 lisp/mail/rfc2047.el             |   8 +-
 lisp/mail/rfc822.el              |   6 +-
 lisp/mail/rmail.el               |  18 +-
 lisp/mail/sendmail.el            |   9 +-
 lisp/mail/smtpmail.el            |   7 +-
 lisp/mail/supercite.el           |   6 +-
 lisp/man.el                      |  21 +-
 lisp/mh-e/mh-e.el                |  18 +-
 lisp/mh-e/mh-utils.el            |   4 +-
 lisp/minibuffer.el               |  14 +-
 lisp/mouse.el                    |   8 +-
 lisp/mpc.el                      |  11 +-
 lisp/net/imap.el                 |  24 +-
 lisp/net/newst-backend.el        |   9 +-
 lisp/net/pop3.el                 |  18 +-
 lisp/net/rcirc.el                |  14 +-
 lisp/net/shr.el                  |   9 +-
 lisp/net/tramp-cache.el          |  10 +-
 lisp/net/tramp-sh.el             |  25 +-
 lisp/net/tramp-smb.el            |  10 +-
 lisp/nxml/rng-maint.el           |   3 +-
 lisp/obsolete/xesam.el           |   3 +-
 lisp/org/org-agenda.el           |  11 +-
 lisp/org/org-capture.el          |   3 +-
 lisp/org/org-clock.el            |  58 ++---
 lisp/org/org-colview.el          |   6 +-
 lisp/org/org-duration.el         |   9 +-
 lisp/org/org-element.el          |   9 +-
 lisp/org/org-habit.el            |   5 +-
 lisp/org/org-id.el               |   6 +-
 lisp/org/org-indent.el           |   4 +-
 lisp/org/org-table.el            |   4 +-
 lisp/org/org-timer.el            |  32 +--
 lisp/org/org.el                  |  56 ++---
 lisp/org/ox-publish.el           |  12 +-
 lisp/org/ox.el                   |   2 +-
 lisp/pixel-scroll.el             |   9 +-
 lisp/play/hanoi.el               |   2 +-
 lisp/proced.el                   |   2 +-
 lisp/progmodes/cpp.el            |   4 +-
 lisp/progmodes/flymake.el        |   3 +-
 lisp/progmodes/js.el             |   4 +-
 lisp/progmodes/sql.el            |  49 ++--
 lisp/progmodes/vhdl-mode.el      |   4 +-
 lisp/progmodes/which-func.el     |  17 +-
 lisp/progmodes/xref.el           |   6 +-
 lisp/ps-samp.el                  |   4 +-
 lisp/ses.el                      |   2 +-
 lisp/simple.el                   |   2 +-
 lisp/subr.el                     |   2 +-
 lisp/term/xterm.el               |   8 +-
 lisp/time.el                     |  18 +-
 lisp/tooltip.el                  |   3 +-
 lisp/type-break.el               |  14 +-
 lisp/url/url-cache.el            |   4 +-
 lisp/url/url-cookie.el           |   9 +-
 lisp/url/url-queue.el            |   4 +-
 lisp/url/url-util.el             |   3 +-
 lisp/url/url.el                  |   3 +-
 lisp/vc/diff-mode.el             | 122 +++++-----
 lisp/vc/vc-git.el                |   5 +-
 lisp/vc/vc-hg.el                 |   8 +-
 lisp/woman.el                    |   2 +-
 lisp/xt-mouse.el                 |   9 +-
 src/w32term.c                    |   3 +
 test/data/shr/ol.html            |  29 +++
 test/data/shr/ol.txt             |  19 ++
 test/lisp/progmodes/sql-tests.el | 228 +++++++++++++-----
 129 files changed, 1485 insertions(+), 829 deletions(-)

diff --git a/ChangeLog.3 b/ChangeLog.3
index 70d1b8f..6c5d9c2 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -1,3 +1,498 @@
+2019-02-20  Glenn Morris  <address@hidden>
+
+       Remove .art from the default list of ImageMagick extensions
+
+       It seems that .art files can be non-image files that
+       ImageMagick mistakenly treats as extremely large images.
+       Real .art images seem rare.
+       * lisp/image.el (imagemagick-enabled-types): Remove ART.  (Bug#22289)
+
+2019-02-19  Eli Zaretskii  <address@hidden>
+
+       Fix input after setting x-wait-for-event-timeout nil
+
+       * src/w32term.c (x_make_frame_visible): Call unblock_input
+       before returning early.  (Bug#34575)
+
+2019-02-19  Martin Rudalics  <address@hidden>
+
+       Fix two warnings in eshell.texi
+
+       * doc/misc/eshell.texi (Built-ins, Globbing): Fix `.' or `,'
+       must follow @xref, not `f' warnings.
+
+2019-02-18  Stefan Monnier  <address@hidden>
+
+       * lisp/minibuffer.el (completion-table-dynamic): Improve docstring
+
+2019-02-18  David Pathakjee  <address@hidden>  (tiny change)
+
+       * lisp/emacs-lisp/debug.el (debug-on-variable-change): Doc fix.  
(Bug#34518)
+
+2019-02-17  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in ELisp manual
+
+       * doc/lispref/abbrevs.texi (Abbrev Table Properties): Fix a
+       typo.  (Bug#34508)
+
+2019-02-16  Paul Eggert  <address@hidden>
+
+       Update citations of Internet RFCs
+
+       For example, RFC 822 has been obsoleted by RFC 2822, which in
+       turn has been obsoleted by RFC 5322.
+       * doc/emacs/ack.texi, doc/lispref/os.texi:
+       * doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
+       * doc/misc/gnus.texi, doc/misc/sc.texi:
+       * lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
+       * lisp/gnus/gnus-util.el, lisp/gnus/message.el:
+       * lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
+       * lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
+       * lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
+       * lisp/mail/mailclient.el, lisp/mail/mailheader.el:
+       * lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
+       * lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
+       * lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
+       * lisp/mh-e/mh-utils.el, lisp/net/imap.el:
+       * lisp/net/newst-backend.el, lisp/org/org-id.el:
+       * lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
+       Update RFC citations.
+
+2019-02-16  Eli Zaretskii  <address@hidden>
+
+       Fix handling of manpage references divided by hyphenation
+
+       * lisp/man.el (Man-reference-regexp): Accept a newline as part
+       of a manpage name only if it's preceded by a hyphen.  (Bug#34286)
+       (Man-translate-references): Adapt to change in
+       'Man-reference-regexp'.
+       (Man-default-man-entry): Support references divided between
+       two lines by an ASCII hyphen.  This is a left-over from fixing
+       bug#6289.
+
+2019-02-16  Gregor Zattler  <address@hidden>  (tiny change)
+
+       * doc/misc/eshell.texi: Fix some @ref's.
+
+2019-02-16  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in lispref/syntax.texi
+
+       * doc/lispref/syntax.texi (Syntax Table Internals): Fix a
+       typo.  (Bug#34495)
+
+2019-02-15  Victor J. Orlikowski  <address@hidden>  (tiny change)
+
+       Avoid errors in erc-dcc.el when erc-dcc-verbose is non-nil
+
+       * lisp/erc/erc-dcc.el (erc-dcc-get-filter): Don't assume STR
+       is always a string.  Use 'buffer-name' to get the DCC file
+       name, as buffer-file-name is not set in the process buffer.
+
+2019-02-15  Daniel Lopez  <address@hidden>  (tiny change)
+
+       Fix faces in compilation messages
+
+       * lisp/progmodes/compile.el (compilation-parse-errors): Don't
+       clobber the value of TYPE inside the loop.  (Bug#34479)
+
+2019-02-15  Gregor Zattler  <address@hidden>
+
+       * doc/misc/eshell.texi (Built-ins): Fix alias description
+
+       Dear eamcs developers, eshells current documentation first states
+       that alias definitions are not saved to an alias file, later that
+       they are saved to an alias file.  I tested it and the latter is
+       correct.
+
+       Please find attached a patch which fixes this.
+
+       Thanks for working on emacs which is really great, Gregor
+
+       >From 1fe51cc769ab7a30d0896fb3d6105c0561243fa7 Mon Sep 17 00:00:00 2001
+       From: Gregor Zattler <address@hidden>
+       Date: Wed, 13 Feb 2019 20:19:38 +0100
+       Subject: * doc/misc/eshell.texi (Built-ins): Fix alias description.
+
+       Bring description of built-in 'alias' in line with (info "(eshell) 
Aliases"),
+       which describes the actual behaviur.
+
+       (cherry picked from commit a48099ce7ff63cda416a870766fe61f5b8ac7c2c)
+
+2019-02-14  Katsumi Yamaoka  <address@hidden>
+
+       Work for empty MIME attachments (related to bug#34387)
+
+       * lisp/gnus/mm-view.el (mm-inline-text):
+       Make undisplayer do nothing if the part is empty.
+
+       * lisp/gnus/mm-decode.el (mm-copy-to-buffer): Work for empty MIME part.
+       * lisp/gnus/mml.el (mime-to-mml): Ditto.
+
+2019-02-14  Jackson Ray Hamilton  <address@hidden>
+
+       Backport: js-indent-align-list-continuation: Make variable safe
+
+       * lisp/progmodes/js.el (js-indent-align-list-continuation): Indicate
+       variable is safe as a file-local variable.  This fixes the
+       js-indent-align-list-continuation-nil test when run with make.
+
+       (cherry picked from commit dd319f2711f895eec87c1017b82cd9d88d9ecd0a)
+
+2019-02-13  Eli Zaretskii  <address@hidden>
+
+       Avoid crashes upon C-g in nested invocations of 'read_char'
+
+       * src/keyboard.c (read_char, read_event_from_main_queue):
+       Ensure the global value of getcjmp is restored when the stack
+       is unwound by the likes of 'throw', by calling
+       record_unwind_protect_ptr instead of restoring the value
+       manually.  (Bug#34394)
+       (restore_getcjmp): Argument is now 'void *', to match the
+       signature of record_unwind_protect_ptr.
+
+       (cherry picked from commit 10527fca66e39d7067986904161fa33741abcd26)
+
+2019-02-12  Stefan Monnier  <address@hidden>
+
+       * src/data.c (Fmake_local_variable): Fix bug#34318
+
+       Revert part of ed962f2b8a.
+
+       * test/src/data-tests.el (data-tests-make-local-forwarded-var):
+       Add corresponding test.
+
+2019-02-12  Eli Zaretskii  <address@hidden>
+
+       Minor fixes in ELisp manual wrt syntax-table properties
+
+       * doc/lispref/syntax.texi (Syntax Properties): Fix reference
+       to syntax-table properties.  (Bug#34455)
+       (Control Parsing): Remove redundant @vindex entry.
+
+2019-02-12  Michael Albinus  <address@hidden>
+
+       * admin/notes/emba: New file.
+
+2019-02-11  Eli Zaretskii  <address@hidden>
+
+       Fix Hunspell invocation for discovering its dictionaries
+
+       * lisp/textmodes/ispell.el
+       (ispell-find-hunspell-dictionaries): Invoke Hunspell with the
+       -a switch, to prevent it from initializing its curses UI.
+       (Bug#34272)
+
+2019-02-08  Eli Zaretskii  <address@hidden>
+
+       Minor improvements to do strings in callproc.c
+
+       * src/callproc.c (Fcall_process, Fcall_process_region): Minor
+       fixes to doc strings.  Suggested by Nicholas Drozd
+       <address@hidden>.  (Bug#34274)
+
+2019-02-08  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'date-to-time' and 'parse-time-string'
+
+       * doc/lispref/os.texi (Time Parsing): Document
+       'parse-time-string', and refer to it for the description of
+       the argument of 'date-to-time'.
+
+       * lisp/calendar/time-date.el (date-to-time): Refer in the doc
+       string to 'parse-time-string' for more information about the
+       format of the DATE argument.  (Bug#34303)
+
+2019-02-08  Nick Drozd  <address@hidden>
+
+       Fix downloading of URLs that end in a slash
+
+       * lisp/net/eww.el (eww-download-callback): Fix download URL
+       file name.  Previously this wasn't handling download URLs
+       correctly, resulting in all downloaded pages being named
+       "!", "!(1)", etc.  (Bug#34291)
+
+2019-02-08  Nick Drozd  <address@hidden>
+
+       * doc/misc/eww.texi (Basics): Fix eww keybindings.  (Bug#34291)
+
+2019-02-08  Robert Pluim  <address@hidden>
+
+       Fix process-thread docstring
+
+       * src/process.c (Fprocess_thread): Correct docstring.
+
+2019-02-08  Eli Zaretskii  <address@hidden>
+
+       Fix failures of vc-find-revision with non-ASCII file names
+
+       * lisp/vc/vc.el (vc-find-revision): Instead of binding
+       coding-system-for-write, make the buffer-file-coding-system of
+       the temporary buffer be no-conversion.  This avoids the
+       unwanted side effect of not encoding the command-line
+       arguments of the VCS commands invoked by the backend.
+       (Bug#34350)
+
+2019-02-07  Eli Zaretskii  <address@hidden>
+
+       * doc/lispref/tips.texi (Documentation Tips): Fix quotes.  (Bug#34372)
+
+2019-02-05  Alex Branham  <address@hidden>
+
+       Add documentation for tabulated-list functions in the elisp manual
+
+       * doc/lispref/modes.texi: Add documentation for
+         'tabulated-list-delete-entry', 'tabulated-list-get-id',
+         'tabulated-list-get-entry', 'tabulated-list-header-overlay-p',
+         'tabulated-list-put-tag', and 'tabulated-list-set-col'.
+
+       Bug#21074
+
+2019-02-03  Jean-Christophe Helary  <address@hidden>
+
+       Fix URL in ucs-normalize.el
+
+       * lisp/international/ucs-normalize.el: Fix URL of the HFS
+       normalization reference.  (Bug#34300)
+
+2019-02-03  Alan Mackenzie  <address@hidden>
+
+       * etc/PROBLEMS: Amend entry for profiler bug #34235 to mention kernel 
4.14.97
+
+2019-02-02  Glenn Morris  <address@hidden>
+
+       * make-dist: Remove references to src/stamp-h.in.
+
+       This file was removed two years ago in 2f89350.
+       No need to merge to master.
+
+2019-02-02  Paul Eggert  <address@hidden>
+
+       * etc/PROBLEMS: Mention profiler-report bug (Bug#34235).
+
+2019-02-01  Eli Zaretskii  <address@hidden>
+
+       Correct the docs of inserting kmacro counter
+
+       * doc/emacs/kmacro.texi (Keyboard Macro Counter): Correct the
+       description of the affect "C-u" has on inserting the macro
+       counter.  Define "previous counter value".
+
+       * lisp/kmacro.el (kmacro-insert-counter)
+       (kmacro-start-macro-or-insert-counter): Fix the doc strings
+       regarding the effect of "C-u".  (Bug#34263)
+
+2019-02-01  Nicholas Drozd  <address@hidden>
+
+       * doc/misc/calc.texi (Algebraic Tutorial): Fix a typo.  (Bug#34273)
+
+2019-02-01  Eli Zaretskii  <address@hidden>
+
+       Avoid errors in 'rmail-get-new-mail'
+
+       * lisp/mail/rmail.el (rmail-insert-inbox-text): Don't assume
+       the Rmail protocol is always a string when calling
+       'rmail-remote-proto-p'.  (Bug#34252)
+
+2019-01-31  Paul Eggert  <address@hidden>
+
+       Fix process-contact bug with TCP connections
+
+       This fixes a regression from Emacs 25.3 (Bug#34134).
+       * src/process.c (server_accept_connection):
+       Set host correctly, fixing a bug introduced in
+       2017-09-16T21:29:address@hidden
+       when working around a GCC bug.
+
+2019-01-29  Eli Zaretskii  <address@hidden>
+
+       Minor copyedits in last manual change
+
+       * doc/emacs/custom.texi (Authentication): Improve markup,
+       indexing, and wording.
+
+2019-01-29  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of face numbers
+
+       * doc/lispref/display.texi (Face Functions): Mention where the
+       face number is used and that it depends on the 'face' property
+       of the face symbol.  Improve indexing.
+
+2019-01-27  Michael Albinus  <address@hidden>
+
+       * doc/emacs/custom.texi (Authentication): Refer to the "Help for users" 
node.
+
+2019-01-26  Michael Albinus  <address@hidden>
+
+       New node Authentication in the Emacs manual
+
+       * doc/emacs/custom.texi (Customization):
+       * doc/emacs/emacs.texi (Top): Add node Authentication.
+
+2019-01-25  Alan Mackenzie  <address@hidden>
+
+       Fix a loop in c-fl-decl-start.  This fixes bug #34186.
+
+       * lisp/progmodes/cc-mode.el (c-fl-decl-start) In the pair of operations
+       c-syntactic-skip-backward and c-forward-syntactic-ws, ensure the latter
+       doesn't come back to the position before the former, and break out of 
the
+       enclosing loop if it does.
+
+2019-01-25  Eli Zaretskii  <address@hidden>
+
+       Fix LaTeX output of month and day from cal-tex.el
+
+       * lisp/calendar/cal-tex.el (cal-tex-cursor-week-iso)
+       (cal-tex-week-hours): Escape a lone blank, to make it through
+       LaTeX.  (Bug#34148)
+
+2019-01-25  Daniel Kahn Gillmor  <address@hidden>  (tiny change)
+
+       Avoid elisp crash for OpenPGP User IDs with no e-mail address
+
+       * lisp/gnus/mml-sec.el (mml-secure-check-user-id): Verify that
+       there is an e-mail address in the current User ID before trying
+       to downcase it.  (Bug#34121)
+
+2019-01-25  Benjamin Riefenstahl  <address@hidden>
+
+       image-mode: Do not use default scaling (bug#33990)
+
+       * lisp/image-mode.el (image-toggle-display-image): Set :scale == 1 so
+       that create-image does not apply additional scaling.
+
+2019-01-25  Benjamin Riefenstahl  <address@hidden>
+
+       create-image: Expand documentation (bug#33990)
+
+       * lisp/image.el (create-image): Discuss default for :scale in the doc
+       string.
+
+2019-01-21  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'isearch-filter-predicate'
+
+       * lisp/isearch.el (isearch-filter-predicate)
+       (isearch-filter-visible): Doc fixes.  (Bug#34150)
+
+2019-01-19  Trevor Spiteri  <address@hidden>  (tiny change)
+
+       Fix cursor column positioning on Grep hits
+
+       * lisp/progmodes/grep.el (grep-match-face): Move before first
+       use, to avoid byte-compilation warning.
+       (grep-regexp-alist): Don't quote grep-match-face.  (Bug#34068)
+
+2019-01-18  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in ELisp manual
+
+       * doc/lispref/nonascii.texi (Converting Representations): Fix
+       inconsistency between @defun and the argument description of
+       'byte-to-string'.  (Bug#34119)
+
+2019-01-15  Alan Third  <address@hidden>
+
+       Prevent redrawing if frame is garbaged
+
+       * src/nsterm.m ([EmacsView viewWillDraw]): Cancel drawing if the frame
+       has been garbaged.
+       * src/xdisp.c (expose_window_tree, expose_frame): Remove NS only
+       exceptions.
+
+2019-01-14  Eli Zaretskii  <address@hidden>
+
+       Attempt to fix hangs on MS-Windows due to C-g
+
+       * src/w32uniscribe.c (uniscribe_otf_capability): Set
+       inhibit-quit around calls to otf_features, because the latter
+       cons Lisp data structures while we are in a critical section.
+       * src/xdisp.c (ALLOCATE_HDC) [HAVE_NTGUI]: Set inhibit-quit.
+       (RELEASE_HDC) [HAVE_NTGUI]: Restore inhibit-quit.
+       (OPTIONAL_HDC, DECLARE_HDC): Remove macros, their job is now
+       done by ALLOCATE_HDC and by a single #ifdef.
+       (draw_glyphs): Adapt to the above changes in macros.
+       (Bug#34059)
+
+2019-01-13  Eli Zaretskii  <address@hidden>
+
+       Fix Calc graph output on MS-Windows
+
+       The previous code relied on "pgnuplot" executable, which is
+       no longer provided with Gnuplot 5.x.
+       * lisp/calc/calc.el (calc-gnuplot-name): Set to "pgnuplot" on
+       MS-Windows only if such an executable exists.
+       * lisp/calc/calc-graph.el (calc-graph-w32-p): New defsubst.
+       (calc-graph-plot, calc-graph-command, calc-gnuplot-command)
+       (calc-graph-init): Call calc-graph-w32-p wherever we need to
+       do something special for invoking gnuplot on MS-Windows,
+       instead of comparing against calc-gnuplot-name.
+       (calc-graph-plot): Set the terminal to "qt" on MS-Windows when
+       pgnuplot.exe is not available.
+       (calc-graph-kill): Delete the temporary files only after
+       killing the gnuplot process, otherwise the deletion might fail
+       on MS-Windows because the files are still in use.
+
+2019-01-13  Eli Zaretskii  <address@hidden>
+
+       Fix a minor mistake in ELisp manual
+
+       * doc/lispref/buffers.texi (Modification Time): Fix
+       documentation of 'visited-file-modtime'.  (Bug#34055)
+
+2019-01-12  Stephen Berman  <address@hidden>
+
+       * etc/tutorials/TUTORIAL: Fix typo (bug#34049)
+
+2019-01-12  Devon Sean McCullough  <address@hidden>
+
+       Fix UI of Buffer-menu
+
+       * lisp/buff-menu.el (Buffer-menu-execute): Don't remove
+       entries of buffers whose killing the user didn't confirm.
+       (Bug#33669)
+
+2019-01-12  Philip K  <address@hidden>  (tiny change)
+
+       Reinitialize ispell-really-enchant when changing the speller
+
+       * lisp/textmodes/ispell.el (ispell-check-version): Reset also
+       ispell-really-enchant.  (Bug#34019)
+
+2019-01-07  Leo Liu  <address@hidden>
+
+       Speed up loading css-mode
+
+       lisp/textmodes/css-mode.el: Remove (require 'eww) which is redundant
+       and slow.  (Bug#33939)
+
+2019-01-07  Michael Albinus  <address@hidden>
+
+       Adapt filenotify-tests for emba
+
+       * .gitlab-ci.yml (test): Add EMACS_EMBA_CI variable.
+
+       * test/lisp/filenotify-tests.el (file-notify-test03-events)
+       (file-notify-test05-file-validity)
+       (file-notify-test06-dir-validity)
+       (file-notify-test07-many-events)
+       (file-notify-test09-watched-file-in-watched-dir): Adapt tests for emba.
+
+2019-01-07  Nicolas Petton  <address@hidden>
+
+       Bump Emacs version to 26.1.91
+
+       * README:
+       * configure.ac:
+       * msdos/sed2v2.inp:
+       * nt/README.W32: Bump Emacs version to 26.1.91.
+
+2019-01-07  Nicolas Petton  <address@hidden>
+
+       * etc/AUTHORS: Update.
+
 2019-01-07  Leo Liu  <address@hidden>
 
        * lisp/textmodes/mhtml-mode.el: Avoid loading flyspell.  (Bug#33939)
@@ -64181,7 +64676,7 @@
 
 This file records repository revisions from
 commit 9d56a21e6a696ad19ac65c4b405aeca44785884a (exclusive) to
-commit 2cf20b67cf6836dd7bd80077042068afa0d7b04f (inclusive).
+commit a19bfb7a5e3557a69824cdbe7d414f5ef422555c (inclusive).
 See ChangeLog.1 for earlier changes.
 
 ;; Local Variables:
diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi
index 3ad6739..0e4a982 100644
--- a/doc/emacs/ack.texi
+++ b/doc/emacs/ack.texi
@@ -829,8 +829,8 @@ command with its arguments.
 Richard Mlynarik wrote @file{cl-indent.el}, a package for indenting
 Common Lisp code; @file{ebuff-menu.el}, an electric browser for
 buffer listings; @file{ehelp.el}, bindings for browsing help screens;
-and @file{rfc822.el}, a parser for E-mail addresses in the RFC-822 format,
-used in mail messages and news articles.
+and @file{rfc822.el}, a parser for E-mail addresses in the format
+used in mail messages and news articles (Internet RFC 822 and its successors).
 
 @item
 Gerd Möllmann was the Emacs maintainer from the beginning of Emacs 21
diff --git a/doc/lispref/abbrevs.texi b/doc/lispref/abbrevs.texi
index b92d370..b67c014 100644
--- a/doc/lispref/abbrevs.texi
+++ b/doc/lispref/abbrevs.texi
@@ -473,7 +473,7 @@ Set the property @var{prop} of abbrev table @var{table} to 
value @var{val}.
 
 @defun abbrev-table-get table prop
 Return the property @var{prop} of abbrev table @var{table}, or @code{nil}
-if the abbrev has no such property.
+if @var{table} has no such property.
 @end defun
 
 The following properties have special meaning:
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 9766b83..cb8f25d 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1562,7 +1562,7 @@ following form:
 The format of this list is the same as what @code{decode-time} accepts
 (@pxref{Time Conversion}), and is described in more detail there.  Any
 element that cannot be determined from the input will be set to
address@hidden  The argument @var{string} should resemble an RFC 2822 or
address@hidden  The argument @var{string} should resemble an RFC 822 (or later) 
or
 ISO 8601 string, like ``Fri, 25 Mar 2016 16:24:56 +0100'' or
 ``1998-09-12T12:21:54-0200'', but this function will attempt to parse
 less well-formed time strings as well.
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi
index 25b9b35..b0c04ef 100644
--- a/doc/lispref/syntax.texi
+++ b/doc/lispref/syntax.texi
@@ -1041,8 +1041,8 @@ This function returns the syntax code for the raw syntax 
descriptor
 @var{syntax-code} component, masks off the high 16 bits which record
 the syntax flags, and returns the resulting integer.
 
-If @var{syntax} is @code{nil}, the return value is returns @code{nil}.
-This is so that the expression
+If @var{syntax} is @code{nil}, the return value is @code{nil}.  This
+is so that the expression
 
 @example
 (syntax-class (syntax-after pos))
diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi
index 123375c..0924240 100644
--- a/doc/misc/emacs-mime.texi
+++ b/doc/misc/emacs-mime.texi
@@ -698,13 +698,15 @@ Translation}.
 A description of the part (@code{Content-Description}).
 
 @item creation-date
-RFC822 date when the part was created (@code{Content-Disposition}).
+Date when the part was created (@code{Content-Disposition}).
+This uses the format of RFC 822 or its successors.
 
 @item modification-date
-RFC822 date when the part was modified (@code{Content-Disposition}).
+RFC 822 (or later) date when the part was modified
+(@code{Content-Disposition}).
 
 @item read-date
-RFC822 date when the part was read (@code{Content-Disposition}).
+RFC 822 (or later) date when the part was read (@code{Content-Disposition}).
 
 @item recipients
 Who to encrypt/sign the part to.  This field is used to override any
@@ -754,7 +756,7 @@ be obtained.  Values include @samp{ftp}, @samp{anon-ftp}, 
@samp{tftp},
 @samp{localfile}, and @samp{mailserver}.  (@code{Content-Type}.)
 
 @item expiration
-The RFC822 date after which the file may no longer be fetched.
+RFC 822 (or later) date after which the file may no longer be fetched.
 (@code{Content-Type}.)
 
 @item size
@@ -1301,7 +1303,7 @@ on.  High-level functionality is dealt with in the first 
chapter
 @menu
 * rfc2045::      Encoding @code{Content-Type} headers.
 * rfc2231::      Parsing @code{Content-Type} headers.
-* ietf-drums::   Handling mail headers defined by RFC822bis.
+* ietf-drums::   Handling mail headers defined by RFC 2822.
 * rfc2047::      En/decoding encoded words in headers.
 * time-date::    Functions for parsing dates and manipulating time.
 * qp::           Quoted-Printable en/decoding.
@@ -1385,8 +1387,8 @@ Encode a parameter in headers likes @code{Content-Type} 
and
 @node ietf-drums
 @section ietf-drums
 
address@hidden is an IETF working group that is working on the replacement
-for RFC822.
address@hidden was an IETF working group that worked on Internet RFC 2822,
+the first successor to RFC 822 and a predecessor of the current email standard.
 
 The functions provided by this library include:
 
@@ -1597,7 +1599,7 @@ The five data representations used are the following:
 
 @table @var
 @item date
-An RFC822 (or similar) date string.  For instance: @code{"Sat Sep 12
+An RFC 822 (or similar) date string.  For instance: @code{"Sat Sep 12
 12:21:54 1998 +0200"}.
 
 @item time
@@ -1889,55 +1891,55 @@ in @file{/etc/mailcap} will ``win'' over an 
@samp{image/*} setting in
 The Emacs @acronym{MIME} library implements handling of various elements
 according to a (somewhat) large number of RFCs, drafts and standards
 documents.  This chapter lists the relevant ones.  They can all be
-fetched from @uref{http://quimby.gnus.org/notes/}.
+fetched from @uref{https://www.rfc-editor.org}.
 
 @table @dfn
address@hidden RFC822
address@hidden STD11
-Standard for the Format of ARPA Internet Text Messages.
address@hidden RFC 5322
+Internet Message Format
 
address@hidden RFC1036
-Standard for Interchange of USENET Messages
address@hidden RFC 5536
+Netnews Article Format
 
address@hidden RFC2045
address@hidden RFC 2045
 Format of Internet Message Bodies
 
address@hidden RFC2046
address@hidden RFC 2046
 Media Types
 
address@hidden RFC2047
address@hidden RFC 2047
 Message Header Extensions for address@hidden Text
 
address@hidden RFC2048
-Registration Procedures
address@hidden RFC 6838
+Media Type Specifications and Registration Procedures
+
address@hidden RFC 4289
+Registration Procedures (obsoleting RFC 2048)
 
address@hidden RFC2049
address@hidden RFC 2049
 Conformance Criteria and Examples
 
address@hidden RFC2231
address@hidden RFC 2231
 @acronym{MIME} Parameter Value and Encoded Word Extensions: Character Sets,
 Languages, and Continuations
 
address@hidden RFC1843
address@hidden RFC 1843
 HZ---A Data Format for Exchanging Files of Arbitrarily Mixed Chinese and
 @acronym{ASCII} characters
 
address@hidden draft-ietf-drums-msg-fmt-05.txt
-Draft for the successor of RFC822
-
address@hidden RFC2112
address@hidden RFC 2387
 The @acronym{MIME} Multipart/Related Content-type
 
address@hidden RFC1892
-The Multipart/Report Content Type for the Reporting of Mail System
address@hidden RFC 6522
address@hidden STD 73
+The Multipart/Report Media Type for the Reporting of Mail System
 Administrative Messages
 
address@hidden RFC2183
address@hidden RFC 2183
 Communicating Presentation Information in Internet Messages: The
 Content-Disposition Header Field
 
address@hidden RFC2646
-Documentation of the text/plain format parameter for flowed text.
address@hidden RFC 3676
+The Text/Plain Format and DelSp Parameters
 
 @end table
 
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index 3540707..ce3a30c 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -213,8 +213,8 @@ available in the Emacs Lisp library.  It does this by 
transforming the
 input line into a callable Lisp address@hidden see the Lisp form that will be 
invoked, type: @samp{eshell-parse-command "echo hello"}}
 
 The command can be either an Elisp function or an external command.
-Eshell looks first for an @ref{Aliases, alias} with the same name as the
-command, then a @ref{Built-ins, built-in command} or a function with the
+Eshell looks first for an alias (@pxref{Aliases}) with the same name as the
+command, then a built-in (@pxref{Built-ins}) or a function with the
 same name; if there is no match, it then tries to execute it as an
 external command.
 
@@ -253,7 +253,7 @@ eshell/ls is a compiled Lisp function in `em-ls.el'
 @end example
 
 If you want to discard a given built-in command, you could declare an
-alias, @ref{Aliases}.  Example:
+alias (@pxref{Aliases}).  Example:
 
 @example
 ~ $ which sudo
@@ -418,7 +418,7 @@ Lisp functions, based on successful completion).
 
 @end table
 
address@hidden for the built-in variables @samp{$*}, @samp{$1},
address@hidden, for the built-in variables @samp{$*}, @samp{$1},
 @samp{$2}, @dots{}, in alias definitions.
 
 @node Variables
@@ -629,8 +629,8 @@ to @code{"hello"}.
 Eshell's globbing syntax is very similar to that of Zsh.  Users coming
 from Bash can still use Bash-style globbing, as there are no
 incompatibilities.  Most globbing is pattern-based expansion, but there
-is also predicate-based expansion.  See
address@hidden Generation, , , zsh, The Z Shell Manual}
+is also predicate-based expansion.  @xref{Filename Generation, , ,
+zsh, The Z Shell Manual},
 for full syntax.  To customize the syntax and behavior of globbing in
 Eshell see the address@hidden@xref{Easy Customization, , , emacs,
 The GNU Emacs Manual}.}
diff --git a/doc/misc/gnus-coding.texi b/doc/misc/gnus-coding.texi
index 87af5e9..9554462 100644
--- a/doc/misc/gnus-coding.texi
+++ b/doc/misc/gnus-coding.texi
@@ -141,7 +141,7 @@ There are no Gnus dependencies in this file.
 There are no Gnus dependencies in this file.
 
 @item ietf-drums.el
-Functions for parsing RFC822bis headers.
+Functions for parsing RFC 2822 headers.
 @c As of 2005-10-21...
 There are no Gnus dependencies in this file.
 
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 2862264..ff2dd7d 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -9679,7 +9679,7 @@ Each article is divided into two parts---the head and the 
body.  The
 body can be divided into a signature part and a text part.  The variable
 that says what is to be considered a signature is
 @code{gnus-signature-separator}.  This is normally the standard
address@hidden $} as mandated by son-of-RFC 1036.  However, many people use
address@hidden $} as mandated by RFC 5536.  However, many people use
 non-standard signature separators, so this variable can also be a list
 of regular expressions to be tested, one by one.  (Searches are done
 from the end of the body towards the beginning.)  One likely value is:
@@ -15991,8 +15991,9 @@ Mailers and list servers are notorious for doing all 
sorts of really,
 really stupid things with mail.  ``Hey, RFC 822 doesn't explicitly
 prohibit us from adding the string @code{wE aRe ElItE!!!!!1!!} to the
 end of all lines passing through our server, so let's do that!!!!1!''
-Yes, but RFC 822 wasn't designed to be read by morons.  Things that were
-considered to be self-evident were not discussed.  So.  Here we are.
+Yes, but RFC 822 and its successors weren't designed to be read by
+morons.  Things that were considered to be self-evident were not
+discussed.  So.  Here we are.
 
 Case in point:  The German version of Microsoft Exchange adds @samp{AW:
 } to the subjects of replies instead of @samp{Re: }.  I could pretend to
@@ -17374,7 +17375,7 @@ Announcement messages from LANL Gov Announce.
 
 @cindex forwarded messages
 @item rfc822-forward
-A message forwarded according to RFC822.
+A message forwarded according to RFC 822 or its successors.
 
 @item outlook
 The Outlook mail box.
@@ -26721,18 +26722,20 @@ with, of course.
 
 @table @strong
 
address@hidden RFC (2)822
address@hidden RFC 822
 @cindex RFC 822
 @cindex RFC 2822
-There are no known breaches of this standard.
address@hidden RFC 5322
+There are no known breaches of this standard or its successors
+(currently RFCs 2822 and 5322).
 
 @item RFC 1036
 @cindex RFC 1036
-There are no known breaches of this standard, either.
+There are no known breaches of this (now-obsolete) standard, either.
 
address@hidden Son-of-RFC 1036
address@hidden Son-of-RFC 1036
-We do have some breaches to this one.
address@hidden RFC 5536
address@hidden RFC 5536
+We do have some breaches of this standard, the successor of RFC 1036.
 
 @table @emph
 
@@ -26747,10 +26750,9 @@ it wasn't for the @code{X-Newsreader} header.
 
 @item USEFOR
 @cindex USEFOR
-USEFOR is an IETF working group writing a successor to RFC 1036, based
-on Son-of-RFC 1036.  They have produced a number of drafts proposing
-various changes to the format of news articles.  The Gnus towers will
-look into implementing the changes when the draft is accepted as an RFC.
+USEFOR was an IETF working group that produced Internet RFCs 5536 and 5537.
+The Gnus towers will look into implementing the changes embodied by these
+standards.
 
 @item MIME---RFC 2045--2049 etc
 @cindex @acronym{MIME}
@@ -29529,7 +29531,8 @@ header         = <text> eol
 @end example
 
 @cindex BNF
-(The version of BNF used here is the one used in RFC822.)
+(The version of extended BNF used here is ABNF, the one used in Internet RFCs.
+See RFC 5234.)
 
 If the return value is @code{nov}, the data buffer should contain
 @dfn{network overview database} lines.  These are basically fields
@@ -30327,7 +30330,7 @@ almost suspect that the author looked at the 
@acronym{NOV} specification and
 just shamelessly @emph{stole} the entire thing, and one would be right.
 
 @dfn{Header} is a severely overloaded term.  ``Header'' is used in
-RFC 1036 to talk about lines in the head of an article (e.g.,
+RFC 5536 to talk about lines in the head of an article (e.g.,
 @code{From}).  It is used by many people as a synonym for
 ``head''---``the header and the body''.  (That should be avoided, in my
 opinion.)  And Gnus uses a format internally that it calls ``header'',
diff --git a/doc/misc/sc.texi b/doc/misc/sc.texi
index 8b25dac..7d53c6d 100644
--- a/doc/misc/sc.texi
+++ b/doc/misc/sc.texi
@@ -851,7 +851,8 @@ scanned.  Info key-value pairs are created for each header 
found.  Also,
 such useful information as the author's name and email address are
 extracted.  If the variable @code{sc-mail-warn-if-non-rfc822-p} is
 address@hidden, then Supercite will warn you if it finds a mail header
-that does not conform to RFC822.  This is rare and indicates a problem
+that does not conform to RFC 822 (or later).
+This is rare and indicates a problem
 either with your MUA or the original author's MUA, or some MTA (mail
 transport agent) along the way.
 
diff --git a/etc/AUTHORS b/etc/AUTHORS
index 0f4ec25..7b93876 100644
--- a/etc/AUTHORS
+++ b/etc/AUTHORS
@@ -108,8 +108,8 @@ Alan Shutko: changed diary-lib.el calendar.el bindings.el 
cal-hebrew.el
 
 Alan Third: wrote dabbrev-tests.el
 and changed nsterm.m nsfns.m nsterm.h nsmenu.m frame.el macfont.m
-  nsimage.m ns-win.el Info.plist.in conf_post.h frame.c frame.h
-  frames.texi keyboard.c macfont.h macos.texi picture.el rect.el xdisp.c
+  nsimage.m ns-win.el xdisp.c Info.plist.in conf_post.h frame.c frame.h
+  frames.texi keyboard.c macfont.h macos.texi picture.el rect.el
   battery.el callproc.c and 12 other files
 
 Alastair Burt: changed gnus-art.el smiley.el
@@ -163,7 +163,7 @@ Alexandru Harsanyi: wrote soap-client.el soap-inspect.el
 and changed emacs3.py vc-hooks.el vc.el xml.el
 
 Alex Branham: changed bibtex.el dired-x.el dired.el em-rebind.el eww.el
-  imenu.el programs.texi
+  imenu.el modes.texi programs.texi
 
 Alex Coventry: changed files.el
 
@@ -471,8 +471,9 @@ Benjamin Andresen: wrote ob-screen.el
 Benjamin Drieu: wrote pong.el
 and changed org-clock.el org.el
 
-Benjamin Riefenstahl: changed w32select.c emacs.c inc/ms-w32.h lisp.h
-  mac-win.el macterm.c mule-cmds.el runemacs.c tcl.el w32.c w32.h
+Benjamin Riefenstahl: changed w32select.c emacs.c image-mode.el image.el
+  inc/ms-w32.h lisp.h mac-win.el macterm.c mule-cmds.el runemacs.c tcl.el
+  w32.c w32.h
 
 Benjamin Rutt: co-wrote gnus-dired.el
 and changed vc.el gnus-msg.el message.el diff-mode.el ffap.el nnimap.el
@@ -699,7 +700,7 @@ and co-wrote longlines.el tango-dark-theme.el tango-theme.el
 and changed simple.el display.texi xdisp.c files.el frames.texi
   cus-edit.el files.texi custom.el subr.el text.texi faces.el keyboard.c
   startup.el package.el misc.texi emacs.texi modes.texi mouse.el
-  custom.texi image.c window.el and 936 other files
+  custom.texi image.c window.el and 935 other files
 
 Chris Chase: co-wrote idlw-shell.el idlwave.el
 
@@ -932,12 +933,16 @@ and changed package-test.el package-x.el ange-ftp.el
 
 Daniel Jensen: changed apropos.el
 
+Daniel Kahn Gillmor: changed mml-sec.el
+
 Daniel Koning: changed artist.el commands.texi subr.el
 
 Daniel LaLiberte: wrote cust-print.el edebug.el isearch.el
 and co-wrote hideif.el
 and changed mlconvert.el eval-region.el
 
+Daniel Lopez: changed progmodes/compile.el
+
 Daniel Lublin: changed dns-mode.el
 
 Daniel McClanahan: changed lisp-mode.el
@@ -1133,7 +1138,7 @@ and changed imenu.el pgg-def.el xterm.c
 David O'Toole: wrote ox-publish.el
 and co-wrote ob-lisp.el
 
-David Pathakjee: changed minibuf.c
+David Pathakjee: changed emacs-lisp/debug.el minibuf.c
 
 David Ponce: wrote bovine/grammar.el cedet.el comp.el java-tags.el
   mode-local.el recentf.el ruler-mode.el semantic/grammar.el
@@ -1209,7 +1214,8 @@ Derek Upham: changed nxml-mode.el
 Detlev Zundel: wrote re-builder.el
 and changed buffer.c
 
-Devon Sean McCullough: changed url-http.el comint.el ns-win.el
+Devon Sean McCullough: changed url-http.el buff-menu.el comint.el
+  ns-win.el
 
 Dhruva Krishnamurthy: changed emacsclient.c fontset.c sound.c w32proc.c
 
@@ -1434,7 +1440,7 @@ and changed c.srt ede.texi info.el rmail.el speedbspec.el 
cedet.el
   ede-autoconf.srt ede-make.srt eieio.texi gud.el sb-dir-minus.xpm
   sb-dir-plus.xpm sb-dir.xpm sb-mail.xpm sb-pg-minus.xpm sb-pg-plus.xpm
   sb-pg.xpm sb-tag-gt.xpm sb-tag-minus.xpm sb-tag-plus.xpm
-  sb-tag-type.xpm and 34 other files
+  sb-tag-type.xpm and 33 other files
 
 Eric Schulte: wrote ob-asymptote.el ob-awk.el ob-calc.el ob-comint.el
   ob-coq.el ob-css.el ob-ditaa.el ob-dot.el ob-emacs-lisp.el ob-eval.el
@@ -1735,7 +1741,7 @@ and changed configure.ac Makefile.in src/Makefile.in 
calendar.el
   diary-lib.el lisp/Makefile.in files.el rmail.el make-dist
   progmodes/f90.el bytecomp.el simple.el authors.el admin.el emacs.texi
   misc/Makefile.in startup.el lib-src/Makefile.in ack.texi display.texi
-  cal-menu.el and 1682 other files
+  cal-menu.el and 1681 other files
 
 Glynn Clements: wrote gamegrid.el snake.el tetris.el
 
@@ -1781,7 +1787,7 @@ Grégory Mounié: changed man.el
 
 Gregory Neil Shapiro: changed mailabbrev.el
 
-Gregor Zattler: changed emacs-lisp-intro.texi
+Gregor Zattler: changed eshell.texi emacs-lisp-intro.texi
 
 Greg Stark: changed gnus-ems.el timezone.el
 
@@ -2140,6 +2146,7 @@ and changed idlw-rinfo.el idlw-toolbar.el comint.el 
idlwave.texi vc.el
   mouse.el
 
 Jean-Christophe Helary: changed ns-win.el strings.texi subr-x.el
+  ucs-normalize.el
 
 Jean Haidouk: changed latin-alt.el latin-post.el latin-pre.el
 
@@ -2546,7 +2553,7 @@ Juri Linkov: wrote files-x.el misearch.el replace-tests.el
 and changed isearch.el info.el replace.el simple.el progmodes/grep.el
   dired.el dired-aux.el progmodes/compile.el startup.el faces.el files.el
   menu-bar.el bindings.el display.texi descr-text.el desktop.el comint.el
-  image-mode.el ispell.el man.el cus-edit.el and 360 other files
+  image-mode.el ispell.el man.el cus-edit.el and 359 other files
 
 Jussi Lahdenniemi: changed w32fns.c ms-w32.h msdos.texi w32.c w32.h
   w32console.c w32heap.c w32inevt.c w32term.h
@@ -2568,7 +2575,7 @@ and co-wrote longlines.el tramp-sh.el tramp.el
 and changed message.el gnus-agent.el gnus-sum.el files.el nnmail.el
   tramp.texi nntp.el gnus.el simple.el ange-ftp.el dired.el paragraphs.el
   bindings.el files.texi gnus-art.el gnus-group.el man.el INSTALL
-  Makefile.in crisp.el fileio.c and 45 other files
+  Makefile.in crisp.el fileio.c and 44 other files
 
 Kailash C. Chowksey: changed HELLO ind-util.el kannada.el knd-util.el
   lisp/Makefile.in loadup.el
@@ -2637,8 +2644,8 @@ Katsuhiro Hermit Endo: changed gnus-group.el gnus-spec.el
 
 Katsumi Yamaoka: wrote canlock.el
 and changed gnus-art.el message.el gnus-sum.el mm-decode.el gnus.texi
-  mm-util.el mm-view.el gnus-util.el gnus-group.el gnus-msg.el shr.el
-  mml.el rfc2047.el gnus-start.el gnus.el nntp.el gnus-agent.el nnrss.el
+  mm-util.el mm-view.el gnus-util.el gnus-group.el gnus-msg.el mml.el
+  shr.el rfc2047.el gnus-start.el gnus.el nntp.el gnus-agent.el nnrss.el
   mm-uu.el nnmail.el emacs-mime.texi and 160 other files
 
 Kaushal Modi: changed files.el isearch.el apropos.el calc-yank.el
@@ -2955,7 +2962,7 @@ Luc Teirlinck: wrote help-at-pt.el
 and changed files.el autorevert.el cus-edit.el subr.el simple.el
   frames.texi startup.el display.texi files.texi dired.el comint.el
   modes.texi custom.texi emacs.texi fns.c frame.el ielm.el minibuf.texi
-  variables.texi buffers.texi commands.texi and 213 other files
+  variables.texi buffers.texi commands.texi and 212 other files
 
 Ludovic Courtès: wrote nnregistry.el
 and changed configure.ac gnus.texi loadup.el
@@ -3160,7 +3167,7 @@ Martin Pohlack: changed iimage.el pc-select.el
 Martin Rudalics: changed window.el window.c windows.texi frame.c
   frames.texi w32fns.c xdisp.c xterm.c w32term.c frame.el xfns.c help.el
   buffer.c display.texi cus-start.el dispnew.c frame.h mouse.el nsfns.m
-  window.h gtkutil.c and 202 other files
+  window.h gtkutil.c and 203 other files
 
 Martin Stjernholm: wrote cc-bytecomp.el
 and co-wrote cc-align.el cc-cmds.el cc-compat.el cc-defs.el cc-engine.el
@@ -3283,7 +3290,7 @@ and changed tramp.texi tramp-adb.el trampver.el 
trampver.texi dbusbind.c
   file-notify-tests.el ange-ftp.el files.el dbus.texi files.texi
   autorevert.el tramp-fish.el kqueue.c tramp-gw.el tramp-imap.el os.texi
   configure.ac lisp.h gfilenotify.c inotify.c keyboard.c
-  and 222 other files
+  and 224 other files
 
 Michael Ben-Gershon: changed acorn.h configure.ac riscix1-1.h riscix1-2.h
   unexec.c
@@ -3349,7 +3356,7 @@ Michael Olson: changed erc.el erc-backend.el Makefile 
erc-track.el
   erc-log.el erc-stamp.el erc-autoaway.el erc-dcc.el erc-goodies.el
   erc-list.el erc-compat.el erc-identd.el erc.texi ERC-NEWS erc-bbdb.el
   erc-match.el erc-notify.el erc-ibuffer.el erc-services.el remember.el
-  erc-button.el and 56 other files
+  erc-button.el and 55 other files
 
 Michael Piotrowski: changed gnus-art.el gnus-sum.el ps-print.el
 
@@ -3547,6 +3554,8 @@ Niall Mansfield: changed etags.c
 
 Nic Ferrier: changed ert.el tramp.el
 
+Nicholas Drozd: changed calc.texi
+
 Nicholas Maniscalco: changed term.el
 
 Nick Alcock: changed control.texi customize.texi display.texi files.el
@@ -3556,6 +3565,8 @@ Nick Alcock: changed control.texi customize.texi 
display.texi files.el
 Nick Dokos: changed org-table.el ox.el icalendar.el mh-search.el
   org-mobile.el org.el ox-ascii.el url-cache.el
 
+Nick Drozd: changed eww.el eww.texi
+
 Nick Helm: changed eldoc.el help.el help.texi whitespace-tests.el
   whitespace.el
 
@@ -3742,7 +3753,7 @@ and co-wrote cal-dst.el
 and changed lisp.h configure.ac alloc.c process.c fileio.c editfns.c
   xdisp.c sysdep.c keyboard.c image.c emacs.c xterm.c data.c lread.c
   fns.c callproc.c Makefile.in gnulib.mk eval.c buffer.c frame.c
-  and 1600 other files
+  and 1608 other files
 
 Paul Fisher: changed fns.c
 
@@ -3901,6 +3912,8 @@ and changed package.el pcmpl-unix.el subr.el
 
 Philip Jackson: wrote find-cmd.el org-irc.el
 
+Philip K: changed ispell.el
+
 Philippe Schnoebelen: wrote gomoku.el mpuz.el
 
 Philippe Vaucher: changed callint.c composite.el debugging.texi
@@ -4146,9 +4159,9 @@ Roberto Rodríguez: changed ada-mode.texi glossary.texi 
widget.texi
 Robert P. Goldman: changed org.texi ob-exp.el org.el ox-latex.el
 
 Robert Pluim: changed gtkutil.c configure.ac files.texi dired-x.texi
-  ftfont.c misc.texi vc-git.el xfns.c xterm.c bindings.el desktop.el
-  efaq.texi epa.texi filelock.c font.c ftcrfont.c gnus-agent.el
-  gnus-demon.el gnus.texi gtkutil.h ido.el and 19 other files
+  ftfont.c misc.texi process.c vc-git.el xfns.c xterm.c bindings.el
+  desktop.el efaq.texi epa.texi filelock.c font.c ftcrfont.c
+  gnus-agent.el gnus-demon.el gnus.texi gtkutil.h and 19 other files
 
 Robert Thorpe: changed cus-start.el indent.el
 
@@ -4530,7 +4543,7 @@ and co-wrote todo-mode.el
 and changed todo-mode.texi diary-lib.el dired-tests.el doc-view.el
   files.el minibuffer.el wdired-tests.el dired.el frames.texi hl-line.el
   info.el menu-bar.el mouse.el otodo-mode.el subr.el .gitattributes
-  allout.el artist.el compile.texi cus-start.el descr-text.el
+  TUTORIAL allout.el artist.el compile.texi cus-start.el
   and 43 other files
 
 Stephen C. Gilardi: changed configure.ac
@@ -4697,7 +4710,7 @@ Teodor Zlatanov: wrote auth-source.el gnus-registry.el 
gnus-tests.el
 and changed spam.el gnus.el nnimap.el gnus.texi gnutls.c gnus-sum.el
   auth.texi cfengine.el gnus-sync.el gnus-util.el gnus-start.el netrc.el
   gnutls.h message.el spam-stat.el encrypt.el mail-source.el nnir.el
-  nnmail.el auth-source-tests.el configure.ac and 121 other files
+  nnmail.el auth-source-tests.el configure.ac and 120 other files
 
 Terje Rosten: changed xfns.c version.el xterm.c xterm.h
 
@@ -4915,6 +4928,8 @@ Trent W. Buck: changed rcirc.el remember.el rx.el
 
 Trevor Murphy: changed gnus.texi nnimap.el org.el
 
+Trevor Spiteri: changed progmodes/grep.el
+
 Trey Jackson: changed spam-stat.el
 
 Triet Hoai Lai: changed vntelex.el viet-util.el vietnamese.el
@@ -4998,6 +5013,8 @@ Vibhav Pant: changed bytecomp.el byte-opt.el bytecode.c 
bytecomp-tests.el
   emacs-module.c erc-backend.el erc.el eshell.texi fns.c hangul.el
   image.c lisp.h lread.c print.c profiler.c xterm.c
 
+Victor J. Orlikowski: changed erc-dcc.el
+
 Victor Zandy: wrote zone.el
 
 Viktor Rosenfeld: changed ob-sql.el org.el
diff --git a/etc/NEWS b/etc/NEWS
index 253da49..3c5fb24 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -698,6 +698,9 @@ has been executed.
 If set, shr will not render tags with attribute 'aria-hidden="true"'.
 This attribute is meant to tell screen readers to ignore a tag.
 
+---
+*** 'shr-tag-ol' now respects the ordered list 'start' attribute.
+
 ** Htmlfontify
 
 *** The functions 'hfy-color', 'hfy-color-vals' and
diff --git a/lisp/battery.el b/lisp/battery.el
index c21ba76..efd2a21 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -375,12 +375,12 @@ The following %-sequences are provided:
                            last-full-capacity design-capacity))
     (and capacity rate
         (setq minutes (if (zerop rate) 0
-                        (floor (* (/ (float (if (string= charging-state
-                                                         "charging")
-                                                (- full-capacity capacity)
-                                              capacity))
-                                     rate)
-                                  60)))
+                        (floor (* (if (string= charging-state
+                                               "charging")
+                                      (- full-capacity capacity)
+                                    capacity)
+                                  60)
+                               rate))
               hours (/ minutes 60)))
     (list (cons ?c (or (and capacity (number-to-string capacity)) "N/A"))
          (cons ?L (or (battery-search-for-one-match-in-files
@@ -414,8 +414,7 @@ The following %-sequences are provided:
          (cons ?p (or (and full-capacity capacity
                            (> full-capacity 0)
                            (number-to-string
-                            (floor (/ capacity
-                                      (/ (float full-capacity) 100)))))
+                            (floor (* 100 capacity) full-capacity)))
                       "N/A")))))
 
 
@@ -471,9 +470,9 @@ The following %-sequences are provided:
                  "POWER_SUPPLY_\\(CURRENT\\|POWER\\)_NOW=\\([0-9]*\\)$"
                  nil t)
            (cl-incf power-now
-                    (* (float (string-to-number (match-string 2)))
+                    (* (string-to-number (match-string 2))
                        (if (eq (char-after (match-beginning 1)) ?C)
-                           voltage-now 1.0))))
+                           voltage-now 1))))
          (goto-char (point-min))
          (when (re-search-forward "POWER_SUPPLY_TEMP=\\([0-9]*\\)$" nil t)
            (setq temperature (match-string 1)))
@@ -585,9 +584,7 @@ The following %-sequences are provided:
     (when seconds
       (setq minutes (/ seconds 60)
             hours (/ minutes 60)
-            remaining-time
-            (format "%d:%02d" (truncate hours)
-                    (- (truncate minutes) (* 60 (truncate hours))))))
+           remaining-time (format "%d:%02d" hours (mod minutes 60))))
     (list (cons ?c (or (and energy
                             (number-to-string (round (* 1000 energy))))
                        "N/A"))
@@ -656,10 +653,9 @@ The following %-sequences are provided:
          (setq minutes (string-to-number battery-life)
                seconds (* 60 minutes))
        (setq seconds (string-to-number battery-life)
-             minutes (truncate (/ seconds 60))))
-      (setq hours (truncate (/ minutes 60))
-           remaining-time (format "%d:%02d" hours
-                                  (- minutes (* 60 hours)))))
+             minutes (truncate seconds 60)))
+      (setq hours (truncate minutes 60)
+           remaining-time (format "%d:%02d" hours (mod minutes 60))))
     (list (cons ?L (or line-status "N/A"))
          (cons ?B (or (car battery-status) "N/A"))
          (cons ?b (or (cdr battery-status) "N/A"))
diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el
index 57747c6..2126cfd 100644
--- a/lisp/calendar/cal-dst.el
+++ b/lisp/calendar/cal-dst.el
@@ -231,7 +231,7 @@ The result has the proper form for 
`calendar-daylight-savings-starts'."
 ;; https://lists.gnu.org/r/emacs-pretest-bug/2006-11/msg00060.html
 (defun calendar-dst-find-data (&optional time)
   "Find data on the first daylight saving time transitions after TIME.
-TIME defaults to `current-time'.  Return value is as described
+TIME defaults to the current time.  Return value is as described
 for `calendar-current-time-zone'."
   (let* ((t0 (or time (current-time)))
          (t0-zone (current-time-zone t0))
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 31ace6f..a8fd765 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -643,12 +643,14 @@ FIXME: multiple comma-separated values should be allowed!"
               (setq year  (nth 2 mdy))))
         ;; create the decoded date-time
         ;; FIXME!?!
-        (condition-case nil
-            (decode-time (encode-time second minute hour day month year zone))
-          (error
-           (message "Cannot decode \"%s\"" isodatetimestring)
-           ;; hope for the best...
-           (list second minute hour day month year 0 nil 0))))
+       (let ((decoded-time (list second minute hour day month year
+                                 nil -1 zone)))
+         (condition-case nil
+             (decode-time (encode-time decoded-time 'integer))
+           (error
+            (message "Cannot decode \"%s\"" isodatetimestring)
+            ;; Hope for the best....
+            decoded-time))))
     ;; isodatetimestring == nil
     nil))
 
@@ -1596,8 +1598,7 @@ regular expression matching the start of non-marking 
entries.
 ENTRY-MAIN is the first line of the diary entry.
 
 Optional argument START determines the first day of the
-enumeration, given as a time value, in same format as returned by
-`current-time' -- used for test purposes."
+enumeration, given as a Lisp time value -- used for test purposes."
   (cond ((string-match (concat nonmarker
                                "%%(and \\(([^)]+)\\))\\(\\s-*.*?\\) ?$")
                        entry-main)
@@ -1621,8 +1622,7 @@ enumeration, given as a time value, in same format as 
returned by
                    (mapcar
                     (lambda (offset)
                       (let* ((day (decode-time (time-add now
-                                                        (encode-time
-                                                          (* offset 60 60 
24)))))
+                                                        (* 60 60 24 offset))))
                              (d (nth 3 day))
                              (m (nth 4 day))
                              (y (nth 5 day))
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el
index fb05a6c..93e7e53 100644
--- a/lisp/calendar/parse-time.el
+++ b/lisp/calendar/parse-time.el
@@ -147,7 +147,7 @@ letters, digits, plus or minus signs or colons."
 ;;;###autoload
 (defun parse-time-string (string)
   "Parse the time-string STRING into (SEC MIN HOUR DAY MON YEAR DOW DST TZ).
-STRING should be on something resembling an RFC2822 string, a la
+STRING should be something resembling an RFC 822 (or later) date-time, e.g.,
 \"Fri, 25 Mar 2016 16:24:56 +0100\", but this function is
 somewhat liberal in what format it accepts, and will attempt to
 return a \"likely\" value even for somewhat malformed strings.
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el
index 5c3580d..a896df5 100644
--- a/lisp/calendar/timeclock.el
+++ b/lisp/calendar/timeclock.el
@@ -467,16 +467,10 @@ include the second count.  If REVERSE-LEADER is non-nil, 
it means to
 output a \"+\" if the time value is negative, rather than a \"-\".
 This is used when negative time values have an inverted meaning (such
 as with time remaining, where negative time really means overtime)."
-  (if show-seconds
-      (format "%s%d:%02d:%02d"
-             (if (< seconds 0) (if reverse-leader "+" "-") "")
-             (truncate (/ (abs seconds) 60 60))
-             (% (truncate (/ (abs seconds) 60)) 60)
-             (% (truncate (abs seconds)) 60))
-    (format "%s%d:%02d"
+  (let ((s (abs (truncate seconds))))
+    (format (if show-seconds "%s%d:%02d:%02d" "%s%d:%02d")
            (if (< seconds 0) (if reverse-leader "+" "-") "")
-           (truncate (/ (abs seconds) 60 60))
-           (% (truncate (/ (abs seconds) 60)) 60))))
+           (/ s 3600) (% (/ s 60) 60) (% s 60))))
 
 (defsubst timeclock-currently-in-p ()
   "Return non-nil if the user is currently clocked in."
@@ -528,13 +522,12 @@ non-nil, the amount returned will be relative to past 
time worked."
   "Return a time value representing the end of today's workday.
 If TODAY-ONLY is non-nil, the value returned will be relative only to
 the time worked today, and not to past time."
-  (time-subtract nil
-                (let ((discrep (timeclock-find-discrep)))
-                  (if discrep
-                      (if today-only
-                          (cadr discrep)
-                        (car discrep))
-                    0))))
+  (time-since (let ((discrep (timeclock-find-discrep)))
+               (if discrep
+                   (if today-only
+                       (cadr discrep)
+                     (car discrep))
+                 0))))
 
 ;;;###autoload
 (defun timeclock-when-to-leave-string (&optional show-seconds
@@ -671,8 +664,8 @@ being logged for.  Normally only \"in\" events specify a 
project."
                    "\n")
            (if (equal (downcase code) "o")
                (setq timeclock-last-period
-                     (- (float-time now)
-                        (float-time (cadr timeclock-last-event)))
+                     (float-time
+                      (time-subtract now (cadr timeclock-last-event)))
                      timeclock-discrepancy
                      (+ timeclock-discrepancy
                         timeclock-last-period)))
@@ -707,8 +700,7 @@ recorded to disk.  If MOMENT is non-nil, use that as the 
current time.
 This is only provided for coherency when used by
 `timeclock-discrepancy'."
   (if (equal (car timeclock-last-event) "i")
-      (- (float-time moment)
-        (float-time (cadr timeclock-last-event)))
+      (float-time (time-subtract moment (cadr timeclock-last-event)))
     timeclock-last-period))
 
 (cl-defstruct (timeclock-entry
@@ -721,8 +713,7 @@ This is only provided for coherency when used by
 
 (defsubst timeclock-entry-length (entry)
   "Return the length of ENTRY in seconds."
-  (- (float-time (cadr entry))
-     (float-time (car entry))))
+  (float-time (time-subtract (cadr entry) (car entry))))
 
 (defsubst timeclock-entry-list-length (entry-list)
   "Return the total length of ENTRY-LIST in seconds."
@@ -741,8 +732,8 @@ This is only provided for coherency when used by
 
 (defsubst timeclock-entry-list-span (entry-list)
   "Return the total time in seconds spanned by ENTRY-LIST."
-  (- (float-time (timeclock-entry-list-end entry-list))
-     (float-time (timeclock-entry-list-begin entry-list))))
+  (float-time (time-subtract (timeclock-entry-list-end entry-list)
+                            (timeclock-entry-list-begin entry-list))))
 
 (defsubst timeclock-entry-list-break (entry-list)
   "Return the total break time (span - length) in ENTRY-LIST."
@@ -1109,7 +1100,7 @@ discrepancy, today's discrepancy, and the time worked 
today."
                           last-date-limited nil)
                     (if beg
                         (error "Error in format of timelog file!")
-                      (setq beg (float-time (cadr event))))))
+                      (setq beg (cadr event)))))
                  ((equal (downcase (car event)) "o")
                   (if (and (nth 2 event)
                            (> (length (nth 2 event)) 0))
@@ -1117,7 +1108,7 @@ discrepancy, today's discrepancy, and the time worked 
today."
                   (if (not beg)
                       (error "Error in format of timelog file!")
                     (setq timeclock-last-period
-                          (- (float-time (cadr event)) beg)
+                          (float-time (time-subtract (cadr event) beg))
                           accum (+ timeclock-last-period accum)
                           beg nil))
                   (if (equal last-date todays-date)
@@ -1262,12 +1253,11 @@ HTML-P is non-nil, HTML markup is added."
              (unless (time-less-p
                       (timeclock-day-begin day)
                       (aref lengths i))
-               (let ((base (float-time
-                            (timeclock-day-base
-                             (timeclock-day-begin day)))))
+               (let ((base (timeclock-day-base (timeclock-day-begin day))))
                  (nconc (aref time-in i)
-                        (list (- (float-time (timeclock-day-begin day))
-                                 base)))
+                        (list (float-time (time-subtract
+                                           (timeclock-day-begin day)
+                                           base))))
                  (let ((span (timeclock-day-span day))
                        (len (timeclock-day-length day))
                        (req (timeclock-day-required day)))
@@ -1278,8 +1268,9 @@ HTML-P is non-nil, HTML markup is added."
                    (when (and (> span 0)
                               (> (/ (float len) (float span)) 0.70))
                      (nconc (aref time-out i)
-                            (list (- (float-time (timeclock-day-end day))
-                                     base)))
+                            (list (float-time (time-subtract
+                                               (timeclock-day-end day)
+                                               base))))
                      (nconc (aref breaks i) (list (- span len))))
                    (if req
                        (setq len (+ len (- timeclock-workday req))))
diff --git a/lisp/cedet/ede/detect.el b/lisp/cedet/ede/detect.el
index daffb6e..e33f7a9 100644
--- a/lisp/cedet/ede/detect.el
+++ b/lisp/cedet/ede/detect.el
@@ -198,7 +198,7 @@ Return a cons cell:
        (ans (ede-detect-directory-for-project default-directory)))
     (if ans
        (message "Project found in %d sec @ %s of type %s"
-                (float-time (time-subtract nil start))
+                (encode-time (time-since start) 'integer)
                 (car ans)
                 (eieio-object-name-string (cdr ans)))
       (message "No Project found.") )))
diff --git a/lisp/completion.el b/lisp/completion.el
index 14ecc9b..89285c7 100644
--- a/lisp/completion.el
+++ b/lisp/completion.el
@@ -409,10 +409,7 @@ Used to decide whether to save completions.")
 (defun cmpl-coerce-string-case (string case-type)
   (cond ((eq case-type :down) (downcase string))
        ((eq case-type :up) (upcase string))
-       ((eq case-type :capitalized)
-        (setq string (downcase string))
-        (aset string 0 (logand ?\337 (aref string 0)))
-        string)
+       ((eq case-type :capitalized) (capitalize string))
        (t string)))
 
 (defun cmpl-merge-string-cases (string-to-coerce given-string)
@@ -435,7 +432,7 @@ Used to decide whether to save completions.")
 
 
 (defun cmpl-hours-since-origin ()
-  (floor (float-time) 3600))
+  (floor (encode-time nil 'integer) 3600))
 
 ;;---------------------------------------------------------------------------
 ;; "Symbol" parsing functions
diff --git a/lisp/desktop.el b/lisp/desktop.el
index a431d04..acabde5 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1544,10 +1544,10 @@ and try to load that."
           ;; for the sake of `clean-buffer-list': preserving the invariant
           ;; "how much time the user spent in Emacs without looking at this 
buffer".
           (setq buffer-display-time
-                (if buffer-display-time
-                    (time-add buffer-display-time
-                              (time-subtract nil desktop-file-modtime))
-                  (current-time)))
+               (time-since (if buffer-display-time
+                               (time-subtract desktop-file-modtime
+                                              buffer-display-time)
+                             0)))
          (unless (< desktop-file-version 208) ; Don't misinterpret any old 
custom args
            (dolist (record compacted-vars)
              (let*
diff --git a/lisp/ecomplete.el b/lisp/ecomplete.el
index fb23ead..d9f34ef 100644
--- a/lisp/ecomplete.el
+++ b/lisp/ecomplete.el
@@ -210,7 +210,7 @@ matches."
 (defun ecomplete-decay-1 (elem)
   ;; We subtract 5% from the item for each week it hasn't been used.
   (/ (car elem)
-     (expt 1.05 (/ (- (float-time) (cadr elem))
+     (expt 1.05 (/ (float-time (time-since (cadr elem)))
                    (* 7 24 60 60)))))
 
 ;; `ecomplete-get-matches' uses substring matching, so also use the `substring'
diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el
index f7384e1..5b5cda3 100644
--- a/lisp/emacs-lisp/benchmark.el
+++ b/lisp/emacs-lisp/benchmark.el
@@ -38,7 +38,7 @@
     `(let (,t1)
        (setq ,t1 (current-time))
        ,@forms
-       (float-time (time-subtract nil ,t1)))))
+       (float-time (time-since ,t1)))))
 
 ;;;###autoload
 (defmacro benchmark-run (&optional repetitions &rest forms)
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index b0ede3b..8989aa0 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -744,7 +744,7 @@ This function is called when SYMBOL's value is modified."
 
 When called interactively, prompt for VARIABLE in the minibuffer.
 
-This works by calling `add-variable-watch' on VARIABLE.  If you
+This works by calling `add-variable-watcher' on VARIABLE.  If you
 quit from the debugger, this will abort the change (unless the
 change is caused by the termination of a let-binding).
 
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index d6bd2c5..20d013b 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -1822,13 +1822,13 @@ determines how frequently the progress display is 
updated.")
   (force-mode-line-update)
   (redisplay t)
   (setf (ert--stats-next-redisplay stats)
-        (+ (float-time) ert-test-run-redisplay-interval-secs)))
+       (float-time (time-add nil ert-test-run-redisplay-interval-secs))))
 
 (defun ert--results-update-stats-display-maybe (ewoc stats)
   "Call `ert--results-update-stats-display' if not called recently.
 
 EWOC and STATS are arguments for `ert--results-update-stats-display'."
-  (when (>= (float-time) (ert--stats-next-redisplay stats))
+  (unless (time-less-p nil (ert--stats-next-redisplay stats))
     (ert--results-update-stats-display ewoc stats)))
 
 (defun ert--tests-running-mode-line-indicator ()
diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el
index c9b2fae..81e2f91 100644
--- a/lisp/emacs-lisp/timer-list.el
+++ b/lisp/emacs-lisp/timer-list.el
@@ -37,16 +37,14 @@
                       ;; Idle.
                       (if (aref timer 7) "*" " ")
                       ;; Next time.
-                      (let ((time (float-time (list (aref timer 1)
-                                                    (aref timer 2)
-                                                    (aref timer 3)))))
+                     (let ((time (list (aref timer 1)
+                                       (aref timer 2)
+                                       (aref timer 3))))
                         (format "%.2f"
-                                (if (aref timer 7)
-                                    time
-                                  (- (float-time (list (aref timer 1)
-                                                       (aref timer 2)
-                                                       (aref timer 3)))
-                                     (float-time)))))
+                               (float-time
+                                (if (aref timer 7)
+                                    time
+                                  (time-subtract time nil)))))
                       ;; Repeat.
                       (let ((repeat (aref timer 4)))
                         (cond
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 51d7e6f..f706d9b 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -74,7 +74,7 @@
 
 (defun timer-set-time (timer time &optional delta)
   "Set the trigger time of TIMER to TIME.
-TIME must be in the internal format returned by, e.g., `current-time'.
+TIME must be a Lisp time value.
 If optional third argument DELTA is a positive number, make the timer
 fire repeatedly that many seconds apart."
   (setf (timer--time timer) time)
@@ -249,8 +249,8 @@ how many will really happen."
 (defun timer-until (timer time)
   "Calculate number of seconds from when TIMER will run, until TIME.
 TIMER is a timer, and stands for the time when its next repeat is scheduled.
-TIME is a time-list."
-  (- (float-time time) (float-time (timer--time timer))))
+TIME is a Lisp time value."
+  (float-time (time-subtract time (timer--time timer))))
 
 (defun timer-event-handler (timer)
   "Call the handler for the timer TIMER.
@@ -281,7 +281,7 @@ This function is called, by name, directly by the C code."
               ;; perhaps because Emacs was suspended for a long time,
               ;; limit how many times things get repeated.
               (if (and (numberp timer-max-repeats)
-                       (< 0 (timer-until timer nil)))
+                      (time-less-p nil (timer--time timer)))
                   (let ((repeats (/ (timer-until timer nil)
                                     (timer--repeat-delay timer))))
                     (if (> repeats timer-max-repeats)
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 2fd3d45..2854cde 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -844,10 +844,9 @@ Additionally, detect whether the IRC process has hung."
              erc-server-last-received-time))
       (with-current-buffer buf
         (if (and erc-server-send-ping-timeout
-                 (>
-                  (erc-time-diff (erc-current-time)
-                                 erc-server-last-received-time)
-                  erc-server-send-ping-timeout))
+                 (time-less-p
+                  erc-server-send-ping-timeout
+                  (time-since erc-server-last-received-time)))
             (progn
               ;; if the process is hung, kill it
               (setq erc-server-timed-out t)
@@ -865,16 +864,15 @@ Additionally, detect whether the IRC process has hung."
 See `erc-server-flood-margin' for an explanation of the flood
 protection algorithm."
   (with-current-buffer buffer
-    (let ((now (erc-current-time)))
+    (let ((now (current-time)))
       (when erc-server-flood-timer
         (erc-cancel-timer erc-server-flood-timer)
         (setq erc-server-flood-timer nil))
-      (when (< erc-server-flood-last-message
-               now)
-        (setq erc-server-flood-last-message now))
+      (when (time-less-p erc-server-flood-last-message now)
+        (setq erc-server-flood-last-message (erc-emacs-time-to-erc-time now)))
       (while (and erc-server-flood-queue
-                  (< erc-server-flood-last-message
-                     (+ now erc-server-flood-margin)))
+                  (time-less-p erc-server-flood-last-message
+                               (time-add now erc-server-flood-margin)))
         (let ((msg (caar erc-server-flood-queue))
               (encoding (cdar erc-server-flood-queue)))
           (setq erc-server-flood-queue (cdr erc-server-flood-queue)
@@ -1070,8 +1068,8 @@ Hands off to helper functions via `erc-call-hooks'."
               erc-server-prevent-duplicates)
       (let ((m (erc-response.unparsed parsed-response)))
         ;; duplicate suppression
-        (if (< (or (gethash m erc-server-duplicates) 0)
-               (- (erc-current-time) erc-server-duplicate-timeout))
+        (if (time-less-p (or (gethash m erc-server-duplicates) 0)
+                         (time-since erc-server-duplicate-timeout))
             (erc-call-hooks process parsed-response))
         (puthash m (erc-current-time) erc-server-duplicates))
     ;; Hand off to the relevant handler.
@@ -1447,7 +1445,7 @@ add things to `%s' instead."
   "Handle pong messages." nil
   (let ((time (string-to-number (erc-response.contents parsed))))
     (when (> time 0)
-      (setq erc-server-lag (erc-time-diff time (erc-current-time)))
+      (setq erc-server-lag (erc-time-diff time nil))
       (when erc-verbose-server-ping
         (erc-display-message
          parsed 'notice proc 'PONG
@@ -1730,7 +1728,7 @@ See `erc-display-server-message'." nil
                (cdr (erc-response.command-args parsed))))
     (setq time (when on-since
                  (format-time-string erc-server-timestamp-format
-                                     (erc-string-to-emacs-time on-since))))
+                                     (string-to-number on-since))))
     (erc-update-user-nick nick nick nil nil nil
                           (and time (format "on since %s" time)))
     (if time
@@ -1802,7 +1800,7 @@ See `erc-display-server-message'." nil
 (define-erc-response-handler (329)
   "Channel creation date." nil
   (let ((channel (cadr (erc-response.command-args parsed)))
-        (time (erc-string-to-emacs-time
+        (time (string-to-number
                (nth 2 (erc-response.command-args parsed)))))
     (erc-display-message
      parsed 'notice (erc-get-buffer channel proc)
@@ -1844,7 +1842,7 @@ See `erc-display-server-message'." nil
   (pcase-let ((`(,channel ,nick ,time)
                (cdr (erc-response.command-args parsed))))
     (setq time (format-time-string erc-server-timestamp-format
-                                   (erc-string-to-emacs-time time)))
+                                   (string-to-number time)))
     (erc-update-channel-topic channel
                               (format "\C-o (%s, %s)" nick time)
                               'append)
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 2849e25..a6b7532 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -1024,7 +1024,7 @@ transfer is complete."
      ?s (number-to-string erc-dcc-byte-count)
      ?t (format "%.0f"
                 (erc-time-diff (plist-get erc-dcc-entry-data :start-time)
-                               (erc-current-time)))))
+                               nil))))
   (kill-buffer (process-buffer proc))
   (delete-process proc))
 
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index 6b526bd..cc4b4a8 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -601,7 +601,7 @@ See `erc-log-match-format'."
                                                       'timestamp))))
                  (away-time (erc-emacs-time-to-erc-time (erc-away-time))))
             (when (and away-time last-msg-time
-                       (erc-time-gt last-msg-time away-time))
+                       (time-less-p away-time last-msg-time))
               (erc-display-message
                nil 'notice 'active
                (format "You have logged messages waiting in \"%s\"."
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index f42bd64..e51e605 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -630,8 +630,8 @@ only consider active buffers visible.")
   (if erc-track-when-inactive
       (when erc-buffer-activity; could be nil
        (and (erc-track-get-buffer-window buffer erc-track-visibility)
-            (<= (erc-time-diff erc-buffer-activity (erc-current-time))
-                erc-buffer-activity-timeout)))
+            (not (time-less-p erc-buffer-activity-timeout
+                              (erc-time-diff erc-buffer-activity nil)))))
     (erc-track-get-buffer-window buffer erc-track-visibility)))
 
 ;;; Tracking the channel modifications
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 697e26b..101a5a0 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2565,8 +2565,8 @@ consumption for long-lived IRC or Emacs sessions."
      (maphash
       (lambda (nick last-PRIVMSG-time)
         (when
-            (> (float-time (time-subtract nil last-PRIVMSG-time))
-               erc-lurker-threshold-time)
+           (time-less-p erc-lurker-threshold-time
+                        (time-since last-PRIVMSG-time))
           (remhash nick hash)))
       hash)
      (if (zerop (hash-table-count hash))
@@ -2631,9 +2631,8 @@ server within `erc-lurker-threshold-time'.  See also
           (gethash (erc-lurker-maybe-trim nick)
                    (gethash server erc-lurker-state (make-hash-table)))))
     (or (null last-PRIVMSG-time)
-        (> (float-time
-            (time-subtract nil last-PRIVMSG-time))
-           erc-lurker-threshold-time))))
+       (time-less-p erc-lurker-threshold-time
+                    (time-since last-PRIVMSG-time)))))
 
 (defcustom erc-common-server-suffixes
   '(("openprojects.net\\'" . "OPN")
@@ -3412,7 +3411,7 @@ Otherwise leave the channel indicated by LINE."
 
 (defun erc-cmd-PING (recipient)
   "Ping RECIPIENT."
-  (let ((time (format "%f" (erc-current-time))))
+  (let ((time (format-time-string "%s.%6N")))
     (erc-log (format "cmd: PING: %s" time))
     (erc-cmd-CTCP recipient "PING" time)))
 
@@ -4640,7 +4639,7 @@ See also `erc-display-message'."
                        (user-full-name)
                        (user-login-name)
                        (system-name))))
-          (ns (erc-time-diff erc-server-last-sent-time (erc-current-time))))
+          (ns (erc-time-diff erc-server-last-sent-time nil)))
       (when (> ns 0)
         (setq s (concat s " Idle for " (erc-sec-to-time ns))))
       (erc-send-ctcp-notice nick s)))
@@ -4729,8 +4728,7 @@ See also `erc-display-message'."
       nil
     (let ((time (match-string 1 msg)))
       (condition-case nil
-          (let ((delta (erc-time-diff (string-to-number time)
-                                      (erc-current-time))))
+          (let ((delta (erc-time-diff (string-to-number time) nil)))
             (erc-display-message
              nil 'notice 'active
              'CTCP-PING ?n nick
@@ -4788,10 +4786,7 @@ If non-nil, return from being away."
                  (erc-default-target)
                  (if away-time
                      (format "is back (gone for %s)"
-                             (erc-sec-to-time
-                              (erc-time-diff
-                               (erc-emacs-time-to-erc-time away-time)
-                               (erc-current-time))))
+                             (erc-sec-to-time (erc-time-diff away-time nil)))
                    "is back")))))))))
     (erc-update-mode-line)))
 
@@ -5383,10 +5378,10 @@ submitted line to be intentional."
 (defun erc-send-current-line ()
   "Parse current line and send it to IRC."
   (interactive)
-  (let ((now (float-time)))
+  (let ((now (current-time)))
     (if (or (not erc-accidental-paste-threshold-seconds)
-            (< erc-accidental-paste-threshold-seconds
-               (- now erc-last-input-time)))
+            (time-less-p erc-accidental-paste-threshold-seconds
+                        (time-subtract now erc-last-input-time)))
         (save-restriction
           (widen)
           (if (< (point) (erc-beg-of-input-line))
@@ -6036,22 +6031,20 @@ non-nil value is found.
 
 ;; time routines
 
-(defun erc-string-to-emacs-time (string)
-  "Convert the long number represented by STRING into an Emacs timestamp."
-  (let* ((n (string-to-number (concat string ".0"))))
-    (list (truncate (/ n 65536))
-          (truncate (mod n 65536)))))
+(define-obsolete-function-alias 'erc-string-to-emacs-time 'string-to-number
+  "27.1")
 
 (defalias 'erc-emacs-time-to-erc-time 'float-time)
 (defalias 'erc-current-time 'float-time)
 
 (defun erc-time-diff (t1 t2)
-  "Return the time difference in seconds between T1 and T2."
-  (abs (- t2 t1)))
+  "Return the absolute value of the difference in seconds between T1 and T2."
+  (abs (float-time (time-subtract t1 t2))))
 
 (defun erc-time-gt (t1 t2)
   "Check whether T1 > T2."
-  (> t1 t2))
+  (declare (obsolete time-less-p "27.1"))
+  (time-less-p t2 t1))
 
 (defun erc-sec-to-time (ns)
   "Convert NS to a time string HH:MM.SS."
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 1cbd236..dd3351b 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -421,9 +421,8 @@ resultant list of strings."
       (forward-char))
     (if (looking-at "[0-9]+")
        (progn
-         (setq when (- (float-time)
-                       (* (string-to-number (match-string 0))
-                          quantum)))
+         (setq when (time-since (* (string-to-number (match-string 0))
+                                   quantum)))
          (goto-char (match-end 0)))
       (setq open (char-after))
       (if (setq close (memq open '(?\( ?\[ ?\< ?\{)))
@@ -438,17 +437,17 @@ resultant list of strings."
             (attrs (file-attributes file)))
        (unless attrs
          (error "Cannot stat file `%s'" file))
-       (setq when (float-time (nth attr-index attrs))))
+       (setq when (nth attr-index attrs)))
       (goto-char (1+ end)))
     `(lambda (file)
        (let ((attrs (file-attributes file)))
         (if attrs
             (,(if (eq qual ?-)
-                  '<
+                  'time-less-p
                 (if (eq qual ?+)
-                    '>
-                  '=)) ,when (float-time
-                              (nth ,attr-index attrs))))))))
+                    '(lambda (a b) (time-less-p b a))
+                  'time-equal-p))
+             ,when (nth ,attr-index attrs)))))))
 
 (defun eshell-pred-file-type (type)
   "Return a test which tests that the file is of a certain TYPE.
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index fca50d7..e4c4265 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -943,7 +943,8 @@ Summarize disk usage of each FILE, recursively for 
directories.")
 (defvar eshell-time-start nil)
 
 (defun eshell-show-elapsed-time ()
-  (let ((elapsed (format "%.3f secs\n" (- (float-time) eshell-time-start))))
+  (let ((elapsed (format "%.3f secs\n"
+                        (float-time (time-since eshell-time-start)))))
     (set-text-properties 0 (length elapsed) '(face bold) elapsed)
     (eshell-interactive-print elapsed))
   (remove-hook 'eshell-post-command-hook 'eshell-show-elapsed-time t))
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 191f623..06f7be3 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -3540,18 +3540,11 @@ possible values."
          (concat "Date: " (message-make-date time)))
         ;; Convert to Universal Time.
         ((eq type 'ut)
-         (concat "Date: "
-                 (substring
-                  (message-make-date
-                   (let* ((e (parse-time-string date))
-                          (tm (encode-time e))
-                          (ms (car tm))
-                          (ls (- (cadr tm) (car (current-time-zone time)))))
-                     (cond ((< ls 0) (list (1- ms) (+ ls 65536)))
-                           ((> ls 65535) (list (1+ ms) (- ls 65536)))
-                           (t (list ms ls)))))
-                  0 -5)
-                 "UT"))
+         (let ((system-time-locale "C"))
+           (format-time-string
+            "Date: %a, %d %b %Y %T UT"
+            (encode-time (parse-time-string date))
+            t)))
         ;; Get the original date from the article.
         ((eq type 'original)
          (concat "Date: " (if (string-match "\n+$" date)
@@ -3569,13 +3562,7 @@ possible values."
              (concat "Date: " (format-time-string format time)))))
         ;; ISO 8601.
         ((eq type 'iso8601)
-         (let ((tz (car (current-time-zone time))))
-           (concat
-            "Date: "
-            (format-time-string "%Y%m%dT%H%M%S" time)
-            (format "%s%02d%02d"
-                    (if (> tz 0) "+" "-") (/ (abs tz) 3600)
-                    (/ (% (abs tz) 3600) 60)))))
+         (format-time-string "Date: %Y%m%dT%H%M%S%z" time))
         ;; Do a lapsed format.
         ((eq type 'lapsed)
          (concat "Date: " (article-lapsed-string time)))
@@ -3623,18 +3610,14 @@ possible values."
 (defun article-lapsed-string (time &optional max-segments)
   ;; If the date is seriously mangled, the timezone functions are
   ;; liable to bug out, so we ignore all errors.
-  (let* ((real-time (time-subtract nil time))
-        (real-sec (and real-time
-                       (+ (* (float (car real-time)) 65536)
-                          (cadr real-time))))
-        (sec (and real-time (abs real-sec)))
+  (let* ((real-time (time-since time))
+        (real-sec (float-time real-time))
+        (sec (abs real-sec))
         (segments 0)
         num prev)
     (unless max-segments
       (setq max-segments (length article-time-units)))
     (cond
-     ((null real-time)
-      "Unknown")
      ((zerop sec)
       "Now")
      (t
diff --git a/lisp/gnus/gnus-cite.el b/lisp/gnus/gnus-cite.el
index d572f22..2216d4a 100644
--- a/lisp/gnus/gnus-cite.el
+++ b/lisp/gnus/gnus-cite.el
@@ -92,7 +92,7 @@ The first regexp group should match the Supercite 
attribution."
 ;;     -----Original Message-----
 ;;     From: ...
 ;;     To: ...
-;;     Sent: ...   [date, in non-RFC-2822 format]
+;;     Sent: ...   [date, in non-RFC-822-or-later format]
 ;;     Subject: ...
 ;;
 ;;     Cited message, with no prefixes
diff --git a/lisp/gnus/gnus-demon.el b/lisp/gnus/gnus-demon.el
index 4ae4c65..6c5e0b7 100644
--- a/lisp/gnus/gnus-demon.el
+++ b/lisp/gnus/gnus-demon.el
@@ -93,7 +93,7 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
 
 (defun gnus-demon-idle-since ()
   "Return the number of seconds since when Emacs is idle."
-  (float-time (or (current-idle-time) '(0 0 0))))
+  (float-time (or (current-idle-time) 0)))
 
 (defun gnus-demon-run-callback (func &optional idle time special)
   "Run FUNC if Emacs has been idle for longer than IDLE seconds.
@@ -192,11 +192,9 @@ marked with SPECIAL."
                            (elt nowParts 6)
                            (elt nowParts 7)
                            (elt nowParts 8)))
-        ;; calculate number of seconds between NOW and THEN
-        (diff (+ (* 65536 (- (car then) (car now)))
-                 (- (cadr then) (cadr now)))))
-    ;; return number of timesteps in the number of seconds
-    (round (/ diff gnus-demon-timestep))))
+        (diff (float-time (time-subtract then now))))
+    ;; Return number of timesteps in the number of seconds.
+    (round diff gnus-demon-timestep)))
 
 (gnus-add-shutdown 'gnus-demon-cancel 'gnus)
 
diff --git a/lisp/gnus/gnus-diary.el b/lisp/gnus/gnus-diary.el
index 51e3995..ceb0d4a 100644
--- a/lisp/gnus/gnus-diary.el
+++ b/lisp/gnus/gnus-diary.el
@@ -159,32 +159,29 @@ There are currently two built-in format functions:
   ;; Code partly stolen from article-make-date-line
   (let* ((extras (mail-header-extra header))
         (sched (gnus-diary-header-schedule extras))
-        (occur (nndiary-next-occurrence sched (current-time)))
         (now (current-time))
+        (occur (nndiary-next-occurrence sched now))
         (real-time (time-subtract occur now)))
-    (if (null real-time)
-       "?????"
-      (let* ((sec (+ (* (float (car real-time)) 65536) (cadr real-time)))
-            (past (< sec 0))
-            delay)
-       (and past (setq sec (- sec)))
-       (unless (zerop sec)
-         ;; This is a bit convoluted, but basically we go through the time
-         ;; units for years, weeks, etc, and divide things to see whether
-         ;; that results in positive answers.
-         (let ((units `((year . ,(* 365.25 24 3600))
-                        (month . ,(* 31 24 3600))
-                        (week . ,(* 7 24 3600))
-                        (day . ,(* 24 3600))
-                        (hour . 3600)
-                        (minute . 60)))
-               unit num)
-           (while (setq unit (pop units))
-             (unless (zerop (setq num (ffloor (/ sec (cdr unit)))))
-               (setq delay (append delay `((,(floor num) . ,(car unit))))))
-             (setq sec (- sec (* num (cdr unit)))))))
-       (funcall gnus-diary-delay-format-function past delay)))
-    ))
+    (let* ((sec (encode-time real-time 'integer))
+          (past (< sec 0))
+          delay)
+      (and past (setq sec (- sec)))
+      (unless (zerop sec)
+       ;; This is a bit convoluted, but basically we go through the time
+       ;; units for years, weeks, etc, and divide things to see whether
+       ;; that results in positive answers.
+       (let ((units `((year . ,(round (* 365.25 24 3600)))
+                      (month . ,(* 31 24 3600))
+                      (week . ,(* 7 24 3600))
+                      (day . ,(* 24 3600))
+                      (hour . 3600)
+                      (minute . 60)))
+             unit num)
+         (while (setq unit (pop units))
+           (unless (zerop (setq num (floor sec (cdr unit))))
+             (setq delay (append delay `((,num . ,(car unit))))))
+           (setq sec (mod sec (cdr unit))))))
+      (funcall gnus-diary-delay-format-function past delay))))
 
 ;; #### NOTE: Gnus sometimes gives me a HEADER not corresponding to any
 ;; message, with all fields set to nil here. I don't know what it is for, and
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index cf8423b..9f579bb 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -4590,7 +4590,7 @@ or `gnus-group-catchup-group-hook'."
   ;; FIXME: This should return a Lisp integer, not a Lisp float,
   ;; since it is always an integer.
   (let* ((time (or (gnus-group-timestamp group) 0))
-        (delta (time-subtract nil time)))
+        (delta (time-since time)))
     (float-time delta)))
 
 (defun gnus-group-timestamp-string (group)
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index a9d15f9..062dd1b 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -413,13 +413,12 @@ Return nil for non-recurring EVENT."
          (end-time (format-time-string "%H:%M" end))
          (end-at-midnight (string= end-time "00:00"))
          (start-end-date-diff
-         (/ (float-time (time-subtract
-                         (org-time-string-to-time end-date)
-                         (org-time-string-to-time start-date)))
-            86400))
+         (time-to-number-of-days (time-subtract
+                                  (org-time-string-to-time end-date)
+                                  (org-time-string-to-time start-date))))
          (org-repeat (gnus-icalendar-event:org-repeat event))
          (repeat (if org-repeat (concat " " org-repeat) ""))
-         (time-1-day '(0 86400)))
+        (time-1-day 86400))
 
     ;; NOTE: special care is needed with appointments ending at midnight
     ;; (typically all-day events): the end time has to be changed to 23:59 to
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 477eb9c..e23e53b 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -257,7 +257,8 @@ If it is down, start it up (again)."
       (insert (format-time-string "%H:%M:%S")
              (format " %.2fs %s %S\n"
                      (if (numberp gnus-backend-trace-elapsed)
-                         (- (float-time) gnus-backend-trace-elapsed)
+                         (float-time
+                          (time-since gnus-backend-trace-elapsed))
                        0)
                      type form))
       (setq gnus-backend-trace-elapsed (float-time)))))
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index f5fd4f3..6114fb5 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -1501,7 +1501,7 @@ If FORMAT, also format the current score file."
       (when (and gnus-summary-default-score
                 scores)
        (let* ((entries gnus-header-index)
-              (now (time-to-days (current-time)))
+              (now (time-to-days nil))
               (expire (and gnus-score-expiry-days
                            (- now gnus-score-expiry-days)))
               (headers gnus-newsgroup-headers)
@@ -2380,7 +2380,7 @@ score in `gnus-newsgroup-scored' by SCORE."
               (memq 'word gnus-newsgroup-adaptive))
       (with-temp-buffer
        (let* ((hashtb (gnus-make-hashtable 1000))
-              (date (time-to-days (current-time)))
+              (date (time-to-days nil))
               (data gnus-newsgroup-data)
               word d score val)
          (with-syntax-table gnus-adaptive-word-syntax-table
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 3a5886a..efb3e4f 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -3855,20 +3855,20 @@ respectively."
 Returns \"  ?  \" if there's bad input or if another error occurs.
 Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
   (condition-case ()
-      (let* ((messy-date (float-time (gnus-date-get-time messy-date)))
-            (now (float-time))
+      (let* ((messy-date (gnus-date-get-time messy-date))
+            (now (current-time))
             ;;If we don't find something suitable we'll use this one
             (my-format "%b %d '%y"))
-       (let* ((difference (- now messy-date))
+       (let* ((difference (time-subtract now messy-date))
               (templist gnus-user-date-format-alist)
               (top (eval (caar templist))))
-         (while (if (numberp top) (< top difference) (not top))
+         (while (if (numberp top) (time-less-p top difference) (not top))
            (progn
              (setq templist (cdr templist))
              (setq top (eval (caar templist)))))
          (if (stringp (cdr (car templist)))
              (setq my-format (cdr (car templist)))))
-       (format-time-string (eval my-format) (encode-time messy-date)))
+       (format-time-string (eval my-format) messy-date))
     (error "  ?   ")))
 
 (defun gnus-summary-set-local-parameters (group)
@@ -5093,8 +5093,8 @@ Unscored articles will be counted as having a score of 
zero."
   "Return the highest article date in THREAD."
   (apply 'max
         (mapcar (lambda (header) (float-time
-                             (gnus-date-get-time
-                              (mail-header-date header))))
+                                  (gnus-date-get-time
+                                   (mail-header-date header))))
                 (flatten-tree thread))))
 
 (defun gnus-thread-total-score-1 (root)
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index ca1466d..d570f78 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -139,7 +139,7 @@ This is a compatibility function for different Emacsen."
 
 (defun gnus-extract-address-components (from)
   "Extract address components from a From header.
-Given an RFC-822 address FROM, extract full name and canonical address.
+Given an RFC-822 (or later) address FROM, extract name and address.
 Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).  Much more simple
 solution than `mail-header-parse-address', which works much better, but
 is slower."
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 5a389fa..7514e64 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -647,9 +647,9 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff 
bfile)
          ;; Don't check for old incoming files more than once per day to
          ;; save a lot of file accesses.
          (when (or (null mail-source-incoming-last-checked-time)
-                   (> (float-time
-                       (time-since mail-source-incoming-last-checked-time))
-                      (* 24 60 60)))
+                   (time-less-p
+                    (* 24 60 60)
+                    (time-since mail-source-incoming-last-checked-time)))
            (setq mail-source-incoming-last-checked-time (current-time))
            (mail-source-delete-old-incoming
             mail-source-delete-incoming
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index b067452..0085337 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1285,10 +1285,9 @@ called and its result is inserted."
              (goto-char (point-min))
              (let ((case-fold-search nil))
                (re-search-forward "^OR\\>" nil t))))
-      ;; According to RFC822, "The field-name must be composed of printable
-      ;; ASCII characters (i. e., characters that have decimal values between
-      ;; 33 and 126, except colon)", i. e., any chars except ctl chars,
-      ;; space, or colon.
+      ;; According to RFC 822 and its successors, the field name must
+      ;; consist of printable US-ASCII characters other than colon,
+      ;; i.e., decimal 33-56 and 59-126.
       '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>address@hidden|}~]+:"))
   "Set this non-nil if the system's mailer runs the header and body together.
 \(This problem exists on Sunos 4 when sendmail is run in remote mode.)
@@ -1791,8 +1790,8 @@ You must have the \"hashcash\" binary installed, see 
`hashcash-path'."
     (concat
      "From "
 
-     ;; Many things can happen to an RFC 822 mailbox before it is put into
-     ;; a `From' line.  The leading phrase can be stripped, e.g.
+     ;; Many things can happen to an RFC 822 (or later) mailbox before it is
+     ;; put into a `From' line.  The leading phrase can be stripped, e.g.
      ;; `Joe <@w.x:address@hidden>' -> `<@w.x:address@hidden>'.  The <> can be 
stripped, e.g.
      ;; `<@x.y:address@hidden>' -> address@hidden:address@hidden'.  Everything 
starting with a CRLF
      ;; can be removed, e.g.
@@ -5732,7 +5731,7 @@ In posting styles use `(\"Expires\" (make-expires-date 
30))'."
        (insert fullname)
        (goto-char (point-min))
        ;; Look for a character that cannot appear unquoted
-       ;; according to RFC 822.
+       ;; according to RFC 822 (or later).
        (when (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" nil 1)
          ;; Quote fullname, escaping specials.
          (goto-char (point-min))
@@ -5746,8 +5745,7 @@ In posting styles use `(\"Expires\" (make-expires-date 
30))'."
        (let ((fullname-start (point)))
          (insert fullname)
          (goto-char fullname-start)
-         ;; RFC 822 says \ and nonmatching parentheses
-         ;; must be escaped in comments.
+         ;; \ and nonmatching parentheses must be escaped in comments.
          ;; Escape every instance of ()\ ...
          (while (re-search-forward "[()\\]" nil 1)
            (replace-match "\\\\\\&" t))
diff --git a/lisp/gnus/mm-bodies.el b/lisp/gnus/mm-bodies.el
index 73305a1..e1e1a12 100644
--- a/lisp/gnus/mm-bodies.el
+++ b/lisp/gnus/mm-bodies.el
@@ -35,7 +35,7 @@
 ;; BS, vertical TAB, form feed, and ^_
 ;;
 ;; Note that CR is *not* included, as that would allow a non-paired CR
-;; in the body contrary to RFC 2822:
+;; in the body contrary to RFC 822 (or later):
 ;;
 ;;   - CR and LF MUST only occur together as CRLF; they MUST NOT
 ;;     appear independently in the body.
diff --git a/lisp/gnus/nneething.el b/lisp/gnus/nneething.el
index 885d6f2..f64007a 100644
--- a/lisp/gnus/nneething.el
+++ b/lisp/gnus/nneething.el
@@ -319,7 +319,7 @@ included.")
      "Subject: " (file-name-nondirectory file) (or extra-msg "") "\n"
      "Message-ID: <nneething-" (nneething-encode-file-name file)
      "@" (system-name) ">\n"
-     (if (zerop (float-time (file-attribute-modification-time atts))) ""
+     (if (time-equal-p 0 (file-attribute-modification-time atts)) ""
        (concat "Date: "
               (current-time-string (file-attribute-modification-time atts))
               "\n"))
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index 7c8673e..090b842 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -1075,7 +1075,7 @@ See `find-file-noselect' for the arguments."
 (defvar nnheader-last-message-time '(0 0))
 (defun nnheader-message-maybe (&rest args)
   (let ((now (current-time)))
-    (when (> (float-time (time-subtract now nnheader-last-message-time)) 1)
+    (when (time-less-p 1 (time-subtract now nnheader-last-message-time))
       (setq nnheader-last-message-time now)
       (apply 'nnheader-message args))))
 
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 9646bb5..ac1d286 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -386,12 +386,12 @@ textual parts.")
        (with-current-buffer buffer
          (when (and nnimap-object
                     (nnimap-last-command-time nnimap-object)
-                    (> (float-time
-                        (time-subtract
-                         now
-                         (nnimap-last-command-time nnimap-object)))
-                       ;; More than five minutes since the last command.
-                       (* 5 60)))
+                    (time-less-p
+                     ;; More than five minutes since the last command.
+                     (* 5 60)
+                     (time-subtract
+                      now
+                      (nnimap-last-command-time nnimap-object))))
             (ignore-errors              ;E.g. "buffer foo has no process".
               (nnimap-send-command "NOOP"))))))))
 
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index c2e84c4..f6d7525 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -1882,7 +1882,7 @@ If TIME is nil, then return the cutoff time for oldness 
instead."
             (setq days (days-to-time days))
             ;; Compare the time with the current time.
             (if (null time)
-                (time-subtract nil days)
+                (time-since days)
               (ignore-errors (time-less-p days (time-since time)))))))))
 
 (declare-function gnus-group-mark-article-read "gnus-group" (group article))
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index 9df2292..5fabeac 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -764,7 +764,7 @@ This variable is set by `nnmaildir-request-article'.")
 
 (defun nnmaildir--scan (gname scan-msgs groups _method srv-dir srv-ls)
   (catch 'return
-    (let ((36h-ago (- (float-time) 129600))
+    (let ((36h-ago (time-since 129600))
          absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls
          files num dir flist group x)
       (setq absdir (nnmaildir--srvgrp-dir srv-dir gname)
@@ -1577,14 +1577,7 @@ This variable is set by `nnmaildir-request-article'.")
       (when no-force
        (unless (integerp time) ;; handle 'never
          (throw 'return (gnus-uncompress-range ranges)))
-       (setq boundary (current-time)
-             high (- (car boundary) (/ time 65536))
-             low (- (cadr boundary) (% time 65536)))
-       (if (< low 0)
-           (setq low (+ low 65536)
-                 high (1- high)))
-       (setcar (cdr boundary) low)
-       (setcar boundary high))
+       (setq boundary (time-since time)))
       (setq dir (nnmaildir--srv-dir nnmaildir--cur-server)
            dir (nnmaildir--srvgrp-dir dir gname)
            dir (nnmaildir--cur dir)
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index 6a47596..7f2accc 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -446,16 +446,16 @@ nnrss: %s: Not valid XML %s and libxml-parse-html-region 
doesn't work %s"
 (autoload 'timezone-parse-date "timezone")
 
 (defun nnrss-normalize-date (date)
-  "Return a date string of DATE in the RFC822 style.
+  "Return a date string of DATE in the style of RFC 822 and its successors.
 This function handles the ISO 8601 date format described in
-URL `http://www.w3.org/TR/NOTE-datetime', and also the RFC822 style
+URL `http://www.w3.org/TR/NOTE-datetime', and also the RFC 822 style
 which RSS 2.0 allows."
   (let (case-fold-search vector year month day time zone cts given)
     (cond ((null date))                        ; do nothing for this case
          ;; if the date is just digits (unix time stamp):
          ((string-match "^[0-9]+$" date)
           (setq given (encode-time (string-to-number date))))
-         ;; RFC822
+         ;; RFC 822
          ((string-match " [0-9]+ " date)
           (setq vector (timezone-parse-date date)
                 year (string-to-number (aref vector 0)))
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index fcda565..1b69574 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1948,11 +1948,10 @@ Otherwise buffers whose name matches an element of
   (ibuffer-mark-on-buffer
    #'(lambda (buf)
        (with-current-buffer buf
-        ;; hacked from midnight.el
         (when buffer-display-time
-          (let* ((now (float-time))
-                 (then (float-time buffer-display-time)))
-            (> (- now then) (* 60 60 ibuffer-old-time))))))))
+          (time-less-p
+           (* 60 60 ibuffer-old-time)
+           (time-since buffer-display-time)))))))
 
 ;;;###autoload
 (defun ibuffer-mark-special-buffers ()
diff --git a/lisp/image.el b/lisp/image.el
index 3aa3b0a..6da3a0b 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -804,19 +804,22 @@ If the image has a non-nil :speed property, it acts as a 
multiplier
 for the animation speed.  A negative value means to animate in reverse."
   (when (and (buffer-live-p (plist-get (cdr image) :animate-buffer))
              ;; Delayed more than two seconds more than expected.
-            (or (<= (- (float-time) target-time) 2)
+            (or (time-less-p (time-since target-time) 2)
                 (progn
                   (message "Stopping animation; animation possibly too big")
                   nil)))
     (image-show-frame image n t)
     (let* ((speed (image-animate-get-speed image))
-          (time (float-time))
+          (time (current-time))
           (animation (image-multi-frame-p image))
+          (time-to-load-image (time-since time))
+          (stated-delay-time (/ (or (cdr animation)
+                                    image-default-frame-delay)
+                                (float (abs speed))))
           ;; Subtract off the time we took to load the image from the
           ;; stated delay time.
-          (delay (max (+ (* (or (cdr animation) image-default-frame-delay)
-                            (/ 1.0 (abs speed)))
-                         time (- (float-time)))
+          (delay (max (float-time (time-subtract stated-delay-time
+                                                 time-to-load-image))
                       image-minimum-frame-delay))
           done)
       (setq n (if (< speed 0)
@@ -925,7 +928,7 @@ has no effect."
   :version "24.3")
 
 (defcustom imagemagick-enabled-types
-  '(3FR ART ARW AVS BMP BMP2 BMP3 CAL CALS CMYK CMYKA CR2 CRW
+  '(3FR ARW AVS BMP BMP2 BMP3 CAL CALS CMYK CMYKA CR2 CRW
     CUR CUT DCM DCR DCX DDS DJVU DNG DPX EXR FAX FITS GBR GIF
     GIF87 GRB HRZ ICB ICO ICON J2C JNG JP2 JPC JPEG JPG JPX K25
     KDC MIFF MNG MRW MSL MSVG MTV NEF ORF OTB PBM PCD PCDS PCL
@@ -959,7 +962,7 @@ has no effect."
   :set (lambda (symbol value)
         (set-default symbol value)
         (imagemagick-register-types))
-  :version "24.3")
+  :version "26.2")                      ; remove ART (bug#22289)
 
 (imagemagick-register-types)
 
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index a6c7669..dfaaa71 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -6854,7 +6854,7 @@ Trigger a debugger invocation when VARIABLE is changed.
 
 When called interactively, prompt for VARIABLE in the minibuffer.
 
-This works by calling `add-variable-watch' on VARIABLE.  If you
+This works by calling `add-variable-watcher' on VARIABLE.  If you
 quit from the debugger, this will abort the change (unless the
 change is caused by the termination of a let-binding).
 
@@ -19472,9 +19472,10 @@ the current value of `kmacro-counter').
 
 When used during defining/executing a macro, inserts the current value
 of `kmacro-counter' and increments the counter value by ARG (or by 1 if no
-prefix argument).  With just \\[universal-argument], inserts the current value
-of `kmacro-counter', but does not modify the counter; this is the
-same as incrementing the counter by zero.
+prefix argument).  With just \\[universal-argument], inserts the previous
+value of `kmacro-counter', and does not modify the counter; this is
+different from incrementing the counter by zero.  (The previous value
+of the counter is the one it had before the last increment.)
 
 The macro counter can be set directly via \\[kmacro-set-counter] and 
\\[kmacro-add-counter].
 The format of the inserted value of the counter can be controlled
@@ -20157,7 +20158,8 @@ and then select the region of un-tablified names and use
 ;;; Generated autoloads from mail/mail-extr.el
 
 (autoload 'mail-extract-address-components "mail-extr" "\
-Given an RFC-822 address ADDRESS, extract full name and canonical address.
+Extract full name and canonical address from ADDRESS.
+ADDRESS should be in RFC 822 (or later) format.
 Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).  If no
 name can be extracted, FULL-NAME will be nil.  Also see
 `mail-extr-ignore-single-names' and
@@ -20248,7 +20250,7 @@ This function normally would be called when the message 
is sent.
 ;;; Generated autoloads from mail/mail-utils.el
 
 (defvar mail-use-rfc822 nil "\
-If non-nil, use a full, hairy RFC822 parser on mail addresses.
+If non-nil, use a full, hairy RFC 822 (or later) parser on mail addresses.
 Otherwise, (the default) use a smaller, somewhat faster, and
 often correct parser.")
 
@@ -24925,7 +24927,7 @@ matching parenthesis is highlighted in 
`show-paren-style' after
 
 (autoload 'parse-time-string "parse-time" "\
 Parse the time-string STRING into (SEC MIN HOUR DAY MON YEAR DOW DST TZ).
-STRING should be on something resembling an RFC2822 string, a la
+STRING should be something resembling an RFC 822 (or later) date-time, e.g.,
 \"Fri, 25 Mar 2016 16:24:56 +0100\", but this function is
 somewhat liberal in what format it accepts, and will attempt to
 return a \"likely\" value even for somewhat malformed strings.
@@ -30047,7 +30049,7 @@ Otherwise, let mailer send back a message to report 
errors.")
 (defvar send-mail-function (if (and (boundp 'smtpmail-smtp-server) 
smtpmail-smtp-server) 'smtpmail-send-it 'sendmail-query-once) "\
 Function to call to send the current buffer as mail.
 The headers should be delimited by a line which is
-not a valid RFC822 header or continuation line,
+not a valid RFC 822 (or later) header or continuation line,
 that matches the variable `mail-header-separator'.
 This is used by the default mail-sending commands.  See also
 `message-send-mail-function' for use with the Message package.")
@@ -34215,6 +34217,7 @@ Return a string giving the duration of the Emacs 
initialization.
 
 (autoload 'date-to-time "time-date" "\
 Parse a string DATE that represents a date-time and return a time value.
+DATE should be in one of the forms recognized by `parse-time-string'.
 If DATE lacks timezone information, GMT is assumed.
 
 \(fn DATE)" nil nil)
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index 2b63343..a90d9c4 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -561,7 +561,7 @@ but common in some proprietary systems."
 ;; maybe some distant mail system needs it.  Really, though, if you
 ;; want a sender line in your mail, just put one in there and don't
 ;; wait for feedmail to do it for you.  (Yes, I know all about
-;; RFC-822 and RFC-1123, but are you *really* one of those cases
+;; RFC-822-or-later and RFC-1123, but are you *really* one of those cases
 ;; they're talking about?  I doubt it.)
 (defcustom feedmail-sender-line nil
   "If non-nil and the email has no Sender: header, use this value.
@@ -787,7 +787,7 @@ cases the name element of the fiddle-plex is ignored and is 
hardwired
 by feedmail to either \"Date\" or \"Resent-Date\".
 
 If you decide to format your own date field, do us all a favor and know
-what you're doing.  Study the relevant parts of RFC-822 and RFC-1123.
+what you're doing.  Study the relevant parts of RFC-822-or-later and RFC-1123.
 Don't make me come up there!
 
 You should let feedmail generate a Date: for you unless you are sure
@@ -1514,7 +1514,7 @@ function, for example, to archive all of your sent 
messages someplace
 
 
 (defvar feedmail-is-a-resend nil
-  "Non-nil means the message is a Resend (in the RFC-822 sense).
+  "Non-nil means the message is a Resend (in the RFC-822-or-later sense).
 This affects the composition of certain headers.  feedmail sets this
 variable as soon as it starts prepping the message text buffer, so any
 user-supplied functions can rely on it.  Users shouldn't set or change this
@@ -2369,7 +2369,7 @@ mapped to mostly alphanumerics for safety."
 
 (defun feedmail-rfc822-date (arg-time)
   (feedmail-say-debug ">in-> feedmail-rfc822-date %s" arg-time)
-  (let ((time (if arg-time arg-time (current-time)))
+  (let ((time (or arg-time (current-time)))
        (system-time-locale "C"))
     (concat
      (format-time-string "%a, %e %b %Y %T " time)
@@ -2443,7 +2443,7 @@ mapped to mostly alphanumerics for safety."
 
          (let ((case-fold-search t) (addr-regexp))
            (goto-char (point-min))
-           ;; There are some RFC-822 combinations/cases missed here,
+           ;; There are some RFC-822-or-later combinations/cases missed here,
            ;; but probably good enough and what users expect.
            ;;
            ;; Use resent-* stuff only if there is at least one non-empty one.
diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el
index 81377c9..29752cb 100644
--- a/lisp/mail/ietf-drums.el
+++ b/lisp/mail/ietf-drums.el
@@ -1,4 +1,4 @@
-;;; ietf-drums.el --- Functions for parsing RFC822bis headers  -*- 
lexical-binding:t -*-
+;;; ietf-drums.el --- Functions for parsing RFC 2822 headers  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
@@ -20,10 +20,10 @@
 
 ;;; Commentary:
 
-;; DRUMS is an IETF Working Group that works (or worked) on the
-;; successor to RFC822, "Standard For The Format Of Arpa Internet Text
-;; Messages".  This library is based on
-;; draft-ietf-drums-msg-fmt-05.txt, released on 1998-08-05.
+;; DRUMS is an IETF Working Group that worked on Internet RFC 2822,
+;; the successor to RFC 822 and the predecessor of RFC 5322.  This
+;; library is based on draft-ietf-drums-msg-fmt-05.txt, released on
+;; 1998-08-05.
 
 ;; Pending a real regression self test suite, Simon Josefsson added
 ;; various self test expressions snipped from bug reports, and their
diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el
index 1b650c9..ae849d7 100644
--- a/lisp/mail/mail-extr.el
+++ b/lisp/mail/mail-extr.el
@@ -1,4 +1,4 @@
-;;; mail-extr.el --- extract full name and address from RFC 822 mail header
+;;; mail-extr.el --- extract full name and address from email header
 
 ;; Copyright (C) 1991-1994, 1997, 2001-2019 Free Software Foundation,
 ;; Inc.
@@ -29,15 +29,15 @@
 ;;
 ;;    mail-extract-address-components: (address &optional all)
 ;;
-;;    Given an RFC-822 ADDRESS, extract full name and canonical address.
+;;    Given an RFC-822-or-later ADDRESS, extract name and address.
 ;;    Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).
 ;;    If no name can be extracted, FULL-NAME will be nil.
 ;;    ADDRESS may be a string or a buffer.  If it is a buffer, the visible
 ;;     (narrowed) portion of the buffer will be interpreted as the address.
 ;;     (This feature exists so that the clever caller might be able to avoid
 ;;     consing a string.)
-;;    If ADDRESS contains more than one RFC-822 address, only the first is
-;;     returned.
+;;    If ADDRESS contains more than one RFC-822-or-later address, only
+;;     the first is returned.
 ;;
 ;;    If ALL is non-nil, that means return info about all the addresses
 ;;     that are found in ADDRESS.  The value is a list of elements of
@@ -149,7 +149,7 @@
 ;;     * Handle "null" addresses.  Handle = used for spacing in mailbox
 ;;       name.  Fix bug in handling of ROUTE-ADDR-type addresses that are
 ;;       missing their brackets.  Handle uppercase "JR".  Extract full
-;;       names from X.400 addresses encoded in RFC-822.  Fix bug in
+;;       names from X.400 addresses encoded in RFC-822-or-later.  Fix bug in
 ;;        handling of multiple addresses where first has trailing comment.
 ;;        Handle more kinds of telephone extension lead-ins.
 ;;
@@ -209,7 +209,7 @@
 
 
 (defgroup mail-extr nil
-  "Extract full name and address from RFC 822 mail header."
+  "Extract full name and address from RFC 822 (or later) mail header."
   :prefix "mail-extr-"
   :group 'mail)
 
@@ -288,8 +288,9 @@ by translating things like \"address@hidden" into 
\"address@hidden"."
 (defconst mail-extr-all-letters-but-separators
   (purecopy "][[:alnum:]{|}'~`"))
 
-;; Any character that can occur in a name in an RFC822 address including
-;; the separator (hyphen and possibly period) for multipart names.
+;; Any character that can occur in a name in an RFC 822 (or later)
+;; address including the separator (hyphen and possibly period) for
+;; multipart names.
 ;; #### should . be in here?
 (defconst mail-extr-all-letters
   (purecopy (concat mail-extr-all-letters-but-separators "---")))
@@ -532,7 +533,8 @@ by translating things like \"address@hidden" into 
\"address@hidden"."
     (?.  ".")
     (?\[ ".")
     (?\] ".")
-    ;; % and ! aren't RFC822 characters, but it is convenient to pretend
+    ;; % and ! aren't RFC 822 (or later) characters,
+    ;; but it is convenient to pretend.
     (?%  ".")
     (?!  ".") ;; this needs to be word-constituent when not in .UUCP mode
     )
@@ -697,7 +699,8 @@ Unless NO-REPLACE is true, at each of the positions in 
LIST-SYMBOL
 
 ;;;###autoload
 (defun mail-extract-address-components (address &optional all)
-  "Given an RFC-822 address ADDRESS, extract full name and canonical address.
+  "Extract full name and canonical address from ADDRESS.
+ADDRESS should be in RFC 822 (or later) format.
 Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).  If no
 name can be extracted, FULL-NAME will be nil.  Also see
 `mail-extr-ignore-single-names' and
@@ -936,10 +939,10 @@ non-display use, you should probably use
          ;; Trim other punctuation lists of items outside < > pair to handle
          ;; stupid MTAs.
          (when <-pos                   ; don't need to check >-pos also
-           ;; handle bozo software that violates RFC 822 by sticking
-           ;; punctuation marks outside of a < > pair
+           ;; Handle bozo software that violates RFC 822 (or later)
+           ;; by sticking punctuation marks outside of a < > pair.
            (mail-extr-nuke-outside-range @-pos <-pos >-pos t)
-           ;; RFC 822 says nothing about these two outside < >, but
+           ;; RFC 822 (or later) says nothing about these two outside < >, but
            ;; remove those positions from the lists to make things
            ;; easier.
            (mail-extr-nuke-outside-range !-pos <-pos >-pos t)
@@ -1325,7 +1328,7 @@ non-display use, you should probably use
                       (narrow-to-region atom-beg atom-end)
                       (cond
 
-                       ;; Handle X.400 addresses encoded in RFC-822.
+                       ;; Handle X.400 addresses encoded in RFC 822 or later.
                        ;; *** Shit!  This has to handle the case where it is
                        ;; *** embedded in a quote too!
                        ;; *** Shit!  The input is being broken up into atoms
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index 61b9726..cbcbdfa 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -29,7 +29,7 @@
 
 ;;;###autoload
 (defcustom mail-use-rfc822 nil
-  "If non-nil, use a full, hairy RFC822 parser on mail addresses.
+  "If non-nil, use a full, hairy RFC 822 (or later) parser on mail addresses.
 Otherwise, (the default) use a smaller, somewhat faster, and
 often correct parser."
   :type 'boolean
@@ -384,7 +384,7 @@ The buffer should be narrowed to just the header."
         (date (mail-fetch-field "date"))
         ;; A From: header can contain multiple addresses, a "From "
         ;; line must contain only one.  (Bug#7760)
-        ;; See eg RFC 5322, 3.6.2. Originator Fields.
+        ;; See, e.g., RFC 5322, 3.6.2. Originator Fields.
         (end (string-match "[ \t]*[,\n]" from)))
     (format "From %s %s\n" (if end
                               (substring from 0 end)
diff --git a/lisp/mail/mailclient.el b/lisp/mail/mailclient.el
index 5dd66ff..4d8cda1 100644
--- a/lisp/mail/mailclient.el
+++ b/lisp/mail/mailclient.el
@@ -152,7 +152,7 @@ The mail client is taken to be the handler of mailto URLs."
                  (setq character-coding (downcase character-coding)))
                (concat
                 "mailto:";
-                ;; some of the headers according to RFC822
+                ;; Some of the headers according to RFC 822 (or later).
                 (mailclient-gather-addresses "To"
                                              'drop-first-name)
                 (mailclient-gather-addresses "cc"  )
diff --git a/lisp/mail/mailheader.el b/lisp/mail/mailheader.el
index 0db4df0..936f53e 100644
--- a/lisp/mail/mailheader.el
+++ b/lisp/mail/mailheader.el
@@ -23,7 +23,7 @@
 
 ;;; Commentary:
 
-;; This package provides an abstraction to RFC822-style messages, used in
+;; This package provides an abstraction of RFC 822 (or later) format, used in
 ;; mail, news, and some other systems.  The simple syntactic rules for such
 ;; headers, such as quoting and line folding, are routinely reimplemented
 ;; in many individual packages.  This package removes the need for this
diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el
index 95f9f8c..118ca8a 100644
--- a/lisp/mail/rfc2047.el
+++ b/lisp/mail/rfc2047.el
@@ -338,7 +338,7 @@ The buffer may be narrowed."
 
 ;; Use this syntax table when parsing into regions that may need
 ;; encoding.  Double quotes are string delimiters, backslash is
-;; character quoting, and all other RFC 2822 special characters are
+;; character quoting, and all other RFC 822 (or later) special characters are
 ;; treated as punctuation so we can use forward-sexp/forward-word to
 ;; skip to the end of regions appropriately.  Nb. ietf-drums does
 ;; things differently.
@@ -366,7 +366,7 @@ The buffer may be narrowed."
 
 (defun rfc2047-encode-region (b e &optional dont-fold)
   "Encode words in region B to E that need encoding.
-By default, the region is treated as containing RFC2822 addresses.
+By default, the region is treated as containing RFC 822 (or later) addresses.
 Dynamically bind `rfc2047-encoding-type' to change that."
   (save-restriction
     (narrow-to-region b e)
@@ -403,7 +403,7 @@ Dynamically bind `rfc2047-encoding-type' to change that."
        (with-syntax-table rfc2047-syntax-table
          (goto-char (point-min))
          (condition-case err           ; in case of unbalanced quotes
-             ;; Look for rfc2822-style: sequences of atoms, quoted
+             ;; Look for RFC 822 (or later) style: sequences of atoms, quoted
              ;; strings, specials, whitespace.  (Specials mustn't be
              ;; encoded.)
              (while (not (eobp))
@@ -1025,7 +1025,7 @@ other than `\"' and `\\' in quoted strings."
              (replace-match " "))
            (setq end (point-max))
            ;; Quote decoded words if there are special characters
-           ;; which might violate RFC2822.
+           ;; which might violate RFC 822 (or later).
            (when (and rfc2047-quote-decoded-words-containing-tspecials
                       (let ((regexp (car (rassq
                                           'address-mime
diff --git a/lisp/mail/rfc822.el b/lisp/mail/rfc822.el
index 594416f..a53a77e 100644
--- a/lisp/mail/rfc822.el
+++ b/lisp/mail/rfc822.el
@@ -1,4 +1,4 @@
-;;; rfc822.el --- hairy rfc822 parser for mail and news and suchlike
+;;; rfc822.el --- hairy RFC 822 (or later) parser for mail, news, etc.
 
 ;; Copyright (C) 1986-1987, 1990, 2001-2019 Free Software Foundation,
 ;; Inc.
@@ -24,8 +24,8 @@
 
 ;;; Commentary:
 
-;; Support functions for parsing RFC-822 headers, used by mail and news
-;; modes.
+;; Support functions for parsing headers used by mail and news modes.
+;; The header format is specified by Internet RFC 822 and its successors.
 
 ;;; Code:
 
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 0f89e0e..36821e8 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -779,8 +779,8 @@ The first parenthesized expression should match the 
MIME-charset name.")
     (concat
      "From "
 
-     ;; Many things can happen to an RFC 822 mailbox before it is put into
-     ;; a `From' line.  The leading phrase can be stripped, e.g.
+     ;; Many things can happen to an RFC 822 (or later) mailbox before it is
+     ;; put into a `From' line.  The leading phrase can be stripped, e.g.
      ;; `Joe <@w.x:address@hidden>' -> `<@w.x:address@hidden>'.  The <> can be 
stripped, e.g.
      ;; `<@x.y:address@hidden>' -> address@hidden:address@hidden'.  Everything 
starting with a CRLF
      ;; can be removed, e.g.
@@ -1003,8 +1003,8 @@ If `rmail-display-summary' is non-nil, make a summary for 
this RMAIL file."
   "Report that the buffer is not in the mbox file format.
 MSGNUM, if present, indicates the malformed message."
   (if msgnum
-      (error "Message %d is not a valid RFC2822 message" msgnum)
-    (error "Message is not a valid RFC2822 message")))
+      (error "Message %d is not a valid RFC 822 (or later) message" msgnum)
+    (error "Message is not a valid RFC 822 (or later) message")))
 
 (defun rmail-convert-babyl-to-mbox ()
   "Convert the mail file from Babyl version 5 to mbox.
@@ -2148,9 +2148,9 @@ Call with point at the end of the message."
     (insert "\n")))
 
 (defun rmail-add-mbox-headers ()
-  "Validate the RFC2822 format for the new messages.
+  "Validate the RFC 822 (or later) format for the new messages.
 Point should be at the first new message.
-An error is signaled if the new messages are not RFC2822
+An error is signaled if the new messages are not RFC 822 (or later)
 compliant.
 Unless an Rmail attribute header already exists, add it to the
 new messages.  Return the number of new messages."
@@ -3915,9 +3915,9 @@ which is an element of rmail-msgref-vector."
             (setq tem (copy-sequence tem))
             (set-text-properties 0 (length tem) nil tem)
             (setq tem (copy-sequence tem))
-            ;; Use prin1 to fake RFC822 quoting
+            ;; Use prin1 to fake RFC 822 (or later) quoting
             (let ((field (prin1-to-string tem)))
-              ;; Wrap it in parens to make it a comment according to RFC822
+              ;; Wrap it in parens to make it a comment.
               (if date
                   (concat "(" field "'s message of " date ")")
                 (concat "(" field ")"))))))
@@ -3946,7 +3946,7 @@ which is an element of rmail-msgref-vector."
              (if message-id
                  ;; "<address@hidden> (message from Unix Loser on 1-Apr-89)"
                  (concat message-id " (" field ")")
-              ;; Wrap in parens to make it a comment, for RFC822.
+              ;; Wrap in parens to make it a comment.
               (concat "(" field ")")))))
         (t
          ;; If we can't kludge it simply, do it correctly
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 9315d6a..93b6c90 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -150,7 +150,7 @@ Otherwise, let mailer send back a message to report errors."
       'smtpmail-send-it 'sendmail-query-once)
   "Function to call to send the current buffer as mail.
 The headers should be delimited by a line which is
-not a valid RFC822 header or continuation line,
+not a valid RFC 822 (or later) header or continuation line,
 that matches the variable `mail-header-separator'.
 This is used by the default mail-sending commands.  See also
 `message-send-mail-function' for use with the Message package."
@@ -908,7 +908,7 @@ the user from the mailer."
            (ml (when mail-mailing-lists
                 ;; The surrounding regexp assumes the use of
                 ;; `mail-strip-quoted-names' on addresses before matching
-                ;; Cannot deal with full RFC 822 freedom, but that is
+                ;; Cannot deal with full RFC 822 (or later), but that is
                 ;; unlikely to be problematic.
                 (concat "\\(?:[[:space:];,]\\|\\`\\)"
                         (regexp-opt mail-mailing-lists t)
@@ -1044,7 +1044,7 @@ This function does not perform RFC2047 encoding."
                 (fullname-end (point-marker)))
             (goto-char fullname-start)
             ;; Look for a character that cannot appear unquoted
-            ;; according to RFC 822.
+            ;; according to RFC 822 (or later).
             (if (or (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]"
                                        fullname-end 1)
                     quote-fullname)
@@ -1068,8 +1068,7 @@ This function does not perform RFC2047 encoding."
                 (insert "\""))
             (let ((fullname-end (point-marker)))
               (goto-char fullname-start)
-              ;; RFC 822 says \ and nonmatching parentheses
-              ;; must be escaped in comments.
+              ;; \ and nonmatching parentheses must be escaped in comments.
               ;; Escape every instance of ()\ ...
               (while (re-search-forward "[()\\]" fullname-end 1)
                 (replace-match "\\\\\\&" t))
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 49645ab..f31e0b4 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -259,7 +259,7 @@ for `smtpmail-try-auth-method'.")
                               (fullname-end (point-marker)))
                           (goto-char fullname-start)
                           ;; Look for a character that cannot appear unquoted
-                          ;; according to RFC 822.
+                          ;; according to RFC 822 or its successors.
                           (if (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]"
                                                  fullname-end 1)
                               (progn
@@ -277,8 +277,9 @@ for `smtpmail-try-auth-method'.")
                           (insert fullname)
                           (let ((fullname-end (point-marker)))
                             (goto-char fullname-start)
-                            ;; RFC 822 says \ and nonmatching parentheses
-                            ;; must be escaped in comments.
+                            ;; RFC 822 and its successors say \ and
+                            ;; nonmatching parentheses must be
+                            ;; escaped in comments.
                             ;; Escape every instance of ()\ ...
                             (while (re-search-forward "[()\\]" fullname-end 1)
                               (replace-match "\\\\\\&" t))
diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el
index 10c61cb..ad69dca 100644
--- a/lisp/mail/supercite.el
+++ b/lisp/mail/supercite.el
@@ -315,7 +315,7 @@ during the initial citing via `sc-cite-original'."
   :group 'supercite-hooks)
 
 (defcustom sc-mail-warn-if-non-rfc822-p t
-  "Warn if mail headers don't conform to RFC822."
+  "Warn if mail headers don't conform to RFC 822 (or later)."
   :type 'boolean
   :group 'supercite-attr)
 (defcustom sc-mumble ""
@@ -738,10 +738,10 @@ If optional ATTRIBS-P is non-nil, the key/value pair is 
placed in
   nil)
 
 (defun sc-mail-error-in-mail-field ()
-  "Issue warning that mail headers don't conform to RFC 822."
+  "Issue warning that mail headers don't conform to email RFCs."
   (let* ((len (min (length curline) 10))
         (ellipsis (if (< len (length curline)) "..." ""))
-        (msg "Mail header \"%s%s\" doesn't conform to RFC 822. skipping..."))
+        (msg "Mail header \"%s%s\" doesn't conform to RFC 822 (or later). 
skipping..."))
     (message msg (substring curline 0 len) ellipsis))
   (beep)
   (sit-for 2)
diff --git a/lisp/man.el b/lisp/man.el
index 767e862..b1d0fd3 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -318,7 +318,7 @@ This regular expression should start with a `^' character.")
 
 (defvar Man-reference-regexp
   (concat "\\(" Man-name-regexp
-         "\\(‐?\n[ \t]+" Man-name-regexp "\\)*\\)[ \t]*(\\("
+         "\\(\\([-‐]\n\\)?[ \t]+" Man-name-regexp "\\)*\\)[ \t]*(\\("
          Man-section-regexp "\\))")
   "Regular expression describing a reference to another manpage.")
 
@@ -664,7 +664,7 @@ and the `Man-section-translations-alist' variables)."
      ;; "chmod(2V)" case ?
      ((string-match (concat "^" Man-reference-regexp "$") ref)
       (setq name (replace-regexp-in-string "[\n\t ]" "" (match-string 1 ref))
-           section (match-string 3 ref)))
+           section (match-string 4 ref)))
      ;; "2v chmod" case ?
      ((string-match (concat "^\\(" Man-section-regexp
                            "\\) +\\(" Man-name-regexp "\\)$") ref)
@@ -783,11 +783,22 @@ POS defaults to `point'."
       ;;     see this-
       ;;     command-here(1)
       ;; Note: This code gets executed iff our entry is after POS.
-      (when (looking-at "‐?[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)([0-9])")
-       (setq word (concat word (match-string-no-properties 1)))
+      (when (looking-at
+             (concat
+              "‐?[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)(" Man-section-regexp ")"))
+        (let ((1st-part word))
+          (setq word (concat word (match-string-no-properties 1)))
+          ;; If they use -Tascii, we cannot know whether a hyphen at
+          ;; EOL is or isn't part of the referenced manpage name.
+          ;; Heuristics: if the part of the manpage before the hyphen
+          ;; doesn't include a hyphen, we consider the hyphen to be
+          ;; added by troff, and remove it.
+          (or (not (eq (string-to-char (substring 1st-part -1)) ?-))
+              (string-match-p "-" (substring 1st-part 0 -1))
+              (setq word (replace-regexp-in-string "-" "" word))))
        ;; Make sure the section number gets included by the code below.
        (goto-char (match-end 1)))
-      (when (string-match "[-._]+$" word)
+      (when (string-match "[-._‐]+$" word)
        (setq word (substring word 0 (match-beginning 0))))
       ;; The following was commented out since the preceding code
       ;; should not produce a leading "*" in the first place.
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 3ff7765..bc09764 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -2420,14 +2420,14 @@ of citations entirely, choose \"None\"."
   :package-version '(MH-E . "8.0"))
 
 ;; These entries have been intentionally excluded by the developers.
-;;  "Comments:"                         ; RFC 2822 - show this one
+;;  "Comments:"                         ; RFC 822 (or later) - show this one
 ;;  "Fax:"                              ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
 ;;  "Mail-System-Version:"              ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
 ;;  "Mailer:"                           ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
 ;;  "Organization:"                     ;
 ;;  "Phone:"                            ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
 ;;  "Reply-By:"                         ; RFC 2156
-;;  "Reply-To:"                         ; RFC 2822
+;;  "Reply-To:"                         ; RFC 822 (or later)
 ;;  "Sender:"                           ;
 ;;  "User-Agent:"                       ; Similar to X-Mailer, so display it.
 ;;  "X-Mailer:"                         ;
@@ -2488,9 +2488,9 @@ of citations entirely, choose \"None\"."
     "From "                             ; sendmail
     "Generate-Delivery-Report:"         ; RFC 2156
     "Importance:"                       ; RFC 2156, 2421
-    "In-Reply-To:"                      ; RFC 2822
+    "In-Reply-To:"                      ; RFC 822 (or later)
     "Incomplete-Copy:"                  ; RFC 2156
-    "Keywords:"                         ; RFC 2822
+    "Keywords:"                         ; RFC 822 (or later)
     "Language:"                         ; RFC 2156
     "Lines:"                            ; RFC 1036
     "List-"                             ; RFC 2369, 2919
@@ -2500,7 +2500,7 @@ of citations entirely, choose \"None\"."
     "Mail-Reply-To:"                    ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Mailing-List:"                     ; Egroups/yahoogroups mailing list 
manager
     "Message-Content:"                  ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
-    "Message-Id:"                       ; RFC 822
+    "Message-ID:"                       ; RFC 822 (or later)
     "Message-Type:"                     ; RFC 2156
     "Mime-Version"                      ; RFC 2045
     "Msgid:"
@@ -2531,14 +2531,14 @@ of citations entirely, choose \"None\"."
     "Priority:"                         ; RFC 2156
     "Read-Receipt-To:"                  ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Received-SPF:"                     ; Gmail
-    "Received:"                         ; RFC 822
-    "References:"                       ; RFC 2822
+    "Received:"                         ; RFC 822 (or later)
+    "References:"                       ; RFC 822 (or later)
     "Registered-Mail-Reply-Requested-By:"       ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Remailed-"                         ; MH
     "Replaces:"                         ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Replied:"                          ; MH
-    "Resent-"                           ; RFC 2822
-    "Return-Path:"                      ; RFC 822
+    "Resent-"                           ; RFC 822 (or later)
+    "Return-Path:"                      ; RFC 822 (or later)
     "Return-Receipt-Requested:"         ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Return-Receipt-To:"                ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Seal-Send-Time:"
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
index 9526338..cad6278 100644
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -888,7 +888,7 @@ in this situation."
 ;;;###mh-autoload
 (defun mh-header-field-beginning ()
   "Move to the beginning of the current header field.
-Handles RFC 822 continuation lines."
+Handle RFC 822 (or later) continuation lines."
   (beginning-of-line)
   (while (looking-at "^[ \t]")
     (forward-line -1)))
@@ -896,7 +896,7 @@ Handles RFC 822 continuation lines."
 ;;;###mh-autoload
 (defun mh-header-field-end ()
   "Move to the end of the current header field.
-Handles RFC 822 continuation lines."
+Handle RFC 822 (or later) continuation lines."
   (forward-line 1)
   (while (looking-at "^[ \t]")
     (forward-line 1))
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index cc87ffa..9fe961d 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -174,10 +174,14 @@ ACTION can be one of nil, t or `lambda'."
 
 (defun completion-table-dynamic (fun &optional switch-buffer)
   "Use function FUN as a dynamic completion table.
-FUN is called with one argument, the string for which completion is required,
-and it should return an alist containing all the intended possible completions.
-This alist may be a full list of possible completions so that FUN can ignore
-the value of its argument.
+FUN is called with one argument, the string for which completion is requested,
+and it should return a completion table containing all the intended possible
+completions.
+This table is allowed to include elements that do not actually match the
+string: they will be automatically filtered out.
+The completion table returned by FUN can use any of the usual formats of
+completion tables such as lists, alists, and hash-tables.
+
 If SWITCH-BUFFER is non-nil and completion is performed in the
 minibuffer, FUN will be called in the buffer from which the minibuffer
 was entered.
@@ -185,6 +189,8 @@ was entered.
 The result of the `completion-table-dynamic' form is a function
 that can be used as the COLLECTION argument to `try-completion' and
 `all-completions'.  See Info node `(elisp)Programmed Completion'.
+The completion table returned by `completion-table-dynamic' has empty
+metadata and trivial boundaries.
 
 See also the related function `completion-table-with-cache'."
   (lambda (string pred action)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 698c2ce..835eaa3 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -98,7 +98,7 @@ point at the click position."
 
 (defun mouse--down-1-maybe-follows-link (&optional _prompt)
   (when mouse-1-click-follows-link
-    (setq mouse--last-down (cons (car-safe last-input-event) (float-time))))
+    (setq mouse--last-down (cons (car-safe last-input-event) (current-time))))
   nil)
 
 (defun mouse--click-1-maybe-follows-link (&optional _prompt)
@@ -110,8 +110,10 @@ Expects to be bound to `(double-)mouse-1' in 
`key-translation-map'."
          ('double (eq 'double-mouse-1 (car-safe last-input-event)))
          (_ (and (eq 'mouse-1 (car-safe last-input-event))
                  (or (not (numberp mouse-1-click-follows-link))
-                     (funcall (if (< mouse-1-click-follows-link 0) #'> #'<)
-                              (- (float-time) (cdr mouse--last-down))
+                    (funcall (if (< mouse-1-click-follows-link 0)
+                                 (lambda (a b) (time-less-p b a))
+                               #'time-less-p)
+                             (time-since (cdr mouse--last-down))
                               (/ (abs mouse-1-click-follows-link) 1000.0))))))
        (eq (car mouse--last-down)
            (event-convert-list (list 'down (car-safe last-input-event))))
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 4a34987..8e557ed 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -2555,7 +2555,6 @@ If stopped, start playback."
 (defvar mpc--faster-toggle-forward nil)
 (defvar mpc--faster-acceleration 0.5)
 (defun mpc--faster-toggle (speedup step)
-  (setq speedup (float speedup))
   (if mpc--faster-toggle-timer
       (mpc--faster-stop)
     (mpc-status-refresh) (mpc-proc-sync)
@@ -2582,7 +2581,7 @@ If stopped, start playback."
                    (setq songtime (string-to-number
                                    (cdr (assq 'time mpc-status))))
                    (setq songduration (mpc--songduration))
-                   (setq oldtime (float-time)))
+                  (setq oldtime (current-time)))
                   ((and (>= songtime songduration) mpc--faster-toggle-forward)
                    ;; Skip to the beginning of the next song.
                    (if (not (equal (cdr (assq 'state mpc-status)) "play"))
@@ -2601,14 +2600,16 @@ If stopped, start playback."
                        (lambda ()
                          (setq songid (cdr (assq 'songid mpc-status)))
                          (setq songtime (setq songduration 
(mpc--songduration)))
-                         (setq oldtime (float-time))
+                        (setq oldtime (current-time))
                          (mpc-proc-cmd (list "seekid" songid songtime)))))))
                   (t
                    (setq speedup (+ speedup mpc--faster-acceleration))
                    (let ((newstep
-                          (truncate (* speedup (- (float-time) oldtime)))))
+                         (truncate
+                          (* speedup
+                             (float-time (time-since oldtime))))))
                      (if (<= newstep 1) (setq newstep 1))
-                     (setq oldtime (+ oldtime (/ newstep speedup)))
+                    (setq oldtime (time-add oldtime (/ newstep speedup)))
                      (if (not mpc--faster-toggle-forward)
                          (setq newstep (- newstep)))
                      (setq songtime (min songduration (+ songtime newstep)))
diff --git a/lisp/net/imap.el b/lisp/net/imap.el
index 0931252..9f43c57 100644
--- a/lisp/net/imap.el
+++ b/lisp/net/imap.el
@@ -1918,11 +1918,7 @@ on failure."
          (unless (< len 10)
            (setq imap-have-messaged t)
            (message "imap read: %dk" len))
-         (accept-process-output imap-process
-                                (truncate imap-read-timeout)
-                                (truncate (* (- imap-read-timeout
-                                                (truncate imap-read-timeout))
-                                             1000)))))
+         (accept-process-output imap-process imap-read-timeout)))
       ;; A process can die _before_ we have processed everything it
       ;; has to say.  Moreover, this can happen in between the call to
       ;; accept-process-output and the call to process-status in an
@@ -2076,23 +2072,23 @@ Return nil if no complete line has arrived."
 ;;                      addr-host ")"
 ;;
 ;;   addr-adl        = nstring
-;;                       ; Holds route from [RFC-822] route-addr if
+;;                       ; Holds route from [RFC-822 (or later)] route-addr if
 ;;                       ; non-nil
 ;;
 ;;   addr-host       = nstring
-;;                       ; nil indicates [RFC-822] group syntax.
-;;                       ; Otherwise, holds [RFC-822] domain name
+;;                       ; nil indicates [RFC-822 (or later)] group syntax.
+;;                       ; Otherwise, holds [RFC-822 (or later)] domain name
 ;;
 ;;   addr-mailbox    = nstring
-;;                       ; nil indicates end of [RFC-822] group; if
+;;                       ; nil indicates end of [RFC-822 (or later)] group; if
 ;;                       ; non-nil and addr-host is nil, holds
-;;                       ; [RFC-822] group name.
-;;                       ; Otherwise, holds [RFC-822] local-part
-;;                       ; after removing [RFC-822] quoting
+;;                       ; [RFC-822 (or later)] group name.
+;;                       ; Otherwise, holds [RFC-822 (or later)] local-part
+;;                       ; after removing [RFC-822 (or later)] quoting
 ;;
 ;;   addr-name       = nstring
-;;                       ; If non-nil, holds phrase from [RFC-822]
-;;                       ; mailbox after removing [RFC-822] quoting
+;;                       ; If non-nil, holds phrase from [RFC-822 (or later)]
+;;                       ; mailbox after removing [RFC-822 (or later)] quoting
 ;;
 
 (defsubst imap-parse-address ()
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index ac58ed9..9925a04 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -1691,8 +1691,8 @@ Examples:
     nil))
 
 (defun newsticker--decode-rfc822-date (rfc822-string)
-  "Return RFC822-STRING in format like `decode-time'.
-Converts from RFC822 to Emacs representation.
+  "Convert RFC822-STRING to a Lisp timestamp.
+RFC822-STRING should use RFC 822 (or later) format.
 Examples:
 Sat, 07 September 2002 00:00:01 +0100
 Sat, 07 September 2002 00:00:01 MET
@@ -1802,7 +1802,7 @@ download it from URL first."
              (time-less-p nil
                           (time-add (file-attribute-modification-time
                                     (file-attributes image-name))
-                                   (encode-time 86400))))
+                                   86400)))
         (newsticker--debug-msg "%s: Getting image for %s skipped"
                                (format-time-string "%A, %H:%M")
                                feed-name)
@@ -1995,8 +1995,7 @@ older than TIME."
          (mapc
           (lambda (item)
             (when (eq (newsticker--age item) old-age)
-              (let ((exp-time (time-add (newsticker--time item)
-                                       (encode-time time))))
+             (let ((exp-time (time-add (newsticker--time item) time)))
                 (when (time-less-p exp-time nil)
                   (newsticker--debug-msg
                    "Item `%s' from %s has expired on %s"
diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el
index 3aac5b5..cd6a113 100644
--- a/lisp/net/pop3.el
+++ b/lisp/net/pop3.el
@@ -180,8 +180,8 @@ Shorter values mean quicker response, but are more CPU 
intensive.")
 ;;  ("SERVER_B" ("USER_B1" "UIDL1" TIMESTAMP1 "UIDL2" TIMESTAMP2...)
 ;;              ("USER_B2" "UIDL1" TIMESTAMP1 "UIDL2" TIMESTAMP2...)
 ;;              ...))
-;; Where TIMESTAMP is the most significant two digits of an Emacs time,
-;; i.e. the return value of `current-time'.
+;; Where TIMESTAMP is an Emacs time value (HI LO) representing the
+;; number of seconds (+ (ash HI 16) LO).
 
 ;;;###autoload
 (defun pop3-movemail (file)
@@ -380,7 +380,9 @@ Use streaming commands."
 (defun pop3-uidl-dele (process)
   "Delete messages according to `pop3-leave-mail-on-server'.
 Return non-nil if it is necessary to update the local UIDL file."
-  (let* ((ctime (current-time))
+  (let* ((ctime (encode-time nil 'list))
+        (age-limit (and (numberp pop3-leave-mail-on-server)
+                        (* 86400 pop3-leave-mail-on-server)))
         (srvr (assoc pop3-mailhost pop3-uidl-saved))
         (saved (assoc pop3-maildrop (cdr srvr)))
         i uidl mod new tstamp dele)
@@ -397,17 +399,13 @@ Return non-nil if it is necessary to update the local 
UIDL file."
           (setq new (mapcan (lambda (elt) (list elt ctime)) pop3-uidl))))
     (when new (setq mod t))
     ;; List expirable messages and delete them from the data to be saved.
-    (setq ctime (when (numberp pop3-leave-mail-on-server)
-                 (/ (+ (* (car ctime) 65536.0) (cadr ctime)) 86400))
-         i (1- (length saved)))
+    (setq i (1- (length saved)))
     (while (> i 0)
       (if (member (setq uidl (nth (1- i) saved)) pop3-uidl)
          (progn
            (setq tstamp (nth i saved))
-           (if (and ctime
-                    (> (- ctime (/ (+ (* (car tstamp) 65536.0) (cadr tstamp))
-                                   86400))
-                       pop3-leave-mail-on-server))
+           (if (and age-limit
+                    (time-less-p age-limit (time-subtract ctime tstamp)))
                ;; Mails to delete.
                (progn
                  (setq mod t)
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 24f1c42..b1a6c1c 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -670,8 +670,9 @@ last ping."
 
 (defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message)
   (with-rcirc-process-buffer process
-    (setq header-line-format (format "%f" (- (float-time)
-                                            (string-to-number message))))))
+    (setq header-line-format
+         (format "%f" (float-time
+                       (time-since (string-to-number message)))))))
 
 (defvar rcirc-debug-buffer "*rcirc debug*")
 (defvar rcirc-debug-flag nil
@@ -723,8 +724,8 @@ When 0, do not auto-reconnect."
                  (< 0 rcirc-reconnect-delay))
         (let ((now (current-time)))
           (when (or (null rcirc-last-connect-time)
-                    (< rcirc-reconnect-delay
-                       (float-time (time-subtract now 
rcirc-last-connect-time))))
+                   (time-less-p rcirc-reconnect-delay
+                                (time-subtract now rcirc-last-connect-time)))
             (setq rcirc-last-connect-time now)
             (rcirc-cmd-reconnect nil))))
       (run-hook-with-args 'rcirc-sentinel-functions process sentinel))))
@@ -2794,7 +2795,7 @@ the only argument."
   (let* ((nick (nth 1 args))
          (idle-secs (string-to-number (nth 2 args)))
          (idle-string (format-seconds "%yy %dd %hh %mm %z%ss" idle-secs))
-        (signon-time (encode-time (string-to-number (nth 3 args))))
+        (signon-time (string-to-number (nth 3 args)))
          (signon-string (format-time-string "%c" signon-time))
          (message (format "%s idle for %s, signed on %s"
                           nick idle-string signon-string)))
@@ -2815,8 +2816,7 @@ Not in rfc1459.txt"
     (with-current-buffer buffer
       (let ((setter (nth 2 args))
            (time (current-time-string
-                  (encode-time
-                   (string-to-number (cl-cadddr args))))))
+                  (string-to-number (cl-cadddr args)))))
        (rcirc-print process sender "TOPIC" (cadr args)
                     (format "%s (%s on %s)" rcirc-topic setter time))))))
 
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 94d68fa..2f628e1 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1755,7 +1755,14 @@ The preference is a float determined from 
`shr-prefer-media-type'."
 
 (defun shr-tag-ol (dom)
   (shr-ensure-paragraph)
-  (let ((shr-list-mode 1))
+  (let* ((attrs (dom-attributes dom))
+         (start-attr (alist-get 'start attrs))
+         ;; Start at 1 if there is no start attribute
+         ;; or if start can't be parsed as an integer.
+         (start-index (condition-case _
+                          (cl-parse-integer start-attr)
+                        (t 1)))
+         (shr-list-mode start-index))
     (shr-generic dom))
   (shr-ensure-paragraph))
 
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 487fc54..0fb9bea 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -128,8 +128,14 @@ Returns DEFAULT if not set."
        (and (consp value)
             (or (null remote-file-name-inhibit-cache)
                 (and (integerp remote-file-name-inhibit-cache)
-                     (<= (tramp-time-diff (current-time) (car value))
-                         remote-file-name-inhibit-cache))
+                     (time-less-p
+                      ;; `current-time' can be nil once we get rid of Emacs 24.
+                      (current-time)
+                      (time-add
+                       (car value)
+                      ;; `seconds-to-time' can be removed once we get
+                      ;; rid of Emacs 24.
+                       (seconds-to-time remote-file-name-inhibit-cache))))
                 (and (consp remote-file-name-inhibit-cache)
                      (time-less-p
                       remote-file-name-inhibit-cache (car value)))))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 49bc9bf..2d02961 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1635,9 +1635,9 @@ of."
                   (tramp-compat-time-equal-p
                    (tramp-compat-file-attribute-modification-time fa2)
                    tramp-time-dont-know)))
-                (> 0 (tramp-time-diff
-                      (tramp-compat-file-attribute-modification-time fa2)
-                      (tramp-compat-file-attribute-modification-time fa1)))
+                (time-less-p
+                 (tramp-compat-file-attribute-modification-time fa2)
+                 (tramp-compat-file-attribute-modification-time fa1))
               ;; If one of them is the dont-know value, then we can
               ;; still try to run a shell command on the remote host.
               ;; However, this only works if both files are Tramp
@@ -4784,9 +4784,12 @@ connection if a previous connection has died for some 
reason."
     (unless (or (process-live-p p)
                (not (tramp-file-name-equal-p
                      vec (car tramp-current-connection)))
-               (> (tramp-time-diff
-                   (current-time) (cdr tramp-current-connection))
-                  (or tramp-connection-min-time-diff 0)))
+               (time-less-p
+                ;; `current-time' can be removed once we get rid of Emacs 24.
+                (time-since (or (cdr tramp-current-connection) (current-time)))
+                ;; `seconds-to-time' can be removed once we get rid
+                ;; of Emacs 24.
+                (seconds-to-time (or tramp-connection-min-time-diff 0))))
       (throw 'suppress 'suppress))
 
     ;; If too much time has passed since last command was sent, look
@@ -4797,11 +4800,11 @@ connection if a previous connection has died for some 
reason."
     ;; try to send a command from time to time, then look again
     ;; whether the process is really alive.
     (condition-case nil
-       (when (and (> (tramp-time-diff
-                      (current-time)
-                      (tramp-get-connection-property
-                       p "last-cmd-time" '(0 0 0)))
-                     60)
+       ;; `seconds-to-time' can be removed once we get rid of Emacs 24.
+       (when (and (time-less-p (seconds-to-time 60)
+                               (time-since
+                                (tramp-get-connection-property
+                                 p "last-cmd-time" (seconds-to-time 0))))
                   (process-live-p p))
          (tramp-send-command vec "echo are you awake" t t)
          (unless (and (process-live-p p)
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index f57c76c..eda3081 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1900,11 +1900,11 @@ If ARGUMENT is non-nil, use it as argument for
     ;; connection timeout.
     (with-current-buffer buf
       (goto-char (point-min))
-      (when (and (> (tramp-time-diff
-                    (current-time)
-                    (tramp-get-connection-property
-                     p "last-cmd-time" '(0 0 0)))
-                   60)
+      ;; `seconds-to-time' can be removed once we get rid of Emacs 24.
+      (when (and (time-less-p (seconds-to-time 60)
+                             (time-since
+                              (tramp-get-connection-property
+                               p "last-cmd-time" (seconds-to-time 0))))
                 (process-live-p p)
                 (re-search-forward tramp-smb-errors nil t))
        (delete-process p)
diff --git a/lisp/nxml/rng-maint.el b/lisp/nxml/rng-maint.el
index 18e3898..56fbf12 100644
--- a/lisp/nxml/rng-maint.el
+++ b/lisp/nxml/rng-maint.el
@@ -228,8 +228,7 @@
   (let* ((start (current-time))
         (val (apply function args)))
     (message "%s ran in %g seconds"
-            function
-            (float-time (time-subtract nil start)))
+            function (float-time (time-since start)))
     val))
 
 (defun rng-time-tokenize-buffer ()
diff --git a/lisp/obsolete/xesam.el b/lisp/obsolete/xesam.el
index a1a4639..16da6d9 100644
--- a/lisp/obsolete/xesam.el
+++ b/lisp/obsolete/xesam.el
@@ -622,8 +622,7 @@ Return propertized STRING."
        (or (widget-get widget :tag) "")
        (format-time-string
         "%d %B %Y, %T"
-        (encode-time
-         (string-to-number (widget-get widget :xesam:sourceModified)))))))
+        (string-to-number (widget-get widget :xesam:sourceModified))))))
 
     ;; Second line: :value.
     (widget-put widget :value (widget-get widget :xesam:url))
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index d491dff..6593c6d 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -5867,12 +5867,12 @@ See also the user option 
`org-agenda-clock-consistency-checks'."
         ((> dt (* 60 maxtime))
          ;; a very long clocking chunk
          (setq issue (format "Clocking interval is very long: %s"
-                             (org-duration-from-minutes (floor (/ dt 60.))))
+                             (org-duration-from-minutes (floor dt 60)))
                face (or (plist-get pl :long-face) face)))
         ((< dt (* 60 mintime))
          ;; a very short clocking chunk
          (setq issue (format "Clocking interval is very short: %s"
-                             (org-duration-from-minutes (floor (/ dt 60.))))
+                             (org-duration-from-minutes (floor dt 60)))
                face (or (plist-get pl :short-face) face)))
         ((and (> tlend 0) (< ts tlend))
          ;; Two clock entries are overlapping
@@ -5912,8 +5912,8 @@ See also the user option 
`org-agenda-clock-consistency-checks'."
        (throw 'exit t))
     ;; We have a shorter gap.
     ;; Now we have to get the minute of the day when these times are
-    (let* ((t1dec (decode-time (encode-time t1)))
-          (t2dec (decode-time (encode-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)))))
@@ -10157,8 +10157,7 @@ to override `appt-message-warning-time'."
          ;; Do not use `org-today' here because appt only takes
          ;; time and without date as argument, so it may pass wrong
          ;; information otherwise
-         (today (org-date-to-gregorian
-                 (time-to-days (current-time))))
+        (today (org-date-to-gregorian (time-to-days nil)))
          (org-agenda-restrict nil)
          (files (org-agenda-files 'unrestricted)) entries file
          (org-agenda-buffer nil))
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index 0c7f159..dbba33b 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -1000,8 +1000,7 @@ Store them in the capture property list."
                   (equal current-prefix-arg 1))
               ;; Prompt for date.
               (let ((prompt-time (org-read-date
-                                  nil t nil "Date for tree entry:"
-                                  (current-time))))
+                                  nil t nil "Date for tree entry:" nil)))
                 (org-capture-put
                  :default-time
                  (cond ((and (or (not (boundp 'org-time-was-given))
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index babf1f7..34b694d 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -723,7 +723,7 @@ menu\nmouse-2 will jump to task"))
 The time returned includes the time spent on this task in
 previous clocking intervals."
   (let ((currently-clocked-time
-        (floor (encode-time (time-subtract nil org-clock-start-time) 'integer)
+        (floor (encode-time (time-since org-clock-start-time) 'integer)
                60)))
     (+ currently-clocked-time (or org-clock-total-time 0))))
 
@@ -932,7 +932,7 @@ If necessary, clock-out of the currently active clock."
        (unless (org-is-active-clock clock)
          (org-clock-clock-in clock t))))
 
-     ((not (time-less-p resolve-to (current-time)))
+     ((not (time-less-p resolve-to nil))
       (error "RESOLVE-TO must refer to a time in the past"))
 
      (t
@@ -1033,8 +1033,7 @@ to be CLOCKED OUT."))))
                                   nil 45)))
                (and (not (memq char-pressed '(?i ?q))) char-pressed)))))
         (default
-          (floor (encode-time (time-subtract (current-time) last-valid)
-                              'integer)
+          (floor (encode-time (time-since last-valid) 'integer)
                  60))
         (keep
          (and (memq ch '(?k ?K))
@@ -1043,8 +1042,9 @@ to be CLOCKED OUT."))))
          (and (memq ch '(?g ?G))
               (read-number "Got back how many minutes ago? " default)))
         (subtractp (memq ch '(?s ?S)))
-        (barely-started-p (< (- (float-time last-valid)
-                                (float-time (cdr clock))) 45))
+        (barely-started-p (time-less-p
+                           (time-subtract last-valid (cdr clock))
+                           45))
         (start-over (and subtractp barely-started-p)))
     (cond
      ((memq ch '(?j ?J))
@@ -1070,10 +1070,9 @@ to be CLOCKED OUT."))))
                   (and gotback (= gotback default)))
               'now)
              (keep
-              (time-add last-valid (encode-time (* 60 keep))))
+              (time-add last-valid (* 60 keep)))
              (gotback
-              (time-subtract (current-time)
-                             (encode-time (* 60 gotback))))
+              (time-since (* 60 gotback)))
              (t
               (error "Unexpected, please report this as a bug")))
        (and gotback last-valid)
@@ -1103,7 +1102,7 @@ If `only-dangling-p' is non-nil, only ask to resolve 
dangling
                        (lambda (clock)
                          (format
                           "Dangling clock started %d mins ago"
-                          (floor (encode-time (time-subtract nil (cdr clock))
+                          (floor (encode-time (time-since (cdr clock))
                                               'integer)
                                  60)))))
                   (or last-valid
@@ -1155,8 +1154,7 @@ so long."
             org-clock-marker (marker-buffer org-clock-marker))
     (let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
           (org-clock-user-idle-start
-           (time-subtract (current-time)
-                          (encode-time org-clock-user-idle-seconds)))
+           (time-since org-clock-user-idle-seconds))
           (org-clock-resolving-clocks-due-to-idleness t))
       (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
          (org-clock-resolve
@@ -1165,9 +1163,8 @@ so long."
           (lambda (_)
             (format "Clocked in & idle for %.1f mins"
                     (/ (float-time
-                        (time-subtract (current-time)
-                                       org-clock-user-idle-start))
-                       60.0)))
+                        (time-since org-clock-user-idle-start))
+                       60)))
           org-clock-user-idle-start)))))
 
 (defvar org-clock-current-task nil "Task currently clocked in.")
@@ -1324,9 +1321,11 @@ the default behavior."
                          (y-or-n-p
                           (format
                            "You stopped another clock %d mins ago; start this 
one from then? "
-                           (/ (- (float-time
-                                  (org-current-time org-clock-rounding-minutes 
t))
-                                 (float-time leftover))
+                           (/ (encode-time
+                               (time-subtract
+                                (org-current-time org-clock-rounding-minutes t)
+                                leftover)
+                               'integer)
                               60)))
                          leftover)
                     start-time
@@ -1577,19 +1576,19 @@ to, overriding the existing value of 
`org-clock-out-switch-to-state'."
          (delete-region (point) (point-at-eol))
          (insert "--")
          (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
-         (setq s (float-time (time-subtract
-                              (org-time-string-to-time te)
-                              (org-time-string-to-time ts)))
+         (setq s (encode-time (time-subtract
+                               (org-time-string-to-time te)
+                               (org-time-string-to-time ts))
+                              'integer)
                h (floor s 3600)
-               s (- s (* 3600 h))
-               m (floor s 60))
+               m (floor (mod s 3600) 60))
          (insert " => " (format "%2d:%02d" h m))
          (move-marker org-clock-marker nil)
          (move-marker org-clock-hd-marker nil)
          ;; Possibly remove zero time clocks.  However, do not add
          ;; a note associated to the CLOCK line in this case.
          (cond ((and org-clock-out-remove-zero-time-clocks
-                     (= (+ h m) 0))
+                     (= 0 h m))
                 (setq remove t)
                 (delete-region (line-beginning-position)
                                (line-beginning-position 2)))
@@ -1833,8 +1832,9 @@ PROPNAME lets you set a custom text property instead of 
:org-clock-minutes."
                      tend
                      (>= (float-time org-clock-start-time) tstart)
                      (<= (float-time org-clock-start-time) tend))
-            (let ((time (floor (- (float-time)
-                                  (float-time org-clock-start-time))
+            (let ((time (floor (encode-time
+                                (time-since org-clock-start-time)
+                                'integer)
                                60)))
               (setq t1 (+ t1 time))))
           (let* ((headline-forced
@@ -2712,14 +2712,14 @@ LEVEL is an integer.  Indent by two spaces per level 
above 1."
       (setq te (float-time (org-time-string-to-time te)))))
     (setq tsb
          (if (eq step0 'week)
-             (let ((dow (nth 6 (decode-time (encode-time ts)))))
+             (let ((dow (nth 6 (decode-time ts))))
                (if (<= dow ws) ts
                  (- ts (* 86400 (- dow ws)))))
            ts))
     (while (< tsb te)
       (unless (bolp) (insert "\n"))
       (let ((start-time (max tsb ts)))
-       (cl-incf tsb (let ((dow (nth 6 (decode-time (encode-time tsb)))))
+       (cl-incf tsb (let ((dow (nth 6 (decode-time tsb))))
                       (if (or (eq step0 'day)
                               (= dow ws))
                           step
@@ -2739,7 +2739,7 @@ LEVEL is an integer.  Indent by two spaces per level 
above 1."
                  :tstart (format-time-string (org-time-stamp-format t t)
                                              start-time)
                  :tend (format-time-string (org-time-stamp-format t t)
-                                           (encode-time (min te tsb))))))))
+                                           (min te tsb)))))))
          (re-search-forward "^[ \t]*#\\+END:")
          (when (and stepskip0 (equal step-time 0))
            ;; Remove the empty table
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index f3e118b..799cc60 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -540,7 +540,7 @@ Where possible, use the standard interface for changing 
this line."
         (eol (line-end-position))
         (pom (or (get-text-property bol 'org-hd-marker) (point)))
         (key (or key (get-char-property (point) 'org-columns-key)))
-        (org-columns--time (float-time (current-time)))
+        (org-columns--time (float-time))
         (action
          (pcase key
            ("CLOCKSUM"
@@ -790,7 +790,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column 
format."
   (org-columns-goto-top-level)
   ;; Initialize `org-columns-current-fmt' and
   ;; `org-columns-current-fmt-compiled'.
-  (let ((org-columns--time (float-time (current-time))))
+  (let ((org-columns--time (float-time)))
     (org-columns-get-format columns-fmt-string)
     (unless org-columns-inhibit-recalculation (org-columns-compute-all))
     (save-excursion
@@ -1494,7 +1494,7 @@ PARAMS is a property list of parameters:
   (if (markerp org-columns-begin-marker)
       (move-marker org-columns-begin-marker (point))
     (setq org-columns-begin-marker (point-marker)))
-  (let* ((org-columns--time (float-time (current-time)))
+  (let* ((org-columns--time (float-time))
         (fmt
          (cond
           ((bound-and-true-p org-agenda-overriding-columns-format))
diff --git a/lisp/org/org-duration.el b/lisp/org/org-duration.el
index f115082..770c72f 100644
--- a/lisp/org/org-duration.el
+++ b/lisp/org/org-duration.el
@@ -317,11 +317,10 @@ When optional argument CANONICAL is non-nil, ignore
 Raise an error if expected format is unknown."
   (pcase (or fmt org-duration-format)
     (`h:mm
-     (let ((minutes (floor minutes)))
-       (format "%d:%02d" (/ minutes 60) (mod minutes 60))))
+     (format "%d:%02d" (/ minutes 60) (mod minutes 60)))
     (`h:mm:ss
      (let* ((whole-minutes (floor minutes))
-           (seconds (floor (* 60 (- minutes whole-minutes)))))
+           (seconds (mod (* 60 minutes) 60)))
        (format "%s:%02d"
               (org-duration-from-minutes whole-minutes 'h:mm)
               seconds)))
@@ -402,9 +401,7 @@ Raise an error if expected format is unknown."
              (pcase-let* ((`(,unit . ,required?) units)
                           (modifier (org-duration--modifier unit canonical)))
                (cond ((<= modifier minutes)
-                      (let ((value (if (integerp modifier)
-                                       (/ (floor minutes) modifier)
-                                     (floor (/ minutes modifier)))))
+                      (let ((value (floor minutes modifier)))
                         (cl-decf minutes (* value modifier))
                         (format " %d%s" value unit)))
                      (required? (concat " 0" unit))
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index e2ee0a0..690dcd1 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -4765,13 +4765,13 @@ you want to help debugging the issue.")
 (defvar org-element-cache-sync-idle-time 0.6
   "Length, in seconds, of idle time before syncing cache.")
 
-(defvar org-element-cache-sync-duration (encode-time 0.04)
+(defvar org-element-cache-sync-duration 0.04
   "Maximum duration, as a time value, for a cache synchronization.
 If the synchronization is not over after this delay, the process
 pauses and resumes after `org-element-cache-sync-break'
 seconds.")
 
-(defvar org-element-cache-sync-break (encode-time 0.3)
+(defvar org-element-cache-sync-break 0.3
   "Duration, as a time value, of the pause between synchronizations.
 See `org-element-cache-sync-duration' for more information.")
 
@@ -5066,7 +5066,7 @@ Assume ELEMENT belongs to cache and that a cache is 
active."
 TIME-LIMIT is a time value or nil."
   (and time-limit
        (or (input-pending-p)
-          (time-less-p time-limit (current-time)))))
+          (time-less-p time-limit nil))))
 
 (defsubst org-element--cache-shift-positions (element offset &optional props)
   "Shift ELEMENT properties relative to buffer positions by OFFSET.
@@ -5120,8 +5120,7 @@ updated before current modification are actually 
submitted."
             (and next (aref next 0))
             threshold
             (and (not threshold)
-                 (time-add (current-time)
-                           org-element-cache-sync-duration))
+                 (time-add nil org-element-cache-sync-duration))
             future-change)
            ;; Request processed.  Merge current and next offsets and
            ;; transfer ending position.
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el
index 06429d7..6234d02 100644
--- a/lisp/org/org-habit.el
+++ b/lisp/org/org-habit.el
@@ -288,7 +288,7 @@ Habits are assigned colors on the following basis:
         (deadline (if scheduled-days
                       (+ scheduled-days (- d-repeat s-repeat))
                     (org-habit-deadline habit)))
-        (m-days (or now-days (time-to-days (current-time)))))
+        (m-days (or now-days (time-to-days nil))))
     (cond
      ((< m-days scheduled)
       '(org-habit-clear-face . org-habit-clear-future-face))
@@ -406,8 +406,7 @@ current time."
   "Insert consistency graph for any habitual tasks."
   (let ((inhibit-read-only t)
        (buffer-invisibility-spec '(org-link))
-       (moment (time-subtract (current-time)
-                              (list 0 (* 3600 org-extend-today-until) 0))))
+       (moment (time-since (* 3600 org-extend-today-until))))
     (save-excursion
       (goto-char (if line (point-at-bol) (point-min)))
       (while (not (eobp))
diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el
index 670abad..6a9d729 100644
--- a/lisp/org/org-id.el
+++ b/lisp/org/org-id.el
@@ -160,9 +160,9 @@ to have no space characters in them."
 (defcustom org-id-include-domain nil
   "Non-nil means add the domain name to new IDs.
 This ensures global uniqueness of IDs, and is also suggested by
-RFC 2445 in combination with RFC 822.  This is only relevant if
-`org-id-method' is `org'.  When uuidgen is used, the domain will never
-be added.
+the relevant RFCs.  This is relevant only if `org-id-method' is
+`org'.  When uuidgen is used, the domain will never be added.
+
 The default is to not use this because we have no really good way to get
 the true domain, and Org entries will normally not be shared with enough
 people to make this necessary."
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el
index f6d6cd4..97cf878 100644
--- a/lisp/org/org-indent.el
+++ b/lisp/org/org-indent.el
@@ -332,7 +332,7 @@ stopped."
      (let* ((case-fold-search t)
            (limited-re (org-get-limited-outline-regexp))
            (level (or (org-current-level) 0))
-           (time-limit (and delay (time-add (current-time) delay))))
+           (time-limit (and delay (time-add nil delay))))
        ;; For each line, set `line-prefix' and `wrap-prefix'
        ;; properties depending on the type of line (headline, inline
        ;; task, item or other).
@@ -345,7 +345,7 @@ stopped."
           ;; In asynchronous mode, take a break of
           ;; `org-indent-agent-resume-delay' every DELAY to avoid
           ;; blocking any other idle timer or process output.
-          ((and delay (time-less-p time-limit (current-time)))
+          ((and delay (time-less-p time-limit nil))
            (setq org-indent-agent-resume-timer
                  (run-with-idle-timer
                   (time-add (current-idle-time) org-indent-agent-resume-delay)
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 81a77fd..765a1ee 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -2175,8 +2175,8 @@ If NLAST is a number, only the NLAST fields will actually 
be summed."
             (sres (if (= org-timecnt 0)
                       (number-to-string res)
                     (setq diff (* 3600 res)
-                          h (floor (/ diff 3600)) diff (mod diff 3600)
-                          m (floor (/ diff 60)) diff (mod diff 60)
+                          h (floor diff 3600) diff (mod diff 3600)
+                          m (floor diff 60) diff (mod diff 60)
                           s diff)
                     (format "%.0f:%02.0f:%02.0f" h m s))))
        (kill-new sres)
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el
index c9ca85c..6529a8b0 100644
--- a/lisp/org/org-timer.el
+++ b/lisp/org/org-timer.el
@@ -139,12 +139,7 @@ the region 0:00:00."
                   (format "Restart timer with offset [%s]: " def)))
          (unless (string-match "\\S-" s) (setq s def))
          (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s)))))
-       (setq org-timer-start-time
-             (encode-time
-              ;; Pass `current-time' result to `float-time' (instead
-              ;; of calling without arguments) so that only
-              ;; `current-time' has to be overridden in tests.
-              (- (float-time (current-time)) delta))))
+       (setq org-timer-start-time (time-since delta)))
       (setq org-timer-pause-time nil)
       (org-timer-set-mode-line 'on)
       (message "Timer start time set to %s, current value is %s"
@@ -167,14 +162,9 @@ With prefix arg STOP, stop it entirely."
            (setq org-timer-countdown-timer
                  (org-timer--run-countdown-timer
                   new-secs org-timer-countdown-timer-title))
-           (setq org-timer-start-time
-                 (time-add (current-time) (encode-time new-secs))))
+           (setq org-timer-start-time (time-add nil new-secs)))
        (setq org-timer-start-time
-             ;; Pass `current-time' result to `float-time' (instead
-             ;; of calling without arguments) so that only
-             ;; `current-time' has to be overridden in tests.
-             (encode-time (- (float-time (current-time))
-                                 (- pause-secs start-secs)))))
+             (time-since (- pause-secs start-secs))))
       (setq org-timer-pause-time nil)
       (org-timer-set-mode-line 'on)
       (run-hooks 'org-timer-continue-hook)
@@ -233,14 +223,9 @@ it in the buffer."
           (abs (floor (org-timer-seconds))))))
 
 (defun org-timer-seconds ()
-  ;; Pass `current-time' result to `float-time' (instead of calling
-  ;; without arguments) so that only `current-time' has to be
-  ;; overridden in tests.
-  (if org-timer-countdown-timer
-      (- (float-time org-timer-start-time)
-        (float-time (or org-timer-pause-time (current-time))))
-    (- (float-time (or org-timer-pause-time (current-time)))
-       (float-time org-timer-start-time))))
+  (let ((s (float-time (time-subtract org-timer-pause-time
+                                     org-timer-start-time))))
+    (if org-timer-countdown-timer (- s) s)))
 
 ;;;###autoload
 (defun org-timer-change-times-in-region (beg end delta)
@@ -400,7 +385,7 @@ VALUE can be `on', `off', or `paused'."
       (message "No timer set")
     (let* ((rtime (decode-time
                   (time-subtract (timer--time org-timer-countdown-timer)
-                                 (current-time))))
+                                 nil)))
           (rsecs (nth 0 rtime))
           (rmins (nth 1 rtime)))
       (message "%d minute(s) %d seconds left before next time out"
@@ -463,8 +448,7 @@ using three `C-u' prefix arguments."
                (org-timer--run-countdown-timer
                 secs org-timer-countdown-timer-title))
          (run-hooks 'org-timer-set-hook)
-         (setq org-timer-start-time
-               (time-add (current-time) (encode-time secs)))
+         (setq org-timer-start-time (time-add nil secs))
          (setq org-timer-pause-time nil)
          (org-timer-set-mode-line 'on))))))
 
diff --git a/lisp/org/org.el b/lisp/org/org.el
index b627282..8a11a8f 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -229,10 +229,10 @@ file to byte-code before it is loaded."
   (interactive "fFile to load: \nP")
   (let* ((age (lambda (file)
                (float-time
-                (time-subtract (current-time)
-                               (file-attribute-modification-time
-                                (or (file-attributes (file-truename file))
-                                    (file-attributes file)))))))
+                (time-since
+                 (file-attribute-modification-time
+                  (or (file-attributes (file-truename file))
+                      (file-attributes file)))))))
         (base-name (file-name-sans-extension file))
         (exported-file (concat base-name ".el")))
     ;; tangle if the Org file is newer than the elisp file
@@ -5626,8 +5626,7 @@ the rounding returns a past time."
 (defun org-today ()
   "Return today date, considering `org-extend-today-until'."
   (time-to-days
-   (time-subtract (current-time)
-                 (list 0 (* 3600 org-extend-today-until) 0))))
+   (time-since (* 3600 org-extend-today-until))))
 
 ;;;; Font-Lock stuff, including the activators
 
@@ -13110,8 +13109,7 @@ This function is run automatically after each state 
change to a DONE state."
                        (while (re-search-forward org-clock-line-re end t)
                          (when (org-at-clock-log-p) (throw :clock t))))))
            (org-entry-put nil "LAST_REPEAT" (format-time-string
-                                             (org-time-stamp-format t t)
-                                             (current-time))))
+                                             (org-time-stamp-format t t))))
          (when org-log-repeat
            (if (or (memq 'org-add-log-note (default-value 'post-command-hook))
                    (memq 'org-add-log-note post-command-hook))
@@ -13170,7 +13168,7 @@ has been set"
                          (let ((nshiftmax 10)
                                (nshift 0))
                            (while (or (= nshift 0)
-                                      (not (time-less-p (current-time) time)))
+                                      (not (time-less-p nil time)))
                              (when (= (cl-incf nshift) nshiftmax)
                                (or (y-or-n-p
                                     (format "%d repeater intervals were not \
@@ -14666,8 +14664,8 @@ it as a time string and apply `float-time' to it.  If S 
is nil, just return 0."
    ((stringp s)
     (condition-case nil
        (float-time (org-time-string-to-time s))
-      (error 0.)))
-   (t 0.)))
+      (error 0)))
+   (t 0)))
 
 (defun org-time-today ()
   "Time in seconds today at 0:00.
@@ -16568,22 +16566,20 @@ non-nil."
              ((org-at-timestamp-p 'lax) (match-string 0))))
         ;; Default time is either the timestamp at point or today.
         ;; When entering a range, only the range start is considered.
-         (default-time (if (not ts) (current-time)
-                        (org-time-string-to-time ts)))
+        (default-time (and ts (org-time-string-to-time ts)))
          (default-input (and ts (org-get-compact-tod ts)))
          (repeater (and ts
                        (string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts)
                        (match-string 0 ts)))
         org-time-was-given
         org-end-time-was-given
-        (time
-         (and (if (equal arg '(16)) (current-time)
+        (time (if (equal arg '(16)) (current-time)
                 ;; Preserve `this-command' and `last-command'.
                 (let ((this-command this-command)
                       (last-command last-command))
                   (org-read-date
                    arg 'totime nil nil default-time default-input
-                   inactive))))))
+                   inactive)))))
     (cond
      ((and ts
            (memq last-command '(org-time-stamp org-time-stamp-inactive))
@@ -16957,7 +16953,7 @@ user."
     (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans)
       (setq ans "+0"))
 
-    (when (setq delta (org-read-date-get-relative ans (current-time) org-def))
+    (when (setq delta (org-read-date-get-relative ans nil org-def))
       (setq ans (replace-match "" t t ans)
            deltan (car delta)
            deltaw (nth 1 delta)
@@ -17114,7 +17110,7 @@ user."
                                        ;      (when (and 
org-read-date-prefer-future
                                        ;                (not iso-year)
                                        ;                (< 
(calendar-absolute-from-gregorian iso-date)
-                                       ;                   (time-to-days 
(current-time))))
+                                       ;                   (time-to-days nil)))
                                        ;       (setq year (1+ year)
                                        ;             iso-date 
(calendar-gregorian-from-absolute
                                        ;                       
(calendar-iso-to-absolute
@@ -17308,7 +17304,7 @@ Don't touch the rest."
 If SECONDS is non-nil, return the difference in seconds."
   (let ((fdiff (if seconds #'float-time #'time-to-days)))
     (- (funcall fdiff (org-time-string-to-time timestamp-string))
-       (funcall fdiff (current-time)))))
+       (funcall fdiff nil))))
 
 (defun org-deadline-close-p (timestamp-string &optional ndays)
   "Is the time in TIMESTAMP-STRING close to the current date?"
@@ -17490,10 +17486,8 @@ days in order to avoid rounding problems."
          (match-end (match-end 0))
          (time1 (org-time-string-to-time ts1))
          (time2 (org-time-string-to-time ts2))
-         (t1 (float-time time1))
-         (t2 (float-time time2))
-         (diff (abs (- t2 t1)))
-         (negative (< (- t2 t1) 0))
+         (diff (abs (float-time (time-subtract time2 time1))))
+         (negative (time-less-p time2 time1))
          ;; (ys (floor (* 365 24 60 60)))
          (ds (* 24 60 60))
          (hs (* 60 60))
@@ -17504,14 +17498,14 @@ days in order to avoid rounding problems."
          (fh "%02d:%02d")
          y d h m align)
      (if havetime
-        (setq ; y (floor (/ diff ys))  diff (mod diff ys)
+        (setq ; y (floor diff ys)  diff (mod diff ys)
          y 0
-         d (floor (/ diff ds))  diff (mod diff ds)
-         h (floor (/ diff hs))  diff (mod diff hs)
-         m (floor (/ diff 60)))
-       (setq ; y (floor (/ diff ys))  diff (mod diff ys)
+         d (floor diff ds)  diff (mod diff ds)
+         h (floor diff hs)  diff (mod diff hs)
+         m (floor diff 60))
+       (setq ; y (floor diff ys)  diff (mod diff ys)
        y 0
-       d (floor (+ (/ diff ds) 0.5))
+       d (round diff ds)
        h 0 m 0))
      (if (not to-buffer)
         (message "%s" (org-make-tdiff-string y d h m))
@@ -17602,7 +17596,7 @@ signaled."
 YEAR is expanded into one of the 30 next years, if possible, or
 into a past one.  Any year larger than 99 is returned unchanged."
   (if (>= year 100) year
-    (let* ((current (string-to-number (format-time-string "%Y" 
(current-time))))
+    (let* ((current (string-to-number (format-time-string "%Y")))
           (century (/ current 100))
           (offset (- year (% current 100))))
       (cond ((> offset 30) (+ (* (1- century) 100) year))
@@ -18122,7 +18116,7 @@ A prefix ARG can be used to force the current date."
        diff)
     (when (or (org-at-timestamp-p 'lax)
              (org-match-line (concat ".*" org-ts-regexp)))
-      (let ((d1 (time-to-days (current-time)))
+      (let ((d1 (time-to-days nil))
            (d2 (time-to-days (org-time-string-to-time (match-string 1)))))
        (setq diff (- d2 d1))))
     (calendar)
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index cd49cd0..74312bc 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -793,13 +793,11 @@ Default for SITEMAP-FILENAME is `sitemap.org'."
                           (not (string-lessp B A))))))
                ((or `anti-chronologically `chronologically)
                 (let* ((adate (org-publish-find-date a project))
-                       (bdate (org-publish-find-date b project))
-                       (A (+ (ash (car adate) 16) (cadr adate)))
-                       (B (+ (ash (car bdate) 16) (cadr bdate))))
+                       (bdate (org-publish-find-date b project)))
                   (setq retval
-                        (if (eq sort-files 'chronologically)
-                            (<= A B)
-                          (>= A B)))))
+                        (not (if (eq sort-files 'chronologically)
+                                 (time-less-p bdate adate)
+                               (time-less-p adate bdate))))))
                (`nil nil)
                (_ (user-error "Invalid sort value %s" sort-files)))
              ;; Directory-wise wins:
@@ -1350,7 +1348,7 @@ does not exist."
               (expand-file-name (or (file-symlink-p file) file)
                                 (file-name-directory file)))))
     (if (not attr) (error "No such file: \"%s\"" file)
-      (floor (float-time (file-attribute-modification-time attr))))))
+      (encode-time (file-attribute-modification-time attr) 'integer))))
 
 
 (provide 'ox-publish)
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index 6c278a1..8813968 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -3252,7 +3252,7 @@ locally for the subtree through node properties."
       (let ((val (cond ((equal (car key) "DATE")
                        (or (cdr key)
                            (with-temp-buffer
-                             (org-insert-time-stamp (current-time)))))
+                             (org-insert-time-stamp nil))))
                       ((equal (car key) "TITLE")
                        (or (let ((visited-file
                                   (buffer-file-name (buffer-base-buffer))))
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 566a0fd..dfd9a5a 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -97,10 +97,11 @@ When scrolling request is delivered soon after the previous 
one,
 user is in hurry.  When the time since last scroll is larger than
 `pixel-dead-time', we are ready for another smooth scroll, and this
 function returns nil."
-  (let* ((current-time (float-time))
-         (scroll-in-rush-p (< (- current-time pixel-last-scroll-time)
-                              pixel-dead-time)))
-    (setq pixel-last-scroll-time current-time)
+  (let* ((now (current-time))
+        (scroll-in-rush-p (time-less-p
+                           (time-subtract now pixel-last-scroll-time)
+                           pixel-dead-time)))
+    (setq pixel-last-scroll-time (float-time now))
     scroll-in-rush-p))
 
 ;;;###autoload
diff --git a/lisp/play/hanoi.el b/lisp/play/hanoi.el
index 635e4a9..d762290 100644
--- a/lisp/play/hanoi.el
+++ b/lisp/play/hanoi.el
@@ -381,7 +381,7 @@ BITS must be of length nrings.  Start at START-TIME."
        (cl-loop for elapsed = (- (float-time) start-time)
                  while (< elapsed hanoi-move-period)
                  with tick-period = (/ (float hanoi-move-period) total-ticks)
-                 for tick = (ceiling (/ elapsed tick-period)) do
+                for tick = (ceiling elapsed tick-period) do
                  (hanoi-ring-to-pos ring (funcall tick-to-pos tick))
                  (hanoi-sit-for (- (* tick tick-period) elapsed)))
       (cl-loop for tick from 1 to total-ticks by 2 do
diff --git a/lisp/proced.el b/lisp/proced.el
index b3c8e2c..ce379a7 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1348,7 +1348,7 @@ Prefix ARG controls sort order, see 
`proced-sort-interactive'."
 
 (defun proced-format-time (time)
   "Format time interval TIME."
-  (let* ((ftime (float-time time))
+  (let* ((ftime (encode-time time 'integer))
          (days (truncate ftime 86400))
          (ftime (mod ftime 86400))
          (hours (truncate ftime 3600))
diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index afdf6a9..29988eb 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -849,8 +849,8 @@ If that option is nil, don't prints messages.
 ARGS are the same as for `message'."
   (when cpp-message-min-time-interval
     (let ((time (current-time)))
-      (when (>= (float-time (time-subtract time cpp-progress-time))
-                cpp-message-min-time-interval)
+      (unless (time-less-p cpp-message-min-time-interval
+                          (time-subtract time cpp-progress-time))
         (setq cpp-progress-time time)
         (apply 'message args)))))
 
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 261e50a..7afcf78 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -765,7 +765,8 @@ report applies to that region."
             (flymake-log :debug "backend %s reported %d diagnostics in %.2f 
second(s)"
                          backend
                          (length new-diags)
-                         (- (float-time) flymake-check-start-time)))
+                        (float-time
+                         (time-since flymake-check-start-time))))
           (when (and (get-buffer (flymake--diagnostics-buffer-name))
                      (get-buffer-window (flymake--diagnostics-buffer-name))
                      (null (cl-set-difference (flymake-running-backends)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index b0bb821..532739d 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -2771,8 +2771,8 @@ Otherwise, use the current value of `process-mark'."
   (with-current-buffer (process-buffer process)
     (cl-loop with start-pos = (or start
                                   (marker-position (process-mark process)))
-             with end-time = (+ (float-time) timeout)
-             for time-left = (- end-time (float-time))
+            with end-time = (time-add nil timeout)
+            for time-left = (float-time (time-subtract end-time nil))
              do (goto-char (point-max))
              if (looking-back regexp start-pos) return t
              while (> time-left 0)
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 9bae3d8..2a42e7f 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -2725,7 +2725,7 @@ highlighting rules in SQL mode.")
              nil 'require-match
              init 'sql-product-history init))))
 
-(defun sql-add-product (product display &rest plist)
+(defun sql-add-product (product display &optional plist)
   "Add support for a database product in `sql-mode'.
 
 Add PRODUCT to `sql-product-alist' which enables `sql-mode' to
@@ -2782,19 +2782,38 @@ list.  See `sql-add-product' to add new products.  The 
FEATURE
 argument must be a plist keyword accepted by
 `sql-product-alist'."
 
-  (let* ((p (assoc product sql-product-alist))
-         (v (plist-get (cdr p) feature)))
-    (if (and p v)
-        (if (and
-             (member feature sql-indirect-features)
-             (symbolp v))
-            (set v newvalue)
-          (setcdr p (plist-put (cdr p) feature newvalue)))
-      (progn
-       (when (null p)
-         (error "`%s' is not a known product; use `sql-add-product' to add it 
first." product))
-       (when (null v)
-         (error "`%s' is not a known feature for `%s'; use `sql-add-product' 
to add it first." feature product))))))
+  (let* ((p (assoc product sql-product-alist))  ;; (PRODUCT :f v ...)
+         (v (plist-member (cdr p) feature)))    ;; (:FEATURE value ...) or null
+
+    (if p
+        (if (member feature sql-indirect-features) ; is indirect
+            (if v
+                (if (car (cdr v))
+                    (if (symbolp (car (cdr v)))
+                        ;; Indirect reference
+                        (set (car (cdr v)) newvalue)
+                      ;; indirect is not a symbol
+                      (error "The value of `%s' for `%s' is not a symbol" 
feature product))
+                  ;; keyword present, set the indirect variable name
+                  (if (symbolp newvalue)
+                      (if (cdr v)
+                          (setf (car (cdr v)) newvalue)
+                        (setf (cdr v) (list newvalue)))
+                    (error "The indirect variable of `%s' for `%s' must be a 
symbol" feature product)))
+              ;; not present; insert list
+              (setq v (list feature newvalue))
+              (setf (cdr (cdr v)) (cdr p))
+              (setf (cdr p) v))
+          ;; Not an indirect feature
+          (if v
+              (if (cdr v)
+                  (setf (car (cdr v)) newvalue)
+                (setf (cdr v) (list newvalue)))
+            ;; no value; insert into the list
+            (setq v (list feature newvalue))
+            (setf (cdr (cdr v)) (cdr p))
+            (setf (cdr p) v)))
+      (error "`%s' is not a known product; use `sql-add-product' to add it 
first" product))))
 
 (defun sql-get-product-feature (product feature &optional fallback 
not-indirect)
   "Lookup FEATURE associated with a SQL PRODUCT.
@@ -2822,7 +2841,7 @@ See `sql-product-alist' for a list of products and 
supported features."
                (member feature sql-indirect-features)
                (not not-indirect)
                (symbolp v))
-              (symbol-value v)
+              (eval v)
             v))
       (error "`%s' is not a known product; use `sql-add-product' to add it 
first." product)
       nil)))
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 27380b3..b8297c4 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -7393,7 +7393,7 @@ only-lines."
   "Update progress information."
   (when (and vhdl-progress-info (not noninteractive)
             (time-less-p vhdl-progress-interval
-                         (time-subtract nil (aref vhdl-progress-info 2))))
+                         (time-since (aref vhdl-progress-info 2))))
     (let ((delta (- (aref vhdl-progress-info 1)
                     (aref vhdl-progress-info 0))))
       (message "%s... (%2d%%)" string
@@ -8143,7 +8143,7 @@ depending on parameter UPPER-CASE."
               (downcase-word -1)))
         (when (and count vhdl-progress-interval (not noninteractive)
                    (time-less-p vhdl-progress-interval
-                                (time-subtract nil last-update)))
+                                (time-since last-update)))
           (message "Fixing case... (%2d%s)"
                    (+ (* count 20) (/ (* 20 (- (point) beg)) (- end beg)))
                    "%")
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 40a74d1..564e0ff 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -272,16 +272,21 @@ It calls them sequentially, and if any returns non-nil,
 
 (defun which-function ()
   "Return current function name based on point.
-Uses `which-func-functions', `imenu--index-alist'
-or `add-log-current-defun'.
+Uses `which-func-functions', `add-log-current-defun'.
+or `imenu--index-alist'
 If no function name is found, return nil."
   (let ((name
         ;; Try the `which-func-functions' functions first.
         (run-hook-with-args-until-success 'which-func-functions)))
-
+    ;; Try using add-log support.
+    (when (null name)
+      (setq name (add-log-current-defun)))
     ;; If Imenu is loaded, try to make an index alist with it.
     (when (and (null name)
-              (boundp 'imenu--index-alist) (null imenu--index-alist)
+              (boundp 'imenu--index-alist)
+               (or (null imenu--index-alist)
+                   ;; Update if outdated
+                   (/= (buffer-chars-modified-tick) 
imenu-menubar-modified-tick))
               (null which-function-imenu-failed))
       (ignore-errors (imenu--make-index-alist t))
       (unless imenu--index-alist
@@ -323,10 +328,6 @@ If no function name is found, return nil."
                              (funcall
                               which-func-imenu-joiner-function
                               (reverse (cons (car pair) namestack))))))))))))
-
-    ;; Try using add-log support.
-    (when (null name)
-      (setq name (add-log-current-defun)))
     ;; Filter the name if requested.
     (when name
       (if which-func-cleanup-function
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 9522d7e..6974d00 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -694,8 +694,10 @@ references displayed in the current *xref* buffer."
   (let ((backward (< n 0))
         (n (abs n))
         (xref nil))
-    (dotimes (_ n)
-      (setq xref (xref--search-property 'xref-item backward)))
+    (if (= n 0)
+        (setq xref (get-text-property (point) 'xref-item))
+      (dotimes (_ n)
+        (setq xref (xref--search-property 'xref-item backward))))
     (cond (xref
            ;; Save the current position (when the buffer is visible,
            ;; it gets reset to that window's point from time to time).
diff --git a/lisp/ps-samp.el b/lisp/ps-samp.el
index ff47254..784b435 100644
--- a/lisp/ps-samp.el
+++ b/lisp/ps-samp.el
@@ -76,8 +76,8 @@
       (concat "Subject: " (or (mail-fetch-field "Subject") "???")))))
 
 ;; Look in an article or mail message for the From: line.  Sorta-kinda
-;; understands RFC-822 addresses and can pull the real name out where
-;; it's provided.
+;; understands RFC 822 (or later) addresses and can pull the real name
+;; out where it's provided.
 (defun ps-article-author ()
   (save-excursion
     (save-restriction
diff --git a/lisp/ses.el b/lisp/ses.el
index df32363..73157d6 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -837,7 +837,7 @@ updated again."
 (defmacro ses--time-check (format &rest args)
   "If `ses-start-time' is more than a second ago, call `message' with FORMAT
 and ARGS and reset `ses-start-time' to the current time."
-  `(when (> (- (float-time) ses-start-time) 1.0)
+  `(when (time-less-p 1 (time-since ses-start-time))
      (message ,format ,@args)
      (setq ses-start-time (float-time))))
 
diff --git a/lisp/simple.el b/lisp/simple.el
index a9cab5a..d4ae5eb 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7834,7 +7834,7 @@ appears to have customizations applying to the old 
default,
   "If the buffer starts with a mail header, move point to the header's end.
 Otherwise, moves to `point-min'.
 The end of the header is the start of the next line, if there is one,
-else the end of the last line.  This function obeys RFC822."
+else the end of the last line.  This function obeys RFC 822 (or later)."
   (goto-char (point-min))
   (when (re-search-forward
         "^\\([:\n]\\|[^: \t\n]+[ \t\n]\\)" nil 'move)
diff --git a/lisp/subr.el b/lisp/subr.el
index 122a0d8..5c8b84b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -5041,7 +5041,7 @@ NEW-MESSAGE, if non-nil, sets a new message for the 
reporter."
         (enough-time-passed
          ;; See if enough time has passed since the last update.
          (or (not update-time)
-             (when (>= (float-time) update-time)
+             (when (time-less-p update-time nil)
                ;; Calculate time for the next update
                (aset parameters 0 (+ update-time (aref parameters 5)))))))
     (cond ((and min-value max-value)
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 0973329..c4b0a8f 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -767,13 +767,15 @@ Can be nil to mean \"no timeout\".")
 By not redisplaying right away for xterm queries, we can avoid
 unsightly flashing during initialization. Give up and redisplay
 anyway if we've been waiting a little while."
-  (let ((start-time (float-time)))
+  (let ((start-time (current-time)))
     (or (let ((inhibit-redisplay t))
           (read-event nil nil xterm-query-redisplay-timeout))
         (read-event nil nil
                     (and xterm-query-timeout
-                         (max 0 (+ start-time xterm-query-timeout
-                                   (- (float-time)))))))))
+                        (max 0 (float-time
+                                (time-subtract
+                                 xterm-query-timeout
+                                 (time-since start-time)))))))))
 
 (defun xterm--query (query handlers &optional no-async)
   "Send QUERY string to the terminal and watch for a response.
diff --git a/lisp/time.el b/lisp/time.el
index 9084217..35157c5 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -434,16 +434,17 @@ update which can wait for the next redisplay."
                ((and (stringp mail-spool-file)
                      (or (null display-time-server-down-time)
                          ;; If have been down for 20 min, try again.
-                         (< 1200 (- (float-time now)
-                                    display-time-server-down-time))))
-                (let ((start-time (float-time)))
+                         (time-less-p 1200 (time-since
+                                            display-time-server-down-time))))
+                (let ((start-time (current-time)))
                   (prog1
                       (display-time-file-nonempty-p mail-spool-file)
                     ;; Record whether mail file is accessible.
                     (setq display-time-server-down-time
-                          (let ((end-time (float-time)))
-                            (and (< 20 (- end-time start-time))
-                                 end-time))))))))
+                          (let ((end-time (current-time)))
+                            (and (time-less-p 20 (time-subtract
+                                                  end-time start-time))
+                                 (float-time end-time)))))))))
          (24-hours (substring time 11 13))
          (hour (string-to-number 24-hours))
          (12-hours (int-to-string (1+ (% (+ hour 11) 12))))
@@ -571,8 +572,9 @@ For example, the Unix uptime command format is \"%D, 
%z%2h:%.2m\"."
   (interactive)
   (let ((str
          (format-seconds (or format "%Y, %D, %H, %M, %z%S")
-                         (float-time
-                          (time-subtract nil before-init-time)))))
+                        (encode-time
+                         (time-since before-init-time)
+                         'integer))))
     (if (called-interactively-p 'interactive)
         (message "%s" str)
       str)))
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index cbb61ef..b1c69ae 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -201,7 +201,8 @@ This might return nil if the event did not occur over a 
buffer."
 (defun tooltip-delay ()
   "Return the delay in seconds for the next tooltip."
   (if (and tooltip-hide-time
-           (< (- (float-time) tooltip-hide-time) tooltip-recent-seconds))
+          (time-less-p (time-since tooltip-hide-time)
+                       tooltip-recent-seconds))
       tooltip-short-delay
     tooltip-delay))
 
diff --git a/lisp/type-break.el b/lisp/type-break.el
index 9a8100f..0ad79dd 100644
--- a/lisp/type-break.el
+++ b/lisp/type-break.el
@@ -460,8 +460,7 @@ the variable of the same name."
              ))))))
 
 (defun timep (time)
-  "If TIME is in the format returned by `current-time' then
-return TIME, else return nil."
+  "If TIME is a Lisp time value then return TIME, else return nil."
   (condition-case nil
       (and (float-time time) time)
     (error nil)))
@@ -481,8 +480,7 @@ return TIME, else return nil."
 
 (defun type-break-get-previous-time ()
   "Get previous break time from `type-break-file-name'.
-Returns nil if the file is missing or if the time breaks with the
-`current-time' format."
+Return nil if the file is missing or if the time is not a Lisp time value."
   (let ((file (type-break-choose-file)))
     (if file
         (timep ;; returns expected format, else nil
@@ -808,7 +806,7 @@ this or ask the user to start one right now."
    ((and (car type-break-keystroke-threshold)
          (< type-break-keystroke-count (car type-break-keystroke-threshold))))
    ((> type-break-time-warning-count 0)
-    (let ((timeleft (type-break-time-difference (current-time)
+    (let ((timeleft (type-break-time-difference nil
                                                 type-break-time-next-break)))
       (setq type-break-warning-countdown-string (number-to-string timeleft))
       (cond
@@ -905,8 +903,8 @@ Current keystroke count     : %s"
                                (current-time-string type-break-time-next-break)
                                (type-break-format-time
                                 (type-break-time-difference
-                                (current-time)
-                                type-break-time-next-break)))
+                                nil
+                                type-break-time-next-break)))
                      "none scheduled")
                    (or (car type-break-keystroke-threshold) "none")
                    (or (cdr type-break-keystroke-threshold) "none")
@@ -1090,7 +1088,7 @@ With optional non-nil ALL, force redisplay of all 
mode-lines."
             (erase-buffer)
             (setq elapsed (type-break-time-difference
                            type-break-time-last-break
-                           (current-time)))
+                          nil))
             (let ((good-interval (or type-break-good-rest-interval
                                      type-break-good-break-interval)))
               (cond
diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
index a1cb0b9..b306082 100644
--- a/lisp/url/url-cache.el
+++ b/lisp/url/url-cache.el
@@ -205,7 +205,7 @@ If `url-standalone-mode' is non-nil, cached items never 
expire."
          (time-less-p
           (time-add
            cache-time
-           (encode-time (or expire-time url-cache-expire-time)))
+           (or expire-time url-cache-expire-time))
           nil)))))
 
 (defun url-cache-prune-cache (&optional directory)
@@ -227,7 +227,7 @@ considered \"expired\"."
           ((time-less-p
             (time-add
              (file-attribute-modification-time (file-attributes file))
-             (encode-time url-cache-expire-time))
+             url-cache-expire-time)
             now)
            (delete-file file)
            (setq deleted-files (1+ deleted-files))))))
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index 213dab2..31fc3e7 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -105,11 +105,10 @@ i.e. 1970-1-1) are loaded as expiring one year from now 
instead."
                    ;; away, make it expire a year from now
                    (expires (format-time-string
                              "%d %b %Y %T [GMT]"
-                             (encode-time
-                              (let ((s (string-to-number (nth 4 fields))))
-                                (if (and (= s 0) long-session)
-                                    (encode-time (+ (* 365 24 60 60) 
(float-time)))
-                                  s)))))
+                             (let ((s (string-to-number (nth 4 fields))))
+                               (if (and (zerop s) long-session)
+                                   (time-add nil (* 365 24 60 60))
+                                 s))))
                    (key (nth 5 fields))
                    (val (nth 6 fields)))
                (cl-incf n)
diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el
index 6350081..9bf1bca 100644
--- a/lisp/url/url-queue.el
+++ b/lisp/url/url-queue.el
@@ -162,8 +162,8 @@ The variable `url-queue-timeout' sets a timeout."
     (dolist (job url-queue)
       ;; Kill jobs that have lasted longer than the timeout.
       (when (and (url-queue-start-time job)
-                (> (- (float-time) (url-queue-start-time job))
-                   url-queue-timeout))
+                (time-less-p url-queue-timeout
+                             (time-since (url-queue-start-time job))))
        (push job dead-jobs)))
     (dolist (job dead-jobs)
       (url-queue-kill-job job)
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index c2baa69..1d0ecb4 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -74,7 +74,8 @@ If a list, it is a list of the types of messages to be 
logged."
 
 ;;;###autoload
 (defun url-parse-args (str &optional nodowncase)
-  ;; Return an assoc list of attribute/value pairs from an RFC822-type string
+  ;; Return an assoc list of attribute/value pairs from a string
+  ;; that uses RFC 822 (or later) format.
   (let (
        name                            ; From name=
        value                           ; its value
diff --git a/lisp/url/url.el b/lisp/url/url.el
index 101c2b2..ed09477 100644
--- a/lisp/url/url.el
+++ b/lisp/url/url.el
@@ -259,8 +259,7 @@ how long to wait for a response before giving up."
        ;; process output.
        (while (and (not retrieval-done)
                     (or (not timeout)
-                        (< (float-time (time-subtract nil start-time))
-                           timeout)))
+                       (time-less-p (time-since start-time) timeout)))
          (url-debug 'retrieval
                     "Spinning in url-retrieve-synchronously: %S (%S)"
                     retrieval-done asynch-buffer)
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 607c7b5..bad5639 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -1458,7 +1458,7 @@ a diff with \\[diff-reverse-direction].
        (lambda () (diff-find-file-name nil 'noprompt)))
   (add-function :filter-return (local 'filter-buffer-substring-function)
                 #'diff--filter-substring)
-  (unless (buffer-file-name)
+  (unless buffer-file-name
     (hack-dir-local-variables-non-file-buffer)))
 
 ;;;###autoload
@@ -2123,6 +2123,26 @@ Return new point, if it was moved."
                                   (match-end 0) end
                                   nil #'diff-refine-preproc props-r 
props-a)))))))
 
+(defun diff--iterate-hunks (max fun)
+  "Iterate over all hunks between point and MAX.
+Call FUN with two args (BEG and END) for each hunk."
+  (save-excursion
+    (let* ((beg (or (ignore-errors (diff-beginning-of-hunk))
+                    (ignore-errors (diff-hunk-next) (point))
+                    max)))
+      (while (< beg max)
+        (goto-char beg)
+        (cl-assert (looking-at diff-hunk-header-re))
+        (let ((end
+               (save-excursion (diff-end-of-hunk) (point))))
+          (cl-assert (< beg end))
+          (funcall fun beg end)
+          (goto-char end)
+          (setq beg (if (looking-at diff-hunk-header-re)
+                        end
+                      (or (ignore-errors (diff-hunk-next) (point))
+                          max))))))))
+
 (defun diff--font-lock-refined (max)
   "Apply hunk refinement from font-lock."
   (when diff-font-lock-refine
@@ -2138,27 +2158,19 @@ Return new point, if it was moved."
       ;; same hunk.
       (goto-char (next-single-char-property-change
                   (point) 'diff--font-lock-refined nil max)))
-    (let* ((min (point))
-           (beg (or (ignore-errors (diff-beginning-of-hunk))
-                    (ignore-errors (diff-hunk-next) (point))
-                    max)))
-      (while (< beg max)
-        (let ((end
-               (save-excursion (goto-char beg) (diff-end-of-hunk) (point))))
-          (if (< end min) (setq beg min))
-          (unless (or (< end beg)
-                      (get-char-property beg 'diff--font-lock-refined))
-            (diff--refine-hunk beg end)
-            (let ((ol (make-overlay beg end)))
-              (overlay-put ol 'diff--font-lock-refined t)
-              (overlay-put ol 'diff-mode 'fine)
-              (overlay-put ol 'evaporate t)
-              (overlay-put ol 'modification-hooks
-                           '(diff--font-lock-refine--refresh))))
-          (goto-char (max beg end))
-          (setq beg (or (ignore-errors (diff-hunk-next) (point)) max)))))))
-
-(defun diff--font-lock-refine--refresh (ol _after _beg _end &optional _len)
+    (diff--iterate-hunks
+     max
+     (lambda (beg end)
+       (unless (get-char-property beg 'diff--font-lock-refined)
+         (diff--refine-hunk beg end)
+         (let ((ol (make-overlay beg end)))
+           (overlay-put ol 'diff--font-lock-refined t)
+           (overlay-put ol 'diff-mode 'fine)
+           (overlay-put ol 'evaporate t)
+           (overlay-put ol 'modification-hooks
+                        '(diff--overlay-auto-delete))))))))
+
+(defun diff--overlay-auto-delete (ol _after _beg _end &optional _len)
   (delete-overlay ol))
 
 (defun diff-undo (&optional arg)
@@ -2365,29 +2377,17 @@ and the position in MAX."
     (when (get-char-property (point) 'diff--font-lock-syntax)
       (goto-char (next-single-char-property-change
                   (point) 'diff--font-lock-syntax nil max)))
-    (let* ((min (point))
-           (beg (or (ignore-errors (diff-beginning-of-hunk))
-                    (ignore-errors (diff-hunk-next) (point))
-                    max)))
-      (while (< beg max)
-        (let ((end
-               (save-excursion (goto-char beg) (diff-end-of-hunk) (point))))
-          (if (< end min) (setq beg min))
-          (unless (or (< end beg)
-                      (get-char-property beg 'diff--font-lock-syntax))
-            (diff-syntax-fontify beg end)
-            (let ((ol (make-overlay beg end)))
-              (overlay-put ol 'diff--font-lock-syntax t)
-              (overlay-put ol 'diff-mode 'syntax)
-              (overlay-put ol 'evaporate t)
-              (overlay-put ol 'modification-hooks
-                           '(diff--font-lock-syntax--refresh))))
-          (goto-char (max beg end))
-          (setq beg (or (ignore-errors (diff-hunk-next) (point)) max))))))
-  nil)
-
-(defun diff--font-lock-syntax--refresh (ol _after _beg _end &optional _len)
-  (delete-overlay ol))
+    (diff--iterate-hunks
+     max
+     (lambda (beg end)
+       (unless (get-char-property beg 'diff--font-lock-syntax)
+         (diff-syntax-fontify beg end)
+         (let ((ol (make-overlay beg end)))
+           (overlay-put ol 'diff--font-lock-syntax t)
+           (overlay-put ol 'diff-mode 'syntax)
+           (overlay-put ol 'evaporate t)
+           (overlay-put ol 'modification-hooks
+                        '(diff--overlay-auto-delete))))))))
 
 (defun diff-syntax-fontify (beg end)
   "Highlight source language syntax in diff hunk between BEG and END."
@@ -2407,7 +2407,7 @@ When OLD is non-nil, highlight the hunk from the old 
source."
   (let* ((hunk (buffer-substring-no-properties beg end))
          ;; Trim a trailing newline to find hunk in diff-syntax-fontify-props
          ;; in diffs that have no newline at end of diff file.
-         (text (string-trim-right (or (ignore-errors (diff-hunk-text hunk (not 
old) nil)) "")))
+         (text (string-trim-right (or (with-demoted-errors (diff-hunk-text 
hunk (not old) nil)) "")))
         (line (if (looking-at "\\(?:\\*\\{15\\}.*\n\\)address@hidden 
]*\\([0-9,]+\\)\\([ acd+]+\\([0-9,]+\\)\\)?")
                   (if old (match-string 1)
                     (if (match-end 3) (match-string 3) (match-string 1)))))
@@ -2430,7 +2430,7 @@ When OLD is non-nil, highlight the hunk from the old 
source."
                   ;; Try to reuse an existing buffer
                   (if (get-file-buffer (expand-file-name file))
                       (with-current-buffer (get-file-buffer (expand-file-name 
file))
-                        (setq props (diff-syntax-fontify-props nil text 
line-nb t)))
+                        (setq props (diff-syntax-fontify-props nil text 
line-nb)))
                     ;; Get properties from the file
                     (with-temp-buffer
                       (insert-file-contents file)
@@ -2450,12 +2450,12 @@ When OLD is non-nil, highlight the hunk from the old 
source."
                       (puthash buffer-name buffer 
diff-syntax-fontify-revisions))))
                 (when buffer
                   (with-current-buffer buffer
-                    (setq props (diff-syntax-fontify-props file text line-nb 
t))))))
+                    (setq props (diff-syntax-fontify-props file text 
line-nb))))))
           ;; If file is unavailable, get properties from the hunk alone
           (setq file (car (diff-hunk-file-names old)))
           (with-temp-buffer
             (insert text)
-            (setq props (diff-syntax-fontify-props file text line-nb nil 
t))))))
+            (setq props (diff-syntax-fontify-props file text line-nb t))))))
      ((and diff-default-directory (not (eq diff-font-lock-syntax 'hunk-only)))
       (let ((file (car (diff-hunk-file-names old))))
         (if (and file (file-exists-p file) (file-regular-p file))
@@ -2466,12 +2466,12 @@ When OLD is non-nil, highlight the hunk from the old 
source."
           ;; Otherwise, get properties from the hunk alone
           (with-temp-buffer
             (insert text)
-            (setq props (diff-syntax-fontify-props file text line-nb nil 
t))))))
+            (setq props (diff-syntax-fontify-props file text line-nb t))))))
      ((memq diff-font-lock-syntax '(hunk-also hunk-only))
       (let ((file (car (diff-hunk-file-names old))))
         (with-temp-buffer
           (insert text)
-          (setq props (diff-syntax-fontify-props file text line-nb nil t))))))
+          (setq props (diff-syntax-fontify-props file text line-nb t))))))
 
     ;; Put properties over the hunk text
     (goto-char beg)
@@ -2494,18 +2494,22 @@ When OLD is non-nil, highlight the hunk from the old 
source."
                     (overlay-put ol 'evaporate t)
                     (overlay-put ol 'face (nth 2 prop))))))))))))
 
-(defun diff-syntax-fontify-props (file text line-nb &optional no-init 
hunk-only)
+(defun diff-syntax-fontify-props (file text line-nb &optional hunk-only)
   "Get font-lock properties from the source code.
-FILE is the name of the source file.  TEXT is the literal source text from
-hunk.  LINE-NB is a pair of numbers: start line number and the number of
+FILE is the name of the source file.  If non-nil, it requests initialization
+of the mode according to FILE.
+TEXT is the literal source text from hunk.
+LINE-NB is a pair of numbers: start line number and the number of
 lines in the hunk.  NO-INIT means no initialization is needed to set major
 mode.  When HUNK-ONLY is non-nil, then don't verify the existence of the
 hunk text in the source file.  Otherwise, don't highlight the hunk if the
 hunk text is not found in the source file."
-  (unless no-init
-    (buffer-disable-undo)
-    (font-lock-mode -1)
-    (setq buffer-file-name nil)
+  (when file
+    ;; When initialization is requested, we should be in a brand new
+    ;; temp buffer.
+    (cl-assert (eq t buffer-undo-list))
+    (cl-assert (not font-lock-mode))
+    (cl-assert (null buffer-file-name))
     (let ((enable-local-variables :safe) ;; to find `mode:'
           (buffer-file-name file))
       (set-auto-mode)
@@ -2514,7 +2518,6 @@ hunk text is not found in the source file."
         (generic-mode-find-file-hook))))
 
   (let ((font-lock-defaults (or font-lock-defaults '(nil t)))
-        (inhibit-read-only t)
         props beg end)
     (goto-char (point-min))
     (if hunk-only
@@ -2546,7 +2549,6 @@ hunk text is not found in the source file."
           (when val (push (list from eol val) line-props))
           (push (nreverse line-props) props))
         (forward-line 1)))
-    (set-buffer-modified-p nil)
     (nreverse props)))
 
 
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index f9ea4de..c6806ba 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1541,10 +1541,7 @@ This command shares argument histories with \\[rgrep] 
and \\[grep]."
   "Create a stash with the current tree state."
   (interactive)
   (vc-git--call nil "stash" "save"
-               (let ((ct (current-time)))
-                 (concat
-                  (format-time-string "Snapshot on %Y-%m-%d" ct)
-                  (format-time-string " at %H:%M" ct))))
+               (format-time-string "Snapshot on %Y-%m-%d at %H:%M"))
   (vc-git-command "*vc-git-stash*" 0 nil "stash" "apply" "-q" "address@hidden")
   (vc-resynch-buffer (vc-git-root default-directory) t t))
 
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 342c6d2..6b17e861 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -923,9 +923,6 @@ FILENAME must be the file's true absolute name."
       (setf ignored (string-match (pop patterns) filename)))
     ignored))
 
-(defun vc-hg--time-to-integer (ts)
-  (+ (* 65536 (car ts)) (cadr ts)))
-
 (defvar vc-hg--cached-ignore-patterns nil
   "Cached pre-parsed hg ignore patterns.")
 
@@ -1046,8 +1043,9 @@ hg binary."
                (let ((vc-hg-size (nth 2 dirstate-entry))
                      (vc-hg-mtime (nth 3 dirstate-entry))
                      (fs-size (file-attribute-size stat))
-                     (fs-mtime (vc-hg--time-to-integer
-                               (file-attribute-modification-time stat))))
+                    (fs-mtime (encode-time
+                               (file-attribute-modification-time stat)
+                               'integer)))
                  (if (and (eql vc-hg-size fs-size) (eql vc-hg-mtime fs-mtime))
                      'up-to-date
                    'edited)))
diff --git a/lisp/woman.el b/lisp/woman.el
index 1100693..38e083a 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -2011,7 +2011,7 @@ Optional argument REDRAW, if non-nil, forces mode line to 
be updated."
 ;;   ;; Terminates man processing
 ;;   "Report formatting time."
 ;;   (message "Man formatting done in %s seconds"
-;;            (float-time (time-subtract nil WoMan-Man-start-time))))
+;;            (float-time (time-since WoMan-Man-start-time))))
 
 
 ;;; Buffer handling:
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 770aecf..5ff7182 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -243,11 +243,10 @@ which is the \"1006\" extension implemented in Xterm >= 
277."
              (y    (nth 2 click))
              ;; Emulate timestamp information.  This is accurate enough
              ;; for default value of mouse-1-click-follows-link (450msec).
-             (timestamp (truncate
-                         (* 1000
-                            (- (float-time)
-                               (or xt-mouse-epoch
-                                   (setq xt-mouse-epoch (float-time)))))))
+            (timestamp (if (not xt-mouse-epoch)
+                           (progn (setq xt-mouse-epoch (float-time)) 0)
+                         (car (encode-time (time-since xt-mouse-epoch)
+                                           1000))))
              (w (window-at x y))
              (ltrb (window-edges w))
              (left (nth 0 ltrb))
diff --git a/src/w32term.c b/src/w32term.c
index 6fc8612..bdd02d0 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -6733,7 +6733,10 @@ x_make_frame_visible (struct frame *f)
     }
 
   if (!FLOATP (Vx_wait_for_event_timeout))
+    {
+      unblock_input ();
       return;
+    }
 
   /* Synchronize to ensure Emacs knows the frame is visible
      before we do anything else.  We do this loop with input not blocked
diff --git a/test/data/shr/ol.html b/test/data/shr/ol.html
new file mode 100644
index 0000000..f9a15f2
--- /dev/null
+++ b/test/data/shr/ol.html
@@ -0,0 +1,29 @@
+<ol>
+  <li>one</li>
+  <li>two</li>
+  <li>three</li>
+</ol>
+
+<ol start="10">
+  <li>ten</li>
+  <li>eleven</li>
+  <li>twelve</li>
+</ol>
+
+<ol start="0">
+  <li>zero</li>
+  <li>one</li>
+  <li>two</li>
+</ol>
+
+<ol start="-5">
+  <li>minus five</li>
+  <li>minus four</li>
+  <li>minus three</li>
+</ol>
+
+<ol start="notanumber">
+  <li>one</li>
+  <li>two</li>
+  <li>three</li>
+</ol>
diff --git a/test/data/shr/ol.txt b/test/data/shr/ol.txt
new file mode 100644
index 0000000..0d46e2a
--- /dev/null
+++ b/test/data/shr/ol.txt
@@ -0,0 +1,19 @@
+1 one
+2 two
+3 three
+
+10 ten
+11 eleven
+12 twelve
+
+0 zero
+1 one
+2 two
+
+-5 minus five
+-4 minus four
+-3 minus three
+
+1 one
+2 two
+3 three
diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el
index a68f931..7a11f76 100644
--- a/test/lisp/progmodes/sql-tests.el
+++ b/test/lisp/progmodes/sql-tests.el
@@ -53,6 +53,8 @@
           (error "some error"))))
     (should-not (sql-postgres-list-databases))))
 
+;;; Check Connection Password Handling/Wallet
+
 (defvar sql-test-login-params nil)
 (defmacro with-sql-test-connect-harness (id login-params connection expected)
   "Set-up and tear-down SQL connect related test.
@@ -62,40 +64,40 @@ LOGIN-PARAMS.  Provide the CONNECTION parameters and the 
EXPECTED
 string of values passed to the comint function for validation."
   (declare (indent 2))
   `(cl-letf
-      ((sql-test-login-params ' ,login-params)
-       ((symbol-function 'sql-comint-test)
-        (lambda (product options &optional buf-name)
-          (with-current-buffer (get-buffer-create buf-name)
-            (insert (pp-to-string (list product options sql-user sql-password 
sql-server sql-database))))))
-       ((symbol-function 'sql-run-test)
-        (lambda (&optional buffer)
-          (interactive "P")
-          (sql-product-interactive 'sqltest buffer)))
-       (sql-user nil)
-       (sql-server nil)
-       (sql-database nil)
-       (sql-product-alist
-        '((ansi)
-          (sqltest
-           :name "SqlTest"
-           :sqli-login sql-test-login-params
-           :sqli-comint-func sql-comint-test)))
-       (sql-connection-alist
-        '((,(format "test-%s" id)
-           ,@connection)))
-       (sql-password-wallet
-        (list
-         (make-temp-file
-          "sql-test-netrc" nil nil
-          (mapconcat #'identity
-                     '("machine aMachine user aUserName password \"netrc-A 
aPassword\""
-                       "machine aServer user aUserName password \"netrc-B 
aPassword\""
-                       "machine aMachine server aServer user aUserName 
password \"netrc-C aPassword\""
-                       "machine aMachine database aDatabase user aUserName 
password \"netrc-D aPassword\""
-                       "machine aDatabase user aUserName password \"netrc-E 
aPassword\""
-                       "machine aMachine server aServer database aDatabase 
user aUserName password \"netrc-F aPassword\""
-                       "machine \"aServer/aDatabase\" user aUserName password 
\"netrc-G aPassword\""
-                       ) "\n")))))
+       ((sql-test-login-params ' ,login-params)
+        ((symbol-function 'sql-comint-test)
+         (lambda (product options &optional buf-name)
+           (with-current-buffer (get-buffer-create buf-name)
+             (insert (pp-to-string (list product options sql-user sql-password 
sql-server sql-database))))))
+        ((symbol-function 'sql-run-test)
+         (lambda (&optional buffer)
+           (interactive "P")
+           (sql-product-interactive 'sqltest buffer)))
+        (sql-user nil)
+        (sql-server nil)
+        (sql-database nil)
+        (sql-product-alist
+         '((ansi)
+           (sqltest
+            :name "SqlTest"
+            :sqli-login sql-test-login-params
+            :sqli-comint-func sql-comint-test)))
+        (sql-connection-alist
+         '((,(format "test-%s" id)
+            ,@connection)))
+        (sql-password-wallet
+         (list
+          (make-temp-file
+           "sql-test-netrc" nil nil
+           (mapconcat #'identity
+                      '("machine aMachine user aUserName password \"netrc-A 
aPassword\""
+                        "machine aServer user aUserName password \"netrc-B 
aPassword\""
+                        "machine aMachine server aServer user aUserName 
password \"netrc-C aPassword\""
+                        "machine aMachine database aDatabase user aUserName 
password \"netrc-D aPassword\""
+                        "machine aDatabase user aUserName password \"netrc-E 
aPassword\""
+                        "machine aMachine server aServer database aDatabase 
user aUserName password \"netrc-F aPassword\""
+                        "machine \"aServer/aDatabase\" user aUserName password 
\"netrc-G aPassword\""
+                        ) "\n")))))
 
      (let* ((connection ,(format "test-%s" id))
             (buffername (format "*SQL: ERT TEST <%s>*" connection)))
@@ -106,53 +108,167 @@ string of values passed to the comint function for 
validation."
        (should (string-equal (with-current-buffer buffername (buffer-string)) 
,expected))
        (when (get-buffer buffername)
          (kill-buffer buffername))
-     (delete-file (car sql-password-wallet)))))
+       (delete-file (car sql-password-wallet)))))
 
 (ert-deftest sql-test-connect ()
   "Test of basic `sql-connect'."
   (with-sql-test-connect-harness 1 (user password server database)
-      ((sql-product 'sqltest)
-       (sql-user "aUserName")
-       (sql-password "test-1 aPassword")
-       (sql-server "aServer")
-       (sql-database "aDatabase"))
+    ((sql-product 'sqltest)
+     (sql-user "aUserName")
+     (sql-password "test-1 aPassword")
+     (sql-server "aServer")
+     (sql-database "aDatabase"))
     "(sqltest nil \"aUserName\" \"test-1 aPassword\" \"aServer\" 
\"aDatabase\")\n"))
 
 (ert-deftest sql-test-connect-password-func ()
   "Test of password function."
   (with-sql-test-connect-harness 2 (user password server database)
-      ((sql-product 'sqltest)
-       (sql-user "aUserName")
-       (sql-password (lambda () (concat [?t ?e ?s ?t ?- ?2 ?\s
-                                       ?a ?P ?a ?s ?s ?w ?o ?r ?d])))
-       (sql-server "aServer")
-       (sql-database "aDatabase"))
+    ((sql-product 'sqltest)
+     (sql-user "aUserName")
+     (sql-password (lambda () (concat [?t ?e ?s ?t ?- ?2 ?\s
+                                     ?a ?P ?a ?s ?s ?w ?o ?r ?d])))
+     (sql-server "aServer")
+     (sql-database "aDatabase"))
     "(sqltest nil \"aUserName\" \"test-2 aPassword\" \"aServer\" 
\"aDatabase\")\n"))
 
 (ert-deftest sql-test-connect-wallet-server-database ()
   "Test of password function."
   (with-sql-test-connect-harness 3 (user password server database)
-      ((sql-product 'sqltest)
-       (sql-user "aUserName")
-       (sql-server "aServer")
-       (sql-database "aDatabase"))
+    ((sql-product 'sqltest)
+     (sql-user "aUserName")
+     (sql-server "aServer")
+     (sql-database "aDatabase"))
     "(sqltest nil \"aUserName\" \"netrc-G aPassword\" \"aServer\" 
\"aDatabase\")\n"))
 
 (ert-deftest sql-test-connect-wallet-database ()
   "Test of password function."
   (with-sql-test-connect-harness 4 (user password database)
-      ((sql-product 'sqltest)
-       (sql-user "aUserName")
-       (sql-database "aDatabase"))
+    ((sql-product 'sqltest)
+     (sql-user "aUserName")
+     (sql-database "aDatabase"))
     "(sqltest nil \"aUserName\" \"netrc-E aPassword\" nil \"aDatabase\")\n"))
 
 (ert-deftest sql-test-connect-wallet-server ()
   "Test of password function."
   (with-sql-test-connect-harness 5 (user password server)
-      ((sql-product 'sqltest)
-       (sql-user "aUserName")
-       (sql-server "aServer"))
+    ((sql-product 'sqltest)
+     (sql-user "aUserName")
+     (sql-server "aServer"))
     "(sqltest nil \"aUserName\" \"netrc-B aPassword\" \"aServer\" nil)\n"))
 
+;;; Set/Get Product Features
+
+(defvar sql-test-feature-value-a nil "Indirect value A.")
+(defvar sql-test-feature-value-b nil "Indirect value B.")
+(defvar sql-test-feature-value-c nil "Indirect value C.")
+(defvar sql-test-feature-value-d nil "Indirect value D.")
+(defmacro sql-test-product-feature-harness (&rest action)
+  "Set-up and tear-down of testing product/feature API.
+
+Perform ACTION and validate results"
+  (declare (indent 2))
+  `(cl-letf
+       ((sql-product-alist
+         (list (list 'a :X 1 :Y 2 :Z 'sql-test-feature-value-a)
+               (list 'b :X 3      :Z 'sql-test-feature-value-b)
+               (list 'c      :Y 6 :Z 'sql-test-feature-value-c)
+               (list 'd :X 7 :Y 8                            )))
+        (sql-indirect-features '(:Z :W))
+        (sql-test-feature-value-a "original A")
+        (sql-test-feature-value-b "original B")
+        (sql-test-feature-value-c "original C")
+        (sql-test-feature-value-d "original D"))
+     ,@action))
+
+(ert-deftest sql-test-add-product ()
+  "Add a product"
+
+  (sql-test-product-feature-harness
+      (sql-add-product 'xyz "XyzDb")
+
+      (should (equal (pp-to-string (assoc 'xyz sql-product-alist))
+                     "(xyz :name \"XyzDb\")\n"))))
+
+(ert-deftest sql-test-add-existing-product ()
+  "Add a product that already exists."
+
+  (sql-test-product-feature-harness
+      (should-error (sql-add-feature 'a "Aaa"))
+      (should (equal (pp-to-string (assoc 'a sql-product-alist))
+                     "(a :X 1 :Y 2 :Z sql-test-feature-value-a)\n"))))
+
+(ert-deftest sql-test-set-feature ()
+  "Add a feature"
+
+  (sql-test-product-feature-harness
+      (sql-set-product-feature 'b :Y 4)
+      (should (equal (pp-to-string (assoc 'b sql-product-alist))
+                     "(b :Y 4 :X 3 :Z sql-test-feature-value-b)\n"))))
+
+(ert-deftest sql-test-set-indirect-feature ()
+  "Set a new indirect feature"
+
+  (sql-test-product-feature-harness
+      (sql-set-product-feature 'd :Z 'sql-test-feature-value-d)
+      (should (equal (pp-to-string (assoc 'd sql-product-alist))
+                     "(d :Z sql-test-feature-value-d :X 7 :Y 8)\n"))))
+
+(ert-deftest sql-test-set-existing-feature ()
+  "Set an existing feature."
+
+  (sql-test-product-feature-harness
+      (sql-set-product-feature 'b :X 33)
+      (should (equal (pp-to-string (assoc 'b sql-product-alist))
+                     "(b :X 33 :Z sql-test-feature-value-b)\n"))))
+
+(ert-deftest sql-test-set-existing-indirect-feature ()
+  "Set an existing indirect feature."
+
+  (sql-test-product-feature-harness
+      (should (equal sql-test-feature-value-b "original B"))
+      (sql-set-product-feature 'b :Z "Hurray!")
+    (should (equal (pp-to-string (assoc 'b sql-product-alist))
+                   "(b :X 3 :Z sql-test-feature-value-b)\n")) ;; unchanged
+    (should (equal sql-test-feature-value-b "Hurray!"))))
+
+(ert-deftest sql-test-set-missing-product ()
+  "Add a feature to a missing product."
+
+  (sql-test-product-feature-harness
+      (should-error (sql-set-product-feature 'x :Y 4))
+      (should-not (assoc 'x sql-product-alist))))
+
+(ert-deftest sql-test-get-feature ()
+  "Get a feature value."
+
+  (sql-test-product-feature-harness
+      (should (equal (sql-get-product-feature 'c :Y) 6))))
+
+(ert-deftest sql-test-get-indirect-feature ()
+  "Get a feature indirect value."
+
+  (sql-test-product-feature-harness
+      (should (equal (sql-get-product-feature 'c :Z nil t) 
'sql-test-feature-value-c))
+      (should (equal sql-test-feature-value-c "original C"))
+    (should (equal (sql-get-product-feature 'c :Z) "original C"))))
+
+(ert-deftest sql-test-get-missing-product ()
+  "Get a feature value from a missing product."
+
+  (sql-test-product-feature-harness
+      (should-error (sql-get-product-feature 'x :Y))))
+
+(ert-deftest sql-test-get-missing-feature ()
+  "Get a missing feature value."
+
+  (sql-test-product-feature-harness
+      (should-not (sql-get-product-feature 'c :X))))
+
+(ert-deftest sql-test-get-missing-indirect-feature ()
+  "Get a missing indirect feature value."
+
+  (sql-test-product-feature-harness
+      (should-not (sql-get-product-feature 'd :Z))))
+
 (provide 'sql-tests)
 ;;; sql-tests.el ends here



reply via email to

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