emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] xwidget_mvp 9b21639 2/7: Merge remote-tracking branch 'ori


From: Joakim Verona
Subject: [Emacs-diffs] xwidget_mvp 9b21639 2/7: Merge remote-tracking branch 'origin/master' into xwidget_mvp
Date: Tue, 15 Sep 2015 08:28:48 +0000

branch: xwidget_mvp
commit 9b21639d7ff307e9e0a815dc6d0a7c7140b1f048
Merge: beaa2cd b142c48
Author: Joakim Verona <address@hidden>
Commit: Joakim Verona <address@hidden>

    Merge remote-tracking branch 'origin/master' into xwidget_mvp
---
 ChangeLog.2                          | 2319 ++++++++++++++++++++++++++++-
 admin/admin.el                       |   22 +-
 admin/authors.el                     |   10 +-
 admin/bzrmerge.el                    |    4 +-
 admin/notes/unicode                  |    1 -
 admin/unidata/makefile.w32-in        |   56 -
 admin/unidata/unidata-gen.el         |    2 +-
 admin/unidata/uvs.el                 |    2 +-
 build-aux/gitlog-to-emacslog         |    2 +-
 configure.ac                         |   45 +-
 doc/emacs/cal-xtra.texi              |    6 +-
 doc/emacs/calendar.texi              |    5 +-
 doc/emacs/makefile.w32-in            |  153 --
 doc/emacs/misc.texi                  |    3 +-
 doc/emacs/modes.texi                 |    3 +-
 doc/emacs/mule.texi                  |   12 +-
 doc/emacs/programs.texi              |    3 +-
 doc/emacs/regs.texi                  |    2 +-
 doc/emacs/search.texi                |   18 +-
 doc/emacs/sending.texi               |    4 +-
 doc/emacs/text.texi                  |   12 +-
 doc/lispintro/emacs-lisp-intro.texi  |   23 +-
 doc/lispintro/makefile.w32-in        |   85 -
 doc/lispref/commands.texi            |    2 +-
 doc/lispref/control.texi             |    6 +-
 doc/lispref/display.texi             |   33 +-
 doc/lispref/elisp.texi               |    9 +-
 doc/lispref/frames.texi              |  889 +++++++----
 doc/lispref/help.texi                |   40 +-
 doc/lispref/internals.texi           |   54 +-
 doc/lispref/intro.texi               |    4 +-
 doc/lispref/makefile.w32-in          |  128 --
 doc/lispref/minibuf.texi             |    2 +-
 doc/lispref/positions.texi           |    3 +-
 doc/lispref/processes.texi           |    4 +-
 doc/lispref/searching.texi           |    7 +-
 doc/lispref/strings.texi             |   35 +-
 doc/lispref/text.texi                |    6 +-
 doc/lispref/windows.texi             |  303 +++-
 doc/misc/makefile.w32-in             |  431 ------
 doc/misc/tramp.texi                  |    6 +-
 etc/DEBUG                            |  224 ++--
 etc/DEVEL.HUMOR                      |    4 +-
 etc/DISTRIB                          |    8 +-
 etc/ETAGS.EBNF                       |    2 +-
 etc/ETAGS.README                     |    2 +-
 etc/MACHINES                         |    8 +-
 etc/NEWS                             |  114 ++-
 etc/PROBLEMS                         |  350 +++---
 etc/README                           |    2 -
 etc/TERMS                            |   70 +-
 etc/TODO                             |   62 +-
 etc/compilation.txt                  |    9 +-
 etc/e/README                         |    2 +-
 etc/enriched.txt                     |   25 +-
 etc/grep.txt                         |    4 +-
 etc/refcards/README                  |    6 +-
 etc/yow.lines                        |  Bin 403 -> 400 bytes
 leim/makefile.w32-in                 |  237 ---
 lib-src/ebrowse.c                    |   12 +-
 lib-src/emacsclient.c                |   14 +-
 lib-src/etags.c                      |  104 +-
 lib-src/make-docfile.c               |    4 +-
 lib-src/makefile.w32-in              |  482 ------
 lib-src/ntlib.c                      |    2 +-
 lib/makefile.w32-in                  |  347 -----
 lib/time_rz.c                        |    4 +-
 lisp/abbrev.el                       |    2 +-
 lisp/align.el                        |   10 +-
 lisp/allout-widgets.el               |   12 +-
 lisp/allout.el                       |   67 +-
 lisp/ansi-color.el                   |   12 +-
 lisp/apropos.el                      |   13 +-
 lisp/autoinsert.el                   |    2 +-
 lisp/autorevert.el                   |    4 +-
 lisp/avoid.el                        |    6 +-
 lisp/bookmark.el                     |   15 +-
 lisp/bs.el                           |    2 +-
 lisp/button.el                       |    6 +-
 lisp/calc/calc-aent.el               |    8 +-
 lisp/calc/calc-embed.el              |   10 +-
 lisp/calc/calc-ext.el                |   16 +-
 lisp/calc/calc-graph.el              |    2 +-
 lisp/calc/calc-help.el               |   35 +-
 lisp/calc/calc-lang.el               |   44 +-
 lisp/calc/calc-misc.el               |    4 +-
 lisp/calc/calc-mode.el               |   16 +-
 lisp/calc/calc-prog.el               |   14 +-
 lisp/calc/calc-store.el              |    3 +-
 lisp/calc/calc-units.el              |   19 +-
 lisp/calc/calc-vec.el                |   12 +-
 lisp/calc/calc-yank.el               |    4 +-
 lisp/calc/calc.el                    |   14 +-
 lisp/calculator.el                   |    2 +-
 lisp/calendar/appt.el                |    2 +-
 lisp/calendar/cal-tex.el             |    4 +-
 lisp/calendar/calendar.el            |   14 +-
 lisp/calendar/diary-lib.el           |   14 +-
 lisp/calendar/holidays.el            |   25 +-
 lisp/calendar/icalendar.el           |   32 +-
 lisp/calendar/time-date.el           |    4 +-
 lisp/calendar/timeclock.el           |   10 +-
 lisp/calendar/todo-mode.el           |   16 +-
 lisp/cedet/cedet-global.el           |    2 +-
 lisp/cedet/data-debug.el             |    2 +-
 lisp/cedet/ede/base.el               |    4 +-
 lisp/cedet/ede/cpp-root.el           |    2 +-
 lisp/cedet/ede/pconf.el              |    4 +-
 lisp/cedet/ede/pmake.el              |    3 +-
 lisp/cedet/ede/proj-archive.el       |    2 +-
 lisp/cedet/ede/proj-prog.el          |    2 +-
 lisp/cedet/ede/proj.el               |    6 +-
 lisp/cedet/ede/project-am.el         |   16 +-
 lisp/cedet/mode-local.el             |  131 ++-
 lisp/cedet/pulse.el                  |   41 +-
 lisp/cedet/semantic.el               |    4 +-
 lisp/cedet/semantic/analyze/debug.el |    2 +-
 lisp/cedet/semantic/bovine/c.el      |   20 +-
 lisp/cedet/semantic/bovine/scm.el    |    2 +-
 lisp/cedet/semantic/complete.el      |    8 +-
 lisp/cedet/semantic/ctxt.el          |    2 +-
 lisp/cedet/semantic/db.el            |    6 +-
 lisp/cedet/semantic/edit.el          |    4 +-
 lisp/cedet/semantic/java.el          |    2 +-
 lisp/cedet/semantic/lex-spp.el       |    2 +-
 lisp/cedet/semantic/senator.el       |    4 +-
 lisp/cedet/semantic/symref.el        |    2 +-
 lisp/cedet/semantic/tag.el           |    2 +-
 lisp/cedet/semantic/wisent.el        |    6 +-
 lisp/cedet/semantic/wisent/comp.el   |    6 +-
 lisp/cedet/semantic/wisent/python.el |    7 +-
 lisp/cedet/srecode/compile.el        |    4 +-
 lisp/cedet/srecode/dictionary.el     |    2 +-
 lisp/cedet/srecode/document.el       |    2 +-
 lisp/cedet/srecode/el.el             |    2 +-
 lisp/cedet/srecode/insert.el         |   10 +-
 lisp/cedet/srecode/texi.el           |    2 +-
 lisp/character-fold.el               |   16 +-
 lisp/comint.el                       |   11 +-
 lisp/cus-edit.el                     |   14 +-
 lisp/cus-start.el                    |   18 +-
 lisp/custom.el                       |   12 +-
 lisp/dabbrev.el                      |    2 +-
 lisp/delim-col.el                    |    4 +-
 lisp/delsel.el                       |   15 +-
 lisp/descr-text.el                   |   18 +-
 lisp/desktop.el                      |    4 +-
 lisp/dframe.el                       |    4 +-
 lisp/dired-aux.el                    |   22 +-
 lisp/dired-x.el                      |   10 +-
 lisp/dired.el                        |   11 +-
 lisp/dirtrack.el                     |    2 +-
 lisp/disp-table.el                   |    3 +-
 lisp/double.el                       |    8 +-
 lisp/ebuff-menu.el                   |    6 +-
 lisp/edmacro.el                      |    2 +-
 lisp/ehelp.el                        |    8 +-
 lisp/electric.el                     |   39 +-
 lisp/emacs-lisp/advice.el            |   34 +-
 lisp/emacs-lisp/byte-opt.el          |   26 +-
 lisp/emacs-lisp/byte-run.el          |   10 +-
 lisp/emacs-lisp/bytecomp.el          |  107 +-
 lisp/emacs-lisp/cconv.el             |   11 +-
 lisp/emacs-lisp/chart.el             |    2 +-
 lisp/emacs-lisp/check-declare.el     |   12 +-
 lisp/emacs-lisp/checkdoc.el          |   42 +-
 lisp/emacs-lisp/cl-extra.el          |   46 +-
 lisp/emacs-lisp/cl-generic.el        |   19 +-
 lisp/emacs-lisp/cl-macs.el           |   32 +-
 lisp/emacs-lisp/cl.el                |    8 +-
 lisp/emacs-lisp/copyright.el         |    4 +-
 lisp/emacs-lisp/crm.el               |    4 +-
 lisp/emacs-lisp/edebug.el            |    6 +-
 lisp/emacs-lisp/eieio-base.el        |    2 +-
 lisp/emacs-lisp/eieio-core.el        |    8 +-
 lisp/emacs-lisp/eieio-opt.el         |    4 +-
 lisp/emacs-lisp/eieio-speedbar.el    |    4 +-
 lisp/emacs-lisp/eieio.el             |    8 +-
 lisp/emacs-lisp/eldoc.el             |    4 +-
 lisp/emacs-lisp/elint.el             |   20 +-
 lisp/emacs-lisp/ert-x.el             |    2 +-
 lisp/emacs-lisp/ert.el               |    2 +-
 lisp/emacs-lisp/find-func.el         |   37 +-
 lisp/emacs-lisp/generator.el         |    2 +-
 lisp/emacs-lisp/gv.el                |    2 +-
 lisp/emacs-lisp/lisp-mnt.el          |   35 +-
 lisp/emacs-lisp/macroexp.el          |   11 +-
 lisp/emacs-lisp/map-ynp.el           |    7 +-
 lisp/emacs-lisp/nadvice.el           |    6 +-
 lisp/emacs-lisp/package-x.el         |    2 +-
 lisp/emacs-lisp/package.el           |  336 +++--
 lisp/emacs-lisp/pcase.el             |   10 +-
 lisp/emacs-lisp/re-builder.el        |    2 +-
 lisp/emacs-lisp/ring.el              |    4 +-
 lisp/emacs-lisp/rx.el                |   42 +-
 lisp/emacs-lisp/seq.el               |  407 +++---
 lisp/emacs-lisp/shadow.el            |    2 +-
 lisp/emacs-lisp/smie.el              |   31 +-
 lisp/emacs-lisp/subr-x.el            |    2 +-
 lisp/emacs-lisp/tabulated-list.el    |    2 +-
 lisp/emacs-lisp/testcover.el         |    2 +-
 lisp/emacs-lisp/timer.el             |    3 +-
 lisp/emacs-lisp/warnings.el          |    8 +-
 lisp/emulation/viper-cmd.el          |   46 +-
 lisp/emulation/viper-init.el         |    4 +-
 lisp/emulation/viper-macs.el         |   16 +-
 lisp/env.el                          |    4 +-
 lisp/epa-file.el                     |    7 +-
 lisp/epa.el                          |   26 +-
 lisp/epg.el                          |    8 +-
 lisp/erc/erc-button.el               |    8 +-
 lisp/erc/erc-dcc.el                  |   27 +-
 lisp/erc/erc-match.el                |   34 +-
 lisp/erc/erc-services.el             |   11 +-
 lisp/erc/erc-speedbar.el             |    7 +-
 lisp/erc/erc-track.el                |    8 +-
 lisp/erc/erc.el                      |   38 +-
 lisp/eshell/em-dirs.el               |   16 +-
 lisp/eshell/em-glob.el               |    4 +-
 lisp/eshell/em-hist.el               |    2 +-
 lisp/eshell/em-pred.el               |   12 +-
 lisp/eshell/em-script.el             |    4 +-
 lisp/eshell/em-term.el               |    2 +-
 lisp/eshell/em-unix.el               |   10 +-
 lisp/eshell/esh-arg.el               |    6 +-
 lisp/eshell/esh-cmd.el               |   16 +-
 lisp/eshell/esh-ext.el               |    2 +-
 lisp/eshell/esh-io.el                |    2 +-
 lisp/eshell/esh-opt.el               |    4 +-
 lisp/eshell/esh-var.el               |   10 +-
 lisp/facemenu.el                     |   10 +-
 lisp/faces.el                        |   49 +-
 lisp/ffap.el                         |   85 +-
 lisp/files-x.el                      |    2 +-
 lisp/files.el                        |   55 +-
 lisp/filesets.el                     |   41 +-
 lisp/find-cmd.el                     |   22 +-
 lisp/find-dired.el                   |    5 +-
 lisp/finder.el                       |    2 +-
 lisp/follow.el                       |    2 +-
 lisp/font-core.el                    |    2 +-
 lisp/font-lock.el                    |    8 +-
 lisp/format.el                       |   12 +-
 lisp/forms.el                        |   10 +-
 lisp/frame.el                        |  134 ++-
 lisp/fringe.el                       |    2 +-
 lisp/gnus/auth-source.el             |   66 +-
 lisp/gnus/gnus-agent.el              |    4 +-
 lisp/gnus/gnus-art.el                |   78 +-
 lisp/gnus/gnus-cite.el               |   14 +-
 lisp/gnus/gnus-html.el               |   18 +-
 lisp/gnus/gnus-int.el                |    8 +-
 lisp/gnus/gnus-registry.el           |   14 +-
 lisp/gnus/gnus-salt.el               |   10 +-
 lisp/gnus/gnus-score.el              |    2 +-
 lisp/gnus/gnus-sieve.el              |   12 +-
 lisp/gnus/gnus-start.el              |    6 +-
 lisp/gnus/gnus-sum.el                |   30 +-
 lisp/gnus/gnus-topic.el              |    2 +-
 lisp/gnus/gnus-util.el               |   15 +-
 lisp/gnus/gnus-uu.el                 |    6 +-
 lisp/gnus/gnus.el                    |   17 +-
 lisp/gnus/legacy-gnus-agent.el       |   11 +-
 lisp/gnus/mail-source.el             |    2 +-
 lisp/gnus/message.el                 |   63 +-
 lisp/gnus/mm-decode.el               |    7 +-
 lisp/gnus/nnbabyl.el                 |    2 +-
 lisp/gnus/nndiary.el                 |    2 +-
 lisp/gnus/nneething.el               |    2 +-
 lisp/gnus/nnheader.el                |    2 +-
 lisp/gnus/nnimap.el                  |   69 +-
 lisp/gnus/nnmail.el                  |   10 +-
 lisp/gnus/nnmaildir.el               |    1 +
 lisp/gnus/nnmairix.el                |    8 +-
 lisp/gnus/nnmbox.el                  |    2 +-
 lisp/gnus/nnmh.el                    |    2 +-
 lisp/gnus/nnml.el                    |    2 +-
 lisp/gnus/nnspool.el                 |    2 +-
 lisp/gnus/nntp.el                    |    6 +-
 lisp/gnus/pop3.el                    |    2 +-
 lisp/gnus/registry.el                |    6 +-
 lisp/gnus/sieve.el                   |   24 +-
 lisp/gnus/spam.el                    |    2 +-
 lisp/help-fns.el                     |  114 +-
 lisp/help-mode.el                    |    2 +
 lisp/help.el                         |    7 +-
 lisp/hexl.el                         |    5 +-
 lisp/hilit-chg.el                    |    2 +-
 lisp/htmlfontify.el                  |   20 +-
 lisp/ibuf-ext.el                     |    2 +-
 lisp/ibuffer.el                      |  186 ++--
 lisp/icomplete.el                    |    2 +-
 lisp/ido.el                          |    8 +-
 lisp/ielm.el                         |    8 +-
 lisp/image.el                        |    6 +-
 lisp/imenu.el                        |    7 +-
 lisp/info-xref.el                    |    4 +-
 lisp/info.el                         |   23 +-
 lisp/international/fontset.el        |   37 +-
 lisp/international/ja-dic-cnv.el     |    4 +-
 lisp/international/kkc.el            |    2 +-
 lisp/international/mule-cmds.el      |   26 +-
 lisp/international/mule-conf.el      |   14 +-
 lisp/international/mule-diag.el      |   25 +-
 lisp/international/mule.el           |    2 +-
 lisp/international/ogonek.el         |    4 +-
 lisp/international/quail.el          |    8 +-
 lisp/international/robin.el          |    2 +-
 lisp/kmacro.el                       |    2 +-
 lisp/language/hanja-util.el          |    4 +-
 lisp/ldefs-boot.el                   |  363 +++---
 lisp/leim/quail/cyrillic.el          |   14 +-
 lisp/leim/quail/greek.el             |    8 +-
 lisp/leim/quail/hangul.el            |   12 +-
 lisp/leim/quail/hebrew.el            |    8 +-
 lisp/leim/quail/japanese.el          |    7 +-
 lisp/leim/quail/lao.el               |    5 +-
 lisp/leim/quail/latin-alt.el         |   44 +-
 lisp/leim/quail/latin-post.el        |   70 +-
 lisp/leim/quail/latin-pre.el         |   32 +-
 lisp/leim/quail/lrt.el               |    5 +-
 lisp/leim/quail/tibetan.el           |   26 +-
 lisp/leim/quail/viqr.el              |    2 +-
 lisp/loadhist.el                     |   13 +-
 lisp/mail/feedmail.el                |   42 +-
 lisp/mail/mail-utils.el              |    7 +-
 lisp/mail/metamail.el                |    2 +-
 lisp/mail/rfc2368.el                 |   10 +-
 lisp/mail/rmail.el                   |  172 ++-
 lisp/mail/rmailout.el                |   40 +-
 lisp/mail/sendmail.el                |   67 +
 lisp/makefile.w32-in                 |  728 ---------
 lisp/menu-bar.el                     |    4 +-
 lisp/mh-e/mh-mime.el                 |    2 +-
 lisp/mh-e/mh-search.el               |    2 +-
 lisp/mh-e/mh-seq.el                  |    4 +-
 lisp/mh-e/mh-utils.el                |   12 +-
 lisp/minibuffer.el                   |    4 +-
 lisp/mouse.el                        |    4 +-
 lisp/mpc.el                          |    6 +-
 lisp/msb.el                          |    4 +-
 lisp/net/ange-ftp.el                 |    8 +-
 lisp/net/gnutls.el                   |    2 +-
 lisp/net/mairix.el                   |   11 +-
 lisp/net/newst-backend.el            |   18 +-
 lisp/net/newst-plainview.el          |    4 +-
 lisp/net/newst-treeview.el           |    8 +-
 lisp/net/nsm.el                      |    2 +-
 lisp/net/pinentry.el                 |  189 ++-
 lisp/net/rcirc.el                    |    2 +-
 lisp/net/rlogin.el                   |    4 +-
 lisp/net/soap-client.el              |   11 +-
 lisp/net/tramp-adb.el                |   95 +-
 lisp/net/tramp-cache.el              |    4 +-
 lisp/net/tramp-cmds.el               |    7 +-
 lisp/net/tramp-compat.el             |   11 +-
 lisp/net/tramp-sh.el                 |  213 ++-
 lisp/net/tramp.el                    |   20 +-
 lisp/net/trampver.el                 |    3 +-
 lisp/newcomment.el                   |    4 +-
 lisp/nxml/nxml-outln.el              |    2 +-
 lisp/nxml/nxml-parse.el              |    2 +-
 lisp/nxml/nxml-rap.el                |    8 +-
 lisp/nxml/rng-cmpct.el               |    2 +-
 lisp/nxml/rng-match.el               |    2 +-
 lisp/nxml/rng-uri.el                 |    2 +-
 lisp/nxml/rng-valid.el               |   16 +-
 lisp/obsolete/complete.el            |    2 +-
 lisp/obsolete/iso-acc.el             |    6 +-
 lisp/obsolete/iswitchb.el            |    8 +-
 lisp/obsolete/landmark.el            |    2 +-
 lisp/obsolete/lmenu.el               |    6 +-
 lisp/obsolete/old-whitespace.el      |    2 +-
 lisp/obsolete/otodo-mode.el          |    4 +-
 lisp/obsolete/pgg-gpg.el             |    2 +-
 lisp/obsolete/pgg-pgp.el             |    2 +-
 lisp/obsolete/pgg-pgp5.el            |   10 +-
 lisp/obsolete/scribe.el              |    8 +-
 lisp/obsolete/sregex.el              |   10 +-
 lisp/obsolete/terminal.el            |    4 +-
 lisp/obsolete/tpu-edt.el             |    6 +-
 lisp/obsolete/vc-arch.el             |    2 +-
 lisp/obsolete/vi.el                  |   16 +-
 lisp/obsolete/vip.el                 |    7 +-
 lisp/org/ob-core.el                  |   20 +-
 lisp/org/ob-exp.el                   |    2 +-
 lisp/org/ob-fortran.el               |    7 +-
 lisp/org/ob-python.el                |    2 +-
 lisp/org/ob-ref.el                   |    2 +-
 lisp/org/ob-scheme.el                |    2 +-
 lisp/org/org-agenda.el               |    8 +-
 lisp/org/org-bibtex.el               |    8 +-
 lisp/org/org-clock.el                |   17 +-
 lisp/org/org-colview.el              |    2 +-
 lisp/org/org-ctags.el                |    4 +-
 lisp/org/org-element.el              |   10 +-
 lisp/org/org-feed.el                 |    3 +-
 lisp/org/org-gnus.el                 |    2 +-
 lisp/org/org-habit.el                |    2 +-
 lisp/org/org-irc.el                  |    4 +-
 lisp/org/org-list.el                 |    6 +-
 lisp/org/org-mouse.el                |   10 +-
 lisp/org/org-plot.el                 |    2 +-
 lisp/org/org-protocol.el             |    2 +-
 lisp/org/org-src.el                  |   10 +-
 lisp/org/org-table.el                |    2 +-
 lisp/org/org.el                      |  252 ++--
 lisp/org/ox-latex.el                 |   16 +-
 lisp/org/ox-man.el                   |    2 +-
 lisp/org/ox-odt.el                   |    4 +-
 lisp/org/ox-publish.el               |    4 +-
 lisp/org/ox-texinfo.el               |    6 +-
 lisp/org/ox.el                       |   12 +-
 lisp/outline.el                      |    4 +-
 lisp/pcmpl-cvs.el                    |    4 +-
 lisp/pcmpl-x.el                      |    2 +-
 lisp/pcomplete.el                    |    8 +-
 lisp/play/bubbles.el                 |   10 +-
 lisp/play/decipher.el                |    4 +-
 lisp/play/dunnet.el                  |   46 +-
 lisp/play/gomoku.el                  |    2 +-
 lisp/play/morse.el                   |    2 +-
 lisp/printing.el                     |    8 +-
 lisp/proced.el                       |    6 +-
 lisp/profiler.el                     |    2 +-
 lisp/progmodes/ada-mode.el           |   36 +-
 lisp/progmodes/ada-prj.el            |    6 +-
 lisp/progmodes/ada-xref.el           |    6 +-
 lisp/progmodes/antlr-mode.el         |    2 +-
 lisp/progmodes/bug-reference.el      |    2 +-
 lisp/progmodes/cc-align.el           |   14 +-
 lisp/progmodes/cc-awk.el             |    8 +-
 lisp/progmodes/cc-bytecomp.el        |    8 +-
 lisp/progmodes/cc-cmds.el            |   27 +-
 lisp/progmodes/cc-defs.el            |  113 +-
 lisp/progmodes/cc-engine.el          |   38 +-
 lisp/progmodes/cc-fonts.el           |   34 +-
 lisp/progmodes/cc-guess.el           |    8 +-
 lisp/progmodes/cc-langs.el           |  221 ++--
 lisp/progmodes/cc-menus.el           |    8 +-
 lisp/progmodes/cc-mode.el            |    8 +-
 lisp/progmodes/cc-styles.el          |    8 +-
 lisp/progmodes/cc-vars.el            |    8 +-
 lisp/progmodes/cfengine.el           |    2 +-
 lisp/progmodes/compile.el            |   10 +-
 lisp/progmodes/cperl-mode.el         |   14 +-
 lisp/progmodes/cpp.el                |    5 +-
 lisp/progmodes/dcl-mode.el           |    2 +-
 lisp/progmodes/ebnf2ps.el            |    2 +-
 lisp/progmodes/ebrowse.el            |    5 +-
 lisp/progmodes/elisp-mode.el         |  245 +++-
 lisp/progmodes/etags.el              |    6 +-
 lisp/progmodes/flymake.el            |   10 +-
 lisp/progmodes/fortran.el            |    2 +-
 lisp/progmodes/gdb-mi.el             |    4 +-
 lisp/progmodes/idlw-shell.el         |   18 +-
 lisp/progmodes/idlwave.el            |    4 +-
 lisp/progmodes/js.el                 |    5 +-
 lisp/progmodes/octave.el             |    2 +-
 lisp/progmodes/opascal.el            |    2 +-
 lisp/progmodes/pascal.el             |    4 +-
 lisp/progmodes/prog-mode.el          |   53 +-
 lisp/progmodes/project.el            |   62 +-
 lisp/progmodes/prolog.el             |    4 +-
 lisp/progmodes/python.el             |  757 ++++++----
 lisp/progmodes/ruby-mode.el          |    4 +-
 lisp/progmodes/sh-script.el          |    2 +-
 lisp/progmodes/sql.el                |    8 +-
 lisp/progmodes/verilog-mode.el       | 2808 +++++++++++++++++-----------------
 lisp/progmodes/vhdl-mode.el          |   54 +-
 lisp/progmodes/xref.el               |   90 +-
 lisp/ps-print.el                     |   11 +-
 lisp/recentf.el                      |    9 +-
 lisp/register.el                     |    2 +-
 lisp/replace.el                      |   24 +-
 lisp/savehist.el                     |    8 +-
 lisp/scroll-bar.el                   |    2 +-
 lisp/server.el                       |   10 +-
 lisp/ses.el                          |    6 +-
 lisp/simple.el                       |  102 +-
 lisp/skeleton.el                     |    2 +-
 lisp/startup.el                      |   77 +-
 lisp/strokes.el                      |    9 +-
 lisp/subr.el                         |   24 +-
 lisp/term.el                         |    6 +-
 lisp/term/common-win.el              |    6 +-
 lisp/term/x-win.el                   | 1604 ++++++++++----------
 lisp/textmodes/bib-mode.el           |    4 +-
 lisp/textmodes/bibtex.el             |    2 +-
 lisp/textmodes/css-mode.el           |   20 +-
 lisp/textmodes/flyspell.el           |   10 +-
 lisp/textmodes/ispell.el             |  207 ++-
 lisp/textmodes/reftex-ref.el         |    2 +-
 lisp/textmodes/reftex-toc.el         |    2 +-
 lisp/textmodes/reftex.el             |    4 +-
 lisp/textmodes/rst.el                |    2 +-
 lisp/textmodes/table.el              |   28 +-
 lisp/textmodes/tex-mode.el           |  482 ++++++-
 lisp/textmodes/texinfmt.el           |    8 +-
 lisp/textmodes/texinfo.el            |    2 +-
 lisp/textmodes/texnfo-upd.el         |    2 +-
 lisp/thumbs.el                       |    2 +-
 lisp/time-stamp.el                   |    2 +-
 lisp/tutorial.el                     |   25 +-
 lisp/type-break.el                   |    5 +-
 lisp/uniquify.el                     |   28 +-
 lisp/url/url-auth.el                 |    6 +-
 lisp/userlock.el                     |    2 +-
 lisp/vc/add-log.el                   |    2 +-
 lisp/vc/ediff-diff.el                |    2 +-
 lisp/vc/emerge.el                    |    2 +-
 lisp/vc/vc-cvs.el                    |    4 +-
 lisp/vc/vc-svn.el                    |    2 +-
 lisp/version.el                      |    9 +-
 lisp/wdired.el                       |   16 +-
 lisp/whitespace.el                   |    6 +-
 lisp/wid-edit.el                     |   22 +-
 lisp/window.el                       |  172 ++-
 lisp/woman.el                        |    6 +-
 lisp/xml.el                          |    8 +-
 make-dist                            |   21 +-
 nt/INSTALL.OLD                       |  752 ---------
 nt/config.nt                         | 1847 ----------------------
 nt/configure.bat                     |  954 +------------
 nt/emacs-src.tags                    |    6 -
 nt/envadd.bat                        |   43 -
 nt/gmake.defs                        |  333 ----
 nt/inc/ms-w32.h                      |   14 +
 nt/makefile.w32-in                   |  465 ------
 nt/multi-install-info.bat            |   40 -
 nt/nmake.defs                        |  294 ----
 nt/paths.h                           |   66 -
 nt/zipdist.bat                       |   43 -
 src/alloc.c                          |  283 +----
 src/bidi.c                           |   17 +-
 src/buffer.c                         |   32 +-
 src/bytecode.c                       |   49 +-
 src/callint.c                        |   20 +-
 src/callproc.c                       |   87 +-
 src/character.h                      |   24 +
 src/charset.c                        |    2 +-
 src/chartab.c                        |   11 -
 src/coding.c                         |   18 +-
 src/composite.c                      |    2 +-
 src/data.c                           |    3 -
 src/dbusbind.c                       |   58 +-
 src/dired.c                          |   29 +-
 src/dispnew.c                        |    2 +-
 src/doc.c                            |  154 +-
 src/doprnt.c                         |   60 +-
 src/editfns.c                        |  400 +++---
 src/emacs.c                          |   42 +-
 src/eval.c                           |  122 +--
 src/fileio.c                         |  107 +-
 src/filelock.c                       |    4 -
 src/floatfns.c                       |   16 +-
 src/fns.c                            |   91 +-
 src/frame.c                          |   74 +-
 src/gfilenotify.c                    |   34 +-
 src/gtkutil.c                        |   15 +-
 src/image.c                          |  322 ++--
 src/indent.c                         |    4 +-
 src/insdel.c                         |   19 -
 src/keyboard.c                       |  369 ++---
 src/keyboard.h                       |    2 +-
 src/keymap.c                         |   82 +-
 src/lisp.h                           |  288 +----
 src/lread.c                          |   66 +-
 src/macfont.m                        |   55 +-
 src/macros.c                         |    3 -
 src/makefile.w32-in                  | 1725 ---------------------
 src/menu.c                           |   11 -
 src/minibuf.c                        |   22 +-
 src/nsfns.m                          |  216 ++--
 src/nsfont.m                         |    2 +-
 src/nsimage.m                        |    4 +-
 src/print.c                          |   41 +-
 src/process.c                        |   83 +-
 src/profiler.c                       |   18 +-
 src/regex.c                          |   14 +-
 src/regex.h                          |    4 +-
 src/search.c                         |   10 +-
 src/sound.c                          |    3 -
 src/syntax.c                         |    6 +-
 src/sysdep.c                         |   26 +-
 src/systime.h                        |    5 +-
 src/textprop.c                       |   40 +-
 src/w32.c                            |   13 +-
 src/w32fns.c                         |  507 ++++---
 src/w32proc.c                        |   26 +-
 src/w32uniscribe.c                   |  301 +++-
 src/window.c                         |  191 +---
 src/xdisp.c                          |  279 ++--
 src/xfaces.c                         |   15 +-
 src/xfns.c                           |  374 +++--
 src/xrdb.c                           |   17 +-
 src/xselect.c                        |   26 +-
 src/xsettings.c                      |    4 +-
 src/xterm.c                          |   35 +-
 src/xterm.h                          |    1 +
 test/automated/elisp-mode-tests.el   |  525 ++++++-
 test/automated/ert-tests.el          |    4 +
 test/automated/finalizer-tests.el    |   50 -
 test/automated/generator-tests.el    |   14 -
 test/automated/icalendar-tests.el    |    4 +-
 test/automated/python-tests.el       |  265 +++-
 test/automated/seq-tests.el          |   17 +-
 test/automated/textprop-tests.el     |   12 +
 test/automated/tramp-tests.el        |   33 +-
 test/indent/css-mode.css             |    2 +-
 test/redisplay-testsuite.el          |   40 +
 611 files changed, 15013 insertions(+), 19612 deletions(-)

diff --git a/ChangeLog.2 b/ChangeLog.2
index c4bb659..15cb656 100644
--- a/ChangeLog.2
+++ b/ChangeLog.2
@@ -1,3 +1,2311 @@
+2015-08-23  Xue Fuqiao  <address@hidden>
+
+       * doc/emacs/modes.texi (Choosing Modes): Minor doc fix for
+       magic-fallback-mode-alist.
+
+2015-08-22  Fabián Ezequiel Gallina  <address@hidden>
+
+       python.el: fallback completion, ffap and eldoc setup enhancements
+       Setup codes are now sent continuously so that the current frame is
+       always taken into account.  This allows working within debuggers
+       and always keeping a fresh version of setup codes that will return
+       proper results.
+       * lisp/progmodes/python.el (python-shell-setup-codes): Cleanup.
+       (python-shell-send-setup-code): Send code only when
+       python-shell-setup-codes is non-nil.
+       (python-shell-completion-string-code): Cleanup trailing newline.
+       (python-shell-completion-get-completions): Always use
+       python-shell-completion-setup-code.
+       (python-ffap-setup-code): Work with any object, not only modules.
+       (python-ffap-string-code): Cleanup trailing newline.
+       (python-ffap-module-path): Always use python-ffap-setup-code.
+       (python-eldoc-string-code): Cleanup trailing newline.
+       (python-eldoc--get-doc-at-point): Always use
+       python-eldoc-setup-code.  Return non-nil only if docstring is
+       found.
+
+       python.el: Increase native completion robustness.
+       * lisp/progmodes/python.el (python-shell-completion-native-setup):
+       Make completer print real candidates and just return dummy ones to
+       avoid input modification.
+       (python-shell-completion-native-get-completions): Set
+       comint-redirect-insert-matching-regexp to non-nil and make
+       comint-redirect-finished-regexp match the last dummy candidate.
+       Use python-shell-accept-process-output to wait for the full list
+       of candidates.
+
+2015-08-22  Eli Zaretskii  <address@hidden>
+
+       Fix invocation of programs via cmdproxy.exe
+       * src/w32proc.c (sys_spawnve): Use exec-directory, not
+       invocation-directory, for finding cmdproxy.exe.  When Emacs is
+       run from the source tree, look for cmdproxy.exe in the same source
+       tree.  (Bug#21323)
+
+2015-08-22  Simen Heggestøyl  <address@hidden>
+
+       Handle comments inside unquoted URIs in css-mode
+       * lisp/textmodes/css-mode.el (css--uri-re): New defconst.
+       (css-syntax-propertize-function): New defconst.
+       (css--font-lock-keywords): Handle parens around unquoted URIs.
+       (css-mode): Set `syntax-propertize-function'.
+
+2015-08-22  Eli Zaretskii  <address@hidden>
+
+       Support invocation of Hunspell with multiple dictionaries
+       * lisp/textmodes/ispell.el (ispell-parse-hunspell-affix-file): Support
+       lists of dictionaries of the form "DICT1,DICT2,...".
+       (ispell-hunspell-add-multi-dic): New command.  (Bug#20495)
+
+       Minor formatting changes in ispell.el
+       * lisp/textmodes/ispell.el (ispell-create-debug-buffer)
+       (ispell-print-if-debug, ispell-aspell-find-dictionary)
+       (ispell-aspell-add-aliases, ispell-hunspell-dict-paths-alist)
+       (ispell-hunspell-dictionary-alist)
+       (ispell-hunspell-fill-dictionary-entry)
+       (ispell-find-hunspell-dictionaries, ispell-send-replacement)
+       (ispell-buffer-with-debug, ispell-complete-word)
+       (ispell-current-dictionary, ispell-current-personal-dictionary)
+       (ispell-accept-output, ispell-minor-mode)
+       (ispell-personal-dictionary, ispell-dictionary-alist)
+       (ispell-really-aspell, ispell-really-hunspell)
+       (ispell-encoding8-command, ispell-aspell-supports-utf8)
+       (ispell-aspell-dictionary-alist, ispell-set-spellchecker-params):
+       Fix whitespace, inconsistent capitalization, and arguments in doc
+       strings.
+
+2015-08-22  Martin Rudalics  <address@hidden>
+
+       In ‘adjust-window-trailing-edge’ fix bug with size-preserved windows.
+       * lisp/window.el (adjust-window-trailing-edge): Fix bug where this
+       function refused to resize a size-preserved window.
+
+2015-08-22  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'window-use-time'
+       * doc/lispref/windows.texi (Selecting Windows): Improve
+       documentation and indexing of 'window-use-time'.
+
+2015-08-21  Stefan Monnier  <address@hidden>
+
+       * lisp/progmodes/cc-*.el: Fix up commenting style
+       * lisp/progmodes/cc-vars.el, lisp/progmodes/cc-styles.el:
+       * lisp/progmodes/cc-mode.el, lisp/progmodes/cc-menus.el:
+       * lisp/progmodes/cc-langs.el, lisp/progmodes/cc-guess.el:
+       * lisp/progmodes/cc-fonts.el, lisp/progmodes/cc-engine.el:
+       * lisp/progmodes/cc-defs.el, lisp/progmodes/cc-cmds.el:
+       * lisp/progmodes/cc-bytecomp.el, lisp/progmodes/cc-awk.el:
+       * lisp/progmodes/cc-align.el, lisp/net/soap-client.el:
+       Fix up commenting style.
+
+2015-08-21  Paul Eggert  <address@hidden>
+
+       text-quoting-style in emacs-lisp diagnostics
+       * lisp/emacs-lisp/advice.el (ad-read-advised-function)
+       (ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
+       (ad-disable-advice, ad-remove-advice, ad-set-argument)
+       (ad-set-arguments):
+       * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
+       (byte-compile-unfold-lambda, byte-optimize-form-code-walker)
+       (byte-optimize-while, byte-optimize-apply):
+       * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
+       (byte-compile-log-file, byte-compile-format-warn)
+       (byte-compile-nogroup-warn, byte-compile-arglist-warn)
+       (byte-compile-cl-warn)
+       (byte-compile-warn-about-unresolved-functions)
+       (byte-compile-file, byte-compile-fix-header)
+       (byte-compile--declare-var, byte-compile-file-form-defmumble)
+       (byte-compile-form, byte-compile-normal-call)
+       (byte-compile-variable-ref, byte-compile-variable-set)
+       (byte-compile-subr-wrong-args, byte-compile-setq-default)
+       (byte-compile-negation-optimizer)
+       (byte-compile-condition-case--old)
+       (byte-compile-condition-case--new, byte-compile-save-excursion)
+       (byte-compile-defvar, byte-compile-autoload)
+       (byte-compile-lambda-form)
+       (byte-compile-make-variable-buffer-local, display-call-tree)
+       (batch-byte-compile):
+       * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
+       (cconv-analyze-form):
+       * lisp/emacs-lisp/chart.el (chart-space-usage):
+       * lisp/emacs-lisp/check-declare.el (check-declare-scan)
+       (check-declare-warn, check-declare-file)
+       (check-declare-directory):
+       * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
+       (checkdoc-message-text-engine):
+       * lisp/emacs-lisp/cl-extra.el (cl-parse-integer):
+       * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
+       (cl-symbol-macrolet):
+       * lisp/emacs-lisp/cl.el (cl-unload-function, flet):
+       * lisp/emacs-lisp/copyright.el (copyright)
+       (copyright-update-directory):
+       * lisp/emacs-lisp/edebug.el (edebug-read-list):
+       * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
+       * lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
+       (eieio-oref, eieio-oset-default):
+       * lisp/emacs-lisp/eieio-speedbar.el:
+       (eieio-speedbar-child-make-tag-lines)
+       (eieio-speedbar-child-description):
+       * lisp/emacs-lisp/eieio.el (defclass, change-class):
+       * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
+       (elint-init-form, elint-check-defalias-form)
+       (elint-check-let-form):
+       * lisp/emacs-lisp/ert.el (ert-get-test):
+       * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
+       (find-function-library):
+       * lisp/emacs-lisp/generator.el (iter-yield):
+       * lisp/emacs-lisp/gv.el (gv-define-simple-setter):
+       * lisp/emacs-lisp/lisp-mnt.el (lm-verify):
+       * lisp/emacs-lisp/package-x.el (package-upload-file):
+       * lisp/emacs-lisp/package.el (package-version-join)
+       (package-disabled-p, package-activate-1, package-activate)
+       (package--download-one-archive)
+       (package--download-and-read-archives)
+       (package-compute-transaction, package-install-from-archive)
+       (package-install, package-install-selected-packages)
+       (package-delete, package-autoremove)
+       (package-install-button-action, package-delete-button-action)
+       (package-menu-hide-package, package-menu--list-to-prompt)
+       (package-menu--perform-transaction)
+       (package-menu--find-and-notify-upgrades):
+       * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
+       * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
+       * lisp/emacs-lisp/ring.el (ring-next, ring-previous):
+       * lisp/emacs-lisp/rx.el (rx-check, rx-anything):
+       * lisp/emacs-lisp/smie.el (smie-config-save):
+       * lisp/emacs-lisp/subr-x.el (internal--check-binding):
+       * lisp/emacs-lisp/testcover.el (testcover-1value):
+       Use curved quotes in diagnostic format strings.
+
+2015-08-21  Fabián Ezequiel Gallina  <address@hidden>
+
+       python.el: Ensure remote process-environment on non-interactive 
processes
+       * lisp/progmodes/python.el
+       (python-shell-tramp-refresh-process-environment): New function.
+       (python-shell-with-environment): Use it.
+       * test/automated/python-tests.el (python-shell-with-environment-2): 
Update.
+
+       python.el: Enhancements to process environment setup.
+       * lisp/progmodes/python.el (python-shell-process-environment)
+       (python-shell-extra-pythonpaths, python-shell-exec-path)
+       (python-shell-virtualenv-root): Update docstring.  Remove :safe.
+       (python-shell-setup-codes): Remove :safe.
+       (python-shell-remote-exec-path): New defcustom.
+       (python-shell--add-to-path-with-priority): New macro.
+       (python-shell-calculate-pythonpath): Give priority to
+       python-shell-extra-pythonpaths.  Update docstring.
+       (python-shell-calculate-process-environment): Give priority to
+       python-shell-process-environment.  Update docstring.
+       (python-shell-calculate-exec-path): Give priority to
+       python-shell-exec-path and calculated virtualenv bin directory.
+       Update docstring.
+       (python-shell-tramp-refresh-remote-path): New function.
+       (python-shell-with-environment): Use it when working remotely and
+       do not modify tramp-remote-path.  Allow nesting.
+       (python-shell-calculate-command): Remove useless
+       python-shell-with-environment call.
+       * test/automated/python-tests.el (python-shell-calculate-pythonpath-1)
+       (python-shell-calculate-pythonpath-2)
+       (python-shell-calculate-process-environment-6)
+       (python-shell-calculate-process-environment-7)
+       (python-shell-calculate-process-environment-8)
+       (python-shell-calculate-exec-path-3)
+       (python-shell-calculate-exec-path-4)
+       (python-shell-calculate-exec-path-5)
+       (python-shell-calculate-exec-path-6)
+       (python-shell-with-environment-3): New tests.
+       (python-shell-calculate-process-environment-2)
+       (python-shell-calculate-process-environment-3)
+       (python-shell-calculate-process-environment-4)
+       (python-shell-calculate-process-environment-5)
+       (python-shell-calculate-exec-path-1)
+       (python-shell-calculate-exec-path-2)
+       (python-shell-with-environment-1)
+       (python-shell-with-environment-2): Update and simplify.
+
+2015-08-21  Paul Eggert  <address@hidden>
+
+       Avoid hard-coding "M-x command" in docstrings
+       * lisp/calendar/todo-mode.el (todo-mode):
+       * lisp/desktop.el (desktop-save-mode):
+       * lisp/edmacro.el (edit-kbd-macro):
+       * lisp/emacs-lisp/package.el (package-menu-execute):
+       * lisp/emulation/viper-cmd.el (viper-ask-level):
+       * lisp/emulation/viper-init.el (viper-expert-level):
+       * lisp/filesets.el (filesets-add-buffer):
+       * lisp/follow.el (follow-mode):
+       * lisp/gnus/auth-source.el (auth-sources):
+       * lisp/international/ogonek.el (ogonek-informacja)
+       (ogonek-information):
+       * lisp/net/tramp.el (tramp-process-actions):
+       * lisp/org/org-gnus.el (org-gnus-no-new-news):
+       * lisp/org/org.el (org-ellipsis):
+       * lisp/progmodes/python.el (python-shell-get-process-or-error):
+       * lisp/progmodes/vhdl-mode.el (vhdl-mode):
+       * lisp/server.el (server-start):
+       * lisp/type-break.el (type-break-noninteractive-query):
+       * lisp/userlock.el (ask-user-about-supersession-help):
+       * lisp/whitespace.el (whitespace-report-region):
+       Prefer (substitute-command-keys "`\\[foo-command]'")
+       to "`M-x foo-command'" in docstrings and the like.
+
+2015-08-21  Tassilo Horn  <address@hidden>
+
+       Use add-function for prettify-symbols-compose-predicate
+       * lisp/textmodes/tex-mode.el (tex-common-initialization): Set
+       prettify-symbols-compose-predicate in terms of add-function.
+       * etc/NEWS: Mention prettify-symbols-compose-predicate and
+       prettify-symbols-mode support in tex-mode.
+
+2015-08-21  Stefan Monnier  <address@hidden>
+
+       * lisp/emacs-lisp/smie.el (smie-indent-current-column): New fun
+       (smie-indent-exps, smie-indent-keyword): Use it.
+       * test/indent/css-mode.css: Test alignment with leading comment.
+
+2015-08-21  Paul Eggert  <address@hidden>
+
+       Respect text-quoting-style in (*Finder*) menus
+       * lisp/info.el (info--prettify-description):
+       Treat description as a docstring, so that it's requoted as
+       per text-quoting-style.
+
+2015-08-21  Martin Rudalics  <address@hidden>
+
+       Document `window-use-time' in Elisp manual
+       * doc/lispref/windows.texi (Selecting Windows): Document 
`window-use-time'.
+
+2015-08-21  Eli Zaretskii  <address@hidden>
+
+       A better fix for bug#21303
+       * src/w32uniscribe.c (_WIN32_WINNT): Define to 0x0600.  This is a
+       cleaner fix for Bug#21260 than the previous change.
+
+2015-08-21  Paul Eggert  <address@hidden>
+
+       Respect text-quoting-style in calc
+       In calc, tespect text-quoting-style preference in diagnostic
+       formats and fix a few similar problems in docstrings.
+       * lisp/calc/calc-aent.el (math-read-factor):
+       * lisp/calc/calc-embed.el (calc-do-embedded):
+       * lisp/calc/calc-ext.el (calc-user-function-list)
+       * lisp/calc/calc-graph.el (calc-graph-show-dumb):
+       * lisp/calc/calc-help.el (calc-describe-key)
+       (calc-describe-thing):
+       * lisp/calc/calc-lang.el (calc-c-language)
+       (math-parse-fortran-vector-end, math-parse-tex-sum)
+       (math-parse-eqn-matrix, math-parse-eqn-prime)
+       (calc-yacas-language, calc-maxima-language, calc-giac-language)
+       (math-read-big-rec, math-read-big-balance):
+       * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
+       (calc-auto-recompute):
+       * lisp/calc/calc-prog.el (calc-user-define-invocation)
+       (math-do-arg-check):
+       * lisp/calc/calc-store.el (calc-edit-variable):
+       * lisp/calc/calc-units.el (math-build-units-table-buffer):
+       * lisp/calc/calc-vec.el (math-read-brackets):
+       * lisp/calc/calc-yank.el (calc-edit-mode):
+       * lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
+       Use curved quotes in diagnostic format strings.
+       * lisp/calc/calc-help.el (calc-describe-thing):
+       Format docstrings with substitute-command-keys.
+       * lisp/calc/calc-help.el (calc-j-prefix-help):
+       * lisp/calc/calc-misc.el (calc-help):
+       * lisp/calc/calc-ext.el (calc-shift-Z-prefix-help):
+       Escape a docstring "`".
+
+2015-08-21  Eli Zaretskii  <address@hidden>
+
+       Fix documentation of 'menu-set-font' and 'set-frame-font'
+       * lisp/menu-bar.el (menu-set-font): Doc fix.  (Bug#21303)
+       * doc/lispref/frames.texi (Frame Font): Document that
+       set-frame-font with the last argument 't' will also make the font
+       the default for the future GUI frames.
+
+       Document '--create-frame' option to emacsclient
+       * doc/emacs/misc.texi (emacsclient Options): Document the
+       '--create-frame' option.  (Bug#21308)
+
+2015-08-21  Stefan Monnier  <address@hidden>
+
+       * lisp/progmodes/js.el (js-mode): Don't eagerly syntax propertize.
+
+2015-08-21  Eli Zaretskii  <address@hidden>
+
+       Document 'get-mru-window' in the ELisp manual
+       * doc/lispref/windows.texi (Cyclic Window Ordering): Document
+       'get-mru-window'.  (Bug#21306)
+
+       Clarify documentation of 'get-buffer-window-list'
+       * doc/lispref/windows.texi (Buffers and Windows): Mention that the
+       current window, if relevant, will be the first in the list
+       returned by 'get-buffer-window-list'.
+       * lisp/window.el (get-buffer-window-list): Doc fix.  (Bug#21305)
+
+2015-08-21  Vasilij Schneidermann  <address@hidden>
+
+       In `ielm' use `pop-to-buffer-same-window' (Bug#20848)
+       * lisp/ielm.el (ielm): Use `pop-to-buffer-same-window' instead of
+       `switch-to-buffer'.
+
+2015-08-21  Kaushal Modi  <address@hidden>  (tiny change)
+
+       In woman.el use `display-buffer' instead of `switch-to-buffer' 
(Bug#21047)
+       * lisp/woman.el (woman-really-find-file, WoMan-find-buffer): Use
+       `display-buffer' instead of `switch-to-buffer'.
+
+2015-08-21  Paul Eggert  <address@hidden>
+
+       Follow user preference in calendar diagnostics
+       Respect text-quoting-style preference in diagnostic formats by
+       using curved quotes (which are translated as per text-quoting-style)
+       instead of grave accent and apostrophe (which are not).
+       * lisp/calendar/appt.el (appt-display-message):
+       * lisp/calendar/diary-lib.el (diary-check-diary-file)
+       (diary-mail-entries, diary-from-outlook):
+       * lisp/calendar/icalendar.el (icalendar-export-region)
+       (icalendar--convert-float-to-ical)
+       (icalendar--convert-date-to-ical)
+       (icalendar--convert-ical-to-diary)
+       (icalendar--convert-recurring-to-diary)
+       (icalendar--add-diary-entry):
+       * lisp/calendar/time-date.el (format-seconds):
+       * lisp/calendar/timeclock.el (timeclock-mode-line-display)
+       (timeclock-make-hours-explicit):
+       * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
+       (todo-item-mark, todo-check-format)
+       (todo-insert-item--next-param, todo-edit-item--next-key)
+       (todo-mode):
+       Use curved quotes in diagnostic format strings.
+       * lisp/calendar/icalendar.el (icalendar-import-format-sample):
+       * test/automated/icalendar-tests.el (icalendar--import-format-sample):
+       Just use straight quoting for simple test case.
+
+2015-08-21  Michael Albinus  <address@hidden>
+
+       * src/gfilenotify.c (Fgfile_add_watch):
+       Handle errors from g_file_monitor.
+
+2015-08-21  Martin Rudalics  <address@hidden>
+
+       In frames.texi use "minibuffer-less frame" instead of "non-minibuffer 
frame"
+       * doc/lispref/frames.texi (Frame Layout): Use "minibuffer-less
+       frame" instead of "non-minibuffer frame".
+
+       Fix frame geometry related text
+       * doc/lispref/frames.texi (Frame Layout): Rename
+       `x-frame-geometry' to `frame-geometry'.
+       * doc/lispref/frames.texi (Mouse Position):
+       * doc/lispref/windows.texi (Coordinates and Windows): Use
+       `set-mouse-absolute-pixel-position' instead of
+       `x-set-mouse-absolute-pixel-position'.
+
+       Sanitize frame geometry related functions
+       * src/nsfns.m (Fx_frame_geometry): Rename to Fns_frame_geometry.
+       (Fx_frame_edges): Rename to Fns_frame_edges.
+       * src/w32fns.c (Fx_frame_geometry): Rename to Fw32_frame_geometry.
+       (Fx_frame_edges): Rename to Fw32_frame_edges.
+       (Fx_mouse_absolute_pixel_position): Rename to
+       Fw32_mouse_absolute_pixel_position.
+       (Fx_set_mouse_absolute_pixel_position): Rename to
+       Fw32_set_mouse_absolute_pixel_position.
+       * lisp/frame.el (x-frame-geometry, w32-frame-geometry)
+       (ns-frame-geometry, x-frame-edges, w32-frame-edges)
+       (ns-frame-edges, w32-mouse-absolute-pixel-position)
+       (x-mouse-absolute-pixel-position)
+       (w32-set-mouse-absolute-pixel-position)
+       (x-set-mouse-absolute-pixel-position): Declare.
+       (frame-geometry, mouse-absolute-pixel-position)
+       (set-mouse-absolute-pixel-position): New functions.
+       (frame-edges): Rewrite in terms of x-/w32-/ns-frame-edges.
+
+2015-08-21  Eli Zaretskii  <address@hidden>
+
+       Fix MinGW64 build broken by latest w32uniscribe.c changes
+       * src/w32uniscribe.c (UNISCRIBE_OPENTYPE): Define to 0x0100, for
+       MinGW64.  Reported by Andy Moreton <address@hidden>.
+       (Bug#21260)
+
+2015-08-21  Tassilo Horn  <address@hidden>
+
+       Add TeX defaults for prettify-symbol-mode
+       * lisp/textmodes/tex-mode.el (tex--prettify-symbols-alist): Rename
+       from tex-prettify-symbols-alist.
+       (tex--prettify-symbols-compose-p): New function.
+       (tex-common-initialization): Use them as prettify-symbols-alist
+       and prettify-symbols-compose-predicate.
+
+       Generalize prettify-symbols to arbitrary modes
+       * lisp/progmodes/prog-mode.el
+       (prettify-symbols-default-compose-p): New function.
+       (prettify-symbols-compose-predicate): New variable.
+       (prettify-symbols--compose-symbol): Use it.
+
+2015-08-20  Paul Eggert  <address@hidden>
+
+       Don't quote symbols 'like-this' in docstrings etc.
+       * admin/unidata/uvs.el (uvs-insert-fields-as-bytes):
+       * lisp/allout-widgets.el (allout-widgets-count-buttons-in-region):
+       * lisp/allout.el (allout-add-resumptions, allout-mode):
+       * lisp/calculator.el (calculator-operators):
+       * lisp/cedet/data-debug.el (dd-propertize):
+       * lisp/cedet/ede/proj-prog.el (ede-proj-target-makefile-program):
+       * lisp/cedet/semantic/analyze/debug.el:
+       (semantic-analyzer-debug-global-miss-text):
+       * lisp/cedet/semantic/lex-spp.el:
+       (semantic-lex-spp-replace-or-symbol-or-keyword):
+       * lisp/cedet/semantic/symref.el:
+       (semantic-symref-cleanup-recent-buffers-fcn):
+       * lisp/cedet/semantic/tag.el (semantic-tag-class):
+       * lisp/cedet/srecode/el.el (srecode-semantic-handle-:el-custom):
+       * lisp/gnus/nnmairix.el (nnmairix-propagate-marks-upon-close):
+       * lisp/gnus/pop3.el (pop3-authentication-scheme):
+       * lisp/help-fns.el (describe-function-orig-buffer):
+       * lisp/imenu.el (imenu--history-list):
+       * lisp/mail/feedmail.el (feedmail-confirm-outgoing)
+       (feedmail-display-full-frame, feedmail-deduce-bcc-where)
+       (feedmail-queue-default-file-slug)
+       (feedmail-queue-buffer-file-name):
+       * lisp/net/mairix.el (mairix-searches-mode-map):
+       * lisp/net/newst-backend.el (newsticker-retrieval-method)
+       (newsticker-auto-mark-filter-list):
+       * lisp/obsolete/vi.el (vi-mode):
+       * lisp/progmodes/cc-engine.el (c-literal-type):
+       * lisp/progmodes/cpp.el (cpp-face):
+       * lisp/progmodes/ebrowse.el (ebrowse-electric-list-looper):
+       * lisp/progmodes/elisp-mode.el (elisp--xref-make-xref):
+       * lisp/progmodes/pascal.el (pascal-auto-lineup):
+       * lisp/progmodes/prog-mode.el (prog-widen):
+       * lisp/progmodes/verilog-mode.el (verilog-regexp-words)
+       (verilog-auto-lineup, verilog-auto-reset-widths)
+       (verilog-auto-arg-format, verilog-auto-inst-template-numbers):
+       * lisp/textmodes/flyspell.el (flyspell-maybe-correct-transposition)
+       (flyspell-maybe-correct-doubling):
+       * lisp/textmodes/table.el (table-justify, table-justify-cell)
+       (table-justify-row, table-justify-column, table-insert-sequence)
+       (table--justify-cell-contents):
+       * lisp/url/url-auth.el (url-get-authentication):
+       * lisp/window.el (display-buffer-record-window):
+       * lisp/xml.el (xml-parse-file, xml-parse-region):
+       * src/gfilenotify.c (Fgfile_add_watch):
+       Don't quote symbols with apostrophes in doc strings.
+       Use asymmetric quotes instead.
+       * lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
+       Likewise for symbol in diagnostic.
+       * lisp/image.el (image-extension-data):
+       * lisp/register.el (frame-configuration-to-register):
+       * src/buffer.c (syms_of_buffer):
+       Remove bogus apostrophes after symbols.
+       * lisp/thumbs.el (thumbs-conversion-program):
+       Quote Lisp string values using double-quotes, not apostrophes.
+
+2015-08-20  Martin Rudalics  <address@hidden>
+
+       Describe frame geometry and related functions in Elisp manual
+       * doc/lispref/display.texi (Size of Displayed Text, Line Height)
+       (Showing Images): Update references.
+       * doc/lispref/elisp.texi (Top): Update node listing.
+       * doc/lispref/frames.texi (Frame Geometry): New node.  Move
+       `Size and Position' section here.
+       (Size Parameters): Update references.
+       (Mouse Position): Update references and nomenclature.  Describe
+       new functions `x-mouse-absolute-pixel-position' and
+       `x-set-mouse-absolute-pixel-position'.
+       * doc/lispref/windows.texi (Window Sizes): Update references.
+       (Resizing Windows): Update references.  Move description of
+       `fit-frame-to-buffer' here.
+       (Coordinates and Windows): Update nomenclature and references.
+       Describe new arguments of `window-edges'.  Comment out
+       descriptions of `window-left-column', `window-top-line',
+       `window-pixel-left' and `window-pixel-top'.  Describe
+       `window-absolute-pixel-position'.
+
+2015-08-20  Alan Mackenzie  <address@hidden>
+
+       Handling of `c-parse-state'.  Fix low level bug.
+       progmodes/cc-engine.el (c-remove-stale-state-cache-backwards): Add
+       "CASE 3.5" to handle `cache-pos' being only slightly before `here'.
+
+2015-08-20  Andreas Politz  <address@hidden>
+
+       In `widget-color--choose-action' quit *Color* window instead of 
deleting it
+       * lisp/wid-edit.el (widget-color--choose-action): Quit *Color*
+       window instead of deleting it.
+
+2015-08-20  Martin Rudalics  <address@hidden>
+
+       In w32fns.c's Fx_frame_geometry rewrite check whether frame has a 
titlebar
+       * src/w32fns.c (Fx_frame_geometry): Use title_bar.rgstate[0] to
+       determine whether frame has a titlebar.
+       Suggested by Eli Zaretskii <address@hidden>
+
+2015-08-20  Tassilo Horn  <address@hidden>
+
+       Add a prettify-symbols-alist for (La)TeX
+       * tex-mode.el (tex-prettify-symbols-alist): New variable holding
+       an alist suitable as prettify-symbols-alist in (La)TeX modes.
+
+2015-08-19  Alan Mackenzie  <address@hidden>
+
+       Make electric-pair-mode, delete-selection-mode and CC Mode cooperate.
+       Fixes debbugs#21275.
+       In Emacs >= 25, let electric-pair-mode take precedence over
+       delete-selection-mode.
+       delsel.el (delete-selection-uses-region-p): New function, previously a
+       lambda expression in a property value for `self-insert-command'.
+       (top-level) Set the `delete-selection' property of `self-insert-command'
+       to `delete-selection-uses-region-p'.
+       progmodes/cc-cmds.el (top-level): Give the `delete-selection' property
+       for c-electric-\(brace\|paren\) the value 
`delete-selection-uses-region-p'
+       when the latter function exists.
+
+2015-08-19  Paul Eggert  <address@hidden>
+
+       Fix key binding quoting in tutorial *Help*
+       * lisp/tutorial.el (tutorial--describe-nonstandard-key):
+       When generating help for custom key bindings, use the user-preferred
+       quoting style rather than hardcoding the grave style.
+
+2015-08-19  Eli Zaretskii  <address@hidden>
+
+       Improve and future-proof OTF fonts support in w32uniscribe.c
+       * src/w32uniscribe.c (uniscribe_otf_capability): Add commentary
+       about the expected results and why the new Uniscribe APIs are not
+       used in this function.
+       (ScriptGetFontScriptTags_Proc, ScriptGetFontLanguageTags_Proc)
+       (ScriptGetFontFeatureTags_Proc): New function typedefs.
+       (uniscribe_new_apis): New static variable.
+       (uniscribe_check_features): New function, implements OTF features
+       verification while correctly accounting for features in the list
+       after the nil member, if any.
+       (uniscribe_check_otf_1): New function, retrieves the features
+       supported by the font for the requested script and language using
+       the Uniscribe APIs available from Windows Vista onwards.
+       (uniscribe_check_otf): If the new Uniscribe APIs are available,
+       use them in preference to reading the font data directly.  Call
+       uniscribe_check_features to verify that the requested features are
+       supported, replacing the original incomplete code.
+       (syms_of_w32uniscribe): Initialize function pointers for the new
+       Uniscribe APIs.  (Bug#21260)
+       (otf_features): Scan the script, langsys, and feature arrays back
+       to front, so that the result we return has them in alphabetical
+       order, like ftfont.c does.
+       * src/w32fns.c (syms_of_w32fns) <w32-disable-new-uniscribe-apis>:
+       New variable for debugging w32uniscribe.c code.
+
+2015-08-19  Artur Malabarba  <address@hidden>
+
+       * isearch.el (isearch-search-fun-default): Revert a5bdb87
+       Remove usage of `isearch-lax-whitespace' inside the `iearch-word'
+       clause of `isearch-search-fun-default'. That lax variable does not
+       refer to lax-whitespacing.  Related to (bug#21777).
+       This reverts commit a5bdb872edb9f031fe041faf9a8c0be432e5f64c.
+       * character-fold.el (character-fold-search): Set to nil
+       Default to nil for now, until someone implements proper
+       lax-whitespacing with char-fold searching.
+
+2015-08-19  Martin Rudalics  <address@hidden>
+
+       Fix doc-string of `help-mode-finish'.
+       * lisp/help-mode.el (help-mode-finish): Fix doc-string.
+
+       In nsimage.m include coding.h (Bug#21292)
+       * src/nsimage.m (top-level): Include coding.h (Bug#21292).
+
+       Move window edge functions to Elisp.
+       * src/window.c (Fwindow_edges, Fwindow_pixel_edges)
+       (Fwindow_absolute_pixel_edges, Fwindow_inside_edges)
+       (Fwindow_inside_pixel_edges, Fwindow_inside_absolute_pixel_edges):
+       Move to window.el.
+       (calc_absolute_offset): Remove.
+       * lisp/frame.el (frame-edges): New function.
+       * lisp/window.el (window-edges, window-pixel-edges)
+       (window-absolute-pixel-edges): Move here from window.c.
+       (window-body-edges, window-body-pixel-edges)
+       (window-absolute-body-pixel-edges): Move here from window.c and
+       rename "inside" to "body".  Keep old names as aliases.
+       (window-absolute-pixel-position): New function.
+
+2015-08-19  Katsumi Yamaoka  <address@hidden>
+
+       [Gnus]: Use overlay functions directly
+       * lisp/gnus/gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part)
+       (gnus-insert-mime-button, gnus-mime-buttonize-attachments-in-header)
+       (gnus-article-highlight-signature, gnus-article-extend-url-button)
+       (gnus-article-add-button, gnus-insert-prev-page-button)
+       (gnus-insert-next-page-button, gnus-insert-mime-security-button):
+       * lisp/gnus/gnus-cite.el (gnus-cite-delete-overlays)
+       (gnus-cite-add-face):
+       * lisp/gnus/gnus-html.el (gnus-html-wash-tags):
+       * lisp/gnus/gnus-salt.el (gnus-tree-read-summary-keys)
+       (gnus-tree-recenter, gnus-highlight-selected-tree):
+       * lisp/gnus/gnus-sum.el (gnus-summary-show-all-threads)
+       (gnus-summary-show-thread, gnus-summary-hide-thread)
+       (gnus-highlight-selected-summary):
+       * lisp/gnus/gnus-util.el (gnus-put-overlay-excluding-newlines):
+       * lisp/gnus/message.el (message-fix-before-sending)
+       (message-toggle-image-thumbnails):
+       * lisp/gnus/mm-decode.el (mm-convert-shr-links):
+       * lisp/gnus/sieve.el (sieve-highlight, sieve-insert-scripts):
+       Use overlay functions directly instead of using gnus-overlay-*,
+       message-overlay-*, and sieve-overlay-*.
+       * lisp/gnus/gnus-sum.el (gnus-remove-overlays):
+       * lisp/gnus/gnus.el (gnus-make-overlay, gnus-copy-overlay)
+       (gnus-delete-overlay, gnus-overlay-get, gnus-overlay-put)
+       (gnus-move-overlay, gnus-overlay-buffer, gnus-overlay-start)
+       (gnus-overlay-end, gnus-overlays-at, gnus-overlays-in):
+       * lisp/gnus/message.el (message-delete-overlay, message-make-overlay)
+       (message-overlay-get, message-overlay-put, message-overlays-in):
+       * lisp/gnus/sieve.el (sieve-make-overlay, sieve-overlay-put)
+       (sieve-overlays-at):
+       Remove.
+
+2015-08-19  Martin Rudalics  <address@hidden>
+
+       In w32fns.c condition TITLEBAR_INFO declaration on WINDOWS version.
+       * src/w32fns.c (TITLEBAR_INFO): Make it a typedef so MinGW64
+       builds can use the declaration from the system headers.
+       (GetTitleBarInfo_Proc, Fx_frame_geometry): Adapt to new
+       definition of TITLEBAR_INFO.
+       Suggested by Eli Zaretskii  <address@hidden>
+
+2015-08-19  Glenn Morris  <address@hidden>
+
+       * lisp/gnus/nnmaildir.el (nnmaildir-flag-mark-mapping): Add "P".
+
+2015-08-19  Paul Eggert  <address@hidden>
+
+       Use new q ‘format’ flag when fixing quotes in C
+       * src/image.c (image_size_error): New function.  All uses of
+       image_error with "Invalid image size ..."  changed to use it.
+       * src/image.c (image_size_error, xbm_load_image, xbm_load)
+       (xpm_load, xpm_load_image, xpm_load, pbm_load, png_load_body)
+       (jpeg_load_body, tiff_load, gif_load, imagemagick_load_image)
+       (imagemagick_load, svg_load, svg_load_image, gs_load)
+       (x_kill_gs_process):
+       * src/lread.c (load_warn_old_style_backquotes):
+       * src/xfaces.c (load_pixmap):
+       * src/xselect.c (x_clipboard_manager_error_1):
+       Use %qs, not uLSQM and uRSQM.
+       * src/syntax.c (Finternal_describe_syntax_value):
+       Prefer Fsubstitute_command_keys to Fformat, as this lets
+       us use AUTO_STRING.
+       * src/xdisp.c (vadd_to_log): Use AUTO_STRING on the format argument,
+       as it's now guaranteed to be ASCII.
+       * src/xselect.c (x_clipboard_manager_error_2):
+       Avoid grave accent in low-level stderr diagnostic.
+
+2015-08-19  Paul Eggert  <address@hidden>
+
+       New q flag for ‘format’
+       * doc/lispref/processes.texi (Sentinels):
+       Don't hardwire grave quoting style in example.
+       * doc/lispref/strings.texi (Formatting Strings):
+       * etc/NEWS:
+       Document new q flag.
+       * src/editfns.c (Fformat): Implement it.
+
+2015-08-18  Daiki Ueno  <address@hidden>
+
+       pinentry.el: Add debugging support
+       * lisp/net/pinentry.el (pinentry-debug): New variable.
+       (pinentry-debug-buffer): New variable.
+       (pinentry--process-filter): Send input to the debug buffer, if
+       `pinentry-debug' is set.
+
+       pinentry.el: Improve multiline prompt
+       * lisp/net/pinentry.el (pinentry--prompt): Simplify the interface.
+       (pinentry--process-filter): Use `pinentry--prompt' for CONFIRM
+       command.
+
+2015-08-18  Paul Eggert  <address@hidden>
+
+       Fix multibyte confusion in diagnostics
+       * src/print.c (print_error_message):
+       Don't assume that the caller's name is unibyte.
+       * src/xdisp.c (vadd_to_log):
+       Don't assume that the formatted diagnostic is unibyte.
+
+       Fix file name encodings in diagnostics
+       Also, close some minor races when opening image files, by opening
+       them once instead of multiple times.
+       * src/gtkutil.c (xg_get_image_for_pixmap):
+       * src/image.c (xpm_load, tiff_load, gif_load, imagemagick_load)
+       (svg_load):
+       * src/nsimage.m (allocInitFromFile:):
+       * src/xfns.c (xg_set_icon):
+       Encode file name, since x_find_image_file no longer does that.
+       * src/image.c (x_find_image_fd): New function.
+       (x_find_image_file): Use it.  Do not encode resulting file name,
+       since callers sometimes need it decoded.
+       (slurp_file): File arg is now a fd, not a file name.
+       All callers changed.  This saves us having to open the file twice.
+       (xbm_load, xpm_load, pbm_load, png_load_body, jpeg_load_body)
+       (svg_load):
+       Use x_find_image_fd and fdopen to save a file-open.
+       Report file name that failed.
+       * src/lread.c (openp): If PREDICATE is t, open the file in binary mode.
+
+2015-08-18  Dmitry Gutov  <address@hidden>
+
+       Allow blink-matching-paren to jump off screen
+       * doc/emacs/programs.texi (Matching): Mention the
+       `blink-matching-paren' value `jump-offscreen'.
+       * lisp/simple.el (blink-matching-paren): New possible value.
+       (blink-matching-paren-on-screen): Clarify the docstring.
+       (blink-matching-open): Handle `jump-offscreen' (bug#21286).
+
+       Refine the previous change
+       * lisp/simple.el (blink-matching-open): Use minibuffer-message
+       outside of save-excursion (bug#21286).
+
+2015-08-18  Martin Rudalics  <address@hidden>
+
+       Rewrite and add frame geometry related functions.
+       * src/frame.c (Fframe_position): New function.
+       (Fset_frame_position): Rename parameters and rewrite doc-string.
+       (syms_of_frame): Remove Qframe_position, Qframe_outer_size,
+       Qtitle_height and Qframe_inner_size.  Add Qouter_edges,
+       Qouter_position, Qouter_size, Qnative_edges, Qinner_edges,
+       Qtitle_bar_size.
+       * src/nsfns.m (frame_geometry): New function.
+       (Fx_frame_geometry): Call frame_geometry.
+       (Fx_frame_edges): New function.
+       * src/w32fns.c (C_CHILDREN_TITLEBAR, TITLEBAR_INFO)
+       (GetTitleBarInfo_Proc): Define these so we can use the
+       GetTitleBarInfo API.
+       (Fw32_frame_menu_bar_size, Fw32_frame_rect): Remove.
+       (Fx_frame_geometry): Rewrite.
+       (Fx_frame_edges, Fx_mouse_absolute_pixel_position)
+       (Fx_set_mouse_absolute_pixel_position): New functions.
+       * src/xfns.c (frame_geometry): New function.
+       (Fx_frame_geometry): Call frame_geometry.
+       (Fx_frame_edges, Fx_mouse_absolute_pixel_position)
+       (Fx_set_mouse_absolute_pixel_position): New functions.
+
+2015-08-18  Michael Albinus  <address@hidden>
+
+       Improve Tramp's compatibility
+       * lisp/net/tramp.el (tramp-get-method-parameter):
+       * lisp/net/tramp-adb.el (tramp-adb-parse-device-names)
+       (tramp-adb-get-device):
+       * lisp/net/trampver.el (tramp-repository-get-version):
+       Use `tramp-compat-replace-regexp-in-string'.
+
+2015-08-18  Pierre Téchoueyres  <address@hidden>  (tiny change)
+
+       * lisp/net/tramp-cmds.el (tramp-reporter-dump-variable):
+       Encode/decode string.
+
+2015-08-18  Paul Eggert  <address@hidden>
+
+       Clarify what happens to match data on failure
+       Problem reported by Ernesto Alfonso (Bug#21279).
+       * doc/lispref/searching.texi (Regexp Search, Simple Match Data):
+       Document more carefully what happens to match data after a failed
+       search.
+       * src/search.c (Fmatch_beginning, Fmatch_end): Document that
+       the return value is undefined if the last search failed.
+       (Fmatch_data): Simplify doc string line 1.
+
+2015-08-18  Daiki Ueno  <address@hidden>
+
+       Revert "pinentry.el: Support external passphrase cache"
+       This reverts commit e086e55a664ec27fbca7b3231c4b32cb78a89337.
+       pinentry.el shouldn't directly interact with the secrets service,
+       but ask the caller to cache the passphrase.
+
+2015-08-17  Xue Fuqiao  <address@hidden>
+
+       * doc/emacs/sending.texi (Mail Misc): Fix two index entries for
+       Message mode hooks.
+
+2015-08-17  Daiki Ueno  <address@hidden>
+
+       epg.el: Make gpgconf output parsing future proof
+       * lisp/epg.el (epg--start): Count the number of fields in "gpgconf
+       --list-options" output.
+
+       pinentry.el: Support external passphrase cache
+       * lisp/net/pinentry.el (pinentry-use-secrets): New user option.
+       (pinentry--allow-external-password-cache): New local variable.
+       (pinentry--key-info): New local variable.
+       (secrets-enabled, secrets-search-items, secrets-get-secret):
+       Declare.
+       (pinentry--send-passphrase): New function, split from
+       `pinentry--process-filter'.
+       (pinentry--process-filter): Use secrets.el to retrieve passphrase
+       from login keyring.
+
+       pinentry.el: Popup window for multiline prompt
+       * lisp/net/pinentry.el (pinentry): New custom group.
+       (pinentry-popup-prompt-window): New user option.
+       (pinentry-prompt-window-height): New user option.
+       (pinentry--prompt-buffer): New variable.
+       (pinentry-prompt-mode-map): New variable.
+       (pinentry-prompt-mode): New function.
+       (pinentry--prompt): New function.
+       (pinentry--process-filter): Use `pinentry--prompt' instead of
+       `read-passwd' and `y-or-n-p'.
+
+2015-08-17  Katsumi Yamaoka  <address@hidden>
+
+       message.el: Silent the byte compiler
+       * lisp/gnus/message.el (message-overlay-put, message-make-overlay)
+       (message-kill-all-overlays, message-overlays-in, message-overlay-get)
+       (message-delete-overlay, message-window-inside-pixel-edges):
+       Declare before using.
+
+       * lisp/gnus/message.el (message-overlay-get, message-overlays-in)
+       (message-window-inside-pixel-edges): XEmacs compatible functions.
+
+2015-08-17  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * message.el (message-toggle-image-thumbnails): New command.
+
+2015-08-17  Noah Friedman  <address@hidden>
+
+       (blink-matching-open): Restore point before calling minibuffer-message.
+
+2015-08-17  Ronnie Schnell  <address@hidden>
+
+       Update version number in header (now matches help)
+
+2015-08-17  Paul Eggert  <address@hidden>
+
+       Curved quotes in --batch diagnostics in non-UTF-8
+       When run with --batch, check that curved quotes are compatible with
+       the system locale before outputting them in diagnostics.
+       Problem reported by Eli Zaretskii in:
+       http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00594.html
+       * lisp/startup.el (command-line): Set internal--text-quoting-flag
+       after the standard display table is initialized.
+       * src/doc.c (default_to_grave_quoting_style): New function.
+       (text_quoting_style): Use it.
+       (text_quoting_flag): New static var, visible to Lisp as
+       internal--text-quoting-flag.
+       * src/emacs.c: Include <wchar.h> if available.
+       (using_utf8): New function.
+       (main): Use it to initialize text_quoting_flag.
+       * src/regex.h (btowc) [WIDE_CHAR_SUPPORT && emacs]:
+       Don't define, as it's not needed and it clashes with wchar.h.
+
+2015-08-17  Glenn Morris  <address@hidden>
+
+       * doc/misc/tramp.texi (Configuration): Reword to avoid warning
+       from makeinfo about spurious "Note:" cross-reference, and for grammar.
+
+2015-08-17  Ilya Zakharevich  <address@hidden>
+
+       Minor change in variable initialization on MS-Windows
+       * src/w32fns.c <after_dead_key>: Initialize to -1.
+       (deliver_wm_chars): If after_deadkey is zero, don't set after_dead
+       non-zero.
+
+       Fix a bug with LWindow key remapping on MS-Windows
+       * src/w32fns.c (deliver_wm_chars): Fix a typo.  (Bug#21276)
+
+2015-08-17  Eli Zaretskii  <address@hidden>
+
+       Improve fontset support for latest OTF script tags
+       * lisp/international/fontset.el (otf-script-alist): Add some
+       missing script tags.
+       (setup-default-fontset): Include settings for v2 versions of the
+       script tags used by some modern OTF/TTF fonts.
+
+2015-08-17  Paul Eggert  <address@hidden>
+
+       Spelling fixes
+
+2015-08-16  Paul Eggert  <address@hidden>
+
+       Use curved quotes in core elisp diagnostics
+       In the core elisp files, use curved quotes in diagnostic formats,
+       so that they follow user preference as per ‘text-quoting-style’
+       rather than being hard-coded to quote `like this'.
+       * lisp/abbrev.el (expand-region-abbrevs):
+       * lisp/button.el (button-category-symbol, button-put)
+       (make-text-button):
+       * lisp/cus-start.el:
+       * lisp/custom.el (custom-add-dependencies, custom-check-theme)
+       (custom--sort-vars-1, load-theme):
+       * lisp/emacs-lisp/byte-run.el (defun, defsubst):
+       * lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
+       (cl-generic-generalizers):
+       * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
+       * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
+       * lisp/emacs-lisp/nadvice.el (advice--make-docstring)
+       (advice--make, define-advice):
+       * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
+       * lisp/emacs-lisp/timer.el (timer-event-handler):
+       * lisp/env.el (setenv):
+       * lisp/facemenu.el (facemenu-add-new-face)
+       (facemenu-add-new-color):
+       * lisp/faces.el (face-documentation, read-face-name)
+       (face-read-string, read-face-font, face-spec-set-match-display)
+       (read-color, x-resolve-font-name):
+       * lisp/files.el (locate-user-emacs-file, find-alternate-file)
+       (set-auto-mode, hack-local-variables)
+       (hack-one-local-variable--obsolete)
+       (dir-locals-set-directory-class, write-file)
+       (basic-save-buffer, delete-directory, copy-directory)
+       (recover-session, recover-session-finish, insert-directory)
+       (file-modes-char-to-who, file-modes-symbolic-to-number)
+       (move-file-to-trash):
+       * lisp/font-lock.el (font-lock-fontify-buffer):
+       * lisp/format.el (format-write-file, format-find-file)
+       (format-insert-file):
+       * lisp/frame.el (get-device-terminal, select-frame-by-name):
+       * lisp/fringe.el (fringe--check-style):
+       * lisp/help.el (describe-minor-mode-from-indicator):
+       * lisp/image.el (image-type):
+       * lisp/international/fontset.el (x-must-resolve-font-name):
+       * lisp/international/mule-cmds.el (prefer-coding-system)
+       (select-safe-coding-system-interactively)
+       (select-safe-coding-system, activate-input-method)
+       (toggle-input-method, describe-current-input-method):
+       * lisp/international/mule-conf.el (code-offset):
+       * lisp/mouse.el (minor-mode-menu-from-indicator):
+       * lisp/replace.el (query-replace-read-from)
+       (occur-after-change-function, occur-1):
+       * lisp/scroll-bar.el (scroll-bar-columns):
+       * lisp/simple.el (execute-extended-command)
+       (undo-outer-limit-truncate, compose-mail, set-variable)
+       (choose-completion-string, define-alternatives):
+       * lisp/startup.el (site-run-file, tty-handle-args, )
+       (command-line, command-line-1):
+       * lisp/subr.el (noreturn, define-error, add-to-list)
+       (read-char-choice):
+       * lisp/term/common-win.el (x-handle-xrm-switch)
+       (x-handle-name-switch, x-handle-args):
+       * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
+       Use curved quotes in diagnostics.
+       * lisp/international/mule.el (find-auto-coding):
+       Use " to quote in a diagnostic, to be consistent with the rest of
+       this file.
+
+       Convert lisp/term/x-win.el to UTF-8
+       * lisp/term/x-win.el: Convert to UTF-8.  This doesn't affect
+       runtime behavior, and the file is multilingual so compile-time
+       appearance shouldn't be an issue.
+       * admin/notes/unicode: Document this.
+
+2015-08-16  Wilson Snyder  <address@hidden>
+
+       Update verilog-mode.el to 2015-05-14-6232468-vpo-GNU.
+           * losp/progmodes/verilog-mode.el: Fix some non-automated indent
+           issues and comments, bug943.  (verilog-type-font-keywords): Cycle
+           delay operators like ##1 and ##[0:$] are now highlighted in their
+           entirety similarly to the # delay-control operator.  Likewise, the
+           followed-by operators #-# and #=# are no longer partially
+           highlighed.  (verilog-backward-syntactic-ws-quick,
+           verilog-skip-backward-comments): Minor performance improvements to
+           buffer traversal functions for reduced latency.  (verilog-calc-1,
+           verilog-in-deferred-immediate-final-p): When the keyword 'final'
+           follows 'assert/assume/cover', then it is part of a deferred
+           immediate assertion item and should not be treated as a final
+           construct for indentation.  Reported by Yuri Sugihara.
+           (verilog-do-indent): Virtual task/function/class definition lines
+           should not be considered as declarations.  Reported by Enzo Chi.
+           (verilog-do-indent): Do not falsely indent to '=' of
+           property/sequence operators on subsequent lines of a multi-line
+           statement.  (verilog-assignment-operator-re): Fix '!==' operator
+           and add support for '<->', ':/', '#-#', and '#=#' operators.
+           (verilog-calculate-indent, verilog-label-be): Enable
+           case-sensitive regular expression parsing when looking for
+           keywords.  (verilog-calc-1): Detect 'pure virtual method'
+           declarations which exist in abstract classes.  Reported by Enzo
+           Chi and Kaushal Modi.  (verilog-backward-ws&directives): When
+           moving back to the start of a line and the preceeding line ended
+           with an escaped-newline, then jump up one line.  This properly
+           consumes a multi-line pre-processor directive.  Reported by
+           Kaushal Modi.  (verilog-dpi-import-export-re,
+           verilog-extended-complete-re, verilog-calc-1): Teach verilog-mode
+           to properly indent after a DPI import/export statement that
+           resides outside of a module.  Reported by Kaushal Modi.
+           (verilog-extended-complete-re): Update regexp to match both
+           "DPI-C" and "DPI".  Reported by Kaushal Modi.
+
+2015-08-15  Paul Eggert  <address@hidden>
+
+       substitute-command-keys a few more doc strings
+       * lisp/allout.el (outlineify-sticky):
+       * lisp/files.el (hack-one-local-variable--obsolete):
+       * lisp/help-fns.el (help-fns--obsolete, describe-variable):
+       Use substitute-command-keys on some doc strings so that
+       they don't use hard-coded key bindings or quoting styles.
+
+       Fix quoting in Fformat calls
+       * src/image.c (xbm_read_bitmap_data, xbm_load_image, xbm_load)
+       (xpm_load, xpm_load_image, pbm_load, png_load_body)
+       (jpeg_load_body, tiff_load, gif_load, imagemagick_load_image)
+       (imagemagick_load, svg_load, svg_load_image, gs_load)
+       (x_kill_gs_process):
+       * src/lread.c (load_warn_old_style_backquotes):
+       * src/xfaces.c (load_pixmap):
+       * src/xselect.c (x_clipboard_manager_error_1):
+       Quote diagnostics according to user preference when calling
+       Fformat or its derivatives.
+
+2015-08-15  Glenn Morris  <address@hidden>
+
+       * admin/admin.el (set-version, set-copyright): Remove deleted files.
+
+2015-08-15  Stephen Leake  <address@hidden>
+
+       Allow describe-function helpers to access buffer-local values.
+       This will be used by cedet/mode-local.el `describe-mode-local-override'
+       on `help-fns-describe-function-functions' in upstream CEDET.
+       * lisp/help-fns.el (describe-function-orig-buffer): New, let-bound in
+       `describe-function'.
+       (describe-function): Bind it, save it on the help xref stack.
+
+       Handle pulse-background being nil
+       * lisp/cedet/pulse.el (pulse-lighten-highlight): Inherit
+       pulse-background, handle it being nil.
+
+2015-08-15  Paul Eggert  <address@hidden>
+
+       Fix "\`" confusion in Lisp strings
+       * admin/authors.el (authors-canonical-author-name):
+       Fix typo by using "\\`" not "\`" in string RE.
+       * lisp/obsolete/complete.el (PC-complete-as-file-name):
+       * lisp/obsolete/vi.el (vi-backward-blank-delimited-word):
+       * lisp/progmodes/verilog-mode.el (verilog-mode-map):
+       Use plain "`", not the equivalent-but-confusing "\`", in strings.
+       * lisp/textmodes/texinfmt.el: Fix comment likewise.
+
+2015-08-15  Dani Moncayo  <address@hidden>
+
+       Remove 'nt/zipdist.bat' (no longer used)
+       * nt/zipdist.bat: Remove - no longer used.
+
+2015-08-15  Jürgen Hötzel  <address@hidden>
+
+       * lisp/net/tramp-sh.el (tramp-remote-selinux-p): Use "selinuxenabled"
+       rather than "getenforce".
+       (tramp-sh-handle-set-file-selinux-context): Do not
+       cache SELinux context if not all context components are given.
+
+2015-08-15  Eli Zaretskii  <address@hidden>
+
+       Add doc strings to 2 help-mode.el functions
+       * lisp/help-mode.el (help-mode-setup, help-mode-finish): Add doc
+       strings.  (Bug#21263)
+
+       Remove files used by the old MS-Windows specific build procedure
+       * admin/unidata/makefile.w32-in:
+       * doc/emacs/makefile.w32-in:
+       * doc/lispintro/makefile.w32-in:
+       * doc/lispref/makefile.w32-in:
+       * doc/misc/makefile.w32-in:
+       * leim/makefile.w32-in:
+       * lib-src/makefile.w32-in:
+       * lib/makefile.w32-in:
+       * lisp/makefile.w32-in:
+       * nt/INSTALL.OLD:
+       * nt/config.nt:
+       * nt/emacs-src.tags:
+       * nt/envadd.bat:
+       * nt/gmake.defs:
+       * nt/makefile.w32-in:
+       * nt/multi-install-info.bat:
+       * nt/nmake.defs:
+       * nt/paths.h:
+       * src/makefile.w32-in: Files deleted.
+       * nt/configure.bat: Remove everything except the blurb about the
+       new build procedure.
+       * make-dist: Remove references to makefile.w32-in in various
+       directories, and to files in nt/ that were deleted.
+       * etc/NEWS: Mention the fact that the files were dropped.
+
+2015-08-15  Paul Eggert  <address@hidden>
+
+       * doc/emacs/mule.texi (Charsets): Give fuller title for ISO-IR.
+       (Bug#21248)
+
+2015-08-14  Paul Eggert  <address@hidden>
+
+       Default to inotify instead of gfile
+       * configure.ac (with_file_notification): Fix typo that
+       prevented suppression of file notification if HAVE_NS.
+       (NOTIFY_OBJ): Prefer inotify to gfile if both exist and
+       with_file_notification is 'yes' (Bug#21241).
+       * etc/NEWS: Mention this.
+
+       Fix broken URLs for ISO-IR
+       * doc/emacs/mule.texi (Charsets):
+       * lisp/international/mule-conf.el:
+       Fix broken URL (Bug#21248).
+
+       Low-level diagnostics now use ‘text-quoting-style’
+       * src/doprnt.c (doprnt):
+       Format ` and ' as per ‘text-quoting-style’.
+       * src/xdisp.c (vmessage, message): Mention that the format should
+       not contain ` or '.
+
+       Prefer ‘format’ to ‘substitute-command-keys’
+       * src/character.h (uLSQM, uRSQM): Move here ...
+       * src/doc.c (uLSQM, uRSQM): ... from here.
+       * src/doc.c (Fsubstitute_command_keys):
+       * src/syntax.c (Finternal_describe_syntax_value):
+       * lisp/cedet/mode-local.el (mode-local-print-binding)
+       (mode-local-describe-bindings-2):
+       * lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
+       * lisp/cus-theme.el (describe-theme-1):
+       * lisp/descr-text.el (describe-text-properties-1, describe-char):
+       * lisp/emacs-lisp/cl-extra.el (cl--describe-class):
+       * lisp/emacs-lisp/cl-generic.el (cl--generic-describe):
+       * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
+       * lisp/emacs-lisp/package.el (describe-package-1):
+       * lisp/faces.el (describe-face):
+       * lisp/help-fns.el (help-fns--key-bindings)
+       (help-fns--compiler-macro, help-fns--parent-mode)
+       (help-fns--obsolete, help-fns--interactive-only)
+       (describe-function-1, describe-variable):
+       * lisp/help.el (describe-mode):
+       Prefer ‘format’ to ‘substitute-command-keys’ when either will do
+       to implement quoting style.  This generally makes the code simpler.
+
+       Extend ‘format’ to translate curved quotes
+       This is a followup to the recent doc string change, and deals with
+       diagnostics and the like.  This patch is more conservative than
+       the doc string change, in that the behavior of ‘format’ changes
+       only if its first arg contains curved quotes and the user prefers
+       straight or grave quotes.  (Come to think of it, perhaps we should
+       be similarly conservative with doc strings too, but that can wait.)
+       The upside of this conservatism is that existing usage is almost
+       surely unaffected.  The downside is that we'll eventually have to
+       change Emacs's format strings to use curved quotes in places where
+       the user might want curved quotes, but that's a simple and
+       mechanical translation that I'm willing to do later.  (Bug#21222)
+       * doc/lispref/help.texi (Keys in Documentation):
+       Move description of text-quoting-style from here ...
+       * doc/lispref/strings.texi (Formatting Strings):
+       ... to here, and describe new behavior of ‘format’.
+       * etc/NEWS: Describe new behavior.
+       * lisp/calc/calc-help.el (calc-describe-thing):
+       * lisp/emacs-lisp/derived.el (derived-mode-make-docstring):
+       * lisp/info.el (Info-find-index-name):
+       Use ‘concat’ rather than ‘format’ to avoid misinterpretation
+       of recently-added curved quotes.
+       * src/doc.c (uLSQM0, uLSQM1, uLSQM2, uRSQM0, uRSQM1, uRSQM2):
+       Move from here ...
+       * src/lisp.h: ... to here.
+       * src/doc.c (text_quoting_style): New function.
+       (Fsubstitute_command_keys): Use it.
+       * src/editfns.c (Fformat): Implement new behavior.
+       * src/lisp.h (enum text_quoting_style): New enum.
+
+2015-08-14  Stefan Monnier  <address@hidden>
+
+       * src/keyboard.c: Use false/true instead of 0/1 for booleans
+       * src/keyboard.h (struct kboard): Mark kbd_queue_has_data as boolean.
+
+2015-08-14  Michael Albinus  <address@hidden>
+
+       * lisp/net/tramp-sh.el (tramp-sh-handle-file-acl): Do not redirect
+       stderr to /dev/null, this is done in `tramp-send-command-and-check'.
+
+2015-08-14  Jürgen Hötzel  <address@hidden>
+
+       Flush file properties in Tramp
+       * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-modes)
+       (tramp-sh-handle-set-file-times):
+       * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-modes)
+       (tramp-adb-handle-set-file-times): Flush the file properties of
+       the directory.
+
+2015-08-14  Ronnie Schnell  <address@hidden>
+
+       * doc/emacs/misc.text (Amusements): Fixed typo.
+
+2015-08-14  Eli Zaretskii  <address@hidden>
+
+       Don't miss warnings about removing string text properties while dumping
+       * src/alloc.c (purecopy): Warn about removing a string's text
+       properties even when the same string was already pure-copied
+       earlier.
+       * lisp/progmodes/elisp-mode.el (elisp--xref-format)
+       (elisp--xref-format-extra): Fix the commentary.
+
+2015-08-13  Stefan Monnier  <address@hidden>
+
+       * lisp/progmodes/sh-script.el (sh-mode): Handle .cshrc (bug#21049)
+
+2015-08-13  Magnus Henoch  <address@hidden>
+
+       * lisp/progmodes/compile.el: Assume 8-wide TABs (bug#21038)
+       * lisp/progmodes/compile.el: Use lexical-binding.
+       (compilation-move-to-column): Assume 8-wide TABs (bug#21038).
+
+2015-08-13  Stefan Monnier  <address@hidden>
+
+       (uniquify-ask-about-buffer-names-p): Remove, unused (bug#21037)
+       * lisp/uniquify.el: Remove redundant `:group's.
+
+2015-08-13  Jürgen Hötzel  <address@hidden>
+
+       * lisp/net/tramp-adb.el
+       (tramp-adb-handle-directory-files-and-attributes): Make a copy of
+       result to prevent modification of the tramp-cache by side effects.
+       Use the correct cache key.
+
+2015-08-13  Paul Eggert  <address@hidden>
+
+       Make add_to_log varargs
+       * src/alloc.c (run_finalizer_handler):
+       * src/charset.c (load_charset_map_from_vector):
+       * src/nsimage.m (ns_load_image):
+       * src/xfaces.c (load_pixmap, load_color2):
+       Simplify, now that add_to_log has a variable number of args.
+       * src/image.c (image_error): Take a variable number of args.
+       Callers simplified.
+       * src/lisp.h (add_to_log, vadd_to_log): Adjust to new APIs.
+       * src/xdisp.c (format_nargs, vadd_to_log): New functions.
+       (add_to_log): Make varargs, and reimplement in terms of vadd_to_log.
+       * src/xfaces.c (merge_face_ref): Fix typo that omitted color name.
+
+       Optional args for holiday-greek-orthodox-easter
+       * etc/NEWS: Document this.
+       * lisp/calendar/holidays.el (holiday-greek-orthodox-easter):
+       Add optional args N and STRING, mimicking the API and code of
+       ‘holiday-easter-etc’.  From suggestion by Foivos S. Zakkak (Bug#21256).
+
+2015-08-13  Stephen Leake  <address@hidden>
+
+       xref-find-definitions: Exclude more generic function items.
+       * lisp/emacs-lisp/cl-generic.el (cl--generic-search-method): Add doc 
string.
+       (cl--generic-find-defgeneric-regexp): New.
+       (find-function-regexp-alist): Add it.
+       * lisp/emacs-lisp/find-func.el (find-feature-regexp): Move here from
+       elisp-mode.el, change to search for ";;; Code:"
+       (find-alias-regexp): Move here from elisp-mode.el, cleaned up.
+       (find-function-regexp-alist): Add them.
+       * lisp/progmodes/elisp-mode.el:
+       (elisp--xref-format, elisp--xref-format-extra): Change back to defvar 
due
+       to bug#21237.
+       (elisp--xref-find-definitions): Exclude co-located default methods for
+       generic functions. Also exclude implicitly declared defgeneric.
+       (elisp--xref-find-definitions): Handle C source properly. Exclude minor
+       mode variables defined by 'define-minor-mode'.
+       * test/automated/elisp-mode-tests.el: Declare generic functions, add
+       tests for them.
+       (xref-elisp-test-run): Fix bug.
+       (emacs-test-dir): Improve initial value.
+       (find-defs-defun-defvar-el): Don't expect defvar.
+       (find-defs-feature-el): Match change to find-feature-regexp.
+
+2015-08-13  Eli Zaretskii  <address@hidden>
+
+       Improve warning about purecopy of strings with properties
+       * src/alloc.c (purecopy): Show the offending string with the
+       warning about removing its text properties.
+
+2015-08-12  Alan Mackenzie  <address@hidden>
+
+       Introduce new macros to cover Emacs's new names in cl-lib.el.
+       This also eliminates `mapcan' warnings in XEmacs.
+       progmodes/cc-defs.el (c--mapcan-status): new variable to characterise
+       [X]Emacs versions.
+       (top-level): Require either 'cl or 'cl-lib, depending on
+       c--mapcan-status.
+       Change this back to cc-external-require from an eval-when-compile
+       require.
+       (c--mapcan, c--set-difference, c--intersection, c--macroexpand-all)
+       (c--delete-duplicates): New macros which expand into either old or new
+       names.
+       (c-make-keywords-re, c-lang-defconst, c-lang-const) Use the new macros
+       rather than the old names.
+       progmodes/cc-engine.el (c-declare-lang-variables): Use c--mapcan rather
+       than mapcan.
+       progmodes/cc-fonts.el (c-compose-keywords-list): Use c--mapcan.
+       progmodes/cc-langs.el (top-level): Require either 'cl or 'cl-lib,
+       depending on c--mapcan-status.
+       (c-filter-ops, c-all-op-syntax-tokens, c-assignment-op-regexp)
+       (c-type-start-kwds, c-prefix-spec-kwds, c-specifier-key)
+       (c-not-decl-init-keywords, c-not-primitive-type-keywords)
+       (c-paren-any-kwds, c-<>-sexp-kwds, c-block-stmt-kwds, c-expr-kwds)
+       (c-decl-block-key, c-keywords, c-keywords-obarray)
+       (c-regular-keywords-regexp, c-primary-expr-regexp,
+       c-primary-expr-regexp)
+       (c-block-prefix-disallowed-chars, c-known-type-key,
+       c-nonlabel-token-key)
+       (c-make-init-lang-vars-fun): Use the new macros rather than the old
+       names.
+
+2015-08-12  Oleh Krehel  <address@hidden>
+
+       loadhist.el (read-feature): Conform to completing-read
+       * lisp/loadhist.el (read-feature): According to `completing-read'
+         documentation, if collection is a list, then it must be a list of
+         strings. And not a list of symbols like before.
+
+2015-08-12  David Kastrup  <address@hidden>
+
+       Deal gracefully with up-events (Bug#19746)
+       * keyboard.c (apply_modifiers_uncached, parse_solitary_modifier)
+       (parse_modifiers_uncached): React gracefully to "up-" modifiers:
+       those may easily be injected by user-level Lisp code.
+       (read_key_sequence): Discard unbound up-events like unbound
+       down-events: they are even more likely only relevant for special
+       purposes.
+       While Emacs will not produce up-events on its own currently (those are
+       converted to drag or click events before being converted to
+       Lisp-readable structures), the input queue can be made to contain them
+       by synthesizing events to `unread-command-events'.  Emacs should deal
+       consistently with such events.
+
+2015-08-12  Eli Zaretskii  <address@hidden>
+
+       Fix display of thin lines whose newline has line-height property of t
+       * src/xdisp.c (append_space_for_newline): Don't try to fix ascent
+       and descent values of non-empty glyph rows, since they could have
+       forced low values deliberately.  (Bug#21243)
+
+2015-08-12  Richard Stallman  <address@hidden>
+
+       Offer to combine multiple To or CC fields.
+       * sendmail.el (mail-combine-fields): New function.
+       (mail-send): Call 'mail-combine-fields'.
+
+       Don't decrypt encrypted files.
+       * mail-utils.el (mail-file-babyl-p): Bind epa-inhibit to t.
+
+       Handle encrypted mbox files.
+       * rmailout.el (rmail-output-as-mbox): Decrypt and reencrypt the mbox
+       file if necessary.
+
+       Re-enable mime processing after decryption.  Add 'decrypt' keyword.
+       * rmail.el (rmail-epa-decrypt-1): New subroutine.
+       (rmail-epa-decrypt): rmail-epa-decrypt-1 broken out.
+       In a mime message, reenable Mime and show the parts that
+       were shown before.
+       Add keyword "decrypt" if anything decrypted.
+
+       epa-inhibit inhibits auto-recognition of .gpg files
+       * lisp/epa-file.el (epa-inhibit): New variable.
+       (epa-file-handler): Check epa-inhibit.
+
+2015-08-12  Artur Malabarba  <address@hidden>
+
+       * emacs-lisp/lisp-mnt.el (lm-header): save-excursion
+
+2015-08-11  Fabián Ezequiel Gallina  <address@hidden>
+
+       Respect python.el imenu when semantic-mode is off
+       Fixes debbugs:21220
+       * lisp/cedet/semantic/wisent/python.el: Do not force
+       wisent-python-default-setup on python-mode-hook.
+
+2015-08-11  Paul Eggert  <address@hidden>
+
+       Give names to Unicode code points in C code
+       * src/character.h (NO_BREAK_SPACE, SOFT_HYPHEN)
+       (ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_JOINER, HYPHEN)
+       (NON_BREAKING_HYPHEN, LEFT_SINGLE_QUOTATION_MARK)
+       (RIGHT_SINGLE_QUOTATION_MARK, PARAGRAPH_SEPARATOR)
+       (LEFT_POINTING_ANGLE_BRACKET, RIGHT_POINTING_ANGLE_BRACKET)
+       (LEFT_ANGLE_BRACKET, RIGHT_ANGLE_BRACKET)
+       (OBJECT_REPLACEMENT_CHARACTER):
+       New named constants for Unicode code points.
+       * src/bidi.c (bidi_fetch_char, CANONICAL_EQU):
+       * src/composite.c (char_composable_p):
+       * src/lread.c (readevalloop, read1):
+       * src/xdisp.c (get_next_display_element):
+       Use them.
+       * src/doc.c (LEFT_SINGLE_QUOTATION_POINT):
+       Remove; now in character.h.
+
+2015-08-11  Stephen Leake  <address@hidden>
+
+       elisp--xref-find-definitions handle cl-defstuct default constructor
+       * lisp/progmodes/elisp-mode.el (elisp-xref-find): Add FIXME.
+       (elisp--xref-format-extra): Rename from elisp--xref-format-cl-defmethod.
+       (elisp--xref-find-definitions): Handle cl-defstuct default constructor.
+       * test/automated/elisp-mode-tests.el (xref-elisp-test-run): Split out
+       from xref-elisp-test for ease of debugging.
+       (xref-elisp-deftest): Rename from xref-elisp-test.
+       (find-defs-constructor): New test.
+       (find-defs-defgeneric-el): Match batch test config.
+       (compile): Required for find-defs compilation-minor-mode test.
+       (find-defs-defvar-el): Match code change.
+       (find-defs-face-el): Match code change.
+       * lisp/progmodes/xref.el (xref-find-function, xref-find-definitions):
+       Improve doc string.
+
+2015-08-11  Stefan Monnier  <address@hidden>
+
+       * lisp/replace.el (perform-replace): Document `replacements'.
+       (perform-replace): Move the description of the format of `replacements' 
from
+       the body's comment to the docstring.
+
+2015-08-11  Jürgen Hötzel  <address@hidden>
+
+       * lisp/net/tramp-adb.el (tramp-adb-prompt): Match leading escape
+       sequence.  Recent adb version send initial escape sequences, even
+       when terminal type is set to TERM=dumb.
+
+2015-08-10  Stephen Leake  <address@hidden>
+
+       Rewrite elisp--xref-find-definitions to handle many more cases; add 
tests.
+       * lisp/progmodes/elisp-mode.el (elisp--xref-identifier-location): 
deleted
+       (elisp--xref-format-cl-defmethod): new
+       (find-feature-regexp): new
+       (find-alias-regexp): new
+       (elisp--xref-make-xref): new
+       (elisp--xref-find-definitions): Rewrite using the above, handle many 
more
+       cases. Always output all available definitions.
+       (xref-location-marker): No need for special cases.
+       * test/automated/elisp-mode-tests.el: Add more tests of
+       elisp--xref-find-definitions, improve current tests.
+
+2015-08-10  Eli Zaretskii  <address@hidden>
+
+       Fix recording of events pushed onto unread-command-events
+       * src/keyboard.c (read_char): Make sure events read from
+       unread-command-events and unread-post-input-method-events are
+       always recorded by record_char.  Reported by David Kastrup
+       <address@hidden>, see
+       http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00193.html.
+
+2015-08-10  Samer Masterson  <address@hidden>
+
+       Set file buffer as current for "--file"
+       * lisp/startup.el (command-line-1): Set file buffer as current before
+       it is displayed so it can be used with options like
+       "--eval".  (Bug#21095)
+
+2015-08-10  Eli Zaretskii  <address@hidden>
+
+       Avoid setting LC_NUMERIC on MS-Windows to anything but "C"
+       * src/emacs.c (synchronize_locale) [WINDOWSNT]: Call fixup_locale
+       after setting LC_ALL to the desired locale, to avoid affecting how
+       numbers are read and printed.  (Bug#21223)
+
+2015-08-10  Alan Mackenzie  <address@hidden>
+
+       Fix "Invalid search bound (wrong side of point)" in fontification.
+       progmodes/cc-fonts.el (c-font-lock-declarators): After skipping an
+       initialization expression, check point is not beyond the fontification
+       limit.
+
+2015-08-09  Paul Eggert  <address@hidden>
+
+       Fix DPI calculation when Xft/DPI is default
+       * src/xsettings.c (parse_settings): Don't use Xft/DPI default
+       value of -1, which evaluates to 2**32 - 1 (Bug#21152).
+       Remove unnecessary cast while we're in the neighborhood.
+
+2015-08-09  Dmitry Gutov  <address@hidden>
+
+       Add project-vc-search-path and project-vc-ignores
+       * lisp/progmodes/project.el (project-vc): New group.
+       (project-vc-search-path, project-vc-ignores): New variables.
+       (project--value-in-dir): Utility function.
+       (project-search-path, project-ignores): Use them.
+       * lisp/progmodes/xref.el (xref--rgrep-command): Only replace `./'
+       at bos.  Don't add extra `/'.  Don't prepend with `*' if replaced.
+
+2015-08-09  Paul Eggert  <address@hidden>
+
+       Fix some minor quoting issues with grave accent
+       * src/dispnew.c (add_window_display_history) [GLYPH_DEBUG]:
+       Remove redundant quotes.
+       * src/doc.c (uLSQM, uRSQM): New macros.
+       * src/doc.c (Fsubstitute_command_keys):
+       * src/syntax.c (Finternal_describe_syntax_value): Follow the user
+       preference for quotes rather than hardcoding the ‘grave’ style.
+       * src/regex.c (PUSH_FAILURE_POINT, POP_FAILURE_POINT)
+       (re_match_2_internal) [DEBUG]: In debugging output, quote C
+       strings with "...", not `...'.
+
+       ChangeLog.2 ignores remote-tracking merges
+       * build-aux/gitlog-to-emacslog: Ignore commit logs matching
+       "Merge remote-tracking branch '.*'" too.  See Eli Zaretskii in:
+       http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00384.html
+
+2015-08-09  Nicolas Richard  <address@hidden>
+
+       Use kpsewhich in ffap-latex-mode, if available
+       * lisp/ffap.el (ffap-latex-guess-rules): New variable.
+       (ffap-latex-mode): Use kpsewhich if available.
+
+       ffap: disallow braces in filenames for tex modes
+       * lisp/ffap.el (ffap-string-at-point-mode-alist): Don't allow
+       braces in tex-related modes.
+
+       Remove useless backslashes from ffap-string-at-point-mode-alist
+       * lisp/ffap.el (ffap-string-at-point-mode-alist): Remove useless and
+       misleading backslashes from default value.
+
+       Augment docstring of ffap-string-at-point-mode-alist
+       * lisp/ffap.el (ffap-string-at-point-mode-alist): Describe how BEG
+       and END are handled.
+
+2015-08-09  Paul Eggert  <address@hidden>
+
+       Remove no-op calls to substitute-command-keys
+       * lisp/org/org-src.el (org-edit-src-code)
+       (org-edit-fixed-width-region):
+       * lisp/simple.el (completion-setup-function):
+       Remove calls to substitute-command-keys that always just return
+       their argument.
+
+2015-08-09  Daiki Ueno  <address@hidden>
+
+       Utilize `quit-window' in epa.el
+       * epa.el (epa-exit-buffer-function): Set to `quit-window'.
+       (Bug#21210)
+
+2015-08-09  Ivan Kanis  <address@hidden>
+
+       fix link to source code in help window
+       * lisp/help-fns.el (find-lisp-object-file-name): remove code that
+       will never work due to Glenn Morris change a6d63d9 on Apr 20 2013
+       'No longer include timestamp in header of .elc files'. Add code
+       that will return .el source file in load-path.
+
+2015-08-09  Artur Malabarba  <address@hidden>
+
+       * isearch.el (isearch-search-fun-default): (Bug#21164)
+       Respect `isearch-lax-whitespace' when searching through
+       `isearch-word'.
+
+2015-08-08  Stefan Monnier  <address@hidden>
+
+       * test/automated/ert-tests.el (ert-test-deftest): Add FIXME.
+
+       * org.el: Fix up some lexical scoping warnings, and use dolist
+       * lisp/org/org.el (org-set-regexps-and-options-for-tags, org-goto-map)
+       (org-set-regexps-and-options, org-assign-fast-keys)
+       (org-contextualize-keys, org-contextualize-validate-key)
+       (org-notes-order-reversed-p, org-local-logging, org-map-entries)
+       (org-find-olp, org-find-exact-heading-in-directory)
+       (org-cycle-agenda-files, org-release-buffers, org-fill-template)
+       (org-agenda-prepare-buffers, org-occur-in-agenda-files)
+       (org-replace-escapes): Use dolist.
+       (org-mode): Optimize away XEmacs-only code.
+       (org-refile-get-targets): Remove unused var `f'.
+       (org-fast-todo-selection): Remove unused var `e'.
+       (org-make-tags-matcher): Use dolist.  Remove unused var `term'.
+       (org-fast-tag-selection): Use dolist.  Remove unused var `e'.
+       (org-format-latex): Use dolist.  Remove unused var `e'.
+       (org-toggle-heading): Access vars lexically rather than dynamically.
+       (org-backward-sentence, org-forward-sentence, org-meta-return)
+       (org-kill-line): Mark arg as unused.
+       (org-submit-bug-report): Silence compiler warning.
+       (org-occur-in-agenda-files): Don't use add-to-list on local vars.
+       (org-get-cursor-date): Remove unused var `tm'.
+       (org-comment-or-uncomment-region): Use standard name `_'.
+       (reftex-docstruct-symbol, reftex-cite-format): Declare to
+       silence byte-compiler.
+       (org-reftex-citation): Add `org--' prefix to dynamically scoped
+       `rds' var.
+
+2015-08-08  Nicolas Petton  <address@hidden>
+
+       Merge remote-tracking branch 
'origin/fix/subsequence-error-with-negative-sequences'
+
+2015-08-08  Paul Eggert  <address@hidden>
+
+       Electric quote if coding is undecided or no conv
+       * lisp/electric.el (electric--insertable-p): Also say that a
+       string is insertable if the buffer file coding system is undecided
+       or uses no conversion, as curved quotes will work in either case.
+
+       * configure.ac (HAVE_STACK_OVERFLOW_HANDLING): Simplify configuration.
+
+2015-08-08  Eli Zaretskii  <address@hidden>
+
+       Fix overlay string display regressions introduced in Emacs 24.5
+       * src/xdisp.c (pop_it): Reset the flag to ignore overlays at this
+       buffer position, if we move the iterator to a new position as
+       result of jumping over text covered by a "replacing" display
+       property.
+       * test/redisplay-testsuite.el (test-redisplay-4): Add 2 new tests.
+
+       Support recovery from C stack overflow on MS-Windows
+       * src/w32fns.c (w32_reset_stack_overflow_guard)
+       (stack_overflow_handler): New functions for handling C stack
+       overflow exceptions.
+       (my_exception_handler): Handle EXCEPTION_STACK_OVERFLOW exceptions
+       specially, and zero out except_addr if we do.
+       (globals_of_w32fns): Initialize dwMainThreadId in non-interactive
+       mode.
+       * src/sysdep.c [HAVE_STACK_OVERFLOW_HANDLING]: Add !WINDOWSNT to
+       the condition, as HAVE_STACK_OVERFLOW_HANDLING is now defined for
+       the MinGW build, but the code guarded by that is for Posix hosts.
+       * src/keyboard.c (command_loop) [WINDOWSNT]: Call
+       w32_reset_stack_overflow_guard.
+       * nt/inc/ms-w32.h (sigjmp_buf): New typedef.
+       (sigsetjmp): New macro.
+       (w32_reset_stack_overflow_guard): Declare the prototype.
+       * configure.ac (HAVE_STACK_OVERFLOW_HANDLING): Set to 1 for MinGW.
+
+2015-08-07  Phillip Lord  <address@hidden>
+
+       Improve error signalling for seq-subseq.
+
+       * lisp/seq.el (seq-subseq): The existing behaviour is to error
+       when indexes are too large, but to silently ignore numbers which
+       are too negative for lists.  String and vector handling errors in
+       both cases. This has been regularlised. Error signalling behaviour
+       has been explicitly added to the docstring.
+
+       * lisp/cl-extra.el (cl-subseq): Defers to (seq-subseq) and is
+       therefore also impacted by this change. The docstring has been
+       updated to reflect this.
+
+       * test/automated/seq-tests.el (test-seq-subseq): Tests have been
+       added for these exceptional cases, as well as one non exceptional
+       base case.
+
+2015-08-07  Jürgen Hötzel  <address@hidden>
+
+       Improve error checking in tramp-adb.el
+       * lisp/net/tramp-adb.el (tramp-adb-ls-output-name-less-p):
+       Improve error checking.  "ls -l" on Android in Enforcing mode can
+       print "lstat './FILENAME failed: Permission denied".
+
+2015-08-07  Stefan Monnier  <address@hidden>
+
+       * lisp/emacs-lisp/cl-generic.el (cl--generic-struct-tag): Don't burp on
+       non-struct vectors.
+
+2015-08-07  Stephen Leake  <address@hidden>
+
+       lisp/window.el: fix typo, more `display-buffer-use-some-frame'
+       * lisp/window.el: fix typo that broke build
+       (display-buffer--action-function-custom-type): add
+       `display-buffer-use-some-frame'
+       (display-buffer): add `display-buffer-use-some-frame' to doc string
+
+       Add support for 'inhibit-same-window in 'display-buffer-use-some-frame'
+       * lisp/window.el (display-buffer-use-some-frame): Add support for
+       'inhibit-same-window in alist.
+       * doc/windows.texi (display-buffer-use-some-frame): Doc support for
+       'inhibit-same-window in alist.
+
+2015-08-07  Eli Zaretskii  <address@hidden>
+
+       Avoid infinite loop in display of invisible text in strings
+       * src/xdisp.c (handle_invisible_prop): If the next change of
+       invisibility spec does not mean the beginning of a visible text,
+       update the string position from which to start the search for the
+       next invisibility change.  This avoids an infinite loop when we
+       have more than one invisibility spec that are made inactive by
+       buffer-invisibility-spec.  Simplify code.  (Bug#21200)
+       * test/redisplay-testsuite.el (test-redisplay-4): Add a test case
+       for the situation that caused bug #21200.
+
+2015-08-06  Artur Malabarba  <address@hidden>
+
+       * lisp/emacs-lisp/package.el: Simplify describe-package-1
+       (package-help-section-name-face): New face.
+       (package--print-help-section): New function.
+       (describe-package-1): Refactor section printing.
+       (package-make-button): Use face instead of font-lock-face, which
+       doesn't work on buttons.
+
+       * lisp/emacs-lisp/package.el: Define custom faces
+       (package-name-face, package-description-face)
+       (package-status-built-in-face, package-status-external-face)
+       (package-status-available-face, package-status-new-face)
+       (package-status-held-face, package-status-disabled-face)
+       (package-status-installed-face, package-status-dependency-face)
+       (package-status-unsigned-face, package-status-incompat-face)
+       (package-status-avail-obso-face): New faces.
+       (package-menu--print-info-simple): Use them.
+
+2015-08-05  Paul Eggert  <address@hidden>
+
+       Fix some confusion with ‘format’
+       * lisp/allout-widgets.el (allout-widgets-before-change-handler)
+       (allout-graphics-modification-handler):
+       Protect arbitrary string in a format context with "%s" format.
+       * lisp/avoid.el:
+       * lisp/cedet/semantic/bovine/scm.el: Fix comment.
+       * lisp/calendar/icalendar.el (icalendar--convert-sexp-to-ical):
+       * lisp/erc/erc-button.el (erc-button-beats-to-time):
+       * lisp/gnus/message.el (message-send-form-letter):
+       * lisp/org/ob-core.el (org-babel-check-evaluate)
+       (org-babel-confirm-evaluate):
+       * lisp/org/ob-fortran.el (org-babel-fortran-var-to-fortran):
+       * lisp/org/ox-latex.el (org-latex-compile):
+       * lisp/org/ox-man.el (org-man-compile):
+       * lisp/org/ox-odt.el (org-odt-template):
+       * lisp/org/ox-texinfo.el (org-texinfo-compile):
+       * lisp/progmodes/prolog.el (prolog-help-info)
+       (prolog-view-predspec):
+       * lisp/progmodes/ruby-mode.el (ruby-parse-partial):
+       * lisp/progmodes/verilog-mode.el (verilog-showscopes):
+       * lisp/textmodes/rst.el (rst-replace-lines):
+       Change (message (format ...)) to (message ...), and likewise
+       for ‘error’.  This lessens the probability of confusion when the
+       output of ‘format’ contains ‘%’.
+
+2015-08-05  Artur Malabarba  <address@hidden>
+
+       * lisp/replace.el (replace-character-fold): Default to nil
+
+       * lisp/character-fold.el: Fix lax whitespace
+       (character-fold-table): Don't make space match other whitespace chars.
+       (character-fold-to-regexp): Simplify lax behaviour.
+
+2015-08-05  Dmitry Gutov  <address@hidden>
+
+       Preserve window point in xref-find-definitions-other-window
+       Fix the problem reported by Ingo Logmar in
+       http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00152.html
+       * lisp/progmodes/xref.el (xref--goto-char): Extract from
+       xref--goto-location.
+       (xref--pop-to-location): Use it. Replace xref--goto-location with
+       a direct xref-location-marker call.
+       (xref--show-location): Likewise.
+       (xref--display-position): Use xref--goto-char.
+
+       * lisp/progmodes/project.el: Add a paragraph to the front matter.
+
+2015-08-04  David Kastrup  <address@hidden>
+
+       Do not overwrite preexisting contents of unread-command-events
+       * lisp/vc/emerge.el (emerge-show-file-name):
+       * lisp/progmodes/vhdl-mode.el (vhdl-electric-dash)
+       (vhdl-comment-insert, vhdl-hooked-abbrev):
+       * lisp/progmodes/octave.el (inferior-octave-dynamic-list-input-ring):
+       * lisp/progmodes/fortran.el (fortran-window-create-momentarily):
+       * lisp/progmodes/ebrowse.el (ebrowse-hack-electric-buffer-menu):
+       * lisp/progmodes/cperl-mode.el (cperl-putback-char):
+       * lisp/obsolete/vip.el (vip-escape-to-emacs)
+       (vip-prefix-arg-value, vip-prefix-arg-com):
+       * lisp/obsolete/terminal.el (te-escape-extended-command-unread):
+       * lisp/leim/quail/tibetan.el (quail-tibetan-update-translation)
+       (quail-tibkey-update-translation):
+       * lisp/leim/quail/lrt.el (quail-lrt-update-translation):
+       * lisp/leim/quail/lao.el (quail-lao-update-translation):
+       * lisp/leim/quail/japanese.el (quail-japanese-update-translation)
+       (quail-japanese-self-insert-and-switch-to-alpha):
+       * lisp/leim/quail/hangul.el (hangul2-input-method)
+       (hangul3-input-method, hangul390-input-method):
+       * lisp/language/hanja-util.el (hangul-to-hanja-char):
+       * lisp/international/robin.el (robin-input-method):
+       * lisp/international/quail.el (quail-start-translation)
+       (quail-start-conversion):
+       * lisp/gnus/gnus-art.el (gnus-article-describe-key)
+       (gnus-article-describe-key-briefly):
+       * lisp/eshell/em-hist.el (eshell-list-history):
+       * lisp/term.el (term-dynamic-list-input-ring)
+       (term-dynamic-list-completions):
+       * lisp/subr.el (momentary-string-display):
+       * lisp/simple.el (read-quoted-char):
+       * lisp/pcomplete.el (pcomplete-show-completions):
+       * lisp/kmacro.el (kmacro-repeat-on-last-key):
+       * lisp/info.el (Info-summary):
+       * lisp/ehelp.el (electric-help-command-loop):
+       * lisp/ebuff-menu.el (electric-buffer-list)
+       (Electric-buffer-menu-exit):
+       * lisp/double.el (double-translate-key):
+       * lisp/comint.el (comint-dynamic-list-input-ring)
+       (comint-dynamic-list-completions): Do not overwrite preexisting
+       contents of `unread-command-events' when putting new events into
+       it.
+
+2015-08-04  Daniel Colascione  <address@hidden>
+
+       Improve ansi-color filtering of unrecognized escape sequences
+       * lisp/ansi-color.el (ansi-color-drop-regexp): Recognize mode-setting
+       escape sequences.
+       (ansi-color-filter-apply): Filter out unrecognized escape sequences
+       (ansi-color-apply): Filter out unrecognized escape sequences
+
+2015-08-04  Artur Malabarba  <address@hidden>
+
+       * lisp/emacs-lisp/package.el (package-menu-mode-map): Convert menu
+       definitions to `easy-menu-define', improve a couple to account for
+       async, and add a couple of new commands.
+
+2015-08-03  Jürgen Hötzel  <address@hidden>
+
+       * lisp/net/tramp-cache.el (tramp-set-file-property): Fix code typo.
+
+2015-08-03  Ingo Lohmar  <address@hidden>
+
+       Add new 'calendar-weekend-days' option
+       Make the days receiving the 'calendar-weekend-header' face freely
+       customizable, as they differ by region/culture.
+       * doc/emacs/calendar.texi (Move to Beginning or End): Document the
+       new variable.
+       * lisp/calendar/calendar.el (calendar-generate-month): New variable
+       calendar-weekend-days to customize day header fontification.
+
+2015-08-03  Paul Eggert  <address@hidden>
+
+       Redo text-quoting-style variable
+       Rename help-quote-translation to text-quoting-style,
+       and use symbols rather than characters as values.
+       This follows suggestions along these lines by Alan Mackenzie in:
+       http://lists.gnu.org/archive/html/emacs-devel/2015-06/msg00343.html
+       and by Drew Adams in:
+       http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00048.html
+       * doc/lispref/help.texi (Keys in Documentation)
+       * etc/NEWS:
+       * lisp/cus-start.el (standard):
+       * src/doc.c (Fsubstitute_command_keys, syms_of_doc):
+       Document and/or implement the new behavior instead of the old.
+       (syms_of_doc): New symbols 'grave' and 'straight'.
+
+2015-08-03  Nikolaus Rath  <address@hidden>
+
+       nnimap.el: Use IMAP MOVE extension if available
+       * lisp/gnus/nnimap.el (nnimap-request-move-article)
+       (nnimap-process-expiry-targets, nnimap-split-incoming-mail):
+       Use MOVE extension if available.
+
+       nnimap.el: Explicitly ask for server capabilities
+       * lisp/gnus/nnimap.el (nnimap-open-connection-1): Don't assume full
+       capabilities will be returned in the login-result.
+
+2015-08-02  Paul Eggert  <address@hidden>
+
+       Treat help strings like other doc strings
+       * doc/lispref/text.texi (Special Properties), etc/NEWS: Document this.
+       * lisp/epa.el (epa--select-keys): Remove no-longer-needed calls to
+       substitute-command-keys.
+       * src/keyboard.c (show_help_echo, parse_menu_item): Call
+       substitute-command-keys on the help string before displaying it.
+
+       Also mention "curly quotes"
+       See Drew Adams's email in:
+       http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00040.html
+       * doc/lispref/help.texi (Keys in Documentation):
+       Add index entry "curly quotes".
+       * etc/NEWS: Use the phrase "curly quotes" too.
+
+       ede-proj-target-makefile docstring tweaks
+       * lisp/cedet/ede/proj.el (ede-proj-target-makefile):
+       Consistently use "all:" to describe the all: target,
+       replacing three different and confusingly-quoted usages.
+
+2015-08-02  Eli Zaretskii  <address@hidden>
+
+       Whitespace fixes
+
+2015-08-02  Evgeny Fraimovitch  <address@hidden>  (tiny change)
+
+       Don't abort emacsclientw when -a was specified
+       * lib-src/emacsclient.c (set_tcp_socket) [WINDOWSNT]: Don't error
+       out if we are in emacsclientw and -a was specified.
+
+2015-08-02  Eli Zaretskii  <address@hidden>
+
+       Fix handling of 1st keystroke on MS-Windows
+       * src/w32fns.c (globals_of_w32fns): Initialize after_deadkey to -1.
+       This is needed to correctly handle the session's first keystroke,
+       if it has any modifiers.  (Bug#19994)
+
+2015-08-02  Paul Eggert  <address@hidden>
+
+       Substitute some customization etc. doc strings
+       These changes apply substitute-command-keys to some
+       doc strings that were going through untranslated
+       when creating customization or other widgets.
+       * lisp/cus-edit.el (custom-group-value-create):
+       * lisp/wid-edit.el (widget-default-create):
+       (widget-push-button-value-create):
+       Treat the widget tag as a doc string.
+       * lisp/emacs-lisp/cl-extra.el (cl--describe-class-slot):
+       Treat the :documentation value as a doc string.
+       * lisp/wid-edit.el (widget-choose):
+       Treat the choice names as doc strings.
+       (widget-default-create): Treat the :doc value as a doc string.
+       (widget-toggle-value-create): Treat the :on and :off values
+       as doc strings.
+       (widget-documentation-string-value-create):
+       Substitute the doc string.
+
+2015-08-01  Dmitry Gutov  <address@hidden>
+
+       Add a second argument to project-ignores
+       * lisp/progmodes/project.el (project-ignores): Add a second
+       argument DIR.
+       * lisp/progmodes/project.el (project-ignores): Only include the VC
+       ignores if DIR is the VC root.
+       * lisp/progmodes/xref.el (xref-find-regexp): Update accordingly.
+
+2015-08-01  Eli Zaretskii  <address@hidden>
+
+       Prevent incorrect display when 'line-spacing' variable is set
+       * src/xdisp.c (try_window_id): Give up this optimization if the
+       buffer has its 'line-spacing' variable set non-nil.
+
+2015-08-01  Dmitry Gutov  <address@hidden>
+
+       Don't pass NOVISIT to find-file
+       * lisp/progmodes/etags.el (next-file):
+       Don't pass NOVISIT to find-file (bug#21175).
+
+       Ignore buffer restriction for tags-loop-eval
+       * lisp/progmodes/etags.el (tags-loop-continue): Ignore buffer
+       restriction (bug#21167).
+
+2015-08-01  Eli Zaretskii  <address@hidden>
+
+       Fix a thinko in 'ffap-gopher-at-point'
+       * lisp/ffap.el (ffap-gopher-at-point): Fix last change.  (Bug#21168)
+
+       Honor 'line-spacing' for empty lines
+       * src/xdisp.c (append_space_for_newline): Honor 'line-height'
+       property and 'line-spacing' frame parameter or variable or
+       property for empty lines, by doing the same processing as in
+       x_produce_glyph for newline characters.  (Bug#21165)
+
+2015-08-01  Paul Eggert  <address@hidden>
+
+       Simplify by assuming C99 integer division
+       * src/floatfns.c (ceiling2, floor2, truncate2):
+       Assume C99 (i.e., Fortran) semantics for integer division.
+       This simplifies the code.
+
+2015-07-31  Paul Eggert  <address@hidden>
+
+       Don't overflow if computing approximate percentage
+       * lisp/align.el (align-region):
+       * lisp/cedet/semantic.el (semantic-repeat-parse-whole-stream):
+       * lisp/cedet/semantic/wisent.el (wisent-parse-region):
+       * lisp/cus-edit.el (custom-buffer-create-internal):
+       * lisp/emacs-lisp/checkdoc.el (checkdoc-interactive-ispell-loop)
+       (checkdoc-message-interactive-ispell-loop, checkdoc-next-error)
+       (checkdoc-next-message-error):
+       * lisp/emacs-lisp/eieio-opt.el (eieio-display-method-list):
+       * lisp/epa.el (epa-progress-callback-function):
+       * lisp/erc/erc-dcc.el (erc-dcc-do-LIST-command):
+       * lisp/ffap.el (ffap-menu-rescan):
+       * lisp/gnus/nnbabyl.el (nnbabyl-retrieve-headers):
+       * lisp/gnus/nndiary.el (nndiary-retrieve-headers):
+       * lisp/gnus/nneething.el (nneething-retrieve-headers):
+       * lisp/gnus/nnmbox.el (nnmbox-retrieve-headers):
+       * lisp/gnus/nnmh.el (nnmh-retrieve-headers):
+       * lisp/gnus/nnml.el (nnml-retrieve-headers):
+       * lisp/gnus/nnspool.el (nnspool-retrieve-headers):
+       * lisp/gnus/nntp.el (nntp-retrieve-headers)
+       (nntp-retrieve-articles):
+       * lisp/imenu.el (imenu--relative-position):
+       * lisp/international/ja-dic-cnv.el (skkdic-collect-okuri-nasi)
+       (skkdic-convert-okuri-nasi):
+       * lisp/net/ange-ftp.el (ange-ftp-process-handle-hash):
+       * lisp/nxml/rng-valid.el (rng-compute-mode-line-string):
+       * lisp/org/org-list.el (org-update-checkbox-count):
+       * lisp/org/org.el (org-table-map-tables)
+       (org-update-parent-todo-statistics):
+       * lisp/play/decipher.el (decipher-insert-frequency-counts)
+       (decipher-analyze-buffer):
+       * lisp/profiler.el (profiler-format-percent):
+       * lisp/progmodes/cc-cmds.el (c-progress-update):
+       * lisp/progmodes/cpp.el (cpp-highlight-buffer):
+       * lisp/progmodes/idlwave.el (idlwave-convert-xml-system-routine-info)
+       (idlwave-list-load-path-shadows):
+       * lisp/progmodes/opascal.el (opascal-step-progress):
+       * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
+       (vhdl-scan-directory-contents):
+       * lisp/textmodes/bibtex.el (bibtex-progress-message):
+       * lisp/textmodes/flyspell.el (flyspell-small-region)
+       (flyspell-external-point-words):
+       * lisp/textmodes/table.el (table-recognize):
+       Prefer (floor (* 100.0 NUMERATOR) DENOMINATOR) when calculating
+       progress-report percentages and the like.  This avoids problems
+       if (* 100 NUMERATOR) would overflow.
+       * lisp/gnus/gnus-registry.el (gnus-registry-import-eld):
+       * lisp/gnus/registry.el (registry-reindex):
+       Use (* 100.0 ...) rather than (* 100 ...) to avoid int overflow issues.
+       * lisp/descr-text.el (describe-char):
+       * lisp/org/org-colview.el (org-nofm-to-completion):
+       * lisp/ps-print.el (ps-plot):
+       * lisp/simple.el (what-cursor-position):
+       Prefer (round (* 100.0 NUMERATOR) DENOMINATOR) to a
+       more-complicated and less-accurate approximation.
+
+       Fix some int overflows in profiler.c
+       * src/profiler.c (make_log): Make args EMACS_INT, not int,
+       to avoid unwanted behavior on 'int' overflow.
+       (make_log, evict_lower_half, record_backtrace):
+       Use ptrdiff_t, not int, for object indexes.
+
+       Port to pedantic memcpy
+       * src/keyboard.c (menu_bar_items, tool_bar_items):
+       * src/xrdb.c (magic_db):
+       Port to pedantic memcpy implementations that reject memcpy (0, 0, 0).
+
+       Merge from gnulib
+       This incorporates:
+       2015-07-29 time_rz: port to pedantic memcpy
+       * lib/time_rz.c: Copy from gnulib.
+
+2015-07-31  Artur Malabarba  <address@hidden>
+
+       * lisp/emacs-lisp/tabulated-list.el (tabulated-list-print): Fix bug
+       When updating the very last entry, tabulated-list-print would
+       erase it and then try to look at the next one (which obviously
+       isn't there).
+
+2015-07-31  Eli Zaretskii  <address@hidden>
+
+       Allow to use the old key processing code on MS-Windows
+       * src/w32fns.c (syms_of_w32fns) <w32-use-fallback-wm-chars-method>:
+       New variable.
+       (w32_wnd_proc): Use it to invoke the old code that processed
+       character keys, as fallback, when this variable is non-nil.  Fix
+       typos in comments.  (Bug#19994)
+
+2015-07-31  Ilya Zakharevich  <address@hidden>
+
+       Improve handling of Unicode keyboard input on MS-Windows
+       * src/w32fns.c (get_wm_chars, deliver_wm_chars): New functions.
+       (FPRINTF_WM_CHARS) [DEBUG_WM_CHARS]: New macro for debugging.
+       (w32_wnd_proc): Call deliver_wm_chars to process non-special keys
+       upon receiving WM_KEYDOWN or WM_SYSKEYDOWN messages.  If that is
+       successful, don't call TranslateMessage.  (Bug#19994)
+
+2015-07-30  Dmitry Gutov  <address@hidden>
+
+       Fix default-directory in changeset diffs after vc-print-log
+       * lisp/vc/log-view.el (log-view-diff-common): Move the
+       revision-granularity check back into log-view-diff-changeset.
+       (log-view-diff-changeset): Bind default-directory to the current
+       VC root.
+
+       Rename project-directories to project-roots
+       * lisp/progmodes/project.el (project-search-path-function)
+       (project-search-path): Update the docstring.
+       (project-directories): Rename to `project-roots', update all
+       callers and implementations accordingly.
+       (project-root): Remove.
+       * lisp/progmodes/xref.el (xref-find-regexp): Use * instead of *.*
+       as the default file mask.
+
+2015-07-30  Eli Zaretskii  <address@hidden>
+
+       Support long URLs in w32-shell-execute
+       * src/w32fns.c (Fw32_shell_execute): Don't use filename_to_utf16
+       and filename_to_ansi to convert the DOCUMENT argument, as it could
+       be a URL that is not limited to MAX_PATH characters.  Instead, use
+       MultiByteToWideChar directly, and allocate heap storage as
+       required to accommodate the converted string.  Likewise with
+       non-Unicode operation.  Ensure OPERATION is null-terminated, even
+       if it is longer than 32K bytes.  (Bug#21158)
+
+2015-07-30  Stephen Leake  <address@hidden>
+
+       vc-mtn-find-revision handle null rev.
+       * lisp/vc/vc-mtn.el (vc-mtn-find-revision): handle null rev
+
+2015-07-29  Stephen Leake  <address@hidden>
+
+       Add docs for display-buffer action display-buffer-use-some-frame
+       * lisp/window.el (display-buffer-use-some-frame): improve doc string
+       * doc/lispref/windows.texi (Display Action Functions): add
+         display-buffer-use-some-frame
+       * etc/NEWS: mention display-buffer-use-some-frame
+
+       Add display-buffer action display-buffer-use-some-frame
+       * lisp/window.el (display-buffer-use-some-frame): new
+
+       Handle vc-mtn error more gently
+       * lisp/vc/vc-mtn.el (vc-mtn-mode-line-string): return "" when branch is 
nil
+
+2015-07-29  Michael Albinus  <address@hidden>
+
+       Fix Tramp problems with multihops, and nc.
+       * lisp/net/tramp-cache.el (tramp-get-file-property)
+       (tramp-set-file-property, tramp-flush-file-property)
+       (tramp-get-connection-property, tramp-set-connection-property)
+       (tramp-flush-connection-property): Remove hop from vector.
+       * lisp/net/tramp-gw.el (tramp-gw-process-filter): Ignore errors.
+       * lisp/net/tramp-sh.el (tramp-methods) <nc>: Separate STDERR.
+       (tramp-do-copy-or-rename-file-out-of-band): Increase timeout of
+       netstat to 60".
+       (tramp-sh-handle-start-file-process): Do not show hops in prompt.
+       * lisp/net/tramp.el (tramp-handle-file-name-as-directory)
+       (tramp-handle-file-name-directory, tramp-handle-file-remote-p):
+       Keep hop in result.
+       * test/automated/tramp-tests.el (tramp-test02-file-name-dissect):
+       Add hop tests.
+
+2015-07-29  Eli Zaretskii  <address@hidden>
+
+       Resurrect highlighting of repeated words by Flyspell Mode
+       * lisp/textmodes/flyspell.el (flyspell-word): Leave some non-word
+       characters between point and the doublon candidate, so that
+       flyspell-word-search-backward finds it.  (Bug#21157)
+
+       Fix redisplay of large images on expose events
+       * src/xdisp.c (expose_window, expose_area): Avoid comparisons
+       between signed negative values and unsigned values.  This
+       prevented redisplay on expose events when the window showed a very
+       large image.
+
+2015-07-29  Paul Eggert  <address@hidden>
+
+       Remove unnecessary stack overflow dependency
+       * configure.ac (HAVE_STACK_OVERFLOW_HANDLING):
+       Don't worry about $ac_cv_header_sys_resource_h and
+       $ac_cv_func_getrlimit, as they're no longer needed for this.
+       Problem reported by Eli Zaretskii in:
+       http://lists.gnu.org/archive/html/emacs-devel/2015-07/msg00443.html
+
+2015-07-28  Andy Moreton  <address@hidden>  (tiny change)
+
+       Pacify compilation -Wincompatible-pointer-types warnings
+       * src/w32proc.c (Fw32_get_codepage_charset): Avoid compilation
+       warning.
+       (CompareStringW_Proc): New typedef.
+       (w32_compare_strings): Use it, to pacify compiler warnings under
+       "-Wincompatible-pointer-types".
+       * src/w32fns.c (GetDiskFreeSpaceExW_Proc)
+       (GetDiskFreeSpaceExA_Proc): New typedefs.
+       (Ffile_system_info): Use them, to pacify compiler warnings under
+       "-Wincompatible-pointer-types".
+
+2015-07-28  Paul Eggert  <address@hidden>
+
+       Fix subscript error in calculate_direct_scrolling
+       Use slightly-longer cost vectors.  Without this change,
+       calculate_direct_scrolling can have a subscript violation when
+       FRAME_LINES (frame) <= delta.
+       * src/scroll.c (calculate_scrolling, calculate_direct_scrolling)
+       (line_ins_del, do_line_insertion_deletion_costs):
+       Allocate and use slightly-larger cost vectors, ones based on
+       FRAME_TOTAL_LINES instead of FRAME_LINES.
+
+       Fix uninitalized value in encode_coding_object
+       * src/coding.c (encode_coding_object): Also initialize
+       coding->src_pos and coding->src_pos_byte when NILP (src_object).
+       This avoids later use of uninitialized storage.
+
+2015-07-27  Xue Fuqiao  <address@hidden>
+
+       * doc/lispref/variables.texi (Variable Aliases): Typo fix.  (Bug#21141)
+
+2015-07-27  Paul Eggert  <address@hidden>
+
+       Merge from gnulib
+       This incorporates:
+       2015-07-27 time_rz: port better to MinGW
+       2015-07-27 time: port __need_time_t to MinGW
+       * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
+       * lib/strftime.c, lib/time.in.h, lib/time_rz.c: Copy from gnulib.
+       * lib/time-internal.h: New file, from gnulib.
+
+2015-07-27  Eli Zaretskii  <address@hidden>
+
+       Handle NULL pointers in w32heap.c allocation routines
+       * src/w32heap.c (FREEABLE_P): Consider a NULL pointer "not
+       freeable".
+       (realloc_after_dump, realloc_before_dump, free_before_dump):
+       Handle NULL pointers gracefully, as Emacs now seems to expect
+       that.
+
+       Fix Cairo build without PNG
+       * src/image.c: Define PNG function when USE_CAIRO is defined, even
+       if HAVE_PNG is not.  (Bug#21133)
+
+       MS-Windows follow-up for recent TZ-related changes
+       * nt/mingw-cfg.site (ac_cv_header_pthread_h)
+       (gl_cv_sys_struct_timespec_in_pthread_h): Force to "no", to avoid
+       picking up 'struct timespec' from pthread.h, if it is installed on
+       the user's system.  We want either the definitions from MinGW
+       system headers, if available, or the Gnulib replacements if not.
+       * nt/inc/ms-w32.h <struct timespec>: Don't define, as we now use
+       lib/time.h.
+       * lib/time.in.h: Don't let __need_* symbols affect what happens on
+       MinGW.  These symbols are defined by MinGW system headers, but we
+       don't want that to affect whether Gnulib portions of the header
+       are or aren't used.
+
+2015-07-26  Paul Eggert  <address@hidden>
+
+       * src/ftfont.c (ftfont_close): Add comment re Bug#20890.
+
+       New optional ZONE arg for format-time-string etc.
+       This simplifies time conversions in other time zones.
+       It also prevents display-time-world tampering with TZ (Bug#21020).
+       * admin/admin.el (add-release-logs):
+       Use improved add-log-time-format API.
+       * admin/merge-gnulib (GNULIB_MODULES): Add time_rz, timegm.
+       (GNULIB_TOOL_FLAGS): Avoid flexmember, setenv, unsetenv.
+       * configure.ac (tzalloc): Remove test for this, since
+       Emacs no longer uses HAVE_TZALLOC directly.
+       * doc/lispref/os.texi (Time of Day, Time Conversion)
+       (Time Parsing):
+       * etc/NEWS: Document the new behavior.
+       Merge from gnulib, incorporating:
+       2015-07-25 strftime: fix newly-introduced bug on Solaris
+       2015-07-23 fprintftime, strftime: use timezone_t args
+       * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
+       * lib/strftime.c, lib/strftime.h, lib/time.in.h, m4/sys_time_h.m4:
+       * m4/time_h.m4:
+       Update from gnulib.
+       * lib/time_rz.c, lib/timegm.c, m4/time_rz.m4, m4/timegm.m4:
+       New files from gnulib.
+       * lisp/time-stamp.el (time-stamp-string):
+       * lisp/time.el (display-time-world-list)
+       (display-time-world-display):
+       Use new API, with time zone arg.
+       * lisp/time.el (display-time-world-display):
+       Fix race when current-time advances while we're running.
+       * lisp/vc/add-log.el (add-log-iso8601-time-zone)
+       (add-log-iso8601-time-string): Accept optional time zone arg.
+       * lisp/vc/add-log.el (add-change-log-entry):
+       * lisp/vc/log-edit.el (log-edit-changelog-ours-p): Use new arg.
+       * nt/gnulib.mk: Propagate lib/gnulib.mk changes here.
+       Add rules for the time module, since they're now needed
+       for tzalloc etc.
+       * src/conf_post.h (getenv_TZ, setenv_TZ): New macros.
+       (emacs_getenv_TZ, emacs_setenv_TZ): New decls.
+       * src/editfns.c: Include errno.h.
+       (set_time_zone_rule): Omit unnecessary forward decl.
+       (initial_tz): Remove, replacing with ...
+       (local_tz, wall_clock_tz, utc_tz): New static vars and constants.
+       (tzeqlen): New constant; prefer it to (sizeof "TZ=" - 1).
+       (emacs_localtime_rz, emacs_mktime_z, xtzalloc, xtzfree)
+       (tzlookup): New static functions.
+       (init_editfns): New arg DUMPING.  All uses changed.
+       (init_editfns): Omit most initialization if dumping, not if
+       !initialized.  Initialize wall_clock_tz and local_tz.
+       (emacs_nmemftime, format_time_string): Time zone argument can now
+       be any time zone, not just a boolean for UTC or local time.  All
+       callers changed.
+       (Fformat_time_string, Fencode_time, Fcurrent_time_string)
+       (Fcurrent_time_zone): New optional arg ZONE.
+       (Fdecode_time, Fset_time_zone_rule): ZONE arg can now also take
+       the same form as with the other new additions.
+       (decode_time_zone): Remove; no longer needed.
+       (tzvalbuf): Now file-scope.
+       (emacs_getenv_TZ, emacs_setenv_TZ): New functions.
+       (syms_of_editfns): Define Qwall.
+       * src/editfns.c (mktime_z) [!HAVE_TZALLOC]:
+       * src/systime.h (mktime_z, timezone_t, tzalloc, tzfree)
+       [!HAVE_TZALLOC]:
+       Remove; now supplied by gnulib.
+       * src/emacs.c (main):
+       * src/lisp.h (init_editfns): Adjust to init_editfns API change.
+
+2015-07-26  Shigeru Fukaya  <address@hidden>
+
+       Fix infinite loop in delete-consecutive-dups
+       * lisp/subr.el (delete-consecutive-dups): Work even if the last
+       element is nil (Bug#20588).  Avoid rescan of a circular list in
+       deletion of last element.
+
+2015-07-26  Martin Rudalics  <address@hidden>
+
+       Have `x-frame-geometry' return nil for terminal and initial frames 
(Bug#21132)
+       * src/nsfns.m (Fx_frame_geometry):
+       * src/xfns.c (Fx_frame_geometry): Return nil for initial and
+       terminal frames.
+       * src/w32fns.c (Fw32_frame_menu_bar_size, Fw32_frame_rect)
+       (Fx_frame_geometry): Return nil for terminal frames
+
 2015-07-26  HOSOYA Kei  <address@hidden>  (tiny change)
 
        * etc/tutorials/TUTORIAL.ja: Improve translation.
@@ -73,7 +2381,6 @@
        Fix customization type of `even-window-sizes'.
        * lisp/window.el (even-window-sizes): Fix customization type.
 
-       2015-07-22  Martin Rudalics  <address@hidden>
        Optionally even widths of `display-buffer' windows.  (Bug#21100)
        * lisp/window.el (quit-restore-window): Restore width if
        requested.
@@ -947,10 +3254,6 @@
        * doc/emacs/display.texi (Displaying Boundaries):
        * doc/emacs/search.texi (Word Search): Add cross references.
 
-2015-07-02  Eli Zaretskii  <address@hidden>
-
-       ;* src/bidi.c (bpa_stack_entry): Update commentary for Unicode 8.0.
-
 2015-07-02  Paul Eggert  <address@hidden>
 
        -batch should not affect ‘’ -> `' display
@@ -1876,8 +4179,6 @@
 
 2015-06-18  Martin Rudalics  <address@hidden>
 
-       Fix last fix"
-
        Set image_cache_refcount before x_default_parameter calls.  (Bug#20802)
        * src/nsfns.m (Fx_create_frame):
        * src/xfns.c (Fx_create_frame, x_create_tip_frame): Move setting
@@ -2177,8 +4478,6 @@
 
 2015-06-15  Eli Zaretskii  <address@hidden>
 
-       ;* src/fontset.c: Update obsolete commentary.
-
        Fix current-iso639-language on MS-Windows
        * lisp/international/mule-cmds.el (set-locale-environment):
        Downcase the locale name before interning it.  This is so the
@@ -8170,7 +10469,7 @@
 
 This file records repository revisions from
 commit 9d56a21e6a696ad19ac65c4b405aeca44785884a (exclusive) to
-commit 2cf501ce1b77e6e409871eef7b9d31a08e73cfc0 (inclusive).
+commit a664f6a5d586e1f3fdbf31d0cf2fdaa6429a58fe (inclusive).
 See ChangeLog.1 for earlier changes.
 
 ;; Local Variables:
diff --git a/admin/admin.el b/admin/admin.el
index 267f2c4..6b213a7 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -88,21 +88,12 @@ Root must be the root of an Emacs source tree."
                       (rx (and "AC_INIT" (1+ (not (in ?,)))
                                 ?, (0+ space)
                                 (submatch (1+ (in "0-9."))))))
-  ;; No longer used, broken in multiple ways, updating version seems pointless.
-  (set-version-in-file root "nt/config.nt" version
-                      (rx (and bol "#" (0+ blank) "define" (1+ blank)
-                               "VERSION" (1+ blank) "\""
-                               (submatch (1+ (in "0-9."))))))
   ;; TODO: msdos could easily extract the version number from
   ;; configure.ac with sed, rather than duplicating the information.
   (set-version-in-file root "msdos/sed2v2.inp" version
                       (rx (and bol "/^#undef " (1+ not-newline)
                                "define VERSION" (1+ space) "\""
                                (submatch (1+ (in "0-9."))))))
-  ;; No longer used, broken in multiple ways, updating version seems pointless.
-  (set-version-in-file root "nt/makefile.w32-in" version
-                      (rx (and "VERSION" (0+ space) "=" (0+ space)
-                               (submatch (1+ (in "0-9."))))))
   ;; Major version only.
   (when (string-match "\\([0-9]\\{2,\\}\\)" version)
     (setq version (match-string 1 version))
@@ -134,10 +125,6 @@ Root must be the root of an Emacs source tree."
                       (rx (and bol "/^#undef " (1+ not-newline)
                                "define COPYRIGHT" (1+ space)
                                ?\" (submatch (1+ (not (in ?\")))) ?\")))
-  (set-version-in-file root "nt/config.nt" copyright
-                      (rx (and bol "#" (0+ blank) "define" (1+ blank)
-                               "COPYRIGHT" (1+ blank)
-                               ?\" (submatch (1+ (not (in ?\")))) ?\")))
   (set-version-in-file root "lib-src/rcs2log" copyright
                       (rx (and "Copyright" (0+ space) ?= (0+ space)
                                ?\' (submatch (1+ nonl)))))
@@ -687,8 +674,8 @@ If optional argument OLD is non-nil, also scan for 
`defvar's."
              (and (not old)
                   (equal "custom" (match-string 2))
                   (not (memq :type form))
-                  (display-warning 'custom
-                                   (format "Missing type in: `%s'" form)))
+                  (display-warning
+                    'custom (format-message "Missing type in: `%s'" form)))
              (setq ver (car (cdr-safe (memq :version form))))
              (if (equal "group" (match-string 2))
                  ;; Group :version could be old.
@@ -702,7 +689,7 @@ If optional argument OLD is non-nil, also scan for 
`defvar's."
                       (setq grp (car (cdr-safe grp))) ; (quote foo) -> foo
                       (setq ver (assq grp glist))))
                (setq alist (cons (cons var ver) alist))))
-          (if form (message "Malformed defcustom: `%s'" form)))))
+          (if form (format-message "Malformed defcustom: `%s'" form)))))
     (message "%sdone" m)
     alist))
 
@@ -794,7 +781,8 @@ changes (in a non-trivial way).  This function does not 
check for that."
        (message "No missing :version tags")
       (pop-to-buffer "*cusver*")
       (erase-buffer)
-      (insert "These `defcustom's might be missing :version tags:\n\n")
+      (insert (substitute-command-keys
+               "These `defcustom's might be missing :version tags:\n\n"))
       (dolist (elem result)
        (let* ((str (file-relative-name (car elem) newdir))
               (strlen (length str)))
diff --git a/admin/authors.el b/admin/authors.el
index c7ec3bc..0afb3a8 100644
--- a/admin/authors.el
+++ b/admin/authors.el
@@ -1078,10 +1078,10 @@ to print a message if FILE is not found."
                  (string-match "^[0-9.]+$" file)
                  laxlog)
        (setq authors-invalid-file-names
-             (cons (format "%s:%d: unrecognized `%s' for %s"
-                           log-file
-                           (1+ (count-lines (point-min) pos))
-                           file author)
+             (cons (format-message "%s:%d: unrecognized `%s' for %s"
+                                   log-file
+                                   (1+ (count-lines (point-min) pos))
+                                   file author)
                    authors-invalid-file-names)))
       valid)))
 
@@ -1154,7 +1154,7 @@ it is found in `authors-fixed-case'."
          (setq regexps (cdr regexps))))))
   (when author
     (setq author (replace-regexp-in-string "[ \t]*[(<].*$" "" author))
-    (setq author (replace-regexp-in-string "\`[ \t]+" "" author))
+    (setq author (replace-regexp-in-string "\\`[ \t]+" "" author))
     (setq author (replace-regexp-in-string "[ \t]+$" "" author))
     (setq author (replace-regexp-in-string "[ \t]+" " " author))
     (unless (string-match "[-, \t]" author)
diff --git a/admin/bzrmerge.el b/admin/bzrmerge.el
index 7d4cd19..1bcbaa2 100644
--- a/admin/bzrmerge.el
+++ b/admin/bzrmerge.el
@@ -140,11 +140,11 @@ are both lists of revnos, in oldest-first order."
                     (setq str (substring str (match-end 0))))
                   (when (string-match "[.!;, ]+\\'" str)
                     (setq str (substring str 0 (match-beginning 0))))
-                  (let ((help-form "\
+                  (let ((help-form (substitute-command-keys "\
 Type `y' to skip this revision,
 `N' to include it and go on to the next revision,
 `n' to not skip, but continue to search this log entry for skip regexps,
-`q' to quit merging."))
+`q' to quit merging.")))
                     (pcase (save-excursion
                             (read-char-choice
                              (format "%s: Skip (y/n/N/q/%s)? " str
diff --git a/admin/notes/unicode b/admin/notes/unicode
index ebec417..079173f 100644
--- a/admin/notes/unicode
+++ b/admin/notes/unicode
@@ -226,7 +226,6 @@ nontrivial changes to the build process.
        lisp/leim/quail/japanese.el
        lisp/leim/quail/py-punct.el
        lisp/leim/quail/pypunct-b5.el
-       lisp/term/x-win.el
 
      This file contains just Chinese characters, and has same problem.
      Also, it contains characters that cannot be encoded in UTF-8.
diff --git a/admin/unidata/makefile.w32-in b/admin/unidata/makefile.w32-in
deleted file mode 100644
index 0e9b9f0..0000000
--- a/admin/unidata/makefile.w32-in
+++ /dev/null
@@ -1,56 +0,0 @@
-# makefile.w32-in -- W32 -*- Makefile -*- to generate character property 
tables.
-# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
-#   National Institute of Advanced Industrial Science and Technology (AIST)
-#   Registration Number H13PRO009
-#
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-EMACS = ../../src/$(BLD)/emacs.exe
-DSTDIR = ../../lisp/international
-lisp = $(CURDIR)/../../lisp
-# EMACSLOADPATH should include international, so Emacs finds encoded-kb.
-# It should include emacs-lisp, so Emacs finds bytecomp.  This is because
-# lisp/subdirs.el is not generated yet when the commands below run.
-EMACSLOADPATH = $(lisp);$(lisp)/international;$(lisp)/emacs-lisp
-# Quote EMACS so it could be a file name with embedded whitespace
-RUNEMACS = "$(EMACS)" -Q -batch
-
-all: $(DSTDIR)/charprop.el
-
-.el.elc:
-       $(RUNEMACS) -f batch-byte-compile $<
-
-unidata.txt: UnicodeData.txt
-       sed -e \
-         $(ARGQUOTE)s/\([^;]*\);\(.*\)/(#x\1 $(DQUOTE)\2$(DQUOTE))/$(ARGQUOTE)\
-         -e $(ARGQUOTE)s/;/$(DQUOTE) $(DQUOTE)/g$(ARGQUOTE) < UnicodeData.txt 
> $@
-
-charprop-SH: unidata-gen.elc unidata.txt
-       ELC=$(CURDIR)/unidata-gen.elc; \
-       DATADIR=$(CURDIR); \
-       DATA=unidata.txt; \
-       cd $(DSTDIR); \
-         $(RUNEMACS) --load $${ELC} -f unidata-gen-files $${DATADIR} $${DATA}
-
-charprop-CMD: unidata-gen.elc unidata.txt
-       $(RUNEMACS) --eval $(ARGQUOTE)(cd 
$(DQUOTE)$(DSTDIR)$(DQUOTE))$(ARGQUOTE) --load $(CURDIR)/unidata-gen.elc -f 
unidata-gen-files $(CURDIR) unidata.txt
-
-${DSTDIR}/charprop.el: charprop-$(SHELLTYPE)
-
-clean:
-       - $(DEL) unidata-gen.elc unidata.txt
-
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el
index 583d492..8d3f5b7 100644
--- a/admin/unidata/unidata-gen.el
+++ b/admin/unidata/unidata-gen.el
@@ -445,7 +445,7 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' 
(None)."
        ;; (4) possibly update the switch cases in
        ;;     bidi.c:bidi_get_type and bidi.c:bidi_get_category.
        (bidi-warning "\
-** Found new bidi-class '%s', please update bidi.c and dispextern.h")
+** Found new bidi-class ‘%s’, please update bidi.c and dispextern.h")
        tail elt range val val-code idx slot
        prev-range-data)
     (setq val-list (cons nil (copy-sequence val-list)))
diff --git a/admin/unidata/uvs.el b/admin/unidata/uvs.el
index a6beac9..8d3ffe2 100644
--- a/admin/unidata/uvs.el
+++ b/admin/unidata/uvs.el
@@ -114,7 +114,7 @@ The most significant byte comes first."
   "Insert VALUES for FIELDS as a sequence of bytes to the current buffer.
 VALUES and FIELDS are lists of integers and field symbols,
 respectively.  Byte length of each value is determined by the
-'uvs-field-size' property of the corresponding field."
+`uvs-field-size' property of the corresponding field."
   (while fields
     (let ((field (car fields))
          (value (car values)))
diff --git a/build-aux/gitlog-to-emacslog b/build-aux/gitlog-to-emacslog
index 4fec4de..51ef2a7 100755
--- a/build-aux/gitlog-to-emacslog
+++ b/build-aux/gitlog-to-emacslog
@@ -77,7 +77,7 @@ test -d .git || {
 # Maybe we should skip all "Merge branch 'master'" messages.
 # See eg the cairo-related ones.
 ./build-aux/gitlog-to-changelog \
-    --ignore-matching="^; |^Merge branch 'master' of 
git\.(savannah|sv)\.gnu\.org:/srv/git/emacs$" \
+    --ignore-matching="^; |^Merge branch 'master' of 
git\.(savannah|sv)\.gnu\.org:/srv/git/emacs$|^Merge remote-tracking branch 
'.*'$" \
   --ignore-line='^; ' --format='%B' \
   "$gen_origin..$new_origin" >"ChangeLog.tmp" || exit
 
diff --git a/configure.ac b/configure.ac
index f291a60..c57131f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -365,7 +365,7 @@ 
AC_ARG_WITH([file-notification],[AS_HELP_STRING([--with-file-notification=LIB],
     * ) AC_MSG_ERROR(['--with-file-notification=$withval' is invalid;
 this option's value should be 'yes', 'no', 'gfile', 'inotify' or 'w32'.
 'yes' is a synonym for 'w32' on MS-Windows, for 'no' on Nextstep,
-otherwise for the first of 'gfile' or 'inotify' that is usable.])
+otherwise for the first of 'inotify' or 'gfile' that is usable.])
     ;;
    esac
    with_file_notification=$val
@@ -2713,7 +2713,7 @@ NOTIFY_SUMMARY=no
 
 dnl FIXME?  Don't auto-detect on NS, but do allow someone to specify
 dnl a particular library.  This doesn't make much sense?
-if test "${HAVE_ns}" = yes && test ${with_file_notification} = yes; then
+if test "${HAVE_NS}" = yes && test ${with_file_notification} = yes; then
   with_file_notification=no
 fi
 
@@ -2733,22 +2733,7 @@ case $with_file_notification,$opsys in
     fi ;;
 esac
 
-dnl g_file_monitor exists since glib 2.18.  G_FILE_MONITOR_EVENT_MOVED
-dnl has been added in glib 2.24.  It has been tested under
-dnl GNU/Linux only.  We take precedence over inotify, but this makes
-dnl only sense when glib has been compiled with inotify support.  How
-dnl to check?
-case $with_file_notification,$NOTIFY_OBJ in
-  gfile, | yes,)
-    EMACS_CHECK_MODULES([GFILENOTIFY], [gio-2.0 >= 2.24])
-    if test "$HAVE_GFILENOTIFY" = "yes"; then
-       AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.])
-       NOTIFY_OBJ=gfilenotify.o
-       NOTIFY_SUMMARY="yes -lgio (gfile)"
-    fi ;;
-esac
-
-dnl inotify is only available on GNU/Linux.
+dnl inotify is available only on GNU/Linux.
 case $with_file_notification,$NOTIFY_OBJ in
   inotify, | yes,)
     AC_CHECK_HEADER(sys/inotify.h)
@@ -2762,6 +2747,19 @@ case $with_file_notification,$NOTIFY_OBJ in
     fi ;;
 esac
 
+dnl g_file_monitor exists since glib 2.18.  G_FILE_MONITOR_EVENT_MOVED
+dnl has been added in glib 2.24.  It has been tested under
+dnl GNU/Linux only.
+case $with_file_notification,$NOTIFY_OBJ in
+  gfile,* | yes,)
+    EMACS_CHECK_MODULES([GFILENOTIFY], [gio-2.0 >= 2.24])
+    if test "$HAVE_GFILENOTIFY" = "yes"; then
+       AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.])
+       NOTIFY_OBJ=gfilenotify.o
+       NOTIFY_SUMMARY="yes -lgio (gfile)"
+    fi ;;
+esac
+
 case $with_file_notification,$NOTIFY_OBJ in
   yes,* | no,* | *,?*) ;;
   *) AC_MSG_ERROR([File notification '$with_file_notification' requested but 
requirements not found.]) ;;
@@ -4595,12 +4593,11 @@ if test $emacs_cv_func_sigsetjmp = yes; then
     [Define to 1 if sigsetjmp and siglongjmp work.])
 fi
 
-# We need all of these features to handle C stack overflows.
-if test "$emacs_cv_func_sigsetjmp" = "yes" &&
-   test "$emacs_cv_alternate_stack" = yes; then
-  AC_DEFINE([HAVE_STACK_OVERFLOW_HANDLING], 1,
-    [Define to 1 if C stack overflow can be handled in some cases.])
-fi
+case $emacs_cv_func_sigsetjmp,$emacs_cv_alternate_stack,$opsys in
+  yes,yes,* | *,*,mingw32)
+    AC_DEFINE([HAVE_STACK_OVERFLOW_HANDLING], 1,
+      [Define to 1 if C stack overflow can be handled in some cases.]);;
+esac
 
 case $opsys in
   sol2* | unixware )
diff --git a/doc/emacs/cal-xtra.texi b/doc/emacs/cal-xtra.texi
index f271be1..ed85045 100644
--- a/doc/emacs/cal-xtra.texi
+++ b/doc/emacs/cal-xtra.texi
@@ -194,14 +194,14 @@ can do this as follows:
 
   Many holidays occur on a specific day of the week, at a specific time
 of month.  Here is a holiday form describing Hurricane Supplication Day,
-celebrated in the Virgin Islands on the fourth Monday in August:
+celebrated in the Virgin Islands on the fourth Monday in July:
 
 @smallexample
-(holiday-float 8 1 4 "Hurricane Supplication Day")
+(holiday-float 7 1 4 "Hurricane Supplication Day")
 @end smallexample
 
 @noindent
-Here the 8 specifies August, the 1 specifies Monday (Sunday is 0,
+Here the 7 specifies July, the 1 specifies Monday (Sunday is 0,
 Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in
 the month (1 specifies the first occurrence, 2 the second occurrence,
 @minus{}1 the last occurrence, @minus{}2 the second-to-last occurrence, and
diff --git a/doc/emacs/calendar.texi b/doc/emacs/calendar.texi
index 6b21dda..e9c8b73 100644
--- a/doc/emacs/calendar.texi
+++ b/doc/emacs/calendar.texi
@@ -177,10 +177,13 @@ repeat count indicating how many weeks, months, or years 
to move
 backward or forward.
 
 @vindex calendar-week-start-day
address@hidden calendar-weekend-days
 @cindex weeks, which day they start on
 @cindex calendar, first day of week
   By default, weeks begin on Sunday.  To make them begin on Monday
-instead, set the variable @code{calendar-week-start-day} to 1.
+instead, set the variable @code{calendar-week-start-day} to 1.  To
+change which day headers are highlighted as weekend days, set the
+variable @code{calendar-weekend-days}.
 
 @node Specified Dates
 @subsection Specified Dates
diff --git a/doc/emacs/makefile.w32-in b/doc/emacs/makefile.w32-in
deleted file mode 100644
index 99da4ab..0000000
--- a/doc/emacs/makefile.w32-in
+++ /dev/null
@@ -1,153 +0,0 @@
-#### -*- Makefile -*- for the Emacs Manual
-
-# Copyright (C) 2003-2015 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-# Where to find the source code.  The source code for Emacs's C kernel is
-# expected to be in $(srcdir)/src, and the source code for Emacs's
-# utility programs is expected to be in $(srcdir)/lib-src.  This is
-# set by the configure script's '--srcdir' option.
-srcdir=.
-
-infodir = $(srcdir)/../../info
-
-# The makeinfo program is part of the Texinfo distribution.
-MAKEINFO = makeinfo
-MAKEINFO_OPTS = --force --enable-encoding -I$(srcdir)
-MULTI_INSTALL_INFO = $(srcdir)\..\..\nt\multi-install-info.bat
-INFO_EXT=.info
-INFO_OPTS=--no-split
-INFO_TARGETS = $(infodir)/emacs$(INFO_EXT)
-DVI_TARGETS =  emacs.dvi
-INFOSOURCES = info.texi
-
-# The following rule does not work with all versions of 'make'.
-.SUFFIXES: .texi .dvi
-.texi.dvi:
-       texi2dvi $<
-
-TEXI2DVI = texi2dvi
-ENVADD = $(srcdir)\..\..\nt\envadd.bat "TEXINPUTS=$(srcdir);$(TEXINPUTS)" \
-        "MAKEINFO=$(MAKEINFO) $(MAKEINFO_OPTS)" /C
-
-EMACS_XTRA=\
-       $(srcdir)/arevert-xtra.texi \
-       $(srcdir)/cal-xtra.texi \
-       $(srcdir)/dired-xtra.texi \
-       $(srcdir)/picture-xtra.texi \
-       $(srcdir)/emerge-xtra.texi \
-       $(srcdir)/vc-xtra.texi \
-       $(srcdir)/vc1-xtra.texi \
-       $(srcdir)/fortran-xtra.texi \
-       $(srcdir)/msdos-xtra.texi
-
-EMACSSOURCES= \
-       $(srcdir)/emacs.texi \
-       $(srcdir)/emacsver.texi \
-       $(srcdir)/doclicense.texi \
-       $(srcdir)/screen.texi \
-       $(srcdir)/commands.texi \
-       $(srcdir)/entering.texi \
-       $(srcdir)/basic.texi \
-       $(srcdir)/mini.texi \
-       $(srcdir)/m-x.texi \
-       $(srcdir)/help.texi \
-       $(srcdir)/mark.texi \
-       $(srcdir)/killing.texi \
-       $(srcdir)/regs.texi \
-       $(srcdir)/display.texi \
-       $(srcdir)/search.texi \
-       $(srcdir)/fixit.texi \
-       $(srcdir)/files.texi \
-       $(srcdir)/buffers.texi \
-       $(srcdir)/windows.texi \
-       $(srcdir)/frames.texi \
-       $(srcdir)/mule.texi \
-       $(srcdir)/modes.texi \
-       $(srcdir)/indent.texi \
-       $(srcdir)/text.texi \
-       $(srcdir)/programs.texi \
-       $(srcdir)/building.texi \
-       $(srcdir)/maintaining.texi \
-       $(srcdir)/abbrevs.texi \
-       $(srcdir)/sending.texi \
-       $(srcdir)/rmail.texi \
-       $(srcdir)/dired.texi \
-       $(srcdir)/calendar.texi \
-       $(srcdir)/misc.texi \
-       $(srcdir)/package.texi \
-       $(srcdir)/custom.texi \
-       $(srcdir)/trouble.texi \
-       $(srcdir)/cmdargs.texi \
-       $(srcdir)/xresources.texi \
-       $(srcdir)/anti.texi \
-       $(srcdir)/macos.texi \
-       $(srcdir)/msdos.texi \
-       $(srcdir)/gnu.texi \
-       $(srcdir)/glossary.texi \
-       $(srcdir)/ack.texi \
-       $(srcdir)/kmacro.texi \
-       $(EMACS_XTRA)
-
-info: $(INFO_TARGETS)
-
-dvi: $(DVI_TARGETS)
-
-# Note that all the Info targets build the Info files
-# in srcdir.  There is no provision for Info files
-# to exist in the build directory.
-# In a distribution of Emacs, the Info files should be up to date.
-
-$(infodir)/dir:
-       $(MULTI_INSTALL_INFO) --info-dir=$(infodir) $(INFO_TARGETS)
-
-$(infodir)/emacs$(INFO_EXT): $(EMACSSOURCES)
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ emacs.texi
-
-emacs.dvi: $(EMACSSOURCES)
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs.texi
-
-emacs.html: $(EMACSSOURCES)
-       $(MAKEINFO) $(MAKEINFO_OPTS) --html -o $@ emacs.texi
-
-emacs-xtra.dvi: emacs-xtra.texi $(EMACS_XTRA)
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-xtra.texi
-
-mostlyclean:
-       - $(DEL) *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.*
-
-## FIXME $(infodir)/emacs* deletes too much, eg emacs-mime.
-clean: mostlyclean
-       - $(DEL) *.dvi
-       - $(DEL) $(infodir)/emacs*
-       - $(DEL_TREE) emacs.html
-
-distclean: clean
-       - $(DEL) makefile
-
-maintainer-clean: distclean
-       - $(DEL) *.aux *.cps *.fns *.kys *.pgs *.vrs *.toc
-# Don't delete these, because they are outside the current directory.
-#      for file in $(INFO_TARGETS); do rm -f $${file}*; done
-
-
-# Formerly this directory had texindex.c and getopt.c in it
-# and this makefile built them to make texindex.
-# That caused trouble because this is run entirely in the source directory.
-# Since we expect to get texi2dvi from elsewhere,
-# it is ok to expect texindex from elsewhere also.
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 20996c2..db096c7 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1675,6 +1675,7 @@ precedence.
 
 @cindex client frame
 @item -c
address@hidden --create-frame
 Create a new graphical @dfn{client frame}, instead of using an
 existing Emacs frame.  See below for the special behavior of @kbd{C-x
 C-c} in a client frame.  If Emacs cannot create a new graphical frame
@@ -2688,7 +2689,7 @@ character.  Keep dissociwords out of your documentation, 
if you want
 it to be well userenced and properbose.
 
 @findex dunnet
-  @kbd{M-x dunnet} runs an text-based adventure game.
+  @kbd{M-x dunnet} runs a text-based adventure game.
 
 @findex gomoku
 @cindex Go Moku
diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi
index e79561a..d442f85 100644
--- a/doc/emacs/modes.texi
+++ b/doc/emacs/modes.texi
@@ -435,7 +435,8 @@ compares the text at the start of the buffer to the variable
 @code{magic-mode-alist}, described above, except that is consulted
 only after @code{auto-mode-alist}.  By default,
 @code{magic-fallback-mode-alist} contains forms that check for image
-files, HTML/XML/SGML files, and PostScript files.
+files, HTML/XML/SGML files, PostScript files, and Unix style Conf
+files.
 
 @findex normal-mode
   If you have changed the major mode of a buffer, you can return to
diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi
index 5a166d1..477f24e 100644
--- a/doc/emacs/mule.texi
+++ b/doc/emacs/mule.texi
@@ -539,6 +539,8 @@ searching for what you have already entered.
   To find out how to input the character after point using the current
 input method, type @kbd{C-u C-x =}.  @xref{Position Info}.
 
address@hidden TODO: document complex-only/default/t of
address@hidden @code{input-method-verbose-flag}
 @vindex input-method-verbose-flag
 @vindex input-method-highlight-flag
   The variables @code{input-method-highlight-flag} and
@@ -1733,9 +1735,13 @@ internal representation within Emacs.
 @findex list-character-sets
   @kbd{M-x list-character-sets} displays a list of all supported
 charsets.  The list gives the names of charsets and additional
-information to identity each charset; see the
address@hidden://www.itscj.ipsj.or.jp/ISO-IR/, International Register of
-Coded Character Sets} for more details.  In this list,
+information to identity each charset; for more details, see the
address@hidden://www.itscj.ipsj.or.jp/itscj_english/iso-ir/ISO-IR.pdf,
+ISO International Register of Coded Character Sets to be Used with
+Escape Sequences (ISO-IR)} maintained by
+the @url{https://www.itscj.ipsj.or.jp/itscj_english/,
+Information Processing Society of Japan/Information Technology
+Standards Commission of Japan (IPSJ/ITSCJ)}.  In this list,
 charsets are divided into two categories: @dfn{normal charsets} are
 listed first, followed by @dfn{supplementary charsets}.  A
 supplementary charset is one that is used to define another charset
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 2eb999d..8f78a1a 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -814,7 +814,8 @@ opening delimiter and closing delimiter are 
mismatched---such as in
 @code{blink-matching-paren} turns the feature on or off: @code{nil}
 disables it, but the default is @code{t} to enable it.  Set it to
 @code{jump} to make indication work by momentarily moving the cursor
-to the matching opening delimiter.
+to the matching opening delimiter.  Set it to @code{jump-offscreen} to
+make the cursor jump, even if the opening delimiter is off screen.
 
 @item
 @code{blink-matching-delay} says how many seconds to keep indicating
diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi
index dc53c3b..fd48f34 100644
--- a/doc/emacs/regs.texi
+++ b/doc/emacs/regs.texi
@@ -151,7 +151,7 @@ during the collection process, you can use the following 
setting.
   @kbd{C-x r i @var{r}} inserts in the buffer the text from register
 @var{r}.  Normally it leaves point after the text and sets the mark
 before, without activating it.  With a numeric argument, it instead
-puts before after the text and the mark after.
+puts point before the text and the mark after.
 
 @node Rectangle Registers
 @section Saving Rectangles in Registers
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index 3562f8a..34d4e8f 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -80,10 +80,10 @@ past the end of the next occurrence of those characters in 
the buffer.
 
   For instance, if you type @kbd{C-s} and then @kbd{F}, that puts the
 cursor after the first @samp{F} that occurs in the buffer after the
-starting point.  Then if you then type @kbd{O}, the cursor moves to
-just after the first @samp{FO}; the @samp{F} in that @samp{FO} might
-not be the first @samp{F} previously found.  After another @kbd{O},
-the cursor moves to just after the first @samp{FOO}.
+starting point.  If you then type @kbd{O}, the cursor moves to just
+after the first @samp{FO}; the @samp{F} in that @samp{FO} might not be
+the first @samp{F} previously found.  After another @kbd{O}, the
+cursor moves to just after the first @samp{FOO}.
 
 @cindex faces for highlighting search matches
 @cindex isearch face
@@ -227,11 +227,11 @@ special effects.
   By default, incremental search performs @dfn{lax space matching}:
 each space, or sequence of spaces, matches any sequence of one or more
 spaces in the text.  Hence, @samp{foo bar} matches @samp{foo bar},
address@hidden  bar}, @samp{foo   bar}, and so on (but not @samp{foobar}).
-More precisely, Emacs matches each sequence of space characters in the
-search string to a regular expression specified by the variable
address@hidden  For example, to make spaces match
-sequences of newlines as well as spaces, set it to
address@hidden@w{  }bar}, @address@hidden   }bar}, and so on (but not
address@hidden).  More precisely, Emacs matches each sequence of space
+characters in the search string to a regular expression specified by
+the variable @code{search-whitespace-regexp}.  For example, to make
+spaces match sequences of newlines as well as spaces, set it to
 @samp{"[[:space:]\n]+"}.
 
   To toggle lax space matching, type @kbd{M-s @key{SPC}}
diff --git a/doc/emacs/sending.texi b/doc/emacs/sending.texi
index b4bdb93..49a4aa7 100644
--- a/doc/emacs/sending.texi
+++ b/doc/emacs/sending.texi
@@ -568,8 +568,8 @@ was yanked, but it checks the text that you yourself 
inserted (it
 looks for indentation or @code{mail-yank-prefix} to distinguish the
 cited lines from your input).  @xref{Spelling}.
 
address@hidden mail-mode-hook
address@hidden mail-setup-hook
address@hidden message-mode-hook
address@hidden message-setup-hook
   Turning on Message mode (which @kbd{C-x m} does automatically) runs
 the normal hooks @code{text-mode-hook} and @code{message-mode-hook}.
 Initializing a new outgoing message runs the normal hook
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 5a13f20..31760b7 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -420,13 +420,11 @@ left and right single or double quotation marks @t{‘like 
this’} or
 @t{“like this”}.  Typewriter quotes are simple and portable; curved
 quotes are less ambiguous and typically look nicer.
 
-  Electric Quote mode makes it easier to type curved quotes.  It
-optionally converts a quotation's grave accent and apostrophe @t{`like
-this'} to single quotation marks @t{‘like this’}.  Similarly, it
-converts a quotation's double grave accent and double apostrophe
address@hidden this''} to double quotation marks @t{“like this”}.  These
-conversions are suppressed in buffers whose coding systems cannot
-represent curved quote characters.
+  Electric Quote mode makes it easier to type curved quotes.  As you
+type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’},
address@hidden to @t{“}, and @t{''} to @t{”}.  These conversions are
+suppressed in buffers whose coding systems cannot represent curved
+quote characters.
 
 @vindex electric-quote-paragraph
 @vindex electric-quote-comment
diff --git a/doc/lispintro/emacs-lisp-intro.texi 
b/doc/lispintro/emacs-lisp-intro.texi
index 183e68f..4406958 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -1240,6 +1240,10 @@ command to do something.  (Usually, of course, it is the 
last of these
 three things that you really want!)
 
 @c use code for the single apostrophe, not samp.
address@hidden quote
address@hidden @code{'} for quoting
address@hidden quoting using apostrophe
address@hidden apostrophe for quoting
 The single apostrophe, @code{'}, that I put in front of some of the
 example lists in preceding sections is called a @dfn{quote}; when it
 precedes a list, it tells Lisp to do nothing with the list, other than
@@ -2840,10 +2844,10 @@ following more complex expression:
 @c noindent
 In this case, the first argument to @code{other-buffer} tells it which
 buffer to skip---the current one---and the second argument tells
address@hidden it is OK to switch to a visible buffer.
-In regular use, @code{switch-to-buffer} takes you to an invisible
-window since you would most likely use @kbd{C-x o} (@code{other-window})
-to go to another visible buffer.}
address@hidden it is OK to switch to a visible buffer.  In
+regular use, @code{switch-to-buffer} takes you to a buffer not visible
+in windows since you would most likely use @kbd{C-x o}
+(@code{other-window}) to go to another visible buffer.}
 
 In the programming examples in later sections of this document, you will
 see the function @code{set-buffer} more often than
@@ -2909,7 +2913,7 @@ the following expression in the usual way:
 @end smallexample
 
 @noindent
-As I write this, the value of @code{point} is 65724.  The @code{point}
+As I write this, the value of point is 65724.  The @code{point}
 function is frequently used in some of the examples later in this
 book.
 
@@ -3227,6 +3231,7 @@ function, @code{multiply-by-seven}.  When you do this, a
 @smallexample
 @group
 multiply-by-seven is a Lisp function.
+
 (multiply-by-seven NUMBER)
 
 Multiply NUMBER by seven.
@@ -4152,8 +4157,8 @@ On the other hand, this function returns @code{nil} if 
the test is false.
 @section @code{save-excursion}
 @findex save-excursion
 @cindex Region, what it is
address@hidden Preserving point, mark, and buffer
address@hidden Point, mark, buffer preservation
address@hidden Preserving point and buffer
address@hidden Point and buffer preservation
 @findex point
 @findex mark
 
@@ -4202,7 +4207,7 @@ region}.  Numerous commands work on the region, including
 @code{center-region}, @code{count-lines-region}, @code{kill-region}, and
 @code{print-region}.
 
-The @code{save-excursion} special form saves the locations of point and
+The @code{save-excursion} special form saves the location of point and
 restores this position after the code within the body of the
 special form is evaluated by the Lisp interpreter.  Thus, if point were
 in the beginning of a piece of text and some code moved point to the end
@@ -4250,7 +4255,7 @@ one expression in the body, the value of the last one 
will be returned
 as the value of the @code{save-excursion} function.  The other
 expressions in the body are evaluated only for their side effects; and
 @code{save-excursion} itself is used only for its side effect (which
-is restoring the positions of point and mark).
+is restoring the position of point).
 
 @need 1250
 In more detail, the template for a @code{save-excursion} expression
diff --git a/doc/lispintro/makefile.w32-in b/doc/lispintro/makefile.w32-in
deleted file mode 100644
index 12e3a43..0000000
--- a/doc/lispintro/makefile.w32-in
+++ /dev/null
@@ -1,85 +0,0 @@
-#### -*- Makefile -*- for the Emacs Lisp Introduction manual.
-
-# Copyright (C) 2003-2015 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-srcdir = .
-
-infodir = $(srcdir)/../../info
-# Directory with the (customized) texinfo.tex file.
-texinfodir = $(srcdir)/../misc
-# Directory with emacsver.texi.
-emacsdir = $(srcdir)/../emacs
-
-INFO_EXT=.info
-INFO_OPTS=--no-split -I$(emacsdir)
-INFO_SOURCES = $(srcdir)/emacs-lisp-intro.texi $(emacsdir)/emacsver.texi \
-  $(srcdir)/doclicense.texi
-# The file name eintr must fit within 5 characters, to allow for
-# -NN extensions to fit into DOS 8+3 limits without clashing
-INFO_TARGETS = $(infodir)/eintr$(INFO_EXT)
-DVI_TARGETS = emacs-lisp-intro.dvi
-
-MAKEINFO = makeinfo
-INSTALL_INFO = install-info
-TEXI2DVI = texi2dvi
-TEXI2PDF = texi2pdf
-DVIPS = dvips
-ENVADD = $(srcdir)\..\..\nt\envadd.bat \
-        "TEXINPUTS=$(srcdir);$(texinfodir);$(emacsdir);$(TEXINPUTS)" \
-        "MAKEINFO=$(MAKEINFO) -I$(srcdir) -I$(emacsdir) -I$(texinfodir)" /C
-
-.SUFFIXES: .dvi .ps .texi
-
-info: $(INFO_TARGETS)
-
-$(infodir)/dir:
-       $(INSTALL_INFO) --info-dir=$(infodir) $(INFO_TARGETS)
-
-dvi: $(DVI_TARGETS)
-
-$(infodir)/eintr$(INFO_EXT): $(INFO_SOURCES)
-       $(MAKEINFO) $(INFO_OPTS) -o $@ $(srcdir)/emacs-lisp-intro.texi
-
-emacs-lisp-intro.dvi: $(INFO_SOURCES)
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-lisp-intro.texi
-
-emacs-lisp-intro.pdf: $(INFO_SOURCES)
-       $(ENVADD) $(TEXI2PDF) $(srcdir)/emacs-lisp-intro.texi
-
-emacs-lisp-intro.html: $(INFO_SOURCES)
-       $(MAKEINFO) --html -o $@ $(srcdir)/emacs-lisp-intro.texi
-
-.dvi.ps:
-       $(DVIPS) $< -o $@
-
-mostlyclean:
-       - $(DEL) *.log *.cp *.fn *.ky *.pg *.vr *.tp
-
-clean: mostlyclean
-       - $(DEL) *.dvi $(infodir)/eintr$(INFO_EXT)*
-
-distclean: clean
-       - $(DEL) makefile
-
-maintainer-clean: distclean
-       - $(DEL) *.aux *.cps *.fns *.kys *.pgs *.vrs *.toc
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index aec7674..5930540 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -211,7 +211,7 @@ argument.
 
 The prompt string can use @samp{%} to include previous argument values
 (starting with the first argument) in the prompt.  This is done using
address@hidden (@pxref{Formatting Strings}).  For example, here is how
address@hidden (@pxref{Formatting Strings}).  For example, here is how
 you could read the name of an existing buffer followed by a new name to
 give to that buffer:
 
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index fb2e1bc..421f5cc 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -372,7 +372,7 @@ More specifically, a Q-pattern can take the following forms:
 @table @code
 @item (@var{qpattern1} . @var{qpattern2})
 This pattern matches any cons cell whose @code{car} matches @var{qpattern1} and
-whose @code{cdr} matches @var{pattern2}.
+whose @code{cdr} matches @var{qpattern2}.
 @item address@hidden @var{qpattern2} @dots{} @var{qpatternm}]
 This pattern matches a vector of length @var{M} whose 0..(@var{M}-1)th
 elements match @var{qpattern1}, @var{qpattern2} @dots{} @var{qpatternm},
@@ -990,7 +990,7 @@ should not end with any sort of punctuation.
 
 @defun error format-string &rest args
 This function signals an error with an error message constructed by
-applying @code{format} (@pxref{Formatting Strings}) to
+applying @code{format-message} (@pxref{Formatting Strings}) to
 @var{format-string} and @var{args}.
 
 These examples show typical uses of @code{error}:
@@ -1009,7 +1009,7 @@ These examples show typical uses of @code{error}:
 
 @code{error} works by calling @code{signal} with two arguments: the
 error symbol @code{error}, and a list containing the string returned by
address@hidden
address@hidden
 
 @strong{Warning:} If you want to use your own string as an error message
 verbatim, don't just write @code{(error @var{string})}.  If @var{string}
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 9e9f8e3..36404f4 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -247,7 +247,7 @@ messages in the echo area.
 @defun message format-string &rest arguments
 This function displays a message in the echo area.
 @var{format-string} is a format string, and @var{arguments} are the
-objects for its format specifications, like in the @code{format}
+objects for its format specifications, like in the @code{format-message}
 function (@pxref{Formatting Strings}).  The resulting formatted string
 is displayed in the echo area; if it contains @code{face} text
 properties, it is displayed with the specified faces (@pxref{Faces}).
@@ -375,7 +375,7 @@ reporting very fast.
 When this progress reporter is subsequently used, it will display
 @var{message} in the echo area, followed by progress percentage.
 @var{message} is treated as a simple string.  If you need it to depend
-on a filename, for instance, use @code{format} before calling this
+on a filename, for instance, use @code{format-message} before calling this
 function.
 
 The arguments @var{min-value} and @var{max-value} should be numbers
@@ -1897,9 +1897,9 @@ to or less than the display width of @var{ellipsis}.  If
 
 The following function returns the size in pixels of text as if it were
 displayed in a given window.  This function is used by
address@hidden (@pxref{Resizing Windows}) and
address@hidden (@pxref{Size and Position}) to make a window
-exactly as large as the text it contains.
address@hidden and @code{fit-frame-to-buffer}
+(@pxref{Resizing Windows}) to make a window exactly as large as the text
+it contains.
 
 @defun window-text-pixel-size &optional window from to x-limit y-limit 
mode-and-header-line
 This function returns the size of the text of @var{window}'s buffer in
@@ -1952,12 +1952,12 @@ height of both, if present, in the return value.
 contents of the line, plus optional additional vertical line spacing
 above or below the display line.
 
-  The height of the line contents is the maximum height of any
-character or image on that display line, including the final newline
-if there is one.  (A display line that is continued doesn't include a
-final newline.)  That is the default line height, if you do nothing to
-specify a greater height.  (In the most common case, this equals the
-height of the default frame font.)
+  The height of the line contents is the maximum height of any character
+or image on that display line, including the final newline if there is
+one.  (A display line that is continued doesn't include a final
+newline.)  That is the default line height, if you do nothing to specify
+a greater height.  (In the most common case, this equals the height of
+the corresponding frame's default font, see @ref{Frame Font}.)
 
   There are several ways to explicitly specify a larger line height,
 either by specifying an absolute height for the display line, or by
@@ -5406,12 +5406,11 @@ This removes only images that were put into 
@var{buffer} the way
 @cindex size of image
 This function returns the size of an image as a pair
 @address@hidden(@var{width} . @var{height})}}.  @var{spec} is an image
-specification.  @var{pixels} address@hidden means return sizes
-measured in pixels, otherwise return sizes measured in canonical
-character units (fractions of the width/height of the frame's default
-font).  @var{frame} is the frame on which the image will be displayed.
address@hidden null or omitted means use the selected frame (@pxref{Input
-Focus}).
+specification.  @var{pixels} address@hidden means return sizes measured
+in pixels, otherwise return sizes measured in the default character size
+of @var{frame} (@pxref{Frame Font}).  @var{frame} is the frame on which
+the image will be displayed.  @var{frame} null or omitted means use the
+selected frame (@pxref{Input Focus}).
 @end defun
 
 @defvar max-image-size
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index a32c69c..9044fba 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -1041,6 +1041,7 @@ Frames
 
 * Creating Frames::         Creating additional frames.
 * Multiple Terminals::      Displaying on several different devices.
+* Frame Geometry::          Geometric properties of frames.
 * Frame Parameters::        Controlling frame size, position, font, etc.
 * Terminal Parameters::     Parameters common for all frames on terminal.
 * Frame Titles::            Automatic updating of frame titles.
@@ -1064,12 +1065,18 @@ Frames
 * Resources::               Getting resource values from the server.
 * Display Feature Testing:: Determining the features of a terminal.
 
+Frame Geometry
+
+* Frame Layout::            Basic layout of frames.
+* Frame Font::              The default font of a frame and how to set it.
+* Size and Position::       Changing the size and position of a frame.
+* Implied Frame Resizing::  Implied resizing of frames and how to prevent it.
+
 Frame Parameters
 
 * Parameter Access::        How to change a frame's parameters.
 * Initial Parameters::      Specifying frame parameters when you make a frame.
 * Window Frame Parameters:: List of frame parameters for window systems.
-* Size and Position::       Changing the size and position of a frame.
 * Geometry::                Parsing geometry specifications.
 
 Window Frame Parameters
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 79b5172..65eeec6 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -80,6 +80,7 @@ for @code{framep} above.
 @menu
 * Creating Frames::             Creating additional frames.
 * Multiple Terminals::          Displaying on several different devices.
+* Frame Geometry::              Geometric properties of frames.
 * Frame Parameters::            Controlling frame size, position, font, etc.
 * Terminal Parameters::         Parameters common for all frames on terminal.
 * Frame Titles::                Automatic updating of frame titles.
@@ -416,6 +417,545 @@ This function returns the attributes of the physical 
monitor
 dominating (see above) @var{frame}, which defaults to the selected frame.
 @end defun
 
+
address@hidden Frame Geometry
address@hidden Frame Geometry
address@hidden frame geometry
address@hidden frame position
address@hidden position of frame
address@hidden frame size
address@hidden size of frame
+
+The geometry of a frame depends on the toolkit that was used to build
+this instance of Emacs and the terminal that displays the frame.  This
+chapter describes these dependencies and some of the functions to deal
+with them.  Note that the @var{frame} argument of all of these functions
+has to specify a live frame (@pxref{Deleting Frames}).  If omitted or
address@hidden, it specifies the selected frame (@pxref{Input Focus}).
+
address@hidden
+* Frame Layout::            Basic layout of frames.
+* Frame Font::              The default font of a frame and how to set it.
+* Size and Position::       Changing the size and position of a frame.
+* Implied Frame Resizing::  Implied resizing of frames and how to prevent it.
address@hidden menu
+
+
address@hidden Frame Layout
address@hidden Frame Layout
address@hidden frame layout
address@hidden layout of frame
+
+The drawing below sketches the layout of a frame on a graphical
+terminal:
address@hidden
address@hidden
+
+        <------------ Outer Frame Width ----------->
+        ___________________________________________
+     ^(0)  ___________ External Border __________   |
+     | |  |_____________ Title Bar ______________|  |
+     | | (1)_____________ Menu Bar ______________|  | ^
+     | | (2)_____________ Tool Bar ______________|  | ^
+     | | (3) _________ Internal Border ________  |  | ^
+     | |  | |   ^                              | |  | |
+     | |  | |   |                              | |  | |
+Outer  |  | | Inner                            | |  | Native
+Frame  |  | | Frame                            | |  | Frame
+Height |  | | Height                           | |  | Height
+     | |  | |   |                              | |  | |
+     | |  | |<--+--- Inner Frame Width ------->| |  | |
+     | |  | |   |                              | |  | |
+     | |  | |___v______________________________| |  | |
+     | |  |___________ Internal Border __________|  | v
+     v |______________ External Border _____________|
+           <-------- Native Frame Width -------->
+
address@hidden group
address@hidden smallexample
+
+In practice not all of the areas shown in the drawing will or may be
+present.  The meaning of these areas is:
+
address@hidden @samp
address@hidden Outer Frame
address@hidden outer frame
address@hidden outer edges
address@hidden outer width
address@hidden outer height
+The @dfn{outer frame} is a rectangle comprising all areas shown in the
+drawing.  The edges of that rectangle are called the @dfn{outer edges}
+of the frame.  The @dfn{outer width} and @dfn{outer height} of the frame
+specify the size of that rectangle.
+
address@hidden outer position
+The upper left corner of the outer frame (indicated by ``(0)'' in the
+drawing above) is the @dfn{outer position} or the frame.  It is
+specified by and settable via the @code{left} and @code{top} frame
+parameters (@pxref{Position Parameters}) as well as the functions
address@hidden and @code{set-frame-position} (@pxref{Size and
+Position}).
+
address@hidden External Border
address@hidden external border
+The @dfn{external border} is part of the decorations supplied by the
+window manager.  It's typically used for resizing the frame with the
+mouse.  The external border is normally not shown on ``fullboth'' and
+maximized frames (@pxref{Size Parameters}) and doesn't exist for text
+terminal frames.
+
+   The external border should not be confused with the @dfn{outer
+border} specified by the @code{border-width} frame parameter
+(@pxref{Layout Parameters}).  Since the outer border is usually ignored
+on most platforms it is not covered here.
+
address@hidden Title Bar
address@hidden title bar
+The @dfn{title bar} is also part of the window manager's decorations and
+typically displays the title of the frame (@pxref{Frame Titles}) as well
+as buttons for minimizing, maximizing and deleting the frame.  The title
+bar is usually not displayed on ``fullboth'' (@pxref{Size Parameters})
+or tooltip frames.  Title bars don't exist for text terminal frames.
+
address@hidden Menu Bar
address@hidden internal menu bar
address@hidden external menu bar
+The menu bar (@pxref{Menu Bar}) can be either internal (drawn by Emacs
+itself) or external (drawn by a toolkit).  Most builds (GTK+, Lucid,
+Motif and Windows) rely on an external menu bar.  NS also uses an
+external menu bar which, however, is not part of the outer frame.
+Non-toolkit builds can provide an internal menu bar.  On text terminal
+frames, the menu bar is part of the frame's root window (@pxref{Windows
+and Frames}).
+
address@hidden Tool Bar
address@hidden internal tool bar
address@hidden external tool bar
+Like the menu bar, the tool bar (@pxref{Tool Bar}) can be either
+internal (drawn by Emacs itself) or external (drawn by a toolkit).  The
+GTK+ and NS builds have the tool bar drawn by the toolkit.  The
+remaining builds use internal tool bars.  With GTK+ the tool bar can be
+located on either side of the frame, immediately outside the internal
+border, see below.
+
address@hidden Native Frame
address@hidden native frame
address@hidden native edges
address@hidden native width
address@hidden native height
address@hidden display area
+The @dfn{native frame} is a rectangle located entirely within the outer
+frame.  It excludes the areas occupied by the external border, the title
+bar and any external menu or external tool bar.  The area enclosed by
+the native frame is sometimes also referred to as the @dfn{display area}
+of the frame.  The edges of the native frame are called the @dfn{native
+edges} of the frame.  The @dfn{native width} and @dfn{native height} of
+the frame specify the size of the rectangle.
+
address@hidden native position
+The top left corner of the native frame specifies the @dfn{native
+position} of the frame.  (1)--(3) in the drawing above indicate that
+position for the various builds:
+
address@hidden @w
address@hidden (1) non-toolkit and terminal frames
+
address@hidden (2) Lucid, Motif and Windows frames
+
address@hidden (3) GTK+ and NS frames
address@hidden itemize
+
+Accordingly, the native height of a frame includes the height of the
+tool bar but not that of the menu bar (Lucid, Motif, Windows) or those
+of the menu bar and the tool bar (non-toolkit and text terminal frames).
+
+The native position of a frame is the reference position of functions
+that set or return the current position of the mouse (@pxref{Mouse
+Position}) and for functions dealing with the position of windows like
address@hidden, @code{window-at} or @code{coordinates-in-window-p}
+(@pxref{Coordinates and Windows}).
+
address@hidden Internal Border
+The internal border (@pxref{Layout Parameters}) is a border drawn by
+Emacs around the inner frame (see below).
+
address@hidden Inner Frame
address@hidden inner frame
address@hidden inner edges
address@hidden inner width
address@hidden inner height
+The @dfn{inner frame} is the rectangle reserved for the frame's windows.
+It's enclosed by the internal border which, however, is not part of the
+inner frame.  Its edges are called the @dfn{inner edges} of the frame.
+The @dfn{inner width} and @dfn{inner height} specify the size of the
+rectangle.
+
address@hidden minibuffer-less frame
address@hidden minibuffer-only frame
+As a rule, the inner frame is subdivided into the frame's root window
+(@pxref{Windows and Frames}) and the frame's minibuffer window
+(@pxref{Minibuffer Windows}).  There are two notable exceptions to this
+rule: A @dfn{minibuffer-less frame} contains a root window only and does
+not contain a minibuffer window.  A @dfn{minibuffer-only frame} contains
+only a minibuffer window which also serves as that frame's root window.
+See @ref{Initial Parameters} for how to create such frame
+configurations.
+
address@hidden Text Area
address@hidden text area
+The @dfn{text area} of a frame is a somewhat fictitious area located
+entirely within the native frame.  It can be obtained by removing from
+the native frame any internal borders, one vertical and one horizontal
+scroll bar, and one left and one right fringe as specified for this
+frame, see @ref{Layout Parameters}.
address@hidden table
+
address@hidden absolute position
+The @dfn{absolute position} of a frame or its edges is usually given in
+terms of pixels counted from an origin at position (0, 0) of the frame's
+display.  Note that with multiple monitors the origin does not
+necessarily coincide with the top left corner of the entire usable
+display area.  Hence the absolute outer position of a frame or the
+absolute positions of the edges of the outer, native or inner frame can
+be negative in such an environment even when that frame is completely
+visible.
+
+  For a frame on a graphical terminal the following function returns the
+sizes of the areas described above:
+
address@hidden frame-geometry &optional frame
+This function returns geometric attributes of @var{frame}.  The return
+value is an association list of the attributes listed below.  All
+coordinate, height and width values are integers counting pixels.
+
address@hidden @code
address@hidden outer-position
+A cons of the absolute X- and Y-coordinates of the outer position of
address@hidden, relative to the origin at position (0, 0) of @var{frame}'s
+display.
+
address@hidden outer-size
+A cons of the outer width and height of @var{frame}.
+
address@hidden external-border-size
+A cons of the horizontal and vertical width of @var{frame}'s external
+borders as supplied by the window manager.  If the window manager
+doesn't supply these values, Emacs will try to guess them from the
+coordinates of the outer and inner frame.
+
address@hidden title-bar-size
+A cons of the width and height of the title bar of @var{frame} as
+supplied by the window manager or operating system.  If both of them are
+zero, the frame has no title bar.  If only the width is zero, Emacs was
+not able to retrieve the width information.
+
address@hidden menu-bar-external
+If address@hidden, this means the menu bar is external (not part of the
+native frame of @var{frame}).
+
address@hidden menu-bar-size
+A cons of the width and height of the menu bar of @var{frame}.
+
address@hidden tool-bar-external
+If address@hidden, this means the tool bar is external (not part of the
+native frame of @var{frame}).
+
address@hidden tool-bar-position
+This tells on which side the tool bar on @var{frame} is and can be one
+of @code{left}, @code{top}, @code{right} or @code{bottom}.  The only
+toolkit that currently supports a value other than @code{top} is GTK+.
+
address@hidden tool-bar-size
+A cons of the width and height of the tool bar of @var{frame}.
+
address@hidden internal-border-width
+The width of the internal border of @var{frame}.
address@hidden table
address@hidden defun
+
+The following function can be used to retrieve the edges of the outer,
+native and inner frame.
+
address@hidden frame-edges &optional frame type
+This function returns the edges of the outer, native or inner frame of
address@hidden  @var{frame} must be a live frame and defaults to the
+selected one.  The list returned has the form (@var{left} @var{top}
address@hidden @var{bottom}) where all values are in pixels relative to the
+position (0, 0) of @var{frame}'s display.  For terminal frames
address@hidden and @var{top} are both zero.
+
+Optional argument @var{type} specifies the type of the edges to return:
address@hidden @code{outer-edges} means to return the outer edges of
address@hidden, @code{native-edges} (or @code{nil}) means to return its
+native edges and @code{inner-edges} means to return its inner edges.
+
+Notice that the ``pixels at the positions'' @var{bottom} and @var{right}
+lie immediately outside the corresponding frame.  This means that if you
+have, for example, two side-by-side frames positioned such that the
+right outer edge of the frame on the left equals the left outer edge of
+the frame on the right, the pixels ``representing'' that edge are part
+of the frame on the right.
address@hidden defun
+
+
address@hidden Frame Font
address@hidden Frame Font
address@hidden default font
address@hidden default character size
address@hidden default character width
address@hidden default width of character
address@hidden default character height
address@hidden default height of character
+Each frame has a @dfn{default font} which specifies the default
+character size for that frame.  This size is meant when retrieving or
+changing the size of a frame in terms of ``columns'' or ``lines''
+(@pxref{Size Parameters}).  It is also used when resizing (@pxref{Window
+Sizes}) or splitting (@pxref{Splitting Windows}) windows.
+
address@hidden line height
address@hidden column width
+The term @dfn{line height} is sometimes used instead of ``default
+character height''.  Similarly, the term @dfn{column width} is used as
+shorthand for ``default character width''.
+
address@hidden frame-char-height &optional frame
address@hidden frame-char-width &optional frame
+These functions return the default height and width of a character in
address@hidden, measured in pixels.  Together, these values establish the
+size of the default font on @var{frame}.  The values depend on the
+choice of font for @var{frame}, see @ref{Font and Color Parameters}.
address@hidden defun
+
+The default font can be also set directly with the following function:
+
address@hidden Command set-frame-font font &optional keep-size frames
+This sets the default font to @var{font}.  When called interactively, it
+prompts for the name of a font, and uses that font on the selected
+frame.  When called from Lisp, @var{font} should be a font name (a
+string), a font object, font entity, or a font spec.
+
+If the optional argument @var{keep-size} is @code{nil}, this keeps the
+number of frame lines and columns fixed.  (If address@hidden, the option
address@hidden described in the next section will
+override this.)  If @var{keep-size} is address@hidden (or with a prefix
+argument), it tries to keep the size of the display area of the current
+frame fixed by adjusting the number of lines and columns.
+
+If the optional argument @var{frames} is @code{nil}, this applies the
+font to the selected frame only.  If @var{frames} is address@hidden, it
+should be a list of frames to act upon, or @code{t} meaning all existing
+and all future graphical frames.
address@hidden deffn
+
+
address@hidden Size and Position
address@hidden Size and Position
address@hidden frame size
address@hidden frame position
address@hidden position of frame
+
+You can read or change the position of a frame using the frame
+parameters @code{left} and @code{top} (@pxref{Position Parameters}) and
+its size using the @code{height} and @code{width} parameters
+(@pxref{Size Parameters}).  Here are some special features for working
+with sizes and positions.  For all of these functions the argument
address@hidden must denote a live frame and defaults to the selected frame.
+
address@hidden frame-position &optional Lisp_Object &optional frame
+This function returns the outer position (@pxref{Frame Layout}) of
address@hidden in pixels.  The value is a cons giving the coordinates of
+the top left corner of the outer frame of @var{frame} relative to an
+origin at the position (0, 0) of the frame's display.  On a text
+terminal frame both values are zero.
address@hidden defun
+
address@hidden set-frame-position frame X Y
+This function sets the outer frame position of @var{frame} to @var{X}
+and @var{Y}.  The latter arguments specify pixels and normally count
+from an origin at the position (0, 0) of @var{frame}'s display.
+
+A negative parameter value positions the right edge of the outer frame
+by @var{-x} pixels left from the right edge of the screen or the bottom
+edge by @var{-y} pixels up from the bottom edge of the screen.
+
+This function has no effect on text terminal frames.
address@hidden defun
+
address@hidden frame-pixel-height &optional frame
address@hidden frame-pixel-width &optional frame
+   These functions return the inner height and width (the height and
+width of the display area, see @ref{Frame Layout}) of @var{frame} in
+pixels.  For a text terminal, the results are in characters rather than
+pixels.
address@hidden defun
+
address@hidden frame-text-height &optional frame
address@hidden frame-text-width &optional frame
+These functions return the height and width of the text area of
address@hidden (@pxref{Frame Layout}), measured in pixels.  For a text
+terminal, the results are in characters rather than pixels.
+
+The value returned by @code{frame-text-height} differs from that
+returned by @code{frame-pixel-height} by not including the heights of
+any internal tool bar or menu bar, the height of one horizontal scroll
+bar and the widths of the internal border.
+
+The value returned by @code{frame-text-width} differs from that returned
+by @code{frame-pixel-width} by not including the width of one vertical
+scroll bar, the widths of one left and one right fringe and the widths
+of the internal border.
address@hidden defun
+
address@hidden frame-height &optional frame
address@hidden frame-width &optional frame
+These functions return the height and width of the text area of
address@hidden, measured in units of the default font height and width of
address@hidden (@pxref{Frame Font}).  These functions are plain shorthands
+for writing @code{(frame-parameter frame 'height)} and
address@hidden(frame-parameter frame 'width)}.
+
+If the text area of @var{frame} measured in pixels is not a multiple of
+its default font size, the values returned by these functions are
+rounded down to the number of characters of the default font that fully
+fit into the text area.
address@hidden defun
+
address@hidden frame-resize-pixelwise
+If this option is @code{nil}, a frame's size is usually rounded to a
+multiple of the current values of that frame's @code{frame-char-height}
+and @code{frame-char-width} whenever the frame is resized.  If this is
address@hidden, no rounding occurs, hence frame sizes can
+increase/decrease by one pixel.
+
+Setting this variable usually causes the next resize operation to pass
+the corresponding size hints to the window manager.  This means that
+this variable should be set only in a user's initial file; applications
+should never bind it temporarily.
+
+The precise meaning of a value of @code{nil} for this option depends on
+the toolkit used.  Dragging the external border with the mouse is done
+character-wise provided the window manager is willing to process the
+corresponding size hints.  Calling @code{set-frame-size} (see below)
+with arguments that do not specify the frame size as an integer multiple
+of its character size, however, may: be ignored, cause a rounding
+(GTK+), or be accepted (Lucid, Motif, MS-Windows).
+
+With some window managers you may have to set this to address@hidden in
+order to make a frame appear truly ``maximized'' or ``fullscreen''.
address@hidden defopt
+
address@hidden set-frame-size frame width height pixelwise
+This function sets the size of the text area of @var{frame}, measured in
+terms of the canonical height and width of a character on @var{frame}
+(@pxref{Frame Font}).
+
+The optional argument @var{pixelwise} address@hidden means to measure
+the new width and height in units of pixels instead.  Note that if
address@hidden is @code{nil}, some toolkits may refuse to
+fully honor the request if it does not increase/decrease the frame size
+to a multiple of its character size.
address@hidden defun
+
address@hidden set-frame-height frame height &optional pretend pixelwise
+This function resizes the text area of @var{frame} to a height of
address@hidden lines.  The sizes of existing windows in @var{frame} are
+altered proportionally to fit.
+
+If @var{pretend} is address@hidden, then Emacs displays @var{height}
+lines of output in @var{frame}, but does not change its value for the
+actual height of the frame.  This is only useful on text terminals.
+Using a smaller height than the terminal actually implements may be
+useful to reproduce behavior observed on a smaller screen, or if the
+terminal malfunctions when using its whole screen.  Setting the frame
+height ``for real'' does not always work, because knowing the correct
+actual size may be necessary for correct cursor positioning on
+text terminals.
+
+The optional fourth argument @var{pixelwise} address@hidden means that
address@hidden should be @var{height} pixels high.  Note that if
address@hidden is @code{nil}, some toolkits may refuse to
+fully honor the request if it does not increase/decrease the frame
+height to a multiple of its character height.
address@hidden defun
+
address@hidden set-frame-width frame width &optional pretend pixelwise
+This function sets the width of the text area of @var{frame}, measured
+in characters.  The argument @var{pretend} has the same meaning as in
address@hidden
+
+The optional fourth argument @var{pixelwise} address@hidden means that
address@hidden should be @var{width} pixels wide.  Note that if
address@hidden is @code{nil}, some toolkits may refuse to
+fully honor the request if it does not increase/decrease the frame width
+to a multiple of its character width.
address@hidden defun
+
+None of these three functions will make a frame smaller than needed to
+display all of its windows together with their scroll bars, fringes,
+margins, dividers, mode and header lines.  This contrasts with requests
+by the window manager triggered, for example, by dragging the external
+border of a frame with the mouse.  Such requests are always honored by
+clipping, if necessary, portions that cannot be displayed at the right,
+bottom corner of the frame.
+
+
address@hidden Implied Frame Resizing
address@hidden Implied Frame Resizing
address@hidden implied frame resizing
address@hidden implied resizing of frame
+
+By default, Emacs tries to keep the number of lines and columns of a
+frame's text area unaltered when, for example, adding or removing the
+menu bar, changing the default font or setting the width of the frame's
+scroll bars.  This means, however, that in such case Emacs must ask the
+window manager to resize the outer frame in order to accommodate the
+size change.  Note that wrapping a menu or tool bar usually does not
+resize the frame's outer size, hence this will alter the number of
+displayed lines.
+
+   Occasionally, such @dfn{implied frame resizing} may be unwanted, for
+example, when the frame is maximized or made fullscreen (where it's
+turned off by default).  In other cases you can disable implied resizing
+with the following option:
+
address@hidden frame-inhibit-implied-resize
+If this option is @code{nil}, changing font, menu bar, tool bar,
+internal borders, fringes or scroll bars of a specific frame may
+implicitly resize the frame's display area in order to preserve the
+number of columns or lines the frame displays.  If this option is
address@hidden, no implied resizing is done.
+
+The value of this option can be also be a list of frame parameters.  In
+that case, implied resizing is inhibited when changing a parameter that
+appears in this list.  The frame parameters currently handled by this
+option are: @code{font}, @code{font-backend},
address@hidden, @code{menu-bar-lines} and
address@hidden
+
+Changing any of the @code{scroll-bar-width}, @code{scroll-bar-height},
address@hidden, @code{horizontal-scroll-bars},
address@hidden and @code{right-fringe} frame parameters is handled
+as if the frame contained just one live window.  This means, for
+example, that removing vertical scroll bars on a frame containing
+several side by side windows will shrink the outer frame width by the
+width of one scroll bar provided this option is @code{nil} and keep it
+unchanged if this option is either @code{t} or a list containing
address@hidden
+
+The default value is @code{'(tool-bar-lines)} for Lucid, Motif and
+Windows (which means that adding/removing a tool bar there does not
+change the outer frame height), @code{nil} on all other window systems
+including GTK+ (which means that changing any of the parameters listed
+above may change the size of the outer frame), and @code{t} otherwise
+(which means the outer frame size never changes implicitly when there's
+no window system support).
+
+Note that when a frame is not large enough to accommodate a change of
+any of the parameters listed above, Emacs may try to enlarge the frame
+even if this option is address@hidden
address@hidden defopt
+
+
 @node Frame Parameters
 @section Frame Parameters
 @cindex frame parameters
@@ -438,7 +978,6 @@ frame transparency, the parameter @code{alpha} is also 
meaningful.
 * Parameter Access::       How to change a frame's parameters.
 * Initial Parameters::     Specifying frame parameters when you make a frame.
 * Window Frame Parameters:: List of frame parameters for window systems.
-* Size and Position::      Changing the size and position of a frame.
 * Geometry::               Parsing geometry specifications.
 @end menu
 
@@ -723,12 +1262,12 @@ pixel sizes of these character units (@pxref{Face 
Attributes}).
 @table @code
 @vindex height, a frame parameter
 @item height
-The height of the frame's text area (@pxref{Size and Position}), in
+The height of the frame's text area (@pxref{Frame Geometry}), in
 characters.
 
 @vindex width, a frame parameter
 @item width
-The width of the frame's text area (@pxref{Size and Position}), in
+The width of the frame's text area (@pxref{Frame Geometry}), in
 characters.
 
 @vindex user-size, a frame parameter
@@ -1183,309 +1722,6 @@ equivalent to the @code{:background} attribute of the
 @end table
 
 
address@hidden Size and Position
address@hidden Frame Size and Position
address@hidden size of frame
address@hidden screen size
address@hidden frame size
address@hidden resize frame
-
-You can read or change the size and position of a frame using the frame
-parameters @code{left}, @code{top}, @code{height}, and @code{width}.
-Whatever geometry parameters you don't specify are chosen by the window
-manager in its usual fashion.
-
-  Here are some special features for working with sizes and positions.
-Most of the functions described below use a @var{frame} argument which
-has to specify a live frame.  If omitted or @code{nil}, it specifies the
-selected frame, see @ref{Input Focus}.
-
address@hidden set-frame-position frame left top
-This function sets the position of the top left corner of @var{frame} to
address@hidden and @var{top}.  These arguments are measured in pixels, and
-normally count from the top left corner of the screen to the top left
-corner of the rectangle allotted to the frame by the window manager.
-
-Negative parameter values position the bottom edge of that rectangle up
-from the bottom edge of the screen, or the right rectangle edge to the
-left of the right edge of the screen.  It would probably be better if
-the values were always counted from the left and top, so that negative
-arguments would position the frame partly off the top or left edge of
-the screen, but it seems inadvisable to change that now.
address@hidden defun
-
address@hidden frame default font
address@hidden default font of a frame
-Each frame has a @dfn{default font} which specifies the canonical height
-and width of a character on that frame.  The default font is used when
-retrieving or changing the size of a frame in terms of columns or lines.
-It is also used when resizing (@pxref{Window Sizes}) or splitting
-(@pxref{Splitting Windows}) windows.
-
address@hidden frame-char-height &optional frame
address@hidden frame-char-width &optional frame
-These functions return the canonical height and width of a character in
address@hidden, measured in pixels.  Together, these values establish the
-size of the default font on @var{frame}.  The values depend on the
-choice of font for @var{frame}, see @ref{Font and Color Parameters}.
address@hidden defun
-
-The default font can be also set directly with the following function:
-
address@hidden Command set-frame-font font &optional keep-size frames
-This sets the default font to @var{font}.  When called interactively, it
-prompts for the name of a font, and uses that font on the selected
-frame.  When called from Lisp, @var{font} should be a font name (a
-string), a font object, font entity, or a font spec.
-
-If the optional argument @var{keep-size} is @code{nil}, this keeps the
-number of frame lines and columns fixed.  (If address@hidden, the option
address@hidden described below will override this.)
-If @var{keep-size} is address@hidden (or with a prefix argument), it
-tries to keep the size of the display area of the current frame fixed by
-adjusting the number of lines and columns.
-
-If the optional argument @var{frames} is @code{nil}, this applies the
-font to the selected frame only.  If @var{frames} is address@hidden, it
-should be a list of frames to act upon, or @code{t} meaning all existing
-graphical frames.
address@hidden deffn
-
address@hidden frame display area
address@hidden display area of a frame
-The @dfn{display area} of a frame is a rectangular area within the area
-allotted to the frame by the window manager.  The display area neither
-includes the title bar (@pxref{Frame Titles}) nor any other decorations
-provided by the window manager (like an external border used for
-resizing frames via mouse dragging).
-
-   The actual height of the display area depends on the window-system
-and toolkit in use.  With GTK+, the display area does not include any
-tool bar or menu bar.  With the Motif or Lucid toolkits and with
-Windows, the display area includes the tool bar but not the menu bar.
-In a graphical version with no toolkit, it includes both the tool bar
-and menu bar.  On a text terminal, the display area includes the menu
-bar.
-
address@hidden frame-pixel-height &optional frame
address@hidden frame-pixel-width &optional frame
-   These functions return the height and width of the display area of
address@hidden, measured in pixels.  For a text terminal, the results are
-in characters rather than pixels.
address@hidden defun
-
address@hidden frame text area
address@hidden text area of a frame
-   The @dfn{text area} of a frame is a concept implicitly used by all
-functions that change a frame's height or width.  It is a rectangle
-located within the display area.  Its size is obtained from that of the
-display area by subtracting the sizes of any tool or menu bars that are
-part of the display area, any internal borders, one vertical and one
-horizontal scroll bar, and one left and one right fringe as specified
-for this frame, see @ref{Layout Parameters}.
-
address@hidden frame-text-height &optional frame
address@hidden frame-text-width &optional frame
-These functions return the height and width of the text area of
address@hidden, measured in pixels.  For a text terminal, the results are
-in characters rather than pixels.
-
-The value returned by @code{frame-text-height} differs from that
-returned by @code{frame-pixel-height} by not including the heights of
-any tool bar or menu bar, the height of one horizontal scroll bar and
-the widths of the internal border.
-
-The value returned by @code{frame-text-width} differs from that returned
-by @code{frame-pixel-width} by not including the width of one vertical
-scroll bar, the widths of one left and one right fringe and the widths
-of the internal border.
address@hidden defun
-
address@hidden frame-height &optional frame
address@hidden frame-width &optional frame
-These functions return the height and width of the text area of
address@hidden, measured in units of the default font height and width of
address@hidden  These functions are plain shorthands for writing
address@hidden(frame-parameter frame 'height)} and @code{(frame-parameter frame
-'width)}.
-
-If the text area of @var{frame} measured in pixles is not a multiple of
-its default font size, the values returned by this functions are rounded
-down to the number of characters of the default font that fully fit into
-the text area.
address@hidden defun
-
address@hidden frame-resize-pixelwise
-If this option is @code{nil}, a frame's size is usually rounded to a
-multiple of the current values of that frame's @code{frame-char-height}
-and @code{frame-char-width}.  If this is address@hidden, no rounding
-occurs, hence frame sizes can increase/decrease by one pixel.
-
-Setting this causes the next resize operation to pass the corresponding
-size hints to the window manager.  This means that this variable should
-be set only in a user's initial file; applications should never bind it
-temporarily.
-
-The precise meaning of a value of @code{nil} for this option depends
-on the toolkit used.  Dragging the frame border with the mouse is usually
-done character-wise.  Calling @code{set-frame-size} (see below)
-with arguments that do not specify the frame size as an integer multiple
-of its character size, however, may: be ignored, cause a
-rounding (GTK+), or be accepted (Lucid, Motif, MS-Windows).
-
-With some window managers you may have to set this to address@hidden in
-order to make a frame appear truly ``maximized'' or ``fullscreen''.
address@hidden defopt
-
address@hidden set-frame-size frame width height pixelwise
-This function sets the size of the text area of @var{frame}, measured in
-characters; @var{width} and @var{height} specify the new width in
-columns and the new height in lines.
-
-The optional argument @var{pixelwise} address@hidden means to measure
-the new width and height in units of pixels instead.  Note that if
address@hidden is @code{nil}, some toolkits may refuse to
-fully honor the request if it does not increase/decrease the frame size
-to a multiple of its character size.
address@hidden defun
-
address@hidden set-frame-height frame height &optional pretend pixelwise
-This function resizes the text area of @var{frame} to a height of
address@hidden lines.  The sizes of existing windows in @var{frame} are
-altered proportionally to fit.
-
-If @var{pretend} is address@hidden, then Emacs displays @var{height}
-lines of output in @var{frame}, but does not change its value for the
-actual height of the frame.  This is only useful on text terminals.
-Using a smaller height than the terminal actually implements may be
-useful to reproduce behavior observed on a smaller screen, or if the
-terminal malfunctions when using its whole screen.  Setting the frame
-height ``for real'' does not always work, because knowing the correct
-actual size may be necessary for correct cursor positioning on
-text terminals.
-
-The optional fourth argument @var{pixelwise} address@hidden means that
address@hidden should be @var{height} pixels high.  Note that if
address@hidden is @code{nil}, some toolkits may refuse to
-fully honor the request if it does not increase/decrease the frame
-height to a multiple of its character height.
address@hidden defun
-
address@hidden set-frame-width frame width &optional pretend pixelwise
-This function sets the width of the text area of @var{frame}, measured
-in characters.  The argument @var{pretend} has the same meaning as in
address@hidden
-
-The optional fourth argument @var{pixelwise} address@hidden means that
address@hidden should be @var{width} pixels wide.  Note that if
address@hidden is @code{nil}, some toolkits may refuse to
-fully honor the request if it does not increase/decrease the frame width
-to a multiple of its character width.
address@hidden defun
-
-None of these three functions will make a frame smaller than needed to
-display all of its windows together with their scroll bars, fringes,
-margins, dividers, mode and header lines.  This contrasts with requests
-by the window manager triggered, for example, by dragging the external
-border of a frame with the mouse.  Such requests are always honored by
-clipping, if necessary, portions that cannot be displayed at the right,
-bottom corner of the frame.
-
-   By default, Emacs tries to keep the number of lines and columns of a
-frame's text area unaltered when, for example, adding or removing a menu
-bar, changing the default font or setting the width of the frame's
-scroll bars.  This means, however, that in such case Emacs must ask the
-window manager to resize the display area of the frame in order to
-accommodate the size change.  Note that wrapping a menu or tool bar
-usually does not resize the frame's display area, hence this will alter
-the number of displayed lines.
-
-   Occasionally, such implied resizing of the display area may be
-unwanted, for example, when the frame is maximized or made fullscreen
-where it's turned off by default.  In other cases you can disable
-implied resizing with the following option:
-
address@hidden frame-inhibit-implied-resize
-If this option is @code{nil}, changing font, menu bar, tool bar,
-internal borders, fringes or scroll bars of a specific frame may
-implicitly resize the frame's display area in order to preserve the
-number of columns or lines the frame displays.  If this option is
address@hidden, no implied resizing is done.
-
-The value of this option can be also be a list of frame parameters.  In
-that case, implied resizing is inhibited when changing a parameter that
-appears in this list.  The frame parameters currently handled by this
-option are: @code{font}, @code{font-backend},
address@hidden, @code{menu-bar-lines} and
address@hidden
-
-Changing any of the @code{scroll-bar-width}, @code{scroll-bar-height},
address@hidden, @code{horizontal-scroll-bars},
address@hidden and @code{right-fringe} frame parameters is handled
-as if the frame contained just one live window.  This means, for
-example, that removing vertical scroll bars on a frame containing
-several side by side windows will shrink the frame width by the width of
-one scroll bar provided this option is @code{nil} and keep it unchanged
-if this option is either @code{t} or a list containing
address@hidden
-
-The default value is @code{'(tool-bar-lines)} for Lucid, Motif and
-Windows (which means that adding/removing a tool bar there does not
-change the frame height), @code{nil} on all other window systems
-including GTK+ (which means that changing any of the parameters listed
-above may change the size of the frame), and @code{t} otherwise (which
-means the frame size never changes implicitly when there's no window
-system support).
-
-Note that when a frame is not large enough to accommodate a change of
-any of the parameters listed above, Emacs may try to enlarge the frame
-even if this option is address@hidden
address@hidden defopt
-
address@hidden FIXME?  Belongs more in Emacs manual than here?
address@hidden But, e.g., fit-window-to-buffer is in this manual.
-If you have a frame that displays only one window, you can fit that
-frame to its buffer using the command @code{fit-frame-to-buffer}.
-
address@hidden Command fit-frame-to-buffer &optional frame max-height 
min-height max-width min-width only
-This command adjusts the size of @var{frame} to display the contents of
-its buffer exactly.  @var{frame} can be any live frame and defaults to
-the selected one.  Fitting is done only if @var{frame}'s root window is
-live.  The arguments @var{max-height}, @var{min-height}, @var{max-width}
-and @var{min-width} specify bounds on the new total size of
address@hidden's root window.  @var{min-height} and @var{min-width} default
-to the values of @code{window-min-height} and @code{window-min-width}
-respectively.
-
-If the optional argument @var{only} is @code{vertically}, this function
-may resize the frame vertically only.  If @var{only} is
address@hidden, it may resize the frame horizontally only.
address@hidden deffn
-
-The behavior of @code{fit-frame-to-buffer} can be controlled with the
-help of the two options listed next.
-
address@hidden fit-frame-to-buffer-margins
-This option can be used to specify margins around frames to be fit by
address@hidden  Such margins can be useful to avoid, for
-example, that such frames overlap the taskbar.
-
-It specifies the numbers of pixels to be left free on the left, above,
-the right, and below a frame that shall be fit.  The default specifies
address@hidden for each which means to use no margins.  The value specified
-here can be overridden for a specific frame by that frame's
address@hidden parameter, if present.
address@hidden defopt
-
address@hidden fit-frame-to-buffer-sizes
-This option specifies size boundaries for @code{fit-frame-to-buffer}.
-It specifies the total maximum and minimum lines and maximum and minimum
-columns of the root window of any frame that shall be fit to its buffer.
-If any of these values is address@hidden, it overrides the corresponding
-argument of @code{fit-frame-to-buffer}.
address@hidden defopt
-
-
 @node Geometry
 @subsection Geometry
 
@@ -2088,8 +2324,10 @@ give access to the current position of the mouse.
 @defun mouse-position
 This function returns a description of the position of the mouse.  The
 value looks like @code{(@var{frame} @var{x} . @var{y})}, where @var{x}
-and @var{y} are integers giving the position in characters relative to
-the top left corner of the inside of @var{frame}.
+and @var{y} are integers giving the (possibly rounded) position in
+multiples of the default character size of @var{frame} (@pxref{Frame
+Font}) relative to the native position of @var{frame} (@pxref{Frame
+Geometry}).
 @end defun
 
 @defvar mouse-position-function
@@ -2105,9 +2343,13 @@ This abnormal hook exists for the benefit of packages 
like
 @defun set-mouse-position frame x y
 This function @dfn{warps the mouse} to position @var{x}, @var{y} in
 frame @var{frame}.  The arguments @var{x} and @var{y} are integers,
-giving the position in characters relative to the top left corner of the
-inside of @var{frame}.  If @var{frame} is not visible, this function
-does nothing.  The return value is not significant.
+giving the position in multiples of the default character size of
address@hidden (@pxref{Frame Font}) relative to the native position of
address@hidden (@pxref{Frame Geometry}).
+
+The resulting mouse position is constrained to the native frame of
address@hidden  If @var{frame} is not visible, this function does nothing.
+The return value is not significant.
 @end defun
 
 @defun mouse-pixel-position
@@ -2118,12 +2360,31 @@ coordinates in units of pixels rather than units of 
characters.
 @defun set-mouse-pixel-position frame x y
 This function warps the mouse like @code{set-mouse-position} except that
 @var{x} and @var{y} are in units of pixels rather than units of
-characters.  These coordinates are not required to be within the frame.
+characters.
 
-If @var{frame} is not visible, this function does nothing.  The return
-value is not significant.
+The resulting mouse position is not constrained to the native frame of
address@hidden  If @var{frame} is not visible, this function does nothing.
+The return value is not significant.
 @end defun
 
+On a graphical terminal the following two functions allow to retrieve
+and set the absolute position of the mouse cursor.
+
address@hidden mouse-absolute-pixel-position
+This function returns a cons cell (@var{x} . @var{y}) of the coordinates
+of the mouse cursor position in pixels, relative to a position (0, 0) of
+the selected frame's display.
address@hidden defun
+
address@hidden set-mouse-absolute-pixel-position x y
+This function moves the mouse cursor to the position (@var{x}, @var{y}).
+The coordinates @var{x} and @var{y} are interpreted in pixels relative
+to a position (0, 0) of the selected frame's display.
address@hidden defun
+
+The following function can tell whether the mouse cursor is currently
+visible on a frame:
+
 @defun frame-pointer-visible-p &optional frame
 This predicate function returns address@hidden if the mouse pointer
 displayed on @var{frame} is visible; otherwise it returns @code{nil}.
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index fde985d..44c09a2 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -318,25 +318,13 @@ stands for no text itself.  It is used only for a side 
effect: it
 specifies @var{mapvar}'s value as the keymap for any following
 @address@hidden sequences in this documentation string.
 
address@hidden `
-(grave accent) stands for a left quote, and alters the interpretation
-of the next unmatched apostrophe.
-
address@hidden '
-(apostrophe) stands for a right quote if preceded by grave accent and
-there are no intervening apostrophes.  Otherwise, apostrophe stands
-for itself.
-
 @item ‘
-(left single quotation mark) stands for a left quote.
address@hidden `
+(left single quotation mark and grave accent) both stand for a left quote.
 
 @item ’
-(right single quotation mark) stands for a right quote.
-
address@hidden '
-(apostrophe) stands for a right quote if
-preceded by grave accent and there are no intervening apostrophes.
-Otherwise, apostrophe stands for itself.
address@hidden '
+(right single quotation mark and apostrophe) both stand for a right quote.
 
 @item \=
 quotes the following character and is discarded; thus, @samp{\=`} puts
@@ -347,17 +335,17 @@ and @samp{\=\=} puts @samp{\=} into the output.
 @strong{Please note:} Each @samp{\} must be doubled when written in a
 string in Emacs Lisp.
 
address@hidden help-quote-translation
address@hidden text-quoting-style
 @cindex curved quotes
-The value of this variable specifies the style
address@hidden uses when generating left and right
-quotes.  If the variable's value is @code{?‘} (U+2018 LEFT SINGLE
-QUOTATION MARK), the style is @t{‘like this’} with curved single
-quotes.  If the value is @code{?'} (apostrophe), the style is @t{'like
-this'} with apostrophes.  If the value is @code{?`} (grave accent),
-the style is @t{`like this'} with grave accent and apostrophe.  The
-default value @code{nil} means to use curved single quotes if
-displayable, and grave accent and apostrophe otherwise.
address@hidden curly quotes
+The value of this variable specifies the style used to generate text
+quotes.  If the variable's value is @code{curve}, the style is
address@hidden this’} with curved single quotes.  If the value is
address@hidden, the style is @t{'like this'} with straight
+apostrophes.  If the value is @code{grave}, the style is @t{`like
+this'} with grave accent and apostrophe.  The default value @code{nil}
+acts like @code{curve} if curved single quotes are displayable, and
+like @code{grave} otherwise.
 @end defvar
 
 @defun substitute-command-keys string
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 0b8e288..2a314a5 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -638,7 +638,6 @@ to read the source, but we can explain some things here.
 @file{eval.c}.  (An ordinary function would have the same general
 appearance.)
 
address@hidden garbage collection protection
 @smallexample
 @group
 DEFUN ("or", For, Sor, 0, UNEVALLED, 0,
@@ -648,15 +647,10 @@ The remaining args are not evalled at all.
 If all args return nil, return nil.
 @end group
 @group
-usage: (or CONDITIONS ...)  */)
+usage: (or CONDITIONS...)  */)
   (Lisp_Object args)
 @{
-  register Lisp_Object val = Qnil;
-  struct gcpro gcpro1;
address@hidden group
-
address@hidden
-  GCPRO1 (args);
+  Lisp_Object val = Qnil;
 @end group
 
 @group
@@ -670,7 +664,6 @@ usage: (or CONDITIONS ...)  */)
 @end group
 
 @group
-  UNGCPRO;
   return val;
 @}
 @end group
@@ -774,36 +767,17 @@ a primitive to accept only a certain type of argument, 
you must check
 the type explicitly using a suitable predicate (@pxref{Type Predicates}).
 @cindex type checking internals
 
address@hidden @code{GCPRO} and @code{UNGCPRO}
address@hidden garbage collection protection
 @cindex protect C variables from garbage collection
-  Within the function @code{For} itself, note the use of the macros
address@hidden and @code{UNGCPRO}.  These macros are defined for the
-sake of the few platforms which do not use Emacs' default
-stack-marking garbage collector.  The @code{GCPRO1} macro ``protects''
-a variable from garbage collection, explicitly informing the garbage
-collector that that variable and all its contents must be as
-accessible.  GC protection is necessary in any function which can
-perform Lisp evaluation by calling @code{eval_sub} or @code{Feval} as
-a subroutine, either directly or indirectly.
-
-  It suffices to ensure that at least one pointer to each object is
-GC-protected.  Thus, a particular local variable can do without
-protection if it is certain that the object it points to will be
-preserved by some other pointer (such as another local variable that
-has a @code{GCPRO}).  Otherwise, the local variable needs a
address@hidden
-
-  The macro @code{GCPRO1} protects just one local variable.  If you
-want to protect two variables, use @code{GCPRO2} instead; repeating
address@hidden will not work.  Macros @code{GCPRO3}, @code{GCPRO4},
address@hidden, and @code{GCPRO6} also exist.  All these macros
-implicitly use local variables such as @code{gcpro1}; you must declare
-these explicitly, with type @code{struct gcpro}.  Thus, if you use
address@hidden, you must declare @code{gcpro1} and @code{gcpro2}.
-
-  @code{UNGCPRO} cancels the protection of the variables that are
-protected in the current function.  It is necessary to do this
-explicitly.
+  Within the function @code{For} itself, the local variable
address@hidden refers to objects controlled by Emacs's stack-marking
+garbage collector.  Although the garbage collector does not reclaim
+objects reachable from C @code{Lisp_Object} stack variables, it may
+move non-object components of an object, such as string contents; so
+functions that access non-object components must take care to refetch
+their addresses after performing Lisp evaluation.  Lisp evaluation can
+occur via calls to @code{eval_sub} or @code{Feval}, either directly or
+indirectly.
 
   You must not use C initializers for static or global variables unless
 the variables are never written once Emacs is dumped.  These variables
@@ -932,9 +906,7 @@ the Lisp function @code{funcall} accepts an unlimited 
number of
 arguments, in C it takes two: the number of Lisp-level arguments, and a
 one-dimensional array containing their values.  The first Lisp-level
 argument is the Lisp function to call, and the rest are the arguments to
-pass to it.  Since @code{Ffuncall} can call the evaluator, you must
-protect pointers from garbage collection around the call to
address@hidden
+pass to it.
 
   The C functions @code{call0}, @code{call1}, @code{call2}, and so on,
 provide handy ways to call a Lisp function conveniently with a fixed
diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi
index 14bdbdb..6158bf5 100644
--- a/doc/lispref/intro.texi
+++ b/doc/lispref/intro.texi
@@ -480,8 +480,8 @@ running.  It is useful to include this string in bug 
reports.
 @smallexample
 @group
 (emacs-version)
-  @result{} "GNU Emacs 23.1 (i686-pc-linux-gnu, GTK+ Version 2.14.4)
-             of 2009-06-01 on cyd.mit.edu"
+  @result{} "GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16)
+             of 2015-06-01"
 @end group
 @end smallexample
 
diff --git a/doc/lispref/makefile.w32-in b/doc/lispref/makefile.w32-in
deleted file mode 100644
index c30d6e2..0000000
--- a/doc/lispref/makefile.w32-in
+++ /dev/null
@@ -1,128 +0,0 @@
-# -*- Makefile -*- for the GNU Emacs Lisp Reference Manual.
-
-# Copyright (C) 2003-2015 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-# Standard configure variables.
-srcdir = .
-
-infodir = $(srcdir)/../../info
-
-# Directory with emacsver.texi.
-emacsdir = $(srcdir)/../emacs
-# Directory with the (customized) texinfo.tex file.
-texinfodir = $(srcdir)/../misc
-
-INFO_EXT=.info
-INFO_OPTS=--no-split
-
-# Redefine 'TEX' if 'tex' does not invoke plain TeX.  For example:
-# TEX=platex
-TEX=tex
-INSTALL_INFO = install-info
-MAKEINFO = makeinfo
-MAKEINFO_OPTS = --force --enable-encoding  -I$(srcdir) -I$(emacsdir)
-
-# The environment variable and its value to add $(srcdir) to the path
-# searched for TeX input files.
-texinputdir = $(srcdir)\..\..\nt\envadd.bat \
-               "TEXINPUTS=$(srcdir);$(texinfodir);$(emacsdir);$(TEXINPUTS)" \
-               "MAKEINFO=$(MAKEINFO) $(MAKEINFO_OPTS)" /C
-
-# List of all the texinfo files in the manual:
-
-srcs = \
-  $(emacsdir)/emacsver.texi \
-  $(srcdir)/abbrevs.texi \
-  $(srcdir)/anti.texi \
-  $(srcdir)/backups.texi \
-  $(srcdir)/buffers.texi \
-  $(srcdir)/commands.texi \
-  $(srcdir)/compile.texi \
-  $(srcdir)/control.texi \
-  $(srcdir)/customize.texi \
-  $(srcdir)/debugging.texi \
-  $(srcdir)/display.texi \
-  $(srcdir)/edebug.texi \
-  $(srcdir)/elisp.texi \
-  $(srcdir)/errors.texi \
-  $(srcdir)/eval.texi \
-  $(srcdir)/files.texi \
-  $(srcdir)/frames.texi \
-  $(srcdir)/functions.texi \
-  $(srcdir)/hash.texi \
-  $(srcdir)/help.texi \
-  $(srcdir)/hooks.texi \
-  $(srcdir)/internals.texi \
-  $(srcdir)/intro.texi \
-  $(srcdir)/keymaps.texi \
-  $(srcdir)/lists.texi \
-  $(srcdir)/loading.texi \
-  $(srcdir)/macros.texi \
-  $(srcdir)/maps.texi \
-  $(srcdir)/markers.texi \
-  $(srcdir)/minibuf.texi \
-  $(srcdir)/modes.texi \
-  $(srcdir)/nonascii.texi \
-  $(srcdir)/numbers.texi \
-  $(srcdir)/objects.texi \
-  $(srcdir)/os.texi \
-  $(srcdir)/package.texi \
-  $(srcdir)/positions.texi \
-  $(srcdir)/processes.texi \
-  $(srcdir)/searching.texi \
-  $(srcdir)/sequences.texi \
-  $(srcdir)/streams.texi \
-  $(srcdir)/strings.texi \
-  $(srcdir)/symbols.texi \
-  $(srcdir)/syntax.texi \
-  $(srcdir)/text.texi \
-  $(srcdir)/tips.texi \
-  $(srcdir)/variables.texi \
-  $(srcdir)/windows.texi \
-  $(srcdir)/index.texi \
-  $(srcdir)/gpl.texi \
-  $(srcdir)/doclicense.texi
-
-
-.PHONY: clean
-
-# The info file is named 'elisp'.
-
-info: $(infodir)/elisp$(INFO_EXT)
-
-$(infodir)/dir:
-       $(INSTALL_INFO) --info-dir=$(infodir) $(infodir)/elisp
-
-$(infodir)/elisp$(INFO_EXT): $(srcs)
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ $(srcdir)/elisp.texi
-
-elisp.dvi: $(srcs)
-       $(texinputdir) $(TEX) $(srcdir)/elisp.texi
-
-clean:
-       - $(DEL) *.toc *.aux *.log *.cp *.cps *.fn *.fns *.tp *.tps \
-                 *.vr *.vrs *.pg *.pgs *.ky *.kys
-       - $(DEL) make.out core
-       - $(DEL) $(infodir)/elisp*
-
-distclean: clean
-       - $(DEL) makefile
-
-maintainer-clean: distclean
-       - $(DEL) elisp$(INFO_EXT) elisp$(INFO_EXT)-? elisp$(INFO_EXT)-?? 
elisp.dvi elisp.oaux
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 24c7559..2aec149 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -2413,7 +2413,7 @@ arrives, whichever comes first.  The variable
 @code{minibuffer-message-timeout} specifies the number of seconds to
 wait in the absence of input.  It defaults to 2.  If @var{args} is
 address@hidden, the actual message is obtained by passing @var{string}
-and @var{args} through @code{format}.  @xref{Formatting Strings}.
+and @var{args} through @code{format-message}.  @xref{Formatting Strings}.
 @end defun
 
 @deffn Command minibuffer-inactive-mode
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index c972bbb..200935d 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -843,11 +843,10 @@ window configurations, see the forms described in 
@ref{Window
 Configurations} and in @ref{Frame Configurations}. @c frameset?
 
 @defspec save-excursion address@hidden
address@hidden mark excursion
 @cindex point excursion
 This special form saves the identity of the current buffer and the
 value of point in it, evaluates @var{body}, and finally
-restores the buffer and its saved value of point.  both saved values are
+restores the buffer and its saved value of point.  Both saved values are
 restored even in case of an abnormal exit via
 @code{throw} or error (@pxref{Nonlocal Exits}).
 
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 2bc6a18..98b3dfb 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -1720,13 +1720,13 @@ sentinel, the eventual call to the sentinel will use 
the new one.
 @group
 (defun msg-me (process event)
    (princ
-     (format "Process: %s had the event `%s'" process event)))
+     (format "Process: %s had the event ‘%s’" process event)))
 (set-process-sentinel (get-process "shell") 'msg-me)
      @result{} msg-me
 @end group
 @group
 (kill-process (get-process "shell"))
-     @print{} Process: #<process shell> had the event `killed'
+     @print{} Process: #<process shell> had the event ‘killed’
      @result{} #<process shell>
 @end group
 @end smallexample
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 5a05c7c..60360cb 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1102,7 +1102,7 @@ For example,
 The index of the first character of the
 string is 0, the index of the second character is 1, and so on.
 
-After this function returns, the index of the first character beyond
+If this function finds a match, the index of the first character beyond
 the match is available as @code{(match-end 0)}.  @xref{Match Data}.
 
 @example
@@ -1425,8 +1425,9 @@ has no text properties.
 @end defun
 
 @defun match-beginning count
-This function returns the position of the start of the text matched by the
-last regular expression searched for, or a subexpression of it.
+If the last regular expression search found a match, this function
+returns the position of the start of the matching text or of a
+subexpression of it.
 
 If @var{count} is zero, then the value is the position of the start of
 the entire match.  Otherwise, @var{count} specifies a subexpression in
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index c2f0607..08e8e87 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -801,7 +801,7 @@ they appear; it is called a @dfn{format string}.
 
   Formatting is often useful for computing messages to be displayed.  In
 fact, the functions @code{message} and @code{error} provide the same
-formatting feature described here; they differ from @code{format} only
+formatting feature described here; they differ from @code{format-message} only
 in how they use the result of formatting.
 
 @defun format string &rest objects
@@ -815,6 +815,16 @@ are copied directly into the output, including their text 
properties,
 if any.
 @end defun
 
address@hidden format-message string &rest objects
address@hidden curved quotes
address@hidden curly quotes
+This function acts like @code{format}, except it also converts any
+curved single quotes in @var{string} as per the value of
address@hidden, and treats grave accent (@t{`}) and
+apostrophe (@t{'}) as if they were curved single quotes.  @xref{Keys
+in Documentation}.
address@hidden defun
+
 @cindex @samp{%} in format
 @cindex format specification
   A format specification is a sequence of characters beginning with a
@@ -913,20 +923,23 @@ specification is unusual in that it does not use a value. 
 For example,
   Any other format character results in an @samp{Invalid format
 operation} error.
 
-  Here are several examples:
+  Here are several examples, which assume the typical
address@hidden settings:
 
 @example
 @group
-(format "The name of this buffer is %s." (buffer-name))
-     @result{} "The name of this buffer is strings.texi."
-
-(format "The buffer object prints as %s." (current-buffer))
-     @result{} "The buffer object prints as strings.texi."
-
 (format "The octal value of %d is %o,
          and the hex value is %x." 18 18 18)
      @result{} "The octal value of 18 is 22,
          and the hex value is 12."
+
+(format-message
+ "The name of this buffer is ‘%s’." (buffer-name))
+     @result{} "The name of this buffer is ‘strings.texi’."
+
+(format-message
+ "The buffer object prints as `%s'." (current-buffer))
+     @result{} "The buffer object prints as ‘strings.texi’."
 @end group
 @end example
 
@@ -948,7 +961,7 @@ the width specifier normally consists of spaces inserted on 
the left:
 If the width is too small, @code{format} does not truncate the
 object's printed representation.  Thus, you can use a width to specify
 a minimum spacing between columns with no risk of losing information.
-In the following three examples, @samp{%7s} specifies a minimum width
+In the following two examples, @samp{%7s} specifies a minimum width
 of 7.  In the first case, the string inserted in place of @samp{%7s}
 has only 3 letters, and needs 4 blank spaces as padding.  In the
 second case, the string @code{"specification"} is 13 letters wide but
@@ -1000,8 +1013,8 @@ ignored.
 (format "%06d is padded on the left with zeros" 123)
      @result{} "000123 is padded on the left with zeros"
 
-(format "%-6d is padded on the right" 123)
-     @result{} "123    is padded on the right"
+(format "'%-6d' is padded on the right" 123)
+     @result{} "'123   ' is padded on the right"
 
 (format "The word '%-7s' actually has %d letters in it."
         "foo" (length "foo"))
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index acf7234..e63e634 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -3472,8 +3472,10 @@ function called to display help strings.  These may be 
@code{help-echo}
 properties, menu help strings (@pxref{Simple Menu Items},
 @pxref{Extended Menu Items}), or tool bar help strings (@pxref{Tool
 Bar}).  The specified function is called with one argument, the help
-string to display.  Tooltip mode (@pxref{Tooltips,,, emacs, The GNU Emacs
-Manual}) provides an example.
+string to display, which is passed through
address@hidden before being given to the function; see
address@hidden in Documentation}.  Tooltip mode (@pxref{Tooltips,,, emacs,
+The GNU Emacs Manual}) provides an example.
 @end defvar
 
 @node Format Properties
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 41f02aa..4656938 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -432,8 +432,8 @@ specified either in units of pixels or in units of lines 
and columns.
 On a graphical display, the latter actually correspond to the height and
 width of a ``default'' character specified by the frame's default font
 as returned by @code{frame-char-height} and @code{frame-char-width}
-(@pxref{Size and Position}).  Thus, if a window is displaying text with
-a different font or size, the reported line height and column width for
+(@pxref{Frame Font}).  Thus, if a window is displaying text with a
+different font or size, the reported line height and column width for
 that window may differ from the actual number of text lines or columns
 displayed within it.
 
@@ -791,8 +791,8 @@ If the value of this option is address@hidden, Emacs 
resizes windows in
 units of pixels.  This currently affects functions like
 @code{split-window} (@pxref{Splitting Windows}), @code{maximize-window},
 @code{minimize-window}, @code{fit-window-to-buffer},
address@hidden (all listed below) and
address@hidden (@pxref{Size and Position}).
address@hidden and
address@hidden (all listed below).
 
 Note that when a frame's pixel size is not a multiple of its character
 size, at least one window may get resized pixelwise even if this
@@ -836,8 +836,7 @@ resize operations (@pxref{Preserving Window Sizes}).
 
 If the option @code{fit-frame-to-buffer} (see below) is address@hidden,
 this function will try to resize the frame of @var{window} to fit its
-contents by calling @code{fit-frame-to-buffer} (@pxref{Size and
-Position}).
+contents by calling @code{fit-frame-to-buffer} (see below).
 @end deffn
 
 @defopt fit-window-to-buffer-horizontally
@@ -858,6 +857,47 @@ live window and this option is address@hidden  If this is
 address@hidden value means frames can be resized in both dimensions.
 @end defopt
 
+If you have a frame that displays only one window, you can fit that
+frame to its buffer using the command @code{fit-frame-to-buffer}.
+
address@hidden Command fit-frame-to-buffer &optional frame max-height 
min-height max-width min-width only
+This command adjusts the size of @var{frame} to display the contents of
+its buffer exactly.  @var{frame} can be any live frame and defaults to
+the selected one.  Fitting is done only if @var{frame}'s root window is
+live.  The arguments @var{max-height}, @var{min-height}, @var{max-width}
+and @var{min-width} specify bounds on the new total size of
address@hidden's root window.  @var{min-height} and @var{min-width} default
+to the values of @code{window-min-height} and @code{window-min-width}
+respectively.
+
+If the optional argument @var{only} is @code{vertically}, this function
+may resize the frame vertically only.  If @var{only} is
address@hidden, it may resize the frame horizontally only.
address@hidden deffn
+
+The behavior of @code{fit-frame-to-buffer} can be controlled with the
+help of the two options listed next.
+
address@hidden fit-frame-to-buffer-margins
+This option can be used to specify margins around frames to be fit by
address@hidden  Such margins can be useful to avoid, for
+example, that such frames overlap the taskbar.
+
+It specifies the numbers of pixels to be left free on the left, above,
+the right, and below a frame that shall be fit.  The default specifies
address@hidden for each which means to use no margins.  The value specified
+here can be overridden for a specific frame by that frame's
address@hidden parameter, if present.
address@hidden defopt
+
address@hidden fit-frame-to-buffer-sizes
+This option specifies size boundaries for @code{fit-frame-to-buffer}.
+It specifies the total maximum and minimum lines and maximum and minimum
+columns of the root window of any frame that shall be fit to its buffer.
+If any of these values is address@hidden, it overrides the corresponding
+argument of @code{fit-frame-to-buffer}.
address@hidden defopt
+
 @deffn Command shrink-window-if-larger-than-buffer &optional window
 This command attempts to reduce @var{window}'s height as much as
 possible while still showing its full buffer, but no less than
@@ -1685,6 +1725,20 @@ function does not alter the list of most recently 
selected windows,
 nor the buffer list.
 @end defun
 
address@hidden window use time
address@hidden use time of window
address@hidden window order by time of last use
address@hidden window-use-time &optional window
+This functions returns the ``use time'' of window @var{window}.
address@hidden must be a live window and defaults to the selected one.
+The @dfn{use time} of a window is not really a time value, but it does
+increase monotonically with each window selection, so the window with
+the lowest ``use time'' is the least recently selected one, and the
+window with the highest ``use time'' is the most recently selected
+one.
address@hidden defun
+
+
 @node Cyclic Window Ordering
 @section Cyclic Ordering of Windows
 @cindex cyclic ordering of windows
@@ -1818,6 +1872,13 @@ the optional argument @var{not-selected} is 
address@hidden, this
 function returns @code{nil} in that case.
 @end defun
 
address@hidden most recently used window
address@hidden get-mru-window &optional all-frames dedicated not-selected
+This function is like @code{get-lru-window}, but it returns the ``most
+recently used'' window instead.  The meaning of the arguments is the
+same as described for @code{get-lru-window}.
address@hidden defun
+
 @cindex largest window
 @defun get-largest-window &optional all-frames dedicated not-selected
 This function returns the window with the largest area (height times
@@ -1944,7 +2005,9 @@ to eliminate this discrepancy.
 This function returns a list of all windows currently displaying
 @var{buffer-or-name}.  @var{buffer-or-name} should be a buffer or the
 name of an existing buffer.  If omitted or @code{nil}, it defaults to
-the current buffer.
+the current buffer.  If the currently selected window displays
address@hidden, it will be the first in the list returned by
+this function.
 
 The arguments @var{minibuf} and @var{all-frames} have the same
 meanings as in the function @code{next-window} (@pxref{Cyclic Window
@@ -2306,16 +2369,18 @@ This function tries to ``display'' @var{buffer} by 
trying to find a
 frame that meets a predicate (by default any frame other than the
 current frame).
 
-If @var{alist} has a address@hidden @code{`inhibit-switch-frame} entry,
-avoid raising the frame.
+If this function chooses a window on another frame, it makes that frame
+visible and, unless @var{alist} contains an @code{inhibit-switch-frame}
+entry (@pxref{Choosing Window Options}), raises that frame if necessary.
 
 If @var{alist} has a non-nil @code{frame-predicate} entry, its value is a
 function taking one argument (a frame), returning non-nil if the
 frame is a candidate; this function replaces the default predicate.
 
-If this function chooses a window on another frame, it makes that frame
-visible and, unless @var{alist} contains an @code{inhibit-switch-frame}
-entry (@pxref{Choosing Window Options}), raises that frame if necessary.
+If @var{alist} has a address@hidden @code{inhibit-same-window} entry,
+the selected window is used; thus if the selected frame has a single
+window, it is not used.
+
 @end defun
 
 @defun display-buffer-pop-up-window buffer alist
@@ -3620,33 +3685,28 @@ is off the screen due to horizontal scrolling:
 @end group
 @end example
 
+
 @node Coordinates and Windows
 @section Coordinates and Windows
 @cindex frame-relative coordinate
 @cindex coordinate, relative to frame
 @cindex window position
 
-  This section describes functions that report the position of a
-window.  Most of these functions report positions relative to the
-window's frame.  In this case, the coordinate origin @samp{(0,0)} lies
-near the upper left corner of the frame.  For technical reasons, on
-graphical displays the origin is not located at the exact corner of
-the graphical window as it appears on the screen.  If Emacs is built
-with the GTK+ toolkit, the origin is at the upper left corner of the
-frame area used for displaying Emacs windows, below the title-bar,
-GTK+ menu bar, and tool bar (since these are drawn by the window
-manager and/or GTK+, not by Emacs).  But if Emacs is not built with
-GTK+, the origin is at the upper left corner of the tool bar (since in
-this case Emacs itself draws the tool bar).  In both cases, the X and
-Y coordinates increase rightward and downward respectively.
-
-  Except where noted, X and Y coordinates are reported in integer
-character units, i.e., numbers of lines and columns respectively.  On a
-graphical display, each ``line'' and ``column'' corresponds to the
-height and width of a default character specified by the frame's
-default font.
-
address@hidden window-edges &optional window
+This section describes functions that report the position of a window.
+Most of these functions report positions relative to an origin at the
+native position of the window's frame (@pxref{Frame Geometry}).  Some
+functions report positions relative to the origin of the display of the
+window's frame.  In any case, the origin has the coordinates (0, 0) and
+X and Y coordinates increase ``rightward'' and ``downward''
+respectively.
+
+  For the following functions, X and Y coordinates are reported in
+integer character units, i.e., numbers of lines and columns
+respectively.  On a graphical display, each ``line'' and ``column''
+corresponds to the height and width of a default character specified by
+the frame's default font (@pxref{Frame Font}).
+
address@hidden window-edges &optional window body absolute pixelwise
 This function returns a list of the edge coordinates of @var{window}.
 If @var{window} is omitted or @code{nil}, it defaults to the selected
 window.
@@ -3663,44 +3723,73 @@ header line, mode line, scroll bar, fringes, window 
divider and display
 margins.  On a text terminal, if the window has a neighbor on its right,
 its right edge includes the separator line between the window and its
 neighbor.
address@hidden defun
 
address@hidden window-inside-edges &optional window
-This function is similar to @code{window-edges}, but the returned edge
-values are for the text area of the window.  They exclude any header
-line, mode line, scroll bar, fringes, window divider, display margins,
-and vertical separator.
+If the optional argument @var{body} is @code{nil}, this means to
+return the edges corresponding to the total size of @var{window}.
address@hidden address@hidden means to return the edges of @var{window}'s
+body (aka text area).  If @var{body} is address@hidden, @var{window}
+must specify a live window.
+
+If the optional argument @var{absolute} is @code{nil}, this means to
+return edges relative to the native position of @var{window}'s frame.
address@hidden address@hidden means to return coordinates relative to
+the origin (0, 0) of @var{window}'s display.  On non-graphical systems
+this argument has no effect.
+
+If the optional argument @var{pixelwise} is @code{nil}, this means to
+return the coordinates in terms of the default character width and
+height of @var{window}'s frame (@pxref{Frame Font}), rounded if
+necessary.  @var{pixelwise} address@hidden means to return the
+coordinates in pixels.  Note that the pixel specified by @var{right} and
address@hidden is immediately outside of these edges.  If @var{absolute}
+is address@hidden, @var{pixelwise} is implicitly address@hidden too.
 @end defun
 
address@hidden window-top-line &optional window
-This function returns the Y coordinate of the topmost row of
address@hidden, equivalent to the @var{top} entry in the list returned
-by @code{window-edges}.
address@hidden window-body-edges &optional window
+This function returns the edges of @var{window}'s body (@pxref{Window
+Sizes}).  Calling @code{(window-body-edges window)} is equivalent to
+calling @code{(window-edges window t)}, see above.
 @end defun
 
address@hidden The following two functions are confusing and hardly used.
address@hidden
 @defun window-left-column &optional window
-This function returns the X coordinate of the leftmost column of
address@hidden, equivalent to the @var{left} entry in the list returned
-by @code{window-edges}.
+This function returns the leftmost column of @var{window}.  This value
+equals the @var{left} entry in the list returned by @code{(window-edges
+window)} minus the number of columns occupied by the internal border of
address@hidden's frame.
 @end defun
 
address@hidden window-top-line &optional window
+This function returns the topmost row of @var{window}.  This value is
+equal to the @var{top} entry in the list returned by @code{(window-edges
+window)} minus the number of lines occupied by the internal border of
address@hidden's frame.
address@hidden defun
address@hidden ignore
+
   The following functions can be used to relate a set of
 frame-relative coordinates to a window:
 
 @defun window-at x y &optional frame
-This function returns the live window at the frame-relative
-coordinates @var{x} and @var{y}, on frame @var{frame}.  If there is no
-window at that position, the return value is @code{nil}.  If
address@hidden is omitted or @code{nil}, it defaults to the selected
+This function returns the live window at the coordinates @var{x} and
address@hidden given in default character sizes (@pxref{Frame Font}) relative
+to the native position of @var{frame} (@pxref{Frame Geometry}).
+
+If there is no window at that position, the return value is @code{nil}.
+If @var{frame} is omitted or @code{nil}, it defaults to the selected
 frame.
 @end defun
 
 @defun coordinates-in-window-p coordinates window
-This function checks whether a window @var{window} occupies the
-frame-relative coordinates @var{coordinates}, and if so, which part of
-the window that is.  @var{window} should be a live window.
+This function checks whether a window @var{window} occupies the frame
+relative coordinates @var{coordinates}, and if so, which part of the
+window that is.  @var{window} should be a live window.
+
 @var{coordinates} should be a cons cell of the form @code{(@var{x}
-. @var{y})}, where @var{x} and @var{y} are frame-relative coordinates.
+. @var{y})}, where @var{x} and @var{y} are given in default character
+sizes (@pxref{Frame Font}) relative to the native position of
address@hidden's frame (@pxref{Frame Geometry}).
 
 If there is no window at the specified position, the return value is
 @code{nil} .  Otherwise, the return value is one of the following:
@@ -3755,46 +3844,96 @@ each text character is taken to be ``one pixel''.
 
 @defun window-pixel-edges &optional window
 This function returns a list of pixel coordinates for the edges of
address@hidden  If @var{window} is omitted or @code{nil}, it defaults
-to the selected window.
address@hidden  Calling @code{(window-pixel-edges window)} is equivalent
+to calling @code{(window-edges window nil nil t)}, see above.
address@hidden defun
 
-The return value has the form @code{(@var{left} @var{top} @var{right}
address@hidden)}.  The list elements are, respectively, the X pixel
-coordinate of the left window edge, the Y pixel coordinate of the top
-edge, one more than the X pixel coordinate of the right edge, and one
-more than the Y pixel coordinate of the bottom edge.
address@hidden The following two functions are confusing and hardly used.
address@hidden
address@hidden window-pixel-left &optional window
+This function returns the left pixel edge of window @var{window}.  This
+value equals the @var{left} entry in the list returned by
address@hidden(window-pixel-edges window)} minus the number of pixels occupied
+by the internal border of @var{window}'s frame.  @var{window} must be a
+valid window and defaults to the selected one.
 @end defun
 
address@hidden window-inside-pixel-edges &optional window
-This function is like @code{window-pixel-edges}, except that it
-returns the pixel coordinates for the edges of the window's text area,
-rather than the pixel coordinates for the edges of the window itself.
address@hidden must specify a live window.
address@hidden window-pixel-top &optional window
+This function returns the top pixel edge of window @var{window}.  This
+value is equal to the @var{top} entry in the list returned by
address@hidden(window-pixel-edges window)} minus the number of pixels occupied
+by the internal border of @var{window}'s frame.  @var{window} must be a
+valid window and defaults to the selected one.
address@hidden defun
address@hidden ignore
+
address@hidden window-body-pixel-edges &optional window
+This function returns the pixel edges of @var{window}'s body.  Calling
address@hidden(window-body-pixel-edges window)} is equivalent to calling
address@hidden(window-edges window t nil t)}, see above.
 @end defun
 
-  The following functions return window positions in pixels, relative
-to the display screen rather than the frame:
+  The following functions return window positions in pixels, relative to
+the origin of the display screen rather than that of the frame:
 
 @defun window-absolute-pixel-edges &optional window
-This function is like @code{window-pixel-edges}, except that it
-returns the edge pixel coordinates relative to the top left corner of
-the display screen.
+This function returns the pixel coordinates of @var{WINDOW} relative to
+an origin at (0, 0) of the display of @var{window}'s frame.  Calling
address@hidden(window-absolute-pixel-edges)} is equivalent to calling
address@hidden(window-edges window nil t t)}, see above.
 @end defun
 
address@hidden window-inside-absolute-pixel-edges &optional window
-This function is like @code{window-inside-pixel-edges}, except that it
-returns the edge pixel coordinates relative to the top left corner of
-the display screen.  @var{window} must specify a live window.
address@hidden defun
address@hidden window-absolute-body-pixel-edges &optional window
+This function returns the pixel coordinates of @var{WINDOW}'s body
+relative to an origin at (0, 0) of the display of @var{window}'s frame.
+Calling @code{(window-absolute-body-pixel-edges window)} is equivalent
+to calling @code{(window-edges window t t t)}, see above.
 
address@hidden window-pixel-left &optional window
-This function returns the left pixel edge of window @var{window}.
address@hidden must be a valid window and defaults to the selected one.
+Combined with @code{set-mouse-absolute-pixel-position}, this function
+can be used to move the mouse pointer to an arbitrary buffer position
+visible in some window:
+
address@hidden
address@hidden
+(let ((edges (window-absolute-body-pixel-edges))
+      (position (pos-visible-in-window-p nil nil t)))
+  (x-set-mouse-absolute-pixel-position
+   (+ (nth 0 edges) (nth 0 position))
+   (+ (nth 1 edges) (nth 1 position))))
address@hidden group
address@hidden example
+
+On a graphical terminal this form ``warps'' the mouse cursor to the
+upper left corner of the glyph at the selected window's point.  A
+position calculated this way can be also used to show a tooltip window
+there.
 @end defun
 
address@hidden window-pixel-top &optional window
-This function returns the top pixel edge of window @var{window}.
address@hidden must be a valid window and defaults to the selected one.
+The following function returns the screen coordinates of a buffer
+position visible in a window:
+
address@hidden window-absolute-pixel-position &optional position window
+If the buffer position @var{position} is visible in window @var{window},
+this function returns the display coordinates of the upper/left corner
+of the glyph at @var{position}.  The return value is a cons of the X-
+and Y-coordinates of that corner, relative to an origin at (0, 0) of
address@hidden's display.  It returns @code{nil} if @var{position} is not
+visible in @var{window}.
+
address@hidden must be a live window and defaults to the selected
+window.  @var{position} defaults to the value of @code{window-point}
+of @var{window}.
+
+This means that in order to move the mouse pointer to the position of
+point in the selected window, it's sufficient to write:
+
address@hidden
address@hidden
+(let ((position (window-absolute-pixel-position)))
+  (set-mouse-absolute-pixel-position
+   (car position) (cdr position)))
address@hidden group
address@hidden example
 @end defun
 
 
diff --git a/doc/misc/makefile.w32-in b/doc/misc/makefile.w32-in
deleted file mode 100644
index 398b774..0000000
--- a/doc/misc/makefile.w32-in
+++ /dev/null
@@ -1,431 +0,0 @@
-#### -*- Makefile -*- for documentation other than the Emacs manual.
-
-# Copyright (C) 2003-2015 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-# Where to find the source code.  The source code for Emacs's C kernel is
-# expected to be in $(srcdir)/src, and the source code for Emacs's
-# utility programs is expected to be in $(srcdir)/lib-src.  This is
-# set by the configure script's '--srcdir' option.
-srcdir=.
-
-infodir = $(srcdir)/../../info
-
-## Directory with emacsver.texi.
-## Currently only used by efaq; could be added to MAKEINFO.
-emacsdir = $(srcdir)/../emacs
-
-INFO_EXT=.info
-INFO_OPTS=--no-split
-
-# The makeinfo program is part of the Texinfo distribution.
-MAKEINFO = makeinfo
-MAKEINFO_OPTS = --force -I$(emacsdir)
-MULTI_INSTALL_INFO = $(srcdir)\..\..\nt\multi-install-info.bat
-INFO_TARGETS = $(infodir)/ccmode$(INFO_EXT) \
-               $(infodir)/cl$(INFO_EXT) $(infodir)/dbus$(INFO_EXT) 
$(infodir)/dired-x$(INFO_EXT) \
-               $(infodir)/ediff$(INFO_EXT) $(infodir)/forms$(INFO_EXT) 
$(infodir)/gnus$(INFO_EXT) \
-               $(infodir)/message$(INFO_EXT) $(infodir)/sieve$(INFO_EXT) 
$(infodir)/pgg$(INFO_EXT) \
-               $(infodir)/emacs-mime$(INFO_EXT) $(infodir)/info$(INFO_EXT) 
$(infodir)/mh-e$(INFO_EXT) \
-               $(infodir)/reftex$(INFO_EXT) $(infodir)/sc$(INFO_EXT) 
$(infodir)/vip$(INFO_EXT) \
-               $(infodir)/viper$(INFO_EXT) $(infodir)/widget$(INFO_EXT) 
$(infodir)/efaq$(INFO_EXT) \
-               $(infodir)/ada-mode$(INFO_EXT) $(infodir)/autotype$(INFO_EXT) 
$(infodir)/calc$(INFO_EXT) \
-               $(infodir)/idlwave$(INFO_EXT) $(infodir)/eudc$(INFO_EXT) 
$(infodir)/ebrowse$(INFO_EXT) \
-               $(infodir)/pcl-cvs$(INFO_EXT) $(infodir)/woman$(INFO_EXT) 
$(infodir)/eshell$(INFO_EXT) \
-               $(infodir)/org$(INFO_EXT) $(infodir)/url$(INFO_EXT) 
$(infodir)/speedbar$(INFO_EXT) \
-               $(infodir)/tramp$(INFO_EXT) $(infodir)/ses$(INFO_EXT) 
$(infodir)/smtpmail$(INFO_EXT) \
-               $(infodir)/flymake$(INFO_EXT) $(infodir)/newsticker$(INFO_EXT) 
$(infodir)/rcirc$(INFO_EXT) \
-               $(infodir)/erc$(INFO_EXT) $(infodir)/ert$(INFO_EXT) \
-               $(infodir)/remember$(INFO_EXT) $(infodir)/nxml-mode$(INFO_EXT) \
-               $(infodir)/epa$(INFO_EXT) $(infodir)/mairix-el$(INFO_EXT) 
$(infodir)/sasl$(INFO_EXT) \
-               $(infodir)/auth$(INFO_EXT) $(infodir)/eieio$(INFO_EXT) 
$(infodir)/ede$(INFO_EXT) \
-               $(infodir)/semantic$(INFO_EXT) $(infodir)/edt$(INFO_EXT) 
$(infodir)/emacs-gnutls$(INFO_EXT) \
-               $(infodir)/srecode$(INFO_EXT) $(infodir)/bovine$(INFO_EXT) \
-               $(infodir)/wisent$(INFO_EXT) $(infodir)/htmlfontify$(INFO_EXT)
-DVI_TARGETS = calc.dvi cc-mode.dvi cl.dvi dbus.dvi dired-x.dvi \
-               ediff.dvi forms.dvi gnus.dvi message.dvi emacs-mime.dvi \
-               sieve.dvi pgg.dvi mh-e.dvi \
-               reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \
-               ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
-               pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \
-               speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
-               newsticker.dvi rcirc.dvi erc.dvi ert.dvi \
-               remember.dvi nxml-mode.dvi \
-               epa.dvi mairix-el.dvi sasl.dvi auth.dvi eieio.dvi ede.dvi \
-               semantic.dvi edt.dvi emacs-gnutls.dvi srecode.dvi bovine.dvi \
-               wisent.dvi htmlfontify.dvi
-INFOSOURCES = info.texi
-
-# The following rule does not work with all versions of 'make'.
-.SUFFIXES: .texi .dvi
-.texi.dvi:
-       texi2dvi $<
-
-TEXI2DVI = texi2dvi
-ENVADD = $(srcdir)\..\..\nt\envadd.bat "TEXINPUTS=$(srcdir);$(TEXINPUTS)" \
-        "MAKEINFO=$(MAKEINFO) $(MAKEINFO_OPTS)" /C
-
-
-info: $(INFO_TARGETS)
-
-dvi: $(DVI_TARGETS)
-
-# Note that all the Info targets build the Info files
-# in srcdir.  There is no provision for Info files
-# to exist in the build directory.
-# In a distribution of Emacs, the Info files should be up to date.
-
-$(infodir)/dir:
-       $(MULTI_INSTALL_INFO) --info-dir=$(infodir) $(INFO_TARGETS)
-
-# The following target uses an explicit -o switch to work around
-# the @setfilename directive in info.texi, which is required for
-# the Texinfo distribution.
-# Some Windows ports of makeinfo seem to require -o to come before the
-# texi filename, contrary to GNU standards.
-
-$(infodir)/info$(INFO_EXT): $(INFOSOURCES)
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ info.texi
-
-info.dvi: $(INFOSOURCES)
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/info.texi
-
-
-$(infodir)/ccmode$(INFO_EXT): cc-mode.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ cc-mode.texi
-cc-mode.dvi: cc-mode.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/cc-mode.texi
-
-$(infodir)/ada-mode$(INFO_EXT): ada-mode.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ada-mode.texi
-ada-mode.dvi: ada-mode.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/ada-mode.texi
-
-$(infodir)/pcl-cvs$(INFO_EXT): pcl-cvs.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ pcl-cvs.texi
-pcl-cvs.dvi: pcl-cvs.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/pcl-cvs.texi
-
-$(infodir)/eshell$(INFO_EXT): eshell.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ eshell.texi
-eshell.dvi: eshell.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/eshell.texi
-
-$(infodir)/cl$(INFO_EXT): cl.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ cl.texi
-cl.dvi: cl.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/cl.texi
-
-$(infodir)/dbus$(INFO_EXT): dbus.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ dbus.texi
-dbus.dvi: dbus.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/dbus.texi
-
-$(infodir)/dired-x$(INFO_EXT): dired-x.texi $(emacsdir)/emacsver.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ dired-x.texi
-dired-x.dvi: dired-x.texi $(emacsdir)/emacsver.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/dired-x.texi
-
-$(infodir)/ediff$(INFO_EXT): ediff.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ediff.texi
-ediff.dvi: ediff.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/ediff.texi
-
-$(infodir)/flymake$(INFO_EXT): flymake.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ flymake.texi
-flymake.dvi: flymake.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/flymake.texi
-
-$(infodir)/forms$(INFO_EXT): forms.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ forms.texi
-forms.dvi: forms.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/forms.texi
-
-# gnus/message/emacs-mime/sieve/pgg are part of Gnus:
-$(infodir)/gnus$(INFO_EXT): gnus.texi gnus-overrides.texi message.texi 
emacs-mime.texi \
-                sieve.texi pgg.texi sasl.texi gnus-news.texi gnus-faq.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ gnus.texi
-gnus.dvi: gnus.texi gnus-overrides.texi message.texi emacs-mime.texi \
-         sieve.texi pgg.texi sasl.texi gnus-news.texi gnus-faq.texi
-       sed -e "/@iflatex/,/@end iflatex/d" $(srcdir)/gnus.texi > gnustmp.texi
-       $(ENVADD) $(TEXI2DVI) gnustmp.texi
-       cp gnustmp.dvi $*.dvi
-       rm gnustmp.*
-#
-$(infodir)/message$(INFO_EXT): message.texi gnus-overrides.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ message.texi
-message.dvi: message.texi gnus-overrides.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/message.texi
-#
-$(infodir)/emacs-mime$(INFO_EXT): emacs-mime.texi gnus-overrides.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ --enable-encoding 
emacs-mime.texi
-emacs-mime.dvi: emacs-mime.texi gnus-overrides.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-mime.texi
-#
-$(infodir)/sieve$(INFO_EXT): sieve.texi gnus-overrides.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ sieve.texi
-sieve.dvi: sieve.texi gnus-overrides.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/sieve.texi
-#
-$(infodir)/pgg$(INFO_EXT): pgg.texi gnus-overrides.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ pgg.texi
-pgg.dvi: pgg.texi gnus-overrides.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/pgg.texi
-
-$(infodir)/mh-e$(INFO_EXT): mh-e.texi gpl.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ mh-e.texi
-mh-e.dvi: mh-e.texi gpl.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/mh-e.texi
-
-$(infodir)/reftex$(INFO_EXT): reftex.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ reftex.texi
-reftex.dvi: reftex.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/reftex.texi
-
-$(infodir)/remember$(INFO_EXT): remember.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ remember.texi
-remember.dvi: remember.texix
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/remember.texi
-
-$(infodir)/sasl$(INFO_EXT): sasl.texi gnus-overrides.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ sasl.texi
-sasl.dvi: sasl.texi gnus-overrides.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/sasl.texi
-
-$(infodir)/sc$(INFO_EXT): sc.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ sc.texi
-sc.dvi: sc.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/sc.texi
-
-$(infodir)/vip$(INFO_EXT): vip.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ vip.texi
-vip.dvi: vip.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/vip.texi
-
-$(infodir)/viper$(INFO_EXT): viper.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ viper.texi
-viper.dvi: viper.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/viper.texi
-
-$(infodir)/widget$(INFO_EXT): widget.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ widget.texi
-widget.dvi: widget.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/widget.texi
-
-$(infodir)/efaq$(INFO_EXT): faq.texi $(emacsdir)/emacsver.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ faq.texi
-faq.dvi: faq.texi $(emacsdir)/emacsver.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/faq.texi
-
-$(infodir)/autotype$(INFO_EXT): autotype.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ autotype.texi
-autotype.dvi: autotype.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/autotype.texi
-
-$(infodir)/calc$(INFO_EXT): calc.texi $(emacsdir)/emacsver.texi gpl.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ calc.texi
-calc.dvi: calc.texi $(emacsdir)/emacsver.texi gpl.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/calc.texi
-
-# This is produced with --no-split to avoid making files whose
-# names clash on DOS 8+3 filesystems
-$(infodir)/idlwave$(INFO_EXT): idlwave.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ idlwave.texi
-idlwave.dvi: idlwave.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/idlwave.texi
-
-$(infodir)/eudc$(INFO_EXT): eudc.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ eudc.texi
-eudc.dvi: eudc.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/eudc.texi
-
-$(infodir)/ebrowse$(INFO_EXT): ebrowse.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ebrowse.texi
-ebrowse.dvi: ebrowse.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/ebrowse.texi
-
-$(infodir)/woman$(INFO_EXT): woman.texi $(emacsdir)/emacsver.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ woman.texi
-woman.dvi: woman.texi $(emacsdir)/emacsver.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/woman.texi
-
-$(infodir)/speedbar$(INFO_EXT): speedbar.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ speedbar.texi
-speedbar.dvi: speedbar.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/speedbar.texi
-
-$(infodir)/tramp$(INFO_EXT): tramp.texi trampver.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ tramp.texi
-tramp.dvi: tramp.texi trampver.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/tramp.texi
-
-$(infodir)/ses$(INFO_EXT): ses.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ses.texi
-ses.dvi: ses.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/ses.texi
-
-$(infodir)/smtpmail$(INFO_EXT): smtpmail.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ smtpmail.texi
-smtpmail.dvi: smtpmail.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/smtpmail.texi
-
-$(infodir)/org$(INFO_EXT): org.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ org.texi
-org.dvi: org.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/org.texi
-
-$(infodir)/url$(INFO_EXT): url.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ url.texi
-url.dvi: url.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/url.texi
-
-$(infodir)/newsticker$(INFO_EXT): newsticker.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ newsticker.texi
-newsticker.dvi: newsticker.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/newsticker.texi
-
-$(infodir)/nxml-mode$(INFO_EXT): nxml-mode.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ nxml-mode.texi
-nxml-mod.dvi: nxml-mode.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/nxml-mode.texi
-
-$(infodir)/rcirc$(INFO_EXT): rcirc.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ rcirc.texi
-rcirc.dvi: rcirc.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/rcirc.texi
-
-$(infodir)/erc$(INFO_EXT): erc.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ erc.texi
-erc.dvi: erc.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/erc.texi
-
-$(infodir)/ert$(INFO_EXT): ert.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ert.texi
-ert.dvi: ert.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/ert.texi
-
-$(infodir)/epa$(INFO_EXT): epa.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ epa.texi
-epa.dvi: epa.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/epa.texi
-
-$(infodir)/mairix-el$(INFO_EXT): mairix-el.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ mairix-el.texi
-mairix-el.dvi: mairix-el.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/mairix-el.texi
-
-$(infodir)/auth$(INFO_EXT): auth.texi gnus-overrides.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ auth.texi
-auth.dvi: auth.texi gnus-overrides.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/auth.texi
-
-$(infodir)/eieio$(INFO_EXT): eieio.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ eieio.texi
-eieio.dvi: eieio.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/eieio.texi
-
-$(infodir)/ede$(INFO_EXT): ede.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ede.texi
-ede.dvi: ede.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/ede.texi
-
-$(infodir)/semantic$(INFO_EXT): semantic.texi sem-user.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ semantic.texi
-semantic.dvi: semantic.texi sem-user.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/semantic.texi
-
-$(infodir)/edt$(INFO_EXT): edt.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ edt.texi
-edt.dvi: edt.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/edt.texi
-
-$(infodir)/emacs-gnutls$(INFO_EXT): emacs-gnutls.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ emacs-gnutls.texi
-emacs-gnutls.dvi: emacs-gnutls.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-gnutls.texi
-
-$(infodir)/srecode$(INFO_EXT): srecode.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ srecode.texi
-srecode.dvi: srecode.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/srecode.texi
-
-$(infodir)/bovine$(INFO_EXT): bovine.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ bovine.texi
-bovine.dvi: bovine.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/bovine.texi
-
-$(infodir)/wisent$(INFO_EXT): wisent.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ wisent.texi
-wisent.dvi: wisent.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/wisent.texi
-
-$(infodir)/htmlfontify$(INFO_EXT): htmlfontify.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ htmlfontify.texi
-htmlfontify.dvi: htmlfontify.texi
-       $(ENVADD) $(TEXI2DVI) $(srcdir)/htmlfontify.texi
-
-
-$(INFO_TARGETS): doclicense.texi
-$(DVI_TARGETS): doclicense.texi
-
-mostlyclean:
-       - $(DEL) *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.*
-
-clean: mostlyclean
-       - $(DEL) *.dvi
-       - $(DEL) $(infodir)/ccmode* $(infodir)/cl* \
-                $(infodir)/dbus* $(infodir)/dired-x* \
-                $(infodir)/ediff* $(infodir)/forms* \
-                $(infodir)/gnus* $(infodir)/info* \
-                $(infodir)/message* $(infodir)/mh-e* \
-                $(infodir)/reftex* $(infodir)/sc* \
-                $(infodir)/vip* $(infodir)/widget* \
-                $(infodir)/efaq* $(infodir)/ada-mode* \
-                $(infodir)/autotype* $(infodir)/calc* \
-                $(infodir)/idlwave* $(infodir)/eudc* \
-                $(infodir)/ebrowse* $(infodir)/pcl-cvs* \
-                $(infodir)/woman* $(infodir)/eshell* \
-                $(infodir)/speedbar* $(infodir)/tramp* \
-                $(infodir)/ses* $(infodir)/smtpmail* \
-                $(infodir)/url* $(infodir)/org* \
-                $(infodir)/flymake* $(infodir)/newsticker* \
-                $(infodir)/sieve* $(infodir)/pgg* \
-                $(infodir)/erc* $(infodir)/ert* $(infodir)/rcirc* \
-                $(infodir)/remember* $(infodir)/nxml-mode* \
-                $(infodir)/epa* $(infodir)/sasl* \
-                $(infodir)/mairix-el* $(infodir)/auth* \
-                $(infodir)/eieio* $(infodir)/ede* \
-                $(infodir)/semantic* $(infodir)edt* \
-                $(infodir)/emacs-gnutls* $(infodir)/srecode* \
-                $(infodir)/bovine* $(infodir)/wisent* \
-                $(infodir)/htmlfontify*
-
-distclean: clean
-       - $(DEL) makefile
-
-maintainer-clean: distclean
-       - $(DEL) *.aux *.cps *.fns *.kys *.pgs *.vrs *.toc
-# Don't delete these, because they are outside the current directory.
-#      for file in $(INFO_TARGETS); do rm -f $${file}*; done
-
-
-# Formerly this directory had texindex.c and getopt.c in it
-# and this makefile built them to make texindex.
-# That caused trouble because this is run entirely in the source directory.
-# Since we expect to get texi2dvi from elsewhere,
-# it is ok to expect texindex from elsewhere also.
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index c9af6dd..012c586 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -524,9 +524,9 @@ can use to connect to remote hosts and transfer files
 If you don't know which method is right for you, see @xref{Default
 Method}.
 
address@hidden:} In the following description, setting of user options
-or variables is explained.  Not all of them are autoloaded by
address@hidden  All examples expect, that you have loaded
address@hidden that the following descriptions reference the setting of
+user options or variables, not all of which are autoloaded by
address@hidden  All examples assume that you have loaded
 @value{tramp} first:
 
 @lisp
diff --git a/etc/DEBUG b/etc/DEBUG
index cc39e42..4bb17e3 100644
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -54,9 +54,9 @@ kick in, provided that you run under GDB.
 
 ** Getting control to the debugger
 
-`Fsignal' is a very useful place to put a breakpoint in.  All Lisp
+'Fsignal' is a very useful place to put a breakpoint in.  All Lisp
 errors go through there.  If you are only interested in errors that
-would fire the debugger, breaking at `maybe_call_debugger' is useful.
+would fire the debugger, breaking at 'maybe_call_debugger' is useful.
 
 It is useful, when debugging, to have a guaranteed way to return to
 the debugger at any time.  When using X, this is easy: type C-z at the
@@ -70,10 +70,10 @@ On modern POSIX systems, you can override that with this 
command:
 
    handle SIGINT stop nopass
 
-After this `handle' command, SIGINT will return control to GDB.  If
-you want the C-g to cause a QUIT within Emacs as well, omit the `nopass'.
+After this 'handle' command, SIGINT will return control to GDB.  If
+you want the C-g to cause a QUIT within Emacs as well, omit the 'nopass'.
 
-A technique that can work when `handle SIGINT' does not is to store
+A technique that can work when 'handle SIGINT' does not is to store
 the code for some character into the variable stop_character.  Thus,
 
     set stop_character = 29
@@ -81,7 +81,7 @@ the code for some character into the variable stop_character. 
 Thus,
 makes Control-] (decimal code 29) the stop character.
 Typing Control-] will cause immediate stop.  You cannot
 use the set command until the inferior process has been started.
-Put a breakpoint early in `main', or suspend the Emacs,
+Put a breakpoint early in 'main', or suspend the Emacs,
 to get an opportunity to do the set command.
 
 Another technique for get control to the debugger is to put a
@@ -91,7 +91,7 @@ is Fredraw_display, which you can invoke at will 
interactively with
 
 When Emacs is running in a terminal, it is sometimes useful to use a separate
 terminal for the debug session.  This can be done by starting Emacs as usual,
-then attaching to it from gdb with the `attach' command which is explained in
+then attaching to it from gdb with the 'attach' command which is explained in
 the node "Attach" of the GDB manual.
 
 On MS-Windows, you can start Emacs in its own separate terminal by
@@ -103,36 +103,36 @@ setting the new-console option before running Emacs under 
GDB:
 ** Examining Lisp object values.
 
 When you have a live process to debug, and it has not encountered a
-fatal error, you can use the GDB command `pr'.  First print the value
-in the ordinary way, with the `p' command.  Then type `pr' with no
+fatal error, you can use the GDB command 'pr'.  First print the value
+in the ordinary way, with the 'p' command.  Then type 'pr' with no
 arguments.  This calls a subroutine which uses the Lisp printer.
 
-You can also use `pp value' to print the emacs value directly.
+You can also use 'pp value' to print the emacs value directly.
 
-To see the current value of a Lisp Variable, use `pv variable'.
+To see the current value of a Lisp Variable, use 'pv variable'.
 
-Note: It is not a good idea to try `pr', `pp', or `pv' if you know that Emacs
+Note: It is not a good idea to try 'pr', 'pp', or 'pv' if you know that Emacs
 is in deep trouble: its stack smashed (e.g., if it encountered SIGSEGV
-due to stack overflow), or crucial data structures, such as `obarray',
-corrupted, etc.  In such cases, the Emacs subroutine called by `pr'
+due to stack overflow), or crucial data structures, such as 'obarray',
+corrupted, etc.  In such cases, the Emacs subroutine called by 'pr'
 might make more damage, like overwrite some data that is important for
 debugging the original problem.
 
-Also, on some systems it is impossible to use `pr' if you stopped
-Emacs while it was inside `select'.  This is in fact what happens if
+Also, on some systems it is impossible to use 'pr' if you stopped
+Emacs while it was inside 'select'.  This is in fact what happens if
 you stop Emacs while it is waiting.  In such a situation, don't try to
-use `pr'.  Instead, use `s' to step out of the system call.  Then
-Emacs will be between instructions and capable of handling `pr'.
+use 'pr'.  Instead, use 's' to step out of the system call.  Then
+Emacs will be between instructions and capable of handling 'pr'.
 
-If you can't use `pr' command, for whatever reason, you can use the
-`xpr' command to print out the data type and value of the last data
+If you can't use 'pr' command, for whatever reason, you can use the
+'xpr' command to print out the data type and value of the last data
 value, For example:
 
     p it->object
     xpr
 
 You may also analyze data values using lower-level commands.  Use the
-`xtype' command to print out the data type of the last data value.
+'xtype' command to print out the data type of the last data value.
 Once you know the data type, use the command that corresponds to that
 type.  Here are these commands:
 
@@ -181,20 +181,20 @@ Then Emacs hits the breakpoint:
     [...]
   }
 
-Now we can use `pr' to print the frame parameters:
+Now we can use 'pr' to print the frame parameters:
 
   (gdb) pp $->param_alist
   ((background-mode . light) (display-type . color) [...])
 
 The Emacs C code heavily uses macros defined in lisp.h.  So suppose
 we want the address of the l-value expression near the bottom of
-`add_command_key' from keyboard.c:
+'add_command_key' from keyboard.c:
 
   XVECTOR (this_command_keys)->contents[this_command_key_count++] = key;
 
 XVECTOR is a macro, so GDB only knows about it if Emacs has been compiled with
 preprocessor macro information.  GCC provides this if you specify the options
-`-gdwarf-N' (where N is 2 or higher) and `-g3'.  In this case, GDB can
+'-gdwarf-N' (where N is 2 or higher) and '-g3'.  In this case, GDB can
 evaluate expressions like "p XVECTOR (this_command_keys)".
 
 When this information isn't available, you can use the xvector command in GDB
@@ -210,20 +210,20 @@ to get the same result.  Here is how:
   (gdb) p &$
   $4 = (int *) 0x411008
 
-Here's a related example of macros and the GDB `define' command.
-There are many Lisp vectors such as `recent_keys', which contains the
+Here's a related example of macros and the GDB 'define' command.
+There are many Lisp vectors such as 'recent_keys', which contains the
 last 300 keystrokes.  We can print this Lisp vector
 
   p recent_keys
   pr
 
-But this may be inconvenient, since `recent_keys' is much more verbose
-than `C-h l'.  We might want to print only the last 10 elements of
-this vector.  `recent_keys' is updated in keyboard.c by the command
+But this may be inconvenient, since 'recent_keys' is much more verbose
+than 'C-h l'.  We might want to print only the last 10 elements of
+this vector.  'recent_keys' is updated in keyboard.c by the command
 
   XVECTOR (recent_keys)->contents[recent_keys_index] = c;
 
-So we define a GDB command `xvector-elts', so the last 10 keystrokes
+So we define a GDB command 'xvector-elts', so the last 10 keystrokes
 are printed by
 
   xvector-elts recent_keys recent_keys_index 10
@@ -242,15 +242,15 @@ where you can define xvector-elts as follows:
   document xvector-elts
   Prints a range of elements of a Lisp vector.
   xvector-elts  v n i
-  prints `i' elements of the vector `v' ending at the index `n'.
+  prints 'i' elements of the vector 'v' ending at the index 'n'.
   end
 
 ** Getting Lisp-level backtrace information within GDB
 
-The most convenient way is to use the `xbacktrace' command.  This
+The most convenient way is to use the 'xbacktrace' command.  This
 shows the names of the Lisp functions that are currently active.
 
-If that doesn't work (e.g., because the `backtrace_list' structure is
+If that doesn't work (e.g., because the 'backtrace_list' structure is
 corrupted), type "bt" at the GDB prompt, to produce the C-level
 backtrace, and look for stack frames that call Ffuncall.  Select them
 one by one in GDB, by typing "up N", where N is the appropriate number
@@ -291,25 +291,25 @@ some redisplay optimizations produce wrong results.  (You 
know that redisplay
 optimizations might be involved if "M-x redraw-display RET", or even just
 typing "M-x", causes Emacs to correct the bad display.)  Since the cursor
 blinking feature triggers periodic redisplay cycles, we recommend disabling
-`blink-cursor-mode' before invoking `trace-redisplay', so that you have less
+'blink-cursor-mode' before invoking 'trace-redisplay', so that you have less
 clutter in the trace.  You can also have up to 30 last trace messages dumped to
-standard error by invoking the `dump-redisplay-history' command.
+standard error by invoking the 'dump-redisplay-history' command.
 
 To find the code paths which were taken by the display engine, search xdisp.c
 for the trace messages you see.
 
-The command `dump-glyph-matrix' is useful for producing on standard error
+The command 'dump-glyph-matrix' is useful for producing on standard error
 stream a full dump of the selected window's glyph matrix.  See the function's
 doc string for more details.  If you are debugging redisplay issues in
-text-mode frames, you may find the command `dump-frame-glyph-matrix' useful.
+text-mode frames, you may find the command 'dump-frame-glyph-matrix' useful.
 
-Other commands useful for debugging redisplay are `dump-glyph-row' and
-`dump-tool-bar-row'.
+Other commands useful for debugging redisplay are 'dump-glyph-row' and
+'dump-tool-bar-row'.
 
 If you run Emacs under GDB, you can print the contents of any glyph matrix by
 just calling that function with the matrix as its argument.  For example, the
 following command will print the contents of the current matrix of the window
-whose pointer is in `w':
+whose pointer is in 'w':
 
   (gdb) p dump_glyph_matrix (w->current_matrix, 2)
 
@@ -321,51 +321,51 @@ disabled.  Configuring Emacs with 
--enable-checking='yes,glyphs' enables it.
 
 Building Emacs like that activates many assertions which scrutinize
 display code operation more than Emacs does normally.  (To see the
-code which tests these assertions, look for calls to the `eassert'
+code which tests these assertions, look for calls to the 'eassert'
 macros.)  Any assertion that is reported to fail should be investigated.
 
 When you debug display problems running emacs under X, you can use
-the `ff' command to flush all pending display updates to the screen.
+the 'ff' command to flush all pending display updates to the screen.
 
 The src/.gdbinit file defines many useful commands for dumping redisplay
 related data structures in a terse and user-friendly format:
 
- `ppt' prints value of PT, narrowing, and gap in current buffer.
- `pit' dumps the current display iterator `it'.
- `pwin' dumps the current window 'win'.
- `prow' dumps the current glyph_row `row'.
- `pg' dumps the current glyph `glyph'.
- `pgi' dumps the next glyph.
- `pgrow' dumps all glyphs in current glyph_row `row'.
- `pcursor' dumps current output_cursor.
+ 'ppt' prints value of PT, narrowing, and gap in current buffer.
+ 'pit' dumps the current display iterator 'it'.
+ 'pwin' dumps the current window 'win'.
+ 'prow' dumps the current glyph_row 'row'.
+ 'pg' dumps the current glyph 'glyph'.
+ 'pgi' dumps the next glyph.
+ 'pgrow' dumps all glyphs in current glyph_row 'row'.
+ 'pcursor' dumps current output_cursor.
 
-The above commands also exist in a version with an `x' suffix which takes an
-object of the relevant type as argument.  For example, `pgrowx' dumps all
-glyphs in its argument, which must be of type `struct glyph_row'.
+The above commands also exist in a version with an 'x' suffix which takes an
+object of the relevant type as argument.  For example, 'pgrowx' dumps all
+glyphs in its argument, which must be of type 'struct glyph_row'.
 
 Since redisplay is performed by Emacs very frequently, you need to place your
 breakpoints cleverly to avoid hitting them all the time, when the issue you are
 debugging did not (yet) happen.  Here are some useful techniques for that:
 
- . Put a breakpoint at `Fredraw_display' before running Emacs.  Then do
+ . Put a breakpoint at 'Fredraw_display' before running Emacs.  Then do
    whatever is required to reproduce the bad display, and invoke "M-x
    redraw-display".  The debugger will kick in, and you can set or enable
    breakpoints in strategic places, knowing that the bad display will be
    redrawn from scratch.
 
  . For debugging incorrect cursor position, a good place to put a breakpoint is
-   in `set_cursor_from_row'.  The first time this function is called as part of
-   `redraw-display', Emacs is redrawing the minibuffer window, which is usually
+   in 'set_cursor_from_row'.  The first time this function is called as part of
+   'redraw-display', Emacs is redrawing the minibuffer window, which is usually
    not what you want; type "continue" to get to the call you want.  In general,
-   always make sure `set_cursor_from_row' is called for the right window and
+   always make sure 'set_cursor_from_row' is called for the right window and
    buffer by examining the value of w->contents: it should be the buffer whose
    display you are debugging.
 
- . `set_cursor_from_row' is also a good place to look at the contents of a
-   screen line (a.k.a. "glyph row"), by means of the `pgrow' GDB command.  Of
+ . 'set_cursor_from_row' is also a good place to look at the contents of a
+   screen line (a.k.a. "glyph row"), by means of the 'pgrow' GDB command.  Of
    course, you need first to make sure the cursor is on the screen line which
-   you want to investigate.  If you have set a breakpoint in `Fredraw_display',
-   as advised above, move cursor to that line before invoking `redraw-display'.
+   you want to investigate.  If you have set a breakpoint in 'Fredraw_display',
+   as advised above, move cursor to that line before invoking 'redraw-display'.
 
  . If the problem happens only at some specific buffer position or for some
    specific rarely-used character, you can make your breakpoints conditional on
@@ -383,14 +383,14 @@ debugging did not (yet) happen.  Here are some useful 
techniques for that:
  . You can also make the breakpoints conditional on what object is being used
    for producing glyphs for display.  The it->method member has the value
    GET_FROM_BUFFER for displaying buffer contents, GET_FROM_STRING for
-   displaying a Lisp string (e.g., a `display' property or an overlay string),
-   GET_FROM_IMAGE for displaying an image, etc.  See `enum it_method' in
+   displaying a Lisp string (e.g., a 'display' property or an overlay string),
+   GET_FROM_IMAGE for displaying an image, etc.  See 'enum it_method' in
    dispextern.h for the full list of values.
 
 ** Following longjmp call.
 
 Recent versions of glibc (2.4+?) encrypt stored values for setjmp/longjmp which
-prevents GDB from being able to follow a longjmp call using `next'.  To
+prevents GDB from being able to follow a longjmp call using 'next'.  To
 disable this protection you need to set the environment variable
 LD_POINTER_GUARD to 0.
 
@@ -400,11 +400,11 @@ Debugging with GDB in Emacs offers some advantages over 
the command line (See
 the GDB Graphical Interface node of the Emacs manual).  There are also some
 features available just for debugging Emacs:
 
-1) The command gud-pp is available on the tool bar (the `pp' icon) and
+1) The command gud-pp is available on the tool bar (the 'pp' icon) and
    allows the user to print the s-expression of the variable at point,
    in the GUD buffer.
 
-2) Pressing `p' on a component of a watch expression that is a lisp object
+2) Pressing 'p' on a component of a watch expression that is a lisp object
    in the speedbar prints its s-expression in the GUD buffer.
 
 3) The STOP button on the tool bar is adjusted so that it sends SIGTSTP
@@ -415,11 +415,11 @@ features available just for debugging Emacs:
 
 ** Debugging what happens while preloading and dumping Emacs
 
-Debugging `temacs' is useful when you want to establish whether a
-problem happens in an undumped Emacs.  To run `temacs' under a
-debugger, type "gdb temacs", then start it with `r -batch -l loadup'.
+Debugging 'temacs' is useful when you want to establish whether a
+problem happens in an undumped Emacs.  To run 'temacs' under a
+debugger, type "gdb temacs", then start it with 'r -batch -l loadup'.
 
-If you need to debug what happens during dumping, start it with `r -batch -l
+If you need to debug what happens during dumping, start it with 'r -batch -l
 loadup dump' instead.  For debugging the bootstrap dumping, use "loadup
 bootstrap" instead of "loadup dump".
 
@@ -444,7 +444,7 @@ option, like this:
 
     emacs -xrm "emacs.synchronous: true"
 
-Setting a breakpoint in the function `x_error_quitter' and looking at
+Setting a breakpoint in the function 'x_error_quitter' and looking at
 the backtrace when Emacs stops inside that function will show what
 code causes the X protocol errors.
 
@@ -455,25 +455,25 @@ procedure:
   - Run Emacs under a debugger and put a breakpoint inside the
     primitive function which, when called from Lisp, triggers the X
     protocol errors.  For example, if the errors happen when you
-    delete a frame, put a breakpoint inside `Fdelete_frame'.
+    delete a frame, put a breakpoint inside 'Fdelete_frame'.
 
   - When the breakpoint breaks, step through the code, looking for
     calls to X functions (the ones whose names begin with "X" or
     "Xt" or "Xm").
 
-  - Insert calls to `XSync' before and after each call to the X
+  - Insert calls to 'XSync' before and after each call to the X
     functions, like this:
 
        XSync (f->output_data.x->display_info->display, 0);
 
-    where `f' is the pointer to the `struct frame' of the selected
+    where 'f' is the pointer to the 'struct frame' of the selected
     frame, normally available via XFRAME (selected_frame).  (Most
     functions which call X already have some variable that holds the
-    pointer to the frame, perhaps called `f' or `sf', so you shouldn't
+    pointer to the frame, perhaps called 'f' or 'sf', so you shouldn't
     need to compute it.)
 
     If your debugger can call functions in the program being debugged,
-    you should be able to issue the calls to `XSync' without recompiling
+    you should be able to issue the calls to 'XSync' without recompiling
     Emacs.  For example, with GDB, just type:
 
        call XSync (f->output_data.x->display_info->display, 0)
@@ -484,8 +484,8 @@ procedure:
 
     Either way, systematically step through the code and issue these
     calls until you find the first X function called by Emacs after
-    which a call to `XSync' winds up in the function
-    `x_error_quitter'.  The first X function call for which this
+    which a call to 'XSync' winds up in the function
+    'x_error_quitter'.  The first X function call for which this
     happens is the one that generated the X protocol error.
 
   - You should now look around this offending X call and try to figure
@@ -506,7 +506,7 @@ to start debugging.
 
 ** If the symptom of the bug is that Emacs fails to respond
 
-Don't assume Emacs is `hung'--it may instead be in an infinite loop.
+Don't assume Emacs is 'hung'--it may instead be in an infinite loop.
 To find out which, make the problem happen under GDB and stop Emacs
 once it is not responding.  (If Emacs is using X Windows directly, you
 can stop Emacs by typing C-z at the GDB job.  On MS-Windows, run Emacs
@@ -514,8 +514,8 @@ as usual, and then attach GDB to it -- that will usually 
interrupt
 whatever Emacs is doing and let you perform the steps described
 below.)
 
-Then try stepping with `step'.  If Emacs is hung, the `step' command
-won't return.  If it is looping, `step' will return.
+Then try stepping with 'step'.  If Emacs is hung, the 'step' command
+won't return.  If it is looping, 'step' will return.
 
 If this shows Emacs is hung in a system call, stop it again and
 examine the arguments of the call.  If you report the bug, it is very
@@ -524,19 +524,19 @@ what the arguments are.
 
 If Emacs is in an infinite loop, try to determine where the loop
 starts and ends.  The easiest way to do this is to use the GDB command
-`finish'.  Each time you use it, Emacs resumes execution until it
-exits one stack frame.  Keep typing `finish' until it doesn't
+'finish'.  Each time you use it, Emacs resumes execution until it
+exits one stack frame.  Keep typing 'finish' until it doesn't
 return--that means the infinite loop is in the stack frame which you
 just tried to finish.
 
-Stop Emacs again, and use `finish' repeatedly again until you get back
-to that frame.  Then use `next' to step through that frame.  By
+Stop Emacs again, and use 'finish' repeatedly again until you get back
+to that frame.  Then use 'next' to step through that frame.  By
 stepping, you will see where the loop starts and ends.  Also, examine
 the data being used in the loop and try to determine why the loop does
 not exit when it should.
 
 On GNU and Unix systems, you can also trying sending Emacs SIGUSR2,
-which, if `debug-on-event' has its default value, will cause Emacs to
+which, if 'debug-on-event' has its default value, will cause Emacs to
 attempt to break it out of its current loop and into the Lisp
 debugger.  This feature is useful when a C-level debugger is not
 conveniently available.
@@ -572,7 +572,7 @@ in such an extremity.  Do
     17:i
     :r -l loadup   (or whatever)
 
-It is necessary to refer to the file `nmout' to convert
+It is necessary to refer to the file 'nmout' to convert
 numeric addresses into symbols and vice versa.
 
 It is useful to be running under a window system.
@@ -591,7 +591,7 @@ screen.  To make these records, do
 
 The dribble file contains all characters read by Emacs from the
 terminal, and the termscript file contains all characters it sent to
-the terminal.  The use of the directory `~/' prevents interference
+the terminal.  The use of the directory '~/' prevents interference
 with any other user.
 
 If you have irreproducible display problems, put those two expressions
@@ -600,7 +600,7 @@ you were running, kill it, and rename the two files.  Then 
you can start
 another Emacs without clobbering those files, and use it to examine them.
 
 An easy way to see if too much text is being redrawn on a terminal is to
-evaluate `(setq inverse-video t)' before you try the operation you think
+evaluate '(setq inverse-video t)' before you try the operation you think
 will cause too much redrawing.  This doesn't refresh the screen, so only
 newly drawn text is in inverse video.
 
@@ -608,7 +608,7 @@ newly drawn text is in inverse video.
 
 If you encounter bugs whereby Emacs built with LessTif grabs all mouse
 and keyboard events, or LessTif menus behave weirdly, it might be
-helpful to set the `DEBUGSOURCES' and `DEBUG_FILE' environment
+helpful to set the 'DEBUGSOURCES' and 'DEBUG_FILE' environment
 variables, so that one can see what LessTif was doing at this point.
 For instance
 
@@ -617,7 +617,7 @@ For instance
   emacs &
 
 causes LessTif to print traces from the three named source files to a
-file in `/usr/tmp' (that file can get pretty large).  The above should
+file in '/usr/tmp' (that file can get pretty large).  The above should
 be typed at the shell prompt before invoking Emacs, as shown by the
 last line above.
 
@@ -628,29 +628,29 @@ the machine where you started GDB and use the debugger 
from there.
 
 ** Debugging problems which happen in GC
 
-The array `last_marked' (defined on alloc.c) can be used to display up
+The array 'last_marked' (defined on alloc.c) can be used to display up
 to 500 last objects marked by the garbage collection process.
 Whenever the garbage collector marks a Lisp object, it records the
-pointer to that object in the `last_marked' array, which is maintained
-as a circular buffer.  The variable `last_marked_index' holds the
-index into the `last_marked' array one place beyond where the pointer
+pointer to that object in the 'last_marked' array, which is maintained
+as a circular buffer.  The variable 'last_marked_index' holds the
+index into the 'last_marked' array one place beyond where the pointer
 to the very last marked object is stored.
 
 The single most important goal in debugging GC problems is to find the
 Lisp data structure that got corrupted.  This is not easy since GC
 changes the tag bits and relocates strings which make it hard to look
-at Lisp objects with commands such as `pr'.  It is sometimes necessary
+at Lisp objects with commands such as 'pr'.  It is sometimes necessary
 to convert Lisp_Object variables into pointers to C struct's manually.
 
-Use the `last_marked' array and the source to reconstruct the sequence
+Use the 'last_marked' array and the source to reconstruct the sequence
 that objects were marked.  In general, you need to correlate the
-values recorded in the `last_marked' array with the corresponding
+values recorded in the 'last_marked' array with the corresponding
 stack frames in the backtrace, beginning with the innermost frame.
-Some subroutines of `mark_object' are invoked recursively, others loop
+Some subroutines of 'mark_object' are invoked recursively, others loop
 over portions of the data structure and mark them as they go.  By
 looking at the code of those routines and comparing the frames in the
-backtrace with the values in `last_marked', you will be able to find
-connections between the values in `last_marked'.  E.g., when GC finds
+backtrace with the values in 'last_marked', you will be able to find
+connections between the values in 'last_marked'.  E.g., when GC finds
 a cons cell, it recursively marks its car and its cdr.  Similar things
 happen with properties of symbols, elements of vectors, etc.  Use
 these connections to reconstruct the data structure that was being
@@ -691,7 +691,7 @@ xterm window, then type these commands inside that window:
 Let's say these commands print "/dev/ttyp4" and "xterm", respectively.
 
 Now start Emacs (the normal, windowed-display session, i.e. without
-the `-nw' option), and invoke "M-x gdb RET emacs RET" from there.  Now
+the '-nw' option), and invoke "M-x gdb RET emacs RET" from there.  Now
 type these commands at GDB's prompt:
 
   (gdb) set args -nw -t /dev/ttyp4
@@ -702,7 +702,7 @@ The debugged Emacs should now start in no-window mode with 
its display
 directed to the xterm window you opened above.
 
 Similar arrangement is possible on a character terminal by using the
-`screen' package.
+'screen' package.
 
 On MS-Windows, you can start Emacs in its own separate terminal by
 setting the new-console option before running Emacs under GDB:
@@ -736,13 +736,13 @@ memory.  Here are some of the changes you might find 
necessary:
 
   - cd ..; src/temacs
 
-(Note that this runs `temacs' instead of the usual `emacs' executable.
+(Note that this runs 'temacs' instead of the usual 'emacs' executable.
 This avoids problems with dumping Emacs mentioned above.)
 
 Some malloc debugging libraries might print lots of false alarms for
 bitfields used by Emacs in some data structures.  If you want to get
 rid of the false alarms, you will have to hack the definitions of
-these data structures on the respective headers to remove the `:N'
+these data structures on the respective headers to remove the ':N'
 bitfield definitions (which will cause each such field to use a full
 int).
 
@@ -792,19 +792,19 @@ opened at Emacs' startup; this console window also shows 
the output of
 'debug_print'.
 
 For example, start and run Emacs in the debugger until it is waiting
-for user input.  Then click on the `Break' button in the debugger to
-halt execution.  Emacs should halt in `ZwUserGetMessage' waiting for
-an input event.  Use the `Call Stack' window to select the procedure
-`w32_msp_pump' up the call stack (see below for why you have to do
+for user input.  Then click on the 'Break' button in the debugger to
+halt execution.  Emacs should halt in 'ZwUserGetMessage' waiting for
+an input event.  Use the 'Call Stack' window to select the procedure
+'w32_msp_pump' up the call stack (see below for why you have to do
 this).  Open the QuickWatch window and enter
 "debug_print(Vexec_path)".  Evaluating this expression will then print
-out the contents of the Lisp variable `exec-path'.
+out the contents of the Lisp variable 'exec-path'.
 
 If QuickWatch reports that the symbol is unknown, then check the call
-stack in the `Call Stack' window.  If the selected frame in the call
+stack in the 'Call Stack' window.  If the selected frame in the call
 stack is not an Emacs procedure, then the debugger won't recognize
 Emacs symbols.  Instead, select a frame that is inside an Emacs
-procedure and try using `debug_print' again.
+procedure and try using 'debug_print' again.
 
 If QuickWatch invokes debug_print but nothing happens, then check the
 thread that is selected in the debugger.  If the selected thread is
diff --git a/etc/DEVEL.HUMOR b/etc/DEVEL.HUMOR
index 7521f79..58b6cb3 100644
--- a/etc/DEVEL.HUMOR
+++ b/etc/DEVEL.HUMOR
@@ -7,7 +7,7 @@
 --                                                                  --
 ----------------------------------------------------------------------
 
-  "Is it legal for a `struct interval' to have a total_length field of
+  "Is it legal for a 'struct interval' to have a total_length field of
 zero?"
   "We can't be arrested for it as far as I know, but it is definitely
 invalid for an interval to have zero length."
@@ -131,7 +131,7 @@ have escaped John's notice."
 Re: patch for woman (woman-topic-at-point)
 
   "Sorry for the long message.  I wanted to make the problem clear
-also for people not familiar with `woman'."
+also for people not familiar with 'woman'."
   "Most hackers, I take?
    For a moment there I thought you had a patch that you could put on
 a woman, and it would make her come right to the topic at point
diff --git a/etc/DISTRIB b/etc/DISTRIB
index 7b33cb8..a95a646 100644
--- a/etc/DISTRIB
+++ b/etc/DISTRIB
@@ -20,7 +20,7 @@ copy and change it--those freedoms are what "free software" 
means.
 The precise conditions for copying and modification are stated in the
 document "GNU General Public License," a copy of which is required to
 be distributed with every copy of GNU Emacs.  It is usually in a file
-named `COPYING' in the same directory as this file.  These conditions
+named 'COPYING' in the same directory as this file.  These conditions
 are designed to make sure that everyone who has a copy of GNU Emacs
 (including modified versions) has the freedom to redistribute and
 change it.
@@ -32,12 +32,12 @@ online store at http://shop.fsf.org.
 
 Emacs has been run on GNU/Linux, FreeBSD, NetBSD, OpenBSD, and on many
 Unix systems, on a variety of types of cpu, as well as on MSDOS,
-Windows and MacOS.  See the file `etc/MACHINES' in the Emacs
+Windows and MacOS.  See the file 'etc/MACHINES' in the Emacs
 distribution for a full list of machines that GNU Emacs has been tested
 on, with machine-specific installation notes and warnings.
 
 GNU Emacs is distributed with no warranty (see the General Public
-License for full details, in the file `COPYING' in this directory (see
+License for full details, in the file 'COPYING' in this directory (see
 above)), and neither I nor the Free Software Foundation promises any
 kind of support or assistance to users.  The foundation keeps a list
 of people who are willing to offer support and assistance for hire.
@@ -73,7 +73,7 @@ you can contribute.
 Your donations will help to support the development of additional GNU
 software.  GNU/Linux systems (variants of GNU, based on the kernel
 Linux) have millions of users, but there is still much to be done.
-For more information on GNU, see the file `GNU' in this directory (see
+For more information on GNU, see the file 'GNU' in this directory (see
 above).
 
                        Richard M Stallman
diff --git a/etc/ETAGS.EBNF b/etc/ETAGS.EBNF
index 0a3d9c6..4a67af8 100644
--- a/etc/ETAGS.EBNF
+++ b/etc/ETAGS.EBNF
@@ -88,7 +88,7 @@ that match it, Emacs then looks for an tag whose implicit tag 
name
 matches the request.  etags.c uses implicit tag names when possible, in
 order to reduce the size of the tags file.
   An implicit tag name is deduced from the pattern by discarding the
-last character if it is one of ` \f\t\n\r()=,;', then taking all the
+last character if it is one of ' \f\t\n\r()=,;', then taking all the
 rightmost consecutive characters in the pattern which are not one of
 those.
 
diff --git a/etc/ETAGS.README b/etc/ETAGS.README
index a312d15..aebe8d3 100644
--- a/etc/ETAGS.README
+++ b/etc/ETAGS.README
@@ -16,7 +16,7 @@ met:
    contributors may be used to endorse or promote products derived
    from this software without specific prior written permission.
 
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY
 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
diff --git a/etc/MACHINES b/etc/MACHINES
index 7e13f17..024149c 100644
--- a/etc/MACHINES
+++ b/etc/MACHINES
@@ -10,12 +10,12 @@ Information about older releases, and platforms that are no 
longer
 supported, has been removed.  Consult older versions of this file if
 you are interested in this information.
 
-The `configure' script uses the configuration name, and the results of
+The 'configure' script uses the configuration name, and the results of
 testing the system, to decide which options to use in src/config.h and
 elsewhere (eg Makefiles).
 
 If you add support for a new configuration, add a section to this
-file, and edit the `configure.ac' source as needed.
+file, and edit the 'configure.ac' source as needed.
 
 Some obsolete platforms are unsupported beginning with Emacs 23.1.  See
 the list at the end of this file.
@@ -90,9 +90,9 @@ the list at the end of this file.
   On Solaris, do not use /usr/ucb/cc.  Use /opt/SUNWspro/bin/cc.  Make
   sure that /usr/ccs/bin and /opt/SUNWspro/bin are in your PATH before
   /usr/ucb.  (Most free software packages have the same requirement on
-  Solaris.)  With this compiler, use `/opt/SUNWspro/bin/cc -E' as the
+  Solaris.)  With this compiler, use '/opt/SUNWspro/bin/cc -E' as the
   preprocessor.  If this inserts extra whitespace into its output (see
-  the PROBLEMS file) then add the option `-Xs'.
+  the PROBLEMS file) then add the option '-Xs'.
 
   To build a 64-bit Emacs (with larger maximum buffer size) on a
   Solaris system which supports 64-bit executables, specify the -m64
diff --git a/etc/NEWS b/etc/NEWS
index 6dbe6b3..0f88e0c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -39,10 +39,20 @@ should be able to work around the problem either by porting 
the Emacs
 undumping code to GCC under IRIX, or by configuring --with-wide-int,
 or by sticking with Emacs 24.4.
 
+** The Emacs garbage collector assumes GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS.
+The GC_MAKE_GCPROS_NOOPS stack-marking variant has been the default
+since Emacs 24.4, and the other variants were undocumented and were
+obstacles to maintenance and development.  GC_MARK_STACK and its
+related symbols have been removed from the C internals.
+
 ** 'configure' now prefers gnustep-config when configuring GNUstep.
 If gnustep-config is not available, the old heuristics are used.
 
 ---
+** 'configure' now prefers inotify to gfile for file notification,
+unless gfile is explicitly requested via --with-file-notification='gfile'.
+
+---
 ** The configure option '--with-pkg-config-prog' has been removed.
 Use './configure PKG_CONFIG=/full/name/of/pkg-config' if you need to.
 
@@ -84,7 +94,12 @@ command line when `initial-buffer-choice' is non-nil.
 
 * Changes in Emacs 25.1
 
-** New display-buffer action function display-buffer-use-some-frame
+** `xref-find-definitions' and `describe-function' now display
+   information about mode local overrides (defined by
+   cedet/mode-local.el `define-overloadable-function' and
+   `define-mode-local-overrides').
+
+** New `display-buffer' action function `display-buffer-use-some-frame'
 This displays the buffer in an existing frame other than the current
 frame, and allows the caller to specify a frame predicate to exclude
 frames.
@@ -267,7 +282,8 @@ successive char insertions.
 ** C-x 8 now has shorthands for these chars: ‐ ‑ ‒ – — ― ‘ ’ “ ” † ‡ • ′ ″
 € № ← → ↔ − ≈ ≠ ≤ ≥.  As before, you can type C-x 8 C-h to list shorthands.
 
-** New minor mode electric-quote-mode for quoting ‘like this’ and “like this”.
+** New minor mode electric-quote-mode for quoting ‘like this’ and “like this”
+as you type.  See also the new variable ‘text-quoting-style’.
 
 ** New minor mode global-eldoc-mode is enabled by default.
 
@@ -297,6 +313,13 @@ standards.
 ** Prog mode has some support for multi-mode indentation.
 See `prog-indentation-context' and `prog-widen'.
 
+** Prettify Symbols mode supports custom composition predicates.  By
+overriding the default `prettify-symbols-compose-predicate', modes can
+specify in which contexts a symbol map be composed to some unicode
+character.  `prettify-symbols-default-compose-p' is the default which
+is suitable for most programming languages such as C or Lisp (but not
+(La)TeX).
+
 ** New `xterm-screen-extra-capabilities' config.
 
 ** The `save-place' variable is replaced by a `save-place-mode'.
@@ -546,6 +569,14 @@ See `diary-chinese-list-entries' and 
`diary-chinese-mark-entries'.
 *** The option `calendar-mode-line-format' can now be nil,
 which means to do nothing special with the mode line in calendars.
 
++++
+*** New option `calendar-weekend-days'.
+The option customizes which day headers receive the
+`calendar-weekend-header' face.
+
+---
+*** New optional args N and STRING for ‘holiday-greek-orthodox-easter’.
+
 ---
 *** Many items obsolete since at least version 23.1 have been removed.
 The majority were function/variable/face aliases, too numerous to list here.
@@ -682,6 +713,10 @@ name patterns (e.x. all "FOR_DOXYGEN_ONLY_*") to be 
excluded.
 *** New custom variable `tex-print-file-extension' to help users who
 use PDF instead of DVI.
 
+*** TeX mode now supports Prettify Symbols mode.  When enabling
+`prettify-symbols-mode' in a tex-mode buffer, \alpha ... \omega, and
+many other math macros are displayed using unicode characters.
+
 ** whitespace-mode: new 'big-indent style highlighting too much indentation.
 By default, 32 spaces and four TABs are considered to be too much but
 `whitespace-big-indent-regexp' can be configured to change that.
@@ -886,16 +921,27 @@ when signaling a file error.  For example, it now reports 
"Permission
 denied" instead of "permission denied".  The old behavior was problematic
 in languages like German where downcasing rules depend on grammar.
 
++++
+** New variable ‘text-quoting-style’ to control how Emacs translates quotes.
+Set it to ‘curve’ for curved single quotes ‘like this’, to ‘straight’
+for straight apostrophes 'like this', and to ‘grave’ for grave accent
+and apostrophe `like this'.  The default value nil acts like ‘curve’
+if curved single quotes are displayable, and like ‘grave’ otherwise.
+The new variable affects display of diagnostics and help, but not of info.
+
++++
 ** substitute-command-keys now replaces quotes.
-That is, it replaces left single quotation marks (‘) by left quotes
-and right single quotation marks (’) by right quotes.  It also
-replaces grave accents by left quotes, and apostrophes that match
-grave accents by right quotes.  As before, isolated apostrophes and
-characters preceded by \= are output as-is.  Left and right quotes are
-determined by new custom variable ‘help-quote-translation’.  ?‘ means
-quote ‘like this’, ?' means quote 'like this', ?` means quote `like
-this', and nil (default) means quote ‘like this’ if displayable and
-'like this' otherwise.
+That is, it converts documentation strings’ quoting style as per the
+value of ‘text-quoting-style’.  Doc strings in source code can use
+either curved single quotes or grave accents and apostrophes.  As
+before, characters preceded by \= are output as-is.
+
++++
+** Message-issuing functions ‘error’, ‘message’, etc. now convert quotes.
+They use the new ‘format-message’ function instead of plain ‘format’,
+so that they now follow user preference as per ‘text-quoting-style’
+when processing curved single quotes, grave accents, and apostrophes
+in their format argument.
 
 +++
 ** The character classes [:alpha:] and [:alnum:] in regular expressions
@@ -1008,13 +1054,27 @@ directory at point.
 *** New macros `thread-first' and `thread-last' allow threading a form
     as the first or last argument of subsequent forms.
 
++++
 ** Documentation strings now support quoting with curved single quotes
 ‘like-this’ in addition to the old style with grave accent and
 apostrophe `like-this'.  The new style looks better on today's displays.
 In the new Electric Quote mode, you can enter curved single quotes
 into documentation by typing ` and '.  Outside Electric Quote mode,
 you can enter them by typing ‘C-x 8 [’ and ‘C-x 8 ]’, or (if your Alt
-key works) by typing ‘A-[’ and ‘A-]’.
+key works) by typing ‘A-[’ and ‘A-]’.  As described above under
+‘text-quoting-style’, the user can specify how to display doc string
+quotes.
+
++++
+** New function ‘format-message’ is like ‘format’ and also converts
+curved single quotes, grave accents and apostrophes as per
+‘text-quoting-style’.
+
++++
+** show-help-function's arg is converted via substitute-command-keys
+before being passed to the function.  Help strings, help-echo
+properties, etc. can therefore contain command key escapes and
+quotation marks.
 
 +++
 ** Time-related changes:
@@ -1087,6 +1147,29 @@ Horizontal scroll bars are turned off by default.
     `scroll-bar-height'.
 
 +++
+** New functions `frame-geometry' and `frame-edges' give access to a
+frame's geometry.
+
++++
+** New functions `mouse-absolute-pixel-position' and
+`set-mouse-absolute-pixel-position' get/set screen coordinates of the
+mouse cursor.
+
++++
+** The function `window-edges' now accepts three additional arguments to
+retrieve body, absolute and pixel edges of the window.
+
++++
+** The functions `window-inside-edges', `window-inside-pixel-edges' and
+`window-inside-absolute-pixel-edges' have been renamed to respectively
+`window-body-edges', `window-body-pixel-edges' and
+`window-absolute-body-pixel-edges'.  The old names are kept as aliases.
+
++++
+** New function `window-absolute-pixel-position' to get the screen
+coordinates of a visible buffer position.
+
++++
 ** The height of a frame's menu and tool bar are no longer counted in the
 frame's text height.  This means that the text height stands only for
 the height of the frame's root window plus that of the echo area (if
@@ -1147,6 +1230,13 @@ qualified names by hand.
 * Changes in Emacs 25.1 on Non-Free Operating Systems
 
 ---
+** MS-Windows specific Emacs build scripts are no longer in the distribution
+This includes the makefile.w32-in files in various subdirectories, and
+the support files.  The file nt/configure.bat now just tells the user
+to use the procedure described in nt/INSTALL, by running the Posix
+`configure' script in the top-level directory.
+
+---
 ** Building Emacs for MS-Windows requires at least Windows XP
 or Windows Server 2003.  The built binaries still run on all versions
 of Windows starting with Windows 9X.
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 340360a..d07e7cf 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -21,7 +21,7 @@ It's completely redundant now, as far as we know.
 
 A typical error message might be something like
 
-  No fonts match `-*-fixed-medium-r-*--6-*-*-*-*-*-iso8859-1'
+  No fonts match ‘-*-fixed-medium-r-*--6-*-*-*-*-*-iso8859-1’
 
 This happens because some X resource specifies a bad font family for
 Emacs to use.  The possible places where this specification might be are:
@@ -85,7 +85,7 @@ This could happen if you compress the file lisp/subdirs.el.  
That file
 tells Emacs what are the directories where it should look for Lisp
 files.  Emacs cannot work with subdirs.el compressed, since the
 Auto-compress mode it needs for this will not be loaded until later,
-when your .emacs file is processed.  (The package `fontset.el' is
+when your .emacs file is processed.  (The package 'fontset.el' is
 required to set up fonts used to display text on window systems, and
 it's loaded very early in the startup procedure.)
 
@@ -132,26 +132,26 @@ optimization.  To do this, configure Emacs with
 This is known to happen when Emacs is compiled with MinGW GCC 4.6.1
 with the -O2 option (which is the default in the Windows build).  The
 reason is a bug in MinGW GCC 4.6.1; to work around, either add the
-`-fno-omit-frame-pointer' switch to GCC or compile without
-optimizations (`--no-opt' switch to the configure.bat script).
+'-fno-omit-frame-pointer' switch to GCC or compile without
+optimizations ('--no-opt' switch to the configure.bat script).
 
 ** Emacs crashes in x-popup-dialog.
 
 This can happen if the dialog widget cannot find the font it wants to
 use.  You can work around the problem by specifying another font with
-an X resource--for example, `Emacs.dialog*.font: 9x15' (or any font that
+an X resource--for example, 'Emacs.dialog*.font: 9x15' (or any font that
 happens to exist on your X server).
 
 ** Emacs crashes when you use Bibtex mode.
 
 This happens if your system puts a small limit on stack size.  You can
-prevent the problem by using a suitable shell command (often `ulimit')
+prevent the problem by using a suitable shell command (often 'ulimit')
 to raise the stack size limit before you run Emacs.
 
-Patches to raise the stack size limit automatically in `main'
+Patches to raise the stack size limit automatically in 'main'
 (src/emacs.c) on various systems would be greatly appreciated.
 
-** Error message `Symbol's value as variable is void: x', followed by
+** Error message 'Symbol’s value as variable is void: x', followed by
 a segmentation fault and core dump.
 
 This has been tracked to a bug in tar!  People report that tar erroneously
@@ -173,7 +173,7 @@ Configure checks for the correct version, but this problem 
could occur
 if a binary built against a shared libungif is run on a system with an
 older version.
 
-** Emacs aborts inside the function `tparam1'.
+** Emacs aborts inside the function 'tparam1'.
 
 This can happen if Emacs was built without terminfo support, but the
 terminal's capabilities use format that is only supported by terminfo.
@@ -261,7 +261,7 @@ and specify the directory that contains the Lisp files.
 Emacs prints a warning when loading a .elc file which is older
 than the corresponding .el file.
 
-Alternatively, if you set the option `load-prefer-newer' non-nil,
+Alternatively, if you set the option 'load-prefer-newer' non-nil,
 Emacs will load whichever version of a file is the newest.
 
 *** Watch out for the EMACSLOADPATH environment variable
@@ -281,15 +281,15 @@ This happens because epop3 redefines the function 
gethash, which is a
 built-in primitive beginning with Emacs 21.1.  We don't have a patch
 for epop3 to fix it, but perhaps a newer version of epop3 corrects that.
 
-*** Buffers from `with-output-to-temp-buffer' get set up in Help mode.
+*** Buffers from 'with-output-to-temp-buffer' get set up in Help mode.
 
 Changes in Emacs 20.4 to the hooks used by that function cause
 problems for some packages, specifically BBDB.  See the function's
 documentation for the hooks involved.  BBDB 2.00.06 fixes the problem.
 
 *** The Hyperbole package causes *Help* buffers not to be displayed in
-Help mode due to setting `temp-buffer-show-hook' rather than using
-`add-hook'.  Using `(add-hook 'temp-buffer-show-hook 'help-mode-finish)'
+Help mode due to setting 'temp-buffer-show-hook' rather than using
+'add-hook'.  Using '(add-hook 'temp-buffer-show-hook 'help-mode-finish)'
 after loading Hyperbole should fix this.
 
 ** Keyboard problems
@@ -298,7 +298,7 @@ after loading Hyperbole should fix this.
 Some users have reported that M-| suffers from "keyboard ghosting".
 This can't be fixed by Emacs, as the keypress never gets passed to it
 at all (as can be verified using "xev").  You can work around this by
-typing `ESC |' instead.
+typing 'ESC |' instead.
 
 *** "Compose Character" key does strange things when used as a Meta key.
 
@@ -316,13 +316,13 @@ them to two different keys.
 
 You are probably using a shell that doesn't support job control, even
 though the system itself is capable of it.  Either use a different shell,
-or set the variable `cannot-suspend' to a non-nil value.
+or set the variable 'cannot-suspend' to a non-nil value.
 
 ** Mailers and other helper programs
 
 *** movemail compiled with POP support can't connect to the POP server.
 
-Make sure that the `pop' entry in /etc/services, or in the services
+Make sure that the 'pop' entry in /etc/services, or in the services
 NIS map if your machine uses NIS, has the same port number as the
 entry on the POP server.  A common error is for the POP server to be
 listening on port 110, the assigned port for the POP3 protocol, while
@@ -332,12 +332,12 @@ old POP protocol.
 *** RMAIL gets error getting new mail.
 
 RMAIL gets new mail from /usr/spool/mail/$USER using a program
-called `movemail'.  This program interlocks with /bin/mail using
+called 'movemail'.  This program interlocks with /bin/mail using
 the protocol defined by /bin/mail.
 
 There are two different protocols in general use.  One of them uses
-the `flock' system call.  The other involves creating a lock file;
-`movemail' must be able to write in /usr/spool/mail in order to do
+the 'flock' system call.  The other involves creating a lock file;
+'movemail' must be able to write in /usr/spool/mail in order to do
 this.  You control which one is used by defining, or not defining,
 the macro MAIL_USE_FLOCK in config.h.
 IF YOU DON'T USE THE FORM OF INTERLOCKING THAT IS NORMAL ON YOUR
@@ -345,8 +345,8 @@ SYSTEM, YOU CAN LOSE MAIL!
 
 If your system uses the lock file protocol, and fascist restrictions
 prevent ordinary users from writing the lock files in /usr/spool/mail,
-you may need to make `movemail' setgid to a suitable group such as
-`mail'.  To do this,  use the following commands (as root) after doing the
+you may need to make 'movemail' setgid to a suitable group such as
+'mail'.  To do this,  use the following commands (as root) after doing the
 make install.
 
         chgrp mail movemail
@@ -387,7 +387,7 @@ This can happen on certain systems when you are using NFS, 
if the
 remote disk is full.  It is due to a bug in NFS (or certain NFS
 implementations), and there is apparently nothing Emacs can do to
 detect the problem.  Emacs checks the failure codes of all the system
-calls involved in writing a file, including `close'; but in the case
+calls involved in writing a file, including 'close'; but in the case
 where the problem occurs, none of those system calls fails.
 
 ** PSGML conflicts with sgml-mode.
@@ -431,11 +431,11 @@ with CEDET 1.0pre4) or later.  Note that Emacs includes 
Semantic since
 
 *** Self-documentation messages are garbled.
 
-This means that the file `etc/DOC' doesn't properly correspond
+This means that the file 'etc/DOC' doesn't properly correspond
 with the Emacs executable.  Redumping Emacs and then installing the
 corresponding pair of files should fix the problem.
 
-*** Programs running under terminal emulator do not recognize `emacs'
+*** Programs running under terminal emulator do not recognize 'emacs'
 terminal type.
 
 The cause of this is a shell startup file that sets the TERMCAP
@@ -454,7 +454,7 @@ happen in a non-login shell.
 *** In Shell mode, you get a ^M at the end of every line.
 
 This happens to people who use tcsh, because it is trying to be too
-smart.  It sees that the Shell uses terminal type `unknown' and turns
+smart.  It sees that the Shell uses terminal type 'unknown' and turns
 on the flag to output ^M at the end of each line.  You can fix the
 problem by adding this to your .cshrc file:
 
@@ -477,12 +477,12 @@ full qualified domain name, FQDN.  You should have your 
FQDN in the
 The way to set this up may vary on non-GNU systems.
 
 *** Visiting files in some auto-mounted directories causes Emacs to print
-`Error reading dir-locals: (file-error "Read error" "is a directory" ...'
+'Error reading dir-locals: (file-error "Read error" "is a directory" ...'
 
 This can happen if the auto-mounter mistakenly reports that
 .dir-locals.el exists and is a directory.  There is nothing Emacs can
 do about this, but you can avoid the issue by adding a suitable entry
-to the variable `locate-dominating-stop-dir-regexp'.  For example, if
+to the variable 'locate-dominating-stop-dir-regexp'.  For example, if
 the problem relates to "/smb/.dir-locals.el", set that variable
 to a new value where you replace "net\\|afs" with "net\\|afs\\|smb".
 (The default value already matches common auto-mount prefixes.)
@@ -491,9 +491,9 @@ See 
http://lists.gnu.org/archive/html/help-gnu-emacs/2015-02/msg00461.html .
 *** Attempting to visit remote files via ange-ftp fails.
 
 If the error message is "ange-ftp-file-modtime: Specified time is not
-representable", then this could happen when `lukemftp' is used as the
+representable", then this could happen when 'lukemftp' is used as the
 ftp client.  This was reported to happen on Debian GNU/Linux, kernel
-version 2.4.3, with `lukemftp' 1.5-5, but might happen on other
+version 2.4.3, with 'lukemftp' 1.5-5, but might happen on other
 systems as well.  To avoid this problem, switch to using the standard
 ftp client.  On a Debian system, type
 
@@ -503,19 +503,19 @@ and then choose /usr/bin/netkit-ftp.
 
 *** Dired is very slow.
 
-This could happen if invocation of the `df' program takes a long
+This could happen if invocation of the 'df' program takes a long
 time.  Possible reasons for this include:
 
-  - ClearCase mounted filesystems (VOBs) that sometimes make `df'
+  - ClearCase mounted filesystems (VOBs) that sometimes make 'df'
     response time extremely slow (dozens of seconds);
 
   - slow automounters on some old versions of Unix;
 
-  - slow operation of some versions of `df'.
+  - slow operation of some versions of 'df'.
 
 To work around the problem, you could either (a) set the variable
-`directory-free-space-program' to nil, and thus prevent Emacs from
-invoking `df'; (b) use `df' from the GNU Coreutils package; or
+'directory-free-space-program' to nil, and thus prevent Emacs from
+invoking 'df'; (b) use 'df' from the GNU Coreutils package; or
 (c) use CVS, which is Free Software, instead of ClearCase.
 
 *** ps-print commands fail to find prologue files ps-prin*.ps.
@@ -558,7 +558,7 @@ backtraces like this:
    4 _rld_text_resolve(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
  ["/comp2/mtibuild/v73/workarea/v7.3/rld/rld_bridge.s":175, 0xfb6032c]
 
-(`rld' is the dynamic linker.)  We don't know why this
+('rld' is the dynamic linker.)  We don't know why this
 happens, but setting the environment variable LD_BIND_NOW to 1 (which
 forces the dynamic linker to bind all shared objects early on) seems
 to work around the problem.
@@ -596,7 +596,7 @@ spelling and the dictionary used by Ispell conform to each 
other.
 
 If your spell-checking program is Aspell, it has been reported that if
 you have a personal configuration file (normally ~/.aspell.conf), it
-can cause this error.  Remove that file, execute `ispell-kill-ispell'
+can cause this error.  Remove that file, execute 'ispell-kill-ispell'
 in Emacs, and then try spell-checking again.
 
 * Runtime problems related to font handling
@@ -662,8 +662,8 @@ overlap.
 
 ** Font Lock displays portions of the buffer in incorrect faces.
 
-By far the most frequent cause of this is a parenthesis `(' or a brace
-`{' in column zero.  Font Lock assumes that such a paren is outside of
+By far the most frequent cause of this is a parenthesis '(' or a brace
+'{' in column zero.  Font Lock assumes that such a paren is outside of
 any comment or string.  This is of course not true in general, but the
 vast majority of well-formatted program source files don't have such
 parens, and therefore this assumption is used to allow optimizations
@@ -681,7 +681,7 @@ indentation) and should be moved or escaped with a 
backslash.
 If you don't use large buffers, or have a very fast machine which
 makes the delays insignificant, you can avoid the incorrect
 fontification by setting the variable
-`font-lock-beginning-of-syntax-function' to a nil value.  (This must
+'font-lock-beginning-of-syntax-function' to a nil value.  (This must
 be done _after_ turning on Font Lock.)
 
 Another alternative is to avoid a paren in column zero.  For example,
@@ -698,12 +698,12 @@ A workaround for this is to add something like
 
 emacs.waitForWM: false
 
-to your X resources.  Alternatively, add `(wait-for-wm . nil)' to a
+to your X resources.  Alternatively, add '(wait-for-wm . nil)' to a
 frame's parameter list, like this:
 
    (modify-frame-parameters nil '((wait-for-wm . nil)))
 
-(this should go into your `.emacs' file).
+(this should go into your '.emacs' file).
 
 ** Underlines appear at the wrong position.
 
@@ -711,10 +711,10 @@ This is caused by fonts having a wrong UNDERLINE_POSITION 
property.
 Examples are the 7x13 font on XFree86 prior to version 4.1, or the jmk
 neep font from the Debian xfonts-jmk package prior to version 3.0.17.
 To circumvent this problem, set x-use-underline-position-properties
-to nil in your `.emacs'.
+to nil in your '.emacs'.
 
 To see what is the value of UNDERLINE_POSITION defined by the font,
-type `xlsfonts -lll FONT' and look at the font's UNDERLINE_POSITION property.
+type 'xlsfonts -lll FONT' and look at the font's UNDERLINE_POSITION property.
 
 ** When using Exceed, fonts sometimes appear too tall.
 
@@ -729,7 +729,7 @@ feature (in the font part of the configuration window).
 
 ** Subscript/superscript text in TeX is hard to read.
 
-If `tex-fontify-script' is non-nil, tex-mode displays
+If 'tex-fontify-script' is non-nil, tex-mode displays
 subscript/superscript text in the faces subscript/superscript, which
 are smaller than the normal font and lowered/raised.  With some fonts,
 nested superscripts (say) can be hard to read.  Switching to a
@@ -782,7 +782,7 @@ characters appear in the buffer as raw bytes of the 
original UTF-8
 (composed into a single quasi-character) and they will be written back
 correctly as UTF-8, assuming you don't break the composed sequences.
 If you read such characters from UTF-16 or UTF-7 data, they are
-substituted with the Unicode `replacement character', and you lose
+substituted with the Unicode 'replacement character', and you lose
 information.
 
 ** Accented ISO-8859-1 characters are displayed as | or _.
@@ -794,21 +794,21 @@ size, it's probably because some fonts pretend to be 
ISO-8859-1 fonts
 when they are really ASCII fonts.  In particular the schumacher-clean
 fonts have this bug in some versions of X.
 
-To see what glyphs are included in a font, use `xfd', like this:
+To see what glyphs are included in a font, use 'xfd', like this:
 
   xfd -fn -schumacher-clean-medium-r-normal--12-120-75-75-c-60-iso8859-1
 
 If this shows only ASCII glyphs, the font is indeed the source of the problem.
 
 The solution is to remove the corresponding lines from the appropriate
-`fonts.alias' file, then run `mkfontdir' in that directory, and then run
-`xset fp rehash'.
+'fonts.alias' file, then run 'mkfontdir' in that directory, and then run
+'xset fp rehash'.
 
-** The `oc-unicode' package doesn't work with Emacs 21.
+** The 'oc-unicode' package doesn't work with Emacs 21.
 
 This package tries to define more private charsets than there are free
 slots now.  The current built-in Unicode support is actually more
-flexible.  (Use option `utf-translate-cjk-mode' if you need CJK
+flexible.  (Use option 'utf-translate-cjk-mode' if you need CJK
 support.)  Files encoded as emacs-mule using oc-unicode aren't
 generally read correctly by Emacs 21.
 
@@ -833,34 +833,34 @@ xmodmap command to the xdm setup script for that display.
 
 *** Using X Window System, control-shift-leftbutton makes Emacs hang.
 
-Use the shell command `xset bc' to make the old X Menu package work.
+Use the shell command 'xset bc' to make the old X Menu package work.
 
 *** C-SPC fails to work on Fedora GNU/Linux (or with fcitx input method).
 
-Fedora Core 4 steals the C-SPC key by default for the `iiimx' program
+Fedora Core 4 steals the C-SPC key by default for the 'iiimx' program
 which is the input method for some languages.  It blocks Emacs users
-from using the C-SPC key for `set-mark-command'.
+from using the C-SPC key for 'set-mark-command'.
 
-One solutions is to remove the `<Ctrl>space' from the `Iiimx' file
-which can be found in the `/usr/lib/X11/app-defaults' directory.
+One solutions is to remove the '<Ctrl>space' from the 'Iiimx' file
+which can be found in the '/usr/lib/X11/app-defaults' directory.
 However, that requires root access.
 
-Another is to specify `Emacs*useXIM: false' in your X resources.
+Another is to specify 'Emacs*useXIM: false' in your X resources.
 
-Another is to build Emacs with the `--without-xim' configure option.
+Another is to build Emacs with the '--without-xim' configure option.
 
 The same problem happens on any other system if you are using fcitx
 (Chinese input method) which by default use C-SPC for toggling.  If
 you want to use fcitx with Emacs, you have two choices.  Toggle fcitx
 by another key (e.g. C-\) by modifying ~/.fcitx/config, or be
-accustomed to use C-@ for `set-mark-command'.
+accustomed to use C-@ for 'set-mark-command'.
 
 *** Link-time optimization with clang doesn't work on Fedora 20.
 
 As of May 2014, Fedora 20 has broken LLVMgold.so plugin support in clang
-(tested with clang-3.4-6.fc20) - `clang --print-file-name=LLVMgold.so'
-prints `LLVMgold.so' instead of full path to plugin shared library, and
-`clang -flto' is unable to find the plugin with the following error:
+(tested with clang-3.4-6.fc20) - 'clang --print-file-name=LLVMgold.so'
+prints 'LLVMgold.so' instead of full path to plugin shared library, and
+'clang -flto' is unable to find the plugin with the following error:
 
 /bin/ld: error: /usr/bin/../lib/LLVMgold.so: could not load plugin library:
 /usr/bin/../lib/LLVMgold.so: cannot open shared object file: No such file
@@ -878,11 +878,11 @@ for character composition.
 
 This happens because some X configurations assign the Ctrl-Shift-t
 combination the same meaning as the Multi_key.  The offending
-definition is in the file `...lib/X11/locale/iso8859-1/Compose'; there
+definition is in the file '...lib/X11/locale/iso8859-1/Compose'; there
 might be other similar combinations which are grabbed by X for similar
 purposes.
 
-We think that this can be countermanded with the `xmodmap' utility, if
+We think that this can be countermanded with the 'xmodmap' utility, if
 you want to be able to bind one of these key sequences within Emacs.
 
 *** Under X, C-v and/or other keys don't work.
@@ -916,7 +916,7 @@ If your keyboard has keys named Alt, you can enable them as 
follows:
     xmodmap -e 'add mod2 = Alt_R'
 
 If the keyboard has just one key named Alt, then only one of those
-commands is needed.  The modifier `mod2' is a reasonable choice if you
+commands is needed.  The modifier 'mod2' is a reasonable choice if you
 are using an unmodified MIT version of X.  Otherwise, choose any
 modifier bit not otherwise used.
 
@@ -970,8 +970,8 @@ option in Preferences->Look&Feel->Style (KDE 2).  In KDE 3, 
this option
 is in the "Colors" section, rather than "Style".
 
 Alternatively, if you do want the KDE defaults to apply to other
-applications, but not to Emacs, you could modify the file `Emacs.ad'
-(should be in the `/usr/share/apps/kdisplay/app-defaults/' directory)
+applications, but not to Emacs, you could modify the file 'Emacs.ad'
+(should be in the '/usr/share/apps/kdisplay/app-defaults/' directory)
 so that it doesn't set the default background and foreground only for
 Emacs.  For example, make sure the following resources are either not
 present or commented out:
@@ -987,7 +987,7 @@ The bug is fixed in version 0.7 or newer of gtk-engines-qt.
 
 *** KDE: Emacs hangs on KDE when a large portion of text is killed.
 
-This is caused by a bug in the KDE applet `klipper' which periodically
+This is caused by a bug in the KDE applet 'klipper' which periodically
 requests the X clipboard contents from applications.  Early versions
 of klipper don't implement the ICCCM protocol for large selections,
 which leads to Emacs being flooded with selection requests.  After a
@@ -995,7 +995,7 @@ while, Emacs may print a message:
 
   Timed out waiting for property-notify event
 
-A workaround is to not use `klipper'.  Upgrading `klipper' to the one
+A workaround is to not use 'klipper'.  Upgrading 'klipper' to the one
 coming with KDE 3.3 or later also solves the problem.
 
 *** CDE: Frames may cover dialogs they created when using CDE.
@@ -1087,7 +1087,7 @@ The messages might say something like this:
 
    Unable to load color "grey95"
 
-(typically, in the `*Messages*' buffer), or something like this:
+(typically, in the '*Messages*' buffer), or something like this:
 
   Error while displaying tooltip: (error Undefined color lightyellow)
 
@@ -1173,7 +1173,7 @@ due to bugs in old versions of X toolkit libraries, but 
no one really
 knows.  If someone debugs this and finds the precise cause, perhaps a
 workaround can be found.
 
-*** An error message such as `X protocol error: BadMatch (invalid
+*** An error message such as 'X protocol error: BadMatch (invalid
 parameter attributes) on protocol request 93'.
 
 This comes from having an invalid X resource, such as
@@ -1205,12 +1205,12 @@ This resource is supposed to apply, and does apply, to 
the menus
 individually as well as to Emacs frames.  If that is not what you
 want, rewrite the resource.
 
-To check thoroughly for such resource specifications, use `xrdb
+To check thoroughly for such resource specifications, use 'xrdb
 -query' to see what resources the X server records, and also look at
 the user's ~/.Xdefaults and ~/.Xdefaults-* files.
 
 *** Emacs running under X Window System does not handle mouse clicks.
-*** `emacs -geometry 80x20' finds a file named `80x20'.
+*** 'emacs -geometry 80x20' finds a file named '80x20'.
 
 One cause of such problems is having (setq term-file-prefix nil) in
 your .emacs file.  Another cause is a bad value of EMACSLOADPATH in
@@ -1220,7 +1220,7 @@ the environment.
 
 People have reported kernel bugs in certain systems that cause Emacs
 not to work with X if DISPLAY is set using a host name.  But
-the problem does not occur if DISPLAY is set to `unix:0.0'.  I think
+the problem does not occur if DISPLAY is set to 'unix:0.0'.  I think
 the bug has to do with SIGIO or FIONREAD.
 
 You may be able to compensate for the bug by doing (set-input-mode nil nil).
@@ -1248,13 +1248,13 @@ Emacs window disappears.  If Emacs was started from a 
terminal, you
 see the message:
 
   Error saving to X clipboard manager.
-  If the problem persists, set `x-select-enable-clipboard-manager' to nil.
+  If the problem persists, set 'x-select-enable-clipboard-manager' to nil.
 
 As the message suggests, this problem occurs when Emacs thinks you
 have a clipboard manager program running, but has trouble contacting it.
 If you don't want to use a clipboard manager, you can set the
 suggested variable.  Or you can make Emacs not wait so long by
-reducing the value of `x-selection-timeout', either in .emacs or with
+reducing the value of 'x-selection-timeout', either in .emacs or with
 X resources.
 
 Sometimes this problem is due to a bug in your clipboard manager.
@@ -1268,7 +1268,7 @@ https://bugzilla.xfce.org/show_bug.cgi?id=7588 .
 When you start Emacs you may see something like this:
 
 (emacs:2286): LIBDBUSMENU-GTK-CRITICAL **: watch_submenu: assertion
-`GTK_IS_MENU_SHELL(menu)' failed
+'GTK_IS_MENU_SHELL(menu)' failed
 
 This happens if the Emacs binary has been renamed.  The cause is the Ubuntu
 appmenu concept.  It tries to track Emacs menus and show them in the top
@@ -1320,14 +1320,14 @@ they generate XON/XOFF flow control characters.  This 
must be set to
 "no XON/XOFF" in order for Emacs to work.  (For example, on a VT220
 you may select "No XOFF" in the setup menu.)  Sometimes there is an
 escape sequence that the computer can send to turn flow control off
-and on.  If so, perhaps the termcap `ti' string should turn flow
-control off, and the `te' string should turn it on.
+and on.  If so, perhaps the termcap 'ti' string should turn flow
+control off, and the 'te' string should turn it on.
 
 Once the terminal has been told "no flow control", you may find it
 needs more padding.  The amount of padding Emacs sends is controlled
 by the termcap entry for the terminal in use, and by the output baud
-rate as known by the kernel.  The shell command `stty' will print
-your output baud rate; `stty' with suitable arguments will set it if
+rate as known by the kernel.  The shell command 'stty' will print
+your output baud rate; 'stty' with suitable arguments will set it if
 it is wrong.  Setting to a higher speed causes increased padding.  If
 the results are wrong for the correct speed, there is probably a
 problem in the termcap entry.  You must speak to a local Unix wizard
@@ -1365,7 +1365,7 @@ order to continue.
 
 If you work in an environment where a majority of terminals of a
 certain type are flow control hobbled, you can use the function
-`enable-flow-control-on' to turn on this flow control avoidance scheme
+'enable-flow-control-on' to turn on this flow control avoidance scheme
 automatically.  Here is an example:
 
 (enable-flow-control-on "vt200" "vt300" "vt101" "vt131")
@@ -1444,7 +1444,7 @@ in termcap.c, tparam.c, term.c, scroll.c, cm.c or 
dispnew.c.
 Some versions of rlogin (and possibly telnet) do not pass flow
 control characters to the remote system to which they connect.
 On such systems, emacs on the remote system cannot disable flow
-control on the local system.  Sometimes `rlogin -8' will avoid this problem.
+control on the local system.  Sometimes 'rlogin -8' will avoid this problem.
 
 One way to cure this is to disable flow control on the local host
 (the one running rlogin, not the one running rlogind) using the
@@ -1476,10 +1476,10 @@ it will scroll them to the top of the screen.
 
 If scrolling is slow but Emacs thinks it is fast, the usual reason is
 that the termcap entry for the terminal you are using does not
-specify any padding time for the `al' and `dl' strings.  Emacs
+specify any padding time for the 'al' and 'dl' strings.  Emacs
 concludes that these operations take only as much time as it takes to
 send the commands at whatever line speed you are using.  You must
-fix the termcap entry to specify, for the `al' and `dl', as much
+fix the termcap entry to specify, for the 'al' and 'dl', as much
 time as the operations really take.
 
 Currently Emacs thinks in terms of serial lines which send characters
@@ -1494,23 +1494,23 @@ not really cost much.  They will be transmitted while 
the scrolling
 is happening and then discarded quickly by the terminal.
 
 Most bit-map terminals provide commands for inserting or deleting
-multiple lines at once.  Define the `AL' and `DL' strings in the
+multiple lines at once.  Define the 'AL' and 'DL' strings in the
 termcap entry to say how to do these things, and you will have
 fast output without wasted padding characters.  These strings should
 each contain a single %-spec saying how to send the number of lines
 to be scrolled.  These %-specs are like those in the termcap
-`cm' string.
+'cm' string.
 
-You should also define the `IC' and `DC' strings if your terminal
+You should also define the 'IC' and 'DC' strings if your terminal
 has a command to insert or delete multiple characters.  These
 take the number of positions to insert or delete as an argument.
 
-A `cs' string to set the scrolling region will reduce the amount
+A 'cs' string to set the scrolling region will reduce the amount
 of motion you see on the screen when part of the screen is scrolled.
 
 ** You type Control-H (Backspace) expecting to delete characters.
 
-Put `stty dec' in your .login file and your problems will disappear
+Put 'stty dec' in your .login file and your problems will disappear
 after a day or two.
 
 The choice of Backspace for erasure was based on confusion, caused by
@@ -1520,12 +1520,12 @@ of text is not the same thing as backspacing followed 
by failure to
 overprint.  I do not wish to propagate this confusion by conforming
 to it.
 
-For this reason, I believe `stty dec' is the right mode to use,
+For this reason, I believe 'stty dec' is the right mode to use,
 and I have designed Emacs to go with that.  If there were a thousand
 other control characters, I would define Control-h to delete as well;
 but there are not very many other control characters, and I think
 that providing the most mnemonic possible Help character is more
-important than adapting to people who don't use `stty dec'.
+important than adapting to people who don't use 'stty dec'.
 
 If you are obstinate about confusing buggy overprinting with deletion,
 you can redefine Backspace in your .emacs file:
@@ -1544,7 +1544,7 @@ uses terminfo, the name of the capability equivalent to 
"Co" is
 "colors".
 
 In addition to the "Co" capability, Emacs needs the "op" (for
-``original pair'') capability, which tells how to switch the terminal
+"original pair") capability, which tells how to switch the terminal
 back to the default foreground and background colors.  Emacs will not
 use colors if this capability is not defined.  If your terminal entry
 doesn't provide such a capability, try using the ANSI standard escape
@@ -1555,12 +1555,12 @@ capability).
 Finally, the "NC" capability (terminfo name: "ncv") tells Emacs which
 attributes cannot be used with colors.  Setting this capability
 incorrectly might have the effect of disabling colors; try setting
-this capability to `0' (zero) and see if that helps.
+this capability to '0' (zero) and see if that helps.
 
 Emacs uses the database entry for the terminal whose name is the value
-of the environment variable TERM.  With `xterm', a common terminal
-entry that supports color is `xterm-color', so setting TERM's value to
-`xterm-color' might activate the color support on an xterm-compatible
+of the environment variable TERM.  With 'xterm', a common terminal
+entry that supports color is 'xterm-color', so setting TERM's value to
+'xterm-color' might activate the color support on an xterm-compatible
 emulator.
 
 Beginning with version 22.1, Emacs supports the --color command-line
@@ -1569,11 +1569,11 @@ modes for getting colors on a tty.  For example, 
--color=ansi8 sets up
 for using the ANSI-standard escape sequences that support 8 colors.
 
 Some modes do not use colors unless you turn on the Font-lock mode.
-Some people have long ago set their `~/.emacs' files to turn on
+Some people have long ago set their '~/.emacs' files to turn on
 Font-lock on X only, so they won't see colors on a tty.  The
 recommended way of turning on Font-lock is by typing "M-x
 global-font-lock-mode RET" or by customizing the variable
-`global-font-lock-mode'.
+'global-font-lock-mode'.
 
 ** Unexpected characters inserted into the buffer when you start Emacs.
 See e.g. <URL:http://debbugs.gnu.org/11129>
@@ -1589,7 +1589,7 @@ connection, and begin typing before Emacs is ready to 
respond.
 This occurs when Emacs tries to query the terminal to see what
 capabilities it supports, and gets confused by the answer.
 To avoid it, set xterm-extra-capabilities to a value other than
-`check' (the default).  See that variable's documentation (in
+'check' (the default).  See that variable's documentation (in
 term/xterm.el) for more details.
 
 * Runtime problems specific to individual Unix variants
@@ -1640,29 +1640,29 @@ Meta, and was astonished when that didn't happen.
 
 The solution is to find out what key on your keyboard produces the Meta
 modifier, and use that key instead.  Try all of the keys to the left
-and to the right of the space bar, together with the `x' key, and see
+and to the right of the space bar, together with the 'x' key, and see
 which combination produces "M-x" in the echo area.  You can also use
-the `xmodmap' utility to show all the keys which produce a Meta
+the 'xmodmap' utility to show all the keys which produce a Meta
 modifier:
 
          xmodmap -pk | egrep -i "meta|alt"
 
 A more convenient way of finding out which keys produce a Meta modifier
-is to use the `xkbprint' utility, if it's available on your system:
+is to use the 'xkbprint' utility, if it's available on your system:
 
          xkbprint 0:0 /tmp/k.ps
 
-This produces a PostScript file `/tmp/k.ps' with a picture of your
+This produces a PostScript file '/tmp/k.ps' with a picture of your
 keyboard; printing that file on a PostScript printer will show what
 keys can serve as Meta.
 
-The `xkeycaps' also shows a visual representation of the current
+The 'xkeycaps' also shows a visual representation of the current
 keyboard settings.  It also allows to modify them.
 
 *** GNU/Linux: slow startup on Linux-based GNU systems.
 
 People using systems based on the Linux kernel sometimes report that
-startup takes 10 to 15 seconds longer than `usual'.
+startup takes 10 to 15 seconds longer than 'usual'.
 
 This is because Emacs looks up the host name when it starts.
 Normally, this takes negligible time; the extra delay is due to
@@ -1673,20 +1673,20 @@ Here is how to fix the configuration.  It requires 
being root.
 
 **** Networked Case.
 
-First, make sure the files `/etc/hosts' and `/etc/host.conf' both
-exist.  The first line in the `/etc/hosts' file should look like this
+First, make sure the files '/etc/hosts' and '/etc/host.conf' both
+exist.  The first line in the '/etc/hosts' file should look like this
 (replace HOSTNAME with your host name):
 
     127.0.0.1      HOSTNAME
 
-Also make sure that the `/etc/host.conf' files contains the following
+Also make sure that the '/etc/host.conf' files contains the following
 lines:
 
     order hosts, bind
     multi on
 
 Any changes, permanent and temporary, to the host name should be
-indicated in the `/etc/hosts' file, since it acts a limited local
+indicated in the '/etc/hosts' file, since it acts a limited local
 database of addresses and names (e.g., some SLIP connections
 dynamically allocate ip addresses).
 
@@ -1694,15 +1694,15 @@ dynamically allocate ip addresses).
 
 The solution described in the networked case applies here as well.
 However, if you never intend to network your machine, you can use a
-simpler solution: create an empty `/etc/host.conf' file.  The command
-`touch /etc/host.conf' suffices to create the file.  The `/etc/hosts'
+simpler solution: create an empty '/etc/host.conf' file.  The command
+'touch /etc/host.conf' suffices to create the file.  The '/etc/hosts'
 file is not necessary with this approach.
 
 *** GNU/Linux: Emacs on a tty switches the cursor to large blinking block.
 
 This was reported to happen on some GNU/Linux systems which use
 ncurses version 5.0, but could be relevant for other versions as well.
-These versions of ncurses come with a `linux' terminfo entry, where
+These versions of ncurses come with a 'linux' terminfo entry, where
 the "cvvis" capability (termcap "vs") is defined as "\E[?25h\E[?8c"
 (show cursor, change size).  This escape sequence switches on a
 blinking hardware text-mode cursor whose size is a full character
@@ -1717,12 +1717,12 @@ the "cnorm" capability as well, so that it operates on 
the software
 cursor instead of the hardware cursor.
 
 To this end, run "infocmp linux > linux-term", edit the file
-`linux-term' to make both the "cnorm" and "cvvis" capabilities send
+'linux-term' to make both the "cnorm" and "cvvis" capabilities send
 the sequence "\E[?25h\E[?17;0;64c", and then run "tic linux-term" to
 produce a modified terminfo entry.
 
 Alternatively, if you want a blinking underscore as your Emacs cursor,
-set the `visible-cursor' variable to nil in your ~/.emacs:
+set the 'visible-cursor' variable to nil in your ~/.emacs:
   (setq visible-cursor nil)
 
 Still other way is to change the "cvvis" capability to send the
@@ -1739,7 +1739,7 @@ current keymap to a file with the command
   $ kbdcontrol -d >emacs.kbd
 
 Edit emacs.kbd, and give the key you want to be the Meta key the
-definition `meta'.  For instance, if your keyboard has a ``Windows''
+definition 'meta'.  For instance, if your keyboard has a "Windows"
 key with scan code 105, change the line for scan code 105 in emacs.kbd
 to look like this
 
@@ -1756,7 +1756,7 @@ to make the Windows key the Meta key.  Load the new 
keymap with
 address@hidden says:
 
 The problem is that in your .cshrc you have something that tries to
-execute `tty`.  If you are not running the shell on a real tty then
+execute 'tty'.  If you are not running the shell on a real tty then
 tty will print "not a tty".  Csh expects one word in some places,
 but tty is giving it back 3.
 
@@ -1772,7 +1772,7 @@ if ("`tty`" == "/dev/console")
 Even better, move things that set up terminal sections out of .cshrc
 and into .login.
 
-*** HP/UX: `Pid xxx killed due to text modification or page I/O error'.
+*** HP/UX: 'Pid xxx killed due to text modification or page I/O error'.
 
 On HP/UX, you can get that error when the Emacs executable is on an NFS
 file system.  HP/UX responds this way if it tries to swap in a page and
@@ -1830,7 +1830,7 @@ This is a bug in HPUX; HPUX patch PHKL_16260 is said to 
fix it.
 *** AIX: Trouble using ptys.
 
 People often install the pty devices on AIX incorrectly.
-Use `smit pty' to reinstall them properly.
+Use 'smit pty' to reinstall them properly.
 
 *** AIXterm: Your Delete key sends a Backspace to the terminal.
 
@@ -1842,22 +1842,22 @@ The solution is to include in your .Xdefaults the lines:
 This makes your Backspace key send DEL (ASCII 127).
 
 *** AIX: If linking fails because libXbsd isn't found, check if you
-are compiling with the system's `cc' and CFLAGS containing `-O5'.  If
+are compiling with the system's 'cc' and CFLAGS containing '-O5'.  If
 so, you have hit a compiler bug.  Please make sure to re-configure
-Emacs so that it isn't compiled with `-O5'.
+Emacs so that it isn't compiled with '-O5'.
 
 *** AIX 4.3.x or 4.4: Compiling fails.
 
 This could happen if you use /bin/c89 as your compiler, instead of
-the default `cc'.  /bin/c89 treats certain warnings, such as benign
+the default 'cc'.  /bin/c89 treats certain warnings, such as benign
 redefinitions of macros, as errors, and fails the build.  A solution
-is to use the default compiler `cc'.
+is to use the default compiler 'cc'.
 
 *** AIX 4: Some programs fail when run in a Shell buffer
 with an error message like   No terminfo entry for "unknown".
 
 On AIX, many terminal type definitions are not installed by default.
-`unknown' is one of them.  Install the "Special Generic Terminal
+'unknown' is one of them.  Install the "Special Generic Terminal
 Definitions" to make them defined.
 
 ** Solaris
@@ -1900,10 +1900,10 @@ suspects that the bug was fixed by one of these more 
recent patches:
 This happens when Emacs was built on some other version of Solaris.
 Rebuild it on Solaris 8.
 
-*** When using M-x dbx with the SparcWorks debugger, the `up' and `down'
+*** When using M-x dbx with the SparcWorks debugger, the 'up' and 'down'
 commands do not move the arrow in Emacs.
 
-You can fix this by adding the following line to `~/.dbxinit':
+You can fix this by adding the following line to '~/.dbxinit':
 
  dbxenv output_short_file_name off
 
@@ -1934,7 +1934,7 @@ compiling with GCC 4.2.3 or CC 5.7, with no optimizations.
 
 *** Irix: Trouble using ptys, or running out of ptys.
 
-The program mkpts (which may be in `/usr/adm' or `/usr/sbin') needs to
+The program mkpts (which may be in '/usr/adm' or '/usr/sbin') needs to
 be set-UID to root, or non-root programs like Emacs will not be able
 to allocate ptys reliably.
 
@@ -2002,8 +2002,8 @@ ahead of any optional DLLs loaded on-demand later in the 
session.
 ** File selection dialog opens in incorrect directories
 
 Invoking the file selection dialog on Windows 7 or later shows a
-directory that is different from what was passed to `read-file-name'
-or `x-file-dialog' via their arguments.
+directory that is different from what was passed to 'read-file-name'
+or 'x-file-dialog' via their arguments.
 
 This is due to a deliberate change in behavior of the file selection
 dialogs introduced in Windows 7.  It is explicitly described in the
@@ -2029,7 +2029,7 @@ see bug#2062.
 
 ** Setting w32-pass-rwindow-to-system and w32-pass-lwindow-to-system to nil
 does not prevent the Start menu from popping up when the left or right
-``Windows'' key is pressed.
+"Windows" key is pressed.
 
 This was reported to happen when XKeymacs is installed.  At least with
 XKeymacs Version 3.47, deactivating XKeymacs when Emacs is active is
@@ -2146,7 +2146,7 @@ method.
 
 To bind keys that produce non-ASCII characters with modifiers, you
 must specify raw byte codes.  For instance, if you want to bind
-META-a-grave to a command, you need to specify this in your `~/.emacs':
+META-a-grave to a command, you need to specify this in your '~/.emacs':
 
   (global-set-key [?\M-\340] ...)
 
@@ -2170,14 +2170,14 @@ daylight savings switchovers by the Windows libraries.
 ** Files larger than 4GB report wrong size in a 32-bit Windows build
 
 Files larger than 4GB cause overflow in the size (represented as a
-32-bit integer) reported by `file-attributes'.  This affects Dired as
-well, since the Windows port uses a Lisp emulation of `ls', which relies
-on `file-attributes'.
+32-bit integer) reported by 'file-attributes'.  This affects Dired as
+well, since the Windows port uses a Lisp emulation of 'ls', which relies
+on 'file-attributes'.
 
 ** Playing sound doesn't support the :data method
 
-Sound playing is not supported with the `:data DATA' key-value pair.
-You _must_ use the `:file FILE' method.
+Sound playing is not supported with the ':data DATA' key-value pair.
+You _must_ use the ':file FILE' method.
 
 ** Typing Alt-Shift has strange effects on MS-Windows.
 
@@ -2201,7 +2201,7 @@ of Bash, up to b20.1, did receive SIGINT from Emacs.)
 
 ** Accessing remote files with ange-ftp hangs the MS-Windows version of Emacs.
 
-If the FTP client is the Cygwin port of GNU `ftp', this appears to be
+If the FTP client is the Cygwin port of GNU 'ftp', this appears to be
 due to some bug in the Cygwin DLL or some incompatibility between it
 and the implementation of asynchronous subprocesses in the Windows
 port of Emacs.  Specifically, some parts of the FTP server responses
@@ -2210,15 +2210,15 @@ confuses ange-ftp.
 
 The solution is to downgrade to an older version of the Cygwin DLL
 (version 1.3.2 was reported to solve the problem), or use the stock
-Windows FTP client, usually found in the `C:\WINDOWS' or 'C:\WINNT'
+Windows FTP client, usually found in the 'C:\WINDOWS' or 'C:\WINNT'
 directory.  To force ange-ftp use the stock Windows client, set the
-variable `ange-ftp-ftp-program-name' to the absolute file name of the
+variable 'ange-ftp-ftp-program-name' to the absolute file name of the
 client's executable.  For example:
 
  (setq ange-ftp-ftp-program-name "c:/windows/ftp.exe")
 
 If you want to stick with the Cygwin FTP client, you can work around
-this problem by putting this in your `.emacs' file:
+this problem by putting this in your '.emacs' file:
 
  (setq ange-ftp-ftp-program-args '("-i" "-n" "-g" "-v" "--prompt" "")
 
@@ -2246,7 +2246,7 @@ was reported to fail to work.  But other commands also 
sometimes don't
 work when an antivirus package is installed.
 
 The solution is to switch the antivirus software to a less aggressive
-mode (e.g., disable the ``auto-protect'' feature), or even uninstall
+mode (e.g., disable the "auto-protect" feature), or even uninstall
 or disable it entirely.
 
 ** Pressing the mouse button on MS-Windows does not give a mouse-2 event.
@@ -2280,7 +2280,7 @@ Under Windows, the AltGr key on international keyboards 
generates key
 events with the modifiers Right-Alt and Left-Ctrl.  Since Emacs cannot
 distinguish AltGr from an explicit Right-Alt and Left-Ctrl
 combination, whenever it sees Right-Alt and Left-Ctrl it assumes that
-AltGr has been pressed.  The variable `w32-recognize-altgr' can be set
+AltGr has been pressed.  The variable 'w32-recognize-altgr' can be set
 to nil to tell Emacs that AltGr is really Ctrl and Alt.
 
 ** Under some X-servers running on MS-Windows, Emacs's display is incorrect.
@@ -2295,7 +2295,7 @@ as well; it is reportedly solved in version 6.2.0.16 and 
later.  The
 problem lies in the X-server settings.
 
 There are reports that you can solve the problem with Exceed by
-running `Xconfig' from within NT, choosing "X selection", then
+running 'Xconfig' from within NT, choosing "X selection", then
 un-checking the boxes "auto-copy X selection" and "auto-paste to X
 selection".
 
@@ -2307,13 +2307,13 @@ If you do, please send it to address@hidden so we can 
list it here.
 
 ** Configuration
 
-*** `configure' warns ``accepted by the compiler, rejected by the 
preprocessor''.
+*** 'configure' warns "accepted by the compiler, rejected by the preprocessor".
 
 This indicates a mismatch between the C compiler and preprocessor that
 configure is using.  For example, on Solaris 10 trying to use
 CC=/opt/SUNWspro/bin/cc (the Sun Studio compiler) together with
 CPP=/usr/ccs/lib/cpp can result in errors of this form (you may also
-see the error ``"/usr/include/sys/isa_defs.h", line 500: undefined control'').
+see the error '"/usr/include/sys/isa_defs.h", line 500: undefined control').
 
 The solution is to tell configure to use the correct C preprocessor
 for your C compiler (CPP="/opt/SUNWspro/bin/cc -E" in the above
@@ -2321,14 +2321,14 @@ example).
 
 ** Compilation
 
-*** Building Emacs over NFS fails with ``Text file busy''.
+*** Building Emacs over NFS fails with "Text file busy".
 
 This was reported to happen when building Emacs on a GNU/Linux system
 (Red Hat Linux 6.2) using a build directory automounted from Solaris
 (SunOS 5.6) file server, but it might not be limited to that
 configuration alone.  Presumably, the NFS server doesn't commit the
 files' data to disk quickly enough, and the Emacs executable file is
-left ``busy'' for several seconds after Emacs has finished dumping
+left "busy" for several seconds after Emacs has finished dumping
 itself.  This causes the subsequent commands which invoke the dumped
 Emacs executable to fail with the above message.
 
@@ -2343,9 +2343,9 @@ you have a different version of the OS or the NFS server, 
you can
 force the NFS server to use 1KB blocks, which was reported to fix the
 problem albeit at a price of slowing down file I/O.  You can force 1KB
 blocks by specifying the "-o  rsize=1024,wsize=1024" options to the
-`mount' command, or by adding ",rsize=1024,wsize=1024" to the mount
+'mount' command, or by adding ",rsize=1024,wsize=1024" to the mount
 options in the appropriate system configuration file, such as
-`/etc/auto.home'.
+'/etc/auto.home'.
 
 Alternatively, when Make fails due to this problem, you could wait for
 a few seconds and then invoke Make again.  In one particular case,
@@ -2353,13 +2353,13 @@ waiting for 10 or more seconds between the two Make 
invocations seemed
 to work around the problem.
 
 Similar problems can happen if your machine NFS-mounts a directory
-onto itself.  Suppose the Emacs sources live in `/usr/local/src' and
-you are working on the host called `marvin'.  Then an entry in the
-`/etc/fstab' file like the following is asking for trouble:
+onto itself.  Suppose the Emacs sources live in '/usr/local/src' and
+you are working on the host called 'marvin'.  Then an entry in the
+'/etc/fstab' file like the following is asking for trouble:
 
     marvin:/usr/local/src /usr/local/src ...options.omitted...
 
-The solution is to remove this line from `/etc/fstab'.
+The solution is to remove this line from '/etc/fstab'.
 
 *** Building a 32-bit executable on a 64-bit GNU/Linux architecture.
 
@@ -2418,10 +2418,10 @@ Some versions of mingw32 make on some versions of 
Windows do not seem
 to detect the shell correctly.  Try "make SHELL=cmd.exe", or if that
 fails, try running make from Cygwin bash instead.
 
-*** Building `ctags' for MS-Windows with the MinGW port of GCC fails.
+*** Building 'ctags' for MS-Windows with the MinGW port of GCC fails.
 
 This might happen due to a bug in the MinGW header assert.h, which
-defines the `assert' macro with a trailing semi-colon.  The following
+defines the 'assert' macro with a trailing semi-colon.  The following
 patch to assert.h should solve this:
 
  *** include/assert.h.orig     Sun Nov  7 02:41:36 1999
@@ -2516,7 +2516,7 @@ and you need to add -lansi just before -lc.
 The precise file names depend on the compiler version, so we
 cannot easily arrange to supply them.
 
-*** `tparam' reported as a multiply-defined symbol when linking with ncurses.
+*** 'tparam' reported as a multiply-defined symbol when linking with ncurses.
 
 This problem results from an incompatible change in ncurses, in
 version 1.9.9e approximately.  This version is unable to provide a
@@ -2534,14 +2534,14 @@ with development builds, since the .elc files are 
pre-compiled in releases.
 *** "No rule to make target" with Ubuntu 8.04 make 3.81-3build1
 
 Compiling the lisp files fails at random places, complaining:
-"No rule to make target `/path/to/some/lisp.elc'".
+"No rule to make target '/path/to/some/lisp.elc'".
 The causes of this problem are not understood.  Using GNU make 3.81 compiled
 from source, rather than the Ubuntu version, worked.
 See <URL:http://debbugs.gnu.org/327>, <URL:http://debbugs.gnu.org/821>.
 
 ** Dumping
 
-*** Segfault during `make bootstrap' under the Linux kernel.
+*** Segfault during 'make bootstrap' under the Linux kernel.
 
 In Red Hat Linux kernels, "Exec-shield" functionality is enabled by
 default, which creates a different memory layout that can break the
@@ -2576,7 +2576,7 @@ by echoing the original values back to the files.
     echo 0 > /proc/sys/kernel/exec-shield
     echo 0 > /proc/sys/kernel/randomize_va_space
 
-Or, on x86, you can try using the `setarch' command when running
+Or, on x86, you can try using the 'setarch' command when running
 temacs, like this:
 
     setarch i386 -R ./temacs --batch --load loadup [dump|bootstrap]
@@ -2590,7 +2590,7 @@ or
 *** temacs prints "Pure Lisp storage exhausted".
 
 This means that the Lisp code loaded from the .elc and .el files during
-`temacs --batch --load loadup dump' took up more space than was allocated.
+'temacs --batch --load loadup dump' took up more space than was allocated.
 
 This could be caused by
  1) adding code to the preloaded Lisp files
@@ -2614,7 +2614,7 @@ of something else that is wrong.  Be sure to check and 
fix the real problem.
 
 *** OpenBSD 4.0 macppc: Segfault during dumping.
 
-The build aborts with signal 11 when the command `./temacs --batch
+The build aborts with signal 11 when the command './temacs --batch
 --load loadup bootstrap' tries to load files.el.  A workaround seems
 to be to reduce the level of compiler optimization used during the
 build (from -O2 to -O1).  It is possible this is an OpenBSD
@@ -2632,8 +2632,8 @@ It is/will be fixed in an openSUSE update.
 
 This was reported to happen when Emacs is built in a directory mounted
 via NFS, for some combinations of NFS client and NFS server.
-Usually, the file `emacs' produced in these cases is full of
-binary null characters, and the `file' utility says:
+Usually, the file 'emacs' produced in these cases is full of
+binary null characters, and the 'file' utility says:
 
     emacs: ASCII text, with no line terminators
 
@@ -2695,7 +2695,7 @@ Install the current Motif runtime library patch 
appropriate for your host.
 (Make sure the patch is current; some older patch versions still have the bug.)
 You should install the other patches recommended by Sun for your host, too.
 You can obtain Sun patches from ftp://sunsolve.sun.com/pub/patches/;
-look for files with names ending in `.PatchReport' to see which patches
+look for files with names ending in '.PatchReport' to see which patches
 are currently recommended for your host.
 
 On Solaris 2.6, Emacs is said to work with Motif when Solaris patch
@@ -2722,7 +2722,7 @@ if you link with the MIT X11 libraries instead of the 
Solaris X11 libraries.
 
 *** MS-Windows NT/95: Problems running Perl under Emacs
 
-`perl -de 0' just hangs when executed in an Emacs subshell.
+'perl -de 0' just hangs when executed in an Emacs subshell.
 The fault lies with Perl (indirectly with Windows NT/95).
 
 The problem is that the Perl debugger explicitly opens a connection to
@@ -2807,9 +2807,9 @@ program in JDEE when javac.exe is installed, but not on 
the system PATH.
 *** When compiling with DJGPP on MS-Windows NT or later, "config msdos" fails.
 
 If the error message is "VDM has been already loaded", this is because
-Windows has a program called `redir.exe' that is incompatible with a
+Windows has a program called 'redir.exe' that is incompatible with a
 program by the same name supplied with DJGPP, which is used by
-config.bat.  To resolve this, move the DJGPP's `bin' subdirectory to
+config.bat.  To resolve this, move the DJGPP's 'bin' subdirectory to
 the front of your PATH environment variable.
 
 *** When Emacs compiled with DJGPP runs on Windows 2000 and later, it cannot
@@ -2826,8 +2826,8 @@ Emacs complains about, where USER is your username or the 
literal
 string "dosuser", which is the default username set up by the DJGPP
 startup file DJGPP.ENV.)
 
-This happens when the functions `user-login-name' and
-`user-real-login-name' return different strings for your username as
+This happens when the functions 'user-login-name' and
+'user-real-login-name' return different strings for your username as
 Emacs sees it.  To correct this, make sure both USER and USERNAME
 environment variables are set to the same value.  Windows 2000 and
 later sets USERNAME, so if you want to keep that, make sure USER is
@@ -2852,14 +2852,14 @@ of how to avoid this problem.
 
   "Wrong type of argument: internal-facep, msdos-menu-active-face"
 
-This can happen if you define an environment variable `TERM'.  Emacs
+This can happen if you define an environment variable 'TERM'.  Emacs
 on MSDOS uses an internal terminal emulator which is disabled if the
-value of `TERM' is anything but the string "internal".  Emacs then
+value of 'TERM' is anything but the string "internal".  Emacs then
 works as if its terminal were a dumb glass teletype that doesn't
-support faces.  To work around this, arrange for `TERM' to be
+support faces.  To work around this, arrange for 'TERM' to be
 undefined when Emacs runs.  The best way to do that is to add an
 [emacs] section to the DJGPP.ENV file which defines an empty value for
-`TERM'; this way, only Emacs gets the empty value, while the rest of
+'TERM'; this way, only Emacs gets the empty value, while the rest of
 your system works as before.
 
 *** MS-DOS: Emacs crashes at startup.
@@ -2882,8 +2882,8 @@ and make sure that your memory managers are properly 
configured.  See
 the djgpp faq for configuration hints.
 
 *** Emacs compiled with DJGPP for MS-DOS/MS-Windows cannot access files
-in the directory with the special name `dev' under the root of any
-drive, e.g. `c:/dev'.
+in the directory with the special name 'dev' under the root of any
+drive, e.g. 'c:/dev'.
 
 This is an unfortunate side-effect of the support for Unix-style
 device names such as /dev/null in the DJGPP runtime library.  A
@@ -2931,7 +2931,7 @@ shortcut keys entirely by adding this line to 
~/.OWdefaults:
 *** twm: A position you specified in .Xdefaults is ignored, using twm.
 
 twm normally ignores "program-specified" positions.
-You can tell it to obey them with this command in your `.twmrc' file:
+You can tell it to obey them with this command in your '.twmrc' file:
 
   UsePPosition "on"            #allow clients to request a position
 
diff --git a/etc/README b/etc/README
index aca7331..c809d39 100644
--- a/etc/README
+++ b/etc/README
@@ -3,8 +3,6 @@ with Emacs.  This includes some text files of documentation for 
GNU
 Emacs or of interest to Emacs users, and the file of dumped docstrings
 for Emacs functions and variables.
 
-`forms-d2.dat' is an example data file used by forms-d2.el.
-
 COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 File: emacs.icon
diff --git a/etc/TERMS b/etc/TERMS
index 5052634..05df853 100644
--- a/etc/TERMS
+++ b/etc/TERMS
@@ -27,38 +27,38 @@ in every character you type).
 
 Emacs supports certain termcap strings that are not described in the
 4.2 manual but appear to be standard in system V.  The one exception
-is `cS', which I invented.
+is 'cS', which I invented.
 
-`AL'    insert several lines.  Takes one parameter, the number of
+'AL'    insert several lines.  Takes one parameter, the number of
         lines to be inserted.  You specify how to send this parameter
-       using a %-construct, just like the cursor positions in the `cm'
+       using a %-construct, just like the cursor positions in the 'cm'
        string.
 
-`DL'    delete several lines.  One parameter.
+'DL'    delete several lines.  One parameter.
 
-`IC'    insert several characters.  One parameter.
+'IC'    insert several characters.  One parameter.
 
-`DC'    delete several characters.  One parameter.
+'DC'    delete several characters.  One parameter.
 
-`rp'    repeat a character.  Takes two parameters, the character
+'rp'    repeat a character.  Takes two parameters, the character
         to be repeated and the number of times to repeat it.
-       Most likely you will use `%.' for sending the character
+       Most likely you will use '%.' for sending the character
        to be repeated.  Emacs interprets a padding spec with a *
        as giving the amount of padding per repetition.
 
        WARNING: Many terminals have a command to repeat the
        *last character output* N times.  This means that the character
        will appear N+1 times in a row when the command argument is N.
-       However, the `rp' string's parameter is the total number of
+       However, the 'rp' string's parameter is the total number of
        times wanted, not one less.  Therefore, such repeat commands
-       may be used in an `rp' string only if you use Emacs's special
-       termcap operator `%a-c\001' to subtract 1 from the repeat count
+       may be used in an 'rp' string only if you use Emacs's special
+       termcap operator '%a-c\001' to subtract 1 from the repeat count
        before substituting it into the string.  It is probably safe
        to use this even though the Unix termcap does not accept it
-       because programs other than Emacs probably won't look for `rp'
+       because programs other than Emacs probably won't look for 'rp'
        anyway.
 
-`cs'    set scroll region.  Takes two parameters, the vertical
+'cs'    set scroll region.  Takes two parameters, the vertical
        positions of the first line to include in the scroll region
        and the last line to include in the scroll region.
        Both parameters are origin-zero.  The effect of this
@@ -68,18 +68,18 @@ is `cS', which I invented.
        This is not the same convention that Emacs version 16 used.
        That is because I was led astray by unclear documentation
        of the meaning of %i in termcap strings.  Since the termcap
-       documentation for `cs' is also unclear, I had to deduce the
+       documentation for 'cs' is also unclear, I had to deduce the
        correct parameter conventions from what would make the VT-100's
-       `cs' string work properly.  From an incorrect assumption about
-       %i, I reached an incorrect conclusion about `cs', but the result
+       'cs' string work properly.  From an incorrect assumption about
+       %i, I reached an incorrect conclusion about 'cs', but the result
        worked correctly on the VT100 and ANSI terminals.  In Emacs
-       version 17, both `cs' and %i work correctly.
+       version 17, both 'cs' and %i work correctly.
 
        The version 16 convention was to pass, for the second parameter,
        the line number of the first line beyond the end of the
        scroll region.
 
-`cS'    set scroll region.  Differs from `cs' in taking parameters
+'cS'    set scroll region.  Differs from 'cs' in taking parameters
        differently.  There are four parameters:
        1. Total number of lines on the screen.
        2. Number of lines above desired scroll region.
@@ -87,22 +87,22 @@ is `cS', which I invented.
        4. Total number of lines on the screen, like #1.
        This is because an Ambassador needs the parameters like this.
 
-`cr', `do', `le'
+'cr', 'do', 'le'
        Emacs will not attempt to use ^M, ^J or ^H for cursor motion
        unless these capabilities are present and say to use those
        characters.
 
-`km'    Says the terminal has a Meta key.
+'km'    Says the terminal has a Meta key.
 
 Defining these strings is important for getting maximum performance
 from your terminal.
 
-Make sure that the `ti' string sets all modes needed for editing
+Make sure that the 'ti' string sets all modes needed for editing
 in Emacs.  For example, if your terminal has a mode that controls
 wrap at the end of the line, you must decide whether to specify
-the `am' flag in the termcap entry; whichever you decide, the `ti'
+the 'am' flag in the termcap entry; whichever you decide, the 'ti'
 string should contain commands to set the mode that way.
-(Emacs also sends the `vs' string after the `ti' string.
+(Emacs also sends the 'vs' string after the 'ti' string.
 You can put the mode-setting commands in either one of them.)
 
 *** Specific Terminal Types ***
@@ -111,13 +111,13 @@ Watch out for termcap entries for Ann Arbor Ambassadors 
that
 give too little padding for clear-screen.  7.2 msec per line is right.
 These are the strings whose padding you probably should change:
     :al=1*\E[L:dl=1*\E[M:cd=7.2*\E[J:cl=7.2*\E[H\E[J:
-I have sometimes seen `\E[2J' at the front of the `ti' string;
+I have sometimes seen '\E[2J' at the front of the 'ti' string;
 this is a clear-screen, very slow, and it can cause you to get
 Control-s sent by the terminal at startup.  I recommend removing
-the `\E[2J' from the `ti' string.
-The `ti' or `vs' strings also usually need stuff added to them, such as
+the '\E[2J' from the 'ti' string.
+The 'ti' or 'vs' strings also usually need stuff added to them, such as
     \E[>33;52;54h\E[>30;37;38;39l
-You might want to add the following to the `te' or `ve' strings:
+You might want to add the following to the 'te' or 've' strings:
     \E[>52l\E[>37h
 The following additional capabilities will improve performance:
     :AL=1*\E[%dL:DL=1*\E[%dM:IC=4\E[%d@:DC=4\E[%dP:rp=1*%.\E[%a-c\001%db:
@@ -126,20 +126,20 @@ If you find that the Meta key does not work, make sure 
that
 is present in the termcap entry.
 
 Watch out for termcap entries for VT100's that fail to specify
-the `sf' string, or that omit the padding needed for the `sf' and `sr'
+the 'sf' string, or that omit the padding needed for the 'sf' and 'sr'
 strings (2msec per line affected).  What you need is
     :sf=2*^J:sr=2*\EM:cs=\E[%i%d;%dr:
 
-The Concept-100 and Concept-108 have many modes that `ti' strings
+The Concept-100 and Concept-108 have many modes that 'ti' strings
 often fail to initialize.  If you have problems on one of these
 terminals, that is probably the place to fix them.  These terminals
-can support an `rp' string.
+can support an 'rp' string.
 
 Watch out on HP terminals for problems with standout disappearing on
 part of the mode line.  These problems are due to the absence of
 :sg#0: which some HP terminals need.
 
-The vi55 is said to require `ip=2'.
+The vi55 is said to require 'ip=2'.
 
 The Sun console should have these capabilities for good performance.
           :AL=\E[%dL:DL=\E[%dM:IC=\E[%d@:DC=\E[%dP:
@@ -154,16 +154,16 @@ commands to turn off flow control:
     define port flow control disable
 
 On System V, in the terminfo database, various terminals may have
-the `xt' flag that should not have it.  `xt' should be present only
+the 'xt' flag that should not have it.  'xt' should be present only
 for the Teleray 1061 or equivalent terminal.
 
-In particular, System V for the 386 often has `xt' for terminal type
+In particular, System V for the 386 often has 'xt' for terminal type
 AT386 or AT386-M, which is used for the console.  You should delete
 this flag.  Here is how:
 
 You can get a copy of the terminfo "source" for at386 using the
-command: `infocmp at386 >at386.tic'.  Edit the file at386.tic and remove
-the `xt' flag.  Then compile the new entry with: `tic at386.tic'.
+command: 'infocmp at386 >at386.tic'.  Edit the file at386.tic and remove
+the 'xt' flag.  Then compile the new entry with: 'tic at386.tic'.
 
 It is also reported that these terminal types sometimes have the wrong
 reverse-scroll string.  It should be \E[T, but sometimes is given as \E[S.
diff --git a/etc/TODO b/etc/TODO
index 2235431..87c53b6 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -32,19 +32,19 @@ Change src/bytecode.c so that calls from byte-code 
functions to byte-code
 functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead
 stay within exec_byte_code.
 
-** Add new `switch' byte-code
+** Add new 'switch' byte-code
 This byte-code would take one argument from the stack (the object to test)
 and one argument from the constant-pool (a switch table, implemented as an
 eq-hashtable) and would jump to the "label" contained in the hashtable.
 
-Then add a `case' special-form that can be compiled to this byte-code.
+Then add a 'case' special-form that can be compiled to this byte-code.
 This would behave just like cl-case, but instead of expanding to cond+eq it
 would be its own special form and would be compiled specially.
 
-Then change pcase to use `case' when applicable.
+Then change pcase to use 'case' when applicable.
 
 Then change the byte-compiler to recognize (cond ((eq x 'foo) bar) ...)
-and turn it into a `case' for more efficient execution.
+and turn it into a 'case' for more efficient execution.
 
 ** Improve the byte-compiler to recognize immutable (lexical) bindings
 and get rid of them if they're used only once and/or they're bound to
@@ -54,7 +54,7 @@ Such things aren't present in hand-written code, but macro 
expansion and
 defsubst can often end up generating things like
 (funcall (lambda (arg) (body)) actual) which then get optimized to
 (let ((arg actual)) (body)) but should additionally get optimized further
-when `actual' is a constant/copyable expression.
+when 'actual' is a constant/copyable expression.
 
 ** Add an "indirect goto" byte-code and use it for local lambda expressions.
 E.g. when you have code like
@@ -64,7 +64,7 @@ E.g. when you have code like
       (funcall foo toto)
       (blabla (funcall foo titi))))
 
-turn those `funcalls' into jumps and their return into indirect jumps back.
+turn those 'funcalls' into jumps and their return into indirect jumps back.
 
 ** Compile efficiently local recursive functions
 
@@ -133,10 +133,10 @@ It can use the same icons as gud.
 ** Check what minor modes don't use define-minor-mode and convert them
 to use it.
 
-** Convert all defvars with leading `*' in the doc-strings into defcustoms
+** Convert all defvars with leading '*' in the doc-strings into defcustoms
 of appropriate :type and :group.
 
-** Remove any leading `*'s from defcustom doc-strings.
+** Remove any leading '*'s from defcustom doc-strings.
 [done?] [A lot of them are in CC Mode.]
 
 ** Remove unnecessary autoload cookies from defcustoms.
@@ -235,8 +235,8 @@ Change them to use report-emacs-bug.
 ** Add a defcustom that supplies a function to name numeric backup files,
 like make-backup-file-name-function for non-numeric backup files.
 
-** `dired-mode' should specify the semantics of `buffer-modified-p' for
-dired buffers and DTRT WRT `auto-revert-mode'.
+** 'dired-mode' should specify the semantics of 'buffer-modified-p' for
+dired buffers and DTRT WRT 'auto-revert-mode'.
 
 ** Check uses of prin1 for error-handling.
 http://lists.gnu.org/archive/html/emacs-devel/2008-08/msg00456.html
@@ -254,18 +254,18 @@ 
http://lists.gnu.org/archive/html/emacs-devel/2013-11/msg00515.html
 *** Several text-property planes
 This would get us rid of font-lock-face property (and I'd be happy to
 get rid of char-property-alias-alist as well) since font-lock would
-simply use the `face' property in the `font-lock' plane.
+simply use the 'face' property in the 'font-lock' plane.
 
-Basically `put-text-property' and friends would take an extra argument PLANE
+Basically 'put-text-property' and friends would take an extra argument PLANE
 (maybe the best backward-compatible way to do that is to make it so that
 PROPERTY can be a cons cell (PLANE . PROP)).  So font-lock would
 do (put-text-property start end '(font-lock . face) value).
 
 All the properties coming from the various planes would get merged via an Elisp
-function (so it can merge `face' differently than `keymap' or it could give
+function (so it can merge 'face' differently than 'keymap' or it could give
 different priorities to different planes (we could imagine enabling/disabling
 planes)).  The merging would not happen lazily while looking up properties but
-instead it would take place eagerly in `add-text-properties'.  This is based on
+instead it would take place eagerly in 'add-text-properties'.  This is based on
 the idea that it's much more frequent to lookup properties than to
 modify them.  Also, when properties are looked up during redisplay, we
 generally can't run Elisp code, whereas we generally can do that when
@@ -276,7 +276,7 @@ properties are added.
 Currently overlays are implemented as (two) sorted singly linked lists (one
 for overlays_before some position and one for overlay_after that
 position, for some quirky definition of "before" and "after").
-The function `overlay-recenter' changes the position used for the split
+The function 'overlay-recenter' changes the position used for the split
 (and is called internally in various situations).
 
 Each overlay is itself implemented with two markers (which keep track of
@@ -418,10 +418,10 @@ from the emacsclient process.
 
 ** Give Tar mode all the features of Archive mode.
 
-** Create a category of errors called `process-error'
+** Create a category of errors called 'process-error'
   for some or all errors associated with using subprocesses.
 
-** Maybe reinterpret `parse-error' as a category of errors
+** Maybe reinterpret 'parse-error' as a category of errors
   and put some other errors under it.
 
 ** Make byte-compile warn when a doc string is too wide.
@@ -436,7 +436,7 @@ from the emacsclient process.
   customization buffers.
 
 ** Emacs Lisp mode could put an overlay on the defun for every
-  function that has advice.  The overlay could have `after-text' like
+  function that has advice.  The overlay could have 'after-text' like
   " [Function has advice]".  It might look like (defun foo [Function
   has advice] (x y) The overlay could also be a button that you could
   use to view the advice.
@@ -455,7 +455,7 @@ from the emacsclient process.
    H-S-C-M-s-double-wheel-up, ...
 
 ** Beefed-up syntax-tables.
-*** recognize multi-character syntactic entities like `begin' and `end'.
+*** recognize multi-character syntactic entities like 'begin' and 'end'.
 *** nested string-delimiters (for PostScript's (foo(bar)baz) strings).
 *** support for infix operators (with precedence).
 *** support for the $ (paired delimiter) in parse-partial-sexp.
@@ -559,7 +559,7 @@ from the emacsclient process.
 ** Make monochrome images display using the foreground and background
   colors of the applicable faces.
 
-** Make `format-time-string' preserve text properties like `format'.
+** Make 'format-time-string' preserve text properties like 'format'.
 
 ** Optionally make the cursor a little thinner at the end of a line
   or the end of the buffer.
@@ -598,24 +598,24 @@ from the emacsclient process.
   the XPMs so that the color versions work generally.  (Requires care
   with the color used for the transparent regions.)
 
-** Convenient access to the `values' variable.  It would be nice to have an
+** Convenient access to the 'values' variable.  It would be nice to have an
   interface that would show you the printed reps of the elements of the
   list in a menu, let you select one of the values, and put it into some
-  other variable, without changing the value of `values'.
+  other variable, without changing the value of 'values'.
 
 ** (Controlled by a flag) make open and close syntax match exactly,
-  i.e. `(' doesn't match `]'.
+  i.e. '(' doesn't match ']'.
 
-** Specify parameter ID-FORMAT in all calls to `file-attributes' and
-  `directory-files-and-attributes' where attributes UID or GID are used.
+** Specify parameter ID-FORMAT in all calls to 'file-attributes' and
+  'directory-files-and-attributes' where attributes UID or GID are used.
   Whenever possible, use value 'string.
   When done, change meaning of default value from 'integer to 'string.
   If value 'integer is used nowhere, remove the parameter ID-FORMAT from
-  the definition of `file-attributes' and `directory-files-and-attributes'
+  the definition of 'file-attributes' and 'directory-files-and-attributes'
   and from the calls.
 
 ** Make language-info-alist customizable.  Currently a user can customize
-  only the variable `current-language-environment'.
+  only the variable 'current-language-environment'.
 
 ** Improve language environment handling so that Emacs can fit
   better to a users locale.  Currently Emacs uses utf-8 language
@@ -630,7 +630,7 @@ from the emacsclient process.
   characters and phrase boundaries, sentence endings, collation for
   sorting (at least for unicodes), HTTP Accept-language, patterns for
   directory listings and compilation messages, yes-or-no replies,
-  common menu items when the toolkit supports it ...  `locale-info'
+  common menu items when the toolkit supports it ...  'locale-info'
   needs extending for LC_COLLATE &c.  [fx started on this.]
 
 ** Eliminate the current restriction on header printing by ps-print.
@@ -654,7 +654,7 @@ from the emacsclient process.
    Info, but also with regard to namespace), and give the value of
    lisp expressions, e.g auto-mode-alist, the right face.
 
-** Possibly make `list-holidays' eval items in the calendar-holidays variable.
+** Possibly make 'list-holidays' eval items in the calendar-holidays variable.
    See thread
    <http://lists.gnu.org/archive/html/emacs-devel/2006-02/msg01034.html>.
    address@hidden will look at this after 22.1]
@@ -1249,7 +1249,7 @@ systems for HTML/XML files automatically."
 ** Cleanup all the GC_ mark bit stuff -- there is no longer any distinction
    since the mark bit is no longer stored in the Lisp_Object itself.
 
-** Refine the `predicate' arg to read-file-name.
+** Refine the 'predicate' arg to read-file-name.
    Currently, it mixes up the predicate to apply when doing completion and the
    one to use when terminating the selection.
 
@@ -1297,7 +1297,7 @@ for vc-rcs-update-changelog.
 
 * Other known bugs:
 
-** `make-frame' forgets unhandled parameters, at least for X11 frames.
+** 'make-frame' forgets unhandled parameters, at least for X11 frames.
 
 ** a two-char comment-starter whose two chars are symbol constituents will
 not be noticed if it appears within a word.
diff --git a/etc/compilation.txt b/etc/compilation.txt
index a69a20b..f134f53 100644
--- a/etc/compilation.txt
+++ b/etc/compilation.txt
@@ -3,13 +3,13 @@
 This shows the different kinds of messages compile recognizes by default and
 how they are rendered.  It is intended both to help you decide which matchers
 you need and as a test of the matchers.  Move the mouse over a colored part or
-use `compilation-message-face', to see how much text was actually matched.
+use 'compilation-message-face', to see how much text was actually matched.
 
 Note that the following example line should NOT be highlighted:
 Compilation started at Sat Jul  8 15:19:25
 
 The important part is the symbol(s) line at the beginning of each entry.
-These are the symbols you can customize `compilation-error-regexp-alist' for,
+These are the symbols you can customize 'compilation-error-regexp-alist' for,
 to match the messages shown in that entry.  A few complex cases have more than
 one symbol, which should be selected together.
 
@@ -551,13 +551,14 @@ index.html (13:1) Unknown element <fdjsk>
 
 * Directory tracking
 
-Directories are matched via `compilation-directory-matcher'.  Files which are
+Directories are matched via 'compilation-directory-matcher'.  Files which are
 not shown as full paths are searched for relative to the directory where the
 message was issued.
 
 Entering directory `/a/b/c'
 Leaving directory `/a/b/c'
-gmake[2]: Entering directory `/a/b/c'
+make[2]: Entering directory '/a/b/c'
+make[2]: Leaving directory '/a/b/c'
 makepp: Leaving directory `/a/b/c'
 
 
diff --git a/etc/e/README b/etc/e/README
index c547fc6..dd2c8d6 100644
--- a/etc/e/README
+++ b/etc/e/README
@@ -8,5 +8,5 @@ necessary, use:
 tic -o ../ ./eterm-color.ti
 
 The compiled file is used by lisp/term.el, so if it is moved term.el
-needs to be changed.  terminfo requires it to be stored in an `e'
+needs to be changed.  terminfo requires it to be stored in an 'e'
 subdirectory (the first character of the file name).
diff --git a/etc/enriched.txt b/etc/enriched.txt
index 637b621..974a90a 100644
--- a/etc/enriched.txt
+++ b/etc/enriched.txt
@@ -22,7 +22,7 @@ and is also an example file in the <italic>text/enriched 
</italic>format.</inden
 <indent>Most of the time, you need not do anything to get these features
 to work.  If you visit a file that has been written out in
 <italic>text/enriched</italic> format, it will automatically be decoded, Emacs 
will
-enter `enriched-mode' while visiting it, and whenever you save it
+enter 'enriched-mode' while visiting it, and whenever you save it
 it will be saved in the same format it was read in.
 
 If you wish to create a new file, however, you will need to turn
@@ -39,7 +39,7 @@ it (which also turns on enriched-mode automatically):
 
 <fixed><indent>M-x format-decode-buffer RET text/enriched 
RET</indent></fixed></indent>
 
-    
+
 
 <x-bg-color><param>blue</param><x-color><param>white</param><bold>WHAT IS 
ENCODED</bold></x-color></x-bg-color>
 
@@ -73,7 +73,7 @@ the right margin, fully justified, centered, or left 
alone).</indent>
 
 <indent>You can add faces either with the menu or with <fixed>M-o.</fixed>  
The face is
 applied to the current region.  If you are using
-`transient-mark-mode' and the region is not active, then the face
+'transient-mark-mode' and the region is not active, then the face
 applies to whatever you type next.  Any face can have colors.  If
 this is its lone attribute, the face is put on the color submenus
 of the "Text Properties" menu.</indent>
@@ -113,8 +113,8 @@ indenting only that part.</indent></indent>
 
 
 
-<indent><nofill>Several styles of justification are possible, the simplest 
being <italic>unfilled. 
-</italic>This means that your lines will be left as you write them. 
+<indent><nofill>Several styles of justification are possible, the simplest 
being <italic>unfilled.
+</italic>This means that your lines will be left as you write them.
 This paragraph is unfilled.</nofill>
 
 
@@ -125,16 +125,15 @@ lines are aligned at the left margin but left uneven at 
the right.</flushleft>
 <flushright>    <italic>FlushRight</italic> makes each line flush with the 
right margin instead.
     This paragraph is FlushRight.</flushright>
 
-    
 
 <flushboth><italic>FlushBoth </italic>regions, which are sometimes called 
"fully justified"
 are aligned evenly on both edges, so that the text on the page has
-a smooth appearance as in a book or newspaper article. 
+a smooth appearance as in a book or newspaper article.
 Unfortunately this does not look as nice with a fixed-width font
 as it does in a proportionally-spaced printed document; the extra
-spaces that are needed on the screen can make it hard to read. </flushboth>
+spaces that are needed on the screen can make it hard to read.</flushboth>
 
-<center>    
+<center>
 
     <bold>Center</bold>
 
@@ -145,10 +144,10 @@ spaces that are needed on the screen can make it hard to 
read. </flushboth>
     M-j or the "Text Properties" menu also can be used to change
     justification.
 
-    
+
 
 </center><flushboth>Note that justification can only change at hard newlines, 
because
-that is the unit over which filling gets done. </flushboth></indent>
+that is the unit over which filling gets done.</flushboth></indent>
 
 
 
<x-bg-color><param>blue</param><x-color><param>white</param><bold>EXCERPTS</bold></x-color></x-bg-color>
@@ -156,7 +155,7 @@ that is the unit over which filling gets done. 
</flushboth></indent>
 
 <excerpt><indent>This is an example of an excerpt.  You can use them for quoted
 parts of other people's email messages and the like.  It is just a
-face, which is the same as the `italic' face by default.</indent></excerpt>
+face, which is the same as the 'italic' face by default.</indent></excerpt>
 
 
 <x-bg-color><param>blue</param><x-color><param>white</param><bold>THE FILE 
FORMAT</bold></x-color></x-bg-color>
@@ -221,7 +220,7 @@ it.</indent>
 
 + Notice and re-fill when window changes widths (optionally).
 
-+ Deal with the `category' text-property in a smart way.
++ Deal with the 'category' text-property in a smart way.
 
 + Interface w/ Gnus, VM, RMAIL.  Maybe Info too?  </indent>(Gnus 5.9 copes
 
diff --git a/etc/grep.txt b/etc/grep.txt
index 5b226fe..0721810 100644
--- a/etc/grep.txt
+++ b/etc/grep.txt
@@ -78,8 +78,8 @@ bzr grep --color=always -in "org-element-map"
 lisp/org/org.el:21047:                    
(org-element-map
 
 * git-grep
-  with `[diff "lisp"] xfuncname = "^(\\(.*)$"' in .gitconfig
-  and `*.el diff=lisp' in .gitattributes
+  with '[diff "lisp"] xfuncname = "^(\\(.*)$"' in .gitconfig
+  and '*.el diff=lisp' in .gitattributes
 
 git --no-pager grep -inH -p -e "org-element-map"
 lisp/org/org.el=20969=(defun org-fill-paragraph (&optional 
justify)
diff --git a/etc/refcards/README b/etc/refcards/README
index 57069ad..ec20f2f 100644
--- a/etc/refcards/README
+++ b/etc/refcards/README
@@ -13,10 +13,10 @@ split some of the files needed to process non-English 
output into
 separate, optional packages such as: texlive-lang-cyrillic,
 texlive-lang-czechslovak, texlive-lang-german, and texlive-lang-polish.
 
-Type `make all' (or `make pdf') to generate PDF versions of all the cards.
-For PostScript format, use `make ps'.
+Type 'make all' (or 'make pdf') to generate PDF versions of all the cards.
+For PostScript format, use 'make ps'.
 To only generate the cards for a specific language, use e.g.
-`make french' or `make french-ps'.  As mentioned above, you may need
+'make french' or 'make french-ps'.  As mentioned above, you may need
 to install extra TeX packages for some languages.
 
 PDF and PS copies of these cards are also available at
diff --git a/etc/yow.lines b/etc/yow.lines
index 98724e1..7ed0c97 100644
Binary files a/etc/yow.lines and b/etc/yow.lines differ
diff --git a/leim/makefile.w32-in b/leim/makefile.w32-in
deleted file mode 100644
index c9bc419..0000000
--- a/leim/makefile.w32-in
+++ /dev/null
@@ -1,237 +0,0 @@
-# -*- Makefile -*- for leim subdirectory in GNU Emacs on the Microsoft Windows 
API.
-
-# Copyright (C) 2000-2015 Free Software Foundation, Inc.
-# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-#   2006, 2007
-#   National Institute of Advanced Industrial Science and Technology (AIST)
-#   Registration Number H14PRO021
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-srcdir=.
-
-# Where to install LEIM files.
-INSTALLDIR=$(INSTALL_DIR)/leim
-
-# On IBM RS6000, double-dot gets screwed up.
-dot = .
-
-# Which Emacs to use to convert TIT files to Emacs Lisp files,
-# byte-compile Emacs Lisp files, and generate the file leim-list.el.
-BUILT_EMACS = $(THISDIR)/$(dot)$(dot)/src/$(BLD)/emacs.exe
-
-buildlisppath=$(CURDIR)/$(dot)$(dot)/lisp
-
-# How to run Emacs.
-RUN_EMACS = "$(BUILT_EMACS)" -batch --no-site-file --no-site-lisp
-
-# Set EMACSLOADPATH correctly (already defined in environment).
-EMACSLOADPATH=$(buildlisppath)
-
-# Subdirectories to be made if $(srcdir) is different from the current
-# directory.
-SUBDIRS=quail
-
-# Files generated from TIT dictionaries for Chinese GB character set.
-TIT_GB=\
-       quail/CCDOSPY.elc       \
-       quail/Punct.elc         \
-       quail/QJ.elc            \
-       quail/SW.elc            \
-       quail/TONEPY.elc
-
-# Files generated from TIT dictionaries for Chinese BIG5 character set.
-TIT_BIG5=\
-       quail/4Corner.elc       \
-       quail/ARRAY30.elc       \
-       quail/ECDICT.elc        \
-       quail/ETZY.elc          \
-       quail/Punct-b5.elc      \
-       quail/PY-b5.elc         \
-       quail/QJ-b5.elc         \
-       quail/ZOZY.elc
-
-CHINESE_TIT=$(TIT_GB) $(TIT_BIG5)
-
-NON_TIT_GB=$(srcdir)/quail/py-punct.elc
-
-NON_TIT_BIG5=$(srcdir)/quail/pypunct-b5.elc
-
-CHINESE_NON_TIT=$(NON_TIT_GB) $(NON_TIT_BIG5)
-
-CHINESE_GB=$(TIT_GB) $(NON_TIT_GB)
-
-CHINESE_BIG5=$(TIT_BIG5) $(NON_TIT_BIG5)
-
-JAPANESE=$(srcdir)/quail/japanese.elc $(srcdir)/ja-dic/ja-dic.elc
-
-KOREAN=        $(srcdir)/quail/hangul.elc      \
-       $(srcdir)/quail/hanja.elc       \
-       $(srcdir)/quail/hanja3.elc      \
-       $(srcdir)/quail/hanja-jis.elc   \
-       $(srcdir)/quail/symbol-ksc.elc
-
-THAI=$(srcdir)/quail/thai.elc
-
-VIETNAMESE=$(srcdir)/quail/viqr.elc $(srcdir)/quail/vntelex.elc
-
-LAO=$(srcdir)/quail/lao.elc $(srcdir)/quail/lrt.elc
-
-INDIAN=$(srcdir)/quail/indian.elc
-
-TIBETAN=$(srcdir)/quail/tibetan.elc
-
-LATIN= $(srcdir)/quail/latin-pre.elc   \
-       $(srcdir)/quail/latin-post.elc  \
-       $(srcdir)/quail/latin-alt.elc   \
-       $(srcdir)/quail/latin-ltx.elc   \
-       $(srcdir)/quail/welsh.elc
-
-UNICODE=$(srcdir)/quail/sgml-input.elc \
-       $(srcdir)/quail/rfc1345.elc     \
-       $(srcdir)/quail/uni-input.elc
-
-SLAVIC= \
-       $(srcdir)/quail/czech.elc \
-       $(srcdir)/quail/croatian.elc \
-       $(srcdir)/quail/slovak.elc
-
-GREEK=$(srcdir)/quail/greek.elc
-
-RUSSIAN=$(srcdir)/quail/cyrillic.elc $(srcdir)/quail/cyril-jis.elc
-
-MISC= \
-       $(srcdir)/quail/arabic.elc \
-       $(srcdir)/quail/ethiopic.elc \
-       $(srcdir)/quail/ipa.elc \
-       $(srcdir)/quail/ipa-praat.elc \
-       $(srcdir)/quail/hebrew.elc \
-       $(srcdir)/quail/georgian.elc \
-       $(srcdir)/quail/persian.elc \
-       $(srcdir)/quail/sisheng.elc
-
-MISC_DIC=\
-       quail/tsang-b5.elc      \
-       quail/quick-b5.elc      \
-       quail/tsang-cns.elc     \
-       quail/quick-cns.elc     \
-       quail/PY.elc            \
-       quail/ZIRANMA.elc       \
-       quail/CTLau.elc         \
-       quail/CTLau-b5.elc
-
-CHINESE=$(CHINESE_GB) $(CHINESE_BIG5)
-EASTASIA=$(CHINESE) $(JAPANESE) $(KOREAN)
-ASIA=$(EASTASIA) $(THAI) $(VIETNAMESE) $(LAO) $(INDIAN) $(TIBETAN)
-EUROPEAN=$(LATIN) $(SLAVIC) $(GREEK) $(RUSSIAN)
-WORLD=$(ASIA) $(EUROPEAN) $(MISC) $(MISC_DIC) $(UNICODE)
-
-TIT=$(CHINESE_TIT)
-NON_TIT=$(CHINESE_NON_TIT) $(JAPANESE) $(KOREAN) $(EUROPEAN) $(MISC)
-
-.SUFFIXES: .elc .el
-
-.el.elc:
-       $(RUN_EMACS) -f batch-byte-compile $<
-
-all: $(BUILT_EMACS) $(SUBDIRS) $(WORLD) leim-list.el
-
-# To ensure that we can run Emacs.  This target is ignored (never
-# being hit) if a user changes default value of EMACS.
-$(dot)$(dot)/src/emacs:
-       cd ../src; $(MAKE) $(MFLAGS) emacs
-
-$(SUBDIRS):
-       mkdir "$@"
-       echo stamp>stamp-subdir
-
-# The rules which generate $(TIT) and ${MISC_DIC) files create them all
-# in one go.  So we need to prevent parallel execution for that target,
-# otherwise Emacs complains about files being locked.  .NOTPARALLEL is
-# for GNU Make, .NO_PARALLEL is for other Make's.
-.NOTPARALLEL: $(TIT) $(MISC_DIC)
-
-.NO_PARALLEL: $(TIT) $(MISC_DIC)
-
-# Rule to generate quail/*.el from CXTERM-DIC/*.tit.
-#
-# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
-#          this can break with GNU Make 3.81 and later if sh.exe is used.
-$(TIT):
-       $(RUN_EMACS) -l \
-           $(ARGQUOTE)$(buildlisppath)/international/titdic-cnv$(ARGQUOTE) \
-           --eval $(ARGQUOTE)(batch-titdic-convert t)$(ARGQUOTE) \
-           -dir quail $(srcdir)/CXTERM-DIC
-       $(RUN_EMACS)  -l \
-           $(ARGQUOTE)$(buildlisppath)/international/quail$(ARGQUOTE) \
-           -f batch-byte-compile $(TIT:.elc=.el)
-
-# Rule to generate quail/*.el from MISC_DIC/*.tit.
-$(MISC_DIC):
-       $(RUN_EMACS) -l \
-           $(ARGQUOTE)$(buildlisppath)/international/titdic-cnv$(ARGQUOTE) \
-           -f batch-miscdic-convert -dir quail $(srcdir)/MISC-DIC
-       $(RUN_EMACS)  -l \
-           $(ARGQUOTE)$(buildlisppath)/international/quail$(ARGQUOTE) \
-           -f batch-byte-compile $(MISC_DIC:.elc=.el)
-
-# Rule to generate ja-dic/ja-dic.el from SKK-DIC/SKK-JISYO.L.
-$(srcdir)/ja-dic/ja-dic.el: $(srcdir)/SKK-DIC/SKK-JISYO.L
-       - mkdir ja-dic
-       $(RUN_EMACS) -l \
-           $(ARGQUOTE)$(buildlisppath)/international/ja-dic-cnv$(ARGQUOTE) \
-           -f batch-skkdic-convert -dir ja-dic $(srcdir)/SKK-DIC/SKK-JISYO.L
-
-#
-# WARNING: Do NOT split the parts inside $(ARGQUOTE)s into multiple lines as
-#          this can break with GNU Make 3.81 and later if sh.exe is used.
-leim-list.el: $(SUBDIRS) $(WORLD) $(srcdir)/leim-ext.el
-       - $(DEL) leim-list.el
-       $(RUN_EMACS) -l \
-           $(ARGQUOTE)$(buildlisppath)/international/quail$(ARGQUOTE) \
-           --eval $(ARGQUOTE)(update-leim-list-file 
$(DQUOTE).$(DQUOTE))$(ARGQUOTE)
-       $(RUN_EMACS) --eval $(ARGQUOTE)(w32-append-code-lines 
$(DQUOTE)address@hidden(DQUOTE) 
$(DQUOTE)$(srcdir)/leim-ext.el$(DQUOTE))$(ARGQUOTE)
-
-install: all
-       - mkdir "$(INSTALLDIR)"
-       - $(DEL) $(DIRNAME)_same-dir.tst
-       - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
-       echo SameDirTest > $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
-       $(IFNOTSAMEDIR) $(CP) leim-list.el $(INSTALLDIR) $(ENDIF)
-       $(IFNOTSAMEDIR) $(CP_DIR) quail $(INSTALLDIR) $(ENDIF)
-       $(IFNOTSAMEDIR) $(CP_DIR) ja-dic $(INSTALLDIR) $(ENDIF)
-       - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
-
-clean mostlyclean:
-       - $(FOREACH) $(TIT) $(FORDO) $(DEL) $(FORVAR) $(ENDFOR)
-       - $(FOREACH) $(MISC_DIC) $(FORDO) $(DEL) $(FORVAR) $(ENDFOR)
-       - $(FOREACH) $(TIT:.elc=.el) $(FORDO) $(DEL) $(FORVAR) $(ENDFOR)
-       - $(FOREACH) $(MISC_DIC:.elc=.el) $(FORDO) $(DEL) $(FORVAR) $(ENDFOR)
-       - $(DEL) leim-list.el
-       - $(DEL) leim-list.el~
-
-distclean: clean
-       - $(DEL) stamp-subdir
-       - $(DEL) makefile
-
-maintainer-clean: distclean
-       - $(FOREACH) $(WORLD) $(FORDO) $(DEL) $(FORVAR) $(ENDFOR)
-
-# We used to delete *~ here, but that might inadvertently remove
-# precious files if it happens to match their short 8+3 aliases.
-extraclean: maintainer-clean
-       - $(FOREACH) *.el~ "#*" $(FORDO) $(DEL) $(FORVAR) $(ENDFOR)
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 5c1e9d9..09edc7d 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -3747,27 +3747,27 @@ main (int argc, char **argv)
          fp = fopen (out_filename, "r");
          if (fp == NULL)
            {
-             yyerror ("file `%s' must exist for --append", out_filename);
+             yyerror ("file '%s' must exist for --append", out_filename);
              exit (EXIT_FAILURE);
            }
 
          rc = fseek (fp, 0, SEEK_END);
          if (rc == -1)
            {
-             yyerror ("error seeking in file `%s'", out_filename);
+             yyerror ("error seeking in file '%s'", out_filename);
              exit (EXIT_FAILURE);
            }
 
          rc = ftell (fp);
          if (rc == -1)
            {
-             yyerror ("error getting size of file `%s'", out_filename);
+             yyerror ("error getting size of file '%s'", out_filename);
              exit (EXIT_FAILURE);
            }
 
          else if (rc == 0)
            {
-             yyerror ("file `%s' is empty", out_filename);
+             yyerror ("file '%s' is empty", out_filename);
              /* It may be ok to use an empty file for appending.
                 exit (EXIT_FAILURE); */
            }
@@ -3778,7 +3778,7 @@ main (int argc, char **argv)
       yyout = fopen (out_filename, f_append ? "a" : "w");
       if (yyout == NULL)
        {
-         yyerror ("cannot open output file `%s'", out_filename);
+         yyerror ("cannot open output file '%s'", out_filename);
          exit (EXIT_FAILURE);
        }
     }
@@ -3806,7 +3806,7 @@ main (int argc, char **argv)
           FILE *fp = fopen (input_filenames[i], "r");
 
           if (fp == NULL)
-            yyerror ("cannot open input file `%s'", input_filenames[i]);
+            yyerror ("cannot open input file '%s'", input_filenames[i]);
           else
             {
              char *file;
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 357ebc7..c3e5635 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -539,7 +539,7 @@ decode_options (int argc, char **argv)
           break;
 
        default:
-         message (true, "Try `%s --help' for more information\n", progname);
+         message (true, "Try '%s --help' for more information\n", progname);
          exit (EXIT_FAILURE);
          break;
        }
@@ -961,6 +961,13 @@ set_tcp_socket (const char *local_server_file)
   /* Open up an AF_INET socket.  */
   if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
     {
+      /* Since we have an alternate to try out, this is not an error
+        yet; popping out a modal dialog at this stage would make -a
+        option totally useless for emacsclientw -- the user will
+        still get an error message if the alternate editor fails.  */
+#ifdef WINDOWSNT
+      if(!(w32_window_app () && alternate_editor))
+#endif
       sock_err_message ("socket");
       return INVALID_SOCKET;
     }
@@ -968,6 +975,9 @@ set_tcp_socket (const char *local_server_file)
   /* Set up the socket.  */
   if (connect (s, (struct sockaddr *) &server, sizeof server) < 0)
     {
+#ifdef WINDOWSNT
+      if(!(w32_window_app () && alternate_editor))
+#endif
       sock_err_message ("connect");
       return INVALID_SOCKET;
     }
@@ -1601,7 +1611,7 @@ main (int argc, char **argv)
   if ((argc - optind < 1) && !eval && current_frame)
     {
       message (true, "%s: file name or argument required\n"
-              "Try `%s --help' for more information\n",
+              "Try '%s --help' for more information\n",
               progname, progname);
       exit (EXIT_FAILURE);
     }
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 8b7f53c..f34c985 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -515,7 +515,7 @@ static const char *Ada_suffixes [] =
   { "ads", "adb", "ada", NULL };
 static const char Ada_help [] =
 "In Ada code, functions, procedures, packages, tasks and types are\n\
-tags.  Use the `--packages-only' option to create tags for\n\
+tags.  Use the '--packages-only' option to create tags for\n\
 packages only.\n\
 Ada tag names have suffixes indicating the type of entity:\n\
        Entity type:    Qualifier:\n\
@@ -526,9 +526,9 @@ Ada tag names have suffixes indicating the type of 
entity:\n\
        package body    /b\n\
        type            /t\n\
        task            /k\n\
-Thus, `M-x find-tag <RET> bidule/b <RET>' will go directly to the\n\
-body of the package `bidule', while `M-x find-tag <RET> bidule <RET>'\n\
-will just search for any tag `bidule'.";
+Thus, 'M-x find-tag <RET> bidule/b <RET>' will go directly to the\n\
+body of the package 'bidule', while 'M-x find-tag <RET> bidule <RET>'\n\
+will just search for any tag 'bidule'.";
 
 /* Assembly code */
 static const char *Asm_suffixes [] =
@@ -555,22 +555,22 @@ static const char *default_C_suffixes [] =
 #if CTAGS                              /* C help for Ctags */
 static const char default_C_help [] =
 "In C code, any C function is a tag.  Use -t to tag typedefs.\n\
-Use -T to tag definitions of `struct', `union' and `enum'.\n\
-Use -d to tag `#define' macro definitions and `enum' constants.\n\
+Use -T to tag definitions of 'struct', 'union' and 'enum'.\n\
+Use -d to tag '#define' macro definitions and 'enum' constants.\n\
 Use --globals to tag global variables.\n\
 You can tag function declarations and external variables by\n\
-using `--declarations', and struct members by using `--members'.";
+using '--declarations', and struct members by using '--members'.";
 #else                                  /* C help for Etags */
 static const char default_C_help [] =
 "In C code, any C function or typedef is a tag, and so are\n\
-definitions of `struct', `union' and `enum'.  `#define' macro\n\
-definitions and `enum' constants are tags unless you specify\n\
-`--no-defines'.  Global variables are tags unless you specify\n\
-`--no-globals' and so are struct members unless you specify\n\
-`--no-members'.  Use of `--no-globals', `--no-defines' and\n\
-`--no-members' can make the tags table file much smaller.\n\
+definitions of 'struct', 'union' and 'enum'.  '#define' macro\n\
+definitions and 'enum' constants are tags unless you specify\n\
+'--no-defines'.  Global variables are tags unless you specify\n\
+'--no-globals' and so are struct members unless you specify\n\
+'--no-members'.  Use of '--no-globals', '--no-defines' and\n\
+'--no-members' can make the tags table file much smaller.\n\
 You can tag function declarations and external variables by\n\
-using `--declarations'.";
+using '--declarations'.";
 #endif /* C help for Ctags and Etags */
 
 static const char *Cplusplus_suffixes [] =
@@ -582,10 +582,10 @@ static const char Cplusplus_help [] =
 "In C++ code, all the tag constructs of C code are tagged.  (Use\n\
 --help --lang=c --lang=c++ for full help.)\n\
 In addition to C tags, member functions are also recognized.  Member\n\
-variables are recognized unless you use the `--no-members' option.\n\
-Tags for variables and functions in classes are named `CLASS::VARIABLE'\n\
-and `CLASS::FUNCTION'.  `operator' definitions have tag names like\n\
-`operator+'.";
+variables are recognized unless you use the '--no-members' option.\n\
+Tags for variables and functions in classes are named 'CLASS::VARIABLE'\n\
+and 'CLASS::FUNCTION'.  'operator' definitions have tag names like\n\
+'operator+'.";
 
 static const char *Cjava_suffixes [] =
   { "java", NULL };
@@ -612,7 +612,7 @@ defined in the file.";
 const char *Forth_suffixes [] =
   { "fth", "tok", NULL };
 static const char Forth_help [] =
-"In Forth code, tags are words defined by `:',\n\
+"In Forth code, tags are words defined by ':',\n\
 constant, code, create, defer, value, variable, buffer:, field.";
 
 static const char *Fortran_suffixes [] =
@@ -623,18 +623,18 @@ static const char Fortran_help [] =
 static const char *HTML_suffixes [] =
   { "htm", "html", "shtml", NULL };
 static const char HTML_help [] =
-"In HTML input files, the tags are the `title' and the `h1', `h2',\n\
-`h3' headers.  Also, tags are `name=' in anchors and all\n\
-occurrences of `id='.";
+"In HTML input files, the tags are the 'title' and the 'h1', 'h2',\n\
+'h3' headers.  Also, tags are 'name=' in anchors and all\n\
+occurrences of 'id='.";
 
 static const char *Lisp_suffixes [] =
   { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL };
 static const char Lisp_help [] =
-"In Lisp code, any function defined with `defun', any variable\n\
-defined with `defvar' or `defconst', and in general the first\n\
-argument of any expression that starts with `(def' in column zero\n\
+"In Lisp code, any function defined with 'defun', any variable\n\
+defined with 'defvar' or 'defconst', and in general the first\n\
+argument of any expression that starts with '(def' in column zero\n\
 is a tag.\n\
-The `--declarations' option tags \"(defvar foo)\" constructs too.";
+The '--declarations' option tags \"(defvar foo)\" constructs too.";
 
 static const char *Lua_suffixes [] =
   { "lua", "LUA", NULL };
@@ -645,7 +645,7 @@ static const char *Makefile_filenames [] =
   { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
 static const char Makefile_help [] =
 "In makefiles, targets are tags; additionally, variables are tags\n\
-unless you specify `--no-globals'.";
+unless you specify '--no-globals'.";
 
 static const char *Objc_suffixes [] =
   { "lm",                      /* Objective lex file */
@@ -654,7 +654,7 @@ static const char *Objc_suffixes [] =
 static const char Objc_help [] =
 "In Objective C code, tags include Objective C definitions for classes,\n\
 class categories, methods and protocols.  Tags for variables and\n\
-functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\
+functions in classes are named 'CLASS::VARIABLE' and 'CLASS::FUNCTION'.\n\
 (Use --help --lang=c --lang=objc --lang=java for full help.)";
 
 static const char *Pascal_suffixes [] =
@@ -670,16 +670,16 @@ static const char *Perl_interpreters [] =
   { "perl", "@PERL@", NULL };
 static const char Perl_help [] =
 "In Perl code, the tags are the packages, subroutines and variables\n\
-defined by the `package', `sub', `my' and `local' keywords.  Use\n\
-`--globals' if you want to tag global variables.  Tags for\n\
-subroutines are named `PACKAGE::SUB'.  The name for subroutines\n\
-defined in the default package is `main::SUB'.";
+defined by the 'package', 'sub', 'my' and 'local' keywords.  Use\n\
+'--globals' if you want to tag global variables.  Tags for\n\
+subroutines are named 'PACKAGE::SUB'.  The name for subroutines\n\
+defined in the default package is 'main::SUB'.";
 
 static const char *PHP_suffixes [] =
   { "php", "php3", "php4", NULL };
 static const char PHP_help [] =
 "In PHP code, tags are functions, classes and defines.  Unless you use\n\
-the `--no-members' option, vars are tags too.";
+the '--no-members' option, vars are tags too.";
 
 static const char *plain_C_suffixes [] =
   { "pc",                      /* Pro*C file */
@@ -699,28 +699,28 @@ line.";
 static const char *Python_suffixes [] =
   { "py", NULL };
 static const char Python_help [] =
-"In Python code, `def' or `class' at the beginning of a line\n\
+"In Python code, 'def' or 'class' at the beginning of a line\n\
 generate a tag.";
 
 /* Can't do the `SCM' or `scm' prefix with a version number. */
 static const char *Scheme_suffixes [] =
   { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
 static const char Scheme_help [] =
-"In Scheme code, tags include anything defined with `def' or with a\n\
-construct whose name starts with `def'.  They also include\n\
-variables set with `set!' at top level in the file.";
+"In Scheme code, tags include anything defined with 'def' or with a\n\
+construct whose name starts with 'def'.  They also include\n\
+variables set with 'set!' at top level in the file.";
 
 static const char *TeX_suffixes [] =
   { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL };
 static const char TeX_help [] =
-"In LaTeX text, the argument of any of the commands `\\chapter',\n\
-`\\section', `\\subsection', `\\subsubsection', `\\eqno', `\\label',\n\
-`\\ref', `\\cite', `\\bibitem', `\\part', `\\appendix', `\\entry',\n\
-`\\index', `\\def', `\\newcommand', `\\renewcommand',\n\
-`\\newenvironment' or `\\renewenvironment' is a tag.\n\
+"In LaTeX text, the argument of any of the commands '\\chapter',\n\
+'\\section', '\\subsection', '\\subsubsection', '\\eqno', '\\label',\n\
+'\\ref', '\\cite', '\\bibitem', '\\part', '\\appendix', '\\entry',\n\
+'\\index', '\\def', '\\newcommand', '\\renewcommand',\n\
+'\\newenvironment' or '\\renewenvironment' is a tag.\n\
 \n\
 Other commands can be specified by setting the environment variable\n\
-`TEXTAGS' to a colon-separated list like, for example,\n\
+'TEXTAGS' to a colon-separated list like, for example,\n\
      TEXTAGS=\"mycommand:myothercommand\".";
 
 
@@ -738,11 +738,11 @@ C code are parsed as C code (use --help --lang=c 
--lang=yacc\n\
 for full help).";
 
 static const char auto_help [] =
-"`auto' is not a real language, it indicates to use\n\
+"'auto' is not a real language, it indicates to use\n\
 a default language for files base on file name suffix and file contents.";
 
 static const char none_help [] =
-"`none' is not a real language, it indicates to only do\n\
+"'none' is not a real language, it indicates to only do\n\
 regexp processing on files.";
 
 static const char no_lang_help [] =
@@ -809,8 +809,8 @@ default file names and dot suffixes:");
          printf (" .%s", *ext);
       puts ("");
     }
-  puts ("where `auto' means use default language for files based on file\n\
-name suffix, and `none' means only do regexp processing on files.\n\
+  puts ("where 'auto' means use default language for files based on file\n\
+name suffix, and 'none' means only do regexp processing on files.\n\
 If no language is specified and no matching suffix is found,\n\
 the first line of the file is read for a sharp-bang (#!) sequence\n\
 followed by the name of an interpreter.  If no such sequence is found,\n\
@@ -950,8 +950,8 @@ Relative ones are stored relative to the output file's 
directory.\n");
   puts ("      If TAGNAME/ is present, the tags created are named.\n\
        For example Tcl named tags can be created with:\n\
          --regex=\"/proc[ \\t]+\\([^ \\t]+\\)/\\1/.\".\n\
-       MODS are optional one-letter modifiers: `i' means to ignore case,\n\
-       `m' means to allow multi-line matches, `s' implies `m' and\n\
+       MODS are optional one-letter modifiers: 'i' means to ignore case,\n\
+       'm' means to allow multi-line matches, 's' implies 'm' and\n\
        causes dot to match any character, including newline.");
 
   puts ("-R, --no-regex\n\
@@ -1012,7 +1012,7 @@ Relative ones are stored relative to the output file's 
directory.\n");
         Print the version of the program.\n\
 -h, --help\n\
         Print this help message.\n\
-        Followed by one or more `--language' options prints detailed\n\
+        Followed by one or more '--language' options prints detailed\n\
         help about tag generation for the specified languages.");
 
   print_language_names ();
@@ -5797,7 +5797,7 @@ add_regex (char *regexp_pattern, language *lang)
        need_filebuf = true;
        break;
       default:
-       error ("invalid regexp modifier `%c', ignoring", modifiers[0]);
+       error ("invalid regexp modifier '%c', ignoring", modifiers[0]);
        break;
       }
 
@@ -6368,7 +6368,7 @@ pfatal (const char *s1)
 static void
 suggest_asking_for_help (void)
 {
-  fprintf (stderr, "\tTry `%s --help' for a complete list of options.\n",
+  fprintf (stderr, "\tTry '%s --help' for a complete list of options.\n",
           progname);
   exit (EXIT_FAILURE);
 }
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index bada8df..3d8f34f 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -507,7 +507,7 @@ write_c_args (char *func, char *buf, int minargs, int 
maxargs)
        {
          if (ident_length == 0)
            {
-             error ("empty arg list for `%s' should be (void), not ()", func);
+             error ("empty arg list for '%s' should be (void), not ()", func);
              continue;
            }
 
@@ -1163,7 +1163,7 @@ scan_c_stream (FILE *infile)
            }
          else if (defunflag && maxargs == -1 && !saw_usage)
            /* The DOC should provide the usage form.  */
-           fprintf (stderr, "Missing `usage' for function `%s'.\n",
+           fprintf (stderr, "Missing 'usage' for function '%s'.\n",
                     input_buffer);
        }
     }
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
deleted file mode 100644
index a81a011..0000000
--- a/lib-src/makefile.w32-in
+++ /dev/null
@@ -1,482 +0,0 @@
-#  -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
-# Copyright (C) 2000-2015 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-ALL = $(BLD)/test-distrib.exe $(BLD)/make-docfile.exe $(BLD)/hexl.exe\
- $(BLD)/ctags.exe $(BLD)/etags.exe $(BLD)/movemail.exe $(BLD)/ebrowse.exe\
- $(BLD)/emacsclient.exe $(BLD)/emacsclientw.exe $(BLD)/profile.exe
-
-.PHONY: make-docfile
-
-LOCAL_FLAGS    = -DNO_LDAV=1 -DNO_ARCHIVES=1 -I../lib \
-                 -I../nt/inc -I../src $(EMACS_EXTRA_C_FLAGS)
-
-LIBS           = $(BASE_LIBS) $(ADVAPI32)
-LIB_SRC                = .
-
-# The following target is used by makefile.w32-in files in other directories.
-make-docfile:  $(BLD)/make-docfile.exe
-
-$(BLD)/make-docfile.exe:       $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O)
-               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/make-docfile.$(O) 
$(BLD)/ntlib.$(O) $(LIBS)
-$(BLD)/hexl.exe:               $(BLD)/hexl.$(O)
-               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/hexl.$(O) $(LIBS)
-$(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O)
-               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/test-distrib.$(O) 
$(LIBS)
-               "$(BLD)/test-distrib.exe" "$(LIB_SRC)/testfile"
-
-MOVEMAILOBJS =  $(BLD)/movemail.$(O) \
-               $(BLD)/pop.$(O) \
-               ../lib/$(BLD)/libgnu.$(A) \
-               $(BLD)/ntlib.$(O)
-
-$(BLD)/movemail.exe:   $(MOVEMAILOBJS) ../lib/getopt.h
-# put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
-               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(MOVEMAILOBJS) $(WSOCK32) 
$(LIBS)
-
-ECLIENT_CFLAGS = -DHAVE_GETCWD -DHAVE_STRERROR
-ECLIENTOBJS =  $(BLD)/emacsclient.$(O) \
-               $(BLD)/ntlib.$(O) \
-               ../lib/$(BLD)/libgnu.$(A)
-CLIENTRES =    ../nt/$(BLD)/emacsclient.res
-
-$(CLIENTRES):  ../nt/emacsclient.rc
-       @echo Emacsclient resource file must be built from nt directory
-       @exit -1
-
-$(BLD)/emacsclient.exe:                $(ECLIENTOBJS)
-# put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
-               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) 
$(USER32) $(COMCTL32) $(LIBS)
-
-$(BLD)/emacsclientw.exe:       $(ECLIENTOBJS) $(CLIENTRES)
-# put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
-               $(LINK) $(LINK_OUT)$@ $(CLIENTRES) $(MWINDOWS) $(LINK_FLAGS) 
$(ECLIENTOBJS) $(WSOCK32) $(USER32) $(COMCTL32) $(LIBS)
-
-$(BLD)/emacsclient.$(O):       emacsclient.c
-               $(CC) $(CFLAGS) $(ECLIENT_CFLAGS) $(CC_OUT)$@ emacsclient.c
-
-ETAGSOBJ      = $(BLD)/etags.$(O) \
-               ../lib/$(BLD)/libgnu.$(A) \
-               $(BLD)/ntlib.$(O) \
-               $(BLD)/regex.$(O)
-
-$(BLD)/etags.exe:      $(ETAGSOBJ)
-               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(ETAGSOBJ) $(LIBS)
-
-
-EBROWSEOBJ    = $(BLD)/ebrowse.$(O) \
-               ../lib/$(BLD)/libgnu.$(A) \
-               $(BLD)/ntlib.$(O)
-
-$(BLD)/ebrowse.exe:     $(EBROWSEOBJ)
-               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(EBROWSEOBJ) $(LIBS)
-
-$(BLD)/regex.$(O): ../src/regex.c ../src/regex.h ../src/config.h
-               $(CC)  $(CFLAGS) -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
-               ../src/regex.c $(CC_OUT)$@
-
-ETAGS_CFLAGS  = -DHAVE_GETCWD -DEMACS_NAME="\"GNU Emacs\""
-$(BLD)/etags.$(O): etags.c
-               $(CC) $(CFLAGS) $(ETAGS_CFLAGS) $(CC_OUT)$@ etags.c
-
-CTAGSOBJ      = $(BLD)/ctags.$(O) \
-               ../lib/$(BLD)/libgnu.$(A) \
-               $(BLD)/ntlib.$(O) \
-               $(BLD)/regex.$(O)
-
-$(BLD)/ctags.exe:  $(CTAGSOBJ)
-               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(CTAGSOBJ) $(LIBS)
-
-ctags.c:       etags.c
-               - $(DEL) ctags.c
-               $(CP) etags.c ctags.c
-
-CTAGS_CFLAGS  = -DCTAGS $(ETAGS_CFLAGS)
-$(BLD)/ctags.$(O): ctags.c
-               $(CC) $(CFLAGS) $(CTAGS_CFLAGS) $(CC_OUT)$@ ctags.c
-
-PROFILEOBJS    = $(BLD)/profile.$(O) \
-                 ../lib/$(BLD)/libgnu.$(A) \
-                 $(BLD)/ntlib.$(O)
-$(BLD)/profile.exe:    $(PROFILEOBJS)
-               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(PROFILEOBJS) $(LIBS)
-
-#
-# From ..\src\Makefile.in
-# It doesn't matter if the real name is *.obj for the files in this list,
-# make-docfile blindly replaces .o with .c anyway.  Keep .o in this list
-# as it is required by code in doc.c.
-#
-obj =   dosfns.o msdos.o \
-       xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
-       fontset.o menu.o dbusbind.o cygw32.o \
-       nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
-       w32.o w32console.o w32fns.o w32heap.o w32inevt.o w32notify.o \
-       w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
-       w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \
-       xsettings.o xgselect.o termcap.o \
-       font.o w32font.o w32uniscribe.o w32notify.o \
-       dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \
-       charset.o coding.o category.o ccl.o character.o chartab.o \
-       cm.o term.o terminal.o xfaces.o \
-       emacs.o keyboard.o macros.o keymap.o sysdep.o \
-       buffer.o filelock.o insdel.o marker.o \
-       minibuf.o fileio.o dired.o \
-       cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
-       alloc.o data.o doc.o editfns.o callint.o \
-       eval.o floatfns.o fns.o print.o lread.o \
-       syntax.o bytecode.o \
-       process.o callproc.o unexw32.o \
-       region-cache.o sound.o atimer.o \
-       doprnt.o intervals.o textprop.o composite.o \
-       gnutls.o xml.o profiler.o
-
-#
-# These are the lisp files that are loaded up in loadup.el
-#
-lispsource = ../lisp/
-
-MOUSE_SUPPORT = \
-       $(lispsource)select.elc \
-       $(lispsource)scroll-bar.elc \
-       $(lispsource)mouse.elc
-WINNT_SUPPORT = \
-       $(lispsource)ls-lisp.elc \
-       $(lispsource)disp-table.elc \
-       $(lispsource)w32-fns.elc \
-       $(lispsource)dos-w32.elc \
-       $(lispsource)w32-vars.elc \
-       $(lispsource)term/common-win.elc \
-       $(lispsource)term/w32-win.elc
-TOOLTIP_SUPPORT = $(lispsource)tooltip.elc
-WINDOW_SUPPORT = \
-       $(lispsource)fringe.elc \
-       $(lispsource)image.elc \
-       $(lispsource)international/fontset.elc \
-       $(lispsource)dnd.elc \
-       $(lispsource)tool-bar.elc \
-       $(lispsource)mwheel.elc
-
-# lisp files that are loaded up on other platforms
-OTHER_PLATFORM_SUPPORT = \
-       $(lispsource)dos-fns.elc \
-       $(lispsource)dos-vars.elc \
-       $(lispsource)term/internal.elc \
-       $(lispsource)term/pc-win.elc \
-       $(lispsource)x-dnd.elc \
-       $(lispsource)term/x-win.elc \
-       $(lispsource)term/ns-win.elc
-
-
-lisp1= \
-       $(lispsource)abbrev.elc \
-       $(lispsource)buff-menu.elc \
-       $(lispsource)button.elc \
-       $(lispsource)emacs-lisp/byte-run.elc \
-       $(lispsource)composite.elc \
-       $(lispsource)cus-face.elc \
-       $(lispsource)cus-start.elc \
-       $(lispsource)custom.elc \
-       $(lispsource)emacs-lisp/backquote.elc \
-       $(lispsource)emacs-lisp/lisp-mode.elc \
-       $(lispsource)emacs-lisp/lisp.elc \
-       $(lispsource)env.elc \
-       $(lispsource)faces.elc \
-       $(lispsource)files.elc \
-       $(lispsource)format.elc \
-       $(lispsource)facemenu.elc \
-       $(MOUSE_SUPPORT) \
-       $(lispsource)emacs-lisp/float-sup.elc \
-       $(lispsource)frame.elc \
-       $(lispsource)help.elc \
-       $(lispsource)indent.elc \
-       $(lispsource)isearch.elc \
-       $(lispsource)rfn-eshadow.elc \
-       $(lispsource)loadup.el \
-       $(lispsource)loaddefs.el \
-       $(lispsource)bindings.elc \
-       $(lispsource)emacs-lisp/map-ynp.elc \
-       $(lispsource)menu-bar.elc \
-       $(lispsource)international/mule.elc \
-       $(lispsource)international/mule-conf.elc \
-       $(lispsource)international/mule-cmds.elc \
-       $(lispsource)international/characters.elc \
-       $(lispsource)international/charprop.el \
-       $(lispsource)case-table.elc \
-       $(lispsource)emacs-lisp/macroexp.elc
-
-lisp2 = \
-       $(lispsource)language/chinese.elc \
-       $(lispsource)language/cyrillic.elc \
-       $(lispsource)language/indian.elc \
-       $(lispsource)language/sinhala.elc \
-       $(lispsource)language/english.elc \
-       $(lispsource)language/ethiopic.elc \
-       $(lispsource)language/european.elc \
-       $(lispsource)language/czech.elc \
-       $(lispsource)language/slovak.elc \
-       $(lispsource)language/romanian.elc \
-       $(lispsource)language/greek.elc \
-       $(lispsource)language/hebrew.elc \
-       $(lispsource)language/japanese.elc \
-       $(lispsource)international/cp51932.el \
-       $(lispsource)international/eucjp-ms.el \
-       $(lispsource)language/korean.elc \
-       $(lispsource)language/lao.elc \
-       $(lispsource)language/cham.elc \
-       $(lispsource)language/tai-viet.elc \
-       $(lispsource)language/thai.elc \
-       $(lispsource)language/tibetan.elc \
-       $(lispsource)language/vietnamese.elc \
-       $(lispsource)language/misc-lang.elc \
-       $(lispsource)language/utf-8-lang.elc \
-       $(lispsource)language/georgian.elc \
-       $(lispsource)language/khmer.elc \
-       $(lispsource)language/burmese.elc \
-       $(lispsource)register.elc \
-       $(lispsource)replace.elc \
-       $(lispsource)simple.elc \
-       $(lispsource)emacs-lisp/nadvice.elc \
-       $(lispsource)minibuffer.elc \
-       $(lispsource)startup.elc \
-       $(lispsource)subr.elc \
-       $(lispsource)term/tty-colors.elc \
-       $(lispsource)font-core.elc \
-       $(lispsource)emacs-lisp/syntax.elc \
-       $(lispsource)font-lock.elc \
-       $(lispsource)jit-lock.elc \
-       $(lispsource)textmodes/fill.elc \
-       $(lispsource)textmodes/page.elc \
-       $(lispsource)textmodes/paragraphs.elc \
-       $(lispsource)textmodes/text-mode.elc \
-       $(lispsource)emacs-lisp/timer.elc \
-       $(lispsource)jka-cmpr-hook.elc \
-       $(lispsource)vc/vc-hooks.elc \
-       $(lispsource)vc/ediff-hook.elc \
-       $(lispsource)epa-hook.elc \
-       $(TOOLTIP_SUPPORT) \
-       $(WINNT_SUPPORT) \
-       $(WINDOW_SUPPORT) \
-       $(lispsource)widget.elc \
-       $(lispsource)window.elc \
-       $(lispsource)version.elc
-
-# This is needed the first time we build the tree, since temacs.exe
-# does not exist yet, and the DOC rule needs it to rebuild DOC whenever
-# Emacs is rebuilt.
-../src/$(BLD)/temacs.exe:
-       - mkdir "../src/$(OBJDIR)"
-       - mkdir "../src/$(BLD)"
-       @echo temacs > temacs.exe
-       $(CP) temacs.exe ../src/$(BLD)
-       - $(DEL) temacs.exe
-
-DOC          = DOC
-$(DOC):                stamp_BLD $(BLD)/make-docfile.exe 
../src/$(BLD)/temacs.exe $(lisp1) $(lisp2) $(OTHER_PLATFORM_SUPPORT)
-               - $(DEL) $(DOC)
-               "$(THISDIR)/$(BLD)/make-docfile" -o $(DOC) -d ../src $(obj)
-               "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp1)
-               "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp2)
-               "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src 
$(OTHER_PLATFORM_SUPPORT)
-               $(CP) $(DOC) ../etc/DOC
-               - mkdir "../src/$(OBJDIR)"
-               - mkdir "../src/$(OBJDIR)/etc"
-               $(CP) $(DOC) ../src/$(OBJDIR)/etc/DOC
-
-{$(BLD)}.$(O){$(BLD)}.exe:
-               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $*.$(O) $(LIBS)
-
-#
-# Build the executables
-#
-all:           $(ALL) $(DOC)
-
-#
-# Assuming INSTALL_DIR is defined, build and install emacs in it.
-#
-INSTALL_FILES = $(ALL)
-install:       $(INSTALL_FILES)
-               - mkdir "$(INSTALL_DIR)/bin"
-               $(CP) $(BLD)/etags.exe $(INSTALL_DIR)/bin
-               $(CP) $(BLD)/ebrowse.exe $(INSTALL_DIR)/bin
-               $(CP) $(BLD)/ctags.exe $(INSTALL_DIR)/bin
-               $(CP) $(BLD)/hexl.exe $(INSTALL_DIR)/bin
-               $(CP) $(BLD)/movemail.exe $(INSTALL_DIR)/bin
-               $(CP) $(BLD)/emacsclient.exe $(INSTALL_DIR)/bin
-               $(CP) $(BLD)/emacsclientw.exe $(INSTALL_DIR)/bin
-               $(CP) $(BLD)/profile.exe $(INSTALL_DIR)/bin
-               - mkdir "$(INSTALL_DIR)/etc"
-               $(CP) $(DOC) $(INSTALL_DIR)/etc
-
-#
-# Maintenance
-#
-# We used to delete *~ here, but that might inadvertently remove
-# precious files if it happens to match their short 8+3 aliases.
-clean:
-               - $(DEL) DOC* $(COMPILER_TEMP_FILES)
-               - $(DEL) ctags.c
-               - $(DEL_TREE) $(OBJDIR)
-               - $(DEL) stamp_BLD
-
-distclean: cleanall
-       - $(DEL) TAGS
-       - $(DEL) Makefile
-
-maintainer-clean: distclean
-
-cleanall:      clean
-               - $(DEL_TREE) obj
-               - $(DEL_TREE) obj-spd
-               - $(DEL_TREE) oo
-               - $(DEL_TREE) oo-spd
-
-#
-# Headers we would preprocess if we could.
-#
-../src/config.h:       ../nt/$(CONFIG_H)
-                       $(DEL) $@
-                       echo $(CONFIG_H) has changed.  Re-run configure.bat.
-                       exit -1
-
-### TAGS ###
-
-TAGS: $(BLD)/etags.exe *.c *.h
-       $(BLD)/etags.exe *.c *.h
-
-### DEPENDENCIES ###
-
-EMACS_ROOT     = ..
-SRC            = $(EMACS_ROOT)/src
-NT_INC         = $(EMACS_ROOT)/nt/inc
-GNU_LIB                = $(EMACS_ROOT)/lib
-
-MS_W32_H       = $(NT_INC)/ms-w32.h \
-                $(NT_INC)/sys/stat.h
-CONF_POST_H    = $(SRC)/conf_post.h \
-                $(MS_W32_H)
-CONFIG_H       = $(SRC)/config.h \
-                $(CONF_POST_H)
-INTTYPES_H     = $(NT_INC)/inttypes.h \
-                $(NT_INC)/stdint.h
-NTLIB_H        = $(LIB_SRC)/ntlib.h \
-                $(NT_INC)/pwd.h
-SYSTIME_H      = $(SRC)/systime.h \
-                $(NT_INC)/sys/time.h \
-                $(GNU_LIB)/timespec.h
-SYSWAIT_H      = $(SRC)/syswait.h \
-                $(NT_INC)/stdbool.h \
-                $(NT_INC)/sys/wait.h
-
-$(BLD)/ctags.$(O) : \
-       $(LIB_SRC)/ctags.c \
-       $(SRC)/regex.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/c-strcase.h \
-       $(GNU_LIB)/getopt.h \
-       $(CONFIG_H)
-
-$(BLD)/ebrowse.$(O) : \
-       $(LIB_SRC)/ebrowse.c \
-       $(GNU_LIB)/getopt.h \
-       $(GNU_LIB)/min-max.h \
-       $(CONFIG_H)
-
-$(BLD)/emacsclient.$(O) : \
-       $(LIB_SRC)/emacsclient.c \
-       $(NT_INC)/pwd.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/getopt.h \
-       $(CONFIG_H)
-
-$(BLD)/etags.$(O) : \
-       $(LIB_SRC)/etags.c \
-       $(SRC)/regex.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/c-strcase.h \
-       $(GNU_LIB)/getopt.h \
-       $(CONFIG_H)
-
-$(BLD)/hexl.$(O) : \
-       $(LIB_SRC)/hexl.c \
-       $(CONFIG_H)
-
-$(BLD)/make-docfile.$(O) : \
-       $(LIB_SRC)/make-docfile.c \
-       $(NT_INC)/unistd.h \
-       $(CONFIG_H)
-
-$(BLD)/movemail.$(O) : \
-       $(LIB_SRC)/movemail.c \
-       $(LIB_SRC)/pop.h \
-       $(NT_INC)/pwd.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/getopt.h \
-       $(CONFIG_H) \
-       $(NTLIB_H) \
-       $(SYSWAIT_H)
-
-$(BLD)/ntlib.$(O) : \
-       $(LIB_SRC)/ntlib.c \
-       $(NT_INC)/sys/stat.h \
-       $(NTLIB_H)
-
-$(BLD)/pop.$(O) : \
-       $(LIB_SRC)/pop.c \
-       $(LIB_SRC)/pop.h \
-       $(NT_INC)/netdb.h \
-       $(NT_INC)/pwd.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/min-max.h \
-       $(CONFIG_H) \
-       $(NTLIB_H)
-
-$(BLD)/profile.$(O) : \
-       $(LIB_SRC)/profile.c \
-       $(GNU_LIB)/intprops.h \
-       $(CONFIG_H) \
-       $(INTTYPES_H) \
-       $(SYSTIME_H)
-
-$(BLD)/regex.$(O) : \
-       $(SRC)/regex.c \
-       $(SRC)/regex.h \
-       $(NT_INC)/stdbool.h \
-       $(NT_INC)/unistd.h \
-       $(CONFIG_H)
-
-$(BLD)/test-distrib.$(O) : \
-       $(LIB_SRC)/test-distrib.c \
-       $(NT_INC)/unistd.h \
-       $(CONFIG_H)
-
-# The following dependencies are for supporting parallel builds, where
-# we must make sure $(BLD) exists before any compilation starts.
-#
-$(BLD)/make-docfile.$(O) $(BLD)/hexl.$(O): stamp_BLD
-
-$(BLD)/test-distrib.$(O) $(MOVEMAILOBJS): stamp_BLD
-
-$(BLD)/emacsclient.$(O) $(BLD)/etags.$(O) $(BLD)/regex.$(O): stamp_BLD
-
-$(BLD)/ebrowse.$(O) $(BLD)/ctags.$(O) $(BLD)/profile.$(O): stamp_BLD
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 7d9dff9..37b847b 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -302,7 +302,7 @@ is_exec (const char * name)
         stricmp (p, ".cmd") == 0));
 }
 
-/* FIXME?  This is in config.nt now - is this still needed?  */
+/* FIXME?  This is in configure.ac now - is this still needed?  */
 #define IS_DIRECTORY_SEP(x) ((x) == '/' || (x) == '\\')
 
 /* We need this because nt/inc/sys/stat.h defines struct stat that is
diff --git a/lib/makefile.w32-in b/lib/makefile.w32-in
deleted file mode 100644
index 8424fd6..0000000
--- a/lib/makefile.w32-in
+++ /dev/null
@@ -1,347 +0,0 @@
-# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
-# Copyright (C) 2011-2015 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-ALL = gnulib
-
-.PHONY: $(ALL)
-
-LOCAL_FLAGS    = -I. -I../nt/inc -I../src
-LIBS           =
-
-GNULIBOBJS = $(BLD)/acl-errno-valid.$(O) \
-            $(BLD)/c-ctype.$(O) \
-            $(BLD)/c-strcasecmp.$(O) \
-            $(BLD)/c-strncasecmp.$(O) \
-            $(BLD)/close-stream.$(O) \
-            $(BLD)/dtoastr.$(O) \
-            $(BLD)/dtotimespec.$(O)  \
-            $(BLD)/execinfo.$(O)  \
-            $(BLD)/fpending.$(O)  \
-            $(BLD)/getopt.$(O)  \
-            $(BLD)/getopt1.$(O) \
-            $(BLD)/gettime.$(O) \
-            $(BLD)/memrchr.$(O) \
-            $(BLD)/strftime.$(O) \
-            $(BLD)/time_r.$(O) \
-            $(BLD)/timespec-add.$(O) \
-            $(BLD)/timespec-sub.$(O) \
-            $(BLD)/md5.$(O) \
-            $(BLD)/sha1.$(O) \
-            $(BLD)/sha256.$(O) \
-            $(BLD)/sha512.$(O) \
-            $(BLD)/sig2str.$(O) \
-            $(BLD)/stat-time.$(O) \
-            $(BLD)/timespec.$(O) \
-            $(BLD)/u64.$(O) \
-            $(BLD)/filemode.$(O)
-
-#
-# Build the library
-#
-$(BLD)/libgnu.$(A):    $(GNULIBOBJS)
-       - $(DEL) $@
-       $(AR) $(AR_OUT)$@ $(ALL_DEPS)
-
-gnulib:                $(BLD)/libgnu.$(A)
-
-#
-# Build everything
-#
-all:           $(ALL)
-
-### TAGS ###
-
-FRC:
-
-TAGS: FRC
-        ../lib-src/$(BLD)/etags.exe *.c *.h
-
-### DEPENDENCIES ###
-
-EMACS_ROOT     = ..
-GNU_LIB                = .
-SRC            = $(EMACS_ROOT)/src
-NT_INC         = $(EMACS_ROOT)/nt/inc
-
-ACL_H         = $(GNU_LIB)/acl.h \
-                $(NT_INC)/sys/stat.h \
-                $(NT_INC)/stdbool.h
-C_CTYPE_H      = $(GNU_LIB)/c-ctype.h \
-                $(NT_INC)/stdbool.h
-MS_W32_H       = $(NT_INC)/ms-w32.h \
-                $(NT_INC)/sys/stat.h
-CONF_POST_H    = $(SRC)/conf_post.h \
-                $(MS_W32_H)
-CONFIG_H       = $(SRC)/config.h \
-                $(CONF_POST_H)
-FILEMODE_H     = $(GNU_LIB)/filemode.h \
-                $(NT_INC)/sys/stat.h
-FTOASTR_H      = $(GNU_LIB)/ftoastr.h \
-                $(GNU_LIB)/intprops.h
-FTOASTR_C      = $(GNU_LIB)/ftoastr.c \
-                $(CONFIG_H) \
-                $(FTOASTR_H)
-GETOPT_INT_H   = $(GNU_LIB)/getopt_int.h \
-                $(GNU_LIB)/getopt.h
-MD5_H          = $(GNU_LIB)/md5.h \
-                $(NT_INC)/stdint.h
-SHA1_H         = $(GNU_LIB)/sha1.h \
-                $(NT_INC)/stdint.h
-SHA256_H       = $(GNU_LIB)/sha256.h \
-                $(NT_INC)/stdint.h
-U64_H          = $(GNU_LIB)/u64.h \
-                $(NT_INC)/stdint.h
-SHA512_H       = $(GNU_LIB)/sha512.h \
-                $(U64_H)
-SIG2STR_H      = $(GNU_LIB)/sig2str.h \
-                $(GNU_LIB)/intprops.h
-STAT_TIME_H    = $(GNU_LIB)/stat-time.h \
-                $(NT_INC)/sys/stat.h
-
-$(BLD)/acl-errno-valid.$(O) : \
-       $(GNU_LIB)/acl-errno-valid.c \
-       $(ACL_H) \
-       $(CONFIG_H)
-
-$(BLD)/c-ctype.$(O) : \
-       $(GNU_LIB)/c-ctype.c \
-       $(CONFIG_H) \
-       $(C_CTYPE_H)
-
-$(BLD)/c-strcasecmp.$(O) : \
-       $(GNU_LIB)/c-strcasecmp.c \
-       $(GNU_LIB)/c-strcase.h \
-       $(CONFIG_H) \
-       $(C_CTYPE_H)
-
-$(BLD)/c-strncasecmp.$(O) : \
-       $(GNU_LIB)/c-strncasecmp.c \
-       $(GNU_LIB)/c-strcase.h \
-       $(CONFIG_H) \
-       $(C_CTYPE_H)
-
-$(BLD)/close-stream.$(O) : \
-       $(GNU_LIB)/close-stream.c \
-       $(GNU_LIB)/close-stream.h \
-       $(GNU_LIB)/fpending.h \
-       $(NT_INC)/stdbool.h \
-       $(CONFIG_H)
-
-$(BLD)/dtoastr.$(O) : \
-       $(GNU_LIB)/dtoastr.c \
-       $(FTOASTR_C)
-
-$(BLD)/dtotimespec.$(O) : \
-       $(GNU_LIB)/dtotimespec.c \
-       $(GNU_LIB)/intprops.h \
-       $(GNU_LIB)/timespec.h \
-       $(CONFIG_H)
-
-$(BLD)/execinfo.$(O) : \
-       $(GNU_LIB)/execinfo.c \
-       $(GNU_LIB)/execinfo.h \
-       $(CONFIG_H)
-
-$(BLD)/fpending.$(O) : \
-       $(GNU_LIB)/fpending.c \
-       $(GNU_LIB)/fpending.h \
-       $(CONFIG_H)
-
-$(BLD)/getopt.$(O) : \
-       $(GNU_LIB)/getopt.c \
-       $(GNU_LIB)/getopt.h \
-       $(GNU_LIB)/gettext.h \
-       $(NT_INC)/unistd.h \
-       $(CONFIG_H) \
-       $(GETOPT_INT_H)
-
-$(BLD)/getopt1.$(O) : \
-       $(GNU_LIB)/getopt1.c \
-       $(GNU_LIB)/getopt.h \
-       $(CONFIG_H) \
-       $(GETOPT_INT_H)
-
-$(BLD)/gettime.$(O) : \
-       $(GNU_LIB)/gettime.c \
-       $(GNU_LIB)/timespec.h \
-       $(NT_INC)/sys/time.h \
-       $(CONFIG_H)
-
-$(BLD)/strftime.$(O) : \
-       $(GNU_LIB)/strftime.c \
-       $(GNU_LIB)/strftime.h \
-       $(NT_INC)/stdbool.h \
-       $(CONFIG_H)
-
-$(BLD)/time_r.$(O) : \
-       $(GNU_LIB)/time_r.c \
-       $(CONFIG_H)
-
-$(BLD)/timespec-add.$(O) : \
-       $(GNU_LIB)/timespec-add.c \
-       $(GNU_LIB)/intprops.h \
-       $(GNU_LIB)/timespec.h \
-       $(CONFIG_H)
-
-$(BLD)/timespec-sub.$(O) : \
-       $(GNU_LIB)/timespec-sub.c \
-       $(GNU_LIB)/intprops.h \
-       $(GNU_LIB)/timespec.h \
-       $(CONFIG_H)
-
-$(BLD)/md5.$(O) : \
-       $(GNU_LIB)/md5.c \
-       $(NT_INC)/stdalign.h \
-       $(NT_INC)/stdint.h \
-       $(CONFIG_H) \
-       $(MD5_H)
-
-$(BLD)/memrchr.$(O) : \
-       $(GNU_LIB)/memrchr.c \
-       $(CONFIG_H)
-
-$(BLD)/sha1.$(O) : \
-       $(GNU_LIB)/sha1.c \
-       $(NT_INC)/stdalign.h \
-       $(NT_INC)/stdint.h \
-       $(CONFIG_H) \
-       $(SHA1_H)
-
-$(BLD)/sha256.$(O) : \
-       $(GNU_LIB)/sha256.c \
-       $(NT_INC)/stdalign.h \
-       $(NT_INC)/stdint.h \
-       $(CONFIG_H) \
-       $(SHA256_H)
-
-$(BLD)/sha512.$(O) : \
-       $(GNU_LIB)/sha512.c \
-       $(NT_INC)/stdalign.h \
-       $(NT_INC)/stdint.h \
-       $(CONFIG_H) \
-       $(SHA512_H)
-
-$(BLD)/stat-time.$(O) : \
-       $(GNU_LIB)/stat-time.c \
-       $(CONFIG_H) \
-       $(STAT_TIME_H)
-
-$(BLD)/timespec.$(O) : \
-       $(GNU_LIB)/timespec.c \
-       $(GNU_LIB)/timespec.h \
-       $(CONFIG_H)
-
-$(BLD)/u64.$(O) : \
-       $(GNU_LIB)/u64.c \
-       $(CONFIG_H) \
-       $(U64_H)
-
-$(BLD)/filemode.$(O) : \
-       $(GNU_LIB)/filemode.c \
-       $(CONFIG_H) \
-       $(FILEMODE_H)
-
-$(BLD)/sig2str.$(O) : \
-       $(GNU_LIB)/sig2str.c \
-       $(CONFIG_H) \
-       $(SIG2STR_H)
-
-
-# The following dependencies are for supporting parallel builds, where
-# we must make sure $(BLD) exists before any compilation starts.
-#
-$(GNULIBOBJS): stamp_BLD
-
-#
-# Headers we would preprocess if we could.
-#
-getopt.h:      getopt_.h
-       $(CP) $(ALL_DEPS) $@
-
-#
-# Maintenance
-#
-clean:
-       - $(DEL) $(COMPILER_TEMP_FILES)
-       - $(DEL) getopt.h
-       - $(DEL_TREE) $(OBJDIR)
-       - $(DEL) stamp_BLD
-
-distclean:     cleanall
-       - $(DEL) TAGS
-       - $(DEL) Makefile
-
-maintainer-clean: distclean
-       - $(DEL) getopt_.h
-
-cleanall:      clean
-       - $(DEL_TREE) obj
-       - $(DEL_TREE) obj-spd
-       - $(DEL_TREE) oo
-       - $(DEL_TREE) oo-spd
-
-# A dummy target to force other targets to be evaluated.
-doit:
-
-getopt_.h: getopt.in.h $(ARG_NONNULL_H)
-       $(MAKE) $(MFLAGS) getopt_.h-$(SHELLTYPE)
-
-getopt_.h-CMD: doit
-       @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
-       @echo Run "$(MAKETYPE) getopt_h" in the lib/ subdirectory.
-       @echo You will need GNU Sed to be installed.
-       exit -1
-
-getopt_.h-SH: doit
-       @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
-       @echo Run '"$(MAKETYPE) getopt_h"' in the lib/ subdirectory.
-       @echo You will need GNU Sed to be installed.
-       exit -1
-
-# Generating getopt_.h from getopt.in.h.
-#
-# To avoid requiring all end users to install Sed, we have below
-# a maintainer-only target that produces getopt_.h from getopt.in.h.
-# For easier maintenance, all the strings that replace the @FOO@
-# placeholder are defined as Make macros below.
-
-HAVE_GETOPT_H = HAVE_GETOPT_H
-INCLUDE_NEXT = include_next
-PRAGMA_COLUMNS =
-NEXT_GETOPT_H = <getopt.h>
-ARG_NONNULL_H = ../build-aux/snippet/arg-nonnull.h
-
-getopt_h:
-       - $(DEL) getopt_.h-t getopt_.h
-       sed -e "address@hidden@!GL!g" \
-           -e "address@hidden@!$(HAVE_GETOPT_H)!g" \
-           -e "address@hidden@!$(INCLUDE_NEXT)!g" \
-           -e "address@hidden@!$(PRAGMA_SYSTEM_HEADER)!g" \
-           -e "address@hidden@!$(PRAGMA_COLUMNS)!g" \
-           -e "address@hidden@!$(NEXT_GETOPT_H)!g" \
-           -e "/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)" \
-           -e "/^\# include_next/i # ifndef __GNUC__" \
-           -e "/^\# include_next/i # include <next_getopt.h>" \
-           -e "/^\# include_next/i # else" \
-           -e "/^\# include_next/a # endif" \
-             < getopt.in.h > getopt_.h-t
-       $(CP) getopt_.h-t getopt_.h
-       - $(DEL) getopt_.h-t
-
-execinfo.h: execinfo.in.h
-       $(CP) execinfo.in.h $@
diff --git a/lib/time_rz.c b/lib/time_rz.c
index cbbe2c6..f94893a 100644
--- a/lib/time_rz.c
+++ b/lib/time_rz.c
@@ -105,7 +105,9 @@ tzalloc (char const *name)
       tz->tzname_copy[0] = tz->tzname_copy[1] = NULL;
 #endif
       tz->tz_is_set = !!name;
-      extend_abbrs (tz->abbrs, name, name_size);
+      tz->abbrs[0] = '\0';
+      if (name)
+        extend_abbrs (tz->abbrs, name, name_size);
     }
   return tz;
 }
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index f9f078b..0ba21da 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -399,7 +399,7 @@ A prefix argument means don't query; expand all abbrevs."
                   (buffer-substring-no-properties
                    (save-excursion (forward-word -1) (point))
                    pnt)))
-           (if (or noquery (y-or-n-p (format "Expand `%s'? " string)))
+           (if (or noquery (y-or-n-p (format-message "Expand ‘%s’? " string)))
                (expand-abbrev)))))))
 
 ;;; Abbrev properties.
diff --git a/lisp/align.el b/lisp/align.el
index 82a55b0..3020b6a 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -1348,7 +1348,7 @@ aligner would have dealt with are."
              (if real-beg
                  (goto-char beg)
                (if (or (not thissep) (eq thissep 'entire))
-                   (error "Cannot determine alignment region for '%s'"
+                   (error "Cannot determine alignment region for ‘%s’"
                           (symbol-name (cdr (assq 'title rule)))))
                (beginning-of-line)
                (while (and (not (eobp))
@@ -1437,12 +1437,12 @@ aligner would have dealt with are."
                               (message
                                "Aligning `%s' (rule %d of %d) %d%%..."
                                (symbol-name symbol) rule-index rule-count
-                               (/ (* (- (point) real-beg) 100)
-                                  (- end-mark real-beg)))
+                               (floor (* (- (point) real-beg) 100.0)
+                                      (- end-mark real-beg)))
                             (message
                              "Aligning %d%%..."
-                             (/ (* (- (point) real-beg) 100)
-                                (- end-mark real-beg))))))
+                             (floor (* (- (point) real-beg) 100.0)
+                                    (- end-mark real-beg))))))
 
                     ;; if the search ended us on the beginning of
                     ;; the next line, move back to the end of the
diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el
index 3c71a81..f0a1cab 100644
--- a/lisp/allout-widgets.el
+++ b/lisp/allout-widgets.el
@@ -481,9 +481,9 @@ text in allout item bodies.")
 
 \(That space is used to convey selected cues indicating body qualities,
 including things like:
- - encryption '~'
- - numbering '#'
- - indirect reference '@'
+ - encryption ‘~’
+ - numbering ‘#’
+ - indirect reference address@hidden
  - distinctive bullets - see `allout-distinctive-bullets-string'.)")
 ;;;_    = allout-span-to-category
 (defvar allout-span-to-category
@@ -869,7 +869,7 @@ Optional RECURSING is for internal use, to limit recursion."
     ;; tell the allout-widgets-post-command-business to reestablish the hook:
     (setq allout-widgets-reenable-before-change-handler t)
     ;; and raise an error to prevent the edit (and disable the hook):
-    (error
+    (error "%s"
      (substitute-command-keys allout-structure-unruly-deletion-message)))))
 ;;;_    > allout-widgets-after-change-handler
 (defun allout-widgets-after-change-handler (_beg _end _prelength)
@@ -2287,7 +2287,7 @@ Deletes allowed only when `inhibit-read-only' is t."
    ((yes-or-no-p "Unruly edit of outline structure - allow? ")
     (setq allout-widgets-unset-inhibit-read-only (not inhibit-read-only)
           inhibit-read-only t))
-   (t (error
+   (t (error "%s"
        (substitute-command-keys allout-structure-unruly-deletion-message)))))
 ;;;_   > allout-item-icon-key-handler ()
 (defun allout-item-icon-key-handler ()
@@ -2372,7 +2372,7 @@ The elements of LIST are not copied, just the list 
structure itself."
     (car list)))
 ;;;_  . allout-widgets-count-buttons-in-region (start end)
 (defun allout-widgets-count-buttons-in-region (start end)
-  "Debugging/diagnostic tool - count overlays with 'button' property in 
region."
+  "Debugging/diagnostic tool - count overlays with `button' property in 
region."
   (interactive "r")
   (setq start (or start (point-min))
         end (or end (point-max)))
diff --git a/lisp/allout.el b/lisp/allout.el
index db87cb1..3ba440f 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -176,7 +176,7 @@ respective allout-mode keybinding variables, 
`allout-command-prefix',
 (defcustom allout-command-prefix "\C-c "
   "Key sequence to be used as prefix for outline mode command key bindings.
 
-Default is '\C-c<space>'; just '\C-c' is more short-and-sweet, if you're
+Default is `\C-c<space>'; just `\C-c' is more short-and-sweet, if you're
 willing to let allout use a bunch of \C-c keybindings."
   :type 'string
   :group 'allout-keybindings
@@ -229,7 +229,7 @@ See `allout-unprefixed-keybindings' for the list of 
keybindings
 that are not prefixed.
 
 Use vector format for the keys:
-  - put literal keys after a '?' question mark, eg: '?a', '?.'
+  - put literal keys after a ‘?’ question mark, eg: ‘?a’, ‘?.’
   - enclose control, shift, or meta-modified keys as sequences within
     parentheses, with the literal key, as above, preceded by the name(s)
     of the modifiers, eg: [(control ?a)]
@@ -257,7 +257,7 @@ This is in contrast to the majority of allout-mode bindings 
on
 preceding command key.
 
 Use vector format for the keys:
-  - put literal keys after a '?' question mark, eg: '?a', '?.'
+  - put literal keys after a ‘?’ question mark, eg: ‘?a’, ‘?.’
   - enclose control, shift, or meta-modified keys as sequences within
     parentheses, with the literal key, as above, preceded by the name(s)
     of the modifiers, eg: [(control ?a)]
@@ -610,7 +610,7 @@ strings."
 Allout outline mode will use the mode-specific `allout-mode-leaders' or
 comment-start string, if any, to lead the topic prefix string, so topic
 headers look like comments in the programming language.  It will also use
-the comment-start string, with an '_' appended, for `allout-primary-bullet'.
+the comment-start string, with an `_' appended, for `allout-primary-bullet'.
 
 String values are used as literals, not regular expressions, so
 do not escape any regular-expression characters.
@@ -1012,9 +1012,9 @@ determination of aberrance is according to the mistaken 
item
 being followed by a legitimate item of excessively greater depth.
 
 The classic example of a mistaken item, for a standard allout
-outline configuration, is a body line that begins with an '...'
+outline configuration, is a body line that begins with an ‘...’
 ellipsis.  This happens to contain a legitimate depth-2 header
-prefix, constituted by two '..' dots at the beginning of the
+prefix, constituted by two ‘..’ dots at the beginning of the
 line.  The only thing that can distinguish it *in principle* from
 a legitimate one is if the following real header is at a depth
 that is discontinuous from the depth of 2 implied by the
@@ -1326,20 +1326,20 @@ scope of the variable is restored along with its value. 
 If it was a void
 buffer-local value, then it is left as nil on resumption.
 
 The pairs are lists whose car is the name of the variable and car of the
-cdr is the new value: '(some-var some-value)'.  The pairs can actually be
+cdr is the new value: `(some-var some-value)'.  The pairs can actually be
 triples, where the third element qualifies the disposition of the setting,
 as described further below.
 
-If the optional third element is the symbol 'extend, then the new value
+If the optional third element is the symbol `extend', then the new value
 created by `cons'ing the second element of the pair onto the front of the
 existing value.
 
-If the optional third element is the symbol 'append, then the new value is
+If the optional third element is the symbol `append', then the new value is
 extended from the existing one by `append'ing a list containing the second
 element of the pair onto the end of the existing value.
 
 Extension, and resumptions in general, should not be used for hook
-functions -- use the 'local mode of `add-hook' for that, instead.
+functions -- use the `local' mode of `add-hook' for that, instead.
 
 The settings are stored on `allout-mode-prior-settings'."
   (while pairs
@@ -1838,7 +1838,7 @@ M-x outlineify-sticky       Activate outline mode for 
current buffer,
                             buffer with name derived from derived from that
                             of current buffer -- \"*BUFFERNAME exposed*\".
 \\[allout-flatten-exposed-to-buffer] `allout-flatten-exposed-to-buffer'
-                            Like above 'copy-exposed', but convert topic
+                            Like above `copy-exposed', but convert topic
                             prefixes to section.subsection... numeric
                             format.
 \\[customize-variable] allout-auto-activation
@@ -1862,7 +1862,7 @@ symmetric decryption keys, preventing entry of the 
correct key on
 subsequent decryption attempts until the cache times-out.  That
 can take several minutes.  (Decryption of other entries is not
 affected.)  Upgrade your EasyPG version, if you can, and you can
-deliberately clear your gpg-agent's cache by sending it a '-HUP'
+deliberately clear your gpg-agent's cache by sending it a `-HUP'
 signal.
 
 See `allout-toggle-current-subtree-encryption' function docstring
@@ -2080,21 +2080,21 @@ OPEN:   A TOPIC that is not CLOSED, though its 
OFFSPRING or BODY may be."
                  use-layout
                  (and (not (string= allout-auto-activation "activate"))
                       (if (string= allout-auto-activation "ask")
-                          (if (y-or-n-p (format "Expose %s with layout '%s'? "
-                                                (buffer-name)
-                                                use-layout))
+                          (if (y-or-n-p (format-message
+                                         "Expose %s with layout ‘%s’? "
+                                         (buffer-name) use-layout))
                               t
                             (message "Skipped %s layout." (buffer-name))
                             nil)
                         t)))
         (save-excursion
-          (message "Adjusting '%s' exposure..." (buffer-name))
+          (message "Adjusting ‘%s’ exposure..." (buffer-name))
           (goto-char 0)
           (allout-this-or-next-heading)
           (condition-case err
               (progn
                 (apply 'allout-expose-topic (list use-layout))
-                (message "Adjusting '%s' exposure... done."
+                (message "Adjusting ‘%s’ exposure... done."
                          (buffer-name)))
             ;; Problem applying exposure -- notify user, but don't
             ;; interrupt, eg, file visit:
@@ -3483,9 +3483,10 @@ Offer one suitable for current depth DEPTH as default."
     (save-excursion
       (goto-char (allout-current-bullet-pos))
       (setq choice (solicit-char-in-string
-                    (format "Select bullet: %s ('%s' default): "
-                            sans-escapes
-                            (allout-substring-no-properties default-bullet))
+                    (format-message
+                     "Select bullet: %s (‘%s’ default): "
+                     sans-escapes
+                     (allout-substring-no-properties default-bullet))
                     sans-escapes
                     t)))
     (message "")
@@ -5134,15 +5135,15 @@ Simple (numeric and null-list) specs are interpreted as 
follows:
   -  - exposes the body of the corresponding topic.
 
 Examples:
-\(allout-expose-topic '(-1 : 0))
+\(allout-expose-topic \\='(-1 : 0))
        Close this and all following topics at current level, exposing
        only their immediate children, but close down the last topic
        at this current level completely.
-\(allout-expose-topic '(-1 () : 1 0))
+\(allout-expose-topic \\='(-1 () : 1 0))
        Close current topic so only the immediate subtopics are shown;
        show the children in the second to last topic, and completely
        close the last one.
-\(allout-expose-topic '(-2 : -1 *))
+\(allout-expose-topic \\='(-2 : -1 *))
         Expose children and grandchildren of all topics at current
        level except the last two; expose children of the second to
        last and completely open the last one."
@@ -5878,7 +5879,7 @@ With repeat count, copy the exposed portions of entire 
buffer."
 (defun allout-toggle-current-subtree-encryption (&optional keymode-cue)
   "Encrypt clear or decrypt encoded topic text.
 
-Allout uses Emacs 'epg' library to perform encryption.  Symmetric
+Allout uses Emacs ‘epg’ library to perform encryption.  Symmetric
 and keypair encryption are supported.  All encryption is ascii
 armored.
 
@@ -5940,7 +5941,7 @@ associated with it.  This can be used to dissociate any
 recipients with the file, by selecting no recipients in the
 dialog.
 
-Encryption and decryption uses the Emacs 'epg' library.
+Encryption and decryption uses the Emacs ‘epg’ library.
 
 Encrypted text will be ascii-armored.
 
@@ -6093,7 +6094,7 @@ symmetric decryption keys, preventing entry of the 
correct key on
 subsequent decryption attempts until the cache times-out.  That
 can take several minutes.  (Decryption of other entries is not
 affected.)  Upgrade your EasyPG version, if you can, and you can
-deliberately clear your gpg-agent's cache by sending it a '-HUP'
+deliberately clear your gpg-agent's cache by sending it a `-HUP'
 signal."
 
   (require 'epg)
@@ -6263,7 +6264,7 @@ the decryption."
   "Return the point of the next topic pending encryption, or nil if none.
 
 Such a topic has the `allout-topic-encryption-bullet' without an
-immediately following '*' that would mark the topic as being encrypted.
+immediately following `*' that would mark the topic as being encrypted.
 It must also have content."
   (let (done got content-beg)
     (save-match-data
@@ -6378,8 +6379,9 @@ for details on preparing Emacs for automatic allout 
activation."
     (if (allout-goto-prefix)
        t
       (allout-open-topic 2)
-      (insert (concat "Dummy outline topic header -- see"
-                      "`allout-mode' docstring: `^Hm'."))
+      (insert (substitute-command-keys
+               (concat "Dummy outline topic header -- see"
+                       " ‘allout-mode’ docstring: ‘\\[describe-mode]’.")))
       (allout-adjust-file-variable
        "allout-layout" (or allout-layout '(-1 : 0))))))
 ;;;_   > allout-file-vars-section-data ()
@@ -6488,8 +6490,9 @@ not its value."
         got)
     (dolist (sym configvar-value)
       (if (not (boundp sym))
-          (if (yes-or-no-p (format "%s entry `%s' is unbound -- remove it? "
-                                   configvar-name sym))
+          (if (yes-or-no-p (format-message
+                           "%s entry `%s' is unbound -- remove it? "
+                           configvar-name sym))
               (delq sym (symbol-value configvar-name)))
         (push (symbol-value sym) got)))
     (reverse got)))
@@ -6543,7 +6546,7 @@ Optional arg DO-DEFAULTING indicates to accept empty 
input (CR)."
 (defun regexp-sans-escapes (regexp &optional successive-backslashes)
   "Return a copy of REGEXP with all character escapes stripped out.
 
-Representations of actual backslashes -- '\\\\\\\\' -- are left as a
+Representations of actual backslashes -- ‘\\\\\\\\’ -- are left as a
 single backslash.
 
 Optional arg SUCCESSIVE-BACKSLASHES is used internally for recursion."
diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el
index 5088c3d..2f3b506 100644
--- a/lisp/ansi-color.el
+++ b/lisp/ansi-color.el
@@ -154,7 +154,7 @@ foreground and background colors, respectively."
   "Regexp that matches SGR control sequences.")
 
 (defconst ansi-color-drop-regexp
-  "\033\\[\\([ABCDsuK]\\|[12][JK]\\|=[0-9]+[hI]\\|[0-9;]*[Hf]\\)"
+  
"\033\\[\\([ABCDsuK]\\|[12][JK]\\|=[0-9]+[hI]\\|[0-9;]*[Hf]\\|\\?[0-9]+[hl]\\)"
   "Regexp that matches ANSI control sequences to silently drop.")
 
 (defconst ansi-color-parameter-regexp "\\([0-9]*\\)[m;]"
@@ -261,7 +261,11 @@ This function can be added to 
`comint-preoutput-filter-functions'."
     ;; find the next escape sequence
     (while (setq end (string-match ansi-color-regexp string start))
       (setq result (concat result (substring string start end))
-           start (match-end 0)))
+            start (match-end 0)))
+    ;; eliminate unrecognized escape sequences
+    (while (string-match ansi-color-drop-regexp string)
+      (setq string
+            (replace-match "" nil nil string)))
     ;; save context, add the remainder of the string to the result
     (let (fragment)
       (if (string-match "\033" string start)
@@ -327,6 +331,10 @@ This function can be added to 
`comint-preoutput-filter-functions'."
     (when codes
       (put-text-property start (length string)
                          'font-lock-face (ansi-color--find-face codes) string))
+    ;; eliminate unrecognized escape sequences
+    (while (string-match ansi-color-drop-regexp string)
+      (setq string
+            (replace-match "" nil nil string)))
     ;; save context, add the remainder of the string to the result
     (let (fragment)
       (if (string-match "\033" string start)
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 0a1bc7b..73f86df 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -681,8 +681,8 @@ the output includes key-bindings of commands."
       (apropos-symbols-internal
        symbols apropos-do-all
        (concat
-        (format (substitute-command-keys
-                 "Library `%s' provides: %s\nand requires: %s")
+        (format-message
+                "Library ‘%s’ provides: %s\nand requires: %s"
                 file
                 (mapconcat 'apropos-library-button
                            (or provides '(nil)) " and ")
@@ -727,11 +727,10 @@ the output includes key-bindings of commands."
                 (let ((alias (get symbol 'face-alias)))
                   (if alias
                       (if (facep alias)
-                          (format "%slias for the face `%s'."
-                                  (if (get symbol 'obsolete-face)
-                                      "Obsolete a"
-                                    "A")
-                                  alias)
+                          (format-message
+                           "%slias for the face `%s'."
+                           (if (get symbol 'obsolete-face) "Obsolete a" "A")
+                           alias)
                         ;; Never happens in practice because fails
                         ;; (facep symbol) test.
                         "(alias for undefined face)")
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el
index 985ae24..255ec9b 100644
--- a/lisp/autoinsert.el
+++ b/lisp/autoinsert.el
@@ -67,7 +67,7 @@ Insertion is possible when something appropriate is found in
 `auto-insert-alist'.  When the insertion is marked as unmodified, you can
 save it with  \\[write-file] RET.
 This variable is used when the function `auto-insert' is called, e.g.
-when you do (add-hook 'find-file-hook 'auto-insert).
+when you do (add-hook \\='find-file-hook \\='auto-insert).
 With \\[auto-insert], this is always treated as if it were t."
   :type '(choice (const :tag "Insert if possible" t)
                  (const :tag "Do nothing" nil)
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 0081419..37ee8ee 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -367,7 +367,7 @@ without being changed in the part that is already in the 
buffer."
   "Turn on Auto-Revert Mode.
 
 This function is designed to be added to hooks, for example:
-  (add-hook 'c-mode-hook #'turn-on-auto-revert-mode)"
+  (add-hook \\='c-mode-hook #\\='turn-on-auto-revert-mode)"
   (auto-revert-mode 1))
 
 
@@ -431,7 +431,7 @@ Perform a full revert? ")
   "Turn on Auto-Revert Tail mode.
 
 This function is designed to be added to hooks, for example:
-  (add-hook 'my-logfile-mode-hook #'turn-on-auto-revert-tail-mode)"
+  (add-hook \\='my-logfile-mode-hook #\\='turn-on-auto-revert-tail-mode)"
   (auto-revert-tail-mode 1))
 
 
diff --git a/lisp/avoid.el b/lisp/avoid.el
index 767f6d3..36ced39 100644
--- a/lisp/avoid.el
+++ b/lisp/avoid.el
@@ -163,9 +163,9 @@ Analogous to `mouse-position'."
 
 ;(defun mouse-avoidance-point-position-test ()
 ;  (interactive)
-;  (message (format "point=%s mouse=%s"
-;                 (cdr (mouse-avoidance-point-position))
-;                 (cdr (mouse-position)))))
+;  (message "point=%s mouse=%s"
+;          (cdr (mouse-avoidance-point-position))
+;          (cdr (mouse-position))))
 
 (defun mouse-avoidance-set-mouse-position (pos)
   ;; Carefully set mouse position to given position (X . Y)
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 4baf00b..308d1ca 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -842,8 +842,11 @@ whose annotation is being edited.")
   "Return default annotation text for BOOKMARK-NAME.
 The default annotation text is simply some text explaining how to use
 annotations."
-  (concat "#  Type the annotation for bookmark '" bookmark-name "' here.\n"
-         "#  All lines which start with a '#' will be deleted.\n"
+  (concat (format-message
+           "#  Type the annotation for bookmark ‘%s’ here.\n"
+           bookmark-name)
+         (format-message
+           "#  All lines which start with a ‘#’ will be deleted.\n")
          "#  Type C-c C-c when done.\n#\n"
          "#  Author: " (user-full-name) " <" (user-login-name) "@"
          (system-name) ">\n"
@@ -1540,7 +1543,7 @@ deletion, or > if it is flagged for displaying."
   (let ((inhibit-read-only t))
     (erase-buffer)
     (if (not bookmark-bmenu-use-header-line)
-      (insert "% Bookmark\n- --------\n"))    
+      (insert "% Bookmark\n- --------\n"))
     (add-text-properties (point-min) (point)
                         '(font-lock-face bookmark-menu-heading))
     (dolist (full-record (bookmark-maybe-sort-alist))
@@ -1581,9 +1584,9 @@ deletion, or > if it is flagged for displaying."
 (defun bookmark-bmenu-set-header ()
   "Sets the immutable header line."
   (let ((header (concat "%% " "Bookmark")))
-    (when bookmark-bmenu-toggle-filenames 
-      (setq header (concat header 
-                          (make-string (- bookmark-bmenu-file-column 
+    (when bookmark-bmenu-toggle-filenames
+      (setq header (concat header
+                          (make-string (- bookmark-bmenu-file-column
                                           (- (length header) 3))  ?\s)
                           "File")))
     (let ((pos 0))
diff --git a/lisp/bs.el b/lisp/bs.el
index c7a20b4..6314bbb 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -1314,7 +1314,7 @@ ALL-BUFFERS is the list of buffers appearing in Buffer 
Selection Menu."
   (format-mode-line mode-name nil nil start-buffer))
 
 (defun bs--get-file-name (_start-buffer _all-buffers)
-  "Return string for column 'File' in Buffer Selection Menu.
+  "Return string for column ‘File’ in Buffer Selection Menu.
 This is the variable `buffer-file-name' of current buffer.
 If not visiting a file, `list-buffers-directory' is returned instead.
 START-BUFFER is the buffer where we started buffer selection.
diff --git a/lisp/button.el b/lisp/button.el
index e7602dd..5fe5bf0 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -114,7 +114,7 @@ Mode-specific keymaps may want to use this as their parent 
keymap.")
   "Return the symbol used by button-type TYPE to store properties.
 Buttons inherit them by setting their `category' property to that symbol."
   (or (get type 'button-category-symbol)
-      (error "Unknown button type `%s'" type)))
+      (error "Unknown button type ‘%s’" type)))
 
 (defun define-button-type (name &rest properties)
   "Define a `button type' called NAME (a symbol).
@@ -208,7 +208,7 @@ changes to a supertype are not reflected in its subtypes)."
         (setq val (button-category-symbol val)))
        ((eq prop 'category)
         ;; Disallow updating the `category' property directly.
-        (error "Button `category' property may not be set directly")))
+        (error "Button ‘category’ property may not be set directly")))
   ;; Add the property.
   (cond ((overlayp button)
         (overlay-put button prop val))
@@ -333,7 +333,7 @@ Also see `insert-text-button'."
       (setq object beg beg 0 end (length object)))
     ;; Disallow setting the `category' property directly.
     (when (plist-get properties 'category)
-      (error "Button `category' property may not be set directly"))
+      (error "Button ‘category’ property may not be set directly"))
     (if (null type-entry)
        ;; The user didn't specify a `type' property, use the default.
        (setq properties (cons 'category (cons 'default-button properties)))
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index cc048eb..2c588c1 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -1057,7 +1057,7 @@ If the current Calc language does not use placeholders, 
return nil."
 (defun math-read-if (cond op)
   (let ((then (math-read-expr-level 0)))
     (or (equal math-expr-data ":")
-       (throw 'syntax "Expected ':'"))
+       (throw 'syntax "Expected ‘:’"))
     (math-read-token)
     (list 'calcFunc-if cond then (math-read-expr-level (nth 3 op)))))
 
@@ -1121,7 +1121,7 @@ If the current Calc language does not use placeholders, 
return nil."
                                   (math-read-expr-list))))
                       (if (not (or (equal math-expr-data calc-function-close)
                                    (eq math-exp-token 'end)))
-                          (throw 'syntax "Expected `)'"))
+                          (throw 'syntax "Expected ‘)’"))
                       (math-read-token)
                       (if (and (memq calc-language
                                       calc-lang-parens-are-subscripts)
@@ -1177,7 +1177,7 @@ If the current Calc language does not use placeholders, 
return nil."
                          (setq el (cdr el))))
                     (if (equal math-expr-data "]")
                         (math-read-token)
-                      (throw 'syntax "Expected ']'")))
+                      (throw 'syntax "Expected ‘]’")))
                   val)))))
          ((eq math-exp-token 'dollar)
           (let ((abs (if (> math-expr-data 0) math-expr-data (- 
math-expr-data))))
@@ -1246,7 +1246,7 @@ If the current Calc language does not use placeholders, 
return nil."
             (if (not (or (equal math-expr-data ")")
                          (and (equal math-expr-data "]") (eq (car-safe exp) 
'intv))
                          (eq math-exp-token 'end)))
-                (throw 'syntax "Expected `)'"))
+                (throw 'syntax "Expected ‘)’"))
             (math-read-token)
             exp))
          ((eq math-exp-token 'string)
diff --git a/lisp/calc/calc-embed.el b/lisp/calc/calc-embed.el
index fcb4b03..3f6e83e 100644
--- a/lisp/calc/calc-embed.el
+++ b/lisp/calc/calc-embed.el
@@ -330,10 +330,12 @@
       (if calc-embedded-firsttime-formula
           (run-hooks 'calc-embedded-new-formula-hook))
       (or (eq calc-embedded-quiet t)
-         (message "Embedded Calc mode enabled; %s to return to normal"
-                  (if calc-embedded-quiet
-                      "Type `C-x * x'"
-                    "Give this command again")))))
+         (message (concat
+                    "Embedded Calc mode enabled; "
+                    (if calc-embedded-quiet
+                        "Type ‘C-x * x’"
+                      "Give this command again")
+                    " to return to normal")))))
   (scroll-down 0))    ; fix a bug which occurs when truncate-lines is changed.
 
 
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 67d0c27..bd33fbe 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -1097,10 +1097,10 @@ calc-tan calc-tanh calc-to-degrees calc-to-radians)
 
  ("calc-mode" calc-alg-simplify-mode calc-algebraic-mode
 calc-always-load-extensions calc-auto-recompute calc-auto-why
-calc-basic-simplify-mode calc-bin-simplify-mode calc-break-vectors 
-calc-center-justify calc-default-simplify-mode calc-display-raw 
-calc-eng-notation calc-ext-simplify-mode calc-fix-notation 
-calc-full-trail-vectors calc-full-vectors calc-get-modes calc-group-char 
+calc-basic-simplify-mode calc-bin-simplify-mode calc-break-vectors
+calc-center-justify calc-default-simplify-mode calc-display-raw
+calc-eng-notation calc-ext-simplify-mode calc-fix-notation
+calc-full-trail-vectors calc-full-vectors calc-get-modes calc-group-char
 calc-group-digits calc-infinite-mode calc-left-justify calc-left-label
 calc-line-breaking calc-line-numbering calc-matrix-brackets
 calc-matrix-center-justify calc-matrix-left-justify calc-matrix-mode
@@ -1177,7 +1177,7 @@ calc-trail-scroll-right calc-trail-yank)
  ("calc-undo" calc-last-args calc-redo)
 
  ("calc-units" calc-autorange-units calc-base-units
-calc-convert-temperature calc-convert-units 
+calc-convert-temperature calc-convert-units
 calc-convert-exact-units calc-define-unit
 calc-enter-units-table calc-explain-units calc-extract-units
 calc-get-unit-definition calc-permanent-units calc-quick-units
@@ -1245,7 +1245,7 @@ calc-kill calc-kill-region calc-yank))))
 
 
 (defun calc-record-message (tag &rest args)
-  (let ((msg (apply 'format args)))
+  (let ((msg (apply #'format-message args)))
     (message "%s" msg)
     (calc-record msg tag))
   (calc-clear-command-flag 'clear-message))
@@ -1957,7 +1957,7 @@ calc-kill calc-kill-region calc-yank))))
                  (desc
                   (if (symbolp func)
                       (if (= (logand kind 3) 0)
-                          (format "`%c' = %s" key name)
+                          (format-message "‘%c’ = %s" key name)
                         (if pos
                             (format "%s%c%s"
                                     (downcase (substring name 0 pos))
@@ -1988,7 +1988,7 @@ calc-kill calc-kill-region calc-yank))))
      "kbd-macros: [ (if), : (else), | (else-if), ] (end-if)"
      "kbd-macros: < > (repeat), ( ) (for), { } (loop)"
      "kbd-macros: / (break)"
-     "kbd-macros: ` (save), ' (restore)")
+     "kbd-macros: \\=` (save), ' (restore)")
    "user" ?Z))
 
 
diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el
index 20b0249..8378b23 100644
--- a/lisp/calc/calc-graph.el
+++ b/lisp/calc/calc-graph.el
@@ -958,7 +958,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
          (define-key calc-dumb-map "\C-c\C-c" 'exit-recursive-edit)))
     (use-local-map calc-dumb-map)
     (setq truncate-lines t)
-    (message "Type `q' or `C-c C-c' to return to Calc")
+    (message "Type ‘q’ or ‘C-c C-c’ to return to Calc")
     (recursive-edit)
     (bury-buffer "*Gnuplot Trail*")))
 
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index b2e7df1..18c3b76 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -239,8 +239,8 @@ C-w  Describe how there is no warranty for Calc."
                      (setq prompts (substring prompts 0 (match-beginning 0))))
                  (if (string-match "\\` +" prompts)
                      (setq prompts (substring prompts (match-end 0))))
-                 (setq msg (format
-                            "%s:  %s%s`%s'%s%s %s%s"
+                 (setq msg (format-message
+                            "%s:  %s%s‘%s’%s%s %s%s"
                             (if (string-match
                                  "\\`\\(calc-[-a-zA-Z0-9]+\\) *\\(.*\\)\\'"
                                  cmd)
@@ -345,7 +345,7 @@ C-w  Describe how there is no warranty for Calc."
   (calc-describe-thing var "Variable Index"))
 
 (defun calc-describe-thing (thing where &optional target not-quoted)
-  (message "Looking for `%s' in %s..." thing where)
+  (message "Looking for ‘%s’ in %s..." thing where)
   (let ((savewin (current-window-configuration)))
     (calc-info-goto-node where)
     (or (let ((case-fold-search nil))
@@ -361,7 +361,7 @@ C-w  Describe how there is no warranty for Calc."
           (if Info-history
               (Info-last))
          (set-window-configuration savewin)
-         (error "Can't find `%s' in %s" thing where)))
+         (error "Can't find ‘%s’ in %s" thing where)))
     (let (Info-history)
       (Info-goto-node (buffer-substring (match-beginning 1) (match-end 1))))
     (let* ((string-target (or target thing))
@@ -380,7 +380,7 @@ C-w  Describe how there is no warranty for Calc."
                 (re-search-forward quoted nil t)
                 (search-forward string-target nil t)))))
     (beginning-of-line)
-    (message "Found `%s' in %s" thing where)))
+    (message "Found ‘%s’ in %s" thing where)))
 
 (defun calc-view-news ()
   (interactive)
@@ -400,11 +400,14 @@ C-w  Describe how there is no warranty for Calc."
     (princ "GNU Emacs Calculator.\n")
     (princ "  By Dave Gillespie.\n")
     (princ (format "  %s\n\n" emacs-copyright))
-    (princ "Type `h s' for a more detailed summary.\n")
-    (princ "Or type `h i' to read the full Calc manual on-line.\n\n")
+    (princ (format-message "Type ‘h s’ for a more detailed summary.\n"))
+    (princ (format-message
+            "Or type ‘h i’ to read the full Calc manual on-line.\n\n"))
     (princ "Basic keys:\n")
     (let* ((calc-full-help-flag t))
-      (mapc (function (lambda (x) (princ (format "  %s\n" x))))
+      (mapc (function (lambda (x) (princ (format
+                                          "  %s\n"
+                                          (substitute-command-keys x)))))
            (nreverse (cdr (reverse (cdr (calc-help))))))
       (mapc (function (lambda (prefix)
                        (let ((msgs (condition-case err
@@ -413,18 +416,22 @@ C-w  Describe how there is no warranty for Calc."
                          (if (car msgs)
                              (princ
                               (if (eq (nth 2 msgs) ?v)
-                                  "\n`v' or `V' prefix (vector/matrix) keys: 
\n"
+                                   (format-message
+                                    "\n‘v’ or ‘V’ prefix (vector/matrix) keys: 
\n")
                                 (if (nth 2 msgs)
-                                    (format
-                                     "\n`%c' prefix (%s) keys:\n"
+                                    (format-message
+                                     "\n‘%c’ prefix (%s) keys:\n"
                                      (nth 2 msgs)
                                      (or (cdr (assq (nth 2 msgs)
                                                     calc-help-long-names))
                                          (nth 1 msgs)))
                                   (format "\n%s-modified keys:\n"
                                           (capitalize (nth 1 msgs)))))))
-                         (mapcar (function (lambda (x)
-                                   (princ (format "  %s\n" x))))
+                         (mapcar (function
+                                   (lambda (x)
+                                     (princ (format
+                                             "  %s\n"
+                                             (substitute-command-keys x)))))
                                  (car msgs)))))
            '(calc-inverse-prefix-help
              calc-hyperbolic-prefix-help
@@ -539,7 +546,7 @@ C-w  Describe how there is no warranty for Calc."
    '("Select, Additional, Once; eVal, Formula; Rewrite"
      "More, Less, 1-9, Next, Previous"
      "Unselect, Clear; Display; Enable; Breakable"
-     "' (replace), ` (edit), +, -, *, /, RET (grab), DEL"
+     "' (replace), \\=` (edit), +, -, *, /, RET (grab), DEL"
      "SHIFT + swap: Left, Right; maybe: Select, Once"
      "SHIFT + Commute, Merge, Distrib, jump-Eqn, Isolate"
      "SHIFT + Negate, & (invert); Unpack")
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el
index 066d781..70a9ff8 100644
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
@@ -94,7 +94,7 @@
   (interactive)
   (calc-wrapper
    (calc-set-language 'c)
-   (message "`C' language mode")))
+   (message "‘C’ language mode")))
 
 (put 'c 'math-oper-table
   '( ( "u!"    calcFunc-lnot -1 1000 )
@@ -387,7 +387,7 @@
              math-exp-token 'end
              math-expr-data "\000")
        x)
-    (throw 'syntax "Unmatched closing `/'")))
+    (throw 'syntax "Unmatched closing ‘/’")))
 
 (defun math-parse-fortran-subscr (sym args)
   (setq sym (math-build-var-name sym))
@@ -695,7 +695,7 @@
 
 (defun math-parse-tex-sum (f val)
   (let (low high save)
-    (or (equal math-expr-data "_") (throw 'syntax "Expected `_'"))
+    (or (equal math-expr-data "_") (throw 'syntax "Expected ‘_’"))
     (math-read-token)
     (setq save math-exp-old-pos)
     (setq low (math-read-factor))
@@ -703,7 +703,7 @@
        (progn
          (setq math-exp-old-pos (1+ save))
          (throw 'syntax "Expected equation")))
-    (or (equal math-expr-data "^") (throw 'syntax "Expected `^'"))
+    (or (equal math-expr-data "^") (throw 'syntax "Expected ‘^’"))
     (math-read-token)
     (setq high (math-read-factor))
     (list (nth 2 f) (math-read-factor) (nth 1 low) (nth 2 low) high)))
@@ -1165,14 +1165,14 @@
     (while (assoc math-expr-data '(("ccol") ("lcol") ("rcol")))
       (math-read-token)
       (or (equal math-expr-data calc-function-open)
-         (throw 'syntax "Expected `{'"))
+         (throw 'syntax "Expected ‘{’"))
       (math-read-token)
       (setq vec (cons (cons 'vec (math-read-expr-list)) vec))
       (or (equal math-expr-data calc-function-close)
-         (throw 'syntax "Expected `}'"))
+         (throw 'syntax "Expected ‘}’"))
       (math-read-token))
     (or (equal math-expr-data calc-function-close)
-       (throw 'syntax "Expected `}'"))
+       (throw 'syntax "Expected ‘}’"))
     (math-read-token)
     (math-transpose (cons 'vec (nreverse vec)))))
 
@@ -1187,7 +1187,7 @@
                          (math-read-expr-list))))
              (if (not (or (equal math-expr-data calc-function-close)
                           (eq math-exp-token 'end)))
-                 (throw 'syntax "Expected `)'"))
+                 (throw 'syntax "Expected ‘)’"))
              (math-read-token)
              (cons (intern (format "calcFunc-%s'" (nth 1 x))) args)))
        (list 'var
@@ -1211,7 +1211,7 @@
   (interactive)
   (calc-wrapper
    (calc-set-language 'yacas)
-   (message "`Yacas' language mode")))
+   (message "‘Yacas’ language mode")))
 
 (put 'yacas 'math-vector-brackets "{}")
 
@@ -1427,7 +1427,7 @@
   (interactive)
   (calc-wrapper
    (calc-set-language 'maxima)
-   (message "`Maxima' language mode")))
+   (message "‘Maxima’ language mode")))
 
 (put 'maxima 'math-oper-table
      '(("+"    +               100  100)
@@ -1625,7 +1625,7 @@
   (interactive)
   (calc-wrapper
    (calc-set-language 'giac)
-   (message "`Giac' language mode")))
+   (message "‘Giac’ language mode")))
 
 (put 'giac 'math-oper-table
   '( ( "["    (math-read-giac-subscr) 250 -1 )
@@ -1817,7 +1817,7 @@ order to Calc's."
 (defun math-read-giac-subscr (x op)
   (let ((idx (math-read-expr-level 0)))
     (or (equal math-expr-data "]")
-       (throw 'syntax "Expected ']'"))
+       (throw 'syntax "Expected ‘]’"))
     (math-read-token)
     (list 'calcFunc-subscr x (calc-normalize (list '+ idx 1)))))
 
@@ -1954,7 +1954,7 @@ order to Calc's."
             (progn
               (math-read-token)
               (equal math-expr-data "]")))
-       (throw 'syntax "Expected ']]'"))
+       (throw 'syntax "Expected ‘]]’"))
     (math-read-token)
     (list 'calcFunc-subscr x idx)))
 
@@ -2237,7 +2237,7 @@ order to Calc's."
               (if (= sep ?\.)
                   (setq h (1+ h)))
               (if (= sep ?\])
-                  (math-read-big-error (1- h) v "Expected `)'"))
+                  (math-read-big-error (1- h) v "Expected ‘)’"))
               (if (= sep ?\))
                   (setq p (math-read-big-rec
                             (1+ math-rb-h1) math-rb-v1 (1- h) math-rb-v2 v))
@@ -2252,7 +2252,7 @@ order to Calc's."
                                                      0 1)
                                                  p))))
                       ((= (math-read-big-char (1- h) v) ?\])
-                       (math-read-big-error (1- h) v "Expected `)'"))
+                       (math-read-big-error (1- h) v "Expected ‘)’"))
                       ((= sep ?\,)
                        (or (and (math-realp (car p)) (math-realp (nth 1 p)))
                            (math-read-big-error
@@ -2280,7 +2280,7 @@ order to Calc's."
                        (setq h (math-read-big-balance (1+ hleft) v "["))
                        (if hright
                            (or (= h hright)
-                               (math-read-big-error hright v "Expected `]'"))
+                               (math-read-big-error hright v "Expected ‘]’"))
                          (setq hright h))
                        (setq p (cons (math-read-big-rec
                                       hleft v h (1+ v)) p))
@@ -2293,7 +2293,7 @@ order to Calc's."
                         (setq h (1+ h)))
                     (and (= (math-read-big-char h v) ?\])
                          (setq h (1+ h))))
-                  (math-read-big-error (1- h) v "Expected `]'"))
+                  (math-read-big-error (1- h) v "Expected ‘]’"))
               (if (= (math-read-big-char h vtop) ?\,)
                   (setq h (1+ h)))
               (math-read-big-emptyp math-rb-h1 (1+ v) (1- h) math-rb-v2 nil t)
@@ -2317,7 +2317,7 @@ order to Calc's."
             (setq widest (math-read-big-char (1- h) v))
             (if (or (memq widest '(?\; ?\)))
                     (and (eq widest ?\.) (cdr p)))
-                (math-read-big-error (1- h) v "Expected `]'"))
+                (math-read-big-error (1- h) v "Expected ‘]’"))
             (if (= widest ?\.)
                 (setq h (1+ h)
                       widest (math-read-big-balance h v "[")
@@ -2369,7 +2369,7 @@ order to Calc's."
                                  h widest)
                            (= (math-read-big-char (1- h) v) ?\,)))
                   (or (= (math-read-big-char (1- h) v) ?\))
-                      (math-read-big-error (1- h) v "Expected `)'"))
+                      (math-read-big-error (1- h) v "Expected ‘)’"))
                   (setq p (cons line (nreverse p))))
               (setq p (list 'var
                             (intern (math-remove-dashes p))
@@ -2432,7 +2432,8 @@ order to Calc's."
               (let ((y (math-read-big-rec h math-rb-v1 math-rb-h2
                                            math-rb-v2 baseline nil t)))
                 (or (= (math-read-big-char math-read-big-h2 baseline) ?\:)
-                    (math-read-big-error math-read-big-h2 baseline "Expected 
`:'"))
+                    (math-read-big-error math-read-big-h2 baseline
+                                          "Expected ‘:’"))
                 (setq p (list (nth 1 widest) p y
                               (math-read-big-rec
                                 (1+ math-read-big-h2) math-rb-v1 math-rb-h2 
math-rb-v2
@@ -2507,7 +2508,8 @@ order to Calc's."
     (while (> count 0)
       (if (>= h len)
          (if what
-             (math-read-big-error nil v (format "Unmatched `%s'" what))
+             (math-read-big-error nil v (format-message
+                                          "Unmatched ‘%s’" what))
            (setq count 0))
        (if (memq (aref line h) '(?\( ?\[))
            (setq count (1+ count))
diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el
index 5d5f4ce..4d84146 100644
--- a/lisp/calc/calc-misc.el
+++ b/lisp/calc/calc-misc.el
@@ -225,7 +225,7 @@ Calc user interface as before (either C-x * C or C-x * K; 
initially C-x * C).
           "Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro; Keep-args"
           "Other keys: +, -, *, /, ^, \\ (int div), : (frac div)"
           "Other keys: & (1/x), | (concat), % (modulo), ! (factorial)"
-          "Other keys: ' (alg-entry), = (eval), ` (edit); M-RET (last-args)"
+          "Other keys: ' (alg-entry), = (eval), \\=` (edit); M-RET (last-args)"
           "Other keys: SPC/RET (enter/dup), LFD (over); < > (scroll horiz)"
           "Other keys: DEL (drop), M-DEL (drop-above); { } (scroll vert)"
           "Other keys: TAB (swap/roll-dn), M-TAB (roll-up)"
@@ -952,7 +952,7 @@ Prompts for bug subject.  Leaves you in a mail buffer."
                                nil nil nil
                                "Please describe exactly what actions triggered 
the bug and the
 precise symptoms of the bug.  If possible, include a backtrace by
-doing 'M-x toggle-debug-on-error', then reproducing the bug.
+doing ‘\\[toggle-debug-on-error]’, then reproducing the bug.
 " )))
 ;;;###autoload
 (defalias 'calc-report-bug 'report-calc-bug)
diff --git a/lisp/calc/calc-mode.el b/lisp/calc/calc-mode.el
index be18dcd..605084e 100644
--- a/lisp/calc/calc-mode.el
+++ b/lisp/calc/calc-mode.el
@@ -110,11 +110,11 @@
      (setq n (and (not (eq calc-auto-why t)) (if calc-auto-why t 1))))
    (calc-change-mode 'calc-auto-why n nil)
    (cond ((null n)
-         (message "User must press `w' to explain unsimplified results"))
+         (message "User must press ‘w’ to explain unsimplified results"))
         ((eq n t)
-         (message "Automatically doing `w' to explain unsimplified results"))
+         (message "Automatically doing ‘w’ to explain unsimplified results"))
         (t
-         (message "Automatically doing `w' only for unusual messages")))))
+         (message "Automatically doing ‘w’ only for unusual messages")))))
 
 (defun calc-group-digits (n)
   (interactive "P")
@@ -272,7 +272,7 @@
         (vals (mapcar (function (lambda (v) (symbol-value (car v))))
                       calc-mode-var-list)))
      (unless calc-settings-file
-       (error "No `calc-settings-file' specified"))
+       (error "No ‘calc-settings-file’ specified"))
      (set-buffer (find-file-noselect (substitute-in-file-name
                                      calc-settings-file)))
      (goto-char (point-min))
@@ -410,7 +410,7 @@
                           ((= n 4) 'global)
                           ((= n 5) 'save)
                           (t 'local)))
-   (message "%s" 
+   (message "%s"
            (cond ((and (eq calc-mode-save-mode 'local) calc-embedded-info)
                   "Recording mode changes with [calc-mode: ...]")
                  ((eq calc-mode-save-mode 'edit)
@@ -478,7 +478,7 @@
                     (cond ((eq arg 0) 'scalar)
                           ((< (prefix-numeric-value arg) 1)
                            (and (< (prefix-numeric-value arg) -1) 'matrix))
-                          (arg 
+                          (arg
                             (if (consp arg) 'sqmatrix
                               (prefix-numeric-value arg)))
                           ((eq calc-matrix-mode 'matrix) 'scalar)
@@ -572,8 +572,8 @@
    (calc-change-mode 'calc-auto-recompute arg nil t)
    (calc-refresh-evaltos)
    (message (if calc-auto-recompute
-               "Automatically recomputing `=>' forms when necessary"
-             "Not recomputing `=>' forms automatically"))))
+               "Automatically recomputing ‘=>’ forms when necessary"
+             "Not recomputing ‘=>’ forms automatically"))))
 
 (defun calc-working (n)
   (interactive "P")
diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el
index 2711407..cc1d270 100644
--- a/lisp/calc/calc-prog.el
+++ b/lisp/calc/calc-prog.el
@@ -597,9 +597,9 @@
         ",")
        ((equal name "#")
         (search-backward "#")
-        (error "Token '#' is reserved"))
+        (error "Token ‘#’ is reserved"))
        ((and unquoted (string-match "#" name))
-        (error "Tokens containing '#' must be quoted"))
+        (error "Tokens containing ‘#’ must be quoted"))
        ((not (string-match "[^ ]" name))
         (search-backward "\"" nil t)
         (error "Blank tokens are not allowed"))
@@ -610,7 +610,7 @@
        (quoted nil))
     (while (progn
             (skip-chars-forward "\n\t ")
-            (if (eobp) (error "Expected '%s'" eterm))
+            (if (eobp) (error "Expected ‘%s’" eterm))
             (not (looking-at term)))
       (cond ((looking-at "%%")
             (end-of-line))
@@ -618,7 +618,7 @@
             (forward-char 2)
             (let ((p (calc-read-parse-table-part "}" "}")))
               (or (looking-at "[+*?]")
-                  (error "Expected '+', '*', or '?'"))
+                  (error "Expected ‘+’, ‘*’, or ‘?’"))
               (let ((sym (intern (buffer-substring (point) (1+ (point))))))
                 (forward-char 1)
                 (looking-at "[^\n\t ]*")
@@ -650,7 +650,7 @@
                                              (match-end 1)))))))
             (goto-char (match-end 0)))
            ((looking-at ":=[\n\t ]")
-            (error "Misplaced ':='"))
+            (error "Misplaced ‘:=’"))
            (t
             (looking-at "[^\n\t ]*")
             (let ((end (match-end 0)))
@@ -673,7 +673,7 @@
   (or last-kbd-macro
       (error "No keyboard macro defined"))
   (setq calc-invocation-macro last-kbd-macro)
-  (message "Use `C-x * Z' to invoke this macro"))
+  (message "Use ‘C-x * Z’ to invoke this macro"))
 
 (defun calc-user-define-edit ()
   (interactive)  ; but no calc-wrapper!
@@ -1899,7 +1899,7 @@ Redefine the corresponding command."
                          `((and
                             (,chk ,var)
                             (math-reject-arg ,var ',qual)))))
-             (error "Unknown qualifier `%s'" qual-name))))))))
+             (error "Unknown qualifier ‘%s’" qual-name))))))))
 
 (defun math-do-arg-list-check (args is-opt is-rest)
   (cond ((null args) nil)
diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el
index 91b927a..4cf5b8c 100644
--- a/lisp/calc/calc-store.el
+++ b/lisp/calc/calc-store.el
@@ -442,7 +442,8 @@
         (setq calc-last-edited-variable var)
         (calc-edit-mode (list 'calc-finish-stack-edit (list 'quote var))
                         t
-                        (concat "Editing variable `" (calc-var-name var) "'. 
"))
+                        (format-message
+                          "Editing variable ‘%s’" (calc-var-name var)))
         (and value
              (insert (math-format-nice-expr value (frame-width)) "\n")))))
   (calc-show-edit-buffer))
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index f3d0234..d56c0b2 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -422,7 +422,7 @@ If EXPR is nil, return nil."
   "Put the units in EXPR in the default units table.
 If COMP or STD is non-nil, put that in the units table instead."
   (let* ((new-units (or comp std (math-get-units expr)))
-         (standard-units (math-get-standard-units 
+         (standard-units (math-get-standard-units
                           (cond
                            (comp (math-simplify-units expr))
                            (std expr)
@@ -457,9 +457,9 @@ If COMP or STD is non-nil, put that in the units table 
instead."
                                 (eq (math-get-standard-units expr) 1))))
        (let ((uold (or old-units
                       (progn
-                        (setq uoldname 
+                        (setq uoldname
                                (if unitscancel
-                                   (read-string 
+                                   (read-string
                                     "(The expression is unitless when 
simplified) Old Units: ")
                                  (read-string "Old units: ")))
                         (if (equal uoldname "")
@@ -1621,11 +1621,14 @@ If COMP or STD is non-nil, put that in the units table 
instead."
               (insert "   " (nth 2 u) "\n")
               (while (eq (car (car (setq uptr (cdr uptr)))) 0)))
             (insert "\n\n")
-            (insert "(**) When in TeX or LaTeX display mode, the TeX specific 
unit\n"
-                     "names will not use the `tex' prefix; the unit name for 
a\n"
-                     "TeX point will be `pt' instead of `texpt', for 
example.\n"
-                     "To avoid conflicts, the unit names for pint and parsec 
will\n"
-                     "be `pint' and `parsec' instead of `pt' and `pc'."))
+            (insert
+             (format-message
+              (concat
+               "(**) When in TeX or LaTeX display mode, the TeX specific 
unit\n"
+               "names will not use the ‘tex’ prefix; the unit name for a\n"
+               "TeX point will be ‘pt’ instead of ‘texpt’, for example.\n"
+               "To avoid conflicts, the unit names for pint and parsec will\n"
+               "be ‘pint’ and ‘parsec’ instead of ‘pt’ and ‘pc’."))))
          (view-mode)
          (message "Formatting units table...done"))
        (setq math-units-table-buffer-valid t)
diff --git a/lisp/calc/calc-vec.el b/lisp/calc/calc-vec.el
index c1ef895..c7a3e716 100644
--- a/lisp/calc/calc-vec.el
+++ b/lisp/calc/calc-vec.el
@@ -1107,7 +1107,7 @@
       (cons 'vec (nreverse (sort (copy-sequence (cdr vec)) 'math-beforep)))
     (math-reject-arg vec 'vectorp)))
 
-;; The variable math-grade-vec is local to calcFunc-grade and 
+;; The variable math-grade-vec is local to calcFunc-grade and
 ;; calcFunc-rgrade, but is used by math-grade-beforep, which is called
 ;; by calcFunc-grade and calcFunc-rgrade.
 (defvar math-grade-vec)
@@ -1149,7 +1149,7 @@
                  (setq bin (math-floor bin)))
             (and (natnump bin)
                  (< bin n)
-                 (aset res bin 
+                 (aset res bin
                        (math-add (aref res bin)
                                  (if wvec (car (setq wp (cdr wp))) wts)))))
            (cons 'vec (append res nil))))
@@ -1167,7 +1167,7 @@
                (while (and tbds (Math-lessp (car tbds) num))
                  (setq i (1+ i))
                  (setq tbds (cdr tbds)))
-               (aset res i 
+               (aset res i
                      (math-add (aref res i)
                                (if wvec (car (setq wp (cdr wp))) wts))))
              (setq vp (cdr vp)))
@@ -1550,7 +1550,7 @@ of two matrices is a matrix."
 ;; indirectly) by math-read-brackets.
 (defvar math-rb-close)
 
-;; The next few variables are local to math-read-exprs in calc-aent.el 
+;; The next few variables are local to math-read-exprs in calc-aent.el
 ;; and math-read-expr in calc-ext.el, but are set in functions they call.
 (defvar math-exp-pos)
 (defvar math-exp-str)
@@ -1618,13 +1618,13 @@ of two matrices is a matrix."
            (if (not (or (equal math-expr-data math-rb-close)
                         (equal math-expr-data ")")
                         (eq math-exp-token 'end)))
-               (throw 'syntax "Expected `]'")))
+               (throw 'syntax "Expected ‘]’")))
        (if (equal math-expr-data ";")
            (let ((math-exp-keep-spaces space-sep))
              (setq vals (cons 'vec (math-read-matrix (list vals))))))
        (if (not (or (equal math-expr-data math-rb-close)
                     (eq math-exp-token 'end)))
-           (throw 'syntax "Expected `]'")))
+           (throw 'syntax "Expected ‘]’")))
       (or (eq math-exp-token 'end)
          (math-read-token))
       vals)))
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el
index 923df5d..cce0470 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -603,9 +603,9 @@ To cancel the edit, simply kill the *Calc Edit* buffer."
     (insert (propertize
              (concat
               (or title title "Calc Edit Mode. ")
-              "Press `C-c C-c'"
+              (format-message "Press ‘C-c C-c’")
               (if allow-ret "" " or RET")
-              " to finish, `C-x k RET' to cancel.\n\n")
+              (format-message " to finish, ‘C-x k RET’ to cancel.\n\n"))
              'font-lock-face 'italic 'read-only t 'rear-nonsticky t 
'front-sticky t))
     (make-local-variable 'calc-edit-top)
     (setq calc-edit-top (point))))
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 52ed5d7..8e4df58 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -989,11 +989,11 @@ Used by `calc-user-invocation'.")
 (defvar calc-last-kill nil
   "The last number killed in calc-mode.")
 (defvar calc-dollar-values nil
-  "Values to be used for '$'.")
+  "Values to be used for ‘$’.")
 (defvar calc-dollar-used nil
-  "The highest order of '$' that occurred.")
+  "The highest order of ‘$’ that occurred.")
 (defvar calc-hashes-used nil
-  "The highest order of '#' that occurred.")
+  "The highest order of ‘#’ that occurred.")
 (defvar calc-quick-prev-results nil
   "Previous results from Quick Calc.")
 (defvar calc-said-hello nil
@@ -1474,7 +1474,7 @@ commands given here will actually operate on the 
*Calculator* stack."
          (and calc-display-trail
               (= (window-width) (frame-width))
               (calc-trail-display 1 t)))
-       (message "Welcome to the GNU Emacs Calculator!  Press `?' or `h' for 
help, `q' to quit")
+       (message "Welcome to the GNU Emacs Calculator!  Press ‘?’ or ‘h’ for 
help, ‘q’ to quit")
        (run-hooks 'calc-start-hook)
        (and (windowp full-display)
             (window-point full-display)
@@ -1622,7 +1622,7 @@ See calc-keypad for details."
                    (stringp (nth 1 err))
                    (string-match "max-specpdl-size\\|max-lisp-eval-depth"
                                  (nth 1 err)))
-              (error "Computation got stuck or ran too long.  Type `M' to 
increase the limit")
+              (error "Computation got stuck or ran too long.  Type ‘M’ to 
increase the limit")
             (setq calc-aborted-prefix nil)
             (signal (car err) (cdr err)))))
       (when calc-aborted-prefix
@@ -2303,7 +2303,7 @@ the United States."
                   (calc-delete-selection 1)
                 (calc-pop-stack nn))))))
     (if calc-context-sensitive-enter (calc-cursor-stack-index (1- num)))))
-    
+
 
 
 
@@ -3856,7 +3856,7 @@ Also looks for the equivalent TeX words, \\gets and 
\\evalto."
 (defun calc-user-invocation ()
   (interactive)
   (unless calc-invocation-macro
-    (error "Use `Z I' inside Calc to define a `C-x * Z' keyboard macro"))
+    (error "Use ‘Z I’ inside Calc to define a ‘C-x * Z’ keyboard macro"))
   (execute-kbd-macro calc-invocation-macro nil))
 
 ;;; User-programmability.
diff --git a/lisp/calculator.el b/lisp/calculator.el
index 4027887..55229bc 100644
--- a/lisp/calculator.el
+++ b/lisp/calculator.el
@@ -311,7 +311,7 @@ user-defined operators, use `calculator-user-operators' 
instead.")
    9 (highest) (optional, defaults to 1);
 
 It it possible have a unary prefix version of a binary operator if it
-comes later in this list.  If the list begins with the symbol 'nobind,
+comes later in this list.  If the list begins with the symbol `nobind',
 then no key binding will take place -- this is only useful for
 predefined keys.
 
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index d5d8a40..426bb28 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -239,7 +239,7 @@ also calls `beep' for an audible reminder."
              (wrong-type-argument
               (if (not (listp mins))
                   (signal (car err) (cdr err))
-                (message "Argtype error in `appt-disp-window-function' - \
+                (message "Argtype error in ‘appt-disp-window-function’ - \
 update it for multiple appts?")
                 ;; Fallback to just displaying the first appt, as we used to.
                 (funcall appt-disp-window-function
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el
index d3c503e..e2e9182 100644
--- a/lisp/calendar/cal-tex.el
+++ b/lisp/calendar/cal-tex.el
@@ -100,7 +100,7 @@ At present, this only affects the daily filofax calendar."
      (format "%d/%d" day days-remaining))
   "Lisp expression giving the date format to use in the LaTeX calendars.
 This should be an expression involving the variable `date'.  When
-this expression is called, `date' is a list of the form '(MONTH DAY YEAR)'.
+this expression is called, `date' is a list of the form `(MONTH DAY YEAR)'.
 
 The string resulting from evaluating this expression is placed at
 the bottom center of each date in monthly calendars, next to the
@@ -151,7 +151,7 @@ For example, to include extra packages:
   "List of functions called after any LaTeX calendar buffer is generated.
 You can use this to do post-processing on the buffer.  For example, to change
 characters with diacritical marks to their LaTeX equivalents, use
-    (add-hook 'cal-tex-hook
+    (add-hook \\='cal-tex-hook
               (lambda () (iso-iso2tex (point-min) (point-max))))"
   :type 'hook
   :group 'calendar-tex)
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index fd2580e..c35bd38 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -190,6 +190,16 @@ movement commands will not work correctly."
          (calendar-redraw))
   :group 'calendar)
 
+(defcustom calendar-weekend-days '(0 6)
+  "Days of the week considered weekend days.
+0 means Sunday, 1 means Monday, and so on.
+
+Determines which day headers are fontified with
+`calendar-weekend-header'."
+  :type '(repeat integer)
+  :version "25.1"
+  :group 'calendar)
+
 (defcustom calendar-view-diary-initially-flag nil
   "Non-nil means display current date's diary entries on entry to calendar.
 The diary is displayed in another window when the calendar is first displayed,
@@ -350,7 +360,7 @@ See also `calendar-today-visible-hook'."
   "List of functions called whenever the cursor moves in the calendar.
 For example,
 
-  (add-hook 'calendar-move-hook (lambda () (diary-view-entries 1)))
+  (add-hook \\='calendar-move-hook (lambda () (diary-view-entries 1)))
 
 redisplays the diary for whatever date the cursor is moved to."
   :type 'hook
@@ -1454,7 +1464,7 @@ line."
      (insert
       (truncate-string-to-width
        (propertize (calendar-day-name j 'header t)
-                   'font-lock-face (if (memq j '(0 6))
+                   'font-lock-face (if (memq j calendar-weekend-days)
                                        'calendar-weekend-header
                                      'calendar-weekday-header))
        calendar-day-header-width nil ?\s)
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 1cb13e4..ec02900 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -185,9 +185,9 @@ diary buffer to be displayed with diary entries from various
 included files, each day's entries sorted into lexicographic
 order, add the following to your init file:
 
-     (setq diary-display-function 'diary-fancy-display)
-     (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
-     (add-hook 'diary-list-entries-hook 'diary-sort-entries t)
+     (setq diary-display-function \\='diary-fancy-display)
+     (add-hook \\='diary-list-entries-hook \\='diary-include-other-diary-files)
+     (add-hook \\='diary-list-entries-hook \\='diary-sort-entries t)
 
 Note how the sort function is placed last, so that it can sort
 the entries included from other files.
@@ -484,8 +484,8 @@ If so, return the expanded file name, otherwise signal an 
error."
   (if (and diary-file (file-exists-p diary-file))
       (if (file-readable-p diary-file)
           diary-file
-        (error "Diary file `%s' is not readable" diary-file))
-    (error "Diary file `%s' does not exist" diary-file)))
+        (error "Diary file ‘%s’ is not readable" diary-file))
+    (error "Diary file ‘%s’ does not exist" diary-file)))
 
 ;;;###autoload
 (defun diary (&optional arg)
@@ -1197,7 +1197,7 @@ ensure that all relevant variables are set.
 "
   (interactive "P")
   (if (string-equal diary-mail-addr "")
-      (user-error "You must set `diary-mail-addr' to use this command")
+      (user-error "You must set ‘diary-mail-addr’ to use this command")
     (let ((diary-display-function 'diary-fancy-display))
       (diary-list-entries (calendar-current-date) (or ndays diary-mail-days)))
     (compose-mail diary-mail-addr
@@ -2527,7 +2527,7 @@ entry is found the user is asked to confirm its addition."
                 #'diary-from-outlook-rmail)
                ((memq major-mode '(gnus-summary-mode gnus-article-mode))
                 #'diary-from-outlook-gnus)
-               (t (error "Don't know how to snarf in `%s'" major-mode)))))
+               (t (error "Don't know how to snarf in ‘%s’" major-mode)))))
     (funcall func noconfirm)))
 
 (provide 'diary-lib)
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 8085c1c..d282d74 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -267,9 +267,9 @@ For example, to add Bastille Day, celebrated in France on 
July 14, add
      (holiday-fixed 7 14 \"Bastille Day\")
 
 to the list.  To add Hurricane Supplication Day, celebrated in the Virgin
-Islands on the fourth Monday in August, add
+Islands on the fourth Monday in July, add
 
-     (holiday-float 8 1 4 \"Hurricane Supplication Day\")
+     (holiday-float 7 1 4 \"Hurricane Supplication Day\")
 
 to the list (the last Monday would be specified with `-1' instead of `4').
 To add the last day of Hanukkah to the list, use
@@ -791,8 +791,16 @@ is non-nil)."
 ;; Prior call to calendar-julian-from-absolute will autoload cal-julian.
 (declare-function calendar-julian-to-absolute "cal-julian" (date))
 
-(defun holiday-greek-orthodox-easter ()
-  "Date of Easter according to the rule of the Council of Nicaea."
+(defun holiday-greek-orthodox-easter (&optional n string)
+  "Date of Nth day after Easter (named STRING), if visible in calendar window.
+It is calculated according to the rule of the Council of Nicaea.
+Negative values of N are interpreted as days before Easter.
+STRING is used purely for display purposes.  The return value has
+the form ((MONTH DAY YEAR) STRING), where the date is that of the
+Nth day before or after Easter.
+
+For backwards compatibility, if this function is called with no
+arguments, it returns the date of Pascha (Greek Orthodox Easter)."
   (let* ((m displayed-month)
          (y displayed-year)
          (julian-year (progn
@@ -808,11 +816,10 @@ is non-nil)."
          (paschal-moon      ; day after full moon on or after March 21
           (- (calendar-julian-to-absolute (list 4 19 julian-year))
              shifted-epact))
-         (nicaean-easter           ; Sunday following the Paschal moon
-          (calendar-gregorian-from-absolute
-           (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))))
-    (if (calendar-date-is-visible-p nicaean-easter)
-        (list (list nicaean-easter "Pascha (Greek Orthodox Easter)")))))
+        (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))
+        (greg (calendar-gregorian-from-absolute (+ abs-easter (or n 0)))))
+    (if (calendar-date-is-visible-p greg)
+       (list (list greg (or string "Pascha (Greek Orthodox Easter)"))))))
 
 (provide 'holidays)
 
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 3e2a2f8..b75e442 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -261,7 +261,7 @@ If non-nil all sexp diary entries are enumerated for
 `icalendar-export-sexp-enumeration-days' days instead of
 translating into an icalendar equivalent.  This affects the
 following sexp diary entries: `diary-anniversary',
-`diary-cyclic', `diary-date', `diary-float',`diary-block'.  All
+`diary-cyclic', `diary-date', `diary-float', `diary-block'.  All
 other sexp entries are enumerated in any case."
   :version "25.1"
   :type 'boolean
@@ -482,7 +482,7 @@ children."
     result))
 
 (defun icalendar--split-value (value-string)
-  "Split VALUE-STRING at ';='."
+  "Split VALUE-STRING at ‘;=’."
   (let ((result '())
         param-name param-value)
     (when value-string
@@ -1118,10 +1118,10 @@ FExport diary data into iCalendar file: ")
            (setq found-error t)
            (save-current-buffer
              (set-buffer (get-buffer-create "*icalendar-errors*"))
-             (insert (format "Error in line %d -- %s: `%s'\n"
-                             (count-lines (point-min) (point))
-                             error-val
-                             entry-main))))))
+             (insert (format-message "Error in line %d -- %s: ‘%s’\n"
+                                     (count-lines (point-min) (point))
+                                     error-val
+                                     entry-main))))))
 
       ;; we're done, insert everything into the file
       (save-current-buffer
@@ -1629,8 +1629,8 @@ enumeration, given as a time value, in same format as 
returned by
                                  (icalendar--convert-ordinary-to-ical
                                   nonmarker (format "%4d/%02d/%02d %s" y m d 
see))))
                              (;TODO:
-                              (error (format "Unsupported Sexp-entry: %s"
-                                             entry-main))))))
+                              (error "Unsupported Sexp-entry: %s"
+                                     entry-main)))))
                     (number-sequence
                      0 (- icalendar-export-sexp-enumeration-days 1))))))
         (t
@@ -1741,7 +1741,7 @@ entries.  ENTRY-MAIN is the first line of the diary 
entry."
           (when day
             (progn
               (icalendar--dmsg "diary-float %s" entry-main)
-              (error "Don't know if or how to implement day in 
`diary-float'")))
+              (error "Don't know if or how to implement day in 
‘diary-float’")))
 
           (cons (concat
                  ;;Start today (yes this is an arbitrary choice):
@@ -1788,7 +1788,7 @@ entries.  ENTRY-MAIN is the first line of the diary 
entry."
                     entry-main)
       (progn
         (icalendar--dmsg "diary-date %s" entry-main)
-        (error "`diary-date' is not supported yet"))
+        (error "‘diary-date’ is not supported yet"))
     ;; no match
     nil))
 
@@ -2104,7 +2104,7 @@ written into the buffer `*icalendar-errors*'."
                  (rrule (icalendar--get-event-property e 'RRULE))
                  (rdate (icalendar--get-event-property e 'RDATE))
                  (duration (icalendar--get-event-property e 'DURATION)))
-            (icalendar--dmsg "%s: `%s'" start-d summary)
+            (icalendar--dmsg "%s: ‘%s’" start-d summary)
             ;; check whether start-time is missing
             (if  (and dtstart
                       (string=
@@ -2282,7 +2282,7 @@ END-T is the event's end time in diary format."
                                                    interval))))
                  )
                 (t
-                 (message "Cannot handle COUNT attribute for `%s' events."
+                 (message "Cannot handle COUNT attribute for ‘%s’ events."
                           frequency)))
           (setq until-conv (icalendar--datetime-to-diary-date until))
           (setq until-1-conv (icalendar--datetime-to-diary-date until-1))
@@ -2473,8 +2473,8 @@ SUMMARY is not nil it must be a string that gives the 
summary of the
 entry.  In this case the user will be asked whether he wants to insert
 the entry."
   (when (or (not summary)
-            (y-or-n-p (format "Add appointment for `%s' to diary? "
-                              summary)))
+            (y-or-n-p (format-message "Add appointment for ‘%s’ to diary? "
+                                      summary)))
     (when summary
       (setq non-marking
             (y-or-n-p (format "Make appointment non-marking? "))))
@@ -2500,8 +2500,8 @@ the entry."
 ;; ======================================================================
 (defun icalendar-import-format-sample (event)
   "Example function for formatting an iCalendar EVENT."
-  (format (concat "SUMMARY=`%s' DESCRIPTION=`%s' LOCATION=`%s' ORGANIZER=`%s' "
-                  "STATUS=`%s' URL=`%s' CLASS=`%s'")
+  (format (concat "SUMMARY='%s' DESCRIPTION='%s' LOCATION='%s' ORGANIZER='%s' "
+                  "STATUS='%s' URL='%s' CLASS='%s'")
           (or (icalendar--get-event-property event 'SUMMARY) "")
           (or (icalendar--get-event-property event 'DESCRIPTION) "")
           (or (icalendar--get-event-property event 'LOCATION) "")
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index bb7e97e..c13ef97 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -377,9 +377,9 @@ This function does not work for SECONDS greater than 
`most-positive-fixnum'."
             spec (match-string 1 string))
       (unless (string-equal spec "%")
         (or (setq match (assoc (downcase spec) units))
-            (error "Bad format specifier: `%s'" spec))
+            (error "Bad format specifier: ‘%s’" spec))
         (if (assoc (downcase spec) usedunits)
-            (error "Multiple instances of specifier: `%s'" spec))
+            (error "Multiple instances of specifier: ‘%s’" spec))
         (if (string-equal (car match) "z")
             (setq zeroflag t)
           (unless larger
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el
index cd79781..797f217 100644
--- a/lisp/calendar/timeclock.el
+++ b/lisp/calendar/timeclock.el
@@ -305,8 +305,8 @@ display (non-nil means on)."
               ;; on calling this function.
               (if display-time-mode
                   (timeclock-update-mode-line)
-                (message "Activate `display-time-mode' or turn off \
-`timeclock-use-display-time' to see timeclock information"))
+                (message "Activate ‘display-time-mode’ or turn off \
+‘timeclock-use-display-time’ to see timeclock information"))
               (add-hook 'display-time-hook 'timeclock-update-mode-line))
           (setq timeclock-update-timer
                 (run-at-time nil 60 'timeclock-update-mode-line))))
@@ -575,7 +575,7 @@ relative only to the time worked today, and not to past 
time."
 OLD-DEFAULT hours are set for every day that has no number indicated."
   (interactive "P")
   (if old-default (setq old-default (prefix-numeric-value old-default))
-    (error "`timelog-make-hours-explicit' requires an explicit argument"))
+    (error "‘timelog-make-hours-explicit’ requires an explicit argument"))
   (let ((extant-timelog (find-buffer-visiting timeclock-file))
        current-date)
     (with-current-buffer (find-file-noselect timeclock-file t)
@@ -589,7 +589,7 @@ OLD-DEFAULT hours are set for every day that has no number 
indicated."
                (unless (looking-at
                         (concat "^\\([bhioO]\\) \\([0-9]+/[0-9]+/[0-9]+\\) "
                                 "\\([0-9]+:[0-9]+:[0-9]+\\)"))
-                 (error "Can't parse `%s'" timeclock-file))
+                 (error "Can't parse ‘%s’" timeclock-file))
                (let ((this-date (match-string 2)))
                  (unless (or (and current-date
                                   (string= this-date current-date))
@@ -919,7 +919,7 @@ following format:
   (DEBT ENTRIES-BY-DAY ENTRIES-BY-PROJECT)
 
 DEBT is a floating point number representing the number of seconds
-\"owed\" before any work was done.  For a new file (one without a 'b'
+“owed” before any work was done.  For a new file (one without a ‘b’
 entry), this is always zero.
 
 The two entries lists have similar formats.  They are both alists,
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 962f425..925d008 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -237,7 +237,7 @@ The final element is \"*\", indicating an unspecified 
month.")
                   (when (string= (widget-value widget) todo-item-mark)
                     (widget-put
                      widget :error
-                     "Invalid value: must be distinct from `todo-item-mark'")
+                     "Invalid value: must be distinct from ‘todo-item-mark’")
                     widget)))
   :initialize 'custom-initialize-default
   :set 'todo-reset-prefix
@@ -1346,7 +1346,7 @@ todo or done items."
                                     "the archived category will remain\n"
                                     "after deleting the todo category.  "
                                     "Do you still want to delete it\n"
-                                    "(see `todo-skip-archived-categories' "
+                                    "(see ‘todo-skip-archived-categories’ "
                                     "for another option)? ")))
                  (t
                   (todo-y-or-n-p (concat "Permanently remove category \"" cat
@@ -1694,7 +1694,7 @@ only when no items are marked."
                   (when (string= (widget-value widget) todo-prefix)
                     (widget-put
                      widget :error
-                     "Invalid value: must be distinct from `todo-prefix'")
+                     "Invalid value: must be distinct from ‘todo-prefix’")
                     widget)))
   :set (lambda (symbol value)
         (custom-set-default symbol (propertize value 'face 'todo-mark)))
@@ -5034,7 +5034,7 @@ but the categories sexp differs from the current value of
        ;; Warn user if categories sexp has changed.
        (unless (string= ssexp cats)
          (message (concat "The sexp at the beginning of the file differs "
-                          "from the value of `todo-categories.\n"
+                          "from the value of ‘todo-categories’.\n"
                           "If the sexp is wrong, you can fix it with "
                           "M-x todo-repair-categories-sexp,\n"
                           "but note this reverts any changes you have "
@@ -5531,7 +5531,7 @@ already entered and those still available."
                         (todo-insert-item--this-key)
                         todo-insert-item--argsleft)))))))))
       (setq todo-insert-item--argsleft todo-insert-item--newargsleft))
-    (when prompt (message "Press a key (so far `%s'): %s"
+    (when prompt (message "Press a key (so far ‘%s’): %s"
                          todo-insert-item--keys-so-far prompt))
     (set-transient-map map)
     (setq todo-insert-item--argsleft argsleft)))
@@ -5585,7 +5585,7 @@ already entered and those still available."
       (`delete (todo-edit-item--text 'comment-delete))
       (`diary (todo-edit-item--diary-inclusion))
       (`nonmarking (todo-edit-item--diary-inclusion 'nonmarking))
-      (`date (let ((todo-edit-item--prompt "Press a key (so far `e d'): "))
+      (`date (let ((todo-edit-item--prompt "Press a key (so far ‘e d’): "))
               (todo-edit-item--next-key
                todo-edit-item--date-param-key-alist arg)))
       (`full (progn (todo-edit-item--header 'date)
@@ -6598,7 +6598,9 @@ Added to `window-configuration-change-hook' in Todo mode."
 
 \\{todo-mode-map}"
   (if (called-interactively-p 'any)
-      (message "Type `M-x todo-show' to enter Todo mode")
+      (message "%s"
+               (substitute-command-keys
+                "Type ‘\\[todo-show]’ to enter Todo mode"))
     (todo-modes-set-1)
     (todo-modes-set-2)
     (todo-modes-set-3)
diff --git a/lisp/cedet/cedet-global.el b/lisp/cedet/cedet-global.el
index 99bffcb..9e31177 100644
--- a/lisp/cedet/cedet-global.el
+++ b/lisp/cedet/cedet-global.el
@@ -36,7 +36,7 @@
 
 (defcustom cedet-global-gtags-command "gtags"
   "Command name for the GNU Global gtags executable.
-GTAGS is used to create the tags table queried by the 'global' command."
+GTAGS is used to create the tags table queried by the ‘global’ command."
   :type 'string
   :group 'cedet)
 
diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el
index 8a8af4e..300bd04 100644
--- a/lisp/cedet/data-debug.el
+++ b/lisp/cedet/data-debug.el
@@ -55,7 +55,7 @@
       (defalias 'data-debug-overlay-p 'extentp)
       (if (not (fboundp 'propertize))
          (defun dd-propertize (string &rest properties)
-           "Mimic 'propertize' in from Emacs 23."
+           "Mimic `propertize' in from Emacs 23."
            (add-text-properties 0 (length string) properties string)
            string
            )
diff --git a/lisp/cedet/ede/base.el b/lisp/cedet/ede/base.el
index 6d5e242..f49cb5b 100644
--- a/lisp/cedet/ede/base.el
+++ b/lisp/cedet/ede/base.el
@@ -105,7 +105,7 @@ which files this object is interested in."
         :accessor ede-object-menu)
    )
   "A target is a structure that describes a file set that produces something.
-Targets, as with 'Make', is an entity that will manage a file set
+Targets, as with `Make', is an entity that will manage a file set
 and knows how to compile or otherwise transform those files into some
 other desired outcome.")
 
@@ -626,7 +626,7 @@ instead of the current project."
 (defun ede-normalize-file/directory (this project-file-name)
   "Fills :directory or :file slots if they're missing in project THIS.
 The other slot will be used to calculate values.
-PROJECT-FILE-NAME is a name of project file (short name, like 'pom.xml', etc."
+PROJECT-FILE-NAME is a name of project file (short name, like `pom.xml', etc."
   (when (and (or (not (slot-boundp this :file))
                 (not (oref this :file)))
             (slot-boundp this :directory)
diff --git a/lisp/cedet/ede/cpp-root.el b/lisp/cedet/ede/cpp-root.el
index 81c6737..22e24c8 100644
--- a/lisp/cedet/ede/cpp-root.el
+++ b/lisp/cedet/ede/cpp-root.el
@@ -262,7 +262,7 @@ exist, it should return nil."
                    :documentation
                    "Compilation command that will be used for this project.
 It could be string or function that will accept proj argument and should 
return string.
-The string will be passed to 'compile' function that will be issued in root
+The string will be passed to `compile' function that will be issued in root
 directory of project."
                    )
    )
diff --git a/lisp/cedet/ede/pconf.el b/lisp/cedet/ede/pconf.el
index 6545b85..a831087 100644
--- a/lisp/cedet/ede/pconf.el
+++ b/lisp/cedet/ede/pconf.el
@@ -31,8 +31,8 @@
 
 (defvar ede-pconf-create-file-query 'ask
   "Controls if queries are made while creating project files.
-A value of 'ask means to always ask the user before creating
-a file, such as AUTHORS.  A value of 'never means don't ask, and
+A value of `ask' means to always ask the user before creating
+a file, such as AUTHORS.  A value of `never' means don't ask, and
 don't do it.  A value of nil means to just do it.")
 
 ;;; Code:
diff --git a/lisp/cedet/ede/pmake.el b/lisp/cedet/ede/pmake.el
index 3307202..1318fde 100644
--- a/lisp/cedet/ede/pmake.el
+++ b/lisp/cedet/ede/pmake.el
@@ -598,7 +598,8 @@ Argument THIS is the target that should insert stuff."
            "address@hidden Makefile is out of date!  "
            "It needs to be regenerated by EDE.\n"
            "address@hidden If you have not modified Project.ede, you can"
-           " use 'touch' to update the Makefile time stamp.\n"
+           (format-message
+             " use ‘touch’ to update the Makefile time stamp.\n")
            "address@hidden"
            "\n\n# End of Makefile\n")))
 
diff --git a/lisp/cedet/ede/proj-archive.el b/lisp/cedet/ede/proj-archive.el
index 0c7ffdd..8aa5477 100644
--- a/lisp/cedet/ede/proj-archive.el
+++ b/lisp/cedet/ede/proj-archive.el
@@ -55,7 +55,7 @@ Makefile.am generator, so use it to add this important bin 
program."
 (cl-defmethod ede-proj-makefile-garbage-patterns
   ((this ede-proj-target-makefile-archive))
   "Add archive name to the garbage patterns.
-This makes sure that the archive is removed with 'make clean'."
+This makes sure that the archive is removed with `make clean'."
   (let ((garb (cl-call-next-method)))
     (append garb (list (concat "lib" (ede-name this) ".a")))))
 
diff --git a/lisp/cedet/ede/proj-prog.el b/lisp/cedet/ede/proj-prog.el
index b1b26d4..a59317c 100644
--- a/lisp/cedet/ede/proj-prog.el
+++ b/lisp/cedet/ede/proj-prog.el
@@ -62,7 +62,7 @@ specified with ldlibs.")
           "Libraries, such as \"m\" or \"Xt\" which this program depends on.
 The linker flag \"-l\" is automatically prepended.  Do not include a \"lib\"
 prefix, or a \".so\" suffix.
-Use the 'ldflags' slot to specify where in-project libraries might be.
+Use the `ldflags' slot to specify where in-project libraries might be.
 
 Note: Currently only used for Automake projects."
           )
diff --git a/lisp/cedet/ede/proj.el b/lisp/cedet/ede/proj.el
index 7caee08..2bc8c09 100644
--- a/lisp/cedet/ede/proj.el
+++ b/lisp/cedet/ede/proj.el
@@ -162,12 +162,12 @@ These are the linkers the user can choose from when 
setting the
              :initform t
              :type boolean
              :custom boolean
-             :label "Part of `all:' target"
+             :label "Part of all: target"
              :group make
              :documentation
-             "Non nil means the rule created is part of the all target.
+             "Non nil means the rule created is part of the all: target.
 Setting this to nil creates the rule to build this item, but does not
-include it in the ALL`all:' rule.")
+include it in the all: rule.")
    (configuration-variables
     :initarg :configuration-variables
     :initform nil
diff --git a/lisp/cedet/ede/project-am.el b/lisp/cedet/ede/project-am.el
index 4623696..48bec3c 100644
--- a/lisp/cedet/ede/project-am.el
+++ b/lisp/cedet/ede/project-am.el
@@ -731,35 +731,35 @@ Strip out duplicates, and recurse on variables."
   (oset this :source (makefile-macro-file-list "EXTRA_DIST")))
 
 (cl-defmethod project-am-macro ((this project-am-objectcode))
-  "Return the default macro to 'edit' for this object type."
+  "Return the default macro to `edit' for this object type."
   (concat (subst-char-in-string ?- ?_ (oref this :name)) "_SOURCES"))
 
 (cl-defmethod project-am-macro ((this project-am-header-noinst))
-  "Return the default macro to 'edit' for this object."
+  "Return the default macro to `edit' for this object."
   "noinst_HEADERS")
 
 (cl-defmethod project-am-macro ((this project-am-header-inst))
-  "Return the default macro to 'edit' for this object."
+  "Return the default macro to `edit' for this object."
   "include_HEADERS")
 
 (cl-defmethod project-am-macro ((this project-am-header-pkg))
-  "Return the default macro to 'edit' for this object."
+  "Return the default macro to `edit' for this object."
   "pkginclude_HEADERS")
 
 (cl-defmethod project-am-macro ((this project-am-header-chk))
-  "Return the default macro to 'edit' for this object."
+  "Return the default macro to `edit' for this object."
   "check_HEADERS")
 
 (cl-defmethod project-am-macro ((this project-am-texinfo))
-  "Return the default macro to 'edit' for this object type."
+  "Return the default macro to `edit' for this object type."
   (concat (file-name-sans-extension (oref this :name)) "_TEXINFOS"))
 
 (cl-defmethod project-am-macro ((this project-am-man))
-  "Return the default macro to 'edit' for this object type."
+  "Return the default macro to `edit' for this object type."
   (oref this :name))
 
 (cl-defmethod project-am-macro ((this project-am-lisp))
-  "Return the default macro to 'edit' for this object."
+  "Return the default macro to `edit' for this object."
   "lisp_LISP")
 
 (defun project-am-buffer-object (amf buffer)
diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el
index 3bdc3ea..9ee8750 100644
--- a/lisp/cedet/mode-local.el
+++ b/lisp/cedet/mode-local.el
@@ -48,6 +48,13 @@
 
 (eval-when-compile (require 'cl))
 
+(require 'find-func)
+;; For find-function-regexp-alist. It is tempting to replace this
+;; ‘require‘ by (defvar find-function-regexp-alist) and
+;; with-eval-after-load, but model-local.el is typically loaded when a
+;; semantic autoload is invoked, and something in semantic loads
+;; find-func.el before mode-local.el, so the eval-after-load is lost.
+
 ;;; Misc utilities
 ;;
 (defun mode-local-map-file-buffers (function &optional predicate buffers)
@@ -625,14 +632,128 @@ SYMBOL is a function that can be overridden."
       ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE
       )))
 
+(defun describe-mode-local-overload (symbol)
+  "For `help-fns-describe-function-functions'; add overloads for SYMBOL."
+  (when (get symbol 'mode-local-overload)
+    (let ((default (or (intern-soft (format "%s-default" (symbol-name symbol)))
+                      symbol))
+         (override (and
+                    (boundp 'describe-function-orig-buffer) ;; added in Emacs 
25
+                    describe-function-orig-buffer
+                    (with-current-buffer describe-function-orig-buffer
+                      (fetch-overload symbol)))))
+      (insert (overload-docstring-extension symbol) "\n\n")
+      (insert (substitute-command-keys (format "default function: `%s'\n" 
default)))
+      (when (and (boundp 'describe-function-orig-buffer) ;; added in Emacs 25
+                describe-function-orig-buffer)
+       (if override
+           (insert (substitute-command-keys
+                    (format "\noverride in buffer '%s': `%s'\n"
+                            describe-function-orig-buffer override)))
+         (insert (substitute-command-keys (format "\nno override in buffer 
'%s'\n"
+                                                  
describe-function-orig-buffer)))))
+      )))
+
+(add-hook 'help-fns-describe-function-functions 'describe-mode-local-overload)
+
+(declare-function xref-item-location "xref" (xref))
+
+(defun xref-mode-local--override-present (sym xrefs)
+  "Return non-nil if SYM is in XREFS."
+  (let (result)
+    (while (and (null result)
+               xrefs)
+      (when (equal sym (car (xref-elisp-location-symbol (xref-item-location 
(pop xrefs)))))
+       (setq result t)))
+    result))
+
+(defun xref-mode-local-overload (symbol)
+  "For ‘elisp-xref-find-def-functions’; add overloads for SYMBOL."
+  ;; Current buffer is the buffer where xref-find-definitions was invoked.
+  (when (get symbol 'mode-local-overload)
+    (let* ((symbol-file (find-lisp-object-file-name symbol (symbol-function 
symbol)))
+          (default (intern-soft (format "%s-default" (symbol-name symbol))))
+          (default-file (when default (find-lisp-object-file-name default 
(symbol-function default))))
+          modes
+          xrefs)
+
+      (mapatoms
+       (lambda (sym) (when (get sym 'mode-local-symbol-table) (push sym 
modes)))
+       obarray)
+
+      ;; mode-local-overrides are inherited from parent modes; we
+      ;; don't want to list the same function twice. So order ‘modes’
+      ;; with parents first, and check for duplicates.
+
+      (setq modes
+           (sort modes
+                 (lambda (a b)
+                   (not (equal b (get a 'mode-local-parent)))))) ;; a is not a 
child, or not a child of b
+
+      (dolist (mode modes)
+       (let* ((major-mode mode)
+              (override (fetch-overload symbol))
+              (override-file (when override (find-lisp-object-file-name 
override (symbol-function override)))))
+
+         (when (and override override-file)
+           (let ((meta-name (cons override major-mode))
+                 ;; For the declaration:
+                 ;;
+                 ;;(define-mode-local-override xref-elisp-foo c-mode
+                 ;;
+                 ;; The override symbol name is
+                 ;; "xref-elisp-foo-c-mode". The summary should match
+                 ;; the declaration, so strip the mode from the
+                 ;; symbol name.
+                 (summary (format elisp--xref-format-extra
+                                  'define-mode-local-override
+                                  (substring (symbol-name override) 0 (- (1+ 
(length (symbol-name major-mode)))))
+                                  major-mode)))
+
+             (unless (xref-mode-local--override-present override xrefs)
+               (push (elisp--xref-make-xref
+                      'define-mode-local-override meta-name override-file 
summary)
+                     xrefs))))))
+
+      ;; %s-default is interned whether it is a separate function or
+      ;; not, so we have to check that here.
+      (when (and (functionp default) default-file)
+       (push (elisp--xref-make-xref nil default default-file) xrefs))
+
+      (when symbol-file
+       (push (elisp--xref-make-xref 'define-overloadable-function symbol 
symbol-file) xrefs))
+
+      xrefs)))
+
+(add-hook 'elisp-xref-find-def-functions 'xref-mode-local-overload)
+
+(defconst xref-mode-local-find-overloadable-regexp
+  "(\\(\\(define-overloadable-function\\)\\|\\(define-overload\\)\\) +%s"
+  "Regexp used by ‘xref-find-definitions’ when searching for a
+  mode-local overloadable function definition.")
+
+(defun xref-mode-local-find-override (meta-name)
+  "Function used by ‘xref-find-definitions’ when searching for an
+  override of a mode-local overloadable function.
+META-NAME is a cons (OVERLOADABLE-SYMBOL . MAJOR-MODE)."
+  (let* ((override (car meta-name))
+        (mode (cdr meta-name))
+        (regexp (format "(define-mode-local-override +%s +%s"
+                        (substring (symbol-name override) 0 (- (1+ (length 
(symbol-name mode)))))
+                        mode)))
+    (re-search-forward regexp nil t)
+    ))
+
+(add-to-list 'find-function-regexp-alist '(define-overloadable-function . 
xref-mode-local-find-overloadable-regexp))
+(add-to-list 'find-function-regexp-alist (cons 'define-mode-local-override 
#'xref-mode-local-find-override))
+
 ;; Help for mode-local bindings.
 (defun mode-local-print-binding (symbol)
   "Print the SYMBOL binding."
   (let ((value (symbol-value symbol)))
-    (princ (format (substitute-command-keys "\n     ‘%s’ value is\n       ")
-                   symbol))
+    (princ (format-message "\n     ‘%s’ value is\n       " symbol))
     (if (and value (symbolp value))
-        (princ (format (substitute-command-keys "‘%s’") value))
+        (princ (format-message "‘%s’" value))
       (let ((pt (point)))
         (pp value)
         (save-excursion
@@ -690,7 +811,7 @@ SYMBOL is a function that can be overridden."
       )
      ((symbolp buffer-or-mode)
       (setq mode buffer-or-mode)
-      (princ (format (substitute-command-keys "‘%s’\n") buffer-or-mode))
+      (princ (format-message "‘%s’\n" buffer-or-mode))
       )
      ((signal 'wrong-type-argument
               (list 'buffer-or-mode buffer-or-mode))))
@@ -700,7 +821,7 @@ SYMBOL is a function that can be overridden."
     (while mode
       (setq table (get mode 'mode-local-symbol-table))
       (when table
-        (princ (format (substitute-command-keys "\n- From ‘%s’\n") mode))
+        (princ (format-message "\n- From ‘%s’\n" mode))
         (mode-local-print-bindings table))
       (setq mode (get-mode-local-parent mode)))))
 
diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el
index 39ba13c..dea73a0 100644
--- a/lisp/cedet/pulse.el
+++ b/lisp/cedet/pulse.el
@@ -131,25 +131,28 @@ Return t if there is more drift to do, nil if completed."
   (if (>= (get 'pulse-highlight-face :iteration) pulse-iterations)
       nil
     (let* ((frame (color-values (face-background 'default)))
-          (start (color-values (face-background
-                                (get 'pulse-highlight-face
-                                     :startface)
-                                 nil t)))
-          (frac  (list (/ (- (nth 0 frame) (nth 0 start)) pulse-iterations)
-                       (/ (- (nth 1 frame) (nth 1 start)) pulse-iterations)
-                       (/ (- (nth 2 frame) (nth 2 start)) pulse-iterations)))
-          (it (get 'pulse-highlight-face :iteration))
-          )
-      (set-face-background 'pulse-highlight-face
-                          (pulse-color-values-to-hex
-                           (list
-                            (+ (nth 0 start) (* (nth 0 frac) it))
-                            (+ (nth 1 start) (* (nth 1 frac) it))
-                            (+ (nth 2 start) (* (nth 2 frac) it)))))
-      (put 'pulse-highlight-face :iteration (1+ it))
-      (if (>= (1+ it) pulse-iterations)
-         nil
-       t))))
+          (pulse-background (face-background
+                             (get 'pulse-highlight-face
+                                  :startface)
+                              nil t)));; can be nil
+      (when pulse-background
+       (let* ((start (color-values pulse-background))
+              (frac  (list (/ (- (nth 0 frame) (nth 0 start)) pulse-iterations)
+                           (/ (- (nth 1 frame) (nth 1 start)) pulse-iterations)
+                           (/ (- (nth 2 frame) (nth 2 start)) 
pulse-iterations)))
+              (it (get 'pulse-highlight-face :iteration))
+              )
+         (set-face-background 'pulse-highlight-face
+                              (pulse-color-values-to-hex
+                               (list
+                                (+ (nth 0 start) (* (nth 0 frac) it))
+                                (+ (nth 1 start) (* (nth 1 frac) it))
+                                (+ (nth 2 start) (* (nth 2 frac) it)))))
+         (put 'pulse-highlight-face :iteration (1+ it))
+         (if (>= (1+ it) pulse-iterations)
+             nil
+           t)))
+      )))
 
 (defun pulse-reset-face (&optional face)
   "Reset the pulse highlighting FACE."
diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el
index 81a9788..290cd90 100644
--- a/lisp/cedet/semantic.el
+++ b/lisp/cedet/semantic.el
@@ -769,8 +769,8 @@ This function returns semantic tags without overlays."
               (eq semantic-working-type 'percent)
               (progress-reporter-update
                semantic--progress-reporter
-               (/ (* 100 (semantic-lex-token-start (car stream)))
-                  (point-max))))))
+               (floor (* 100.0 (semantic-lex-token-start (car stream)))
+                      (point-max))))))
     result))
 
 ;;; Parsing Warnings:
diff --git a/lisp/cedet/semantic/analyze/debug.el 
b/lisp/cedet/semantic/analyze/debug.el
index 9f9270f..d0ab7c82 100644
--- a/lisp/cedet/semantic/analyze/debug.el
+++ b/lisp/cedet/semantic/analyze/debug.el
@@ -512,7 +512,7 @@ Optional argument CLASSCONSTRAINT says to output to tags of 
that class."
   )
 
 (defun semantic-analyzer-debug-global-miss-text (name-in)
-  "Use 'princ' to show text describing not finding symbol NAME-IN.
+  "Use `princ' to show text describing not finding symbol NAME-IN.
 NAME is the name of the unfound symbol."
   (let ((name (cond ((stringp name-in)
                     name-in)
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index e86f09c..6639f17 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -225,7 +225,7 @@ to store your global macros in a more natural way."
   )
 
 (defcustom semantic-c-member-of-autocast 't
-  "Non-nil means classes with a '->' operator will cast to its return type.
+  "Non-nil means classes with a `->' operator will cast to its return type.
 
 For Examples:
 
@@ -1049,8 +1049,8 @@ now.
     return-list))
 
 (defun semantic-expand-c-extern-C (tag)
-  "Expand TAG containing an 'extern \"C\"' statement.
-This will return all members of TAG with 'extern \"C\"' added to
+  "Expand TAG containing an `extern \"C\"' statement.
+This will return all members of TAG with `extern \"C\"' added to
 the typemodifiers attribute."
     (when (eq (semantic-tag-class tag) 'extern)
       (let* ((mb (semantic-tag-get-attribute tag :members))
@@ -1065,7 +1065,7 @@ the typemodifiers attribute."
 (defun semantic-expand-c-complex-type (tag)
   "Check if TAG has a full :type with a name on its own.
 If so, extract it, and replace it with a reference to that type.
-Thus, 'struct A { int a; } B;' will create 2 toplevel tags, one
+Thus, `struct A { int a; } B;' will create 2 toplevel tags, one
 is type A, and the other variable B where the :type of B is just
 a type tag A that is a prototype, and the actual struct info of A
 is its own toplevel tag.  This function will return (cons A B)."
@@ -1656,7 +1656,7 @@ SPEC-LIST is the template specifier of the datatype 
instantiated."
 
 (defun semantic-c--template-name-1 (spec-list)
   "Return a string used to compute template class name.
-Based on SPEC-LIST, for ref<Foo,Bar> it will return 'Foo,Bar'."
+Based on SPEC-LIST, for ref<Foo,Bar> it will return `Foo,Bar'."
   (when (car spec-list)
     (let* ((endpart (semantic-c--template-name-1 (cdr spec-list)))
           (separator (and endpart ",")))
@@ -1665,7 +1665,7 @@ Based on SPEC-LIST, for ref<Foo,Bar> it will return 
'Foo,Bar'."
 (defun semantic-c--template-name (type spec-list)
   "Return a template class name for TYPE based on SPEC-LIST.
 For a type `ref' with a template specifier of (Foo Bar) it will
-return 'ref<Foo,Bar>'."
+return `ref<Foo,Bar>'."
   (concat (semantic-tag-name type)
          "<" (semantic-c--template-name-1 (cdr spec-list)) ">"))
 
@@ -1693,7 +1693,7 @@ instantiated as specified in TYPE-DECLARATION."
 ;;; Patch here by "Raf" for instantiating templates.
 (defun semantic-c-dereference-member-of (type scope &optional type-declaration)
   "Dereference through the `->' operator of TYPE.
-Uses the return type of the '->' operator if it is contained in TYPE.
+Uses the return type of the `->' operator if it is contained in TYPE.
 SCOPE is the current local scope to perform searches in.
 TYPE-DECLARATION is passed through."
   (if semantic-c-member-of-autocast
@@ -1709,8 +1709,8 @@ TYPE-DECLARATION is passed through."
 ;; tests 5 and following.
 
 (defun semantic-c-dereference-namespace (type scope &optional type-declaration)
-  "Dereference namespace which might hold an 'alias' for TYPE.
-Such an alias can be created through 'using' statements in a
+  "Dereference namespace which might hold an `alias' for TYPE.
+Such an alias can be created through `using' statements in a
 namespace declaration.  This function checks the namespaces in
 SCOPE for such statements."
   (let ((scopetypes (oref scope scopetypes))
@@ -1826,7 +1826,7 @@ or nil if it cannot be found."
 (define-mode-local-override semantic-analyze-dereference-metatype
   c-mode (type scope &optional type-declaration)
   "Dereference TYPE as described in `semantic-analyze-dereference-metatype'.
-Handle typedef, template instantiation, and '->' operator."
+Handle typedef, template instantiation, and `->' operator."
   (let* ((dereferencer-list '(semantic-c-dereference-typedef
                               semantic-c-dereference-template
                               semantic-c-dereference-member-of
diff --git a/lisp/cedet/semantic/bovine/scm.el 
b/lisp/cedet/semantic/bovine/scm.el
index 8b99e70..745731c 100644
--- a/lisp/cedet/semantic/bovine/scm.el
+++ b/lisp/cedet/semantic/bovine/scm.el
@@ -70,7 +70,7 @@ Attempts a simple prototype for calling or using TAG."
 (define-lex-regex-analyzer semantic-lex-scheme-symbol
   "Detect and create symbol and keyword tokens."
   "\\(\\sw\\([:]\\|\\sw\\|\\s_\\)*\\)"
-  ;; (message (format "symbol: %s" (match-string 0)))
+  ;; (message "symbol: %s" (match-string 0))
   (semantic-lex-push-token
    (semantic-lex-token
     (or (semantic-lex-keyword-p (match-string 0)) 'symbol)
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index 1e12190..9c32388 100644
--- a/lisp/cedet/semantic/complete.el
+++ b/lisp/cedet/semantic/complete.el
@@ -156,7 +156,7 @@ Presumably if you call this you will insert something new 
there."
   "Display the string FMT formatted with ARGS at the end of the minibuffer."
   (if semantic-complete-inline-overlay
       (apply 'message fmt args)
-    (message (concat (buffer-string) (apply 'format fmt args)))))
+    (message (concat (buffer-string) (apply #'format-message fmt args)))))
 
 ;;; ------------------------------------------------------------
 ;;; MINIBUFFER: Option Selection harnesses
@@ -1491,7 +1491,7 @@ Not meaningful return value."
   "Display completions in *Completions* buffer, with focus highlight.
 A traditional displayor which can focus on a tag by showing it.
 Same as `semantic-displayor-traditional', but with selection between
-multiple tags with the same name done by 'focusing' on the source
+multiple tags with the same name done by focusing on the source
 location of the different tags to differentiate them.")
 
 (cl-defmethod semantic-displayor-focus-request
@@ -1665,7 +1665,7 @@ Display mechanism using tooltip for a list of possible 
completions.")
        (when (>= (oref obj typing-count) 5)
          (oset obj mode 'standard)
          (setq mode 'standard)
-         (message "Resetting inline-mode to 'standard'."))
+         (message "Resetting inline-mode to ‘standard’."))
        (when (and (> numcompl max-tags)
                   (< (oref obj typing-count) 2))
          ;; Discretely hint at completion availability.
@@ -1684,7 +1684,7 @@ Display mechanism using tooltip for a list of possible 
completions.")
              (setq msg-tail (concat "\n[<TAB> " (number-to-string (- numcompl 
max-tags)) " more]"))
            (setq msg-tail (concat "\n[<n/a> " (number-to-string (- numcompl 
max-tags)) " more]"))
            (when (>= (oref obj typing-count) 2)
-             (message "Refine search to display results beyond the '%s' limit"
+             (message "Refine search to display results beyond the ‘%s’ limit"
                       (symbol-name 
'semantic-complete-inline-max-tags-extended)))))
         ((= numcompl 1)
          ;; two possible cases
diff --git a/lisp/cedet/semantic/ctxt.el b/lisp/cedet/semantic/ctxt.el
index 456ef8d..33b9a2e 100644
--- a/lisp/cedet/semantic/ctxt.el
+++ b/lisp/cedet/semantic/ctxt.el
@@ -362,7 +362,7 @@ This skips forward over symbols in a complex reference.
 For example, in the C statement:
   this.that().entry;
 
-If the cursor is on 'this', will move point to the ; after entry.")
+If the cursor is on `this', will move point to the ; after entry.")
 
 (defun semantic-ctxt-end-of-symbol-default (&optional point)
   "Move point to the end of the current symbol under POINT.
diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el
index 7380bdd..e4ac56c 100644
--- a/lisp/cedet/semantic/db.el
+++ b/lisp/cedet/semantic/db.el
@@ -142,7 +142,7 @@ Abstract tables do not have file names associated with 
them."
   nil)
 
 (cl-defmethod semanticdb-dirty-p ((obj semanticdb-abstract-table))
-  "Return non-nil if OBJ is 'dirty'."
+  "Return non-nil if OBJ is dirty."
   nil)
 
 (cl-defmethod semanticdb-set-dirty ((obj semanticdb-abstract-table))
@@ -313,7 +313,7 @@ If OBJ's file is not loaded, read it in first."
                    (oref (oref obj parent-db) reference-directory)))
 
 (cl-defmethod semanticdb-dirty-p ((obj semanticdb-table))
-  "Return non-nil if OBJ is 'dirty'."
+  "Return non-nil if OBJ is dirty."
   (oref obj dirty))
 
 (cl-defmethod semanticdb-set-dirty ((obj semanticdb-table))
@@ -369,7 +369,7 @@ Abstract tables do not have file names associated with 
them."
   nil)
 
 (cl-defmethod semanticdb-dirty-p ((DB semanticdb-project-database))
-  "Return non-nil if DB is 'dirty'.
+  "Return non-nil if DB is dirty.
 A database is dirty if the state of the database changed in a way
 where it may need to resynchronize with some persistent storage."
   (let ((dirty nil)
diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el
index f207fce..aa7131e 100644
--- a/lisp/cedet/semantic/edit.el
+++ b/lisp/cedet/semantic/edit.el
@@ -463,11 +463,11 @@ See `semantic-edits-change-leaf-tag' for details on 
parents."
 
 (defun semantic-parse-changes-failed (&rest args)
   "Signal that Semantic failed to parse changes.
-That is, display a message by passing all ARGS to `format', then throw
+That is, display a message by passing all ARGS to `format-message', then throw
 a 'semantic-parse-changes-failed exception with value t."
   (when semantic-edits-verbose-flag
     (message "Semantic parse changes failed: %S"
-            (apply 'format args)))
+            (apply #'format-message args)))
   (throw 'semantic-parse-changes-failed t))
 
 (defsubst semantic-edits-incremental-fail ()
diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el
index 7dcd7f1..fc02d03 100644
--- a/lisp/cedet/semantic/java.el
+++ b/lisp/cedet/semantic/java.el
@@ -369,7 +369,7 @@ That is @NAME."
 
 (defsubst semantic-java-doc-tag-name (tag)
   "Return name of the doc TAG symbol.
-That is TAG `symbol-name' without the leading '@'."
+That is TAG `symbol-name' without the leading address@hidden"
   (substring (symbol-name tag) 1))
 
 (defun semantic-java-doc-keyword-before-p (k1 k2)
diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el
index 0aa2f95..761cc1a 100644
--- a/lisp/cedet/semantic/lex-spp.el
+++ b/lisp/cedet/semantic/lex-spp.el
@@ -919,7 +919,7 @@ STR occurs in the current buffer between BEG and END."
     ))
 
 (define-lex-regex-analyzer semantic-lex-spp-replace-or-symbol-or-keyword
-  "Like 'semantic-lex-symbol-or-keyword' plus preprocessor macro replacement."
+  "Like `semantic-lex-symbol-or-keyword' plus preprocessor macro replacement."
   "\\(\\sw\\|\\s_\\)+"
   (let ((str (match-string 0))
        (beg (match-beginning 0))
diff --git a/lisp/cedet/semantic/senator.el b/lisp/cedet/semantic/senator.el
index c58def6..372e1d9 100644
--- a/lisp/cedet/semantic/senator.el
+++ b/lisp/cedet/semantic/senator.el
@@ -507,7 +507,7 @@ filters in `senator-search-tag-filter-functions' remain 
active."
 (define-overloadable-function semantic-up-reference (tag)
   "Return a tag that is referred to by TAG.
 A \"reference\" could be any interesting feature of TAG.
-In C++, a function may have a 'parent' which is non-local.
+In C++, a function may have a `parent' which is non-local.
 If that parent which is only a reference in the function tag
 is found, we can jump to it.
 Some tags such as includes have other reference features.")
@@ -516,7 +516,7 @@ Some tags such as includes have other reference features.")
 (defun senator-go-to-up-reference (&optional tag)
   "Move up one reference from the current TAG.
 A \"reference\" could be any interesting feature of TAG.
-In C++, a function may have a 'parent' which is non-local.
+In C++, a function may have a `parent' which is non-local.
 If that parent which is only a reference in the function tag
 is found, we can jump to it.
 Some tags such as includes have other reference features."
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index ca5dd7d..89e8b40 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -337,7 +337,7 @@ Use the  `semantic-symref-hit-tags' method to get this 
list.")
   "List of buffers opened by `semantic-symref-result-get-tags'.")
 
 (defun semantic-symref-cleanup-recent-buffers-fcn ()
-  "Hook function to be used in 'post-command-hook' to cleanup buffers.
+  "Hook function to be used in `post-command-hook' to cleanup buffers.
 Buffers collected during symref can result in some files being
 opened multiple times for one operation.  This will keep buffers open
 until the next command is executed."
diff --git a/lisp/cedet/semantic/tag.el b/lisp/cedet/semantic/tag.el
index 545ca91..6c6616d 100644
--- a/lisp/cedet/semantic/tag.el
+++ b/lisp/cedet/semantic/tag.el
@@ -95,7 +95,7 @@ print statement."
 
 (defsubst semantic-tag-class (tag)
   "Return the class of TAG.
-That is, the symbol 'variable, 'function, 'type, or other.
+This is a symbol like `variable', `function', or `type'.
 There is no limit to the symbols that may represent the class of a tag.
 Each parser generates tags with classes defined by it.
 
diff --git a/lisp/cedet/semantic/wisent.el b/lisp/cedet/semantic/wisent.el
index dfa533c..761bc68 100644
--- a/lisp/cedet/semantic/wisent.el
+++ b/lisp/cedet/semantic/wisent.el
@@ -322,9 +322,9 @@ the standard function `semantic-parse-region'."
               semantic--progress-reporter
               (progress-reporter-update
                semantic--progress-reporter
-               (/ (* 100 (semantic-lex-token-start
-                          (car wisent-lex-istream)))
-                  (point-max))))))
+               (floor (* 100.0 (semantic-lex-token-start
+                                (car wisent-lex-istream)))
+                      (point-max))))))
     ;; Return parse tree
     (nreverse ptree)))
 
diff --git a/lisp/cedet/semantic/wisent/comp.el 
b/lisp/cedet/semantic/wisent/comp.el
index 2e4072f..6730e8e 100644
--- a/lisp/cedet/semantic/wisent/comp.el
+++ b/lisp/cedet/semantic/wisent/comp.el
@@ -230,11 +230,11 @@ Its name is defined in constant `wisent-log-buffer-name'."
 
 (defsubst wisent-log (&rest args)
   "Insert text into the log buffer.
-`format' is applied to ARGS and the result string is inserted into the
+`format-message' is applied to ARGS and the result string is inserted into the
 log buffer returned by the function `wisent-log-buffer'."
   (and wisent-new-log-flag (wisent-new-log))
   (with-current-buffer (wisent-log-buffer)
-    (insert (apply 'format args))))
+    (insert (apply #'format-message args))))
 
 (defconst wisent-log-file "wisent.output"
   "The log file.
@@ -2892,7 +2892,7 @@ Also warn if X is a $N or $regionN symbol with N < 1 or N 
> M."
   "Parse BODY of semantic action.
 N is the maximum number of $N variables that can be referenced in
 BODY.  Warn on references out of permitted range.
-Optional argument FOUND is the accumulated list of '$N' references
+Optional argument FOUND is the accumulated list of $N references
 encountered so far.
 Return a cons (FOUND . XBODY), where FOUND is the list of $N
 references found in BODY, and XBODY is BODY expression with
diff --git a/lisp/cedet/semantic/wisent/python.el 
b/lisp/cedet/semantic/wisent/python.el
index a8348d2..2dc3dd3 100644
--- a/lisp/cedet/semantic/wisent/python.el
+++ b/lisp/cedet/semantic/wisent/python.el
@@ -130,7 +130,7 @@ curly braces."
 
 (defun wisent-python-forward-balanced-expression ()
   "Move point to the end of the balanced expression at point.
-Here 'balanced expression' means anything matched by Emacs'
+Here “balanced expression” means anything matched by Emacs's
 open/close parenthesis syntax classes.  We can't use forward-sexp
 for this because that Emacs built-in can't parse Python's
 triple-quoted string syntax."
@@ -490,7 +490,7 @@ Return nil if there is nothing relevant."
 ;;
 (define-mode-local-override semantic-format-tag-abbreviate python-mode (tag 
&optional parent color)
   "Format an abbreviated tag for python.
-Shortens 'code' tags, but passes through for others."
+Shortens `code' tags, but passes through for others."
   (cond ((semantic-tag-of-class-p tag 'code)
         ;; Just take the first line.
         (let ((name (semantic-tag-name tag)))
@@ -534,9 +534,6 @@ Shortens 'code' tags, but passes through for others."
                                      (code . "Code")))
    )
 
-;;;###autoload
-(add-hook 'python-mode-hook 'wisent-python-default-setup)
-
 ;; Make sure the newer python modes pull in the same python
 ;; mode overrides.
 (define-child-mode python-2-mode python-mode "Python 2 mode")
diff --git a/lisp/cedet/srecode/compile.el b/lisp/cedet/srecode/compile.el
index a8d6a50..c6b3b53 100644
--- a/lisp/cedet/srecode/compile.el
+++ b/lisp/cedet/srecode/compile.el
@@ -75,7 +75,7 @@ any incoming dictionaries values.")
           :initform nil
           :documentation
           "During template insertion, this is the stack of active templates.
-The top-most template is the 'active' template.  Use the accessor methods
+The top-most template is the `active' template.  Use the accessor methods
 for push, pop, and peek for the active template.")
    (table :initarg :table
          :documentation
@@ -290,7 +290,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current 
escape sequences in use."
        )
       ;; Continue
       (setq tags (cdr tags)))
-    
+
     ;; MSG - Before install since nreverse whacks our list.
     (when (called-interactively-p 'interactive)
       (message "%d templates compiled for %s"
diff --git a/lisp/cedet/srecode/dictionary.el b/lisp/cedet/srecode/dictionary.el
index 27e730f..b95d45e 100644
--- a/lisp/cedet/srecode/dictionary.el
+++ b/lisp/cedet/srecode/dictionary.el
@@ -417,7 +417,7 @@ searched for NAME if it is not found in DICT.  This 
recursive
 lookup can be disabled by the optional argument NON-RECURSIVE.
 
 This function derives values for some special NAMEs, such as
-'FIRST' and 'LAST'."
+`FIRST' and `LAST'."
   (if (not (slot-boundp dict 'namehash))
       nil
     ;; Get the value of this name from the dictionary or its parent
diff --git a/lisp/cedet/srecode/document.el b/lisp/cedet/srecode/document.el
index 4757784..f0fe498 100644
--- a/lisp/cedet/srecode/document.el
+++ b/lisp/cedet/srecode/document.el
@@ -655,7 +655,7 @@ If there is only one tag in the region, complain."
   "Create documentation for the function defined in TAG.
 If we can identify a verb in the list followed by some
 name part then check the return value to see if we can use that to
-finish off the sentence.  That is, any function with 'alloc' in it will be
+finish off the sentence.  That is, any function with `alloc' in it will be
 allocating something based on its type."
   (let ((al srecode-document-autocomment-return-first-alist)
        (dropit nil)
diff --git a/lisp/cedet/srecode/el.el b/lisp/cedet/srecode/el.el
index 2bdf804..7e91a61 100644
--- a/lisp/cedet/srecode/el.el
+++ b/lisp/cedet/srecode/el.el
@@ -50,7 +50,7 @@ Adds the following:
 (defun srecode-semantic-handle-:el-custom (dict)
   "Add macros into the dictionary DICT based on the current Emacs Lisp file.
 Adds the following:
-  GROUP - The 'defgroup' name we guess you want for variables.
+  GROUP - The `defgroup' name we guess you want for variables.
   FACEGROUP - The `defgroup' name you might want for faces."
   (require 'semantic/db-find)
   (let ((groups (semanticdb-strip-find-results
diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el
index c2a70fe..d1b0015 100644
--- a/lisp/cedet/srecode/insert.el
+++ b/lisp/cedet/srecode/insert.el
@@ -216,7 +216,7 @@ insertions."
     (data-debug-insert-thing dictionary "" "> ")
     ;; Show the error message.
     (insert (propertize "Error" 'face '(:weight bold)) "\n")
-    (insert (apply #'format format args))
+    (insert (apply #'format-message format args))
     (pop-to-buffer (current-buffer))))
 
 (defun srecode-insert-report-error (dictionary format &rest args)
@@ -377,9 +377,9 @@ Can't be blank, or it might be used by regular variable 
insertion.")
     (where :initform 'begin
           :initarg :where
           :documentation
-          "This should be 'begin or 'end, indicating where to insert a CR.
-When set to 'begin, it will insert a CR if we are not at 'bol'.
-When set to 'end it will insert a CR if we are not at 'eol'.")
+          "This should be `begin' or `end', indicating where to insert a CR.
+When `begin', insert a CR if not at 'bol'.
+When `end', insert a CR if not at 'eol'.")
     ;; @TODO - Add slot and control for the number of blank
     ;;         lines before and after point.
    )
@@ -762,7 +762,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current 
escape sequences in use."
 (cl-defmethod srecode-insert-method ((sti srecode-template-inserter-point)
                                  dictionary)
   "Insert the STI inserter.
-Save point in the class allocated 'point' slot.
+Save point in the class allocated `point' slot.
 If `srecode-template-inserter-point-override' non-nil then this
 generalized marker will do something else.  See
 `srecode-template-inserter-include-wrap' as an example."
diff --git a/lisp/cedet/srecode/texi.el b/lisp/cedet/srecode/texi.el
index 6c8f7a6..38bdc9a 100644
--- a/lisp/cedet/srecode/texi.el
+++ b/lisp/cedet/srecode/texi.el
@@ -245,7 +245,7 @@ that class.
  variable   => @code{variable}
  class      => @code{class} @xref{class}
  unknown    => @code{unknown}
- \"text\"     => \\=`\\=`text''
+ \"text\"     => \\=`\\=`text\\='\\='
  'quoteme   => @code{quoteme}
  non-nil    => address@hidden
  t          => @code{t}
diff --git a/lisp/character-fold.el b/lisp/character-fold.el
index bf5ae59..988a506 100644
--- a/lisp/character-fold.el
+++ b/lisp/character-fold.el
@@ -24,7 +24,7 @@
 
 
 ;;;###autoload
-(defvar character-fold-search t
+(defvar character-fold-search nil
   "Non-nil if searches should fold similar characters.
 This means some characters will match entire groups of characters.
 For instance, \" will match all variants of double quotes, and
@@ -94,8 +94,7 @@ some).")
       ;; Add some manual entries.
       (dolist (it '((?\" """ "“" "”" "”" "„" "⹂" "〞" "‟" "‟" "❞" "❝" "❠" "“" 
"„" "〝" "〟" "🙷" "🙶" "🙸" "«" "»")
                     (?' "❟" "❛" "❜" "‘" "’" "‚" "‛" "‚" "󠀢" "❮" "❯" "‹" "›")
-                    (?` "❛" "‘" "‛" "󠀢" "❮" "‹")
-                    (?\s "\t" "\r" "\n")))
+                    (?` "❛" "‘" "‛" "󠀢" "❮" "‹")))
         (let ((idx (car it))
               (chars (cdr it)))
           (aset equiv idx (append chars (aref equiv idx)))))
@@ -121,12 +120,11 @@ If LAX is non-nil, any single whitespace character is 
allowed to
 match any number of times."
   (if character-fold-search
       (apply #'concat
-        (mapcar (lambda (c) (let ((out (or (aref character-fold-table c)
-                                      (regexp-quote (string c)))))
-                         (if (and lax (memq c '(?\s ?\t ?\r ?\n )))
-                             (concat out "+")
-                           out)))
-                string))
+             (mapcar (lambda (c) (if (and lax (memq c '(?\s ?\t ?\r ?\n)))
+                                "[ 
\t\n\r\xa0\x2002\x2d\x200a\x202f\x205f\x3000]+"
+                              (or (aref character-fold-table c)
+                                  (regexp-quote (string c)))))
+                     string))
     (regexp-quote string)))
 
 ;;; character-fold.el ends here
diff --git a/lisp/comint.el b/lisp/comint.el
index de22061..b840a22 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -184,11 +184,11 @@ narrowing in effect.  This way you will be certain that 
none of
 the remaining prompts will be accidentally messed up.  You may
 wish to put something like the following in your init file:
 
-\(add-hook 'comint-mode-hook
+\(add-hook \\='comint-mode-hook
          (lambda ()
-           (define-key comint-mode-map [remap kill-region] 'comint-kill-region)
+           (define-key comint-mode-map [remap kill-region] 
\\='comint-kill-region)
            (define-key comint-mode-map [remap kill-whole-line]
-             'comint-kill-whole-line)))
+             \\='comint-kill-whole-line)))
 
 If you sometimes use comint-mode on text-only terminals or with `emacs -nw',
 you might wish to use another binding for `comint-kill-whole-line'."
@@ -1051,7 +1051,7 @@ See also `comint-read-input-ring'."
       (let ((ch (read-event)))
        (if (eq ch ?\s)
            (set-window-configuration conf)
-         (setq unread-command-events (list ch)))))))
+         (push ch unread-command-events))))))
 
 
 (defun comint-regexp-arg (prompt)
@@ -3365,7 +3365,8 @@ the completions."
            (set-window-configuration comint-dynamic-list-completions-config))
        (if (eq first ?\s)
            (set-window-configuration comint-dynamic-list-completions-config)
-         (setq unread-command-events (listify-key-sequence key)))))))
+         (setq unread-command-events
+                (nconc (listify-key-sequence key) unread-command-events)))))))
 
 (defun comint-get-next-from-history ()
   "After fetching a line from input history, this fetches the following line.
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 1d9a9d6..7030833 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -633,7 +633,7 @@ if that fails, the doc string with 
`custom-guess-doc-alist'."
        (setq found (nth 1 current)
              names nil)))
     (unless found
-      (let ((doc (documentation-property symbol 'variable-documentation))
+      (let ((doc (documentation-property symbol 'variable-documentation t))
            (docs custom-guess-doc-alist))
        (when doc
          (while docs
@@ -1599,7 +1599,7 @@ This button will have a menu with all three reset 
operations."
 
 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box)
                                             '(("unspecified" . unspecified))))
-  "If non-nil, indicate active buttons in a `raised-button' style.
+  "If non-nil, indicate active buttons in a raised-button style.
 Otherwise use brackets."
   :type 'boolean
   :version "21.1"
@@ -1709,7 +1709,7 @@ Operate on all settings in this buffer:\n"))
            (mapcar (lambda (entry)
                      (prog2
                          (message "Creating customization items ...%2d%%"
-                                  (/ (* 100.0 count) length))
+                                  (floor (* 100.0 count) length))
                          (widget-create (nth 1 entry)
                                         :tag (custom-unlispify-tag-name
                                               (nth 0 entry))
@@ -1748,7 +1748,7 @@ Operate on all settings in this buffer:\n"))
 on a button to invoke its action.
 Invoke [+] to expand a group, and [-] to collapse an expanded group.\n"
                         (if custom-raised-buttons
-                            "`Raised' text indicates"
+                            "Raised text indicates"
                           "Square brackets indicate")))
 
 
@@ -2457,7 +2457,7 @@ If INITIAL-STRING is non-nil, use that rather than 
\"Parent groups:\"."
   "Return documentation of VARIABLE for use in Custom buffer.
 Normally just return the docstring.  But if VARIABLE automatically
 becomes buffer local when set, append a message to that effect."
-  (format "%s%s" (documentation-property variable 'variable-documentation)
+  (format "%s%s" (documentation-property variable 'variable-documentation t)
          (if (and (local-variable-if-set-p variable)
                   (or (not (local-variable-p variable))
                       (with-temp-buffer
@@ -3990,12 +3990,12 @@ If GROUPS-ONLY is non-nil, return only those members 
that are groups."
         ;; (indent (widget-get widget :indent))
         (prefix (widget-get widget :custom-prefix))
         (buttons (widget-get widget :buttons))
-        (tag (widget-get widget :tag))
+        (tag (substitute-command-keys (widget-get widget :tag)))
         (symbol (widget-value widget))
         (members (custom-group-members symbol
                                        (and (eq custom-buffer-style 'tree)
                                             custom-browse-only-groups)))
-        (doc (widget-docstring widget)))
+        (doc (substitute-command-keys (widget-docstring widget))))
     (cond ((and (eq custom-buffer-style 'tree)
                (eq state 'hidden)
                (or members (custom-unloaded-widget-p widget)))
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 69dbf0d..2b9cc09 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -221,14 +221,14 @@ Leaving \"Default\" unchecked is equivalent with 
specifying a default of
             (no-redraw-on-reenter display boolean)
 
             ;; doc.c
-            (help-quote-translation help
-                                    (choice
-                                     (character :tag "Quote with curved quotes"
-                                                 :value ?‘)
-                                     (character :tag "Quote 'like this'" 
:value ?\')
-                                     (character :tag "Quote `like this'" 
:value ?\`)
-                                     (const :tag "Quote with curved quotes if 
displayable, 'like this' otherwise" nil))
-                                    "25.1")
+            (text-quoting-style
+              help
+              (choice
+               (const :tag "Quote with curved single quotes \\=‘like this\\=’" 
curve)
+               (const :tag "Quote with straight apostrophes \\='like this\\='" 
straight)
+               (const :tag "Quote with grave accent and apostrophe \\=`like 
this\\='" grave)
+               (const :tag "Use curved quotes if displayable, grave accent and 
apostrophe otherwise" nil))
+              "25.1")
              ;; dosfns.c
             (dos-display-scancodes display boolean)
             (dos-hyper-key keyboard integer)
@@ -635,7 +635,7 @@ since it could result in memory overflow and make Emacs 
crash."
     (if (not (boundp symbol))
        ;; If variables are removed from C code, give an error here!
        (and native-p
-            (message "Note, built-in variable `%S' not bound" symbol))
+            (message "Note, built-in variable ‘%S’ not bound" symbol))
       ;; Save the standard value, unless we already did.
       (or (get symbol 'standard-value)
          (put symbol 'standard-value (list standard)))
diff --git a/lisp/custom.el b/lisp/custom.el
index ea5ab7a..f2b5d52 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -548,13 +548,13 @@ VALUE should be a list of symbols.  For each symbol in 
that list,
 this specifies that SYMBOL should be set after the specified symbol,
 if both appear in constructs like `custom-set-variables'."
   (unless (listp value)
-    (error "Invalid custom dependency `%s'" value))
+    (error "Invalid custom dependency ‘%s’" value))
   (let* ((deps (get symbol 'custom-dependencies))
         (new-deps deps))
     (while value
       (let ((dep (car value)))
        (unless (symbolp dep)
-         (error "Invalid custom dependency `%s'" dep))
+         (error "Invalid custom dependency ‘%s’" dep))
        (unless (memq dep new-deps)
          (setq new-deps (cons dep new-deps)))
        (setq value (cdr value))))
@@ -830,7 +830,7 @@ to the front of this list.")
 (defsubst custom-check-theme (theme)
   "Check whether THEME is valid, and signal an error if it is not."
   (unless (custom-theme-p theme)
-    (error "Unknown theme `%s'" theme)))
+    (error "Unknown theme ‘%s’" theme)))
 
 (defun custom-push-theme (prop symbol theme mode &optional value)
   "Record VALUE for face or variable SYMBOL in custom theme THEME.
@@ -1043,7 +1043,7 @@ list, in which A occurs before B if B was defined with a
     (when elt
       (cond
        ((eq (car elt) 'dependant)
-       (error "Circular custom dependency on `%s'" sym))
+       (error "Circular custom dependency on ‘%s’" sym))
        ((car elt)
        (setcar elt 'dependant)
        (dolist (dep (get sym 'custom-dependencies))
@@ -1201,7 +1201,7 @@ Return t if THEME was successfully loaded, nil otherwise."
                                     (custom-available-themes))))
     nil nil))
   (unless (custom-theme-name-valid-p theme)
-    (error "Invalid theme name `%s'" theme))
+    (error "Invalid theme name ‘%s’" theme))
   ;; If THEME is already enabled, re-enable it after loading, even if
   ;; NO-ENABLE is t.
   (if no-enable
@@ -1217,7 +1217,7 @@ Return t if THEME was successfully loaded, nil otherwise."
                         '("" "c")))
        hash)
     (unless fn
-      (error "Unable to find theme file for `%s'" theme))
+      (error "Unable to find theme file for ‘%s’" theme))
     (with-temp-buffer
       (insert-file-contents fn)
       (setq hash (secure-hash 'sha256 (current-buffer)))
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 50c5207..42d7fd3 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -534,7 +534,7 @@ See also `dabbrev-abbrev-char-regexp' and 
\\[dabbrev-completion]."
       (if (not (or (eq dabbrev--last-buffer dabbrev--last-buffer-found)
                   (minibuffer-window-active-p (selected-window))))
          (progn
-           (message "Expansion found in '%s'"
+           (message "Expansion found in `%s'"
                     (buffer-name dabbrev--last-buffer))
            (setq dabbrev--last-buffer-found dabbrev--last-buffer))
        (message nil))
diff --git a/lisp/delim-col.el b/lisp/delim-col.el
index d16a03c..bb4b5f4 100644
--- a/lisp/delim-col.el
+++ b/lisp/delim-col.el
@@ -179,11 +179,11 @@ Valid values are:
                `delimit-columns-separator' and then followed by spaces.
                For example, the result is: \"<ccc>:   <dddd>:  \"
 
-   'separator  align separators.  That is, `delimit-columns-after' is followed
+   `separator' align separators.  That is, `delimit-columns-after' is followed
                by spaces and then followed by `delimit-columns-separator'.
                For example, the result is: \"<ccc>   :<dddd>  :\"
 
-   'padding    format column by filling with spaces before
+   `padding'   format column by filling with spaces before
                `delimit-columns-after'.  That is, spaces are followed by
                `delimit-columns-after' and then followed by
                `delimit-columns-separator'.
diff --git a/lisp/delsel.el b/lisp/delsel.el
index 740b603..586c130 100644
--- a/lisp/delsel.el
+++ b/lisp/delsel.el
@@ -231,10 +231,17 @@ See `delete-selection-helper'."
     (delete-selection-helper (and (symbolp this-command)
                                   (get this-command 'delete-selection)))))
 
-(put 'self-insert-command 'delete-selection
-     (lambda ()
-       (not (run-hook-with-args-until-success
-             'self-insert-uses-region-functions))))
+(defun delete-selection-uses-region-p ()
+  "Return t when the current command will be using the region
+rather than having `delete-selection' delete it, nil otherwise.
+
+This function is intended for use as the value of the
+`delete-selection' property of a command, and shouldn't be used
+for anything else."
+  (not (run-hook-with-args-until-success
+        'self-insert-uses-region-functions)))
+
+(put 'self-insert-command 'delete-selection 'delete-selection-uses-region-p)
 
 (put 'insert-char 'delete-selection t)
 (put 'quoted-insert 'delete-selection t)
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index a0b9ddf..237cc00 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -161,11 +161,8 @@ otherwise."
       ;; Buttons
       (when (and button (not (widgetp wid-button)))
        (newline)
-       (insert (substitute-command-keys "Here is a ‘")
-               (format "%S" button-type)
-               (substitute-command-keys "’ button labeled ‘")
-               button-label
-               (substitute-command-keys "’.\n\n")))
+       (insert (format-message "Here is a ‘%S’ button labeled ‘%s’.\n\n"
+                                button-type button-label)))
       ;; Overlays
       (when overlays
        (newline)
@@ -542,9 +539,7 @@ relevant to POS."
                ,(let* ((beg      (point-min))
                        (end      (point-max))
                        (total    (buffer-size))
-                       (percent  (if (> total 50000) ; Avoid overflow 
multiplying by 100
-                                     (/ (+ (/ total 200) (1- pos))  (max (/ 
total 100) 1))
-                                   (/ (+ (/ total 2) (* 100 (1- pos)))  (max 
total 1))))
+                       (percent  (round (* 100.0 (1- pos)) (max total 1)))
                        (hscroll  (if (= (window-hscroll) 0)
                                      ""
                                    (format ", Hscroll: %d" (window-hscroll))))
@@ -741,9 +736,7 @@ relevant to POS."
                       (when face
                         (insert (propertize " " 'display '(space :align-to 5))
                                 "face: ")
-                        (insert (substitute-command-keys "‘")
-                                (symbol-name face)
-                                (substitute-command-keys "’\n"))))))
+                        (insert (format-message "‘%s’\n" face))))))
               (insert "these terminal codes:\n")
               (dotimes (i (length disp-vector))
                 (insert (car (aref disp-vector i))
@@ -806,7 +799,8 @@ relevant to POS."
                   (insert "\n  " (car elt) ":"
                           (propertize " " 'display '(space :align-to 4))
                           (or (cdr elt) "-- not encodable --"))))
-              (insert "\nSee the variable `reference-point-alist' for "
+              (insert (substitute-command-keys
+                      "\nSee the variable `reference-point-alist' for ")
                       "the meaning of the rule.\n")))
 
           (unless eight-bit-p
diff --git a/lisp/desktop.el b/lisp/desktop.el
index c168f9c..9d023e3 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -165,8 +165,8 @@ one session to another.  In particular, Emacs will save the 
desktop when
 it exits (this may prompt you; see the option `desktop-save').  The next
 time Emacs starts, if this mode is active it will restore the desktop.
 
-To manually save the desktop at any time, use the command `M-x desktop-save'.
-To load it, use `M-x desktop-read'.
+To manually save the desktop at any time, use the command `\\[desktop-save]'.
+To load it, use `\\[desktop-read]'.
 
 Once a desktop file exists, Emacs will auto-save it according to the
 option `desktop-auto-save-timeout'.
diff --git a/lisp/dframe.el b/lisp/dframe.el
index 94c1e10..d8ddbc8 100644
--- a/lisp/dframe.el
+++ b/lisp/dframe.el
@@ -688,11 +688,11 @@ Optionally select that frame if necessary."
 Argument FMT is the format string, and ARGS are the arguments for message."
   (save-selected-window
     (if dframe-suppress-message-flag
-       (apply 'format fmt args)
+       (apply #'format-message fmt args)
       (if dframe-attached-frame
           ;; KB: Here we do not need calling `dframe-select-attached-frame'
          (select-frame dframe-attached-frame))
-      (apply 'message fmt args))))
+      (apply #'message fmt args))))
 
 (defun dframe-y-or-n-p (prompt)
   "Like `y-or-n-p', but for use in a dedicated frame.
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 18a3c88..a67b11f 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -686,9 +686,11 @@ can be produced by `dired-get-marked-files', for example."
     (if (cond ((not (or on-each no-subst))
               (error "You can not combine `*' and `?' substitution marks"))
              ((and star on-each)
-              (y-or-n-p "Confirm--do you mean to use `*' as a wildcard? "))
+              (y-or-n-p (format-message
+                         "Confirm--do you mean to use `*' as a wildcard? ")))
              ((and qmark no-subst)
-              (y-or-n-p "Confirm--do you mean to use `?' as a wildcard? "))
+              (y-or-n-p (format-message
+                         "Confirm--do you mean to use `?' as a wildcard? ")))
              (t))
        (if on-each
            (dired-bunch-files
@@ -1006,7 +1008,7 @@ return t; if SYM is q or ESC, return nil."
           nil)     ; skip, and don't ask again
          (t        ; no previous answer - ask now
           (setq prompt
-                (concat (apply 'format prompt args)
+                (concat (apply #'format-message prompt args)
                         (if help-form
                             (format " [Type yn!q or %s] "
                                     (key-description (vector help-char)))
@@ -1497,7 +1499,7 @@ or with the current marker character if MARKER-CHAR is t."
           (let* ((overwrite (file-exists-p to))
                  (dired-overwrite-confirmed ; for dired-handle-overwrite
                   (and overwrite
-                       (let ((help-form '(format "\
+                       (let ((help-form '(format-message "\
 Type SPC or `y' to overwrite file `%s',
 DEL or `n' to skip to next,
 ESC or `q' to not overwrite any of the remaining files,
@@ -1878,11 +1880,11 @@ of `dired-dwim-target', which see."
   ;; Optional arg MARKER-CHAR as in dired-create-files.
   (let* ((fn-list (dired-get-marked-files nil arg))
         (operation-prompt (concat operation " `%s' to `%s'?"))
-        (rename-regexp-help-form (format "\
+        (rename-regexp-help-form (format-message "\
 Type SPC or `y' to %s one match, DEL or `n' to skip to next,
 `!' to %s all remaining matches with no more questions."
-                                         (downcase operation)
-                                         (downcase operation)))
+                                                 (downcase operation)
+                                                 (downcase operation)))
         (regexp-name-constructor
          ;; Function to construct new filename using REGEXP and NEWNAME:
          (if whole-name                ; easy (but rare) case
@@ -2003,11 +2005,11 @@ See function `dired-do-rename-regexp' for more info."
        (let ((to (concat (file-name-directory from)
                          (funcall basename-constructor
                                   (file-name-nondirectory from)))))
-         (and (let ((help-form (format "\
+         (and (let ((help-form (format-message "\
 Type SPC or `y' to %s one file, DEL or `n' to skip to next,
 `!' to %s all remaining matches with no more questions."
-                                       (downcase operation)
-                                       (downcase operation))))
+                                               (downcase operation)
+                                               (downcase operation))))
                 (dired-query 'rename-non-directory-query
                              (concat operation " `%s' to `%s'")
                              (dired-make-relative from)
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index c90306a..4903b15 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -149,7 +149,7 @@ regexp `dired-omit-files', nor files ending with extensions 
in
 To enable omitting in every Dired buffer, you can put this in
 your init file:
 
-  (add-hook 'dired-mode-hook (lambda () (dired-omit-mode)))
+  (add-hook \\='dired-mode-hook (lambda () (dired-omit-mode)))
 
 See Info node `(dired-x) Omitting Variables' for more information."
   :group 'dired-x
@@ -1353,12 +1353,12 @@ otherwise."
   (interactive)
   (let ((file (dired-get-filename t)))
     (if dired-bind-vm
-       (if (y-or-n-p (concat "Visit `" file
-                             "' as a mail folder with VM?"))
+       (if (y-or-n-p (format-message
+                      "Visit ‘%s’ as a mail folder with VM?" file))
            (dired-vm))
       ;; Read mail folder using rmail.
-      (if (y-or-n-p (concat "Visit `" file
-                           "' as a mailbox with RMAIL?"))
+      (if (y-or-n-p (format-message
+                    "Visit ‘%s’ as a mailbox with RMAIL?" file))
          (dired-rmail)))))
 
 
diff --git a/lisp/dired.el b/lisp/dired.el
index 5593083..f47c066 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3558,7 +3558,7 @@ Thus, use \\[backward-page] to find the beginning of a 
group of errors."
       (let ((inhibit-read-only t))
        (cond ((stringp log)
               (insert (if args
-                          (apply (function format) log args)
+                          (apply #'format-message log args)
                         log)))
              ((bufferp log)
               (insert-buffer-substring log))
@@ -3811,7 +3811,8 @@ Ask means pop up a menu for the user to select one of 
copy, move or link."
            ((memq action '(copy private move link))
             (let ((overwrite (and (file-exists-p to)
                                   (y-or-n-p
-                                   (format "Overwrite existing file `%s'? " 
to))))
+                                   (format-message
+                                    "Overwrite existing file `%s'? " to))))
                   ;; Binding dired-overwrite-confirmed to nil makes
                   ;; dired-handle-overwrite a no-op.  We instead use
                   ;; y-or-n-p, which pops a graphical menu.
@@ -3824,7 +3825,7 @@ Ask means pop up a menu for the user to select one of 
copy, move or link."
                                (car (find-backup-file-name to)))
                          (or (eq dired-backup-overwrite 'always)
                              (y-or-n-p
-                              (format
+                              (format-message
                                "Make backup for existing file `%s'? " to))))
                 (rename-file to backup-file 0)
                 (dired-relist-entry backup-file))
@@ -3895,7 +3896,7 @@ Ask means pop up a menu for the user to select one of 
copy, move or link."
 
 ;;; Start of automatically extracted autoloads.
 
-;;;### (autoloads nil "dired-aux" "dired-aux.el" 
"45867cb96abef86d29a9850ee2113cf2")
+;;;### (autoloads nil "dired-aux" "dired-aux.el" 
"637aadf6baffb10be036ba4cec2372f9")
 ;;; Generated autoloads from dired-aux.el
 
 (autoload 'dired-diff "dired-aux" "\
@@ -4398,7 +4399,7 @@ instead.
 
 ;;;***
 
-;;;### (autoloads nil "dired-x" "dired-x.el" 
"183a6677a0dfc9e853e24b05abda5490")
+;;;### (autoloads nil "dired-x" "dired-x.el" 
"c1a6289ba8504b605595321436a9c04d")
 ;;; Generated autoloads from dired-x.el
 
 (autoload 'dired-jump "dired-x" "\
diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el
index d1c46dd..ab7e34c 100644
--- a/lisp/dirtrack.el
+++ b/lisp/dirtrack.el
@@ -218,7 +218,7 @@ the mode if ARG is omitted or nil."
   (when dirtrack-debug-mode
     (with-current-buffer (get-buffer-create dirtrack-debug-buffer)
       (goto-char (point-max))
-      (insert msg1 msg2 "\n"))))
+      (insert (substitute-command-keys msg1) msg2 "\n"))))
 
 (declare-function shell-prefixed-directory-name "shell" (dir))
 (declare-function shell-process-cd "shell" (arg))
diff --git a/lisp/disp-table.el b/lisp/disp-table.el
index 84f9c89..62ed102 100644
--- a/lisp/disp-table.el
+++ b/lisp/disp-table.el
@@ -281,7 +281,8 @@ in `.emacs'."
               (set-terminal-coding-system nil))))
 
     (display-warning 'i18n
-                    "`standard-display-european' is semi-obsolete; see its doc 
string for details"
+                    (format-message
+                     "`standard-display-european' is semi-obsolete; see its 
doc string for details")
                     :warning)
 
     ;; Switch to Latin-1 language environment
diff --git a/lisp/double.el b/lisp/double.el
index b06f59c..ee511e5 100644
--- a/lisp/double.el
+++ b/lisp/double.el
@@ -122,9 +122,10 @@ but not `C-u X' or `ESC X' since the X is not the prefix 
key."
                         (append (make-list (1- (length (nth 1 entry)))
                                            127)
                                 (nth 2 entry)
-                                '(magic-end)))
+                                '(magic-end)
+                                 unread-command-events))
                   (vector 127))
-              (setq unread-command-events (list new))
+              (push new unread-command-events)
               [ignore])))
          ((eq key 'magic-end)
           ;; End of double event.  Ignore.
@@ -134,7 +135,8 @@ but not `C-u X' or `ESC X' since the X is not the prefix 
key."
           (let ((exp (nth 1 (assoc key double-map))))
             (setq double-last-event key)
             (setq unread-command-events
-                  (append (substring exp 1) '(magic-start)))
+                  (append (substring exp 1) '(magic-start)
+                           unread-command-events))
             (vector (aref exp 0)))))))
 
 ;;; Mode
diff --git a/lisp/ebuff-menu.el b/lisp/ebuff-menu.el
index 337ea10..9341806 100644
--- a/lisp/ebuff-menu.el
+++ b/lisp/ebuff-menu.el
@@ -133,7 +133,7 @@ Run hooks in `electric-buffer-menu-mode-hook' on entry.
            (setq select
                  (catch 'electric-buffer-menu-select
                    (message "<<< Type SPC or RET to bury the buffer list >>>")
-                   (setq unread-command-events (list (read-event)))
+                   (push (read-event) unread-command-events)
                    (let ((start-point (point))
                          (first (progn (goto-char (point-min))
                                        (unless Buffer-menu-use-header-line
@@ -210,7 +210,9 @@ See the documentation of `electric-buffer-list' for 
details."
 
 (defun Electric-buffer-menu-exit ()
   (interactive)
-  (setq unread-command-events (listify-key-sequence (this-command-keys)))
+  (setq unread-command-events
+        (nconc (listify-key-sequence (this-command-keys))
+               unread-command-events))
   ;; for robustness
   (condition-case ()
       (throw 'electric-buffer-menu-select nil)
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index 84dfd4f..acbd1e2 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -89,7 +89,7 @@ Default nil means to write characters above \\177 in octal 
notation."
   "Edit a keyboard macro.
 At the prompt, type any key sequence which is bound to a keyboard macro.
 Or, type `C-x e' or RET to edit the last keyboard macro, `C-h l' to edit
-the last 300 keystrokes as a keyboard macro, or `M-x' to edit a macro by
+the last 300 keystrokes as a keyboard macro, or `\\[execute-extended-command]' 
to edit a macro by
 its command name.
 With a prefix argument, format the macro in a more concise way."
   (interactive "kKeyboard macro to edit (C-x e, M-x, C-h l, or keys): \nP")
diff --git a/lisp/ehelp.el b/lisp/ehelp.el
index 66e4f5c..2e15af3 100644
--- a/lisp/ehelp.el
+++ b/lisp/ehelp.el
@@ -204,10 +204,10 @@ BUFFER is put back into its original major mode."
   (catch 'exit
     (if (pos-visible-in-window-p (point-max))
        (progn (message "%s" (substitute-command-keys "<<< Press Space to bury 
the help buffer, Press \\[electric-help-retain] to retain it >>>"))
-              (if (equal (setq unread-command-events (list (read-event)))
-                         '(?\s))
-                  (progn (setq unread-command-events nil)
-                         (throw 'exit t)))))
+               (let ((ev (read-event)))
+                 (if (equal ev ?\s)
+                     (throw 'exit t)
+                   (push ev unread-command-events)))))
     (let (up down both neither
          (standard (and (eq (key-binding " " nil t)
                             'scroll-up)
diff --git a/lisp/electric.el b/lisp/electric.el
index ca05c8c..bef5bb9 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -428,8 +428,10 @@ The variable `electric-layout-rules' says when and how to 
insert newlines."
   :type 'boolean :safe 'booleanp :group 'electricity)
 
 (defun electric--insertable-p (string)
-  (not (unencodable-char-position nil nil buffer-file-coding-system
-                                  nil string)))
+  (or (not buffer-file-coding-system)
+      (eq (coding-system-base buffer-file-coding-system) 'undecided)
+      (not (unencodable-char-position nil nil buffer-file-coding-system
+                                      nil string))))
 
 (defun electric-quote-post-self-insert-function ()
   "Function that ‘electric-quote-mode’ adds to ‘post-self-insert-hook’.
@@ -451,7 +453,7 @@ This requotes when a quoting key is typed."
         (save-excursion
           (if (eq last-command-event ?\`)
               (cond ((and (electric--insertable-p "“")
-                          (re-search-backward "[`‘]`" (- (point) 2) t))
+                          (search-backward "‘`" (- (point) 2) t))
                      (replace-match "“")
                      (when (and electric-pair-mode
                                 (eq (cdr-safe
@@ -463,19 +465,14 @@ This requotes when a quoting key is typed."
                           (search-backward "`" (1- (point)) t))
                      (replace-match "‘")
                      (setq last-command-event ?‘)))
-            (let ((pos (point)))
-              (if (memq (char-before (1- (point))) '(?\' ?’))
-                  (when (and (search-backward "“" start t)
-                             (eq pos (re-search-forward
-                                      "“\\(\\([^‘”]\\|‘[^‘’”]*’\\)*\\)['’]'"
-                                      pos t)))
-                    (replace-match "“\\1”")
-                    (setq last-command-event ?”))
-                (when (and (search-backward "‘" start t)
-                           (eq pos (re-search-forward
-                                    "‘\\([^’]*\\)'" pos t)))
-                  (replace-match "‘\\1’")
-                  (setq last-command-event ?’))))))))))
+            (cond ((and (electric--insertable-p "”")
+                        (search-backward "’'" (- (point) 2) t))
+                   (replace-match "”")
+                   (setq last-command-event ?”))
+                  ((and (electric--insertable-p "’")
+                        (search-backward "'" (1- (point)) t))
+                   (replace-match "’")
+                   (setq last-command-event ?’)))))))))
 
 (put 'electric-quote-post-self-insert-function 'priority 10)
 
@@ -486,11 +483,11 @@ With a prefix argument ARG, enable Electric Quote mode if
 ARG is positive, and disable it otherwise.  If called from Lisp,
 enable the mode if ARG is omitted or nil.
 
-When enabled, this replaces \\=`foo bar' with \\=‘foo bar\\=’ and replaces
-\\=`\\=`foo bar'' with “foo bar” as you type.  This occurs only in
-comments, strings, and text paragraphs, and these are selectively
-controlled with ‘electric-quote-comment’,
-‘electric-quote-string’, and ‘electric-quote-paragraph’.
+When enabled, as you type this replaces \\=` with \\=‘, \\=' with \\=’,
+\\=`\\=` with “, and \\='\\=' with ”.  This occurs only in comments, strings,
+and text paragraphs, and these are selectively controlled with
+‘electric-quote-comment’, ‘electric-quote-string’, and
+‘electric-quote-paragraph’.
 
 This is a global minor mode.  To toggle the mode in a single buffer,
 use ‘electric-quote-local-mode’."
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 1915d94..bbff34d 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -168,7 +168,7 @@
 ;;  "Switch to non-existing buffers only upon confirmation."
 ;;  (interactive "BSwitch to buffer: ")
 ;;  (if (or (get-buffer (ad-get-arg 0))
-;;          (y-or-n-p (format "`%s' does not exist, create? " (ad-get-arg 0))))
+;;          (y-or-n-p (format "‘%s’ does not exist, create? " (ad-get-arg 0))))
 ;;      ad-do-it))
 ;;
 ;;(defadvice find-file (before existing-files-only activate)
@@ -1870,7 +1870,7 @@ function at point for which PREDICATE returns non-nil)."
     (if (equal function "")
        (if (ad-is-advised default)
            default
-         (error "ad-read-advised-function: `%s' is not advised" default))
+         (error "ad-read-advised-function: ‘%s’ is not advised" default))
       (intern function))))
 
 (defvar ad-advice-class-completion-table
@@ -1887,7 +1887,7 @@ class of FUNCTION)."
            (cl-dolist (class ad-advice-classes)
              (if (ad-get-advice-info-field function class)
                  (cl-return class)))
-           (error "ad-read-advice-class: `%s' has no advices" function)))
+           (error "ad-read-advice-class: ‘%s’ has no advices" function)))
   (let ((class (completing-read
                (format "%s (default %s): " (or prompt "Class") default)
                ad-advice-class-completion-table nil t)))
@@ -1904,7 +1904,7 @@ An optional PROMPT is used to prompt for the name."
                  (ad-get-advice-info-field function class)))
         (default
           (if (null name-completion-table)
-              (error "ad-read-advice-name: `%s' has no %s advice"
+              (error "ad-read-advice-name: ‘%s’ has no %s advice"
                      function class)
             (car (car name-completion-table))))
         (prompt (format "%s (default %s): " (or prompt "Name") default))
@@ -1995,9 +1995,9 @@ FUNCTION was not advised)."
   (interactive (ad-read-advice-specification "Enable advice of"))
   (if (ad-is-advised function)
       (if (eq (ad-enable-advice-internal function class name t) 0)
-         (error "ad-enable-advice: `%s' has no %s advice matching `%s'"
+         (error "ad-enable-advice: ‘%s’ has no %s advice matching ‘%s’"
                 function class name))
-    (error "ad-enable-advice: `%s' is not advised" function)))
+    (error "ad-enable-advice: ‘%s’ is not advised" function)))
 
 ;;;###autoload
 (defun ad-disable-advice (function class name)
@@ -2005,9 +2005,9 @@ FUNCTION was not advised)."
   (interactive (ad-read-advice-specification "Disable advice of"))
   (if (ad-is-advised function)
       (if (eq (ad-enable-advice-internal function class name nil) 0)
-         (error "ad-disable-advice: `%s' has no %s advice matching `%s'"
+         (error "ad-disable-advice: ‘%s’ has no %s advice matching ‘%s’"
                 function class name))
-    (error "ad-disable-advice: `%s' is not advised" function)))
+    (error "ad-disable-advice: ‘%s’ is not advised" function)))
 
 (defun ad-enable-regexp-internal (regexp class flag)
   "Set enable FLAGs of all CLASS advices whose name contains a REGEXP match.
@@ -2053,9 +2053,9 @@ in that CLASS."
            (ad-set-advice-info-field
             function class
             (delq advice-to-remove (ad-get-advice-info-field function class)))
-         (error "ad-remove-advice: `%s' has no %s advice `%s'"
+         (error "ad-remove-advice: ‘%s’ has no %s advice ‘%s’"
                 function class name)))
-    (error "ad-remove-advice: `%s' is not advised" function)))
+    (error "ad-remove-advice: ‘%s’ is not advised" function)))
 
 ;;;###autoload
 (defun ad-add-advice (function advice class position)
@@ -2319,7 +2319,7 @@ INDEX counts from zero."
              ,value-form))
          (argument-access
           `(setq ,argument-access ,value-form))
-         (t (error "ad-set-argument: No argument at position %d of `%s'"
+         (t (error "ad-set-argument: No argument at position %d of ‘%s’"
                    index arglist)))))
 
 (defun ad-get-arguments (arglist index)
@@ -2361,7 +2361,7 @@ The assignment starts at position INDEX."
       (setq index (1+ index))
       (setq values-index (1+ values-index)))
     (if (null set-forms)
-       (error "ad-set-arguments: No argument at position %d of `%s'"
+       (error "ad-set-arguments: No argument at position %d of ‘%s’"
               index arglist)
         (if (= (length set-forms) 1)
             ;; For exactly one set-form we can use values-form directly,...
@@ -2911,14 +2911,14 @@ the value of `ad-redefinition-action' and de/activate 
again."
            (if (not (eq current-definition original-definition))
                ;; We have a redefinition:
                (if (not (memq ad-redefinition-action '(accept discard warn)))
-                   (error "ad-redefinition-action: `%s' %s"
+                   (error "ad-redefinition-action: ‘%s’ %s"
                           function "invalidly redefined")
                  (if (eq ad-redefinition-action 'discard)
                      nil ;; Just drop it!
                    (funcall (or fsetfun #'fset) function newdef)
                     (ad-activate-internal function)
                    (if (eq ad-redefinition-action 'warn)
-                       (message "ad-handle-definition: `%s' got redefined"
+                       (message "ad-handle-definition: ‘%s’ got redefined"
                                 function))))
              ;; either advised def or correct original is in place:
              nil)
@@ -2953,7 +2953,7 @@ definition will always be cached for later usage."
         current-prefix-arg))
   (cond
    ((not (ad-is-advised function))
-    (error "ad-activate: `%s' is not advised" function))
+    (error "ad-activate: ‘%s’ is not advised" function))
    ;; Just return for forward advised and not yet defined functions:
    ((not (ad-get-orig-definition function)) nil)
    ((not (ad-has-any-advice function)) (ad-unadvise function))
@@ -2977,10 +2977,10 @@ a call to `ad-activate'."
   (interactive
    (list (ad-read-advised-function "Deactivate advice of" 'ad-is-active)))
   (if (not (ad-is-advised function))
-      (error "ad-deactivate: `%s' is not advised" function)
+      (error "ad-deactivate: ‘%s’ is not advised" function)
     (cond ((ad-is-active function)
           (if (not (ad-get-orig-definition function))
-              (error "ad-deactivate: `%s' has no original definition"
+              (error "ad-deactivate: ‘%s’ has no original definition"
                      function)
              (ad-clear-advicefunname-definition function)
             (ad-set-advice-info-field function 'active nil)
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 1a34fa7..716e1c6 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -192,7 +192,7 @@
   ;; (if (aref byte-code-vector 0)
   ;;     (error "The old version of the disassembler is loaded.  Reload 
new-bytecomp as well"))
   (byte-compile-log-1
-   (apply 'format format
+   (apply #'format-message format
      (let (c a)
        (mapcar (lambda (arg)
                  (if (not (consp arg))
@@ -255,11 +255,11 @@
                    (cdr (assq name byte-compile-function-environment)))))
     (pcase fn
       (`nil
-       (byte-compile-warn "attempt to inline `%s' before it was defined"
+       (byte-compile-warn "attempt to inline ‘%s’ before it was defined"
                           name)
        form)
       (`(autoload . ,_)
-       (error "File `%s' didn't define `%s'" (nth 1 fn) name))
+       (error "File ‘%s’ didn't define ‘%s’" (nth 1 fn) name))
       ((and (pred symbolp) (guard (not (eq fn t)))) ;A function alias.
        (byte-compile-inline-expand (cons fn (cdr form))))
       ((pred byte-code-function-p)
@@ -336,7 +336,7 @@
                                   bindings)
                    values nil))
             ((and (not optionalp) (null values))
-             (byte-compile-warn "attempt to open-code `%s' with too few 
arguments" name)
+             (byte-compile-warn "attempt to open-code ‘%s’ with too few 
arguments" name)
              (setq arglist nil values 'too-few))
             (t
              (setq bindings (cons (list (car arglist) (car values))
@@ -347,7 +347,7 @@
         (progn
           (or (eq values 'too-few)
               (byte-compile-warn
-               "attempt to open-code `%s' with too many arguments" name))
+               "attempt to open-code ‘%s’ with too many arguments" name))
           form)
 
                                        ;; The following leads to infinite 
recursion when loading a
@@ -383,7 +383,7 @@
             form))
          ((eq fn 'quote)
           (if (cdr (cdr form))
-              (byte-compile-warn "malformed quote form: `%s'"
+              (byte-compile-warn "malformed quote form: ‘%s’"
                                  (prin1-to-string form)))
           ;; map (quote nil) to nil to simplify optimizer logic.
           ;; map quoted constants to nil if for-effect (just because).
@@ -407,7 +407,7 @@
                         (if (symbolp binding)
                             binding
                           (if (cdr (cdr binding))
-                              (byte-compile-warn "malformed let binding: `%s'"
+                              (byte-compile-warn "malformed let binding: ‘%s’"
                                                  (prin1-to-string binding)))
                           (list (car binding)
                                 (byte-optimize-form (nth 1 binding) nil))))
@@ -420,7 +420,7 @@
                                (cons
                                 (byte-optimize-form (car clause) nil)
                                 (byte-optimize-body (cdr clause) for-effect))
-                             (byte-compile-warn "malformed cond form: `%s'"
+                             (byte-compile-warn "malformed cond form: ‘%s’"
                                                 (prin1-to-string clause))
                              clause))
                         (cdr form))))
@@ -457,7 +457,7 @@
 
          ((eq fn 'if)
           (when (< (length form) 3)
-            (byte-compile-warn "too few arguments for `if'"))
+            (byte-compile-warn "too few arguments for ‘if’"))
           (cons fn
             (cons (byte-optimize-form (nth 1 form) nil)
               (cons
@@ -485,7 +485,7 @@
             (cons fn (mapcar 'byte-optimize-form (cdr form)))))
 
          ((eq fn 'interactive)
-          (byte-compile-warn "misplaced interactive spec: `%s'"
+          (byte-compile-warn "misplaced interactive spec: ‘%s’"
                              (prin1-to-string form))
           nil)
 
@@ -539,7 +539,7 @@
            (cons fn (mapcar #'byte-optimize-form (cdr form))))
 
          ((not (symbolp fn))
-          (byte-compile-warn "`%s' is a malformed function"
+          (byte-compile-warn "‘%s’ is a malformed function"
                              (prin1-to-string fn))
           form)
 
@@ -1054,7 +1054,7 @@
 
 (defun byte-optimize-while (form)
   (when (< (length form) 2)
-    (byte-compile-warn "too few arguments for `while'"))
+    (byte-compile-warn "too few arguments for ‘while’"))
   (if (nth 1 form)
       form))
 
@@ -1090,7 +1090,7 @@
                  (nconc (list 'funcall fn) butlast
                         (mapcar (lambda (x) (list 'quote x)) (nth 1 last))))
              (byte-compile-warn
-              "last arg to apply can't be a literal atom: `%s'"
+              "last arg to apply can't be a literal atom: ‘%s’"
               (prin1-to-string last))
              nil))
        form)))
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 081ea31..3c561db 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -267,7 +267,7 @@ The return value is undefined.
                                 (cdr body)
                               body)))
                     nil)
-                   (t (message "Warning: Unknown defun property `%S' in %S"
+                   (t (message "Warning: Unknown defun property ‘%S’ in %S"
                                (car x) name)))))
                    decls))
           (def (list 'defalias
@@ -317,7 +317,7 @@ The return value is undefined.
   (declare (debug defun) (doc-string 3))
   (or (memq (get name 'byte-optimizer)
            '(nil byte-compile-inline-expand))
-      (error "`%s' is a primitive" name))
+      (error "‘%s’ is a primitive" name))
   `(prog1
        (defun ,name ,arglist ,@body)
      (eval-and-compile
@@ -355,12 +355,12 @@ was first made obsolete, for example a date or a release 
number."
                                                   &optional when docstring)
   "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it 
obsolete.
 
-\(define-obsolete-function-alias 'old-fun 'new-fun \"22.1\" \"old-fun's doc.\")
+\(define-obsolete-function-alias \\='old-fun \\='new-fun \"22.1\" \"old-fun's 
doc.\")
 
 is equivalent to the following two lines of code:
 
-\(defalias 'old-fun 'new-fun \"old-fun's doc.\")
-\(make-obsolete 'old-fun 'new-fun \"22.1\")
+\(defalias \\='old-fun \\='new-fun \"old-fun's doc.\")
+\(make-obsolete \\='old-fun \\='new-fun \"22.1\")
 
 See the docstrings of `defalias' and `make-obsolete' for more details."
   (declare (doc-string 4)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 197df3b..8b8b667 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -814,7 +814,7 @@ CONST2 may be evaluated multiple times."
            off (cdr lap-entry))
       (cond
        ((not (symbolp op))
-        (error "Non-symbolic opcode `%s'" op))
+        (error "Non-symbolic opcode ‘%s’" op))
        ((eq op 'TAG)
         (setcar off pc))
        (t
@@ -973,7 +973,7 @@ Each function's symbol gets added to 
`byte-compile-noruntime-functions'."
          (print-level 4)
          (print-length 4))
       (byte-compile-log-1
-       (format
+       (format-message
        ,format-string
        ,@(mapcar
           (lambda (x) (if (symbolp x) (list 'prin1-to-string x) x))
@@ -1120,7 +1120,8 @@ Each function's symbol gets added to 
`byte-compile-noruntime-functions'."
                pt)
           (when dir
             (unless was-same
-              (insert (format "Leaving directory `%s'\n" default-directory))))
+              (insert (format-message "Leaving directory ‘%s’\n"
+                                       default-directory))))
           (unless (bolp)
             (insert "\n"))
           (setq pt (point-marker))
@@ -1135,8 +1136,8 @@ Each function's symbol gets added to 
`byte-compile-noruntime-functions'."
           (when dir
             (setq default-directory dir)
             (unless was-same
-              (insert (format "Entering directory `%s'\n"
-                               default-directory))))
+              (insert (format-message "Entering directory ‘%s’\n"
+                                       default-directory))))
           (setq byte-compile-last-logged-file byte-compile-current-file
                 byte-compile-last-warned-form nil)
           ;; Do this after setting default-directory.
@@ -1154,7 +1155,7 @@ Each function's symbol gets added to 
`byte-compile-noruntime-functions'."
 
 (defun byte-compile-warn (format &rest args)
   "Issue a byte compiler warning; use (format FORMAT ARGS...) for message."
-  (setq format (apply 'format format args))
+  (setq format (apply #'format-message format args))
   (if byte-compile-error-on-warn
       (error "%s" format)              ; byte-compile-file catches and logs it
     (byte-compile-log-warning format t :warning)))
@@ -1338,7 +1339,7 @@ extra args."
          (nargs (- (length form) 2)))
       (unless (= nargs nfields)
        (byte-compile-warn
-        "`%s' called with %d args to fill %d format field(s)" (car form)
+        "‘%s’ called with %d args to fill %d format field(s)" (car form)
         nargs nfields)))))
 
 (dolist (elt '(format message error))
@@ -1358,7 +1359,7 @@ extra args."
           (plist-get keyword-args :group)
           (not (and (consp name) (eq (car name) 'quote)))
           (byte-compile-warn
-           "%s for `%s' fails to specify containing group"
+           "%s for ‘%s’ fails to specify containing group"
            (cdr (assq (car form)
                       '((custom-declare-group . defgroup)
                         (custom-declare-face . defface)
@@ -1377,7 +1378,7 @@ extra args."
   (let ((calls (assq name byte-compile-unresolved-functions))
         nums sig min max)
     (when (and calls macrop)
-      (byte-compile-warn "macro `%s' defined too late" name))
+      (byte-compile-warn "macro ‘%s’ defined too late" name))
     (setq byte-compile-unresolved-functions
           (delq calls byte-compile-unresolved-functions))
     (setq calls (delq t calls))      ;Ignore higher-order uses of the function.
@@ -1385,7 +1386,7 @@ extra args."
       (when (and (symbolp name)
                  (eq (function-get name 'byte-optimizer)
                      'byte-compile-inline-expand))
-        (byte-compile-warn "defsubst `%s' was used before it was defined"
+        (byte-compile-warn "defsubst ‘%s’ was used before it was defined"
                            name))
       (setq sig (byte-compile-arglist-signature arglist)
             nums (sort (copy-sequence (cdr calls)) (function <))
@@ -1464,7 +1465,7 @@ extra args."
                          ;; so don't warn about them.
                          macroexpand
                          cl--compiling-file))))
-       (byte-compile-warn "function `%s' from cl package called at runtime"
+       (byte-compile-warn "function ‘%s’ from cl package called at runtime"
                           func)))
   form)
 
@@ -1506,12 +1507,12 @@ extra args."
        (if (fboundp f) (push f noruntime) (push f unresolved)))
       ;; Complain about the no-run-time functions
       (byte-compile-print-syms
-       "the function `%s' might not be defined at runtime."
+       "the function ‘%s’ might not be defined at runtime."
        "the following functions might not be defined at runtime:"
        noruntime)
       ;; Complain about the unresolved functions
       (byte-compile-print-syms
-       "the function `%s' is not known to be defined."
+       "the function ‘%s’ is not known to be defined."
        "the following functions are not known to be defined:"
        unresolved)))
   nil)
@@ -1813,11 +1814,11 @@ The value is non-nil if there were no errors, nil if 
errors."
     ;; compile this file.
     (if (with-current-buffer input-buffer no-byte-compile)
        (progn
-         ;; (message "%s not compiled because of `no-byte-compile: %s'"
+         ;; (message "%s not compiled because of ‘no-byte-compile: %s’"
          ;;       (byte-compile-abbreviate-file filename)
          ;;       (with-current-buffer input-buffer no-byte-compile))
          (when (file-exists-p target-file)
-           (message "%s deleted because of `no-byte-compile: %s'"
+           (message "%s deleted because of ‘no-byte-compile: %s’"
                     (byte-compile-abbreviate-file target-file)
                     (buffer-local-value 'no-byte-compile input-buffer))
            (condition-case nil (delete-file target-file) (error nil)))
@@ -2014,7 +2015,7 @@ and will be removed soon.  See (elisp)Backquote in the 
manual."))
        (format "     (string-lessp emacs-version \"%s\")\n" minimum-version)
        ;; Because the header must fit in a fixed width, we cannot
        ;; insert arbitrary-length file names (Bug#11585).
-       "     (error \"`%s' was compiled for "
+       "     (error \"'%s' was compiled for "
        (format "Emacs %s or later\" #$))\n\n" minimum-version))
       ;; Now compensate for any change in size, to make sure all
       ;; positions in the file remain valid.
@@ -2300,12 +2301,12 @@ list that represents a doc string reference.
   (when (and (symbolp sym)
              (not (string-match "[-*/:$]" (symbol-name sym)))
              (byte-compile-warning-enabled-p 'lexical))
-    (byte-compile-warn "global/dynamic var `%s' lacks a prefix"
+    (byte-compile-warn "global/dynamic var ‘%s’ lacks a prefix"
                        sym))
   (when (memq sym byte-compile-lexical-variables)
     (setq byte-compile-lexical-variables
           (delq sym byte-compile-lexical-variables))
-    (byte-compile-warn "Variable `%S' declared after its first use" sym))
+    (byte-compile-warn "Variable ‘%S’ declared after its first use" sym))
   (push sym byte-compile-bound-variables))
 
 (defun byte-compile-file-form-defvar (form)
@@ -2422,7 +2423,7 @@ not to take responsibility for the actual compilation of 
the code."
                     ;; Don't warn when compiling the stubs in byte-run...
                     (not (assq name byte-compile-initial-macro-environment)))
                (byte-compile-warn
-                "`%s' defined multiple times, as both function and macro"
+                "‘%s’ defined multiple times, as both function and macro"
                 name))
            (setcdr that-one nil))
           (this-one
@@ -2430,13 +2431,13 @@ not to take responsibility for the actual compilation 
of the code."
                       ;; Hack: Don't warn when compiling the magic internal
                       ;; byte-compiler macros in byte-run.el...
                       (not (assq name byte-compile-initial-macro-environment)))
-             (byte-compile-warn "%s `%s' defined multiple times in this file"
+             (byte-compile-warn "%s ‘%s’ defined multiple times in this file"
                                 (if macro "macro" "function")
                                 name)))
           ((eq (car-safe (symbol-function name))
                (if macro 'lambda 'macro))
            (when (byte-compile-warning-enabled-p 'redefine)
-             (byte-compile-warn "%s `%s' being redefined as a %s"
+             (byte-compile-warn "%s ‘%s’ being redefined as a %s"
                                 (if macro "function" "macro")
                                 name
                                 (if macro "macro" "function")))
@@ -2453,7 +2454,7 @@ not to take responsibility for the actual compilation of 
the code."
                (stringp (car-safe (cdr-safe (cdr-safe body)))))
       ;; FIXME: We've done that already just above, so this looks wrong!
       ;;(byte-compile-set-symbol-position name)
-      (byte-compile-warn "probable `\"' without `\\' in doc string of %s"
+      (byte-compile-warn "probable ‘\"’ without ‘\\’ in doc string of %s"
                          name))
 
     (if (not (listp body))
@@ -2979,20 +2980,20 @@ for symbols generated by the byte compiler itself."
             (`(',var . ,_)
              (when (assq var byte-compile-lexical-variables)
                (byte-compile-log-warning
-                (format "%s cannot use lexical var `%s'" fn var)
+                (format-message "%s cannot use lexical var ‘%s’" fn var)
                 nil :error)))))
         (when (macroexp--const-symbol-p fn)
-          (byte-compile-warn "`%s' called as a function" fn))
+          (byte-compile-warn "‘%s’ called as a function" fn))
        (when (and (byte-compile-warning-enabled-p 'interactive-only)
                   interactive-only)
-         (byte-compile-warn "`%s' is for interactive use only%s"
+         (byte-compile-warn "‘%s’ is for interactive use only%s"
                             fn
                             (cond ((stringp interactive-only)
                                    (format "; %s" interactive-only))
                                   ((and (symbolp 'interactive-only)
                                         (not (eq interactive-only t)))
-                                   (format "; use `%s' instead."
-                                           interactive-only))
+                                   (format-message "; use ‘%s’ instead."
+                                                    interactive-only))
                                   (t "."))))
         (if (eq (car-safe (symbol-function (car form))) 'macro)
             (byte-compile-log-warning
@@ -3036,7 +3037,7 @@ for symbols generated by the byte compiler itself."
              (byte-compile-warning-enabled-p 'mapcar))
     (byte-compile-set-symbol-position 'mapcar)
     (byte-compile-warn
-     "`mapcar' called for effect; use `mapc' or `dolist' instead"))
+     "‘mapcar’ called for effect; use ‘mapc’ or ‘dolist’ instead"))
   (byte-compile-push-constant (car form))
   (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster.
   (byte-compile-out 'byte-call (length (cdr form))))
@@ -3124,8 +3125,8 @@ for symbols generated by the byte compiler itself."
   (cond ((or (not (symbolp var)) (macroexp--const-symbol-p var))
         (when (byte-compile-warning-enabled-p 'constants)
           (byte-compile-warn (if (eq access-type 'let-bind)
-                                 "attempt to let-bind %s `%s`"
-                               "variable reference to %s `%s'")
+                                 "attempt to let-bind %s ‘%s’"
+                               "variable reference to %s ‘%s’")
                              (if (symbolp var) "constant" "nonvariable")
                              (prin1-to-string var))))
        ((let ((od (get var 'byte-obsolete-variable)))
@@ -3163,7 +3164,7 @@ for symbols generated by the byte compiler itself."
                  (boundp var)
                  (memq var byte-compile-bound-variables)
                  (memq var byte-compile-free-references))
-       (byte-compile-warn "reference to free variable `%S'" var)
+       (byte-compile-warn "reference to free variable ‘%S’" var)
        (push var byte-compile-free-references))
       (byte-compile-dynamic-variable-op 'byte-varref var))))
 
@@ -3179,7 +3180,7 @@ for symbols generated by the byte compiler itself."
                  (boundp var)
                  (memq var byte-compile-bound-variables)
                  (memq var byte-compile-free-assignments))
-       (byte-compile-warn "assignment to free variable `%s'" var)
+       (byte-compile-warn "assignment to free variable ‘%s’" var)
        (push var byte-compile-free-assignments))
       (byte-compile-dynamic-variable-op 'byte-varset var))))
 
@@ -3360,7 +3361,7 @@ If it is nil, then the handler is 
\"byte-compile-SYMBOL.\""
 
 (defun byte-compile-subr-wrong-args (form n)
   (byte-compile-set-symbol-position (car form))
-  (byte-compile-warn "`%s' called with %d arg%s, but requires %s"
+  (byte-compile-warn "‘%s’ called with %d arg%s, but requires %s"
                     (car form) (length (cdr form))
                     (if (= 1 (length (cdr form))) "" "s") n)
   ;; Get run-time wrong-number-of-args error.
@@ -3728,7 +3729,7 @@ discarding."
                 (macroexp--const-symbol-p var t))
             (byte-compile-warning-enabled-p 'constants)
             (byte-compile-warn
-             "variable assignment to %s `%s'"
+             "variable assignment to %s ‘%s’"
              (if (symbolp var) "constant" "nonvariable")
              (prin1-to-string var)))
        (byte-compile-normal-call `(set-default ',var ,@(cdr form)))))))
@@ -3824,11 +3825,11 @@ discarding."
   "Execute forms in BODY, potentially guarded by CONDITION.
 CONDITION is a variable whose value is a test in an `if' or `cond'.
 BODY is the code to compile in the first arm of the if or the body of
-the cond clause.  If CONDITION's value is of the form (fboundp 'foo)
-or (boundp 'foo), the relevant warnings from BODY about foo's
+the cond clause.  If CONDITION's value is of the form (fboundp \\='foo)
+or (boundp \\='foo), the relevant warnings from BODY about foo's
 being undefined (or obsolete) will be suppressed.
 
-If CONDITION's value is (not (featurep 'emacs)) or (featurep 'xemacs),
+If CONDITION's value is (not (featurep \\='emacs)) or (featurep \\='xemacs),
 that suppresses all warnings during execution of BODY."
   (declare (indent 1) (debug t))
   `(let* ((fbound-list (byte-compile-find-bound-condition
@@ -4102,7 +4103,7 @@ binding slots have been popped."
   (list 'not
     (cons (or (get (car form) 'byte-compile-negated-op)
              (error
-              "Compiler error: `%s' has no `byte-compile-negated-op' property"
+              "Compiler error: ‘%s’ has no ‘byte-compile-negated-op’ property"
               (car form)))
          (cdr form))))
 
@@ -4165,7 +4166,7 @@ binding slots have been popped."
     (byte-compile-set-symbol-position 'condition-case)
     (unless (symbolp var)
       (byte-compile-warn
-       "`%s' is not a variable-name or nil (in condition-case)" var))
+       "‘%s’ is not a variable-name or nil (in condition-case)" var))
     (if fun-bodies (setq var (make-symbol "err")))
     (byte-compile-push-constant var)
     (if fun-bodies
@@ -4184,14 +4185,14 @@ binding slots have been popped."
                                              (setq ok nil)))
                                        ok))))
                        (byte-compile-warn
-                        "`%S' is not a condition name or list of such (in 
condition-case)"
+                        "‘%S’ is not a condition name or list of such (in 
condition-case)"
                         condition))
                       ;; (not (or (eq condition 't)
                       ;;         (and (stringp (get condition 'error-message))
                       ;;              (consp (get condition
                       ;;                          'error-conditions)))))
                       ;; (byte-compile-warn
-                      ;;   "`%s' is not a known condition name
+                      ;;   "‘%s’ is not a known condition name
                       ;;   (in condition-case)"
                       ;;   condition))
                       )
@@ -4217,7 +4218,7 @@ binding slots have been popped."
     (byte-compile-set-symbol-position 'condition-case)
     (unless (symbolp var)
       (byte-compile-warn
-       "`%s' is not a variable-name or nil (in condition-case)" var))
+       "‘%s’ is not a variable-name or nil (in condition-case)" var))
 
     (dolist (clause (reverse clauses))
       (let ((condition (nth 1 clause)))
@@ -4225,12 +4226,12 @@ binding slots have been popped."
         (dolist (c condition)
           (unless (and c (symbolp c))
             (byte-compile-warn
-             "`%S' is not a condition name (in condition-case)" c))
+             "‘%S’ is not a condition name (in condition-case)" c))
           ;; In reality, the `error-conditions' property is only required
           ;; for the argument to `signal', not to `condition-case'.
           ;;(unless (consp (get c 'error-conditions))
           ;;  (byte-compile-warn
-          ;;   "`%s' is not a known condition name (in condition-case)"
+          ;;   "‘%s’ is not a known condition name (in condition-case)"
           ;;   c))
           )
         (byte-compile-push-constant condition))
@@ -4267,7 +4268,7 @@ binding slots have been popped."
   (if (and (eq 'set-buffer (car-safe (car-safe (cdr form))))
            (byte-compile-warning-enabled-p 'suspicious))
       (byte-compile-warn
-       "Use `with-current-buffer' rather than save-excursion+set-buffer"))
+       "Use ‘with-current-buffer’ rather than save-excursion+set-buffer"))
   (byte-compile-out 'byte-save-excursion 0)
   (byte-compile-body-do-effect (cdr form))
   (byte-compile-out 'byte-unbind 1))
@@ -4307,7 +4308,7 @@ binding slots have been popped."
   (when (and (symbolp (nth 1 form))
              (not (string-match "[-*/:$]" (symbol-name (nth 1 form))))
              (byte-compile-warning-enabled-p 'lexical))
-    (byte-compile-warn "global/dynamic var `%s' lacks a prefix"
+    (byte-compile-warn "global/dynamic var ‘%s’ lacks a prefix"
                        (nth 1 form)))
   (let ((fun (nth 0 form))
        (var (nth 1 form))
@@ -4318,7 +4319,7 @@ binding slots have been popped."
              (and (eq fun 'defconst) (null (cddr form))))
       (let ((ncall (length (cdr form))))
        (byte-compile-warn
-        "`%s' called with %d argument%s, but %s %s"
+        "‘%s’ called with %d argument%s, but %s %s"
         fun ncall
         (if (= 1 ncall) "" "s")
         (if (< ncall 2) "requires" "accepts only")
@@ -4327,7 +4328,7 @@ binding slots have been popped."
     (if (eq fun 'defconst)
        (push var byte-compile-const-variables))
     (when (and string (not (stringp string)))
-      (byte-compile-warn "third arg to `%s %s' is not a string: %s"
+      (byte-compile-warn "third arg to ‘%s %s’ is not a string: %s"
                          fun var string))
     (byte-compile-form-do-effect
      (if (cddr form)  ; `value' provided
@@ -4350,7 +4351,7 @@ binding slots have been popped."
        (not (fboundp (eval (nth 1 form))))
        (byte-compile-warn
        "The compiler ignores `autoload' except at top level.  You should
-     probably put the autoload of the macro `%s' at top-level."
+     probably put the autoload of the macro ‘%s’ at top-level."
        (eval (nth 1 form))))
   (byte-compile-normal-call form))
 
@@ -4358,7 +4359,7 @@ binding slots have been popped."
 ;; The ones that remain are errors.
 (defun byte-compile-lambda-form (_form)
   (byte-compile-set-symbol-position 'lambda)
-  (error "`lambda' used as function name is invalid"))
+  (error "‘lambda’ used as function name is invalid"))
 
 ;; Compile normally, but deal with warnings for the function being defined.
 (put 'defalias 'byte-hunk-handler 'byte-compile-file-form-defalias)
@@ -4430,7 +4431,7 @@ binding slots have been popped."
   (if (and (eq (car-safe (car-safe (cdr-safe form))) 'quote)
            (byte-compile-warning-enabled-p 'make-local))
       (byte-compile-warn
-       "`make-variable-buffer-local' not called at toplevel"))
+       "‘make-variable-buffer-local’ not called at toplevel"))
   (byte-compile-normal-call form))
 (put 'make-variable-buffer-local
      'byte-hunk-handler 'byte-compile-form-make-variable-buffer-local)
@@ -4562,7 +4563,7 @@ invoked interactively."
                                       (length (nth 2 y))))))
                       (`name
                        (lambda (x y) (string< (car x) (car y))))
-                      (_ (error "`byte-compile-call-tree-sort': `%s' - unknown 
sort mode"
+                      (_ (error "‘byte-compile-call-tree-sort’: ‘%s’ - unknown 
sort mode"
                                 byte-compile-call-tree-sort))))))
     (message "Generating call tree...")
     (let ((rest byte-compile-call-tree)
@@ -4675,7 +4676,7 @@ already up-to-date."
   ;; startup.el.
   (defvar command-line-args-left)      ;Avoid 'free variable' warning
   (if (not noninteractive)
-      (error "`batch-byte-compile' is to be used only with -batch"))
+      (error "‘batch-byte-compile’ is to be used only with -batch"))
   (let ((error nil))
     (while command-line-args-left
       (if (file-directory-p (expand-file-name (car command-line-args-left)))
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index fa82407..a20e201 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -300,7 +300,8 @@ places where they originally did not directly appear."
                         (prog1 binder (setq binder (list binder)))
                        (when (cddr binder)
                          (byte-compile-log-warning
-                          (format "Malformed `%S' binding: %S" letsym binder)))
+                          (format-message "Malformed ‘%S’ binding: %S"
+                                          letsym binder)))
                       (setq value (cadr binder))
                       (car binder)))
                (new-val
@@ -545,7 +546,7 @@ FORM is the parent form that binds this var."
     (`((,(and var (guard (eq ?_ (aref (symbol-name var) 0)))) . ,_)
        ,_ ,_ ,_ ,_)
      (byte-compile-log-warning
-      (format "%s `%S' not left unused" varkind var))))
+      (format-message "%s ‘%S’ not left unused" varkind var))))
   (pcase vardata
     (`((,var . ,_) nil ,_ ,_ nil)
      ;; FIXME: This gives warnings in the wrong order, with imprecise line
@@ -557,8 +558,8 @@ FORM is the parent form that binds this var."
               (eq ?_ (aref (symbol-name var) 0))
              ;; As a special exception, ignore "ignore".
              (eq var 'ignored))
-       (byte-compile-log-warning (format "Unused lexical %s `%S'"
-                                         varkind var))))
+       (byte-compile-log-warning (format-message "Unused lexical %s ‘%S’"
+                                                 varkind var))))
     ;; If it's unused, there's no point converting it into a cons-cell, even if
     ;; it's captured and mutated.
     (`(,binder ,_ t t ,_)
@@ -678,7 +679,7 @@ and updates the data stored in ENV."
 
     ;; ((and `(quote ,v . ,_) (guard (assq v env)))
     ;;  (byte-compile-log-warning
-    ;;   (format "Possible confusion variable/symbol for `%S'" v)))
+    ;;   (format-message "Possible confusion variable/symbol for ‘%S’" v)))
 
     (`(quote . ,_) nil)                 ; quote form
     (`(function . ,_) nil)              ; same as quote
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el
index 0660125..d972879 100644
--- a/lisp/emacs-lisp/chart.el
+++ b/lisp/emacs-lisp/chart.el
@@ -652,7 +652,7 @@ SORT-PRED if desired."
     (set-buffer b)
     (erase-buffer)
     (insert "cd " d ";du -sk * \n")
-    (message "Running `cd %s;du -sk *'..." d)
+    (message "Running ‘cd %s;du -sk *’..." d)
     (call-process-region (point-min) (point-max) shell-file-name t
                         (current-buffer) nil)
     (goto-char (point-min))
diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el
index ea865f2..bdcb4ec 100644
--- a/lisp/emacs-lisp/check-declare.el
+++ b/lisp/emacs-lisp/check-declare.el
@@ -106,7 +106,7 @@ don't know how to recognize (e.g. some macros)."
                  (symbolp (setq fileonly (nth 4 form))))
             (setq alist (cons (list fnfile fn arglist fileonly) alist))
           ;; FIXME make this more noticeable.
-          (if form (message "Malformed declaration for `%s'" (cadr form))))))
+          (if form (message "Malformed declaration for ‘%s’" (cadr form))))))
     (message "%sdone" m)
     alist))
 
@@ -279,8 +279,8 @@ TYPE is a string giving the nature of the error.  Warning 
is displayed in
            entry))
         (warning-fill-prefix "    "))
     (display-warning 'check-declare
-                     (format "said `%s' was defined in %s: %s"
-                             fn (file-name-nondirectory fnfile) type)
+                     (format-message "said ‘%s’ was defined in %s: %s"
+                                     fn (file-name-nondirectory fnfile) type)
                      nil check-declare-warning-buffer)))
 
 (declare-function compilation-forget-errors "compile" ())
@@ -318,7 +318,7 @@ Return a list of any errors found."
 See `check-declare-directory' for more information."
   (interactive "fFile to check: ")
   (or (file-exists-p file)
-      (error "File `%s' not found" file))
+      (error "File ‘%s’ not found" file))
   (let ((m (format "Checking %s..." file))
         errlist)
     (message "%s" m)
@@ -332,8 +332,8 @@ See `check-declare-directory' for more information."
 Returns non-nil if any false statements are found."
   (interactive "DDirectory to check: ")
   (or (file-directory-p (setq root (expand-file-name root)))
-      (error "Directory `%s' not found" root))
-  (let ((m "Checking `declare-function' statements...")
+      (error "Directory ‘%s’ not found" root))
+  (let ((m "Checking ‘declare-function’ statements...")
         (m2 "Finding files with declarations...")
         errlist files)
     (message "%s" m)
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 0b451ef..8a845f9 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -747,7 +747,7 @@ buffer, otherwise searching starts at START-HERE."
       ;; Loop over docstrings.
       (while (checkdoc-next-docstring)
         (message "Searching for doc string spell error...%d%%"
-                 (/ (* 100 (point)) (point-max)))
+                 (floor (* 100.0 (point)) (point-max)))
         (if (looking-at "\"")
             (checkdoc-ispell-docstring-engine
              (save-excursion (forward-sexp 1) (point-marker)))))
@@ -767,7 +767,7 @@ buffer, otherwise searching starts at START-HERE."
       ;; Loop over message strings.
       (while (checkdoc-message-text-next-string (point-max))
         (message "Searching for message string spell error...%d%%"
-                 (/ (* 100 (point)) (point-max)))
+                 (floor (* 100.0 (point)) (point-max)))
         (if (looking-at "\"")
             (checkdoc-ispell-docstring-engine
              (save-excursion (forward-sexp 1) (point-marker)))))
@@ -791,7 +791,7 @@ perform the fix."
       (condition-case nil
          (while (and (not msg) (checkdoc-next-docstring))
            (message "Searching for doc string error...%d%%"
-                    (/ (* 100 (point)) (point-max)))
+                    (floor (* 100.0 (point)) (point-max)))
            (if (setq msg (checkdoc-this-string-valid))
                (setq msg (cons msg (point)))))
        ;; Quit.. restore position,  Other errors, leave alone
@@ -813,7 +813,7 @@ assumes that the cursor is already positioned to perform 
the fix."
                      (setq type
                            (checkdoc-message-text-next-string (point-max))))
            (message "Searching for message string error...%d%%"
-                    (/ (* 100 (point)) (point-max)))
+                    (floor (* 100.0 (point)) (point-max)))
            (if (setq msg (checkdoc-message-text-engine type))
                (setq msg (cons msg (point)))))
        ;; Quit.. restore position,  Other errors, leave alone
@@ -1419,7 +1419,7 @@ regexp short cuts work.  FP is the function defun 
information."
        (when (re-search-forward "^(" e t)
         (if (checkdoc-autofix-ask-replace (match-beginning 0)
                                           (match-end 0)
-                                          "Escape this '('? "
+                                          "Escape this ‘(’? "
                                           "\\(")
             nil
           (checkdoc-create-error
@@ -1663,7 +1663,7 @@ function,command,variable,option or symbol." ms1))))))
             ;;           (concat "\\<" (regexp-quote (car fp)) "\\>")
             ;;           newname))
             ;;         (checkdoc-create-error
-            ;;          "Flag variable names should normally end in `-flag'" s
+            ;;          "Flag variable names should normally end in ‘-flag’" s
             ;;          (marker-position e)))))
             ;; Done with variables
             ))
@@ -1714,8 +1714,8 @@ function,command,variable,option or symbol." ms1))))))
                                e t))
                             (if (checkdoc-autofix-ask-replace
                                  (match-beginning 1) (match-end 1)
-                                 (format
-                                  "If this is the argument `%s', it should 
appear as %s.  Fix? "
+                                 (format-message
+                                  "If this is the argument ‘%s’, it should 
appear as %s.  Fix? "
                                   (car args) (upcase (car args)))
                                  (upcase (car args)) t)
                                 (setq found (match-beginning 1))))))
@@ -1740,8 +1740,8 @@ function,command,variable,option or symbol." ms1))))))
                             (insert "."))
                         nil)
                     (checkdoc-create-error
-                     (format
-                      "Argument `%s' should appear (as %s) in the doc string"
+                     (format-message
+                      "Argument ‘%s’ should appear (as %s) in the doc string"
                       (car args) (upcase (car args)))
                      s (marker-position e)))
                 (if (or (and order (eq order 'yes))
@@ -1824,16 +1824,16 @@ Replace with \"%s\"? " original replace)
                    (setq found (intern-soft ms))
                    (or (boundp found) (fboundp found)))
               (progn
-                (setq msg (format "Add quotes around Lisp symbol `%s'? "
-                                  ms))
+                (setq msg (format-message
+                            "Add quotes around Lisp symbol ‘%s’? " ms))
                 (if (checkdoc-autofix-ask-replace
                      (match-beginning 1) (+ (match-beginning 1)
                                             (length ms))
                      msg (concat "‘" ms "’") t)
                     (setq msg nil)
                   (setq msg
-                        (format "Lisp symbol `%s' should appear in quotes"
-                                ms))))))
+                        (format-message
+                          "Lisp symbol ‘%s’ should appear in quotes" ms))))))
         (if msg
             (checkdoc-create-error msg (match-beginning 1)
                                    (+ (match-beginning 1)
@@ -1849,7 +1849,7 @@ Replace with \"%s\"? " original replace)
                (match-string 2) t)
               nil
             (checkdoc-create-error
-             "Symbols t and nil should not appear in `...' quotes"
+             "Symbols t and nil should not appear in ‘...’ quotes"
              (match-beginning 1) (match-end 1)))))
      ;; Here is some basic sentence formatting
      (checkdoc-sentencespace-region-engine (point) e)
@@ -2487,22 +2487,22 @@ Argument TYPE specifies the type of question, such as 
`error' or `y-or-n-p'."
               ;; If we see a ?, then replace with "? ".
               (if (checkdoc-autofix-ask-replace
                    (match-beginning 0) (match-end 0)
-                   "`y-or-n-p' argument should end with \"? \".  Fix? "
+                   "‘y-or-n-p’ argument should end with \"? \".  Fix? "
                    "? " t)
                   nil
                 (checkdoc-create-error
-                 "`y-or-n-p' argument should end with \"? \""
+                 "‘y-or-n-p’ argument should end with \"? \""
                  (match-beginning 0) (match-end 0)))
             (if (save-excursion (forward-sexp 1)
                                 (forward-char -2)
                                 (looking-at " "))
                 (if (checkdoc-autofix-ask-replace
                      (match-beginning 0) (match-end 0)
-                     "`y-or-n-p' argument should end with \"? \".  Fix? "
+                     "‘y-or-n-p’ argument should end with \"? \".  Fix? "
                      "? " t)
                     nil
                   (checkdoc-create-error
-                   "`y-or-n-p' argument should end with \"? \""
+                   "‘y-or-n-p’ argument should end with \"? \""
                    (match-beginning 0) (match-end 0)))
               (if (and ;; if this isn't true, we have a problem.
                    (save-excursion (forward-sexp 1)
@@ -2510,11 +2510,11 @@ Argument TYPE specifies the type of question, such as 
`error' or `y-or-n-p'."
                                    (looking-at "\""))
                    (checkdoc-autofix-ask-replace
                     (match-beginning 0) (match-end 0)
-                    "`y-or-n-p' argument should end with \"? \".  Fix? "
+                    "‘y-or-n-p’ argument should end with \"? \".  Fix? "
                     "? \"" t))
                   nil
                 (checkdoc-create-error
-                 "`y-or-n-p' argument should end with \"? \""
+                 "‘y-or-n-p’ argument should end with \"? \""
                  (match-beginning 0) (match-end 0)))))))
      ;; Now, let's just run the spell checker on this guy.
      (checkdoc-ispell-docstring-engine (save-excursion (forward-sexp 1)
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 38cc772..7a7712a 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -38,7 +38,6 @@
 ;;; Code:
 
 (require 'cl-lib)
-(require 'seq)
 
 ;;; Type coercion.
 
@@ -416,7 +415,7 @@ as an integer unless JUNK-ALLOWED is non-nil."
        (cond ((and junk-allowed (null sum)) sum)
              (junk-allowed (* sign sum))
              ((or (/= start end) (null sum))
-              (error "Not an integer string: `%s'" string))
+              (error "Not an integer string: ‘%s’" string))
              (t (* sign sum)))))))
 
 
@@ -518,19 +517,44 @@ This sets the values of: `cl-most-positive-float', 
`cl-most-negative-float',
 (defun cl-subseq (seq start &optional end)
   "Return the subsequence of SEQ from START to END.
 If END is omitted, it defaults to the length of the sequence.
-If START or END is negative, it counts from the end."
+If START or END is negative, it counts from the end.
+Signal an error if START or END are outside of the sequence (i.e
+too large if positive or too small if negative)."
   (declare (gv-setter
             (lambda (new)
               (macroexp-let2 nil new new
                `(progn (cl-replace ,seq ,new :start1 ,start :end1 ,end)
                        ,new)))))
-  (seq-subseq seq start end))
-
-;;;###autoload
-(defalias 'cl-concatenate #'seq-concatenate
+  (cond ((or (stringp seq) (vectorp seq)) (substring seq start end))
+        ((listp seq)
+         (let (len
+               (errtext (format "Bad bounding indices: %s, %s" start end)))
+           (and end (< end 0) (setq end (+ end (setq len (length seq)))))
+           (if (< start 0) (setq start (+ start (or len (setq len (length 
seq))))))
+           (unless (>= start 0)
+             (error "%s" errtext))
+           (when (> start 0)
+             (setq seq (nthcdr (1- start) seq))
+             (or seq (error "%s" errtext))
+             (setq seq (cdr seq)))
+           (if end
+               (let ((res nil))
+                 (while (and (>= (setq end (1- end)) start) seq)
+                   (push (pop seq) res))
+                 (or (= (1+ end) start) (error "%s" errtext))
+                 (nreverse res))
+             (copy-sequence seq))))
+        (t (error "Unsupported sequence: %s" seq))))
+
+;;;###autoload
+(defun cl-concatenate (type &rest sequences)
   "Concatenate, into a sequence of type TYPE, the argument SEQUENCEs.
-\n(fn TYPE SEQUENCE...)")
-
+\n(fn TYPE SEQUENCE...)"
+  (pcase type
+    (`vector (apply #'vconcat sequences))
+    (`string (apply #'concat sequences))
+    (`list (apply #'append (append sequences '(nil))))
+    (_ (error "Not a sequence type name: %S" type))))
 
 ;;; List functions.
 
@@ -831,7 +855,9 @@ including `cl-block' and `cl-eval-when'."
               (prin1-to-string
                (alist-get :printer (cl--slot-descriptor-props slot)))))
     (when (alist-get :documentation (cl--slot-descriptor-props slot))
-      (concat "\n  " (alist-get :documentation (cl--slot-descriptor-props 
slot))
+      (concat "\n  "
+              (substitute-command-keys
+               (alist-get :documentation (cl--slot-descriptor-props slot)))
               "\n")))
    "\n"))
 
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 619428d..5d52761 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -192,7 +192,7 @@ BODY, if present, is used as the body of a default method.
          (when doc (error "Multiple doc strings for %S" name))
          (setq doc (cadr (pop options-and-methods))))
         (`declare
-         (when declarations (error "Multiple `declare' for %S" name))
+         (when declarations (error "Multiple ‘declare’ for %S" name))
          (setq declarations (pop options-and-methods)))
         (`:method (push (cdr (pop options-and-methods)) methods))
         (_ (push (pop options-and-methods) options))))
@@ -208,7 +208,7 @@ BODY, if present, is used as the body of a default method.
                                        defun-declarations-alist))))
                      (cond
                       (f (apply (car f) name args (cdr declaration)))
-                      (t (message "Warning: Unknown defun property `%S' in %S"
+                      (t (message "Warning: Unknown defun property ‘%S’ in %S"
                                   (car declaration) name)
                          nil))))
                  (cdr declarations))
@@ -791,6 +791,8 @@ Can only be used from within the lexical body of a primary 
or around method."
 ;;; Add support for describe-function
 
 (defun cl--generic-search-method (met-name)
+  "For `find-function-regexp-alist'. Searches for a cl-defmethod.
+MET-NAME is a cons (SYMBOL . SPECIALIZERS)."
   (let ((base-re (concat "(\\(?:cl-\\)?defmethod[ \t]+"
                          (regexp-quote (format "%s" (car met-name)))
                         "\\_>")))
@@ -806,11 +808,15 @@ Can only be used from within the lexical body of a 
primary or around method."
       nil t)
      (re-search-forward base-re nil t))))
 
+;; WORKAROUND: This can't be a defconst due to bug#21237.
+(defvar cl--generic-find-defgeneric-regexp "(\\(?:cl-\\)?defgeneric[ 
\t]+%s\\>")
 
 (with-eval-after-load 'find-func
   (defvar find-function-regexp-alist)
   (add-to-list 'find-function-regexp-alist
-               `(cl-defmethod . ,#'cl--generic-search-method)))
+               `(cl-defmethod . ,#'cl--generic-search-method))
+  (add-to-list 'find-function-regexp-alist
+               `(cl-defgeneric . cl--generic-find-defgeneric-regexp)))
 
 (defun cl--generic-method-info (method)
   (let* ((specializers (cl--generic-method-specializers method))
@@ -986,8 +992,9 @@ The value returned is a list of elements of the form
   `(and (vectorp ,name)
         (> (length ,name) 0)
         (let ((tag (aref ,name 0)))
-          (if (eq (symbol-function tag) :quick-object-witness-check)
-              tag))))
+          (and (symbolp tag)
+               (eq (symbol-function tag) :quick-object-witness-check)
+               tag))))
 
 (defun cl--generic-class-parents (class)
   (let ((parents ())
@@ -1063,7 +1070,7 @@ The value returned is a list of elements of the form
    (and (assq type cl--generic-typeof-types)
         (progn
           (if (memq type '(vector array sequence))
-              (message "`%S' also matches CL structs and EIEIO classes" type))
+              (message "‘%S’ also matches CL structs and EIEIO classes" type))
           (list cl--generic-typeof-generalizer)))
    (cl-call-next-method)))
 
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index f5e1ffb..06e75b3 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1132,7 +1132,7 @@ For more details, see Info node `(cl)Loop Facility'.
     (cond
 
      ((null cl--loop-args)
-      (error "Malformed `cl-loop' macro"))
+      (error "Malformed ‘cl-loop’ macro"))
 
      ((eq word 'named)
       (setq cl--loop-name (pop cl--loop-args)))
@@ -1140,7 +1140,7 @@ For more details, see Info node `(cl)Loop Facility'.
      ((eq word 'initially)
       (if (memq (car cl--loop-args) '(do doing)) (pop cl--loop-args))
       (or (consp (car cl--loop-args))
-          (error "Syntax error on `initially' clause"))
+          (error "Syntax error on ‘initially’ clause"))
       (while (consp (car cl--loop-args))
        (push (pop cl--loop-args) cl--loop-initially)))
 
@@ -1150,7 +1150,7 @@ For more details, see Info node `(cl)Loop Facility'.
                 (or (cl--pop2 cl--loop-args) '(quote nil)))
        (if (memq (car cl--loop-args) '(do doing)) (pop cl--loop-args))
        (or (consp (car cl--loop-args))
-            (error "Syntax error on `finally' clause"))
+            (error "Syntax error on ‘finally’ clause"))
        (if (and (eq (caar cl--loop-args) 'return) (null cl--loop-name))
            (setq cl--loop-result-explicit
                   (or (nth 1 (pop cl--loop-args)) '(quote nil)))
@@ -1177,7 +1177,7 @@ For more details, see Info node `(cl)Loop Facility'.
                             above below by))
                (push word cl--loop-args)
                (if (memq (car cl--loop-args) '(downto above))
-                   (error "Must specify `from' value for downward cl-loop"))
+                   (error "Must specify ‘from’ value for downward cl-loop"))
                (let* ((down (or (eq (car cl--loop-args) 'downfrom)
                                 (memq (nth 2 cl--loop-args)
                                        '(downto above))))
@@ -1197,7 +1197,7 @@ For more details, see Info node `(cl)Loop Facility'.
                       (step-var (and (not (macroexp-const-p step))
                                      (make-symbol "--cl-var--"))))
                  (and step (numberp step) (<= step 0)
-                      (error "Loop `by' value is not positive: %s" step))
+                      (error "Loop ‘by’ value is not positive: %s" step))
                  (push (list var (or start 0)) loop-for-bindings)
                  (if end-var (push (list end-var end) loop-for-bindings))
                  (if step-var (push (list step-var step)
@@ -1276,7 +1276,7 @@ For more details, see Info node `(cl)Loop Facility'.
               ((memq word '(element elements))
                (let ((ref (or (memq (car cl--loop-args) '(in-ref of-ref))
                               (and (not (memq (car cl--loop-args) '(in of)))
-                                   (error "Expected `of'"))))
+                                   (error "Expected ‘of’"))))
                      (seq (cl--pop2 cl--loop-args))
                      (temp-seq (make-symbol "--cl-seq--"))
                      (temp-idx
@@ -1284,7 +1284,7 @@ For more details, see Info node `(cl)Loop Facility'.
                            (if (and (= (length (cadr cl--loop-args)) 2)
                                     (eq (cl-caadr cl--loop-args) 'index))
                                (cadr (cl--pop2 cl--loop-args))
-                             (error "Bad `using' clause"))
+                             (error "Bad ‘using’ clause"))
                          (make-symbol "--cl-idx--"))))
                  (push (list temp-seq seq) loop-for-bindings)
                  (push (list temp-idx 0) loop-for-bindings)
@@ -1309,7 +1309,7 @@ For more details, see Info node `(cl)Loop Facility'.
 
               ((memq word hash-types)
                (or (memq (car cl--loop-args) '(in of))
-                    (error "Expected `of'"))
+                    (error "Expected ‘of’"))
                (let* ((table (cl--pop2 cl--loop-args))
                       (other
                         (if (eq (car cl--loop-args) 'using)
@@ -1317,7 +1317,7 @@ For more details, see Info node `(cl)Loop Facility'.
                                      (memq (cl-caadr cl--loop-args) hash-types)
                                      (not (eq (cl-caadr cl--loop-args) word)))
                                 (cadr (cl--pop2 cl--loop-args))
-                              (error "Bad `using' clause"))
+                              (error "Bad ‘using’ clause"))
                           (make-symbol "--cl-var--"))))
                  (if (memq word '(hash-value hash-values))
                      (setq var (prog1 other (setq other var))))
@@ -1372,7 +1372,7 @@ For more details, see Info node `(cl)Loop Facility'.
 
               ((memq word key-types)
                (or (memq (car cl--loop-args) '(in of))
-                    (error "Expected `of'"))
+                    (error "Expected ‘of’"))
                (let ((cl-map (cl--pop2 cl--loop-args))
                      (other
                        (if (eq (car cl--loop-args) 'using)
@@ -1380,7 +1380,7 @@ For more details, see Info node `(cl)Loop Facility'.
                                     (memq (cl-caadr cl--loop-args) key-types)
                                     (not (eq (cl-caadr cl--loop-args) word)))
                                (cadr (cl--pop2 cl--loop-args))
-                             (error "Bad `using' clause"))
+                             (error "Bad ‘using’ clause"))
                          (make-symbol "--cl-var--"))))
                  (if (memq word '(key-binding key-bindings))
                      (setq var (prog1 other (setq other var))))
@@ -1430,7 +1430,7 @@ For more details, see Info node `(cl)Loop Facility'.
                                    (get word 'cl-loop-for-handler))))
                  (if handler
                      (funcall handler var)
-                   (error "Expected a `for' preposition, found %s" word)))))
+                   (error "Expected a ‘for’ preposition, found %s" word)))))
              (eq (car cl--loop-args) 'and))
          (setq ands t)
          (pop cl--loop-args))
@@ -1569,7 +1569,7 @@ For more details, see Info node `(cl)Loop Facility'.
 
      ((memq word '(do doing))
       (let ((body nil))
-       (or (consp (car cl--loop-args)) (error "Syntax error on `do' clause"))
+       (or (consp (car cl--loop-args)) (error "Syntax error on ‘do’ clause"))
        (while (consp (car cl--loop-args)) (push (pop cl--loop-args) body))
        (push (cons 'progn (nreverse (cons t body))) cl--loop-body)))
 
@@ -1802,7 +1802,7 @@ Labels have lexical scope and dynamic extent."
        `((go . ,(lambda (label)
                   (let ((catch-tag (cdr (assq label cl--tagbody-alist))))
                     (unless catch-tag
-                      (error "Unknown cl-tagbody go label `%S'" label))
+                      (error "Unknown cl-tagbody go label ‘%S’" label))
                     `(throw ',catch-tag ',label))))
          ,@macroexpand-all-environment)))))
 
@@ -2101,8 +2101,8 @@ by EXPANSION, and (setq NAME ...) will act like (setf 
EXPANSION ...).
                                           macroexpand-all-environment))))
               (if (or (null (cdar bindings)) (cl-cddar bindings))
                   (macroexp--warn-and-return
-                   (format "Malformed `cl-symbol-macrolet' binding: %S"
-                           (car bindings))
+                   (format-message "Malformed ‘cl-symbol-macrolet’ binding: %S"
+                                   (car bindings))
                    expansion)
                 expansion)))
         (fset 'macroexpand previous-macroexpand))))))
diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el
index c966ace..38deeae 100644
--- a/lisp/emacs-lisp/cl.el
+++ b/lisp/emacs-lisp/cl.el
@@ -86,7 +86,7 @@
 
 (defun cl-unload-function ()
   "Stop unloading of the Common Lisp extensions."
-  (message "Cannot unload the feature `cl'")
+  (message "Cannot unload the feature ‘cl’")
   ;; Stop standard unloading!
   t)
 
@@ -459,15 +459,15 @@ definitions, or lack thereof).
              (if (or (and (fboundp (car x))
                           (eq (car-safe (symbol-function (car x))) 'macro))
                      (cdr (assq (car x) macroexpand-all-environment)))
-                 (error "Use `labels', not `flet', to rebind macro names"))
+                 (error "Use ‘labels’, not ‘flet’, to rebind macro names"))
              (let ((func `(cl-function
                            (lambda ,(cadr x)
                              (cl-block ,(car x) ,@(cddr x))))))
                (when (cl--compiling-file)
                  ;; Bug#411.  It would be nice to fix this.
                  (and (get (car x) 'byte-compile)
-                      (error "Byte-compiling a redefinition of `%s' \
-will not work - use `labels' instead" (symbol-name (car x))))
+                      (error "Byte-compiling a redefinition of ‘%s’ \
+will not work - use ‘labels’ instead" (symbol-name (car x))))
                  ;; FIXME This affects the rest of the file, when it
                  ;; should be restricted to the flet body.
                  (and (boundp 'byte-compile-function-environment)
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index 1317d69..ece6883 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -350,7 +350,7 @@ independently replaces consecutive years with a range."
   (or (getenv "ORGANIZATION")
       str)
   '(if (copyright-offset-too-large-p)
-       (message "Copyright extends beyond `copyright-limit' and won't be 
updated automatically."))
+       (message "Copyright extends beyond ‘copyright-limit’ and won't be 
updated automatically."))
   comment-end \n)
 
 ;; TODO: recurse, exclude COPYING etc.
@@ -361,7 +361,7 @@ If FIX is non-nil, run `copyright-fix-years' instead."
   (interactive "DDirectory: \nMFilenames matching (regexp): ")
   (dolist (file (directory-files directory t match nil))
     (unless (file-directory-p file)
-      (message "Updating file `%s'" file)
+      (message "Updating file ‘%s’" file)
       ;; FIXME we should not use find-file+save+kill.
       (let ((enable-local-variables :safe)
            (enable-local-eval nil))
diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el
index f516e78..61cb3c3 100644
--- a/lisp/emacs-lisp/crm.el
+++ b/lisp/emacs-lisp/crm.el
@@ -128,8 +128,8 @@ A value of nil specifies `try-completion'.  A value of t 
specifies
 `all-completions'.  A value of lambda specifies a test for an exact match.
 
 For more information on STRING, PREDICATE, and FLAG, see the Elisp
-Reference sections on 'Programmed Completion' and 'Basic Completion
-Functions'."
+Reference sections on “Programmed Completion” and “Basic Completion
+Functions”."
   (let ((beg 0))
     (while (string-match crm-separator string beg)
       (setq beg (match-end 0)))
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index b5b68d2..3ad496a 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -85,7 +85,7 @@ This applies to `eval-defun', `eval-region', `eval-buffer', 
and
 
 You can use the command `edebug-all-defs' to toggle the value of this
 variable.  You may wish to make it local to each buffer with
-\(make-local-variable 'edebug-all-defs) in your
+\(make-local-variable \\='edebug-all-defs) in your
 `emacs-lisp-mode-hook'."
   :type 'boolean
   :group 'edebug)
@@ -880,7 +880,7 @@ Maybe clear the markers and delete the symbol's edebug 
property?"
              (setq dotted-form (edebug-read-storing-offsets stream))
                    elements (nconc elements dotted-form)
              (if (not (eq (edebug-next-token-class) 'rparen))
-                 (edebug-syntax-error "Expected `)'"))
+                 (edebug-syntax-error "Expected ‘)’"))
              (setq edebug-read-dotted-list (listp dotted-form))
              ))
        elements)
@@ -3373,7 +3373,7 @@ Return the result of the last expression."
 (defalias 'edebug-prin1 'prin1)
 (defalias 'edebug-print 'print)
 (defalias 'edebug-prin1-to-string 'prin1-to-string)
-(defalias 'edebug-format 'format)
+(defalias 'edebug-format 'format-message)
 (defalias 'edebug-message 'message)
 
 (defun edebug-eval-expression (expr)
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index 400bdb9..e1051b2 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -218,7 +218,7 @@ for CLASS.  Optional ALLOW-SUBCLASS says that it is ok for
 `eieio-persistent-read' to load in subclasses of class instead of
 being pedantic."
   (unless class
-    (message "Unsafe call to `eieio-persistent-read'."))
+    (message "Unsafe call to ‘eieio-persistent-read’."))
   (when class (cl-check-type class class))
   (let ((ret nil)
        (buffstr nil))
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
index 7fcf85c..3b07c5d 100644
--- a/lisp/emacs-lisp/eieio-core.el
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -544,7 +544,7 @@ If SKIPNIL is non-nil, then if default value is nil return 
t instead."
     (if (not (eq type t))
         (if (not (equal type tp))
             (error
-             "Child slot type `%s' does not match inherited type `%s' for `%s'"
+             "Child slot type ‘%s’ does not match inherited type ‘%s’ for ‘%s’"
              type tp a))
       (setf (cl--slot-descriptor-type new) tp))
     ;; If we have a repeat, only update the initarg...
@@ -564,7 +564,7 @@ If SKIPNIL is non-nil, then if default value is nil return 
t instead."
     (let ((super-prot (alist-get :protection oprops))
           (prot (alist-get :protection nprops)))
       (if (not (eq prot super-prot))
-          (error "Child slot protection `%s' does not match inherited 
protection `%s' for `%s'"
+          (error "Child slot protection ‘%s’ does not match inherited 
protection ‘%s’ for ‘%s’"
                  prot super-prot a)))
     ;; End original PLN
 
@@ -733,7 +733,7 @@ Argument FN is the function calling this verifier."
                 ((and (or `',name (and name (pred keywordp)))
                       (guard (not (memq name eieio--known-slot-names))))
                  (macroexp--warn-and-return
-                  (format "Unknown slot `%S'" name) exp 'compile-only))
+                  (format-message "Unknown slot ‘%S’" name) exp 'compile-only))
                 (_ exp)))))
   (cl-check-type slot symbol)
   (cl-check-type obj (or eieio-object class))
@@ -847,7 +847,7 @@ Fills in the default value in CLASS' in SLOT with VALUE."
       ;; gnus/registry.el, so it might be used elsewhere as well, so let's
       ;; keep it for now.
       ;; FIXME: Generate a compile-time warning for it!
-      ;; (error "Can't `oset-default' an instance-allocated slot: %S of %S"
+      ;; (error "Can't ‘oset-default’ an instance-allocated slot: %S of %S"
       ;;        slot class)
       (eieio--validate-slot-value class c value slot)
       ;; Set this into the storage for defaults.
diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el
index 9ecc594..0b00336 100644
--- a/lisp/emacs-lisp/eieio-opt.el
+++ b/lisp/emacs-lisp/eieio-opt.el
@@ -243,13 +243,13 @@ are not abstract."
     (princ "Methods Primary Only: ")
     (prin1 primaryonly)
     (princ "\t")
-    (princ (format "%d" (* (/ (float primaryonly) (float methidx)) 100)))
+    (princ (format "%d" (floor (* 100.0 primaryonly) methidx)))
     (princ "% of total methods")
     (terpri)
     (princ "Only One Primary Impl: ")
     (prin1 oneprimary)
     (princ "\t")
-    (princ (format "%d" (* (/ (float oneprimary) (float primaryonly)) 100)))
+    (princ (format "%d" (floor (* 100.0 oneprimary) primaryonly)))
     (princ "% of total primary methods")
     (terpri)
     ))
diff --git a/lisp/emacs-lisp/eieio-speedbar.el 
b/lisp/emacs-lisp/eieio-speedbar.el
index a1eabcf..ac8124a 100644
--- a/lisp/emacs-lisp/eieio-speedbar.el
+++ b/lisp/emacs-lisp/eieio-speedbar.el
@@ -323,7 +323,7 @@ Argument DEPTH is the depth at which the tag line is 
inserted."
 
 (cl-defmethod eieio-speedbar-child-make-tag-lines ((object eieio-speedbar) 
_depth)
   "Base method for creating tag lines for non-object children."
-  (error "You must implement `eieio-speedbar-child-make-tag-lines' for %s"
+  (error "You must implement ‘eieio-speedbar-child-make-tag-lines’ for %s"
         (eieio-object-name object)))
 
 (cl-defmethod eieio-speedbar-expand ((object eieio-speedbar) depth)
@@ -364,7 +364,7 @@ TOKEN is the object.  INDENT is the current indentation 
level."
 
 (cl-defmethod eieio-speedbar-child-description ((obj eieio-speedbar))
   "Return a description for a child of OBJ which is not an object."
-  (error "You must implement `eieio-speedbar-child-description' for %s"
+  (error "You must implement ‘eieio-speedbar-child-description’ for %s"
         (eieio-object-name obj)))
 
 (defun eieio-speedbar-item-info ()
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
index 84a68a8..84c07d9 100644
--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -114,10 +114,10 @@ and reference them using the function `class-option'."
 
   (cond ((and (stringp (car options-and-doc))
               (/= 1 (% (length options-and-doc) 2)))
-         (error "Too many arguments to `defclass'"))
+         (error "Too many arguments to ‘defclass’"))
         ((and (symbolp (car options-and-doc))
               (/= 0 (% (length options-and-doc) 2)))
-         (error "Too many arguments to `defclass'")))
+         (error "Too many arguments to ‘defclass’")))
 
   (if (stringp (car options-and-doc))
       (setq options-and-doc
@@ -941,7 +941,7 @@ this object."
   "Change the class of OBJ to type CLASS.
 This may create or delete slots, but does not affect the return value
 of `eq'."
-  (error "EIEIO: `change-class' is unimplemented"))
+  (error "EIEIO: ‘change-class’ is unimplemented"))
 
 ;; Hook ourselves into help system for describing classes and methods.
 ;; FIXME: This is not actually needed any more since we can click on the
@@ -983,7 +983,7 @@ Optional argument GROUP is the sub-group of slots to 
display.
 
 ;;;***
 
-;;;### (autoloads nil "eieio-opt" "eieio-opt.el" 
"cb1aba7670b6a4b9c6f968c0ad6dc130")
+;;;### (autoloads nil "eieio-opt" "eieio-opt.el" 
"694d44fcd869546592d35f3321f62667")
 ;;; Generated autoloads from eieio-opt.el
 
 (autoload 'eieio-browse "eieio-opt" "\
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 032cdec..feffd54 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -261,7 +261,7 @@ Otherwise work like `message'."
                        mode-line-format)))
           (setq eldoc-mode-line-string
                 (when (stringp format-string)
-                  (apply 'format format-string args)))
+                  (apply #'format-message format-string args)))
           (force-mode-line-update)))
     (apply 'message format-string args)))
 
@@ -274,7 +274,7 @@ Otherwise work like `message'."
                ;; eldoc-last-message so eq test above might succeed on
                ;; subsequent calls.
                ((null (cdr args)) (car args))
-               (t (apply 'format args))))
+               (t (apply #'format-message args))))
     ;; In emacs 19.29 and later, and XEmacs 19.13 and later, all messages
     ;; are recorded in a log.  Do not put eldoc messages in that log since
     ;; they are Legion.
diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el
index fc66c82..15eeb49 100644
--- a/lisp/emacs-lisp/elint.el
+++ b/lisp/emacs-lisp/elint.el
@@ -249,9 +249,9 @@ This environment can be passed to `macroexpand'."
     (elint-set-mode-line t)
     (with-current-buffer elint-log-buffer
       (unless (string-equal default-directory dir)
-       (elint-log-message (format "\nLeaving directory `%s'"
-                                  default-directory) t)
-       (elint-log-message (format "Entering directory `%s'" dir) t)
+       (elint-log-message (format-message "\nLeaving directory ‘%s’"
+                                           default-directory) t)
+       (elint-log-message (format-message "Entering directory ‘%s’" dir) t)
        (setq default-directory dir))))
   (let ((str (format "Linting file %s" file)))
     (message "%s..." str)
@@ -374,7 +374,7 @@ Returns the forms."
          ;; quoted check cannot be elsewhere, since quotes skipped.
          (if (looking-back "'" (1- (point)))
              ;; Eg cust-print.el uses ' as a comment syntax.
-             (elint-warning "Skipping quoted form `'%.20s...'"
+             (elint-warning "Skipping quoted form ‘'%.20s...’"
                           (read (current-buffer)))
            (condition-case nil
                (setq tops (cons
@@ -383,7 +383,7 @@ Returns the forms."
                            tops))
              (end-of-file
               (goto-char elint-current-pos)
-              (error "Missing ')' in top form: %s"
+              (error "Missing ‘)’ in top form: %s"
                      (buffer-substring elint-current-pos
                                        (line-end-position))))))))
       (nreverse tops))))
@@ -401,7 +401,7 @@ Return nil if there are no more forms, t otherwise."
   (cond
    ;; Eg nnmaildir seems to use [] as a form of comment syntax.
    ((not (listp form))
-    (elint-warning "Skipping non-list form `%s'" form))
+    (elint-warning "Skipping non-list form ‘%s’" form))
    ;; Add defined variable
    ((memq (car form) '(defvar defconst defcustom))
     (setq elint-env (elint-env-add-var elint-env (cadr form))))
@@ -432,7 +432,7 @@ Return nil if there are no more forms, t otherwise."
               (if (or (< (length form) 4)
                       (eq (nth 3 form) t)
                       (unless (stringp (nth 2 form))
-                        (elint-error "Malformed declaration for `%s'"
+                        (elint-error "Malformed declaration for ‘%s’"
                                      (cadr form))
                         t))
                   'unknown
@@ -758,7 +758,7 @@ CODE can be a lambda expression, a macro, or byte-compiled 
code."
     (and (eq (car-safe alias) 'quote)
         (eq (car-safe target) 'quote)
         (eq (elint-get-args (cadr target) env) 'undefined)
-        (elint-warning "Alias `%s' has unknown target `%s'"
+        (elint-warning "Alias ‘%s’ has unknown target ‘%s’"
                        (cadr alias) (cadr target))))
   (elint-form form env t))
 
@@ -796,7 +796,7 @@ CODE can be a lambda expression, a macro, or byte-compiled 
code."
                  (setq newenv
                        (elint-env-add-var newenv (car s))))
                 (t (elint-error
-                    "Malformed `let' declaration: %s" s))))
+                    "Malformed ‘let’ declaration: %s" s))))
              varlist)
 
        ;; Lint the body forms
@@ -982,7 +982,7 @@ Does basic handling of `featurep' tests."
                                                    (line-beginning-position))))
                               0)       ; unknown position
                             type
-                            (apply 'format string args))))
+                            (apply #'format-message string args))))
 
 (defun elint-error (string &rest args)
   "Report a linting error.
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el
index 647784b..cae3fa2 100644
--- a/lisp/emacs-lisp/ert-x.el
+++ b/lisp/emacs-lisp/ert-x.el
@@ -214,7 +214,7 @@ property list, or no properties if there is no plist before 
it.
 
 As a simple example,
 
-\(ert-propertized-string \"foo \" '(face italic) \"bar\" \" baz\" nil \
+\(ert-propertized-string \"foo \" \\='(face italic) \"bar\" \" baz\" nil \
 \" quux\"\)
 
 would return the string \"foo bar baz quux\" where the substring
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 99c5ede..91fc157 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -121,7 +121,7 @@ Emacs bug 6581 at URL 
`http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6581'."
 
 (defun ert-get-test (symbol)
   "If SYMBOL names a test, return that.  Signal an error otherwise."
-  (unless (ert-test-boundp symbol) (error "No test named `%S'" symbol))
+  (unless (ert-test-boundp symbol) (error "No test named ‘%S’" symbol))
   (get symbol 'ert--test))
 
 (defun ert-set-test (symbol definition)
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index cd23cd7..86a1f28 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -100,10 +100,34 @@ Please send improvements and fixes to the maintainer."
   :group 'find-function
   :version "22.1")
 
+(defcustom find-feature-regexp
+  (concat ";;; Code:")
+  "The regexp used by `xref-find-definitions' when searching for a feature 
definition.
+Note it must contain a `%s' at the place where `format'
+should insert the feature name."
+  ;; We search for ";;; Code" rather than (feature '%s) because the
+  ;; former is near the start of the code, and the latter is very
+  ;; uninteresting. If the regexp is not found, just goes to
+  ;; (point-min), which is acceptable in this case.
+  :type 'regexp
+  :group 'xref
+  :version "25.0")
+
+(defcustom find-alias-regexp
+  "(defalias +'%s"
+  "The regexp used by `xref-find-definitions' to search for an alias 
definition.
+Note it must contain a `%s' at the place where `format'
+should insert the feature name."
+  :type 'regexp
+  :group 'xref
+  :version "25.0")
+
 (defvar find-function-regexp-alist
   '((nil . find-function-regexp)
     (defvar . find-variable-regexp)
-    (defface . find-face-regexp))
+    (defface . find-face-regexp)
+    (feature . find-feature-regexp)
+    (defalias . find-alias-regexp))
   "Alist mapping definition types into regexp variables.
 Each regexp variable's value should actually be a format string
 to be used to substitute the desired symbol name into the regexp.
@@ -272,7 +296,7 @@ Otherwise, TYPE specifies the kind of definition,
 and it is interpreted via `find-function-regexp-alist'.
 The search is done in the source for library LIBRARY."
   (if (null library)
-      (error "Don't know where `%s' is defined" symbol))
+      (error "Don't know where ‘%s’ is defined" symbol))
   ;; Some functions are defined as part of the construct
   ;; that defines something else.
   (while (and (symbolp symbol) (get symbol 'definition-name))
@@ -343,10 +367,11 @@ message about the whole chain of aliases."
           (not verbose)
           (setq aliases (if aliases
                             (concat aliases
-                                    (format ", which is an alias for `%s'"
-                                            (symbol-name def)))
-                          (format "`%s' is an alias for `%s'"
-                                  function (symbol-name def)))))
+                                    (format-message
+                                     ", which is an alias for ‘%s’"
+                                     (symbol-name def)))
+                          (format-message "‘%s’ is an alias for ‘%s’"
+                                          function (symbol-name def)))))
       (setq function (find-function-advised-original function)
             def (find-function-advised-original function)))
     (if aliases
diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el
index 123f64b..79e760d 100644
--- a/lisp/emacs-lisp/generator.el
+++ b/lisp/emacs-lisp/generator.el
@@ -661,7 +661,7 @@ The caller of `iter-next' receives VALUE, and the next call 
to
 `iter-next' resumes execution at the previous
 `iter-yield' point."
   (identity value)
-  (error "`iter-yield' used outside a generator"))
+  (error "‘iter-yield’ used outside a generator"))
 
 (defmacro iter-yield-from (value)
   "When used inside a generator function, delegate to a sub-iterator.
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index e67888c..bed9024 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -239,7 +239,7 @@ instead the assignment is turned into something equivalent 
to
 so as to preserve the semantics of `setf'."
   (declare (debug (sexp (&or symbolp lambda-expr) &optional sexp)))
   (when (eq 'lambda (car-safe setter))
-    (message "Use `gv-define-setter' or name %s's setter function" name))
+    (message "Use ‘gv-define-setter’ or name %s's setter function" name))
   `(gv-define-setter ,name (val &rest args)
      ,(if fix-return
           `(macroexp-let2 nil v val
diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el
index 104c23c..6fdd348 100644
--- a/lisp/emacs-lisp/lisp-mnt.el
+++ b/lisp/emacs-lisp/lisp-mnt.el
@@ -265,16 +265,17 @@ a section."
 
 (defun lm-header (header)
   "Return the contents of the header named HEADER."
-  (goto-char (point-min))
-  (let ((case-fold-search t))
-    (when (and (re-search-forward (lm-get-header-re header) (lm-code-mark) t)
-              ;;   RCS ident likes format "$identifier: data$"
-              (looking-at
-               (if (save-excursion
-                     (skip-chars-backward "^$" (match-beginning 0))
-                     (= (point) (match-beginning 0)))
-                   "[^\n]+" "[^$\n]+")))
-      (match-string-no-properties 0))))
+  (save-excursion
+    (goto-char (point-min))
+    (let ((case-fold-search t))
+      (when (and (re-search-forward (lm-get-header-re header) (lm-code-mark) t)
+                 ;;   RCS ident likes format "$identifier: data$"
+                 (looking-at
+                  (if (save-excursion
+                        (skip-chars-backward "^$" (match-beginning 0))
+                        (= (point) (match-beginning 0)))
+                      "[^\n]+" "[^$\n]+")))
+        (match-string-no-properties 0)))))
 
 (defun lm-header-multiline (header)
   "Return the contents of the header named HEADER, with continuation lines.
@@ -541,21 +542,21 @@ copyright notice is allowed."
               ((null name)
                "Can't find package name")
               ((not (lm-authors))
-               "`Author:' tag missing")
+               "‘Author:’ tag missing")
               ((not (lm-maintainer))
-               "`Maintainer:' tag missing")
+               "‘Maintainer:’ tag missing")
               ((not (lm-summary))
                "Can't find the one-line summary description")
               ((not (lm-keywords))
-               "`Keywords:' tag missing")
+               "‘Keywords:’ tag missing")
               ((not (lm-keywords-finder-p))
-               "`Keywords:' has no valid finder keywords (see 
`finder-known-keywords')")
+               "‘Keywords:’ has no valid finder keywords (see 
‘finder-known-keywords’)")
               ((not (lm-commentary-mark))
-               "Can't find a 'Commentary' section marker")
+               "Can't find a ‘Commentary’ section marker")
               ((not (lm-history-mark))
-               "Can't find a 'History' section marker")
+               "Can't find a ‘History’ section marker")
               ((not (lm-code-mark))
-               "Can't find a 'Code' section marker")
+               "Can't find a ‘Code’ section marker")
               ((progn
                  (goto-char (point-max))
                  (not
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index ffc6585..ff359e6 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -146,11 +146,12 @@ and also to avoid outputting the warning during normal 
execution."
 (defun macroexp--obsolete-warning (fun obsolescence-data type)
   (let ((instead (car obsolescence-data))
         (asof (nth 2 obsolescence-data)))
-    (format "`%s' is an obsolete %s%s%s" fun type
-            (if asof (concat " (as of " asof ")") "")
-            (cond ((stringp instead) (concat "; " instead))
-                  (instead (format "; use `%s' instead." instead))
-                  (t ".")))))
+    (format-message
+     "‘%s’ is an obsolete %s%s%s" fun type
+     (if asof (concat " (as of " asof ")") "")
+     (cond ((stringp instead) (concat "; " instead))
+           (instead (format-message "; use ‘%s’ instead." instead))
+           (t ".")))))
 
 (defun macroexpand-1 (form &optional environment)
   "Perform (at most) one step of macroexpansion."
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index 08b34fb..3ac7094 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -198,9 +198,10 @@ Returns the number of actions taken."
                                   (objects (if help (nth 1 help) "objects"))
                                   (action (if help (nth 2 help) "act on")))
                               (concat
-                               (format "Type SPC or `y' to %s the current %s;
-DEL or `n' to skip the current %s;
-RET or `q' to give up on the %s (skip all remaining %s);
+                               (format-message "\
+Type SPC or ‘y’ to %s the current %s;
+DEL or ‘n’ to skip the current %s;
+RET or ‘q’ to give up on the %s (skip all remaining %s);
 C-g to quit (cancel the whole command);
 ! to %s all remaining %s;\n"
                                        action object object action objects 
action
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index 5a59a98..7eebb5e 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -95,7 +95,7 @@ Each element has the form (WHERE BYTECODE STACK) where:
                (propertize (format "%s advice: " where)
                            'face 'warning)
                (let ((fun (advice--car flist)))
-                 (if (symbolp fun) (format "`%S'" fun)
+                 (if (symbolp fun) (format-message "‘%S’" fun)
                    (let* ((name (cdr (assq 'name (advice--props flist))))
                           (doc (documentation fun t))
                           (usage (help-split-fundoc doc function)))
@@ -176,7 +176,7 @@ WHERE is a symbol to select an entry in 
`advice--where-alist'."
           (advice--make-1 (aref main 1) (aref main 3)
                           (advice--car main) rest (advice--props main)))
       (let ((desc (assq where advice--where-alist)))
-        (unless desc (error "Unknown add-function location `%S'" where))
+        (unless desc (error "Unknown add-function location ‘%S’" where))
         (advice--make-1 (nth 1 desc) (nth 2 desc)
                         function main props)))))
 
@@ -461,7 +461,7 @@ otherwise it is named address@hidden'.
          (advice (cond ((null name) `(lambda ,lambda-list ,@body))
                        ((or (stringp name) (symbolp name))
                         (intern (format "address@hidden" symbol name)))
-                       (t (error "Unrecognized name spec `%S'" name)))))
+                       (t (error "Unrecognized name spec ‘%S’" name)))))
     `(prog1 ,@(and (symbolp advice) `((defun ,advice ,lambda-list ,@body)))
        (advice-add ',symbol ,where #',advice ,@(and props `(',props))))))
 
diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el
index 81d0b83..608bf73 100644
--- a/lisp/emacs-lisp/package-x.el
+++ b/lisp/emacs-lisp/package-x.el
@@ -296,7 +296,7 @@ destination, prompt for one."
             ((string-match "\\.tar\\'" file)
              (tar-mode) (package-tar-file-info))
             ((string-match "\\.el\\'" file) (package-buffer-info))
-            (t (error "Unrecognized extension `%s'"
+            (t (error "Unrecognized extension ‘%s’"
                       (file-name-extension file))))))
       (package-upload-buffer-internal pkg-desc (file-name-extension file)))))
 
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index aeb8c65..7c4f21f 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -456,13 +456,13 @@ This is, approximately, the inverse of `version-to-list'.
           (push (int-to-string num) str-list)
           (push "." str-list))
          ((< num -4)
-          (error "Invalid version list `%s'" vlist))
+          (error "Invalid version list ‘%s’" vlist))
          (t
           ;; pre, or beta, or alpha
           (cond ((equal "." (car str-list))
                  (pop str-list))
                 ((not (string-match "[0-9]+" (car str-list)))
-                 (error "Invalid version list `%s'" vlist)))
+                 (error "Invalid version list ‘%s’" vlist)))
           (push (cond ((= num -1) "pre")
                       ((= num -2) "beta")
                       ((= num -3) "alpha")
@@ -623,7 +623,7 @@ Return the max version (as a string) if the package is held 
at a lower version."
           ((stringp force)              ; held
            (unless (version-list-= version (version-to-list force))
              force))
-          (t (error "Invalid element in `package-load-list'")))))
+          (t (error "Invalid element in ‘package-load-list’")))))
 
 (defun package-built-in-p (package &optional min-version)
   "Return true if PACKAGE is built-in to Emacs.
@@ -651,7 +651,7 @@ correspond to previously loaded files (those returned by
          (pkg-dir (package-desc-dir pkg-desc))
          (pkg-dir-dir (file-name-as-directory pkg-dir)))
     (unless pkg-dir
-      (error "Internal error: unable to find directory for `%s'"
+      (error "Internal error: unable to find directory for ‘%s’"
              (package-desc-full-name pkg-desc)))
     ;; Add to load path, add autoloads, and activate the package.
     (let* ((old-lp load-path)
@@ -754,8 +754,8 @@ Newer versions are always activated, regardless of FORCE."
                        (unless (package-activate (car req))
                          (throw 'dep-failure req))))))
         (if fail
-            (warn "Unable to activate package `%s'.
-Required package `%s-%s' is unavailable"
+            (warn "Unable to activate package ‘%s’.
+Required package ‘%s-%s’ is unavailable"
                   package (car fail) (package-version-join (cadr fail)))
           ;; If all goes well, activate the package itself.
           (package-activate-1 pkg-vec force)))))))
@@ -1465,7 +1465,7 @@ similar to an entry in `package-alist'.  Save the cached 
copy to
                ;; Even if the sig fails, this download is done, so
                ;; remove it from the in-progress list.
                (package--update-downloads-in-progress archive)
-               (error "Unsigned archive `%s'" name))
+               (error "Unsigned archive ‘%s’" name))
              ;; Write out the archives file.
              (write-region content nil local-file nil 'silent)
              ;; Write out good signatures into archive-contents.signed file.
@@ -1495,7 +1495,7 @@ perform the downloads asynchronously."
          (when async
            ;; The t at the end means to propagate connection errors.
            (lambda () (package--update-downloads-in-progress archive) t)))
-      (error (message "Failed to download `%s' archive."
+      (error (message "Failed to download ‘%s’ archive."
                (car archive))))))
 
 ;;;###autoload
@@ -1564,7 +1564,7 @@ SEEN is used internally to detect infinite recursion."
                          (package-desc-full-name already))
               (setq packages (delq already packages))
               (setq already nil))
-          (error "Need package `%s-%s', but only %s is being installed"
+          (error "Need package ‘%s-%s’, but only %s is being installed"
                  next-pkg (package-version-join next-version)
                  (package-version-join (package-desc-version already)))))
       (cond
@@ -1592,20 +1592,21 @@ SEEN is used internally to detect infinite recursion."
                 (unless problem
                   (setq problem
                         (if (stringp disabled)
-                            (format "Package `%s' held at version %s, but 
version %s required"
-                                    next-pkg disabled
-                                    (package-version-join next-version))
-                          (format "Required package '%s' is disabled"
-                                  next-pkg)))))
+                            (format-message
+                             "Package ‘%s’ held at version %s, but version %s 
required"
+                             next-pkg disabled
+                             (package-version-join next-version))
+                          (format-message "Required package ‘%s’ is disabled"
+                                          next-pkg)))))
                (t (setq found pkg-desc)))))
           (unless found
             (cond
              (problem (error "%s" problem))
              (found-something
-              (error "Need package `%s-%s', but only %s is available"
+              (error "Need package ‘%s-%s’, but only %s is available"
                      next-pkg (package-version-join next-version)
                      found-something))
-             (t (error "Package `%s-%s' is unavailable"
+             (t (error "Package ‘%s-%s’ is unavailable"
                        next-pkg (package-version-join next-version)))))
           (setq packages
                 (package-compute-transaction (cons found packages)
@@ -1765,7 +1766,7 @@ if all the in-between dependencies are also in 
PACKAGE-LIST."
              (unless (or good-sigs (eq package-check-signature 
'allow-unsigned))
                ;; Even if the sig fails, this download is done, so
                ;; remove it from the in-progress list.
-               (error "Unsigned package: `%s'"
+               (error "Unsigned package: ‘%s’"
                  (package-desc-name pkg-desc)))
              ;; Signature checked, unpack now.
              (with-temp-buffer (insert content)
@@ -1906,7 +1907,7 @@ to install it but still mark it as selected."
                                                (package-desc-reqs pkg)))
               (package-compute-transaction () (list (list pkg))))))
       (package-download-transaction transaction)
-    (message "`%s' is already installed" (package-desc-full-name pkg))))
+    (message "‘%s’ is already installed" (package-desc-full-name pkg))))
 
 (defun package-strip-rcs-id (str)
   "Strip RCS version ID from the version string STR.
@@ -1981,7 +1982,7 @@ If some packages are not installed propose to install 
them."
   ;; using here, because the outcome is the same either way (nothing
   ;; gets installed).
   (if (not package-selected-packages)
-      (message "`package-selected-packages' is empty, nothing to install")
+      (message "‘package-selected-packages’ is empty, nothing to install")
     (cl-loop for p in package-selected-packages
              unless (package-installed-p p)
              collect p into lst
@@ -2046,13 +2047,13 @@ If NOSAVE is non-nil, the package is not removed from
                                   (expand-file-name package-user-dir))
                                  (expand-file-name dir)))
            ;; Don't delete "system" packages.
-           (error "Package `%s' is a system package, not deleting"
+           (error "Package ‘%s’ is a system package, not deleting"
                   (package-desc-full-name pkg-desc)))
           ((and (null force)
                 (setq pkg-used-elsewhere-by
                       (package--used-elsewhere-p pkg-desc)))
            ;; Don't delete packages used as dependency elsewhere.
-           (error "Package `%s' is used by `%s' as dependency, not deleting"
+           (error "Package ‘%s’ is used by ‘%s’ as dependency, not deleting"
                   (package-desc-full-name pkg-desc)
                   (package-desc-name pkg-used-elsewhere-by)))
           (t
@@ -2067,7 +2068,7 @@ If NOSAVE is non-nil, the package is not removed from
              (delete pkg-desc pkgs)
              (unless (cdr pkgs)
                (setq package-alist (delq pkgs package-alist))))
-           (message "Package `%s' deleted." (package-desc-full-name 
pkg-desc))))))
+           (message "Package ‘%s’ deleted." (package-desc-full-name 
pkg-desc))))))
 
 ;;;###autoload
 (defun package-reinstall (pkg)
@@ -2096,7 +2097,7 @@ will be deleted."
   ;; do absolutely nothing.
   (when (or package-selected-packages
             (yes-or-no-p
-             "`package-selected-packages' is empty! Really remove ALL 
packages? "))
+             "‘package-selected-packages’ is empty! Really remove ALL 
packages? "))
     (let ((removable (package--removable-packages)))
       (if removable
           (when (y-or-n-p
@@ -2143,6 +2144,22 @@ will be deleted."
       (with-current-buffer standard-output
         (describe-package-1 package)))))
 
+(defface package-help-section-name-face
+  '((t :inherit (bold font-lock-function-name-face)))
+  "Face used on section names in package description buffers."
+  :version "25.1")
+
+(defun package--print-help-section (name &rest strings)
+  "Print \"NAME: \", right aligned to the 13th column.
+If more STRINGS are provided, insert them followed by a newline.
+Otherwise no newline is inserted."
+  (declare (indent 1))
+  (insert (make-string (max 0 (- 11 (string-width name))) ?\s)
+          (propertize (concat name ": ") 'font-lock-face 
'package-help-section-name-face))
+  (when strings
+    (apply #'insert strings)
+    (insert "\n")))
+
 (declare-function lm-commentary "lisp-mnt" (&optional file))
 
 (defun describe-package-1 (pkg)
@@ -2178,16 +2195,16 @@ will be deleted."
     (princ status)
     (princ " package.\n\n")
 
-    (insert "     " (propertize "Status" 'font-lock-face 'bold) ": ")
+    (package--print-help-section "Status")
     (cond (built-in
            (insert (propertize (capitalize status)
-                               'font-lock-face 'font-lock-builtin-face)
+                               'font-lock-face 'package-status-builtin-face)
                    "."))
           (pkg-dir
            (insert (propertize (if (member status '("unsigned" "dependency"))
                                    "Installed"
                                  (capitalize status))
-                               'font-lock-face 'font-lock-builtin-face))
+                               'font-lock-face 'package-status-builtin-face))
            (insert (substitute-command-keys " in ‘"))
            (let ((dir (abbreviate-file-name
                        (file-name-as-directory
@@ -2200,7 +2217,7 @@ will be deleted."
                (insert (substitute-command-keys
                         "’,\n             shadowing a ")
                        (propertize "built-in package"
-                                   'font-lock-face 'font-lock-builtin-face))
+                                   'font-lock-face 
'package-status-builtin-face))
              (insert (substitute-command-keys "’")))
            (if signed
                (insert ".")
@@ -2229,18 +2246,18 @@ will be deleted."
           (t (insert (capitalize status) ".")))
     (insert "\n")
     (unless (and pkg-dir (not archive)) ; Installed pkgs don't have archive.
-      (insert "    " (propertize "Archive" 'font-lock-face 'bold)
-              ": " (or archive "n/a") "\n"))
+      (package--print-help-section "Archive"
+        (or archive "n/a") "\n"))
     (and version
-         (insert "    "
-                 (propertize "Version" 'font-lock-face 'bold) ": "
-                 (package-version-join version) "\n"))
-    (insert "    " (propertize "Summary" 'font-lock-face 'bold)
-            ": " (if desc (package-desc-summary desc)) "\n")
+         (package--print-help-section "Version"
+           (package-version-join version)))
+    (when desc
+      (package--print-help-section "Summary"
+        (package-desc-summary desc)))
 
     (setq reqs (if desc (package-desc-reqs desc)))
     (when reqs
-      (insert "   " (propertize "Requires" 'font-lock-face 'bold) ": ")
+      (package--print-help-section "Requires")
       (let ((first t))
         (dolist (req reqs)
           (let* ((name (car req))
@@ -2259,7 +2276,7 @@ will be deleted."
             (insert reason)))
         (insert "\n")))
     (when required-by
-      (insert (propertize "Required by" 'font-lock-face 'bold) ": ")
+      (package--print-help-section "Required by")
       (let ((first t))
         (dolist (pkg required-by)
           (let ((text (package-desc-full-name pkg)))
@@ -2272,11 +2289,11 @@ will be deleted."
                                      (package-desc-name pkg))))
         (insert "\n")))
     (when homepage
-      (insert "   " (propertize "Homepage" 'font-lock-face 'bold) ": ")
+      (package--print-help-section "Homepage")
       (help-insert-xref-button homepage 'help-url homepage)
       (insert "\n"))
     (when keywords
-      (insert "   " (propertize "Keywords" 'font-lock-face 'bold) ": ")
+      (package--print-help-section "Keywords")
       (dolist (k keywords)
         (package-make-button
          k
@@ -2290,24 +2307,23 @@ will be deleted."
                                (if bi (list (package--from-builtin bi))))))
            (other-pkgs (delete desc all-pkgs)))
       (when other-pkgs
-        (insert "    " (propertize "Other versions" 'font-lock-face 'bold) ": "
-                (mapconcat
-                 (lambda (opkg)
-                   (let* ((ov (package-desc-version opkg))
-                          (dir (package-desc-dir opkg))
-                          (from (or (package-desc-archive opkg)
-                                    (if (stringp dir) "installed" dir))))
-                     (if (not ov) (format "%s" from)
-                       (format "%s (%s)"
-                               (make-text-button (package-version-join ov) nil
-                                                 'font-lock-face 'link
-                                                 'follow-link t
-                                                 'action
-                                                 (lambda (_button)
-                                                   (describe-package opkg)))
-                               from))))
-                 other-pkgs ", ")
-                ".\n")))
+        (package--print-help-section "Other versions"
+          (mapconcat (lambda (opkg)
+                       (let* ((ov (package-desc-version opkg))
+                              (dir (package-desc-dir opkg))
+                              (from (or (package-desc-archive opkg)
+                                        (if (stringp dir) "installed" dir))))
+                         (if (not ov) (format "%s" from)
+                           (format "%s (%s)"
+                                   (make-text-button (package-version-join ov) 
nil
+                                                     'font-lock-face 'link
+                                                     'follow-link t
+                                                     'action
+                                                     (lambda (_button)
+                                                       (describe-package 
opkg)))
+                                   from))))
+                     other-pkgs ", ")
+          ".")))
 
     (insert "\n")
 
@@ -2350,16 +2366,16 @@ will be deleted."
 
 (defun package-install-button-action (button)
   (let ((pkg-desc (button-get button 'package-desc)))
-    (when (y-or-n-p (format "Install package `%s'? "
-                            (package-desc-full-name pkg-desc)))
+    (when (y-or-n-p (format-message "Install package ‘%s’? "
+                                    (package-desc-full-name pkg-desc)))
       (package-install pkg-desc nil)
       (revert-buffer nil t)
       (goto-char (point-min)))))
 
 (defun package-delete-button-action (button)
   (let ((pkg-desc (button-get button 'package-desc)))
-    (when (y-or-n-p (format "Delete package `%s'? "
-                      (package-desc-full-name pkg-desc)))
+    (when (y-or-n-p (format-message "Delete package ‘%s’? "
+                                    (package-desc-full-name pkg-desc)))
       (package-delete pkg-desc)
       (revert-buffer nil t)
       (goto-char (point-min)))))
@@ -2375,15 +2391,14 @@ will be deleted."
                                 :background "light grey"
                                 :foreground "black")
                        'link)))
-    (apply 'insert-text-button button-text 'font-lock-face button-face 
'follow-link t
+    (apply 'insert-text-button button-text 'face button-face 'follow-link t
            props)))
 
 
 ;;;; Package menu mode.
 
 (defvar package-menu-mode-map
-  (let ((map (make-sparse-keymap))
-        (menu-map (make-sparse-keymap "Package")))
+  (let ((map (make-sparse-keymap)))
     (set-keymap-parent map tabulated-list-mode-map)
     (define-key map "\C-m" 'package-menu-describe-package)
     (define-key map "u" 'package-menu-mark-unmark)
@@ -2399,60 +2414,41 @@ will be deleted."
     (define-key map "H" #'package-menu-hide-package)
     (define-key map "?" 'package-menu-describe-package)
     (define-key map "(" #'package-menu-toggle-hiding)
-    (define-key map [menu-bar package-menu] (cons "Package" menu-map))
-    (define-key menu-map [mq]
-      '(menu-item "Quit" quit-window
-                  :help "Quit package selection"))
-    (define-key menu-map [s1] '("--"))
-    (define-key menu-map [mn]
-      '(menu-item "Next" next-line
-                  :help "Next Line"))
-    (define-key menu-map [mp]
-      '(menu-item "Previous" previous-line
-                  :help "Previous Line"))
-    (define-key menu-map [s2] '("--"))
-    (define-key menu-map [mu]
-      '(menu-item "Unmark" package-menu-mark-unmark
-                  :help "Clear any marks on a package and move to the next 
line"))
-    (define-key menu-map [munm]
-      '(menu-item "Unmark Backwards" package-menu-backup-unmark
-                  :help "Back up one line and clear any marks on that 
package"))
-    (define-key menu-map [md]
-      '(menu-item "Mark for Deletion" package-menu-mark-delete
-                  :help "Mark a package for deletion and move to the next 
line"))
-    (define-key menu-map [mi]
-      '(menu-item "Mark for Install" package-menu-mark-install
-                  :help "Mark a package for installation and move to the next 
line"))
-    (define-key menu-map [mupgrades]
-      '(menu-item "Mark Upgradable Packages" package-menu-mark-upgrades
-                  :help "Mark packages that have a newer version for 
upgrading"))
-    (define-key menu-map [s3] '("--"))
-    (define-key menu-map [mf]
-      '(menu-item "Filter Package List..." package-menu-filter
-                  :help "Filter package selection (q to go back)"))
-    (define-key menu-map [mg]
-      '(menu-item "Update Package List" revert-buffer
-                  :help "Update the list of packages"))
-    (define-key menu-map [mr]
-      '(menu-item "Refresh Package List" package-menu-refresh
-                  :help "Download the ELPA archive"))
-    (define-key menu-map [s4] '("--"))
-    (define-key menu-map [mt]
-      '(menu-item "Mark Obsolete Packages" 
package-menu-mark-obsolete-for-deletion
-                  :help "Mark all obsolete packages for deletion"))
-    (define-key menu-map [mx]
-      '(menu-item "Execute Actions" package-menu-execute
-                  :help "Perform all the marked actions"))
-    (define-key menu-map [s5] '("--"))
-    (define-key menu-map [mh]
-      '(menu-item "Help" package-menu-quick-help
-                  :help "Show short key binding help for package-menu-mode"))
-    (define-key menu-map [mc]
-      '(menu-item "Describe Package" package-menu-describe-package
-                  :help "Display information about this package"))
     map)
   "Local keymap for `package-menu-mode' buffers.")
 
+(easy-menu-define package-menu-mode-menu package-menu-mode-map
+  "Menu for `package-menu-mode'."
+  `("Package"
+    ["Describe Package" package-menu-describe-package :help "Display 
information about this package"]
+    ["Help" package-menu-quick-help :help "Show short key binding help for 
package-menu-mode"]
+    "--"
+    ["Refresh Package List" package-menu-refresh
+     :help "Redownload the ELPA archive"
+     :active (not package--downloads-in-progress)]
+    ["Redisplay buffer" revert-buffer :help "Update the buffer with current 
list of packages"]
+    ["Execute Marked Actions" package-menu-execute :help "Perform all the 
marked actions"]
+
+    "--"
+    ["Mark All Available Upgrades" package-menu-mark-upgrades
+     :help "Mark packages that have a newer version for upgrading"
+     :active (not package--downloads-in-progress)]
+    ["Mark All Obsolete for Deletion" package-menu-mark-obsolete-for-deletion 
:help "Mark all obsolete packages for deletion"]
+    ["Mark for Install" package-menu-mark-install :help "Mark a package for 
installation and move to the next line"]
+    ["Mark for Deletion" package-menu-mark-delete :help "Mark a package for 
deletion and move to the next line"]
+    ["Unmark" package-menu-mark-unmark :help "Clear any marks on a package and 
move to the next line"]
+
+    "--"
+    ["Filter Package List" package-menu-filter :help "Filter package selection 
(q to go back)"]
+    ["Hide by Regexp" package-menu-hide-package :help "Permanently hide all 
packages matching a regexp"]
+    ["Display Older Versions" package-menu-toggle-hiding
+     :style toggle :selected (not package-menu--hide-packages)
+     :help "Display package even if a newer version is already installed"]
+
+    "--"
+    ["Quit" quit-window :help "Quit package selection"]
+    ["Customize" (customize-group 'package)]))
+
 (defvar package-menu--new-package-list nil
   "List of newly-available packages since `list-packages' was last called.")
 
@@ -2761,27 +2757,97 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])."
 (make-obsolete 'package-menu--print-info
                'package-menu--print-info-simple "25.1")
 
+
+;;; Package menu faces
+(defface package-name-face
+  '((t :inherit link))
+  "Face used on package names in the package menu."
+  :version "25.1")
+
+(defface package-description-face
+  '((t :inherit default))
+  "Face used on package description summaries in the package menu."
+  :version "25.1")
+
+(defface package-status-built-in-face
+  '((t :inherit font-lock-builtin-face))
+  "Face used on the status and version of built-in packages."
+  :version "25.1")
+
+(defface package-status-external-face
+  '((t :inherit package-status-builtin-face))
+  "Face used on the status and version of external packages."
+  :version "25.1")
+
+(defface package-status-available-face
+  '((t :inherit default))
+  "Face used on the status and version of available packages."
+  :version "25.1")
+
+(defface package-status-new-face
+  '((t :inherit (bold package-status-available-face)))
+  "Face used on the status and version of new packages."
+  :version "25.1")
+
+(defface package-status-held-face
+  '((t :inherit font-lock-constant-face))
+  "Face used on the status and version of held packages."
+  :version "25.1")
+
+(defface package-status-disabled-face
+  '((t :inherit font-lock-warning-face))
+  "Face used on the status and version of disabled packages."
+  :version "25.1")
+
+(defface package-status-installed-face
+  '((t :inherit font-lock-comment-face))
+  "Face used on the status and version of installed packages."
+  :version "25.1")
+
+(defface package-status-dependency-face
+  '((t :inherit package-status-installed-face))
+  "Face used on the status and version of dependency packages."
+  :version "25.1")
+
+(defface package-status-unsigned-face
+  '((t :inherit font-lock-warning-face))
+  "Face used on the status and version of unsigned packages."
+  :version "25.1")
+
+(defface package-status-incompat-face
+  '((t :inherit font-lock-comment-face))
+  "Face used on the status and version of incompat packages."
+  :version "25.1")
+
+(defface package-status-avail-obso-face
+  '((t :inherit package-status-incompat-face))
+  "Face used on the status and version of avail-obso packages."
+  :version "25.1")
+
+
+;;; Package menu printing
 (defun package-menu--print-info-simple (pkg)
   "Return a package entry suitable for `tabulated-list-entries'.
 PKG is a package-desc object.
 Return (PKG-DESC [NAME VERSION STATUS DOC])."
   (let* ((status  (package-desc-status pkg))
          (face (pcase status
-                 (`"built-in"  'font-lock-builtin-face)
-                 (`"external"  'font-lock-builtin-face)
-                 (`"available" 'default)
-                 (`"avail-obso" 'font-lock-comment-face)
-                 (`"new"       'bold)
-                 (`"held"      'font-lock-constant-face)
-                 (`"disabled"  'font-lock-warning-face)
-                 (`"installed" 'font-lock-comment-face)
-                 (`"dependency" 'font-lock-comment-face)
-                 (`"unsigned"  'font-lock-warning-face)
-                 (`"incompat"  'font-lock-comment-face)
+                 (`"built-in"  'package-status-built-in-face)
+                 (`"external"  'package-status-external-face)
+                 (`"available" 'package-status-available-face)
+                 (`"avail-obso" 'package-status-avail-obso-face)
+                 (`"new"       'package-status-new-face)
+                 (`"held"      'package-status-held-face)
+                 (`"disabled"  'package-status-disabled-face)
+                 (`"installed" 'package-status-installed-face)
+                 (`"dependency" 'package-status-dependency-face)
+                 (`"unsigned"  'package-status-unsigned-face)
+                 (`"incompat"  'package-status-incompat-face)
                  (_            'font-lock-warning-face)))) ; obsolete.
     (list pkg
           `[(,(symbol-name (package-desc-name pkg))
-             face link
+             face package-name-face
+             font-lock-face package-name-face
              follow-link t
              package-desc ,pkg
              action package-menu-describe-package)
@@ -2792,7 +2858,8 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])."
             ,@(if (cdr package-archives)
                   (list (propertize (or (package-desc-archive pkg) "")
                                     'font-lock-face face)))
-            ,(package-desc-summary pkg)])))
+            ,(propertize (package-desc-summary pkg)
+                         'font-lock-face 'package-description-face)])))
 
 (defvar package-menu--old-archive-contents nil
   "`package-archive-contents' before the latest refresh.")
@@ -2826,8 +2893,8 @@ If optional arg BUTTON is non-nil, describe its 
associated package."
            (cl-remove-if-not (lambda (e) (string-match re (symbol-name (car 
e))))
                              package-archive-contents)))
       (message (substitute-command-keys
-                (concat "Hiding %s packages, type 
`\\[package-menu-toggle-hiding]'"
-                        " to toggle or `\\[customize-variable] RET 
package-hidden-regexps'"
+                (concat "Hiding %s packages, type 
‘\\[package-menu-toggle-hiding]’"
+                        " to toggle or ‘\\[customize-variable] RET 
package-hidden-regexps’"
                         " to customize it"))
         (length hidden)))))
 
@@ -3011,8 +3078,8 @@ prompt (see `package-menu--prompt-transaction-p')."
       (length packages)
       (mapconcat #'package-desc-full-name packages ", ")))
    ;; Exactly 1
-   (t (format "package `%s'"
-        (package-desc-full-name (car packages))))))
+   (t (format-message "package ‘%s’"
+                      (package-desc-full-name (car packages))))))
 
 (defun package-menu--prompt-transaction-p (delete install upgrade)
   "Prompt the user about DELETE, INSTALL, and UPGRADE.
@@ -3067,7 +3134,7 @@ objects removed."
       (condition-case-unless-debug err
           (let ((inhibit-message package-menu-async))
             (package-delete elt nil 'nosave))
-        (error (message "Error trying to delete `%s': %S"
+        (error (message "Error trying to delete ‘%s’: %S"
                  (package-desc-full-name elt)
                  err))))))
 
@@ -3128,7 +3195,8 @@ Optional argument NOQUERY non-nil means do not ask the 
user to confirm."
             (if-let ((removable (package--removable-packages)))
                 (message "Package menu: Operation finished.  %d packages %s"
                   (length removable)
-                  "are no longer needed, type `M-x package-autoremove' to 
remove them")
+                  (substitute-command-keys
+                   "are no longer needed, type `\\[package-autoremove]' to 
remove them"))
               (message (replace-regexp-in-string "__" "ed" message-template)
                 "finished"))))))))
 
@@ -3197,7 +3265,7 @@ Store this list in `package-menu--new-package-list'."
 (defun package-menu--find-and-notify-upgrades ()
   "Notify the user of upgradable packages."
   (when-let ((upgrades (package-menu--find-upgrades)))
-    (message "%d package%s can be upgraded; type `%s' to mark %s for 
upgrading."
+    (message "%d package%s can be upgraded; type ‘%s’ to mark %s for 
upgrading."
       (length upgrades)
       (if (= (length upgrades) 1) "" "s")
       (substitute-command-keys "\\[package-menu-mark-upgrades]")
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 50a2507..5fe36bb 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -115,8 +115,8 @@ Patterns can take the following forms:
   SYMBOL       matches anything and binds it to SYMBOL.
   (or PAT...)  matches if any of the patterns matches.
   (and PAT...) matches if all the patterns match.
-  'VAL         matches if the object is `equal' to VAL
-  ATOM         is a shorthand for 'ATOM.
+  \\='VAL              matches if the object is `equal' to VAL
+  ATOM         is a shorthand for \\='ATOM.
                   ATOM can be a keyword, an integer, or a string.
   (pred FUN)   matches if FUN applied to the object returns non-nil.
   (guard BOOLEXP)      matches if BOOLEXP evaluates to non-nil.
@@ -197,7 +197,7 @@ Currently, the following patterns are provided this way:"
          (pcase--dontwarn-upats (cons x pcase--dontwarn-upats)))
     (pcase--expand
      ;; FIXME: Could we add the FILE:LINE data in the error message?
-     exp (append cases `((,x (error "No clause matching `%S'" ,x)))))))
+     exp (append cases `((,x (error "No clause matching ‘%S’" ,x)))))))
 
 ;;;###autoload
 (defmacro pcase-lambda (lambda-list &rest body)
@@ -775,7 +775,7 @@ Otherwise, it defers to REST which is a list of branches of 
the form
         (let ((code (pcase--u1 matches code vars rest)))
           (if (eq upat '_) code
             (macroexp--warn-and-return
-             "Pattern t is deprecated.  Use `_' instead"
+             "Pattern t is deprecated.  Use ‘_’ instead"
              code))))
        ((eq upat 'pcase--dontcare) :pcase--dontcare)
        ((memq (car-safe upat) '(guard pred))
@@ -860,7 +860,7 @@ Otherwise, it defers to REST which is a list of branches of 
the form
                      (pcase--u rest))
                    vars
                    (list `((and . ,matches) ,code . ,vars))))
-       (t (error "Unknown pattern `%S'" upat)))))
+       (t (error "Unknown pattern ‘%S’" upat)))))
    (t (error "Incorrect MATCH %S" (car matches)))))
 
 (def-edebug-spec
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index a499b03..de1f6d1 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -458,7 +458,7 @@ matching parts of the target buffer will be highlighted."
   (setq reb-subexp-mode t)
   (reb-update-modestring)
   (use-local-map reb-subexp-mode-map)
-  (message "`0'-`9' to display subexpressions  `q' to quit subexp mode"))
+  (message "‘0’-‘9’ to display subexpressions  ‘q’ to quit subexp mode"))
 
 (defun reb-show-subexp (subexp &optional pause)
   "Visually show limit of subexpression SUBEXP of recent search.
diff --git a/lisp/emacs-lisp/ring.el b/lisp/emacs-lisp/ring.el
index 2447dfa..8badac3 100644
--- a/lisp/emacs-lisp/ring.el
+++ b/lisp/emacs-lisp/ring.el
@@ -175,14 +175,14 @@ Comparison is done via `equal'.  The index is 0-based."
   "Return the next item in the RING, after ITEM.
 Raise error if ITEM is not in the RING."
   (let ((curr-index (ring-member ring item)))
-    (unless curr-index (error "Item is not in the ring: `%s'" item))
+    (unless curr-index (error "Item is not in the ring: ‘%s’" item))
     (ring-ref ring (ring-plus1 curr-index (ring-length ring)))))
 
 (defun ring-previous (ring item)
   "Return the previous item in the RING, before ITEM.
 Raise error if ITEM is not in the RING."
   (let ((curr-index (ring-member ring item)))
-    (unless curr-index (error "Item is not in the ring: `%s'" item))
+    (unless curr-index (error "Item is not in the ring: ‘%s’" item))
     (ring-ref ring (ring-minus1 curr-index (ring-length ring)))))
 
 (defun ring-extend (ring x)
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 5202106..7b0de6e 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -324,7 +324,7 @@ a standalone symbol."
 (defun rx-check (form)
   "Check FORM according to its car's parsing info."
   (unless (listp form)
-    (error "rx `%s' needs argument(s)" form))
+    (error "rx ‘%s’ needs argument(s)" form))
   (let* ((rx (rx-info (car form) 'head))
         (nargs (1- (length form)))
         (min-args (nth 1 rx))
@@ -332,16 +332,16 @@ a standalone symbol."
         (type-pred (nth 3 rx)))
     (when (and (not (null min-args))
               (< nargs min-args))
-      (error "rx form `%s' requires at least %d args"
+      (error "rx form ‘%s’ requires at least %d args"
             (car form) min-args))
     (when (and (not (null max-args))
               (> nargs max-args))
-      (error "rx form `%s' accepts at most %d args"
+      (error "rx form ‘%s’ accepts at most %d args"
             (car form) max-args))
     (when (not (null type-pred))
       (dolist (sub-form (cdr form))
        (unless (funcall type-pred sub-form)
-         (error "rx form `%s' requires args satisfying `%s'"
+         (error "rx form ‘%s’ requires args satisfying ‘%s’"
                 (car form) type-pred))))))
 
 
@@ -395,7 +395,7 @@ FORM is of the form `(and FORM1 ...)'."
 (defun rx-anything (form)
   "Match any character."
   (if (consp form)
-      (error "rx `anything' syntax error: %s" form))
+      (error "rx ‘anything’ syntax error: %s" form))
   (rx-or (list 'or 'not-newline ?\n)))
 
 
@@ -452,7 +452,7 @@ Only both edges of each range is checked."
   (let ((i 0)
        c1 c2 l)
     (if (= 0 (length str))
-       (error "String arg for Rx `any' must not be empty"))
+       (error "String arg for Rx ‘any’ must not be empty"))
     (while (string-match ".-." str i)
       ;; string before range: convert it to characters
       (if (< i (match-beginning 0))
@@ -482,13 +482,13 @@ Only both edges of each range is checked."
                          (error nil))))
        (if (or (null translation)
               (null (string-match "\\`\\[\\[:[-a-z]+:\\]\\]\\'" translation)))
-          (error "Invalid char class `%s' in Rx `any'" arg))
+          (error "Invalid char class ‘%s’ in Rx ‘any’" arg))
        (list (substring translation 1 -1)))) ; strip outer brackets
     ((and (integerp (car-safe arg)) (integerp (cdr-safe arg)))
      (list arg))
     ((stringp arg) (rx-check-any-string arg))
     ((error
-      "rx `any' requires string, character, char pair or char class args"))))
+      "rx ‘any’ requires string, character, char pair or char class args"))))
 
 
 (defun rx-any (form)
@@ -581,7 +581,7 @@ ARG is optional."
              (eq arg 'word-boundary)
              (and (consp arg)
                   (memq (car arg) '(not any in syntax category))))
-    (error "rx `not' syntax error: %s" arg))
+    (error "rx ‘not’ syntax error: %s" arg))
   t)
 
 
@@ -640,7 +640,7 @@ If SKIP is non-nil, allow that number of items after the 
head, i.e.
   (setq form (rx-trans-forms form 1))
   (unless (and (integerp (nth 1 form))
               (> (nth 1 form) 0))
-    (error "rx `=' requires positive integer first arg"))
+    (error "rx ‘=’ requires positive integer first arg"))
   (format "%s\\{%d\\}" (rx-form (nth 2 form) '*) (nth 1 form)))
 
 
@@ -650,7 +650,7 @@ If SKIP is non-nil, allow that number of items after the 
head, i.e.
   (setq form (rx-trans-forms form 1))
   (unless (and (integerp (nth 1 form))
               (> (nth 1 form) 0))
-    (error "rx `>=' requires positive integer first arg"))
+    (error "rx ‘>=’ requires positive integer first arg"))
   (format "%s\\{%d,\\}" (rx-form (nth 2 form) '*) (nth 1 form)))
 
 
@@ -671,14 +671,14 @@ FORM is either `(repeat N FORM1)' or `(repeat N M 
FORMS...)'."
   (cond ((= (length form) 3)
         (unless (and (integerp (nth 1 form))
                      (> (nth 1 form) 0))
-          (error "rx `repeat' requires positive integer first arg"))
+          (error "rx ‘repeat’ requires positive integer first arg"))
         (format "%s\\{%d\\}" (rx-form (nth 2 form) '*) (nth 1 form)))
        ((or (not (integerp (nth 2 form)))
             (< (nth 2 form) 0)
             (not (integerp (nth 1 form)))
             (< (nth 1 form) 0)
             (< (nth 2 form) (nth 1 form)))
-        (error "rx `repeat' range error"))
+        (error "rx ‘repeat’ range error"))
        (t
         (format "%s\\{%d,%d\\}" (rx-form (nth 3 form) '*)
                 (nth 1 form) (nth 2 form)))))
@@ -713,7 +713,7 @@ FORM is either `(repeat N FORM1)' or `(repeat N M 
FORMS...)'."
 (defun rx-check-backref (arg)
   "Check arg ARG for Rx `backref'."
   (or (and (integerp arg) (>= arg 1) (<= arg 9))
-      (error "rx `backref' requires numeric 1<=arg<=9: %s" arg)))
+      (error "rx ‘backref’ requires numeric 1<=arg<=9: %s" arg)))
 
 (defun rx-kleene (form)
   "Parse and produce code from FORM.
@@ -786,7 +786,7 @@ of all atomic regexps."
           (if (= 1 (length name))
               (setq syntax (aref name 0))))))
       (unless syntax
-       (error "Unknown rx syntax `%s'" sym)))
+       (error "Unknown rx syntax ‘%s’" sym)))
     (format "\\s%c" syntax)))
 
 
@@ -794,7 +794,7 @@ of all atomic regexps."
   "Check the argument FORM of a `(category FORM)'."
   (unless (or (integerp form)
              (cdr (assq form rx-categories)))
-    (error "Unknown category `%s'" form))
+    (error "Unknown category ‘%s’" form))
   t)
 
 
@@ -815,9 +815,9 @@ of all atomic regexps."
 
 (defun rx-greedy (form)
   "Parse and produce code from FORM.
-If FORM is '(minimal-match FORM1)', non-greedy versions of `*',
+If FORM is `(minimal-match FORM1)', non-greedy versions of `*',
 `+', and `?' operators will be used in FORM1.  If FORM is
-'(maximal-match FORM1)', greedy operators will be used."
+`(maximal-match FORM1)', greedy operators will be used."
   (rx-check form)
   (let ((rx-greedy-flag (eq (car form) 'maximal-match)))
     (rx-form (cadr form) rx-parent)))
@@ -846,16 +846,16 @@ shy groups around the result and some more in other 
functions."
       (cond ((stringp info)
              info)
             ((null info)
-             (error "Unknown rx form `%s'" form))
+             (error "Unknown rx form ‘%s’" form))
             (t
              (funcall (nth 0 info) form)))))
    ((consp form)
     (let ((info (rx-info (car form) 'head)))
       (unless (consp info)
-        (error "Unknown rx form `%s'" (car form)))
+        (error "Unknown rx form ‘%s’" (car form)))
       (funcall (nth 0 info) form)))
    (t
-    (error "rx syntax error at `%s'" form))))
+    (error "rx syntax error at ‘%s’" form))))
 
 
 ;;;###autoload
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 9eed36e..a17b0a8 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -4,7 +4,7 @@
 
 ;; Author: Nicolas Petton <address@hidden>
 ;; Keywords: sequences
-;; Version: 1.8
+;; Version: 2.0
 ;; Package: seq
 
 ;; Maintainer: address@hidden
@@ -38,10 +38,27 @@
 ;; the sequence as their second argument.  All other functions take
 ;; the sequence as their first argument.
 ;;
+;; While seq.el version 1.8 is in GNU ELPA for convenience, seq.el
+;; version 2.0 requires Emacs>=25.1.
+;;
+;; seq.el can be extended to support new type of sequences.  Here are
+;; the generic functions that must be implemented by new seq types:
+;; - `seq-elt'
+;; - `seq-length'
+;; - `seq-do'
+;; - `seq-p'
+;; - `seq-subseq'
+;; - `seq-into-sequence'
+;; - `seq-copy'
+;; - `seq-into'
+;;
 ;; All functions are tested in test/automated/seq-tests.el
 
 ;;; Code:
 
+(eval-when-compile (require 'cl-generic))
+(require 'cl-extra) ;; for cl-subseq
+
 (defmacro seq-doseq (spec &rest body)
   "Loop over a sequence.
 Similar to `dolist' but can be applied to lists, strings, and vectors.
@@ -50,91 +67,162 @@ Evaluate BODY with VAR bound to each element of SEQ, in 
turn.
 
 \(fn (VAR SEQ) BODY...)"
   (declare (indent 1) (debug ((symbolp form &optional form) body)))
-  (let ((length (make-symbol "length"))
-        (seq (make-symbol "seq"))
-        (index (make-symbol "index")))
-    `(let* ((,seq ,(cadr spec))
-            (,length (if (listp ,seq) nil (seq-length ,seq)))
-            (,index (if ,length 0 ,seq)))
-       (while (if ,length
-                  (< ,index ,length)
-                (consp ,index))
-         (let ((,(car spec) (if ,length
-                                (prog1 (seq-elt ,seq ,index)
-                                  (setq ,index (+ ,index 1)))
-                              (pop ,index))))
-           ,@body)))))
-
-(if (fboundp 'pcase-defmacro)
-    ;; Implementation of `seq-let' based on a `pcase'
-    ;; pattern. Requires Emacs>=25.1.
-    (progn
-      (pcase-defmacro seq (&rest args)
-        "pcase pattern matching sequence elements.
+  `(seq-do (lambda (,(car spec))
+             ,@body)
+           ,(cadr spec)))
+
+(pcase-defmacro seq (&rest args)
+  "pcase pattern matching sequence elements.
 Matches if the object is a sequence (list, string or vector), and
 binds each element of ARGS to the corresponding element of the
 sequence."
-        `(and (pred seq-p)
-              ,@(seq--make-pcase-bindings args)))
+  `(and (pred seq-p)
+        ,@(seq--make-pcase-bindings args)))
 
-      (defmacro seq-let (args seq &rest body)
-        "Bind the variables in ARGS to the elements of SEQ then evaluate BODY.
+(defmacro seq-let (args seq &rest body)
+  "Bind the variables in ARGS to the elements of SEQ then evaluate BODY.
 
 ARGS can also include the `&rest' marker followed by a variable
 name to be bound to the rest of SEQ."
-        (declare (indent 2) (debug t))
-        `(pcase-let ((,(seq--make-pcase-patterns args) ,seq))
-           ,@body)))
+  (declare (indent 2) (debug t))
+  `(pcase-let ((,(seq--make-pcase-patterns args) ,seq))
+     ,@body))
+
+
+;;; Basic seq functions that have to be implemented by new seq types
+(cl-defgeneric seq-elt (seq n)
+  "Return the element of SEQ at index N."
+  (elt seq n))
+
+;; Default gv setters for `seq-elt'.
+;; It can be a good idea for new sequence implementations to provide a
+;; "gv-setter" for `seq-elt'.
+(cl-defmethod (setf seq-elt) (store (seq array) n)
+  (aset seq n store))
+
+(cl-defmethod (setf seq-elt) (store (seq cons) n)
+  (setcar (nthcdr n seq) store))
+
+(cl-defgeneric seq-length (seq)
+  "Return the length of the sequence SEQ."
+  (length seq))
+
+(cl-defgeneric seq-do (function seq)
+  "Apply FUNCTION to each element of SEQ, presumably for side effects.
+Return SEQ."
+  (mapc function seq))
 
-  ;; Implementation of `seq-let' compatible with Emacs<25.1.
-  (defmacro seq-let (args seq &rest body)
-    "Bind the variables in ARGS to the elements of SEQ then evaluate BODY.
+(defalias 'seq-each #'seq-do)
 
-ARGS can also include the `&rest' marker followed by a variable
-name to be bound to the rest of SEQ."
-    (declare (indent 2) (debug t))
-    (let ((seq-var (make-symbol "seq")))
-      `(let* ((,seq-var ,seq)
-              ,@(seq--make-bindings args seq-var))
-         ,@body))))
+(cl-defgeneric seq-p (seq)
+  "Return non-nil if SEQ is a sequence, nil otherwise."
+  (sequencep seq))
 
-(defun seq-drop (seq n)
+(cl-defgeneric seq-copy (seq)
+  "Return a shallow copy of SEQ."
+  (copy-sequence seq))
+
+(cl-defgeneric seq-subseq (seq start &optional end)
+  "Return the subsequence of SEQ from START to END.
+If END is omitted, it defaults to the length of the sequence.
+If START or END is negative, it counts from the end.
+Signal an error if START or END are outside of the sequence (i.e
+too large if positive or too small if negative)."
+  (cl-subseq seq start end))
+
+
+(cl-defgeneric seq-map (function seq)
+  "Return the result of applying FUNCTION to each element of SEQ."
+  (let (result)
+    (seq-do (lambda (elt)
+              (push (funcall function elt) result))
+            seq)
+    (nreverse result)))
+
+;; faster implementation for sequences (sequencep)
+(cl-defmethod seq-map (function (seq sequence))
+  (mapcar function seq))
+
+(cl-defgeneric seq-drop (seq n)
   "Return a subsequence of SEQ without its first N elements.
 The result is a sequence of the same type as SEQ.
 
 If N is a negative integer or zero, SEQ is returned."
   (if (<= n 0)
       seq
-    (if (listp seq)
-        (seq--drop-list seq n)
-      (let ((length (seq-length seq)))
-        (seq-subseq seq (min n length) length)))))
+    (let ((length (seq-length seq)))
+      (seq-subseq seq (min n length) length))))
 
-(defun seq-take (seq n)
+(cl-defgeneric seq-take (seq n)
   "Return a subsequence of SEQ with its first N elements.
 The result is a sequence of the same type as SEQ.
 
 If N is a negative integer or zero, an empty sequence is
 returned."
-  (if (listp seq)
-      (seq--take-list seq n)
-    (seq-subseq seq 0 (min (max n 0) (seq-length seq)))))
+  (seq-subseq seq 0 (min (max n 0) (seq-length seq))))
 
-(defun seq-drop-while (pred seq)
+(cl-defgeneric seq-drop-while (pred seq)
   "Return a sequence from the first element for which (PRED element) is nil in 
SEQ.
 The result is a sequence of the same type as SEQ."
-  (if (listp seq)
-      (seq--drop-while-list pred seq)
-    (seq-drop seq (seq--count-successive pred seq))))
+  (seq-drop seq (seq--count-successive pred seq)))
 
-(defun seq-take-while (pred seq)
+(cl-defgeneric seq-take-while (pred seq)
   "Return the successive elements for which (PRED element) is non-nil in SEQ.
 The result is a sequence of the same type as SEQ."
-  (if (listp seq)
-      (seq--take-while-list pred seq)
-    (seq-take seq (seq--count-successive pred seq))))
+  (seq-take seq (seq--count-successive pred seq)))
+
+(cl-defgeneric seq-empty-p (seq)
+  "Return non-nil if the sequence SEQ is empty, nil otherwise."
+  (= 0 (seq-length seq)))
+
+(cl-defgeneric seq-sort (pred seq)
+  "Return a sorted sequence comparing using PRED the elements of SEQ.
+The result is a sequence of the same type as SEQ."
+  (let ((result (seq-sort pred (append seq nil))))
+    (seq-into result (type-of seq))))
+
+(cl-defmethod seq-sort (pred (list list))
+  (sort (seq-copy list) pred))
+
+(cl-defgeneric seq-reverse (seq)
+  "Return the reversed shallow copy of SEQ."
+  (let ((result '()))
+    (seq-map (lambda (elt)
+               (push elt result))
+             seq)
+    (seq-into result (type-of seq))))
+
+;; faster implementation for sequences (sequencep)
+(cl-defmethod seq-reverse ((seq sequence))
+  (reverse seq))
+
+(cl-defgeneric seq-concatenate (type &rest seqs)
+  "Concatenate, into a sequence of type TYPE, the sequences SEQS.
+TYPE must be one of following symbols: vector, string or list.
+
+\n(fn TYPE SEQUENCE...)"
+  (apply #'cl-concatenate type (seq-map #'seq-into-sequence seqs)))
+
+(cl-defgeneric seq-into-sequence (seq)
+  "Convert SEQ into a sequence.
 
-(defun seq-filter (pred seq)
+The default implementation is to signal an error if SEQ is not a
+sequence, specific functions should be implemented for new types
+of seq."
+  (unless (sequencep seq)
+    (error "Cannot convert %S into a sequence" seq))
+  seq)
+
+(cl-defgeneric seq-into (seq type)
+  "Convert the sequence SEQ into a sequence of type TYPE.
+TYPE can be one of the following symbols: vector, string or list."
+  (pcase type
+    (`vector (vconcat seq))
+    (`string (concat seq))
+    (`list (append seq nil))
+    (_ (error "Not a sequence type name: %S" type))))
+
+(cl-defgeneric seq-filter (pred seq)
   "Return a list of all the elements for which (PRED element) is non-nil in 
SEQ."
   (let ((exclude (make-symbol "exclude")))
     (delq exclude (seq-map (lambda (elt)
@@ -143,12 +231,12 @@ The result is a sequence of the same type as SEQ."
                                exclude))
                            seq))))
 
-(defun seq-remove (pred seq)
+(cl-defgeneric seq-remove (pred seq)
   "Return a list of all the elements for which (PRED element) is nil in SEQ."
   (seq-filter (lambda (elt) (not (funcall pred elt)))
               seq))
 
-(defun seq-reduce (function seq initial-value)
+(cl-defgeneric seq-reduce (function seq initial-value)
   "Reduce the function FUNCTION across SEQ, starting with INITIAL-VALUE.
 
 Return the result of calling FUNCTION with INITIAL-VALUE and the
@@ -164,7 +252,7 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not 
called."
         (setq acc (funcall function acc elt)))
       acc)))
 
-(defun seq-some-p (pred seq)
+(cl-defgeneric seq-some-p (pred seq)
   "Return any element for which (PRED element) is non-nil in SEQ, nil 
otherwise."
   (catch 'seq--break
     (seq-doseq (elt seq)
@@ -172,7 +260,7 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not 
called."
         (throw 'seq--break elt)))
     nil))
 
-(defun seq-every-p (pred seq)
+(cl-defgeneric seq-every-p (pred seq)
   "Return non-nil if (PRED element) is non-nil for all elements of the 
sequence SEQ."
   (catch 'seq--break
     (seq-doseq (elt seq)
@@ -180,7 +268,7 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not 
called."
           (throw 'seq--break nil)))
     t))
 
-(defun seq-count (pred seq)
+(cl-defgeneric seq-count (pred seq)
   "Return the number of elements for which (PRED element) is non-nil in SEQ."
   (let ((count 0))
     (seq-doseq (elt seq)
@@ -188,28 +276,14 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not 
called."
         (setq count (+ 1 count))))
     count))
 
-(defun seq-empty-p (seq)
-  "Return non-nil if the sequence SEQ is empty, nil otherwise."
-  (if (listp seq)
-      (null seq)
-    (= 0 (seq-length seq))))
-
-(defun seq-sort (pred seq)
-  "Return a sorted sequence comparing using PRED the elements of SEQ.
-The result is a sequence of the same type as SEQ."
-  (if (listp seq)
-      (sort (seq-copy seq) pred)
-    (let ((result (seq-sort pred (append seq nil))))
-      (seq-into result (type-of seq)))))
-
-(defun seq-contains-p (seq elt &optional testfn)
+(cl-defgeneric seq-contains-p (seq elt &optional testfn)
   "Return the first element in SEQ that equals to ELT.
 Equality is defined by TESTFN if non-nil or by `equal' if nil."
   (seq-some-p (lambda (e)
                 (funcall (or testfn #'equal) elt e))
               seq))
 
-(defun seq-uniq (seq &optional testfn)
+(cl-defgeneric seq-uniq (seq &optional testfn)
   "Return a list of the elements of SEQ with duplicates removed.
 TESTFN is used to compare elements, or `equal' if TESTFN is nil."
   (let ((result '()))
@@ -218,46 +292,13 @@ TESTFN is used to compare elements, or `equal' if TESTFN 
is nil."
         (setq result (cons elt result))))
     (nreverse result)))
 
-(defun seq-subseq (seq start &optional end)
-  "Return the subsequence of SEQ from START to END.
-If END is omitted, it defaults to the length of the sequence.
-If START or END is negative, it counts from the end."
-  (cond ((or (stringp seq) (vectorp seq)) (substring seq start end))
-        ((listp seq)
-         (let (len (errtext (format "Bad bounding indices: %s, %s" start end)))
-           (and end (< end 0) (setq end (+ end (setq len (seq-length seq)))))
-           (if (< start 0) (setq start (+ start (or len (setq len (seq-length 
seq))))))
-           (when (> start 0)
-             (setq seq (nthcdr (1- start) seq))
-             (or seq (error "%s" errtext))
-             (setq seq (cdr seq)))
-           (if end
-               (let ((res nil))
-                 (while (and (>= (setq end (1- end)) start) seq)
-                   (push (pop seq) res))
-                 (or (= (1+ end) start) (error "%s" errtext))
-                 (nreverse res))
-             (seq-copy seq))))
-        (t (error "Unsupported sequence: %s" seq))))
-
-(defun seq-concatenate (type &rest seqs)
-  "Concatenate, into a sequence of type TYPE, the sequences SEQS.
-TYPE must be one of following symbols: vector, string or list.
-
-\n(fn TYPE SEQUENCE...)"
-  (pcase type
-    (`vector (apply #'vconcat seqs))
-    (`string (apply #'concat seqs))
-    (`list (apply #'append (append seqs '(nil))))
-    (_ (error "Not a sequence type name: %S" type))))
-
-(defun seq-mapcat (function seq &optional type)
+(cl-defgeneric seq-mapcat (function seq &optional type)
   "Concatenate the result of applying FUNCTION to each element of SEQ.
 The result is a sequence of type TYPE, or a list if TYPE is nil."
   (apply #'seq-concatenate (or type 'list)
          (seq-map function seq)))
 
-(defun seq-partition (seq n)
+(cl-defgeneric seq-partition (seq n)
   "Return a list of the elements of SEQ grouped into sub-sequences of length N.
 The last sequence may contain less than N elements.  If N is a
 negative integer or 0, nil is returned."
@@ -268,7 +309,7 @@ negative integer or 0, nil is returned."
         (setq seq (seq-drop seq n)))
       (nreverse result))))
 
-(defun seq-intersection (seq1 seq2 &optional testfn)
+(cl-defgeneric seq-intersection (seq1 seq2 &optional testfn)
   "Return a list of the elements that appear in both SEQ1 and SEQ2.
 Equality is defined by TESTFN if non-nil or by `equal' if nil."
   (seq-reduce (lambda (acc elt)
@@ -278,7 +319,7 @@ Equality is defined by TESTFN if non-nil or by `equal' if 
nil."
               (seq-reverse seq1)
               '()))
 
-(defun seq-difference (seq1 seq2 &optional testfn)
+(cl-defgeneric seq-difference (seq1 seq2 &optional testfn)
   "Return a list of the elements that appear in SEQ1 but not in SEQ2.
 Equality is defined by TESTFN if non-nil or by `equal' if nil."
   (seq-reduce (lambda (acc elt)
@@ -288,7 +329,7 @@ Equality is defined by TESTFN if non-nil or by `equal' if 
nil."
               (seq-reverse seq1)
               '()))
 
-(defun seq-group-by (function seq)
+(cl-defgeneric seq-group-by (function seq)
   "Apply FUNCTION to each element of SEQ.
 Separate the elements of SEQ into an alist using the results as
 keys.  Keys are compared using `equal'."
@@ -303,70 +344,16 @@ keys.  Keys are compared using `equal'."
    (seq-reverse seq)
    nil))
 
-(defalias 'seq-reverse
-  (if (ignore-errors (reverse [1 2]))
-      #'reverse
-    (lambda (seq)
-      "Return the reversed copy of list, vector, or string SEQ.
-See also the function `nreverse', which is used more often."
-      (let ((result '()))
-        (seq-map (lambda (elt) (push elt result))
-                 seq)
-        (if (listp seq)
-            result
-          (seq-into result (type-of seq)))))))
-
-(defun seq-into (seq type)
-  "Convert the sequence SEQ into a sequence of type TYPE.
-TYPE can be one of the following symbols: vector, string or list."
-  (pcase type
-    (`vector (vconcat seq))
-    (`string (concat seq))
-    (`list (append seq nil))
-    (_ (error "Not a sequence type name: %S" type))))
-
-(defun seq-min (seq)
+(cl-defgeneric seq-min (seq)
   "Return the smallest element of SEQ.
 SEQ must be a sequence of numbers or markers."
   (apply #'min (seq-into seq 'list)))
 
-(defun seq-max (seq)
-    "Return the largest element of SEQ.
+(cl-defgeneric seq-max (seq)
+  "Return the largest element of SEQ.
 SEQ must be a sequence of numbers or markers."
   (apply #'max (seq-into seq 'list)))
 
-(defun seq--drop-list (list n)
-  "Return a list from LIST without its first N elements.
-This is an optimization for lists in `seq-drop'."
-  (while (and list (> n 0))
-    (setq list (cdr list)
-          n (1- n)))
-  list)
-
-(defun seq--take-list (list n)
-  "Return a list from LIST made of its first N elements.
-This is an optimization for lists in `seq-take'."
-  (let ((result '()))
-    (while (and list (> n 0))
-      (setq n (1- n))
-      (push (pop list) result))
-    (nreverse result)))
-
-(defun seq--drop-while-list (pred list)
-  "Return a list from the first element for which (PRED element) is nil in 
LIST.
-This is an optimization for lists in `seq-drop-while'."
-  (while (and list (funcall pred (car list)))
-    (setq list (cdr list)))
-  list)
-
-(defun seq--take-while-list (pred list)
-  "Return the successive elements for which (PRED element) is non-nil in LIST.
-This is an optimization for lists in `seq-take-while'."
-  (let ((result '()))
-    (while (and list (funcall pred (car list)))
-      (push (pop list) result))
-    (nreverse result)))
-
 (defun seq--count-successive (pred seq)
   "Return the number of successive elements for which (PRED element) is 
non-nil in SEQ."
   (let ((n 0)
@@ -403,52 +390,52 @@ This is an optimization for lists in `seq-take-while'."
                      elt))
                  args)))
 
-;; Helper function for the Backward-compatible version of `seq-let'
-;; for Emacs<25.1.
-(defun seq--make-bindings (args seq &optional bindings)
-  "Return a list of bindings of the variables in ARGS to the elements of a 
sequence.
-if BINDINGS is non-nil, append new bindings to it, and return
-BINDINGS."
-  (let ((index 0)
-        (rest-marker nil))
-    (seq-doseq (name args)
-      (unless rest-marker
-        (pcase name
-          ((pred seq-p)
-           (setq bindings (seq--make-bindings (seq--elt-safe args index)
-                                              `(seq--elt-safe ,seq ,index)
-                                              bindings)))
-          (`&rest
-           (progn (push `(,(seq--elt-safe args (1+ index))
-                          (seq-drop ,seq ,index))
-                        bindings)
-                  (setq rest-marker t)))
-          (_
-           (push `(,name (seq--elt-safe ,seq ,index)) bindings))))
-      (setq index (1+ index)))
-    bindings))
-
+;; TODO: make public?
 (defun seq--elt-safe (seq n)
   "Return element of SEQ at the index N.
 If no element is found, return nil."
-  (when (or (listp seq)
-            (and (sequencep seq)
-                 (> (seq-length seq) n)))
-    (seq-elt seq n)))
+  (ignore-errors (seq-elt seq n)))
+
+
+;;; Optimized implementations for lists
+
+(cl-defmethod seq-drop ((list list) n)
+  "Optimized implementation of `seq-drop' for lists."
+  (while (and list (> n 0))
+    (setq list (cdr list)
+          n (1- n)))
+  list)
+
+(cl-defmethod seq-take ((list list) n)
+  "Optimized implementation of `seq-take' for lists."
+  (let ((result '()))
+    (while (and list (> n 0))
+      (setq n (1- n))
+      (push (pop list) result))
+    (nreverse result)))
+
+(cl-defmethod seq-drop-while (pred (list list))
+  "Optimized implementation of `seq-drop-while' for lists"
+  (while (and list (funcall pred (car list)))
+    (setq list (cdr list)))
+  list)
+
+(cl-defmethod seq-drop-while (pred (list list))
+  "Optimized implementation of `seq-drop-while' for lists"
+  (while (and list (funcall pred (car list)))
+    (setq list (cdr list)))
+  list)
+
+(cl-defmethod seq-empty-p ((list list))
+  "Optimized implementation of `seq-empty-p' for lists."
+  (null list))
+
 
 (defun seq--activate-font-lock-keywords ()
   "Activate font-lock keywords for some symbols defined in seq."
   (font-lock-add-keywords 'emacs-lisp-mode
                           '("\\<seq-doseq\\>" "\\<seq-let\\>")))
 
-(defalias 'seq-copy #'copy-sequence)
-(defalias 'seq-elt #'elt)
-(defalias 'seq-length #'length)
-(defalias 'seq-do #'mapc)
-(defalias 'seq-each #'seq-do)
-(defalias 'seq-map #'mapcar)
-(defalias 'seq-p #'sequencep)
-
 (unless (fboundp 'elisp--font-lock-flush-elisp-buffers)
   ;; In Emacs≥25, (via elisp--font-lock-flush-elisp-buffers and a few others)
   ;; we automatically highlight macros.
diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el
index 59bf634..c7a95e4 100644
--- a/lisp/emacs-lisp/shadow.el
+++ b/lisp/emacs-lisp/shadow.el
@@ -213,7 +213,7 @@ For example, suppose `load-path' is set to
 
 and that each of these directories contains a file called XXX.el.  Then
 XXX.el in the site-lisp directory is referred to by all of:
-\(require 'XXX), (autoload .... \"XXX\"), (load-library \"XXX\") etc.
+\(require \\='XXX), (autoload .... \"XXX\"), (load-library \"XXX\") etc.
 
 The first XXX.el file prevents Emacs from seeing the second (unless
 the second is loaded explicitly via `load-file').
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 1bc5eb2..9678cfa 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -1198,6 +1198,21 @@ Comments are treated as spaces."
       (forward-comment (- (point)))
       (<= (point) bol))))
 
+(defun smie-indent--current-column ()
+  "Like `current-column', but if there's a comment before us, use that."
+  ;; This is used, so that when we align elements, we don't get
+  ;;    toto = { /* foo, */ a,
+  ;;                        b }
+  ;; but
+  ;;    toto = { /* foo, */ a,
+  ;;             b }
+  (let ((pos (point))
+        (lbp (line-beginning-position)))
+    (save-excursion
+      (unless (and (forward-comment -1) (>= (point) lbp))
+        (goto-char pos))
+      (current-column))))
+
 ;; Dynamically scoped.
 (defvar smie--parent) (defvar smie--after) (defvar smie--token)
 
@@ -1577,7 +1592,9 @@ should not be computed on the basis of the following 
token."
               ;; So we use a heuristic here, which is that we only use virtual
               ;; if the parent is tightly linked to the child token (they're
               ;; part of the same BNF rule).
-              (if (car parent) (current-column) (smie-indent-virtual)))))))))))
+              (if (car parent)
+                  (smie-indent--current-column)
+                (smie-indent-virtual)))))))))))
 
 (defun smie-indent-comment ()
   "Compute indentation of a comment."
@@ -1707,12 +1724,12 @@ should not be computed on the basis of the following 
token."
         ;; There's a previous element, and it's not special (it's not
         ;; the function), so let's just align with that one.
         (goto-char (car positions))
-        (current-column))
+        (smie-indent--current-column))
        ((cdr positions)
         ;; We skipped some args plus the function and bumped into something.
         ;; Align with the first arg.
         (goto-char (cadr positions))
-        (current-column))
+        (smie-indent--current-column))
        (positions
         ;; We're the first arg.
         (goto-char (car positions))
@@ -1720,7 +1737,7 @@ should not be computed on the basis of the following 
token."
            ;; We used to use (smie-indent-virtual), but that
            ;; doesn't seem right since it might then indent args less than
            ;; the function itself.
-           (current-column)))))))
+           (smie-indent--current-column)))))))
 
 (defvar smie-indent-functions
   '(smie-indent-fixindent smie-indent-bob smie-indent-close
@@ -2196,13 +2213,13 @@ One way to generate local rules is the command 
`smie-config-guess'."
     (let* ((existing (assq major-mode smie-config))
            (config
             (cond ((null existing)
-                   (message "Local rules saved in `smie-config'")
+                   (message "Local rules saved in ‘smie-config’")
                    smie-config--buffer-local)
                   ((y-or-n-p "Replace the existing mode's config? ")
-                   (message "Mode rules replaced in `smie-config'")
+                   (message "Mode rules replaced in ‘smie-config’")
                    smie-config--buffer-local)
                   ((y-or-n-p "Merge with existing mode's config? ")
-                   (message "Mode rules adjusted in `smie-config'")
+                   (message "Mode rules adjusted in ‘smie-config’")
                    (append smie-config--buffer-local (cdr existing)))
                   (t (error "Abort")))))
       (if existing
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index e6d451a..9637e42 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -90,7 +90,7 @@ threading."
   (when (> (length binding) 2)
     (signal
      'error
-     (cons "`let' bindings can have only one value-form" binding)))
+     (cons "‘let’ bindings can have only one value-form" binding)))
   binding)
 
 (defsubst internal--build-binding-value-form (binding prev-var)
diff --git a/lisp/emacs-lisp/tabulated-list.el 
b/lisp/emacs-lisp/tabulated-list.el
index cd61eb9..404dbd1 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -129,7 +129,7 @@ no entry at POS.  POS, if omitted or nil, defaults to 
point."
 TAG should be a string, with length <= `tabulated-list-padding'.
 If ADVANCE is non-nil, move forward by one line afterwards."
   (unless (stringp tag)
-    (error "Invalid argument to `tabulated-list-put-tag'"))
+    (error "Invalid argument to ‘tabulated-list-put-tag’"))
   (unless (> tabulated-list-padding 0)
     (error "Unable to tag the current line"))
   (save-excursion
diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el
index 110c63f..3e6039e 100644
--- a/lisp/emacs-lisp/testcover.el
+++ b/lisp/emacs-lisp/testcover.el
@@ -475,7 +475,7 @@ same value during coverage testing."
     (aset testcover-vector idx (cons '1value val)))
    ((not (and (eq (car-safe (aref testcover-vector idx)) '1value)
              (equal (cdr (aref testcover-vector idx)) val)))
-    (error "Value of form marked with `1value' does vary: %s" val)))
+    (error "Value of form marked with ‘1value’ does vary: %s" val)))
   val)
 
 
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 9ae11b7..0a0296f 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -324,7 +324,8 @@ This function is called, by name, directly by the C code."
               (apply (timer--function timer) (timer--args timer)))
           (error (message "Error running timer%s: %S"
                           (if (symbolp (timer--function timer))
-                              (format " `%s'" (timer--function timer)) "")
+                              (format-message " ‘%s’" (timer--function timer))
+                            "")
                           err)))
         (when (and retrigger
                    ;; If the timer's been canceled, don't "retrigger" it
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 44a9876..d729a9a 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -316,7 +316,7 @@ See also `warning-series', `warning-prefix-function' and
 (defun lwarn (type level message &rest args)
   "Display a warning message made from (format MESSAGE ARGS...).
 \\<special-mode-map>
-Aside from generating the message with `format',
+Aside from generating the message with `format-message',
 this is equivalent to `display-warning'.
 
 TYPE is the warning type: either a custom group name (a symbol),
@@ -332,15 +332,15 @@ LEVEL should be either :debug, :warning, :error, or 
:emergency
 :error     -- invalid data or circumstances.
 :warning   -- suspicious data or circumstances.
 :debug     -- info for debugging only."
-  (display-warning type (apply 'format message args) level))
+  (display-warning type (apply #'format-message message args) level))
 
 ;;;###autoload
 (defun warn (message &rest args)
   "Display a warning message made from (format MESSAGE ARGS...).
-Aside from generating the message with `format',
+Aside from generating the message with `format-message',
 this is equivalent to `display-warning', using
 `emacs' as the type and `:warning' as the level."
-  (display-warning 'emacs (apply 'format message args)))
+  (display-warning 'emacs (apply #'format-message message args)))
 
 (provide 'warnings)
 
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 5e1620d..4fe948a 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -3447,8 +3447,8 @@ controlled by the sign of prefix numeric value."
   (interactive)
   (setq viper-parse-sexp-ignore-comments
        (not viper-parse-sexp-ignore-comments))
-  (princ (format
-         "From now on, `%%' will %signore parentheses inside comment fields"
+  (princ (format-message
+         "From now on, ‘%%’ will %signore parentheses inside comment fields"
          (if viper-parse-sexp-ignore-comments "" "NOT "))))
 
 
@@ -3639,24 +3639,26 @@ the Emacs binding of `/'."
   (let (msg)
     (cond ((or (eq arg 1)
               (and (null arg)
-                   (y-or-n-p (format "Search style: '%s'.  Want '%s'? "
-                                     (if viper-case-fold-search
-                                         "case-insensitive" "case-sensitive")
-                                     (if viper-case-fold-search
-                                         "case-sensitive"
-                                       "case-insensitive")))))
+                   (y-or-n-p (format-message
+                               "Search style: ‘%s’.  Want ‘%s’? "
+                               (if viper-case-fold-search
+                                   "case-insensitive" "case-sensitive")
+                               (if viper-case-fold-search
+                                   "case-sensitive"
+                                 "case-insensitive")))))
           (setq viper-case-fold-search (null viper-case-fold-search))
           (if viper-case-fold-search
               (setq msg "Search becomes case-insensitive")
             (setq msg "Search becomes case-sensitive")))
          ((or (eq arg 2)
               (and (null arg)
-                   (y-or-n-p (format "Search style: '%s'.  Want '%s'? "
-                                     (if viper-re-search
-                                         "regexp-search" "vanilla-search")
-                                     (if viper-re-search
-                                         "vanilla-search"
-                                       "regexp-search")))))
+                   (y-or-n-p (format-message
+                               "Search style: ‘%s’.  Want ‘%s’? "
+                               (if viper-re-search
+                                   "regexp-search" "vanilla-search")
+                               (if viper-re-search
+                                   "vanilla-search"
+                                 "regexp-search")))))
           (setq viper-re-search (null viper-re-search))
           (if viper-re-search
               (setq msg "Search becomes regexp-style")
@@ -3986,8 +3988,8 @@ Null string will repeat previous search."
     (if (null buffer) (error "`%s': No such buffer" buffer-name))
     (if (or (not (buffer-modified-p buffer))
            (y-or-n-p
-            (format
-             "Buffer `%s' is modified, are you sure you want to kill it? "
+            (format-message
+             "Buffer ‘%s’ is modified, are you sure you want to kill it? "
              buffer-name)))
        (kill-buffer buffer)
       (error "Buffer not killed"))))
@@ -4400,7 +4402,7 @@ and regexp replace."
 ;; etc.
 (defun viper-cycle-through-mark-ring ()
   "Visit previous locations on the mark ring.
-One can use \\=`\\=` and '' to temporarily jump 1 step back."
+One can use \\=`\\=` and \\='\\=' to temporarily jump 1 step back."
   (let* ((sv-pt (point)))
        ;; if repeated `m,' command, pop the previously saved mark.
        ;; Prev saved mark is actually prev saved point.  It is used if the
@@ -4636,8 +4638,8 @@ One can use \\=`\\=` and '' to temporarily jump 1 step 
back."
                                          (substring text 0 (- pos s))
                                          reg (substring text (- pos s)))))
                     (princ
-                     (format
-                      "Textmarker `%c' is in buffer `%s' at line %d.\n"
+                     (format-message
+                      "Textmarker ‘%c’ is in buffer ‘%s’ at line %d.\n"
                                     reg (buffer-name buf) line-no))
                     (princ (format "Here is some text around %c:\n\n %s"
                                     reg text)))
@@ -4782,10 +4784,10 @@ sensitive for VI-style look-and-feel."
          (setq repeated t))
        (setq dont-change-unless t
              level-changed t)
-       (insert "
+       (insert (substitute-command-keys "
 Please specify your level of familiarity with the venomous VI PERil
 \(and the VI Plan for Emacs Rescue).
-You can change it at any time by typing `M-x viper-set-expert-level RET'
+You can change it at any time by typing `\\[viper-set-expert-level]'
 
  1 -- BEGINNER: Almost all Emacs features are suppressed.
        Feels almost like straight Vi.  File name completion and
@@ -4803,7 +4805,7 @@ You can change it at any time by typing `M-x 
viper-set-expert-level RET'
        viper-electric-mode, viper-want-ctl-h-help, viper-want-emacs-keys-in-vi,
        and viper-want-emacs-keys-in-insert.  Adjust these to your taste.
 
-Please, specify your level now: ")
+Please, specify your level now: "))
 
        (setq viper-expert-level (- (viper-read-char-exclusive) ?0))
        ) ; end while
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index e575eee..e28c67a 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -279,7 +279,7 @@ The minor mode viper-vi-diehard-minor-mode is in effect when
 viper-expert-level is 1 or 2 or when viper-want-emacs-keys-in-vi is t.
 The minor mode viper-insert-diehard-minor-mode is in effect when
 viper-expert-level is 1 or 2 or if viper-want-emacs-keys-in-insert is t.
-Use `M-x viper-set-expert-level' to change this.")
+Use `\\[viper-set-expert-level]' to change this.")
 
 ;; Max expert level supported by Viper.  This is NOT a user option.
 ;; It is here to make it hard for the user from resetting it.
@@ -583,7 +583,7 @@ the Insert state."
 
 (defcustom viper-keep-point-on-repeat t
   "If t, don't move point when repeating previous command.
-This is useful for doing repeated changes with the '.' key.
+This is useful for doing repeated changes with the ‘.’ key.
 The user can change this to nil, if she likes when the cursor moves
 to a new place after repeating previous Vi command."
   :type 'boolean
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index 89bc77f..e856832 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -369,12 +369,12 @@ If SCOPE is nil, the user is asked to specify the scope."
          (setq scope
                (cond
                 ((y-or-n-p
-                  (format
-                   "Map this macro for buffer `%s' only? "
+                  (format-message
+                   "Map this macro for buffer ‘%s’ only? "
                    (buffer-name)))
                  (setq msg
-                       (format
-                        "%S is mapped to %s for %s in `%s'"
+                       (format-message
+                        "%S is mapped to %s for %s in ‘%s’"
                         (viper-display-macro macro-name)
                         (viper-abbreviate-string
                          (format
@@ -385,12 +385,12 @@ If SCOPE is nil, the user is asked to specify the scope."
                         state-name (buffer-name)))
                  (buffer-name))
                 ((y-or-n-p
-                  (format
-                   "Map this macro for the major mode `%S' only? "
+                  (format-message
+                   "Map this macro for the major mode ‘%S’ only? "
                    major-mode))
                  (setq msg
-                       (format
-                        "%S is mapped to %s for %s in `%S'"
+                       (format-message
+                        "%S is mapped to %s for %s in ‘%S’"
                         (viper-display-macro macro-name)
                         (viper-abbreviate-string
                          (format
diff --git a/lisp/env.el b/lisp/env.el
index 3966ab1..f50ed12 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -175,7 +175,7 @@ a side-effect."
       (let ((codings (find-coding-systems-string (concat variable value))))
        (unless (or (eq 'undecided (car codings))
                    (memq (coding-system-base locale-coding-system) codings))
-         (error "Can't encode `%s=%s' with `locale-coding-system'"
+         (error "Can't encode ‘%s=%s’ with ‘locale-coding-system’"
                 variable (or value "")))))
   (and value
        substitute-env-vars
@@ -185,7 +185,7 @@ a side-effect."
   (if (and value (multibyte-string-p value))
       (setq value (encode-coding-string value locale-coding-system)))
   (if (string-match "=" variable)
-      (error "Environment variable name `%s' contains `='" variable))
+      (error "Environment variable name ‘%s’ contains ‘=’" variable))
   (if (string-equal "TZ" variable)
       (set-time-zone-rule value))
   (setq process-environment (setenv-internal process-environment
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index db8613a..88d25a5 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -82,12 +82,15 @@ encryption is used."
                passphrase))))
     (epa-passphrase-callback-function context key-id file)))
 
+(defvar epa-inhibit nil
+  "Non-nil means don't try to decrypt .gpg files when operating on them.")
+
 ;;;###autoload
 (defun epa-file-handler (operation &rest args)
   (save-match-data
     (let ((op (get operation 'epa-file)))
-      (if op
-         (apply op args)
+      (if (and op (not epa-inhibit))
+          (apply op args)
        (epa-file-run-real-handler operation args)))))
 
 (defun epa-file-run-real-handler (operation args)
diff --git a/lisp/epa.el b/lisp/epa.el
index d3fec73..9f112c4 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -249,7 +249,7 @@ You should bind this variable with `let', but do not set it 
globally.")
     (define-key keymap "q" 'delete-window)
     keymap))
 
-(defvar epa-exit-buffer-function #'bury-buffer)
+(defvar epa-exit-buffer-function #'quit-window)
 
 (define-widget 'epa-key 'push-button
   "Button for representing a epg-key object."
@@ -462,14 +462,12 @@ If ARG is non-nil, mark the key."
       (widget-create 'link
                     :notify (lambda (&rest _ignore) (abort-recursive-edit))
                     :help-echo
-                    (substitute-command-keys
-                     "Click here or \\[abort-recursive-edit] to cancel")
+                    "Click here or \\[abort-recursive-edit] to cancel"
                     "Cancel")
       (widget-create 'link
                     :notify (lambda (&rest _ignore) (exit-recursive-edit))
                     :help-echo
-                    (substitute-command-keys
-                     "Click here or \\[exit-recursive-edit] to finish")
+                    "Click here or \\[exit-recursive-edit] to finish"
                     "OK")
       (insert "\n\n")
       (epa--insert-keys keys)
@@ -658,7 +656,7 @@ If SECRET is non-nil, list secret keys instead of public 
keys."
        (if (= current total)
            (message "%s...done" prompt)
          (message "%s...%d%%" prompt
-                  (floor (* (/ current (float total)) 100))))
+                  (floor (* 100.0 current) total)))
       (message "%s..." prompt))))
 
 (defun epa-read-file-name (input)
@@ -843,10 +841,10 @@ should consider using the string based counterpart
 
 For example:
 
-\(let ((context (epg-make-context 'OpenPGP)))
+\(let ((context (epg-make-context \\='OpenPGP)))
   (decode-coding-string
     (epg-decrypt-string context (buffer-substring start end))
-    'utf-8))"
+    \\='utf-8))"
   (interactive "r")
   (save-excursion
     (let ((context (epg-make-context epa-protocol))
@@ -941,10 +939,10 @@ should consider using the string based counterpart
 
 For example:
 
-\(let ((context (epg-make-context 'OpenPGP)))
+\(let ((context (epg-make-context \\='OpenPGP)))
   (decode-coding-string
     (epg-verify-string context (buffer-substring start end))
-    'utf-8))"
+    \\='utf-8))"
   (declare (interactive-only t))
   (interactive "r")
   (let ((context (epg-make-context epa-protocol))
@@ -1030,10 +1028,10 @@ based counterpart `epg-sign-file' instead.
 
 For example:
 
-\(let ((context (epg-make-context 'OpenPGP)))
+\(let ((context (epg-make-context \\='OpenPGP)))
   (epg-sign-string
     context
-    (encode-coding-string (buffer-substring start end) 'utf-8)))"
+    (encode-coding-string (buffer-substring start end) \\='utf-8)))"
   (declare (interactive-only t))
   (interactive
    (let ((verbose current-prefix-arg))
@@ -1116,10 +1114,10 @@ file based counterpart `epg-encrypt-file' instead.
 
 For example:
 
-\(let ((context (epg-make-context 'OpenPGP)))
+\(let ((context (epg-make-context \\='OpenPGP)))
   (epg-encrypt-string
     context
-    (encode-coding-string (buffer-substring start end) 'utf-8)
+    (encode-coding-string (buffer-substring start end) \\='utf-8)
     nil))"
   (declare (interactive-only t))
   (interactive
diff --git a/lisp/epg.el b/lisp/epg.el
index 7e3cec7..ed71e96 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -611,7 +611,9 @@ callback data (if any)."
                                        "--list-options" "gpg-agent")
                          0)
                   (goto-char (point-min))
-                  (re-search-forward "^allow-emacs-pinentry:.*:1$" nil t))))
+                  (re-search-forward
+                    "^allow-emacs-pinentry:\\(?:.*:\\)\\{8\\}1"
+                    nil t))))
       (pinentry-start))
     (setq process-environment
          (cons (format "INSIDE_EMACS=%s,epg" emacs-version)
@@ -1612,7 +1614,7 @@ handle the case where SIGNATURE has multiple signature.
 
 To check the verification results, use `epg-context-result-for' as follows:
 
-\(epg-context-result-for context 'verify)
+\(epg-context-result-for context \\='verify)
 
 which will return a list of `epg-signature' object."
   (unwind-protect
@@ -1647,7 +1649,7 @@ handle the case where SIGNATURE has multiple signature.
 
 To check the verification results, use `epg-context-result-for' as follows:
 
-\(epg-context-result-for context 'verify)
+\(epg-context-result-for context \\='verify)
 
 which will return a list of `epg-signature' object."
   (let ((coding-system-for-write 'binary)
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index 380ea7c..6139e93 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -511,7 +511,8 @@ Examples:
 
 (defun erc-nick-popup (nick)
   (let* ((completion-ignore-case t)
-         (action (completing-read (concat "What action to take on '" nick "'? 
")
+         (action (completing-read (format-message
+                                   "What action to take on ‘%s’? " nick)
                                   erc-nick-popup-alist))
          (code (cdr (assoc action erc-nick-popup-alist))))
     (when code
@@ -537,8 +538,8 @@ and `apropos' for other symbols."
                      (- (car (current-time-zone)))))
          (hours (mod (floor seconds 3600) 24))
          (minutes (mod (round seconds 60) 60)))
-    (message (format "@%s is %d:%02d local time"
-                     beats hours minutes))))
+    (message "@%s is %d:%02d local time"
+             beats hours minutes)))
 
 (provide 'erc-button)
 
@@ -546,4 +547,3 @@ and `apropos' for other symbols."
 ;; Local Variables:
 ;; indent-tabs-mode: nil
 ;; End:
-
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 182f1e0..bb6e311 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -166,7 +166,7 @@ All values of the list must be uppercase strings.")
   "Return the first matching entry in `erc-dcc-list' which satisfies the
 constraints given as a plist in ARGS. Returns nil on no match.
 
-The property :nick is treated specially, if it contains a '!' character,
+The property :nick is treated specially, if it contains a ‘!’ character,
 it is treated as a address@hidden string, and compared with the :nick property
 value of the individual elements using string-equal. Otherwise it is
 compared with `erc-nick-equal-p' which is IRC case-insensitive."
@@ -315,10 +315,10 @@ Should be set to a string or nil.  If nil, use the value 
of
 
 (defcustom erc-dcc-send-request 'ask
   "How to treat incoming DCC Send requests.
-'ask - Report the Send request, and wait for the user to manually accept it
-       You might want to set `erc-dcc-auto-masks' for this.
-'auto - Automatically accept the request and begin downloading the file
-'ignore - Ignore incoming DCC Send requests completely."
+`ask' - Report the Send request, and wait for the user to manually accept it
+        You might want to set `erc-dcc-auto-masks' for this.
+`auto' - Automatically accept the request and begin downloading the file
+`ignore' - Ignore incoming DCC Send requests completely."
   :group 'erc-dcc
   :type '(choice (const ask) (const auto) (const ignore)))
 
@@ -594,14 +594,9 @@ It lists the current state of `erc-dcc-list' in an easy to 
read manner."
                                             (get-buffer (plist-get elt :file))
                                           (+ (buffer-size) 0.0
                                              erc-dcc-byte-count))))
-                        (concat " ("
-                                (if (= byte-count 0)
-                                    "0"
-                                  (number-to-string
-                                   (truncate
-                                    (* 100
-                                       (/ byte-count (plist-get elt :size))))))
-                                "%)"))))
+                        (format " (%d%%)"
+                                (floor (* 100.0 byte-count)
+                                       (plist-get elt :size))))))
        ?f (or (and (plist-member elt :file) (plist-get elt :file)) "")))
     (erc-display-message
      nil 'notice 'active
@@ -718,9 +713,9 @@ match, returns that regexp and nil otherwise."
 
 (defcustom erc-dcc-chat-request 'ask
   "How to treat incoming DCC Chat requests.
-'ask - Report the Chat request, and wait for the user to manually accept it
-'auto - Automatically accept the request and open a new chat window
-'ignore - Ignore incoming DCC chat requests completely."
+`ask' - Report the Chat request, and wait for the user to manually accept it
+`auto' - Automatically accept the request and open a new chat window
+`ignore' - Ignore incoming DCC chat requests completely."
   :group 'erc-dcc
   :type '(choice (const ask) (const auto) (const ignore)))
 
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index 776231f..55f298b 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -88,13 +88,13 @@ Useful to mark nicks from dangerous hosts."
 
 The following values are allowed:
 
- nil              - do not highlight the message at all
- 'keyword         - highlight all instances of current nickname in message
- 'nick            - highlight the nick of the user who typed your nickname
- 'nick-or-keyword - highlight the nick of the user who typed your nickname,
-                    or all instances of the current nickname if there was
-                    no sending user
- 'all             - highlight the entire message where current nickname occurs
+ nil               - do not highlight the message at all
+ `keyword'         - highlight all instances of current nickname in message
+ `nick'            - highlight the nick of the user who typed your nickname
+ `nick-or-keyword' - highlight the nick of the user who typed your nickname,
+                     or all instances of the current nickname if there was
+                     no sending user
+ `all'             - highlight the entire message where current nickname occurs
 
 Any other value disables highlighting of current nickname altogether."
   :group 'erc-match
@@ -110,9 +110,9 @@ See `erc-pals'.
 
 The following values are allowed:
 
-    nil   - do not highlight the message at all
-    'nick - highlight pal's nickname only
-    'all  - highlight the entire message from pal
+    nil    - do not highlight the message at all
+    `nick' - highlight pal's nickname only
+    `all'  - highlight the entire message from pal
 
 Any other value disables pal highlighting altogether."
   :group 'erc-match
@@ -126,9 +126,9 @@ See `erc-fools'.
 
 The following values are allowed:
 
-    nil   - do not highlight the message at all
-    'nick - highlight fool's nickname only
-    'all  - highlight the entire message from fool
+    nil    - do not highlight the message at all
+    `nick' - highlight fool's nickname only
+    `all'  - highlight the entire message from fool
 
 Any other value disables fool highlighting altogether."
   :group 'erc-match
@@ -142,8 +142,8 @@ See variable `erc-keywords'.
 
 The following values are allowed:
 
-    'keyword - highlight keyword only
-    'all     - highlight the entire message containing keyword
+    `keyword' - highlight keyword only
+    `all'     - highlight the entire message containing keyword
 
 Any other value disables keyword highlighting altogether."
   :group 'erc-match
@@ -157,8 +157,8 @@ See `erc-dangerous-hosts'.
 
 The following values are allowed:
 
-    'nick - highlight nick from dangerous-host only
-    'all  - highlight the entire message from dangerous-host
+    `nick' - highlight nick from dangerous-host only
+    `all'  - highlight the entire message from dangerous-host
 
 Any other value disables dangerous-host highlighting altogether."
   :group 'erc-match
diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el
index b37427f..07a4274 100644
--- a/lisp/erc/erc-services.el
+++ b/lisp/erc/erc-services.el
@@ -83,11 +83,11 @@ communication with those Services."
 
 Possible settings are:.
 
-'autodetect  - Identify when the real Nickserv sends an identify request.
-'nick-change - Identify when you log in or change your nickname.
-'both        - Do the former if the network supports it, otherwise do the
-               latter.
-nil          - Disables automatic Nickserv identification.
+`autodetect'  - Identify when the real Nickserv sends an identify request.
+`nick-change' - Identify when you log in or change your nickname.
+`both'        - Do the former if the network supports it, otherwise do the
+                latter.
+nil           - Disables automatic Nickserv identification.
 
 You can also use M-x erc-nickserv-identify-mode to change modes."
   :group 'erc-services
@@ -447,4 +447,3 @@ When called interactively, read the password using 
`read-passwd'."
 ;; indent-tabs-mode: t
 ;; tab-width: 8
 ;; End:
-
diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
index a1bf32b..6015a6a 100644
--- a/lisp/erc/erc-speedbar.el
+++ b/lisp/erc/erc-speedbar.el
@@ -48,9 +48,9 @@
 (defcustom erc-speedbar-sort-users-type 'activity
   "How channel nicknames are sorted.
 
-'activity     - Sort users by channel activity
-'alphabetical - Sort users alphabetically
-nil           - Do not sort users"
+`activity'     - Sort users by channel activity
+`alphabetical' - Sort users alphabetically
+nil            - Do not sort users"
   :group 'erc-speedbar
   :type '(choice (const :tag "Sort users by channel activity" activity)
                 (const :tag "Sort users alphabetically" alphabetical)
@@ -364,4 +364,3 @@ The INDENT level is ignored."
 ;; indent-tabs-mode: t
 ;; tab-width: 8
 ;; End:
-
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 1a9aee1..2ebc1f2 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -248,10 +248,10 @@ The effect may be disabled by setting this variable to 
nil."
 Setting this variable only has effects in GNU Emacs versions above 21.3.
 
 Choices are:
-'before-modes - add to the beginning of `mode-line-modes',
-'after-modes  - add to the end of `mode-line-modes',
-t             - add to the end of `global-mode-string',
-nil           - don't add to mode line."
+`before-modes' - add to the beginning of `mode-line-modes',
+`after-modes'  - add to the end of `mode-line-modes',
+t              - add to the end of `global-mode-string',
+nil            - don't add to mode line."
   :group 'erc-track
   :type '(choice (const :tag "Just before mode information" before-modes)
                 (const :tag "Just after mode information" after-modes)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 460accd..f282179 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -230,7 +230,7 @@ prompt you for it.")
 (defcustom erc-hide-prompt nil
   "If non-nil, do not display the prompt for commands.
 
-\(A command is any input starting with a '/').
+\(A command is any input starting with a ‘/’).
 
 See also the variables `erc-prompt' and `erc-command-indicator'."
   :group 'erc-display
@@ -667,7 +667,7 @@ See also the variable `erc-prompt'."
   "Indicator used by ERC for showing commands.
 
 If non-nil, this will be used in the ERC buffer to indicate
-commands (i.e., input starting with a '/').
+commands (i.e., input starting with a ‘/’).
 
 If nil, the prompt will be constructed from the variable `erc-prompt'."
   :group 'erc-display
@@ -696,8 +696,8 @@ See `erc-notice-prefix'.
 
 The following values are allowed:
 
-    'prefix - highlight notice prefix only
-    'all    - highlight the entire notice
+    `prefix' - highlight notice prefix only
+    `all'    - highlight the entire notice
 
 Any other value disables notice's highlighting altogether."
   :group 'erc-display
@@ -1258,13 +1258,13 @@ erc-NAME-enable, and erc-NAME-disable.
 
 Example:
 
-  ;;;###autoload (autoload 'erc-replace-mode \"erc-replace\")
+  ;;;###autoload (autoload \\='erc-replace-mode \"erc-replace\")
   (define-erc-module replace nil
     \"This mode replaces incoming text according to `erc-replace-alist'.\"
-    ((add-hook 'erc-insert-modify-hook
-               'erc-replace-insert))
-    ((remove-hook 'erc-insert-modify-hook
-                  'erc-replace-insert)))"
+    ((add-hook \\='erc-insert-modify-hook
+               \\='erc-replace-insert))
+    ((remove-hook \\='erc-insert-modify-hook
+                  \\='erc-replace-insert)))"
   (declare (doc-string 3))
   (let* ((sn (symbol-name name))
          (mode (intern (format "erc-%s-mode" (downcase sn))))
@@ -1476,11 +1476,11 @@ Defaults to the server buffer."
 
 The available choices are:
 
-  'window          - in another window,
-  'window-noselect - in another window, but don't select that one,
-  'frame           - in another frame,
-  'bury            - bury it in a new buffer,
-  'buffer          - in place of the current buffer,
+  `window'          - in another window,
+  `window-noselect' - in another window, but don't select that one,
+  `frame'           - in another frame,
+  `bury'            - bury it in a new buffer,
+  `buffer'          - in place of the current buffer,
   any other value  - in place of the current buffer."
   :group 'erc-buffers
   :type '(choice (const :tag "Split window and select" window)
@@ -2789,7 +2789,7 @@ this function from interpreting the line as a command."
 (defun erc-cmd-SAY (line)
   "Send LINE to the current query or channel as a message, not a command.
 
-Use this when you want to send a message with a leading '/'.  Note
+Use this when you want to send a message with a leading ‘/’.  Note
 that since multi-line messages are never a command, you don't
 need this when pasting multiple lines of text."
   (if (string-match "^\\s-*$" line)
@@ -3119,9 +3119,9 @@ a script after exceeding the flood threshold."
         (erc-display-message nil 'error (current-buffer)
                              'cannot-read-file ?f file))
        (t
-        (message "Loading \'%s\'..." file)
+        (message "Loading ‘%s’..." file)
         (erc-load-script file)
-        (message "Loading \'%s\'...done" file))))
+        (message "Loading ‘%s’...done" file))))
     t)
    (t nil)))
 
@@ -4466,7 +4466,7 @@ See also: `erc-echo-notice-in-user-buffers',
   "Handle the logging in process of connection."
   (unless erc-logged-in
     (setq erc-logged-in t)
-    (message "Logging in as \'%s\'... done" (erc-current-nick))
+    (message "Logging in as ‘%s’... done" (erc-current-nick))
     ;; execute a startup script
     (let ((f (erc-select-startup-file)))
       (when f
@@ -6512,7 +6512,7 @@ All windows are opened in the current frame."
     . "\n\nConnection failed!  Not re-establishing connection.\n")
    (finished . "\n\n*** ERC finished ***\n")
    (terminated . "\n\n*** ERC terminated: %e\n")
-   (login . "Logging in as \'%n\'...")
+   (login . "Logging in as ‘%n’...")
    (nick-in-use . "%n is in use. Choose new nickname: ")
    (nick-too-long
     . "WARNING: Nick length (%i) exceeds max NICKLEN(%l) defined by server")
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index 8a3b581..ac1616d 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -71,7 +71,7 @@ they lack somewhat in feel from the typical shell 
equivalents."
   "The function used to normalize the value of Eshell's `pwd'.
 The value returned by `pwd' is also used when recording the
 last-visited directory in the last-dir-ring, so it will affect the
-form of the list used by 'cd ='."
+form of the list used by `cd ='."
   :type '(radio (function-item file-truename)
                (function-item expand-file-name)
                (function-item identity)
@@ -115,7 +115,7 @@ calls \"ls\" and references `eshell-last-arguments'."
   :group 'eshell-dirs)
 
 (defcustom eshell-pushd-tohome nil
-  "If non-nil, make pushd with no arg behave as 'pushd ~' (like `cd').
+  "If non-nil, make pushd with no arg behave as `pushd ~' (like `cd').
 This mirrors the optional behavior of tcsh."
   :type 'boolean
   :group 'eshell-dirs)
@@ -150,11 +150,11 @@ If it is nil, the last-dir-ring will not be written to 
disk."
   "If non-nil, the size of the directory history ring.
 This ring is added to every time `cd' or `pushd' is used.  It simply
 stores the most recent directory locations Eshell has been in.  To
-return to the most recent entry, use 'cd -' (equivalent to 'cd -0').
-To return to an older entry, use 'cd -N', where N is an integer less
+return to the most recent entry, use `cd -' (equivalent to `cd -0').
+To return to an older entry, use `cd -N', where N is an integer less
 than `eshell-last-dir-ring-size'.  To return to the last directory
-matching a particular regexp, use 'cd =REGEXP'.  To display the
-directory history list, use 'cd ='.
+matching a particular regexp, use `cd =REGEXP'.  To display the
+directory history list, use `cd ='.
 
 This mechanism is very similar to that provided by `pushd', except
 it's far more automatic.  `pushd' allows the user to decide which
@@ -313,7 +313,7 @@ Thus, this does not include the current directory.")
       path)))
 
 (defun eshell-expand-multiple-dots (path)
-  "Convert '...' to '../..', '....' to '../../..', etc..
+  "Convert `...' to `../..', `....' to `../../..', etc..
 
 With the following piece of advice, you can make this functionality
 available in most of Emacs, with the exception of filename completion
@@ -364,7 +364,7 @@ in the minibuffer:
       (let ((curdir (eshell/pwd)))
        (if (string-match path curdir)
            (setq path (replace-match subpath nil nil curdir))
-         (error "Path substring '%s' not found" path))))
+         (error "Path substring ‘%s’ not found" path))))
      ((and path (string-match "^-\\([0-9]*\\)$" path))
       (let ((index (match-string 1 path)))
        (setq path
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el
index c7ebbf8..8abdd00 100644
--- a/lisp/eshell/em-glob.el
+++ b/lisp/eshell/em-glob.el
@@ -193,7 +193,7 @@ The basic syntax is:
   *      .*      matches any group of characters (or none)
   #      *       matches zero or more occurrences of preceding
   ##     +       matches one or more occurrences of preceding
-  (x)    \(x\)   makes 'x' a regular expression group
+  (x)    \(x\)   makes ‘x’ a regular expression group
   |      \|      boolean OR within an expression group
   [a-b]  [a-b]   matches a character or range
   [^a]   [^a]    excludes a character or range
@@ -220,7 +220,7 @@ resulting regular expression."
                  matched-in-pattern (1+ op-begin))
          (let ((xlat (assq op-char eshell-glob-translate-alist)))
            (if (not xlat)
-               (error "Unrecognized globbing character '%c'" op-char)
+               (error "Unrecognized globbing character ‘%c’" op-char)
              (if (stringp (cdr xlat))
                  (setq regexp (concat regexp (cdr xlat))
                        matched-in-pattern (1+ op-begin))
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index 1cdf6d6..9f070c3 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -520,7 +520,7 @@ See also `eshell-read-history'."
        (let ((ch (read-event)))
          (if (eq ch ?\ )
              (set-window-configuration conf)
-           (setq unread-command-events (list ch))))))))
+           (push ch unread-command-events)))))))
 
 (defun eshell-hist-word-reference (ref)
   "Return the word designator index referred to by REF."
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 289d37d..539080f 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -193,7 +193,7 @@ EXAMPLES:
   ***/*~f*(-/)  recursively (though not traversing symlinks),
                find all directories (or symlinks referring to
                directories) whose names do not begin with f.
-  e*(*Lk+50)    executables 50k or larger beginning with 'e'")
+  e*(*Lk+50)    executables 50k or larger beginning with ‘e’")
 
 (defvar eshell-modifier-help-string
   "Eshell modifier quick reference:
@@ -318,7 +318,7 @@ resultant list of strings."
                    (if (and func (functionp func))
                        (setq preds (eshell-add-pred-func func preds
                                                          negate follow))
-                     (error "Invalid function predicate '%s'"
+                     (error "Invalid function predicate ‘%s’"
                             (eshell-stringify func))))
                (error "Invalid function predicate")))
             ((eq char ?^)
@@ -336,20 +336,20 @@ resultant list of strings."
                              (cons `(lambda (lst)
                                       (mapcar (function ,func) lst))
                                    mods))
-                     (error "Invalid function modifier '%s'"
+                     (error "Invalid function modifier ‘%s’"
                             (eshell-stringify func))))
                (error "Invalid function modifier")))
             ((eq char ?:)
              (forward-char)
              (let ((mod (assq (char-after) eshell-modifier-alist)))
                (if (not mod)
-                   (error "Unknown modifier character '%c'" (char-after))
+                   (error "Unknown modifier character ‘%c’" (char-after))
                  (forward-char)
                  (setq mods (cons (eval (cdr mod)) mods)))))
             (t
              (let ((pred (assq char eshell-predicate-alist)))
                (if (not pred)
-                   (error "Unknown predicate character '%c'" char)
+                   (error "Unknown predicate character ‘%c’" char)
                  (forward-char)
                  (setq preds
                        (eshell-add-pred-func (eval (cdr pred)) preds
@@ -451,7 +451,7 @@ resultant list of strings."
 (defun eshell-pred-file-type (type)
   "Return a test which tests that the file is of a certain TYPE.
 TYPE must be a character, and should be one of the possible options
-that 'ls -l' will show in the first column of its display. "
+that `ls -l' will show in the first column of its display. "
   (when (eq type ?%)
     (setq type (char-after))
     (if (memq type '(?b ?c))
diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el
index 04f3a98..8e65e44 100644
--- a/lisp/eshell/em-script.el
+++ b/lisp/eshell/em-script.el
@@ -45,7 +45,7 @@ commands, as a script file."
 (defcustom eshell-login-script (expand-file-name "login" eshell-directory-name)
   "If non-nil, a file to invoke when starting up Eshell interactively.
 This file should be a file containing Eshell commands, where comment
-lines begin with '#'."
+lines begin with ‘#’."
   :type 'file
   :group 'eshell-script)
 
@@ -89,7 +89,7 @@ This includes when running `eshell-command'."
 
 (defun eshell-source-file (file &optional args subcommand-p)
   "Execute a series of Eshell commands in FILE, passing ARGS.
-Comments begin with '#'."
+Comments begin with ‘#’."
   (interactive "f")
   (let ((orig (point))
        (here (point-max))
diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el
index 9ac2813..a8fa973 100644
--- a/lisp/eshell/em-term.el
+++ b/lisp/eshell/em-term.el
@@ -40,7 +40,7 @@
 ;;;###autoload
 (progn
 (defgroup eshell-term nil
-  "This module causes visual commands (e.g., 'vi') to be executed by
+  "This module causes visual commands (e.g., `vi') to be executed by
 the `term' package, which comes with Emacs.  This package handles most
 of the ANSI control codes, allowing curses-based applications to run
 within an Emacs window.  The variable `eshell-visual-commands' defines
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index c50a874..210e74d 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -168,10 +168,10 @@ Otherwise, Emacs will attempt to use rsh to invoke du on 
the remote machine."
 
 (defun eshell/info (&rest args)
   "Run the info command in-frame with the same behavior as command-line 
`info', ie:
-  'info'           => goes to top info window
-  'info arg1'      => IF arg1 is a file, then visits arg1
-  'info arg1'      => OTHERWISE goes to top info window and then menu item arg1
-  'info arg1 arg2' => does action for arg1 (either visit-file or menu-item) 
and then menu item arg2
+  `info'           => goes to top info window
+  `info arg1'      => IF arg1 is a file, then visits arg1
+  `info arg1'      => OTHERWISE goes to top info window and then menu item arg1
+  `info arg1 arg2' => does action for arg1 (either visit-file or menu-item) 
and then menu item arg2
   etc."
   (eval-and-compile (require 'info))
   (let ((file (cond
@@ -579,7 +579,7 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.")
 Create a link to the specified TARGET with optional LINK_NAME.  If there is
 more than one TARGET, the last argument must be a directory;  create links
 in DIRECTORY to each TARGET.  Create hard links by default, symbolic links
-with '--symbolic'.  When creating hard links, each TARGET must exist.")
+with `--symbolic'.  When creating hard links, each TARGET must exist.")
    (let ((no-dereference t))
      (eshell-mvcpln-template "ln" "linking"
                             (if symbolic
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index 49ba727..93d795b 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -237,7 +237,7 @@ Point is left at the end of the arguments."
                    (let* ((here (point))
                           (arg (eshell-parse-argument)))
                      (if (= (point) here)
-                         (error "Failed to parse argument '%s'"
+                         (error "Failed to parse argument `%s'"
                                 (buffer-substring here (point-max))))
                      (and arg (nconc args (list arg)))))))
               (throw 'eshell-incomplete (if (listp delim)
@@ -357,13 +357,13 @@ after are both returned."
          (goto-char (1+ end)))))))
 
 (defun eshell-parse-special-reference ()
-  "Parse a special syntax reference, of the form '#<args>'.
+  "Parse a special syntax reference, of the form `#<args>'.
 
 args           := `type' `whitespace' `arbitrary-args' | `arbitrary-args'
 type           := \"buffer\" or \"process\"
 arbitrary-args := any string of characters.
 
-If the form has no 'type', the syntax is parsed as if 'type' were
+If the form has no `type', the syntax is parsed as if `type' were
 \"buffer\"."
   (when (and (not eshell-current-argument)
              (not eshell-current-quoted)
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index d0c8cc4..efd8582 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -165,13 +165,13 @@ In order to substitute an alternate command form for 
execution, the
 hook function should throw it using the tag `eshell-replace-command'.
 For example:
 
-  (add-hook 'eshell-named-command-hook 'subst-with-cd)
+  (add-hook \\='eshell-named-command-hook \\='subst-with-cd)
   (defun subst-with-cd (command args)
-    (throw 'eshell-replace-command
+    (throw \\='eshell-replace-command
           (eshell-parse-command \"cd\" args)))
 
 Although useless, the above code will cause any non-glob, non-Lisp
-command (i.e., 'ls' as opposed to '*ls' or '(ls)') to be replaced by a
+command (i.e., `ls' as opposed to `*ls' or `(ls)') to be replaced by a
 call to `cd' using the arguments that were passed to the function."
   :type 'hook
   :group 'eshell-cmd)
@@ -243,7 +243,7 @@ return non-nil if the command is complex."
   "If non-nil, enable Eshell debugging code.
 This is slow, and only useful for debugging problems with Eshell.
 If you change this without using customize after Eshell has loaded,
-you must re-load 'esh-cmd.el'."
+you must re-load `esh-cmd.el'."
   :initialize 'custom-initialize-default
   :set (lambda (symbol value)
         (set symbol value)
@@ -390,7 +390,7 @@ hooks should be run before and after the command."
       (macroexp-progn commands))))
 
 (defun eshell-debug-command (tag subform)
-  "Output a debugging message to '*eshell last cmd*'."
+  "Output a debugging message to `*eshell last cmd*'."
   (let ((buf (get-buffer-create "*eshell last cmd*"))
        (text (eshell-stringify eshell-current-command)))
     (with-current-buffer buf
@@ -424,14 +424,14 @@ hooks should be run before and after the command."
     (setq terms (cdr terms))))
 
 (defun eshell-rewrite-sexp-command (terms)
-  "Rewrite a sexp in initial position, such as '(+ 1 2)'."
+  "Rewrite a sexp in initial position, such as `(+ 1 2)'."
   ;; this occurs when a Lisp expression is in first position
   (if (and (listp (car terms))
           (eq (caar terms) 'eshell-command-to-value))
       (car (cdar terms))))
 
 (defun eshell-rewrite-initial-subcommand (terms)
-  "Rewrite a subcommand in initial position, such as '{+ 1 2}'."
+  "Rewrite a subcommand in initial position, such as `{+ 1 2}'."
   (if (and (listp (car terms))
           (eq (caar terms) 'eshell-as-subcommand))
       (car terms)))
@@ -634,7 +634,7 @@ For an external command, it means an exit code of 0."
     final))
 
 (defun eshell-parse-subcommand-argument ()
-  "Parse a subcommand argument of the form '{command}'."
+  "Parse a subcommand argument of the form `{command}'."
   (if (and (not eshell-current-argument)
           (not eshell-current-quoted)
           (eq (char-after) ?\{)
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el
index 91c4f4b..81ffaa7 100644
--- a/lisp/eshell/esh-ext.el
+++ b/lisp/eshell/esh-ext.el
@@ -66,7 +66,7 @@ loaded into memory, thus beginning a new process."
 This can be useful on systems like Windows, where the operating system
 doesn't support the execution bit for shell scripts; or in cases where
 you want to associate an interpreter with a particular kind of script
-file, but the language won't let you but a '#!' interpreter line in
+file, but the language won't let you but a `#!' interpreter line in
 the file, and you don't want to make it executable since nothing else
 but Eshell will be able to understand
 `eshell-interpreter-alist'."
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index dc731bc..749c481 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -182,7 +182,7 @@ not be added to this variable."
                 #'eshell--apply-redirections))
 
 (defun eshell-parse-redirection ()
-  "Parse an output redirection, such as '2>'."
+  "Parse an output redirection, such as `2>'."
   (if (and (not eshell-current-quoted)
           (looking-at "\\([0-9]\\)?\\(<\\|>+\\)&?\\([0-9]\\)?\\s-*"))
       (if eshell-current-argument
diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el
index 5b4cdb0..2e929b0 100644
--- a/lisp/eshell/esh-opt.el
+++ b/lisp/eshell/esh-opt.el
@@ -178,9 +178,9 @@ This code doesn't really need to be macro expanded 
everywhere."
       (if extcmd
          (setq usage
                (concat usage
-                       (format "
+                       (format-message "
 This command is implemented in Lisp.  If an unrecognized option is
-passed to this command, the external version '%s'
+passed to this command, the external version ‘%s’
 will be called instead." extcmd)))))
     (throw 'eshell-usage usage)))
 
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index 197a8e7..f5110c3 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -116,7 +116,7 @@
 (require 'ring)
 
 (defgroup eshell-var nil
-  "Variable interpolation is introduced whenever the '$' character
+  "Variable interpolation is introduced whenever the ‘$’ character
 appears unquoted in any argument (except when that argument is
 surrounded by single quotes).  It may be used to interpolate a
 variable value, a subcommand, or even the result of a Lisp form."
@@ -148,7 +148,7 @@ variable value, a subcommand, or even the result of a Lisp 
form."
 
 (defcustom eshell-variable-name-regexp "[A-Za-z0-9_-]+"
   "A regexp identifying what constitutes a variable name reference.
-Note that this only applies for '$NAME'.  If the syntax '$<NAME>' is
+Note that this only applies for `$NAME'.  If the syntax `$<NAME>' is
 used, then NAME can contain any character, including angle brackets,
 if they are quoted with a backslash."
   :type 'regexp
@@ -186,12 +186,12 @@ if they are quoted with a backslash."
 It is very similar in concept to what `eshell-user-aliases-list' does
 for commands.  Each member of this defines the name of a command,
 and the Lisp value to return for that variable if it is accessed
-via the syntax '$NAME'.
+via the syntax `$NAME'.
 
 If the value is a function, that function will be called with two
 arguments: the list of the indices that was used in the reference, and
 whether the user is requesting the length of the ultimate element.
-For example, a reference of '$NAME[10][20]' would result in the
+For example, a reference of `$NAME[10][20]' would result in the
 function for alias `NAME' being called (assuming it were aliased to a
 function), and the arguments passed to this function would be the list
 '(10 20)', and nil."
@@ -231,7 +231,7 @@ function), and the arguments passed to this function would 
be the list
              'eshell-complete-variable-assignment nil t)))
 
 (defun eshell-handle-local-variables ()
-  "Allow for the syntax 'VAR=val <command> <args>'."
+  "Allow for the syntax `VAR=val <command> <args>'."
   ;; strip off any null commands, which can only happen if a variable
   ;; evaluates to nil, such as "$var x", where `var' is nil.  The
   ;; command name in that case becomes `x', for compatibility with
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 3d58943..a90794f 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -797,10 +797,10 @@ This is called whenever you create a new face, and at 
other times."
            symbol (intern name)))
     (setq menu 'facemenu-face-menu)
     (setq docstring
-         (purecopy (format "Select face `%s' for subsequent insertion.
+         (purecopy (format-message "Select face ‘%s’ for subsequent insertion.
 If the mark is active and there is no prefix argument,
-apply face `%s' to the region instead.
-This command was defined by `facemenu-add-new-face'."
+apply face ‘%s’ to the region instead.
+This command was defined by ‘facemenu-add-new-face’."
                  name name)))
     (cond ((facemenu-iterate ; check if equivalent face is already in the menu
            (lambda (m) (and (listp m)
@@ -846,12 +846,12 @@ Return the event type (a symbol) of the added menu entry.
 This is called whenever you use a new color."
   (let (symbol)
     (unless (color-defined-p color)
-      (error "Color `%s' undefined" color))
+      (error "Color ‘%s’ undefined" color))
     (cond ((eq menu 'facemenu-foreground-menu)
           (setq symbol (intern (concat "fg:" color))))
          ((eq menu 'facemenu-background-menu)
           (setq symbol (intern (concat "bg:" color))))
-         (t (error "MENU should be `facemenu-foreground-menu' or 
`facemenu-background-menu'")))
+         (t (error "MENU should be ‘facemenu-foreground-menu’ or 
‘facemenu-background-menu’")))
     (unless (facemenu-iterate ; Check if color is already in the menu.
             (lambda (m) (and (listp m)
                              (eq (car m) symbol)))
diff --git a/lisp/faces.el b/lisp/faces.el
index 511b354..9e879c1 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -574,7 +574,7 @@ If FACE is a face-alias, get the documentation for the 
target face."
   (let ((alias (get face 'face-alias)))
     (if alias
         (let ((doc (get alias 'face-documentation)))
-         (format "%s is an alias for the face `%s'.%s" face alias
+         (format-message "%s is an alias for the face ‘%s’.%s" face alias
                   (if doc (format "\n%s" doc)
                     "")))
       (get face 'face-documentation))))
@@ -1005,7 +1005,7 @@ a single face name."
     (setq default (car (split-string default crm-separator t))))
 
   (let ((prompt (if default
-                    (format "%s (default `%s'): " prompt default)
+                    (format-message "%s (default ‘%s’): " prompt default)
                   (format "%s: " prompt)))
         aliasfaces nonaliasfaces faces)
     ;; Build up the completion tables.
@@ -1136,10 +1136,10 @@ Value is the new attribute value."
   (setq name (concat (upcase (substring name 0 1)) (substring name 1)))
   (let* ((completion-ignore-case t)
         (value (completing-read
-                (if default
-                    (format "%s for face `%s' (default %s): "
-                            name face default)
-                  (format "%s for face `%s': " name face))
+                 (format-message (if default
+                                     "%s for face ‘%s’ (default %s): "
+                                   "%s for face ‘%s’: ")
+                                 name face default)
                 completion-alist nil nil nil nil default)))
     (if (equal value "") default value)))
 
@@ -1224,7 +1224,8 @@ of a global face.  Value is the new attribute value."
   "Read the name of a font for FACE on FRAME.
 If optional argument FRAME is nil or omitted, use the selected frame."
   (let ((completion-ignore-case t))
-    (completing-read (format "Set font attributes of face `%s' from font: " 
face)
+    (completing-read (format-message
+                      "Set font attributes of face ‘%s’ from font: " face)
                     (append (fontset-list) (x-list-fonts "*" nil frame)))))
 
 
@@ -1435,17 +1436,17 @@ If FRAME is omitted or nil, use the selected frame."
                  (when alias
                    (setq face alias)
                    (insert
-                    (format (substitute-command-keys
-                              "\n  %s is an alias for the face ‘%s’.\n%s")
-                            f alias
-                            (if (setq obsolete (get f 'obsolete-face))
-                                (format (substitute-command-keys
-                                          "  This face is obsolete%s; use ‘%s’ 
instead.\n")
-                                        (if (stringp obsolete)
-                                            (format " since %s" obsolete)
-                                          "")
-                                        alias)
-                              ""))))
+                    (format-message
+                      "\n  %s is an alias for the face ‘%s’.\n%s"
+                      f alias
+                      (if (setq obsolete (get f 'obsolete-face))
+                          (format-message
+                           "  This face is obsolete%s; use ‘%s’ instead.\n"
+                           (if (stringp obsolete)
+                               (format " since %s" obsolete)
+                             "")
+                           alias)
+                        ""))))
                  (insert "\nDocumentation:\n"
                           (substitute-command-keys
                            (or (face-documentation face)
@@ -1551,7 +1552,7 @@ If FRAME is nil, the current FRAME is used."
                               options))
                        ((eq req 'supports)
                         (display-supports-face-attributes-p options frame))
-                       (t (error "Unknown req `%S' with options `%S'"
+                       (t (error "Unknown req ‘%S’ with options ‘%S’"
                                  req options)))))
     match))
 
@@ -1924,7 +1925,7 @@ resulting color name in the echo area."
                                (logand 65535 (nth 0 components))
                                (logand 65535 (nth 1 components))
                                (logand 65535 (nth 2 components))))))))
-    (when msg (message "Color: `%s'" color))
+    (when msg (message "Color: ‘%s’" color))
     color))
 
 (defun face-at-point (&optional thing multiple)
@@ -2777,13 +2778,13 @@ also the same size as FACE on FRAME, or fail."
                (if (string-match-p "\\*" pattern)
                    (if (null (face-font face))
                        (error "No matching fonts are the same height as the 
frame default font")
-                     (error "No matching fonts are the same height as face 
`%s'" face))
+                     (error "No matching fonts are the same height as face 
‘%s’" face))
                  (if (null (face-font face))
-                     (error "Height of font `%s' doesn't match the frame 
default font"
+                     (error "Height of font ‘%s’ doesn't match the frame 
default font"
                             pattern)
-                   (error "Height of font `%s' doesn't match face `%s'"
+                   (error "Height of font ‘%s’ doesn't match face ‘%s’"
                           pattern face)))
-             (error "No fonts match `%s'" pattern)))
+             (error "No fonts match ‘%s’" pattern)))
        (car fonts))
     (cdr (assq 'font (frame-parameters (selected-frame))))))
 
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 81cba07..975f726 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -90,7 +90,6 @@
 
 
 ;;; Todo list:
-;; * use kpsewhich
 ;; * let "/dir/file#key" jump to key (tag or regexp) in /dir/file
 ;; * find file of symbol if TAGS is loaded (like above)
 ;; * break long menus into multiple panes (like imenu?)
@@ -894,6 +893,24 @@ URL, or nil.  If nil, search the alist for further 
matches.")
   "Path where `ffap-tex-mode' looks for TeX files.
 If t, `ffap-tex-init' will initialize this when needed.")
 
+(defvar ffap-latex-guess-rules '(("" . ".sty")
+                               ("" . ".cls")
+                               ("" . ".ltx")
+                               ("" . ".tex")
+                               ("" . "") ;; in some rare cases the
+                                         ;; extension is already in
+                                         ;; the buffer.
+                               ("beamertheme" . ".sty")
+                               ("beamercolortheme". ".sty")
+                               ("beamerfonttheme". ".sty")
+                               ("beamerinnertheme". ".sty")
+                               ("beameroutertheme". ".sty")
+                               ("" . ".ldf"))
+  "List of rules for guessing a filename.
+Each rule is a cons (PREFIX . SUFFIX) used for guessing a
+filename from the word at point by prepending PREFIX and
+appending SUFFIX.")
+
 (defun ffap-tex-init ()
   ;; Compute ffap-tex-path if it is now t.
   (and (eq t ffap-tex-path)
@@ -917,9 +934,56 @@ If t, `ffap-tex-init' will initialize this when needed.")
   (ffap-locate-file name '(".tex" "") ffap-tex-path))
 
 (defun ffap-latex-mode (name)
-  (ffap-tex-init)
-  ;; only rare need for ""
-  (ffap-locate-file name '(".cls" ".sty" ".tex" "") ffap-tex-path))
+  "`ffap' function suitable for latex buffers.
+This uses the program kpsewhich if available. In this case, the
+variable `ffap-latex-guess-rules' is used for building a filename
+out of NAME."
+  (cond ((file-exists-p name)
+         name)
+        ((not (executable-find "kpsewhich"))
+         (ffap-tex-init)
+         (ffap-locate-file name '(".cls" ".sty" ".tex" "") ffap-tex-path))
+        (t
+         (let ((curbuf (current-buffer))
+               (guess-rules ffap-latex-guess-rules)
+               (preferred-suffix-rules '(("input" . ".tex")
+                                         ("include" . ".tex")
+                                         ("usepackage" . ".sty")
+                                         ("RequirePackageWithOptions" . ".sty")
+                                         ("RequirePackage" . ".sty")
+                                         ("documentclass" . ".cls")
+                                         ("documentstyle" . ".cls")
+                                         ("LoadClass" . ".cls")
+                                         ("LoadClassWithOptions" . ".cls")
+                                         ("bibliography" . ".bib")
+                                         ("addbibresource" . ""))))
+           ;; We now add preferred suffix in front of suffixes.
+           (when
+               ;; The condition is essentially:
+               ;; (assoc (TeX-current-macro)
+               ;;        (mapcar 'car preferred-suffix-rules))
+               ;; but (TeX-current-macro) can take time, so we just
+               ;; check if one of the `car' in preferred-suffix-rules
+               ;; is found before point on the current line.  It
+               ;; should cover most cases.
+               (save-excursion
+                 (re-search-backward (regexp-opt
+                                      (mapcar 'car preferred-suffix-rules))
+                                     (point-at-bol)
+                                     t))
+             (push (cons "" (cdr (assoc (match-string 0) ; i.e. 
"(TeX-current-macro)"
+                                        preferred-suffix-rules)))
+                   guess-rules))
+           (setq kpsewhich-args (mapcar (lambda (rule)
+                                          (concat (car rule) name (cdr rule)))
+                                        guess-rules))
+           (with-temp-buffer
+             (let ((process-environment (buffer-local-value
+                                         'process-environment curbuf))
+                   (exec-path (buffer-local-value 'exec-path curbuf)))
+               (apply #'call-process "kpsewhich"  nil  t  nil kpsewhich-args))
+             (when (< (point-min) (point-max))
+               (buffer-substring (goto-char (point-min)) (point-at-eol))))))))
 
 (defun ffap-tex (name)
   (ffap-tex-init)
@@ -1004,7 +1068,7 @@ If a given RFC isn't in these then `ffap-rfc-path' is 
offered."
     ;; Slightly controversial decisions:
     ;; * strip trailing "@" and ":"
     ;; * no commas (good for latex)
-    (file "--:\\\\$\\{\\}+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
+    (file "--:\\\\${}+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
     ;; An url, or maybe a email/news message-id:
     (url "--:=&address@hidden:alpha:]~#,%;*()!'" "^[0-9a-zA-Z]" ":;.,!?")
     ;; Find a string that does *not* contain a colon:
@@ -1013,6 +1077,9 @@ If a given RFC isn't in these then `ffap-rfc-path' is 
offered."
     (machine "-[:alnum:]." "" ".")
     ;; Mathematica paths: allow backquotes
     (math-mode ",-:$+<>@-Z_[:lower:]~`" "<" "@>;.,!?`:")
+    ;; (La)TeX: don't allow braces
+    (latex-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
+    (tex-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
     )
   "Alist of (MODE CHARS BEG END), where MODE is a symbol,
 possibly a major-mode name, or one of the symbols
@@ -1020,7 +1087,9 @@ possibly a major-mode name, or one of the symbols
 Function `ffap-string-at-point' uses the data fields as follows:
 1. find a maximal string of CHARS around point,
 2. strip BEG chars before point from the beginning,
-3. strip END chars after point from the end.")
+3. strip END chars after point from the end.
+The arguments CHARS, BEG and END are handled as described in
+`skip-chars-forward'.")
 
 (defvar ffap-string-at-point nil
   ;; Added at suggestion of RHOGEE (for ff-paths), 7/24/95.
@@ -1134,7 +1203,7 @@ Sets the variable `ffap-string-at-point-region' to the 
bounds of URL, if any."
                                           (match-end 2))))
                (set var val)
                (forward-line 1)))
-            (setcdr ffap-string-at-point-region (point))
+            (setcdr ffap-string-at-point-region (list (point)))
            (if (and path (string-match "^ftp:.*@" path))
                (concat "ftp://";
                        (substring path 4 (1- (match-end 0)))
@@ -1568,7 +1637,7 @@ Applies `ffap-menu-text-plist' text properties at all 
matches."
            (add-text-properties (car ffap-string-at-point-region) (point)
                                 ffap-menu-text-plist)
            (message "Scanning...%2d%% <%s>"
-                    (/ (* 100 (- (point) (point-min))) range) item)))
+                    (floor (* 100.0 (- (point) (point-min))) range) item)))
       (or mod (restore-buffer-modified-p nil))))
   (message "Scanning...done")
   ;; Remove duplicates.
diff --git a/lisp/files-x.el b/lisp/files-x.el
index a130ffc..524ad49 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -189,7 +189,7 @@ from the Local Variables list ignoring the input argument 
VALUE."
        (unless (let ((case-fold-search t))
                  (goto-char beg)
                  (search-forward "Local Variables:" nil t))
-         (throw 'exit (message "Can't add file-local variables"))))
+         (throw 'exit (message "Can’t add file-local variables"))))
 
       ;; prefix is what comes before "local variables:" in its line.
       ;; suffix is what comes after "local variables:" in its line.
diff --git a/lisp/files.el b/lisp/files.el
index a371344..f96ac09 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -995,10 +995,10 @@ directory if it does not exist."
               (put 'user-emacs-directory-warning 'this-session t)
               (display-warning 'initialization
                                (format "\
-Unable to %s `user-emacs-directory' (%s).
+Unable to %s ‘user-emacs-directory’ (%s).
 Any data that would normally be written there may be lost!
 If you never want to see this message again,
-customize the variable `user-emacs-directory-warning'."
+customize the variable ‘user-emacs-directory-warning’."
                                        errtype user-emacs-directory)))))
        bestname))))
 
@@ -1641,8 +1641,8 @@ killed."
     (user-error "Aborted"))
   (and (buffer-modified-p) buffer-file-name
        (not (yes-or-no-p
-             (format "Kill and replace buffer `%s' without saving it? "
-                     (buffer-name))))
+             (format-message "Kill and replace buffer ‘%s’ without saving it? "
+                             (buffer-name))))
        (user-error "Aborted"))
   (let ((obuf (current-buffer))
        (ofile buffer-file-name)
@@ -2789,7 +2789,7 @@ we don't actually set it to the same mode the buffer 
already has."
        (catch 'nop
          (dolist (mode (nreverse modes))
            (if (not (functionp mode))
-               (message "Ignoring unknown mode `%s'" mode)
+               (message "Ignoring unknown mode ‘%s’" mode)
              (setq done t)
              (or (set-auto-mode-0 mode keep-mode-if-same)
                  ;; continuing would call minor modes again, toggling them off
@@ -2803,7 +2803,7 @@ we don't actually set it to the same mode the buffer 
already has."
         (setq mode (hack-local-variables t))
         (not (memq mode modes))        ; already tried and failed
         (if (not (functionp mode))
-            (message "Ignoring unknown mode `%s'" mode)
+            (message "Ignoring unknown mode ‘%s’" mode)
           (setq done t)
           (set-auto-mode-0 mode keep-mode-if-same)))
     ;; If we didn't, look for an interpreter specified in the first line.
@@ -3419,9 +3419,10 @@ local variables, but directory-local variables may still 
be applied."
                                 (setq hack-local-variables--warned-lexical t)
                                 (display-warning
                                   :warning
-                                  (format "%s: `lexical-binding' at end of 
file unreliable"
-                                          (file-name-nondirectory
-                                           (or buffer-file-name ""))))))
+                                  (format-message
+                                   "%s: ‘lexical-binding’ at end of file 
unreliable"
+                                   (file-name-nondirectory
+                                    (or buffer-file-name ""))))))
                              (t
                               (ignore-errors
                                 (push (cons (if (eq var 'eval)
@@ -3554,8 +3555,9 @@ It is dangerous if either of these conditions are met:
             (since (nth 2 o)))
         (message "%s is obsolete%s; %s"
                  var (if since (format " (since %s)" since))
-                 (if (stringp instead) instead
-                   (format "use `%s' instead" instead)))))))
+                 (if (stringp instead)
+                     (substitute-command-keys instead)
+                   (format-message "use ‘%s’ instead" instead)))))))
 
 (defun hack-one-local-variable (var val)
   "Set local variable VAR with value VAL.
@@ -3672,7 +3674,7 @@ variables from CLASS are applied to the buffer.  The 
variables
 for a class are defined using `dir-locals-set-class-variables'."
   (setq directory (file-name-as-directory (expand-file-name directory)))
   (unless (assq class dir-locals-class-alist)
-    (error "No such class `%s'" (symbol-name class)))
+    (error "No such class ‘%s’" (symbol-name class)))
   (push (list directory class mtime) dir-locals-directory-cache))
 
 (defun dir-locals-set-class-variables (class variables)
@@ -4027,7 +4029,8 @@ Interactively, confirmation is required unless you supply 
a prefix argument."
             (not (and (eq (framep-on-display) 'ns)
                       (listp last-nonmenu-event)
                       use-dialog-box))
-            (or (y-or-n-p (format "File `%s' exists; overwrite? " filename))
+            (or (y-or-n-p (format-message
+                            "File ‘%s’ exists; overwrite? " filename))
                 (user-error "Canceled")))
        (set-visited-file-name filename (not confirm))))
   (set-buffer-modified-p t)
@@ -4732,8 +4735,9 @@ Before and after saving the buffer, this function runs
                         ;; Signal an error if the user specified the name of an
                         ;; existing directory.
                         (error "%s is a directory" filename)
-                      (unless (y-or-n-p (format "File `%s' exists; overwrite? "
-                                                filename))
+                      (unless (y-or-n-p (format-message
+                                         "File ‘%s’ exists; overwrite? "
+                                         filename))
                         (error "Canceled"))))
                 (set-visited-file-name filename)))
          (or (verify-visited-file-modtime (current-buffer))
@@ -4773,7 +4777,8 @@ Before and after saving the buffer, this function runs
                            (expand-file-name buffer-file-name))))
                  (unless (file-exists-p dir)
                    (if (y-or-n-p
-                        (format "Directory `%s' does not exist; create? " dir))
+                        (format-message
+                          "Directory ‘%s’ does not exist; create? " dir))
                        (make-directory dir t)
                      (error "Canceled")))
                  (setq setmodes (basic-save-buffer-1))))
@@ -5216,8 +5221,8 @@ given.  With a prefix argument, TRASH is nil."
      (list dir
           (if (directory-files dir nil directory-files-no-dot-files-regexp)
               (y-or-n-p
-               (format "Directory `%s' is not empty, really %s? "
-                       dir (if trashing "trash" "delete")))
+               (format-message "Directory ‘%s’ is not empty, really %s? "
+                                dir (if trashing "trash" "delete")))
             nil)
           (null current-prefix-arg))))
   ;; If default-directory is a remote directory, make sure we find its
@@ -5322,7 +5327,7 @@ directly into NEWNAME instead."
            default-directory default-directory nil nil)
           current-prefix-arg t nil)))
   (when (file-in-directory-p newname directory)
-    (error "Cannot copy `%s' into its subdirectory `%s'"
+    (error "Cannot copy ‘%s’ into its subdirectory ‘%s’"
            directory newname))
   ;; If default-directory is a remote directory, make sure we find its
   ;; copy-directory handler.
@@ -5694,7 +5699,7 @@ To choose one, move point to the proper line and then 
type C-c C-c.
 Then you'll be asked about a number of files to recover."
   (interactive)
   (if (null auto-save-list-file-prefix)
-      (error "You set `auto-save-list-file-prefix' to disable making session 
files"))
+      (error "You set ‘auto-save-list-file-prefix’ to disable making session 
files"))
   (let ((dir (file-name-directory auto-save-list-file-prefix))
         (nd (file-name-nondirectory auto-save-list-file-prefix)))
     (unless (file-directory-p dir)
@@ -5788,7 +5793,7 @@ This command is used in the special Dired buffer created 
by
                               (condition-case nil
                                   (save-excursion (recover-file file))
                                 (error
-                                 "Failed to recover `%s'" file)))
+                                 "Failed to recover ‘%s’" file)))
                             files
                             '("file" "files" "recover"))
            (message "No files can be recovered from this session now")))
@@ -6473,7 +6478,7 @@ normally equivalent short `-D' option is just passed on to
                 file result)
              ;; Unix.  Access the file to get a suitable error.
              (access-file file "Reading directory")
-             (error "Listing directory failed but `access-file' worked")))
+             (error "Listing directory failed but ‘access-file’ worked")))
 
          (when (if (stringp switches)
                    (string-match "--dired\\>" switches)
@@ -6766,7 +6771,7 @@ for the specified category of users."
        ((= char ?g) #o2070)
        ((= char ?o) #o1007)
        ((= char ?a) #o7777)
-       (t (error "%c: bad `who' character" char))))
+       (t (error "%c: bad ‘who’ character" char))))
 
 (defun file-modes-char-to-right (char &optional from)
   "Convert CHAR to a numeric value of mode bits.
@@ -6838,7 +6843,7 @@ as in \"og+rX-w\"."
                    (file-modes-rights-to-number (substring modes (match-end 1))
                                                 num-who num-modes)
                    modes (substring modes (match-end 3))))
-         (error "Parse error in modes near `%s'" (substring modes 0))))
+         (error "Parse error in modes near ‘%s’" (substring modes 0))))
       num-modes)))
 
 (defun read-file-modes (&optional prompt orig-file)
@@ -6907,7 +6912,7 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
                                               trash-dir)))
           ;; We can't trash a parent directory of trash-directory.
           (if (string-prefix-p fn trash-dir)
-              (error "Trash directory `%s' is a subdirectory of `%s'"
+              (error "Trash directory ‘%s’ is a subdirectory of ‘%s’"
                      trash-dir filename))
           (unless (file-directory-p trash-dir)
             (make-directory trash-dir t))
diff --git a/lisp/filesets.el b/lisp/filesets.el
index f990333..8e2b145 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -416,7 +416,7 @@ Possible uses: If you don't want to save `filesets-data' in 
your normal
 configuration file, you can add a something like this
 
        \(lambda ()
-             \(insert (format \"(setq-default filesets-data '%S)\"
+             \(insert (format \"(setq-default filesets-data \\='%S)\"
                              filesets-data))
              \(newline 2))
 
@@ -975,7 +975,7 @@ being an association list with the fields:
 
 :pattern DIR PATTERN ... a base directory and a regexp matching
                          files in that directory.  Usually,
-                         PATTERN has the form '^REGEXP$'.  Unlike
+                         PATTERN has the form `^REGEXP$'.  Unlike
                          :tree, this form does not descend
                          recursively into subdirectories.
 
@@ -1799,7 +1799,7 @@ User will be queried, if no fileset name is provided."
                     (current-buffer)))
         (name   (or name
                     (completing-read
-                     (format "Add '%s' to fileset: " buffer)
+                     (format-message "Add ‘%s’ to fileset: " buffer)
                      filesets-data nil)))
          (entry  (or (assoc name filesets-data)
                      (when (y-or-n-p
@@ -1808,7 +1808,8 @@ User will be queried, if no fileset name is provided."
                        (progn
       (add-to-list 'filesets-data (list name '(:files)))
       (message
-       "Fileset %s created.  Call `M-x filesets-save-config' to save."
+       (substitute-command-keys
+        "Fileset %s created.  Call `\\[filesets-save-config]' to save.")
        name)
       (car filesets-data))))))
     (if entry
@@ -1818,13 +1819,13 @@ User will be queried, if no fileset name is provided."
                                        :test 'filesets-files-equalp)))
          (cond
           (inlist
-           (message "Filesets: '%s' is already in '%s'" this name))
+           (message "Filesets: ‘%s’ is already in ‘%s’" this name))
           ((and (equal (filesets-entry-mode entry) ':files)
                 this)
            (filesets-entry-set-files entry (cons this files) t)
            (filesets-set-config name 'filesets-data filesets-data))
           (t
-           (message "Filesets: Can't add '%s' to fileset '%s'" this name)))))))
+           (message "Filesets: Can't add ‘%s’ to fileset ‘%s’" this name)))))))
 
 (defun filesets-remove-buffer (&optional name buffer)
   "Remove BUFFER (or current buffer) to fileset NAME.
@@ -1834,7 +1835,7 @@ User will be queried, if no fileset name is provided."
                     (current-buffer)))
         (name   (or name
                     (completing-read
-                     (format "Remove '%s' from fileset: " buffer)
+                     (format-message "Remove ‘%s’ from fileset: " buffer)
                      filesets-data nil t)))
                 (entry (assoc name filesets-data)))
     (if entry
@@ -1847,7 +1848,7 @@ User will be queried, if no fileset name is provided."
              (let ((new (list (cons ':files (delete (car inlist) files)))))
                (setcdr entry new)
                (filesets-set-config name 'filesets-data filesets-data))
-           (message "Filesets: Can't remove '%s' from fileset '%s'"
+           (message "Filesets: Can't remove ‘%s’ from fileset ‘%s’"
                     this
                     name))))))
 
@@ -2436,38 +2437,38 @@ fileset thinks this is necessary or not."
   (filesets-menu-cache-file-load))
 
 (defun filesets-update-pre010505 ()
-  (let ((msg
+  (let ((msg (format-message
 "Filesets: manual editing of user data required!
 
 Filesets has detected that you were using an older version before,
-which requires some manual updating. Type 'y' for editing the startup
+which requires some manual updating. Type ‘y’ for editing the startup
 file now.
 
-The layout of `filesets-data' has changed. Please delete your cache file
+The layout of ‘filesets-data’ has changed. Please delete your cache file
 and edit your startup file as shown below:
 
-1. `filesets-data': Edit all :pattern filesets in your startup file and
+1. ‘filesets-data’: Edit all :pattern filesets in your startup file and
 transform all entries as shown in this example:
 
        \(\"Test\" (:pattern \"~/dir/^pattern$\"))
        --> \(\"Test\" (:pattern \"~/dir/\" \"^pattern$\"))
 
-2. `filesets-data': Change all occurrences of \":document\" to \":ingroup\":
+2. ‘filesets-data’: Change all occurrences of \":document\" to \":ingroup\":
 
       \(\(\"Test\" \(:document \"~/dir/file\"))
       --> \(\(\"Test\" \(:ingroup \"~/dir/file\"))
 
-3. `filesets-subdocument-patterns': If you already modified the variable
-previously called `filesets-subdocument-patterns', change its name to
-`filesets-ingroup-patterns'.
+3. ‘filesets-subdocument-patterns’: If you already modified the variable
+previously called ‘filesets-subdocument-patterns’, change its name to
+‘filesets-ingroup-patterns’.
 
-4. `filesets-menu-cache-contents': If you already modified this
-variable, change the entry `filesets-subdocument--cache' to
-`filesets-ingroup-cache'.
+4. ‘filesets-menu-cache-contents’: If you already modified this
+variable, change the entry ‘filesets-subdocument--cache’ to
+‘filesets-ingroup-cache’.
 
 5. Type M-x filesets-update-cleanup and restart Emacs.
 
-We apologize for the inconvenience."))
+We apologize for the inconvenience.")))
     (let* ((cf (or custom-file user-init-file)))
       (switch-to-buffer-other-frame "*Filesets update*")
       (insert msg)
diff --git a/lisp/find-cmd.el b/lisp/find-cmd.el
index 7230761..8e41906 100644
--- a/lisp/find-cmd.el
+++ b/lisp/find-cmd.el
@@ -140,8 +140,8 @@ the string will be quoted).")
   "Initiate the building of a find command.
 For example:
 
-\(find-cmd '\(prune \(name \".svn\" \".git\" \".CVS\"\)\)
-          '\(and \(or \(name \"*.pl\" \"*.pm\" \"*.t\"\)
+\(find-cmd \\='\(prune \(name \".svn\" \".git\" \".CVS\"\)\)
+          \\='\(and \(or \(name \"*.pl\" \"*.pm\" \"*.t\"\)
                     \(mtime \"+1\"\)\)
                 \(fstype \"nfs\" \"ufs\"\)\)\)\)
 
@@ -161,7 +161,7 @@ result is a string that should be ready for the command 
line."
   "And FORMs together, so:
   \(and \(mtime \"+1\"\) \(name \"something\"\)\)
 will produce:
-  find . \\\( -mtime '+1' -and -name 'something' \\\)"
+  find . \\\( -mtime +1 -and -name something \\\)"
   (if (< (length form) 2)
       (find-to-string (car form))
       (concat "\\( "
@@ -172,7 +172,7 @@ will produce:
   "Or FORMs together, so:
   \(or \(mtime \"+1\"\) \(name \"something\"\)\)
 will produce:
-  find . \\\( -mtime '+1' -or -name 'something' \\\)"
+  find . \\\( -mtime +1 -or -name something \\\)"
   (if (< (length form) 2)
       (find-to-string (car form))
       (concat "\\( "
@@ -183,19 +183,19 @@ will produce:
   "Or FORMs together and prefix with a -not, so:
   \(not \(mtime \"+1\"\) \(name \"something\"\)\)
 will produce:
-  -not \\\( -mtime '+1' -or -name 'something' \\\)
+  -not \\\( -mtime +1 -or -name something \\\)
 If you wanted the FORMs -and(ed) together instead then this would
 suffice:
   \(not \(and \(mtime \"+1\"\) \(name \"something\"\)\)\)"
   (concat "-not " (find-or (mapcar #'find-to-string form))))
 
 (defun find-prune (form)
-  "-or together FORMs postfix '-prune' and then -or that with a
+  "-or together FORMs postfix `-prune' and then -or that with a
 -true, so:
-  \(prune \(name \".svn\" \".git\"\)\) \(name \"*.pm\"\)
+  \(\(prune \(name \".svn\" \".git\"\)\) \(name \"*.pm\"\)\)
 will produce (unwrapped):
-  \\\( \\\( \\\( -name '.svn' -or -name '.git' \\\) /
-  -prune -or -true \\\) -and -name '*.pm' \\\)"
+  \\\( \\\( \\\( -name .svn -or -name .git \\\) /
+  -prune -or -true \\\) -and -name *.pm \\\)"
   (find-or
    (list
     (concat (find-or (mapcar #'find-to-string form)) (find-generic "prune"))
@@ -209,7 +209,7 @@ args that OPTION can receive and ARGS are the arguments for 
OPTION.
 If DONT-QUOTE is non-nil, arguments are quoted for passing them to
 the shell."
   (when (and (numberp argcount) (< (length args) argcount))
-    (error "'%s' needs at least %d arguments" option argcount))
+    (error "‘%s’ needs at least %d arguments" option argcount))
   (let ((oper (or oper 'find-or)))
     (if (and args (length args))
         (funcall oper (mapcar (lambda (x)
@@ -247,7 +247,7 @@ them into valid switches.  The result is -and(ed) together."
             (find-to-string
              (find-generic option oper argcnt (cdr form) dont-quote))))
          (t
-          (error "Sorry I don't know how to handle '%s'" (car form))))))))
+          (error "Sorry I don't know how to handle ‘%s’" (car form))))))))
 
 (provide 'find-cmd)
 
diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 0dc98de..b53c1da 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -151,7 +151,8 @@ use in place of \"-ls\" as the final argument."
     (let ((find (get-buffer-process (current-buffer))))
       (when find
        (if (or (not (eq (process-status find) 'run))
-               (yes-or-no-p "A `find' process is running; kill it? "))
+               (yes-or-no-p
+                (format-message "A `find' process is running; kill it? ")))
            (condition-case nil
                (progn
                  (interrupt-process find)
@@ -238,7 +239,7 @@ and run Dired on those files.
 PATTERN is a shell wildcard (not an Emacs regexp) and need not be quoted.
 The default command run (after changing into DIR) is
 
-    find . -name 'PATTERN' -ls
+    find . -name \\='PATTERN\\=' -ls
 
 See `find-name-arg' to customize the arguments."
   (interactive
diff --git a/lisp/finder.el b/lisp/finder.el
index 715dd94..51226ae 100644
--- a/lisp/finder.el
+++ b/lisp/finder.el
@@ -393,7 +393,7 @@ FILE should be in a form suitable for passing to 
`locate-library'."
       (if (locate-library (match-string 1))
           (make-text-button (match-beginning 1) (match-end 1)
                             'xref (match-string-no-properties 1)
-                            'help-echo "Read this file's commentary"
+                            'help-echo "Read this file’s commentary"
                             :type 'finder-xref)))
     (goto-char (point-min))
     (setq buffer-read-only t)
diff --git a/lisp/follow.el b/lisp/follow.el
index abb874e..d62d557 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -405,7 +405,7 @@ mileage may vary).
 
 To split one large window into two side-by-side windows, the commands
 `\\[split-window-right]' or \
-`M-x follow-delete-other-windows-and-split' can be used.
+`\\[follow-delete-other-windows-and-split]' can be used.
 
 Only windows displayed in the same frame follow each other.
 
diff --git a/lisp/font-core.el b/lisp/font-core.el
index 5dd6ad3..6d8588b 100644
--- a/lisp/font-core.el
+++ b/lisp/font-core.el
@@ -106,7 +106,7 @@ fontifying different parts of buffer text, use 
\\[customize-face].
 You can enable Font Lock mode in any major mode automatically by turning on in
 the major mode's hook.  For example, put in your ~/.emacs:
 
- (add-hook 'c-mode-hook 'turn-on-font-lock)
+ (add-hook \\='c-mode-hook \\='turn-on-font-lock)
 
 Alternatively, you can use Global Font Lock mode to automagically turn on Font
 Lock mode in buffers whose major mode supports it and whose major mode is one
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index b145513..5f12c6c 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -696,12 +696,12 @@ pass nil for MODE and add the call to c-mode-hook.
 
 For example:
 
- (add-hook 'c-mode-hook
+ (add-hook \\='c-mode-hook
   (lambda ()
    (font-lock-add-keywords nil
-    '((\"\\\\\\=<\\\\(FIXME\\\\):\" 1 'font-lock-warning-face prepend)
+    \\='((\"\\\\\\=<\\\\(FIXME\\\\):\" 1 \\='font-lock-warning-face prepend)
       (\"\\\\\\=<\\\\(and\\\\|or\\\\|not\\\\)\\\\\\=>\" .
-       'font-lock-keyword-face)))))
+       \\='font-lock-keyword-face)))))
 
 The above procedure may fail to add keywords to derived modes if
 some involved major mode does not follow the standard conventions.
@@ -1051,7 +1051,7 @@ The region it returns may start or end in the middle of a 
line.")
    ;; Of course, this function doesn't do all of the above in all situations
    ;; (e.g. depending on whether jit-lock is in use) and it can't guess what
    ;; the caller wants.
-   (interactive-only "use `font-lock-ensure' or `font-lock-flush' instead."))
+   (interactive-only "use ‘font-lock-ensure’ or ‘font-lock-flush’ instead."))
   (interactive "p")
   (font-lock-set-defaults)
   (let ((font-lock-verbose (or font-lock-verbose interactively)))
diff --git a/lisp/format.el b/lisp/format.el
index 1a05e7e..7ab68c8 100644
--- a/lisp/format.el
+++ b/lisp/format.el
@@ -395,8 +395,8 @@ unless you supply a prefix argument."
                                  (cdr (assq 'default-directory
                                             (buffer-local-variables)))
                                  nil nil (buffer-name))))
-         (fmt (format-read (format "Write file `%s' in format: "
-                                   (file-name-nondirectory file)))))
+         (fmt (format-read (format-message "Write file ‘%s’ in format: "
+                                            (file-name-nondirectory file)))))
      (list file fmt (not current-prefix-arg))))
   (let ((old-formats buffer-file-format)
        preserve-formats)
@@ -416,8 +416,8 @@ If FORMAT is nil then do not do any format conversion."
   (interactive
    ;; Same interactive spec as write-file, plus format question.
    (let* ((file (read-file-name "Find file: "))
-         (fmt (format-read (format "Read file `%s' in format: "
-                                   (file-name-nondirectory file)))))
+         (fmt (format-read (format-message "Read file ‘%s’ in format: "
+                                            (file-name-nondirectory file)))))
      (list file fmt)))
   (let ((format-alist nil))
      (find-file filename))
@@ -435,8 +435,8 @@ a list (ABSOLUTE-FILE-NAME SIZE)."
   (interactive
    ;; Same interactive spec as write-file, plus format question.
    (let* ((file (read-file-name "Find file: "))
-         (fmt (format-read (format "Read file `%s' in format: "
-                                   (file-name-nondirectory file)))))
+         (fmt (format-read (format-message "Read file ‘%s’ in format: "
+                                            (file-name-nondirectory file)))))
      (list file fmt)))
   (let (value size old-undo)
     ;; Record only one undo entry for the insertion.  Inhibit point-motion and
diff --git a/lisp/forms.el b/lisp/forms.el
index bccb4a0..e7e399f 100644
--- a/lisp/forms.el
+++ b/lisp/forms.el
@@ -692,10 +692,12 @@ Commands:                        Equivalent keys in 
read-only mode:
        (insert
         "GNU Emacs Forms Mode\n\n"
         (if (file-exists-p forms-file)
-            (concat "No records available in file `" forms-file "'\n\n")
-          (format "Creating new file `%s'\nwith %d field%s per record\n\n"
-                  forms-file forms-number-of-fields
-                  (if (= 1 forms-number-of-fields) "" "s")))
+            (format-message
+             "No records available in file `%s'\n\n" forms-file)
+          (format-message
+           "Creating new file `%s'\nwith %d field%s per record\n\n"
+           forms-file forms-number-of-fields
+           (if (= 1 forms-number-of-fields) "" "s")))
         "Use " (substitute-command-keys "\\[forms-insert-record]")
         " to create new records.\n")
        (setq forms--current-record 1)
diff --git a/lisp/frame.el b/lisp/frame.el
index 1177a00..3abb72c 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -743,7 +743,7 @@ the name of an X display device (HOST.SERVER.SCREEN) or a 
tty device file."
       (frame-terminal f)))
    ((terminal-live-p device) device)
    (t
-    (error "Invalid argument %s in `get-device-terminal'" device))))
+    (error "Invalid argument %s in ‘get-device-terminal’" device))))
 
 (defun frames-on-display-list (&optional device)
   "Return a list of all frames on DEVICE.
@@ -894,7 +894,7 @@ If there is no frame by that name, signal an error."
         (frame (cdr (assoc name frame-names-alist))))
     (if frame
        (select-frame-set-input-focus frame)
-      (error "There is no frame named `%s'" name))))
+      (error "There is no frame named ‘%s’" name))))
 
 
 ;;;; Background mode.
@@ -1312,6 +1312,136 @@ live frame and defaults to the selected one."
       (setq vertical default-frame-scroll-bars))
     (cons vertical (and horizontal 'bottom))))
 
+(declare-function x-frame-geometry "xfns.c" (&optional frame))
+(declare-function w32-frame-geometry "w32fns.c" (&optional frame))
+(declare-function ns-frame-geometry "nsfns.m" (&optional frame))
+
+(defun frame-geometry (&optional frame)
+  "Return geometric attributes of FRAME.
+FRAME must be a live frame and defaults to the selected one.  The return
+value is an association list of the attributes listed below.  All height
+and width values are in pixels.
+
+`outer-position' is a cons of the outer left and top edges of FRAME
+  relative to the origin - the position (0, 0) - of FRAME's display.
+
+`outer-size' is a cons of the outer width and height of FRAME.  The
+  outer size includes the title bar and the external borders as well as
+  any menu and/or tool bar of frame.
+
+`external-border-size' is a cons of the horizontal and vertical width of
+  FRAME's external borders as supplied by the window manager.
+
+`title-bar-size' is a cons of the width and height of the title bar of
+  FRAME as supplied by the window manager.  If both of them are zero,
+  FRAME has no title bar.  If only the width is zero, Emacs was not
+  able to retrieve the width information.
+
+`menu-bar-external', if non-nil, means the menu bar is external (never
+  included in the inner edges of FRAME).
+
+`menu-bar-size' is a cons of the width and height of the menu bar of
+  FRAME.
+
+`tool-bar-external', if non-nil, means the tool bar is external (never
+  included in the inner edges of FRAME).
+
+`tool-bar-position' tells on which side the tool bar on FRAME is and can
+  be one of `left', `top', `right' or `bottom'.  If this is nil, FRAME
+  has no tool bar.
+
+`tool-bar-size' is a cons of the width and height of the tool bar of
+  FRAME.
+
+`internal-border-width' is the width of the internal border of
+  FRAME."
+  (let* ((frame (window-normalize-frame frame))
+        (frame-type (framep-on-display frame)))
+    (cond
+     ((eq frame-type 'x)
+      (x-frame-geometry frame))
+     ((eq frame-type 'w32)
+      (w32-frame-geometry frame))
+     ((eq frame-type 'ns)
+      (ns-frame-geometry frame))
+     (t
+      (list
+       '(outer-position 0 . 0)
+       (cons 'outer-size (cons (frame-width frame) (frame-height frame)))
+       '(external-border-size 0 . 0)
+       '(title-bar-size 0 . 0)
+       '(menu-bar-external . nil)
+       (let ((menu-bar-lines (frame-parameter frame 'menu-bar-lines)))
+        (cons 'menu-bar-size
+              (if menu-bar-lines
+                  (cons (frame-width frame) 1)
+                1 0)))
+       '(tool-bar-external . nil)
+       '(tool-bar-position . nil)
+       '(tool-bar-size 0 . 0)
+       (cons 'internal-border-width
+            (frame-parameter frame 'internal-border-width)))))))
+
+(declare-function x-frame-edges "xfns.c" (&optional frame type))
+(declare-function w32-frame-edges "w32fns.c" (&optional frame type))
+(declare-function ns-frame-edges "nsfns.m" (&optional frame type))
+
+(defun frame-edges (&optional frame type)
+  "Return coordinates of FRAME's edges.
+FRAME must be a live frame and defaults to the selected one.  The
+list returned has the form (LEFT TOP RIGHT BOTTOM) where all
+values are in pixels relative to the origin - the position (0, 0)
+- of FRAME's display.  For terminal frames all values are
+relative to LEFT and TOP which are both zero.
+
+Optional argument TYPE specifies the type of the edges.  TYPE
+`outer-edges' means to return the outer edges of FRAME.  TYPE
+`native-edges' (or nil) means to return the native edges of
+FRAME.  TYPE `inner-edges' means to return the inner edges of
+FRAME."
+  (let* ((frame (window-normalize-frame frame))
+        (frame-type (framep-on-display frame)))
+    (cond
+     ((eq frame-type 'x)
+      (x-frame-edges frame type))
+     ((eq frame-type 'w32)
+      (w32-frame-edges frame type))
+     ((eq frame-type 'ns)
+      (ns-frame-edges frame type))
+     (t
+      (list 0 0 (frame-width frame) (frame-height frame))))))
+
+(declare-function w32-mouse-absolute-pixel-position "w32fns.c")
+(declare-function x-mouse-absolute-pixel-position "xfns.c")
+
+(defun mouse-absolute-pixel-position ()
+  "Return absolute position of mouse cursor in pixels.
+The position is returned as a cons cell (X . Y) of the
+coordinates of the mouse cursor position in pixels relative to a
+position (0, 0) of the selected frame's terminal."
+  (let ((frame-type (framep-on-display)))
+    (cond
+     ((eq frame-type 'x)
+      (x-mouse-absolute-pixel-position))
+     ((eq frame-type 'w32)
+      (w32-mouse-absolute-pixel-position))
+     (t
+      (cons 0 0)))))
+
+(declare-function w32-set-mouse-absolute-pixel-position "w32fns.c" (x y))
+(declare-function x-set-mouse-absolute-pixel-position "xfns.c" (x y))
+
+(defun set-mouse-absolute-pixel-position (x y)
+  "Move mouse pointer to absolute pixel position (X, Y).
+The coordinates X and Y are interpreted in pixels relative to a
+position (0, 0) of the selected frame's terminal."
+  (let ((frame-type (framep-on-display)))
+    (cond
+     ((eq frame-type 'x)
+      (x-set-mouse-absolute-pixel-position x y))
+     ((eq frame-type 'w32)
+      (w32-set-mouse-absolute-pixel-position x y)))))
+
 (defun frame-monitor-attributes (&optional frame)
   "Return the attributes of the physical monitor dominating FRAME.
 If FRAME is omitted or nil, describe the currently selected frame.
diff --git a/lisp/fringe.el b/lisp/fringe.el
index 8f40c46..f982b35 100644
--- a/lisp/fringe.el
+++ b/lisp/fringe.el
@@ -122,7 +122,7 @@ See `fringe-mode' for possible values and their effect."
       (and (consp style)
           (or (null (car style)) (integerp (car style)))
           (or (null (cdr style)) (integerp (cdr style))))
-      (error "Invalid fringe style `%s'" style)))
+      (error "Invalid fringe style ‘%s’" style)))
 
 ;; For initialization of fringe-mode, take account of changes
 ;; made explicitly to default-frame-alist.
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el
index d502a3b..3f426bf 100644
--- a/lisp/gnus/auth-source.el
+++ b/lisp/gnus/auth-source.el
@@ -242,7 +242,7 @@ EPA/EPG set up, the file will be encrypted and decrypted
 automatically.  See Info node `(epa)Encrypting/decrypting gpg files'
 for details.
 
-It's best to customize this with `M-x customize-variable' because the choices
+It's best to customize this with `\\[customize-variable]' because the choices
 can get pretty complex."
   :group 'auth-source
   :version "24.1" ;; No Gnus
@@ -577,25 +577,25 @@ port keys.
 
 Here's an example:
 
-\(let ((auth-source-creation-defaults '((user . \"defaultUser\")
+\(let ((auth-source-creation-defaults \\='((user . \"defaultUser\")
                                         (A    . \"default A\"))))
-  (auth-source-search :host \"mine\" :type 'netrc :max 1
+  (auth-source-search :host \"mine\" :type \\='netrc :max 1
                       :P \"pppp\" :Q \"qqqq\"
                       :create t))
 
 which says:
 
-\"Search for any entry matching host 'mine' in backends of type
- 'netrc', maximum one result.
+\"Search for any entry matching host `mine' in backends of type
+ `netrc', maximum one result.
 
  Create a new entry if you found none.  The netrc backend will
  automatically require host, user, and port.  The host will be
- 'mine'.  We prompt for the user with default 'defaultUser' and
+ `mine'.  We prompt for the user with default `defaultUser' and
  for the port without a default.  We will not prompt for A, Q,
  or P.  The resulting token will only have keys user, host, and
  port.\"
 
-:create '(A B C) also means to create a token if possible.
+:create \\='(A B C) also means to create a token if possible.
 
 The behavior is like :create t but if the list contains any
 parameter, that parameter will be required in the resulting
@@ -604,32 +604,32 @@ search parameters or from user input.  If any queries are 
needed,
 the alist `auth-source-creation-defaults' will be checked for the
 default value.  If the user, host, or port are missing, the alist
 `auth-source-creation-prompts' will be used to look up the
-prompts IN THAT ORDER (so the 'user prompt will be queried first,
-then 'host, then 'port, and finally 'secret).  Each prompt string
+prompts IN THAT ORDER (so the `user' prompt will be queried first,
+then `host', then `port', and finally `secret').  Each prompt string
 can use %u, %h, and %p to show the user, host, and port.
 
 Here's an example:
 
-\(let ((auth-source-creation-defaults '((user . \"defaultUser\")
+\(let ((auth-source-creation-defaults \\='((user . \"defaultUser\")
                                         (A    . \"default A\")))
        (auth-source-creation-prompts
-        '((password . \"Enter IMAP password for %h:%p: \"))))
-  (auth-source-search :host '(\"nonesuch\" \"twosuch\") :type 'netrc :max 1
+        \\='((password . \"Enter IMAP password for %h:%p: \"))))
+  (auth-source-search :host \\='(\"nonesuch\" \"twosuch\") :type \\='netrc 
:max 1
                       :P \"pppp\" :Q \"qqqq\"
-                      :create '(A B Q)))
+                      :create \\='(A B Q)))
 
 which says:
 
-\"Search for any entry matching host 'nonesuch'
- or 'twosuch' in backends of type 'netrc', maximum one result.
+\"Search for any entry matching host `nonesuch'
+ or `twosuch' in backends of type `netrc', maximum one result.
 
  Create a new entry if you found none.  The netrc backend will
  automatically require host, user, and port.  The host will be
- 'nonesuch' and Q will be 'qqqq'.  We prompt for the password
+ `nonesuch' and Q will be `qqqq'.  We prompt for the password
  with the shown prompt.  We will not prompt for Q.  The resulting
  token will have keys user, host, port, A, B, and Q.  It will not
  have P with any value, even though P is used in the search to
- find only entries that have P set to 'pppp'.\"
+ find only entries that have P set to `pppp'.\"
 
 When multiple values are specified in the search parameter, the
 user is prompted for which one.  So :host (X Y Z) would ask the
@@ -650,8 +650,8 @@ property.
 Use `auth-source-delete' in ELisp code instead of calling
 `auth-source-search' directly with this parameter.
 
-:type (X Y Z) will check only those backend types.  'netrc and
-'secrets are the only ones supported right now.
+:type (X Y Z) will check only those backend types.  `netrc' and
+`secrets' are the only ones supported right now.
 
 :max N means to try to return at most N items (defaults to 1).
 More than N items may be returned, depending on the search and
@@ -1097,7 +1097,7 @@ Note that the MAX parameter is used so we can exit the 
parse early."
           (if (equal item2 "machine")
               (progn
                 (gnus-error 1
-                 "%s: Unexpected 'machine' token at line %d"
+                 "%s: Unexpected `machine' token at line %d"
                  "auth-source-netrc-parse-entries"
                  (auth-source-current-line))
                 (forward-line 1))
@@ -1554,23 +1554,23 @@ matching, do a wider search and narrow it down yourself.
 
 You'll get back all the properties of the token as a plist.
 
-Here's an example that looks for the first item in the 'Login'
+Here's an example that looks for the first item in the `Login'
 Secrets collection:
 
- \(let ((auth-sources '(\"secrets:Login\")))
+ \(let ((auth-sources \\='(\"secrets:Login\")))
     (auth-source-search :max 1)
 
-Here's another that looks for the first item in the 'Login'
-Secrets collection whose label contains 'gnus':
+Here's another that looks for the first item in the `Login'
+Secrets collection whose label contains `gnus':
 
- \(let ((auth-sources '(\"secrets:Login\")))
+ \(let ((auth-sources \\='(\"secrets:Login\")))
     (auth-source-search :max 1 :label \"gnus\")
 
-And this one looks for the first item in the 'Login' Secrets
+And this one looks for the first item in the `Login' Secrets
 collection that's a Google Chrome entry for the git.gnus.org site
 authentication tokens:
 
- \(let ((auth-sources '(\"secrets:Login\")))
+ \(let ((auth-sources \\='(\"secrets:Login\")))
     (auth-source-search :max 1 :signon_realm \"https://git.gnus.org/Git\";))
 "
 
@@ -1674,8 +1674,8 @@ matching, do a wider search and narrow it down yourself.
 
 You'll get back all the properties of the token as a plist.
 
-The :type key is either 'macos-keychain-internet or
-'macos-keychain-generic.
+The :type key is either `macos-keychain-internet' or
+`macos-keychain-generic'.
 
 For the internet keychain type, the :label key searches the
 item's labels (\"-l LABEL\" passed to \"/usr/bin/security\").
@@ -1691,19 +1691,19 @@ field), :user maps to \"-a USER\", and :port maps to 
\"-s PORT\".
 Here's an example that looks for the first item in the default
 generic MacOS Keychain:
 
- \(let ((auth-sources '(macos-keychain-generic)))
+ \(let ((auth-sources \\='(macos-keychain-generic)))
     (auth-source-search :max 1)
 
 Here's another that looks for the first item in the internet
-MacOS Keychain collection whose label is 'gnus':
+MacOS Keychain collection whose label is `gnus':
 
- \(let ((auth-sources '(macos-keychain-internet)))
+ \(let ((auth-sources \\='(macos-keychain-internet)))
     (auth-source-search :max 1 :label \"gnus\")
 
 And this one looks for the first item in the internet keychain
 entries for git.gnus.org:
 
- \(let ((auth-sources '(macos-keychain-internet\")))
+ \(let ((auth-sources \\='(macos-keychain-internet\")))
     (auth-source-search :max 1 :host \"git.gnus.org\"))
 "
   ;; TODO
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index f779f3c..7b35de0 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -1721,7 +1721,7 @@ and that there are no duplicates."
               (or backed-up
                   (setq backed-up (gnus-agent-backup-overview-buffer)))
              (gnus-message 1
-                           "Overview buffer contains garbage '%s'."
+                           "Overview buffer contains garbage `%s'."
                            (buffer-substring
                             p (point-at-eol))))
             ((= cur prev-num)
@@ -1901,7 +1901,7 @@ article numbers will be returned."
 
       (when articles
        (gnus-message
-        10 "gnus-agent-fetch-headers: undownloaded articles are '%s'"
+        10 "gnus-agent-fetch-headers: undownloaded articles are `%s'"
         (gnus-compress-sequence articles t)))
 
       (with-current-buffer nntp-server-buffer
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index d83eadd..1a439ec 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -399,7 +399,7 @@ advertisements.  For example:
   "*Alist that says how to fontify certain phrases.
 Each item looks like this:
 
-  (\"_\\\\(\\\\w+\\\\)_\" 0 1 'underline)
+  (\"_\\\\(\\\\w+\\\\)_\" 0 1 \\='underline)
 
 The first element is a regular expression to be matched.  The second
 is a number that says what regular expression grouping used to find
@@ -5403,9 +5403,9 @@ Compressed files like .gz and .bz2 are decompressed."
                                    'gnus-undeletable t))))
          ;; We're in the article header.
          (delete-char -1)
-         (dolist (ovl (gnus-overlays-in btn (point)))
-           (gnus-overlay-put ovl 'gnus-button-attachment-extra t)
-           (gnus-overlay-put ovl 'face nil))
+         (dolist (ovl (overlays-in btn (point)))
+           (overlay-put ovl 'gnus-button-attachment-extra t)
+           (overlay-put ovl 'face nil))
          (save-restriction
            (message-narrow-to-field)
            (let ((gnus-treatment-function-alist
@@ -5798,9 +5798,9 @@ all parts."
                                    'gnus-undeletable t))))
          ;; We're in the article header.
          (delete-char -1)
-         (dolist (ovl (gnus-overlays-in point (point)))
-           (gnus-overlay-put ovl 'gnus-button-attachment-extra t)
-           (gnus-overlay-put ovl 'face nil))
+         (dolist (ovl (overlays-in point (point)))
+           (overlay-put ovl 'gnus-button-attachment-extra t)
+           (overlay-put ovl 'face nil))
          (save-restriction
            (message-narrow-to-field)
            (let ((gnus-treatment-function-alist
@@ -5889,8 +5889,8 @@ all parts."
                (1- (point))
              (point)))
     (when gnus-article-button-face
-      (gnus-overlay-put (gnus-make-overlay b e nil t)
-                       'face gnus-article-button-face))
+      (overlay-put (make-overlay b e nil t)
+                  'face gnus-article-button-face))
     (widget-convert-button
      'link b e
      :mime-handle handle
@@ -6452,9 +6452,9 @@ in the body.  Use `gnus-header-face-alist' to highlight 
buttons."
                  (insert "\n")
                  (end-of-line)))
              (insert "\n")
-             (dolist (ovl (gnus-overlays-in (point-min) (point)))
-               (gnus-overlay-put ovl 'gnus-button-attachment-extra t)
-               (gnus-overlay-put ovl 'face nil))
+             (dolist (ovl (overlays-in (point-min) (point)))
+               (overlay-put ovl 'gnus-button-attachment-extra t)
+               (overlay-put ovl 'face nil))
              (let ((gnus-treatment-function-alist
                     '((gnus-treat-highlight-headers
                        gnus-article-highlight-headers))))
@@ -6871,11 +6871,13 @@ KEY is a string or a vector."
       (with-current-buffer gnus-article-current-summary
        (setq unread-command-events
              (if (featurep 'xemacs)
-                 (append key nil)
-               (mapcar (lambda (x) (if (and (integerp x) (>= x 128))
-                                       (list 'meta (- x 128))
-                                     x))
-                       key)))
+                 (append key unread-command-events)
+               (nconc
+                (mapcar (lambda (x) (if (and (integerp x) (>= x 128))
+                                        (list 'meta (- x 128))
+                                      x))
+                        key)
+                unread-command-events)))
        (let ((cursor-in-echo-area t)
              gnus-pick-mode)
          (describe-key (read-key-sequence nil t))))
@@ -6893,11 +6895,13 @@ KEY is a string or a vector."
       (with-current-buffer gnus-article-current-summary
        (setq unread-command-events
              (if (featurep 'xemacs)
-                 (append key nil)
-               (mapcar (lambda (x) (if (and (integerp x) (>= x 128))
-                                       (list 'meta (- x 128))
-                                     x))
-                       key)))
+                 (append key unread-command-events)
+               (nconc
+                (mapcar (lambda (x) (if (and (integerp x) (>= x 128))
+                                        (list 'meta (- x 128))
+                                      x))
+                        key)
+                unread-command-events)))
        (let ((cursor-in-echo-area t)
              gnus-pick-mode)
          (describe-key-briefly (read-key-sequence nil t) insert)))
@@ -8033,8 +8037,8 @@ It does this by highlighting everything after
       (save-restriction
        (when (and gnus-signature-face
                   (gnus-article-narrow-to-signature))
-         (gnus-overlay-put (gnus-make-overlay (point-min) (point-max) nil t)
-                           'face gnus-signature-face)
+         (overlay-put (make-overlay (point-min) (point-max) nil t)
+                      'face gnus-signature-face)
          (widen)
          (gnus-article-search-signature)
          (let ((start (match-beginning 0))
@@ -8132,12 +8136,12 @@ url is put as the `gnus-button-url' overlay property on 
the button."
                                       'gnus-button-push
                                       (list beg (assq 'gnus-button-url-regexp
                                                       gnus-button-alist)))))
-         (let ((overlay (gnus-make-overlay start end)))
-           (gnus-overlay-put overlay 'evaporate t)
-           (gnus-overlay-put overlay 'gnus-button-url
-                             (list (mapconcat 'identity (nreverse url) "")))
+         (let ((overlay (make-overlay start end)))
+           (overlay-put overlay 'evaporate t)
+           (overlay-put overlay 'gnus-button-url
+                        (list (mapconcat 'identity (nreverse url) "")))
            (when gnus-article-mouse-face
-             (gnus-overlay-put overlay 'mouse-face gnus-article-mouse-face)))
+             (overlay-put overlay 'mouse-face gnus-article-mouse-face)))
          t)
       (goto-char opoint))))
 
@@ -8176,8 +8180,8 @@ url is put as the `gnus-button-url' overlay property on 
the button."
 (defun gnus-article-add-button (from to fun &optional data text)
   "Create a button between FROM and TO with callback FUN and data DATA."
   (when gnus-article-button-face
-    (gnus-overlay-put (gnus-make-overlay from to nil t)
-                     'face gnus-article-button-face))
+    (overlay-put (make-overlay from to nil t)
+                'face gnus-article-button-face))
   (gnus-add-text-properties
    from to
    (nconc (and gnus-article-mouse-face
@@ -8516,8 +8520,8 @@ url is put as the `gnus-button-url' overlay property on 
the button."
                (1- (point))
              (point)))
     (when gnus-article-button-face
-      (gnus-overlay-put (gnus-make-overlay b e nil t)
-                        'face gnus-article-button-face))
+      (overlay-put (make-overlay b e nil t)
+                  'face gnus-article-button-face))
     (widget-convert-button
      'link b e
      :action 'gnus-button-prev-page
@@ -8552,8 +8556,8 @@ url is put as the `gnus-button-url' overlay property on 
the button."
                (1- (point))
              (point)))
     (when gnus-article-button-face
-      (gnus-overlay-put (gnus-make-overlay b e nil t)
-                        'face gnus-article-button-face))
+      (overlay-put (make-overlay b e nil t)
+                  'face gnus-article-button-face))
     (widget-convert-button
      'link b e
      :action 'gnus-button-next-page
@@ -8948,8 +8952,8 @@ For example:
                (1- (point))
              (point)))
     (when gnus-article-button-face
-      (gnus-overlay-put (gnus-make-overlay b e nil t)
-                        'face gnus-article-button-face))
+      (overlay-put (make-overlay b e nil t)
+                  'face gnus-article-button-face))
     (widget-convert-button
      'link b e
      :mime-handle handle
diff --git a/lisp/gnus/gnus-cite.el b/lisp/gnus/gnus-cite.el
index d8ee35d..57fc281 100644
--- a/lisp/gnus/gnus-cite.el
+++ b/lisp/gnus/gnus-cite.el
@@ -786,12 +786,12 @@ See also the documentation for 
`gnus-article-highlight-citation'."
 (defun gnus-cite-delete-overlays ()
   (dolist (overlay gnus-cite-overlay-list)
     (ignore-errors
-      (when (or (not (gnus-overlay-end overlay))
-               (and (>= (gnus-overlay-end overlay) (point-min))
-                    (<= (gnus-overlay-end overlay) (point-max))))
+      (when (or (not (overlay-end overlay))
+               (and (>= (overlay-end overlay) (point-min))
+                    (<= (overlay-end overlay) (point-max))))
        (setq gnus-cite-overlay-list (delete overlay gnus-cite-overlay-list))
        (ignore-errors
-         (gnus-delete-overlay overlay))))))
+         (delete-overlay overlay))))))
 
 (defun gnus-cite-parse-wrapper ()
   ;; Wrap chopped gnus-cite-parse.
@@ -1096,10 +1096,10 @@ See also the documentation for 
`gnus-article-highlight-citation'."
        (skip-chars-backward " \t")
        (setq to (point))
        (when (< from to)
-         (push (setq overlay (gnus-make-overlay from to nil t))
+         (push (setq overlay (make-overlay from to nil t))
                gnus-cite-overlay-list)
-         (gnus-overlay-put overlay 'evaporate t)
-         (gnus-overlay-put overlay 'face face))))))
+         (overlay-put overlay 'evaporate t)
+         (overlay-put overlay 'face face))))))
 
 (defun gnus-cite-toggle (prefix)
   (with-current-buffer gnus-article-buffer
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index b706de7..bedf7e4 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -307,12 +307,12 @@ Use ALT-TEXT for the image string."
          (gnus-article-add-button start end
                                   'browse-url (mm-url-decode-entities-string 
url)
                                   url)
-         (let ((overlay (gnus-make-overlay start end)))
-           (gnus-overlay-put overlay 'evaporate t)
-           (gnus-overlay-put overlay 'gnus-button-url url)
+         (let ((overlay (make-overlay start end)))
+           (overlay-put overlay 'evaporate t)
+           (overlay-put overlay 'gnus-button-url url)
            (gnus-put-text-property start end 'gnus-string url)
            (when gnus-article-mouse-face
-             (gnus-overlay-put overlay 'mouse-face gnus-article-mouse-face)))))
+             (overlay-put overlay 'mouse-face gnus-article-mouse-face)))))
        ;; The upper-case IMG_ALT is apparently just an artifact that
        ;; should be deleted.
        ((equal tag "IMG_ALT")
@@ -320,19 +320,19 @@ Use ALT-TEXT for the image string."
        ;; w3m does not normalize the case
        ((or (equal tag "b")
             (equal tag "B"))
-        (gnus-overlay-put (gnus-make-overlay start end) 'face 
'gnus-emphasis-bold))
+        (overlay-put (make-overlay start end) 'face 'gnus-emphasis-bold))
        ((or (equal tag "u")
             (equal tag "U"))
-        (gnus-overlay-put (gnus-make-overlay start end) 'face 
'gnus-emphasis-underline))
+        (overlay-put (make-overlay start end) 'face 'gnus-emphasis-underline))
        ((or (equal tag "i")
             (equal tag "I"))
-        (gnus-overlay-put (gnus-make-overlay start end) 'face 
'gnus-emphasis-italic))
+        (overlay-put (make-overlay start end) 'face 'gnus-emphasis-italic))
        ((or (equal tag "s")
             (equal tag "S"))
-        (gnus-overlay-put (gnus-make-overlay start end) 'face 
'gnus-emphasis-strikethru))
+        (overlay-put (make-overlay start end) 'face 'gnus-emphasis-strikethru))
        ((or (equal tag "ins")
             (equal tag "INS"))
-        (gnus-overlay-put (gnus-make-overlay start end) 'face 
'gnus-emphasis-underline))
+        (overlay-put (make-overlay start end) 'face 'gnus-emphasis-underline))
        ;; Handle different UL types
        ((equal tag "_SYMBOL")
         (when (string-match "TYPE=\\(.+\\)" parameters)
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 4e870bb..4f8f17f 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -164,8 +164,8 @@ If CONFIRM is non-nil, the user will be asked for an NNTP 
server."
        (gnus-open-server gnus-select-method)
        gnus-batch-mode
        (gnus-y-or-n-p
-       (format
-        "%s (%s) open error: '%s'.  Continue? "
+       (gnus-format-message
+        "%s (%s) open error: `%s'.  Continue? "
         (car gnus-select-method) (cadr gnus-select-method)
         (gnus-status-message gnus-select-method)))
        (gnus-error 1 "Couldn't open server on %s"
@@ -555,7 +555,7 @@ the group's summary.
   (let ((saved-display
          (gnus-group-get-parameter group 'display :allow-list)))
 
-    ;; Tell gnus we really don't want any articles 
+    ;; Tell gnus we really don't want any articles
     (gnus-group-set-parameter group 'display 0)
 
     (unwind-protect
@@ -573,7 +573,7 @@ the group's summary.
   ;; Create it now and insert the message
   (let ((group-is-new (gnus-summary-setup-buffer group)))
     (condition-case err
-        (let ((article-number 
+        (let ((article-number
                (gnus-summary-insert-subject message-id)))
           (unless article-number
             (signal 'error "message-id not in group"))
diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index 0cb5960..b233ad7 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -558,7 +558,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more 
details."
                      do (gnus-message
                          ;; warn more if gnus-registry-track-extra
                          (if gnus-registry-track-extra 7 9)
-                         "%s (extra tracking) traced subject '%s' to %s"
+                         "%s (extra tracking) traced subject `%s' to %s"
                          log-agent subject group)
                     and collect group))
          ;; filter the found groups and return them
@@ -585,7 +585,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more 
details."
                      do (gnus-message
                          ;; warn more if gnus-registry-track-extra
                          (if gnus-registry-track-extra 7 9)
-                         "%s (extra tracking) traced sender '%s' to %s"
+                         "%s (extra tracking) traced sender `%s' to %s"
                          log-agent sender group)
                      and collect group)))
 
@@ -615,7 +615,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more 
details."
                          do (gnus-message
                              ;; warn more if gnus-registry-track-extra
                              (if gnus-registry-track-extra 7 9)
-                             "%s (extra tracking) traced recipient '%s' to %s"
+                             "%s (extra tracking) traced recipient `%s' to %s"
                              log-agent recp group)
                         and collect group)))))
 
@@ -630,7 +630,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more 
details."
 (defun gnus-registry-post-process-groups (mode key groups)
   "Inspects GROUPS found by MODE for KEY to determine which ones to follow.
 
-MODE can be 'subject' or 'sender' for example.  The KEY is the
+MODE can be `subject' or `sender' for example.  The KEY is the
 value by which MODE was searched.
 
 Transforms each group name to the equivalent short name.
@@ -712,12 +712,12 @@ possible.  Uses `gnus-registry-split-strategy'."
      ((null out)
       (gnus-message
        5
-       "%s: no matches for %s '%s'."
+       "%s: no matches for %s `%s'."
        log-agent mode key)
       nil)
      (t (gnus-message
          5
-         "%s: too many extra matches (%s) for %s '%s'.  Returning none."
+         "%s: too many extra matches (%s) for %s `%s'.  Returning none."
          log-agent out mode key)
         nil))))
 
@@ -1100,7 +1100,7 @@ only the last one's marks are returned."
         (when (and (< 0 expected)
                    (= 0 (mod count 100)))
           (message "importing: %d of %d (%.2f%%)"
-                   count expected (/ (* 100 count) expected)))
+                   count expected (/ (* 100.0 count) expected)))
         (setq entry (car-safe old)
               old (cdr-safe old))
         (let* ((id (car-safe entry))
diff --git a/lisp/gnus/gnus-salt.el b/lisp/gnus/gnus-salt.el
index e071543..5776b0a 100644
--- a/lisp/gnus/gnus-salt.el
+++ b/lisp/gnus/gnus-salt.el
@@ -504,7 +504,7 @@ Two predefined functions are available:
       (when (setq win (get-buffer-window buf))
        (select-window win)
        (when gnus-selected-tree-overlay
-         (goto-char (or (gnus-overlay-end gnus-selected-tree-overlay) 1)))
+         (goto-char (or (overlay-end gnus-selected-tree-overlay) 1)))
        (gnus-tree-minimize)))))
 
 (defun gnus-tree-show-summary ()
@@ -547,7 +547,7 @@ Two predefined functions are available:
     (when tree-window
       (select-window tree-window)
       (when gnus-selected-tree-overlay
-       (goto-char (or (gnus-overlay-end gnus-selected-tree-overlay) 1)))
+       (goto-char (or (overlay-end gnus-selected-tree-overlay) 1)))
       (let* ((top (cond ((< (window-height) 4) 0)
                        ((< (window-height) 7) 1)
                        (t 2)))
@@ -858,12 +858,12 @@ it in the environment specified by BINDINGS."
        (when (or (not gnus-selected-tree-overlay)
                  (gnus-extent-detached-p gnus-selected-tree-overlay))
          ;; Create a new overlay.
-         (gnus-overlay-put
+         (overlay-put
           (setq gnus-selected-tree-overlay
-                (gnus-make-overlay (point-min) (1+ (point-min))))
+                (make-overlay (point-min) (1+ (point-min))))
           'face gnus-selected-tree-face))
        ;; Move the overlay to the article.
-       (gnus-move-overlay
+       (move-overlay
         gnus-selected-tree-overlay (goto-char (car region)) (cdr region))
        (gnus-tree-minimize)
        (gnus-tree-recenter)
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 7f3ab5e..4840af1 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -626,7 +626,7 @@ current score file."
              (if mimic
                  (progn
                    (sit-for 1) (message "%c %c-" prefix hchar))
-               (message "%s header '%s' with match type (%s?): "
+               (message "%s header `%s' with match type (%s?): "
                         (if increase "Increase" "Lower")
                         (nth 1 entry)
                         (mapconcat (lambda (s) (char-to-string (car s)))
diff --git a/lisp/gnus/gnus-sieve.el b/lisp/gnus/gnus-sieve.el
index 5f8cb32..cde9376 100644
--- a/lisp/gnus/gnus-sieve.el
+++ b/lisp/gnus/gnus-sieve.el
@@ -139,7 +139,7 @@ Return nil if no rule could be guessed."
   "Convert an elisp string list to a Sieve string list.
 
 For example:
-\(gnus-sieve-string-list '(\"to\" \"cc\"))
+\(gnus-sieve-string-list \\='(\"to\" \"cc\"))
   => \"[\\\"to\\\", \\\"cc\\\"]\"
 "
   (concat "[\"" (mapconcat 'identity list "\", \"") "\"]"))
@@ -148,7 +148,7 @@ For example:
   "Convert an elisp test list to a Sieve test list.
 
 For example:
-\(gnus-sieve-test-list '((address \"sender\" \"address@hidden") (size :over 
4K)))
+\(gnus-sieve-test-list \\='((address \"sender\" \"address@hidden") (size :over 
4K)))
   => \"(address \\\"sender\\\" \\\"address@hidden", size :over 4K)\""
   (concat "(" (mapconcat 'gnus-sieve-test list ", ") ")"))
 
@@ -157,13 +157,13 @@ For example:
   "Convert an elisp test token to a Sieve test token.
 
 For example:
-\(gnus-sieve-test-token 'address)
+\(gnus-sieve-test-token \\='address)
   => \"address\"
 
 \(gnus-sieve-test-token \"sender\")
   => \"\\\"sender\\\"\"
 
-\(gnus-sieve-test-token '(\"to\" \"cc\"))
+\(gnus-sieve-test-token \\='(\"to\" \"cc\"))
   => \"[\\\"to\\\", \\\"cc\\\"]\""
   (cond
    ((symbolp token)            ;; Keyword
@@ -184,10 +184,10 @@ For example:
   "Convert an elisp test to a Sieve test.
 
 For example:
-\(gnus-sieve-test '(address \"sender\" \"address@hidden"))
+\(gnus-sieve-test \\='(address \"sender\" \"address@hidden"))
   => \"address \\\"sender\\\" \\\"address@hidden"\"
 
-\(gnus-sieve-test '(anyof ((header :contains (\"to\" \"cc\") \"address@hidden")
+\(gnus-sieve-test \\='(anyof ((header :contains (\"to\" \"cc\") 
\"address@hidden")
                          (size :over 100K))))
   => \"anyof (header :contains [\\\"to\\\", \\\"cc\\\"] \\\"address@hidden",
             size :over 100K)\""
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index 0c0246a..82a2c98 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -2369,7 +2369,7 @@ If FORCE is non-nil, the .newsrc file is read."
                   (while (let (c
                                (cursor-in-echo-area t)
                                (echo-keystrokes 0))
-                           (message "Convert gnus from version '%s' to '%s'? 
(n/y/?)"
+                           (message "Convert gnus from version `%s' to `%s'? 
(n/y/?)"
                                     gnus-newsrc-file-version gnus-version)
                            (setq c (read-char-exclusive))
 
@@ -2390,8 +2390,8 @@ If FORCE is non-nil, the .newsrc file is read."
 
               (funcall func convert-to)))
           (gnus-dribble-enter
-           (format ";Converted gnus from version '%s' to '%s'."
-                   gnus-newsrc-file-version gnus-version)))))))
+           (gnus-format-message ";Converted gnus from version `%s' to `%s'."
+                               gnus-newsrc-file-version gnus-version)))))))
 
 (defun gnus-convert-mark-converter-prompt (converter no-prompt)
   "Indicate whether CONVERTER requires gnus-convert-old-newsrc to
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 37a707e..e4c144b 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -8429,7 +8429,7 @@ articles that are younger than AGE days."
     (gnus-summary-position-point)))
 
 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
-  "Limit the summary buffer to articles that match an 'extra' header."
+  "Limit the summary buffer to articles that match an `extra' header."
   (interactive
    (let ((header
          (intern
@@ -11695,20 +11695,10 @@ If ARG is positive number, turn showing conversation 
threads on."
     (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
     (gnus-summary-position-point)))
 
-(eval-and-compile
-  (if (fboundp 'remove-overlays)
-      (defalias 'gnus-remove-overlays 'remove-overlays)
-    (defun gnus-remove-overlays (beg end name val)
-      "Clear BEG and END of overlays whose property NAME has value VAL.
-For compatibility with XEmacs."
-      (dolist (ov (gnus-overlays-in beg end))
-       (when (eq (gnus-overlay-get ov name) val)
-         (gnus-delete-overlay ov))))))
-
 (defun gnus-summary-show-all-threads ()
   "Show all threads."
   (interactive)
-  (gnus-remove-overlays (point-min) (point-max) 'invisible 'gnus-sum)
+  (remove-overlays (point-min) (point-max) 'invisible 'gnus-sum)
   (gnus-summary-position-point))
 
 (defsubst gnus-summary--inv (p)
@@ -11735,7 +11725,7 @@ Returns nil if no thread was there to be shown."
                                    'gnus-sum))))
                  (point)))))
     (when eoi
-      (gnus-remove-overlays beg eoi 'invisible 'gnus-sum)
+      (remove-overlays beg eoi 'invisible 'gnus-sum)
       (goto-char orig)
       (gnus-summary-position-point)
       eoi)))
@@ -11804,10 +11794,10 @@ Returns nil if no threads were there to be hidden."
               (search-backward "\n" start t))
          (progn
            (when (> (point) starteol)
-             (gnus-remove-overlays starteol (point) 'invisible 'gnus-sum)
-             (let ((ol (gnus-make-overlay starteol (point) nil t nil)))
-               (gnus-overlay-put ol 'invisible 'gnus-sum)
-               (gnus-overlay-put ol 'evaporate t)))
+             (remove-overlays starteol (point) 'invisible 'gnus-sum)
+             (let ((ol (make-overlay starteol (point) nil t nil)))
+               (overlay-put ol 'invisible 'gnus-sum)
+               (overlay-put ol 'evaporate t)))
            (gnus-summary-goto-subject article)
             (when (> start (point))
               (message "Hiding the thread moved us backwards, aborting!")
@@ -12626,11 +12616,11 @@ If REVERSE, save parts that do not match TYPE."
          (setq to end))
        (if gnus-newsgroup-selected-overlay
            ;; Move old overlay.
-           (gnus-move-overlay
+           (move-overlay
             gnus-newsgroup-selected-overlay from to (current-buffer))
          ;; Create new overlay.
-         (gnus-overlay-put
-          (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
+         (overlay-put
+          (setq gnus-newsgroup-selected-overlay (make-overlay from to))
           'face gnus-summary-selected-face))))))
 
 (defvar gnus-summary-highlight-line-cached nil)
diff --git a/lisp/gnus/gnus-topic.el b/lisp/gnus/gnus-topic.el
index 656ef80..9474ca0 100644
--- a/lisp/gnus/gnus-topic.el
+++ b/lisp/gnus/gnus-topic.el
@@ -1525,7 +1525,7 @@ If NON-RECURSIVE (which is the prefix) is t, don't unmark 
its subtopics."
           (read-string (format "Rename %s to: " topic) topic))))
   ;; Check whether the new name exists.
   (when (gnus-topic-find-topology new-name)
-    (error "Topic '%s' already exists" new-name))
+    (error "Topic `%s' already exists" new-name))
   ;; "nil" is an invalid name, for reasons I'd rather not go
   ;; into here.  Trust me.
   (when (equal new-name "nil")
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index b75d9ef..54cf099 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -853,10 +853,6 @@ If there's no subdirectory, delete DIRECTORY as well."
          (setq beg (point)))
        (gnus-put-text-property beg (point) prop val)))))
 
-(declare-function gnus-overlay-put  "gnus" (overlay prop value))
-(declare-function gnus-make-overlay "gnus"
-                  (beg end &optional buffer front-advance rear-advance))
-
 (defsubst gnus-put-overlay-excluding-newlines (beg end prop val)
   "The same as `put-text-property', but don't put this prop on any newlines in 
the region."
   (save-match-data
@@ -864,11 +860,9 @@ If there's no subdirectory, delete DIRECTORY as well."
       (save-restriction
        (goto-char beg)
        (while (re-search-forward gnus-emphasize-whitespace-regexp end 'move)
-         (gnus-overlay-put
-          (gnus-make-overlay beg (match-beginning 0))
-          prop val)
+         (overlay-put (make-overlay beg (match-beginning 0)) prop val)
          (setq beg (point)))
-       (gnus-overlay-put (gnus-make-overlay beg (point)) prop val)))))
+       (overlay-put (make-overlay beg (point)) prop val)))))
 
 (defun gnus-put-text-property-excluding-characters-with-faces (beg end prop 
val)
   "The same as `put-text-property', except where `gnus-face' is set.
@@ -1980,6 +1974,11 @@ to case differences."
               (string-equal (downcase str1) (downcase prefix))
             (string-equal str1 prefix))))))
 
+(if (fboundp 'format-message)
+    (defalias 'gnus-format-message 'format-message)
+  ;; for Emacs < 25, and XEmacs, don't worry about quote translation.
+  (defalias 'gnus-format-message 'format))
+
 ;; Simple check: can be a macro but this way, although slow, it's really clear.
 ;; We don't use `bound-and-true-p' because it's not in XEmacs.
 (defun gnus-bound-and-true-p (sym)
diff --git a/lisp/gnus/gnus-uu.el b/lisp/gnus/gnus-uu.el
index 94f01c6..881ff4e 100644
--- a/lisp/gnus/gnus-uu.el
+++ b/lisp/gnus/gnus-uu.el
@@ -79,10 +79,10 @@ To change the behavior, you can either edit this variable 
or set
 
 For example:
 
-To make gnus-uu use 'xli' to display JPEG and GIF files, put the
+To make gnus-uu use `xli' to display JPEG and GIF files, put the
 following in your .emacs file:
 
-  (setq gnus-uu-user-view-rules '((\"jpg$\\\\|gif$\" \"xli\")))
+  (setq gnus-uu-user-view-rules \\='((\"jpg$\\\\|gif$\" \"xli\")))
 
 Both these variables are lists of lists with two string elements.  The
 first string is a regular expression.  If the file name matches this
@@ -140,7 +140,7 @@ details."
 
 (defcustom gnus-uu-user-archive-rules nil
   "A list that can be set to override the default archive unpacking commands.
-To use, for instance, 'untar' to unpack tar files and 'zip -x' to
+To use, for instance, `untar' to unpack tar files and `zip -x' to
 unpack zip files, say the following:
   (setq gnus-uu-user-archive-rules
     '((\"\\\\.tar$\" \"untar\")
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 30c89f5..6362d9a 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -304,17 +304,6 @@ be set in `.emacs' instead."
   :type 'boolean)
 
 (unless (featurep 'gnus-xmas)
-  (defalias 'gnus-make-overlay 'make-overlay)
-  (defalias 'gnus-copy-overlay 'copy-overlay)
-  (defalias 'gnus-delete-overlay 'delete-overlay)
-  (defalias 'gnus-overlay-get 'overlay-get)
-  (defalias 'gnus-overlay-put 'overlay-put)
-  (defalias 'gnus-move-overlay 'move-overlay)
-  (defalias 'gnus-overlay-buffer 'overlay-buffer)
-  (defalias 'gnus-overlay-start 'overlay-start)
-  (defalias 'gnus-overlay-end 'overlay-end)
-  (defalias 'gnus-overlays-at 'overlays-at)
-  (defalias 'gnus-overlays-in 'overlays-in)
   (defalias 'gnus-extent-detached-p 'ignore)
   (defalias 'gnus-extent-start-open 'ignore)
   (defalias 'gnus-mail-strip-quoted-names 'mail-strip-quoted-names)
@@ -1319,11 +1308,11 @@ news is to be fetched, the second is the address.
 For instance, if you want to get your news via \"flab.flab.edu\" using
 NNTP, you could say:
 
-\(setq gnus-select-method '(nntp \"flab.flab.edu\"))
+\(setq gnus-select-method \\='(nntp \"flab.flab.edu\"))
 
 If you want to use your local spool, say:
 
-\(setq gnus-select-method (list 'nnspool (system-name)))
+\(setq gnus-select-method (list \\='nnspool (system-name)))
 
 If you use this variable, you must set `gnus-nntp-server' to nil.
 
@@ -1408,7 +1397,7 @@ This is a list where each element is a complete select 
method (see
 If, for instance, you want to read your mail with the nnml back end,
 you could set this variable:
 
-\(setq gnus-secondary-select-methods '((nnml \"\")))"
+\(setq gnus-secondary-select-methods \\='((nnml \"\")))"
   :group 'gnus-server
   :type '(repeat gnus-select-method))
 
diff --git a/lisp/gnus/legacy-gnus-agent.el b/lisp/gnus/legacy-gnus-agent.el
index bd69087..ed66fec 100644
--- a/lisp/gnus/legacy-gnus-agent.el
+++ b/lisp/gnus/legacy-gnus-agent.el
@@ -147,14 +147,19 @@ converted to the compressed format."
             (insert "The definition of gnus-agent-expire-days has been 
changed.\nYou currently have it set to the list:\n  ")
             (gnus-pp gnus-agent-expire-days)
 
-            (insert "\nIn order to use version '" converting-to "' of gnus, 
you will need to set\n")
+           (insert
+            (gnus-format-message
+             "\nIn order to use version `%s' of gnus, you will need to set\n"
+             converting-to))
             (insert "gnus-agent-expire-days to an integer. If you still wish 
to set different\n")
             (insert "expiration days to individual groups, you must instead 
set the\n")
-            (insert "'agent-days-until-old group and/or topic parameter.\n")
+            (insert (gnus-format-message
+                    "`agent-days-until-old' group and/or topic parameter.\n"))
             (insert "\n")
             (insert "If you would like, gnus can iterate over every group 
comparing its name to the\n")
             (insert "regular expressions that you currently have in 
gnus-agent-expire-days.  When\n")
-            (insert "gnus finds a match, it will update that group's 
'agent-days-until-old group\n")
+            (insert (gnus-format-message
+                    "gnus finds a match, it will update that group's 
`agent-days-until-old' group\n"))
             (insert "parameter to the value associated with the regular 
expression.\n")
             (insert "\n")
             (insert "Whether gnus assigns group parameters, or not, gnus will 
terminate with an\n")
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 94c8950..cb74228 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -934,7 +934,7 @@ authentication.  To do that, you need to set the
 `message-send-mail-function' variable as `message-smtpmail-send-it'
 and put the following line in your ~/.gnus.el file:
 
-\(add-hook 'message-send-mail-hook 'mail-source-touch-pop)
+\(add-hook \\='message-send-mail-hook \\='mail-source-touch-pop)
 
 See the Gnus manual for details."
   (let ((sources (if mail-source-primary-source
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 9e813e6..d74ce43 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -541,7 +541,7 @@ The provided functions are:
       newsgroup), in brackets followed by the subject
 * `message-forward-subject-name-subject' Source of article (name of author
       or newsgroup), in brackets followed by the subject
-* `message-forward-subject-fwd' Subject of article with 'Fwd:' prepended
+* `message-forward-subject-fwd' Subject of article with `Fwd:' prepended
       to it."
   :group 'message-forwarding
   :link '(custom-manual "(message)Forwarding")
@@ -2005,6 +2005,17 @@ You must have the \"hashcash\" binary installed, see 
`hashcash-path'."
 (unless (fboundp 'mail-dont-reply-to)
   (defalias 'mail-dont-reply-to 'rmail-dont-reply-to))
 
+(eval-and-compile
+  (if (featurep 'emacs)
+      (progn
+       (defun message-kill-all-overlays ()
+         (mapcar #'delete-overlay (overlays-in (point-min) (point-max))))
+       (defalias 'message-window-inside-pixel-edges
+         'window-inside-pixel-edges))
+    (defun message-kill-all-overlays ()
+      (map-extents (lambda (extent ignore) (delete-extent extent))))
+    (defalias 'message-window-inside-pixel-edges 'ignore)))
+
 
 
 ;;;
@@ -4380,8 +4391,7 @@ conformance."
                to (cdar regions)
                regions (cdr regions))
          (put-text-property from to 'invisible nil)
-         (message-overlay-put (message-make-overlay from to)
-                              'face 'highlight))
+         (overlay-put (make-overlay from to) 'face 'highlight))
        (unless (yes-or-no-p
                 "Invisible text found and made visible; continue sending? ")
          (error "Invisible text found and made visible")))))
@@ -4408,8 +4418,7 @@ conformance."
                                                 control-1))
                       (not (get-text-property
                             (point) 'untranslated-utf-8))))
-         (message-overlay-put (message-make-overlay (point) (1+ (point)))
-                              'face 'highlight)
+         (overlay-put (make-overlay (point) (1+ (point))) 'face 'highlight)
          (setq found t))
        (forward-char))
       (when found
@@ -7201,7 +7210,7 @@ want to get rid of this query permanently."))
 
 (defun message-is-yours-p ()
   "Non-nil means current article is yours.
-If you have added 'cancel-messages to `message-shoot-gnksa-feet', all articles
+If you have added `cancel-messages' to `message-shoot-gnksa-feet', all articles
 are yours except those that have Cancel-Lock header not belonging to you.
 Instead of shooting GNKSA feet, you should modify `message-alternative-emails'
 regexp to match all of yours addresses."
@@ -7885,14 +7894,6 @@ which specify the range to operate on."
   (goto-char (prog1 (mark t)
               (set-marker (mark-marker) (point)))))
 
-(defalias 'message-make-overlay 'make-overlay)
-(defalias 'message-delete-overlay 'delete-overlay)
-(defalias 'message-overlay-put 'overlay-put)
-(defun message-kill-all-overlays ()
-  (if (featurep 'xemacs)
-      (map-extents (lambda (extent ignore) (delete-extent extent)))
-    (mapcar #'delete-overlay (overlays-in (point-min) (point-max)))))
-
 ;; Support for toolbar
 (defvar tool-bar-mode)
 
@@ -8176,7 +8177,7 @@ The following arguments may contain lists of values."
 (defun message-flatten-list (list)
   "Return a new, flat list that contains all elements of LIST.
 
-\(message-flatten-list '(1 (2 3 (4 5 (6))) 7))
+\(message-flatten-list \\='(1 (2 3 (4 5 (6))) 7))
 => (1 2 3 4 5 6 7)"
   (cond ((consp list)
         (apply 'append (mapcar 'message-flatten-list list)))
@@ -8487,7 +8488,7 @@ Header and body are separated by `mail-header-separator'."
            (progn
              (setq sent (1+ sent))
              (message-send-and-exit))
-         (message (format "Message to `%s' skipped." to))
+         (message "Message to `%s' skipped." to)
          (setq skipped (1+ skipped)))
        (when (buffer-live-p buff)
          (kill-buffer buff))))
@@ -8546,14 +8547,44 @@ Used in `message-simplify-recipients'."
 ;;; multipart/related and HTML support.
 
 (defun message-make-html-message-with-image-files (files)
+  "Make a message containing the current dired-marked image files."
   (interactive (list (dired-get-marked-files nil current-prefix-arg)))
   (message-mail)
   (message-goto-body)
   (insert "<#part type=text/html>\n\n")
   (dolist (file files)
     (insert (format "<img src=%S>\n\n" file)))
+  (message-toggle-image-thumbnails)
   (message-goto-to))
 
+(defun message-toggle-image-thumbnails ()
+  "For any included image files, insert a thumbnail of that image."
+  (interactive)
+  (let ((overlays (overlays-in (point-min) (point-max)))
+       (displayed nil))
+    (while overlays
+      (let ((overlay (car overlays)))
+       (when (overlay-get overlay 'put-image)
+         (delete-overlay overlay)
+         (setq displayed t)))
+      (setq overlays (cdr overlays)))
+    (unless displayed
+      (save-excursion
+       (goto-char (point-min))
+       (while (re-search-forward "<img.*src=\"\\([^\"]+\\)" nil t)
+         (let ((file (match-string 1))
+               (edges (message-window-inside-pixel-edges
+                       (get-buffer-window (current-buffer)))))
+           (put-image
+            (create-image
+             file 'imagemagick nil
+             :max-width (truncate
+                         (* 0.7 (- (nth 2 edges) (nth 0 edges))))
+             :max-height (truncate
+                          (* 0.5 (- (nth 3 edges) (nth 1 edges)))))
+            (match-beginning 0)
+            " ")))))))
+
 (when (featurep 'xemacs)
   (require 'messagexmas)
   (message-xmas-redefine))
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index bce9abd..b0ec16e 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -31,9 +31,6 @@
 (autoload 'gnus-replace-in-string "gnus-util")
 (autoload 'gnus-read-shell-command "gnus-util")
 
-(autoload 'gnus-overlays-at "gnus")
-(autoload 'gnus-overlay-put "gnus")
-
 (autoload 'mm-inline-partial "mm-partial")
 (autoload 'mm-inline-external-body "mm-extern")
 (autoload 'mm-extern-cache-contents "mm-extern")
@@ -1915,8 +1912,8 @@ If RECURSIVE, search recursively."
         :keymap shr-map
         (get-text-property start 'shr-url))
        (put-text-property start end 'local-map nil)
-       (dolist (overlay (gnus-overlays-at start))
-         (gnus-overlay-put overlay 'face nil))
+       (dolist (overlay (overlays-at start))
+         (overlay-put overlay 'face nil))
        (setq start end)))))
 
 (defun mm-handle-filename (handle)
diff --git a/lisp/gnus/nnbabyl.el b/lisp/gnus/nnbabyl.el
index d060c2a..ae417a0 100644
--- a/lisp/gnus/nnbabyl.el
+++ b/lisp/gnus/nnbabyl.el
@@ -105,7 +105,7 @@
             (> number nnmail-large-newsgroup)
             (zerop (% (incf count) 20))
             (nnheader-message 5 "nnbabyl: Receiving headers... %d%%"
-                              (/ (* count 100) number))))
+                              (floor (* count 100.0) number))))
 
       (and (numberp nnmail-large-newsgroup)
           (> number nnmail-large-newsgroup)
diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el
index 027d888..3134438 100644
--- a/lisp/gnus/nndiary.el
+++ b/lisp/gnus/nndiary.el
@@ -423,7 +423,7 @@ all.  This may very well take some time.")
                   (> number nnmail-large-newsgroup)
                   (zerop (% count 20))
                   (nnheader-message 6 "nndiary: Receiving headers... %d%%"
-                                    (/ (* count 100) number))))
+                                    (floor (* count 100.0) number))))
 
            (and (numberp nnmail-large-newsgroup)
                 (> number nnmail-large-newsgroup)
diff --git a/lisp/gnus/nneething.el b/lisp/gnus/nneething.el
index 183e396..0d9044f 100644
--- a/lisp/gnus/nneething.el
+++ b/lisp/gnus/nneething.el
@@ -106,7 +106,7 @@ included.")
          (and large
               (zerop (% count 20))
               (nnheader-message 5 "nneething: Receiving headers... %d%%"
-                                (/ (* count 100) number))))
+                                (floor (* count 100.0) number))))
 
        (when large
          (nnheader-message 5 "nneething: Receiving headers...done"))
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index 2ce5cb8..c88f4af 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -114,7 +114,7 @@ Shorter values mean quicker response, but are more CPU 
intensive.")
 For instance, if \":\" is invalid as a file character in file names
 on your system, you could say something like:
 
-\(setq nnheader-file-name-translation-alist '((?: . ?_)))")
+\(setq nnheader-file-name-translation-alist \\='((?: . ?_)))")
 
 (defvar nnheader-directory-separator-character
   (string-to-char (substring (file-name-as-directory ".") -1))
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 161a6b4..20ba0a3 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -490,7 +490,7 @@ textual parts.")
                        (funcall (nth 2 credentials)))
                      ;; See if CAPABILITY is set as part of login
                      ;; response.
-                     (dolist (response (cddr login-result))
+                     (dolist (response (cddr (nnimap-command "CAPABILITY")))
                        (when (string= "CAPABILITY" (upcase (car response)))
                          (setf (nnimap-capabilities nnimap-object)
                                (mapcar #'upcase (cdr response))))))
@@ -930,17 +930,19 @@ textual parts.")
       ;; way.
       (let ((message-id (message-field-value "message-id")))
        (if internal-move-group
-           (let ((result
-                  (with-current-buffer (nnimap-buffer)
-                    (nnimap-command "UID COPY %d %S"
-                                    article
-                                    (utf7-encode internal-move-group t)))))
-             (when (car result)
-               (nnimap-delete-article article)
-               (cons internal-move-group
-                     (or (nnimap-find-uid-response "COPYUID" (cadr result))
-                         (nnimap-find-article-by-message-id
-                          internal-move-group server message-id
+            (with-current-buffer (nnimap-buffer)
+              (let* ((can-move (nnimap-capability "MOVE"))
+                    (command (if can-move
+                                 "UID MOVE %d %S"
+                               "UID COPY %d %S"))
+                    (result (nnimap-command command article
+                                            (utf7-encode internal-move-group 
t))))
+                (when (and (car result) (not can-move))
+                  (nnimap-delete-article article))
+                (cons internal-move-group
+                      (or (nnimap-find-uid-response "COPYUID" (caddr result))
+                          (nnimap-find-article-by-message-id
+                           internal-move-group server message-id
                            nnimap-request-articles-find-limit)))))
          ;; Move the article to a different method.
          (let ((result (eval accept-form)))
@@ -980,11 +982,12 @@ textual parts.")
        (gnus-sorted-complement articles deletable-articles))))))
 
 (defun nnimap-process-expiry-targets (articles group server)
-  (let ((deleted-articles nil))
+  (let ((deleted-articles nil)
+        (articles-to-delete nil))
     (cond
      ;; shortcut further processing if we're going to delete the articles
      ((eq nnmail-expiry-target 'delete)
-      (setq deleted-articles articles)
+      (setq articles-to-delete articles)
       t)
      ;; or just move them to another folder on the same IMAP server
      ((and (not (functionp nnmail-expiry-target))
@@ -994,11 +997,14 @@ textual parts.")
       (and (nnimap-change-group group server)
           (with-current-buffer (nnimap-buffer)
             (nnheader-message 7 "Expiring articles from %s: %s" group articles)
-            (nnimap-command
-             "UID COPY %s %S"
-             (nnimap-article-ranges (gnus-compress-sequence articles))
-             (utf7-encode (gnus-group-real-name nnmail-expiry-target) t))
-            (setq deleted-articles articles)))
+             (let ((can-move (nnimap-capability "MOVE")))
+               (nnimap-command
+                (if can-move
+                    "UID MOVE %s %S"
+                  "UID COPY %s %S")
+                (nnimap-article-ranges (gnus-compress-sequence articles))
+                (utf7-encode (gnus-group-real-name nnmail-expiry-target) t))
+               (set (if can-move 'deleted-articles 'articles-to-delete) 
articles))))
       t)
      (t
       (dolist (article articles)
@@ -1019,11 +1025,13 @@ textual parts.")
                    (setq target nil))
                (nnheader-message 7 "Expiring article %s:%d" group article))
              (when target
-               (push article deleted-articles))))))
-      (setq deleted-articles (nreverse deleted-articles))))
+               (push article articles-to-delete))))))
+      (setq articles-to-delete (nreverse articles-to-delete))))
     ;; Change back to the current group again.
     (nnimap-change-group group server)
-    (nnimap-delete-article (gnus-compress-sequence deleted-articles))
+    (when articles-to-delete
+      (nnimap-delete-article (gnus-compress-sequence articles-to-delete))
+      (setq deleted-articles articles-to-delete))
     deleted-articles))
 
 (defun nnimap-find-expired-articles (group)
@@ -2060,6 +2068,7 @@ Return the server's response to the SELECT or EXAMINE 
command."
                                  nnmail-split-fancy))
          (nnmail-inhibit-default-split-group t)
          (groups (nnimap-get-groups))
+          (can-move (nnimap-capability "MOVE"))
          new-articles)
       (erase-buffer)
       (nnimap-command "SELECT %S" nnimap-inbox)
@@ -2094,14 +2103,16 @@ Return the server's response to the SELECT or EXAMINE 
command."
                  ;; Don't copy if the message is already in its
                  ;; target group.
                  (unless (string= group nnimap-inbox)
-                  (push (list (nnimap-send-command
-                               "UID COPY %s %S"
-                               (nnimap-article-ranges ranges)
-                               (utf7-encode group t))
-                              ranges)
-                        sequences)))))
+                   (push (list (nnimap-send-command
+                                (if can-move
+                                    "UID MOVE %s %S"
+                                  "UID COPY %s %S")
+                                (nnimap-article-ranges ranges)
+                                (utf7-encode group t))
+                               ranges)
+                         sequences)))))
            ;; Wait for the last COPY response...
-           (when sequences
+           (when (and (not can-move) sequences)
              (nnimap-wait-for-response (caar sequences))
              ;; And then mark the successful copy actions as deleted,
              ;; and possibly expunge them.
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index 71bc916..2292849 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -288,7 +288,7 @@ running (\"xwatch\", etc.)
 
 E.g.:
 
-\(add-hook 'nnmail-read-incoming-hook
+\(add-hook \\='nnmail-read-incoming-hook
          (lambda ()
            (call-process \"/local/bin/mailsend\" nil nil nil
                          \"read\"
@@ -301,11 +301,11 @@ read.
 
 If you use `display-time', you could use something like this:
 
-\(add-hook 'nnmail-read-incoming-hook
+\(add-hook \\='nnmail-read-incoming-hook
          (lambda ()
            ;; Update the displayed time, since that will clear out
            ;; the flag that says you have mail.
-           (when (eq (process-status \"display-time\") 'run)
+           (when (eq (process-status \"display-time\") \\='run)
              (display-time-filter display-time-process \"\"))))"
   :group 'nnmail-prepare
   :type 'hook)
@@ -480,12 +480,12 @@ GROUP can contain \\& and \\N which will substitute from 
matching
 
 Example:
 
-\(setq nnmail-split-methods 'nnmail-split-fancy
+\(setq nnmail-split-methods \\='nnmail-split-fancy
       nnmail-split-fancy
       ;; Messages from the mailer daemon are not crossposted to any of
       ;; the ordinary groups.  Warnings are put in a separate group
       ;; from real errors.
-      '(| (\"from\" mail (| (\"subject\" \"warn.*\" \"mail.warning\")
+      \\='(| (\"from\" mail (| (\"subject\" \"warn.*\" \"mail.warning\")
                          \"mail.misc\"))
          ;; Non-error messages are crossposted to all relevant
          ;; groups, but we don't crosspost between the group for the
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index 097d4f8..5b72b52 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -75,6 +75,7 @@
 
 (defconst nnmaildir-flag-mark-mapping
   '((?F . tick)
+    (?P . forward)
     (?R . reply)
     (?S . read))
   "Alist mapping Maildir filename flags to Gnus marks.
diff --git a/lisp/gnus/nnmairix.el b/lisp/gnus/nnmairix.el
index 96b40e5..e34b708 100644
--- a/lisp/gnus/nnmairix.el
+++ b/lisp/gnus/nnmairix.el
@@ -243,7 +243,7 @@ unused nnmairix groups on the back end using
 
 (defcustom nnmairix-mairix-update-options '("-F" "-Q")
   "Options when calling mairix for updating the database.
-The default is '-F' and '-Q' for making updates faster.  You
+The default is \"-F\" and \"-Q\" for making updates faster.  You
 should call mairix without these options from time to
 time (e.g. via cron job)."
   :version "23.1"
@@ -252,7 +252,7 @@ time (e.g. via cron job)."
 
 (defcustom nnmairix-mairix-search-options '("-Q")
   "Options when calling mairix for searching.
-The default is '-Q' for making searching faster."
+The default is \"-Q\" for making searching faster."
   :version "23.1"
   :type '(repeat string)
   :group 'nnmairix)
@@ -311,7 +311,7 @@ The default chooses the largest window in the current 
frame."
 The default of this variable is t.  If set to 'ask, the
 user will be asked if the flags should be propagated when the
 group is closed.  If set to nil, the user will have to manually
-call 'nnmairix-propagate-marks'."
+call `nnmairix-propagate-marks'."
   :version "23.1"
   :type '(choice (const :tag "always" t)
                 (const :tag "ask" ask)
@@ -1943,7 +1943,7 @@ Fill in VALUES if based on an article."
     (kill-all-local-variables)
     (erase-buffer)
     (widget-insert "Specify your query for Mairix (check boxes for activating 
fields):\n\n")
-    (widget-insert "(Whitespaces will be converted to ',' (i.e. AND). Use '/' 
for OR.)\n\n")
+    (widget-insert "(Whitespaces will be converted to ‘,’ (i.e. AND). Use ‘/’ 
for OR.)\n\n")
 ;    (make-local-variable 'nnmairix-widgets)
     (setq nnmairix-widgets (nnmairix-widget-build-editable-fields values))
     (when (member 'flags nnmairix-widget-other)
diff --git a/lisp/gnus/nnmbox.el b/lisp/gnus/nnmbox.el
index 78983a5..a70a039 100644
--- a/lisp/gnus/nnmbox.el
+++ b/lisp/gnus/nnmbox.el
@@ -106,7 +106,7 @@
             (> number nnmail-large-newsgroup)
             (zerop (% count 20))
             (nnheader-message 5 "nnmbox: Receiving headers... %d%%"
-                              (/ (* count 100) number))))
+                              (floor (* count 100.0) number))))
 
       (and (numberp nnmail-large-newsgroup)
           (> number nnmail-large-newsgroup)
diff --git a/lisp/gnus/nnmh.el b/lisp/gnus/nnmh.el
index 04270a5..cdbf38a 100644
--- a/lisp/gnus/nnmh.el
+++ b/lisp/gnus/nnmh.el
@@ -109,7 +109,7 @@ as unread by Gnus.")
          (and large
               (zerop (% count 20))
               (nnheader-message 5 "nnmh: Receiving headers... %d%%"
-                                (/ (* count 100) number))))
+                                (floor (* count 100.0) number))))
 
        (when large
          (nnheader-message 5 "nnmh: Receiving headers...done"))
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el
index 8275e19..c825e09 100644
--- a/lisp/gnus/nnml.el
+++ b/lisp/gnus/nnml.el
@@ -178,7 +178,7 @@ non-nil.")
                   (> number nnmail-large-newsgroup)
                   (zerop (% count 20))
                   (nnheader-message 6 "nnml: Receiving headers... %d%%"
-                                    (/ (* count 100) number))))
+                                    (floor (* count 100.0) number))))
 
            (and (numberp nnmail-large-newsgroup)
                 (> number nnmail-large-newsgroup)
diff --git a/lisp/gnus/nnspool.el b/lisp/gnus/nnspool.el
index 9e9537a..f10b1ad 100644
--- a/lisp/gnus/nnspool.el
+++ b/lisp/gnus/nnspool.el
@@ -174,7 +174,7 @@ there.")
            (and do-message
                 (zerop (% (incf count) 20))
                 (nnheader-message 5 "nnspool: Receiving headers... %d%%"
-                                  (/ (* count 100) number))))
+                                  (floor (* count 100.0) number))))
 
          (when do-message
            (nnheader-message 5 "nnspool: Receiving headers...done"))
diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el
index 0891dba..8d09781 100644
--- a/lisp/gnus/nntp.el
+++ b/lisp/gnus/nntp.el
@@ -291,7 +291,7 @@ update their active files often, this can help.")
 (defvar nntp-async-process-list nil)
 
 (defvar nntp-authinfo-rejected nil
-"A custom error condition used to report 'Authentication Rejected' errors.
+"A custom error condition used to report `Authentication Rejected' errors.
 Condition handlers that match just this condition ensure that the nntp
 backend doesn't catch this error.")
 (put 'nntp-authinfo-rejected 'error-conditions '(error nntp-authinfo-rejected))
@@ -728,7 +728,7 @@ command whose response triggered the error."
                     (> number nntp-large-newsgroup)
                     (zerop (% received 20))
                     (nnheader-message 6 "NNTP: Receiving headers... %d%%"
-                                      (/ (* received 100) number)))
+                                      (floor (* received 100.0) number)))
                (nntp-accept-response))))
          (and (numberp nntp-large-newsgroup)
               (> number nntp-large-newsgroup)
@@ -965,7 +965,7 @@ command whose response triggered the error."
                   (> number nntp-large-newsgroup)
                   (zerop (% received 20))
                   (nnheader-message 6 "NNTP: Receiving articles... %d%%"
-                                    (/ (* received 100) number)))
+                                    (floor (* received 100.0) number)))
              (nntp-accept-response))))
        (and (numberp nntp-large-newsgroup)
             (> number nntp-large-newsgroup)
diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el
index 4d9dfda..696c6e4 100644
--- a/lisp/gnus/pop3.el
+++ b/lisp/gnus/pop3.el
@@ -82,7 +82,7 @@
 (defcustom pop3-authentication-scheme 'pass
   "*POP3 authentication scheme.
 Defaults to `pass', for the standard USER/PASS authentication.  The other
-valid value is 'apop'."
+valid value is `apop'."
   :type '(choice (const :tag "Normal user/password" pass)
                 (const :tag "APOP" apop))
   :version "22.1" ;; Oort Gnus
diff --git a/lisp/gnus/registry.el b/lisp/gnus/registry.el
index 96a89fc..783ff36 100644
--- a/lisp/gnus/registry.el
+++ b/lisp/gnus/registry.el
@@ -222,9 +222,9 @@ When SET is not nil, set it for VAL (use t for an empty 
list)."
 
 (defmethod registry-search ((db registry-db) &rest spec)
   "Search for SPEC across the registry-db THIS.
-For example calling with :member '(a 1 2) will match entry '((a 3 1)).
+For example calling with :member \\='(a 1 2) will match entry \\='((a 3 1)).
 Calling with :all t (any non-nil value) will match all.
-Calling with :regex '\(a \"h.llo\") will match entry '((a \"hullo\" \"bye\").
+Calling with :regex \\='\(a \"h.llo\") will match entry \\='((a \"hullo\" 
\"bye\").
 The test order is to check :all first, then :member, then :regex."
   (when db
     (let ((all (plist-get spec :all))
@@ -320,7 +320,7 @@ Errors out if the key exists already."
           (when (and (< 0 expected)
                      (= 0 (mod count 1000)))
             (message "reindexing: %d of %d (%.2f%%)"
-                     count expected (/ (* 100 count) expected)))
+                     count expected (/ (* 100.0 count) expected)))
           (dolist (val (cdr-safe (assq tr v)))
             (let* ((value-keys (registry-lookup-secondary-value db tr val)))
               (push key value-keys)
diff --git a/lisp/gnus/sieve.el b/lisp/gnus/sieve.el
index 6eef569..8d40fa4 100644
--- a/lisp/gnus/sieve.el
+++ b/lisp/gnus/sieve.el
@@ -275,21 +275,9 @@ Used to bracket operations which move point in the 
sieve-buffer."
   (interactive "d")
   (get-char-property (or pos (point)) 'script-name))
 
-(eval-and-compile
-  (defalias 'sieve-make-overlay (if (featurep 'xemacs)
-                                   'make-extent
-                                 'make-overlay))
-  (defalias 'sieve-overlay-put (if (featurep 'xemacs)
-                                  'set-extent-property
-                                'overlay-put))
-  (defalias 'sieve-overlays-at (if  (featurep 'xemacs)
-                                  'extents-at
-                                'overlays-at)))
-
 (defun sieve-highlight (on)
   "Turn ON or off highlighting on the current language overlay."
-  (sieve-overlay-put (car (sieve-overlays-at (point)))
-                    'face (if on 'highlight 'default)))
+  (overlay-put (car (overlays-at (point))) 'face (if on 'highlight 'default)))
 
 (defun sieve-insert-scripts (scripts)
   "Format and insert LANGUAGE-LIST strings into current buffer at point."
@@ -300,11 +288,11 @@ Used to bracket operations which move point in the 
sieve-buffer."
       (if (consp script)
          (insert (format " ACTIVE %s" (cdr script)))
        (insert (format "        %s" script)))
-      (setq ext (sieve-make-overlay p (point)))
-      (sieve-overlay-put ext 'mouse-face 'highlight)
-      (sieve-overlay-put ext 'script-name (if (consp script)
-                                             (cdr script)
-                                           script))
+      (setq ext (make-overlay p (point)))
+      (overlay-put ext 'mouse-face 'highlight)
+      (overlay-put ext 'script-name (if (consp script)
+                                       (cdr script)
+                                     script))
       (insert "\n"))))
 
 (defun sieve-open-server (server &optional port)
diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el
index 02ec695..4ebd8a9 100644
--- a/lisp/gnus/spam.el
+++ b/lisp/gnus/spam.el
@@ -2054,7 +2054,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more 
details."
                 (if spam-use-dig
                     (let ((query-result (query-dig query-string)))
                       (when query-result
-                        (gnus-message 6 "(DIG): positive blackhole check '%s'"
+                        (gnus-message 6 "(DIG): positive blackhole check `%s'"
                                       query-result)
                         (push (list ip server query-result)
                               matches)))
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 1c7a68a..5f0dc87 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -43,6 +43,11 @@ The functions will receive the function name as argument.")
 
 ;; Functions
 
+(defvar describe-function-orig-buffer nil
+  "Buffer that was current when `describe-function' was invoked.
+Functions on `help-fns-describe-function-functions' can use this
+to get buffer-local values.")
+
 ;;;###autoload
 (defun describe-function (function)
   "Display the full documentation of FUNCTION (a symbol)."
@@ -61,18 +66,35 @@ The functions will receive the function name as argument.")
       (user-error "You didn't specify a function symbol"))
   (or (fboundp function)
       (user-error "Symbol's function definition is void: %s" function))
-  (help-setup-xref (list #'describe-function function)
-                   (called-interactively-p 'interactive))
-  (save-excursion
-    (with-help-window (help-buffer)
-      (prin1 function)
-      ;; Use " is " instead of a colon so that
-      ;; it is easier to get out the function name using forward-sexp.
-      (princ " is ")
-      (describe-function-1 function)
-      (with-current-buffer standard-output
-        ;; Return the text we displayed.
-        (buffer-string)))))
+
+  ;; We save describe-function-orig-buffer on the help xref stack, so
+  ;; it is restored by the back/forward buttons.  'help-buffer'
+  ;; expects (current-buffer) to be a help buffer when processing
+  ;; those buttons, so we can't change the current buffer before
+  ;; calling that.
+  (let ((describe-function-orig-buffer
+         (or describe-function-orig-buffer
+             (current-buffer))))
+
+    (help-setup-xref
+     (list (lambda (function buffer)
+             (let ((describe-function-orig-buffer
+                    (if (buffer-live-p buffer) buffer)))
+               (describe-function function)))
+           function describe-function-orig-buffer)
+     (called-interactively-p 'interactive))
+
+    (save-excursion
+      (with-help-window (help-buffer)
+        (prin1 function)
+        ;; Use " is " instead of a colon so that
+        ;; it is easier to get out the function name using forward-sexp.
+        (princ " is ")
+        (describe-function-1 function)
+        (with-current-buffer standard-output
+          ;; Return the text we displayed.
+          (buffer-string))))
+    ))
 
 
 ;; Could be this, if we make symbol-file do the work below.
@@ -275,19 +297,7 @@ suitable file is found, return nil."
                    lib-name)
                file-name))
             ;; The next three forms are from `find-source-lisp-file'.
-            (elc-file (locate-file
-                       (concat file-name
-                               (if (string-match "\\.el\\'" file-name)
-                                   "c"
-                                 ".elc"))
-                       load-path nil 'readable))
-            (str (when elc-file
-                   (with-temp-buffer
-                     (insert-file-contents-literally elc-file nil 0 256)
-                     (buffer-string))))
-            (src-file (and str
-                           (string-match ";;; from file \\(.*\\.el\\)" str)
-                           (match-string 1 str))))
+            (src-file (locate-library file-name t nil 'readable)))
        (and src-file (file-readable-p src-file) src-file))))))
 
 (defun help-fns--key-bindings (function)
@@ -309,9 +319,7 @@ suitable file is found, return nil."
             (when remapped
               (princ "Its keys are remapped to ")
               (princ (if (symbolp remapped)
-                        (concat (substitute-command-keys "‘")
-                                (symbol-name remapped)
-                                (substitute-command-keys "’"))
+                         (format-message "‘%s’" remapped)
                       "an anonymous command"))
               (princ ".\n"))
 
@@ -345,7 +353,7 @@ suitable file is found, return nil."
       (insert "\nThis function has a compiler macro")
       (if (symbolp handler)
           (progn
-            (insert (format (substitute-command-keys " ‘%s’") handler))
+            (insert (format-message " ‘%s’" handler))
             (save-excursion
               (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’")
                                   nil t)
@@ -353,7 +361,7 @@ suitable file is found, return nil."
         ;; FIXME: Obsolete since 24.4.
         (let ((lib (get function 'compiler-macro-file)))
           (when (stringp lib)
-            (insert (format (substitute-command-keys " in ‘%s’") lib))
+            (insert (format-message " in ‘%s’" lib))
             (save-excursion
               (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’")
                                   nil t)
@@ -433,9 +441,7 @@ suitable file is found, return nil."
       (when (nth 2 obsolete)
         (insert (format " since %s" (nth 2 obsolete))))
       (insert (cond ((stringp use) (concat ";\n" use))
-                    (use (format (substitute-command-keys
-                                  ";\nuse ‘%s’ instead.")
-                                 use))
+                    (use (format-message ";\nuse ‘%s’ instead." use))
                     (t "."))
               "\n"))))
 
@@ -471,9 +477,8 @@ FILE is the file where FUNCTION was probably defined."
                           (format ";\nin Lisp code %s" interactive-only))
                          ((and (symbolp 'interactive-only)
                                (not (eq interactive-only t)))
-                          (format (substitute-command-keys
-                                   ";\nin Lisp code use ‘%s’ instead.")
-                                  interactive-only))
+                          (format-message ";\nin Lisp code use ‘%s’ instead."
+                                          interactive-only))
                          (t "."))
                    "\n")))))
 
@@ -541,8 +546,7 @@ FILE is the file where FUNCTION was probably defined."
                 ;; Aliases are Lisp functions, so we need to check
                 ;; aliases before functions.
                 (aliased
-                 (format (substitute-command-keys "an alias for ‘%s’")
-                          real-def))
+                 (format-message "an alias for ‘%s’" real-def))
                 ((autoloadp def)
                  (format "%s autoloaded %s"
                          (if (commandp def) "an interactive" "an")
@@ -582,13 +586,12 @@ FILE is the file where FUNCTION was probably defined."
              (help-xref-button 1 'help-function real-def)))))
 
       (when file-name
-       (princ (substitute-command-keys " in ‘"))
        ;; We used to add .el to the file name,
        ;; but that's completely wrong when the user used load-file.
-       (princ (if (eq file-name 'C-source)
-                  "C source code"
-                (help-fns-short-filename file-name)))
-       (princ (substitute-command-keys "’"))
+       (princ (format-message " in ‘%s’"
+                               (if (eq file-name 'C-source)
+                                   "C source code"
+                                 (help-fns-short-filename file-name))))
        ;; Make a hyperlink to the library.
        (with-current-buffer standard-output
          (save-excursion
@@ -726,12 +729,11 @@ it is displayed along with the global value."
 
              (if file-name
                  (progn
-                   (princ (substitute-command-keys
-                            " is a variable defined in ‘"))
-                   (princ (if (eq file-name 'C-source)
-                              "C source code"
-                            (file-name-nondirectory file-name)))
-                   (princ (substitute-command-keys "’.\n"))
+                   (princ (format-message
+                            " is a variable defined in ‘%s’.\n"
+                            (if (eq file-name 'C-source)
+                                "C source code"
+                              (file-name-nondirectory file-name))))
                    (with-current-buffer standard-output
                      (save-excursion
                        (re-search-backward (substitute-command-keys
@@ -866,9 +868,9 @@ if it is given a local binding.\n")))
              ;; Mention if it's an alias.
               (unless (eq alias variable)
                 (setq extra-line t)
-                (princ (format (substitute-command-keys
-                                "  This variable is an alias for ‘%s’.\n")
-                               alias)))
+                (princ (format-message
+                        "  This variable is an alias for ‘%s’.\n"
+                        alias)))
 
               (when obsolete
                 (setq extra-line t)
@@ -876,9 +878,8 @@ if it is given a local binding.\n")))
                 (if (nth 2 obsolete)
                     (princ (format " since %s" (nth 2 obsolete))))
                (princ (cond ((stringp use) (concat ";\n  " use))
-                            (use (format (substitute-command-keys
-                                           ";\n  use ‘%s’ instead.")
-                                          (car obsolete)))
+                            (use (format-message ";\n  use ‘%s’ instead."
+                                                  (car obsolete)))
                             (t ".")))
                 (terpri))
 
@@ -940,8 +941,7 @@ file-local variable.\n")
                (princ "if its value\n  satisfies the predicate ")
                (princ (if (byte-code-function-p safe-var)
                           "which is a byte-compiled expression.\n"
-                        (format (substitute-command-keys "‘%s’.\n")
-                                 safe-var))))
+                        (format-message "‘%s’.\n" safe-var))))
 
               (if extra-line (terpri))
              (princ "Documentation:\n")
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index e1fc9fd..22e5386 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -294,11 +294,13 @@ Commands:
 
 ;;;###autoload
 (defun help-mode-setup ()
+  "Enter Help Mode in the current buffer."
   (help-mode)
   (setq buffer-read-only nil))
 
 ;;;###autoload
 (defun help-mode-finish ()
+  "Finalize Help Mode setup in current buffer."
   (when (derived-mode-p 'help-mode)
     (setq buffer-read-only t)
     (help-make-xrefs (current-buffer))))
diff --git a/lisp/help.el b/lisp/help.el
index 46136d9..2fcb52e 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -964,9 +964,8 @@ documentation for the major and minor modes of that buffer."
        (let* ((mode major-mode)
               (file-name (find-lisp-object-file-name mode nil)))
          (when file-name
-           (princ (concat (substitute-command-keys " defined in ‘")
-                           (file-name-nondirectory file-name)
-                           (substitute-command-keys "’")))
+           (princ (format-message " defined in ‘%s’"
+                                   (file-name-nondirectory file-name)))
            ;; Make a hyperlink to the library.
            (with-current-buffer standard-output
              (save-excursion
@@ -1042,7 +1041,7 @@ is currently activated with completion."
   (let ((minor-mode (lookup-minor-mode-from-indicator indicator)))
     (if minor-mode
        (describe-minor-mode-from-symbol minor-mode)
-      (error "Cannot find minor mode for `%s'" indicator))))
+      (error "Cannot find minor mode for ‘%s’" indicator))))
 
 (defun lookup-minor-mode-from-indicator (indicator)
   "Return a minor mode symbol from its indicator on the mode line."
diff --git a/lisp/hexl.el b/lisp/hexl.el
index 27d4659..3e0ea41 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -940,8 +940,9 @@ and their encoded form is inserted byte by byte."
                     ch internal-hex))
                   (setq encoded internal)
                 (error
-                 "Can't encode `0x%x' with this buffer's coding system; try 
\\[hexl-insert-hex-string]"
-                 ch)))
+                 "Can't encode `0x%x' with this buffer's coding system; %s"
+                 ch
+                 (substitute-command-keys "try \\[hexl-insert-hex-string]"))))
             (while (> num 0)
               (mapc
                (function (lambda (c) (hexl-insert-char c 1))) encoded)
diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el
index 8d01294..2f69bbc 100644
--- a/lisp/hilit-chg.el
+++ b/lisp/hilit-chg.el
@@ -731,7 +731,7 @@ You can automatically rotate colors when the buffer is 
saved by adding
 this function to `write-file-functions' as a buffer-local value.  To do
 this, eval the following in the buffer to be saved:
 
-  (add-hook 'write-file-functions 'highlight-changes-rotate-faces nil t)"
+  (add-hook \\='write-file-functions \\='highlight-changes-rotate-faces nil t)"
   (interactive)
   (when (and highlight-changes-mode highlight-changes-visible-mode)
     (let ((modified (buffer-modified-p))
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index 97e7d0f..310a074 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -187,13 +187,13 @@ It takes only one argument, the filename."
   :type  '(string))
 
 (defcustom hfy-src-doc-link-style "text-decoration: underline;"
-  "String to add to the '<style> a' variant of an htmlfontify CSS class."
+  "String to add to the ‘<style> a’ variant of an htmlfontify CSS class."
   :group 'htmlfontify
   :tag   "src-doc-link-style"
   :type  '(string))
 
 (defcustom hfy-src-doc-link-unstyle " text-decoration: none;"
-  "Regex to remove from the <style> a variant of an htmlfontify CSS class."
+  "Regex to remove from the ‘<style> a’ variant of an htmlfontify CSS class."
   :group 'htmlfontify
   :tag   "src-doc-link-unstyle"
   :type  '(string))
@@ -330,7 +330,7 @@ done;")
 (defcustom hfy-etags-cmd-alist
   hfy-etags-cmd-alist-default
   "Alist of possible shell commands that will generate etags output that
-`htmlfontify' can use.  '%s' will be replaced by `hfy-etags-bin'."
+`htmlfontify' can use.  `%s' will be replaced by `hfy-etags-bin'."
   :group 'htmlfontify
   :tag   "etags-cmd-alist"
   :type  '(alist :key-type (string) :value-type (string)))
@@ -389,8 +389,8 @@ exuberant-ctags' etags respectively."
 
 (defcustom hfy-istext-command "file %s | sed -e 'address@hidden:]*:[ \t]*@@'"
   "Command to run with the name of a file, to see whether it is a text file
-or not.  The command should emit a string containing the word 'text' if
-the file is a text file, and a string not containing 'text' otherwise."
+or not.  The command should emit a string containing the word `text' if
+the file is a text file, and a string not containing `text' otherwise."
   :group 'htmlfontify
   :tag   "istext-command"
   :type  '(string))
@@ -500,12 +500,12 @@ tagged items, not the locations of their definitions.")
 (defvar hfy-style-assoc 'please-ignore-this-line
   "An assoc representing/describing an Emacs face.
 Properties may be repeated, in which case later properties should be
-treated as if they were inherited from a 'parent' font.
+treated as if they were inherited from a `parent' font.
 \(For some properties, only the first encountered value is of any importance,
 for others the values might be cumulative, and for others they might be
 cumulative in a complex way.)\n
 Some examples:\n
-\(hfy-face-to-style 'default) =>
+\(hfy-face-to-style \\='default) =>
   ((\"background\"      . \"rgb(0, 0, 0)\")
    (\"color\"           . \"rgb(255, 255, 255)\")
    (\"font-style\"      . \"normal\")
@@ -514,7 +514,7 @@ Some examples:\n
    (\"font-family\"     . \"misc-fixed\")
    (\"font-size\"       . \"13pt\")
    (\"text-decoration\" . \"none\"))\n
-\(hfy-face-to-style 'Info-title-3-face) =>
+\(hfy-face-to-style \\='Info-title-3-face) =>
   ((\"font-weight\"     . \"700\")
    (\"font-family\"     . \"helv\")
    (\"font-size\"       . \"120%\")
@@ -527,14 +527,14 @@ Some examples:\n
 
 (defvar hfy-facemap-assoc 'please-ignore-this-line
   "An assoc of (point . FACE-SYMBOL) or (point . DEFFACE-LIST)
-and (point . 'end) elements, in descending order of point value
+and (point . \\='end) elements, in descending order of point value
 \(ie from the file's end to its beginning).\n
 The map is in reverse order because inserting a <style> tag (or any other
 string) at `point' invalidates the map for all entries with a greater value of
 point.  By traversing the map from greatest to least point, we still invalidate
 the map as we go, but only those points we have already dealt with (and
 therefore no longer care about) will be invalid at any time.\n
-'((64820 . end)
+\\='((64820 . end)
   (64744 . font-lock-comment-face)
   (64736 . end)
   (64722 . font-lock-string-face)
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 1088771..e5df999 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1557,7 +1557,7 @@ You can then feed the file name(s) to other commands with 
\\[yank]."
 
 ;;;###autoload
 (defun ibuffer-mark-special-buffers ()
-  "Mark all buffers whose name begins and ends with '*'."
+  "Mark all buffers whose name begins and ends with `*'."
   (interactive)
   (ibuffer-mark-on-buffer
    #'(lambda (buf) (string-match "^\\*.+\\*$"
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index c426976..3e97343 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -2303,7 +2303,7 @@ buffers which are visiting a file."
 (defun ibuffer (&optional other-window-p name qualifiers noselect
                          shrink filter-groups formats)
   "Begin using Ibuffer to edit a list of buffers.
-Type 'h' after entering ibuffer for more information.
+Type ‘h’ after entering ibuffer for more information.
 
 All arguments are optional.
 OTHER-WINDOW-P says to use another window.
@@ -2362,122 +2362,122 @@ particular subset of them, and sorting by various 
criteria.
 
 Operations on marked buffers:
 \\<ibuffer-mode-map>
-  '\\[ibuffer-do-save]' - Save the marked buffers
-  '\\[ibuffer-do-view]' - View the marked buffers in this frame.
-  '\\[ibuffer-do-view-other-frame]' - View the marked buffers in another frame.
-  '\\[ibuffer-do-revert]' - Revert the marked buffers.
-  '\\[ibuffer-do-toggle-read-only]' - Toggle read-only state of marked buffers.
-  '\\[ibuffer-do-delete]' - Kill the marked buffers.
-  '\\[ibuffer-do-isearch]' - Do incremental search in the marked buffers.
-  '\\[ibuffer-do-isearch-regexp]' - Isearch for regexp in the marked buffers.
-  '\\[ibuffer-do-replace-regexp]' - Replace by regexp in each of the marked
+  `\\[ibuffer-do-save]' - Save the marked buffers
+  `\\[ibuffer-do-view]' - View the marked buffers in this frame.
+  `\\[ibuffer-do-view-other-frame]' - View the marked buffers in another frame.
+  `\\[ibuffer-do-revert]' - Revert the marked buffers.
+  `\\[ibuffer-do-toggle-read-only]' - Toggle read-only state of marked buffers.
+  `\\[ibuffer-do-delete]' - Kill the marked buffers.
+  `\\[ibuffer-do-isearch]' - Do incremental search in the marked buffers.
+  `\\[ibuffer-do-isearch-regexp]' - Isearch for regexp in the marked buffers.
+  `\\[ibuffer-do-replace-regexp]' - Replace by regexp in each of the marked
           buffers.
-  '\\[ibuffer-do-query-replace]' - Query replace in each of the marked buffers.
-  '\\[ibuffer-do-query-replace-regexp]' - As above, with a regular expression.
-  '\\[ibuffer-do-print]' - Print the marked buffers.
-  '\\[ibuffer-do-occur]' - List lines in all marked buffers which match
+  `\\[ibuffer-do-query-replace]' - Query replace in each of the marked buffers.
+  `\\[ibuffer-do-query-replace-regexp]' - As above, with a regular expression.
+  `\\[ibuffer-do-print]' - Print the marked buffers.
+  `\\[ibuffer-do-occur]' - List lines in all marked buffers which match
           a given regexp (like the function `occur').
-  '\\[ibuffer-do-shell-command-pipe]' - Pipe the contents of the marked
+  `\\[ibuffer-do-shell-command-pipe]' - Pipe the contents of the marked
           buffers to a shell command.
-  '\\[ibuffer-do-shell-command-pipe-replace]' - Replace the contents of the 
marked
+  `\\[ibuffer-do-shell-command-pipe-replace]' - Replace the contents of the 
marked
           buffers with the output of a shell command.
-  '\\[ibuffer-do-shell-command-file]' - Run a shell command with the
+  `\\[ibuffer-do-shell-command-file]' - Run a shell command with the
           buffer's file as an argument.
-  '\\[ibuffer-do-eval]' - Evaluate a form in each of the marked buffers.  This
+  `\\[ibuffer-do-eval]' - Evaluate a form in each of the marked buffers.  This
           is a very flexible command.  For example, if you want to make all
           of the marked buffers read only, try using (read-only-mode 1) as
           the input form.
-  '\\[ibuffer-do-view-and-eval]' - As above, but view each buffer while the 
form
+  `\\[ibuffer-do-view-and-eval]' - As above, but view each buffer while the 
form
           is evaluated.
-  '\\[ibuffer-do-kill-lines]' - Remove the marked lines from the *Ibuffer* 
buffer,
+  `\\[ibuffer-do-kill-lines]' - Remove the marked lines from the *Ibuffer* 
buffer,
           but don't kill the associated buffer.
-  '\\[ibuffer-do-kill-on-deletion-marks]' - Kill all buffers marked for 
deletion.
+  `\\[ibuffer-do-kill-on-deletion-marks]' - Kill all buffers marked for 
deletion.
 
 Marking commands:
 
-  '\\[ibuffer-mark-forward]' - Mark the buffer at point.
-  '\\[ibuffer-toggle-marks]' - Unmark all currently marked buffers, and mark
+  `\\[ibuffer-mark-forward]' - Mark the buffer at point.
+  `\\[ibuffer-toggle-marks]' - Unmark all currently marked buffers, and mark
           all unmarked buffers.
-  '\\[ibuffer-unmark-forward]' - Unmark the buffer at point.
-  '\\[ibuffer-unmark-backward]' - Unmark the buffer at point, and move to the
+  `\\[ibuffer-unmark-forward]' - Unmark the buffer at point.
+  `\\[ibuffer-unmark-backward]' - Unmark the buffer at point, and move to the
           previous line.
-  '\\[ibuffer-unmark-all]' - Unmark all marked buffers.
-  '\\[ibuffer-mark-by-mode]' - Mark buffers by major mode.
-  '\\[ibuffer-mark-unsaved-buffers]' - Mark all \"unsaved\" buffers.
+  `\\[ibuffer-unmark-all]' - Unmark all marked buffers.
+  `\\[ibuffer-mark-by-mode]' - Mark buffers by major mode.
+  `\\[ibuffer-mark-unsaved-buffers]' - Mark all \"unsaved\" buffers.
           This means that the buffer is modified, and has an associated file.
-  '\\[ibuffer-mark-modified-buffers]' - Mark all modified buffers,
+  `\\[ibuffer-mark-modified-buffers]' - Mark all modified buffers,
           regardless of whether or not they have an associated file.
-  '\\[ibuffer-mark-special-buffers]' - Mark all buffers whose name begins and
-          ends with '*'.
-  '\\[ibuffer-mark-dissociated-buffers]' - Mark all buffers which have
+  `\\[ibuffer-mark-special-buffers]' - Mark all buffers whose name begins and
+          ends with `*'.
+  `\\[ibuffer-mark-dissociated-buffers]' - Mark all buffers which have
           an associated file, but that file doesn't currently exist.
-  '\\[ibuffer-mark-read-only-buffers]' - Mark all read-only buffers.
-  '\\[ibuffer-mark-dired-buffers]' - Mark buffers in `dired' mode.
-  '\\[ibuffer-mark-help-buffers]' - Mark buffers in `help-mode', 
`apropos-mode', etc.
-  '\\[ibuffer-mark-old-buffers]' - Mark buffers older than `ibuffer-old-time'.
-  '\\[ibuffer-mark-for-delete]' - Mark the buffer at point for deletion.
-  '\\[ibuffer-mark-by-name-regexp]' - Mark buffers by their name, using a 
regexp.
-  '\\[ibuffer-mark-by-mode-regexp]' - Mark buffers by their major mode, using 
a regexp.
-  '\\[ibuffer-mark-by-file-name-regexp]' - Mark buffers by their filename, 
using a regexp.
+  `\\[ibuffer-mark-read-only-buffers]' - Mark all read-only buffers.
+  `\\[ibuffer-mark-dired-buffers]' - Mark buffers in `dired' mode.
+  `\\[ibuffer-mark-help-buffers]' - Mark buffers in `help-mode', 
`apropos-mode', etc.
+  `\\[ibuffer-mark-old-buffers]' - Mark buffers older than `ibuffer-old-time'.
+  `\\[ibuffer-mark-for-delete]' - Mark the buffer at point for deletion.
+  `\\[ibuffer-mark-by-name-regexp]' - Mark buffers by their name, using a 
regexp.
+  `\\[ibuffer-mark-by-mode-regexp]' - Mark buffers by their major mode, using 
a regexp.
+  `\\[ibuffer-mark-by-file-name-regexp]' - Mark buffers by their filename, 
using a regexp.
 
 Filtering commands:
 
-  '\\[ibuffer-filter-by-mode]' - Add a filter by any major mode.
-  '\\[ibuffer-filter-by-used-mode]' - Add a filter by a major mode now in use.
-  '\\[ibuffer-filter-by-derived-mode]' - Add a filter by derived mode.
-  '\\[ibuffer-filter-by-name]' - Add a filter by buffer name.
-  '\\[ibuffer-filter-by-content]' - Add a filter by buffer content.
-  '\\[ibuffer-filter-by-filename]' - Add a filter by filename.
-  '\\[ibuffer-filter-by-size-gt]' - Add a filter by buffer size.
-  '\\[ibuffer-filter-by-size-lt]' - Add a filter by buffer size.
-  '\\[ibuffer-filter-by-predicate]' - Add a filter by an arbitrary Lisp 
predicate.
-  '\\[ibuffer-save-filters]' - Save the current filters with a name.
-  '\\[ibuffer-switch-to-saved-filters]' - Switch to previously saved filters.
-  '\\[ibuffer-add-saved-filters]' - Add saved filters to current filters.
-  '\\[ibuffer-or-filter]' - Replace the top two filters with their logical OR.
-  '\\[ibuffer-pop-filter]' - Remove the top filter.
-  '\\[ibuffer-negate-filter]' - Invert the logical sense of the top filter.
-  '\\[ibuffer-decompose-filter]' - Break down the topmost filter.
-  '\\[ibuffer-filter-disable]' - Remove all filtering currently in effect.
+  `\\[ibuffer-filter-by-mode]' - Add a filter by any major mode.
+  `\\[ibuffer-filter-by-used-mode]' - Add a filter by a major mode now in use.
+  `\\[ibuffer-filter-by-derived-mode]' - Add a filter by derived mode.
+  `\\[ibuffer-filter-by-name]' - Add a filter by buffer name.
+  `\\[ibuffer-filter-by-content]' - Add a filter by buffer content.
+  `\\[ibuffer-filter-by-filename]' - Add a filter by filename.
+  `\\[ibuffer-filter-by-size-gt]' - Add a filter by buffer size.
+  `\\[ibuffer-filter-by-size-lt]' - Add a filter by buffer size.
+  `\\[ibuffer-filter-by-predicate]' - Add a filter by an arbitrary Lisp 
predicate.
+  `\\[ibuffer-save-filters]' - Save the current filters with a name.
+  `\\[ibuffer-switch-to-saved-filters]' - Switch to previously saved filters.
+  `\\[ibuffer-add-saved-filters]' - Add saved filters to current filters.
+  `\\[ibuffer-or-filter]' - Replace the top two filters with their logical OR.
+  `\\[ibuffer-pop-filter]' - Remove the top filter.
+  `\\[ibuffer-negate-filter]' - Invert the logical sense of the top filter.
+  `\\[ibuffer-decompose-filter]' - Break down the topmost filter.
+  `\\[ibuffer-filter-disable]' - Remove all filtering currently in effect.
 
 Filter group commands:
 
-  '\\[ibuffer-filters-to-filter-group]' - Create filter group from filters.
-  '\\[ibuffer-pop-filter-group]' - Remove top filter group.
-  '\\[ibuffer-forward-filter-group]' - Move to the next filter group.
-  '\\[ibuffer-backward-filter-group]' - Move to the previous filter group.
-  '\\[ibuffer-clear-filter-groups]' - Remove all active filter groups.
-  '\\[ibuffer-save-filter-groups]' - Save the current groups with a name.
-  '\\[ibuffer-switch-to-saved-filter-groups]' - Restore previously saved 
groups.
-  '\\[ibuffer-delete-saved-filter-groups]' - Delete previously saved groups.
+  `\\[ibuffer-filters-to-filter-group]' - Create filter group from filters.
+  `\\[ibuffer-pop-filter-group]' - Remove top filter group.
+  `\\[ibuffer-forward-filter-group]' - Move to the next filter group.
+  `\\[ibuffer-backward-filter-group]' - Move to the previous filter group.
+  `\\[ibuffer-clear-filter-groups]' - Remove all active filter groups.
+  `\\[ibuffer-save-filter-groups]' - Save the current groups with a name.
+  `\\[ibuffer-switch-to-saved-filter-groups]' - Restore previously saved 
groups.
+  `\\[ibuffer-delete-saved-filter-groups]' - Delete previously saved groups.
 
 Sorting commands:
 
-  '\\[ibuffer-toggle-sorting-mode]' - Rotate between the various sorting modes.
-  '\\[ibuffer-invert-sorting]' - Reverse the current sorting order.
-  '\\[ibuffer-do-sort-by-alphabetic]' - Sort the buffers lexicographically.
-  '\\[ibuffer-do-sort-by-filename/process]' - Sort the buffers by the file 
name.
-  '\\[ibuffer-do-sort-by-recency]' - Sort the buffers by last viewing time.
-  '\\[ibuffer-do-sort-by-size]' - Sort the buffers by size.
-  '\\[ibuffer-do-sort-by-major-mode]' - Sort the buffers by major mode.
+  `\\[ibuffer-toggle-sorting-mode]' - Rotate between the various sorting modes.
+  `\\[ibuffer-invert-sorting]' - Reverse the current sorting order.
+  `\\[ibuffer-do-sort-by-alphabetic]' - Sort the buffers lexicographically.
+  `\\[ibuffer-do-sort-by-filename/process]' - Sort the buffers by the file 
name.
+  `\\[ibuffer-do-sort-by-recency]' - Sort the buffers by last viewing time.
+  `\\[ibuffer-do-sort-by-size]' - Sort the buffers by size.
+  `\\[ibuffer-do-sort-by-major-mode]' - Sort the buffers by major mode.
 
 Other commands:
 
-  '\\[ibuffer-update]' - Regenerate the list of all buffers.
+  `\\[ibuffer-update]' - Regenerate the list of all buffers.
           Prefix arg means to toggle whether buffers that match
           `ibuffer-maybe-show-predicates' should be displayed.
 
-  '\\[ibuffer-switch-format]' - Change the current display format.
-  '\\[forward-line]' - Move point to the next line.
-  '\\[previous-line]' - Move point to the previous line.
-  '\\[describe-mode]' - This help.
-  '\\[ibuffer-diff-with-file]' - View the differences between this buffer
+  `\\[ibuffer-switch-format]' - Change the current display format.
+  `\\[forward-line]' - Move point to the next line.
+  `\\[previous-line]' - Move point to the previous line.
+  `\\[describe-mode]' - This help.
+  `\\[ibuffer-diff-with-file]' - View the differences between this buffer
           and its associated file.
-  '\\[ibuffer-visit-buffer]' - View the buffer on this line.
-  '\\[ibuffer-visit-buffer-other-window]' - As above, but in another window.
-  '\\[ibuffer-visit-buffer-other-window-noselect]' - As both above, but don't 
select
+  `\\[ibuffer-visit-buffer]' - View the buffer on this line.
+  `\\[ibuffer-visit-buffer-other-window]' - As above, but in another window.
+  `\\[ibuffer-visit-buffer-other-window-noselect]' - As both above, but don't 
select
           the new window.
-  '\\[ibuffer-bury-buffer]' - Bury (not kill!) the buffer on this line.
+  `\\[ibuffer-bury-buffer]' - Bury (not kill!) the buffer on this line.
 
 ** Information on Filtering:
 
@@ -2485,7 +2485,7 @@ Other commands:
 buffer has its own stack of active filters.  For example, suppose you
 are working on an Emacs Lisp project.  You can create an Ibuffer
 buffer displays buffers in just `emacs-lisp' modes via
-'\\[ibuffer-filter-by-mode] emacs-lisp-mode RET'.  In this case, there
+`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET'.  In this case, there
 is just one entry on the filtering stack.
 
 You can also combine filters.  The various filtering commands push a
@@ -2493,21 +2493,21 @@ new filter onto the stack, and the filters combine to 
show just
 buffers which satisfy ALL criteria on the stack.  For example, suppose
 you only want to see buffers in `emacs-lisp' mode, whose names begin
 with \"gnus\".  You can accomplish this via:
-'\\[ibuffer-filter-by-mode] emacs-lisp-mode RET
+`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET
 \\[ibuffer-filter-by-name] ^gnus RET'.
 
 Additionally, you can OR the top two filters together with
-'\\[ibuffer-or-filters]'.  To see all buffers in either
+`\\[ibuffer-or-filters]'.  To see all buffers in either
 `emacs-lisp-mode' or `lisp-interaction-mode', type:
 
-'\\[ibuffer-filter-by-mode] emacs-lisp-mode RET \\[ibuffer-filter-by-mode] 
lisp-interaction-mode RET \\[ibuffer-or-filters]'.
+`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET \\[ibuffer-filter-by-mode] 
lisp-interaction-mode RET \\[ibuffer-or-filters]'.
 
 Filters can also be saved and restored using mnemonic names: see the
 functions `ibuffer-save-filters' and `ibuffer-switch-to-saved-filters'.
 
-To remove the top filter on the stack, use '\\[ibuffer-pop-filter]', and
+To remove the top filter on the stack, use `\\[ibuffer-pop-filter]', and
 to disable all filtering currently in effect, use
-'\\[ibuffer-filter-disable]'.
+`\\[ibuffer-filter-disable]'.
 
 ** Filter Groups:
 
@@ -2515,12 +2515,12 @@ Once one has mastered filters, the next logical step up 
is \"filter
 groups\".  A filter group is basically a named group of buffers which
 match a filter, which are displayed together in an Ibuffer buffer.  To
 create a filter group, simply use the regular functions to create a
-filter, and then type '\\[ibuffer-filters-to-filter-group]'.
+filter, and then type `\\[ibuffer-filters-to-filter-group]'.
 
 A quick example will make things clearer.  Suppose that one wants to
 group all of one's Emacs Lisp buffers together.  To do this, type
 
-'\\[ibuffer-filter-by-mode] emacs-lisp-mode RET 
\\[ibuffer-filters-to-filter-group] RET emacs lisp buffers RET'
+`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET 
\\[ibuffer-filters-to-filter-group] RET emacs lisp buffers RET'
 
 You may, of course, name the group whatever you want; it doesn't have
 to be \"emacs lisp buffers\".  Filter groups may be composed of any
@@ -2532,7 +2532,7 @@ multiple filter groups; instead, the first filter group 
is used.  The
 filter groups are displayed in this order of precedence.
 
 You may rearrange filter groups by using the regular
-'\\[ibuffer-kill-line]' and '\\[ibuffer-yank]' pair.  Yanked groups
+`\\[ibuffer-kill-line]' and `\\[ibuffer-yank]' pair.  Yanked groups
 will be inserted before the group at point."
   ;; Include state info next to the mode name.
   (set (make-local-variable 'mode-line-process)
@@ -2597,7 +2597,7 @@ will be inserted before the group at point."
 
 ;;; Start of automatically extracted autoloads.
 
-;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" 
"442bac528ce7a9a20bb191d0eb08cbd8")
+;;;### (autoloads nil "ibuf-ext" "ibuf-ext.el" 
"65ef908165926cf48da6f43fd01ef50b")
 ;;; Generated autoloads from ibuf-ext.el
 
 (autoload 'ibuffer-auto-mode "ibuf-ext" "\
@@ -2944,7 +2944,7 @@ Mark buffers which have not been viewed in 
`ibuffer-old-time' hours.
 \(fn)" t nil)
 
 (autoload 'ibuffer-mark-special-buffers "ibuf-ext" "\
-Mark all buffers whose name begins and ends with '*'.
+Mark all buffers whose name begins and ends with `*'.
 
 \(fn)" t nil)
 
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index b1894ca..9c712db 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -122,7 +122,7 @@ This hook is run during minibuffer setup if Icomplete is 
active.
 It is intended for use in customizing Icomplete for interoperation
 with other features and packages.  For instance:
 
-  (add-hook 'icomplete-minibuffer-setup-hook
+  (add-hook \\='icomplete-minibuffer-setup-hook
             (lambda () (setq-local max-mini-window-height 3)))
 
 will constrain Emacs to a maximum minibuffer height of 3 lines when
diff --git a/lisp/ido.el b/lisp/ido.el
index 1f12fbf..95be656 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -941,7 +941,7 @@ This hook is run during minibuffer setup if Ido is active.
 It is intended for use in customizing Ido for interoperation
 with other packages.  For instance:
 
-  (add-hook 'ido-minibuffer-setup-hook
+  (add-hook \\='ido-minibuffer-setup-hook
            (lambda () (setq-local max-mini-window-height 3)))
 
 will constrain Emacs to a maximum minibuffer height of 3 lines when
@@ -2275,7 +2275,8 @@ If cursor is not at the end of the user input, move to 
end of input."
 
        ((and (eq ido-create-new-buffer 'prompt)
             (null require-match)
-            (not (y-or-n-p (format "No buffer matching `%s', create one? " 
buf))))
+            (not (y-or-n-p (format-message
+                            "No buffer matching `%s', create one? " buf))))
        nil)
 
        ;; buffer doesn't exist
@@ -2285,7 +2286,8 @@ If cursor is not at the end of the user input, move to 
end of input."
 
        ((and (eq ido-create-new-buffer 'prompt)
             (null require-match)
-            (not (y-or-n-p (format "No buffer matching `%s', create one? " 
buf))))
+            (not (y-or-n-p (format-message
+                            "No buffer matching `%s', create one? " buf))))
        nil)
 
        ;; create a new buffer
diff --git a/lisp/ielm.el b/lisp/ielm.el
index 3c9908a..183f8a6 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -62,11 +62,11 @@ narrowing in effect.  This way you will be certain that 
none of
 the remaining prompts will be accidentally messed up.  You may
 wish to put something like the following in your init file:
 
-\(add-hook 'ielm-mode-hook
+\(add-hook \\='ielm-mode-hook
           (lambda ()
-             (define-key ielm-map \"\\C-w\" 'comint-kill-region)
+             (define-key ielm-map \"\\C-w\" \\='comint-kill-region)
              (define-key ielm-map [C-S-backspace]
-               'comint-kill-whole-line)))
+               \\='comint-kill-whole-line)))
 
 If you set `comint-prompt-read-only' to t, you might wish to use
 `comint-mode-hook' and `comint-mode-map' instead of
@@ -615,7 +615,7 @@ See `inferior-emacs-lisp-mode' for details."
       (with-current-buffer (get-buffer-create "*ielm*")
         (unless (zerop (buffer-size)) (setq old-point (point)))
         (inferior-emacs-lisp-mode)))
-    (switch-to-buffer "*ielm*")
+    (pop-to-buffer-same-window "*ielm*")
     (when old-point (push-mark old-point))))
 
 (provide 'ielm)
diff --git a/lisp/image.el b/lisp/image.el
index b023491..99a65e3 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -343,7 +343,7 @@ of image data.  If that doesn't work, and SOURCE is a file 
name,
 use its file extension as image type.
 Optional DATA-P non-nil means SOURCE is a string containing image data."
   (when (and (not data-p) (not (stringp source)))
-    (error "Invalid image file name `%s'" source))
+    (error "Invalid image file name ‘%s’" source))
   (unless type
     (setq type (if data-p
                   (image-type-from-data source)
@@ -351,13 +351,13 @@ Optional DATA-P non-nil means SOURCE is a string 
containing image data."
                     (image-type-from-file-name source))))
     (or type (error "Cannot determine image type")))
   (or (memq type (and (boundp 'image-types) image-types))
-      (error "Invalid image type `%s'" type))
+      (error "Invalid image type ‘%s’" type))
   type)
 
 
 (if (fboundp 'image-metadata)           ; eg not --without-x
     (define-obsolete-function-alias 'image-extension-data
-      'image-metadata' "24.1"))
+      'image-metadata "24.1"))
 
 (define-obsolete-variable-alias
     'image-library-alist
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 65c5282..158718b 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -476,7 +476,7 @@ element recalculates the buffer's index alist.")
 
 (defvar imenu--history-list nil
   ;; Making this buffer local caused it not to work!
-  "History list for 'jump-to-function-in-buffer'.")
+  "History list for `jump-to-function-in-buffer'.")
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
@@ -499,10 +499,7 @@ If REVERSE is non-nil then the beginning is 100 and the 
end is 0."
   (let ((pos (point))
        (total (buffer-size)))
     (and reverse (setq pos (- total pos)))
-    (if (> total 50000)
-       ;; Avoid overflow from multiplying by 100!
-       (/ (1- pos) (max (/ total 100) 1))
-      (/ (* 100 (1- pos)) (max total 1)))))
+    (floor (* 100.0 (1- pos)) (max total 1))))
 
 (defun imenu--split (list n)
   "Split LIST into sublists of max length N.
diff --git a/lisp/info-xref.el b/lisp/info-xref.el
index 3e871a1..2b81efa 100644
--- a/lisp/info-xref.el
+++ b/lisp/info-xref.el
@@ -170,13 +170,13 @@ overall good/bad count summary inserted at the very end."
                          info-xref-good info-xref-bad info-xref-unavail))))
 
 (defun info-xref-output (fmt &rest args)
-  "Emit a `format'-ed message FMT+ARGS to the `info-xref-output-buffer'."
+  "Emit a `format-message'-ed message FMT+ARGS to the 
`info-xref-output-buffer'."
   (with-current-buffer info-xref-output-buffer
     (save-excursion
       (goto-char (point-max))
       (let ((inhibit-read-only t))
         (insert info-xref-output-heading
-                (apply 'format fmt args)
+                (apply #'format-message fmt args)
                 "\n")))
     (setq info-xref-output-heading "")
     ;; all this info-xref can be pretty slow, display now so the user sees
diff --git a/lisp/info.el b/lisp/info.el
index 48d9d19..21dbca9 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3381,11 +3381,11 @@ Give an empty topic name to go to the Index node 
itself."
           (car (car Info-index-alternatives))
           (nth 2 (car Info-index-alternatives))
           (if (cdr Info-index-alternatives)
-              (format "(%s total; use `%s' for next)"
-                      (length Info-index-alternatives)
-                      (key-description (where-is-internal
-                                        'Info-index-next overriding-local-map
-                                        t)))
+              (format-message
+               "(%s total; use `%s' for next)"
+               (length Info-index-alternatives)
+               (key-description (where-is-internal
+                                 'Info-index-next overriding-local-map t)))
             "(Only match)")))
 
 (defun Info-find-index-name (name)
@@ -3460,7 +3460,7 @@ MATCHES is a list of index matches found by 
`Info-index'.")
        (when (equal (car (nth 0 nodeinfo)) (or filename Info-current-file))
          (insert
           (format "* %-20s %s.\n"
-                  (format "*Index for ‘%s’*::" (cdr (nth 0 nodeinfo)))
+                  (format-message "*Index for ‘%s’*::" (cdr (nth 0 nodeinfo)))
                   (cdr (nth 0 nodeinfo)))))))))
 
 (defun Info-virtual-index (topic)
@@ -3495,7 +3495,8 @@ search results."
        (setq Info-history-list ohist-list)
        (Info-goto-node orignode)
        (message "")))
-    (Info-find-node Info-current-file (format "*Index for ‘%s’*" topic))))
+    (Info-find-node Info-current-file
+                    (format-message "*Index for ‘%s’*" topic))))
 
 (add-to-list 'Info-virtual-files
             '("\\`\\*Apropos\\*\\'"
@@ -3634,7 +3635,7 @@ Build a menu of the possible matches."
        (setq nodes (cdr nodes)))
       (if nodes
          (Info-find-node Info-apropos-file (car (car nodes)))
-       (setq nodename (format "Index for ‘%s’" string))
+       (setq nodename (format-message "Index for ‘%s’" string))
        (push (list nodename string (Info-apropos-matches string))
              Info-apropos-nodes)
        (Info-find-node Info-apropos-file nodename)))))
@@ -3662,7 +3663,7 @@ Build a menu of the possible matches."
 (defun info--prettify-description (desc)
   (if (stringp desc)
       (with-temp-buffer
-       (insert desc)
+       (insert (substitute-command-keys desc))
        (if (equal ?. (char-before))
            (delete-char -1))
        (goto-char (point-min))
@@ -3825,7 +3826,7 @@ with a list of packages that contain all specified 
keywords."
                    (message (if flag "Type Space to see more"
                               "Type Space to return to Info"))
                    (if (not (eq ?\s (setq ch (read-event))))
-                       (progn (setq unread-command-events (list ch)) nil)
+                       (progn (push ch unread-command-events) nil)
                      flag))
        (scroll-up)))
     (bury-buffer "*Help*")))
@@ -3837,7 +3838,7 @@ START is a regular expression which will match the
     beginning of the tokens delimited string.
 ALL is a regular expression with a single
     parenthesized subpattern which is the token to be
-    returned.  E.g. '{\(.*\)}' would return any string
+    returned.  E.g. `{\(.*\)}' would return any string
     enclosed in braces around POS.
 ERRORSTRING optional fourth argument, controls action on no match:
     nil: return nil
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index 2d57955..4667a00 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -303,6 +303,9 @@
        (lepc . lepcha)
        (limb . limbu)
        (linb . linear_b)
+        (lisu . lisu)
+        (lyci . lycian)
+        (lydi . lydian)
        (mlym . malayalam)
        (mlm2 . malayalam)
        (mand . mandaic)
@@ -312,6 +315,7 @@
        (mero . meroitic)
        (mong . mongolian)
        (musc . musical-symbol)
+       (mym2 . burmese)
        (mymr . burmese)
        (nko\  . nko)
        (ogam . ogham)
@@ -346,6 +350,7 @@
        (taml . tamil)
        (tml2 . tamil)
        (telu . telugu)
+       (tel2 . telugu)
        (thaa . thaana)
        (thai . thai)
        (tibt . tibetan)
@@ -471,19 +476,29 @@
            (nil . "TIS620*")
            (nil . "ISO8859-11"))
 
-     (devanagari ,(font-spec :registry "iso10646-1" :otf '(deva nil (rphf)))
+     (devanagari ,(font-spec :registry "iso10646-1" :otf '(dev2 nil (rphf)))
+                 ,(font-spec :registry "iso10646-1" :otf '(deva nil (rphf)))
                 (nil . "iso10646.indian-1"))
-     (bengali ,(font-spec :registry "iso10646-1" :otf '(beng nil (rphf))))
-     (gurmukhi ,(font-spec :registry "iso10646-1" :otf '(guru nil (blwf))))
-     (gujarati ,(font-spec :registry "iso10646-1" :otf '(gujr nil (rphf))))
-     (oriya ,(font-spec :registry "iso10646-1" :otf '(orya nil (rphf))))
-     (tamil ,(font-spec :registry "iso10646-1" :otf '(taml nil (akhn))))
-     (telugu ,(font-spec :registry "iso10646-1" :otf '(telu nil (blwf))))
-     (kannada ,(font-spec :registry "iso10646-1" :otf '(knda nil (rphf))))
+     (bengali ,(font-spec :registry "iso10646-1" :otf '(bng2 nil (rphf)))
+              ,(font-spec :registry "iso10646-1" :otf '(beng nil (rphf))))
+     (gurmukhi ,(font-spec :registry "iso10646-1" :otf '(gur2 nil (blwf)))
+               ,(font-spec :registry "iso10646-1" :otf '(guru nil (blwf))))
+     (gujarati ,(font-spec :registry "iso10646-1" :otf '(gjr2 nil (rphf)))
+               ,(font-spec :registry "iso10646-1" :otf '(gujr nil (rphf))))
+     (oriya ,(font-spec :registry "iso10646-1" :otf '(ory2 nil (rphf)))
+            ,(font-spec :registry "iso10646-1" :otf '(orya nil (rphf))))
+     (tamil ,(font-spec :registry "iso10646-1" :otf '(tml2 nil (akhn)))
+            ,(font-spec :registry "iso10646-1" :otf '(taml nil (akhn))))
+     (telugu ,(font-spec :registry "iso10646-1" :otf '(tel2 nil (blwf)))
+             ,(font-spec :registry "iso10646-1" :otf '(telu nil (blwf))))
+     (kannada ,(font-spec :registry "iso10646-1" :otf '(knd2 nil (rphf)))
+              ,(font-spec :registry "iso10646-1" :otf '(knda nil (rphf))))
      (sinhala ,(font-spec :registry "iso10646-1" :otf '(sinh nil (akhn))))
-     (malayalam ,(font-spec :registry "iso10646-1" :otf '(mlym nil (akhn))))
+     (malayalam ,(font-spec :registry "iso10646-1" :otf '(mlm2 nil (akhn)))
+                ,(font-spec :registry "iso10646-1" :otf '(mlym nil (akhn))))
 
-     (burmese ,(font-spec :registry "iso10646-1" :otf '(mymr nil nil))
+     (burmese ,(font-spec :registry "iso10646-1" :otf '(mym2 nil nil))
+              ,(font-spec :registry "iso10646-1" :otf '(mymr nil nil))
              ,(font-spec :registry "iso10646-1" :script 'burmese))
 
      (lao ,(font-spec :registry "iso10646-1" :otf '(lao\  nil nil (mark)))
@@ -1055,7 +1070,7 @@ Value is name of that font."
        (condition-case nil
            (setq ascii-font (x-resolve-font-name pattern))
          (error
-          (message "Warning: no fonts matching `%s' available" pattern)
+          (message "Warning: no fonts matching ‘%s’ available" pattern)
           (aset xlfd-fields index "*")
           (setq index (1+ index))))))
     (unless ascii-font
diff --git a/lisp/international/ja-dic-cnv.el b/lisp/international/ja-dic-cnv.el
index edb6d89..d9c77bf5 100644
--- a/lisp/international/ja-dic-cnv.el
+++ b/lisp/international/ja-dic-cnv.el
@@ -280,7 +280,7 @@
                (cons (cons kana candidates) skkdic-okuri-nasi-entries)
                skkdic-okuri-nasi-entries-count
                (1+ skkdic-okuri-nasi-entries-count))
-         (setq ratio (floor (/ (* (point) 100.0) (point-max))))
+         (setq ratio (floor (* (point) 100.0) (point-max)))
          (if (/= (/ prev-ratio 10) (/ ratio 10))
              (progn
                (message "collected %2d%% ..." ratio)
@@ -306,7 +306,7 @@
       (while l
        (let ((kana (car (car l)))
              (candidates (cdr (car l))))
-         (setq ratio (/ (* count 100) skkdic-okuri-nasi-entries-count)
+         (setq ratio (floor (* count 100.0) skkdic-okuri-nasi-entries-count)
                count (1+ count))
          (if (/= (/ prev-ratio 10) (/ ratio 10))
              (progn
diff --git a/lisp/international/kkc.el b/lisp/international/kkc.el
index 90fb151..7eb8a4d 100644
--- a/lisp/international/kkc.el
+++ b/lisp/international/kkc.el
@@ -209,7 +209,7 @@ area while indicating the current selection by `<N>'."
 
 (define-error 'kkc-error nil)
 (defun kkc-error (&rest args)
-  (signal 'kkc-error (apply 'format args)))
+  (signal 'kkc-error (apply #'format-message args)))
 
 (defvar kkc-converting nil)
 
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 59fc37d..4ee3b28 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -397,12 +397,12 @@ A coding system that requires automatic detection of 
text+encoding
 
 To prefer, for instance, utf-8, say the following:
 
-  \(prefer-coding-system 'utf-8)"
+  \(prefer-coding-system \\='utf-8)"
   (interactive "zPrefer coding system: ")
   (if (not (and coding-system (coding-system-p coding-system)))
-      (error "Invalid coding system `%s'" coding-system))
+      (error "Invalid coding system ‘%s’" coding-system))
   (if (memq (coding-system-type coding-system) '(raw-text undecided))
-      (error "Can't prefer the coding system `%s'" coding-system))
+      (error "Can't prefer the coding system ‘%s’" coding-system))
   (let ((base (coding-system-base coding-system))
        (eol-type (coding-system-eol-type coding-system)))
     (set-coding-system-priority base)
@@ -417,7 +417,7 @@ To prefer, for instance, utf-8, say the following:
     (set-default-coding-systems base)
     (if (called-interactively-p 'interactive)
        (or (eq base default-file-name-coding-system)
-           (message "The default value of `file-name-coding-system' was not 
changed because the specified coding system is not suitable for file 
names.")))))
+           (message "The default value of ‘file-name-coding-system’ was not 
changed because the specified coding system is not suitable for file 
names.")))))
 
 (defvar sort-coding-systems-predicate nil
   "If non-nil, a predicate function to sort coding systems.
@@ -719,14 +719,14 @@ DEFAULT is the coding system to use by default in the 
query."
              (insert "No default coding systems to try for "
                      (if (stringp from)
                          (format "string \"%s\"." from)
-                       (format "buffer `%s'." bufname)))
+                       (format-message "buffer ‘%s’." bufname)))
            (insert
             "These default coding systems were tried to encode"
             (if (stringp from)
                 (concat " \"" (if (> (length from) 10)
                                   (concat (substring from 0 10) "...\"")
                                 (concat from "\"")))
-              (format " text\nin the buffer `%s'" bufname))
+              (format-message " text\nin the buffer ‘%s’" bufname))
             ":\n")
            (let ((pos (point))
                  (fill-prefix "  "))
@@ -876,12 +876,12 @@ and TO is ignored."
                (display-warning
                 'mule
                 (format "\
-Invalid coding system `%s' is specified
+Invalid coding system ‘%s’ is specified
 for the current buffer/file by the %s.
 It is highly recommended to fix it before writing to a file."
                         (car auto-cs)
                         (if (eq (cdr auto-cs) :coding) ":coding tag"
-                          (format "variable `%s'" (cdr auto-cs))))
+                          (format-message "variable ‘%s’" (cdr auto-cs))))
                 :warning)
                (or (yes-or-no-p "Really proceed with writing? ")
                    (error "Save aborted"))
@@ -1451,7 +1451,7 @@ If INPUT-METHOD is nil, deactivate any current input 
method."
   (unless (or current-input-method (null input-method))
     (let ((slot (assoc input-method input-method-alist)))
       (if (null slot)
-         (error "Can't activate input method `%s'" input-method))
+         (error "Can't activate input method ‘%s’" input-method))
       (setq current-input-method-title nil)
       (let ((func (nth 2 slot)))
        (if (functionp func)
@@ -1460,7 +1460,7 @@ If INPUT-METHOD is nil, deactivate any current input 
method."
              (progn
                (require (cdr func))
                (apply (car func) input-method (nthcdr 5 slot)))
-           (error "Can't activate input method `%s'" input-method))))
+           (error "Can't activate input method ‘%s’" input-method))))
       (setq current-input-method input-method)
       (or (stringp current-input-method-title)
          (setq current-input-method-title (nth 3 slot)))
@@ -1538,7 +1538,7 @@ which marks the variable `default-input-method' as set 
for Custom buffers."
 
   (interactive "P\np")
   (if toggle-input-method-active
-      (error "Recursive use of `toggle-input-method'"))
+      (error "Recursive use of ‘toggle-input-method’"))
   (if (and current-input-method (not arg))
       (deactivate-input-method)
     (let ((toggle-input-method-active t)
@@ -1587,7 +1587,7 @@ which marks the variable `default-input-method' as set 
for Custom buffers."
                          (called-interactively-p 'interactive))
         (with-output-to-temp-buffer (help-buffer)
           (let ((elt (assoc input-method input-method-alist)))
-            (princ (format
+            (princ (format-message
                     "Input method: %s (‘%s’ in mode line) for %s\n  %s\n"
                     input-method (nth 3 elt) (nth 1 elt) (nth 4 elt))))))))))
 
@@ -1598,7 +1598,7 @@ This is a subroutine for `describe-input-method'."
       (if (and (symbolp describe-current-input-method-function)
               (fboundp describe-current-input-method-function))
          (funcall describe-current-input-method-function)
-       (message "No way to describe the current input method `%s'"
+       (message "No way to describe the current input method ‘%s’"
                 current-input-method)
        (ding))
     (error "No input method is activated now")))
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index 3308dbd..063b873 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -35,7 +35,9 @@
 
 ;;; Remarks
 
-;; The ISO-IR registry is at http://www.itscj.ipsj.or.jp/ISO-IR/.
+;; The ISO-IR registry is maintained by the Information Processing
+;; Society of Japan/Information Technology Standards Commission of
+;; Japan (IPSJ/ITSCJ) at https://www.itscj.ipsj.or.jp/itscj_english/.
 ;; Standards docs equivalent to iso-2022 and iso-8859 are at
 ;; http://www.ecma.ch/.
 
@@ -902,8 +904,9 @@
   (dolist (script '(devanagari sanskrit bengali tamil telugu assamese
                               oriya kannada malayalam gujarati punjabi))
     (define-charset (intern (format "%s-cdac" script))
-      (format "Glyphs of %s script for CDAC font.  Subset of `indian-glyph'."
-             (capitalize (symbol-name script)))
+      (format-message
+       "Glyphs of %s script for CDAC font.  Subset of ‘indian-glyph’."
+       (capitalize (symbol-name script)))
       :short-name (format "CDAC %s glyphs" (capitalize (symbol-name script)))
       :supplementary-p t
       :code-space [0 255]
@@ -913,8 +916,9 @@
   (dolist (script '(devanagari bengali punjabi gujarati
                               oriya tamil telugu kannada malayalam))
     (define-charset (intern (format "%s-akruti" script))
-      (format "Glyphs of %s script for AKRUTI font.  Subset of `indian-glyph'."
-             (capitalize (symbol-name script)))
+      (format-message
+       "Glyphs of %s script for AKRUTI font.  Subset of ‘indian-glyph’."
+       (capitalize (symbol-name script)))
       :short-name (format "AKRUTI %s glyphs" (capitalize (symbol-name script)))
       :supplementary-p t
       :code-space [0 255]
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el
index 7ef758b..57b6d62 100644
--- a/lisp/international/mule-diag.el
+++ b/lisp/international/mule-diag.el
@@ -332,7 +332,7 @@ meanings of these arguments."
       (let ((char (charset-iso-final-char charset)))
        (when (> char 0)
          (insert "Final char of ISO2022 designation sequence: ")
-         (insert (format "‘%c’\n" char))))
+         (insert (format-message "‘%c’\n" char))))
       (let (aliases)
        (dolist (c charset-list)
          (if (and (not (eq c charset))
@@ -1058,17 +1058,18 @@ installed LEIM (Libraries of Emacs Input Methods).")
          (setq language (nth 1 elt))
          (princ language)
          (terpri))
-       (princ (format "  %s (‘%s’ in mode line)\n    %s\n"
-                      (car elt)
-                      (let ((title (nth 3 elt)))
-                        (if (and (consp title) (stringp (car title)))
-                            (car title)
-                          title))
-                      ;; If the doc is multi-line, indent all
-                      ;; non-blank lines. (Bug#8066)
-                      (replace-regexp-in-string
-                        "\n\\(.\\)" "\n    \\1"
-                        (substitute-command-keys (or (nth 4 elt) "")))))))))
+       (princ (format-message
+                "  %s (‘%s’ in mode line)\n    %s\n"
+                (car elt)
+                (let ((title (nth 3 elt)))
+                  (if (and (consp title) (stringp (car title)))
+                      (car title)
+                    title))
+                ;; If the doc is multi-line, indent all
+                ;; non-blank lines. (Bug#8066)
+                (replace-regexp-in-string
+                 "\n\\(.\\)" "\n    \\1"
+                 (substitute-command-keys (or (nth 4 elt) "")))))))))
 
 ;;; DIAGNOSIS
 
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 181474c..946f793 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -2002,7 +2002,7 @@ use \"coding: 'raw-text\" instead."
                (goto-char pos)
                (when (and set-auto-coding-for-load
                           (re-search-forward re-unibyte tail-end t))
-                  (display-warning 'mule "`unibyte: t' is obsolete; \
+                  (display-warning 'mule "\"unibyte: t\" is obsolete; \
 use \"coding: 'raw-text\" instead." :warning)
                  (setq coding-system 'raw-text))
                (when (and (not coding-system)
diff --git a/lisp/international/ogonek.el b/lisp/international/ogonek.el
index 27ac17c..9e5a450 100644
--- a/lisp/international/ogonek.el
+++ b/lisp/international/ogonek.el
@@ -75,7 +75,7 @@ are given in the following order:
 Je/sli czytasz ten tekst, to albo przegl/adasz plik /xr/od/lowy
 biblioteki `ogonek.el', albo wywo/la/le/s polecenie `ogonek-jak'.
 W drugim przypadku mo/zesz usun/a/c tekst z ekranu, stosuj/ac
-polecenie `M-x kill-buffer'.
+polecenie `\\[kill-buffer]'.
 
 Niniejsza biblioteka dostarcza funkcji do zmiany kodowania polskich
 znak/ow diakrytycznych. Funkcje te mo/zna pogrupowa/c nast/epuj/aco.
@@ -174,7 +174,7 @@ znak/ow diakrytycznych. Funkcje te mo/zna pogrupowa/c 
nast/epuj/aco.
 
 If you read this text then you are either looking at the library's
 source text or you have called the `ogonek-how' command. In the
-latter case you may remove this text using `M-x kill-buffer'.
+latter case you may remove this text using `\\[kill-buffer]'.
 
 The library provides functions for changing the encoding of Polish
 diacritic characters, the ones with an `ogonek' below or above them.
diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index 90a540a..8c9d145 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -1305,7 +1305,7 @@ The returned value is a Quail map specific to KEY."
 
 (define-error 'quail-error nil)
 (defun quail-error (&rest args)
-  (signal 'quail-error (apply 'format args)))
+  (signal 'quail-error (apply #'format-message args)))
 
 (defun quail-input-string-to-events (str)
   "Convert input string STR to a list of events.
@@ -1415,7 +1415,8 @@ Return the input string."
              ;; KEYSEQ is not defined in the translation keymap.
              ;; Let's return the event(s) to the caller.
              (setq unread-command-events
-                   (string-to-list (this-single-command-raw-keys)))
+                   (append (this-single-command-raw-keys)
+                            unread-command-events))
              (setq quail-translating nil))))
        (quail-delete-region)
        quail-current-str)
@@ -1491,7 +1492,8 @@ Return the input string."
              ;; KEYSEQ is not defined in the conversion keymap.
              ;; Let's return the event(s) to the caller.
              (setq unread-command-events
-                   (string-to-list (this-single-command-raw-keys)))
+                   (append (this-single-command-raw-keys)
+                            unread-command-events))
              (setq quail-converting nil))))
        (setq quail-translating nil)
        (if (overlay-start quail-conv-overlay)
diff --git a/lisp/international/robin.el b/lisp/international/robin.el
index 8254180..0ef90b1 100644
--- a/lisp/international/robin.el
+++ b/lisp/international/robin.el
@@ -466,7 +466,7 @@ While this input method is active, the variable
          (list key)
        (delete-region start (point))
        (if key
-           (setq unread-command-events (list key)))
+           (push key unread-command-events))
        (if (stringp output)
            (string-to-list output)
          (list output))))))
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 327cf45..9636a36 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -432,7 +432,7 @@ Optional arg EMPTY is message to print if no macros are 
defined."
       (setq last-input-event nil)))
   (when last-input-event
     (clear-this-command-keys t)
-    (setq unread-command-events (list last-input-event))))
+    (push last-input-event unread-command-events)))
 
 
 (defun kmacro-get-repeat-prefix ()
diff --git a/lisp/language/hanja-util.el b/lisp/language/hanja-util.el
index 8b62ee7..c9501d2 100644
--- a/lisp/language/hanja-util.el
+++ b/lisp/language/hanja-util.el
@@ -6585,7 +6585,9 @@ The value is a hanja character that is selected 
interactively."
                     (cmd (lookup-key hanja-keymap seq)))
                (if (functionp cmd)
                    (funcall cmd)
-                 (setq unread-command-events (listify-key-sequence seq))
+                 (setq unread-command-events
+                        (nconc (listify-key-sequence seq)
+                               unread-command-events))
                  (throw 'exit-input-loop nil))))))
       (setq hanja-conversions nil))))
 
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index 1bcd190..c571ca9 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -108,8 +108,8 @@ Completion is available.
 
 ;;;***
 
-;;;### (autoloads nil "add-log" "vc/add-log.el" (21670 32331 885635
-;;;;;;  586000))
+;;;### (autoloads nil "add-log" "vc/add-log.el" (21942 1330 829986
+;;;;;;  820000))
 ;;; Generated autoloads from vc/add-log.el
 
 (put 'change-log-default-name 'safe-local-variable 'string-or-null-p)
@@ -147,7 +147,7 @@ Find a change log file for \\[add-change-log-entry] and 
return the name.
 
 Optional arg FILE-NAME specifies the file to use.
 If FILE-NAME is nil, use the value of `change-log-default-name'.
-If `change-log-default-name' is nil, behave as though it were 'ChangeLog'
+If `change-log-default-name' is nil, behave as though it were \"ChangeLog\"
 \(or whatever we use on this operating system).
 
 If `change-log-default-name' contains a leading directory component, then
@@ -374,7 +374,7 @@ usage: (defadvice FUNCTION (CLASS NAME [POSITION] [ARGLIST] 
FLAG...)
 
 ;;;***
 
-;;;### (autoloads nil "align" "align.el" (21670 32330 885624 725000))
+;;;### (autoloads nil "align" "align.el" (21948 40114 174686 453000))
 ;;; Generated autoloads from align.el
 
 (autoload 'align "align" "\
@@ -896,8 +896,8 @@ outline hot-spot navigation (see `allout-mode').
 
 ;;;***
 
-;;;### (autoloads nil "ange-ftp" "net/ange-ftp.el" (21855 577 137948
-;;;;;;  458000))
+;;;### (autoloads nil "ange-ftp" "net/ange-ftp.el" (21948 40114 314686
+;;;;;;  453000))
 ;;; Generated autoloads from net/ange-ftp.el
 
 (defalias 'ange-ftp-re-read-dir 'ange-ftp-reread-dir)
@@ -1603,8 +1603,8 @@ insert a template for the file depending on the mode of 
the buffer.
 
 ;;;***
 
-;;;### (autoloads nil "autoload" "emacs-lisp/autoload.el" (21906
-;;;;;;  58854 98640 200000))
+;;;### (autoloads nil "autoload" "emacs-lisp/autoload.el" (21935
+;;;;;;  28080 450075 956000))
 ;;; Generated autoloads from emacs-lisp/autoload.el
 
 (put 'generated-autoload-file 'safe-local-variable 'stringp)
@@ -1655,8 +1655,8 @@ should be non-nil).
 
 ;;;***
 
-;;;### (autoloads nil "autorevert" "autorevert.el" (21855 576 477946
-;;;;;;  398000))
+;;;### (autoloads nil "autorevert" "autorevert.el" (21928 54832 51662
+;;;;;;  924000))
 ;;; Generated autoloads from autorevert.el
 
 (autoload 'auto-revert-mode "autorevert" "\
@@ -1679,7 +1679,7 @@ without being changed in the part that is already in the 
buffer.
 Turn on Auto-Revert Mode.
 
 This function is designed to be added to hooks, for example:
-  (add-hook 'c-mode-hook #'turn-on-auto-revert-mode)
+  (add-hook \\='c-mode-hook #\\='turn-on-auto-revert-mode)
 
 \(fn)" nil nil)
 
@@ -1707,7 +1707,7 @@ Use `auto-revert-mode' for changes other than appends!
 Turn on Auto-Revert Tail mode.
 
 This function is designed to be added to hooks, for example:
-  (add-hook 'my-logfile-mode-hook #'turn-on-auto-revert-tail-mode)
+  (add-hook \\='my-logfile-mode-hook #\\='turn-on-auto-revert-tail-mode)
 
 \(fn)" nil nil)
 
@@ -1874,8 +1874,8 @@ For non-interactive use see also `benchmark-run' and
 
 ;;;***
 
-;;;### (autoloads nil "bibtex" "textmodes/bibtex.el" (21855 577 517944
-;;;;;;  90000))
+;;;### (autoloads nil "bibtex" "textmodes/bibtex.el" (21948 40114
+;;;;;;  506686 453000))
 ;;; Generated autoloads from textmodes/bibtex.el
 
 (autoload 'bibtex-initialize "bibtex" "\
@@ -3718,8 +3718,8 @@ Add the warnings that closure conversion would encounter.
 
 ;;;***
 
-;;;### (autoloads nil "cfengine" "progmodes/cfengine.el" (21906 27825
-;;;;;;  297852 407000))
+;;;### (autoloads nil "cfengine" "progmodes/cfengine.el" (21931 31023
+;;;;;;  757164 572000))
 ;;; Generated autoloads from progmodes/cfengine.el
 (push (purecopy '(cfengine 1 4)) package--builtin-versions)
 
@@ -3748,8 +3748,8 @@ Choose `cfengine2-mode' or `cfengine3-mode' by buffer 
contents.
 
 ;;;***
 
-;;;### (autoloads nil "character-fold" "character-fold.el" (21907
-;;;;;;  48688 653360 195000))
+;;;### (autoloads nil "character-fold" "character-fold.el" (21914
+;;;;;;  21937 447876 215000))
 ;;; Generated autoloads from character-fold.el
 
 (defvar character-fold-search t "\
@@ -3797,8 +3797,8 @@ Returns non-nil if any false statements are found.
 
 ;;;***
 
-;;;### (autoloads nil "checkdoc" "emacs-lisp/checkdoc.el" (21880
-;;;;;;  42635 728365 616000))
+;;;### (autoloads nil "checkdoc" "emacs-lisp/checkdoc.el" (21948
+;;;;;;  40114 230686 453000))
 ;;; Generated autoloads from emacs-lisp/checkdoc.el
 (push (purecopy '(checkdoc 0 6 2)) package--builtin-versions)
 (put 'checkdoc-force-docstrings-flag 'safe-local-variable #'booleanp)
@@ -4388,8 +4388,8 @@ on third call it again advances points to the next 
difference and so on.
 
 ;;;***
 
-;;;### (autoloads nil "compile" "progmodes/compile.el" (21907 48688
-;;;;;;  769360 195000))
+;;;### (autoloads nil "compile" "progmodes/compile.el" (21911 45744
+;;;;;;  555516 371000))
 ;;; Generated autoloads from progmodes/compile.el
 
 (defvar compilation-mode-hook nil "\
@@ -4451,11 +4451,11 @@ Last shell command used to do a compilation; default 
for next compilation.
 Sometimes it is useful for files to supply local values for this variable.
 You might also use mode hooks to specify it in certain modes, like this:
 
-    (add-hook 'c-mode-hook
+    (add-hook \\='c-mode-hook
        (lambda ()
         (unless (or (file-exists-p \"makefile\")
                     (file-exists-p \"Makefile\"))
-          (set (make-local-variable 'compile-command)
+          (set (make-local-variable \\='compile-command)
                (concat \"make -k \"
                        (if buffer-file-name
                          (shell-quote-argument
@@ -5016,8 +5016,8 @@ Run a `perldoc' on the word around point.
 
 ;;;***
 
-;;;### (autoloads nil "cpp" "progmodes/cpp.el" (21670 32331 385639
-;;;;;;  720000))
+;;;### (autoloads nil "cpp" "progmodes/cpp.el" (21948 40114 418686
+;;;;;;  453000))
 ;;; Generated autoloads from progmodes/cpp.el
 
 (autoload 'cpp-highlight-buffer "cpp" "\
@@ -5158,8 +5158,8 @@ entering the area covered by the text-property property 
or leaving it.
 
 ;;;***
 
-;;;### (autoloads nil "cus-edit" "cus-edit.el" (21855 576 647952
-;;;;;;  330000))
+;;;### (autoloads nil "cus-edit" "cus-edit.el" (21948 40114 214686
+;;;;;;  453000))
 ;;; Generated autoloads from cus-edit.el
 
 (defvar custom-browse-sort-alphabetically nil "\
@@ -5795,8 +5795,8 @@ There is some minimal font-lock support (see vars
 
 ;;;***
 
-;;;### (autoloads nil "debug" "emacs-lisp/debug.el" (21855 576 767950
-;;;;;;  442000))
+;;;### (autoloads nil "debug" "emacs-lisp/debug.el" (21918 44225
+;;;;;;  955204 84000))
 ;;; Generated autoloads from emacs-lisp/debug.el
 
 (setq debugger 'debug)
@@ -5839,8 +5839,8 @@ To specify a nil argument interactively, exit with an 
empty minibuffer.
 
 ;;;***
 
-;;;### (autoloads nil "decipher" "play/decipher.el" (21799 41767
-;;;;;;  31221 635000))
+;;;### (autoloads nil "decipher" "play/decipher.el" (21948 40114
+;;;;;;  398686 453000))
 ;;; Generated autoloads from play/decipher.el
 
 (autoload 'decipher "decipher" "\
@@ -5991,8 +5991,8 @@ the first time the mode is used.
 
 ;;;***
 
-;;;### (autoloads nil "descr-text" "descr-text.el" (21891 60465 839679
-;;;;;;  523000))
+;;;### (autoloads nil "descr-text" "descr-text.el" (21948 40114 214686
+;;;;;;  453000))
 ;;; Generated autoloads from descr-text.el
 
 (autoload 'describe-text-properties "descr-text" "\
@@ -6418,7 +6418,7 @@ Optional arguments are passed to `dig-invoke'.
 
 ;;;***
 
-;;;### (autoloads nil "dired" "dired.el" (21874 51372 526324 856000))
+;;;### (autoloads nil "dired" "dired.el" (21914 55048 605882 55000))
 ;;; Generated autoloads from dired.el
 
 (defvar dired-listing-switches (purecopy "-al") "\
@@ -7614,7 +7614,7 @@ With prefix arg NOCONFIRM, execute current line as-is 
without editing.
 
 ;;;***
 
-;;;### (autoloads nil "ede" "cedet/ede.el" (21834 29303 521933 754000))
+;;;### (autoloads nil "ede" "cedet/ede.el" (21947 19252 621252 749000))
 ;;; Generated autoloads from cedet/ede.el
 (push (purecopy '(ede 1 2)) package--builtin-versions)
 
@@ -8125,15 +8125,15 @@ BUFFER is put back into its original major mode.
 
 ;;;***
 
-;;;### (autoloads nil "eieio" "emacs-lisp/eieio.el" (21891 60664
-;;;;;;  847679 523000))
+;;;### (autoloads nil "eieio" "emacs-lisp/eieio.el" (21915 42801
+;;;;;;  52409 735000))
 ;;; Generated autoloads from emacs-lisp/eieio.el
 (push (purecopy '(eieio 1 4)) package--builtin-versions)
 
 ;;;***
 
-;;;### (autoloads nil "eieio-core" "emacs-lisp/eieio-core.el" (21827
-;;;;;;  47608 610495 897000))
+;;;### (autoloads nil "eieio-core" "emacs-lisp/eieio-core.el" (21915
+;;;;;;  42801 48409 735000))
 ;;; Generated autoloads from emacs-lisp/eieio-core.el
 (push (purecopy '(eieio-core 1 4)) package--builtin-versions)
 
@@ -8417,7 +8417,7 @@ Commands:
 
 ;;;***
 
-;;;### (autoloads nil "epa" "epa.el" (21670 32330 885624 725000))
+;;;### (autoloads nil "epa" "epa.el" (21948 40114 234686 453000))
 ;;; Generated autoloads from epa.el
 
 (autoload 'epa-list-keys "epa" "\
@@ -8730,7 +8730,7 @@ if ARG is omitted or nil.
 
 ;;;***
 
-;;;### (autoloads nil "epg" "epg.el" (21890 39605 414073 663000))
+;;;### (autoloads nil "epg" "epg.el" (21931 31023 725164 572000))
 ;;; Generated autoloads from epg.el
 (push (purecopy '(epg 1 0 0)) package--builtin-versions)
 
@@ -8741,8 +8741,8 @@ Return a context object.
 
 ;;;***
 
-;;;### (autoloads nil "epg-config" "epg-config.el" (21670 32330 885624
-;;;;;;  725000))
+;;;### (autoloads nil "epg-config" "epg-config.el" (21927 33969 780642
+;;;;;;  720000))
 ;;; Generated autoloads from epg-config.el
 
 (autoload 'epg-configuration "epg-config" "\
@@ -8839,8 +8839,8 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL.
 
 ;;;***
 
-;;;### (autoloads nil "erc-dcc" "erc/erc-dcc.el" (21696 56380 925320
-;;;;;;  624000))
+;;;### (autoloads nil "erc-dcc" "erc/erc-dcc.el" (21948 40114 242686
+;;;;;;  453000))
 ;;; Generated autoloads from erc/erc-dcc.el
  (autoload 'erc-dcc-mode "erc-dcc")
 
@@ -9399,8 +9399,8 @@ corresponding to a successful execution.
 
 ;;;***
 
-;;;### (autoloads nil "etags" "progmodes/etags.el" (21907 48688 773360
-;;;;;;  195000))
+;;;### (autoloads nil "etags" "progmodes/etags.el" (21919 39857 637327
+;;;;;;  44000))
 ;;; Generated autoloads from progmodes/etags.el
 
 (defvar tags-file-name nil "\
@@ -10163,8 +10163,8 @@ This is used only in conjunction with 
`expand-add-abbrevs'.
 
 ;;;***
 
-;;;### (autoloads nil "f90" "progmodes/f90.el" (21880 42136 781803
-;;;;;;  616000))
+;;;### (autoloads nil "f90" "progmodes/f90.el" (21914 21937 459876
+;;;;;;  215000))
 ;;; Generated autoloads from progmodes/f90.el
 
 (autoload 'f90-mode "f90" "\
@@ -10446,7 +10446,7 @@ you can set `feedmail-queue-reminder-alist' to nil.
 
 ;;;***
 
-;;;### (autoloads nil "ffap" "ffap.el" (21837 20508 21231 579000))
+;;;### (autoloads nil "ffap" "ffap.el" (21948 40114 250686 453000))
 ;;; Generated autoloads from ffap.el
 
 (autoload 'ffap-next "ffap" "\
@@ -11096,8 +11096,8 @@ Turn flymake mode off.
 
 ;;;***
 
-;;;### (autoloads nil "flyspell" "textmodes/flyspell.el" (21750 59840
-;;;;;;  704617 663000))
+;;;### (autoloads nil "flyspell" "textmodes/flyspell.el" (21948 40114
+;;;;;;  506686 453000))
 ;;; Generated autoloads from textmodes/flyspell.el
 
 (autoload 'flyspell-prog-mode "flyspell" "\
@@ -11132,7 +11132,7 @@ invoking `ispell-change-dictionary'.
 
 Consider using the `ispell-parser' to check your text.  For instance
 consider adding:
-\(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex))))
+\(add-hook \\='tex-mode-hook (function (lambda () (setq ispell-parser 
\\='tex))))
 in your init file.
 
 \\[flyspell-region] checks all words inside a region.
@@ -11298,8 +11298,8 @@ Visit a file in Forms mode in other window.
 
 ;;;***
 
-;;;### (autoloads nil "fortran" "progmodes/fortran.el" (21670 32331
-;;;;;;  385639 720000))
+;;;### (autoloads nil "fortran" "progmodes/fortran.el" (21914 21937
+;;;;;;  467876 215000))
 ;;; Generated autoloads from progmodes/fortran.el
 
 (autoload 'fortran-mode "fortran" "\
@@ -12224,8 +12224,8 @@ If gravatars are already displayed, remove them.
 
 ;;;***
 
-;;;### (autoloads nil "gnus-group" "gnus/gnus-group.el" (21852 24381
-;;;;;;  597233 80000))
+;;;### (autoloads nil "gnus-group" "gnus/gnus-group.el" (21918 18992
+;;;;;;  805579 660000))
 ;;; Generated autoloads from gnus/gnus-group.el
 
 (autoload 'gnus-fetch-group "gnus-group" "\
@@ -12533,8 +12533,8 @@ Add NUM into sorted LIST by side effect.
 
 ;;;***
 
-;;;### (autoloads nil "gnus-registry" "gnus/gnus-registry.el" (21774
-;;;;;;  38574 225319 550000))
+;;;### (autoloads nil "gnus-registry" "gnus/gnus-registry.el" (21948
+;;;;;;  40114 254686 453000))
 ;;; Generated autoloads from gnus/gnus-registry.el
 
 (autoload 'gnus-registry-initialize "gnus-registry" "\
@@ -13015,8 +13015,8 @@ it if ARG is omitted or nil.
 
 ;;;***
 
-;;;### (autoloads nil "gv" "emacs-lisp/gv.el" (21750 59840 206034
-;;;;;;  761000))
+;;;### (autoloads nil "gv" "emacs-lisp/gv.el" (21916 4736 835897
+;;;;;;  451000))
 ;;; Generated autoloads from emacs-lisp/gv.el
 
 (autoload 'gv-get "gv" "\
@@ -13061,7 +13061,7 @@ arguments as NAME.  DO is a function as defined in 
`gv-get'.
 
 \(fn SYMBOL NAME ARGS HANDLER &optional FIX)" nil nil)
 
-(or (assq 'gv-expander defun-declarations-alist) (push `(gv-expander 
,(apply-partially #'gv--defun-declaration 'gv-expander)) 
defun-declarations-alist))
+(or (assq 'gv-expander defun-declarations-alist) (let ((x `(gv-expander 
,(apply-partially #'gv--defun-declaration 'gv-expander)))) (push x 
macro-declarations-alist) (push x defun-declarations-alist)))
 
 (or (assq 'gv-setter defun-declarations-alist) (push `(gv-setter 
,(apply-partially #'gv--defun-declaration 'gv-setter)) 
defun-declarations-alist))
 
@@ -13335,8 +13335,8 @@ different regions.  With numeric argument ARG, behaves 
like
 
 ;;;***
 
-;;;### (autoloads nil "help-fns" "help-fns.el" (21891 60465 919679
-;;;;;;  523000))
+;;;### (autoloads nil "help-fns" "help-fns.el" (21915 42801 64409
+;;;;;;  735000))
 ;;; Generated autoloads from help-fns.el
 
 (autoload 'describe-function "help-fns" "\
@@ -13387,11 +13387,9 @@ it is displayed along with the global value.
 
 \(fn VARIABLE &optional BUFFER FRAME)" t nil)
 
-(autoload 'describe-function-or-variable "help-fns" "\
-Display the full documentation of the function or variable SYMBOL.
-If SYMBOL is a variable and has a buffer-local value in BUFFER or FRAME
-\(default to the current buffer and current frame), it is displayed along
-with the global value.
+(autoload 'describe-symbol "help-fns" "\
+Display the full documentation of SYMBOL.
+Will show the info of SYMBOL as a function, variable, and/or face.
 
 \(fn SYMBOL &optional BUFFER FRAME)" t nil)
 
@@ -13437,8 +13435,8 @@ gives the window that lists the options.")
 
 ;;;***
 
-;;;### (autoloads nil "help-mode" "help-mode.el" (21891 60465 919679
-;;;;;;  523000))
+;;;### (autoloads nil "help-mode" "help-mode.el" (21915 42801 64409
+;;;;;;  735000))
 ;;; Generated autoloads from help-mode.el
 
 (autoload 'help-mode "help-mode" "\
@@ -13528,13 +13526,7 @@ Add xrefs for symbols in `pp's output between FROM and 
TO.
 
 \(fn FROM TO)" nil nil)
 
-(autoload 'help-xref-interned "help-mode" "\
-Follow a hyperlink which appeared to be an arbitrary interned SYMBOL.
-Both variable, function and face documentation are extracted into a single
-help buffer. If SYMBOL is a variable, include buffer-local value for optional
-BUFFER or FRAME.
-
-\(fn SYMBOL &optional BUFFER FRAME)" nil nil)
+(define-obsolete-function-alias 'help-xref-interned 'describe-symbol "25.1")
 
 (autoload 'help-bookmark-jump "help-mode" "\
 Jump to help-mode bookmark BOOKMARK.
@@ -14005,7 +13997,7 @@ You can automatically rotate colors when the buffer is 
saved by adding
 this function to `write-file-functions' as a buffer-local value.  To do
 this, eval the following in the buffer to be saved:
 
-  (add-hook 'write-file-functions 'highlight-changes-rotate-faces nil t)
+  (add-hook \\='write-file-functions \\='highlight-changes-rotate-faces nil t)
 
 \(fn)" t nil)
 
@@ -14446,8 +14438,8 @@ FORMATS is the value to use for `ibuffer-formats'.
 
 ;;;***
 
-;;;### (autoloads nil "icalendar" "calendar/icalendar.el" (21795
-;;;;;;  44704 594368 994000))
+;;;### (autoloads nil "icalendar" "calendar/icalendar.el" (21934
+;;;;;;  7227 609892 708000))
 ;;; Generated autoloads from calendar/icalendar.el
 (push (purecopy '(icalendar 0 19)) package--builtin-versions)
 
@@ -14607,8 +14599,8 @@ See also the variable `idlwave-shell-prompt-pattern'.
 
 ;;;***
 
-;;;### (autoloads nil "idlwave" "progmodes/idlwave.el" (21862 60209
-;;;;;;  838658 475000))
+;;;### (autoloads nil "idlwave" "progmodes/idlwave.el" (21948 40114
+;;;;;;  438686 453000))
 ;;; Generated autoloads from progmodes/idlwave.el
 (push (purecopy '(idlwave 6 1 22)) package--builtin-versions)
 
@@ -14737,7 +14729,7 @@ The main features of this mode are
 
 ;;;***
 
-;;;### (autoloads nil "ido" "ido.el" (21862 60209 728658 929000))
+;;;### (autoloads nil "ido" "ido.el" (21909 4018 621671 120000))
 ;;; Generated autoloads from ido.el
 
 (defvar ido-mode nil "\
@@ -15469,7 +15461,7 @@ on these modes.
 
 ;;;***
 
-;;;### (autoloads nil "imenu" "imenu.el" (21670 32331 385639 720000))
+;;;### (autoloads nil "imenu" "imenu.el" (21948 40114 294686 453000))
 ;;; Generated autoloads from imenu.el
 
 (defvar imenu-sort-function nil "\
@@ -15657,7 +15649,7 @@ of `inferior-lisp-program').  Runs the hooks from
 
 ;;;***
 
-;;;### (autoloads nil "info" "info.el" (21887 28748 899667 16000))
+;;;### (autoloads nil "info" "info.el" (21931 31023 745164 572000))
 ;;; Generated autoloads from info.el
 
 (defcustom Info-default-directory-list (let* ((config-dir 
(file-name-as-directory (or (and (featurep 'ns) (let ((dir (expand-file-name 
"../info" data-directory))) (if (file-directory-p dir) dir))) 
configure-info-directory))) (prefixes (prune-directory-list '("/usr/local/" 
"/usr/" "/opt/" "/"))) (suffixes '("share/" "" "gnu/" "gnu/lib/" 
"gnu/lib/emacs/" "emacs/" "lib/" "lib/emacs/")) (standard-info-dirs (apply 
#'nconc (mapcar (lambda (pfx) (let ((dirs (mapcar (lambda (sfx) (concat pfx sfx 
[...]
@@ -16431,14 +16423,14 @@ The `X' command aborts sending the message so that 
you can edit the buffer.
 
 To spell-check whenever a message is sent, include the appropriate lines
 in your init file:
-   (add-hook 'message-send-hook 'ispell-message)  ;; GNUS 5
-   (add-hook 'news-inews-hook 'ispell-message)    ;; GNUS 4
-   (add-hook 'mail-send-hook  'ispell-message)
-   (add-hook 'mh-before-send-letter-hook 'ispell-message)
+   (add-hook \\='message-send-hook \\='ispell-message)  ;; GNUS 5
+   (add-hook \\='news-inews-hook \\='ispell-message)    ;; GNUS 4
+   (add-hook \\='mail-send-hook  \\='ispell-message)
+   (add-hook \\='mh-before-send-letter-hook \\='ispell-message)
 
 You can bind this to the key C-c i in GNUS or mail by adding to
 `news-reply-mode-hook' or `mail-mode-hook' the following lambda expression:
-   (function (lambda () (local-set-key \"\\C-ci\" 'ispell-message)))
+   (function (lambda () (local-set-key \"\\C-ci\" \\='ispell-message)))
 
 \(fn)" t nil)
 
@@ -16546,8 +16538,8 @@ by `jka-compr-installed'.
 
 ;;;***
 
-;;;### (autoloads nil "js" "progmodes/js.el" (21833 59993 694773
-;;;;;;  201000))
+;;;### (autoloads nil "js" "progmodes/js.el" (21931 31023 761164
+;;;;;;  572000))
 ;;; Generated autoloads from progmodes/js.el
 (push (purecopy '(js 9)) package--builtin-versions)
 
@@ -16795,38 +16787,6 @@ The kind of Korean keyboard for Korean input method.
 
 ;;;***
 
-;;;### (autoloads nil "landmark" "play/landmark.el" (21670 32331
-;;;;;;  385639 720000))
-;;; Generated autoloads from play/landmark.el
-(push (purecopy '(landmark 1 0)) package--builtin-versions)
-
-(defalias 'landmark-repeat 'landmark-test-run)
-
-(autoload 'landmark-test-run "landmark" "\
-Run 100 Landmark games, each time saving the weights from the previous game.
-
-\(fn)" t nil)
-
-(autoload 'landmark "landmark" "\
-Start or resume an Landmark game.
-If a game is in progress, this command allows you to resume it.
-Here is the relation between prefix args and game options:
-
-prefix arg | robot is auto-started | weights are saved from last game
----------------------------------------------------------------------
-none / 1   | yes                   | no
-       2   | yes                   | yes
-       3   | no                    | yes
-       4   | no                    | no
-
-You start by moving to a square and typing \\[landmark-start-robot],
-if you did not use a prefix arg to ask for automatic start.
-Use \\[describe-mode] for more info.
-
-\(fn PARG)" t nil)
-
-;;;***
-
 ;;;### (autoloads nil "lao-util" "language/lao-util.el" (21670 32331
 ;;;;;;  385639 720000))
 ;;; Generated autoloads from language/lao-util.el
@@ -17124,8 +17084,8 @@ except that FILTER is not optional.
 
 ;;;***
 
-;;;### (autoloads nil "log-edit" "vc/log-edit.el" (21852 24382 97237
-;;;;;;  703000))
+;;;### (autoloads nil "log-edit" "vc/log-edit.el" (21942 1330 837986
+;;;;;;  820000))
 ;;; Generated autoloads from vc/log-edit.el
 
 (autoload 'log-edit "log-edit" "\
@@ -17156,8 +17116,8 @@ done.  Otherwise, it uses the current buffer.
 
 ;;;***
 
-;;;### (autoloads nil "log-view" "vc/log-view.el" (21850 34915 117255
-;;;;;;  375000))
+;;;### (autoloads nil "log-view" "vc/log-view.el" (21947 19252 637252
+;;;;;;  749000))
 ;;; Generated autoloads from vc/log-view.el
 
 (autoload 'log-view-mode "log-view" "\
@@ -17826,8 +17786,8 @@ Default bookmark handler for Man buffers.
 
 ;;;***
 
-;;;### (autoloads nil "map" "emacs-lisp/map.el" (21895 57521 614301
-;;;;;;  332000))
+;;;### (autoloads nil "map" "emacs-lisp/map.el" (21919 39857 593327
+;;;;;;  44000))
 ;;; Generated autoloads from emacs-lisp/map.el
 (push (purecopy '(map 1 0)) package--builtin-versions)
 
@@ -18963,8 +18923,8 @@ The default is 20.  If LIMIT is negative, do not limit 
the listing.
 
 ;;;***
 
-;;;### (autoloads nil "mule-util" "international/mule-util.el" (21893
-;;;;;;  15793 483985 415000))
+;;;### (autoloads nil "mule-util" "international/mule-util.el" (21931
+;;;;;;  31023 753164 572000))
 ;;; Generated autoloads from international/mule-util.el
 
 (defsubst string-to-list (string) "\
@@ -19107,6 +19067,20 @@ QUALITY can be:
 
 \(fn BYTE &optional QUALITY CODING-SYSTEM)" nil nil)
 
+(autoload 'bufferpos-to-filepos "mule-util" "\
+Try to return the file byte corresponding to a particular buffer POSITION.
+Value is the file position given as a (0-based) byte count.
+The function presumes the file is encoded with CODING-SYSTEM, which defaults
+to `buffer-file-coding-system'.
+QUALITY can be:
+  `approximate', in which case we may cut some corners to avoid
+    excessive work.
+  `exact', in which case we may end up re-(en/de)coding a large
+    part of the file/buffer.
+  nil, in which case we may return nil rather than an approximation.
+
+\(fn POSITION &optional QUALITY CODING-SYSTEM)" nil nil)
+
 ;;;***
 
 ;;;### (autoloads nil "net-utils" "net/net-utils.el" (21826 50071
@@ -19390,8 +19364,8 @@ Start newsticker treeview.
 
 ;;;***
 
-;;;### (autoloads nil "nndiary" "gnus/nndiary.el" (21670 32331 385639
-;;;;;;  720000))
+;;;### (autoloads nil "nndiary" "gnus/nndiary.el" (21948 40114 262686
+;;;;;;  453000))
 ;;; Generated autoloads from gnus/nndiary.el
 
 (autoload 'nndiary-generate-nov-databases "nndiary" "\
@@ -19427,7 +19401,7 @@ This command does not work if you use short group names.
 
 ;;;***
 
-;;;### (autoloads nil "nnml" "gnus/nnml.el" (21670 32331 385639 720000))
+;;;### (autoloads nil "nnml" "gnus/nnml.el" (21948 40114 266686 453000))
 ;;; Generated autoloads from gnus/nnml.el
 
 (autoload 'nnml-generate-nov-databases "nnml" "\
@@ -19615,8 +19589,8 @@ startup file, `~/.emacs-octave'.
 
 ;;;***
 
-;;;### (autoloads nil "opascal" "progmodes/opascal.el" (21670 32331
-;;;;;;  385639 720000))
+;;;### (autoloads nil "opascal" "progmodes/opascal.el" (21948 40114
+;;;;;;  450686 453000))
 ;;; Generated autoloads from progmodes/opascal.el
 
 (define-obsolete-function-alias 'delphi-mode 'opascal-mode "24.4")
@@ -19651,7 +19625,7 @@ Coloring:
 
 ;;;***
 
-;;;### (autoloads nil "org" "org/org.el" (21866 57262 677944 752000))
+;;;### (autoloads nil "org" "org/org.el" (21948 40114 382686 453000))
 ;;; Generated autoloads from org/org.el
 
 (autoload 'org-babel-do-load-languages "org" "\
@@ -20189,8 +20163,8 @@ Set `org-capture-templates' to be similar to 
`org-remember-templates'.
 
 ;;;***
 
-;;;### (autoloads nil "org-colview" "org/org-colview.el" (21670 32331
-;;;;;;  385639 720000))
+;;;### (autoloads nil "org-colview" "org/org-colview.el" (21948 40114
+;;;;;;  334686 453000))
 ;;; Generated autoloads from org/org-colview.el
 
 (autoload 'org-columns-remove-overlays "org-colview" "\
@@ -20337,8 +20311,8 @@ See the command `outline-mode' for more information on 
this mode.
 
 ;;;***
 
-;;;### (autoloads nil "package" "emacs-lisp/package.el" (21907 48688
-;;;;;;  661360 195000))
+;;;### (autoloads nil "package" "emacs-lisp/package.el" (21930 10161
+;;;;;;  970828 320000))
 ;;; Generated autoloads from emacs-lisp/package.el
 (push (purecopy '(package 1 0 1)) package--builtin-versions)
 
@@ -20406,7 +20380,8 @@ Downloads and installs required packages as needed.
 
 (autoload 'package-install-file "package" "\
 Install a package from a file.
-The file can either be a tar file or an Emacs Lisp file.
+The file can either be a tar file, an Emacs Lisp file, or a
+directory.
 
 \(fn FILE)" t nil)
 
@@ -21828,8 +21803,8 @@ Proced buffers.
 
 ;;;***
 
-;;;### (autoloads nil "profiler" "profiler.el" (21670 32331 385639
-;;;;;;  720000))
+;;;### (autoloads nil "profiler" "profiler.el" (21948 40114 402686
+;;;;;;  453000))
 ;;; Generated autoloads from profiler.el
 
 (autoload 'profiler-start "profiler" "\
@@ -21857,6 +21832,17 @@ Open profile FILENAME.
 
 ;;;***
 
+;;;### (autoloads nil "project" "progmodes/project.el" (21947 19252
+;;;;;;  629252 749000))
+;;; Generated autoloads from progmodes/project.el
+
+(autoload 'project-current "project" "\
+Return the project instance in DIR or `default-directory'.
+
+\(fn &optional DIR)" nil nil)
+
+;;;***
+
 ;;;### (autoloads nil "prolog" "progmodes/prolog.el" (21670 32331
 ;;;;;;  385639 720000))
 ;;; Generated autoloads from progmodes/prolog.el
@@ -21949,8 +21935,8 @@ Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when 
the cursor is at the number
 
 ;;;***
 
-;;;### (autoloads nil "ps-print" "ps-print.el" (21855 577 457945
-;;;;;;  244000))
+;;;### (autoloads nil "ps-print" "ps-print.el" (21948 40114 490686
+;;;;;;  453000))
 ;;; Generated autoloads from ps-print.el
 (push (purecopy '(ps-print 7 3 5)) package--builtin-versions)
 
@@ -22166,8 +22152,8 @@ Optional argument FACE specifies the face to do the 
highlighting.
 
 ;;;***
 
-;;;### (autoloads nil "python" "progmodes/python.el" (21855 577 407510
-;;;;;;  166000))
+;;;### (autoloads nil "python" "progmodes/python.el" (21915 42801
+;;;;;;  68409 735000))
 ;;; Generated autoloads from progmodes/python.el
 (push (purecopy '(python 0 24 5)) package--builtin-versions)
 
@@ -22554,7 +22540,8 @@ Display `quickurl-list' as a formatted list using 
`quickurl-list-mode'.
 
 ;;;***
 
-;;;### (autoloads nil "rcirc" "net/rcirc.el" (21855 577 167944 784000))
+;;;### (autoloads nil "rcirc" "net/rcirc.el" (21930 10161 986828
+;;;;;;  320000))
 ;;; Generated autoloads from net/rcirc.el
 
 (autoload 'rcirc "rcirc" "\
@@ -23421,8 +23408,8 @@ Validation will be enabled if 
`rng-nxml-auto-validate-flag' is non-nil.
 
 ;;;***
 
-;;;### (autoloads nil "rng-valid" "nxml/rng-valid.el" (21670 32331
-;;;;;;  385639 720000))
+;;;### (autoloads nil "rng-valid" "nxml/rng-valid.el" (21948 40114
+;;;;;;  322686 453000))
 ;;; Generated autoloads from nxml/rng-valid.el
 
 (autoload 'rng-validate-mode "rng-valid" "\
@@ -24097,8 +24084,8 @@ vertically fixed relative to window boundaries during 
scrolling.
 
 ;;;***
 
-;;;### (autoloads nil "semantic" "cedet/semantic.el" (21679 47292
-;;;;;;  556033 759000))
+;;;### (autoloads nil "semantic" "cedet/semantic.el" (21948 40114
+;;;;;;  186686 453000))
 ;;; Generated autoloads from cedet/semantic.el
 (push (purecopy '(semantic 2 2)) package--builtin-versions)
 
@@ -24459,14 +24446,14 @@ Like `mail' command, but display mail buffer in 
another frame.
 
 ;;;***
 
-;;;### (autoloads nil "seq" "emacs-lisp/seq.el" (21906 58825 966640
-;;;;;;  200000))
+;;;### (autoloads nil "seq" "emacs-lisp/seq.el" (21909 4018 525671
+;;;;;;  120000))
 ;;; Generated autoloads from emacs-lisp/seq.el
 (push (purecopy '(seq 1 8)) package--builtin-versions)
 
 ;;;***
 
-;;;### (autoloads nil "server" "server.el" (21906 27825 297852 407000))
+;;;### (autoloads nil "server" "server.el" (21916 4736 887897 451000))
 ;;; Generated autoloads from server.el
 
 (put 'server-host 'risky-local-variable t)
@@ -24577,8 +24564,8 @@ formula:
 
 ;;;***
 
-;;;### (autoloads nil "sgml-mode" "textmodes/sgml-mode.el" (21839
-;;;;;;  43859 371195 279000))
+;;;### (autoloads nil "sgml-mode" "textmodes/sgml-mode.el" (21939
+;;;;;;  25137 195448 264000))
 ;;; Generated autoloads from textmodes/sgml-mode.el
 
 (autoload 'sgml-mode "sgml-mode" "\
@@ -24887,8 +24874,8 @@ DOM should be a parse tree as generated by
 
 ;;;***
 
-;;;### (autoloads nil "sieve-mode" "gnus/sieve-mode.el" (21670 32331
-;;;;;;  385639 720000))
+;;;### (autoloads nil "sieve-mode" "gnus/sieve-mode.el" (21931 31023
+;;;;;;  733164 572000))
 ;;; Generated autoloads from gnus/sieve-mode.el
 
 (autoload 'sieve-mode "sieve-mode" "\
@@ -24952,8 +24939,8 @@ with no arguments, if that value is non-nil.
 
 ;;;***
 
-;;;### (autoloads nil "skeleton" "skeleton.el" (21862 60209 898658
-;;;;;;  614000))
+;;;### (autoloads nil "skeleton" "skeleton.el" (21939 25137 183448
+;;;;;;  264000))
 ;;; Generated autoloads from skeleton.el
 
 (defvar skeleton-filter-function 'identity "\
@@ -26383,8 +26370,8 @@ The variable `tab-width' controls the spacing of tab 
stops.
 
 ;;;***
 
-;;;### (autoloads nil "table" "textmodes/table.el" (21804 59688 284811
-;;;;;;  0))
+;;;### (autoloads nil "table" "textmodes/table.el" (21948 40114 526686
+;;;;;;  453000))
 ;;; Generated autoloads from textmodes/table.el
 
 (autoload 'table-insert "table" "\
@@ -27603,8 +27590,8 @@ Compose Thai characters in the current buffer.
 
 ;;;***
 
-;;;### (autoloads nil "thingatpt" "thingatpt.el" (21882 2522 257758
-;;;;;;  815000))
+;;;### (autoloads nil "thingatpt" "thingatpt.el" (21918 18992 829579
+;;;;;;  660000))
 ;;; Generated autoloads from thingatpt.el
 
 (autoload 'forward-thing "thingatpt" "\
@@ -27843,7 +27830,7 @@ variable will be set to the representation.
 
 ;;;***
 
-;;;### (autoloads nil "time" "time.el" (21907 48688 857360 195000))
+;;;### (autoloads nil "time" "time.el" (21942 1330 821986 820000))
 ;;; Generated autoloads from time.el
 
 (defvar display-time-day-and-date nil "\
@@ -28009,8 +27996,8 @@ Convert the time interval in seconds to a short string.
 
 ;;;***
 
-;;;### (autoloads nil "time-stamp" "time-stamp.el" (21670 32331 885635
-;;;;;;  586000))
+;;;### (autoloads nil "time-stamp" "time-stamp.el" (21942 1330 821986
+;;;;;;  820000))
 ;;; Generated autoloads from time-stamp.el
 (put 'time-stamp-format 'safe-local-variable 'stringp)
 (put 'time-stamp-time-zone 'safe-local-variable 'string-or-null-p)
@@ -28424,7 +28411,8 @@ the output buffer or changing the window configuration.
 
 ;;;***
 
-;;;### (autoloads nil "tramp" "net/tramp.el" (21869 33455 50802 161000))
+;;;### (autoloads nil "tramp" "net/tramp.el" (21945 63921 461174
+;;;;;;  555000))
 ;;; Generated autoloads from net/tramp.el
 
 (defvar tramp-mode t "\
@@ -29645,7 +29633,7 @@ If FILE-NAME is non-nil, save the result to FILE-NAME.
 
 ;;;***
 
-;;;### (autoloads nil "vc" "vc/vc.el" (21850 34915 137255 549000))
+;;;### (autoloads nil "vc" "vc/vc.el" (21923 36911 845418 539000))
 ;;; Generated autoloads from vc/vc.el
 
 (defvar vc-checkout-hook nil "\
@@ -30082,7 +30070,7 @@ case, and the process object in the asynchronous case.
 
 ;;;***
 
-;;;### (autoloads nil "vc-hg" "vc/vc-hg.el" (21842 40086 557968 381000))
+;;;### (autoloads nil "vc-hg" "vc/vc-hg.el" (21932 51888 960440 344000))
 ;;; Generated autoloads from vc/vc-hg.el
  (defun vc-hg-registered (file)
   "Return non-nil if FILE is registered with hg."
@@ -30093,8 +30081,8 @@ case, and the process object in the asynchronous case.
 
 ;;;***
 
-;;;### (autoloads nil "vc-mtn" "vc/vc-mtn.el" (21826 49712 314797
-;;;;;;  780000))
+;;;### (autoloads nil "vc-mtn" "vc/vc-mtn.el" (21945 63921 477174
+;;;;;;  555000))
 ;;; Generated autoloads from vc/vc-mtn.el
 
 (defconst vc-mtn-admin-dir "_MTN" "\
@@ -30157,8 +30145,8 @@ For a description of possible values, see 
`vc-check-master-templates'.")
 
 ;;;***
 
-;;;### (autoloads nil "vc-svn" "vc/vc-svn.el" (21903 51634 294370
-;;;;;;  580000))
+;;;### (autoloads nil "vc-svn" "vc/vc-svn.el" (21916 4736 891897
+;;;;;;  451000))
 ;;; Generated autoloads from vc/vc-svn.el
  (defun vc-svn-registered (f)
   (let ((admin-dir (cond ((and (eq system-type 'windows-nt)
@@ -30370,8 +30358,8 @@ Key bindings specific to `verilog-mode-map' are:
 
 ;;;***
 
-;;;### (autoloads nil "vhdl-mode" "progmodes/vhdl-mode.el" (21907
-;;;;;;  48688 801360 195000))
+;;;### (autoloads nil "vhdl-mode" "progmodes/vhdl-mode.el" (21948
+;;;;;;  40114 482686 453000))
 ;;; Generated autoloads from progmodes/vhdl-mode.el
 
 (autoload 'vhdl-mode "vhdl-mode" "\
@@ -31401,8 +31389,8 @@ in certain major modes.
 
 ;;;***
 
-;;;### (autoloads nil "whitespace" "whitespace.el" (21828 42028 670509
-;;;;;;  602000))
+;;;### (autoloads nil "whitespace" "whitespace.el" (21918 18992 845579
+;;;;;;  660000))
 ;;; Generated autoloads from whitespace.el
 (push (purecopy '(whitespace 13 2 2)) package--builtin-versions)
 
@@ -32042,8 +32030,8 @@ If LIMIT is non-nil, then do not consider characters 
beyond LIMIT.
 
 ;;;***
 
-;;;### (autoloads nil "xref" "progmodes/xref.el" (21903 51634 290370
-;;;;;;  580000))
+;;;### (autoloads nil "xref" "progmodes/xref.el" (21947 19252 629252
+;;;;;;  749000))
 ;;; Generated autoloads from progmodes/xref.el
 
 (autoload 'xref-pop-marker-stack "xref" "\
@@ -32081,6 +32069,8 @@ With prefix argument, prompt for the identifier.
 
 (autoload 'xref-find-regexp "xref" "\
 Find all matches for REGEXP.
+With \\[universal-argument] prefix, you can specify the directory
+to search in, and the file name pattern to search for.
 
 \(fn REGEXP)" t nil)
 
@@ -32091,6 +32081,7 @@ The argument has the same meaning as in `apropos'.
 \(fn PATTERN)" t nil)
  (define-key esc-map "." #'xref-find-definitions)
  (define-key esc-map "," #'xref-pop-marker-stack)
+ (define-key esc-map "?" #'xref-find-references)
  (define-key esc-map [?\C-.] #'xref-find-apropos)
  (define-key ctl-x-4-map "." #'xref-find-definitions-other-window)
  (define-key ctl-x-5-map "." #'xref-find-definitions-other-frame)
@@ -32366,7 +32357,7 @@ Zone out, completely.
 ;;;;;;  "vc/ediff-vers.el" "vc/ediff-wind.el" "vc/pcvs-info.el" 
"vc/pcvs-parse.el"
 ;;;;;;  "vc/pcvs-util.el" "vc/vc-dav.el" "vc/vc-filewise.el" "vcursor.el"
 ;;;;;;  "vt-control.el" "vt100-led.el" "w32-fns.el" "w32-vars.el"
-;;;;;;  "x-dnd.el") (21907 48688 857360 195000))
+;;;;;;  "x-dnd.el") (21948 40114 418686 453000))
 
 ;;;***
 
diff --git a/lisp/leim/quail/cyrillic.el b/lisp/leim/quail/cyrillic.el
index ecee243..89a58cf 100644
--- a/lisp/leim/quail/cyrillic.el
+++ b/lisp/leim/quail/cyrillic.el
@@ -618,7 +618,7 @@
  "cyrillic-ukrainian" "Ukrainian" "ЖU" nil
  "ЄЇЕРТЗ-ІЎ UKRAINIAN
 
-Sorry, but 'ghe with upturn' is not included in ISO 8859-5."
+Sorry, but `ghe with upturn' is not included in ISO 8859-5."
  nil t t t t nil nil nil nil nil t)
 
 ;;  1! 2" 3# 4$ 5% 6& 7' 8( 9) 0= /? +* <>
@@ -839,7 +839,7 @@ Sorry, but 'ghe with upturn' is not included in ISO 8859-5."
  "ЯВЕРТЫ Roman transcription
 
 This layout is based on Roman transcription by phonemic resemblance.
-When preceded by a '/', the second and the third rows (number key row) change
+When preceded by a ‘/’, the second and the third rows (number key row) change
 as follows.
 
   keytop | Q  W  E  R  T  Y  U  I  O  P  A  S  D
@@ -1007,14 +1007,14 @@ are included.  Should handle most cases.  However:
   э (REVERSE ROUNDED E) = \"e\\\"
   х (KHA) when after с (S) = \"x\" or \"kh\"
   ъ (HARD SIGN) = \"~\", Ъ (CAPITAL HARD SIGN) = \"~~\",
-  ь (SOFT SIGN) = \"'\", Ь (CAPITAL SOFT SIGN) = \"''\",
+  ь (SOFT SIGN) = \"\\='\", Ь (CAPITAL SOFT SIGN) = \"\\='\\='\",
   я (YA) = \"ya\", \"ja\" or \"q\".
 
-Russian alphabet: a b v=w g d e yo=jo zh z i j=j' k l m n o p r s t
-u f h=kh=x c ch sh shch=sj=/s=/sht ~ y ' e\\ yu=ju ya=ja=q
+Russian alphabet: a b v=w g d e yo=jo zh z i j=j\\=' k l m n o p r s t
+u f h=kh=x c ch sh shch=sj=/s=/sht ~ y \\=' e\\ yu=ju ya=ja=q
 
 Also included are Ukrainian є (YE) = \"/e\", ї (YI) = \"yi\",
-ґ (GHE WITH UPTURN) = \"g'\",
+ґ (GHE WITH UPTURN) = \"g\\='\",
 Belarusian ў (SHORT U) = \"u~\",
 Serbo-Croatian ђ (DJE) = \"/d\", ћ (CHJE)= \"/ch\",
 Macedonian ѓ (GJE) = \"/g\", ѕ (DZE) = \"/s\", ќ (KJE) = \"/k\",
@@ -1410,7 +1410,7 @@ This keyboard layout is standard for Bulgarian 
typewriters.
 The letters Ц, М, Ч, Р, Л, Б and Ы are not affected by Caps Lock.
 
 In addition to original Bulgarian typewriter layout, keys \\ and |
-are transformed into ' and Ы respectively.  Some keyboards mark these
+are transformed into \\=' and Ы respectively.  Some keyboards mark these
 keys as being transformed into ( and ) respectively.  For ( and ), use
 \\=` and ~ respectively.  This input method follows XKB."
  nil t t t t nil nil nil nil nil t)
diff --git a/lisp/leim/quail/greek.el b/lisp/leim/quail/greek.el
index cf99150..1dfc93a 100644
--- a/lisp/leim/quail/greek.el
+++ b/lisp/leim/quail/greek.el
@@ -178,7 +178,7 @@ koppa               &               %
 mark           key
 ------------------------
 ypogegrammeni  J
-psili          '  or  v
+psili          \\='  or  v
 dasia          \\=`  or  V
 oxia           /
 varia          ?
@@ -461,9 +461,9 @@ mark                key
 ypogegrammeni  |
 psili          >
 dasia          <
-oxia           '
-koronis         ''
-varia          `
+oxia           \\='
+koronis                \\='\\='
+varia          \\=`
 perispomeni    ~
 dialytika      \"
 ano teleia     ;
diff --git a/lisp/leim/quail/hangul.el b/lisp/leim/quail/hangul.el
index 12d7358..56a244f 100644
--- a/lisp/leim/quail/hangul.el
+++ b/lisp/leim/quail/hangul.el
@@ -410,7 +410,9 @@ When a Korean input method is off, convert the following 
hangul character."
                      ((commandp cmd)
                       (call-interactively cmd))
                      (t
-                      (setq unread-command-events (listify-key-sequence seq))
+                      (setq unread-command-events
+                             (nconc (listify-key-sequence seq)
+                                    unread-command-events))
                       (throw 'exit-input-loop nil))))))
        (quail-delete-overlays)))))
 
@@ -454,7 +456,9 @@ When a Korean input method is off, convert the following 
hangul character."
                      ((commandp cmd)
                       (call-interactively cmd))
                      (t
-                      (setq unread-command-events (listify-key-sequence seq))
+                      (setq unread-command-events
+                             (nconc (listify-key-sequence seq)
+                                    unread-command-events))
                       (throw 'exit-input-loop nil))))))
        (quail-delete-overlays)))))
 
@@ -499,7 +503,9 @@ When a Korean input method is off, convert the following 
hangul character."
                      ((commandp cmd)
                       (call-interactively cmd))
                      (t
-                      (setq unread-command-events (listify-key-sequence seq))
+                      (setq unread-command-events
+                             (nconc (listify-key-sequence seq)
+                                    unread-command-events))
                       (throw 'exit-input-loop nil))))))
        (quail-delete-overlays)))))
 
diff --git a/lisp/leim/quail/hebrew.el b/lisp/leim/quail/hebrew.el
index 1601e1e..ac67fbf 100644
--- a/lisp/leim/quail/hebrew.el
+++ b/lisp/leim/quail/hebrew.el
@@ -36,8 +36,8 @@
 
 Based on SI-1452 keyboard layout.
 Only Hebrew-related characters are considered.
- 'q' is used to switch levels instead of Alt-Gr.
- Maqaaf (־) is mapped to '/פ'.
+ ‘q’ is used to switch levels instead of Alt-Gr.
+ Maqaaf (־) is mapped to ‘/פ’.
 " nil t t t t nil nil nil nil nil t)
 
 (quail-define-rules
@@ -457,8 +457,8 @@ Provides access to all Hebrew characters suitable to Modern 
Hebrew.
 
 Based on Society of Biblical Literature's Tiro keyboard layout.
 Not suitable for modern Hebrew input.
- 'q' is used to switch levels instead of Alt-Gr.
- Combining dot above (Called Masora dot) (̇) is mapped to 'q1'.
+ ‘q’ is used to switch levels instead of Alt-Gr.
+ Combining dot above (Called Masora dot) (̇) is mapped to ‘q1’.
 " nil t t t t nil nil nil nil nil t)
 
 (quail-define-rules
diff --git a/lisp/leim/quail/japanese.el b/lisp/leim/quail/japanese.el
index fd6628b..831725f 100644
--- a/lisp/leim/quail/japanese.el
+++ b/lisp/leim/quail/japanese.el
@@ -59,8 +59,9 @@
                 (setq quail-current-str (aref quail-current-key 0))))
          (if (integerp control-flag)
              (setq unread-command-events
-                   (string-to-list
-                    (substring quail-current-key control-flag)))))))
+                   (append
+                    (substring quail-current-key control-flag)
+                     unread-command-events))))))
   control-flag)
 
 ;; Convert Hiragana <-> Katakana in the current translation region.
@@ -103,7 +104,7 @@
 
 (defun quail-japanese-self-insert-and-switch-to-alpha (key idx)
   (quail-delete-region)
-  (setq unread-command-events (list (aref key (1- idx))))
+  (push (aref key (1- idx)) unread-command-events)
   (quail-japanese-switch-package "q" 1))
 
 (defvar quail-japanese-switch-table
diff --git a/lisp/leim/quail/lao.el b/lisp/leim/quail/lao.el
index 52357af..14cf926 100644
--- a/lisp/leim/quail/lao.el
+++ b/lisp/leim/quail/lao.el
@@ -36,8 +36,9 @@
            (buffer-substring (overlay-start quail-overlay)
                              (overlay-end quail-overlay))
            unread-command-events
-           (string-to-list
-            (substring quail-current-key control-flag)))
+           (append
+            (substring quail-current-key control-flag)
+             unread-command-events))
     (setq quail-current-str
          (compose-string (quail-lookup-map-and-concat quail-current-key))))
   control-flag)
diff --git a/lisp/leim/quail/latin-alt.el b/lisp/leim/quail/latin-alt.el
index 0614ecb..935a471 100644
--- a/lisp/leim/quail/latin-alt.el
+++ b/lisp/leim/quail/latin-alt.el
@@ -48,7 +48,7 @@ special (so you can use that to enter a slash).
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   grave      |    \\=`    | a\\=` -> à
   circumflex |    ^    | a^ -> â
   diaeresis  |    \"    | a\" -> ä
@@ -62,7 +62,7 @@ It seems natural to use comma for cedillas, but that is
 inconvenient in practice because commas are needed very
 often after a letter.
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -213,7 +213,7 @@ comma and period are not special (use \\=` instead).
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   ogonek     |    \\=`    | a\\=` -> ą
   diaeresis  |    \"    | a\" -> ä
   circumflex |    ^    | a^ -> â
@@ -230,7 +230,7 @@ It seems natural to use period and comma for dots/rings and
 cedillas/ogoneks, but that is inconvenient in practice, because
 periods and commas are needed very often after a letter.
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -408,7 +408,7 @@ special (use slash instead).
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   grave      |    \\=`    | a\\=` -> à
   circumflex |    ^    | a^ -> â
   diaeresis  |    \"    | a\" -> ä
@@ -423,7 +423,7 @@ It would be natural to use period and comma for dots and 
cedillas, but
 that would inconvenient in practice, because periods and commas are
 needed very often after a letter.
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -581,7 +581,7 @@ special (use ~ instead).
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   circumflex |    ^    | a^ -> â
   diaeresis  |    \"    | a\" -> ä
   ogonek     |    \\=`    | a\\=` -> ą
@@ -598,7 +598,7 @@ It seems natural to use period and comma for dots and
 cedillas/ogoneks, but that is inconvenient in practice, because
 periods and commas are needed very often after a letter.
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -778,7 +778,7 @@ special (use / instead).
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   grave      |    \\=`    | a\\=` -> à
   circumflex |    ^    | a^ -> â
   diaeresis  |    \"    | a\" -> ä
@@ -793,7 +793,7 @@ It seems natural to use period and comma for dots and 
cedillas, but
 that is inconvenient in practice, because periods and commas are
 needed very often after a letter.
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -930,13 +930,13 @@ Doubling the postfix separates the letter and postfix: 
e.g. a'' -> a'
  "french-alt-postfix" "French" "FR<" t
  "French (Français) input method with postfix modifiers
 
-\\=` pour grave, ' pour aigu, ^ pour circonflexe, et \" pour tréma.
-Par exemple: a\\=` -> à   e' -> é.
+\\=` pour grave, \\=' pour aigu, ^ pour circonflexe, et \" pour tréma.
+Par exemple: a\\=` -> à   e\\=' -> é.
 
 Ç, «, et » sont produits par C/, <<, et >>.
 
 En doublant la frappe des diacritiques, ils s'isoleront de la lettre.
-Par exemple: e'' -> e'
+Par exemple: e\\='\\=' -> e\\='
 
 Πest produit par O/."
  nil t nil nil nil nil nil nil nil nil t)
@@ -1011,11 +1011,11 @@ Par exemple: e'' -> e'
  "italian-alt-postfix" "Latin-1" "IT<" t
  "Italian (Italiano) input method with postfix modifiers
 
-a' -> á    A' -> Á    a\\=` -> à    A\\=` -> À    i^ -> î    << -> «
-e' -> é    E' -> É    e\\=` -> è    E\\=` -> È    I^ -> Î    >> -> »
-i' -> í    I' -> Í    i\\=` -> ì    I\\=` -> Ì               o_ -> º
-o' -> ó    O' -> Ó    o\\=` -> ò    O\\=` -> Ò               a_ -> ª
-u' -> ú    U' -> Ú    u\\=` -> ù    U\\=` -> Ù
+a\\=' -> á    A\\=' -> Á    a\\=` -> à    A\\=` -> À    i^ -> î    << -> «
+e\\=' -> é    E\\=' -> É    e\\=` -> è    E\\=` -> È    I^ -> Î    >> -> »
+i\\=' -> í    I\\=' -> Í    i\\=` -> ì    I\\=` -> Ì               o_ -> º
+o\\=' -> ó    O\\=' -> Ó    o\\=` -> ò    O\\=` -> Ò               a_ -> ª
+u\\=' -> ú    U\\=' -> Ú    u\\=` -> ù    U\\=` -> Ù
 
 This method is for purists who like accents the old way.
 
@@ -1160,7 +1160,7 @@ Caters for French and Turkish as well as Dutch.
  ------------+---------+----------
              | postfix |
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   grave      |    \\=`    | a\\=` -> à
   circumflex |    ^    | a^ -> â
   Turkish    | various | i/ -> ı  s, -> ş  g^ -> ğ   I/ -> İ
@@ -1170,7 +1170,7 @@ Caters for French and Turkish as well as Dutch.
  ------------+---------+----------
   diaeresis  |    \"    | \"a -> ä
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -1338,7 +1338,7 @@ of characters from a single Latin-N charset.
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   grave      |    \\=`    | a\\=` -> à
   circumflex |    ^    | a^ -> â
   diaeresis  |    \"    | a\" -> ä
@@ -1359,7 +1359,7 @@ It would be natural to use comma for cedillas, but that 
would be
 inconvenient in practice because commas are needed very often after a
 letter.
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 ;; Fixme: ¦ § ¨ © ¬ ­ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ ¼ ½ ¾ × ÷
diff --git a/lisp/leim/quail/latin-post.el b/lisp/leim/quail/latin-post.el
index 5106bd2..25fd450 100644
--- a/lisp/leim/quail/latin-post.el
+++ b/lisp/leim/quail/latin-post.el
@@ -40,7 +40,7 @@
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   grave      |    \\=`    | a\\=` -> à
   circumflex |    ^    | a^ -> â
   diaeresis  |    \"    | a\" -> ä
@@ -50,7 +50,7 @@
   others     |    /    | s/ -> ß   ?/ -> ¿   !/ -> ¡   // -> °
              | various | << -> «   >> -> »   o_ -> º   a_ -> ª
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -201,7 +201,7 @@ Doubling the postfix separates the letter and postfix: e.g. 
a'' -> a'
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   ogonek     |    ,    | a, -> ą
   diaeresis  |    \"    | a\" -> ä
   circumflex |    ^    | a^ -> â
@@ -214,7 +214,7 @@ Doubling the postfix separates the letter and postfix: e.g. 
a'' -> a'
   stroke     |    /    | d/ -> đ
   others     |    /    | s/ -> ß
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -389,7 +389,7 @@ Doubling the postfix separates the letter and postfix: e.g. 
a'' -> a'
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   grave      |    \\=`    | a\\=` -> à
   circumflex |    ^    | a^ -> â
   diaeresis  |    \"    | a\" -> ä
@@ -400,7 +400,7 @@ Doubling the postfix separates the letter and postfix: e.g. 
a'' -> a'
   stroke     |    /    | h/ -> ħ
   others     |    /    | s/ -> ß
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -555,7 +555,7 @@ Doubling the postfix separates the letter and postfix: e.g. 
a'' -> a'
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   circumflex |    ^    | a^ -> â
   diaeresis  |    \"    | a\" -> ä
   ogonek     |    ,    | a, -> ą
@@ -568,7 +568,7 @@ Doubling the postfix separates the letter and postfix: e.g. 
a'' -> a'
   nordic     |    /    | a/ -> å   e/ -> æ   o/ -> ø
   others     |    /    | s/ -> ß   n/ -> ŋ   k/ -> ĸ
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -745,7 +745,7 @@ Doubling the postfix separates the letter and postfix: e.g. 
a'' -> a'
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   grave      |    \\=`    | a\\=` -> à
   circumflex |    ^    | a^ -> â
   diaeresis  |    \"    | a\" -> ä
@@ -756,7 +756,7 @@ Doubling the postfix separates the letter and postfix: e.g. 
a'' -> a'
   nordic     |    /    | a/ -> å   e/ -> æ   o/ -> ø
   others     |    /    | s/ -> ß
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -889,7 +889,7 @@ Doubling the postfix separates the letter and postfix: e.g. 
a'' -> a'
 
 (quail-define-package
  "danish-postfix" "Latin-1" "DA<" t
- "Danish input method (rule: AE -> Æ, OE -> Ø, AA -> Å, E' -> É)
+ "Danish input method (rule: AE -> Æ, OE -> Ø, AA -> Å, E\\=' -> É)
 
 Doubling the postfix separates the letter and postfix: e.g. aee -> ae
 "
@@ -923,7 +923,7 @@ A following ^ or x will produce an accented character,
 e.g. c^ -> ĉ   gx -> ĝ   u^ -> ŭ.
 
 Doubling the postfix separates the letter and postfix,
-e.g. a'' -> a'.
+e.g. a\\='\\=' -> a\\='.
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -1005,13 +1005,13 @@ OEE -> OE
  "french-postfix" "French" "FR<" t
  "French (Français) input method with postfix modifiers
 
-\\=` pour grave, ' pour aigu, ^ pour circonflexe, et \" pour tréma.
-Par exemple: a\\=` -> à   e' -> é.
+\\=` pour grave, \\=' pour aigu, ^ pour circonflexe, et \" pour tréma.
+Par exemple: a\\=` -> à   e\\=' -> é.
 
 Ç, «, et » sont produits par C,, <<, et >>.
 
 En doublant la frappe des diacritiques, ils s'isoleront de la lettre.
-Par exemple: e'' -> e'
+Par exemple: e\\='\\=' -> e\\='
 
 Πest produit par O/."
  nil t nil nil nil nil nil nil nil nil t)
@@ -1124,18 +1124,18 @@ szz -> sz
  "icelandic-postfix" "Latin-1" "IS<" t
  "Icelandic (Íslenska) input method with postfix modifiers
 
-A' -> Á
-E' -> É
-I' -> Í
-O' -> Ó
-U' -> Ú
-Y' -> Ý
+A\\=' -> Á
+E\\=' -> É
+I\\=' -> Í
+O\\=' -> Ó
+U\\=' -> Ú
+Y\\=' -> Ý
 AE -> Æ
 OE -> Ö
 D/ -> Ð (eth)
 T/ -> Þ (thorn)
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -1186,8 +1186,8 @@ Doubling the postfix separates the letter and postfix: 
e.g. a'' -> a'
  "italian-postfix" "Latin-1" "IT<" t
  "Italian (Italiano) input method with postfix modifiers
 
-a\\=` -> à    A\\=` -> À    e' -> é    << -> «
-e\\=` -> è    E\\=` -> È    E' -> É    >> -> »
+a\\=` -> à    A\\=` -> À    e\\=' -> é    << -> «
+e\\=` -> è    E\\=` -> È    E\\=' -> É    >> -> »
 i\\=` -> ì    I\\=` -> Ì               o_ -> º
 o\\=` -> ò    O\\=` -> Ò               a_ -> ª
 u\\=` -> ù    U\\=` -> Ù
@@ -1235,7 +1235,7 @@ Doubling the postfix separates the letter and postfix: 
e.g. a\\=`\\=` -> a\\=`
 
 (quail-define-package
  "norwegian-postfix" "Latin-1" "NO<" t
- "Norwegian (Norsk) input method (rule: AE->Æ   OE->Ø   AA->Å   E'->É)
+ "Norwegian (Norsk) input method (rule: AE->Æ   OE->Ø   AA->Å   E\\='->É)
 
 Doubling the postfix separates the letter and postfix: e.g. aee -> ae
 "
@@ -1271,7 +1271,7 @@ oe -> ø
 aa -> å
 a\" -> ä
 o\" -> ö
-e' -> é
+e\\=' -> é
 
 Doubling the postfix separates the letter and postfix:
 aee -> ae   o\"\" -> o\"   etc.
@@ -1309,17 +1309,17 @@ aee -> ae   o\"\" -> o\"   etc.
  "spanish-postfix" "Spanish" "ES<" t
  "Spanish (Español) input method with postfix modifiers
 
-A' -> Á
-E' -> É
-I' -> Í
-O' -> Ó
-U' -> Ú
+A\\=' -> Á
+E\\=' -> É
+I\\=' -> Í
+O\\=' -> Ó
+U\\=' -> Ú
 N~ -> Ñ
 !/ -> ¡
 ?/ -> ¿
 
 Doubling the postfix separates the letter and postfix:
-a'' -> a'   n~~ -> n~, etc.
+a\\='\\=' -> a\\='   n~~ -> n~, etc.
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -1360,7 +1360,7 @@ a'' -> a'   n~~ -> n~, etc.
 
 (quail-define-package
  "swedish-postfix" "Latin-1" "SV<" t
- "Swedish (Svenska) input method (rule: AA -> Å   AE -> Ä   OE -> Ö   E' -> É)
+ "Swedish (Svenska) input method (rule: AA -> Å   AE -> Ä   OE -> Ö   E\\=' -> 
É)
 
 Doubling the postfix separates the letter and postfix: e.g. aee -> ae
 " nil t nil nil nil nil nil nil nil nil t)
@@ -2089,7 +2089,7 @@ of characters from a single Latin-N charset.
 
              | postfix | examples
  ------------+---------+----------
-  acute      |    '    | a' -> á
+  acute      |    \\='    | a\\=' -> á
   grave      |    \\=`    | a\\=` -> à
   circumflex |    ^    | a^ -> â
   diaeresis  |    \"    | a\" -> ä
@@ -2106,7 +2106,7 @@ of characters from a single Latin-N charset.
   others     |    /    | s/ -> ß   ?/ -> ¿   !/ -> ¡   // -> °   o/ -> œ
              | various | << -> «   >> -> »   o_ -> º   a_ -> ª
 
-Doubling the postfix separates the letter and postfix: e.g. a'' -> a'
+Doubling the postfix separates the letter and postfix: e.g. a\\='\\=' -> a\\='
 " nil t nil nil nil nil nil nil nil nil t)
 
 ;; Fixme: ¦ § ¨ © ¬ ­ ® ¯ ± ² ³ ´ µ ¶ · ¸ ¹ ¼ ½ ¾ × ÷
diff --git a/lisp/leim/quail/latin-pre.el b/lisp/leim/quail/latin-pre.el
index 4e60d9c..7e4fd43 100644
--- a/lisp/leim/quail/latin-pre.el
+++ b/lisp/leim/quail/latin-pre.el
@@ -52,7 +52,7 @@
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   '    | 'a -> á, '' -> ´
+    acute    |   \\='    | \\='a -> á, \\='\\=' -> ´
     grave    |   \\=`    | \\=`a -> à
   circumflex |   ^    | ^a -> â
   diaeresis  |   \"    | \"a -> ä  \"\" -> ¨
@@ -183,7 +183,7 @@
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   '    | 'a -> á   '' -> ´
+    acute    |   \\='    | \\='a -> á   \\='\\=' -> ´
     grave    |   \\=`    | \\=`a -> à
   diaeresis  |   \"    | \"i -> ï   \"\" -> ¨
     tilde    |   ~    | ~n -> ñ
@@ -258,7 +258,7 @@ Key translation rules are:
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   '    | 'e -> é
+    acute    |   \\='    | \\='e -> é
     grave    |   \\=`    | \\=`a -> à
   circumflex |   ^    | ^a -> â
   diaeresis  |   \"    | \"i -> ï
@@ -338,9 +338,9 @@ Key translation rules are:
     effect   | prefix | examples
  ------------+--------+------------------
     tilde    |   \"    | \"a -> â
-  circumflex |   '    | 'a -> â, 'i -> î
-   cedilla   |   '    | 's -> ş, 't -> ţ
-   '         |   '    | '' -> '
+  circumflex |   \\='    | \\='a -> â, \\='i -> î
+   cedilla   |   \\='    | \\='s -> ş, \\='t -> ţ
+   \\='         |   \\='    | \\='\\=' -> \\='
    \"         |   \"    | \"\" -> \"
 " nil t nil nil nil nil nil nil nil nil t)
 
@@ -374,7 +374,7 @@ Key translation rules are:
  "irish-prefix" "Latin-1" "GA>" t
  "Irish input method with prefix modifiers
 Key translation rules are:
- 'A -> Á   'E -> É   'I -> Í   'O -> Ó   'U -> Ú
+ \\='A -> Á   \\='E -> É   \\='I -> Í   \\='O -> Ó   \\='U -> Ú
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -397,12 +397,12 @@ Key translation rules are:
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   '    | 'a -> á   '' -> ´
+    acute    |   \\='    | \\='a -> á   \\='\\=' -> ´
     grave    |   \\=`    | \\=`a -> à
   circumflex |   ^    | ^a -> â
   diaeresis  |   \"    | \"u -> ü
     tilde    |   ~    | ~a -> ã
-   cedilla   | ' or , | 'c -> ç   ,c -> ç
+   cedilla   | \\=' or , | \\='c -> ç   ,c -> ç
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -448,7 +448,7 @@ Key translation rules are:
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   '    | 'a -> á
+    acute    |   \\='    | \\='a -> á
   diaeresis  |   \"    | \"u -> ü
     tilde    |   ~    | ~n -> ñ
    symbol    |   ~    | ~> -> »   ~< -> «   ~! -> ¡   ~? -> ¿
@@ -484,13 +484,13 @@ Key translation rules are:
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   '    | 'a -> á   '' -> ?´
+    acute    |   \\='    | \\='a -> á   \\='\\=' -> ?´
   circumflex |   ^    | ^a -> â
   diaeresis  |   \"    | \"a -> ä   \"\" -> ¨
     breve    |   ~    | ~a -> ă
     caron    |   ~    | ~c -> č
    cedilla   |   \\=`    | \\=`c -> ç   \\=`e -> ?ę
-    misc     | ' \\=` ~  | 'd -> đ   \\=`l -> ł   \\=`z -> ż   ~o -> ő   ~u -> 
ű
+    misc     | \\=' \\=` ~  | \\='d -> đ   \\=`l -> ł   \\=`z -> ż   ~o -> ő   
~u -> ű
    symbol    |   ~    | \\=`. -> ˙   ~~ -> ˘   ~. -> ?¸
 " nil t nil nil nil nil nil nil nil nil t)
 
@@ -595,7 +595,7 @@ Key translation rules are:
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   '    | 'a -> á   '' -> ?´
+    acute    |   \\='    | \\='a -> á   \\='\\=' -> ?´
     grave    |   \\=`    | \\=`a -> à
   circumflex |   ^    | ^a -> â
   diaeresis  |   \"    | \"a -> ä   \"\" -> ¨
@@ -736,7 +736,7 @@ For example, the character named `aogonek' is obtained by 
`/a'."
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   '    | 'a -> á
+    acute    |   \\='    | \\='a -> á
     grave    |   \\=`    | \\=`a -> à
   circumflex |   ^    | ^a -> â
   diaeresis  |   \"    | \"a -> ä, \"Y -> Ÿ
@@ -871,7 +871,7 @@ For example, the character named `aogonek' is obtained by 
`/a'."
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   '    | 'a -> á
+    acute    |   \\='    | \\='a -> á
     grave    |   \\=`    | \\=`a -> à
   circumflex |   ^    | ^w -> ŵ
   diaeresis  |   \"    | \"a -> ä
@@ -996,7 +996,7 @@ of characters from a single Latin-N charset.
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   '    | 'a -> á, '' -> ´
+    acute    |   \\='    | \\='a -> á, \\='\\=' -> ´
     grave    |   \\=`    | \\=`a -> à
   circumflex |   ^    | ^a -> â
   diaeresis  |   \"    | \"a -> ä  \"\" -> ¨
diff --git a/lisp/leim/quail/lrt.el b/lisp/leim/quail/lrt.el
index 342b52d..ed9138d 100644
--- a/lisp/leim/quail/lrt.el
+++ b/lisp/leim/quail/lrt.el
@@ -41,8 +41,9 @@
            (buffer-substring (overlay-start quail-overlay)
                              (overlay-end quail-overlay))
            unread-command-events
-           (string-to-list
-            (substring quail-current-key control-flag)))
+           (append
+            (substring quail-current-key control-flag)
+             unread-command-events))
     (let ((lao-str (lao-transcribe-roman-to-lao-string quail-current-key)))
       (if (> (aref lao-str 0) 255)
          (setq quail-current-str lao-str)
diff --git a/lisp/leim/quail/tibetan.el b/lisp/leim/quail/tibetan.el
index 1313f56..d5a92ca 100644
--- a/lisp/leim/quail/tibetan.el
+++ b/lisp/leim/quail/tibetan.el
@@ -50,8 +50,9 @@
            (buffer-substring (overlay-start quail-overlay)
                              (overlay-end quail-overlay))
            unread-command-events
-           (string-to-list
-            (substring quail-current-key control-flag)))
+           (append
+            (substring quail-current-key control-flag)
+             unread-command-events))
     ;; Special treatment of "-d..." and "-y...".
     (if (string-match "^-[dy]" quail-current-key)
        (setq quail-current-key (substring quail-current-key 1)))
@@ -133,7 +134,7 @@
     |ཏ་ t |ཐ་ th |ད་ d  |དྷ་ dh |ན་ n |   ོ o          ༑       ;
     |པ་ p |ཕ་ ph |བ་ b  |བྷ་ bh |མ་ m |   ཻ ai (ee, E) ༏        $
     |ཙ་ ts|ཚ་ tsh|ཛ་ dz |ཛྷ་ dzh|ཝ་ w |   ཽ au (oo, O) ༐        &
-    |ཞ་ zh|ཟ་ z  |འ་ '  |       |ཡ་ y |   ྀ I          ༄༅   *
+    |ཞ་ zh|ཟ་ z  |འ་ \\='  |       |ཡ་ y |   ྀ I          ༄༅   *
     |ར་ r |ལ་ l  |ཤ་ sh |ཥ་ SH |ས་ s |   ཿ :         ༄༅༅  #
     |ཧ་ h |ཨ་ A  |ཀྵ་ kSH|       |      |   ཾ M           ༼ ༽   < >
     +-------------------------------------+   ༔  %
@@ -154,7 +155,7 @@
             and to get da-drag in  -r-d, -l-d .)
   |     : Special signs.
 
-  Tsheg is assigned to SPC.  Space is assigned to period '.'.
+  Tsheg is assigned to SPC.  Space is assigned to period ‘.’.
 "
  nil nil nil nil nil nil nil nil
  'quail-tibetan-update-translation)
@@ -381,8 +382,9 @@
            (buffer-substring (overlay-start quail-overlay)
                              (overlay-end quail-overlay))
            unread-command-events
-           (string-to-list
-            (substring quail-current-key control-flag)))
+           (append
+            (substring quail-current-key control-flag)
+             unread-command-events))
     (let ((transcription (quail-tibkey-to-transcription quail-current-key)))
       (if (> (length transcription) 0)
          (let ((quail-current-key transcription))
@@ -405,11 +407,11 @@
   +-------------------------------------------------------+
      |qཀ|wཁ|eག|rང|tཅ|yཆ|uཇ|iཉ|oཏ|pཐ|[ད|]ན|
      +-----------------------------------------------+
-      |aཔ| sཕ| dབ|fམ|gུ|h  |jོ|kཙ|lཚ|;ཛ|'ཝ|
+      |aཔ| sཕ| dབ|fམ|gུ|h  |jོ|kཙ|lཚ|;ཛ|\\='ཝ|
       +---------------------------------------------+
          |zཞ|xཟ|cའ|vཡ|bར|nལ|mཤ|,ས|.ཧ|/ཨ|
          +---------------------------------------+
-  The key 'h' is used for consonant stacking.
+  The key ‘h’ is used for consonant stacking.
 
   [SHIFTED]
 
@@ -425,14 +427,14 @@
 
   DIFFERENCE FROM THE ORIGINAL TIBKEY:
 
-    1. Vowel 'a' should be typed explicitly by the key 'A'.
+    1. Vowel ‘a’ should be typed explicitly by the key ‘A’.
        This is really inconvenient.  But to make the coding
        scheme clear, it is desirable to have an explicit
-       vowel sign for 'a'.
+       vowel sign for ‘a’.
     2. Tsheg is assigned to SPC key.  You can input a space
-       by typing '>'.
+       by typing ‘>’.
     4. To avoid the default stacking ���� and to obtain གཡ,
-       type 'E' instead of 'v' (=ཡ).
+       type ‘E’ instead of ‘v’ (=ཡ).
     3. There are many characters that are not supported in the
        current implementation (especially special signs).
        I hope I'll complete in a future revision.
diff --git a/lisp/leim/quail/viqr.el b/lisp/leim/quail/viqr.el
index 570a16b..879fba4 100644
--- a/lisp/leim/quail/viqr.el
+++ b/lisp/leim/quail/viqr.el
@@ -52,7 +52,7 @@
   circumflex |    ^    | a^ -> â
     horn     |    +    | o+ -> ơ
  ------------+---------+----------
-    acute    |    '    | a' -> á
+    acute    |    \\='    | a\\=' -> á
     grave    |    \\=`    | a\\=` -> à
   hook above |    ?    | a? -> ả
     tilde    |    ~    | a~ -> ã
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 056a4ef..52fd047 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -101,10 +101,15 @@ A library name is equivalent to the file name that 
`load-library' would load."
   "Read feature name from the minibuffer, prompting with string PROMPT.
 If optional second arg LOADED-P is non-nil, the feature must be loaded
 from a file."
-  (intern (completing-read prompt
-                          features
-                          (and loaded-p #'feature-file)
-                          loaded-p)))
+  (intern (completing-read
+           prompt
+           (mapcar #'symbol-name
+                   (if loaded-p
+                       (delq nil
+                             (mapcar
+                              (lambda (x) (and (feature-file x) x))
+                              features))
+                     features)))))
 
 (defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks)
 (defvar unload-feature-special-hooks
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index 7f27599..a94a81c 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -399,10 +399,10 @@
   "If non-nil, give a y-or-n confirmation prompt before sending mail.
 This is done after the message is completely prepped, and you'll be
 looking at the top of the message in a buffer when you get the prompt.
-If set to the symbol 'queued, give the confirmation prompt only while
+If set to the symbol `queued', give the confirmation prompt only while
 running the queue (however, the prompt is always suppressed if you are
 processing the queue via `feedmail-run-the-queue-no-prompts').  If set
-to the symbol 'immediate, give the confirmation prompt only when
+to the symbol `immediate', give the confirmation prompt only when
 sending immediately.  For any other non-nil value, prompt in both
 cases.  You can give a timeout for the prompt; see variable
 `feedmail-confirm-outgoing-timeout'."
@@ -418,9 +418,9 @@ cases.  You can give a timeout for the prompt; see variable
 If nil, the prepped message will be shown, for confirmation or
 otherwise, in some window in the current frame without resizing
 anything.  That may or may not display enough of the message to
-distinguish it from others.  If set to the symbol 'queued, take
+distinguish it from others.  If set to the symbol ‘queued’, take
 this action only when running the queue.  If set to the symbol
-'immediate, take this action only when sending immediately.  For
+‘immediate’, take this action only when sending immediately.  For
 any other non-nil value, take the action in both cases.  Even if
 you're not confirming the sending of immediate or queued messages,
 it can still be interesting to see a lot about them as they are
@@ -471,9 +471,9 @@ Addresses for the message envelope are deduced by examining
 appropriate address headers in the message.  Generally, they will show
 up in the list of deduced addresses in the order that the headers
 happen to appear (duplicate addresses are eliminated in any case).
-This variable can be set to the symbol 'first, in which case the
+This variable can be set to the symbol ‘first’, in which case the
 Bcc:/Resent-Bcc: addresses will appear at the beginning in the list;
-or, it can be set to the symbol 'last, in which case they will appear
+or, it can be set to the symbol ‘last’, in which case they will appear
 at the end of the list.
 
 Why should you care?  Well, maybe you don't, and certainly the same
@@ -484,7 +484,7 @@ addresses are not handled first, there can be substantial 
delays in
 seeing the message again.  Some configurations of sendmail, for example,
 seem to try to deliver to each addressee at least once, immediately
 and serially, so slow SMTP conversations can add up to a delay.  There
-is an option for either 'first or 'last because you might have a
+is an option for either ‘first’ or ‘last’ because you might have a
 delivery agent that processes the addresses backwards."
   :group 'feedmail-headers
   :type '(choice (const nil)
@@ -1231,7 +1231,7 @@ If a string, it is used directly.
 If a function, it is called with no arguments from the buffer containing the 
raw
 text of the message.  It must return a string (which may be empty).
 
-If the symbol 'ask, you will be prompted for a string in the mini-buffer.
+If the symbol `ask', you will be prompted for a string in the mini-buffer.
 Filename completion is available so that you can inspect what's already been
 used, but feedmail will do further manipulation on the string you return, so
 it's not expected to be a complete filename."
@@ -1301,27 +1301,27 @@ the fact in the messages buffer."
 
 
 (defvar feedmail-queue-buffer-file-name nil
-  "If non-nil, has the value normally expected of 'buffer-file-name'.
+  "If non-nil, has the value normally expected of `buffer-file-name'.
 You are not intended to set this to something in your configuration.  Rather,
 you might programmatically set it to something via a hook or function
 advice or whatever.  You might like to do this if you are using a mail
-composition program that eventually uses sendmail.el's 'mail-send'
+composition program that eventually uses sendmail.el's `mail-send'
 function to process the message.  If there is a filename associated
-with the message buffer, 'mail-send' will ask you for confirmation.
+with the message buffer, `mail-send' will ask you for confirmation.
 There's no trivial way to avoid it.  It's unwise to just set the value
-of 'buffer-file-name' to nil because that will defeat feedmail's file
+of `buffer-file-name' to nil because that will defeat feedmail's file
 management features.  Instead, arrange for this variable to be set to
-the value of 'buffer-file-name' before setting that to nil.  An easy way
-to do that would be with defadvice on 'mail-send' \(undoing the
+the value of `buffer-file-name' before setting that to nil.  An easy way
+to do that would be with defadvice on `mail-send' \(undoing the
 assignments in a later advice\).
 
-feedmail will pretend that 'buffer-file-name', if nil, has the value
-assigned of 'feedmail-queue-buffer-file-name' and carry out its normal
+feedmail will pretend that `buffer-file-name', if nil, has the value
+assigned of `feedmail-queue-buffer-file-name' and carry out its normal
 activities.  feedmail does not restore the non-nil value of
-'buffer-file-name'.  For safe bookkeeping, the user should insure that
+`buffer-file-name'.  For safe bookkeeping, the user should insure that
 feedmail-queue-buffer-file-name is restored to nil.
 
-Example 'defadvice' for mail-send:
+Example `defadvice' for mail-send:
 
    (defadvice mail-send (before feedmail-mail-send-before-advice activate)
      (setq feedmail-queue-buffer-file-name buffer-file-name)
@@ -1354,7 +1354,7 @@ If you have `mail-send-hook' functions that should only 
be called for sending/
 queueing messages or only be called for the sending of queued messages, this is
 for you.  Add this function to `mail-send-hook' with something like this:
 
-       (add-hook 'mail-send-hook 'feedmail-mail-send-hook-splitter)
+       (add-hook \\='mail-send-hook \\='feedmail-mail-send-hook-splitter)
 
 Then add the functions you want called to either 
`feedmail-mail-send-hook-queued'
 or `feedmail-mail-send-hook', as appropriate.  The distinction is that
@@ -1551,7 +1551,7 @@ See feedmail-binmail-template documentation."
                                           "/bin/rmail %s" "/bin/mail %s"))
   "Command template for the subprocess which will get rid of the mail.
 It can result in any command understandable by /bin/sh.  Might not
-work at all in non-UNIX environments.  The single '%s', if present,
+work at all in non-UNIX environments.  The single `%s', if present,
 gets replaced by the space-separated, simplified list of addressees.
 Used in `feedmail-buffer-to-binmail' to form the shell command which
 will receive the contents of the prepped buffer as stdin.  The default
@@ -2053,7 +2053,7 @@ backup file names and the like)."
                ;; the handler for the condition-case
                (error (setq messages-skipped (1+ messages-skipped))
                       (ding t)
-                      (message "FQM: Trapped '%s', message left in queue." 
(car signal-stuff))
+                      (message "FQM: Trapped ‘%s’, message left in queue." 
(car signal-stuff))
                       (sit-for 3)
                       (message "FQM: Trap details: \"%s\""
                                (mapconcat 'identity (cdr signal-stuff) "\" 
\""))
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index 736e3f5..3d5d7c9 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -50,9 +50,10 @@ also the To field, unless this would leave an empty To 
field."
 ;;;###autoload
 (defun mail-file-babyl-p (file)
   "Return non-nil if FILE is a Babyl file."
-  (with-temp-buffer
-    (insert-file-contents file nil 0 100)
-    (looking-at "BABYL OPTIONS:")))
+  (let ((epa-inhibit t))
+    (with-temp-buffer
+      (insert-file-contents file nil 0 100)
+      (looking-at "BABYL OPTIONS:"))))
 
 (defun mail-string-delete (string start end)
   "Returns a string containing all of STRING except the part
diff --git a/lisp/mail/metamail.el b/lisp/mail/metamail.el
index c962dcc..6f406c3 100644
--- a/lisp/mail/metamail.el
+++ b/lisp/mail/metamail.el
@@ -150,7 +150,7 @@ redisplayed as output is inserted."
 
 ;;;###autoload
 (defun metamail-region (beg end &optional viewmode buffer nodisplay)
-  "Process current region through 'metamail'.
+  "Process current region through `metamail'.
 Optional argument VIEWMODE specifies the value of the
 EMACS_VIEW_MODE environment variable (defaulted to 1).
 Optional argument BUFFER specifies a buffer to be filled (nil
diff --git a/lisp/mail/rfc2368.el b/lisp/mail/rfc2368.el
index 77fa0f5..3c4e9b2 100644
--- a/lisp/mail/rfc2368.el
+++ b/lisp/mail/rfc2368.el
@@ -66,16 +66,16 @@
 
 ;; describes 'mailto:'
 (defconst rfc2368-mailto-scheme-index 1
-  "Describes the 'mailto:' portion of the url.")
+  "Describes the ‘mailto:’ portion of the url.")
 ;; i'm going to call this part the 'prequery'
 (defconst rfc2368-mailto-prequery-index 2
-  "Describes the portion of the url between 'mailto:' and '?'.")
+  "Describes the portion of the url between ‘mailto:’ and ‘?’.")
 ;; i'm going to call this part the 'query'
 (defconst rfc2368-mailto-query-index 4
-  "Describes the portion of the url after '?'.")
+  "Describes the portion of the url after ‘?’.")
 
 (defun rfc2368-unhexify-string (string)
-  "Unhexify STRING -- e.g. 'hello%20there' -> 'hello there'."
+  "Unhexify STRING -- e.g. ‘hello%20there’ -> ‘hello there’."
   (replace-regexp-in-string "%[[:xdigit:]]\\{2\\}"
                            (lambda (match)
                              (string (string-to-number (substring match 1)
@@ -85,7 +85,7 @@
 (defun rfc2368-parse-mailto-url (mailto-url)
   "Parse MAILTO-URL, and return an alist of header-name, header-value pairs.
 MAILTO-URL should be a RFC 2368 (mailto) compliant url.  A cons cell w/ a
-key of 'Body' is a special case and is considered a header for this purpose.
+key of `Body' is a special case and is considered a header for this purpose.
 The returned alist is intended for use w/ the `compose-mail' interface.
 Note: make sure MAILTO-URL has been 'unhtmlized' (e.g. &amp; -> &), before
 calling this function."
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 26c91bb..90a140b 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -4508,9 +4508,78 @@ encoded string (and the same mask) will decode the 
string."
      (setq i (1+ i)))
    (concat string-vector)))
 
+(defun rmail-epa-decrypt-1 (mime)
+  "Decrypt a single GnuPG encrypted text in a message.
+The starting string of the encrypted text should have just been regexp-matched.
+Argument MIME is non-nil if this is a mime message."
+  (let* ((armor-start (match-beginning 0))
+         (armor-prefix (buffer-substring
+                        (line-beginning-position)
+                        armor-start))
+         (armor-end-regexp)
+         armor-end after-end
+         unquote)
+    (if (string-match "<pre>\\'" armor-prefix)
+        (setq armor-prefix ""))
+
+    (setq armor-end-regexp
+          (concat "^"
+                  armor-prefix
+                  "-----END PGP MESSAGE-----$"))
+    (setq armor-end (re-search-forward armor-end-regexp
+                                       nil t))
+
+    (unless armor-end
+      (error "Encryption armor beginning has no matching end"))
+    (goto-char armor-start)
+
+    ;; Because epa--find-coding-system-for-mime-charset not autoloaded.
+    (require 'epa)
+
+    ;; Advance over this armor.
+    (goto-char armor-end)
+    (setq after-end (- (point-max) armor-end))
+
+    (when mime
+      (save-excursion
+        (goto-char armor-start)
+        (re-search-backward "^--" nil t)
+        (save-restriction
+          (narrow-to-region (point) armor-start)
+
+          ;; Use the charset specified in the armor.
+          (unless coding-system-for-read
+            (if (re-search-forward "^[ \t]*Charset[ \t\n]*:[ \t\n]*\\(.*\\)" 
nil t)
+                (setq coding-system-for-read
+                      (epa--find-coding-system-for-mime-charset
+                       (intern (downcase (match-string 1)))))))
+
+          (goto-char (point-min))
+          (if (re-search-forward "^[ \t]*Content-transfer-encoding[ \t\n]*:[ 
\t\n]*quoted-printable[ \t]*$" nil t)
+              (setq unquote t)))))
+
+    (when unquote
+      (let ((inhibit-read-only t))
+        (mail-unquote-printable-region armor-start
+                                       (- (point-max) after-end))))
+
+    ;; Decrypt it, maybe in place, maybe making new buffer.
+    (epa-decrypt-region
+     armor-start (- (point-max) after-end)
+     ;; Call back this function to prepare the output.
+     (lambda ()
+       (let ((inhibit-read-only t))
+         (delete-region armor-start (- (point-max) after-end))
+         (goto-char armor-start)
+         (current-buffer))))
+
+    (list armor-start (- (point-max) after-end) mime
+          armor-end-regexp)))
+
 ;; Should this have a key-binding, or be in a menu?
 ;; There doesn't really seem to be an appropriate menu.
 ;; Eg the edit command is not in a menu either.
+
 (defun rmail-epa-decrypt ()
   "Decrypt GnuPG or OpenPGP armors in current message."
   (interactive)
@@ -4519,12 +4588,14 @@ encoded string (and the same mask) will decode the 
string."
   ;; change it in one of the calls to `epa-decrypt-region'.
 
   (save-excursion
-    (let (decrypts (mime (rmail-mime-message-p)))
+    (let (decrypts (mime (rmail-mime-message-p))
+                   mime-disabled)
       (goto-char (point-min))
 
       ;; Turn off mime processing.
       (when (and mime
                 (not (get-text-property (point-min) 'rmail-mime-hidden)))
+        (setq mime-disabled t)
        (rmail-mime))
 
       ;; Now find all armored messages in the buffer
@@ -4532,74 +4603,12 @@ encoded string (and the same mask) will decode the 
string."
       (goto-char (point-min))
       (while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t)
        (let ((coding-system-for-read coding-system-for-read)
-             (case-fold-search t)
-             unquote
-             armor-start armor-prefix armor-end-regexp armor-end after-end)
-
-         (setq armor-start (match-beginning 0)
-               armor-prefix (buffer-substring
-                             (line-beginning-position)
-                             armor-start))
-         (if (string-match "<pre>\\'" armor-prefix)
-             (setq armor-prefix ""))
-
-         (setq armor-end-regexp
-               (concat "^"
-                       armor-prefix
-                       "-----END PGP MESSAGE-----$"))
-         (setq armor-end (re-search-forward armor-end-regexp
-                                            nil t))
-
-         (unless armor-end
-           (error "Encryption armor beginning has no matching end"))
-         (goto-char armor-start)
-
-         ;; Because epa--find-coding-system-for-mime-charset not autoloaded.
-         (require 'epa)
-
-         ;; Advance over this armor.
-         (goto-char armor-end)
-         (setq after-end (- (point-max) armor-end))
-
-         (when mime
-           (save-excursion
-             (goto-char armor-start)
-             (re-search-backward "^--" nil t)
-             (save-restriction
-               (narrow-to-region (point) armor-start)
-
-               ;; Use the charset specified in the armor.
-               (unless coding-system-for-read
-                 (if (re-search-forward "^[ \t]*Charset[ \t\n]*:[ 
\t\n]*\\(.*\\)" nil t)
-                     (setq coding-system-for-read
-                           (epa--find-coding-system-for-mime-charset
-                            (intern (downcase (match-string 1)))))))
-
-               (goto-char (point-min))
-               (if (re-search-forward "^[ \t]*Content-transfer-encoding[ 
\t\n]*:[ \t\n]*quoted-printable[ \t]*$" nil t)
-                   (setq unquote t)))))
-
-         (when unquote
-           (let ((inhibit-read-only t))
-             (mail-unquote-printable-region armor-start
-                                            (- (point-max) after-end))))
-
-         ;; Decrypt it, maybe in place, maybe making new buffer.
-         (epa-decrypt-region
-          armor-start (- (point-max) after-end)
-          ;; Call back this function to prepare the output.
-          (lambda ()
-            (let ((inhibit-read-only t))
-              (delete-region armor-start (- (point-max) after-end))
-              (goto-char armor-start)
-              (current-buffer))))
-
-         (push (list armor-start (- (point-max) after-end) mime
-                     armor-end-regexp)
-               decrypts)))
+             (case-fold-search t))
 
-      (unless decrypts
-       (error "Nothing to decrypt"))
+          (push (rmail-epa-decrypt-1 mime) decrypts)))
+
+      (when (and decrypts (eq major-mode 'rmail-mode))
+        (rmail-add-label "decrypt"))
 
       (when (and decrypts (rmail-buffers-swapped-p))
        (when (y-or-n-p "Replace the original message? ")
@@ -4639,8 +4648,31 @@ encoded string (and the same mask) will decode the 
string."
                                (let ((value (match-string 0)))
                                  (unless (member value '("text/plain" 
"text/html"))
                                    (replace-match "text/plain"))))))))
-                     ))))))))))
- 
+                     )))))))
+
+      (when (and (null decrypts)
+                 mime mime-disabled)
+        ;; Re-enable mime processing.
+       (rmail-mime)
+        ;; Find each Show button and show that part.
+       (while (search-forward " Show " nil t)
+         (forward-char -2)
+         (let ((rmail-mime-render-html-function nil)
+               (entity (get-text-property (point) 'rmail-mime-entity)))
+            (unless (and (not (stringp entity))
+                         (rmail-mime-entity-truncated entity))
+              (push-button))))
+        (goto-char (point-min))
+        (while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t)
+          (let ((coding-system-for-read coding-system-for-read)
+                (case-fold-search t))
+            (push (rmail-epa-decrypt-1 mime) decrypts)))
+
+        )
+
+      (unless decrypts
+       (error "Nothing to decrypt")))))
+
 
 ;;;;  Desktop support
 
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
index a00c66c..6b753b3 100644
--- a/lisp/mail/rmailout.el
+++ b/lisp/mail/rmailout.el
@@ -345,6 +345,7 @@ the text directly to FILE-NAME, and displays a \"Wrote 
file\" message
 unless NOMSG is a symbol (neither nil nor t).
 AS-SEEN is non-nil if we are copying the message \"as seen\"."
   (let ((case-fold-search t)
+        encrypted-file-name
        from date)
     (goto-char (point-min))
     ;; Preserve the Mail-From and MIME-Version fields
@@ -364,10 +365,45 @@ AS-SEEN is non-nil if we are copying the message \"as 
seen\"."
     (goto-char (point-min))
     (let ((buf (find-buffer-visiting file-name))
          (tembuf (current-buffer)))
+      (when (string-match "[.]gpg\\'" file-name)
+        (setq encrypted-file-name file-name
+              file-name (substring file-name 0 (match-beginning 0))))
       (if (null buf)
-         (let ((coding-system-for-write 'raw-text-unix))
+         (let ((coding-system-for-write 'raw-text-unix)
+                (coding-system-for-read 'raw-text-unix))
+            ;; If the specified file is encrypted, decrypt it.
+            (when encrypted-file-name
+              (with-temp-buffer
+                (insert-file-contents encrypted-file-name)
+                (write-region 1 (point-max) file-name nil 'nomsg)))
            ;; FIXME should ensure existing file ends with a blank line.
-           (write-region (point-min) (point-max) file-name t nomsg))
+           (write-region (point-min) (point-max) file-name t
+                          (if (or nomsg encrypted-file-name)
+                              'nomsg))
+            ;; If the specified file was encrypted, re-encrypt it.
+            (when encrypted-file-name
+              ;; Save the old encrypted file as a backup.
+              (rename-file encrypted-file-name
+                           (make-backup-file-name encrypted-file-name)
+                           t)
+              (if (= 0
+                     (call-process "gpg" nil nil
+                                   "--use-agent" "--batch" "--no-tty"
+                                   "--encrypt" "-r"
+                                   user-mail-address
+                                   file-name))
+                  ;; Delete the unencrypted file if encryption succeeded.
+                  (delete-file file-name)
+                ;; If encrypting failed, put back the original
+                ;; encrypted file and signal an error.
+                (rename-file (make-backup-file-name encrypted-file-name)
+                             encrypted-file-name
+                             t)
+                (error "Encryption failed; %s unchanged"
+                       encrypted-file-name))
+              (unless nomsg
+                (message "Added to %s" encrypted-file-name)))
+            )
        (if (eq buf (current-buffer))
            (error "Can't output message to same file it's already in"))
        ;; File has been visited, in buffer BUF.
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 2b9d8fa..5b5ee4e 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -907,6 +907,8 @@ the user from the mailer."
                 (concat "\\(?:[[:space:];,]\\|\\`\\)"
                         (regexp-opt mail-mailing-lists t)
                         "\\(?:[[:space:];,]\\|\\'\\)"))))
+        (mail-combine-fields "To")
+        (mail-combine-fields "CC")
        ;; If there are mailing lists defined
        (when ml
          (save-excursion
@@ -1075,6 +1077,71 @@ This function does not perform RFC2047 encoding."
                 (goto-char fullname-start))))
           (insert ")\n")))))
 
+(defun mail-combine-fields (field)
+  "Offer to combine all FIELD fields in buffer into one FIELD field.
+If this finds multiple FIELD fields, it asks the user whether
+to combine them into one, and does so if the user says y."
+  (let ((search-pattern (format "^%s[ \t]*:" field))
+        first-to-end
+        query-asked
+        query-answer
+        (old-point (point))
+        (old-max (point-max)))
+    (save-excursion
+      (save-restriction
+        (goto-char (point-min))
+        (narrow-to-region (point-min) (mail-header-end))
+        ;; Find the first FIELD field and record where it ends.
+        (when (re-search-forward search-pattern nil t)
+          (forward-line 1)
+          (re-search-forward "^[^ \t]" nil t)
+          (beginning-of-line)
+          (setq first-to-end (point-marker))
+          (set-marker-insertion-type first-to-end t)
+          ;; Find each following FIELD field
+          ;; and combine it with the first FIELD field.
+          (while (re-search-forward search-pattern nil t)
+            ;; For the second FIELD field, ask user to
+            ;; approve combining them.
+            ;; But if the user refuse to combine them, signal error.
+            (unless query-asked
+              (save-restriction
+                ;; This is just so the screen doesn't change.
+                (narrow-to-region (point-min) old-max)
+                (goto-char old-point)
+                (setq query-asked t)
+                (if (y-or-n-p (format "Message contains multiple %s fields.  
Combine? " field))
+                    (setq query-answer t))))
+            (when query-answer
+              (let ((this-to-start (line-beginning-position))
+                    this-to-end
+                    this-to)
+                (forward-line 1)
+                (re-search-forward "^[^ \t]" nil t)
+                (beginning-of-line)
+                (setq this-to-end (point))
+                ;; Get the text of this FIELD field.
+                (setq this-to (buffer-substring this-to-start this-to-end))
+                ;; Delete it.
+                (delete-region this-to-start this-to-end)
+                (save-excursion
+                  ;; Put a comma after the first FIELD field.
+                  (goto-char first-to-end)
+                  (forward-char -1)
+                  (insert ",")
+                  ;; Copy this one after it.
+                  (goto-char first-to-end)
+                  (save-excursion
+                    (insert this-to))
+                  ;; Replace the FIELD: with spaces.
+                  (looking-at search-pattern)
+                  ;; Try to preserve alignment of contents of the field
+                  (let ((prefix-length (length (match-string 0))))
+                    (replace-match " ")
+                    (dotimes (i (1- prefix-length))
+                      (insert " ")))))))
+          (set-marker first-to-end nil))))))
+
 (defun mail-encode-header (beg end)
   "Encode the mail header between BEG and END according to RFC2047.
 Return non-nil if and only if some part of the header is encoded."
diff --git a/lisp/makefile.w32-in b/lisp/makefile.w32-in
deleted file mode 100644
index 8f41041..0000000
--- a/lisp/makefile.w32-in
+++ /dev/null
@@ -1,728 +0,0 @@
-# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
-# Copyright (C) 2000-2015 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-ALL =
-
-all: $(ALL)
-
-SQUOTE='
-# '
-
-lisp = $(CURDIR)
-srcdir = $(CURDIR)/..
-
-# You can specify a different executable on the make command line,
-# e.g. "make EMACS=../bin/emacs ...".
-
-EMACS = ../src/$(BLD)/emacs.exe
-
-# Command line flags for Emacs.
-
-EMACSOPT = -batch --no-site-file --no-site-lisp
-
-# Extra flags to pass to the byte compiler
-BYTE_COMPILE_EXTRA_FLAGS =
-# For example to not display the undefined function warnings you can use this:
-# BYTE_COMPILE_EXTRA_FLAGS = --eval '(setq byte-compile-warnings (quote (not 
unresolved)))'
-# The example above is just for developers, it should not be used by default.
-
-# Set EMACSLOADPATH correctly (already defined in environment).
-EMACSLOADPATH=$(lisp)
-
-# Use C locale
-LC_ALL = C
-
-lisptagsfiles1 = $(lisp)/*.el
-lisptagsfiles2 = $(lisp)/*/*.el
-lisptagsfiles3 = $(lisp)/*/*/*.el
-lisptagsfiles4 = $(lisp)/*/*/*/*.el
-ETAGS = "../lib-src/$(BLD)/etags.exe"
-## $(DEST) is overridden by ../src/makefile.w32-in.
-DEST=$(lisp)
-
-# Automatically generated autoload files, apart from lisp/loaddefs.el.
-LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \
-       $(lisp)/calendar/diary-loaddefs.el $(lisp)/calendar/hol-loaddefs.el \
-       $(lisp)/mh-e/mh-loaddefs.el $(lisp)/net/tramp-loaddefs.el
-
-AUTOGENEL = $(lisp)/loaddefs.el $(LOADDEFS) $(lisp)/cus-load.el \
-       $(lisp)/finder-inf.el $(lisp)/subdirs.el $(lisp)/eshell/esh-groups.el \
-       $(lisp)/calc/calc-loaddefs.el $(lisp)/nxml/subdirs.el \
-       $(lisp)/cedet/semantic/loaddefs.el $(lisp)/cedet/ede/loaddefs.el \
-       $(lisp)/cedet/srecode/loaddefs.el
-
-# Value of max-lisp-eval-depth when compiling initially.
-# During bootstrapping the byte-compiler is run interpreted when compiling
-# itself, and uses more stack than usual.
-#
-BIG_STACK_DEPTH = 2200
-BIG_STACK_OPTS = --eval "(setq max-lisp-eval-depth $(BIG_STACK_DEPTH))"
-
-BYTE_COMPILE_FLAGS = $(BIG_STACK_OPTS) $(BYTE_COMPILE_EXTRA_FLAGS)
-
-# Files to compile before others during a bootstrap.  This is done to
-# speed up the bootstrap process.
-
-COMPILE_FIRST = \
-       $(lisp)/emacs-lisp/macroexp.el \
-       $(lisp)/emacs-lisp/cconv.el \
-       $(lisp)/emacs-lisp/byte-opt.el \
-       $(lisp)/emacs-lisp/bytecomp.el \
-       $(lisp)/emacs-lisp/autoload.el
-
-# The actual Emacs command run in the targets below.
-# The quotes around $(EMACS) are here because the user could type
-# it with forward slashes and without quotes, which will fail if
-# the shell is cmd.exe.
-
-emacs = "$(EMACS)" $(EMACSOPT)
-
-# Have to define the list of subdirs manually when not using sh.
-WINS_CEDET=\
-       cedet \
-       cedet/ede \
-       cedet/semantic \
-       cedet/srecode \
-       cedet/semantic/analyze \
-       cedet/semantic/bovine \
-       cedet/semantic/decorate \
-       cedet/semantic/symref \
-       cedet/semantic/wisent
-
-# The list of subdirectories is subdivided into 4 more or less equal
-# parts so that we could have 4-way parallelism while compiling Lisp
-# files, which helps to slash bootstrap times.  See the 'compile'
-# target below.
-WINS_BASIC1=\
-       calc \
-       calendar \
-       emacs-lisp \
-       erc \
-       net \
-       url
-
-WINS_BASIC2=\
-       gnus \
-       international \
-       language \
-       mail
-
-WINS_BASIC3=\
-       emulation \
-       mh-e \
-       nxml \
-       org \
-       play \
-       textmodes \
-       vc
-
-WINS_BASIC4=\
-       eshell \
-       progmodes
-
-WINS_BASIC= $(WINS_BASIC1) $(WINS_BASIC2) $(WINS_BASIC3) $(WINS_BASIC4)
-
-# Directories with lisp files to compile, and to extract data from
-# (customs, autoloads, etc.)
-WINS_UPDATES=$(WINS_BASIC) \
-       $(WINS_CEDET)
-
-# Directories to add to subdirs.el
-WINS_SUBDIR=$(WINS_BASIC) \
-       obsolete
-
-# All directories
-WINS= $(WINS_UPDATES) \
-       term \
-       obsolete
-
-doit:
-
-cus-load.el-SH:
-       echo ";;; cus-load.el --- automatically extracted custom dependencies" 
> $@
-       echo ";;" >> $@; echo ";;; Code:" >> $@
-       echo "" >> $@
-       echo ";; Local Variables:" >> $@
-       echo ";; version-control: never" >> $@
-       echo ";; no-byte-compile: t" >> $@
-       echo ";; no-update-autoloads: t" >> $@
-       echo ";; End:" >> $@
-
-cus-load.el-CMD:
-       echo ;;; cus-load.el --- automatically extracted custom dependencies> $@
-       echo ;;>> $@
-       echo ;;; Code:>> $@
-       echo.>> $@
-       echo ;; Local Variables:>> $@
-       echo ;; version-control: never>> $@
-       echo ;; no-byte-compile: t>> $@
-       echo ;; no-update-autoloads: t>> $@
-       echo ;; End:>> $@
-
-$(lisp)/cus-load.el:
-       $(MAKE) $(MFLAGS) cus-load.el-$(SHELLTYPE)
-       mv cus-load.el-$(SHELLTYPE) $@
-
-# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
-#          this can break with GNU Make 3.81 and later if sh.exe is used.
-custom-deps: $(lisp)/cus-load.el $(lisp)/loaddefs.el $(lisp)/subdirs.el doit
-       @echo Directories: $(WINS_UPDATES)
-       -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook 
nil)$(ARGQUOTE) \
-                 -f custom-make-dependencies $(lisp) $(WINS_UPDATES)
-
-finder-data: $(lisp)/loaddefs.el $(lisp)/subdirs.el doit
-       @echo Directories: $(WINS_UPDATES)
-       $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) 
$(WINS_UPDATES)
-
-$(lisp)/loaddefs.el:
-       $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
-       cp loaddefs.el-$(SHELLTYPE) $@
-       rm loaddefs.el-$(SHELLTYPE)
-
-loaddefs.el-SH:
-       echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
-       echo ";;" >> $@; echo ";;; Code:" >> $@
-       echo "" >> $@
-       echo ";; Local Variables:" >> $@
-       echo ";; version-control: never" >> $@
-       echo ";; no-byte-compile: t" >> $@
-       echo ";; no-update-autoloads: t" >> $@
-       echo ";; coding: utf-8" >> $@
-       echo ";; End:" >> $@
-       echo ";;; loaddefs.el ends here" >> $@
-
-loaddefs.el-CMD:
-       echo ;;; loaddefs.el --- automatically extracted autoloads> $@
-       echo ;;>> $@
-       echo ;;; Code:>> $@
-       echo.>> $@
-       echo ;; Local Variables:>> $@
-       echo ;; version-control: never>> $@
-       echo ;; no-byte-compile: t>> $@
-       echo ;; no-update-autoloads: t>> $@
-       echo ;; coding: utf-8>> $@
-       echo ;; End:>> $@
-       echo ;;; loaddefs.el ends here>> $@
-
-# Use . instead of $(lisp) because $(lisp) is an absolute file name,
-# including a drive letter and any leading directories, so the generated
-# loaddefs.el will mention file names that on other machine reference
-# possibly non-existent directories.
-#
-# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
-#          this can break with GNU Make 3.81 and later if sh.exe is used.
-autoloads: $(lisp)/loaddefs.el $(LOADDEFS) doit
-       @echo Directories: . $(WINS_UPDATES)
-       $(emacs) -l autoload \
-               --eval $(ARGQUOTE)(setq find-file-hook nil 
find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
-               -f w32-batch-update-autoloads "$(lisp)/loaddefs.el" $(MAKE) . 
$(WINS_UPDATES)
-
-$(lisp)/subdirs.el:
-       $(MAKE) $(MFLAGS) update-subdirs
-
-# Need separate version for sh and native cmd.exe
-update-subdirs: update-subdirs-$(SHELLTYPE)
-
-update-subdirs-CMD: doit
-       echo ;; In load-path, after this directory should come> 
$(lisp)/subdirs.el
-       echo ;; certain of its subdirectories.  Here we specify them.>> 
$(lisp)/subdirs.el
-       echo (normal-top-level-add-to-load-path $(SQUOTE)(>> $(lisp)/subdirs.el
-       @for %%d in ($(WINS_SUBDIR) cedet) do echo "%%d">> $(lisp)/subdirs.el
-       echo ))>> $(lisp)/subdirs.el
-       echo ;; Local Variables:>> $(lisp)/subdirs.el
-       echo ;; version-control: never>> $(lisp)/subdirs.el
-       echo ;; no-byte-compile: t>> $(lisp)/subdirs.el
-       echo ;; End:>> $(lisp)/subdirs.el
-
-update-subdirs-SH: doit
-       $(srcdir)/build-aux/update-subdirs $(lisp); \
-       for file in $(WINS_SUBDIR); do \
-          $(srcdir)/build-aux/update-subdirs $$file; \
-       done;
-
-updates: $(lisp)/subdirs.el autoloads mh-autoloads finder-data custom-deps
-
-# This is useful after a repository fetch.
-repo-update: recompile autoloads finder-data custom-deps
-
-# For backwards compatibility:
-cvs-update: repo-update
-
-# Update the AUTHORS file.
-
-update-authors:
-       $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS 
$(srcdir)
-
-TAGS: TAGS-$(MAKETYPE)
-
-TAGS-LISP: TAGS-LISP-$(MAKETYPE)
-
-TAGS-nmake:
-       echo This target is not supported with NMake
-       exit -1
-
-TAGS-LISP-nmake:
-       echo This target is not supported with NMake
-       exit -1
-
-TAGS-gmake: TAGS-$(SHELLTYPE)
-
-TAGS-LISP-gmake: TAGS-LISP-$(SHELLTYPE)
-
-TAGS-SH: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) 
$(lisptagsfiles4)
-       - $(DEL) TAGS
-       for dir in . $(WINS_UPDATES); do \
-         $(ETAGS) -a $(lisp)/$$dir/*.el; \
-       done
-
-TAGS-LISP-SH: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) 
$(lisptagsfiles4)
-       - $(DEL) $(DEST)/TAGS-LISP
-       for dir in . $(WINS_UPDATES); do \
-         $(ETAGS) -a -o $(DEST)/TAGS-LISP $(lisp)/$$dir/*.el; \
-       done
-
-TAGS-CMD: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) 
$(lisptagsfiles4)
-       - $(DEL) TAGS
-       for %%d in (. $(WINS_UPDATES)) do $(ETAGS) -a $(lisp)/%%d/*.el
-
-TAGS-LISP-CMD: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) 
$(lisptagsfiles4)
-       - $(DEL) $(DEST)/TAGS-LISP
-       for %%d in (. $(WINS_UPDATES)) do \
-         $(ETAGS) -a -o $(DEST)/TAGS-LISP $(lisp)/%%d/*.el
-
-.SUFFIXES: .elc .el
-
-.el.elc:
-       -$(emacs) $(BYTE_COMPILE_FLAGS) -f batch-byte-compile $<
-
-# Compile all Lisp files, but don't recompile those that are up to
-# date.  Some files don't actually get compiled because they set the
-# local variable no-byte-compile.
-
-# All .elc files are made writable before compilation in case we
-# checked out read-only (CVS option -r).  Files MUST be compiled one by
-# one.  If we compile several files in a row we can't make sure that
-# the compilation environment is clean.  We also set the load-path of
-# the Emacs used for compilation to the current directory and its
-# subdirectories, to make sure require's and load's in the files being
-# compiled find the right files.
-
-# Need separate version for sh and native cmd.exe
-compile: $(lisp)/subdirs.el compile0-$(SHELLTYPE) compile1-$(SHELLTYPE) 
compile2-$(SHELLTYPE) compile3-$(SHELLTYPE) compile4-$(SHELLTYPE) doit
-
-compile0-CMD: autoloads
-#      -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r 
%%g
-       for %%f in ($(COMPILE_FIRST)) do \
-         $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile-if-not-done %%f
-
-compile1-CMD: autoloads compile0-CMD
-       for %%f in (. $(WINS_BASIC1)) do for %%g in (%%f/*.el) do \
-         $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile-if-not-done %%f/%%g
-
-compile2-CMD: autoloads compile0-CMD
-       for %%f in ($(WINS_BASIC2)) do for %%g in (%%f/*.el) do \
-         $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile-if-not-done %%f/%%g
-
-compile3-CMD: autoloads compile0-CMD
-       for %%f in ($(WINS_BASIC3)) do for %%g in (%%f/*.el) do \
-         $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile-if-not-done %%f/%%g
-
-compile4-CMD: autoloads compile0-CMD
-       for %%f in ($(WINS_BASIC4) $(WINS_CEDET) term obsolete) do for %%g in 
(%%f/*.el) do \
-         $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile-if-not-done %%f/%%g
-
-compile0-SH: autoloads
-#      for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
-       for el in $(COMPILE_FIRST); do \
-         echo Compiling $$el; \
-         $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile-if-not-done $$el; \
-       done
-
-compile1-SH: autoloads compile0-SH
-       for dir in $(lisp) $(WINS_BASIC1); do \
-         for el in $$dir/*.el; do \
-           if test -f $$el; \
-           then \
-             echo Compiling $$el; \
-             $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile-if-not-done $$el; \
-           fi \
-         done; \
-       done
-
-compile2-SH: autoloads compile0-SH
-       for dir in $(WINS_BASIC2); do \
-         for el in $$dir/*.el; do \
-           if test -f $$el; \
-           then \
-             echo Compiling $$el; \
-             $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile-if-not-done $$el; \
-           fi \
-         done; \
-       done
-
-compile3-SH: autoloads compile0-SH
-       for dir in $(WINS_BASIC3); do \
-         for el in $$dir/*.el; do \
-           if test -f $$el; \
-           then \
-             echo Compiling $$el; \
-             $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile-if-not-done $$el; \
-           fi \
-         done; \
-       done
-
-compile4-SH: autoloads compile0-SH
-       for dir in $(WINS_BASIC4) $(WINS_CEDET) term obsolete; do \
-         for el in $$dir/*.el; do \
-           if test -f $$el; \
-           then \
-             echo Compiling $$el; \
-             $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile-if-not-done $$el; \
-           fi \
-         done; \
-       done
-
-# Compile all Lisp files.  This is like `compile' but compiles files
-# unconditionally.  Some files don't actually get compiled because they
-# set the local variable no-byte-compile.
-
-compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
-
-compile-always-CMD:
-#      -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r 
%%g
-       for %%f in ($(COMPILE_FIRST)) do $(emacs) $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile %%f
-       for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) 
$(BYTE_COMPILE_FLAGS) -f batch-byte-compile %%f/%%g
-
-compile-always-SH:
-#      for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
-       for el in $(COMPILE_FIRST); do \
-         echo Compiling $$el; \
-         $(emacs) $(BYTE_COMPILE_FLAGS) -f batch-byte-compile $$el || exit 1; \
-       done
-       for dir in $(lisp) $(WINS); do \
-         for el in $$dir/*.el; do \
-           echo Compiling $$el; \
-           $(emacs) $(BYTE_COMPILE_FLAGS) -f batch-byte-compile $$el || exit 
1; \
-         done; \
-       done
-
-compile-calc: compile-calc-$(SHELLTYPE)
-
-compile-calc-CMD:
-       for %%f in ($(lisp)/calc/*.el) do $(emacs) $(BYTE_COMPILE_FLAGS) -f 
batch-byte-compile %%f
-
-compile-calc-SH:
-       for el in $(lisp)/calc/*.el; do \
-         echo Compiling $$el; \
-         $(emacs) $(BYTE_COMPILE_FLAGS) -f batch-byte-compile $$el || exit 1; \
-       done
-
-# Backup compiled Lisp files in elc.tar.gz.  If that file already
-# exists, make a backup of it.
-
-backup-compiled-files:
-       -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
-       -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
-
-# Compile Lisp files, but save old compiled files first.
-
-compile-after-backup: backup-compiled-files compile-always
-
-compile-first:         $(lisp)/emacs-lisp/bytecomp.elc 
$(lisp)/emacs-lisp/byte-opt.elc \
-       $(lisp)/emacs-lisp/autoload.elc $(lisp)/subdirs.el
-
-# Recompile all Lisp files which are newer than their .elc files.
-# Note that this doesn't create .elc files.  It only recompiles if an
-# .elc is present.
-# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
-#          this can break with GNU Make 3.81 and later if sh.exe is used.
-recompile: compile-first autoloads doit $(lisp)/progmodes/cc-mode.elc
-       $(emacs) --eval $(ARGQUOTE)(batch-byte-recompile-directory 
0)$(ARGQUOTE) $(lisp)
-
-$(lisp)/calendar/cal-loaddefs.el: $(lisp)/subdirs.el
-       "$(EMACS)" $(EMACSOPT) -l autoload \
-          --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
-          --eval "(setq find-file-suppress-same-file-warnings t)" \
-          --eval "(setq make-backup-files nil)" \
-          -f w32-batch-update-autoloads "$(lisp)/calendar/cal-loaddefs.el" \
-             $(MAKE) ./calendar
-
-$(lisp)/calendar/diary-loaddefs.el: $(lisp)/subdirs.el
-       "$(EMACS)" $(EMACSOPT) -l autoload \
-          --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \
-          --eval "(setq find-file-suppress-same-file-warnings t)" \
-          --eval "(setq make-backup-files nil)" \
-          -f w32-batch-update-autoloads $(lisp)/calendar/diary-loaddefs.el \
-             $(MAKE) ./calendar
-
-$(lisp)/calendar/hol-loaddefs.el: $(lisp)/subdirs.el
-       "$(EMACS)" $(EMACSOPT) -l autoload \
-          --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \
-          --eval "(setq find-file-suppress-same-file-warnings t)" \
-          --eval "(setq make-backup-files nil)" \
-          -f w32-batch-update-autoloads $(lisp)/calendar/hol-loaddefs.el \
-             $(MAKE) ./calendar
-
-# Update MH-E internal autoloads. These are not to be confused with
-# the autoloads for the MH-E entry points, which are already in
-# loaddefs.el.
-MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el   \
-       $(lisp)/mh-e/mh-buffers.el $(lisp)/mh-e/mh-compat.el    \
-       $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-e.el            \
-       $(lisp)/mh-e/mh-folder.el $(lisp)/mh-e/mh-funcs.el      \
-       $(lisp)/mh-e/mh-gnus.el $(lisp)/mh-e/mh-identity.el     \
-       $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-junk.el          \
-       $(lisp)/mh-e/mh-letter.el $(lisp)/mh-e/mh-limit.el      \
-       $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-print.el        \
-       $(lisp)/mh-e/mh-scan.el $(lisp)/mh-e/mh-search.el       \
-       $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-show.el          \
-       $(lisp)/mh-e/mh-speed.el $(lisp)/mh-e/mh-thread.el      \
-       $(lisp)/mh-e/mh-tool-bar.el $(lisp)/mh-e/mh-utils.el    \
-       $(lisp)/mh-e/mh-xface.el
-
-# See the commentary for autoloads above for why we use ./mh-e below
-# instead of $(lisp)/mh-e.
-mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
-$(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC) $(lisp)/subdirs.el
-       "$(EMACS)" $(EMACSOPT) \
-          -l autoload \
-          --eval $(ARGQUOTE)(setq generate-autoload-cookie 
$(DQUOTE);;;###mh-autoload$(DQUOTE))$(ARGQUOTE) \
-          --eval $(ARGQUOTE)(setq find-file-suppress-same-file-warnings 
t)$(ARGQUOTE) \
-          --eval $(ARGQUOTE)(setq make-backup-files nil)$(ARGQUOTE) \
-          -f w32-batch-update-autoloads \
-          $(ARGQUOTE)$(lisp)/mh-e/mh-loaddefs.el$(ARGQUOTE) $(MAKE) ./mh-e
-
-# Update TRAMP internal autoloads. Maybe we could move tramp*.el into
-# an own subdirectory. OTOH, it does not hurt to keep them in
-# lisp/net.
-TRAMP_DIR = $(lisp)/net
-TRAMP_SRC = $(TRAMP_DIR)/tramp.el    $(TRAMP_DIR)/tramp-adb.el \
-       $(TRAMP_DIR)/tramp-cache.el  $(TRAMP_DIR)/tramp-cmds.el \
-       $(TRAMP_DIR)/tramp-compat.el $(TRAMP_DIR)/tramp-ftp.el  \
-       $(TRAMP_DIR)/tramp-gvfs.el   $(TRAMP_DIR)/tramp-gw.el   \
-       $(TRAMP_DIR)/tramp-sh.el     $(TRAMP_DIR)/tramp-smb.el  \
-       $(TRAMP_DIR)/tramp-uu.el     $(TRAMP_DIR)/trampver.el
-
-$(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC) $(lisp)/subdirs.el
-       "$(EMACS)" $(EMACSOPT) \
-          -l autoload \
-          --eval $(ARGQUOTE)(setq generate-autoload-cookie 
$(DQUOTE);;;###tramp-autoload$(DQUOTE))$(ARGQUOTE) \
-          --eval $(ARGQUOTE)(setq find-file-suppress-same-file-warnings 
t)$(ARGQUOTE) \
-          --eval $(ARGQUOTE)(setq make-backup-files nil)$(ARGQUOTE) \
-          -f w32-batch-update-autoloads \
-          $(ARGQUOTE)$(TRAMP_DIR)/tramp-loaddefs.el$(ARGQUOTE) $(MAKE) ./net
-
-# Prepare a bootstrap in the lisp subdirectory.
-#
-# Build loaddefs.el to make sure it's up-to-date.  If it's not, that
-# might lead to errors during the bootstrap because something fails to
-# autoload as expected.  If there is no emacs binary, then we can't
-# build autoloads yet.  In that case we have to use ldefs-boot.el;
-# bootstrap should always work with ldefs-boot.el.  (Because
-# loaddefs.el is an automatically generated file, we don't want to
-# store it in the source repository).
-#
-# Remove compiled Lisp files so that bootstrap-emacs will be built from
-# sources only.
-
-# Need separate version for sh and native cmd.exe
-bootstrap-clean:
-       - $(DEL) $(lisp)/loaddefs.el
-       - $(DEL) $(lisp)/subdirs.el
-       $(MAKE) $(MFLAGS) bootstrap-clean-$(SHELLTYPE)
-
-bootstrap-clean-CMD:
-#      if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads
-       -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
-
-bootstrap-clean-SH:
-#      if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi
-#      -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
-       -for dir in . $(WINS); do rm -f $$dir/*.elc $$dir/*/*.elc 
$$dir/*/*/*.elc; done
-
-# Generate/update files for the bootstrap process.
-# When done, remove bootstrap-emacs from ../bin, so that
-# it will not be mistaken for an installed binary.
-
-bootstrap: $(lisp)/subdirs.el compile finder-data custom-deps
-       - $(DEL) "$(EMACS)"
-
-#
-# Assuming INSTALL_DIR is defined, copy the elisp files to it
-# Windows 95 makes this harder than it should be.
-#
-install:
-               - mkdir "$(INSTALL_DIR)/lisp"
-               - $(DEL) ../$(DIRNAME)_same-dir.tst
-               - $(DEL) "$(INSTALL_DIR)/$(DIRNAME)_same-dir.tst"
-               echo SameDirTest > "$(INSTALL_DIR)/$(DIRNAME)_same-dir.tst"
-#ifdef COPY_LISP_SOURCE
-               $(IFNOTSAMEDIR) $(MAKE) $(MFLAGS) install-lisp-$(SHELLTYPE) 
$(ENDIF)
-#else
-#              $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
-#              $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
-#              $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
-#              $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
-#              $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
-#              $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
-#              $(IFNOTSAMEDIR) $(CP) mail/blessmail.el 
"$(INSTALL_DIR)/lisp/mail" $(ENDIF)
-#              $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" 
$(ENDIF)
-#              $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" 
$(ENDIF)
-#              $(IFNOTSAMEDIR) $(CP) international/latin-*.el 
"$(INSTALL_DIR)/lisp/international" $(ENDIF)
-#              $(IFNOTSAMEDIR) $(CP) international/mule-conf.el 
"$(INSTALL_DIR)/lisp/international" $(ENDIF)
-#endif
-               - $(DEL) ../$(DIRNAME)_same-dir.tst
-               - $(DEL) "$(INSTALL_DIR)/$(DIRNAME)_same-dir.tst"
-
-# Need to copy *.el files first, to avoid "source file is newer" annoyance
-# since cp does not preserve time stamps
-install-lisp-SH:
-       cp -f *.el "$(INSTALL_DIR)/lisp"
-       for dir in $(WINS); do [ -d "$(INSTALL_DIR)/lisp/$$dir" ] || mkdir 
"$(INSTALL_DIR)/lisp/$$dir"; done
-       for dir in $(WINS); do cp -f $$dir/*.el "$(INSTALL_DIR)/lisp/$$dir"; 
done
-       for dir in . $(WINS); do cp $$dir/*.elc "$(INSTALL_DIR)/lisp/$$dir"; 
done
-
-install-lisp-CMD:
-       cp -f *.el "$(INSTALL_DIR)/lisp"
-       for %%f in ($(WINS)) do if not exist "$(INSTALL_DIR)/lisp/%%f" mkdir 
"$(INSTALL_DIR)/lisp/%%f"
-       for %%f in ($(WINS)) do cp -f %%f/*.el "$(INSTALL_DIR)/lisp/%%f"
-       for %%f in (. $(WINS)) do cp -f %%f/*.elc "$(INSTALL_DIR)/lisp/%%f"
-
-# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
-#          this can break with GNU Make 3.81 and later if sh.exe is used.
-check-declare:
-       $(emacs) -l $(lisp)/emacs-lisp/check-declare --eval 
$(ARGQUOTE)(check-declare-directory $(DQUOTE)$(lisp)$(DQUOTE))$(ARGQUOTE)
-
-#
-# Maintenance
-#
-# We used to delete *~ here, but that might inadvertently remove
-# precious files if it happens to match their short 8+3 aliases.
-clean:
-       - $(DEL) *.el~
-       - $(DEL) calc/calc-loaddefs.el~
-       - $(DEL) eshell/esh-groups.el~
-
-distclean: clean
-       - $(DEL) $(lisp)/Makefile
-
-maintainer-clean: bootstrap-clean distclean
-       - $(DEL) $(AUTOGENEL)
-
-# Dependencies
-
-# CC Mode uses a compile time macro system which causes a compile time
-# dependency in cc-*.elc files on the macros in other cc-*.el and the
-# version string in cc-defs.el.
-$(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-awk.elc\
- $(lisp)/progmodes/cc-cmds.elc $(lisp)/progmodes/cc-compat.elc\
- $(lisp)/progmodes/cc-engine.elc $(lisp)/progmodes/cc-fonts.elc\
- $(lisp)/progmodes/cc-langs.elc $(lisp)/progmodes/cc-menus.elc\
- $(lisp)/progmodes/cc-mode.elc $(lisp)/progmodes/cc-styles.elc\
- $(lisp)/progmodes/cc-vars.elc: \
-   $(lisp)/progmodes/cc-bytecomp.elc $(lisp)/progmodes/cc-defs.elc
-
-$(lisp)/progmodes/cc-align.elc: \
-   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc
-
-$(lisp)/progmodes/cc-cmds.elc: \
-   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc
-
-$(lisp)/progmodes/cc-compat.elc: \
-   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-styles.elc \
-   $(lisp)/progmodes/cc-engine.elc
-
-$(lisp)/progmodes/cc-defs.elc: $(lisp)/progmodes/cc-bytecomp.elc \
-   $(lisp)/emacs-lisp/cl.elc $(lisp)/emacs-lisp/regexp-opt.elc
-
-$(lisp)/progmodes/cc-engine.elc: $(lisp)/progmodes/cc-langs.elc \
-   $(lisp)/progmodes/cc-vars.elc
-
-$(lisp)/progmodes/cc-fonts.elc: $(lisp)/progmodes/cc-langs.elc \
-   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc \
-   $(lisp)/font-lock.elc
-
-$(lisp)/progmodes/cc-langs.elc: $(lisp)/progmodes/cc-vars.elc \
-   $(lisp)/emacs-lisp/cl.elc
-
-$(lisp)/progmodes/cc-mode.elc: $(lisp)/progmodes/cc-langs.elc \
-   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc \
-   $(lisp)/progmodes/cc-styles.elc $(lisp)/progmodes/cc-cmds.elc \
-   $(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-menus.elc \
-   $(lisp)/subdirs.el
-
-$(lisp)/progmodes/cc-styles.elc: $(lisp)/progmodes/cc-vars.elc \
-   $(lisp)/progmodes/cc-align.elc
-
-$(lisp)/progmodes/cc-vars.elc: $(lisp)/custom.elc $(lisp)/widget.elc
-
-# MH-E dependencies, mainly to prevent failures with parallel
-# compilation, due to race conditions between writing a given FOO.elc
-# file and another file being compiled that says "(require FOO)",
-# which causes Emacs to try to read FOO.elc.
-MH_E_DIR = ./mh-e
-$(MH_E_DIR)/mh-alias.elc $(MH_E_DIR)/mh-comp.elc $(MH_E_DIR)/mh-folder.elc\
- $(MH_E_DIR)/mh-funcs.elc $(MH_E_DIR)/mh-identity.elc $(MH_E_DIR)/mh-inc.elc\
- $(MH_E_DIR)/mh-junk.elc $(MH_E_DIR)/mh-letter.elc $(MH_E_DIR)/mh-limit.elc\
- $(MH_E_DIR)/mh-mime.elc $(MH_E_DIR)/mh-print.elc $(MH_E_DIR)/mh-scan.elc\
- $(MH_E_DIR)/mh-search.elc $(MH_E_DIR)/mh-seq.elc $(MH_E_DIR)/mh-show.elc\
- $(MH_E_DIR)/mh-speed.elc $(MH_E_DIR)/mh-thread.elc 
$(MH_E_DIR)/mh-tool-bar.elc\
- $(MH_E_DIR)/mh-utils.elc $(MH_E_DIR)/mh-xface.elc:\
-   $(MH_E_DIR)/mh-e.elc
-
-$(MH_E_DIR)/mh-alias.elc $(MH_E_DIR)/mh-e.elc $(MH_E_DIR)/mh-folder.elc\
- $(MH_E_DIR)/mh-inc.elc $(MH_E_DIR)/mh-junk.elc $(MH_E_DIR)/mh-limit.elc\
- $(MH_E_DIR)/mh-search.elc $(MH_E_DIR)/mh-seq.elc $(MH_E_DIR)/mh-speed.elc\
- $(MH_E_DIR)/mh-utils.elc $(MH_E_DIR)/mh-xface.elc:\
-   $(lisp)/emacs-lisp/cl.elc
-
-$(MH_E_DIR)/mh-comp.elc $(MH_E_DIR)/mh-folder.elc $(MH_E_DIR)/mh-funcs.elc\
- $(MH_E_DIR)/mh-junk.elc $(MH_E_DIR)/mh-limit.elc $(MH_E_DIR)/mh-print.elc\
- $(MH_E_DIR)/mh-seq.elc $(MH_E_DIR)/mh-show.elc $(MH_E_DIR)/mh-thread.elc:\
-   $(MH_E_DIR)/mh-scan.elc
-
-$(MH_E_DIR)/mh-folder.elc $(MH_E_DIR)/mh-letter.elc $(MH_E_DIR)/mh-mime.elc\
- $(MH_E_DIR)/mh-search.elc $(MH_E_DIR)/mh-show.elc $(MH_E_DIR)/mh-speed.elc:\
-   $(lisp)/gnus/gnus-util.elc
-
-$(MH_E_DIR)/mh-folder.elc $(MH_E_DIR)/mh-search.elc:\
-   $(lisp)/progmodes/which-func.elc
-
-$(MH_E_DIR)/mh-letter.elc $(MH_E_DIR)/mh-seq.elc $(MH_E_DIR)/mh-show.elc\
- $(MH_E_DIR)/mh-utils.elc:\
-   $(lisp)/font-lock.elc
-
-$(MH_E_DIR)/mh-alias.elc $(MH_E_DIR)/mh-show.elc: $(lisp)/net/goto-addr.elc
-
-$(MH_E_DIR)/mh-comp.elc: $(lisp)/mail/sendmail.elc
-
-$(MH_E_DIR)/mh-e.elc: $(MH_E_DIR)/mh-buffers.elc $(lisp)/gnus/gnus.elc \
-   $(lisp)/cus-face.elc
-
-$(MH_E_DIR)/mh-letter.elc: $(lisp)/gnus/mailcap.elc $(lisp)/gnus/mm-decode.elc 
\
-   $(lisp)/gnus/mm-view.elc  $(lisp)/gnus/mml.elc $(lisp)/gnus/message.elc
-
-$(MH_E_DIR)/mh-print.elc:  $(lisp)/ps-print.elc
-
-$(MH_E_DIR)/mh-search.elc: $(lisp)/imenu.elc
-
-$(MH_E_DIR)/mh-show.elc: $(lisp)/gnus/gnus-cite.elc
-
-$(MH_E_DIR)/mh-speed.elc: $(lisp)/speedbar.elc $(lisp)/emacs-lisp/timer.elc
-
-$(MH_E_DIR)/mh-tool-bar.elc: $(lisp)/tool-bar.elc
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 6a2ff63..63dbe40 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -652,7 +652,9 @@ by \"Save Options\" in Custom buffers.")
 ;; Function for setting/saving default font.
 
 (defun menu-set-font ()
-  "Interactively select a font and make it the default on all existing frames."
+  "Interactively select a font and make it the default on all frames.
+
+The selected font will be the default on both the existing and future frames."
   (interactive)
   (set-frame-font (if (fboundp 'x-select-font)
                      (x-select-font)
diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el
index 31685e9..60b796b 100644
--- a/lisp/mh-e/mh-mime.el
+++ b/lisp/mh-e/mh-mime.el
@@ -1801,7 +1801,7 @@ initialized. Always use the command 
`mh-have-file-command'.")
 
 ;;;###mh-autoload
 (defun mh-have-file-command ()
-  "Return t if 'file' command is on the system.
+  "Return t if `file' command is on the system.
 'file -i' is used to get MIME type of composition insertion."
   (when (eq mh-have-file-command 'undefined)
     (setq mh-have-file-command
diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el
index f30e6a6..7d066b0 100644
--- a/lisp/mh-e/mh-search.el
+++ b/lisp/mh-e/mh-search.el
@@ -1160,7 +1160,7 @@ the file \"/home/user/Mail/.namazu/mknmzrc\" with the 
following
 contents:
 
      package conf;  # Don't remove this line!
-     $ADDRESS = 'address@hidden';
+     $ADDRESS = \\='address@hidden';
      $ALLOW_FILE = \"[0-9]*\";
      $EXCLUDE_PATH = \"^/home/user/Mail/(mhe-index|spam)\";
 
diff --git a/lisp/mh-e/mh-seq.el b/lisp/mh-e/mh-seq.el
index 8fd477c..2e73f62 100644
--- a/lisp/mh-e/mh-seq.el
+++ b/lisp/mh-e/mh-seq.el
@@ -390,7 +390,7 @@ then a non-empty sequence is read."
   "Read and return a sequence name.
 Prompt with PROMPT, raise an error if the sequence is empty and
 the NOT-EMPTY flag is non-nil, and supply an optional DEFAULT
-sequence. A reply of '%' defaults to the first sequence
+sequence. A reply of ‘%’ defaults to the first sequence
 containing the current message."
   (let* ((input (completing-read (format "%s sequence%s: " prompt
                                          (if default
@@ -766,7 +766,7 @@ completion is over."
   "Parse LINE to generate folder name, unseen messages and total messages.
 If CURRENT-FOLDER is non-nil then it contains the current folder
 name and it is used to avoid problems in corner cases involving
-folders whose names end with a '+' character."
+folders whose names end with a ‘+’ character."
   (with-temp-buffer
     (insert line)
     (goto-char (point-max))
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
index a9e9847..060da46 100644
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -419,21 +419,21 @@ names and the function is called when OUTPUT is 
available."
                                         return-nil-if-folder-empty)
   "Normalizes FOLDER name.
 
-Makes sure that two '/' characters never occur next to each
-other. Also all occurrences of \"..\" and \".\" are suitably
+Makes sure that two ‘/’ characters never occur next to each
+other. Also all occurrences of ‘..’ and ‘.’ are suitably
 processed. So \"+inbox/../news\" will be normalized to \"+news\".
 
-If optional argument EMPTY-STRING-OKAY is nil then a '+' is added
+If optional argument EMPTY-STRING-OKAY is nil then a ‘+’ is added
 at the front if FOLDER lacks one. If non-nil and FOLDER is the
 empty string then nothing is added.
 
 If optional argument DONT-REMOVE-TRAILING-SLASH is non-nil then a
-trailing '/' if present is retained (if present), otherwise it is
+trailing ‘/’ if present is retained (if present), otherwise it is
 removed.
 
 If optional argument RETURN-NIL-IF-FOLDER-EMPTY is non-nil, then
 return nil if FOLDER is \"\" or \"+\". This is useful when
-normalizing the folder for the \"folders\" command which displays
+normalizing the folder for the ‘folders’ command which displays
 the directories in / if passed \"+\". This is usually not
 desired. If this argument is non-nil, then EMPTY-STRING-OKAY has
 no effect."
@@ -653,7 +653,7 @@ with \"+\"."
 ;;;###mh-autoload
 (defun mh-expand-file-name (filename &optional default)
   "Expand FILENAME like `expand-file-name', but also handle MH folder names.
-Any filename that starts with '+' is treated as a folder name.
+Any filename that starts with `+' is treated as a folder name.
 See `expand-file-name' for description of DEFAULT."
   (if (mh-folder-name-p filename)
       (expand-file-name (substring filename 1) mh-user-path)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 411416b..689911c 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -687,7 +687,7 @@ for use at QPOS."
 The text is displayed for `minibuffer-message-timeout' seconds,
 or until the next input event arrives, whichever comes first.
 Enclose MESSAGE in [...] if this is not yet the case.
-If ARGS are provided, then pass MESSAGE through `format'."
+If ARGS are provided, then pass MESSAGE through `format-message'."
   (if (not (minibufferp (current-buffer)))
       (progn
         (if args
@@ -702,7 +702,7 @@ If ARGS are provided, then pass MESSAGE through `format'."
                       ;; Make sure we can put-text-property.
                       (copy-sequence message)
                     (concat " [" message "]")))
-    (when args (setq message (apply 'format message args)))
+    (when args (setq message (apply #'format-message message args)))
     (let ((ol (make-overlay (point-max) (point-max) nil t t))
           ;; A quit during sit-for normally only interrupts the sit-for,
           ;; but since minibuffer-message is used at the end of a command,
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 221d30b..f52b83b 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -146,7 +146,7 @@ items `Turn Off' and `Help'."
          (describe-minor-mode-completion-table-for-indicator))))
   (let* ((minor-mode (lookup-minor-mode-from-indicator indicator))
          (mm-fun (or (get minor-mode :minor-mode-function) minor-mode)))
-    (unless minor-mode (error "Cannot find minor mode for `%s'" indicator))
+    (unless minor-mode (error "Cannot find minor mode for ‘%s’" indicator))
     (let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist)))
            (menu (and (keymapp map) (lookup-key map [menu-bar]))))
       (setq menu
@@ -1027,7 +1027,7 @@ This must be bound to a mouse click."
   (interactive "e")
   (mouse-minibuffer-check click)
   (select-window (posn-window (event-start click)))
-  ;; We don't use save-excursion because that preserves the mark too.
+  ;; FIXME: Use save-excursion
   (let ((point-save (point)))
     (unwind-protect
        (progn (mouse-set-point click)
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 76c08db..59581f3 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -217,7 +217,7 @@ defaults to 6600 and HOST defaults to localhost."
         (goto-char (point-max))
         (insert-before-markers          ;So it scrolls.
          (replace-regexp-in-string "\n" "\n    "
-                                   (apply 'format format args))
+                                   (apply #'format-message format args))
          "\n"))))
 
 (defun mpc--proc-filter (proc string)
@@ -1643,7 +1643,7 @@ Return non-nil if a selection was deactivated."
         (when (equal (sort (copy-sequence active) #'string-lessp)
                      (sort (copy-sequence selection) #'string-lessp))
           (setq active 'all)))
-      
+
       ;; FIXME: This `mpc-sort' takes a lot of time.  Maybe we should
       ;; be more clever and presume the buffer is mostly sorted already.
       (mpc-sort (if (listp active) active))
@@ -1751,7 +1751,7 @@ A value of t means the main playlist.")
                      (completing-read "Rename playlist: "
                                       (mpc-cmd-list 'Playlist)
                                       nil 'require-match)))
-          (newname (read-string (format "Rename '%s' to: " oldname))))
+          (newname (read-string (format-message "Rename ‘%s’ to: " oldname))))
      (if (zerop (length newname))
          (error "Aborted")
        (list oldname newname))))
diff --git a/lisp/msb.el b/lisp/msb.el
index 149d193..03b2920 100644
--- a/lisp/msb.el
+++ b/lisp/msb.el
@@ -745,8 +745,8 @@ to the buffer-list variable in FUNCTION-INFO."
            (msb--add-to-menu buffer info max-buffer-name-length)))
       (error (unless msb--error
               (setq msb--error
-                    (format
-                     "In msb-menu-cond, error for buffer `%s'."
+                    (format-message
+                     "In msb-menu-cond, error for buffer ‘%s’."
                      (buffer-name buffer)))
               (error "%s" msb--error))))))
 
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 1f893a7..38b1604 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -1107,7 +1107,7 @@ All HOST values should be in lower case.")
 (defun ange-ftp-message (fmt &rest args)
   "Display message in echo area, but indicate if truncated.
 Args are as in `message': a format string, plus arguments to be formatted."
-  (let ((msg (apply 'format fmt args))
+  (let ((msg (apply #'format-message fmt args))
        (max (window-width (minibuffer-window))))
     (if noninteractive
        msg
@@ -1613,7 +1613,7 @@ good, skip, fatal, or unknown."
                          -6)))
         (if (zerop ange-ftp-xfer-size)
             (ange-ftp-message "%s...%dk" ange-ftp-process-msg kbytes)
-          (let ((percent (/ (* 100 kbytes) ange-ftp-xfer-size)))
+          (let ((percent (floor (* 100.0 kbytes) ange-ftp-xfer-size)))
             ;; cut out the redisplay of identical %-age messages.
             (unless (eq percent ange-ftp-last-percent)
               (setq ange-ftp-last-percent percent)
@@ -4626,7 +4626,7 @@ NEWNAME should be the name to give the new compressed or 
uncompressed file.")
            (format  "%s %s \"%s\""     ; remsh -l USER does not work well
                                        ; on a hp-ux machine I tried
                     remote-shell-program host command))
-      (ange-ftp-message "Remote command '%s' ..." command)
+      (ange-ftp-message "Remote command ‘%s’ ..." command)
       ;; Cannot call ange-ftp-real-dired-run-shell-command here as it
       ;; would prepend "cd default-directory" --- which bombs because
       ;; default-directory is in ange-ftp syntax for remote file names.
@@ -5978,7 +5978,7 @@ Other orders of $ and _ seem to all work just fine.")
 
 (defcustom ange-ftp-bs2000-special-prefix
   "X"
-  "Prefix used for filenames starting with '#' or '@'."
+  "Prefix used for filenames starting with ‘#’ or address@hidden"
   :group 'ange-ftp
   :type 'string)
 
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el
index 235b2a2..418796a 100644
--- a/lisp/net/gnutls.el
+++ b/lisp/net/gnutls.el
@@ -259,7 +259,7 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT."
     (message "%s: (err=[%s] %s) %s"
              "gnutls.el"
              doit (gnutls-error-string doit)
-             (apply 'format format (or params '(nil))))))
+             (apply #'format-message format (or params '(nil))))))
 
 (provide 'gnutls)
 
diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el
index 087ae43..8a9236c 100644
--- a/lisp/net/mairix.el
+++ b/lisp/net/mairix.el
@@ -116,7 +116,7 @@ You can add further options here if you want to, but better 
use
 
 (defcustom mairix-update-options '("-F" "-Q")
   "Options when calling mairix for updating the database.
-The default is '-F' and '-Q' for making updates faster.  You
+The default is \"-F\" and \"-Q\" for making updates faster.  You
 should call mairix without these options from time to
 time (e.g. via cron job)."
   :type '(repeat string)
@@ -124,7 +124,7 @@ time (e.g. via cron job)."
 
 (defcustom mairix-search-options '("-Q")
   "Options when calling mairix for searching.
-The default is '-Q' for making searching faster."
+The default is \"-Q\" for making searching faster."
   :type '(repeat string)
   :group 'mairix)
 
@@ -398,7 +398,7 @@ Overwrite existing entry? ")
                                (concat "\n\n" (make-string 65 ?=)
 "\nYou can now customize your saved Mairix searches by modifying\n\
 the variable mairix-saved-searches. Don't forget to save your\nchanges \
-in your .emacs by pressing 'Save for Future Sessions'.\n"
+in your .emacs by pressing ‘Save for Future Sessions’.\n"
 (make-string 65 ?=) "\n")))
 
 (autoload 'mail-strip-quoted-names "mail-utils")
@@ -667,7 +667,8 @@ Fill in VALUES if based on an article."
             "                  up to N errors(missing/extra/different 
letters)\n"
             "    ^substring=  to match the substring at the beginning of a 
word.\n"))
     (widget-insert
-     "Whitespace will be converted to ',' (i.e. AND).  Use '/' for OR.\n\n")
+     (format-message
+      "Whitespace will be converted to ‘,’ (i.e. AND).  Use ‘/’ for OR.\n\n"))
     (setq mairix-widgets (mairix-widget-build-editable-fields values))
     (when (member 'flags mairix-widget-other)
       (widget-insert "\nFlags:\n      Seen:     ")
@@ -762,7 +763,7 @@ VALUES may contain values for editable fields from current 
article."
     (define-key map [(d)] 'mairix-select-delete)
     (define-key map [(s)] 'mairix-select-save)
     map)
-  "'mairix-searches-mode' keymap.")
+  "`mairix-searches-mode' keymap.")
 
 (defvar mairix-searches-mode-font-lock-keywords
   '(("^\\([0-9]+\\)"
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index 5db04eb..9277b09 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -235,7 +235,7 @@ which apply for this feed only, overriding the value of
   'intern
   "Method for retrieving news from the web, either `intern' or `extern'.
 Default value `intern' uses Emacs' built-in asynchronous download
-capabilities ('url-retrieve').  If set to `extern' the external
+capabilities (`url-retrieve').  If set to `extern' the external
 program wget is used, see `newsticker-wget-name'."
   :type '(choice :tag "Method"
                  (const :tag "Intern" intern)
@@ -332,9 +332,9 @@ deleted at the next retrieval."
 This is an alist of the form (FEED-NAME PATTERN-LIST).  I.e. each
 element consists of a FEED-NAME a PATTERN-LIST.  Each element of
 the pattern-list has the form (AGE TITLE-OR-DESCRIPTION REGEXP).
-AGE must be one of the symbols 'old or 'immortal.
-TITLE-OR-DESCRIPTION must be on of the symbols 'title,
-'description, or 'all.  REGEXP is a regular expression, i.e. a
+AGE must be one of the symbols `old' or `immortal'.
+TITLE-OR-DESCRIPTION must be one of the symbols `title',
+`description', or `all'.  REGEXP is a regular expression, i.e., a
 string.
 
 This filter is checked after a new headline has been retrieved.
@@ -343,8 +343,8 @@ pattern-list is checked: The new headline will be marked as 
AGE
 if REGEXP matches the headline's TITLE-OR-DESCRIPTION.
 
 If, for example, `newsticker-auto-mark-filter-list' looks like
- \((slashdot ('old 'title \"^Forget me!$\") ('immortal 'title \"Read me\")
-  \('immortal 'all \"important\"))))
+ \((slashdot (\\='old \\='title \"^Forget me!$\") (\\='immortal \\='title 
\"Read me\")
+  \(\\='immortal \\='all \"important\"))))
 
 then all articles from slashdot are marked as old if they have
 the title \"Forget me!\".  All articles with a title containing
@@ -846,10 +846,10 @@ Argument BUFFER is the buffer of the retrieval process."
                newsticker--cache
                name-symbol
                newsticker--error-headline
-               (format
+               (format-message
                 (concat "%s: Newsticker could not retrieve news from %s.\n"
-                        "Return status: `%s'\n"
-                        "Command was `%s'")
+                        "Return status: ‘%s’\n"
+                        "Command was ‘%s’")
                 (format-time-string "%A, %H:%M")
                 feed-name event command)
                ""
diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el
index 4ab0007..0cb5d8c 100644
--- a/lisp/net/newst-plainview.el
+++ b/lisp/net/newst-plainview.el
@@ -251,7 +251,7 @@ assures that the current feed is completely visible."
   "List of functions run after the newsticker buffer has been updated.
 Each function is called after `newsticker-buffer-update' has been called.
 
-The default value '`newsticker-w3m-show-inline-images' loads inline
+The default value `\\='newsticker-w3m-show-inline-images' loads inline
 images."
   :type 'hook
   :group 'newsticker-plainview-hooks)
@@ -263,7 +263,7 @@ Each function is called after
 `newsticker-toggle-auto-narrow-to-feed' or
 `newsticker-toggle-auto-narrow-to-item' has been called.
 
-The default value '`newsticker-w3m-show-inline-images' loads inline
+The default value `\\='newsticker-w3m-show-inline-images' loads inline
 images."
   :type 'hook
   :group 'newsticker-plainview-hooks)
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index eca2a9c..ef8507e 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -1268,8 +1268,8 @@ Note: does not update the layout."
                          (expand-file-name (concat newsticker-dir "/groups"))))
                    (file-exists-p newsticker-groups-filename)
                    (y-or-n-p
-                    (format
-                     (concat "Obsolete variable `newsticker-groups-filename' "
+                    (format-message
+                     (concat "Obsolete variable ‘newsticker-groups-filename’ "
                              "points to existing file \"%s\".\n"
                              "Read it? ")
                      newsticker-groups-filename))
@@ -1279,9 +1279,9 @@ Note: does not update the layout."
                    (find-file-noselect filename))))
     (and newsticker-groups-filename
          (file-exists-p newsticker-groups-filename)
-        (y-or-n-p (format
+        (y-or-n-p (format-message
                     (concat "Delete the file \"%s\",\nto which the obsolete "
-                            "variable `newsticker-groups-filename' points ? ")
+                            "variable ‘newsticker-groups-filename’ points ? ")
                     newsticker-groups-filename))
         (delete-file newsticker-groups-filename))
     (when buf
diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el
index 261e5a1..c54553a 100644
--- a/lisp/net/nsm.el
+++ b/lisp/net/nsm.el
@@ -304,7 +304,7 @@ unencrypted."
        (when (> (length cert) 0)
          (insert cert "\n"))
        (let ((start (point)))
-         (insert (apply 'format message args))
+         (insert (apply #'format-message message args))
          (goto-char start)
          ;; Fill the first line of the message, which usually
          ;; contains lots of explanatory text.
diff --git a/lisp/net/pinentry.el b/lisp/net/pinentry.el
index 7cbe9f5..eaa9fa4 100644
--- a/lisp/net/pinentry.el
+++ b/lisp/net/pinentry.el
@@ -43,13 +43,28 @@
 ;; subset of the Pinentry Assuan protocol described in (info
 ;; "(pinentry) Protocol").
 ;;
-;; NOTE: As of June 2015, this feature requires newer versions of
-;; GnuPG (2.1.5+) and Pinentry (not yet released, possibly 0.9.5+).
-;; For details, see the discussion on gnupg-devel mailing list:
-;; <https://lists.gnupg.org/pipermail/gnupg-devel/2015-May/029875.html>.
+;; NOTE: As of August 2015, this feature requires newer versions of
+;; GnuPG (2.1.5+) and Pinentry (0.9.5+).
 
 ;;; Code:
 
+(defgroup pinentry nil
+  "The Pinentry server"
+  :version "25.1"
+  :group 'external)
+
+(defcustom pinentry-popup-prompt-window t
+  "If non-nil, display multiline prompt in another window."
+  :type 'boolean
+  :group 'pinentry)
+
+(defcustom pinentry-prompt-window-height 5
+  "Number of lines used to display multiline prompt."
+  :type 'integer
+  :group 'pinentry)
+
+(defvar pinentry-debug nil)
+(defvar pinentry-debug-buffer nil)
 (defvar pinentry--server-process nil)
 (defvar pinentry--connection-process-list nil)
 
@@ -58,6 +73,8 @@
 (defvar pinentry--read-point nil)
 (put 'pinentry--read-point 'permanent-local t)
 
+(defvar pinentry--prompt-buffer nil)
+
 ;; We use the same location as `server-socket-dir', when local sockets
 ;; are supported.
 (defvar pinentry--socket-dir
@@ -82,6 +99,57 @@ If local sockets are not supported, this is nil.")
 
 (autoload 'server-ensure-safe-dir "server")
 
+(defvar pinentry-prompt-mode-map
+  (let ((keymap (make-sparse-keymap)))
+    (define-key keymap "q" 'quit-window)
+    keymap))
+
+(define-derived-mode pinentry-prompt-mode special-mode "Pinentry"
+  "Major mode for `pinentry--prompt-buffer'."
+  (buffer-disable-undo)
+  (setq truncate-lines t
+       buffer-read-only t))
+
+(defun pinentry--prompt (labels query-function &rest query-args)
+  (let ((desc (cdr (assq 'desc labels)))
+        (error (cdr (assq 'error labels)))
+        (prompt (cdr (assq 'prompt labels))))
+    (when (string-match "[ \n]*\\'" prompt)
+      (setq prompt (concat
+                    (substring
+                     prompt 0 (match-beginning 0)) " ")))
+    (when error
+      (setq desc (concat "Error: " (propertize error 'face 'error)
+                         "\n" desc)))
+    (if (and desc pinentry-popup-prompt-window)
+      (save-window-excursion
+        (delete-other-windows)
+       (unless (and pinentry--prompt-buffer
+                     (buffer-live-p pinentry--prompt-buffer))
+         (setq pinentry--prompt-buffer (generate-new-buffer "*Pinentry*")))
+       (if (get-buffer-window pinentry--prompt-buffer)
+           (delete-window (get-buffer-window pinentry--prompt-buffer)))
+       (with-current-buffer pinentry--prompt-buffer
+         (let ((inhibit-read-only t)
+               buffer-read-only)
+           (erase-buffer)
+           (insert desc))
+         (pinentry-prompt-mode)
+         (goto-char (point-min)))
+       (if (> (window-height)
+              pinentry-prompt-window-height)
+           (set-window-buffer (split-window nil
+                                             (- (window-height)
+                                                pinentry-prompt-window-height))
+                              pinentry--prompt-buffer)
+         (pop-to-buffer pinentry--prompt-buffer)
+         (if (> (window-height) pinentry-prompt-window-height)
+             (shrink-window (- (window-height)
+                                pinentry-prompt-window-height))))
+        (prog1 (apply query-function prompt query-args)
+          (quit-window)))
+      (apply query-function (concat desc "\n" prompt) query-args))))
+
 ;;;###autoload
 (defun pinentry-start ()
   "Start a Pinentry service.
@@ -227,6 +295,13 @@ Assuan protocol."
         (setq pinentry--read-point (point-min))
         (make-local-variable 'pinentry--labels))))
   (with-current-buffer (process-buffer process)
+    (when pinentry-debug
+      (with-current-buffer
+          (or pinentry-debug-buffer
+              (setq pinentry-debug-buffer (generate-new-buffer
+                                           " *pinentry-debug*")))
+        (goto-char (point-max))
+        (insert input)))
     (save-excursion
       (goto-char (point-max))
       (insert input)
@@ -251,32 +326,15 @@ Assuan protocol."
                 (ignore-errors
                   (process-send-string process "OK\n")))
                 ("GETPIN"
-                 (let ((prompt
-                        (or (cdr (assq 'desc pinentry--labels))
-                            (cdr (assq 'prompt pinentry--labels))
-                            ""))
-                      (confirm (not (null (assq 'repeat pinentry--labels))))
-                       entry)
-                   (if (setq entry (assq 'error pinentry--labels))
-                       (setq prompt (concat "Error: "
-                                            (propertize
-                                             (copy-sequence (cdr entry))
-                                             'face 'error)
-                                            "\n"
-                                            prompt)))
-                   (if (setq entry (assq 'title pinentry--labels))
-                       (setq prompt (format "[%s] %s"
-                                            (cdr entry) prompt)))
-                   (if (string-match ":?[ \n]*\\'" prompt)
-                       (setq prompt (concat
-                                     (substring
-                                      prompt 0 (match-beginning 0)) ": ")))
-                   (let (passphrase escaped-passphrase encoded-passphrase)
-                     (unwind-protect
-                         (condition-case nil
-                             (progn
-                               (setq passphrase
-                                    (read-passwd prompt confirm))
+                 (let ((confirm (not (null (assq 'repeat pinentry--labels))))
+                       passphrase escaped-passphrase encoded-passphrase)
+                   (unwind-protect
+                       (condition-case err
+                           (progn
+                             (setq passphrase
+                                   (pinentry--prompt
+                                    pinentry--labels
+                                    #'read-passwd confirm))
                                (setq escaped-passphrase
                                      (pinentry--escape-string
                                       passphrase))
@@ -287,7 +345,8 @@ Assuan protocol."
                                 (pinentry--send-data
                                  process encoded-passphrase)
                                 (process-send-string process "OK\n")))
-                           (error
+                         (error
+                          (message "GETPIN error %S" err)
                            (ignore-errors
                              (pinentry--send-error
                               process
@@ -298,59 +357,55 @@ Assuan protocol."
                            (clear-string escaped-passphrase))
                        (if encoded-passphrase
                            (clear-string encoded-passphrase))))
-                   (setq pinentry--labels nil)))
+                   (setq pinentry--labels nil))
                 ("CONFIRM"
                  (let ((prompt
-                        (or (cdr (assq 'desc pinentry--labels))
-                            ""))
+                        (or (cdr (assq 'prompt pinentry--labels))
+                            "Confirm? "))
                        (buttons
-                        (pinentry--labels-to-shortcuts
-                         (list (cdr (assq 'ok pinentry--labels))
-                               (cdr (assq 'notok pinentry--labels))
-                              (cdr (assq 'cancel pinentry--labels)))))
+                        (delq nil
+                              (pinentry--labels-to-shortcuts
+                               (list (cdr (assq 'ok pinentry--labels))
+                                     (cdr (assq 'notok pinentry--labels))
+                                     (cdr (assq 'cancel pinentry--labels))))))
                        entry)
-                   (if (setq entry (assq 'error pinentry--labels))
-                       (setq prompt (concat "Error: "
-                                            (propertize
-                                             (copy-sequence (cdr entry))
-                                             'face 'error)
-                                            "\n"
-                                            prompt)))
-                   (if (setq entry (assq 'title pinentry--labels))
-                       (setq prompt (format "[%s] %s"
-                                            (cdr entry) prompt)))
-                   (if (remq nil buttons)
+                   (if buttons
                        (progn
                          (setq prompt
                                (concat prompt " ("
-                                       (mapconcat #'cdr (remq nil buttons)
+                                       (mapconcat #'cdr buttons
                                                   ", ")
                                        ") "))
+                         (if (setq entry (assq 'prompt pinentry--labels))
+                             (setcdr entry prompt)
+                           (setq pinentry--labels (cons (cons 'prompt prompt)
+                                                        pinentry--labels)))
                          (condition-case nil
-                             (let ((result (read-char prompt)))
+                             (let ((result (pinentry--prompt pinentry--labels
+                                                             #'read-char)))
                                (if (eq result (caar buttons))
-                                  (ignore-errors
-                                    (process-send-string process "OK\n"))
+                                   (ignore-errors
+                                     (process-send-string process "OK\n"))
                                  (if (eq result (car (nth 1 buttons)))
-                                    (ignore-errors
-                                      (pinentry--send-error
-                                       process
-                                       pinentry--error-not-confirmed))
-                                  (ignore-errors
-                                    (pinentry--send-error
-                                     process
-                                     pinentry--error-cancelled)))))
+                                     (ignore-errors
+                                       (pinentry--send-error
+                                        process
+                                        pinentry--error-not-confirmed))
+                                   (ignore-errors
+                                     (pinentry--send-error
+                                      process
+                                      pinentry--error-cancelled)))))
                            (error
-                           (ignore-errors
+                            (ignore-errors
                              (pinentry--send-error
                               process
                               pinentry--error-cancelled)))))
-                     (if (string-match "[ \n]*\\'" prompt)
-                         (setq prompt (concat
-                                       (substring
-                                        prompt 0 (match-beginning 0)) " ")))
+                     (if (setq entry (assq 'prompt pinentry--labels))
+                         (setcdr entry prompt)
+                       (setq pinentry--labels (cons (cons 'prompt prompt)
+                                                    pinentry--labels)))
                      (if (condition-case nil
-                             (y-or-n-p prompt)
+                             (pinentry--prompt pinentry--labels #'y-or-n-p)
                            (quit))
                         (ignore-errors
                           (process-send-string process "OK\n"))
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 13a7cfa..cd5bbbd 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -926,7 +926,7 @@ The list is updated automatically by 
`defun-rcirc-command'.")
 
 (defun rcirc-complete ()
   "Cycle through completions from list of nicks in channel or IRC commands.
-IRC command completion is performed only if '/' is the first input char."
+IRC command completion is performed only if ‘/’ is the first input char."
   (interactive)
   (unless (rcirc-looking-at-input)
     (error "Point not located after rcirc prompt"))
diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el
index e71179b..c0dcc23 100644
--- a/lisp/net/rlogin.el
+++ b/lisp/net/rlogin.el
@@ -174,8 +174,8 @@ If you wish to change directory tracking styles during a 
session, use the
 function `rlogin-directory-tracking-mode' rather than simply setting the
 variable."
   (interactive (list
-               (read-from-minibuffer (format
-                                       "Arguments for `%s' (hostname first): "
+               (read-from-minibuffer (format-message
+                                       "Arguments for ‘%s’ (hostname first): "
                                        (file-name-nondirectory rlogin-program))
                                      nil nil nil 'rlogin-history)
                current-prefix-arg))
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el
index 7740574..a05108d 100644
--- a/lisp/net/soap-client.el
+++ b/lisp/net/soap-client.el
@@ -51,7 +51,8 @@
 
 (defsubst soap-warning (message &rest args)
   "Display a warning MESSAGE with ARGS, using the 'soap-client warning type."
-  (display-warning 'soap-client (apply 'format message args) :warning))
+  (display-warning 'soap-client (apply #'format-message message args)
+                   :warning))
 
 (defgroup soap-client nil
   "Access SOAP web services from Emacs."
@@ -1818,9 +1819,9 @@ operations in a WSDL document."
 (provide 'soap-client)
 
 
-;;; Local Variables:
-;;; eval: (outline-minor-mode 1)
-;;; outline-regexp: ";;;;+"
-;;; End:
+;; Local Variables:
+;; eval: (outline-minor-mode 1)
+;; outline-regexp: ";;;;+"
+;; End:
 
 ;;; soap-client.el ends here
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 6305921..f818fcd 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -59,7 +59,7 @@ It is used for TCP/IP devices."
 
 ;;;###tramp-autoload
 (defcustom tramp-adb-prompt
-  
"^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:address@hidden:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]"
+  
"^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]\e;address@hidden:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]"
   "Regexp used as prompt in almquist shell."
   :type 'string
   :version "24.4"
@@ -211,7 +211,7 @@ pass to the OPERATION."
         (lambda (elt)
           (setcar
            (cdr elt)
-           (replace-regexp-in-string
+           (tramp-compat-replace-regexp-in-string
             ":" tramp-prefix-port-format (car (cdr elt)))))
         result)
        result))))
@@ -394,41 +394,42 @@ pass to the OPERATION."
   "Like `directory-files-and-attributes' for Tramp files."
   (when (file-directory-p directory)
     (with-parsed-tramp-file-name (expand-file-name directory) nil
-      (with-tramp-file-property
-         v localname (format "directory-files-attributes-%s-%s-%s-%s"
-                             full match id-format nosort)
-       (with-current-buffer (tramp-get-buffer v)
-         (when (tramp-adb-send-command-and-check
-                v (format "%s -a -l %s"
-                          (tramp-adb-get-ls-command v)
-                          (tramp-shell-quote-argument localname)))
-           ;; We insert also filename/. and filename/.., because "ls" doesn't.
-           (narrow-to-region (point) (point))
-           (tramp-adb-send-command
-            v (format "%s -d -a -l %s %s"
-                      (tramp-adb-get-ls-command v)
-                      (tramp-shell-quote-argument
-                       (concat (file-name-as-directory localname) "."))
-                      (tramp-shell-quote-argument
-                       (concat (file-name-as-directory localname) ".."))))
-           (widen))
-         (tramp-adb-sh-fix-ls-output)
-         (let ((result (tramp-do-parse-file-attributes-with-ls
-                        v (or id-format 'integer))))
-           (when full
-             (setq result
-                   (mapcar
-                    (lambda (x)
-                      (cons (expand-file-name (car x) directory) (cdr x)))
-                    result)))
-           (unless nosort
-             (setq result
-                   (sort result (lambda (x y) (string< (car x) (car y))))))
-           (delq nil
-                 (mapcar (lambda (x)
-                           (if (or (not match) (string-match match (car x)))
-                               x))
-                         result))))))))
+      (copy-tree
+       (with-tramp-file-property
+          v localname (format "directory-files-and-attributes-%s-%s-%s-%s"
+                              full match id-format nosort)
+        (with-current-buffer (tramp-get-buffer v)
+          (when (tramp-adb-send-command-and-check
+                 v (format "%s -a -l %s"
+                           (tramp-adb-get-ls-command v)
+                           (tramp-shell-quote-argument localname)))
+            ;; We insert also filename/. and filename/.., because "ls" doesn't.
+            (narrow-to-region (point) (point))
+            (tramp-adb-send-command
+             v (format "%s -d -a -l %s %s"
+                       (tramp-adb-get-ls-command v)
+                       (tramp-shell-quote-argument
+                        (concat (file-name-as-directory localname) "."))
+                       (tramp-shell-quote-argument
+                        (concat (file-name-as-directory localname) ".."))))
+            (widen))
+          (tramp-adb-sh-fix-ls-output)
+          (let ((result (tramp-do-parse-file-attributes-with-ls
+                         v (or id-format 'integer))))
+            (when full
+              (setq result
+                    (mapcar
+                     (lambda (x)
+                       (cons (expand-file-name (car x) directory) (cdr x)))
+                     result)))
+            (unless nosort
+              (setq result
+                    (sort result (lambda (x y) (string< (car x) (car y))))))
+            (delq nil
+                  (mapcar (lambda (x)
+                            (if (or (not match) (string-match match (car x)))
+                                x))
+                          result)))))))))
 
 (defun tramp-adb-get-ls-command (vec)
   (with-tramp-connection-property vec "ls"
@@ -497,12 +498,11 @@ Emacs dired can't find files."
 
 (defun tramp-adb-ls-output-name-less-p (a b)
   "Sort \"ls\" output by name, ascending."
-  (let (posa posb)
-    (string-match directory-listing-before-filename-regexp a)
-    (setq posa (match-end 0))
-    (string-match directory-listing-before-filename-regexp b)
-    (setq posb (match-end 0))
-    (string-lessp (substring a posa) (substring b posb))))
+  (if (string-match directory-listing-before-filename-regexp a)
+      (let ((posa (match-end 0)))
+       (if (string-match directory-listing-before-filename-regexp b)
+           (let ((posb (match-end 0)))
+             (string-lessp (substring a posa) (substring b posb)))))))
 
 (defun tramp-adb-handle-make-directory (dir &optional parents)
   "Like `make-directory' for Tramp files."
@@ -635,7 +635,8 @@ But handle the case, if the \"test\" command is not 
available."
        'write-region
        (list start end tmpfile append 'no-message lockname confirm))
       (with-tramp-progress-reporter
-         v 3 (format "Moving tmp file `%s' to `%s'" tmpfile filename)
+        v 3 (format-message
+             "Moving tmp file `%s' to `%s'" tmpfile filename)
        (unwind-protect
            (when (tramp-adb-execute-adb-command v "push" tmpfile localname)
              (tramp-error v 'file-error "Cannot write: `%s'" filename))
@@ -652,6 +653,7 @@ But handle the case, if the \"test\" command is not 
available."
 (defun tramp-adb-handle-set-file-modes (filename mode)
   "Like `set-file-modes' for Tramp files."
   (with-parsed-tramp-file-name filename nil
+    (tramp-flush-file-property v (file-name-directory localname))
     (tramp-flush-file-property v localname)
     (tramp-adb-send-command-and-check
      v (format "chmod %s %s" (tramp-compat-decimal-to-octal mode) localname))))
@@ -659,6 +661,7 @@ But handle the case, if the \"test\" command is not 
available."
 (defun tramp-adb-handle-set-file-times (filename &optional time)
   "Like `set-file-times' for Tramp files."
   (with-parsed-tramp-file-name filename nil
+    (tramp-flush-file-property v (file-name-directory localname))
     (tramp-flush-file-property v localname)
     (let ((time (if (or (null time) (equal time '(0 0)))
                    (current-time)
@@ -1030,7 +1033,7 @@ E.g. a host name \"192.168.1.1#5555\" returns 
\"192.168.1.1:5555\"
           (host (tramp-file-name-host vec))
           (port (tramp-file-name-port vec))
           (devices (mapcar 'cadr (tramp-adb-parse-device-names nil))))
-      (replace-regexp-in-string
+      (tramp-compat-replace-regexp-in-string
        tramp-prefix-port-format ":"
        (cond ((member host devices) host)
             ;; This is the case when the host is connected to the default port.
@@ -1046,7 +1049,7 @@ E.g. a host name \"192.168.1.1#5555\" returns 
\"192.168.1.1:5555\"
                   (not (zerop (length host)))
                   (not (tramp-adb-execute-adb-command
                          vec "connect"
-                         (replace-regexp-in-string
+                         (tramp-compat-replace-regexp-in-string
                           tramp-prefix-port-format ":" host))))
              ;; When new device connected, running other adb command (e.g.
              ;; adb shell) immediately will fail.  To get around this
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index f777468..bfcfe15 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -157,7 +157,7 @@ Returns VALUE."
   ;; Unify localname.  Remove hop from vector.
   (setq key (copy-sequence key))
   (aset key 3 (tramp-run-real-handler 'directory-file-name (list file)))
-p  (aset key 4 nil)
+  (aset key 4 nil)
   (let ((hash (tramp-get-hash-table key)))
     ;; We put the timestamp there.
     (puthash property (cons (current-time) value) hash)
@@ -440,7 +440,7 @@ for all methods.  Resulting data are derived from 
connection history."
      (clrhash tramp-cache-data))
     (error
      ;; File is corrupted.
-     (message "Tramp persistency file '%s' is corrupted: %s"
+     (message "Tramp persistency file `%s' is corrupted: %s"
              tramp-persistency-file-name (error-message-string err))
      (clrhash tramp-cache-data))))
 
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index fee74ee..22c1398 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -236,8 +236,11 @@ buffer in your bug report.
                 (string-match
                  (concat "[^" (symbol-value 'mm-7bit-chars) "]") val))
        (with-current-buffer reporter-eval-buffer
-         (set varsym (format "(base64-decode-string \"%s\")"
-                             (base64-encode-string val))))))
+         (set
+          varsym
+          (format
+           "(decode-coding-string (base64-decode-string \"%s\") 'raw-text)"
+           (base64-encode-string (encode-coding-string val 'raw-text)))))))
 
     ;; Dump variable.
     (tramp-compat-funcall 'reporter-dump-variable varsym mailbuf)
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index e68c81c..9848325 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -533,10 +533,9 @@ EOL-TYPE can be one of `dos', `unix', or `mac'."
          (cond ((eq eol-type 'dos) 'crlf)
                ((eq eol-type 'unix) 'lf)
                ((eq eol-type 'mac) 'cr)
-               (t
-                (error "Unknown EOL-TYPE `%s', must be %s"
-                       eol-type
-                       "`dos', `unix', or `mac'")))))
+               (t (error
+                   "Unknown EOL-TYPE `%s', must be `dos', `unix', or `mac'"
+                   eol-type)))))
         (t (error "Can't change EOL conversion -- is MULE missing?"))))
 
 ;; `replace-regexp-in-string' does not exist in XEmacs.
@@ -595,6 +594,10 @@ and replace a sub-expression, e.g.
 (unless (fboundp 'default-toplevel-value)
   (defalias 'default-toplevel-value 'symbol-value))
 
+;; `format-message' is new in Emacs 25, and does not exist in XEmacs.
+(unless (fboundp 'format-message)
+  (defalias 'format-message 'format))
+
 (add-hook 'tramp-unload-hook
          (lambda ()
            (unload-feature 'tramp-loaddefs 'force)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index bb939bf..c5ffb26 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -97,7 +97,7 @@ e.g. \"$HOME/.sh_history\"."
    "///%s#$"
    (md5 (concat (prin1-to-string process-environment) (current-time-string))))
   "String used to recognize end of output.
-The '$' character at the end is quoted; the string cannot be
+The `$' character at the end is quoted; the string cannot be
 detected as prompt when being sent on echoing hosts, therefore.")
 
 ;;;###tramp-autoload
@@ -873,6 +873,78 @@ Escape sequence %s is replaced with name of Perl binary.")
   "Perl program to use for decoding a file.
 Escape sequence %s is replaced with name of Perl binary.")
 
+(defconst tramp-awk-encode
+  "od -v -t x1 -A n | busybox awk '\\
+BEGIN {
+  b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"
+  b16 = \"0123456789abcdef\"
+}
+{
+  for (c=1; c<=length($0); c++) {
+    d=index(b16, substr($0,c,1))
+    if (d--) {
+      for (b=1; b<=4; b++) {
+        o=o*2+int(d/8); d=(d*2)%%16
+        if (++obc==6) {
+          printf substr(b64,o+1,1)
+          if (++rc>75) { printf \"\\n\"; rc=0 }
+          obc=0; o=0
+        }
+      }
+    }
+  }
+}
+END {
+  if (obc) {
+    tail=(obc==2) ? \"==\\n\" : \"=\\n\"
+    while (obc++<6) { o=o*2 }
+    printf \"%%c\", substr(b64,o+1,1)
+  } else {
+    tail=\"\\n\"
+  }
+  printf tail
+}'"
+  "Awk program to use for encoding a file.
+This string is passed to `format', so percent characters need to be doubled.")
+
+(defconst tramp-awk-decode
+  "busybox awk '\\
+BEGIN {
+  b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"
+}
+{
+  for (i=1; i<=length($0); i++) {
+    c=index(b64, substr($0,i,1))
+    if(c--) {
+      for(b=0; b<6; b++) {
+        o=o*2+int(c/32); c=(c*2)%%64
+        if(++obc==8) {
+          if (o) {
+            printf \"%%c\", o
+          } else {
+            system(\"dd if=/dev/zero bs=1 count=1 2>/dev/null\")
+          }
+          obc=0; o=0
+        }
+      }
+    }
+  }
+}'"
+  "Awk program to use for decoding a file.
+This string is passed to `format', so percent characters need to be doubled.")
+
+(defconst tramp-awk-coding-test
+  "test -c /dev/zero && \
+od -v -t x1 -A n </dev/null && \
+busybox awk '{}' </dev/null"
+  "Test command for checking `tramp-awk-encode' and `tramp-awk-decode'.")
+
+(defconst tramp-stat-marker "/////"
+  "Marker in stat commands for file attributes.")
+
+(defconst tramp-stat-quoted-marker "\\/\\/\\/\\/\\/"
+  "Quoted marker in stat commands for file attributes.")
+
 (defconst tramp-vc-registered-read-file-names
   "echo \"(\"
 while read file; do
@@ -1304,19 +1376,25 @@ target of the symlink differ."
     (concat
      ;; On Opsware, pdksh (which is the true name of ksh there)
      ;; doesn't parse correctly the sequence "((".  Therefore, we add
-     ;; a space.  Apostrophes in the stat output are masked as "//",
-     ;; in order to make a proper shell escape of them in file names.
+     ;; a space.  Apostrophes in the stat output are masked as
+     ;; `tramp-stat-marker', in order to make a proper shell escape of
+     ;; them in file names.
      "( (%s %s || %s -h %s) && (%s -c "
-     "'((//%%N//) %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 //%%A// t %%ie0 -1)' "
-     "%s | sed -e 's/\"/\\\\\"/g' -e 's/\\/\\//\"/g') || echo nil)")
+     "'((%s%%N%s) %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 %s%%A%s t %%ie0 -1)' "
+     "%s | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g') || echo nil)")
     (tramp-get-file-exists-command vec)
     (tramp-shell-quote-argument localname)
     (tramp-get-test-command vec)
     (tramp-shell-quote-argument localname)
     (tramp-get-remote-stat vec)
-    (if (eq id-format 'integer) "%ue0" "//%U//")
-    (if (eq id-format 'integer) "%ge0" "//%G//")
-    (tramp-shell-quote-argument localname))))
+    tramp-stat-marker tramp-stat-marker
+    (if (eq id-format 'integer)
+       "%ue0" (concat tramp-stat-marker "%U" tramp-stat-marker))
+    (if (eq id-format 'integer)
+       "%ge0" (concat tramp-stat-marker "%G" tramp-stat-marker))
+    tramp-stat-marker tramp-stat-marker
+    (tramp-shell-quote-argument localname)
+    tramp-stat-quoted-marker)))
 
 (defun tramp-sh-handle-set-visited-file-modtime (&optional time-list)
   "Like `set-visited-file-modtime' for Tramp files."
@@ -1407,6 +1485,7 @@ of."
 (defun tramp-sh-handle-set-file-modes (filename mode)
   "Like `set-file-modes' for Tramp files."
   (with-parsed-tramp-file-name filename nil
+    (tramp-flush-file-property v (file-name-directory localname))
     (tramp-flush-file-property v localname)
     ;; FIXME: extract the proper text from chmod's stderr.
     (tramp-barf-unless-okay
@@ -1421,6 +1500,7 @@ of."
   (if (tramp-tramp-file-p filename)
       (with-parsed-tramp-file-name filename nil
        (when (tramp-get-remote-touch v)
+         (tramp-flush-file-property v (file-name-directory localname))
          (tramp-flush-file-property v localname)
          (let ((time (if (or (null time) (equal time '(0 0)))
                          (current-time)
@@ -1490,15 +1570,8 @@ be non-negative integers."
 
 (defun tramp-remote-selinux-p (vec)
   "Check, whether SELINUX is enabled on the remote host."
-  (with-tramp-connection-property
-      (tramp-get-connection-process vec) "selinux-p"
-    (let ((result (tramp-find-executable
-                  vec "getenforce" (tramp-get-remote-path vec) t t)))
-      (and result
-          (string-equal
-           (tramp-send-command-and-read
-            vec (format "echo \\\"`%S`\\\"" result))
-           "Enforcing")))))
+  (with-tramp-connection-property (tramp-get-connection-process vec) 
"selinux-p"
+    (tramp-send-command-and-check vec "selinuxenabled")))
 
 (defun tramp-sh-handle-file-selinux-context (filename)
   "Like `file-selinux-context' for Tramp files."
@@ -1524,24 +1597,25 @@ be non-negative integers."
 (defun tramp-sh-handle-set-file-selinux-context (filename context)
   "Like `set-file-selinux-context' for Tramp files."
   (with-parsed-tramp-file-name filename nil
-    (if (and (consp context)
-            (tramp-remote-selinux-p v)
-            (tramp-send-command-and-check
-             v (format "chcon %s %s %s %s %s"
-                       (if (stringp (nth 0 context))
-                           (format "--user=%s" (nth 0 context)) "")
-                       (if (stringp (nth 1 context))
-                           (format "--role=%s" (nth 1 context)) "")
-                       (if (stringp (nth 2 context))
-                           (format "--type=%s" (nth 2 context)) "")
-                       (if (stringp (nth 3 context))
-                           (format "--range=%s" (nth 3 context)) "")
-                       (tramp-shell-quote-argument localname))))
-       (progn
-         (tramp-set-file-property v localname "file-selinux-context" context)
-         t)
-      (tramp-set-file-property v localname "file-selinux-context" 'undef)
-      nil)))
+    (when (and (consp context)
+              (tramp-remote-selinux-p v))
+      (let ((user (and (stringp (nth 0 context)) (nth 0 context)))
+           (role (and (stringp (nth 1 context)) (nth 1 context)))
+           (type (and (stringp (nth 2 context)) (nth 2 context)))
+           (range (and (stringp (nth 3 context)) (nth 3 context))))
+       (when (tramp-send-command-and-check
+              v (format "chcon %s %s %s %s %s"
+                        (if user (format "--user=%s" user) "")
+                        (if role (format "--role=%s" role) "")
+                        (if type (format "--type=%s" type) "")
+                        (if range (format "--range=%s" range) "")
+                      (tramp-shell-quote-argument localname)))
+         (if (and user role type range)
+             (tramp-set-file-property
+              v localname "file-selinux-context" context)
+           (tramp-set-file-property
+            v localname "file-selinux-context" 'undef))
+         t)))))
 
 (defun tramp-remote-acl-p (vec)
   "Check, whether ACL is enabled on the remote host."
@@ -1555,7 +1629,7 @@ be non-negative integers."
       (when (and (tramp-remote-acl-p v)
                 (tramp-send-command-and-check
                  v (format
-                    "getfacl -ac %s 2>/dev/null"
+                    "getfacl -ac %s"
                     (tramp-shell-quote-argument localname))))
        (with-current-buffer (tramp-get-connection-buffer v)
          (goto-char (point-max))
@@ -1751,12 +1825,12 @@ be non-negative integers."
      ;; We must care about file names with spaces, or starting with
      ;; "-"; this would confuse xargs.  "ls -aQ" might be a solution,
      ;; but it does not work on all remote systems.  Apostrophes in
-     ;; the stat output are masked as "//", in order to make a proper
-     ;; shell escape of them in file names.
+     ;; the stat output are masked as `tramp-stat-marker', in order to
+     ;; make a proper shell escape of them in file names.
      "cd %s && echo \"(\"; (%s %s -a | "
      "xargs %s -c "
-     "'(//%%n// (//%%N//) %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 //%%A// t %%ie0 
-1)' "
-     "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/\\/\\//\"/g'); echo \")\"")
+     "'(%s%%n%s (%s%%N%s) %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 %s%%A%s t %%ie0 
-1)' "
+     "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\"")
     (tramp-shell-quote-argument localname)
     (tramp-get-ls-command vec)
     ;; On systems which have no quoting style, file names with
@@ -1764,8 +1838,14 @@ be non-negative integers."
     (if (tramp-get-ls-command-with-quoting-style vec)
        "--quoting-style=shell" "")
     (tramp-get-remote-stat vec)
-    (if (eq id-format 'integer) "%ue0" "//%U//")
-    (if (eq id-format 'integer) "%ge0" "//%G//"))))
+    tramp-stat-marker tramp-stat-marker
+    tramp-stat-marker tramp-stat-marker
+    (if (eq id-format 'integer)
+       "%ue0" (concat tramp-stat-marker "%U" tramp-stat-marker))
+    (if (eq id-format 'integer)
+       "%ge0" (concat tramp-stat-marker "%G" tramp-stat-marker))
+    tramp-stat-marker tramp-stat-marker
+    tramp-stat-quoted-marker)))
 
 ;; This function should return "foo/" for directories and "bar" for
 ;; files.
@@ -3162,14 +3242,15 @@ the result will be a local, non-Tramp, file name."
            (save-excursion
              (with-tramp-progress-reporter
               v 3
-              (format "Encoding remote file `%s' with `%s'" filename rem-enc)
+              (format-message "Encoding remote file `%s' with `%s'"
+                               filename rem-enc)
               (tramp-barf-unless-okay
                v (format rem-enc (tramp-shell-quote-argument localname))
                "Encoding remote file failed"))
 
              (with-tramp-progress-reporter
-                 v 3 (format "Decoding local file `%s' with `%s'"
-                             tmpfile loc-dec)
+                 v 3 (format-message "Decoding local file `%s' with `%s'"
+                                     tmpfile loc-dec)
                (if (functionp loc-dec)
                    ;; If local decoding is a function, we call it.
                    ;; We must disable multibyte, because
@@ -3376,8 +3457,9 @@ the result will be a local, non-Tramp, file name."
                    (set-buffer-multibyte nil)
                    ;; Use encoding function or command.
                    (with-tramp-progress-reporter
-                       v 3 (format "Encoding local file `%s' using `%s'"
-                                   tmpfile loc-enc)
+                       v 3 (format-message
+                            "Encoding local file `%s' using `%s'"
+                            tmpfile loc-enc)
                      (if (functionp loc-enc)
                          ;; The following `let' is a workaround for
                          ;; the base64.el that comes with pgnus-0.84.
@@ -3406,8 +3488,9 @@ the result will be a local, non-Tramp, file name."
                    ;; writes to remote file.  Because this happens on
                    ;; the remote host, we cannot use the function.
                    (with-tramp-progress-reporter
-                       v 3 (format "Decoding remote file `%s' using `%s'"
-                                   filename rem-dec)
+                       v 3 (format-message
+                            "Decoding remote file `%s' using `%s'"
+                            filename rem-dec)
                      (goto-char (point-max))
                      (unless (bolp) (newline))
                      (tramp-send-command
@@ -3508,7 +3591,7 @@ the result will be a local, non-Tramp, file name."
   (tramp-compat-with-temp-message ""
     (with-parsed-tramp-file-name file nil
       (with-tramp-progress-reporter
-         v 3 (format "Checking `vc-registered' for %s" file)
+         v 3 (format-message "Checking `vc-registered' for %s" file)
 
        ;; There could be new files, created by the vc backend.  We
        ;; cannot reuse the old cache entries, therefore.  In
@@ -3756,7 +3839,8 @@ Only send the definition if it has not already been done."
   (let ((scripts (tramp-get-connection-property
                  (tramp-get-connection-process vec) "scripts" nil)))
     (unless (member name scripts)
-      (with-tramp-progress-reporter vec 5 (format "Sending script `%s'" name)
+      (with-tramp-progress-reporter
+         vec 5 (format-message "Sending script `%s'" name)
        ;; In bash, leading TABs like in `tramp-vc-registered-read-file-names'
        ;; could result in unwanted command expansion.  Avoid this.
        (setq script (tramp-compat-replace-regexp-in-string
@@ -3930,7 +4014,7 @@ file exists and nonzero exit status otherwise."
 (defun tramp-open-shell (vec shell)
   "Opens shell SHELL."
   (with-tramp-progress-reporter
-      vec 5 (format "Opening remote shell `%s'" shell)
+      vec 5 (format-message "Opening remote shell `%s'" shell)
     ;; Find arguments for this shell.
     (let ((alist tramp-sh-extra-args)
          item extra-args)
@@ -4227,7 +4311,7 @@ and end of region, and are expected to replace the region 
contents
 with the encoded or decoded results, respectively.")
 
 (defconst tramp-remote-coding-commands
-  '((b64 "base64" "base64 -d -i")
+  `((b64 "base64" "base64 -d -i")
     ;; "-i" is more robust with older base64 from GNU coreutils.
     ;; However, I don't know whether all base64 versions do supports
     ;; this option.
@@ -4237,6 +4321,8 @@ with the encoded or decoded results, respectively.")
     (b64 "recode data..base64" "recode base64..data")
     (b64 tramp-perl-encode-with-module tramp-perl-decode-with-module)
     (b64 tramp-perl-encode tramp-perl-decode)
+    ;; This is painful slow, so we put it on the end.
+    (b64 tramp-awk-encode tramp-awk-decode ,tramp-awk-coding-test)
     (uu  "uuencode xxx" "uudecode -o /dev/stdout" "test -c /dev/stdout")
     (uu  "uuencode xxx" "uudecode -o -")
     (uu  "uuencode xxx" "uudecode -p")
@@ -4315,7 +4401,8 @@ Goes through the list `tramp-local-coding-commands' and
                    (unless (tramp-send-command-and-check vec rem-test t)
                      (throw 'wont-work-remote nil)))
                  ;; Check if remote perl exists when necessary.
-                 (when (and (not (stringp rem-enc))
+                 (when (and (symbolp rem-enc)
+                            (string-match "perl" (symbol-name rem-enc))
                             (not (tramp-get-remote-perl vec)))
                    (throw 'wont-work-remote nil))
                  ;; Check if remote encoding and decoding commands can be
@@ -5027,10 +5114,18 @@ raises an error."
 Convert file mode bits to string and set virtual device number.
 Return ATTR."
   (when attr
-    ;; Remove color escape sequences from symlink.
+    ;; Convert symlink from `tramp-do-file-attributes-with-stat'.
+    (when (consp (car attr))
+      (if (and (stringp (caar attr))
+               (string-match ".+ -> .\\(.+\\)." (caar attr)))
+          (setcar attr (match-string 1 (caar attr)))
+        (setcar attr nil)))
+    ;; Remove color escape sequences and double slashes from symlink.
     (when (stringp (car attr))
       (while (string-match tramp-color-escape-sequence-regexp (car attr))
-       (setcar attr (replace-match "" nil nil (car attr)))))
+       (setcar attr (replace-match "" nil nil (car attr))))
+      (while (string-match "//" (car attr))
+       (setcar attr (replace-match "/" nil nil (car attr)))))
     ;; Convert uid and gid.  Use -1 as indication of unusable value.
     (when (and (numberp (nth 2 attr)) (< (nth 2 attr) 0))
       (setcar (nthcdr 2 attr) -1))
@@ -5071,12 +5166,6 @@ Return ATTR."
     ;; Convert directory indication bit.
     (when (string-match "^d" (nth 8 attr))
       (setcar attr t))
-    ;; Convert symlink from `tramp-do-file-attributes-with-stat'.
-    (when (consp (car attr))
-      (if (and (stringp (caar attr))
-               (string-match ".+ -> .\\(.+\\)." (caar attr)))
-          (setcar attr (match-string 1 (caar attr)))
-        (setcar attr nil)))
     ;; Set file's gid change bit.
     (setcar (nthcdr 9 attr)
             (if (numberp (nth 3 attr))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e157321..bf3e1c7 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1111,7 +1111,8 @@ If VEC is a vector, check first in connection properties.
 Afterwards, check in `tramp-methods'.  If the `tramp-methods'
 entry does not exist, return nil."
   (let ((hash-entry
-        (replace-regexp-in-string "^tramp-" "" (symbol-name param))))
+        (tramp-compat-replace-regexp-in-string
+         "^tramp-" "" (symbol-name param))))
     (if (tramp-connection-property-p vec hash-entry)
        ;; We use the cached property.
        (tramp-get-connection-property  vec hash-entry nil)
@@ -1503,7 +1504,7 @@ ARGUMENTS to actually emit the message (if applicable)."
 ;          (1+ (count-lines (point-min) (cdr ffn)))))))
       (insert (format "%s " fn)))
     ;; The message.
-    (insert (apply 'format fmt-string arguments))))
+    (insert (apply #'format-message fmt-string arguments))))
 
 (defvar tramp-message-show-message t
   "Show Tramp message in the minibuffer.
@@ -1580,8 +1581,8 @@ signal identifier to be raised, remaining arguments 
passed to
        (error-message-string
        (list signal
              (get signal 'error-message)
-             (apply 'format fmt-string arguments)))))
-    (signal signal (list (apply 'format fmt-string arguments)))))
+             (apply #'format-message fmt-string arguments)))))
+    (signal signal (list (apply #'format-message fmt-string arguments)))))
 
 (defsubst tramp-error-with-buffer
   (buf vec-or-proc signal fmt-string &rest arguments)
@@ -3093,7 +3094,7 @@ User is always nil."
               v 'file-error "File `%s' not found on remote host" filename)
 
            (with-tramp-progress-reporter
-               v 3 (format "Inserting `%s'" filename)
+               v 3 (format-message "Inserting `%s'" filename)
              (condition-case err
                  (if (and (tramp-local-host-p v)
                           (let (file-name-handler-alist)
@@ -3593,11 +3594,12 @@ connection buffer."
           (cond
            ((eq exit 'permission-denied) "Permission denied")
            ((eq exit 'process-died)
-            (concat
-             "Tramp failed to connect.  If this happens repeatedly, try\n"
-             "    `M-x tramp-cleanup-this-connection'"))
+             (substitute-command-keys
+              (concat
+               "Tramp failed to connect.  If this happens repeatedly, try\n"
+               "    `\\[tramp-cleanup-this-connection]'")))
            ((eq exit 'timeout)
-            (format
+            (format-message
              "Timeout reached, see buffer `%s' for details"
              (tramp-get-connection-buffer vec)))
            (t "Login failed")))))
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 2f575f9..ab67120 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -50,7 +50,8 @@
                  (ignore-errors
                    (call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
                 (not (zerop (buffer-size)))
-                (replace-regexp-in-string "\n" "" (buffer-string)))))))))
+                (tramp-compat-replace-regexp-in-string
+                 "\n" "" (buffer-string)))))))))
 
 ;; Check for (X)Emacs version.
 (let ((x (if (or (>= emacs-major-version 22)
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 172a563..037d294 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -286,8 +286,8 @@ makes the comment easier to read.  Default is 1.  nil means 
0."
 This is useful when style-conventions require a certain minimal offset.
 Python's PEP8 for example recommends two spaces, so you could do:
 
-\(add-hook 'python-mode-hook
-   (lambda () (set (make-local-variable 'comment-inline-offset) 2)))
+\(add-hook \\='python-mode-hook
+   (lambda () (set (make-local-variable \\='comment-inline-offset) 2)))
 
 See `comment-padding' for whole-line comments."
   :version "24.3"
diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el
index a8dc5b1..c87cd53 100644
--- a/lisp/nxml/nxml-outln.el
+++ b/lisp/nxml/nxml-outln.el
@@ -1003,7 +1003,7 @@ immediately after the section's start-tag."
 ;;; Error handling
 
 (defun nxml-report-outline-error (msg err)
-  (error msg (apply 'format (cdr err))))
+  (error msg (apply #'format-message (cdr err))))
 
 (defun nxml-outline-error (&rest args)
   (signal 'nxml-outline-error args))
diff --git a/lisp/nxml/nxml-parse.el b/lisp/nxml/nxml-parse.el
index c0a8497..d8523ee 100644
--- a/lisp/nxml/nxml-parse.el
+++ b/lisp/nxml/nxml-parse.el
@@ -304,7 +304,7 @@ same way as well-formedness error."
 (defun nxml-parse-error (position &rest args)
   (nxml-signal-file-parse-error nxml-parse-file-name
                                (or position xmltok-start)
-                               (apply 'format args)))
+                               (apply #'format-message args)))
 
 (defun nxml-check-xmltok-errors ()
   (when xmltok-errors
diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el
index e6857a9..5689b12 100644
--- a/lisp/nxml/nxml-rap.el
+++ b/lisp/nxml/nxml-rap.el
@@ -128,7 +128,7 @@ Return nil if the character at POS is not inside."
 The change happened between START and END.
 Return position after which lexical state is unchanged.
 END must be > `nxml-prolog-end'.  START must be outside
-any 'inside' regions and at the beginning of a token."
+any “inside” regions and at the beginning of a token."
   (if (>= start nxml-scan-end)
       nxml-scan-end
     (let ((inside-remove-start start)
@@ -234,10 +234,10 @@ Sets variables like `nxml-token-after'."
     xmltok-type))
 
 (defun nxml-move-tag-backwards (bound)
-  "Move point backwards outside any 'inside' regions or tags.
+  "Move point backwards outside any “inside” regions or tags.
 Point will not move past `nxml-prolog-end'.
-Point will either be at BOUND or a '<' character starting a tag
-outside any 'inside' regions.
+Point will either be at BOUND or a `<' character starting a tag
+outside any “inside” regions.
 As a precondition, point must be >= BOUND."
   (nxml-move-outside-backwards)
   (when (not (equal (char-after) ?<))
diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el
index 5934031..31864a4 100644
--- a/lisp/nxml/rng-cmpct.el
+++ b/lisp/nxml/rng-cmpct.el
@@ -400,7 +400,7 @@ OVERRIDE is either nil, require or t."
 (defun rng-c-error (&rest args)
   (rng-c-signal-incorrect-schema rng-c-file-name
                                 (rng-c-translate-position (point))
-                                (apply 'format args)))
+                                (apply #'format-message args)))
 
 (defun rng-c-parse-top-level (context)
   (let ((rng-c-namespace-decls nil)
diff --git a/lisp/nxml/rng-match.el b/lisp/nxml/rng-match.el
index 8ebb573..ef55e85 100644
--- a/lisp/nxml/rng-match.el
+++ b/lisp/nxml/rng-match.el
@@ -1504,7 +1504,7 @@ nullable and y1 isn't, return a choice
 
 (defun rng-compile-error (&rest args)
   (signal 'rng-compile-error
-         (list (apply 'format args))))
+         (list (apply #'format-message args))))
 
 (define-error 'rng-compile-error "Incorrect schema" 'rng-error)
 
diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el
index e95ad08..98b4384 100644
--- a/lisp/nxml/rng-uri.el
+++ b/lisp/nxml/rng-uri.el
@@ -125,7 +125,7 @@ Signal an error if URI is not a valid file URL."
          (t path))))
 
 (defun rng-uri-error (&rest args)
-  (signal 'rng-uri-error (list (apply 'format args))))
+  (signal 'rng-uri-error (list (apply #'format-message args))))
 
 (define-error 'rng-uri-error "Invalid URI")
 
diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el
index 2bf8f1d..61a9654 100644
--- a/lisp/nxml/rng-valid.el
+++ b/lisp/nxml/rng-valid.el
@@ -345,17 +345,11 @@ The schema is set like `rng-auto-set-schema'."
 
 (defun rng-compute-mode-line-string ()
   (cond (rng-validate-timer
-        (concat " Validated:"
-                (number-to-string
-                 ;; Use floor rather than round because we want
-                 ;; to show 99% rather than 100% for changes near
-                 ;; the end.
-                 (floor (if (eq (buffer-size) 0)
-                            0.0
-                          (/ (* (- rng-validate-up-to-date-end (point-min))
-                                 100.0)
-                             (- (point-max) (point-min))))))
-                "%%"))
+        (format " Validated:%d%%"
+                (if (= 0 (buffer-size))
+                    0
+                  (floor (- rng-validate-up-to-date-end (point-min))
+                         (- (point-max) (point-min))))))
        ((> rng-error-count 0)
         (concat " "
                 (propertize "Invalid"
diff --git a/lisp/obsolete/complete.el b/lisp/obsolete/complete.el
index 7c7582f..87dedac 100644
--- a/lisp/obsolete/complete.el
+++ b/lisp/obsolete/complete.el
@@ -963,7 +963,7 @@ or properties are considered."
  Environment vars are converted to their values."
    (interactive)
    (let* ((end (point))
-          (beg (if (re-search-backward "[^\\][ \t\n\"\`\'][^ \t\n\"\`\']"
+          (beg (if (re-search-backward "[^\\][ \t\n\"`'][^ \t\n\"`']"
                                       (point-min) t)
                    (+ (point) 2)
                    (point-min)))
diff --git a/lisp/obsolete/iso-acc.el b/lisp/obsolete/iso-acc.el
index 499a9da..c612849 100644
--- a/lisp/obsolete/iso-acc.el
+++ b/lisp/obsolete/iso-acc.el
@@ -55,7 +55,7 @@
 ;;
 ;; If the pseudo-accent is followed by anything else than a
 ;; self-insert-command, the dead-key code is terminated, the
-;; pseudo-accent inserted 'as is' and the bell is rung to signal this.
+;; pseudo-accent inserted ‘as is’ and the bell is rung to signal this.
 ;;
 ;; Function `iso-accents-mode' can be used to enable the iso accents
 ;; minor mode, or disable it.
@@ -272,7 +272,7 @@ See the function `iso-accents-mode'."
 
 (defcustom iso-accents-enable '(?' ?` ?^ ?\" ?~ ?/)
   "List of accent keys that become prefixes in ISO Accents mode.
-The default is (?' ?\\=` ?^ ?\" ?~ ?/), which contains all the supported
+The default is (?\\=' ?\\=` ?^ ?\" ?~ ?/), which contains all the supported
 accent keys.  If you set this variable to a list in which some of those
 characters are missing, the missing ones do not act as accents.
 
@@ -346,7 +346,7 @@ the language you choose)."
   "Toggle ISO Accents mode, in which accents modify the following letter.
 This permits easy insertion of accented characters according to ISO-8859-1.
 When Iso-accents mode is enabled, accent character keys
-\(\\=`, ', \", ^, / and ~) do not self-insert; instead, they modify the 
following
+\(\\=`, \\=', \", ^, / and ~) do not self-insert; instead, they modify the 
following
 letter key so that it inserts an ISO accented letter.
 
 You can customize ISO Accents mode to a particular language
diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el
index 111de85..61f9d7f 100644
--- a/lisp/obsolete/iswitchb.el
+++ b/lisp/obsolete/iswitchb.el
@@ -389,8 +389,8 @@ See documentation of `walk-windows' for useful values."
 
 This hook is run during minibuffer setup if `iswitchb' is active.
 For instance:
-\(add-hook 'iswitchb-minibuffer-setup-hook
-         '\(lambda () (set (make-local-variable 'max-mini-window-height) 3)))
+\(add-hook \\='iswitchb-minibuffer-setup-hook
+         \\='\(lambda () (set (make-local-variable \\='max-mini-window-height) 
3)))
 will constrain the minibuffer to a maximum height of 3 lines when
 iswitchb is running."
   :type 'hook
@@ -1095,8 +1095,8 @@ Return the modified list with the last element prepended 
to it."
 
              (and iswitchb-prompt-newbuffer
                   (y-or-n-p
-                   (format
-                    "No buffer matching `%s', create one? "
+                   (format-message
+                    "No buffer matching ‘%s’, create one? "
                     buf)))))
        ;; then create a new buffer
        (progn
diff --git a/lisp/obsolete/landmark.el b/lisp/obsolete/landmark.el
index cd397ae..39684a7 100644
--- a/lisp/obsolete/landmark.el
+++ b/lisp/obsolete/landmark.el
@@ -866,7 +866,7 @@ If the game is finished, this command requests for another 
game."
   (move-to-column (+ landmark-x-offset (* landmark-square-width (1- x)))))
 
 (defun landmark-plot-square (square value)
-  "Draw 'X', 'O' or '.' on SQUARE depending on VALUE, leave point there."
+  "Draw ‘X’, ‘O’ or ‘.’ on SQUARE depending on VALUE, leave point there."
   (or (= value 1)
       (landmark-goto-square square))
   (let ((inhibit-read-only t))
diff --git a/lisp/obsolete/lmenu.el b/lisp/obsolete/lmenu.el
index e4886ab..9764382 100644
--- a/lisp/obsolete/lmenu.el
+++ b/lisp/obsolete/lmenu.el
@@ -160,9 +160,9 @@ The syntax, more precisely:
    active-p    :=  <t, nil, or a form to evaluate to decide whether this
                    button should be selectable>
    name                :=  <string>
-   partition   :=  'nil'
-   button      :=  '['  name callback active-p ']'
-   dialog      :=  '(' name [ button ]+ [ partition [ button ]+ ] ')'"
+   partition   :=  `nil'
+   button      :=  `['  name callback active-p `]'
+   dialog      :=  `(' name [ button ]+ [ partition [ button ]+ ] `)'"
   (let ((name (car data))
        (tail (cdr data))
        converted
diff --git a/lisp/obsolete/old-whitespace.el b/lisp/obsolete/old-whitespace.el
index 4619a58..00b3214 100644
--- a/lisp/obsolete/old-whitespace.el
+++ b/lisp/obsolete/old-whitespace.el
@@ -259,7 +259,7 @@ These are mostly programming and documentation modes.  But 
you may add other
 modes that you want whitespaces checked in by adding something like the
 following to your `.emacs':
 
-\(setq whitespace-modes (cons 'my-mode (cons 'my-other-mode
+\(setq whitespace-modes (cons \\='my-mode (cons \\='my-other-mode
                                            whitespace-modes))\)
 
 Or, alternately, you can use the Emacs `customize' command to set this."
diff --git a/lisp/obsolete/otodo-mode.el b/lisp/obsolete/otodo-mode.el
index 04b8810..be067f8 100644
--- a/lisp/obsolete/otodo-mode.el
+++ b/lisp/obsolete/otodo-mode.el
@@ -648,7 +648,7 @@ If point is on an empty line, insert the entry there."
     (forward-line (1- todo-previous-line))
     (let ((item (todo-item-string-start)))
       (setq todo-previous-answer
-            (y-or-n-p (concat "More important than '" item "'? ")))))
+            (y-or-n-p (format-message "More important than ‘%s’? " item)))))
   todo-previous-answer)
 (defalias 'todo-ask-p 'todo-more-important-p)
 
@@ -734,7 +734,7 @@ If point is on an empty line, insert the entry there."
 Number of entries for each category is given by NOF-PRIORITIES which
 defaults to `todo-show-priorities'.
 
-If CATEGORY-PR-PAGE is non-nil, a page separator '^L' is inserted
+If CATEGORY-PR-PAGE is non-nil, a page separator `^L' is inserted
 between each category.
 INTERACTIVE should be non-nil if this function is called interactively."
 
diff --git a/lisp/obsolete/pgg-gpg.el b/lisp/obsolete/pgg-gpg.el
index 5b405e4..cd29c61 100644
--- a/lisp/obsolete/pgg-gpg.el
+++ b/lisp/obsolete/pgg-gpg.el
@@ -122,7 +122,7 @@
                  (insert-file-contents output-file-name)))
            (set-buffer errors-buffer)
            (if (memq status '(stop signal))
-               (error "%s exited abnormally: '%s'" program exit-status))
+               (error "%s exited abnormally: ‘%s’" program exit-status))
            (if (= 127 exit-status)
                (error "%s could not be found" program))))
       (if passphrase-with-newline
diff --git a/lisp/obsolete/pgg-pgp.el b/lisp/obsolete/pgg-pgp.el
index af2b2aa..ee7af04 100644
--- a/lisp/obsolete/pgg-pgp.el
+++ b/lisp/obsolete/pgg-pgp.el
@@ -99,7 +99,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for 
\"2>\"."
            (pgg-convert-lbt-region (point-min)(point-max) 'LF)
 
            (if (memq status '(stop signal))
-               (error "%s exited abnormally: '%s'" program exit-status))
+               (error "%s exited abnormally: ‘%s’" program exit-status))
            (if (= 127 exit-status)
                (error "%s could not be found" program))
 
diff --git a/lisp/obsolete/pgg-pgp5.el b/lisp/obsolete/pgg-pgp5.el
index 97caedb..d87c6fd 100644
--- a/lisp/obsolete/pgg-pgp5.el
+++ b/lisp/obsolete/pgg-pgp5.el
@@ -35,22 +35,22 @@
   :group 'pgg)
 
 (defcustom pgg-pgp5-pgpe-program "pgpe"
-  "PGP 5.* 'pgpe' executable."
+  "PGP 5.* `pgpe' executable."
   :group 'pgg-pgp5
   :type 'string)
 
 (defcustom pgg-pgp5-pgps-program "pgps"
-  "PGP 5.* 'pgps' executable."
+  "PGP 5.* `pgps' executable."
   :group 'pgg-pgp5
   :type 'string)
 
 (defcustom pgg-pgp5-pgpk-program "pgpk"
-  "PGP 5.* 'pgpk' executable."
+  "PGP 5.* `pgpk' executable."
   :group 'pgg-pgp5
   :type 'string)
 
 (defcustom pgg-pgp5-pgpv-program "pgpv"
-  "PGP 5.* 'pgpv' executable."
+  "PGP 5.* `pgpv' executable."
   :group 'pgg-pgp5
   :type 'string)
 
@@ -115,7 +115,7 @@ Bourne shell or its equivalent \(not tcsh) is needed for 
\"2>\"."
            (pgg-convert-lbt-region (point-min)(point-max) 'LF)
 
            (if (memq status '(stop signal))
-               (error "%s exited abnormally: '%s'" program exit-status))
+               (error "%s exited abnormally: ‘%s’" program exit-status))
            (if (= 127 exit-status)
                (error "%s could not be found" program))
 
diff --git a/lisp/obsolete/scribe.el b/lisp/obsolete/scribe.el
index 68b2208..e28e0ab 100644
--- a/lisp/obsolete/scribe.el
+++ b/lisp/obsolete/scribe.el
@@ -50,7 +50,7 @@
   :group 'scribe)
 
 (defcustom scribe-electric-quote nil
-  "Non-nil makes insert of double quote use \\=`\\=` or '' depending on 
context."
+  "Non-nil makes insert of double quote use \\=`\\=` or \\='\\=' depending on 
context."
   :type 'boolean
   :group 'scribe)
 
@@ -124,7 +124,7 @@ Interesting variables:
   Non-nil makes Scribe mode use a different style of paragraph separation.
 
 `scribe-electric-quote'
-  Non-nil makes insert of double quote use \\=`\\=` or '' depending on context.
+  Non-nil makes insert of double quote use \\=`\\=` or \\='\\=' depending on 
context.
 
 `scribe-electric-parenthesis'
   Non-nil makes an open-parenthesis char (one of `([<{')
@@ -265,8 +265,8 @@ to skip backward."
   (forward-char -1))
 
 (defun scribe-insert-quote (count)
-  "Insert \\=`\\=`, '' or \" according to preceding character.
-If `scribe-electric-quote' is non-nil, insert \\=`\\=`, '' or \" according
+  "Insert \\=`\\=`, \\='\\=' or \" according to preceding character.
+If `scribe-electric-quote' is non-nil, insert \\=`\\=`, \\='\\=' or \" 
according
 to preceding character.  With numeric arg N, always insert N \" characters.
 Else just insert \"."
   (interactive "P")
diff --git a/lisp/obsolete/sregex.el b/lisp/obsolete/sregex.el
index 80b2c92..0a15f50 100644
--- a/lisp/obsolete/sregex.el
+++ b/lisp/obsolete/sregex.el
@@ -338,15 +338,15 @@ computed (i.e., non-constant) values in `sregexq' 
expressions.  So
 automatically quote its values.  Literal sregex clauses must be
 explicitly quoted like so:
 
-  (sregex '(or \"Bob\" \"Robert\"))  =>  \"Bob\\\\|Robert\"
+  (sregex \\='(or \"Bob\" \"Robert\"))  =>  \"Bob\\\\|Robert\"
 
 but computed clauses can be included easily, allowing for the reuse
 of common clauses:
 
-  (let ((dotstar '(0+ any))
-        (whitespace '(1+ (syntax ?-)))
-        (digits '(1+ (char (?0 . ?9)))))
-    (sregex 'bol dotstar \":\" whitespace digits))  =>  \"^.*:\\\\s-+[0-9]+\"
+  (let ((dotstar \\='(0+ any))
+        (whitespace \\='(1+ (syntax ?-)))
+        (digits \\='(1+ (char (?0 . ?9)))))
+    (sregex \\='bol dotstar \":\" whitespace digits))  =>  
\"^.*:\\\\s-+[0-9]+\"
 
 Here are the clauses allowed in an `sregex' or `sregexq' expression:
 
diff --git a/lisp/obsolete/terminal.el b/lisp/obsolete/terminal.el
index 6bab61b..f1a38d2 100644
--- a/lisp/obsolete/terminal.el
+++ b/lisp/obsolete/terminal.el
@@ -291,7 +291,9 @@ Other chars following \"%s\" are interpreted as follows:\n"
 ;; not used.
 (defun te-escape-extended-command-unread ()
   (interactive)
-  (setq unread-command-events (listify-key-sequence (this-command-keys)))
+  (setq unread-command-events
+        (nconc (listify-key-sequence (this-command-keys))
+               unread-command-events))
   (te-escape-extended-command))
 
 (defun te-set-escape-char (c)
diff --git a/lisp/obsolete/tpu-edt.el b/lisp/obsolete/tpu-edt.el
index 9814265..adf6122 100644
--- a/lisp/obsolete/tpu-edt.el
+++ b/lisp/obsolete/tpu-edt.el
@@ -873,7 +873,7 @@ With argument, fill and justify."
   (set-frame-width (selected-frame) width))
 
 (defun tpu-toggle-newline-and-indent nil
-  "Toggle between 'newline and indent' and 'simple newline'."
+  "Toggle between ‘newline and indent’ and ‘simple newline’."
   (interactive)
   (cond (tpu-newline-and-indent-p
          (setq tpu-newline-and-indent-string "")
@@ -1124,7 +1124,7 @@ if ARG is omitted or nil."
 
     M-x help-for-help <CR> p <CR>
 
-  Where `M-x' might be any of `Gold-KP7', 'Do', or 'ESC-x'.
+  Where `M-x' might be any of `Gold-KP7', `Do', or `ESC-x'.
 
   When you successfully invoke this part of the Emacs help facility, you
   will see a buffer named `*Finder*' listing a number of topics.  Look for
@@ -1313,7 +1313,7 @@ kill modified buffers without asking."
                (if tpu-regexp-p "en" "dis"))))
 
 (defun tpu-regexp-prompt (prompt)
-  "Read a string, adding 'RE' to the prompt if tpu-regexp-p is set."
+  "Read a string, adding ‘RE ’ to the prompt if tpu-regexp-p is set."
   (let ((re-prompt (concat (if tpu-regexp-p "RE ") prompt)))
     (read-from-minibuffer re-prompt nil nil nil 'tpu-regexp-prompt-hist)))
 
diff --git a/lisp/obsolete/vc-arch.el b/lisp/obsolete/vc-arch.el
index 8b2454b..e6540ce 100644
--- a/lisp/obsolete/vc-arch.el
+++ b/lisp/obsolete/vc-arch.el
@@ -315,7 +315,7 @@ Only the value `maybe' can be trusted :-(."
 (declare-function vc-exec-after "vc-dispatcher" (code))
 
 (defun vc-arch-dir-status-files (dir _files callback)
-  "Run 'tla inventory' for DIR and pass results to CALLBACK.
+  "Run `tla inventory' for DIR and pass results to CALLBACK.
 CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
 `vc-dir-refresh'."
   (let ((default-directory dir))
diff --git a/lisp/obsolete/vi.el b/lisp/obsolete/vi.el
index fbdf7a1..2375eb5 100644
--- a/lisp/obsolete/vi.el
+++ b/lisp/obsolete/vi.el
@@ -428,27 +428,27 @@ Major differences between this mode and real vi :
   - Search patterns with line offset (e.g. /pat/+3 or /pat/z.) are
     not supported.
   - Ex commands are not implemented; try ':' to get some hints.
-  - No line undo (i.e. the 'U' command), but multi-undo is a standard feature.
+  - No line undo (i.e. the `U' command), but multi-undo is a standard feature.
 
 * Modifications
   - The stopping positions for some point motion commands (word boundary,
-    pattern search) are slightly different from standard 'vi'.
+    pattern search) are slightly different from standard `vi'.
     Also, no automatic wrap around at end of buffer for pattern searching.
   - Since changes are done in two steps (deletion then insertion), you need
     to undo twice to completely undo a change command.  But this is not needed
     for undoing a repeated change command.
-  - No need to set/unset 'magic', to search for a string with regular expr
+  - No need to set/unset `magic', to search for a string with regular expr
     in it just put a prefix arg for the search commands.  Replace cmds too.
   - ^R is bound to incremental backward search, so use ^L to redraw screen.
 
 * Extensions
   - Some standard (or modified) Emacs commands were integrated, such as
     incremental search, query replace, transpose objects, and keyboard macros.
-  - In command state, ^X links to the 'ctl-x-map', and ESC can be linked to
+  - In command state, ^X links to the `ctl-x-map', and ESC can be linked to
     esc-map or set undefined.  These can give you the full power of Emacs.
   - See vi-com-map for those keys that are extensions to standard vi, e.g.
     `vi-name-last-change-or-macro', `vi-verify-spelling', `vi-locate-def',
-    `vi-mark-region', and 'vi-quote-words'.  Some of them are quite handy.
+    `vi-mark-region', and `vi-quote-words'.  Some of them are quite handy.
   - Use \\[vi-switch-mode] to switch among different modes quickly.
 
 Syntax table and abbrevs while in vi mode remain as they were in Emacs."
@@ -520,7 +520,7 @@ set sw=n     M-x set-variable vi-shift-width n "
 (defun vi-goto-insert-state (repetition &optional prefix-code do-it-now-p)
   "Go into insert state, the text entered will be repeated if REPETITION > 1.
 If PREFIX-CODE is given, do it before insertion begins if DO-IT-NOW-P is T.
-In any case, the prefix-code will be done before each 'redo-insert'.
+In any case, the prefix-code will be done before each `redo-insert'.
 This function expects `overwrite-mode' being set properly beforehand."
   (if do-it-now-p (apply (car prefix-code) (cdr prefix-code)))
   (setq vi-ins-point (point))
@@ -832,7 +832,7 @@ Possible prefix-arg cases are nil, INTEGER, (nil . CHAR) or 
(INTEGER . CHAR)."
 
 (defun vi-goto-mark (mark-char &optional line-flag)
   "Go to marked position or line (if line-flag is given).
-Goto mark '@' means jump into and pop the top mark on the mark ring."
+Goto mark address@hidden means jump into and pop the top mark on the mark 
ring."
   (cond ((char-equal mark-char last-command-event)     ; `` or ''
         (exchange-point-and-mark) (if line-flag (back-to-indentation)))
        ((char-equal mark-char ?@)      ; jump and pop mark
@@ -1213,7 +1213,7 @@ SPECIAL FEATURE: char argument can be used to specify 
shift amount(1-9)."
 (defun vi-backward-blank-delimited-word (count)
   "Backward COUNT blank-delimited words."
   (interactive "p")
-  (if (re-search-backward "[ \t\n\`][^ \t\n\`]+" nil t count)
+  (if (re-search-backward "[ \t\n`][^ \t\n`]+" nil t count)
       (if (not (bobp)) (forward-char 1))))
 
 (defun vi-forward-blank-delimited-word (count)
diff --git a/lisp/obsolete/vip.el b/lisp/obsolete/vip.el
index d6adbd4..0c345e2 100644
--- a/lisp/obsolete/vip.el
+++ b/lisp/obsolete/vip.el
@@ -462,7 +462,8 @@ ARG is used as the prefix value for the executed command.  
If
 EVENTS is a list of events, which become the beginning of the command."
   (interactive "P")
   (let (com key (old-map (current-local-map)))
-    (if events (setq unread-command-events events))
+    (if events (setq unread-command-events
+                     (append events unread-command-events)))
     (setq prefix-arg arg)
     (use-local-map vip-emacs-local-map)
     (unwind-protect
@@ -518,7 +519,7 @@ obtained so far, and COM is the command part obtained so 
far."
   (while (= char ?U)
     (vip-describe-arg prefix-arg)
     (setq char (read-char)))
-  (setq unread-command-events (list char)))
+  (push char unread-command-events))
 
 (defun vip-prefix-arg-com (char value com)
   "Vi operator as prefix argument."
@@ -572,7 +573,7 @@ obtained so far, and COM is the command part obtained so 
far."
        (while (= char ?U)
          (vip-describe-arg prefix-arg)
          (setq char (read-char)))
-       (setq unread-command-events (list char)))
+       (push char unread-command-events))
     ;; as com is non-nil, this means that we have a command to execute
     (if (or (= (car com) ?r) (= (car com) ?R))
        ;; execute appropriate region command.
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index f767a4e..ffc7df4 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -316,8 +316,8 @@ name of the code block."
 Do not query the user."
   (org-babel-check-confirm-evaluate info
     (not (when noeval
-          (message (format "Evaluation of this%scode-block%sis disabled."
-                           code-block block-name))))))
+          (message "Evaluation of this%scode-block%sis disabled."
+                    code-block block-name)))))
 
  ;; dynamically scoped for asynchronous export
 (defvar org-babel-confirm-evaluate-answer-no)
@@ -343,8 +343,8 @@ of potentially harmful code."
                    (yes-or-no-p
                     (format "Evaluate this%scode block%son your system? "
                             code-block block-name)))
-            (message (format "Evaluation of this%scode-block%sis aborted."
-                             code-block block-name)))))))
+            (message "Evaluation of this%scode-block%sis aborted."
+                      code-block block-name))))))
 
 ;;;###autoload
 (defun org-babel-execute-safely-maybe ()
@@ -1677,7 +1677,7 @@ If the point is not on a source block then return nil."
     (if point
         ;; taken from `org-open-at-point'
         (progn (org-mark-ring-push) (goto-char point) (org-show-context))
-      (message "source-code block '%s' not found in this buffer" name))))
+      (message "source-code block ‘%s’ not found in this buffer" name))))
 
 (defun org-babel-find-named-block (name)
   "Find a named source-code block.
@@ -1712,7 +1712,7 @@ org-babel-named-src-block-regexp."
     (if point
         ;; taken from `org-open-at-point'
         (progn (goto-char point) (org-show-context))
-      (message "result '%s' not found in this buffer" name))))
+      (message "result ‘%s’ not found in this buffer" name))))
 
 (defun org-babel-find-named-result (name &optional point)
   "Find a named result.
@@ -2207,7 +2207,7 @@ file's directory then expand relative links."
   "Make true to capitalize begin/end example markers inserted by code blocks.")
 
 (defun org-babel-examplize-region (beg end &optional results-switches)
-  "Comment out region using the inline '==' or ': ' org example quote."
+  "Comment out region using the inline ‘==’ or ‘: ’ org example quote."
   (interactive "*r")
   (let ((chars-between (lambda (b e)
                         (not (string-match "^[\\s]*$" (buffer-substring b 
e)))))
@@ -2406,7 +2406,7 @@ CONTEXT may be one of :tangle, :export or :eval."
   "Expand Noweb references in the body of the current source code block.
 
 For example the following reference would be replaced with the
-body of the source-code block named 'example-block'.
+body of the source-code block named `example-block'.
 
 <<example-block>>
 
@@ -2419,7 +2419,7 @@ This function must be called from inside of the buffer 
containing
 the source-code block which holds BODY.
 
 In addition the following syntax can be used to insert the
-results of evaluating the source-code block named 'example-block'.
+results of evaluating the source-code block named `example-block'.
 
 <<example-block()>>
 
@@ -2583,7 +2583,7 @@ block but are passed literally to the \"example-block\"."
 (defun org-babel-read (cell &optional inhibit-lisp-eval)
   "Convert the string value of CELL to a number if appropriate.
 Otherwise if cell looks like lisp (meaning it starts with a
-\"(\", \"'\", \"\\=`\" or a \"[\") then read it as lisp,
+\"(\", \"\\='\", \"\\=`\" or a \"[\") then read it as lisp,
 otherwise return it unmodified as a string.  Optional argument
 NO-LISP-EVAL inhibits lisp evaluation for situations in which is
 it not appropriate."
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el
index 3bfa8c5..92006f8 100644
--- a/lisp/org/ob-exp.el
+++ b/lisp/org/ob-exp.el
@@ -98,7 +98,7 @@ be executed."
 
 (defun org-babel-exp-src-block (&rest headers)
   "Process source block for export.
-Depending on the 'export' headers argument, replace the source
+Depending on the `export' headers argument, replace the source
 code block like this:
 
 both ---- display the code and the results
diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el
index 7fbfaf2..0e6eb4f 100644
--- a/lisp/org/ob-fortran.el
+++ b/lisp/org/ob-fortran.el
@@ -108,7 +108,7 @@ it's header arguments."
   "Wrap body in a \"program ... end program\" block if none exists."
   (if (string-match "^[ \t]*program[ \t]*.*" (capitalize body))
       (let ((vars (mapcar #'cdr (org-babel-get-header params :var))))
-       (if vars (error "Cannot use :vars if 'program' statement is present"))
+       (if vars (error "Cannot use :vars if ‘program’ statement is present"))
        body)
     (format "program main\n%s\nend program main\n" body)))
 
@@ -147,15 +147,14 @@ of the same value."
      ;; val is a matrix
      ((and (listp val) (org-every #'listp val))
       (format "real, parameter :: %S(%d,%d) = transpose( reshape( %s , (/ %d, 
%d /) ) )\n"
-             var (length val) (length (car val)) 
+             var (length val) (length (car val))
              (org-babel-fortran-transform-list val)
              (length (car val)) (length val)))
      ((listp val)
       (format "real, parameter :: %S(%d) = %s\n"
              var (length val) (org-babel-fortran-transform-list val)))
      (t
-      (error (format "the type of parameter %s is not supported by ob-fortran"
-                    var))))))
+      (error "the type of parameter %s is not supported by ob-fortran" var)))))
 
 (defun org-babel-fortran-transform-list (val)
   "Return a fortran representation of enclose syntactic lists."
diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el
index 3d441a3..4abe7af 100644
--- a/lisp/org/ob-python.el
+++ b/lisp/org/ob-python.el
@@ -64,7 +64,7 @@ This will typically be either 'python or 'python-mode."
   :type 'string)
 
 (defcustom org-babel-python-None-to 'hline
-  "Replace 'None' in python tables with this before returning."
+  "Replace ‘None’ in python tables with this before returning."
   :group 'org-babel
   :version "24.4"
   :package-version '(Org . "8.0")
diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el
index e5085ac..472d3e6 100644
--- a/lisp/org/ob-ref.el
+++ b/lisp/org/ob-ref.el
@@ -176,7 +176,7 @@ the variable."
            ;;       buffer (marker-buffer id-loc)
            ;;       loc (marker-position id-loc))
            ;; (move-marker id-loc nil)
-           (error "Reference '%s' not found in this buffer" ref))
+           (error "Reference ‘%s’ not found in this buffer" ref))
          (cond
           (lob-info (setq type 'lob))
           (id (setq type 'id))
diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index 02b9dc3..419b9a6 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -109,7 +109,7 @@ For a named session, the buffer name will be the session 
name.
 
 If the session is unnamed (nil), generate a name.
 
-If the session is 'none', use nil for the session name, and
+If the session is ‘none’, use nil for the session name, and
 org-babel-scheme-execute-with-geiser will use a temporary session."
   (let ((result
         (cond ((not name)
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 3df9fb6..b73e130 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -1211,7 +1211,7 @@ For example, 9:30am would become 09:30 rather than  9:30."
   :type 'boolean)
 
 (defun org-agenda-time-of-day-to-ampm (time)
-  "Convert TIME of a string like '13:45' to an AM/PM style time string."
+  "Convert TIME of a string like ‘13:45’ to an AM/PM style time string."
   (let* ((hour-number (string-to-number (substring time 0 -3)))
          (minute (substring time -2))
          (ampm "am"))
@@ -1975,7 +1975,7 @@ estimate."
   :type 'boolean)
 
 (defcustom org-agenda-auto-exclude-function nil
-  "A function called with a tag to decide if it is filtered on '/ RET'.
+  "A function called with a tag to decide if it is filtered on ‘/ RET’.
 The sole argument to the function, which is called once for each
 possible tag, is a string giving the name of the tag.  The
 function should return either nil if the tag should be included
@@ -3625,9 +3625,9 @@ FILTER-ALIST is an alist of filters we need to apply when
          ;; Popup existing buffer
          (org-agenda-prepare-window (get-buffer org-agenda-buffer-name)
                                     filter-alist)
-         (message "Sticky Agenda buffer, use `r' to refresh")
+         (message "Sticky Agenda buffer, use ‘r’ to refresh")
          (or org-agenda-multi (org-agenda-fit-window-to-buffer))
-         (throw 'exit "Sticky Agenda buffer, use `r' to refresh"))
+         (throw 'exit "Sticky Agenda buffer, use ‘r’ to refresh"))
       (setq org-todo-keywords-for-agenda nil)
       (setq org-drawers-for-agenda nil)
       (put 'org-agenda-tag-filter :preset-filter
diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el
index 8b5da8f..2eb2d12 100644
--- a/lisp/org/org-bibtex.el
+++ b/lisp/org/org-bibtex.el
@@ -190,7 +190,7 @@
     (:booktitle    . "Title of a book, part of which is being cited.  See the 
LaTeX book for how to type titles.  For book entries, use the title field 
instead.")
     (:chapter      . "A chapter (or section or whatever) number.")
     (:crossref     . "The database key of the entry being cross referenced.")
-    (:edition      . "The edition of a book for example, 'Second'.  This 
should be an ordinal, and should have the first letter capitalized, as shown 
here; the standard styles convert to lower case when necessary.")
+    (:edition      . "The edition of a book for example, ‘Second’.  This 
should be an ordinal, and should have the first letter capitalized, as shown 
here; the standard styles convert to lower case when necessary.")
     (:editor       . "Name(s) of editor(s), typed as indicated in the LaTeX 
book.  If there is also an author field, then the editor field gives the editor 
of the book or collection in which the reference appears.")
     (:howpublished . "How something strange has been published.  The first 
word should be capitalized.")
     (:institution  . "The sponsoring institution of a technical report.")
@@ -205,9 +205,9 @@
     (:school       . "The name of the school where a thesis was written.")
     (:series       . "The name of a series or set of books.  When citing an 
entire book, the title field gives its title and an optional series field gives 
the name of a series or multi-volume set in which the book is published.")
     (:title        . "The work’s title, typed as explained in the LaTeX book.")
-    (:type         . "The type of a technical report for example, 'Research 
Note'.")
+    (:type         . "The type of a technical report for example, ‘Research 
Note’.")
     (:volume       . "The volume of a journal or multi-volume book.")
-    (:year         . "The year of publication or, for an unpublished work, the 
year it was written.  Generally it should consist of four numerals, such as 
1984, although the standard styles can handle any year whose last four 
nonpunctuation characters are numerals, such as '(about 1984)'"))
+    (:year         . "The year of publication or, for an unpublished work, the 
year it was written.  Generally it should consist of four numerals, such as 
1984, although the standard styles can handle any year whose last four 
nonpunctuation characters are numerals, such as ‘(about 1984)’"))
   "Bibtex fields with descriptions.")
 
 (defvar org-bibtex-entries nil
@@ -221,7 +221,7 @@
 
 (defcustom org-bibtex-prefix nil
   "Optional prefix for all bibtex property names.
-For example setting to 'BIB_' would allow interoperability with fireforg."
+For example setting to ‘BIB_’ would allow interoperability with fireforg."
   :group 'org-bibtex
   :version "24.1"
   :type  '(choice
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index c0a45b3..aee91ce 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -389,8 +389,8 @@ nil          current clock is not displayed"
 (defcustom org-clock-frame-title-format '(t org-mode-line-string)
   "The value for `frame-title-format' when clocking in.
 
-When `org-clock-clocked-in-display' is set to 'frame-title
-or 'both, clocking in will replace `frame-title-format' with
+When `org-clock-clocked-in-display' is set to `frame-title'
+or `both', clocking in will replace `frame-title-format' with
 this value.  Clocking out will restore `frame-title-format'.
 
 `org-frame-title-string' is a format string using the same
@@ -717,8 +717,9 @@ Notification is shown only once."
          (unless org-clock-notification-was-shown
            (setq org-clock-notification-was-shown t)
            (org-notify
-            (format "Task '%s' should be finished by now. (%s)"
-                    org-clock-heading org-clock-effort) org-clock-sound))
+            (format-message "Task ‘%s’ should be finished by now. (%s)"
+                             org-clock-heading org-clock-effort)
+             org-clock-sound))
        (setq org-clock-notification-was-shown nil)))))
 
 (defun org-notify (notification &optional play-sound)
@@ -937,7 +938,7 @@ was started."
                (org-clock-jump-to-current-clock clock))
              (unless org-clock-resolve-expert
                (with-output-to-temp-buffer "*Org Clock*"
-                 (princ "Select a Clock Resolution Command:
+                 (princ (format-message "Select a Clock Resolution Command:
 
 i/q      Ignore this question; the same as keeping all the idle time.
 
@@ -946,8 +947,8 @@ k/K      Keep X minutes of the idle time (default is all).  
If this
          that many minutes after the time that idling began, and then
          clocked back in at the present time.
 
-g/G      Indicate that you \"got back\" X minutes ago.  This is quite
-         different from 'k': it clocks you out from the beginning of
+g/G      Indicate that you “got back” X minutes ago.  This is quite
+         different from ‘k’: it clocks you out from the beginning of
          the idle period and clock you back in X minutes ago.
 
 s/S      Subtract the idle time from the current clock.  This is the
@@ -959,7 +960,7 @@ C        Cancel the open timer altogether.  It will be as 
though you
 j/J      Jump to the current clock, to make manual adjustments.
 
 For all these options, using uppercase makes your final state
-to be CLOCKED OUT.")))
+to be CLOCKED OUT."))))
              (org-fit-window-to-buffer (get-buffer-window "*Org Clock*"))
              (let (char-pressed)
                (when (featurep 'xemacs)
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index e14849f..e938ab4 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -1086,7 +1086,7 @@ display, or in the #+COLUMNS line of the current buffer."
 (defun org-nofm-to-completion (n m &optional percent)
   (if (not percent)
       (format "[%d/%d]" n m)
-    (format "[%d%%]"(floor (+ 0.5 (* 100. (/ (* 1.0 n) m)))))))
+    (format "[%d%%]" (round (* 100.0 n) m))))
 
 
 (defun org-columns-string-to-number (s fmt)
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el
index a9baf04..911ee2e 100644
--- a/lisp/org/org-ctags.el
+++ b/lisp/org/org-ctags.el
@@ -455,8 +455,8 @@ to rebuild (update) the TAGS file."
 Wrapper for org-ctags-rebuild-tags-file-then-find-tag."
   (if (and (buffer-file-name)
           (y-or-n-p
-           (format
-            "Tag `%s' not found.  Rebuild table `%s/TAGS' and look again?"
+           (format-message
+            "Tag ‘%s’ not found.  Rebuild table ‘%s/TAGS’ and look again?"
             name
             (file-name-directory (buffer-file-name)))))
       (org-ctags-rebuild-tags-file-then-find-tag name)
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index 651ce67..573d7ee 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -4141,12 +4141,12 @@ Assuming TREE is a variable containing an Org buffer 
parse tree,
 the following example will return a flat list of all `src-block'
 and `example-block' elements in it:
 
-  \(org-element-map tree '(example-block src-block) 'identity)
+  \(org-element-map tree \\='(example-block src-block) \\='identity)
 
 The following snippet will find the first headline with a level
 of 1 and a \"phone\" tag, and will return its beginning position:
 
-  \(org-element-map tree 'headline
+  \(org-element-map tree \\='headline
    \(lambda (hl)
      \(and (= (org-element-property :level hl) 1)
           \(member \"phone\" (org-element-property :tags hl))
@@ -4156,15 +4156,15 @@ of 1 and a \"phone\" tag, and will return its beginning 
position:
 The next example will return a flat list of all `plain-list' type
 elements in TREE that are not a sub-list themselves:
 
-  \(org-element-map tree 'plain-list 'identity nil nil 'plain-list)
+  \(org-element-map tree \\='plain-list \\='identity nil nil \\='plain-list)
 
 Eventually, this example will return a flat list of all `bold'
 type objects containing a `latex-snippet' type object, even
 looking into captions:
 
-  \(org-element-map tree 'bold
+  \(org-element-map tree \\='bold
    \(lambda (b)
-     \(and (org-element-map b 'latex-snippet 'identity nil t) b))
+     \(and (org-element-map b \\='latex-snippet \\='identity nil t) b))
    nil nil nil t)"
   ;; Ensure TYPES and NO-RECURSION are a list, even of one element.
   (unless (listp types) (setq types (list types)))
diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el
index f012124..22e543c 100644
--- a/lisp/org/org-feed.el
+++ b/lisp/org/org-feed.el
@@ -690,7 +690,8 @@ formatted as a string, not the original XML data."
                                  (xml-node-children content)))))
         (t
          (setq entry (plist-put entry :description
-                                (format "Unknown '%s' content." type)))))))
+                                (format-message
+                                  "Unknown ‘%s’ content." type)))))))
     entry))
 
 (provide 'org-feed)
diff --git a/lisp/org/org-gnus.el b/lisp/org/org-gnus.el
index 8b616f0..06f00a4 100644
--- a/lisp/org/org-gnus.el
+++ b/lisp/org/org-gnus.el
@@ -291,7 +291,7 @@ If `org-store-link' was called with a prefix arg the 
meaning of
        (group (gnus-group-jump-to-group group))))
 
 (defun org-gnus-no-new-news ()
-  "Like `M-x gnus' but doesn't check for new news."
+  "Like `\\[gnus]' but doesn't check for new news."
   (if (not (gnus-alive-p)) (if org-gnus-no-server (gnus-no-server) (gnus))))
 
 (provide 'org-gnus)
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el
index cf2f4c8..7911dcf 100644
--- a/lisp/org/org-habit.el
+++ b/lisp/org/org-habit.el
@@ -180,7 +180,7 @@ This list represents a \"habit\" for the rest of this 
module."
        (error "Habit %s has no scheduled date" habit-entry))
       (unless scheduled-repeat
        (error
-        "Habit '%s' has no scheduled repeat period or has an incorrect one"
+        "Habit ‘%s’ has no scheduled repeat period or has an incorrect one"
         habit-entry))
       (setq sr-days (org-habit-duration-to-days scheduled-repeat))
       (unless (> sr-days 0)
diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el
index 62f3d95..fc3294f 100644
--- a/lisp/org/org-irc.el
+++ b/lisp/org/org-irc.el
@@ -108,7 +108,7 @@ attributes that are found."
 (defun org-irc-ellipsify-description (string &optional after)
   "Remove unnecessary white space from STRING and add ellipses if necessary.
 Strip starting and ending white space from STRING and replace any
-chars that the value AFTER with '...'"
+chars that the value AFTER with ‘...’"
   (let* ((after (number-to-string (or after 30)))
         (replace-map (list (cons "^[ \t]*" "")
                            (cons "[ \t]*$" "")
@@ -172,7 +172,7 @@ the session itself."
            (org-store-link-props
             :type "irc"
             :link (concat "irc:/" link-text)
-            :description (concat "irc session '" link-text "'")
+            :description (concat "irc session `" link-text "'")
             :server (car (car link))
             :port (or (string-to-number (cadr (pop link))) erc-default-port)
             :nick (pop link))
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el
index 73f24ce..28bed8d 100644
--- a/lisp/org/org-list.el
+++ b/lisp/org/org-list.el
@@ -230,7 +230,7 @@ This variable needs to be set before org.el is loaded.  If 
you
 need to make a change while Emacs is running, use the customize
 interface or run the following code after updating it:
 
-  \(when (featurep 'org-element) (load \"org-element\" t t))"
+  \(when (featurep \\='org-element) (load \"org-element\" t t))"
   :group 'org-plain-lists
   :version "24.1"
   :type 'boolean
@@ -2555,8 +2555,8 @@ With optional prefix argument ALL, do this for the whole 
buffer."
                     (checked (car (nth 3 cookie)))
                     (total (cdr (nth 3 cookie)))
                     (new (if percentp
-                             (format "[%d%%]" (/ (* 100 checked)
-                                                 (max 1 total)))
+                             (format "[%d%%]" (floor (* 100.0 checked)
+                                                     (max 1 total)))
                            (format "[%d/%d]" checked total))))
                (goto-char beg)
                (insert new)
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el
index 9b21814..a52c196 100644
--- a/lisp/org/org-mouse.el
+++ b/lisp/org/org-mouse.el
@@ -378,7 +378,7 @@ nor a function, elements of KEYWORDS are used directly."
 (defvar org-mouse-priority-regexp "\\[#\\([A-Z]\\)\\]"
   "Regular expression matching the priority indicator.
 Differs from `org-priority-regexp' in that it doesn't contain the
-leading '.*?'.")
+leading `.*?'.")
 
 (defun org-mouse-get-priority (&optional default)
   "Return the priority of the current headline.
@@ -539,7 +539,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
                ((stringp (nth 2 entry))
                 (concat (org-mouse-agenda-type (nth 1 entry))
                         (nth 2 entry)))
-               (t "Agenda Command '%s'"))
+               (t "Agenda Command ‘%s’"))
               30))))
      "--"
      ["Delete Blank Lines" delete-blank-lines
@@ -566,7 +566,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
       (save-excursion (org-apply-on-list wrap-fun nil)))))
 
 (defun org-mouse-bolp ()
-  "Return true if there only spaces, tabs, and '*' before point.
+  "Return true if there only spaces, tabs, and ‘*’ before point.
 This means, between the beginning of line and the point."
   (save-excursion
     (skip-chars-backward " \t*") (bolp)))
@@ -708,9 +708,9 @@ This means, between the beginning of line and the point."
      ((org-mouse-looking-at ":\\([A-Za-z0-9_]+\\):" "A-Za-z0-9_" -1) ;tags
       (popup-menu
        `(nil
-        [,(format "Display '%s'" (match-string 1))
+        [,(format-message "Display ‘%s’" (match-string 1))
          (org-tags-view nil ,(match-string 1))]
-        [,(format "Sparse Tree '%s'" (match-string 1))
+        [,(format-message "Sparse Tree ‘%s’" (match-string 1))
          (org-tags-sparse-tree nil ,(match-string 1))]
         "--"
         ,@(org-mouse-tag-menu))))
diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el
index f092c71..7024ed6 100644
--- a/lisp/org/org-plot.el
+++ b/lisp/org/org-plot.el
@@ -94,7 +94,7 @@ Return value is the point at the beginning of the table."
   (goto-char (org-table-begin)))
 
 (defun org-plot/collect-options (&optional params)
-  "Collect options from an org-plot '#+Plot:' line.
+  "Collect options from an org-plot ‘#+Plot:’ line.
 Accepts an optional property list PARAMS, to which the options
 will be added.  Returns the resulting property list."
   (interactive)
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el
index d0750f7..4d9e79f 100644
--- a/lisp/org/org-protocol.el
+++ b/lisp/org/org-protocol.el
@@ -394,7 +394,7 @@ The sub-protocol used to reach this function is set in
 `org-protocol-protocol-alist'.
 
 This function detects an URL, title and optional text, separated
-by '/'.  The location for a browser's bookmark looks like this:
+by `/'.  The location for a browser's bookmark looks like this:
 
   javascript:location.href='org-protocol://capture://'+ \\
         encodeURIComponent(location.href)+'/' \\
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index 5c2ceaf..4f79986 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -270,8 +270,7 @@ the display of windows containing the Org buffer and the 
code buffer."
       (setq beg (move-marker beg (nth 0 info))
            end (move-marker end (nth 1 info))
            msg (if allow-write-back-p
-                   (substitute-command-keys
-                    "Edit, then exit with C-c ' (C-c and single quote) -- C-c 
C-k to abort")
+                    "Edit, then exit with C-c ' (C-c and single quote) -- C-c 
C-k to abort"
                  "Exit with C-c ' (C-c and single quote) -- C-c C-k to abort")
            code (or code (buffer-substring-no-properties beg end))
            lang (or (cdr (assoc (nth 2 info) org-src-lang-modes))
@@ -468,8 +467,7 @@ the fragment in the Org-mode buffer."
   (let ((line (org-current-line))
        (col (current-column))
        (case-fold-search t)
-       (msg (substitute-command-keys
-             "Edit, then exit with C-c ' (C-c and single quote) -- C-c C-k to 
abort"))
+       (msg "Edit, then exit with C-c ' (C-c and single quote) -- C-c C-k to 
abort")
        (org-mode-p (derived-mode-p 'org-mode))
        (beg (make-marker))
        (end (make-marker))
@@ -867,9 +865,9 @@ This command is not bound to a key by default, to avoid 
conflicts
 with language major mode bindings.  To bind it to C-c @ in all
 language major modes, you could use
 
-  (add-hook 'org-src-mode-hook
+  (add-hook \\='org-src-mode-hook
             (lambda () (define-key org-src-mode-map \"address@hidden"
-                    'org-src-do-key-sequence-at-code-block)))
+                    \\='org-src-do-key-sequence-at-code-block)))
 
 In that case, for example, C-c @ t issued in code edit buffers
 would tangle the current Org code block, C-c @ e would execute
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index d84c51b..fb59367 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -3404,7 +3404,7 @@ Parameters get priority."
     (if (eq org-table-use-standard-references t)
        (org-table-fedit-toggle-ref-type))
     (org-goto-line startline)
-    (message "Edit formulas, finish with `C-c C-c' or `C-c ' '.  See menu for 
more commands.")))
+    (message "Edit formulas, finish with ‘C-c C-c’ or ‘C-c '’.  See menu for 
more commands.")))
 
 (defun org-table-fedit-post-command ()
   (when (not (memq this-command '(lisp-complete-symbol)))
diff --git a/lisp/org/org.el b/lisp/org/org.el
index e9dae19..acfc6f0 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -381,7 +381,7 @@ core modules, nor modules from the CONTRIB directory).  
Just add symbols
 to the end of the list.  If the package is called org-xyz.el, then you need
 to add the symbol `xyz', and the package must have a call to:
 
-   \(provide 'org-xyz)
+   \(provide \\='org-xyz)
 
 For export specific modules, see also `org-export-backends'."
   :group 'org
@@ -471,20 +471,20 @@ value of the variable, after updating it:
            \(lambda (backend)
              \(let ((name (org-export-backend-name backend)))
                \(or (memq name val)
-                   \(catch 'parentp
+                   \(catch \\='parentp
                      \(dolist (b val)
                        \(and (org-export-derived-backend-p b name)
-                            \(throw 'parentp t)))))))
+                            \(throw \\='parentp t)))))))
            org-export--registered-backends))
-    \(let ((new-list (mapcar 'org-export-backend-name
+    \(let ((new-list (mapcar \\='org-export-backend-name
                             org-export--registered-backends)))
       \(dolist (backend val)
         \(cond
          \((not (load (format \"ox-%s\" backend) t t))
-          \(message \"Problems while trying to load export back-end `%s'\"
+          \(message \"Problems while trying to load export back-end ‘%s’\"
                    backend))
          \((not (memq backend new-list)) (push backend new-list))))
-      \(set-default 'org-export-backends new-list)))
+      \(set-default \\='org-export-backends new-list)))
 
 Adding a back-end to this list will also pull the back-end it
 depends on, if any."
@@ -827,7 +827,7 @@ When nil, just use the standard three dots.
 When a string, use that string instead.
 When a face, use the standard 3 dots, but with the specified face.
 The change affects only Org-mode (which will then use its own display table).
-Changing this requires executing `M-x org-mode RET' in a buffer to become
+Changing this requires executing `\\[org-mode]' in a buffer to become
 effective."
   :group 'org-startup
   :type '(choice (const :tag "Default" nil)
@@ -1548,8 +1548,8 @@ links in Org-mode buffers can have an optional tag after 
a double colon, e.g.
 
      [[linkkey:tag][description]]
 
-The 'linkkey' must be a word word, starting with a letter, followed
-by letters, numbers, '-' or '_'.
+The `linkkey' must be a word word, starting with a letter, followed
+by letters, numbers, `-' or `_'.
 
 If REPLACE is a string, the tag will simply be appended to create the link.
 If the string contains \"%s\", the tag will be inserted there.  If the string
@@ -2487,7 +2487,7 @@ TODO state changes
 ------------------
 :type  todo-state-change
 :from  previous state (keyword as a string), or nil, or a symbol
-       'todo' or 'done', to indicate the general type of state.
+       `todo' or `done', to indicate the general type of state.
 :to    new state, like in :from")
 
 (defcustom org-enforce-todo-dependencies nil
@@ -3291,10 +3291,10 @@ Instead of customizing this variable directly, you 
might want to
 set it locally for capture buffers, because there no list of
 tags in that file can be created dynamically (there are none).
 
-  (add-hook 'org-capture-mode-hook
+  (add-hook \\='org-capture-mode-hook
             (lambda ()
               (set (make-local-variable
-                    'org-complete-tags-always-offer-all-agenda-tags)
+                    \\='org-complete-tags-always-offer-all-agenda-tags)
                    t)))"
   :group 'org-tags
   :version "24.1"
@@ -3974,7 +3974,7 @@ lines to the buffer:
 
 (defcustom org-hidden-keywords nil
   "List of symbols corresponding to keywords to be hidden the org buffer.
-For example, a value '(title) for this list will make the document's title
+For example, a value \\='(title) for this list will make the document's title
 appear in the buffer without the initial #+TITLE: keyword."
   :group 'org-appearance
   :version "24.1"
@@ -4346,7 +4346,8 @@ If TABLE-TYPE is non-nil, also check for table.el-type 
tables."
       (goto-char (point-min))
       (while (re-search-forward org-table-any-line-regexp nil t)
        (unless quietly
-         (message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size))))
+         (message "Mapping tables: %d%%"
+                  (floor (* 100.0 (point)) (buffer-size))))
        (beginning-of-line 1)
        (when (and (looking-at org-table-line-regexp)
                   ;; Exclude tables in src/example/verbatim/clocktable blocks
@@ -4859,8 +4860,8 @@ Support for group tags is controlled by the option
                                             (if (characterp (cdr tg))
                                                 (format "(%s)" (char-to-string 
(cdr tg))) "")))))
               org-tag-alist)))
-      (let (e tgs g)
-       (while (setq e (pop tags))
+      (let (tgs g)
+       (dolist (e tags)
          (cond
           ((equal e "{")
            (progn (push '(:startgroup) tgs)
@@ -4874,7 +4875,8 @@ Support for group tags is controlled by the option
           ((equal e "\\n") (push '(:newline) tgs))
           ((string-match (org-re "^\\([[:alnum:address@hidden)(\\(.\\))$") e)
            (push (cons (match-string 1 e)
-                       (string-to-char (match-string 2 e))) tgs)
+                       (string-to-char (match-string 2 e)))
+                  tgs)
            (if (and g (> g 0))
                (setcar org-tag-groups-alist
                        (append (car org-tag-groups-alist)
@@ -4886,7 +4888,7 @@ Support for group tags is controlled by the option
                          (append (car org-tag-groups-alist) (list e))))
              (if g (setq g (1+ g))))))
        (org-set-local 'org-tag-alist nil)
-       (while (setq e (pop tgs))
+       (dolist (e tgs)
          (or (and (stringp (car e))
                   (assoc (car e) org-tag-alist))
              (push e org-tag-alist)))
@@ -4956,7 +4958,8 @@ Support for group tags is controlled by the option
             ((string-match "\\`\\([a-zA-Z][0-9a-zA-Z_]*\\)_TODO\\'" key)
              ;; general TODO-like setup
              (push (cons (intern (downcase (match-string 1 key)))
-                         (org-split-string value splitre)) kwds))
+                         (org-split-string value splitre))
+                    kwds))
             ((equal key "COLUMNS")
              (org-set-local 'org-columns-default-format value))
             ((equal key "LINK")
@@ -4977,8 +4980,8 @@ Support for group tags is controlled by the option
              (org-table-set-constants))
             ((equal key "STARTUP")
              (let ((opts (org-split-string value splitre))
-                   l var val)
-               (while (setq l (pop opts))
+                   var val)
+               (dolist (l opts)
                  (when (setq l (assoc l org-startup-options))
                    (setq var (nth 1 l) val (nth 2 l))
                    (if (not (nth 3 l))
@@ -5040,8 +5043,8 @@ Support for group tags is controlled by the option
                                   (default-value 'org-todo-keywords)))))
        (setq kwds (reverse kwds)))
       (setq kwds (nreverse kwds))
-      (let (inter kws kw)
-       (while (setq kws (pop kwds))
+      (let (inter kw)
+       (dolist (kws kwds)
          (let ((kws (or
                      (run-hook-with-args-until-success
                       'org-todo-setup-filter-hook kws)
@@ -5209,8 +5212,8 @@ This will extract info from a string like \"WAIT(w@/!)\"."
 (defun org-assign-fast-keys (alist)
   "Assign fast keys to a keyword-key alist.
 Respect keys that are already there."
-  (let (new e (alt ?0))
-    (while (setq e (pop alist))
+  (let (new (alt ?0))
+    (dolist (e alist)
       (if (or (memq (car e) '(:newline :grouptags :endgroup :startgroup))
              (cdr e)) ;; Key already assigned.
          (push e new)
@@ -5329,8 +5332,9 @@ The following commands are available:
     (define-key org-mode-map [menu-bar show] 'undefined))
 
   (org-load-modules-maybe)
-  (easy-menu-add org-org-menu)
-  (easy-menu-add org-tbl-menu)
+  (when (featurep 'xemacs)
+    (easy-menu-add org-org-menu)
+    (easy-menu-add org-tbl-menu))
   (org-install-agenda-files-menu)
   (if org-descriptive-links (add-to-invisibility-spec '(org-link)))
   (add-to-invisibility-spec '(org-cwidth))
@@ -7264,9 +7268,8 @@ Optional arguments START and END can be used to limit the 
range."
   (setq org-goto-map
        (let ((map (make-sparse-keymap)))
          (let ((cmds '(isearch-forward isearch-backward kill-ring-save 
set-mark-command
-                                       mouse-drag-region universal-argument 
org-occur))
-               cmd)
-           (while (setq cmd (pop cmds))
+                                       mouse-drag-region universal-argument 
org-occur)))
+           (dolist (cmd cmds)
              (substitute-key-definition cmd cmd map global-map)))
          (suppress-keymap map)
          (org-defkey map "\C-m"     'org-goto-ret)
@@ -8563,7 +8566,8 @@ and still retain the repeater to cover future instances 
of the task."
              (goto-char (point-min))
              (while (re-search-forward drawer-re nil t)
                (mapc (lambda (d)
-                       (org-remove-empty-drawer-at d (point))) org-drawers)))
+                       (org-remove-empty-drawer-at d (point)))
+                      org-drawers)))
            (goto-char (point-min))
            (when doshift
              (while (re-search-forward org-ts-regexp-both nil t)
@@ -8597,7 +8601,8 @@ Optional argument WITH-CASE means sort case-sensitively."
   (while (string-match org-bracket-link-regexp s)
     (setq s (replace-match (if (match-end 2)
                               (match-string 3 s)
-                            (match-string 1 s)) t t s)))
+                            (match-string 1 s))
+                           t t s)))
   (let ((st (format " %s " s)))
     (while (string-match org-emph-re st)
       (setq st (replace-match (format " %s " (match-string 4 st)) t t st)))
@@ -9147,10 +9152,11 @@ definitions."
                            (list (car c) (car c) (cadr c)))
                           ((string= "" (cadr c))
                            (list (car c) (car c) (caddr c)))
-                          (t c))) contexts))
-       (a alist) c r s)
+                          (t c)))
+          contexts))
+       (a alist) r s)
     ;; loop over all commands or templates
-    (while (setq c (pop a))
+    (dolist (c a)
       (let (vrules repl)
        (cond
         ((not (assoc (car c) contexts))
@@ -9160,7 +9166,8 @@ definitions."
                             (car c) contexts)))
          (mapc (lambda (vr)
                  (when (not (equal (car vr) (cadr vr)))
-                   (setq repl vr))) vrules)
+                   (setq repl vr)))
+                vrules)
          (if (not repl) (push c r)
            (push (cadr repl) s)
            (push
@@ -9177,14 +9184,16 @@ definitions."
                (let ((tpl (car x)))
                  (when (not (delq
                              nil
-                             (mapcar (lambda(y)
-                                       (equal y tpl)) s))) x)))
+                             (mapcar (lambda (y)
+                                       (equal y tpl))
+                                      s)))
+                    x)))
              (reverse r))))))
 
 (defun org-contextualize-validate-key (key contexts)
   "Check CONTEXTS for agenda or capture KEY."
-  (let (r rr res)
-    (while (setq r (pop contexts))
+  (let (rr res)
+    (dolist (r contexts)
       (mapc
        (lambda (rr)
         (when
@@ -9483,7 +9492,8 @@ active region."
                  (funcall (caar sfuns)))
              (setq link (plist-get org-store-link-plist :link)
                    desc (or (plist-get org-store-link-plist
-                                       :description) link))))
+                                       :description)
+                             link))))
 
        ;; Store a link from a source code buffer
        ((org-src-edit-buffer-p)
@@ -9663,7 +9673,8 @@ active region."
 
        ;; Return the link
        (if (not (and (or (org-called-interactively-p 'any)
-                        executing-kbd-macro) link))
+                        executing-kbd-macro)
+                     link))
           (or agenda-link (and link (org-make-link-string link desc)))
         (push (list link desc) org-stored-links)
         (message "Stored: %s" (or desc link))
@@ -10896,7 +10907,7 @@ visibility around point, thus ignoring
 enclose the position of `org-open-link-marker'."
   (let ((m org-open-link-marker))
     (catch 'exit
-      (while (apply 're-search-forward args)
+      (while (apply #'re-search-forward args)
        (unless (get-text-property (match-end group) 'intangible) ; Emacs 21
          (goto-char (match-end group))
          (if (and (or (not (eq (marker-buffer m) (current-buffer)))
@@ -11176,7 +11187,7 @@ org-open-file.
 It assumes that is the case when the entry uses a regular
 expression which has at least one grouping construct and the
 action is either a lisp form or a command string containing
-'%1', i.e. using at least one subexpression match as a
+`%1', i.e. using at least one subexpression match as a
 parameter."
   (let ((selector (car entry))
        (action (cdr entry)))
@@ -11247,12 +11258,9 @@ on the system \"/address@hidden:\"."
    ((eq t org-reverse-note-order) t)
    ((not (listp org-reverse-note-order)) nil)
    (t (catch 'exit
-       (let  ((all org-reverse-note-order)
-              entry)
-         (while (setq entry (pop all))
-           (if (string-match (car entry) buffer-file-name)
-               (throw 'exit (cdr entry))))
-         nil)))))
+        (dolist (entry org-reverse-note-order)
+          (if (string-match (car entry) buffer-file-name)
+              (throw 'exit (cdr entry))))))))
 
 (defvar org-refile-target-table nil
   "The list of refile targets, created by `org-refile'.")
@@ -11317,10 +11325,10 @@ on the system \"/address@hidden:\"."
   (let ((case-fold-search nil)
        ;; otherwise org confuses "TODO" as a kw and "Todo" as a word
        (entries (or org-refile-targets '((nil . (:level . 1)))))
-       targets tgs txt re files f desc descre fast-path-p level pos0)
+       targets tgs txt re files desc descre fast-path-p level pos0)
     (message "Getting targets...")
     (with-current-buffer (or default-buffer (current-buffer))
-      (while (setq entry (pop entries))
+      (dolist (entry entries)
        (setq files (car entry) desc (cdr entry))
        (setq fast-path-p nil)
        (cond
@@ -11353,7 +11361,7 @@ on the system \"/address@hidden:\"."
                                              (cdr desc)))
                               "\\}[ \t]")))
         (t (error "Bad refiling target description %s" desc)))
-       (while (setq f (pop files))
+       (dolist (f files)
          (with-current-buffer
              (if (bufferp f) f (org-get-agenda-file-buffer f))
            (or
@@ -12679,7 +12687,8 @@ statistics everywhere."
                (outline-next-heading)))
            (setq new
                  (if is-percent
-                     (format "[%d%%]" (/ (* 100 cnt-done) (max 1 cnt-all)))
+                     (format "[%d%%]" (floor (* 100.0 cnt-done)
+                                             (max 1 cnt-all)))
                    (format "[%d/%d]" cnt-done cnt-all))
                  ndel (- (match-end 0) checkbox-beg))
            ;; handle overlays when updating cookie from column view
@@ -12734,20 +12743,19 @@ This hook runs even if there is no statistics cookie 
present, in which case
 
 (defun org-local-logging (value)
   "Get logging settings from a property VALUE."
-  (let* (words w a)
-    ;; directly set the variables, they are already local.
-    (setq org-log-done nil
-         org-log-repeat nil
-         org-todo-log-states nil)
-    (setq words (org-split-string value))
-    (while (setq w (pop words))
+  ;; Directly set the variables, they are already local.
+  (setq org-log-done nil
+        org-log-repeat nil
+        org-todo-log-states nil)
+  (dolist (w (org-split-string value))
+    (let* (a)
       (cond
        ((setq a (assoc w org-startup-options))
-       (and (member (nth 1 a) '(org-log-done org-log-repeat))
-            (set (nth 1 a) (nth 2 a))))
+        (and (member (nth 1 a) '(org-log-done org-log-repeat))
+             (set (nth 1 a) (nth 2 a))))
        ((setq a (org-extract-log-state-settings w))
-       (and (member (car a) org-todo-keywords-1)
-            (push a org-todo-log-states)))))))
+        (and (member (car a) org-todo-keywords-1)
+             (push a org-todo-log-states)))))))
 
 (defun org-get-todo-sequence-head (kwd)
   "Return the head of the TODO sequence to which KWD belongs.
@@ -12777,7 +12785,7 @@ Returns the new TODO keyword, or nil if no state change 
should occur."
         (expert nil)
         (fwidth (+ maxlen 3 1 3))
         (ncol (/ (- (window-width) 4) fwidth))
-        tg cnt e c tbl
+        tg cnt c tbl
         groups ingroup)
     (save-excursion
       (save-window-excursion
@@ -12787,7 +12795,7 @@ Returns the new TODO keyword, or nil if no state change 
should occur."
        (erase-buffer)
        (org-set-local 'org-done-keywords done-keywords)
        (setq tbl fulltable cnt 0)
-       (while (setq e (pop tbl))
+       (dolist (e tbl)
          (cond
           ((equal e '(:startgroup))
            (push '() groups) (setq ingroup t)
@@ -14121,7 +14129,7 @@ See also `org-scan-tags'.
        (re (org-re 
"^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL\\([<=>]\\{1,2\\}\\)\\([0-9]+\\)\\|\\(\\(?:[[:alnum:]_]+\\(?:\\\\-\\)*\\)+\\)\\([<>=]\\{1,2\\}\\)\\({[^}]+}\\|\"[^\"]*\"\\|-?[.0-9]+\\(?:[eE][-+]?[0-9]+\\)?\\)\\|[[:alnum:address@hidden)"))
        minus tag mm
        tagsmatch todomatch tagsmatcher todomatcher kwd matcher
-       orterms term orlist re-p str-p level-p level-op time-p
+       orterms orlist re-p str-p level-p level-op time-p
        prop-p pn pv po gv rest (start 0) (ss 0))
     ;; Expand group tags
     (setq match (org-tags-expand match))
@@ -14150,7 +14158,7 @@ See also `org-scan-tags'.
     (if (or (not tagsmatch) (not (string-match "\\S-" tagsmatch)))
        (setq tagsmatcher t)
       (setq orterms (org-split-string tagsmatch "|") orlist nil)
-      (while (setq term (pop orterms))
+      (dolist (term orterms)
        (while (and (equal (substring term -1) "\\") orterms)
          (setq term (concat term "|" (pop orterms)))) ; repair bad split
        (while (string-match re term)
@@ -14211,7 +14219,7 @@ See also `org-scan-tags'.
     (if (or (not todomatch) (not (string-match "\\S-" todomatch)))
        (setq todomatcher t)
       (setq orterms (org-split-string todomatch "|") orlist nil)
-      (while (setq term (pop orterms))
+      (dolist (term orterms)
        (while (string-match re term)
          (setq minus (and (match-end 1)
                           (equal (match-string 1 term) "-"))
@@ -14280,7 +14288,8 @@ When DOWNCASE is non-nil, expand downcased TAGS."
                    (with-syntax-table stable
                      (string-match
                       (concat "\\(?1:[+-]?\\)\\(?2:\\<"
-                              (regexp-opt tml) "\\>\\)") rtnmatch)))
+                              (regexp-opt tml) "\\>\\)")
+                       rtnmatch)))
          (let* ((dir (match-string 1 rtnmatch))
                 (tag (match-string 2 rtnmatch))
                 (tag (if downcased (downcase tag) tag)))
@@ -14416,7 +14425,8 @@ ignore inherited ones."
          (reverse (delete-dups
                    (reverse (append
                              (org-remove-uninherited-tags
-                              org-file-tags) tags)))))))))
+                              org-file-tags)
+                              tags)))))))))
 
 (defun org-add-prop-inherited (s)
   (add-text-properties 0 (length s) '(inherited t) s)
@@ -14748,7 +14758,7 @@ Returns the new tags string, or nil to not change the 
current settings."
         (ncol (/ (- (window-width) 4) fwidth))
         (i-face 'org-done)
         (c-face 'org-todo)
-        tg cnt e c char c1 c2 ntable tbl rtn
+        tg cnt c char c1 c2 ntable tbl rtn
         ov-start ov-end ov-prefix
         (exit-after-next org-fast-tag-selection-single-key)
         (done-keywords org-done-keywords)
@@ -14783,7 +14793,7 @@ Returns the new tags string, or nil to not change the 
current settings."
       (org-fast-tag-show-exit exit-after-next)
       (org-set-current-tags-overlay current ov-prefix)
       (setq tbl fulltable char ?a cnt 0)
-      (while (setq e (pop tbl))
+      (dolist (e tbl)
        (cond
         ((equal (car e) :startgroup)
          (push '() groups) (setq ingroup t)
@@ -15075,7 +15085,7 @@ a *different* entry, you cannot use these techniques."
             ((eq scope 'file-with-archives)
              (setq scope (org-add-archive-files (list (buffer-file-name))))))
            (org-agenda-prepare-buffers scope)
-           (while (setq file (pop scope))
+           (dolist (file scope)
              (with-current-buffer (org-find-base-buffer-visiting file)
                (save-excursion
                  (save-restriction
@@ -16032,7 +16042,7 @@ only headings."
          (widen)
          (setq limit (point-max))
          (goto-char (point-min))
-         (while (setq heading (pop path))
+         (dolist (heading path)
            (setq re (format org-complex-heading-regexp-format
                             (regexp-quote heading)))
            (setq cnt 0 pos (point))
@@ -16077,7 +16087,7 @@ When the target headline is found, return a marker to 
this location."
                                nil "\\`[^.#].*\\.org\\'"))
         file visiting m buffer)
     (catch 'found
-      (while (setq file (pop files))
+      (dolist (file files)
         (message "trying %s" file)
         (setq visiting (org-find-base-buffer-visiting file))
         (setq buffer (or visiting (find-file-noselect file)))
@@ -18035,7 +18045,7 @@ If the current buffer does not, find the first agenda 
file."
         file)
     (unless files (user-error "No agenda files"))
     (catch 'exit
-      (while (setq file (pop files))
+      (dolist (file files)
        (if (equal (file-truename file) tcf)
            (when (car files)
              (find-file (car files))
@@ -18121,8 +18131,8 @@ it to the list of buffers which might be released 
later."
   "Release all buffers in list, asking the user for confirmation when needed.
 When a buffer is unmodified, it is just killed.  When modified, it is saved
 \(if the user agrees) and then killed."
-  (let (buf file)
-    (while (setq buf (pop blist))
+  (let (file)
+    (dolist (buf blist)
       (setq file (buffer-file-name buf))
       (when (and (buffer-modified-p buf)
                 file
@@ -18144,7 +18154,7 @@ When a buffer is unmodified, it is just killed.  When 
modified, it is saved
          org-tag-groups-alist-for-agenda nil)
     (save-excursion
       (save-restriction
-       (while (setq file (pop files))
+       (dolist (file files)
          (catch 'nextfile
            (if (bufferp file)
                (set-buffer file)
@@ -18424,11 +18434,11 @@ Some of the options can be changed using the variable
         (optnew org-format-latex-options)
         (matchers (plist-get opt :matchers))
         (re-list org-latex-regexps)
-        (cnt 0) txt hash link beg end re e checkdir
+        (cnt 0) txt hash link beg end re checkdir
         string
         m n block-type block linkfile movefile ov)
     ;; Check the different regular expressions
-    (while (setq e (pop re-list))
+    (dolist (e re-list)
       (setq m (car e) re (nth 1 e) n (nth 2 e) block-type (nth 3 e)
            block (if block-type "\n\n" ""))
       (when (member m matchers)
@@ -19052,7 +19062,7 @@ BEG and END default to the buffer boundaries."
 (org-defkey org-mode-map "\C-i"       'org-cycle)
 (org-defkey org-mode-map [(tab)]      'org-cycle)
 (org-defkey org-mode-map [(control tab)] 'org-force-cycle-archived)
-(org-defkey org-mode-map "\M-\t" 'pcomplete)
+(org-defkey org-mode-map "\M-\t" #'pcomplete)
 ;; The following line is necessary under Suse GNU/Linux
 (unless (featurep 'xemacs)
   (org-defkey org-mode-map [S-iso-lefttab]  'org-shifttab))
@@ -19119,7 +19129,7 @@ BEG and END default to the buffer boundaries."
   (org-defkey org-mode-map [?\C-c (right)] 'org-shiftright)
   (org-defkey org-mode-map [?\C-c ?\C-x (right)] 'org-shiftcontrolright)
   (org-defkey org-mode-map [?\C-c ?\C-x (left)] 'org-shiftcontrolleft)
-  (org-defkey org-mode-map [?\e (tab)] 'pcomplete)
+  (org-defkey org-mode-map [?\e (tab)] #'pcomplete)
   (org-defkey org-mode-map [?\e (shift return)] 'org-insert-todo-heading)
   (org-defkey org-mode-map [?\e (shift left)]   'org-shiftmetaleft)
   (org-defkey org-mode-map [?\e (shift right)]  'org-shiftmetaright)
@@ -20782,8 +20792,8 @@ number of stars to add."
                   (insert
                    (org-list-to-subtree
                     (org-list-parse-list t)
-                    '(:istart (concat stars add-stars (funcall get-stars 
depth))
-                              :icount (concat stars add-stars (funcall 
get-stars depth)))))))
+                    `(:istart (concat ',stars ',add-stars (funcall get-stars 
depth))
+                       :icount (concat ',stars ',add-stars (funcall get-stars 
depth)))))))
               (setq toggled t))
             (forward-line))))
        ;; Case 3. Started at normal text: make every line an heading,
@@ -20805,11 +20815,11 @@ number of stars to add."
               (forward-line)))))))
     (unless toggled (message "Cannot toggle heading from here"))))
 
-(defun org-meta-return (&optional arg)
+(defun org-meta-return (&optional _arg)
   "Insert a new heading or wrap a region in a table.
 Calls `org-insert-heading' or `org-table-wrap-region', depending
 on context.  See the individual commands for more information."
-  (interactive "P")
+  (interactive)
   (org-check-before-invisible-edit 'insert)
   (or (run-hook-with-args-until-success 'org-metareturn-hook)
       (let* ((element (org-element-at-point))
@@ -21107,6 +21117,7 @@ output buffer into your mail program, as it gives us 
important
 information about your Org-mode version and configuration."
   (interactive)
   (require 'reporter)
+  (defvar reporter-prompt-for-summary-p)
   (org-load-modules-maybe)
   (org-require-autoloaded-modules)
   (let ((reporter-prompt-for-summary-p "Bug report subject: "))
@@ -21366,11 +21377,13 @@ upon the next fontification round."
                                        'invisible 'org-link s))
        (setq s (concat (substring s 0 b)
                        (substring s (or (next-single-property-change
-                                         b 'invisible s) (length s)))))))
+                                         b 'invisible s)
+                                         (length s)))))))
     (while (setq b (text-property-any 0 (length s) 'org-cwidth t s))
       (setq s (concat (substring s 0 b)
                      (substring s (or (next-single-property-change
-                                       b 'org-cwidth s) (length s))))))
+                                       b 'org-cwidth s)
+                                       (length s))))))
     (setq l (string-width s) b -1)
     (while (setq b (text-property-any (1+ b) (length s) 'org-dwidth t s))
       (setq l (- l (get-text-property b 'org-dwidth-n s))))
@@ -21467,11 +21480,9 @@ N may optionally be the number of spaces to remove."
 
 (defun org-fill-template (template alist)
   "Find each %key of ALIST in TEMPLATE and replace it."
-  (let ((case-fold-search nil)
-       entry key value)
-    (setq alist (sort (copy-sequence alist)
-                     (lambda (a b) (< (length (car a)) (length (car b))))))
-    (while (setq entry (pop alist))
+  (let ((case-fold-search nil))
+    (dolist (entry (sort (copy-sequence alist)
+                         (lambda (a b) (< (length (car a)) (length (car b))))))
       (setq template
            (replace-regexp-in-string
             (concat "%" (regexp-quote (car entry)))
@@ -21793,23 +21804,24 @@ block from point."
        "^[ \t]*:end:.*$"
        lim-up lim-down))))
 
-(defun org-occur-in-agenda-files (regexp &optional nlines)
+(defun org-occur-in-agenda-files (regexp &optional _nlines)
   "Call `multi-occur' with buffers for all agenda files."
-  (interactive "sOrg-files matching: \np")
+  (interactive "sOrg-files matching: ")
   (let* ((files (org-agenda-files))
-        (tnames (mapcar 'file-truename files))
-        (extra org-agenda-text-search-extra-files)
-        f)
+        (tnames (mapcar #'file-truename files))
+        (extra org-agenda-text-search-extra-files))
     (when (eq (car extra) 'agenda-archives)
       (setq extra (cdr extra))
       (setq files (org-add-archive-files files)))
-    (while (setq f (pop extra))
+    (dolist (f extra)
       (unless (member (file-truename f) tnames)
-       (add-to-list 'files f 'append)
-       (add-to-list 'tnames (file-truename f) 'append)))
+        (unless (member f files) (setq files (append files (list f))))
+        (setq tnames (append tnames (list (file-truename f))))))
     (multi-occur
      (mapcar (lambda (x)
               (with-current-buffer
+                   ;; FIXME: Why not just (find-file-noselect x)?
+                   ;; Is it to avoid the "revert buffer" prompt?
                   (or (get-file-buffer x) (find-file-noselect x))
                 (widen)
                 (current-buffer)))
@@ -21859,8 +21871,8 @@ for the search purpose."
 
 For example, in this alist:
 
-\(org-uniquify-alist '((a 1) (b 2) (a 3)))
-  => '((a 1 3) (b 2))
+\(org-uniquify-alist \\='((a 1) (b 2) (a 3)))
+  => \\='((a 1 3) (b 2))
 
 merge (a 1) and (a 3) into (a 1 3).
 
@@ -21994,7 +22006,7 @@ so values can contain further %-escapes if they are 
define later in TABLE."
        (case-fold-search nil)
         (pchg 0)
         e re rpl)
-    (while (setq e (pop tbl))
+    (dolist (e tbl)
       (setq re (concat "%-?[0-9.]*" (substring (car e) 1)))
       (when (and (cdr e) (string-match re (cdr e)))
         (let ((sref (substring (cdr e) (match-beginning 0) (match-end 0)))
@@ -22057,7 +22069,7 @@ This works in the calendar and in the agenda, anywhere 
else it just
 returns the current time.
 If WITH-TIME is non-nil, returns the time of the event at point (in
 the agenda) or the current time of the day."
-  (let (date day defd tp tm hod mod)
+  (let (date day defd tp hod mod)
     (when with-time
       (setq tp (get-text-property (point) 'time))
       (when (and tp (string-match "\\([0-9][0-9]\\):\\([0-9][0-9]\\)" tp))
@@ -22588,7 +22600,7 @@ If the line is empty, insert comment at its beginning."
   (insert "# "))
 
 (defvar comment-empty-lines)           ; From newcomment.el.
-(defun org-comment-or-uncomment-region (beg end &rest ignore)
+(defun org-comment-or-uncomment-region (beg end &rest _)
   "Comment or uncomment each non-blank line in the region.
 Uncomment each non-blank line between BEG and END if it only
 contains commented lines.  Otherwise, comment them."
@@ -22780,6 +22792,10 @@ this line is also exported in fixed-width font."
          (goto-char (match-end 0))
          (insert org-quote-string " ")))))))
 
+(defvar reftex-docstruct-symbol)
+(defvar reftex-cite-format)
+(defvar org--rds)
+
 (defun org-reftex-citation ()
   "Use reftex-citation to insert a citation into the buffer.
 This looks for a line like
@@ -22794,9 +22810,9 @@ into the buffer.
 Export of such citations to both LaTeX and HTML is handled by the contributed
 package ox-bibtex by Taru Karttunen."
   (interactive)
-  (let ((reftex-docstruct-symbol 'rds)
+  (let ((reftex-docstruct-symbol 'org--rds)
        (reftex-cite-format "\\cite{%l}")
-       rds bib)
+       org--rds bib)
     (save-excursion
       (save-restriction
        (widen)
@@ -22807,7 +22823,7 @@ package ox-bibtex by Taru Karttunen."
                         (re-search-backward re nil t))))
              (error "No bibliography defined in file")
            (setq bib (concat (match-string 1) ".bib")
-                 rds (list (list 'bib bib)))))))
+                 org--rds (list (list 'bib bib)))))))
     (call-interactively 'reftex-citation)))
 
 ;;;; Functions extending outline functionality
@@ -22924,20 +22940,20 @@ the cursor is already beyond the end of the headline."
 (define-key org-mode-map "\C-a" 'org-beginning-of-line)
 (define-key org-mode-map "\C-e" 'org-end-of-line)
 
-(defun org-backward-sentence (&optional arg)
+(defun org-backward-sentence (&optional _arg)
   "Go to beginning of sentence, or beginning of table field.
 This will call `backward-sentence' or `org-table-beginning-of-field',
 depending on context."
-  (interactive "P")
+  (interactive)
   (cond
    ((org-at-table-p) (call-interactively 'org-table-beginning-of-field))
    (t (call-interactively 'backward-sentence))))
 
-(defun org-forward-sentence (&optional arg)
+(defun org-forward-sentence (&optional _arg)
   "Go to end of sentence, or end of table field.
 This will call `forward-sentence' or `org-table-end-of-field',
 depending on context."
-  (interactive "P")
+  (interactive)
   (cond
    ((org-at-table-p) (call-interactively 'org-table-end-of-field))
    (t (call-interactively 'forward-sentence))))
@@ -22945,9 +22961,9 @@ depending on context."
 (define-key org-mode-map "\M-a" 'org-backward-sentence)
 (define-key org-mode-map "\M-e" 'org-forward-sentence)
 
-(defun org-kill-line (&optional arg)
+(defun org-kill-line (&optional _arg)
   "Kill line, to tags or end of line."
-  (interactive "P")
+  (interactive)
   (cond
    ((or (not org-special-ctrl-k)
        (bolp)
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el
index 98023a4..cea02ff 100644
--- a/lisp/org/ox-latex.el
+++ b/lisp/org/ox-latex.el
@@ -601,7 +601,7 @@ in order to mimic default behavior:
          title
          \(when tags
             \(format \"\\\\hfill{}\\\\textsc{:%s:}\"
-                    \(mapconcat 'identity tags \":\")))))
+                    \(mapconcat \\='identity tags \":\")))))
     \(format (concat \"\\\\begin{center}\\n\"
                    \"\\\\fbox{\\n\"
                    \"\\\\begin{minipage}[c]{.6\\\\textwidth}\\n\"
@@ -626,21 +626,21 @@ listings package, and if you want to have color, the color
 package.  Just add these to `org-latex-packages-alist', for
 example using customize, or with something like:
 
-  \(require 'ox-latex)
-  \(add-to-list 'org-latex-packages-alist '(\"\" \"listings\"))
-  \(add-to-list 'org-latex-packages-alist '(\"\" \"color\"))
+  \(require \\='ox-latex)
+  \(add-to-list \\='org-latex-packages-alist \\='(\"\" \"listings\"))
+  \(add-to-list \\='org-latex-packages-alist \\='(\"\" \"color\"))
 
 Alternatively,
 
-  \(setq org-latex-listings 'minted)
+  \(setq org-latex-listings \\='minted)
 
 causes source code to be exported using the minted package as
 opposed to listings.  If you want to use minted, you need to add
 the minted package to `org-latex-packages-alist', for example
 using customize, or with
 
-  \(require 'ox-latex)
-  \(add-to-list 'org-latex-packages-alist '(\"\" \"minted\"))
+  \(require \\='ox-latex)
+  \(add-to-list \\='org-latex-packages-alist \\='(\"\" \"minted\"))
 
 In addition, it is necessary to install pygments
 \(http://pygments.org), and to configure the variable
@@ -2846,7 +2846,7 @@ Return PDF file name or an error if it couldn't be 
produced."
                                (file-name-directory full-name)
                              default-directory))
         errors)
-    (unless snippet (message (format "Processing LaTeX file %s..." texfile)))
+    (unless snippet (message "Processing LaTeX file %s..." texfile))
     (save-window-excursion
       (cond
        ;; A function is provided: Apply it.
diff --git a/lisp/org/ox-man.el b/lisp/org/ox-man.el
index 2b8348f..8b4ddc7 100644
--- a/lisp/org/ox-man.el
+++ b/lisp/org/ox-man.el
@@ -1190,7 +1190,7 @@ Return PDF file name or an error if it couldn't be 
produced."
                                (file-name-directory full-name)
                              default-directory))
          errors)
-    (message (format "Processing Groff file %s..." file))
+    (message "Processing Groff file %s..." file)
     (save-window-excursion
       (cond
        ;; A function is provided: Apply it.
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el
index f1ef90e..a028142 100644
--- a/lisp/org/ox-odt.el
+++ b/lisp/org/ox-odt.el
@@ -1389,8 +1389,8 @@ original parsed data.  INFO is a plist holding export 
options."
         ((member styles-file-type '("odt" "ott"))
          (org-odt--zip-extract styles-file "styles.xml" org-odt-zip-dir)))))
      (t
-      (error (format "Invalid specification of styles.xml file: %S"
-                    org-odt-styles-file))))
+      (error "Invalid specification of styles.xml file: %S"
+             org-odt-styles-file)))
 
     ;; create a manifest entry for styles.xml
     (org-odt-create-manifest-file-entry "text/xml" "styles.xml")
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index f35df1b..08762fb 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -61,7 +61,7 @@ Blocks could hash sha1 values here.")
 
 (defcustom org-publish-project-alist nil
   "Association list to control publishing behavior.
-Each element of the alist is a publishing 'project.'  The CAR of
+Each element of the alist is a publishing “project”.  The CAR of
 each element is a string, uniquely identifying the project.  The
 CDR of each element is in one of the following forms:
 
@@ -711,7 +711,7 @@ If `:auto-sitemap' is set, publish the sitemap too.  If
 (defun org-publish-org-sitemap (project &optional sitemap-filename)
   "Create a sitemap of pages in set defined by PROJECT.
 Optionally set the filename of the sitemap with SITEMAP-FILENAME.
-Default for SITEMAP-FILENAME is 'sitemap.org'."
+Default for SITEMAP-FILENAME is `sitemap.org'."
   (let* ((project-plist (cdr project))
         (dir (file-name-as-directory
               (plist-get project-plist :base-directory)))
diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el
index 26f58ad..d5e650a 100644
--- a/lisp/org/ox-texinfo.el
+++ b/lisp/org/ox-texinfo.el
@@ -217,7 +217,7 @@ order to reproduce the default set-up:
          text
          \(when tags
             \(format \"\\\\hfill{}\\\\textsc{%s}\"
-              \(mapconcat 'identity tags \":\"))))"
+              \(mapconcat \\='identity tags \":\"))))"
   :group 'org-export-texinfo
   :type 'function)
 
@@ -347,7 +347,7 @@ in order to mimic default behavior:
          title
          \(when tags
             \(format \":%s:\"
-                    \(mapconcat 'identity tags \":\")))))
+                    \(mapconcat \\='identity tags \":\")))))
     \(format (concat \"@center %s\n\n\"
                    \"%s\"
                     \"\n\"))
@@ -1513,7 +1513,7 @@ Return INFO file name or an error if it couldn't be 
produced."
                                (file-name-directory full-name)
                              default-directory))
         errors)
-    (message (format "Processing Texinfo file %s..." file))
+    (message "Processing Texinfo file %s..." file)
     (save-window-excursion
       ;; Replace %b, %f and %o with appropriate values in each command
       ;; before applying it.  Output is redirected to "*Org INFO
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index efac2f8..a0573d0 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -1180,12 +1180,12 @@ keywords are understood:
 As an example, here is how one could define \"my-latex\" back-end
 as a variant of `latex' back-end with a custom template function:
 
-  \(org-export-define-derived-backend 'my-latex 'latex
-     :translate-alist '((template . my-latex-template-fun)))
+  \(org-export-define-derived-backend \\='my-latex \\='latex
+     :translate-alist \\='((template . my-latex-template-fun)))
 
 The back-end could then be called with, for example:
 
-  \(org-export-to-buffer 'my-latex \"*Test my-latex*\")"
+  \(org-export-to-buffer \\='my-latex \"*Test my-latex*\")"
   (declare (indent 2))
   (let (blocks filters menu-entry options transcoders contents)
     (while (keywordp (car body))
@@ -5553,7 +5553,7 @@ and `org-export-to-file' for more specialized functions."
                                       (kill-buffer proc-buffer))))
                            (org-export-add-to-stack proc-buffer nil p)
                            (ding)
-                           (message "Process '%s' exited abnormally" p))
+                           (message "Process ‘%s’ exited abnormally" p))
                        (unless org-export-async-debug
                          (delete-file ,,temp-file)))))))))))))
 
@@ -5589,7 +5589,7 @@ use it to set a major mode there, e.g,
   \(defun org-latex-export-as-latex
     \(&optional async subtreep visible-only body-only ext-plist)
     \(interactive)
-    \(org-export-to-buffer 'latex \"*Org LATEX Export*\"
+    \(org-export-to-buffer \\='latex \"*Org LATEX Export*\"
       async subtreep visible-only body-only ext-plist (lambda () 
(LaTeX-mode))))
 
 This function returns BUFFER."
@@ -5650,7 +5650,7 @@ to send the output file through additional processing, 
e.g,
     \(&optional async subtreep visible-only body-only ext-plist)
     \(interactive)
     \(let ((outfile (org-export-output-file-name \".tex\" subtreep)))
-      \(org-export-to-file 'latex outfile
+      \(org-export-to-file \\='latex outfile
         async subtreep visible-only body-only ext-plist
         \(lambda (file) (org-latex-compile file)))
 
diff --git a/lisp/outline.el b/lisp/outline.el
index 059ca62..d9142c5 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -449,8 +449,8 @@ Otherwise, it will be one level below."
           ;; Why bother checking that it is indeed higher/lower level ?
           new-head
         ;; Didn't work, so ask what to do.
-        (read-string (format "%s heading for `%s': "
-                             (if up "Parent" "Demoted") head)
+        (read-string (format-message "%s heading for `%s': "
+                                    (if up "Parent" "Demoted") head)
                      head nil nil t)))))
 
 (defun outline-promote (&optional which)
diff --git a/lisp/pcmpl-cvs.el b/lisp/pcmpl-cvs.el
index 6b63695..33446af 100644
--- a/lisp/pcmpl-cvs.el
+++ b/lisp/pcmpl-cvs.el
@@ -38,7 +38,7 @@
 ;; User Variables:
 
 (defcustom pcmpl-cvs-binary (or (executable-find "cvs") "cvs")
-  "The full path of the 'cvs' binary."
+  "The full path of the ‘cvs’ binary."
   :type 'file
   :group 'pcmpl-cvs)
 
@@ -154,7 +154,7 @@
 (defun pcmpl-cvs-entries (&optional opers)
   "Return the Entries for the current directory.
 If OPERS is a list of characters, return entries for which that
-operation character applies, as displayed by 'cvs -n update'."
+operation character applies, as displayed by ‘cvs -n update’."
   (let* ((arg (pcomplete-arg))
         (dir (file-name-as-directory
               (or (file-name-directory arg) "")))
diff --git a/lisp/pcmpl-x.el b/lisp/pcmpl-x.el
index 7072d92..e6fb5bf 100644
--- a/lisp/pcmpl-x.el
+++ b/lisp/pcmpl-x.el
@@ -223,7 +223,7 @@
 ;;;###autoload
 (defun pcomplete/ack ()
   "Completion for the `ack' command.
-Start an argument with '-' to complete short options and '--' for
+Start an argument with `-' to complete short options and `--' for
 long options."
   ;; No space after =
   (while t
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 7bcf2c1..65dd8e7 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -193,7 +193,7 @@ current command argument."
 
 (defcustom pcomplete-expand-before-complete nil
   "If non-nil, expand the current argument before completing it.
-This means that typing something such as '$HOME/bi' followed by
+This means that typing something such as `$HOME/bi' followed by
 \\[pcomplete-argument] will cause the variable reference to be
 resolved first, and the resultant value that will be completed against
 to be inserted in the buffer.  Note that exactly what gets expanded
@@ -1022,8 +1022,8 @@ string, use it as the completion stub instead of the 
default (which is
 the entire text of the current argument).
 
 For an example of when you might want to use STUB: if the current
-argument text is 'long-path-name/', you don't want the completions
-list display to be cluttered by 'long-path-name/' appearing at the
+argument text is `long-path-name/', you don't want the completions
+list display to be cluttered by `long-path-name/' appearing at the
 beginning of every alternative.  Not only does this make things less
 intelligible, but it is also inefficient.  Yet, if the completion list
 does not begin with this string for every entry, the current argument
@@ -1112,7 +1112,7 @@ Typing SPC flushes the help buffer."
                     (scroll-up))))
               (message ""))
              (t
-              (setq unread-command-events (list event))
+              (push event unread-command-events)
               (throw 'done nil)))))
       (if (and pcomplete-last-window-config
                pcomplete-restore-window-delay)
diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el
index 2c40310..5ca792d 100644
--- a/lisp/play/bubbles.el
+++ b/lisp/play/bubbles.el
@@ -101,31 +101,31 @@ and a shift mode."
   :group 'bubbles)
 
 (defun bubbles-set-game-easy ()
-  "Set game theme to 'easy'."
+  "Set game theme to ‘easy’."
   (interactive)
   (setq bubbles-game-theme 'easy)
   (bubbles))
 
 (defun bubbles-set-game-medium ()
-  "Set game theme to 'medium'."
+  "Set game theme to ‘medium’."
   (interactive)
   (setq bubbles-game-theme 'medium)
   (bubbles))
 
 (defun bubbles-set-game-difficult ()
-  "Set game theme to 'difficult'."
+  "Set game theme to ‘difficult’."
   (interactive)
   (setq bubbles-game-theme 'difficult)
   (bubbles))
 
 (defun bubbles-set-game-hard ()
-  "Set game theme to 'hard'."
+  "Set game theme to ‘hard’."
   (interactive)
   (setq bubbles-game-theme 'hard)
   (bubbles))
 
 (defun bubbles-set-game-userdefined ()
-  "Set game theme to 'user-defined'."
+  "Set game theme to ‘user-defined’."
   (interactive)
   (setq bubbles-game-theme 'user-defined)
   (bubbles))
diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el
index f42ae90..c2268a9 100644
--- a/lisp/play/decipher.el
+++ b/lisp/play/decipher.el
@@ -793,7 +793,7 @@ TOTAL is the total number of letters in the ciphertext."
         (insert (caar temp-list)
                 (format "%4d%3d%%  "
                         (cl-cadar temp-list)
-                        (/ (* 100 (cl-cadar temp-list)) total)))
+                        (floor (* 100.0 (cl-cadar temp-list)) total)))
         (setq temp-list (nthcdr 4 temp-list)))
       (insert ?\n)
       (setq freq-list (cdr freq-list)
@@ -957,7 +957,7 @@ Creates the statistics buffer if it doesn't exist."
                     ": A B C D E F G H I J K L M N O P Q R S T U V W X Y Z *"
                     (format "%4d %4d %3d%%\n  "
                             (cl-third entry) (cl-second entry)
-                            (/ (* 100 (cl-second entry)) total-chars))
+                            (floor (* 100.0 (cl-second entry)) total-chars))
                     (decipher--digram-counts (aref decipher--after  i)) ?\n))))
       (setq buffer-read-only t)
       (set-buffer-modified-p nil)
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el
index 877e5db..ba137f5 100644
--- a/lisp/play/dunnet.el
+++ b/lisp/play/dunnet.el
@@ -4,7 +4,7 @@
 
 ;; Author: Ron Schnell <address@hidden>
 ;; Created: 25 Jul 1992
-;; Version: 2.01
+;; Version: 2.02
 ;; Keywords: games
 
 ;; This file is part of GNU Emacs.
@@ -894,7 +894,7 @@ to swim.")
     (dun-mprincl " endgame points out of a possible 110.")
     (if (= (dun-endgame-score) 110)
        (dun-mprincl
-"\n\nCongratulations.  You have won.  The wizard password is 'moby'"))))
+"\n\nCongratulations.  You have won.  The wizard password is ‘moby’"))))
 
 (defun dun-help (args)
   (dun-mprincl
@@ -902,7 +902,7 @@ to swim.")
 Here is some useful information (read carefully because there are one
 or more clues in here):
 - If you have a key that can open a door, you do not need to explicitly
-  open it.  You may just use 'in' or walk in the direction of the door.
+  open it.  You may just use ‘in’ or walk in the direction of the door.
 
 - If you have a lamp, it is always lit.
 
@@ -916,8 +916,8 @@ or more clues in here):
   If this happens, your score will decrease, and in many cases you can never
   get credit for it again.
 
-- You can save your game with the 'save' command, and use restore it
-  with the 'restore' command.
+- You can save your game with the ‘save’ command, and use restore it
+  with the ‘restore’ command.
 
 - There are no limits on lengths of object names.
 
@@ -1053,7 +1053,7 @@ for a moment, then straighten yourself up.
 (if (not dun-endgame-questions)
     (progn
       (dun-mprincl "Your question is:")
-      (dun-mprincl "No more questions, just do 'answer foo'.")
+      (dun-mprincl "No more questions, just do ‘answer foo’.")
       (setq dun-correct-answer '("foo")))
   (let (which i newques)
     (setq i 0)
@@ -1464,8 +1464,8 @@ kept.  The exit is to the west."
 "You are in a computer room.  It seems like most of the equipment has
 been removed.  There is a VAX 11/780 in front of you, however, with
 one of the cabinets wide open.  A sign on the front of the machine
-says: This VAX is named 'pokey'.  To type on the console, use the
-'type' command.  The exit is to the east."
+says: This VAX is named ‘pokey’.  To type on the console, use the
+‘type’ command.  The exit is to the east."
                "Computer room"
               )
              (
@@ -1475,7 +1475,7 @@ to the west, and a door leads to the south."
               )
              (
 "You are in a round, stone room with a door to the east.  There
-is a sign on the wall that reads: 'receiving room'."
+is a sign on the wall that reads: ‘receiving room’."
                "Receiving room"
               )
              (
@@ -1552,7 +1552,7 @@ northeast through the brush you can see the bear hangout."
              (
 "The entrance to a cave is to the south.  To the north, a road leads
 towards a deep lake.  On the ground nearby there is a chute, with a sign
-that says 'put treasures here for points'."
+that says ‘put treasures here for points’."
                "Cave Entrance"                      ;28
               )
              (
@@ -1831,13 +1831,13 @@ starvation.  Doors lead out to the south and east."
               )
              (
 "You are in some sort of maintenance room for the museum.  There is a
-switch on the wall labeled 'BL'.  There are doors to the west and north."
+switch on the wall labeled ‘BL’.  There are doors to the west and north."
                "Maintenance room"                   ;87
               )
              (
 "You are in a classroom where school children were taught about natural
-history.  On the blackboard is written, 'No children allowed downstairs.'
-There is a door to the east with an 'exit' sign on it.  There is another
+history.  On the blackboard is written, ‘No children allowed downstairs.’
+There is a door to the east with an ‘exit’ sign on it.  There is another
 door to the west."
                "Classroom"                          ;88
               )
@@ -1871,7 +1871,7 @@ a room to the northeast."
              (
 "You are in another computer room.  There is a computer in here larger
 than you have ever seen.  It has no manufacturers name on it, but it
-does have a sign that says: This machine's name is 'endgame'.  The
+does have a sign that says: This machine's name is ‘endgame’.  The
 exit is to the southwest.  There is no console here on which you could
 type."
                "Endgame computer room"         ;95
@@ -1882,7 +1882,7 @@ type."
               )
              (
 "You have reached a question room.  You must answer a question correctly in
-order to get by.  Use the 'answer' command to answer the question."
+order to get by.  Use the ‘answer’ command to answer the question."
                "Question room 1"              ;97
               )
              (
@@ -1913,7 +1913,7 @@ a hallway leads to the south."
              (
 "You have reached a dead end.  There is a PC on the floor here.  Above
 it is a sign that reads:
-          Type the 'reset' command to type on the PC.
+          Type the ‘reset’ command to type on the PC.
 A hole leads north."
                "PC area"                       ;104
                )
@@ -2357,8 +2357,8 @@ nil))
 2 Megabytes of RAM onboard."
 "It looks like some kind of meat.  Smells pretty bad."
 nil
-"The paper says: Don't forget to type 'help' for help.  Also, remember
-this word: 'worms'"
+"The paper says: Don't forget to type ‘help’ for help.  Also, remember
+this word: ‘worms’"
 "The statuette is of the likeness of Richard Stallman, the author of the
 famous EMACS editor.  You notice that he is not wearing any shoes."
 nil
@@ -2414,10 +2414,10 @@ flush handle is so clean that you can see your 
reflection in it."
 nil
 nil
 "The box has a slit in the top of it, and on it, in sloppy handwriting, is
-written: 'For key upgrade, put key in here.'"
+written: ‘For key upgrade, put key in here.’"
 nil
-"It says 'express mail' on it."
-"It is a 35 passenger bus with the company name 'mobytours' on it."
+"It says ‘express mail’ on it."
+"It is a 35 passenger bus with the company name ‘mobytours’ on it."
 "It is a large metal gate that is too big to climb over."
 "It is a HIGH cliff."
 "Unfortunately you do not know enough about dinosaurs to tell very much about
@@ -2449,14 +2449,14 @@ nil
 
 (setq dun-endgame-questions '(
                          (
-"What is your password on the machine called 'pokey'?" "robert")
+"What is your password on the machine called ‘pokey’?" "robert")
                          (
 "What password did you use during anonymous ftp to gamma?" "foo")
                          (
 "Excluding the endgame, how many places are there where you can put
 treasures for points?" "4" "four")
                          (
-"What is your login name on the 'endgame' machine?" "toukmond"
+"What is your login name on the ‘endgame’ machine?" "toukmond"
 )
                          (
 "What is the nearest whole dollar to the price of the shovel?" "20" "twenty")
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el
index 8e6165f..702376c 100644
--- a/lisp/play/gomoku.el
+++ b/lisp/play/gomoku.el
@@ -977,7 +977,7 @@ If the game is finished, this command requests for another 
game."
   (move-to-column (+ gomoku-x-offset (* gomoku-square-width (1- x)))))
 
 (defun gomoku-plot-square (square value)
-  "Draw 'X', 'O' or '.' on SQUARE depending on VALUE, leave point there."
+  "Draw ‘X’, ‘O’ or ‘.’ on SQUARE depending on VALUE, leave point there."
   (or (= value 1)
       (gomoku-goto-square square))
   (let ((inhibit-read-only t))
diff --git a/lisp/play/morse.el b/lisp/play/morse.el
index 5352341..bbd3e6b 100644
--- a/lisp/play/morse.el
+++ b/lisp/play/morse.el
@@ -144,7 +144,7 @@
                        (")" . "Close")
                        ("@" . "At"))
   "NATO phonetic alphabet.
-See ''International Code of Signals'' (INTERCO), United States
+See “International Code of Signals” (INTERCO), United States
 Edition, 1969 Edition (Revised 2003) available from National
 Geospatial-Intelligence Agency at URL `http://www.nga.mil/'")
 
diff --git a/lisp/printing.el b/lisp/printing.el
index 86d569a..8ad56f4 100644
--- a/lisp/printing.el
+++ b/lisp/printing.el
@@ -5542,8 +5542,8 @@ If menu binding was not done, calls `pr-menu-bind'."
                 ((file-exists-p res)
                  (ding)
                  (setq prompt "exists")
-                 (not (y-or-n-p (format "File `%s' exists; overwrite? "
-                                        res))))
+                 (not (y-or-n-p (format-message
+                                 "File `%s' exists; overwrite? " res))))
                 (t nil))
       (setq res (read-file-name
                 (format "File %s; PostScript file: " prompt)
@@ -6540,8 +6540,8 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
        ((or (not (file-exists-p pr-i-out-file))
             pr-i-answer-yes
             (setq pr-i-answer-yes
-                  (y-or-n-p (format "File `%s' exists; overwrite? "
-                                    pr-i-out-file))))
+                  (y-or-n-p (format-message "File `%s' exists; overwrite? "
+                                            pr-i-out-file))))
         pr-i-out-file)
        (t
         (error "File already exists"))))
diff --git a/lisp/proced.el b/lisp/proced.el
index 69355ab..5c65edf 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1915,7 +1915,7 @@ and \f (formfeed) at the end."
       (let (buffer-read-only)
        (cond ((stringp log)
               (insert (if args
-                          (apply 'format log args)
+                          (apply #'format-message log args)
                         log)))
              ((bufferp log)
               (insert-buffer-substring log))
@@ -1924,8 +1924,8 @@ and \f (formfeed) at the end."
               (unless (bolp)
                 (insert "\n"))
               (insert (current-time-string)
-                      "\tBuffer `" (buffer-name obuf) "', "
-                       (format "signal `%s'\n" (car args)))
+                      (format-message "\tBuffer ‘%s’, signal ‘%s’\n"
+                                      (buffer-name obuf) (car args)))
               (goto-char (point-max))
               (insert "\f\n")))))))
 
diff --git a/lisp/profiler.el b/lisp/profiler.el
index 2425d8c..f28bbfe 100644
--- a/lisp/profiler.el
+++ b/lisp/profiler.el
@@ -56,7 +56,7 @@
         (format "%s" object))))
 
 (defun profiler-format-percent (number divisor)
-  (concat (number-to-string (/ (* number 100) divisor)) "%"))
+  (format "%d%%" (floor (* 100.0 number) divisor)))
 
 (defun profiler-format-number (number)
   "Format NUMBER in human readable string."
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index c1bc79c..70af389 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -286,11 +286,11 @@ type A is
   :type 'boolean :group 'ada)
 
 (defcustom ada-indent-is-separate t
-  "Non-nil means indent 'is separate' or 'is abstract' if on a single line."
+  "Non-nil means indent ‘is separate’ or ‘is abstract’ if on a single line."
   :type 'boolean :group 'ada)
 
 (defcustom ada-indent-record-rel-type 3
-  "Indentation for 'record' relative to 'type' or 'use'.
+  "Indentation for ‘record’ relative to ‘type’ or ‘use’.
 
 An example is:
    type A is
@@ -309,7 +309,7 @@ An example is:
   :type 'integer :group 'ada)
 
 (defcustom ada-indent-return 0
-  "Indentation for 'return' relative to the matching 'function' statement.
+  "Indentation for `return' relative to the matching `function' statement.
 If `ada-indent-return' is null or negative, the indentation is done relative to
 the open parenthesis (if there is no parenthesis, `ada-broken-indent' is used).
 
@@ -349,7 +349,7 @@ This is also used for <<..>> labels"
   :type '(choice (const ada83) (const ada95) (const ada2005)) :group 'ada)
 
 (defcustom ada-move-to-declaration nil
-  "Non-nil means `ada-move-to-start' moves to the subprogram declaration, not 
to 'begin'."
+  "Non-nil means `ada-move-to-start' moves to the subprogram declaration, not 
to `begin'."
   :type 'boolean :group 'ada)
 
 (defcustom ada-popup-key '[down-mouse-3]
@@ -397,7 +397,7 @@ Must be one of :
   :group 'ada)
 
 (defcustom ada-use-indent ada-broken-indent
-  "Indentation for the lines in a 'use' statement.
+  "Indentation for the lines in a ‘use’ statement.
 
 An example is:
    use Ada.Text_IO,
@@ -405,7 +405,7 @@ An example is:
   :type 'integer :group 'ada)
 
 (defcustom ada-when-indent 3
-  "Indentation for 'when' relative to 'exception' or 'case'.
+  "Indentation for ‘when’ relative to ‘exception’ or ‘case’.
 
 An example is:
    case A is
@@ -413,7 +413,7 @@ An example is:
   :type 'integer :group 'ada)
 
 (defcustom ada-with-indent ada-broken-indent
-  "Indentation for the lines in a 'with' statement.
+  "Indentation for the lines in a ‘with’ statement.
 
 An example is:
    with Ada.Text_IO,
@@ -493,7 +493,7 @@ Used to define `ada-*-keywords.'"))
   "Alist of substrings (entities) that have special casing.
 The substrings are detected for word constituent when the word
 is not itself in `ada-case-exception', and only for substrings that
-either are at the beginning or end of the word, or start after '_'.")
+either are at the beginning or end of the word, or start after `_'.")
 
 (defvar ada-lfd-binding nil
   "Variable to save key binding of LFD when casing is activated.")
@@ -1689,7 +1689,7 @@ See also `ada-auto-case' to disable auto casing 
altogether."
   nil)
 
 (defun ada-capitalize-word (&optional _arg)
-  "Upcase first letter and letters following '_', lower case other letters.
+  "Upcase first letter and letters following `_', lower case other letters.
 ARG is ignored, and is there for compatibility with `capitalize-word' only."
   (interactive)
   (let ((end   (save-excursion (skip-syntax-forward  "w") (point)))
@@ -2834,7 +2834,7 @@ ORGPOINT is the limit position used in the calculation."
       (save-excursion
        (goto-char (car match-cons))
        (unless (ada-search-ignore-string-comment "when" t opos)
-         (error "Missing 'when' between 'case' and '=>'"))
+         (error "Missing ‘when’ between ‘case’ and ‘=>’"))
        (list (save-excursion (back-to-indentation) (point)) 'ada-indent)))
      ;;
      ;; case..is..when
@@ -3003,7 +3003,7 @@ ORGPOINT is the limit position used in the calculation."
       (list cur-indent 'ada-broken-indent)))))
 
 (defun ada-get-indent-noindent (orgpoint)
-  "Calculate the indentation when point is just before a 'noindent stmt'.
+  "Calculate the indentation when point is just before a ‘noindent stmt’.
 ORGPOINT is the limit position used in the calculation."
   (let ((label 0))
     (save-excursion
@@ -3429,7 +3429,7 @@ Return the new position of point or nil if not found."
 Moves point to the matching block start."
   (ada-goto-matching-start 0)
   (unless (looking-at (concat "\\<" keyword "\\>"))
-    (error "Matching start is not '%s'" keyword)))
+    (error "Matching start is not ‘%s’" keyword)))
 
 
 (defun ada-check-defun-name (defun-name)
@@ -3667,7 +3667,7 @@ otherwise throw error."
   "Move point to the beginning of a block-start.
 Which block depends on the value of NEST-LEVEL, which defaults to zero.
 If NOERROR is non-nil, it only returns nil if no matching start was found.
-If GOTOTHEN is non-nil, point moves to the 'then' following 'if'."
+If GOTOTHEN is non-nil, point moves to the ‘then’ following ‘if’."
   (let ((nest-count (if nest-level nest-level 0))
        (found nil)
 
@@ -3734,7 +3734,7 @@ If GOTOTHEN is non-nil, point moves to the 'then' 
following 'if'."
                (if pos
                    (goto-char (car pos))
                  (error (concat
-                         "No matching 'is' or 'renames' for 'package' at"
+                         "No matching ‘is’ or ‘renames’ for ‘package’ at"
                          " line "
                          (number-to-string (count-lines 1 (1+ current)))))))
              (unless (looking-at "renames")
@@ -3862,7 +3862,7 @@ If GOTOTHEN is non-nil, point moves to the 'then' 
following 'if'."
             ((looking-at "do")
              (unless (ada-search-ignore-string-comment
                       "\\<accept\\|return\\>" t)
-               (error "Missing 'accept' or 'return' in front of 'do'"))))
+               (error "Missing ‘accept’ or ‘return’ in front of ‘do’"))))
            (point))
 
        (if noerror
@@ -4073,7 +4073,7 @@ Assumes point to be at the end of a statement."
 
 
 (defun ada-looking-at-semi-or ()
-  "Return t if looking at an 'or' following a semicolon."
+  "Return t if looking at an ‘or’ following a semicolon."
   (save-excursion
     (and (looking-at "\\<or\\>")
         (progn
@@ -4146,7 +4146,7 @@ Return nil if the private is part of the package name, as 
in
                           "type\\)\\>"))))))
 
 (defun ada-search-ignore-complex-boolean (regexp backwardp)
-  "Search for REGEXP, ignoring comments, strings, 'and then', 'or else'.
+  "Search for REGEXP, ignoring comments, strings, ‘and then’, ‘or else’.
 If BACKWARDP is non-nil, search backward; search forward otherwise."
   (let (result)
   (while (and (setq result (ada-search-ignore-string-comment regexp backwardp))
@@ -4366,7 +4366,7 @@ of the region.  Otherwise, operate only on the current 
line."
 
 (defun ada-move-to-end ()
   "Move point to the end of the block around point.
-Moves to 'begin' if in a declarative part."
+Moves to ‘begin’ if in a declarative part."
   (interactive)
   (let ((pos (point))
        decl-start)
diff --git a/lisp/progmodes/ada-prj.el b/lisp/progmodes/ada-prj.el
index 4b1c1c2..7e354bc 100644
--- a/lisp/progmodes/ada-prj.el
+++ b/lisp/progmodes/ada-prj.el
@@ -309,13 +309,13 @@ where the compilation is done.")
 "If you want to remotely compile, debug and
 run your application, specify the name of a
 remote machine here. This capability requires
-the 'rsh' protocol on the remote machine.")
+the ‘rsh’ protocol on the remote machine.")
     (ada-prj-field 'cross_prefix "Prefix used in for the cross tool chain"
 "When working on multiple cross targets, it is
 most convenient to specify the prefix of the
 tool chain here. For instance, on PowerPc
-vxworks, you would enter 'powerpc-wrs-vxworks-'.
-To use JGNAT, enter 'j'.")
+vxworks, you would enter ‘powerpc-wrs-vxworks-’.
+To use JGNAT, enter ‘j’.")
     )
 
 
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index 771dc2a..6f2f78f 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -236,7 +236,7 @@ we need to use `/d' or the drive is never changed.")
   "Associative list of project files with properties.
 It has the format: (project project ...)
 A project has the format: (project-file . project-plist)
-\(See 'apropos plist' for operations on property lists).
+\(See `apropos plist' for operations on property lists).
 See `ada-default-prj-properties' for the list of valid properties.
 The current project is retrieved with `ada-xref-current-project'.
 Properties are retrieved with `ada-xref-get-project-field', set with
@@ -286,7 +286,7 @@ On Windows systems, this will properly handle .exe 
extension as well."
                    (ada-find-file-in-dir (concat exec-name ".exe") 
exec-path))))
     (if result
        result
-      (error "'%s' not found in path" exec-name))))
+      (error "‘%s’ not found in path" exec-name))))
 
 (defun ada-initialize-runtime-library (cross-prefix)
   "Initialize the variables for the runtime library location.
@@ -667,7 +667,7 @@ the same base name as the Ada file, but extension given by
 `ada-prj-file-extension' (default .adp).  If not found, search for *.adp
 in the current directory; if several are found, and NO-USER-QUESTION
 is non-nil, prompt the user to select one.  If none are found, return
-'default.adp'."
+\"default.adp\"."
 
   (let (selected)
 
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el
index 28049e9..d59948e 100644
--- a/lisp/progmodes/antlr-mode.el
+++ b/lisp/progmodes/antlr-mode.el
@@ -448,7 +448,7 @@ The standard value is (\"file\" \"grammar\" \"rule\" 
\"subrule\").  See
             "Generate default exception handler for each rule? "))
      ("codeGenMakeSwitchThreshold" nil
       (20600 antlr-read-value
-            "Min number of alternatives for 'switch': "))
+            "Min number of alternatives for `switch': "))
      ("codeGenBitsetTestThreshold" nil
       (20600 antlr-read-value
             "Min size of lookahead set for bitset test: "))
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index 53d2958..a78c57c 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -58,7 +58,7 @@ It can use `match-string' to get parts matched against
 There is no default setting for this, it must be set per file.
 If you set it to a symbol in the file Local Variables section,
 you need to add a `bug-reference-url-format' property to it:
-\(put 'my-bug-reference-url-format 'bug-reference-url-format t)
+\(put \\='my-bug-reference-url-format \\='bug-reference-url-format t)
 so that it is considered safe, see `enable-local-variables'.")
 
 ;;;###autoload
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el
index 4db310d..b0c4a64 100644
--- a/lisp/progmodes/cc-align.el
+++ b/lisp/progmodes/cc-align.el
@@ -325,10 +325,10 @@ operator you typically want to use it together with some 
other line-up
 settings, e.g. as follows \(the arglist-close setting is just a
 suggestion to get a consistent style):
 
-\(c-set-offset 'arglist-cont '(c-lineup-arglist-operators 0))
-\(c-set-offset 'arglist-cont-nonempty '(c-lineup-arglist-operators
+\(c-set-offset \\='arglist-cont \\='(c-lineup-arglist-operators 0))
+\(c-set-offset \\='arglist-cont-nonempty \\='(c-lineup-arglist-operators
                                         c-lineup-arglist))
-\(c-set-offset 'arglist-close '(c-lineup-arglist-close-under-paren))
+\(c-set-offset \\='arglist-close \\='(c-lineup-arglist-close-under-paren))
 
 Works with: arglist-cont, arglist-cont-nonempty."
   (save-excursion
@@ -1345,8 +1345,8 @@ For other semicolon contexts, no determination is made."
 
 (cc-provide 'cc-align)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-align.el ends here
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el
index ad02485..337fdc8 100644
--- a/lisp/progmodes/cc-awk.el
+++ b/lisp/progmodes/cc-awk.el
@@ -1147,8 +1147,8 @@ comment at the start of cc-engine.el for more info."
 
 (cc-provide 'cc-awk)                   ; Changed from 'awk-mode, ACM 2002/5/21
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; awk-mode.el ends here
diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el
index b63eeb4..81b7a82 100644
--- a/lisp/progmodes/cc-bytecomp.el
+++ b/lisp/progmodes/cc-bytecomp.el
@@ -439,8 +439,8 @@ exclude any functions that have been bound during 
compilation with
 
 (provide 'cc-bytecomp)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-bytecomp.el ends here
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 94dc34b..0e249bd 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1809,7 +1809,7 @@ with a brace block."
   (c-save-buffer-state
       (beginning-of-defun-function end-of-defun-function
        where pos name-end case-fold-search)
- 
+
     (save-restriction
       (widen)
       (save-excursion
@@ -2853,19 +2853,28 @@ sentence motion in or near comments and multiline 
strings."
 
 ;; set up electric character functions to work with pending-del,
 ;; (a.k.a. delsel) mode.  All symbols get the t value except
-;; the functions which delete, which gets 'supersede.
+;; the functions which delete, which gets 'supersede, and (from Emacs
+;; 25) `c-electric-brace' and `c-electric-paren' get special handling
+;; so as to work gracefully with `electric-pair-mode'.
 (mapc
  (function
   (lambda (sym)
     (put sym 'delete-selection t)      ; for delsel (Emacs)
     (put sym 'pending-delete t)))      ; for pending-del (XEmacs)
  '(c-electric-pound
-   c-electric-brace
    c-electric-slash
    c-electric-star
    c-electric-semi&comma
    c-electric-lt-gt
-   c-electric-colon
+   c-electric-colon))
+(mapc
+ (function
+  (lambda (sym)
+    (put sym 'delete-selection (if (fboundp 'delete-selection-uses-region-p)
+                                  'delete-selection-uses-region-p
+                                t))
+    (put sym 'pending-delete t)))
+ '(c-electric-brace
    c-electric-paren))
 (put 'c-electric-delete    'delete-selection 'supersede) ; delsel
 (put 'c-electric-delete    'pending-delete   'supersede) ; pending-del
@@ -3412,7 +3421,7 @@ Otherwise reindent just the current line."
       (if (< c-progress-interval (- now lastsecs))
          (progn
            (message "Indenting region... (%d%% complete)"
-                    (/ (* 100 (- (point) start)) (- end start)))
+                    (floor (* 100.0 (- (point) start)) (- end start)))
            (aset c-progress-info 2 now)))
       )))
 
@@ -4760,8 +4769,8 @@ normally bound to C-o.  See `c-context-line-break' for 
the details."
 
 (cc-provide 'cc-cmds)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-cmds.el ends here
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index fd4bfb3..0422ca0 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -43,7 +43,23 @@
           load-path)))
     (load "cc-bytecomp" nil t)))
 
-(eval-when-compile (require 'cl)) ; was (cc-external-require 'cl).  ACM 
2005/11/29.
+(eval-and-compile
+  (defvar c--mapcan-status
+    (cond ((and (fboundp 'mapcan)
+               (subrp (symbol-function 'mapcan)))
+          ;; XEmacs
+          'mapcan)
+         ((locate-file "cl-lib.elc" load-path)
+          ;; Emacs >= 24.3
+          'cl-mapcan)
+         (t
+          ;; Emacs <= 24.2
+          nil))))
+
+(cc-external-require (if (eq c--mapcan-status 'cl-mapcan) 'cl-lib 'cl))
+; was (cc-external-require 'cl).  ACM 2005/11/29.
+; Changed from (eval-when-compile (require 'cl)) back to
+; cc-external-require, 2015-08-12.
 (cc-external-require 'regexp-opt)
 
 ;; Silence the compiler.
@@ -173,12 +189,47 @@ This variant works around bugs in `eval-when-compile' in 
various
 
   (put 'cc-eval-when-compile 'lisp-indent-hook 0))
 
-(eval-and-compile
-  (defalias 'c--macroexpand-all
-    (if (fboundp 'macroexpand-all)
-        'macroexpand-all 'cl-macroexpand-all)))
 
 ;;; Macros.
+(defmacro c--mapcan (fun liszt)
+  ;; CC Mode equivalent of `mapcan' which bridges the difference
+  ;; between the host [X]Emacsen."
+  ;; The motivation for this macro is to avoid the irritating message
+  ;; "function `mapcan' from cl package called at runtime" produced by Emacs.
+  (cond
+   ((eq c--mapcan-status 'mapcan)
+    `(mapcan ,fun ,liszt))
+   ((eq c--mapcan-status 'cl-mapcan)
+    `(cl-mapcan ,fun ,liszt))
+   (t
+    ;; Emacs <= 24.2.  It would be nice to be able to distinguish between
+    ;; compile-time and run-time use here.
+    `(apply 'nconc (mapcar ,fun ,liszt)))))
+
+(defmacro c--set-difference (liszt1 liszt2 &rest other-args)
+  ;; Macro to smooth out the renaming of `set-difference' in Emacs 24.3.
+  (if (eq c--mapcan-status 'cl-mapcan)
+      `(cl-set-difference ,liszt1 ,liszt2 ,@other-args)
+    `(set-difference ,liszt1 ,liszt2 ,@other-args)))
+
+(defmacro c--intersection (liszt1 liszt2 &rest other-args)
+  ;; Macro to smooth out the renaming of `intersection' in Emacs 24.3.
+  (if (eq c--mapcan-status 'cl-mapcan)
+      `(cl-intersection ,liszt1 ,liszt2 ,@other-args)
+    `(intersection ,liszt1 ,liszt2 ,@other-args)))
+
+(eval-and-compile
+  (defmacro c--macroexpand-all (form &optional environment)
+    ;; Macro to smooth out the renaming of `cl-macroexpand-all' in Emacs 24.3.
+    (if (eq c--mapcan-status 'cl-mapcan)
+       `(macroexpand-all ,form ,environment)
+      `(cl-macroexpand-all ,form ,environment)))
+
+  (defmacro c--delete-duplicates (cl-seq &rest cl-keys)
+    ;; Macro to smooth out the renaming of `delete-duplicates' in Emacs 24.3.
+    (if (eq c--mapcan-status 'cl-mapcan)
+       `(cl-delete-duplicates ,cl-seq ,@cl-keys)
+      `(delete-duplicates ,cl-seq ,@cl-keys))))
 
 (defmacro c-point (position &optional point)
   "Return the value of certain commonly referenced POSITIONs relative to POINT.
@@ -1591,11 +1642,11 @@ surrounds the matched alternative, and the regexp will 
also not match
 a prefix of any identifier.  Adorned regexps cannot be appended.  The
 language variable `c-nonsymbol-key' is used to make the adornment.
 
-A value 'appendable for ADORN is like above, but all alternatives in
+A value `appendable' for ADORN is like above, but all alternatives in
 the list that end with a word constituent char will have \\> appended
 instead, so that the regexp remains appendable.  Note that this
 variant doesn't always guarantee that an identifier prefix isn't
-matched since the symbol constituent '_' is normally considered a
+matched since the symbol constituent `_' is normally considered a
 nonword token by \\>.
 
 The optional MODE specifies the language to get `c-nonsymbol-key' from
@@ -1869,30 +1920,30 @@ There are many flavors of Emacs out there, each with 
different
 features supporting those needed by CC Mode.  The following values
 might be present:
 
-'8-bit              8 bit syntax entry flags (XEmacs style).
-'1-bit              1 bit syntax entry flags (Emacs style).
-'argumentative-bod-function        beginning-of-defun and end-of-defun pass
+`8-bit'             8 bit syntax entry flags (XEmacs style).
+`1-bit'             1 bit syntax entry flags (Emacs style).
+`argumentative-bod-function'    beginning-of-defun and end-of-defun pass
                    ARG through to beginning/end-of-defun-function.
-'syntax-properties  It works to override the syntax for specific characters
-                   in the buffer with the 'syntax-table property.  It's
+`syntax-properties' It works to override the syntax for specific characters
+                   in the buffer with the `syntax-table' property.  It's
                    always set - CC Mode no longer works in emacsen without
                    this feature.
-'category-properties Syntax routines can add a level of indirection to text
-                   properties using the 'category property.
-'gen-comment-delim  Generic comment delimiters work
+`category-properties' Syntax routines can add a level of indirection to text
+                   properties using the `category' property.
+`gen-comment-delim' Generic comment delimiters work
                    (i.e. the syntax class `!').
-'gen-string-delim   Generic string delimiters work
+`gen-string-delim'  Generic string delimiters work
                    (i.e. the syntax class `|').
-'pps-extended-state `parse-partial-sexp' returns a list with at least 10
+`pps-extended-state' `parse-partial-sexp' returns a list with at least 10
                    elements, i.e. it contains the position of the start of
                    the last comment or string.  It's always set - CC Mode
                     no longer works in emacsen without this feature.
-'posix-char-classes The regexp engine understands POSIX character classes.
-'col-0-paren        It's possible to turn off the ad-hoc rule that a paren
+`posix-char-classes' The regexp engine understands POSIX character classes.
+`col-0-paren'       It's possible to turn off the ad-hoc rule that a paren
                    in column zero is the start of a defun.
-'infodock           This is Infodock (based on XEmacs).
+`infodock'           This is Infodock (based on XEmacs).
 
-'8-bit and '1-bit are mutually exclusive.")
+`8-bit' and `1-bit' are mutually exclusive.")
 
 
 ;;; Some helper constants.
@@ -2228,12 +2279,12 @@ quoted."
                ;; are no file dependencies needed.
                (nreverse
                 ;; Reverse to get the right load order.
-                (apply 'nconc
-                       (mapcar (lambda (elem)
-                                 (if (eq file (car elem))
-                                     nil ; Exclude our own file.
-                                   (list (car elem))))
-                               (get sym 'source))))))
+               (c--mapcan (lambda (elem)
+                            (if (eq file (car elem))
+                                nil    ; Exclude our own file.
+                              (list (car elem))))
+                          (get sym 'source)))))
+
             ;; Make some effort to do a compact call to
             ;; `c-get-lang-constant' since it will be compiled in.
             (args (and mode `(',mode))))
@@ -2446,8 +2497,8 @@ fallback definition for all modes, to break the cycle).")
 
 (cc-provide 'cc-defs)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-defs.el ends here
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 06b03a2..1223db3 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -154,12 +154,12 @@
 
 (defmacro c-declare-lang-variables ()
   `(progn
-     ,@(mapcan (lambda (init)
-                `(,(if (elt init 2)
-                       `(defvar ,(car init) nil ,(elt init 2))
-                     `(defvar ,(car init) nil))
-                  (make-variable-buffer-local ',(car init))))
-              (cdr c-lang-variable-inits))))
+     ,@(c--mapcan (lambda (init)
+                   `(,(if (elt init 2)
+                          `(defvar ,(car init) nil ,(elt init 2))
+                        `(defvar ,(car init) nil))
+                     (make-variable-buffer-local ',(car init))))
+                (cdr c-lang-variable-inits))))
 (c-declare-lang-variables)
 
 
@@ -671,8 +671,8 @@ position if that is less ('same is returned in this case).
 
 NOERROR turns off error logging to `c-parsing-error'.
 
-Normally only ';' and virtual semicolons are considered to delimit
-statements, but if COMMA-DELIM is non-nil then ',' is treated
+Normally only `;' and virtual semicolons are considered to delimit
+statements, but if COMMA-DELIM is non-nil then `,' is treated
 as a delimiter too.
 
 Note that this function might do hidden buffer changes.  See the
@@ -3135,16 +3135,20 @@ comment at the start of cc-engine.el for more info."
        nil))                           ; for the cond
 
      ((save-restriction
-        (narrow-to-region too-far-back (point-max))
-        (setq ren (c-safe (c-sc-scan-lists pos -1 -1))))
-
+       (narrow-to-region too-far-back (point-max))
+       (setq ren (c-safe (c-sc-scan-lists pos -1 -1))))
       ;; CASE 3: After a }/)/] before `here''s BOL.
       (list (1+ ren) (and dropped-cons pos) nil)) ; Return value
 
+     ((progn (setq good-pos (c-state-lit-beg (c-point 'bopl here-bol)))
+            (>= cache-pos good-pos))
+      ;; CASE 3.5: Just after an existing entry in `c-state-cache' on `here''s
+      ;; line or the previous line.
+      (list cache-pos nil nil))
+
      (t
       ;; CASE 4; Best of a bad job: BOL before `here-bol', or beginning of
       ;; literal containing it.
-      (setq good-pos (c-state-lit-beg (c-point 'bopl here-bol)))
       (list good-pos (and dropped-cons good-pos) nil)))))
 
 
@@ -4612,7 +4616,7 @@ comment at the start of cc-engine.el for more info."
 (defun c-literal-type (range)
   "Convenience function that given the result of `c-literal-limits',
 returns nil or the type of literal that the range surrounds, one
-of the symbols 'c, 'c++ or 'string.  It's much faster than using
+of the symbols `c', `c++' or `string'.  It's much faster than using
 `c-in-literal' and is intended to be used when you need both the
 type of a literal and its limits.
 
@@ -11228,8 +11232,8 @@ Cannot combine absolute offsets %S and %S in `add' 
method"
 
 (cc-provide 'cc-engine)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-engine.el ends here
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index ad564f7..f05d6a0 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1140,6 +1140,7 @@ casts and declarations are fontified.  Used on level 2 
and higher."
                             (looking-at "{"))
                        (c-safe (c-forward-sexp) t) ; over { .... }
                      t)
+                   (< (point) limit)
                    ;; FIXME: Should look for c-decl-end markers here;
                    ;; we might go far into the following declarations
                    ;; in e.g. ObjC mode (see e.g. methods-4.m).
@@ -1957,19 +1958,18 @@ higher."
              (cdr-safe (or (assq c-buffer-is-cc-mode c-doc-comment-style)
                            (assq 'other c-doc-comment-style)))
            c-doc-comment-style))
-        (list (nconc (apply 'nconc
-                            (mapcar
-                             (lambda (doc-style)
-                               (let ((sym (intern
-                                           (concat (symbol-name doc-style)
-                                                   "-font-lock-keywords"))))
-                                 (cond ((fboundp sym)
-                                        (funcall sym))
-                                       ((boundp sym)
-                                        (append (eval sym) nil)))))
-                             (if (listp doc-keywords)
-                                 doc-keywords
-                               (list doc-keywords))))
+        (list (nconc (c--mapcan
+                      (lambda (doc-style)
+                        (let ((sym (intern
+                                    (concat (symbol-name doc-style)
+                                            "-font-lock-keywords"))))
+                          (cond ((fboundp sym)
+                                 (funcall sym))
+                                ((boundp sym)
+                                 (append (eval sym) nil)))))
+                      (if (listp doc-keywords)
+                          doc-keywords
+                        (list doc-keywords)))
                      base-list)))
 
     ;; Kludge: If `c-font-lock-complex-decl-prepare' is on the list we
@@ -2704,8 +2704,8 @@ need for `pike-font-lock-extra-types'.")
 ;; 2006-07-10:  awk-font-lock-keywords has been moved back to cc-awk.el.
 (cc-provide 'cc-fonts)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-fonts.el ends here
diff --git a/lisp/progmodes/cc-guess.el b/lisp/progmodes/cc-guess.el
index ba23a75..4295fc7 100644
--- a/lisp/progmodes/cc-guess.el
+++ b/lisp/progmodes/cc-guess.el
@@ -573,8 +573,8 @@ WITH-NAME is asked to the user."
 
 (cc-provide 'cc-guess)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-guess.el ends here
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 07f5ef4..235ef21 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -130,7 +130,7 @@
 
 
 ;; This file is not always loaded.  See note above.
-(cc-external-require 'cl)
+(cc-external-require (if (eq c--mapcan-status 'cl-mapcan) 'cl-lib 'cl))
 
 
 ;;; Setup for the `c-lang-defvar' system.
@@ -251,19 +251,19 @@ the evaluated constant value at compile time."
     (unless xlate
       (setq xlate 'identity))
     (c-with-syntax-table (c-lang-const c-mode-syntax-table)
-      (delete-duplicates
-       (mapcan (lambda (opgroup)
-                (when (if (symbolp (car opgroup))
-                          (when (funcall opgroup-filter (car opgroup))
-                            (setq opgroup (cdr opgroup))
-                            t)
-                        t)
-                  (mapcan (lambda (op)
-                            (when (funcall op-filter op)
-                              (let ((res (funcall xlate op)))
-                                (if (listp res) res (list res)))))
-                          opgroup)))
-              ops)
+      (c--delete-duplicates
+       (c--mapcan (lambda (opgroup)
+                   (when (if (symbolp (car opgroup))
+                             (when (funcall opgroup-filter (car opgroup))
+                               (setq opgroup (cdr opgroup))
+                               t)
+                           t)
+                     (c--mapcan (lambda (op)
+                                  (when (funcall op-filter op)
+                                    (let ((res (funcall xlate op)))
+                                      (if (listp res) res (list res)))))
+                                opgroup)))
+                 ops)
        :test 'equal))))
 
 
@@ -457,7 +457,7 @@ the new syntax, as accepted by `modify-syntax-entry'."
       (modify-syntax-entry (car mod) (cdr mod) table))
     table)
   "Syntax table built on the mode syntax table but additionally
-classifies symbol constituents like '_' and '$' as word constituents,
+classifies symbol constituents like `_' and `$' as word constituents,
 so that all identifiers are recognized as words.")
 
 (c-lang-defconst c-get-state-before-change-functions
@@ -578,8 +578,8 @@ EOL terminated statements."
 (c-lang-defvar c-has-bitfields (c-lang-const c-has-bitfields))
 
 (c-lang-defconst c-modified-constant
-  "Regexp that matches a \"modified\" constant literal such as \"L'a'\",
-a \"long character\".  In particular, this recognizes forms of constant
+  "Regexp that matches a “modified” constant literal such as \"L\\='a\\='\",
+a “long character”.  In particular, this recognizes forms of constant
 which `c-backward-sexp' needs to be called twice to move backwards over."
   t nil
   (c c++ objc) "L'\\([^\\'\t\f\n\r]\\|\\\\.\\)'")
@@ -1165,9 +1165,9 @@ operators."
 (c-lang-defconst c-all-op-syntax-tokens
   ;; List of all tokens in the punctuation and parenthesis syntax
   ;; classes.
-  t (delete-duplicates (append (c-lang-const c-other-op-syntax-tokens)
-                              (c-lang-const c-operator-list))
-                      :test 'string-equal))
+  t (c--delete-duplicates (append (c-lang-const c-other-op-syntax-tokens)
+                                 (c-lang-const c-operator-list))
+                         :test 'string-equal))
 
 (c-lang-defconst c-nonsymbol-token-char-list
   ;; List containing all chars not in the word, symbol or
@@ -1204,9 +1204,9 @@ operators."
         "=\\([^=]\\|$\\)"
         "\\|"
         (c-make-keywords-re nil
-          (set-difference (c-lang-const c-assignment-operators)
-                          '("=")
-                          :test 'string-equal)))
+          (c--set-difference (c-lang-const c-assignment-operators)
+                             '("=")
+                             :test 'string-equal)))
       "\\<\\>"))
 (c-lang-defvar c-assignment-op-regexp
   (c-lang-const c-assignment-op-regexp))
@@ -1256,7 +1256,7 @@ operators."
   ;; multicharacter tokens that begin with ">" except for those beginning with
   ;; ">>".
   t (c-make-keywords-re nil
-      (set-difference
+      (c--set-difference
        (c-lang-const c->-op-cont-tokens)
        (c-filter-ops (c-lang-const c-all-op-syntax-tokens)
                     t
@@ -1765,10 +1765,10 @@ not the type face."
 (c-lang-defconst c-type-start-kwds
   ;; All keywords that can start a type (i.e. are either a type prefix
   ;; or a complete type).
-  t (delete-duplicates (append (c-lang-const c-primitive-type-kwds)
-                              (c-lang-const c-type-prefix-kwds)
-                              (c-lang-const c-type-modifier-kwds))
-                      :test 'string-equal))
+  t (c--delete-duplicates (append (c-lang-const c-primitive-type-kwds)
+                                 (c-lang-const c-type-prefix-kwds)
+                                 (c-lang-const c-type-modifier-kwds))
+                         :test 'string-equal))
 
 (c-lang-defconst c-class-decl-kwds
   "Keywords introducing declarations where the following block (if any)
@@ -2030,16 +2030,16 @@ one of `c-type-list-kwds', `c-ref-list-kwds',
   ;; something is a type or just some sort of macro in front of the
   ;; declaration.  They might be ambiguous with types or type
   ;; prefixes.
-  t (delete-duplicates (append (c-lang-const c-class-decl-kwds)
-                              (c-lang-const c-brace-list-decl-kwds)
-                              (c-lang-const c-other-block-decl-kwds)
-                              (c-lang-const c-typedef-decl-kwds)
-                              (c-lang-const c-typeless-decl-kwds)
-                              (c-lang-const c-modifier-kwds)
-                              (c-lang-const c-other-decl-kwds)
-                              (c-lang-const c-decl-start-kwds)
-                              (c-lang-const c-decl-hangon-kwds))
-                      :test 'string-equal))
+  t (c--delete-duplicates (append (c-lang-const c-class-decl-kwds)
+                                 (c-lang-const c-brace-list-decl-kwds)
+                                 (c-lang-const c-other-block-decl-kwds)
+                                 (c-lang-const c-typedef-decl-kwds)
+                                 (c-lang-const c-typeless-decl-kwds)
+                                 (c-lang-const c-modifier-kwds)
+                                 (c-lang-const c-other-decl-kwds)
+                                 (c-lang-const c-decl-start-kwds)
+                                 (c-lang-const c-decl-hangon-kwds))
+                         :test 'string-equal))
 
 (c-lang-defconst c-prefix-spec-kwds-re
   ;; Adorned regexp of `c-prefix-spec-kwds'.
@@ -2052,10 +2052,10 @@ one of `c-type-list-kwds', `c-ref-list-kwds',
   ;; ambiguous with types or type prefixes.  These are the keywords (like
   ;; extern, namespace, but NOT template) that can modify a declaration.
   t (c-make-keywords-re t
-      (set-difference (c-lang-const c-prefix-spec-kwds)
-                     (append (c-lang-const c-type-start-kwds)
-                             (c-lang-const c-<>-arglist-kwds))
-                     :test 'string-equal)))
+      (c--set-difference (c-lang-const c-prefix-spec-kwds)
+                        (append (c-lang-const c-type-start-kwds)
+                                (c-lang-const c-<>-arglist-kwds))
+                        :test 'string-equal)))
 (c-lang-defvar c-specifier-key (c-lang-const c-specifier-key))
 
 (c-lang-defconst c-postfix-spec-kwds
@@ -2068,19 +2068,19 @@ one of `c-type-list-kwds', `c-ref-list-kwds',
   ;; Adorned regexp matching all keywords that can't appear at the
   ;; start of a declaration.
   t (c-make-keywords-re t
-      (set-difference (c-lang-const c-keywords)
-                     (append (c-lang-const c-type-start-kwds)
-                             (c-lang-const c-prefix-spec-kwds)
-                             (c-lang-const c-typeof-kwds))
-                     :test 'string-equal)))
+      (c--set-difference (c-lang-const c-keywords)
+                        (append (c-lang-const c-type-start-kwds)
+                                (c-lang-const c-prefix-spec-kwds)
+                                (c-lang-const c-typeof-kwds))
+                        :test 'string-equal)))
 (c-lang-defvar c-not-decl-init-keywords
   (c-lang-const c-not-decl-init-keywords))
 
 (c-lang-defconst c-not-primitive-type-keywords
   "List of all keywords apart from primitive types (like \"int\")."
-  t (set-difference (c-lang-const c-keywords)
-                   (c-lang-const c-primitive-type-kwds)
-                   :test 'string-equal)
+  t (c--set-difference (c-lang-const c-keywords)
+                      (c-lang-const c-primitive-type-kwds)
+                      :test 'string-equal)
   ;; The "more" for C++ is the QT keyword (as in "more slots:").
   ;; This variable is intended for use in c-beginning-of-statement-1.
   c++ (append (c-lang-const c-not-primitive-type-keywords) '("more")))
@@ -2101,7 +2101,7 @@ one of `c-type-list-kwds', `c-ref-list-kwds',
   "Keywords introducing declarations that can contain a block which
 might be followed by variable declarations, e.g. like \"foo\" in
 \"class Foo { ... } foo;\".  So if there is a block in a declaration
-like that, it ends with the following ';' and not right away.
+like that, it ends with the following `;' and not right away.
 
 The keywords on list are assumed to also be present on one of the
 `*-decl-kwds' lists."
@@ -2224,9 +2224,9 @@ type identifiers separated by arbitrary tokens."
   pike '("array" "function" "int" "mapping" "multiset" "object" "program"))
 
 (c-lang-defconst c-paren-any-kwds
-  t (delete-duplicates (append (c-lang-const c-paren-nontype-kwds)
-                              (c-lang-const c-paren-type-kwds))
-                      :test 'string-equal))
+  t (c--delete-duplicates (append (c-lang-const c-paren-nontype-kwds)
+                                 (c-lang-const c-paren-type-kwds))
+                         :test 'string-equal))
 
 (c-lang-defconst c-<>-type-kwds
   "Keywords that may be followed by an angle bracket expression
@@ -2250,9 +2250,9 @@ assumed to be set if this isn't nil."
 
 (c-lang-defconst c-<>-sexp-kwds
   ;; All keywords that can be followed by an angle bracket sexp.
-  t (delete-duplicates (append (c-lang-const c-<>-type-kwds)
-                              (c-lang-const c-<>-arglist-kwds))
-                      :test 'string-equal))
+  t (c--delete-duplicates (append (c-lang-const c-<>-type-kwds)
+                                 (c-lang-const c-<>-arglist-kwds))
+                         :test 'string-equal))
 
 (c-lang-defconst c-opt-<>-sexp-key
   ;; Adorned regexp matching keywords that can be followed by an angle
@@ -2310,9 +2310,9 @@ Keywords here should also be in `c-block-stmt-1-kwds'."
 
 (c-lang-defconst c-block-stmt-kwds
   ;; Union of `c-block-stmt-1-kwds' and `c-block-stmt-2-kwds'.
-  t (delete-duplicates (append (c-lang-const c-block-stmt-1-kwds)
-                              (c-lang-const c-block-stmt-2-kwds))
-                      :test 'string-equal))
+  t (c--delete-duplicates (append (c-lang-const c-block-stmt-1-kwds)
+                                 (c-lang-const c-block-stmt-2-kwds))
+                         :test 'string-equal))
 
 (c-lang-defconst c-opt-block-stmt-key
   ;; Regexp matching the start of any statement that has a
@@ -2344,7 +2344,7 @@ Keywords here should also be in `c-block-stmt-1-kwds'."
 
 (c-lang-defconst c-paren-stmt-kwds
   "Statement keywords followed by a parenthesis expression that
-nevertheless contains a list separated with ';' and not ','."
+nevertheless contains a list separated with `;' and not `,'."
   t    '("for")
   idl  nil)
 
@@ -2417,7 +2417,7 @@ This construct is \"<keyword> <expression> :\"."
 (c-lang-defconst c-expr-kwds
   ;; Keywords that can occur anywhere in expressions.  Built from
   ;; `c-primary-expr-kwds' and all keyword operators in `c-operators'.
-  t (delete-duplicates
+  t (c--delete-duplicates
      (append (c-lang-const c-primary-expr-kwds)
             (c-filter-ops (c-lang-const c-operator-list)
                           t
@@ -2468,12 +2468,12 @@ Note that Java specific rules are currently applied to 
tell this from
   t (let* ((decl-kwds (append (c-lang-const c-class-decl-kwds)
                              (c-lang-const c-other-block-decl-kwds)
                              (c-lang-const c-inexpr-class-kwds)))
-          (unambiguous (set-difference decl-kwds
-                                       (c-lang-const c-type-start-kwds)
-                                       :test 'string-equal))
-          (ambiguous (intersection decl-kwds
-                                   (c-lang-const c-type-start-kwds)
-                                   :test 'string-equal)))
+          (unambiguous (c--set-difference decl-kwds
+                                          (c-lang-const c-type-start-kwds)
+                                          :test 'string-equal))
+          (ambiguous (c--intersection decl-kwds
+                                      (c-lang-const c-type-start-kwds)
+                                      :test 'string-equal)))
       (if ambiguous
          (concat (c-make-keywords-re t unambiguous)
                  "\\|"
@@ -2521,7 +2521,7 @@ Note that Java specific rules are currently applied to 
tell this from
 
 (c-lang-defconst c-keywords
   ;; All keywords as a list.
-  t (delete-duplicates
+  t (c--delete-duplicates
      (c-lang-defconst-eval-immediately
       `(append ,@(mapcar (lambda (kwds-lang-const)
                           `(c-lang-const ,kwds-lang-const))
@@ -2585,6 +2585,7 @@ Note that Java specific rules are currently applied to 
tell this from
       (setplist (intern kwd obarray)
                ;; Emacs has an odd bug that causes `mapcan' to fail
                ;; with unintelligible errors.  (XEmacs works.)
+               ;; (2015-06-24): This bug has not yet been fixed.
                ;;(mapcan (lambda (lang-const)
                ;;            (list lang-const t))
                ;;          lang-const-list)
@@ -2597,10 +2598,10 @@ Note that Java specific rules are currently applied to 
tell this from
   ;; Adorned regexp matching all keywords that should be fontified
   ;; with the keywords face.  I.e. that aren't types or constants.
   t (c-make-keywords-re t
-      (set-difference (c-lang-const c-keywords)
-                     (append (c-lang-const c-primitive-type-kwds)
-                             (c-lang-const c-constant-kwds))
-                     :test 'string-equal)))
+      (c--set-difference (c-lang-const c-keywords)
+                        (append (c-lang-const c-primitive-type-kwds)
+                                (c-lang-const c-constant-kwds))
+                        :test 'string-equal)))
 (c-lang-defvar c-regular-keywords-regexp
   (c-lang-const c-regular-keywords-regexp))
 
@@ -2635,12 +2636,12 @@ Note that Java specific rules are currently applied to 
tell this from
                            right-assoc-sequence)
                          t))
 
-          (unambiguous-prefix-ops (set-difference nonkeyword-prefix-ops
-                                                  in-or-postfix-ops
-                                                  :test 'string-equal))
-          (ambiguous-prefix-ops (intersection nonkeyword-prefix-ops
-                                              in-or-postfix-ops
-                                              :test 'string-equal)))
+          (unambiguous-prefix-ops (c--set-difference nonkeyword-prefix-ops
+                                                     in-or-postfix-ops
+                                                     :test 'string-equal))
+          (ambiguous-prefix-ops (c--intersection nonkeyword-prefix-ops
+                                                 in-or-postfix-ops
+                                                 :test 'string-equal)))
 
       (concat
        "\\("
@@ -2648,14 +2649,14 @@ Note that Java specific rules are currently applied to 
tell this from
        ;; first submatch from them together with `c-primary-expr-kwds'.
        (c-make-keywords-re t
         (append (c-lang-const c-primary-expr-kwds)
-                (set-difference prefix-ops nonkeyword-prefix-ops
-                                :test 'string-equal)))
+                (c--set-difference prefix-ops nonkeyword-prefix-ops
+                                   :test 'string-equal)))
 
        "\\|"
        ;; Match all ambiguous operators.
        (c-make-keywords-re nil
-        (intersection nonkeyword-prefix-ops in-or-postfix-ops
-                      :test 'string-equal))
+        (c--intersection nonkeyword-prefix-ops in-or-postfix-ops
+                         :test 'string-equal))
        "\\)"
 
        "\\|"
@@ -2670,8 +2671,8 @@ Note that Java specific rules are currently applied to 
tell this from
        "\\|"
        ;; The unambiguous operators from `prefix-ops'.
        (c-make-keywords-re nil
-        (set-difference nonkeyword-prefix-ops in-or-postfix-ops
-                        :test 'string-equal))
+        (c--set-difference nonkeyword-prefix-ops in-or-postfix-ops
+                           :test 'string-equal))
 
        "\\|"
        ;; Match string and character literals.
@@ -2805,7 +2806,7 @@ the \"class Foo: public Bar\" part of:
 If parens can occur, the chars inside those aren't filtered with this
 list.
 
-'<' and '>' should be disallowed even if angle bracket arglists can
+`<' and `>' should be disallowed even if angle bracket arglists can
 occur.  That since the search function needs to stop at them anyway to
 ensure they are given paren syntax.
 
@@ -2816,7 +2817,7 @@ possible for good performance."
 
   ;; Default to all chars that only occurs in nonsymbol tokens outside
   ;; identifiers.
-  t (set-difference
+  t (c--set-difference
      (c-lang-const c-nonsymbol-token-char-list)
      (c-filter-ops (append (c-lang-const c-identifier-ops)
                           (list (cons nil
@@ -2833,26 +2834,26 @@ possible for good performance."
 
   ;; Allow cpp operations (where applicable).
   t (if (c-lang-const c-opt-cpp-prefix)
-       (set-difference (c-lang-const c-block-prefix-disallowed-chars)
-                       '(?#))
+       (c--set-difference (c-lang-const c-block-prefix-disallowed-chars)
+                          '(?#))
       (c-lang-const c-block-prefix-disallowed-chars))
 
   ;; Allow ':' for inherit list starters.
-  (c++ objc idl) (set-difference (c-lang-const c-block-prefix-disallowed-chars)
-                                '(?:))
+  (c++ objc idl) (c--set-difference (c-lang-const 
c-block-prefix-disallowed-chars)
+                                   '(?:))
 
   ;; Allow ',' for multiple inherits.
-  (c++ java) (set-difference (c-lang-const c-block-prefix-disallowed-chars)
-                            '(?,))
+  (c++ java) (c--set-difference (c-lang-const c-block-prefix-disallowed-chars)
+                               '(?,))
 
   ;; Allow parentheses for anonymous inner classes in Java and class
   ;; initializer lists in Pike.
-  (java pike) (set-difference (c-lang-const c-block-prefix-disallowed-chars)
-                             '(?\( ?\)))
+  (java pike) (c--set-difference (c-lang-const c-block-prefix-disallowed-chars)
+                                '(?\( ?\)))
 
   ;; Allow '"' for extern clauses (e.g. extern "C" {...}).
-  (c c++ objc) (set-difference (c-lang-const c-block-prefix-disallowed-chars)
-                              '(?\" ?')))
+  (c c++ objc) (c--set-difference (c-lang-const 
c-block-prefix-disallowed-chars)
+                                 '(?\" ?')))
 
 (c-lang-defconst c-block-prefix-charset
   ;; `c-block-prefix-disallowed-chars' as an inverted charset suitable
@@ -3157,10 +3158,10 @@ i.e. before \":\".  Only used if 
`c-recognize-colon-labels' is set."
   t (concat
      ;; All keywords except `c-label-kwds' and `c-protection-kwds'.
      (c-make-keywords-re t
-       (set-difference (c-lang-const c-keywords)
-                      (append (c-lang-const c-label-kwds)
-                              (c-lang-const c-protection-kwds))
-                      :test 'string-equal)))
+       (c--set-difference (c-lang-const c-keywords)
+                         (append (c-lang-const c-label-kwds)
+                                 (c-lang-const c-protection-kwds))
+                         :test 'string-equal)))
   ;; Don't allow string literals, except in AWK.  Character constants are OK.
   (c objc java pike idl) (concat "\"\\|"
                                 (c-lang-const c-nonlabel-token-key))
@@ -3280,16 +3281,16 @@ accomplish that conveniently."
                             ;; `c-lang-const' will expand to the evaluated
                             ;; constant immediately in `c--macroexpand-all'
                             ;; below.
-                             (mapcan
+                             (c--mapcan
                               (lambda (init)
                                 `(current-var ',(car init)
-                                  ,(car init) ,(c--macroexpand-all
-                                                (elt init 1))))
+                                              ,(car init) ,(c--macroexpand-all
+                                                            (elt init 1))))
                               ;; Note: The following `append' copies the
                               ;; first argument.  That list is small, so
                               ;; this doesn't matter too much.
-                             (append (cdr c-emacs-variable-inits)
-                                     (cdr c-lang-variable-inits)))))
+                              (append (cdr c-emacs-variable-inits)
+                                      (cdr c-lang-variable-inits)))))
 
                 ;; This diagnostic message isn't useful for end
                 ;; users, so it's disabled.
@@ -3355,8 +3356,8 @@ evaluated and should not be quoted."
 
 (cc-provide 'cc-langs)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-langs.el ends here
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el
index 414b957..51cb920 100644
--- a/lisp/progmodes/cc-menus.el
+++ b/lisp/progmodes/cc-menus.el
@@ -521,8 +521,8 @@ Example:
 
 (cc-provide 'cc-menus)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-menus.el ends here
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 8365702..97491e4 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1919,8 +1919,8 @@ Key bindings:
 
 (cc-provide 'cc-mode)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-mode.el ends here
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index 9a29c01..527d4c4 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -663,8 +663,8 @@ DEFAULT-STYLE has the same format as `c-default-style'."
 
 (cc-provide 'cc-styles)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-styles.el ends here
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index 022bc22..df6e987 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1772,8 +1772,8 @@ It treats escaped EOLs as whitespace.")
 
 (cc-provide 'cc-vars)
 
-;;; Local Variables:
-;;; indent-tabs-mode: t
-;;; tab-width: 8
-;;; End:
+;; Local Variables:
+;; indent-tabs-mode: t
+;; tab-width: 8
+;; End:
 ;;; cc-vars.el ends here
diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el
index 108ccb6..96bb8d3 100644
--- a/lisp/progmodes/cfengine.el
+++ b/lisp/progmodes/cfengine.el
@@ -157,7 +157,7 @@ bundle agent rcfiles
   "Whether `cfengine-mode' should print debugging info.")
 
 (defvar cfengine-mode-syntax-cache nil
-  "Cache for `cfengine-mode' syntax trees obtained from 'cf-promises -s 
json'.")
+  "Cache for `cfengine-mode' syntax trees obtained from `cf-promises -s 
json'.")
 
 (defconst cfengine3-fallback-syntax
   '((functions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 9a44335..a6e9ed8 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1,4 +1,4 @@
-;;; compile.el --- run compiler as inferior of Emacs, parse error messages
+;;; compile.el --- run compiler as inferior of Emacs, parse error messages  
-*- lexical-binding:t -*-
 
 ;; Copyright (C) 1985-1987, 1993-1999, 2001-2015 Free Software
 ;; Foundation, Inc.
@@ -650,11 +650,11 @@ The value nil as an element means to try the default 
directory."
 Sometimes it is useful for files to supply local values for this variable.
 You might also use mode hooks to specify it in certain modes, like this:
 
-    (add-hook 'c-mode-hook
+    (add-hook \\='c-mode-hook
        (lambda ()
         (unless (or (file-exists-p \"makefile\")
                     (file-exists-p \"Makefile\"))
-          (set (make-local-variable 'compile-command)
+          (set (make-local-variable \\='compile-command)
                (concat \"make -k \"
                        (if buffer-file-name
                          (shell-quote-argument
@@ -1109,7 +1109,9 @@ If SCREEN is non-nil, columns are screen columns, 
otherwise, they are
 just char-counts."
   (setq col (- col compilation-first-column))
   (if screen
-      (move-to-column (max col 0))
+      ;; Presumably, the compilation tool doesn't know about our current
+      ;; `tab-width' setting, so it probably assumed 8-wide TABs (bug#21038).
+      (let ((tab-width 8)) (move-to-column (max col 0)))
     (goto-char (min (+ (line-beginning-position) col) (line-end-position)))))
 
 (defun compilation-internal-error-properties (file line end-line col end-col 
type fmts)
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 7d2f3fc..322024e 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -1042,11 +1042,11 @@ In regular expressions (including character classes):
   cperl-can-font-lock)
 
 (defun cperl-putback-char (c)          ; Emacs 19
-  (set 'unread-command-events (list c))) ; Avoid undefined warning
+  (push c unread-command-events))       ; Avoid undefined warning
 
 (if (featurep 'xemacs)
     (defun cperl-putback-char (c)      ; XEmacs >= 19.12
-      (setq unread-command-events (list (eval '(character-to-event c))))))
+      (push (eval '(character-to-event c)) unread-command-events)))
 
 (or (fboundp 'uncomment-region)
     (defun uncomment-region (beg end)
@@ -7607,7 +7607,7 @@ than a line.  Your contribution to update/shorten it is 
appreciated."
 
 (defvar cperl-short-docs 'please-ignore-this-line
   ;; Perl4 version was written by Johan Vromans (address@hidden)
-  "# based on '@(#)@ perl-descr.el 1.9 - describe-perl-symbol' [Perl 5]
+  "# based on \\='@(#)@ perl-descr.el 1.9 - describe-perl-symbol\\=' [Perl 5]
 ...    Range (list context); flip/flop [no flop when flip] (scalar context).
 ! ...  Logical negation.
 ... != ...     Numeric inequality.
@@ -7630,7 +7630,7 @@ $7        Match of the 7th set of parentheses in the last 
match (auto-local).
 $8     Match of the 8th set of parentheses in the last match (auto-local).
 $9     Match of the 9th set of parentheses in the last match (auto-local).
 $&     The string matched by the last pattern match (auto-local).
-$'     The string after what was matched by the last match (auto-local).
+$\\='  The string after what was matched by the last match (auto-local).
 $\\=`  The string before what was matched by the last match (auto-local).
 
 $(     The real gid of this process.
@@ -7886,7 +7886,7 @@ pop(ARRAY)
 print [FILEHANDLE] [(LIST)]
 printf [FILEHANDLE] (FORMAT,LIST)
 push(ARRAY,LIST)
-q/STRING/      Synonym for 'STRING'
+q/STRING/      Synonym for \\='STRING\\='
 qq/STRING/     Synonym for \"STRING\"
 qx/STRING/     Synonym for \\=`STRING\\=`
 rand[(EXPR)]
@@ -7988,7 +7988,7 @@ DESTROY           Shorthand for `sub DESTROY {...}'.
 abs [ EXPR ]   absolute value
 ... and ...            Low-precedence synonym for &&.
 bless REFERENCE [, PACKAGE]    Makes reference into an object of a package.
-chomp [LIST]   Strips $/ off LIST/$_.  Returns count.  Special if $/ eq ''!
+chomp [LIST]   Strips $/ off LIST/$_.  Returns count.  Special if $/ eq 
\\='\\='!
 chr            Converts a number to char with the same ordinal.
 else           Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}.
 elsif          Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}.
@@ -8005,7 +8005,7 @@ not ...           Low-precedence synonym for ! - negation.
 ... or ...             Low-precedence synonym for ||.
 pos STRING    Set/Get end-position of the last match over this string, see \\G.
 quotemeta [ EXPR ]     Quote regexp metacharacters.
-qw/WORD1 .../          Synonym of split('', 'WORD1 ...')
+qw/WORD1 .../          Synonym of split(\\='\\=', \\='WORD1 ...\\=')
 readline FH    Synonym of <FH>.
 readpipe CMD   Synonym of \\=`CMD\\=`.
 ref [ EXPR ]   Type of EXPR when dereferenced.
diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index bf8458e..685bb21 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -57,7 +57,7 @@
   :group 'cpp)
 
 (define-widget 'cpp-face 'lazy
-  "Either a face or the special symbol 'invisible'."
+  "Either a face or the special symbol `invisible'."
   :type '(choice (const invisible) (face)))
 
 (defcustom cpp-known-face 'invisible
@@ -234,7 +234,8 @@ A prefix arg suppresses display of that buffer."
       (cpp-progress-message "Parsing...")
       (while (re-search-forward cpp-parse-regexp nil t)
        (cpp-progress-message "Parsing...%d%%"
-                         (/ (* 100 (- (point) (point-min))) (buffer-size)))
+                             (floor (* 100.0 (- (point) (point-min)))
+                                    (buffer-size)))
        (let ((match (buffer-substring (match-beginning 0) (match-end 0))))
          (cond ((or (string-equal match "'")
                     (string-equal match "\""))
diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el
index eab4ae8..4c997bd 100644
--- a/lisp/progmodes/dcl-mode.el
+++ b/lisp/progmodes/dcl-mode.el
@@ -173,7 +173,7 @@ It can have the following values:
   first-line  indentation for the first line in a buffer or SUBROUTINE.
 CUR-INDENT is the indentation of the preceding command line.
 EXTRA-INDENT is the default change in indentation for this line
-\(a negative number for 'outdent).
+\(a negative number for “outdent”).
 LAST-POINT is the buffer position of the first significant word on the
 previous line or nil if the current line is the first line.
 THIS-POINT is the buffer position of the first significant word on the
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index a897f96..c694bbd 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -6345,7 +6345,7 @@ killed after process termination."
   (when ebnf-log
     (with-current-buffer (get-buffer-create "*Ebnf2ps Log*")
       (goto-char (point-max))
-      (insert (apply 'format format-str args) "\n"))))
+      (insert (apply #'format-message format-str args) "\n"))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index f91e4a7..7c785d4 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -2015,7 +2015,7 @@ COLLAPSE non-nil means collapse the branch."
 (defun ebrowse-electric-list-looper (state condition)
   "Prevent cursor from moving beyond the buffer end.
 Don't let it move into the title lines.
-See 'Electric-command-loop' for a description of STATE and CONDITION."
+See `Electric-command-loop' for a description of STATE and CONDITION."
   (cond ((and condition
              (not (memq (car condition)
                         '(buffer-read-only end-of-buffer
@@ -4223,7 +4223,8 @@ NUMBER-OF-STATIC-VARIABLES:"
                                                    (1+ (point)))))))))
       (unless non-empty
        (error "No tree buffers"))
-      (setf unread-command-events (listify-key-sequence "p"))
+      (setf unread-command-events
+            (nconc (listify-key-sequence "p") unread-command-events))
       (shrink-window-if-larger-than-buffer (selected-window))
       (setq buffer-read-only t))))
 
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index cf34e1a..e76728d 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -28,6 +28,7 @@
 
 ;;; Code:
 
+(require 'cl-generic)
 (require 'lisp-mode)
 (eval-when-compile (require 'cl-lib))
 
@@ -441,6 +442,7 @@ It can be quoted, or be inside a quoted form."
          (string-match ".*$" doc)
          (match-string 0 doc))))
 
+;; can't (require 'find-func) in a preloaded file
 (declare-function find-library-name "find-func" (library))
 (declare-function find-function-library "find-func" (function &optional l-o v))
 
@@ -588,6 +590,10 @@ It can be quoted, or be inside a quoted form."
 
 (defun elisp-xref-find (action id)
   (require 'find-func)
+  ;; FIXME: use information in source near point to filter results:
+  ;; (dvc-log-edit ...) - exclude 'feature
+  ;; (require 'dvc-log-edit) - only 'feature
+  ;; Semantic may provide additional information
   (pcase action
     (`definitions
       (let ((sym (intern-soft id)))
@@ -598,64 +604,199 @@ It can be quoted, or be inside a quoted form."
     (`apropos
      (elisp--xref-find-apropos id))))
 
-(defun elisp--xref-identifier-location (type sym)
-  (let ((file
-         (pcase type
-           (`defun (when (fboundp sym)
-                     (let ((fun-lib
-                            (find-function-library sym)))
-                       (setq sym (car fun-lib))
-                       (cdr fun-lib))))
-           (`defvar (and (boundp sym)
-                         (let ((el-file (symbol-file sym 'defvar)))
-                           (if el-file
-                               (and
-                                ;; Don't show minor modes twice.
-                                ;; TODO: If TYPE ever becomes dependent on the
-                                ;; context, move this check outside.
-                                (not (and (fboundp sym)
-                                          (memq sym minor-mode-list)))
-                                el-file)
-                             (help-C-file-name sym 'var)))))
-           (`feature (and (featurep sym)
-                          ;; Skip when a function with the same name
-                          ;; is defined, because it's probably in the
-                          ;; same file.
-                          (not (fboundp sym))
-                          (ignore-errors
-                            (find-library-name (symbol-name sym)))))
-           (`defface (when (facep sym)
-                       (symbol-file sym 'defface))))))
-    (when file
-      (when (string-match-p "\\.elc\\'" file)
-        (setq file (substring file 0 -1)))
-      (xref-make-elisp-location sym type file))))
-
+;; WORKAROUND: This is nominally a constant, but the text properties
+;; are not preserved thru dump if use defconst.  See bug#21237.
 (defvar elisp--xref-format
   (let ((str "(%s %s)"))
     (put-text-property 1 3 'face 'font-lock-keyword-face str)
     (put-text-property 4 6 'face 'font-lock-function-name-face str)
     str))
 
+;; WORKAROUND: This is nominally a constant, but the text properties
+;; are not preserved thru dump if use defconst.  See bug#21237.
+(defvar elisp--xref-format-extra
+  (let ((str "(%s %s %s)"))
+    (put-text-property 1 3 'face 'font-lock-keyword-face str)
+    (put-text-property 4 6 'face 'font-lock-function-name-face str)
+    str))
+
+(defvar find-feature-regexp);; in find-func.el
+
+(defun elisp--xref-make-xref (type symbol file &optional summary)
+  "Return an xref for TYPE SYMBOL in FILE.
+TYPE must be a type in `find-function-regexp-alist' (use nil for
+'defun).  If SUMMARY is non-nil, use it for the summary;
+otherwise build the summary from TYPE and SYMBOL."
+  (xref-make (or summary
+                (format elisp--xref-format (or type 'defun) symbol))
+            (xref-make-elisp-location symbol type file)))
+
+(defvar elisp-xref-find-def-functions nil
+  "List of functions to be run from ‘elisp--xref-find-definitions’ to add 
additional xrefs.
+Called with one arg; the symbol whose definition is desired.
+Each function should return a list of xrefs, or nil; the first
+non-nil result supercedes the xrefs produced by
+‘elisp--xref-find-definitions’.")
+
+;; FIXME: name should be singular; match xref-find-definition
 (defun elisp--xref-find-definitions (symbol)
-  (save-excursion
-    (let (lst)
-      (dolist (type '(feature defface defvar defun))
-        (let ((loc
-               (condition-case err
-                   (elisp--xref-identifier-location type symbol)
-                 (error
-                  (xref-make-bogus-location (error-message-string err))))))
-          (when loc
-            (push
-             (xref-make (format elisp--xref-format type symbol)
-                        loc)
-             lst))))
-      lst)))
+  ;; The file name is not known when `symbol' is defined via interactive eval.
+  (let (xrefs temp)
+
+    (let ((temp elisp-xref-find-def-functions))
+      (while (and (null xrefs)
+                  temp)
+        (setq xrefs (append xrefs (funcall (pop temp) symbol)))))
+
+    (unless xrefs
+      ;; alphabetical by result type symbol
+
+      ;; FIXME: advised function; list of advice functions
+
+      ;; FIXME: aliased variable
+
+      (when (and (symbolp symbol)
+                 (symbol-function symbol)
+                 (symbolp (symbol-function symbol)))
+        ;; aliased function
+        (let* ((alias-symbol symbol)
+               (alias-file (symbol-file alias-symbol))
+               (real-symbol  (symbol-function symbol))
+               (real-file (find-lisp-object-file-name real-symbol 'defun)))
+
+          (when real-file
+            (push (elisp--xref-make-xref nil real-symbol real-file) xrefs))
+
+          (when alias-file
+            (push (elisp--xref-make-xref 'defalias alias-symbol alias-file) 
xrefs))))
+
+      (when (facep symbol)
+        (let ((file (find-lisp-object-file-name symbol 'defface)))
+          (when file
+            (push (elisp--xref-make-xref 'defface symbol file) xrefs))))
+
+      (when (fboundp symbol)
+        (let ((file (find-lisp-object-file-name symbol (symbol-function 
symbol)))
+              generic doc)
+          (when file
+            (cond
+             ((eq file 'C-source)
+              ;; First call to find-lisp-object-file-name for an object
+              ;; defined in C; the doc strings from the C source have
+              ;; not been loaded yet.  Second call will return "src/*.c"
+              ;; in file; handled by 't' case below.
+              (push (elisp--xref-make-xref nil symbol (help-C-file-name 
(symbol-function symbol) 'subr)) xrefs))
+
+             ((and (setq doc (documentation symbol t))
+                   ;; This doc string is defined in cl-macs.el cl-defstruct
+                   (string-match "Constructor for objects of type `\\(.*\\)'" 
doc))
+              ;; `symbol' is a name for the default constructor created by
+              ;; cl-defstruct, so return the location of the cl-defstruct.
+              (let* ((type-name (match-string 1 doc))
+                     (type-symbol (intern type-name))
+                     (file (find-lisp-object-file-name type-symbol 
'define-type))
+                     (summary (format elisp--xref-format-extra
+                                      'cl-defstruct
+                                      (concat "(" type-name)
+                                      (concat "(:constructor " (symbol-name 
symbol) "))"))))
+                (push (elisp--xref-make-xref 'define-type type-symbol file 
summary) xrefs)
+                ))
+
+             ((setq generic (cl--generic symbol))
+              ;; FIXME: move this to elisp-xref-find-def-functions, in 
cl-generic.el
+
+              ;; A generic function. If there is a default method, it
+              ;; will appear in the method table, with no
+              ;; specializers.
+              ;;
+              ;; If the default method is declared by the cl-defgeneric
+              ;; declaration, it will have the same location as the
+              ;; cl-defgeneric, so we want to exclude it from the
+              ;; result. In this case, it will have a null doc
+              ;; string. User declarations of default methods may also
+              ;; have null doc strings, but we hope that is
+              ;; rare. Perhaps this heuristic will discourage that.
+              (dolist (method (cl--generic-method-table generic))
+                (let* ((info (cl--generic-method-info method));; qual-string 
combined-args doconly
+                       (specializers (cl--generic-method-specializers method))
+                       (met-name (cons symbol specializers))
+                       (file (find-lisp-object-file-name met-name 
'cl-defmethod)))
+                  (when (and file
+                             (or specializers   ;; default method has null 
specializers
+                                 (nth 2 info))) ;; assuming only co-located 
default has null doc string
+                    (if specializers
+                        (let ((summary (format elisp--xref-format-extra 
'cl-defmethod symbol (nth 1 info))))
+                          (push (elisp--xref-make-xref 'cl-defmethod met-name 
file summary) xrefs))
+
+                      (let ((summary (format elisp--xref-format-extra 
'cl-defmethod symbol "()")))
+                        (push (elisp--xref-make-xref 'cl-defmethod met-name 
file summary) xrefs))))
+                  ))
+
+              (if (and (setq doc (documentation symbol t))
+                       ;; This doc string is created somewhere in
+                       ;; cl--generic-make-function for an implicit
+                       ;; defgeneric.
+                       (string-match "\n\n(fn ARG &rest ARGS)" doc))
+                  ;; This symbol is an implicitly defined defgeneric, so
+                  ;; don't return it.
+                  nil
+                (push (elisp--xref-make-xref 'cl-defgeneric symbol file) 
xrefs))
+              )
+
+             (t
+              (push (elisp--xref-make-xref nil symbol file) xrefs))
+             ))))
+
+      (when (boundp symbol)
+        ;; A variable
+        (let ((file (find-lisp-object-file-name symbol 'defvar)))
+          (when file
+            (cond
+             ((eq file 'C-source)
+              ;; The doc strings from the C source have not been loaded
+              ;; yet; help-C-file-name does that.  Second call will
+              ;; return "src/*.c" in file; handled below.
+              (push (elisp--xref-make-xref 'defvar symbol (help-C-file-name 
symbol 'var)) xrefs))
+
+             ((string= "src/" (substring file 0 4))
+              ;; The variable is defined in a C source file; don't check
+              ;; for define-minor-mode.
+              (push (elisp--xref-make-xref 'defvar symbol file) xrefs))
+
+             ((memq symbol minor-mode-list)
+              ;; The symbol is a minor mode. These should be defined by
+              ;; "define-minor-mode", which means the variable and the
+              ;; function are declared in the same place. So we return only
+              ;; the function, arbitrarily.
+              ;;
+              ;; There is an exception, when the variable is defined in C
+              ;; code, as for abbrev-mode.
+              ;;
+              ;; IMPROVEME: If the user is searching for the identifier at
+              ;; point, we can determine whether it is a variable or
+              ;; function by looking at the source code near point.
+              ;;
+              ;; IMPROVEME: The user may actually be asking "do any
+              ;; variables by this name exist"; we need a way to specify
+              ;; that.
+              nil)
+
+             (t
+              (push (elisp--xref-make-xref 'defvar symbol file) xrefs))
+
+             ))))
+
+      (when (featurep symbol)
+        (let ((file (ignore-errors
+                      (find-library-name (symbol-name symbol)))))
+          (when file
+            (push (elisp--xref-make-xref 'feature symbol file) xrefs))))
+      );; 'unless xrefs'
+
+    xrefs))
 
 (declare-function project-search-path "project")
 (declare-function project-current "project")
-(declare-function project-prune-directories "project")
 
 (defun elisp--xref-find-references (symbol)
   (cl-mapcan
@@ -690,13 +831,7 @@ It can be quoted, or be inside a quoted form."
 
 (cl-defmethod xref-location-marker ((l xref-elisp-location))
   (pcase-let (((cl-struct xref-elisp-location symbol type file) l))
-    (let ((buffer-point
-           (pcase type
-             (`defun (find-function-search-for-symbol symbol nil file))
-             ((or `defvar `defface)
-              (find-function-search-for-symbol symbol type file))
-             (`feature
-              (cons (find-file-noselect file) 1)))))
+    (let ((buffer-point (find-function-search-for-symbol symbol type file)))
       (with-current-buffer (car buffer-point)
         (goto-char (or (cdr buffer-point) (point-min)))
         (point-marker)))))
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index f5745a9..23f9370 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1754,7 +1754,7 @@ if the file was newly read in, the value is the filename."
         (with-current-buffer buffer
           (revert-buffer t t)))
     (if (not (and new novisit))
-       (find-file next novisit)
+       (find-file next)
       ;; Like find-file, but avoids random warning messages.
       (switch-to-buffer (get-buffer-create " *next-file*"))
       (kill-all-local-variables)
@@ -1846,7 +1846,9 @@ nil, we exit; otherwise we scan the next file."
 
          ;; Now operate on the file.
          ;; If value is non-nil, continue to scan the next file.
-         (tags-loop-eval tags-loop-operate))
+          (save-restriction
+            (widen)
+            (tags-loop-eval tags-loop-operate)))
       (setq file-finished t))
     (and messaged
         (null tags-loop-operate)
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index bb5ac63..f220633 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -200,7 +200,7 @@ ignored.  Otherwise, it is printed using `message'.
 TEXT is a format control string, and the remaining arguments ARGS
 are the string substitutions (see the function `format')."
   (if (<= level flymake-log-level)
-      (let* ((msg (apply 'format text args)))
+      (let* ((msg (apply #'format-message text args)))
        (message "%s" msg))))
 
 (defun flymake-ins-after (list pos val)
@@ -785,7 +785,7 @@ Perhaps use text from LINE-ERR-INFO-LIST to enhance 
highlighting."
        (when (flymake-same-files real-file-name source-file-name)
          (setq line-err-info (flymake-ler-set-file line-err-info nil))
          (setq err-info-list (flymake-add-err-info err-info-list 
line-err-info))))
-      (flymake-log 3 "parsed '%s', %s line-err-info" (nth idx lines) (if 
line-err-info "got" "no"))
+      (flymake-log 3 "parsed ‘%s’, %s line-err-info" (nth idx lines) (if 
line-err-info "got" "no"))
       (setq idx (1+ idx)))
     err-info-list))
 
@@ -1084,8 +1084,10 @@ For the format of LINE-ERR-INFO, see 
`flymake-ler-make-ler'."
                      default-directory)
         process)
     (error
-     (let* ((err-str (format "Failed to launch syntax check process '%s' with 
args %s: %s"
-                             cmd args (error-message-string err)))
+     (let* ((err-str
+             (format-message
+              "Failed to launch syntax check process ‘%s’ with args %s: %s"
+              cmd args (error-message-string err)))
             (source-file-name buffer-file-name)
             (cleanup-f        (flymake-get-cleanup-function source-file-name)))
        (flymake-log 0 err-str)
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index 65aa745..83e427d 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -1117,7 +1117,7 @@ See also `fortran-window-create'."
           (message "Type SPC to continue editing.")
           (let ((char (read-event)))
             (or (equal char ?\s)
-                (setq unread-command-events (list char))))))
+                (push char unread-command-events)))))
     (fortran-window-create)))
 
 (defun fortran-split-line ()
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 4af8ac6..9942e17 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -2195,10 +2195,10 @@ value when the message is complete.
 
 Implement the following GDB/MI output grammar rule:
   result-class ==>
-       'done' | 'running' | 'connected' | 'error' | 'exit'
+       `done' | `running' | `connected' | `error' | `exit'
 
   async-class ==>
-       'stopped' | others (where others will be added depending on the needs
+       `stopped' | others (where others will be added depending on the needs
                            --this is still in development).")
 
 (defun gdbmi-bnf-result-and-async-record-impl ()
diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el
index 23f9d4a..b5e7998 100644
--- a/lisp/progmodes/idlw-shell.el
+++ b/lisp/progmodes/idlw-shell.el
@@ -379,15 +379,15 @@ This mechanism is useful for correct interaction with the 
IDL function
 GET_KBRD, because in normal operation IDLWAVE only sends \\n terminated
 strings.  Here is some example code which makes use of the default spells.
 
-  print,'<chars>'               ; Make IDLWAVE switch to character mode
+  print,\\='<chars>\\='               ; Make IDLWAVE switch to character mode
   REPEAT BEGIN
       A = GET_KBRD(1)
       PRINT, BYTE(A)
-  ENDREP UNTIL A EQ 'q'
-  print,'</chars>'              ; Make IDLWAVE switch back to line mode
+  ENDREP UNTIL A EQ \\='q\\='
+  print,\\='</chars>\\='              ; Make IDLWAVE switch back to line mode
 
-  print,'Quit the program, y or n?'
-  print,'<onechar>'             ; Ask IDLWAVE to send one character
+  print,\\='Quit the program, y or n?\\='
+  print,\\='<onechar>\\='             ; Ask IDLWAVE to send one character
   answer = GET_KBRD(1)
 
 Since the IDLWAVE shell defines the system variable `!IDLWAVE_VERSION',
@@ -403,11 +403,11 @@ idlwave_char_input,/off          ; End the loop to send 
characters
 
 pro idlwave_char_input,on=on,off=off
   ;; Test if we are running under Emacs
-  defsysv,'!idlwave_version',exists=running_emacs
+  defsysv,\\='!idlwave_version\\=',exists=running_emacs
   if running_emacs then begin
-      if keyword_set(on) then         print,'<chars>' $
-        else if keyword_set(off) then print,'</chars>' $
-        else                          print,'<onechar>'
+      if keyword_set(on) then         print,\\='<chars>\\=' $
+        else if keyword_set(off) then print,\\='</chars>\\=' $
+        else                          print,\\='<onechar>\\='
   endif
 end"
   :group 'idlwave-shell-command-setup
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index 8e30aa2..d759442 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -4881,7 +4881,7 @@ Cache to disk for quick recovery."
              props (car (cdr elem)))
        (if (= (mod elem-cnt msg-cnt) 0)
            (message "Converting XML routine info...%2d%%"
-                    (/ (* elem-cnt 100) nelem)))
+                    (floor (* elem-cnt 100.0) nelem)))
        (cond
         ((eq type 'ROUTINE)
          (if (setq alias (assq 'alias_to props))
@@ -8694,7 +8694,7 @@ can be used to detect possible name clashes during this 
process."
       (erase-buffer)
       (while (setq routine (pop routines))
        (if (= (mod (setq n (1+ n)) step) 0)
-           (message "Compiling list...(%2d%%)" (/ (* n 100) nroutines)))
+           (message "Compiling list...(%2d%%)" (floor (* n 100.0) nroutines)))
 
        ;; Get a list of all twins
        (setq twins (idlwave-routine-twins routine (or lroutines routines)))
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 40a4a10..98a22dd 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3560,9 +3560,10 @@ If one hasn't been set, or if it's stale, prompt for a 
new one."
   ;; the buffer containing the problem, JIT-lock will apply the
   ;; correct syntax to the regular expression literal and the problem
   ;; will mysteriously disappear.
-  ;; FIXME: We should actually do this fontification lazily by adding
+  ;; FIXME: We should instead do this fontification lazily by adding
   ;; calls to syntax-propertize wherever it's really needed.
-  (syntax-propertize (point-max)))
+  ;;(syntax-propertize (point-max))
+  )
 
 ;;;###autoload (defalias 'javascript-mode 'js-mode)
 
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 50f888c..89e0b10 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -919,7 +919,7 @@ startup file, `~/.emacs-octave'."
       (let ((ch (read-event)))
         (if (eq ch ?\ )
             (set-window-configuration conf)
-          (setq unread-command-events (list ch)))))))
+          (push ch unread-command-events))))))
 
 (defun inferior-octave-output-digest (_proc string)
   "Special output filter for the inferior Octave process.
diff --git a/lisp/progmodes/opascal.el b/lisp/progmodes/opascal.el
index 2eba620..ef3433f 100644
--- a/lisp/progmodes/opascal.el
+++ b/lisp/progmodes/opascal.el
@@ -368,7 +368,7 @@ routine.")
          ;; Report the percentage complete.
          (setq opascal-progress-last-reported-point p)
          (message "%s %s ... %d%%"
-                  desc (buffer-name) (/ (* 100 p) (point-max))))))
+                  desc (buffer-name) (floor (* 100.0 p) (point-max))))))
 
 (defun opascal-next-line-start (&optional from-point)
   ;; Returns the first point of the next line.
diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el
index c05bda5..454367c 100644
--- a/lisp/progmodes/pascal.el
+++ b/lisp/progmodes/pascal.el
@@ -234,9 +234,9 @@ The name of the function or case is included between the 
braces."
 
 (defcustom pascal-auto-lineup '(all)
   "List of contexts where auto lineup of :'s or ='s should be done.
-Elements can be of type: 'paramlist', 'declaration' or 'case', which will
+Elements can be of type: `paramlist', `declaration' or `case', which will
 do auto lineup in parameterlist, declarations or case-statements
-respectively.  The word 'all' will do all lineups.  '(case paramlist) for
+respectively.  The word `all' will do all lineups.  '(case paramlist) for
 instance will do lineup in case-statements and parameterlist, while '(all)
 will do all lineups."
   :type '(set :extra-offset 8
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index cb8aaad..8f50887 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -116,7 +116,7 @@ This function can be used instead of `widen' in any 
function used
 by the indentation engine to make it respect the value
 `prog-indentation-context'.
 
-This function (like 'widen') is useful inside a
+This function (like `widen') is useful inside a
 `save-restriction' to make the indentation correctly work when
 narrowing is in effect."
   (let ((chunk (cadr prog-indentation-context)))
@@ -133,26 +133,41 @@ Each element looks like (SYMBOL . CHARACTER), where the 
symbol
 matching SYMBOL (a string, not a regexp) will be shown as
 CHARACTER instead.")
 
+(defun prettify-symbols-default-compose-p (start end _match)
+  "Return true iff the symbol MATCH should be composed.
+The symbol starts at position START and ends at position END.
+This is default `prettify-symbols-compose-predicate' which is
+suitable for most programming languages such as C or Lisp."
+  ;; Check that the chars should really be composed into a symbol.
+  (let* ((syntaxes-beg (if (memq (char-syntax (char-after start)) '(?w ?_))
+                           '(?w ?_) '(?. ?\\)))
+         (syntaxes-end (if (memq (char-syntax (char-before end)) '(?w ?_))
+                           '(?w ?_) '(?. ?\\))))
+    (not (or (memq (char-syntax (or (char-before start) ?\s)) syntaxes-beg)
+             (memq (char-syntax (or (char-after end) ?\s)) syntaxes-end)
+             (nth 8 (syntax-ppss))))))
+
+(defvar-local prettify-symbols-compose-predicate
+  #'prettify-symbols-default-compose-p
+  "A predicate deciding if the currently matched symbol is to be composed.
+The matched symbol is the car of one entry in `prettify-symbols-alist'.
+The predicate receives the match's start and end position as well
+as the match-string as arguments.")
+
 (defun prettify-symbols--compose-symbol (alist)
   "Compose a sequence of characters into a symbol.
 Regexp match data 0 points to the chars."
   ;; Check that the chars should really be composed into a symbol.
-  (let* ((start (match-beginning 0))
-        (end (match-end 0))
-        (syntaxes-beg (if (memq (char-syntax (char-after start)) '(?w ?_))
-                           '(?w ?_) '(?. ?\\)))
-        (syntaxes-end (if (memq (char-syntax (char-before end)) '(?w ?_))
-                      '(?w ?_) '(?. ?\\)))
-        match)
-    (if (or (memq (char-syntax (or (char-before start) ?\s)) syntaxes-beg)
-           (memq (char-syntax (or (char-after end) ?\s)) syntaxes-end)
-            ;; syntax-ppss could modify the match data (bug#14595)
-            (progn (setq match (match-string 0)) (nth 8 (syntax-ppss))))
-       ;; No composition for you.  Let's actually remove any composition
-       ;; we may have added earlier and which is now incorrect.
-       (remove-text-properties start end '(composition))
-      ;; That's a symbol alright, so add the composition.
-      (compose-region start end (cdr (assoc match alist)))))
+  (let ((start (match-beginning 0))
+        (end (match-end 0))
+        (match (match-string 0)))
+    (if (funcall prettify-symbols-compose-predicate start end match)
+        ;; That's a symbol alright, so add the composition.
+        (compose-region start end (cdr (assoc match alist)))
+      ;; No composition for you.  Let's actually remove any
+      ;; composition we may have added earlier and which is now
+      ;; incorrect.
+      (remove-text-properties start end '(composition))))
   ;; Return nil because we're not adding any face property.
   nil)
 
@@ -177,9 +192,9 @@ in `prettify-symbols-alist' (which see), which are locally 
defined
 by major modes supporting prettifying.  To add further customizations
 for a given major mode, you can modify `prettify-symbols-alist' thus:
 
-  (add-hook 'emacs-lisp-mode-hook
+  (add-hook \\='emacs-lisp-mode-hook
             (lambda ()
-              (push '(\"<=\" . ?≤) prettify-symbols-alist)))
+              (push \\='(\"<=\" . ?≤) prettify-symbols-alist)))
 
 You can enable this mode locally in desired buffers, or use
 `global-prettify-symbols-mode' to enable it for all modes that
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 2735459..186840a 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -22,6 +22,10 @@
 ;; This file contains generic infrastructure for dealing with
 ;; projects, and a number of public functions: finding the current
 ;; root, related project directories, search path, etc.
+;;
+;; The goal is to make it easy for Lisp programs to operate on the
+;; current project, without having to know which package handles
+;; detection of that project type, parsing its config files, etc.
 
 ;;; Code:
 
@@ -78,10 +82,12 @@ It should include the current project root, as well as the 
roots
 of any other currently open projects, if they're meant to be
 edited together.  The directory names should be absolute.")
 
-(cl-defgeneric project-ignores (_project)
-  "Return the list of glob patterns that match ignored files.
+(cl-defgeneric project-ignores (_project _dir)
+  "Return the list of glob patterns to ignore inside DIR.
+Patterns can match both regular files and directories.
 To root an entry, start it with `./'.  To match directories only,
-end it with `/'."
+end it with `/'.  DIR must be either one of `project-roots', or
+an element of `project-search-path'."
   (require 'grep)
   (defvar grep-find-ignored-files)
   (nconc
@@ -91,6 +97,21 @@ end it with `/'."
     vc-directory-exclusion-list)
    grep-find-ignored-files))
 
+(defgroup project-vc nil
+  "Project implementation using the VC package."
+  :group 'tools)
+
+(defcustom project-vc-search-path nil
+  "List ot directories to include in `project-search-path'.
+The file names can be absolute, or relative to the project root."
+  :type '(repeat file)
+  :safe 'listp)
+
+(defcustom project-vc-ignores nil
+  "List ot patterns to include in `project-ignores'."
+  :type '(repeat string)
+  :safe 'listp)
+
 (defun project-try-vc (dir)
   (let* ((backend (ignore-errors (vc-responsible-backend dir)))
          (root (and backend (ignore-errors
@@ -100,18 +121,29 @@ end it with `/'."
 (cl-defmethod project-roots ((project (head vc)))
   (list (cdr project)))
 
-(cl-defmethod project-ignores ((project (head vc)))
-  (nconc
-   (let* ((dir (cdr project))
-          (backend (vc-responsible-backend dir)))
+(cl-defmethod project-search-path ((project (head vc)))
+  (append
+   (let ((root (cdr project)))
      (mapcar
-      (lambda (entry)
-        (if (string-match "\\`/" entry)
-            (replace-match "./" t t entry)
-          entry))
-      (vc-call-backend backend 'ignore-completion-table dir)))
+      (lambda (dir) (expand-file-name dir root))
+      (project--value-in-dir 'project-vc-search-path root)))
    (cl-call-next-method)))
 
+(cl-defmethod project-ignores ((project (head vc)) dir)
+  (let* ((root (cdr project))
+          backend)
+    (append
+     (when (file-equal-p dir root)
+       (setq backend (vc-responsible-backend root))
+       (mapcar
+        (lambda (entry)
+          (if (string-match "\\`/" entry)
+              (replace-match "./" t t entry)
+            entry))
+        (vc-call-backend backend 'ignore-completion-table root)))
+     (project--value-in-dir 'project-vc-ignores root)
+     (cl-call-next-method))))
+
 (defun project-ask-user (dir)
   (cons 'user (read-directory-name "Project root: " dir nil t)))
 
@@ -134,5 +166,11 @@ end it with `/'."
         (setq ref (cdr ref))))
     (cl-delete-if-not #'file-exists-p dirs)))
 
+(defun project--value-in-dir (var dir)
+  (with-temp-buffer
+    (setq default-directory dir)
+    (hack-dir-local-variables-non-file-buffer)
+    (symbol-value var)))
+
 (provide 'project)
 ;;; project.el ends here
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index 2d95345..b95c3f9 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -2305,7 +2305,7 @@ In effect it sets the `fill-prefix' when inside comments 
and then calls
     (pop-to-buffer nil)
     (Info-goto-node prolog-info-predicate-index)
     (if (not (re-search-forward str nil t))
-        (error (format "Help on predicate `%s' not found." predicate)))
+        (error "Help on predicate `%s' not found." predicate))
 
     (setq oldp (point))
     (if (re-search-forward str nil t)
@@ -2975,7 +2975,7 @@ Return the final point or nil if no such a beginning was 
found."
   (let* ((pinfo (prolog-clause-info))
          (predname (nth 0 pinfo))
          (arity (nth 1 pinfo)))
-    (message (format "%s/%d" predname arity))))
+    (message "%s/%d" predname arity)))
 
 (defun prolog-insert-predicate-template ()
   "Insert the template for the current clause."
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 95814fa..63a43c1 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2,9 +2,10 @@
 
 ;; Copyright (C) 2003-2015 Free Software Foundation, Inc.
 
-;; Author: Fabián E. Gallina <address@hidden>
+;; Author: Fabián E. Gallina <address@hidden>
 ;; URL: https://github.com/fgallina/python.el
-;; Version: 0.24.5
+;; Version: 0.25.1
+;; Package-Requires: ((emacs "24.1") (cl-lib "1.0"))
 ;; Maintainer: address@hidden
 ;; Created: Jul 2010
 ;; Keywords: languages
@@ -282,6 +283,18 @@
   :version "24.3"
   :link '(emacs-commentary-link "python"))
 
+
+;;; 24.x Compat
+
+
+(unless (fboundp 'prog-widen)
+  (defun prog-widen ()
+    (widen)))
+
+(unless (fboundp 'prog-first-column)
+  (defun prog-first-column ()
+    0))
+
 
 ;;; Bindings
 
@@ -1945,53 +1958,60 @@ Python shell.  See commentary for details."
   :safe 'booleanp)
 
 (defcustom python-shell-process-environment nil
-  "List of environment variables for Python shell.
-This variable follows the same rules as `process-environment'
-since it merges with it before the process creation routines are
-called.  When this variable is nil, the Python shell is run with
-the default `process-environment'."
+  "List of overridden environment variables for subprocesses to inherit.
+Each element should be a string of the form ENVVARNAME=VALUE.
+When this variable is non-nil, values are exported into the
+process environment before starting it.  Any variables already
+present in the current environment are superseded by variables
+set here."
   :type '(repeat string)
-  :group 'python
-  :safe 'listp)
+  :group 'python)
 
 (defcustom python-shell-extra-pythonpaths nil
   "List of extra pythonpaths for Python shell.
-The values of this variable are added to the existing value of
-PYTHONPATH in the `process-environment' variable."
+When this variable is non-nil, values added at the beginning of
+the PYTHONPATH before starting processes.  Any values present
+here that already exists in PYTHONPATH are moved to the beginning
+of the list so that they are prioritized when looking for
+modules."
   :type '(repeat string)
-  :group 'python
-  :safe 'listp)
+  :group 'python)
 
 (defcustom python-shell-exec-path nil
-  "List of path to search for binaries.
-This variable follows the same rules as `exec-path' since it
-merges with it before the process creation routines are called.
-When this variable is nil, the Python shell is run with the
-default `exec-path'."
+  "List of paths for searching executables.
+When this variable is non-nil, values added at the beginning of
+the PATH before starting processes.  Any values present here that
+already exists in PATH are moved to the beginning of the list so
+that they are prioritized when looking for executables."
   :type '(repeat string)
-  :group 'python
-  :safe 'listp)
+  :group 'python)
+
+(defcustom python-shell-remote-exec-path nil
+  "List of paths to be ensured remotely for searching executables.
+When this variable is non-nil, values are exported into remote
+hosts PATH before starting processes.  Values defined in
+`python-shell-exec-path' will take precedence to paths defined
+here.  Normally you wont use this variable directly unless you
+plan to ensure a particular set of paths to all Python shell
+executed through tramp connections."
+  :type '(repeat string)
+  :group 'python)
 
 (defcustom python-shell-virtualenv-root nil
   "Path to virtualenv root.
-This variable, when set to a string, makes the values stored in
-`python-shell-process-environment' and `python-shell-exec-path'
-to be modified properly so shells are started with the specified
+This variable, when set to a string, makes the environment to be
+modified such that shells are started within the specified
 virtualenv."
   :type '(choice (const nil) string)
-  :group 'python
-  :safe 'stringp)
+  :group 'python)
 
 (define-obsolete-variable-alias
   'python-shell-virtualenv-path 'python-shell-virtualenv-root "25.1")
 
-(defcustom python-shell-setup-codes '(python-shell-completion-setup-code
-                                      python-ffap-setup-code
-                                      python-eldoc-setup-code)
+(defcustom python-shell-setup-codes nil
   "List of code run by `python-shell-send-setup-codes'."
   :type '(repeat symbol)
-  :group 'python
-  :safe 'listp)
+  :group 'python)
 
 (defcustom python-shell-compilation-regexp-alist
   `((,(rx line-start (1+ (any " \t")) "File \""
@@ -2008,22 +2028,37 @@ virtualenv."
   :type '(alist string)
   :group 'python)
 
+(defmacro python-shell--add-to-path-with-priority (pathvar paths)
+  "Modify PATHVAR and ensure PATHS are added only once at beginning."
+  `(dolist (path (reverse ,paths))
+     (cl-delete path ,pathvar :test #'string=)
+     (cl-pushnew path ,pathvar :test #'string=)))
+
+(defun python-shell-calculate-pythonpath ()
+  "Calculate the PYTHONPATH using `python-shell-extra-pythonpaths'."
+  (let ((pythonpath
+         (tramp-compat-split-string
+          (or (getenv "PYTHONPATH") "") path-separator)))
+    (python-shell--add-to-path-with-priority
+     pythonpath python-shell-extra-pythonpaths)
+    (mapconcat 'identity pythonpath path-separator)))
+
 (defun python-shell-calculate-process-environment ()
   "Calculate `process-environment' or `tramp-remote-process-environment'.
-Pre-appends `python-shell-process-environment', sets extra
+Prepends `python-shell-process-environment', sets extra
 pythonpaths from `python-shell-extra-pythonpaths' and sets a few
 virtualenv related vars.  If `default-directory' points to a
-remote machine, the returned value is intended for
+remote host, the returned value is intended for
 `tramp-remote-process-environment'."
   (let* ((remote-p (file-remote-p default-directory))
-         (process-environment (append
-                               python-shell-process-environment
-                               (if remote-p
-                                   tramp-remote-process-environment
-                                 process-environment) nil))
-         (virtualenv (if python-shell-virtualenv-root
-                         (directory-file-name python-shell-virtualenv-root)
-                       nil)))
+         (process-environment (if remote-p
+                                  tramp-remote-process-environment
+                                process-environment))
+         (virtualenv (when python-shell-virtualenv-root
+                       (directory-file-name python-shell-virtualenv-root))))
+    (dolist (env python-shell-process-environment)
+      (pcase-let ((`(,key ,value) (split-string env "=")))
+        (setenv key value)))
     (when python-shell-unbuffered
       (setenv "PYTHONUNBUFFERED" "1"))
     (when python-shell-extra-pythonpaths
@@ -2035,50 +2070,105 @@ remote machine, the returned value is intended for
     process-environment))
 
 (defun python-shell-calculate-exec-path ()
-  "Calculate `exec-path' or `tramp-remote-path'.
-Pre-appends `python-shell-exec-path' and adds the binary
-directory for virtualenv if `python-shell-virtualenv-root' is
-set.  If `default-directory' points to a remote machine, the
-returned value is intended for `tramp-remote-path'."
-  (let ((path (append
-               ;; Use nil as the tail so that the list is a full copy,
-               ;; this is a paranoid safeguard for side-effects.
-               python-shell-exec-path
-               (if (file-remote-p default-directory)
-                   tramp-remote-path
-                 exec-path)
-               nil)))
+  "Calculate `exec-path'.
+Prepends `python-shell-exec-path' and adds the binary directory
+for virtualenv if `python-shell-virtualenv-root' is set.  If
+`default-directory' points to a remote host, the returned value
+appends `python-shell-remote-exec-path' instead of `exec-path'."
+  (let ((new-path (copy-sequence
+                   (if (file-remote-p default-directory)
+                       python-shell-remote-exec-path
+                     exec-path))))
+    (python-shell--add-to-path-with-priority
+     new-path python-shell-exec-path)
     (if (not python-shell-virtualenv-root)
-        path
-      (cons (expand-file-name "bin" python-shell-virtualenv-root)
-            path))))
+        new-path
+      (python-shell--add-to-path-with-priority
+       new-path
+       (list (expand-file-name "bin" python-shell-virtualenv-root)))
+      new-path)))
+
+(defun python-shell-tramp-refresh-remote-path (vec paths)
+  "Update VEC's remote-path giving PATHS priority."
+  (let ((remote-path (tramp-get-connection-property vec "remote-path" nil)))
+    (when remote-path
+      (python-shell--add-to-path-with-priority remote-path paths)
+      (tramp-set-connection-property vec "remote-path" remote-path)
+      (tramp-set-remote-path vec))))
+
+(defun python-shell-tramp-refresh-process-environment (vec env)
+  "Update VEC's process environment with ENV."
+  ;; Stolen from `tramp-open-connection-setup-interactive-shell'.
+  (let ((env (append (when (fboundp #'tramp-get-remote-locale)
+                       ;; Emacs<24.4 compat.
+                       (list (tramp-get-remote-locale vec)))
+                    (copy-sequence env)))
+        (tramp-end-of-heredoc
+         (if (boundp 'tramp-end-of-heredoc)
+             tramp-end-of-heredoc
+           (md5 tramp-end-of-output)))
+       unset vars item)
+    (while env
+      (setq item (tramp-compat-split-string (car env) "="))
+      (setcdr item (mapconcat 'identity (cdr item) "="))
+      (if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
+         (push (format "%s %s" (car item) (cdr item)) vars)
+       (push (car item) unset))
+      (setq env (cdr env)))
+    (when vars
+      (tramp-send-command
+       vec
+       (format "while read var val; do export $var=$val; done <<'%s'\n%s\n%s"
+              tramp-end-of-heredoc
+              (mapconcat 'identity vars "\n")
+              tramp-end-of-heredoc)
+       t))
+    (when unset
+      (tramp-send-command
+       vec (format "unset %s" (mapconcat 'identity unset " ")) t))))
 
 (defmacro python-shell-with-environment (&rest body)
   "Modify shell environment during execution of BODY.
 Temporarily sets `process-environment' and `exec-path' during
 execution of body.  If `default-directory' points to a remote
 machine then modifies `tramp-remote-process-environment' and
-`tramp-remote-path' instead."
+`python-shell-remote-exec-path' instead."
   (declare (indent 0) (debug (body)))
-  (let ((remote-p (make-symbol "remote-p")))
-    `(let* ((,remote-p (file-remote-p default-directory))
-            (process-environment
-             (if ,remote-p
-                 process-environment
-               (python-shell-calculate-process-environment)))
-            (tramp-remote-process-environment
-             (if ,remote-p
-                 (python-shell-calculate-process-environment)
-               tramp-remote-process-environment))
-            (exec-path
-             (if ,remote-p
-                 exec-path
-               (python-shell-calculate-exec-path)))
-            (tramp-remote-path
-             (if ,remote-p
-                 (python-shell-calculate-exec-path)
-               tramp-remote-path)))
-       ,(macroexp-progn body))))
+  (let ((vec (make-symbol "vec")))
+    `(progn
+       (let* ((,vec
+               (when (file-remote-p default-directory)
+                 (ignore-errors
+                   (tramp-dissect-file-name default-directory 'noexpand))))
+              (process-environment
+               (if ,vec
+                   process-environment
+                 (python-shell-calculate-process-environment)))
+              (exec-path
+               (if ,vec
+                   exec-path
+                 (python-shell-calculate-exec-path)))
+              (tramp-remote-process-environment
+               (if ,vec
+                   (python-shell-calculate-process-environment)
+                 tramp-remote-process-environment)))
+         (when (tramp-get-connection-process ,vec)
+           ;; For already existing connections, the new exec path must
+           ;; be re-set, otherwise it won't take effect.  One example
+           ;; of such case is when remote dir-locals are read and
+           ;; *then* subprocesses are triggered within the same
+           ;; connection.
+           (python-shell-tramp-refresh-remote-path
+            ,vec (python-shell-calculate-exec-path))
+           ;; The `tramp-remote-process-environment' variable is only
+           ;; effective when the started process is an interactive
+           ;; shell, otherwise (like in the case of processes started
+           ;; with `process-file') the environment is not changed.
+           ;; This makes environment modifications effective
+           ;; unconditionally.
+           (python-shell-tramp-refresh-process-environment
+            ,vec tramp-remote-process-environment))
+         ,(macroexp-progn body)))))
 
 (defvar python-shell--prompt-calculated-input-regexp nil
   "Calculated input prompt regexp for inferior python shell.
@@ -2110,6 +2200,8 @@ detection and just returns nil."
                     "ps_json = '\\n[\"%s\", \"%s\", \"%s\"]\\n' % tuple(ps)\n"
                     "print (ps_json)\n"
                     "sys.exit(0)\n"))
+             (interpreter python-shell-interpreter)
+             (interpreter-arg python-shell-interpreter-interactive-arg)
              (output
               (with-temp-buffer
                 ;; TODO: improve error handling by using
@@ -2119,11 +2211,11 @@ detection and just returns nil."
                   (let ((code-file (python-shell--save-temp-file code)))
                     ;; Use `process-file' as it is remote-host friendly.
                     (process-file
-                     python-shell-interpreter
+                     interpreter
                      code-file
                      '(t nil)
                      nil
-                     python-shell-interpreter-interactive-arg)
+                     interpreter-arg)
                     ;; Try to cleanup
                     (delete-file code-file)))
                 (buffer-string)))
@@ -2259,28 +2351,14 @@ the `buffer-name'."
 
 (defun python-shell-calculate-command ()
   "Calculate the string used to execute the inferior Python process."
-  (python-shell-with-environment
-    ;; `exec-path' gets tweaked so that virtualenv's specific
-    ;; `python-shell-interpreter' absolute path can be found by
-    ;; `executable-find'.
-    (format "%s %s"
-            (shell-quote-argument python-shell-interpreter)
-            python-shell-interpreter-args)))
+  (format "%s %s"
+          (shell-quote-argument python-shell-interpreter)
+          python-shell-interpreter-args))
 
 (define-obsolete-function-alias
   'python-shell-parse-command
   #'python-shell-calculate-command "25.1")
 
-(defun python-shell-calculate-pythonpath ()
-  "Calculate the PYTHONPATH using `python-shell-extra-pythonpaths'."
-  (let ((pythonpath (getenv "PYTHONPATH"))
-        (extra (mapconcat 'identity
-                          python-shell-extra-pythonpaths
-                          path-separator)))
-    (if pythonpath
-        (concat extra path-separator pythonpath)
-      extra)))
-
 (defvar python-shell--package-depth 10)
 
 (defun python-shell-package-enable (directory package)
@@ -2527,6 +2605,40 @@ With argument MSG show activation/deactivation message."
       (python-shell-font-lock-turn-off msg))
     python-shell-font-lock-enable))
 
+(defvar python-shell--first-prompt-received-output-buffer nil)
+(defvar python-shell--first-prompt-received nil)
+
+(defcustom python-shell-first-prompt-hook nil
+  "Hook run upon first (non-pdb) shell prompt detection.
+This is the place for shell setup functions that need to wait for
+output.  Since the first prompt is ensured, this helps the
+current process to not hang waiting for output by safeguarding
+interactive actions can be performed.  This is useful to safely
+attach setup code for long-running processes that eventually
+provide a shell."
+  :type 'hook
+  :group 'python)
+
+(defun python-shell-comint-watch-for-first-prompt-output-filter (output)
+  "Run `python-shell-first-prompt-hook' when first prompt is found in OUTPUT."
+  (when (not python-shell--first-prompt-received)
+    (set (make-local-variable 
'python-shell--first-prompt-received-output-buffer)
+         (concat python-shell--first-prompt-received-output-buffer
+                 (ansi-color-filter-apply output)))
+    (when (python-shell-comint-end-of-output-p
+           python-shell--first-prompt-received-output-buffer)
+      (if (string-match-p
+           (concat python-shell-prompt-pdb-regexp (rx eos))
+           (or python-shell--first-prompt-received-output-buffer ""))
+          ;; Skip pdb prompts and reset the buffer.
+          (setq python-shell--first-prompt-received-output-buffer nil)
+        (set (make-local-variable 'python-shell--first-prompt-received) t)
+        (setq python-shell--first-prompt-received-output-buffer nil)
+        (with-current-buffer (current-buffer)
+          (let ((inhibit-quit nil))
+            (run-hooks 'python-shell-first-prompt-hook))))))
+  output)
+
 ;; Used to hold user interactive overrides to
 ;; `python-shell-interpreter' and `python-shell-interpreter-args' that
 ;; will be made buffer-local by `inferior-python-mode':
@@ -2576,6 +2688,7 @@ variable.
   (setq mode-line-process '(":%s"))
   (set (make-local-variable 'comint-output-filter-functions)
        '(ansi-color-process-output
+         python-shell-comint-watch-for-first-prompt-output-filter
          python-pdbtrack-comint-output-filter-function
          python-comint-postoutput-scroll-to-bottom))
   (set (make-local-variable 'compilation-error-regexp-alist)
@@ -2589,9 +2702,7 @@ variable.
   (make-local-variable 'python-shell-internal-last-output)
   (when python-shell-font-lock-enable
     (python-shell-font-lock-turn-on))
-  (compilation-shell-minor-mode 1)
-  (python-shell-accept-process-output
-   (get-buffer-process (current-buffer))))
+  (compilation-shell-minor-mode 1))
 
 (defun python-shell-make-comint (cmd proc-name &optional show internal)
   "Create a Python shell comint buffer.
@@ -2708,7 +2819,8 @@ of `error' with a user-friendly message."
   (or (python-shell-get-process)
       (if interactivep
           (user-error
-           "Start a Python process first with `M-x run-python' or `%s'."
+           "Start a Python process first with ‘%s’ or ‘%s’."
+           (substitute-command-keys "\\[run-python]")
            ;; Get the binding.
            (key-description
             (where-is-internal
@@ -2874,29 +2986,32 @@ the python shell:
      coding cookie is added.
   4. Wraps indented regions under an \"if True:\" block so the
      interpreter evaluates them correctly."
-  (let* ((substring (buffer-substring-no-properties start end))
+  (let* ((start (save-excursion
+                  ;; Normalize start to the line beginning position.
+                  (goto-char start)
+                  (line-beginning-position)))
+         (substring (buffer-substring-no-properties start end))
          (starts-at-point-min-p (save-restriction
                                   (widen)
                                   (= (point-min) start)))
          (encoding (python-info-encoding))
+         (toplevel-p (zerop (save-excursion
+                              (goto-char start)
+                              (python-util-forward-comment 1)
+                              (current-indentation))))
          (fillstr (when (not starts-at-point-min-p)
                     (concat
                      (format "# -*- coding: %s -*-\n" encoding)
                      (make-string
                       ;; Subtract 2 because of the coding cookie.
-                      (- (line-number-at-pos start) 2) ?\n))))
-         (toplevel-block-p (save-excursion
-                             (goto-char start)
-                             (or (zerop (line-number-at-pos start))
-                                 (progn
-                                   (python-util-forward-comment 1)
-                                   (zerop (current-indentation)))))))
+                      (- (line-number-at-pos start) 2) ?\n)))))
     (with-temp-buffer
       (python-mode)
-      (if fillstr (insert fillstr))
+      (when fillstr
+        (insert fillstr))
       (insert substring)
       (goto-char (point-min))
-      (when (not toplevel-block-p)
+      (when (not toplevel-p)
         (insert "if True:")
         (delete-region (point) (line-end-position)))
       (when nomain
@@ -3039,76 +3154,82 @@ t when called interactively."
   "Send all setup code for shell.
 This function takes the list of setup code to send from the
 `python-shell-setup-codes' list."
-  (let ((process (python-shell-get-process))
-        (code (concat
-               (mapconcat
-                (lambda (elt)
-                  (cond ((stringp elt) elt)
-                        ((symbolp elt) (symbol-value elt))
-                        (t "")))
-                python-shell-setup-codes
-                "\n\n")
-               "\n\nprint ('python.el: sent setup code')")))
-    (python-shell-send-string code process)
-    (python-shell-accept-process-output process)))
-
-(add-hook 'inferior-python-mode-hook
+  (when python-shell-setup-codes
+    (let ((process (python-shell-get-process))
+          (code (concat
+                 (mapconcat
+                  (lambda (elt)
+                    (cond ((stringp elt) elt)
+                          ((symbolp elt) (symbol-value elt))
+                          (t "")))
+                  python-shell-setup-codes
+                  "\n\nprint ('python.el: sent setup code')"))))
+      (python-shell-send-string code process)
+      (python-shell-accept-process-output process))))
+
+(add-hook 'python-shell-first-prompt-hook
           #'python-shell-send-setup-code)
 
 
 ;;; Shell completion
 
 (defcustom python-shell-completion-setup-code
-  "try:
-    import readline
-except:
-    def __PYTHON_EL_get_completions(text):
-        return []
-else:
-    def __PYTHON_EL_get_completions(text):
+  "
+def __PYTHON_EL_get_completions(text):
+    completions = []
+    completer = None
+
+    try:
+        import readline
+
         try:
             import __builtin__
         except ImportError:
             # Python 3
             import builtins as __builtin__
         builtins = dir(__builtin__)
-        completions = []
+
         is_ipython = ('__IPYTHON__' in builtins or
                       '__IPYTHON__active' in builtins)
         splits = text.split()
         is_module = splits and splits[0] in ('from', 'import')
-        try:
-            if is_ipython and is_module:
-                from IPython.core.completerlib import module_completion
-                completions = module_completion(text.strip())
-            elif is_ipython and '__IP' in builtins:
-                completions = __IP.complete(text)
-            elif is_ipython and 'get_ipython' in builtins:
-                completions = get_ipython().Completer.all_completions(text)
-            else:
-                # Try to reuse current completer.
+
+        if is_ipython and is_module:
+            from IPython.core.completerlib import module_completion
+            completions = module_completion(text.strip())
+        elif is_ipython and '__IP' in builtins:
+            completions = __IP.complete(text)
+        elif is_ipython and 'get_ipython' in builtins:
+            completions = get_ipython().Completer.all_completions(text)
+        else:
+            # Try to reuse current completer.
+            completer = readline.get_completer()
+            if not completer:
+                # importing rlcompleter sets the completer, use it as a
+                # last resort to avoid breaking customizations.
+                import rlcompleter
                 completer = readline.get_completer()
-                if not completer:
-                    # importing rlcompleter sets the completer, use it as a
-                    # last resort to avoid breaking customizations.
-                    import rlcompleter
-                    completer = readline.get_completer()
-                i = 0
-                while True:
-                    completion = completer(text, i)
-                    if not completion:
-                        break
-                    i += 1
-                    completions.append(completion)
-        except:
-            pass
-        return completions"
+            if getattr(completer, 'PYTHON_EL_WRAPPED', False):
+                completer.print_mode = False
+            i = 0
+            while True:
+                completion = completer(text, i)
+                if not completion:
+                    break
+                i += 1
+                completions.append(completion)
+    except:
+        pass
+    finally:
+        if getattr(completer, 'PYTHON_EL_WRAPPED', False):
+            completer.print_mode = True
+    return completions"
   "Code used to setup completion in inferior Python processes."
   :type 'string
   :group 'python)
 
 (defcustom python-shell-completion-string-code
-  "';'.join(__PYTHON_EL_get_completions('''%s'''))\n"
+  "';'.join(__PYTHON_EL_get_completions('''%s'''))"
   "Python code used to get a string of completions separated by semicolons.
 The string passed to the function is the current python name or
 the full statement in the case of imports."
@@ -3164,57 +3285,92 @@ When a match is found, native completion is disabled."
          python-shell-completion-native-try-output-timeout))
     (python-shell-completion-native-get-completions
      (get-buffer-process (current-buffer))
-     nil "int")))
+     nil "")))
 
 (defun python-shell-completion-native-setup ()
   "Try to setup native completion, return non-nil on success."
   (let ((process (python-shell-get-process)))
-    (python-shell-send-string "
+    (with-current-buffer (process-buffer process)
+      (python-shell-send-string "
 def __PYTHON_EL_native_completion_setup():
     try:
         import readline
+
         try:
             import __builtin__
         except ImportError:
             # Python 3
             import builtins as __builtin__
+
         builtins = dir(__builtin__)
         is_ipython = ('__IPYTHON__' in builtins or
                       '__IPYTHON__active' in builtins)
+
         class __PYTHON_EL_Completer:
+            '''Completer wrapper that prints candidates to stdout.
+
+            It wraps an existing completer function and changes its behavior so
+            that the user input is unchanged and real candidates are printed to
+            stdout.
+
+            Returned candidates are '0__dummy_completion__' and
+            '1__dummy_completion__' in that order ('0__dummy_completion__' is
+            returned repeatedly until all possible candidates are consumed).
+
+            The real candidates are printed to stdout so that they can be
+            easily retrieved through comint output redirect trickery.
+            '''
+
             PYTHON_EL_WRAPPED = True
+
             def __init__(self, completer):
                 self.completer = completer
                 self.last_completion = None
+                self.print_mode = True
+
             def __call__(self, text, state):
                 if state == 0:
-                    # The first completion is always a dummy completion.  This
-                    # ensures proper output for sole completions and a current
-                    # input safeguard when no completions are available.
+                    # Set the first dummy completion.
                     self.last_completion = None
                     completion = '0__dummy_completion__'
                 else:
                     completion = self.completer(text, state - 1)
+
                 if not completion:
-                    if state == 1:
-                        # When no completions are available, two non-sharing
-                        # prefix strings are returned just to ensure output
+                    if self.last_completion != '1__dummy_completion__':
+                        # When no more completions are available, returning a
+                        # dummy with non-sharing prefix allow to ensure output
                         # while preventing changes to current input.
+                        # Coincidentally it's also the end of output.
                         completion = '1__dummy_completion__'
-                    elif self.last_completion != '~~~~__dummy_completion__':
-                        # This marks the end of output.
-                        completion = '~~~~__dummy_completion__'
                 elif completion.endswith('('):
                     # Remove parens on callables as it breaks completion on
                     # arguments (e.g. str(Ari<tab>)).
                     completion = completion[:-1]
                 self.last_completion = completion
-                return completion
+
+                if completion in (
+                        '0__dummy_completion__', '1__dummy_completion__'):
+                    return completion
+                elif completion:
+                    # For every non-dummy completion, return a repeated dummy
+                    # one and print the real candidate so it can be retrieved
+                    # by comint output filters.
+                    if self.print_mode:
+                        print (completion)
+                        return '0__dummy_completion__'
+                    else:
+                        return completion
+                else:
+                    return completion
+
         completer = readline.get_completer()
+
         if not completer:
             # Used as last resort to avoid breaking customizations.
             import rlcompleter
             completer = readline.get_completer()
+
         if completer and not getattr(completer, 'PYTHON_EL_WRAPPED', False):
             # Wrap the existing completer function only once.
             new_completer = __PYTHON_EL_Completer(completer)
@@ -3229,22 +3385,26 @@ def __PYTHON_EL_native_completion_setup():
                 # function into the existing instance directly:
                 instance = getattr(completer, 'im_self', completer.__self__)
                 instance.rlcomplete = new_completer
+
         if readline.__doc__ and 'libedit' in readline.__doc__:
             readline.parse_and_bind('bind ^I rl_complete')
         else:
             readline.parse_and_bind('tab: complete')
             # Require just one tab to send output.
             readline.parse_and_bind('set show-all-if-ambiguous on')
-        print ('python.el: readline is available')
-    except IOError:
-        print ('python.el: readline not available')
-__PYTHON_EL_native_completion_setup()"
-     process)
-    (python-shell-accept-process-output process)
-    (when (save-excursion
-            (re-search-backward
-             (regexp-quote "python.el: readline is available") nil t 1))
-      (python-shell-completion-native-try))))
+
+        print ('python.el: native completion setup loaded')
+    except:
+        print ('python.el: native completion setup failed')
+
+__PYTHON_EL_native_completion_setup()" process)
+      (when (and
+             (python-shell-accept-process-output
+              process python-shell-completion-native-try-output-timeout)
+             (save-excursion
+               (re-search-backward
+                (regexp-quote "python.el: native completion setup loaded") nil 
t 1)))
+        (python-shell-completion-native-try)))))
 
 (defun python-shell-completion-native-turn-off (&optional msg)
   "Turn off shell native completions.
@@ -3291,7 +3451,7 @@ With argument MSG show activation/deactivation message."
   "Like `python-shell-completion-native-turn-on-maybe' but force messages."
   (python-shell-completion-native-turn-on-maybe t))
 
-(add-hook 'inferior-python-mode-hook
+(add-hook 'python-shell-first-prompt-hook
           #'python-shell-completion-native-turn-on-maybe-with-msg)
 
 (defun python-shell-completion-native-toggle (&optional msg)
@@ -3309,103 +3469,75 @@ With argument MSG show activation/deactivation 
message."
 When IMPORT is non-nil takes precedence over INPUT for
 completion."
   (with-current-buffer (process-buffer process)
-    (when (and python-shell-completion-native-enable
-               (python-util-comint-last-prompt)
-               (>= (point) (cdr (python-util-comint-last-prompt))))
-      (let* ((input (or import input))
-             (original-filter-fn (process-filter process))
-             (redirect-buffer (get-buffer-create
-                               python-shell-completion-native-redirect-buffer))
-             (separators (python-rx (or whitespace open-paren close-paren)))
-             (trigger "\t")
-             (new-input (concat input trigger))
-             (input-length
-              (save-excursion
-                (+ (- (point-max) (comint-bol)) (length new-input))))
-             (delete-line-command (make-string input-length ?\b))
-             (input-to-send (concat new-input delete-line-command)))
-        ;; Ensure restoring the process filter, even if the user quits
-        ;; or there's some other error.
-        (unwind-protect
-            (with-current-buffer redirect-buffer
-              ;; Cleanup the redirect buffer
-              (delete-region (point-min) (point-max))
-              ;; Mimic `comint-redirect-send-command', unfortunately it
-              ;; can't be used here because it expects a newline in the
-              ;; command and that's exactly what we are trying to avoid.
-              (let ((comint-redirect-echo-input nil)
-                    (comint-redirect-verbose nil)
-                    (comint-redirect-perform-sanity-check nil)
-                    (comint-redirect-insert-matching-regexp nil)
-                    ;; Feed it some regex that will never match.
-                    (comint-redirect-finished-regexp "^\\'$")
-                    (comint-redirect-output-buffer redirect-buffer)
-                    (current-time (float-time)))
-                ;; Compatibility with Emacs 24.x.  Comint changed and
-                ;; now `comint-redirect-filter' gets 3 args.  This
-                ;; checks which version of `comint-redirect-filter' is
-                ;; in use based on its args and uses `apply-partially'
-                ;; to make it up for the 3 args case.
-                (if (= (length
-                        (help-function-arglist 'comint-redirect-filter)) 3)
-                    (set-process-filter
-                     process (apply-partially
-                              #'comint-redirect-filter original-filter-fn))
-                  (set-process-filter process #'comint-redirect-filter))
-                (process-send-string process input-to-send)
-                ;; Grab output until our dummy completion used as
-                ;; output end marker is found.  Output is accepted
-                ;; *very* quickly to keep the shell super-responsive.
-                (while (and (not (re-search-backward 
"~~~~__dummy_completion__" nil t))
-                            (< (- (float-time) current-time)
-                               python-shell-completion-native-output-timeout))
-                  (accept-process-output process 0.01))
+    (let* ((input (or import input))
+           (original-filter-fn (process-filter process))
+           (redirect-buffer (get-buffer-create
+                             python-shell-completion-native-redirect-buffer))
+           (trigger "\t")
+           (new-input (concat input trigger))
+           (input-length
+            (save-excursion
+              (+ (- (point-max) (comint-bol)) (length new-input))))
+           (delete-line-command (make-string input-length ?\b))
+           (input-to-send (concat new-input delete-line-command)))
+      ;; Ensure restoring the process filter, even if the user quits
+      ;; or there's some other error.
+      (unwind-protect
+          (with-current-buffer redirect-buffer
+            ;; Cleanup the redirect buffer
+            (erase-buffer)
+            ;; Mimic `comint-redirect-send-command', unfortunately it
+            ;; can't be used here because it expects a newline in the
+            ;; command and that's exactly what we are trying to avoid.
+            (let ((comint-redirect-echo-input nil)
+                  (comint-redirect-completed nil)
+                  (comint-redirect-perform-sanity-check nil)
+                  (comint-redirect-insert-matching-regexp t)
+                  (comint-redirect-finished-regexp
+                   "1__dummy_completion__[[:space:]]*\n")
+                  (comint-redirect-output-buffer redirect-buffer))
+              ;; Compatibility with Emacs 24.x.  Comint changed and
+              ;; now `comint-redirect-filter' gets 3 args.  This
+              ;; checks which version of `comint-redirect-filter' is
+              ;; in use based on its args and uses `apply-partially'
+              ;; to make it up for the 3 args case.
+              (if (= (length
+                      (help-function-arglist 'comint-redirect-filter)) 3)
+                  (set-process-filter
+                   process (apply-partially
+                            #'comint-redirect-filter original-filter-fn))
+                (set-process-filter process #'comint-redirect-filter))
+              (process-send-string process input-to-send)
+              ;; Grab output until our dummy completion used as
+              ;; output end marker is found.
+              (when (python-shell-accept-process-output
+                     process python-shell-completion-native-output-timeout
+                     comint-redirect-finished-regexp)
+                (re-search-backward "0__dummy_completion__" nil t)
                 (cl-remove-duplicates
-                 (cl-remove-if
-                  (lambda (c)
-                    (string-match "__dummy_completion__" c))
-                  (split-string
-                   (buffer-substring-no-properties
-                    (point-min) (point-max))
-                   separators t))
-                 :test #'string=)))
-          (set-process-filter process original-filter-fn))))))
+                 (split-string
+                  (buffer-substring-no-properties
+                   (line-beginning-position) (point-min))
+                  "[ \f\t\n\r\v()]+" t)
+                 :test #'string=))))
+        (set-process-filter process original-filter-fn)))))
 
 (defun python-shell-completion-get-completions (process import input)
   "Do completion at point using PROCESS for IMPORT or INPUT.
 When IMPORT is non-nil takes precedence over INPUT for
 completion."
+  (setq input (or import input))
   (with-current-buffer (process-buffer process)
-    (let* ((prompt
-            (let ((prompt-boundaries (python-util-comint-last-prompt)))
-              (buffer-substring-no-properties
-               (car prompt-boundaries) (cdr prompt-boundaries))))
-           (completion-code
-            ;; Check whether a prompt matches a pdb string, an import
-            ;; statement or just the standard prompt and use the
-            ;; correct python-shell-completion-*-code string
-            (cond ((and (string-match
-                         (concat "^" python-shell-prompt-pdb-regexp) prompt))
-                   ;; Since there are no guarantees the user will remain
-                   ;; in the same context where completion code was sent
-                   ;; (e.g. user steps into a function), safeguard
-                   ;; resending completion setup continuously.
-                   (concat python-shell-completion-setup-code
-                           "\nprint (" python-shell-completion-string-code 
")"))
-                  ((string-match
-                    python-shell--prompt-calculated-input-regexp prompt)
-                   python-shell-completion-string-code)
-                  (t nil)))
-           (subject (or import input)))
-      (and completion-code
-           (> (length input) 0)
-           (let ((completions
-                  (python-util-strip-string
-                   (python-shell-send-string-no-output
-                    (format completion-code subject) process))))
-             (and (> (length completions) 2)
-                  (split-string completions
-                                "^'\\|^\"\\|;\\|'$\\|\"$" t)))))))
+    (let ((completions
+           (python-util-strip-string
+            (python-shell-send-string-no-output
+             (format
+              (concat python-shell-completion-setup-code
+                      "\nprint (" python-shell-completion-string-code ")")
+              input) process))))
+      (when (> (length completions) 2)
+        (split-string completions
+                      "^'\\|^\"\\|;\\|'$\\|\"$" t)))))
 
 (defun python-shell-completion-at-point (&optional process)
   "Function for `completion-at-point-functions' in `inferior-python-mode'.
@@ -3432,10 +3564,26 @@ using that one instead of current buffer's process."
               (forward-char (length (match-string-no-properties 0)))
               (point))))
          (end (point))
+         (prompt-boundaries (python-util-comint-last-prompt))
+         (prompt
+          (with-current-buffer (process-buffer process)
+            (when prompt-boundaries
+              (buffer-substring-no-properties
+               (car prompt-boundaries) (cdr prompt-boundaries)))))
          (completion-fn
-          (if python-shell-completion-native-enable
-              #'python-shell-completion-native-get-completions
-            #'python-shell-completion-get-completions)))
+          (with-current-buffer (process-buffer process)
+            (cond ((or (null prompt)
+                       (< (point) (cdr prompt-boundaries)))
+                   #'ignore)
+                  ((or (not python-shell-completion-native-enable)
+                       ;; Even if native completion is enabled, for
+                       ;; pdb interaction always use the fallback
+                       ;; mechanism since the completer is changed.
+                       ;; Also, since pdb interaction is single-line
+                       ;; based, this is enough.
+                       (string-match-p python-shell-prompt-pdb-regexp prompt))
+                   #'python-shell-completion-get-completions)
+                  (t #'python-shell-completion-native-get-completions)))))
     (list start end
           (completion-table-dynamic
            (apply-partially
@@ -3857,8 +4005,8 @@ The skeleton will be bound to python-skeleton-NAME."
   (declare (indent 2))
   (let* ((name (symbol-name name))
          (function-name (intern (concat "python-skeleton--" name)))
-         (msg (format
-               "Add '%s' clause? " name)))
+         (msg (format-message
+               "Add ‘%s’ clause? " name)))
     (when (not skel)
       (setq skel
             `(< ,(format "%s:" name) \n \n
@@ -3949,13 +4097,22 @@ The skeleton will be bound to python-skeleton-NAME."
 ;;; FFAP
 
 (defcustom python-ffap-setup-code
-  "def __FFAP_get_module_path(module):
+  "
+def __FFAP_get_module_path(objstr):
     try:
-        import os
-        path = __import__(module).__file__
-        if path[-4:] == '.pyc' and os.path.exists(path[0:-1]):
-            path = path[:-1]
-        return path
+        import inspect
+        import os.path
+        # NameError exceptions are delayed until this point.
+        obj = eval(objstr)
+        module = inspect.getmodule(obj)
+        filename = module.__file__
+        ext = os.path.splitext(filename)[1]
+        if ext in ('.pyc', '.pyo'):
+            # Point to the source file.
+            filename = filename[:-1]
+        if os.path.exists(filename):
+            return filename
+        return ''
     except:
         return ''"
   "Python code to get a module path."
@@ -3963,7 +4120,7 @@ The skeleton will be bound to python-skeleton-NAME."
   :group 'python)
 
 (defcustom python-ffap-string-code
-  "__FFAP_get_module_path('''%s''')\n"
+  "__FFAP_get_module_path('''%s''')"
   "Python code used to get a string with the path of a module."
   :type 'string
   :group 'python)
@@ -3978,9 +4135,12 @@ The skeleton will be bound to python-skeleton-NAME."
         nil
       (let ((module-file
              (python-shell-send-string-no-output
-              (format python-ffap-string-code module) process)))
-        (when module-file
-          (substring-no-properties module-file 1 -1))))))
+              (concat
+               python-ffap-setup-code
+               "\nprint (" (format python-ffap-string-code module) ")")
+              process)))
+        (unless (zerop (length module-file))
+          (python-util-strip-string module-file))))))
 
 (defvar ffap-alist)
 
@@ -4066,13 +4226,13 @@ See `python-check-command' for the default."
             doc = doc.splitlines()[0]
     except:
         doc = ''
-    print (doc)"
+    return doc"
   "Python code to setup documentation retrieval."
   :type 'string
   :group 'python)
 
 (defcustom python-eldoc-string-code
-  "__PYDOC_get_help('''%s''')\n"
+  "__PYDOC_get_help('''%s''')"
   "Python code used to get a string with the documentation of an object."
   :type 'string
   :group 'python)
@@ -4098,15 +4258,20 @@ returns will be used.  If not FORCE-PROCESS is passed 
what
 `python-shell-get-process' returns is used."
   (let ((process (or force-process (python-shell-get-process))))
     (when process
-      (let ((input (or force-input
-                       (python-eldoc--get-symbol-at-point))))
-        (and input
-             ;; Prevent resizing the echo area when iPython is
-             ;; enabled.  Bug#18794.
-             (python-util-strip-string
-              (python-shell-send-string-no-output
-               (format python-eldoc-string-code input)
-               process)))))))
+      (let* ((input (or force-input
+                        (python-eldoc--get-symbol-at-point)))
+             (docstring
+              (when input
+                ;; Prevent resizing the echo area when iPython is
+                ;; enabled.  Bug#18794.
+                (python-util-strip-string
+                 (python-shell-send-string-no-output
+                  (concat
+                   python-eldoc-setup-code
+                   "\nprint(" (format python-eldoc-string-code input) ")")
+                  process)))))
+        (unless (zerop (length docstring))
+          docstring)))))
 
 (defun python-eldoc-function ()
   "`eldoc-documentation-function' for Python.
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 21ad102..5d59a56 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1178,9 +1178,7 @@ delimiter."
           (setq in-string (match-end 0))
           (goto-char ruby-indent-point)))
        (t
-        (error (format "Bad string %s"
-                       (buffer-substring (point) pnt)
-                       ))))))
+        (error "Bad string %s" (buffer-substring (point) pnt))))))
   (list in-string nest depth pcol))
 
 (defun ruby-parse-region (start end)
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 6709e75..735c8f9 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1675,7 +1675,7 @@ with your script for an edit-interpret-debug cycle."
          ((string-match "[.]sh\\>"     buffer-file-name) "sh")
          ((string-match "[.]bash\\>"   buffer-file-name) "bash")
          ((string-match "[.]ksh\\>"    buffer-file-name) "ksh")
-         ((string-match "[.]csh\\>"    buffer-file-name) "csh")
+         ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh")
         ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
          (t sh-shell-file))
    nil nil)
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 3800cfb..18f445c 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -3799,7 +3799,7 @@ Note that SQL doesn't have an escape character unless you 
specify
 one.  If you specify backslash as escape character in SQL, you
 must tell Emacs.  Here's how to do that in your init file:
 
-\(add-hook 'sql-mode-hook
+\(add-hook \\='sql-mode-hook
           (lambda ()
            (modify-syntax-entry ?\\\\ \".\" sql-mode-syntax-table)))"
   :group 'SQL
@@ -3896,9 +3896,9 @@ If you want to make SQL buffers limited in length, add 
the function
 Here is an example for your init file.  It keeps the SQLi buffer a
 certain length.
 
-\(add-hook 'sql-interactive-mode-hook
+\(add-hook \\='sql-interactive-mode-hook
     \(function (lambda ()
-        \(setq comint-output-filter-functions 'comint-truncate-buffer))))
+        \(setq comint-output-filter-functions \\='comint-truncate-buffer))))
 
 Here is another example.  It will always put point back to the statement
 you entered, right above the output it created.
@@ -4276,7 +4276,7 @@ passed as command line arguments."
     ;; work for remote hosts; we suppress the check there.
     (unless (or (file-remote-p default-directory)
                (executable-find program))
-      (error "Unable to locate SQL program \'%s\'" program))
+      (error "Unable to locate SQL program ‘%s’" program))
     ;; Make sure buffer name is unique.
     (when (sql-buffer-live-p (format "*%s*" buf-name))
       (setq buf-name (format "SQL-%s" product))
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 11b7561..107dee5 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -77,8 +77,8 @@
 ;; the following in code (please un comment it first!) in your
 ;; .emacs, or in your site's site-load.el
 
-; (autoload 'verilog-mode "verilog-mode" "Verilog mode" t )
-; (add-to-list 'auto-mode-alist '("\\.[ds]?vh?\\'" . verilog-mode))
+;;   (autoload 'verilog-mode "verilog-mode" "Verilog mode" t )
+;;   (add-to-list 'auto-mode-alist '("\\.[ds]?vh?\\'" . verilog-mode))
 
 ;; Be sure to examine at the help for verilog-auto, and the other
 ;; verilog-auto-* functions for some major coding time savers.
@@ -92,38 +92,38 @@
 ;; in Local Variables in every file.  Otherwise, different people's
 ;; AUTO expansion may result different whitespace changes.
 ;;
-; ;; Enable syntax highlighting of **all** languages
-; (global-font-lock-mode t)
-;
-; ;; User customization for Verilog mode
-; (setq verilog-indent-level             3
-;       verilog-indent-level-module      3
-;       verilog-indent-level-declaration 3
-;       verilog-indent-level-behavioral  3
-;       verilog-indent-level-directive   1
-;       verilog-case-indent              2
-;       verilog-auto-newline             t
-;       verilog-auto-indent-on-newline   t
-;       verilog-tab-always-indent        t
-;       verilog-auto-endcomments         t
-;       verilog-minimum-comment-distance 40
-;       verilog-indent-begin-after-if    t
-;       verilog-auto-lineup              'declarations
-;       verilog-highlight-p1800-keywords nil
-;       verilog-linter                  "my_lint_shell_command"
-;       )
-
-;; 
+;;   ;; Enable syntax highlighting of **all** languages
+;;   (global-font-lock-mode t)
+;;
+;;   ;; User customization for Verilog mode
+;;   (setq verilog-indent-level             3
+;;         verilog-indent-level-module      3
+;;         verilog-indent-level-declaration 3
+;;         verilog-indent-level-behavioral  3
+;;         verilog-indent-level-directive   1
+;;         verilog-case-indent              2
+;;         verilog-auto-newline             t
+;;         verilog-auto-indent-on-newline   t
+;;         verilog-tab-always-indent        t
+;;         verilog-auto-endcomments         t
+;;         verilog-minimum-comment-distance 40
+;;         verilog-indent-begin-after-if    t
+;;         verilog-auto-lineup              'declarations
+;;         verilog-highlight-p1800-keywords nil
+;;         verilog-linter                   "my_lint_shell_command"
+;;         )
 
+
 ;;; History:
 ;;
 ;; See commit history at http://www.veripool.org/verilog-mode.html
 ;; (This section is required to appease checkdoc.)
 
 ;;; Code:
+;;
 
 ;; This variable will always hold the version number of the mode
-(defconst verilog-mode-version "2015-05-14-6232468-vpo-GNU"
+(defconst verilog-mode-version "2015-08-16-ce03c7a-vpo-GNU"
   "Version of this Verilog mode.")
 (defconst verilog-mode-release-emacs t
   "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -150,36 +150,36 @@
       (error nil))
     (condition-case nil
         (if (fboundp 'when)
-            nil ;; fab
+            nil  ; fab
           (defmacro when (cond &rest body)
             (list 'if cond (cons 'progn body))))
       (error nil))
     (condition-case nil
         (if (fboundp 'unless)
-            nil ;; fab
+            nil  ; fab
           (defmacro unless (cond &rest body)
             (cons 'if (cons cond (cons nil body)))))
       (error nil))
     (condition-case nil
         (if (fboundp 'store-match-data)
-            nil ;; fab
+            nil  ; fab
           (defmacro store-match-data (&rest _args) nil))
       (error nil))
     (condition-case nil
         (if (fboundp 'char-before)
-            nil ;; great
+            nil  ; great
           (defmacro char-before (&rest _body)
             (char-after (1- (point)))))
       (error nil))
     (condition-case nil
         (if (fboundp 'when)
-            nil ;; fab
+            nil  ; fab
           (defsubst point-at-bol (&optional N)
             (save-excursion (beginning-of-line N) (point))))
       (error nil))
     (condition-case nil
         (if (fboundp 'when)
-            nil ;; fab
+            nil  ; fab
           (defsubst point-at-eol (&optional N)
             (save-excursion (end-of-line N) (point))))
       (error nil))
@@ -188,7 +188,7 @@
       (error nil))
     (condition-case nil
         (if (fboundp 'match-string-no-properties)
-            nil ;; great
+            nil  ; great
           (defsubst match-string-no-properties (num &optional string)
             "Return string of text matched by last search, without text 
properties.
 NUM specifies which parenthesized expression in the last regexp.
@@ -208,7 +208,7 @@ STRING should be given if the last search was by 
`string-match' on STRING."
          )
       (error nil))
     (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
-        nil ;; We've got what we needed
+        nil  ; We've got what we needed
       ;; We have the old custom-library, hack around it!
       (defmacro defgroup (&rest _args)  nil)
       (defmacro customize (&rest _args)
@@ -224,7 +224,7 @@ STRING should be given if the last search was by 
`string-match' on STRING."
       )
 
     (if (and (featurep 'custom) (fboundp 'customize-group))
-        nil ;; We've got what we needed
+        nil  ; We've got what we needed
       ;; We have an intermediate custom-library, hack around it!
       (defmacro customize-group (var &rest _args)
         `(customize ,var))
@@ -254,16 +254,16 @@ STRING should be given if the last search was by 
`string-match' on STRING."
           (if (fboundp 'function-max-args)
               (let ((args (function-max-args `regexp-opt)))
                 (cond
-                 ((eq args 3) ;; It takes 3
+                 ((eq args 3)  ; It takes 3
                   (condition-case nil  ; Hide this defun from emacses
-                                       ;with just a two input regexp
+                                        ; with just a two input regexp
                       (defun verilog-regexp-opt (a b)
                         "Deal with differing number of required arguments for  
`regexp-opt'.
          Call `regexp-opt' on A and B."
                         (regexp-opt a b t))
                     (error nil))
                   )
-                 ((eq args 2) ;; It takes 2
+                 ((eq args 2)  ; It takes 2
                   (defun verilog-regexp-opt (a b)
                     "Call `regexp-opt' on A and B."
                     (regexp-opt a b))
@@ -307,35 +307,35 @@ LIMIT.
 
 As a general recommendation, try to avoid using `looking-back'
 wherever possible, since it is slow."
-   (let ((start (point))
-         (pos
-          (save-excursion
-            (and (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)
-                 (point)))))
-     (if (and greedy pos)
-         (save-restriction
-           (narrow-to-region (point-min) start)
-           (while (and (> pos (point-min))
-                       (save-excursion
-                         (goto-char pos)
-                         (backward-char 1)
-                         (looking-at (concat "\\(?:"  regexp "\\)\\'"))))
-             (setq pos (1- pos)))
-           (save-excursion
-             (goto-char pos)
-             (looking-at (concat "\\(?:"  regexp "\\)\\'")))))
-     (not (null pos)))))))
+      (let ((start (point))
+            (pos
+             (save-excursion
+               (and (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit 
t)
+                    (point)))))
+        (if (and greedy pos)
+            (save-restriction
+              (narrow-to-region (point-min) start)
+              (while (and (> pos (point-min))
+                          (save-excursion
+                            (goto-char pos)
+                            (backward-char 1)
+                            (looking-at (concat "\\(?:"  regexp "\\)\\'"))))
+                (setq pos (1- pos)))
+              (save-excursion
+                (goto-char pos)
+                (looking-at (concat "\\(?:"  regexp "\\)\\'")))))
+        (not (null pos)))))))
 
 (eval-and-compile
   ;; Both xemacs and emacs
   (condition-case nil
-      (require 'diff) ;; diff-command and diff-switches
+      (require 'diff)  ; diff-command and diff-switches
     (error nil))
   (condition-case nil
-      (require 'compile) ;; compilation-error-regexp-alist-alist
+      (require 'compile)  ; compilation-error-regexp-alist-alist
     (error nil))
   (condition-case nil
-      (unless (fboundp 'buffer-chars-modified-tick)  ;; Emacs 22 added
+      (unless (fboundp 'buffer-chars-modified-tick)  ; Emacs 22 added
        (defmacro buffer-chars-modified-tick () (buffer-modified-tick)))
     (error nil))
   ;; Added in Emacs 24.1
@@ -346,17 +346,17 @@ wherever possible, since it is slow."
 
 (eval-when-compile
   (defun verilog-regexp-words (a)
-    "Call 'regexp-opt' with word delimiters for the words A."
+    "Call `regexp-opt' with word delimiters for the words A."
     (concat "\\<" (verilog-regexp-opt a t) "\\>")))
 (defun verilog-regexp-words (a)
-  "Call 'regexp-opt' with word delimiters for the words A."
+  "Call `regexp-opt' with word delimiters for the words A."
   ;; The FAQ references this function, so user LISP sometimes calls it
   (concat "\\<" (verilog-regexp-opt a t) "\\>"))
 
 (defun verilog-easy-menu-filter (menu)
   "Filter `easy-menu-define' MENU to support new features."
   (cond ((not (featurep 'xemacs))
-        menu) ;; GNU Emacs - passthru
+         menu)  ; GNU Emacs - passthru
        ;; XEmacs doesn't support :help.  Strip it.
        ;; Recursively filter the a submenu
        ((listp menu)
@@ -370,7 +370,7 @@ wherever possible, since it is slow."
               (setq out (vconcat out (vector (aref menu i)))
                     i (1+ i))))
           out))
-       (t menu))) ;; Default - ok
+        (t menu)))  ; Default - ok
 ;;(verilog-easy-menu-filter
 ;;  `("Verilog" ("MA" ["SAA" nil :help "Help SAA"] ["SAB" nil :help "Help 
SAA"])
 ;;     "----" ["MB" nil :help "Help MB"]))
@@ -439,10 +439,10 @@ Set `verilog-in-hooks' during this time, to assist AUTO 
caches."
   :version "22.2"
   :group 'languages)
 
-; (defgroup verilog-mode-fonts nil
-;   "Facilitates easy customization fonts used in Verilog source text"
-;   :link '(customize-apropos "font-lock-*" 'faces)
-;  :group 'verilog-mode)
+;; (defgroup verilog-mode-fonts nil
+;;   "Facilitates easy customization fonts used in Verilog source text"
+;;   :link '(customize-apropos "font-lock-*" 'faces)
+;;   :group 'verilog-mode)
 
 (defgroup verilog-mode-indent nil
   "Customize indentation and highlighting of Verilog source text."
@@ -541,9 +541,9 @@ entry \"Fontify Buffer\").  XEmacs: turn off and on font 
locking."
 
 (defcustom verilog-auto-lineup 'declarations
   "Type of statements to lineup across multiple lines.
-If 'all' is selected, then all line ups described below are done.
+If `all' is selected, then all line ups described below are done.
 
-If 'declarations', then just declarations are lined up with any
+If `declarations', then just declarations are lined up with any
 preceding declarations, taking into account widths and the like,
 so or example the code:
        reg [31:0] a;
@@ -552,7 +552,7 @@ would become
        reg [31:0] a;
        reg        b;
 
-If 'assignment', then assignments are lined up with any preceding
+If `assignment', then assignments are lined up with any preceding
 assignments, so for example the code
        a_long_variable <= b + c;
        d = e + f;
@@ -736,7 +736,7 @@ file referenced.  If false, this is not supported."
 Set this to \"wire\" if the Verilog code uses \"\\=`default_nettype
 none\".  Note using \\=`default_nettype none isn't recommended practice; this
 mode is experimental."
-  :version "24.1"  ;; rev670
+  :version "24.1"  ; rev670
   :group 'verilog-mode-actions
   :type 'boolean)
 (put 'verilog-auto-declare-nettype 'safe-local-variable `stringp)
@@ -744,7 +744,7 @@ mode is experimental."
 (defcustom verilog-auto-wire-type nil
   "Non-nil specifies the data type to use with `verilog-auto-wire' etc.
 Set this to \"logic\" for SystemVerilog code, or use `verilog-auto-logic'."
-  :version "24.1"  ;; rev673
+  :version "24.1"  ; rev673
   :group 'verilog-mode-actions
   :type 'boolean)
 (put 'verilog-auto-wire-type 'safe-local-variable `stringp)
@@ -758,7 +758,7 @@ The name of the function or case will be set between the 
braces."
 
 (defcustom verilog-auto-delete-trailing-whitespace nil
   "Non-nil means to `delete-trailing-whitespace' in `verilog-auto'."
-  :version "24.1"  ;; rev703
+  :version "24.1"  ; rev703
   :group 'verilog-mode-actions
   :type 'boolean)
 (put 'verilog-auto-delete-trailing-whitespace 'safe-local-variable 
'verilog-booleanp)
@@ -827,8 +827,11 @@ Function takes three arguments, the original buffer, the
 difference buffer, and the point in original buffer with the
 first difference.")
 
-;;; Compile support
+;;; Compile support:
+;;
+
 (require 'compile)
+
 (defvar verilog-error-regexp-added nil)
 
 (defvar verilog-error-regexp-emacs-alist
@@ -1037,7 +1040,7 @@ If nil, all blocking assigned signals are ignored when any
 non-blocking assignment is in the AUTORESET block.  This allows
 blocking assignments to be used for temporary values and not have
 those temporaries reset.  See example in `verilog-auto-reset'."
-  :version "24.1"  ;; rev718
+  :version "24.1"  ; rev718
   :type 'boolean
   :group 'verilog-mode-auto)
 (put 'verilog-auto-reset-blocking-in-non 'safe-local-variable 
'verilog-booleanp)
@@ -1051,7 +1054,7 @@ the MSB or LSB of a signal inside an AUTORESET.
 
 If nil, AUTORESET uses \"0\" as the constant.
 
-If 'unbased', AUTORESET used the unbased unsized literal \"'0\"
+If `unbased', AUTORESET used the unbased unsized literal \"'0\"
 as the constant. This setting is strongly recommended for
 SystemVerilog designs."
   :type 'boolean
@@ -1067,10 +1070,10 @@ SystemVerilog designs."
 
 (defcustom verilog-auto-arg-format 'packed
   "Formatting to use for AUTOARG signal names.
-If 'packed', then as many inputs and outputs that fit within
+If `packed', then as many inputs and outputs that fit within
 `fill-column' will be put onto one line.
 
-If 'single', then a single input or output will be put onto each
+If `single', then a single input or output will be put onto each
 line."
   :version "25.1"
   :type '(radio (const :tag "Line up Assignments and Declarations" packed)
@@ -1146,7 +1149,7 @@ declared together to remain together.  Sorted order 
reduces
 changes when declarations are moved around in a file.
 
 See also `verilog-auto-arg-sort'."
-  :version "24.1"  ;; rev688
+  :version "24.1"  ; rev688
   :group 'verilog-mode-auto
   :type 'boolean)
 (put 'verilog-auto-inst-sort 'safe-local-variable 'verilog-booleanp)
@@ -1169,7 +1172,7 @@ was used for that port declaration.  This setting is 
suggested
 only for debugging use, as regular use may cause a large numbers
 of merge conflicts.
 
-If 'lhs', the comment will show the left hand side of the
+If `lhs', the comment will show the left hand side of the
 AUTO_TEMPLATE rule that is matched.  This is less precise than
 numbering (t) when multiple rules have the same pin name, but
 won't merge conflict."
@@ -1186,7 +1189,7 @@ won't merge conflict."
 
 (defcustom verilog-auto-inst-interfaced-ports nil
   "Non-nil means include interfaced ports in AUTOINST expansions."
-  :version "24.3"  ;; rev773, default change rev815
+  :version "24.3"  ; rev773, default change rev815
   :group 'verilog-mode-auto
   :type 'boolean)
 (put 'verilog-auto-inst-interfaced-ports 'safe-local-variable 
'verilog-booleanp)
@@ -1215,7 +1218,7 @@ See the \\[verilog-faq] for examples on using this."
 (defcustom verilog-auto-template-warn-unused nil
   "Non-nil means report warning if an AUTO_TEMPLATE line is not used.
 This feature is not supported before Emacs 21.1 or XEmacs 21.4."
-  :version "24.3"  ;;rev787
+  :version "24.3"  ; rev787
   :group 'verilog-mode-auto
   :type 'boolean)
 (put 'verilog-auto-template-warn-unused 'safe-local-variable 'verilog-booleanp)
@@ -1224,7 +1227,7 @@ This feature is not supported before Emacs 21.1 or XEmacs 
21.4."
   "Data type used for the declaration for AUTOTIEOFF.
 If \"wire\" then create a wire, if \"assign\" create an
 assignment, else the data type for variable creation."
-  :version "24.1"  ;; rev713
+  :version "24.1"  ; rev713
   :group 'verilog-mode-auto
   :type 'string)
 (put 'verilog-auto-tieoff-declaration 'safe-local-variable 'stringp)
@@ -1296,13 +1299,13 @@ See also `verilog-case-fold'."
 
 (defcustom verilog-before-save-font-hook nil
   "Hook run before `verilog-save-font-mods' removes highlighting."
-  :version "24.3"  ;;rev735
+  :version "24.3"  ; rev735
   :group 'verilog-mode-auto
   :type 'hook)
 
 (defcustom verilog-after-save-font-hook nil
   "Hook run after `verilog-save-font-mods' restores highlighting."
-  :version "24.3"  ;;rev735
+  :version "24.3"  ; rev735
   :group 'verilog-mode-auto
   :type 'hook)
 
@@ -1330,13 +1333,16 @@ If set will become buffer local.")
 If set will become buffer local.")
 (make-variable-buffer-local 'verilog-project)
 
+;;; Keymap and Menu:
+;;
+
 (defvar verilog-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map ";"        'electric-verilog-semi)
     (define-key map [(control 59)]    'electric-verilog-semi-with-comment)
     (define-key map ":"        'electric-verilog-colon)
     ;;(define-key map "="        'electric-verilog-equal)
-    (define-key map "\`"       'electric-verilog-tick)
+    (define-key map "`"        'electric-verilog-tick)
     (define-key map "\t"       'electric-verilog-tab)
     (define-key map "\r"       'electric-verilog-terminate-line)
     ;; backspace/delete key bindings
@@ -1350,9 +1356,9 @@ If set will become buffer local.")
     (define-key map "\M-\t"    'verilog-complete-word)
     (define-key map "\M-?"     'verilog-show-completions)
     ;; Note \C-c and letter are reserved for users
-    (define-key map "\C-c\`"   'verilog-lint-off)
-    (define-key map "\C-c\*"   'verilog-delete-auto-star-implicit)
-    (define-key map "\C-c\?"   'verilog-diff-auto)
+    (define-key map "\C-c`"    'verilog-lint-off)
+    (define-key map "\C-c*"    'verilog-delete-auto-star-implicit)
+    (define-key map "\C-c?"    'verilog-diff-auto)
     (define-key map "\C-c\C-r" 'verilog-label-be)
     (define-key map "\C-c\C-i" 'verilog-pretty-declarations)
     (define-key map "\C-c="    'verilog-pretty-expr)
@@ -1697,7 +1703,7 @@ will break, as the o's continuously replace.  xa -> x 
works ok though."
 (defsubst verilog-re-search-forward (REGEXP BOUND NOERROR)
   ;; checkdoc-params: (REGEXP BOUND NOERROR)
   "Like `re-search-forward', but skips over match in comments or strings."
-  (let ((mdata '(nil nil)))  ;; So match-end will return nil if no matches 
found
+  (let ((mdata '(nil nil)))  ; So match-end will return nil if no matches found
     (while (and
            (re-search-forward REGEXP BOUND NOERROR)
            (setq mdata (match-data))
@@ -1713,7 +1719,7 @@ will break, as the o's continuously replace.  xa -> x 
works ok though."
 (defsubst verilog-re-search-backward (REGEXP BOUND NOERROR)
   ;; checkdoc-params: (REGEXP BOUND NOERROR)
   "Like `re-search-backward', but skips over match in comments or strings."
-  (let ((mdata '(nil nil)))  ;; So match-end will return nil if no matches 
found
+  (let ((mdata '(nil nil)))  ; So match-end will return nil if no matches found
     (while (and
            (re-search-backward REGEXP BOUND NOERROR)
            (setq mdata (match-data))
@@ -1735,7 +1741,7 @@ so there may be a large up front penalty for the first 
search."
     (while (and (not pt)
                (re-search-forward regexp bound noerror))
       (if (verilog-inside-comment-or-string-p)
-         (re-search-forward "[/\"\n]" nil t) ;; Only way a comment or quote 
can end
+          (re-search-forward "[/\"\n]" nil t)  ; Only way a comment or quote 
can end
        (setq pt (match-end 0))))
     pt))
 
@@ -1749,7 +1755,7 @@ so there may be a large up front penalty for the first 
search."
     (while (and (not pt)
                (re-search-backward regexp bound noerror))
       (if (verilog-inside-comment-or-string-p)
-         (re-search-backward "[/\"]" nil t) ;; Only way a comment or quote can 
begin
+          (re-search-backward "[/\"]" nil t)  ; Only way a comment or quote 
can begin
        (setq pt (match-beginning 0))))
     pt))
 
@@ -1771,7 +1777,7 @@ This speeds up complicated regexp matches."
        (setq done nil)))
     (when done (goto-char done))
     done))
-;;(verilog-re-search-forward-substr "-end" "get-end-of" nil t) ;;-end (test 
bait)
+;;(verilog-re-search-forward-substr "-end" "get-end-of" nil t)  ; -end (test 
bait)
 
 (defsubst verilog-re-search-backward-substr (substr regexp bound noerror)
   "Like `re-search-backward', but first search for SUBSTR constant.
@@ -1791,7 +1797,7 @@ This speeds up complicated regexp matches."
        (setq done nil)))
     (when done (goto-char done))
     done))
-;;(verilog-re-search-backward-substr "-end" "get-end-of" nil t) ;;-end (test 
bait)
+;;(verilog-re-search-backward-substr "-end" "get-end-of" nil t)  ; -end (test 
bait)
 
 (defun verilog-delete-trailing-whitespace ()
   "Delete trailing spaces or tabs, but not newlines nor linefeeds.
@@ -1803,13 +1809,13 @@ To call on \\[verilog-auto], set 
`verilog-auto-delete-trailing-whitespace'."
   ;; Similar to `delete-trailing-whitespace' but that's not present in XEmacs
   (save-excursion
     (goto-char (point-min))
-    (while (re-search-forward "[ \t]+$" nil t)  ;; Not syntactic WS as no 
formfeed
+    (while (re-search-forward "[ \t]+$" nil t)  ; Not syntactic WS as no 
formfeed
       (replace-match "" nil nil))
     (goto-char (point-max))
     (unless (bolp) (insert "\n"))))
 
 (defvar compile-command)
-(defvar create-lockfiles)  ;; Emacs 24
+(defvar create-lockfiles)  ; Emacs 24
 
 ;; compilation program
 (defun verilog-set-compile-command ()
@@ -1867,7 +1873,7 @@ be substituted."
                 t t command))
   (setq command        (verilog-string-replace-matches
                 "\\b__FILE__\\b" (file-name-nondirectory
-                                  (or (buffer-file-name) ""))
+                                 (or (buffer-file-name) ""))
                 t t command))
   command)
 
@@ -1908,35 +1914,34 @@ find the errors."
 
 ;; Following code only gets called from compilation-mode-hook on Emacs to add 
error handling.
 (defun verilog-error-regexp-add-emacs ()
-   "Tell Emacs compile that we are Verilog.
+  "Tell Emacs compile that we are Verilog.
 Called by `compilation-mode-hook'.  This allows \\[next-error] to
 find the errors."
-   (interactive)
-   (if (boundp 'compilation-error-regexp-alist-alist)
-       (progn
-         (if (not (assoc 'verilog-xl-1 compilation-error-regexp-alist-alist))
-             (mapcar
-              (lambda (item)
-                (push (car item) compilation-error-regexp-alist)
-                (push item compilation-error-regexp-alist-alist)
-                )
-              verilog-error-regexp-emacs-alist)))))
+  (interactive)
+  (when (boundp 'compilation-error-regexp-alist-alist)
+    (when (not (assoc 'verilog-xl-1 compilation-error-regexp-alist-alist))
+      (mapcar
+       (lambda (item)
+         (push (car item) compilation-error-regexp-alist)
+         (push item compilation-error-regexp-alist-alist))
+       verilog-error-regexp-emacs-alist))))
 
 (if (featurep 'xemacs) (add-hook 'compilation-mode-hook 
'verilog-error-regexp-add-xemacs))
 (if (featurep 'emacs) (add-hook 'compilation-mode-hook 
'verilog-error-regexp-add-emacs))
 
 (defconst verilog-compiler-directives
   (eval-when-compile
-    '( ;; compiler directives, from IEEE 1800-2012 section 22.1
-    "`__FILE__" "`__LINE" "`begin_keywords" "`celldefine" "`default_nettype"
-    "`define" "`else" "`elsif" "`end_keywords" "`endcelldefine" "`endif"
-    "`ifdef" "`ifndef" "`include" "`line" "`nounconnected_drive" "`pragma"
-    "`resetall" "`timescale" "`unconnected_drive" "`undef" "`undefineall"
-     ;; compiler directives not covered by IEEE 1800
-     "`case" "`default" "`endfor" "`endprotect" "`endswitch" "`endwhile" "`for"
-     "`format" "`if" "`let" "`protect" "`switch" "`timescale" "`time_scale"
-     "`while"
-     ))
+    '(
+      ;; compiler directives, from IEEE 1800-2012 section 22.1
+      "`__FILE__" "`__LINE" "`begin_keywords" "`celldefine" "`default_nettype"
+      "`define" "`else" "`elsif" "`end_keywords" "`endcelldefine" "`endif"
+      "`ifdef" "`ifndef" "`include" "`line" "`nounconnected_drive" "`pragma"
+      "`resetall" "`timescale" "`unconnected_drive" "`undef" "`undefineall"
+      ;; compiler directives not covered by IEEE 1800
+      "`case" "`default" "`endfor" "`endprotect" "`endswitch" "`endwhile" 
"`for"
+      "`format" "`if" "`let" "`protect" "`switch" "`timescale" "`time_scale"
+      "`while"
+      ))
   "List of Verilog compiler directives.")
 
 (defconst verilog-directive-re
@@ -2028,10 +2033,10 @@ find the errors."
   (eval-when-compile
     (verilog-regexp-opt
      '(
-;;       "`vmm_xactor_member_enum_array"
        
"`vmm_\\(data\\|env\\|scenario\\|subenv\\|xactor\\)_member_\\(scalar\\|string\\|enum\\|vmm_data\\|channel\\|xactor\\|subenv\\|user_defined\\)\\(_array\\)?"
-;;       "`vmm_xactor_member_scalar_array"
-;;       "`vmm_xactor_member_scalar"
+       ;; "`vmm_xactor_member_enum_array"
+       ;; "`vmm_xactor_member_scalar_array"
+       ;; "`vmm_xactor_member_scalar"
        ) nil )))
 
 (defconst verilog-ovm-statement-re
@@ -2158,9 +2163,9 @@ find the errors."
        "`uvm_component_utils"
        "`uvm_create"
        "`uvm_create_on"
-       "`uvm_create_seq"               ;; Undocumented in 1.1
+       "`uvm_create_seq"                ; Undocumented in 1.1
        "`uvm_declare_p_sequencer"
-       "`uvm_declare_sequence_lib"     ;; Deprecated in 1.1
+       "`uvm_declare_sequence_lib"      ; Deprecated in 1.1
        "`uvm_do"
        "`uvm_do_callbacks"
        "`uvm_do_callbacks_exit_on"
@@ -2172,8 +2177,8 @@ find the errors."
        "`uvm_do_on_with"
        "`uvm_do_pri"
        "`uvm_do_pri_with"
-       "`uvm_do_seq"                   ;; Undocumented in 1.1
-       "`uvm_do_seq_with"              ;; Undocumented in 1.1
+       "`uvm_do_seq"                    ; Undocumented in 1.1
+       "`uvm_do_seq_with"               ; Undocumented in 1.1
        "`uvm_do_with"
        "`uvm_error"
        "`uvm_error_context"
@@ -2215,14 +2220,14 @@ find the errors."
        "`uvm_field_sarray_string"
        "`uvm_field_string"
        "`uvm_field_utils"
-       "`uvm_file"             ;; Undocumented in 1.1, use `__FILE__
+       "`uvm_file"              ; Undocumented in 1.1, use `__FILE__
        "`uvm_get_imp_decl"
        "`uvm_get_peek_imp_decl"
        "`uvm_info"
        "`uvm_info_context"
-       "`uvm_line"             ;; Undocumented in 1.1, use `__LINE__
+       "`uvm_line"              ; Undocumented in 1.1, use `__LINE__
        "`uvm_master_imp_decl"
-       "`uvm_non_blocking_transport_imp_decl"  ;; Deprecated in 1.1
+       "`uvm_non_blocking_transport_imp_decl"   ; Deprecated in 1.1
        "`uvm_nonblocking_get_imp_decl"
        "`uvm_nonblocking_get_peek_imp_decl"
        "`uvm_nonblocking_master_imp_decl"
@@ -2232,7 +2237,7 @@ find the errors."
        "`uvm_nonblocking_transport_imp_decl"
        "`uvm_object_param_utils"
        "`uvm_object_registry"
-       "`uvm_object_registry_param"    ;; Undocumented in 1.1
+       "`uvm_object_registry_param"     ; Undocumented in 1.1
        "`uvm_object_utils"
        "`uvm_pack_array"
        "`uvm_pack_arrayN"
@@ -2257,7 +2262,7 @@ find the errors."
        "`uvm_register_cb"
        "`uvm_send"
        "`uvm_send_pri"
-       "`uvm_sequence_utils"           ;; Deprecated in 1.1
+       "`uvm_sequence_utils"            ; Deprecated in 1.1
        "`uvm_set_super_type"
        "`uvm_slave_imp_decl"
        "`uvm_transport_imp_decl"
@@ -2273,8 +2278,8 @@ find the errors."
        "`uvm_unpack_sarray"
        "`uvm_unpack_sarrayN"
        "`uvm_unpack_string"
-       "`uvm_update_sequence_lib"              ;; Deprecated in 1.1
-       "`uvm_update_sequence_lib_and_item"     ;; Deprecated in 1.1
+       "`uvm_update_sequence_lib"               ; Deprecated in 1.1
+       "`uvm_update_sequence_lib_and_item"      ; Deprecated in 1.1
        "`uvm_warning"
        "`uvm_warning_context") nil )))
 
@@ -2291,40 +2296,40 @@ find the errors."
 ;;   b :
 (defconst verilog-assignment-operator-re
   (eval-when-compile
-     (verilog-regexp-opt
-      `(
-       ;; blocking assignment_operator
-       "=" "+=" "-=" "*=" "/=" "%=" "&=" "|=" "^=" "<<=" ">>=" "<<<=" ">>>="
-       ;; non blocking assignment operator
-       "<="
-       ;; comparison
-       "==" "!=" "===" "!===" "<=" ">=" "==\?" "!=\?"
-       ;; event_trigger
-       "->" "->>"
-       ;; property_expr
-       "|->" "|=>"
-       ;; Is this a legal verilog operator?
-       ":="
-       ) 't
-      )))
+    (verilog-regexp-opt
+     `(
+       ;; blocking assignment_operator
+       "=" "+=" "-=" "*=" "/=" "%=" "&=" "|=" "^=" "<<=" ">>=" "<<<=" ">>>="
+       ;; non blocking assignment operator
+       "<="
+       ;; comparison
+       "==" "!=" "===" "!==" "<=" ">=" "==\?" "!=\?" "<->"
+       ;; event_trigger
+       "->" "->>"
+       ;; property_expr
+       "|->" "|=>" "#-#" "#=#"
+       ;; distribution weighting
+       ":=" ":/"
+       ) 't
+         )))
 (defconst verilog-assignment-operation-re
   (concat
-;     "\\(^\\s-*[A-Za-z0-9_]+\\(\\[\\([A-Za-z0-9_]+\\)\\]\\)*\\s-*\\)"
-;     "\\(^\\s-*[^=<>+-*/%&|^:\\s-]+[^=<>+-*/%&|^\n]*?\\)"
-     "\\(^.*?\\)" "\\B" verilog-assignment-operator-re "\\B" ))
+   ;; "\\(^\\s-*[A-Za-z0-9_]+\\(\\[\\([A-Za-z0-9_]+\\)\\]\\)*\\s-*\\)"
+   ;; "\\(^\\s-*[^=<>+-*/%&|^:\\s-]+[^=<>+-*/%&|^\n]*?\\)"
+   "\\(^.*?\\)" "\\B" verilog-assignment-operator-re "\\B" ))
 
 (defconst verilog-label-re (concat verilog-symbol-re "\\s-*:\\s-*"))
 (defconst verilog-property-re
   (concat "\\(" verilog-label-re "\\)?"
+          ;; "\\(assert\\|assume\\|cover\\)\\s-+property\\>"
          
"\\(\\(assert\\|assume\\|cover\\)\\>\\s-+\\<property\\>\\)\\|\\(assert\\)"))
-         ;;  "\\(assert\\|assume\\|cover\\)\\s-+property\\>"
 
 (defconst verilog-no-indent-begin-re
   (eval-when-compile
     (verilog-regexp-words
-     '("always" "always_comb" "always_ff" "always_latch" "initial" "final" ;; 
procedural blocks
-       "if" "else"                                                         ;; 
conditional statements
-       "while" "for" "foreach" "repeat" "do" "forever" ))))                ;; 
loop statements
+     '("always" "always_comb" "always_ff" "always_latch" "initial" "final"  ; 
procedural blocks
+       "if" "else"                                                          ; 
conditional statements
+       "while" "for" "foreach" "repeat" "do" "forever" ))))                 ; 
loop statements
 
 (defconst verilog-ends-re
   ;; Parenthesis indicate type of keyword found
@@ -2396,8 +2401,8 @@ find the errors."
                "package")))
          "\\)"))
 
-;;; NOTE: verilog-leap-to-head expects that verilog-end-block-re and
-;;; verilog-end-block-ordered-re matches exactly the same strings.
+;; NOTE: verilog-leap-to-head expects that verilog-end-block-re and
+;; verilog-end-block-ordered-re matches exactly the same strings.
 (defconst verilog-end-block-ordered-re
   ;; Parenthesis indicate type of keyword found
   (concat "\\(\\<endcase\\>\\)\\|" ; 1
@@ -2421,9 +2426,9 @@ find the errors."
   (eval-when-compile
     (verilog-regexp-words
 
-     `("end"  ;; closes begin
-       "endcase" ;; closes any of case, casex casez or randcase
-       "join" "join_any" "join_none" ;; closes fork
+     `("end"      ; closes begin
+       "endcase"  ; closes any of case, casex casez or randcase
+       "join" "join_any" "join_none"  ; closes fork
        "endclass"
        "endtable"
        "endspecify"
@@ -2666,7 +2671,7 @@ find the errors."
   (eval-when-compile (verilog-regexp-words `("initial" "final" "always" 
"always_comb" "always_latch" "always_ff"
                                             "function" "task"))))
 (defconst verilog-coverpoint-re 
"\\w+\\s*:\\s*\\(coverpoint\\|cross\\constraint\\)"  )
-(defconst verilog-in-constraint-re ;; keywords legal in constraint blocks 
starting a statement/block
+(defconst verilog-in-constraint-re  ; keywords legal in constraint blocks 
starting a statement/block
   (eval-when-compile (verilog-regexp-words `("if" "else" "solve" "foreach"))))
 
 (defconst verilog-indent-re
@@ -2676,7 +2681,7 @@ find the errors."
        "{"
        "always" "always_latch" "always_ff" "always_comb"
        "begin" "end"
-;       "unique" "priority"
+       ;; "unique" "priority"
        "case" "casex" "casez" "randcase" "endcase"
        "class" "endclass"
        "clocking" "endclocking"
@@ -2734,7 +2739,7 @@ find the errors."
        "`uvm_sequence_utils_begin"
        "`uvm_sequencer_utils_begin"
        ;; UVM End tokens
-       "`uvm_component_utils_end"      ;; Typo in spec, it's not 
uvm_component_end
+       "`uvm_component_utils_end"       ; Typo in spec, it's not 
uvm_component_end
        "`uvm_field_utils_end"
        "`uvm_object_utils_end"
        "`uvm_sequence_utils_end"
@@ -2780,12 +2785,18 @@ find the errors."
      `(
        "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" 
"endclass"
        ))))
+
+(defconst verilog-dpi-import-export-re
+  (eval-when-compile
+    
"\\(\\<\\(import\\|export\\)\\>\\s-+\"DPI\\(-C\\)?\"\\s-+\\(\\<\\(context\\|pure\\)\\>\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_]*\\s-*=\\s-*\\)?\\<\\(function\\|task\\)\\>\\)"
+    ))
+
 (defconst verilog-disable-fork-re "\\(disable\\|wait\\)\\s-+fork\\>")
 (defconst verilog-extended-case-re 
"\\(\\(unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\)")
 (defconst verilog-extended-complete-re
   (concat 
"\\(\\(\\<extern\\s-+\\|\\<\\(\\<\\(pure\\|context\\)\\>\\s-+\\)?virtual\\s-+\\|\\<protected\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)\\)"
          
"\\|\\(\\(\\<typedef\\>\\s-+\\)*\\(\\<struct\\>\\|\\<union\\>\\|\\<class\\>\\)\\)"
-         
"\\|\\(\\(\\<import\\>\\s-+\\)?\\(\"DPI-C\"\\s-+\\)?\\(\\<\\(pure\\|context\\)\\>\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_]*\\s-+=\\s-+\\)?\\(function\\>\\|task\\>\\)\\)"
+         
"\\|\\(\\(\\<\\(import\\|export\\)\\>\\s-+\\)?\\(\"DPI\\(-C\\)?\"\\s-+\\)?\\(\\<\\(pure\\|context\\)\\>\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_]*\\s-*=\\s-*\\)?\\(function\\>\\|task\\>\\)\\)"
          "\\|" verilog-extended-case-re ))
 (defconst verilog-basic-complete-re
   (eval-when-compile
@@ -2848,10 +2859,10 @@ find the errors."
      "\\)\\|\\(?:"
      ;; `define and `if can span multiple lines if line ends in '\'. NOTE: `if 
is not IEEE 1800-2012
      ;; from http://www.emacswiki.org/emacs/MultilineRegexp
-     (concat "\\<\\(`define\\|`if\\)\\>" ;; directive
-            "\\s-+" ;; separator
-             "\\(?:.*?\\(?:\n.*\\)*?\\)" ;; definition: to end of line, then 
maybe more lines (excludes any trailing \n)
-            "\\(?:\n\\s-*\n\\|\\'\\)") ;; blank line or EOF
+     (concat "\\<\\(`define\\|`if\\)\\>"  ; directive
+             "\\s-+"  ; separator
+             "\\(?:.*?\\(?:\n.*\\)*?\\)"  ; definition: to end of line, then 
maybe more lines (excludes any trailing \n)
+             "\\(?:\n\\s-*\n\\|\\'\\)")  ; blank line or EOF
      "\\)\\|\\(?:"
      ;; `<macro>() : i.e. `uvm_info(a,b,c) or any other pre-defined macro
      ;; Since parameters inside the macro can have parentheses, and
@@ -2859,56 +2870,56 @@ find the errors."
      ;; parentheses and then continue to the end of the first
      ;; non-escaped EOL
      (concat "\\<`\\w+\\>\\s-*("
-      "\\(?:.*?\\(?:\n.*\\)*?\\)" ;; definition: to end of line, then maybe 
more lines (excludes any trailing \n)
-            "\\(?:\n\\s-*\n\\|\\'\\)") ;; blank line or EOF
+             "\\(?:.*?\\(?:\n.*\\)*?\\)"  ; definition: to end of line, then 
maybe more lines (excludes any trailing \n)
+             "\\(?:\n\\s-*\n\\|\\'\\)")   ; blank line or EOF
      "\\)"
      )))
 
 (defconst verilog-keywords
   (append verilog-compiler-directives
-   '(
-     "after" "alias" "always" "always_comb" "always_ff" "always_latch" "and"
-     "assert" "assign" "assume" "automatic" "before" "begin" "bind"
-     "bins" "binsof" "bit" "break" "buf" "bufif0" "bufif1" "byte"
-     "case" "casex" "casez" "cell" "chandle" "class" "clocking" "cmos"
-     "config" "const" "constraint" "context" "continue" "cover"
-     "covergroup" "coverpoint" "cross" "deassign" "default" "defparam"
-     "design" "disable" "dist" "do" "edge" "else" "end" "endcase"
-     "endclass" "endclocking" "endconfig" "endfunction" "endgenerate"
-     "endgroup" "endinterface" "endmodule" "endpackage" "endprimitive"
-     "endprogram" "endproperty" "endspecify" "endsequence" "endtable"
-     "endtask" "enum" "event" "expect" "export" "extends" "extern"
-     "final" "first_match" "for" "force" "foreach" "forever" "fork"
-     "forkjoin" "function" "generate" "genvar" "highz0" "highz1" "if"
-     "iff" "ifnone" "ignore_bins" "illegal_bins" "import" "incdir"
-     "include" "initial" "inout" "input" "inside" "instance" "int"
-     "integer" "interface" "intersect" "join" "join_any" "join_none"
-     "large" "liblist" "library" "local" "localparam" "logic"
-     "longint" "macromodule" "mailbox" "matches" "medium" "modport" "module"
-     "nand" "negedge" "new" "nmos" "nor" "noshowcancelled" "not"
-     "notif0" "notif1" "null" "or" "output" "package" "packed"
-     "parameter" "pmos" "posedge" "primitive" "priority" "program"
-     "property" "protected" "pull0" "pull1" "pulldown" "pullup"
-     "pulsestyle_onevent" "pulsestyle_ondetect" "pure" "rand" "randc"
-     "randcase" "randsequence" "rcmos" "real" "realtime" "ref" "reg"
-     "release" "repeat" "return" "rnmos" "rpmos" "rtran" "rtranif0"
-     "rtranif1" "scalared" "semaphore" "sequence" "shortint" "shortreal"
-     "showcancelled" "signed" "small" "solve" "specify" "specparam"
-     "static" "string" "strong0" "strong1" "struct" "super" "supply0"
-     "supply1" "table" "tagged" "task" "this" "throughout" "time"
-     "timeprecision" "timeunit" "tran" "tranif0" "tranif1" "tri"
-     "tri0" "tri1" "triand" "trior" "trireg" "type" "typedef" "union"
-     "unique" "unsigned" "use" "uwire" "var" "vectored" "virtual" "void"
-     "wait" "wait_order" "wand" "weak0" "weak1" "while" "wildcard"
-     "wire" "with" "within" "wor" "xnor" "xor"
-     ;; 1800-2009
-     "accept_on" "checker" "endchecker" "eventually" "global" "implies"
-     "let" "nexttime" "reject_on" "restrict" "s_always" "s_eventually"
-     "s_nexttime" "s_until" "s_until_with" "strong" "sync_accept_on"
-     "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak"
-     ;; 1800-2012
-     "implements" "interconnect" "nettype" "soft"
-     ))
+          '(
+            "after" "alias" "always" "always_comb" "always_ff" "always_latch" 
"and"
+            "assert" "assign" "assume" "automatic" "before" "begin" "bind"
+            "bins" "binsof" "bit" "break" "buf" "bufif0" "bufif1" "byte"
+            "case" "casex" "casez" "cell" "chandle" "class" "clocking" "cmos"
+            "config" "const" "constraint" "context" "continue" "cover"
+            "covergroup" "coverpoint" "cross" "deassign" "default" "defparam"
+            "design" "disable" "dist" "do" "edge" "else" "end" "endcase"
+            "endclass" "endclocking" "endconfig" "endfunction" "endgenerate"
+            "endgroup" "endinterface" "endmodule" "endpackage" "endprimitive"
+            "endprogram" "endproperty" "endspecify" "endsequence" "endtable"
+            "endtask" "enum" "event" "expect" "export" "extends" "extern"
+            "final" "first_match" "for" "force" "foreach" "forever" "fork"
+            "forkjoin" "function" "generate" "genvar" "highz0" "highz1" "if"
+            "iff" "ifnone" "ignore_bins" "illegal_bins" "import" "incdir"
+            "include" "initial" "inout" "input" "inside" "instance" "int"
+            "integer" "interface" "intersect" "join" "join_any" "join_none"
+            "large" "liblist" "library" "local" "localparam" "logic"
+            "longint" "macromodule" "mailbox" "matches" "medium" "modport" 
"module"
+            "nand" "negedge" "new" "nmos" "nor" "noshowcancelled" "not"
+            "notif0" "notif1" "null" "or" "output" "package" "packed"
+            "parameter" "pmos" "posedge" "primitive" "priority" "program"
+            "property" "protected" "pull0" "pull1" "pulldown" "pullup"
+            "pulsestyle_onevent" "pulsestyle_ondetect" "pure" "rand" "randc"
+            "randcase" "randsequence" "rcmos" "real" "realtime" "ref" "reg"
+            "release" "repeat" "return" "rnmos" "rpmos" "rtran" "rtranif0"
+            "rtranif1" "scalared" "semaphore" "sequence" "shortint" "shortreal"
+            "showcancelled" "signed" "small" "solve" "specify" "specparam"
+            "static" "string" "strong0" "strong1" "struct" "super" "supply0"
+            "supply1" "table" "tagged" "task" "this" "throughout" "time"
+            "timeprecision" "timeunit" "tran" "tranif0" "tranif1" "tri"
+            "tri0" "tri1" "triand" "trior" "trireg" "type" "typedef" "union"
+            "unique" "unsigned" "use" "uwire" "var" "vectored" "virtual" "void"
+            "wait" "wait_order" "wand" "weak0" "weak1" "while" "wildcard"
+            "wire" "with" "within" "wor" "xnor" "xor"
+            ;; 1800-2009
+            "accept_on" "checker" "endchecker" "eventually" "global" "implies"
+            "let" "nexttime" "reject_on" "restrict" "s_always" "s_eventually"
+            "s_nexttime" "s_until" "s_until_with" "strong" "sync_accept_on"
+            "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak"
+            ;; 1800-2012
+            "implements" "interconnect" "nettype" "soft"
+            ))
   "List of Verilog keywords.")
 
 (defconst verilog-comment-start-regexp "//\\|/\\*"
@@ -2928,7 +2939,7 @@ find the errors."
     (modify-syntax-entry ?| "." table)
     ;; FIXME: This goes against Emacs conventions.  Use "_" syntax instead and
     ;; then use regexps with things like "\\_<...\\_>".
-    (modify-syntax-entry ?` "w" table) ;; ` is part of definition symbols in 
Verilog
+    (modify-syntax-entry ?` "w" table)  ; ` is part of definition symbols in 
Verilog
     (modify-syntax-entry ?_ "w" table)
     (modify-syntax-entry ?\' "." table)
 
@@ -3119,9 +3130,9 @@ See also `verilog-font-lock-extra-types'.")
        (list
         ;; Fontify all builtin keywords
         (concat "\\<\\(" verilog-font-keywords "\\|"
-                      ;; And user/system tasks and functions
-              "\\$[a-zA-Z][a-zA-Z0-9_\\$]*"
-              "\\)\\>")
+                 ;; And user/system tasks and functions
+                 "\\$[a-zA-Z][a-zA-Z0-9_\\$]*"
+                 "\\)\\>")
         ;; Fontify all types
         (if verilog-highlight-grouping-keywords
             (cons (concat "\\<\\(" verilog-font-grouping-keywords "\\)\\>")
@@ -3129,7 +3140,7 @@ See also `verilog-font-lock-extra-types'.")
           (cons (concat "\\<\\(" verilog-font-grouping-keywords "\\)\\>")
                 'font-lock-type-face))
         (cons (concat "\\<\\(" verilog-type-font-keywords "\\)\\>")
-          'font-lock-type-face)
+               'font-lock-type-face)
         ;; Fontify IEEE-1800-2005 keywords appropriately
         (if verilog-highlight-p1800-keywords
             (cons (concat "\\<\\(" verilog-1800-2005-keywords "\\)\\>")
@@ -3163,8 +3174,8 @@ See also `verilog-font-lock-extra-types'.")
                 ;; Fontify function definitions
                 (list
                  (concat 
"\\<function\\>\\s-+\\(integer\\|real\\(time\\)?\\|time\\)\\s-+\\(\\sw+\\)" )
-                      '(1 font-lock-keyword-face)
-                      '(3 font-lock-constant-face prepend))
+                  '(1 font-lock-keyword-face)
+                  '(3 font-lock-constant-face prepend))
                 '("\\<function\\>\\s-+\\(\\[[^]]+\\]\\)\\s-+\\(\\sw+\\)"
                   (1 font-lock-keyword-face)
                   (2 font-lock-constant-face append))
@@ -3180,11 +3191,14 @@ See also `verilog-font-lock-extra-types'.")
                 '("\\(\\\\\\S-*\\s-\\)"  0 font-lock-function-name-face)
                 ;; Fontify macro definitions/ uses
                 '("`\\s-*[A-Za-z][A-Za-z0-9_]*" 0 (if (boundp 
'font-lock-preprocessor-face)
-                                                      
'font-lock-preprocessor-face
-                                                    'font-lock-type-face))
+                                                      
'font-lock-preprocessor-face
+                                                    'font-lock-type-face))
                 ;; Fontify delays/numbers
-                
'("\\(@\\)\\|\\(#\\s-*\\(\\(\[0-9_.\]+\\('s?[hdxbo][0-9a-fA-F_xz]*\\)?\\)\\|\\(([^()]+)\\|\\sw+\\)\\)\\)"
+                '("\\(@\\)\\|\\([ 
\t\n\f\r]#\\s-*\\(\\(\[0-9_.\]+\\('s?[hdxbo][0-9a-fA-F_xz]*\\)?\\)\\|\\(([^()]+)\\|\\sw+\\)\\)\\)"
                   0 font-lock-type-face append)
+     ;; Fontify property/sequence cycle delays - these start with '##'
+     '("\\(##\\(\\sw+\\|\\[[^\]]+\\]\\)\\)"
+       0 font-lock-type-face append)
                 ;; Fontify instantiation names
                 '("\\([A-Za-z][A-Za-z0-9_]*\\)\\s-*(" 1 
font-lock-function-name-face)
                 )))
@@ -3257,10 +3271,10 @@ to full text form for parsing.  Additional actions may 
be specified with
                        (font-lock-mode 0)
                        t)))
      (unwind-protect
-          (progn ,@body)
-        ;; Unwind forms
-        (when fontlocked (font-lock-mode t))
-        (when hooked (verilog-run-hooks 'verilog-after-save-font-hook)))))
+         (progn ,@body)
+       ;; Unwind forms
+       (when fontlocked (font-lock-mode t))
+       (when hooked (verilog-run-hooks 'verilog-after-save-font-hook)))))
 
 ;;
 ;; Comment detection and caching
@@ -3292,7 +3306,7 @@ This requires that insertions must use `verilog-insert'."
   ;; Note this must work properly if there's multiple layers of calls
   ;; to verilog-save-scan-cache even with differing ticks.
   `(progn
-     (unless (verilog-scan-cache-ok-p)  ;; Must be before let
+     (unless (verilog-scan-cache-ok-p)   ; Must be before let
        (setq verilog-scan-cache-tick nil))
      (let* ((verilog-scan-cache-preserving (current-buffer)))
        (progn ,@body))))
@@ -3330,7 +3344,7 @@ This creates v-cmts properties where comments are in 
force."
                  (put-text-property (1+ pt) (point) 'v-cmts t))
                 ((looking-at "\"")
                  (setq pt (point))
-                 (or (re-search-forward "[^\\]\"" end t)       ;; don't 
forward-char first, since we look for a non backslash first
+                  (or (re-search-forward "[^\\]\"" end t)  ; don't 
forward-char first, since we look for a non backslash first
                      ;; No error - let later code indicate it so we can
                      (goto-char end))
                  (put-text-property (1+ pt) (point) 'v-cmts t))
@@ -3348,14 +3362,14 @@ either is ok to parse as a non-comment, or 
`verilog-insert' was used."
   (unless (verilog-scan-cache-ok-p)
     (save-excursion
       (verilog-save-buffer-state
-       (when verilog-debug
-         (message "Scanning %s cache=%s cachetick=%S tick=%S" (current-buffer)
-                  verilog-scan-cache-preserving verilog-scan-cache-tick
-                  (buffer-chars-modified-tick)))
-       (remove-text-properties (point-min) (point-max) '(v-cmts nil))
-       (verilog-scan-region (point-min) (point-max))
-       (setq verilog-scan-cache-tick (buffer-chars-modified-tick))
-       (when verilog-debug (message "Scanning... done"))))))
+       (when verilog-debug
+         (message "Scanning %s cache=%s cachetick=%S tick=%S" (current-buffer)
+                  verilog-scan-cache-preserving verilog-scan-cache-tick
+                  (buffer-chars-modified-tick)))
+       (remove-text-properties (point-min) (point-max) '(v-cmts nil))
+       (verilog-scan-region (point-min) (point-max))
+       (setq verilog-scan-cache-tick (buffer-chars-modified-tick))
+       (when verilog-debug (message "Scanning... done"))))))
 
 (defun verilog-scan-debug ()
   "For debugging, show with display face results of `verilog-scan'."
@@ -3427,13 +3441,13 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
   ;; before that see if we are in a comment
   (verilog-forward-sexp))
 
-;;;used by hs-minor-mode
 (defun verilog-forward-sexp-function (arg)
+  "Move forward a sexp."
+  ;; Used by hs-minor-mode
   (if (< arg 0)
       (verilog-backward-sexp)
     (verilog-forward-sexp)))
 
-
 (defun verilog-backward-sexp ()
   (let ((reg)
        (elsec 1)
@@ -3504,7 +3518,7 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
        ((match-end 2)
        ;; Search forward for matching endcase
        (setq reg 
"\\(\\<randcase\\>\\|\\(\\<unique0?\\>\\s-+\\|\\<priority\\>\\s-+\\)?\\<case[xz]?\\>[^:]\\)\\|\\(\\<endcase\\>\\)"
 )
-       (setq md 3) ;; ender is third item in regexp
+        (setq md 3)  ; ender is third item in regexp
        )
        ((match-end 4)
        ;; might be "disable fork" or "wait fork"
@@ -3514,15 +3528,15 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
               (looking-at verilog-disable-fork-re)
               (and (looking-at "fork")
                    (progn
-                     (setq here (point)) ;; sometimes a fork is just a fork
+                      (setq here (point))  ; sometimes a fork is just a fork
                      (forward-word -1)
                      (looking-at verilog-disable-fork-re))))
-             (progn ;; it is a disable fork; ignore it
+              (progn  ; it is a disable fork; ignore it
                (goto-char (match-end 0))
                (forward-word 1)
                (setq reg nil))
-           (progn ;; it is a nice simple fork
-             (goto-char here)   ;; return from looking for "disable fork"
+            (progn  ; it is a nice simple fork
+              (goto-char here)   ; return from looking for "disable fork"
              ;; Search forward for matching join
              (setq reg 
"\\(\\<fork\\>\\)\\|\\(\\<join\\(_any\\|_none\\)?\\>\\)" )))))
        ((match-end 6)
@@ -3533,41 +3547,41 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
        ;; Search forward for matching endtable
        (setq reg "\\<endtable\\>" )
        (setq nest 'no))
-      ((match-end 8)
-       ;; Search forward for matching endspecify
-       (setq reg "\\(\\<specify\\>\\)\\|\\(\\<endspecify\\>\\)" ))
-      ((match-end 9)
-       ;; Search forward for matching endfunction
-       (setq reg "\\<endfunction\\>" )
-       (setq nest 'no))
-      ((match-end 10)
-       ;; Search forward for matching endfunction
-       (setq reg "\\<endfunction\\>" )
-       (setq nest 'no))
-      ((match-end 14)
-       ;; Search forward for matching endtask
-       (setq reg "\\<endtask\\>" )
-       (setq nest 'no))
-      ((match-end 15)
-       ;; Search forward for matching endtask
-       (setq reg "\\<endtask\\>" )
-       (setq nest 'no))
-      ((match-end 19)
-       ;; Search forward for matching endgenerate
-       (setq reg "\\(\\<generate\\>\\)\\|\\(\\<endgenerate\\>\\)" ))
-      ((match-end 20)
-       ;; Search forward for matching endgroup
-       (setq reg "\\(\\<covergroup\\>\\)\\|\\(\\<endgroup\\>\\)" ))
-      ((match-end 21)
-       ;; Search forward for matching endproperty
-       (setq reg "\\(\\<property\\>\\)\\|\\(\\<endproperty\\>\\)" ))
-      ((match-end 25)
-       ;; Search forward for matching endsequence
-       (setq reg "\\(\\<\\(rand\\)?sequence\\>\\)\\|\\(\\<endsequence\\>\\)" )
-       (setq md 3)) ; 3 to get to endsequence in the reg above
-      ((match-end 27)
-       ;; Search forward for matching endclocking
-       (setq reg "\\(\\<clocking\\>\\)\\|\\(\\<endclocking\\>\\)" )))
+       ((match-end 8)
+        ;; Search forward for matching endspecify
+        (setq reg "\\(\\<specify\\>\\)\\|\\(\\<endspecify\\>\\)" ))
+       ((match-end 9)
+        ;; Search forward for matching endfunction
+        (setq reg "\\<endfunction\\>" )
+        (setq nest 'no))
+       ((match-end 10)
+        ;; Search forward for matching endfunction
+        (setq reg "\\<endfunction\\>" )
+        (setq nest 'no))
+       ((match-end 14)
+        ;; Search forward for matching endtask
+        (setq reg "\\<endtask\\>" )
+        (setq nest 'no))
+       ((match-end 15)
+        ;; Search forward for matching endtask
+        (setq reg "\\<endtask\\>" )
+        (setq nest 'no))
+       ((match-end 19)
+        ;; Search forward for matching endgenerate
+        (setq reg "\\(\\<generate\\>\\)\\|\\(\\<endgenerate\\>\\)" ))
+       ((match-end 20)
+        ;; Search forward for matching endgroup
+        (setq reg "\\(\\<covergroup\\>\\)\\|\\(\\<endgroup\\>\\)" ))
+       ((match-end 21)
+        ;; Search forward for matching endproperty
+        (setq reg "\\(\\<property\\>\\)\\|\\(\\<endproperty\\>\\)" ))
+       ((match-end 25)
+        ;; Search forward for matching endsequence
+        (setq reg "\\(\\<\\(rand\\)?sequence\\>\\)\\|\\(\\<endsequence\\>\\)" )
+        (setq md 3)) ; 3 to get to endsequence in the reg above
+       ((match-end 27)
+        ;; Search forward for matching endclocking
+        (setq reg "\\(\\<clocking\\>\\)\\|\\(\\<endclocking\\>\\)" )))
       (if (and reg
               (forward-word 1))
          (catch 'skip
@@ -3590,9 +3604,9 @@ Use filename, if current buffer being edited shorten to 
just buffer name."
                                  (progn
                                    (forward-word -1)
                                    (looking-at verilog-disable-fork-re))))
-                           (progn ;; it is a disable fork; another false alarm
+                            (progn  ; it is a disable fork; another false alarm
                              (goto-char (match-end 0)))
-                         (progn ;; it is a simple fork (or has nothing to do 
with fork)
+                          (progn  ; it is a simple fork (or has nothing to do 
with fork)
                            (goto-char here)
                            (setq depth (1+ depth))))))))))
              (if (verilog-re-search-forward reg nil 'move)
@@ -3787,7 +3801,7 @@ Key bindings specific to `verilog-mode-map' are:
   (setq verilog-which-tool 1)
   (setq verilog-tool 'verilog-linter)
   (verilog-set-compile-command)
-  (when (boundp 'hack-local-variables-hook)  ;; Also modify any 
file-local-variables
+  (when (boundp 'hack-local-variables-hook)  ; Also modify any 
file-local-variables
     (add-hook 'hack-local-variables-hook 'verilog-modify-compile-command t))
 
   ;; Setting up menus
@@ -3813,7 +3827,7 @@ Key bindings specific to `verilog-mode-map' are:
   ;;------------------------------------------------------------
   ;; now hook in 'verilog-highlight-include-files (eldo-mode.el&spice-mode.el)
   ;; all buffer local:
-  (unless noninteractive  ;; Else can't see the result, and change hooks are 
slow
+  (unless noninteractive  ; Else can't see the result, and change hooks are 
slow
     (when (featurep 'xemacs)
       (make-local-hook 'font-lock-mode-hook)
       (make-local-hook 'font-lock-after-fontify-buffer-hook); doesn't exist in 
Emacs
@@ -3841,10 +3855,9 @@ Key bindings specific to `verilog-mode-map' are:
   ;; verilog-mode-hook call added by define-derived-mode
   )
 
-
-;;
-;;  Electric functions
+;;; Electric functions:
 ;;
+
 (defun electric-verilog-terminate-line (&optional arg)
   "Terminate line and indent next line.
 With optional ARG, remove existing end of line comments."
@@ -3866,36 +3879,36 @@ With optional ARG, remove existing end of line 
comments."
       (newline)
       (verilog-more-comment))
      ((eolp)
-       ;; First, check if current line should be indented
-       (if (save-excursion
-             (delete-horizontal-space)
-            (beginning-of-line)
-            (skip-chars-forward " \t")
-            (if (looking-at verilog-auto-end-comment-lines-re)
-                (let ((indent-str (verilog-indent-line)))
-                  ;; Maybe we should set some endcomments
-                  (if verilog-auto-endcomments
-                      (verilog-set-auto-endcomments indent-str arg))
-                  (end-of-line)
-                  (delete-horizontal-space)
-                  (if arg
-                      ()
-                    (newline))
-                  nil)
-              (progn
-                (end-of-line)
-                (delete-horizontal-space)
-                't)))
-          ;; see if we should line up assignments
-          (progn
-            (if (or (eq 'all verilog-auto-lineup)
-                    (eq 'assignments verilog-auto-lineup))
-                (verilog-pretty-expr t "\\(<\\|:\\)?=" ))
-            (newline))
-        (forward-line 1))
-       ;; Indent next line
-       (if verilog-auto-indent-on-newline
-          (verilog-indent-line)))
+      ;; First, check if current line should be indented
+      (if (save-excursion
+            (delete-horizontal-space)
+            (beginning-of-line)
+            (skip-chars-forward " \t")
+            (if (looking-at verilog-auto-end-comment-lines-re)
+                (let ((indent-str (verilog-indent-line)))
+                  ;; Maybe we should set some endcomments
+                  (if verilog-auto-endcomments
+                      (verilog-set-auto-endcomments indent-str arg))
+                  (end-of-line)
+                  (delete-horizontal-space)
+                  (if arg
+                      ()
+                    (newline))
+                  nil)
+              (progn
+                (end-of-line)
+                (delete-horizontal-space)
+                't)))
+          ;; see if we should line up assignments
+          (progn
+            (if (or (eq 'all verilog-auto-lineup)
+                    (eq 'assignments verilog-auto-lineup))
+                (verilog-pretty-expr t "\\(<\\|:\\)?=" ))
+            (newline))
+        (forward-line 1))
+      ;; Indent next line
+      (if verilog-auto-indent-on-newline
+          (verilog-indent-line)))
      (t
       (newline)))))
 
@@ -3944,8 +3957,8 @@ With optional ARG, remove existing end of line comments."
        (goto-char p)
        (verilog-backward-case-item lim)
        (verilog-indent-line)))
-;;    (let ((verilog-tab-always-indent nil))
-;;      (verilog-indent-line))
+    ;; (let ((verilog-tab-always-indent nil))
+    ;;   (verilog-indent-line))
     ))
 
 ;;(defun electric-verilog-equal ()
@@ -3995,7 +4008,7 @@ With optional ARG, remove existing end of line comments."
              (t
               (indent-for-comment)
               (when (and (eolp) (= oldpnt (point)))
-                                       ; kill existing comment
+                 ;; kill existing comment
                 (beginning-of-line)
                 (re-search-forward comment-start-skip oldpnt 'move)
                 (goto-char (match-beginning 0))
@@ -4004,9 +4017,7 @@ With optional ARG, remove existing end of line comments."
    (t (progn (insert "\t")))))
 
 
-
-;;
-;; Interactive functions
+;;; Interactive functions:
 ;;
 
 (defun verilog-indent-buffer ()
@@ -4213,6 +4224,7 @@ Uses `verilog-scan' cache."
   "Label matching begin ... end, fork ... join and case ... endcase 
statements."
   (interactive)
   (let ((cnt 0)
+       (case-fold-search nil)
        (oldpos (point))
        (b (progn
             (verilog-beg-of-defun)
@@ -4222,7 +4234,7 @@ Uses `verilog-scan' cache."
             (point-marker))))
     (goto-char (marker-position b))
     (if (> (- e b) 200)
-       (message  "Relabeling module..."))
+       (message "Relabeling module..."))
     (while (and
            (> (marker-position e) (point))
            (verilog-re-search-forward
@@ -4240,7 +4252,7 @@ Uses `verilog-scan' cache."
     (if (or
         (> (- e b) 200)
         (> cnt 20))
-       (message  "%d lines auto commented" cnt))))
+       (message "%d lines auto commented" cnt))))
 
 (defun verilog-beg-of-statement ()
   "Move backward to beginning of statement."
@@ -4319,16 +4331,16 @@ Uses `verilog-scan' cache."
               (goto-char pt)
               (throw 'done t)))))
     (verilog-forward-syntactic-ws)))
-;
-;    (while (and
-;            (not (looking-at verilog-complete-reg))
-;            (not (bolp))
-;            (not (= (preceding-char) ?\;)))
-;      (verilog-backward-token)
-;      (verilog-backward-syntactic-ws)
-;      (setq pt (point)))
-;    (goto-char pt)
-; ;(verilog-forward-syntactic-ws)
+;;
+;;      (while (and
+;;              (not (looking-at verilog-complete-reg))
+;;              (not (bolp))
+;;              (not (= (preceding-char) ?\;)))
+;;        (verilog-backward-token)
+;;        (verilog-backward-syntactic-ws)
+;;        (setq pt (point)))
+;;      (goto-char pt)
+;;   ;(verilog-forward-syntactic-ws)
 
 (defun verilog-end-of-statement ()
   "Move forward to end of current statement."
@@ -4347,30 +4359,30 @@ Uses `verilog-scan' cache."
 
      ;; Skip to end of statement
      ((condition-case nil
-       (setq pos
-             (catch 'found
-               (while t
-                 (forward-sexp 1)
-                 (verilog-skip-forward-comment-or-string)
-                 (if (eolp)
-                     (forward-line 1))
-                 (cond ((looking-at "[ \t]*;")
-                        (skip-chars-forward "^;")
-                        (forward-char 1)
-                        (throw 'found (point)))
-                       ((save-excursion
-                          (forward-sexp -1)
-                          (looking-at verilog-beg-block-re))
-                        (goto-char (match-beginning 0))
-                        (throw 'found nil))
-                       ((looking-at "[ \t]*)")
-                        (throw 'found (point)))
-                       ((eobp)
-                        (throw 'found (point)))
-                       )))
-
-             )
-       (error nil))
+          (setq pos
+                (catch 'found
+                  (while t
+                    (forward-sexp 1)
+                    (verilog-skip-forward-comment-or-string)
+                    (if (eolp)
+                        (forward-line 1))
+                    (cond ((looking-at "[ \t]*;")
+                           (skip-chars-forward "^;")
+                           (forward-char 1)
+                           (throw 'found (point)))
+                          ((save-excursion
+                             (forward-sexp -1)
+                             (looking-at verilog-beg-block-re))
+                           (goto-char (match-beginning 0))
+                           (throw 'found nil))
+                          ((looking-at "[ \t]*)")
+                           (throw 'found (point)))
+                          ((eobp)
+                           (throw 'found (point)))
+                          )))
+
+                )
+        (error nil))
       (if (not pos)
           ;; Skip a whole block
           (catch 'found
@@ -4464,6 +4476,13 @@ More specifically, after a generate and before an 
endgenerate."
                (setq nest (1+ nest)))))))
     (= nest 0) )) ; return nest
 
+(defun verilog-in-deferred-immediate-final-p ()
+  "Return true if inside an ‘assert/assume/cover final’ statement."
+  (interactive)
+  (and (looking-at "final")
+       (verilog-looking-back "\\<\\(?:assert\\|assume\\|cover\\)\\>\\s-+" nil))
+  )
+
 (defun verilog-backward-case-item (lim)
   "Skip backward to nearest enclosing case item.
 Limit search to point LIM."
@@ -4485,14 +4504,14 @@ Limit search to point LIM."
               (verilog-re-search-backward "\\(\\[\\)\\|\\(\\]\\)\\|\\(:\\)"
                                           lim1 'move))
            (cond
-            ((match-end 1) ;; [
+             ((match-end 1)  ; [
              (setq colon (1+ colon))
              (if (>= colon 0)
                  (error "%s: unbalanced [" (verilog-point-text))))
-            ((match-end 2) ;; ]
+             ((match-end 2)  ; ]
              (setq colon (1- colon)))
 
-            ((match-end 3) ;; :
+             ((match-end 3)  ; :
              (setq colon (1+ colon)))))
          ;; Skip back to beginning of case item
          (skip-chars-backward "\t ")
@@ -4527,9 +4546,7 @@ Limit search to point LIM."
          str)
       'nil)))
 
-
-;;
-;; Other functions
+;;; Other functions:
 ;;
 
 (defun verilog-kill-existing-comment ()
@@ -4625,312 +4642,312 @@ primitive or interface named NAME."
                      (search-backward "//" (point-at-bol) t)))))
       (let ((type (car indent-str)))
        (unless (eq type 'declaration)
-         (unless (looking-at (concat "\\(" verilog-end-block-ordered-re "\\)[ 
\t]*:")) ;; ignore named ends
+          (unless (looking-at (concat "\\(" verilog-end-block-ordered-re "\\)[ 
\t]*:"))  ; ignore named ends
            (if (looking-at verilog-end-block-ordered-re)
-             (cond
-              (;- This is a case block; search back for the start of this case
-               (match-end 1) ;; of verilog-end-block-ordered-re
-
-               (let ((err 't)
-                     (str "UNMATCHED!!"))
-                 (save-excursion
-                   (verilog-leap-to-head)
-                   (cond
-                    ((looking-at "\\<randcase\\>")
-                     (setq str "randcase")
-                     (setq err nil))
-                    ((looking-at 
"\\(\\(unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\)")
-                     (goto-char (match-end 0))
-                     (setq str (concat (match-string 0) " " 
(verilog-get-expr)))
-                     (setq err nil))
-                    ))
-                 (end-of-line)
-                 (if kill-existing-comment
-                     (verilog-kill-existing-comment))
-                 (delete-horizontal-space)
-                 (insert (concat " // " str ))
-                 (if err (ding 't))))
-
-              (;- This is a begin..end block
-               (match-end 2) ;; of verilog-end-block-ordered-re
-               (let ((str " // UNMATCHED !!")
-                     (err 't)
-                     (here (point))
-                     there
-                     cntx)
-                 (save-excursion
-                   (verilog-leap-to-head)
-                   (setq there (point))
-                   (if (not (match-end 0))
-                       (progn
-                         (goto-char here)
-                         (end-of-line)
-                         (if kill-existing-comment
-                             (verilog-kill-existing-comment))
-                         (delete-horizontal-space)
-                         (insert str)
-                         (ding 't))
-                     (let ((lim
-                            (save-excursion (verilog-beg-of-defun) (point)))
-                           (here (point)))
-                       (cond
-                        (;-- handle named block differently
-                         (looking-at verilog-named-block-re)
-                         (search-forward ":")
-                         (setq there (point))
-                         (setq str (verilog-get-expr))
-                         (setq err nil)
-                         (setq str (concat " // block: " str )))
-
-                        ((verilog-in-case-region-p) ;-- handle case item 
differently
-                         (goto-char here)
-                         (setq str (verilog-backward-case-item lim))
-                         (setq there (point))
-                         (setq err nil)
-                         (setq str (concat " // case: " str )))
-
-                        (;- try to find "reason" for this begin
-                         (cond
-                          (;
-                           (eq here (progn
-                                   ;;   (verilog-backward-token)
-                                      (verilog-beg-of-statement)
-                                      (point)))
-                           (setq err nil)
-                           (setq str ""))
-                          ((looking-at verilog-endcomment-reason-re)
-                           (setq there (match-end 0))
-                           (setq cntx (concat (match-string 0) " "))
-                           (cond
-                            (;- begin
-                             (match-end 1)
-                             (setq err nil)
-                             (save-excursion
-                               (if (and (verilog-continued-line)
-                                        (looking-at 
"\\<repeat\\>\\|\\<wait\\>\\|\\<always\\>"))
-                                   (progn
-                                     (goto-char (match-end 0))
-                                     (setq there (point))
-                                     (setq str
-                                           (concat " // " (match-string 0) " " 
(verilog-get-expr))))
-                                 (setq str ""))))
-
-                            (;- else
-                             (match-end 2)
-                             (let ((nest 0)
-                                   ( reg 
"\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)\\|\\(\\<if\\>\\)\\|\\(assert\\)"))
-                               (catch 'skip
-                                 (while (verilog-re-search-backward reg nil 
'move)
-                                   (cond
-                                    ((match-end 1) ; begin
-                                     (setq nest (1- nest)))
-                                    ((match-end 2)                       ; end
-                                     (setq nest (1+ nest)))
-                                    ((match-end 3)
-                                     (if (= 0 nest)
-                                         (progn
-                                           (goto-char (match-end 0))
-                                           (setq there (point))
-                                           (setq err nil)
-                                           (setq str (verilog-get-expr))
-                                           (setq str (concat " // else: !if" 
str ))
-                                           (throw 'skip 1))))
-                                    ((match-end 4)
-                                     (if (= 0 nest)
-                                         (progn
-                                           (goto-char (match-end 0))
-                                           (setq there (point))
-                                           (setq err nil)
-                                           (setq str (verilog-get-expr))
-                                           (setq str (concat " // else: 
!assert " str ))
-                                           (throw 'skip 1)))))))))
-                            (;- end else
-                             (match-end 3)
-                             (goto-char there)
-                             (let ((nest 0)
-                                   (reg 
"\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)\\|\\(\\<if\\>\\)\\|\\(assert\\)"))
-                               (catch 'skip
-                                 (while (verilog-re-search-backward reg nil 
'move)
-                                   (cond
-                                    ((match-end 1) ; begin
-                                     (setq nest (1- nest)))
-                                    ((match-end 2)                       ; end
-                                     (setq nest (1+ nest)))
-                                    ((match-end 3)
-                                     (if (= 0 nest)
-                                         (progn
-                                           (goto-char (match-end 0))
-                                           (setq there (point))
-                                           (setq err nil)
-                                           (setq str (verilog-get-expr))
-                                           (setq str (concat " // else: !if" 
str ))
-                                           (throw 'skip 1))))
-                                    ((match-end 4)
-                                     (if (= 0 nest)
-                                         (progn
-                                           (goto-char (match-end 0))
-                                           (setq there (point))
-                                           (setq err nil)
-                                           (setq str (verilog-get-expr))
-                                           (setq str (concat " // else: 
!assert " str ))
-                                           (throw 'skip 1)))))))))
-
-                            (; always, always_comb, always_latch w/o @...
-                             (match-end 5)
-                             (goto-char (match-end 0))
-                             (setq there (point))
-                             (setq err nil)
-                             (setq str (concat " // " cntx )))
-
-                            (;- task/function/initial et cetera
-                             t
-                             (match-end 0)
-                             (goto-char (match-end 0))
-                             (setq there (point))
-                             (setq err nil)
-                             (setq str (concat " // " cntx 
(verilog-get-expr))))
-
-                            (;-- otherwise...
-                             (setq str " // auto-endcomment confused "))))
-
-                          ((and
-                            (verilog-in-case-region-p) ;-- handle case item 
differently
-                            (progn
-                              (setq there (point))
-                              (goto-char here)
-                              (setq str (verilog-backward-case-item lim))))
-                           (setq err nil)
-                           (setq str (concat " // case: " str )))
-
-                          ((verilog-in-fork-region-p)
-                           (setq err nil)
-                           (setq str " // fork branch" ))
-
-                          ((looking-at "\\<end\\>")
-                           ;; HERE
-                           (forward-word 1)
-                           (verilog-forward-syntactic-ws)
-                           (setq err nil)
-                           (setq str (verilog-get-expr))
-                           (setq str (concat " // " cntx str )))
-
-                          ))))
-                     (goto-char here)
-                     (end-of-line)
-                     (if kill-existing-comment
-                         (verilog-kill-existing-comment))
-                     (delete-horizontal-space)
-                     (if (or err
-                             (> (count-lines here there) 
verilog-minimum-comment-distance))
-                         (insert str))
-                     (if err (ding 't))
-                     ))))
-              (;- this is endclass, which can be nested
-               (match-end 11) ;; of verilog-end-block-ordered-re
-               ;;(goto-char there)
-               (let ((nest 0)
-                     (reg 
"\\<\\(class\\)\\|\\(endclass\\)\\|\\(package\\|primitive\\|\\(macro\\)?module\\)\\>")
-                     string)
-                 (save-excursion
-                   (catch 'skip
-                     (while (verilog-re-search-backward reg nil 'move)
-                       (cond
-                        ((match-end 3) ; endclass
-                         (ding 't)
-                         (setq string "unmatched endclass")
-                         (throw 'skip 1))
-
-                        ((match-end 2) ; endclass
-                         (setq nest (1+ nest)))
-
-                        ((match-end 1) ; class
-                         (setq nest (1- nest))
-                         (if (< nest 0)
-                             (progn
-                               (goto-char (match-end 0))
-                               (let (b e)
-                                 (setq b (progn
-                                           (skip-chars-forward "^ \t")
-                                           (verilog-forward-ws&directives)
-                                           (point))
-                                       e (progn
-                                           (skip-chars-forward "a-zA-Z0-9_")
-                                           (point)))
-                                 (setq string (buffer-substring b e)))
-                               (throw 'skip 1))))
-                        ))))
-                 (end-of-line)
-      (if kill-existing-comment
-          (verilog-kill-existing-comment))
-      (delete-horizontal-space)
-                 (insert (concat " // " string ))))
-
-              (;- this is 
end{function,generate,task,module,primitive,table,generate}
-               ;- which can not be nested.
-               t
-               (let (string reg (name-re nil))
-                 (end-of-line)
-                 (if kill-existing-comment
-                     (save-match-data
-                      (verilog-kill-existing-comment)))
-                 (delete-horizontal-space)
-                 (backward-sexp)
-                 (cond
-                  ((match-end 5) ;; of verilog-end-block-ordered-re
-                   (setq reg 
"\\(\\<function\\>\\)\\|\\(\\<\\(endfunction\\|task\\|\\(macro\\)?module\\|primitive\\)\\>\\)")
-                   (setq name-re "\\w+\\(?:\n\\|\\s-\\)*[(;]"))
-                  ((match-end 6) ;; of verilog-end-block-ordered-re
-                   (setq reg 
"\\(\\<task\\>\\)\\|\\(\\<\\(endtask\\|function\\|\\(macro\\)?module\\|primitive\\)\\>\\)")
-                   (setq name-re "\\w+\\(?:\n\\|\\s-\\)*[(;]"))
-                  ((match-end 7) ;; of verilog-end-block-ordered-re
-                   (setq reg 
"\\(\\<\\(macro\\)?module\\>\\)\\|\\<endmodule\\>"))
-                  ((match-end 8) ;; of verilog-end-block-ordered-re
-                   (setq reg 
"\\(\\<primitive\\>\\)\\|\\(\\<\\(endprimitive\\|package\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
-                  ((match-end 9) ;; of verilog-end-block-ordered-re
-                   (setq reg 
"\\(\\<interface\\>\\)\\|\\(\\<\\(endinterface\\|package\\|primitive\\|\\(macro\\)?module\\)\\>\\)"))
-                  ((match-end 10) ;; of verilog-end-block-ordered-re
-                   (setq reg 
"\\(\\<package\\>\\)\\|\\(\\<\\(endpackage\\|primitive\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
-                  ((match-end 11) ;; of verilog-end-block-ordered-re
-                   (setq reg 
"\\(\\<class\\>\\)\\|\\(\\<\\(endclass\\|primitive\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
-                  ((match-end 12) ;; of verilog-end-block-ordered-re
-                   (setq reg 
"\\(\\<covergroup\\>\\)\\|\\(\\<\\(endcovergroup\\|primitive\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
-                  ((match-end 13) ;; of verilog-end-block-ordered-re
-                   (setq reg 
"\\(\\<program\\>\\)\\|\\(\\<\\(endprogram\\|primitive\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
-                  ((match-end 14) ;; of verilog-end-block-ordered-re
-                   (setq reg 
"\\(\\<\\(rand\\)?sequence\\>\\)\\|\\(\\<\\(endsequence\\|primitive\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
-                  ((match-end 15) ;; of verilog-end-block-ordered-re
-                   (setq reg "\\(\\<clocking\\>\\)\\|\\<endclocking\\>"))
-                  ((match-end 16) ;; of verilog-end-block-ordered-re
-                   (setq reg "\\(\\<property\\>\\)\\|\\<endproperty\\>"))
-
-                  (t (error "Problem in verilog-set-auto-endcomments")))
-                 (let (b e)
-                   (save-excursion
-                     (verilog-re-search-backward reg nil 'move)
-                     (cond
-                      ((match-end 1)
-                       (setq b (progn
-                                 (skip-chars-forward "^ \t")
-                                 (verilog-forward-ws&directives)
-                                 (if (looking-at "static\\|automatic")
-                                     (progn
-                                       (goto-char (match-end 0))
-                                       (verilog-forward-ws&directives)))
-                                 (if (and name-re (verilog-re-search-forward 
name-re nil 'move))
-                                     (progn
-                                       (goto-char (match-beginning 0))
-                                       (verilog-forward-ws&directives)))
-                                 (point))
-                             e (progn
-                                 (skip-chars-forward "a-zA-Z0-9_")
-                                 (point)))
-                       (setq string (buffer-substring b e)))
-                      (t
-                       (ding 't)
-                       (setq string "unmatched 
end(function|task|module|primitive|interface|package|class|clocking)")))))
-                 (end-of-line)
-                 (insert (concat " // " string )))
-               ))))))))))
+                (cond
+                 (;- This is a case block; search back for the start of this 
case
+                  (match-end 1)  ; of verilog-end-block-ordered-re
+
+                  (let ((err 't)
+                        (str "UNMATCHED!!"))
+                    (save-excursion
+                      (verilog-leap-to-head)
+                      (cond
+                       ((looking-at "\\<randcase\\>")
+                        (setq str "randcase")
+                        (setq err nil))
+                       ((looking-at 
"\\(\\(unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\)")
+                        (goto-char (match-end 0))
+                        (setq str (concat (match-string 0) " " 
(verilog-get-expr)))
+                        (setq err nil))
+                       ))
+                    (end-of-line)
+                    (if kill-existing-comment
+                        (verilog-kill-existing-comment))
+                    (delete-horizontal-space)
+                    (insert (concat " // " str ))
+                    (if err (ding 't))))
+
+                 (;- This is a begin..end block
+                  (match-end 2)  ; of verilog-end-block-ordered-re
+                  (let ((str " // UNMATCHED !!")
+                        (err 't)
+                        (here (point))
+                        there
+                        cntx)
+                    (save-excursion
+                      (verilog-leap-to-head)
+                      (setq there (point))
+                      (if (not (match-end 0))
+                          (progn
+                            (goto-char here)
+                            (end-of-line)
+                            (if kill-existing-comment
+                                (verilog-kill-existing-comment))
+                            (delete-horizontal-space)
+                            (insert str)
+                            (ding 't))
+                        (let ((lim
+                               (save-excursion (verilog-beg-of-defun) (point)))
+                              (here (point)))
+                          (cond
+                           (;-- handle named block differently
+                            (looking-at verilog-named-block-re)
+                            (search-forward ":")
+                            (setq there (point))
+                            (setq str (verilog-get-expr))
+                            (setq err nil)
+                            (setq str (concat " // block: " str )))
+
+                           ((verilog-in-case-region-p) ;-- handle case item 
differently
+                            (goto-char here)
+                            (setq str (verilog-backward-case-item lim))
+                            (setq there (point))
+                            (setq err nil)
+                            (setq str (concat " // case: " str )))
+
+                           (;- try to find "reason" for this begin
+                            (cond
+                             (;
+                              (eq here (progn
+                                         ;;   (verilog-backward-token)
+                                         (verilog-beg-of-statement)
+                                         (point)))
+                              (setq err nil)
+                              (setq str ""))
+                             ((looking-at verilog-endcomment-reason-re)
+                              (setq there (match-end 0))
+                              (setq cntx (concat (match-string 0) " "))
+                              (cond
+                               (;- begin
+                                (match-end 1)
+                                (setq err nil)
+                                (save-excursion
+                                  (if (and (verilog-continued-line)
+                                           (looking-at 
"\\<repeat\\>\\|\\<wait\\>\\|\\<always\\>"))
+                                      (progn
+                                        (goto-char (match-end 0))
+                                        (setq there (point))
+                                        (setq str
+                                              (concat " // " (match-string 0) 
" " (verilog-get-expr))))
+                                    (setq str ""))))
+
+                               (;- else
+                                (match-end 2)
+                                (let ((nest 0)
+                                      ( reg 
"\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)\\|\\(\\<if\\>\\)\\|\\(assert\\)"))
+                                  (catch 'skip
+                                    (while (verilog-re-search-backward reg nil 
'move)
+                                      (cond
+                                       ((match-end 1) ; begin
+                                        (setq nest (1- nest)))
+                                       ((match-end 2)                       ; 
end
+                                        (setq nest (1+ nest)))
+                                       ((match-end 3)
+                                        (if (= 0 nest)
+                                            (progn
+                                              (goto-char (match-end 0))
+                                              (setq there (point))
+                                              (setq err nil)
+                                              (setq str (verilog-get-expr))
+                                              (setq str (concat " // else: 
!if" str ))
+                                              (throw 'skip 1))))
+                                       ((match-end 4)
+                                        (if (= 0 nest)
+                                            (progn
+                                              (goto-char (match-end 0))
+                                              (setq there (point))
+                                              (setq err nil)
+                                              (setq str (verilog-get-expr))
+                                              (setq str (concat " // else: 
!assert " str ))
+                                              (throw 'skip 1)))))))))
+                               (;- end else
+                                (match-end 3)
+                                (goto-char there)
+                                (let ((nest 0)
+                                      (reg 
"\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)\\|\\(\\<if\\>\\)\\|\\(assert\\)"))
+                                  (catch 'skip
+                                    (while (verilog-re-search-backward reg nil 
'move)
+                                      (cond
+                                       ((match-end 1) ; begin
+                                        (setq nest (1- nest)))
+                                       ((match-end 2)                       ; 
end
+                                        (setq nest (1+ nest)))
+                                       ((match-end 3)
+                                        (if (= 0 nest)
+                                            (progn
+                                              (goto-char (match-end 0))
+                                              (setq there (point))
+                                              (setq err nil)
+                                              (setq str (verilog-get-expr))
+                                              (setq str (concat " // else: 
!if" str ))
+                                              (throw 'skip 1))))
+                                       ((match-end 4)
+                                        (if (= 0 nest)
+                                            (progn
+                                              (goto-char (match-end 0))
+                                              (setq there (point))
+                                              (setq err nil)
+                                              (setq str (verilog-get-expr))
+                                              (setq str (concat " // else: 
!assert " str ))
+                                              (throw 'skip 1)))))))))
+
+                               (; always, always_comb, always_latch w/o @...
+                                (match-end 5)
+                                (goto-char (match-end 0))
+                                (setq there (point))
+                                (setq err nil)
+                                (setq str (concat " // " cntx )))
+
+                               (;- task/function/initial et cetera
+                                t
+                                (match-end 0)
+                                (goto-char (match-end 0))
+                                (setq there (point))
+                                (setq err nil)
+                                (setq str (concat " // " cntx 
(verilog-get-expr))))
+
+                               (;-- otherwise...
+                                (setq str " // auto-endcomment confused "))))
+
+                             ((and
+                               (verilog-in-case-region-p) ;-- handle case item 
differently
+                               (progn
+                                 (setq there (point))
+                                 (goto-char here)
+                                 (setq str (verilog-backward-case-item lim))))
+                              (setq err nil)
+                              (setq str (concat " // case: " str )))
+
+                             ((verilog-in-fork-region-p)
+                              (setq err nil)
+                              (setq str " // fork branch" ))
+
+                             ((looking-at "\\<end\\>")
+                              ;; HERE
+                              (forward-word 1)
+                              (verilog-forward-syntactic-ws)
+                              (setq err nil)
+                              (setq str (verilog-get-expr))
+                              (setq str (concat " // " cntx str )))
+
+                             ))))
+                        (goto-char here)
+                        (end-of-line)
+                        (if kill-existing-comment
+                            (verilog-kill-existing-comment))
+                        (delete-horizontal-space)
+                        (if (or err
+                                (> (count-lines here there) 
verilog-minimum-comment-distance))
+                            (insert str))
+                        (if err (ding 't))
+                        ))))
+                 (;- this is endclass, which can be nested
+                  (match-end 11)  ; of verilog-end-block-ordered-re
+                  ;;(goto-char there)
+                  (let ((nest 0)
+                        (reg 
"\\<\\(class\\)\\|\\(endclass\\)\\|\\(package\\|primitive\\|\\(macro\\)?module\\)\\>")
+                        string)
+                    (save-excursion
+                      (catch 'skip
+                        (while (verilog-re-search-backward reg nil 'move)
+                          (cond
+                           ((match-end 3)      ; endclass
+                            (ding 't)
+                            (setq string "unmatched endclass")
+                            (throw 'skip 1))
+
+                           ((match-end 2)      ; endclass
+                            (setq nest (1+ nest)))
+
+                           ((match-end 1) ; class
+                            (setq nest (1- nest))
+                            (if (< nest 0)
+                                (progn
+                                  (goto-char (match-end 0))
+                                  (let (b e)
+                                    (setq b (progn
+                                              (skip-chars-forward "^ \t")
+                                              (verilog-forward-ws&directives)
+                                              (point))
+                                          e (progn
+                                              (skip-chars-forward "a-zA-Z0-9_")
+                                              (point)))
+                                    (setq string (buffer-substring b e)))
+                                  (throw 'skip 1))))
+                           ))))
+                    (end-of-line)
+                    (if kill-existing-comment
+                        (verilog-kill-existing-comment))
+                    (delete-horizontal-space)
+                    (insert (concat " // " string ))))
+
+                 (;  - this is 
end{function,generate,task,module,primitive,table,generate}
+                  ;; - which can not be nested.
+                  t
+                  (let (string reg (name-re nil))
+                    (end-of-line)
+                    (if kill-existing-comment
+                        (save-match-data
+                          (verilog-kill-existing-comment)))
+                    (delete-horizontal-space)
+                    (backward-sexp)
+                    (cond
+                     ((match-end 5)  ; of verilog-end-block-ordered-re
+                      (setq reg 
"\\(\\<function\\>\\)\\|\\(\\<\\(endfunction\\|task\\|\\(macro\\)?module\\|primitive\\)\\>\\)")
+                      (setq name-re "\\w+\\(?:\n\\|\\s-\\)*[(;]"))
+                     ((match-end 6)  ; of verilog-end-block-ordered-re
+                      (setq reg 
"\\(\\<task\\>\\)\\|\\(\\<\\(endtask\\|function\\|\\(macro\\)?module\\|primitive\\)\\>\\)")
+                      (setq name-re "\\w+\\(?:\n\\|\\s-\\)*[(;]"))
+                     ((match-end 7)  ; of verilog-end-block-ordered-re
+                      (setq reg 
"\\(\\<\\(macro\\)?module\\>\\)\\|\\<endmodule\\>"))
+                     ((match-end 8)  ; of verilog-end-block-ordered-re
+                      (setq reg 
"\\(\\<primitive\\>\\)\\|\\(\\<\\(endprimitive\\|package\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
+                     ((match-end 9)  ; of verilog-end-block-ordered-re
+                      (setq reg 
"\\(\\<interface\\>\\)\\|\\(\\<\\(endinterface\\|package\\|primitive\\|\\(macro\\)?module\\)\\>\\)"))
+                     ((match-end 10)  ; of verilog-end-block-ordered-re
+                      (setq reg 
"\\(\\<package\\>\\)\\|\\(\\<\\(endpackage\\|primitive\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
+                     ((match-end 11)  ; of verilog-end-block-ordered-re
+                      (setq reg 
"\\(\\<class\\>\\)\\|\\(\\<\\(endclass\\|primitive\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
+                     ((match-end 12)  ; of verilog-end-block-ordered-re
+                      (setq reg 
"\\(\\<covergroup\\>\\)\\|\\(\\<\\(endcovergroup\\|primitive\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
+                     ((match-end 13)  ; of verilog-end-block-ordered-re
+                      (setq reg 
"\\(\\<program\\>\\)\\|\\(\\<\\(endprogram\\|primitive\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
+                     ((match-end 14)  ; of verilog-end-block-ordered-re
+                      (setq reg 
"\\(\\<\\(rand\\)?sequence\\>\\)\\|\\(\\<\\(endsequence\\|primitive\\|interface\\|\\(macro\\)?module\\)\\>\\)"))
+                     ((match-end 15)  ; of verilog-end-block-ordered-re
+                      (setq reg "\\(\\<clocking\\>\\)\\|\\<endclocking\\>"))
+                     ((match-end 16)  ; of verilog-end-block-ordered-re
+                      (setq reg "\\(\\<property\\>\\)\\|\\<endproperty\\>"))
+
+                     (t (error "Problem in verilog-set-auto-endcomments")))
+                    (let (b e)
+                      (save-excursion
+                        (verilog-re-search-backward reg nil 'move)
+                        (cond
+                         ((match-end 1)
+                          (setq b (progn
+                                    (skip-chars-forward "^ \t")
+                                    (verilog-forward-ws&directives)
+                                    (if (looking-at "static\\|automatic")
+                                        (progn
+                                          (goto-char (match-end 0))
+                                          (verilog-forward-ws&directives)))
+                                    (if (and name-re 
(verilog-re-search-forward name-re nil 'move))
+                                        (progn
+                                          (goto-char (match-beginning 0))
+                                          (verilog-forward-ws&directives)))
+                                    (point))
+                                e (progn
+                                    (skip-chars-forward "a-zA-Z0-9_")
+                                    (point)))
+                          (setq string (buffer-substring b e)))
+                         (t
+                          (ding 't)
+                          (setq string "unmatched 
end(function|task|module|primitive|interface|package|class|clocking)")))))
+                    (end-of-line)
+                    (insert (concat " // " string )))
+                  ))))))))))
 
 (defun verilog-get-expr()
   "Grab expression at point, e.g., case ( a | b & (c ^d))."
@@ -5059,7 +5076,7 @@ Useful for creating tri's and other expanded fields."
        (let ((bpt (- (point) 2)))
          (end-of-line)
          (delete-region bpt (point))))))
-    ;;
+  ;;
   (goto-char (point-min))
   (while (re-search-forward "/\\*" nil t)
     (if (verilog-within-string)
@@ -5073,7 +5090,7 @@ Useful for creating tri's and other expanded fields."
   (interactive)
   (goto-char (point-min))
   (while (re-search-forward "\\([^;]\\)[ \t]*\n[ \t]*" nil t)
-       (replace-match "\\1 " nil nil)))
+    (replace-match "\\1 " nil nil)))
 
 (defun verilog-linter-name ()
   "Return name of linter, either surelint or verilint."
@@ -5085,7 +5102,7 @@ Useful for creating tri's and other expanded fields."
          ((equal compile-word1 "verilint") `verilint)
          ((equal lint-word1 "surelint")    `surelint)
          ((equal lint-word1 "verilint")    `verilint)
-         (t `surelint))))  ;; back compatibility
+          (t `surelint))))  ; back compatibility
 
 (defun verilog-lint-off ()
   "Convert a Verilog linter warning line into a disable statement.
@@ -5227,9 +5244,7 @@ FILENAME to find directory to run in, or defaults to 
`buffer-file-name'."
           ;; So avoid bytecomp's interactive-only by going through intern.
           (when fontlocked (funcall (intern "font-lock-fontify-buffer"))))))))
 
-
-;;
-;; Batch
+;;; Batch:
 ;;
 
 (defun verilog-warn (string &rest args)
@@ -5251,7 +5266,7 @@ This lets programs calling batch mode to easily extract 
error messages."
         (progn ,@body)
        (error
        (error "%%Error: %s%s" (error-message-string err)
-              (if (featurep 'xemacs) "\n" ""))))))  ;; XEmacs forgets to add a 
newline
+               (if (featurep 'xemacs) "\n" ""))))))  ; XEmacs forgets to add a 
newline
 
 (defun verilog-batch-execute-func (funref &optional no-save)
   "Internal processing of a batch command.
@@ -5291,7 +5306,7 @@ Save the result unless optional NO-SAVE is t."
                   (set-buffer buf)
                   (funcall funref)
                   (when (and (not no-save)
-                             (buffer-modified-p)) ;; Avoid "no changes to be 
saved"
+                              (buffer-modified-p))  ; Avoid "no changes to be 
saved"
                     (save-buffer)))))
             orig-buffer-list))))
 
@@ -5302,7 +5317,7 @@ with \\[verilog-auto] on all command-line files, and 
saves the buffers.
 For proper results, multiple filenames need to be passed on the command
 line in bottom-up order."
   (unless noninteractive
-    (error "Use verilog-batch-auto only with --batch"))  ;; Otherwise we'd 
mess up buffer modes
+    (error "Use verilog-batch-auto only with --batch"))  ; Otherwise we'd mess 
up buffer modes
   (verilog-batch-execute-func `verilog-auto))
 
 (defun verilog-batch-delete-auto ()
@@ -5310,7 +5325,7 @@ line in bottom-up order."
 This sets up the appropriate Verilog mode environment, deletes automatics
 with \\[verilog-delete-auto] on all command-line files, and saves the buffers."
   (unless noninteractive
-    (error "Use verilog-batch-delete-auto only with --batch"))  ;; Otherwise 
we'd mess up buffer modes
+    (error "Use verilog-batch-delete-auto only with --batch"))  ; Otherwise 
we'd mess up buffer modes
   (verilog-batch-execute-func `verilog-delete-auto))
 
 (defun verilog-batch-delete-trailing-whitespace ()
@@ -5319,7 +5334,7 @@ This sets up the appropriate Verilog mode environment, 
removes
 whitespace with \\[verilog-delete-trailing-whitespace] on all
 command-line files, and saves the buffers."
   (unless noninteractive
-    (error "Use verilog-batch-delete-trailing-whitespace only with --batch"))  
;; Otherwise we'd mess up buffer modes
+    (error "Use verilog-batch-delete-trailing-whitespace only with --batch"))  
; Otherwise we'd mess up buffer modes
   (verilog-batch-execute-func `verilog-delete-trailing-whitespace))
 
 (defun verilog-batch-diff-auto ()
@@ -5329,7 +5344,7 @@ with \\[verilog-diff-auto] on all command-line files, and 
reports an error
 if any differences are observed.  This is appropriate for adding to regressions
 to insure automatics are always properly maintained."
   (unless noninteractive
-    (error "Use verilog-batch-diff-auto only with --batch"))  ;; Otherwise 
we'd mess up buffer modes
+    (error "Use verilog-batch-diff-auto only with --batch"))  ; Otherwise we'd 
mess up buffer modes
   (verilog-batch-execute-func `verilog-diff-auto t))
 
 (defun verilog-batch-inject-auto ()
@@ -5339,7 +5354,7 @@ with \\[verilog-inject-auto] on all command-line files, 
and saves the buffers.
 For proper results, multiple filenames need to be passed on the command
 line in bottom-up order."
   (unless noninteractive
-    (error "Use verilog-batch-inject-auto only with --batch"))  ;; Otherwise 
we'd mess up buffer modes
+    (error "Use verilog-batch-inject-auto only with --batch"))  ; Otherwise 
we'd mess up buffer modes
   (verilog-batch-execute-func `verilog-inject-auto))
 
 (defun verilog-batch-indent ()
@@ -5347,12 +5362,10 @@ line in bottom-up order."
 This sets up the appropriate Verilog mode environment, calls
 \\[verilog-indent-buffer] on all command-line files, and saves the buffers."
   (unless noninteractive
-    (error "Use verilog-batch-indent only with --batch"))  ;; Otherwise we'd 
mess up buffer modes
+    (error "Use verilog-batch-indent only with --batch"))  ; Otherwise we'd 
mess up buffer modes
   (verilog-batch-execute-func `verilog-indent-buffer))
 
-
-;;
-;; Indentation
+;;; Indentation:
 ;;
 (defconst verilog-indent-alist
   '((block       . (+ ind verilog-indent-level))
@@ -5391,6 +5404,7 @@ type of the current line, return that lines' indent level 
and its type.
 Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
   (save-excursion
     (let* ((starting_position (point))
+          (case-fold-search nil)
           (par 0)
           (begin (looking-at "[ \t]*begin\\>"))
           (lim (save-excursion (verilog-re-search-backward 
"\\(\\<begin\\>\\)\\|\\(\\<module\\>\\)" nil t)))
@@ -5412,132 +5426,132 @@ Return a list of two elements: (INDENT-TYPE 
INDENT-LEVEL)."
                                            (not (or (looking-at "[ 
\t]*`[ou]vm_")
                                                     (looking-at "[ 
\t]*`vmm_")))))
                       (throw 'nesting 'directive))
-           ;; indent structs as if there were module level
-           (setq structres (verilog-in-struct-nested-p))
-           (cond ((not structres) nil)
-                 ;;((and structres (equal (char-after) ?\})) (throw 'nesting 
'struct-close))
-                 ((> structres 0) (throw 'nesting 'nested-struct))
-                 ((= structres 0) (throw 'nesting 'block))
-                 (t nil))
-
-          ;; if we are in a parenthesized list, and the user likes to indent 
these, return.
-          ;; unless we are in the newfangled coverpoint or constraint blocks
-          (if (and
-                verilog-indent-lists
-                (verilog-in-paren)
-                (not (verilog-in-coverage-p))
-                )
-              (progn (setq par 1)
-                      (throw 'nesting 'block)))
-
-          ;; See if we are continuing a previous line
-          (while t
-            ;; trap out if we crawl off the top of the buffer
-            (if (bobp) (throw 'nesting 'cpp))
-
-            (if (and (verilog-continued-line-1 lim)
-                      (or (not (verilog-in-coverage-p))
-                          (looking-at verilog-in-constraint-re) ))  ;; may 
still get hosed if concat in constraint
-                (let ((sp (point)))
-                  (if (and
-                       (not (looking-at verilog-complete-reg))
-                       (verilog-continued-line-1 lim))
-                      (progn (goto-char sp)
-                             (throw 'nesting 'cexp))
-
-                    (goto-char sp))
-                   (if (and (verilog-in-coverage-p)
-                            (looking-at verilog-in-constraint-re))
-                       (progn
-                        (beginning-of-line)
-                        (skip-chars-forward " \t")
-                        (throw 'nesting 'constraint)))
-                  (if (and begin
-                            (not verilog-indent-begin-after-if)
-                            (looking-at verilog-no-indent-begin-re))
-                      (progn
-                        (beginning-of-line)
-                        (skip-chars-forward " \t")
-                        (throw 'nesting 'statement))
-                    (progn
-                      (throw 'nesting 'cexp))))
-              ;; not a continued line
-              (goto-char starting_position))
-
-            (if (looking-at "\\<else\\>")
-                ;; search back for governing if, striding across begin..end 
pairs
-                ;; appropriately
-                (let ((elsec 1))
-                  (while (verilog-re-search-backward verilog-ends-re nil 'move)
-                    (cond
-                     ((match-end 1) ; else, we're in deep
-                      (setq elsec (1+ elsec)))
-                     ((match-end 2) ; if
-                      (setq elsec (1- elsec))
-                      (if (= 0 elsec)
-                          (if verilog-align-ifelse
-                              (throw 'nesting 'statement)
-                            (progn ;; back up to first word on this line
-                              (beginning-of-line)
-                              (verilog-forward-syntactic-ws)
-                              (throw 'nesting 'statement)))))
-                     ((match-end 3) ; assert block
-                      (setq elsec (1- elsec))
-                      (verilog-beg-of-statement) ;; doesn't get to beginning
-                      (if (looking-at verilog-property-re)
-                          (throw 'nesting 'statement) ; We don't need an 
endproperty for these
-                        (throw 'nesting 'block)        ;We still need an 
endproperty
-                        ))
-                     (t ; endblock
-                                       ; try to leap back to matching outward 
block by striding across
-                                       ; indent level changing tokens then 
immediately
-                                       ; previous line governs indentation.
-                      (let (( reg) (nest 1))
-                        ;;      verilog-ends =>  
else|if|end|join(_any|_none|)|endcase|endclass|endtable|endspecify|endfunction|endtask|endgenerate|endgroup
-                        (cond
-                         ((match-end 4) ; end
-                          ;; Search back for matching begin
-                          (setq reg "\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)" ))
-                         ((match-end 5) ; endcase
-                          ;; Search back for matching case
-                          (setq reg 
"\\(\\<randcase\\>\\|\\<case[xz]?\\>[^:]\\)\\|\\(\\<endcase\\>\\)" ))
-                         ((match-end 6) ; endfunction
-                          ;; Search back for matching function
-                          (setq reg 
"\\(\\<function\\>\\)\\|\\(\\<endfunction\\>\\)" ))
-                         ((match-end 7) ; endtask
-                          ;; Search back for matching task
-                          (setq reg "\\(\\<task\\>\\)\\|\\(\\<endtask\\>\\)" ))
-                         ((match-end 8) ; endspecify
-                          ;; Search back for matching specify
-                          (setq reg 
"\\(\\<specify\\>\\)\\|\\(\\<endspecify\\>\\)" ))
-                         ((match-end 9) ; endtable
-                          ;; Search back for matching table
-                          (setq reg "\\(\\<table\\>\\)\\|\\(\\<endtable\\>\\)" 
))
-                         ((match-end 10) ; endgenerate
-                          ;; Search back for matching generate
-                          (setq reg 
"\\(\\<generate\\>\\)\\|\\(\\<endgenerate\\>\\)" ))
-                         ((match-end 11) ; joins
-                          ;; Search back for matching fork
-                          (setq reg 
"\\(\\<fork\\>\\)\\|\\(\\<join\\(_any\\|none\\)?\\>\\)" ))
-                         ((match-end 12) ; class
-                          ;; Search back for matching class
-                          (setq reg "\\(\\<class\\>\\)\\|\\(\\<endclass\\>\\)" 
))
-                         ((match-end 13) ; covergroup
-                          ;; Search back for matching covergroup
-                          (setq reg 
"\\(\\<covergroup\\>\\)\\|\\(\\<endgroup\\>\\)" )))
-                        (catch 'skip
-                          (while (verilog-re-search-backward reg nil 'move)
-                            (cond
-                             ((match-end 1) ; begin
-                              (setq nest (1- nest))
-                              (if (= 0 nest)
-                                  (throw 'skip 1)))
-                             ((match-end 2) ; end
-                              (setq nest (1+ nest)))))
-                          )))))))
-            (throw 'nesting (verilog-calc-1)))
-          );; catch nesting
-                );; type
+                   ;; indent structs as if there were module level
+                   (setq structres (verilog-in-struct-nested-p))
+                   (cond ((not structres) nil)
+                         ;;((and structres (equal (char-after) ?\})) (throw 
'nesting 'struct-close))
+                         ((> structres 0) (throw 'nesting 'nested-struct))
+                         ((= structres 0) (throw 'nesting 'block))
+                         (t nil))
+
+                   ;; if we are in a parenthesized list, and the user likes to 
indent these, return.
+                   ;; unless we are in the newfangled coverpoint or constraint 
blocks
+                   (if (and
+                        verilog-indent-lists
+                        (verilog-in-paren)
+                        (not (verilog-in-coverage-p))
+                        )
+                       (progn (setq par 1)
+                              (throw 'nesting 'block)))
+
+                   ;; See if we are continuing a previous line
+                   (while t
+                     ;; trap out if we crawl off the top of the buffer
+                     (if (bobp) (throw 'nesting 'cpp))
+
+                     (if (and (verilog-continued-line-1 lim)
+                              (or (not (verilog-in-coverage-p))
+                                  (looking-at verilog-in-constraint-re) ))  ; 
may still get hosed if concat in constraint
+                         (let ((sp (point)))
+                           (if (and
+                                (not (looking-at verilog-complete-reg))
+                                (verilog-continued-line-1 lim))
+                               (progn (goto-char sp)
+                                      (throw 'nesting 'cexp))
+
+                             (goto-char sp))
+                           (if (and (verilog-in-coverage-p)
+                                    (looking-at verilog-in-constraint-re))
+                               (progn
+                                 (beginning-of-line)
+                                 (skip-chars-forward " \t")
+                                 (throw 'nesting 'constraint)))
+                           (if (and begin
+                                    (not verilog-indent-begin-after-if)
+                                    (looking-at verilog-no-indent-begin-re))
+                               (progn
+                                 (beginning-of-line)
+                                 (skip-chars-forward " \t")
+                                 (throw 'nesting 'statement))
+                             (progn
+                               (throw 'nesting 'cexp))))
+                       ;; not a continued line
+                       (goto-char starting_position))
+
+                     (if (looking-at "\\<else\\>")
+                         ;; search back for governing if, striding across 
begin..end pairs
+                         ;; appropriately
+                         (let ((elsec 1))
+                           (while (verilog-re-search-backward verilog-ends-re 
nil 'move)
+                             (cond
+                              ((match-end 1) ; else, we're in deep
+                               (setq elsec (1+ elsec)))
+                              ((match-end 2) ; if
+                               (setq elsec (1- elsec))
+                               (if (= 0 elsec)
+                                   (if verilog-align-ifelse
+                                       (throw 'nesting 'statement)
+                                     (progn  ; back up to first word on this 
line
+                                       (beginning-of-line)
+                                       (verilog-forward-syntactic-ws)
+                                       (throw 'nesting 'statement)))))
+                              ((match-end 3) ; assert block
+                               (setq elsec (1- elsec))
+                               (verilog-beg-of-statement)  ; doesn't get to 
beginning
+                               (if (looking-at verilog-property-re)
+                                   (throw 'nesting 'statement)  ; We don't 
need an endproperty for these
+                                 (throw 'nesting 'block)       ; We still need 
an endproperty
+                                 ))
+                              (t ; endblock
+                               ;; try to leap back to matching outward block 
by striding across
+                               ;; indent level changing tokens then immediately
+                               ;; previous line governs indentation.
+                               (let (( reg) (nest 1))
+                                 ;;     verilog-ends =>  
else|if|end|join(_any|_none|)|endcase|endclass|endtable|endspecify|endfunction|endtask|endgenerate|endgroup
+                                 (cond
+                                  ((match-end 4) ; end
+                                   ;; Search back for matching begin
+                                   (setq reg 
"\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)" ))
+                                  ((match-end 5) ; endcase
+                                   ;; Search back for matching case
+                                   (setq reg 
"\\(\\<randcase\\>\\|\\<case[xz]?\\>[^:]\\)\\|\\(\\<endcase\\>\\)" ))
+                                  ((match-end 6) ; endfunction
+                                   ;; Search back for matching function
+                                   (setq reg 
"\\(\\<function\\>\\)\\|\\(\\<endfunction\\>\\)" ))
+                                  ((match-end 7) ; endtask
+                                   ;; Search back for matching task
+                                   (setq reg 
"\\(\\<task\\>\\)\\|\\(\\<endtask\\>\\)" ))
+                                  ((match-end 8) ; endspecify
+                                   ;; Search back for matching specify
+                                   (setq reg 
"\\(\\<specify\\>\\)\\|\\(\\<endspecify\\>\\)" ))
+                                  ((match-end 9) ; endtable
+                                   ;; Search back for matching table
+                                   (setq reg 
"\\(\\<table\\>\\)\\|\\(\\<endtable\\>\\)" ))
+                                  ((match-end 10) ; endgenerate
+                                   ;; Search back for matching generate
+                                   (setq reg 
"\\(\\<generate\\>\\)\\|\\(\\<endgenerate\\>\\)" ))
+                                  ((match-end 11) ; joins
+                                   ;; Search back for matching fork
+                                   (setq reg 
"\\(\\<fork\\>\\)\\|\\(\\<join\\(_any\\|none\\)?\\>\\)" ))
+                                  ((match-end 12) ; class
+                                   ;; Search back for matching class
+                                   (setq reg 
"\\(\\<class\\>\\)\\|\\(\\<endclass\\>\\)" ))
+                                  ((match-end 13) ; covergroup
+                                   ;; Search back for matching covergroup
+                                   (setq reg 
"\\(\\<covergroup\\>\\)\\|\\(\\<endgroup\\>\\)" )))
+                                 (catch 'skip
+                                   (while (verilog-re-search-backward reg nil 
'move)
+                                     (cond
+                                      ((match-end 1) ; begin
+                                       (setq nest (1- nest))
+                                       (if (= 0 nest)
+                                           (throw 'skip 1)))
+                                      ((match-end 2) ; end
+                                       (setq nest (1+ nest)))))
+                                   )))))))
+                     (throw 'nesting (verilog-calc-1)))
+                   )  ; catch nesting
+                ) ; type
           )
       ;; Return type of block and indent level.
       (if (not type)
@@ -5545,18 +5559,18 @@ Return a list of two elements: (INDENT-TYPE 
INDENT-LEVEL)."
       (if (> par 0)                    ; Unclosed Parenthesis
          (list 'cparenexp par)
        (cond
-         ((eq type 'case)
-          (list type (verilog-case-indent-level)))
-         ((eq type 'statement)
-          (list type (current-column)))
-         ((eq type 'defun)
-          (list type 0))
-         ((eq type 'constraint)
-          (list 'block (current-column)))
-         ((eq type 'nested-struct)
-          (list 'block structres))
-         (t
-          (list type (verilog-current-indent-level))))))))
+         ((eq type 'case)
+          (list type (verilog-case-indent-level)))
+         ((eq type 'statement)
+          (list type (current-column)))
+         ((eq type 'defun)
+          (list type 0))
+         ((eq type 'constraint)
+          (list 'block (current-column)))
+         ((eq type 'nested-struct)
+          (list 'block structres))
+         (t
+          (list type (verilog-current-indent-level))))))))
 
 (defun verilog-wai ()
   "Show matching nesting block for debugging."
@@ -5570,18 +5584,18 @@ Return a list of two elements: (INDENT-TYPE 
INDENT-LEVEL)."
       (if (and
           verilog-indent-lists
           (not(or (verilog-in-coverage-p)
-               (verilog-in-struct-p)))
+                   (verilog-in-struct-p)))
           (verilog-in-paren))
          (setq depth 1)
        (cond
-         ((eq type 'case)
-          (setq depth (verilog-case-indent-level)))
-         ((eq type 'statement)
-          (setq depth (current-column)))
-         ((eq type 'defun)
-          (setq depth 0))
-         (t
-          (setq depth (verilog-current-indent-level)))))
+         ((eq type 'case)
+          (setq depth (verilog-case-indent-level)))
+         ((eq type 'statement)
+          (setq depth (current-column)))
+         ((eq type 'defun)
+          (setq depth 0))
+         (t
+          (setq depth (verilog-current-indent-level)))))
       (message "You are at nesting %s depth %d" type depth))))
 
 (defun verilog-calc-1 ()
@@ -5589,108 +5603,115 @@ Return a list of two elements: (INDENT-TYPE 
INDENT-LEVEL)."
     (let ((re (concat "\\({\\|}\\|" verilog-indent-re "\\)"))
           (inconstraint (verilog-in-coverage-p)))
       (while (verilog-re-search-backward re nil 'move)
-       (catch 'continue
-         (cond
-          ((equal (char-after) ?\{)
+        (catch 'continue
+          (cond
+           ((equal (char-after) ?\{)
             ;; block type returned based on outer constraint { or inner
-           (if (verilog-at-constraint-p)
+            (if (verilog-at-constraint-p)
                 (cond (inconstraint
                        (beginning-of-line nil)
                        (skip-chars-forward " \t")
                        (throw 'nesting 'constraint))
                       (t
                        (throw 'nesting 'statement)))))
-          ((equal (char-after) ?\})
-           (let (par-pos
+           ((equal (char-after) ?\})
+            (let (par-pos
                   (there (verilog-at-close-constraint-p)))
-             (if there ;; we are at the } that closes a constraint.  Find the 
{ that opens it
-                 (progn
-                   (if (> (verilog-in-paren-count) 0)
+              (if there  ; we are at the } that closes a constraint.  Find the 
{ that opens it
+                  (progn
+                    (if (> (verilog-in-paren-count) 0)
                         (forward-char 1))
                     (setq par-pos (verilog-parenthesis-depth))
                     (cond (par-pos
-                          (goto-char par-pos)
-                          (forward-char 1))
-                         (t
-                          (backward-char 1)))))))
-
-          ((looking-at verilog-beg-block-re-ordered)
-           (cond
-            ((match-end 2)  ; *sigh* could be "unique case" or "priority casex"
-             (let ((here (point)))
-               (verilog-beg-of-statement)
-               (if (looking-at verilog-extended-case-re)
-                   (throw 'nesting 'case)
-                 (goto-char here)))
-             (throw 'nesting 'case))
-
-            ((match-end 4)  ; *sigh* could be "disable fork"
-             (let ((here (point)))
-               (verilog-beg-of-statement)
-               (if (looking-at verilog-disable-fork-re)
-                   t ; this is a normal statement
-                 (progn ; or is fork, starts a new block
-                   (goto-char here)
-                   (throw 'nesting 'block)))))
-
-            ((match-end 27)  ; *sigh* might be a clocking declaration
-             (let ((here (point)))
-               (if (verilog-in-paren)
-                   t ; this is a normal statement
-                 (progn ; or is fork, starts a new block
-                   (goto-char here)
-                   (throw 'nesting 'block)))))
-
-            ;; need to consider typedef struct here...
-            ((looking-at "\\<class\\|struct\\|function\\|task\\>")
-                                       ; *sigh* These words have an optional 
prefix:
-                                       ; extern {virtual|protected}? function 
a();
-                                       ; typedef class foo;
-                                       ; and we don't want to confuse this with
-                                       ; function a();
-                                       ; property
-                                       ; ...
-                                       ; endfunction
-             (verilog-beg-of-statement)
-             (if (looking-at verilog-beg-block-re-ordered)
-                 (throw 'nesting 'block)
-               (throw 'nesting 'defun)))
-
-            ;;
-            ((looking-at "\\<property\\>")
-                                       ; *sigh*
-                                       ;    {assert|assume|cover} property (); 
are complete
-                                       ;   and could also be labeled: - foo: 
assert property
-                                       ; but
-                                        ;    property ID () ... needs 
end_property
-             (verilog-beg-of-statement)
-             (if (looking-at verilog-property-re)
-                 (throw 'continue 'statement) ; We don't need an endproperty 
for these
-               (throw 'nesting 'block) ;We still need an endproperty
-               ))
-
-            (t              (throw 'nesting 'block))))
-
-          ((looking-at verilog-end-block-re)
-           (verilog-leap-to-head)
-           (if (verilog-in-case-region-p)
-               (progn
-                 (verilog-leap-to-case-head)
-                 (if (looking-at verilog-extended-case-re)
-                     (throw 'nesting 'case)))))
-
-          ((looking-at verilog-defun-level-re)
-           (if (looking-at verilog-defun-level-generate-only-re)
-               (if (verilog-in-generate-region-p)
-                   (throw 'continue 'foo)  ; always block in a generate - keep 
looking
-                 (throw 'nesting 'defun))
-             (throw 'nesting 'defun)))
-
-          ((looking-at verilog-cpp-level-re)
-           (throw 'nesting 'cpp))
-
-          ((bobp)
-           (throw 'nesting 'cpp)))))
+                           (goto-char par-pos)
+                           (forward-char 1))
+                          (t
+                           (backward-char 1)))))))
+
+           ((looking-at verilog-beg-block-re-ordered)
+            (cond
+             ((match-end 2)  ; *sigh* could be "unique case" or "priority 
casex"
+              (let ((here (point)))
+                (verilog-beg-of-statement)
+                (if (looking-at verilog-extended-case-re)
+                    (throw 'nesting 'case)
+                  (goto-char here)))
+              (throw 'nesting 'case))
+
+             ((match-end 4)  ; *sigh* could be "disable fork"
+              (let ((here (point)))
+                (verilog-beg-of-statement)
+                (if (looking-at verilog-disable-fork-re)
+                    t ; this is a normal statement
+                  (progn ; or is fork, starts a new block
+                    (goto-char here)
+                    (throw 'nesting 'block)))))
+
+             ((match-end 27)  ; *sigh* might be a clocking declaration
+              (let ((here (point)))
+                (if (verilog-in-paren)
+                    t ; this is a normal statement
+                  (progn ; or is fork, starts a new block
+                    (goto-char here)
+                    (throw 'nesting 'block)))))
+
+             ;; need to consider typedef struct here...
+             ((looking-at "\\<class\\|struct\\|function\\|task\\>")
+              ;; *sigh* These words have an optional prefix:
+              ;; extern {virtual|protected}? function a();
+              ;; typedef class foo;
+              ;; and we don't want to confuse this with
+              ;; function a();
+              ;; property
+              ;; ...
+              ;; endfunction
+              (verilog-beg-of-statement)
+              (cond
+               ((looking-at verilog-dpi-import-export-re)
+                (throw 'continue 'foo))
+               ((looking-at 
"\\<pure\\>\\s-+\\<virtual\\>\\s-+\\(?:\\<\\(local\\|protected\\|static\\)\\>\\s-+\\)?\\<\\(function\\|task\\)\\>\\s-+")
+                (throw 'nesting 'statement))
+               ((looking-at verilog-beg-block-re-ordered)
+                (throw 'nesting 'block))
+               (t
+                (throw 'nesting 'defun))))
+
+             ;;
+             ((looking-at "\\<property\\>")
+              ;; *sigh*
+              ;;    {assert|assume|cover} property (); are complete
+              ;;   and could also be labeled: - foo: assert property
+              ;; but
+              ;;    property ID () ... needs end_property
+              (verilog-beg-of-statement)
+              (if (looking-at verilog-property-re)
+                  (throw 'continue 'statement) ; We don't need an endproperty 
for these
+                (throw 'nesting 'block)        ;We still need an endproperty
+                ))
+
+             (t              (throw 'nesting 'block))))
+
+           ((looking-at verilog-end-block-re)
+            (verilog-leap-to-head)
+            (if (verilog-in-case-region-p)
+                (progn
+                  (verilog-leap-to-case-head)
+                  (if (looking-at verilog-extended-case-re)
+                      (throw 'nesting 'case)))))
+
+           ((looking-at verilog-defun-level-re)
+            (if (looking-at verilog-defun-level-generate-only-re)
+                (if (or (verilog-in-generate-region-p)
+                        (verilog-in-deferred-immediate-final-p))
+                    (throw 'continue 'foo)  ; always block in a generate - 
keep looking
+                  (throw 'nesting 'defun))
+              (throw 'nesting 'defun)))
+
+           ((looking-at verilog-cpp-level-re)
+            (throw 'nesting 'cpp))
+
+           ((bobp)
+            (throw 'nesting 'cpp)))))
 
       (throw 'nesting 'cpp))))
 
@@ -5698,8 +5719,8 @@ Return a list of two elements: (INDENT-TYPE 
INDENT-LEVEL)."
   "Return indentation level for directive.
 For speed, the searcher looks at the last directive, not the indent
 of the appropriate enclosing block."
-  (let ((base -1)      ;; Indent of the line that determines our indentation
-       (ind 0))        ;; Relative offset caused by other directives (like 
`endif on same line as `else)
+  (let ((base -1)  ; Indent of the line that determines our indentation
+        (ind 0))   ; Relative offset caused by other directives (like `endif 
on same line as `else)
     ;; Start at current location, scan back for another directive
 
     (save-excursion
@@ -5708,9 +5729,9 @@ of the appropriate enclosing block."
                  (verilog-re-search-backward verilog-directive-re nil t))
        (cond ((save-excursion (skip-chars-backward " \t") (bolp))
               (setq base (current-indentation))))
-       (cond ((and (looking-at verilog-directive-end) (< base 0))  ;; Only 
matters when not at BOL
+        (cond ((and (looking-at verilog-directive-end) (< base 0))  ; Only 
matters when not at BOL
               (setq ind (- ind verilog-indent-level-directive)))
-             ((and (looking-at verilog-directive-middle) (>= base 0))  ;; Only 
matters when at BOL
+              ((and (looking-at verilog-directive-middle) (>= base 0))  ; Only 
matters when at BOL
               (setq ind (+ ind verilog-indent-level-directive)))
              ((looking-at verilog-directive-begin)
               (setq ind (+ ind verilog-indent-level-directive)))))
@@ -5723,7 +5744,7 @@ of the appropriate enclosing block."
       (cond ((or (looking-at verilog-directive-middle)
                 (looking-at verilog-directive-end))
             (setq ind (max 0 (- ind verilog-indent-level-directive))))))
-   ind))
+    ind))
 
 (defun verilog-leap-to-case-head ()
   (let ((nest 1))
@@ -5784,7 +5805,7 @@ Jump from end to matching begin, from endcase to matching 
case, and so on."
       ;; 8: Search back for matching function
       (setq reg 
"\\(\\<function\\>\\)\\|\\(\\(\\(\\<virtual\\>\\s-+\\)\\|\\(\\<protected\\>\\s-+\\)\\)+\\<function\\>\\)")
       (setq nesting 'no))
-      ;;(setq reg "\\(\\<function\\>\\)\\|\\(\\<endfunction\\>\\)" ))
+     ;;(setq reg "\\(\\<function\\>\\)\\|\\(\\<endfunction\\>\\)" ))
      ((looking-at "\\<endgenerate\\>")
       ;; 8: Search back for matching generate
       (setq reg "\\(\\<generate\\>\\)\\|\\(\\<endgenerate\\>\\)" ))
@@ -5870,7 +5891,7 @@ Set point to where line starts."
                        (save-excursion
                          (skip-chars-backward " \t")
                          (not (bolp))))
-           (setq continued (verilog-backward-token)))))
+              (setq continued (verilog-backward-token)))))
       (setq continued nil))
     continued))
 
@@ -5884,14 +5905,14 @@ Set point to where line starts."
    (;-- Anything ending in a ; is complete
     (= (preceding-char) ?\;)
     nil)
-   (; If a "}" is prefixed by a ";", then this is a complete statement
-    ; i.e.: constraint foo { a = b; }
+   (;  If a "}" is prefixed by a ";", then this is a complete statement
+    ;; i.e.: constraint foo { a = b; }
     (= (preceding-char) ?\})
     (progn
       (backward-char)
       (not(verilog-at-close-constraint-p))))
    (;-- constraint foo { a = b }
-    ;   is a complete statement. *sigh*
+    ;;  is a complete statement. *sigh*
     (= (preceding-char) ?\{)
     (progn
       (backward-char)
@@ -5909,10 +5930,10 @@ Set point to where line starts."
     t)
 
    (;-- Could be 'case (foo)' or 'always @(bar)' which is complete
-    ;   also could be simply '@(foo)'
-    ;   or foo u1 #(a=8)
-    ;            (b, ... which ISN'T complete
-    ;;;; Do we need this???
+    ;;  also could be simply '@(foo)'
+    ;;  or foo u1 #(a=8)
+    ;;           (b, ... which ISN'T complete
+    ;; Do we need this???
     (= (preceding-char) ?\))
     (progn
       (backward-char)
@@ -5936,16 +5957,16 @@ Set point to where line starts."
          t)
         ((looking-at verilog-ovm-end-re)
          t)
-     ;; JBA find VMM macros
-     ((looking-at verilog-vmm-statement-re)
-      nil )
-     ((looking-at verilog-vmm-begin-re)
-      t)
-     ((looking-at verilog-vmm-end-re)
-      nil)
-     ;; JBA trying to catch macro lines with no ; at end
-     ((looking-at "\\<`")
-      nil)
+         ;; JBA find VMM macros
+         ((looking-at verilog-vmm-statement-re)
+          nil )
+         ((looking-at verilog-vmm-begin-re)
+          t)
+         ((looking-at verilog-vmm-end-re)
+          nil)
+         ;; JBA trying to catch macro lines with no ; at end
+         ((looking-at "\\<`")
+          nil)
         (t
          (goto-char back)
          (cond
@@ -6003,16 +6024,16 @@ Set point to where line starts."
 (defun verilog-backward-syntactic-ws-quick ()
   "As with `verilog-backward-syntactic-ws' but use `verilog-scan' cache."
   (while (cond ((bobp)
-               nil) ; Done
-              ((> (skip-syntax-backward " ") 0)
-               t)
-              ((eq (preceding-char) ?\n)  ;; \n's terminate // so aren't space 
syntax
-               (forward-char -1)
-               t)
-              ((or (verilog-inside-comment-or-string-p (1- (point)))
-                   (verilog-inside-comment-or-string-p (point)))
-               (re-search-backward "[/\"]" nil t) ;; Only way a comment or 
quote can begin
-               t))))
+                nil) ; Done
+               ((< (skip-syntax-backward " ") 0)
+                t)
+               ((eq (preceding-char) ?\n)  ; \n's terminate // so aren't space 
syntax
+                (forward-char -1)
+                t)
+               ((or (verilog-inside-comment-or-string-p (1- (point)))
+                    (verilog-inside-comment-or-string-p (point)))
+                (re-search-backward "[/\"]" nil t)  ; Only way a comment or 
quote can begin
+                t))))
 
 (defun verilog-forward-syntactic-ws ()
   (verilog-skip-forward-comment-p)
@@ -6029,10 +6050,10 @@ Optional BOUND limits search."
          (progn
            (let ((state (save-excursion (verilog-syntax-ppss))))
              (cond
-              ((nth 7 state) ;; in // comment
+               ((nth 7 state)  ; in // comment
                (verilog-re-search-backward "//" nil 'move)
                 (skip-chars-backward "/"))
-              ((nth 4 state) ;; in /* */ comment
+               ((nth 4 state)  ; in /* */ comment
                (verilog-re-search-backward "/\*" nil 'move))))
            (narrow-to-region bound (point))
            (while (/= here (point))
@@ -6041,6 +6062,9 @@ Optional BOUND limits search."
              (setq p
                    (save-excursion
                      (beginning-of-line)
+                     ;; for as long as we're right after a continued line, 
keep moving up
+                     (while (and (verilog-looking-back "\\\\[\n\r\f]" nil)
+                                  (forward-line -1)))
                      (cond
                       ((and verilog-highlight-translate-off
                             (verilog-within-translate-off))
@@ -6062,19 +6086,19 @@ Optional BOUND limits search."
          (progn
            (let ((state (save-excursion (verilog-syntax-ppss))))
              (cond
-              ((nth 7 state) ;; in // comment
+               ((nth 7 state)  ; in // comment
                (end-of-line)
                (forward-char 1)
                (skip-chars-forward " \t\n\f")
                )
-              ((nth 4 state) ;; in /* */ comment
+               ((nth 4 state)  ; in /* */ comment
                (verilog-re-search-forward "\*\/\\s-*" nil 'move))))
            (narrow-to-region (point) bound)
            (while (/= here (point))
              (setq here (point)
                    jump nil)
              (forward-comment (buffer-size))
-             (and (looking-at "\\s-*(\\*.*\\*)\\s-*") ;; Attribute
+              (and (looking-at "\\s-*(\\*.*\\*)\\s-*")  ; Attribute
                   (goto-char (match-end 0)))
              (save-excursion
                (beginning-of-line)
@@ -6084,38 +6108,38 @@ Optional BOUND limits search."
                  (beginning-of-line 2))))))))
 
 (defun verilog-in-comment-p ()
- "Return true if in a star or // comment."
- (let ((state (save-excursion (verilog-syntax-ppss))))
-   (or (nth 4 state) (nth 7 state))))
+  "Return true if in a star or // comment."
+  (let ((state (save-excursion (verilog-syntax-ppss))))
+    (or (nth 4 state) (nth 7 state))))
 
 (defun verilog-in-star-comment-p ()
- "Return true if in a star comment."
- (let ((state (save-excursion (verilog-syntax-ppss))))
-   (and
-    (nth 4 state)                      ; t if in a comment of style a // or b 
/**/
-       (not
-        (nth 7 state)                  ; t if in a comment of style b /**/
-        ))))
+  "Return true if in a star comment."
+  (let ((state (save-excursion (verilog-syntax-ppss))))
+    (and
+     (nth 4 state)                     ; t if in a comment of style a // or b 
/**/
+     (not
+      (nth 7 state)                    ; t if in a comment of style b /**/
+      ))))
 
 (defun verilog-in-slash-comment-p ()
- "Return true if in a slash comment."
- (let ((state (save-excursion (verilog-syntax-ppss))))
-   (nth 7 state)))
+  "Return true if in a slash comment."
+  (let ((state (save-excursion (verilog-syntax-ppss))))
+    (nth 7 state)))
 
 (defun verilog-in-comment-or-string-p ()
- "Return true if in a string or comment."
- (let ((state (save-excursion (verilog-syntax-ppss))))
-   (or (nth 3 state) (nth 4 state) (nth 7 state)))) ; Inside string or comment)
+  "Return true if in a string or comment."
+  (let ((state (save-excursion (verilog-syntax-ppss))))
+    (or (nth 3 state) (nth 4 state) (nth 7 state)))) ; Inside string or 
comment)
 
 (defun verilog-in-attribute-p ()
- "Return true if point is in an attribute (* [] attribute *)."
- (save-match-data
-   (save-excursion
-     (verilog-re-search-backward "\\((\\*\\)\\|\\(\\*)\\)" nil 'move)
-     (cond
-      ((match-end 1)
-         (progn (goto-char (match-end 1))
-                (not (looking-at "\\s-*)")))
+  "Return true if point is in an attribute (* [] attribute *)."
+  (save-match-data
+    (save-excursion
+      (verilog-re-search-backward "\\((\\*\\)\\|\\(\\*)\\)" nil 'move)
+      (cond
+       ((match-end 1)
+        (progn (goto-char (match-end 1))
+               (not (looking-at "\\s-*)")))
         nil)
        ((match-end 2)
         (progn (goto-char (match-beginning 2))
@@ -6124,91 +6148,93 @@ Optional BOUND limits search."
        (t nil)))))
 
 (defun verilog-in-parameter-p ()
- "Return true if point is in a parameter assignment #( p1=1, p2=5)."
- (save-match-data
-   (save-excursion
-     (verilog-re-search-backward "\\(#(\\)\\|\\()\\)" nil 'move)
-     (numberp (match-beginning 1)))))
+  "Return true if point is in a parameter assignment #( p1=1, p2=5)."
+  (save-match-data
+    (save-excursion
+      (verilog-re-search-backward "\\(#(\\)\\|\\()\\)" nil 'move)
+      (numberp (match-beginning 1)))))
 
 (defun verilog-in-escaped-name-p ()
- "Return true if in an escaped name."
- (save-excursion
-   (backward-char)
-   (skip-chars-backward "^ \t\n\f")
-   (if (equal (char-after (point) ) ?\\ )
-       t
-     nil)))
+  "Return true if in an escaped name."
+  (save-excursion
+    (backward-char)
+    (skip-chars-backward "^ \t\n\f")
+    (if (equal (char-after (point) ) ?\\ )
+        t
+      nil)))
+
 (defun verilog-in-directive-p ()
- "Return true if in a directive."
- (save-excursion
-   (beginning-of-line)
-   (looking-at verilog-directive-re-1)))
+  "Return true if in a directive."
+  (save-excursion
+    (beginning-of-line)
+    (looking-at verilog-directive-re-1)))
 
 (defun verilog-in-parenthesis-p ()
- "Return true if in a ( ) expression (but not { } or [ ])."
- (save-match-data
-   (save-excursion
-     (verilog-re-search-backward "\\((\\)\\|\\()\\)" nil 'move)
-     (numberp (match-beginning 1)))))
+  "Return true if in a ( ) expression (but not { } or [ ])."
+  (save-match-data
+    (save-excursion
+      (verilog-re-search-backward "\\((\\)\\|\\()\\)" nil 'move)
+      (numberp (match-beginning 1)))))
 
 (defun verilog-in-paren ()
- "Return true if in a parenthetical expression.
+  "Return true if in a parenthetical expression.
 May cache result using `verilog-syntax-ppss'."
- (let ((state (save-excursion (verilog-syntax-ppss))))
-   (> (nth 0 state) 0 )))
+  (let ((state (save-excursion (verilog-syntax-ppss))))
+    (> (nth 0 state) 0 )))
 
 (defun verilog-in-paren-count ()
- "Return paren depth, floor to 0.
+  "Return paren depth, floor to 0.
 May cache result using `verilog-syntax-ppss'."
- (let ((state (save-excursion (verilog-syntax-ppss))))
-   (if (> (nth 0 state) 0)
-       (nth 0 state)
-     0 )))
+  (let ((state (save-excursion (verilog-syntax-ppss))))
+    (if (> (nth 0 state) 0)
+        (nth 0 state)
+      0 )))
 
 (defun verilog-in-paren-quick ()
- "Return true if in a parenthetical expression.
+  "Return true if in a parenthetical expression.
 Always starts from `point-min', to allow inserts with hooks disabled."
- ;; The -quick refers to its use alongside the other -quick functions,
- ;; not that it's likely to be faster than verilog-in-paren.
- (let ((state (save-excursion (parse-partial-sexp (point-min) (point)))))
-   (> (nth 0 state) 0 )))
+  ;; The -quick refers to its use alongside the other -quick functions,
+  ;; not that it's likely to be faster than verilog-in-paren.
+  (let ((state (save-excursion (parse-partial-sexp (point-min) (point)))))
+    (> (nth 0 state) 0 )))
 
 (defun verilog-in-struct-p ()
- "Return true if in a struct declaration."
- (interactive)
- (save-excursion
-   (if (verilog-in-paren)
-       (progn
-        (verilog-backward-up-list 1)
-        (verilog-at-struct-p)
-        )
-     nil)))
+  "Return true if in a struct declaration."
+  (interactive)
+  (save-excursion
+    (if (verilog-in-paren)
+        (progn
+          (verilog-backward-up-list 1)
+          (verilog-at-struct-p)
+          )
+      nil)))
 
 (defun verilog-in-struct-nested-p ()
- "Return nil for not in struct.
+  "Return nil for not in struct.
 Return 0 for in non-nested struct.
 Return >0 for nested struct."
- (interactive)
- (let (col)
-   (save-excursion
-     (if (verilog-in-paren)
-         (progn
-           (verilog-backward-up-list 1)
-           (setq col (verilog-at-struct-mv-p))
-           (if col
-               (if (verilog-in-struct-p) (current-column) 0)))
-       nil))))
+  (interactive)
+  (let (col)
+    (save-excursion
+      (if (verilog-in-paren)
+          (progn
+            (verilog-backward-up-list 1)
+            (setq col (verilog-at-struct-mv-p))
+            (if col
+                (if (verilog-in-struct-p) (current-column) 0)))
+        nil))))
 
 (defun verilog-in-coverage-p ()
- "Return true if in a constraint or coverpoint expression."
- (interactive)
- (save-excursion
-   (if (verilog-in-paren)
-       (progn
-        (verilog-backward-up-list 1)
-        (verilog-at-constraint-p)
-        )
-     nil)))
+  "Return true if in a constraint or coverpoint expression."
+  (interactive)
+  (save-excursion
+    (if (verilog-in-paren)
+        (progn
+          (verilog-backward-up-list 1)
+          (verilog-at-constraint-p)
+          )
+      nil)))
+
 (defun verilog-at-close-constraint-p ()
   "If at the } that closes a constraint or covergroup, return true."
   (if (and
@@ -6218,8 +6244,8 @@ Return >0 for nested struct."
       (save-excursion
        (verilog-backward-ws&directives)
        (if (or (equal (char-before) ?\;)
-                (equal (char-before) ?\}) ;; can end with inner constraint { } 
block or ;
-                (equal (char-before) ?\{)) ;; empty constraint block
+                (equal (char-before) ?\})  ; can end with inner constraint { } 
block or ;
+                (equal (char-before) ?\{))  ; empty constraint block
            (point)
          nil))))
 
@@ -6227,17 +6253,17 @@ Return >0 for nested struct."
   "If at the { of a constraint or coverpoint definition, return true, moving 
point to constraint."
   (if (save-excursion
        (let ((p (point)))
-       (and
-        (equal (char-after) ?\{)
-        (forward-list)
-        (progn (backward-char 1)
-               (verilog-backward-ws&directives)
-         (and
-               (or (equal (char-before) ?\{) ;; empty case
-                    (equal (char-before) ?\;)
-                    (equal (char-before) ?\}))
-                    ;; skip what looks like bus repetition operator {#{
-                    (not (string-match "^{\\s-*[0-9]+\\s-*{" (buffer-substring 
p (point)))))))))
+          (and
+           (equal (char-after) ?\{)
+           (forward-list)
+           (progn (backward-char 1)
+                  (verilog-backward-ws&directives)
+                  (and
+                   (or (equal (char-before) ?\{)  ; empty case
+                       (equal (char-before) ?\;)
+                       (equal (char-before) ?\}))
+                   ;; skip what looks like bus repetition operator {#{
+                   (not (string-match "^{\\s-*[0-9]+\\s-*{" (buffer-substring 
p (point)))))))))
       (progn
         (let ( (pt (point)) (pass 0))
           (verilog-backward-ws&directives)
@@ -6246,7 +6272,7 @@ Return >0 for nested struct."
               (progn (setq pass 1)
                      (if (looking-at "\\<with\\>")
                          (progn (verilog-backward-ws&directives)
-                                (beginning-of-line) ;; 1
+                                (beginning-of-line)  ; 1
                                 (verilog-forward-ws&directives)
                                 1 )
                        (verilog-beg-of-statement)
@@ -6294,76 +6320,78 @@ Return >0 for nested struct."
     nil))
 
 (defun verilog-parenthesis-depth ()
- "Return non zero if in parenthetical-expression."
- (save-excursion (nth 1 (verilog-syntax-ppss))))
+  "Return non zero if in parenthetical-expression."
+  (save-excursion (nth 1 (verilog-syntax-ppss))))
 
 
 (defun verilog-skip-forward-comment-or-string ()
- "Return true if in a string or comment."
- (let ((state (save-excursion (verilog-syntax-ppss))))
-   (cond
-    ((nth 3 state)                     ;Inside string
-     (search-forward "\"")
-     t)
-    ((nth 7 state)                     ;Inside // comment
-     (forward-line 1)
-     t)
-    ((nth 4 state)                     ;Inside any comment (hence /**/)
-     (search-forward "*/"))
-    (t
-     nil))))
+  "Return true if in a string or comment."
+  (let ((state (save-excursion (verilog-syntax-ppss))))
+    (cond
+     ((nth 3 state)                    ;Inside string
+      (search-forward "\"")
+      t)
+     ((nth 7 state)                    ;Inside // comment
+      (forward-line 1)
+      t)
+     ((nth 4 state)                    ;Inside any comment (hence /**/)
+      (search-forward "*/"))
+     (t
+      nil))))
 
 (defun verilog-skip-backward-comment-or-string ()
- "Return true if in a string or comment."
- (let ((state (save-excursion (verilog-syntax-ppss))))
-   (cond
-    ((nth 3 state)                     ;Inside string
-     (search-backward "\"")
-     t)
-    ((nth 7 state)                     ;Inside // comment
-     (search-backward "//")
-     (skip-chars-backward "/")
-     t)
-    ((nth 4 state)                     ;Inside /* */ comment
-     (search-backward "/*")
-     t)
-    (t
-     nil))))
+  "Return true if in a string or comment."
+  (let ((state (save-excursion (verilog-syntax-ppss))))
+    (cond
+     ((nth 3 state)                    ;Inside string
+      (search-backward "\"")
+      t)
+     ((nth 7 state)                    ;Inside // comment
+      (search-backward "//")
+      (skip-chars-backward "/")
+      t)
+     ((nth 4 state)                    ;Inside /* */ comment
+      (search-backward "/*")
+      t)
+     (t
+      nil))))
 
 (defun verilog-skip-backward-comments ()
- "Return true if a comment was skipped."
- (let ((more t))
-   (while more
-     (setq more
-          (let ((state (save-excursion (verilog-syntax-ppss))))
-            (cond
-             ((nth 7 state)                    ;Inside // comment
-              (search-backward "//")
-              (skip-chars-backward "/")
-              (skip-chars-backward " \t\n\f")
-              t)
-             ((nth 4 state)                    ;Inside /* */ comment
-              (search-backward "/*")
-              (skip-chars-backward " \t\n\f")
-              t)
-             ((and (not (bobp))
-                   (= (char-before) ?\/)
-                   (= (char-before (1- (point))) ?\*))
-              (goto-char (- (point) 2))
-              t) ;; Let nth 4 state handle the rest
-             ((and (not (bobp))
-                   (verilog-looking-back "\\*)" nil)
-                   (not (verilog-looking-back "(\\s-*\\*)" nil)))
-              (goto-char (- (point) 2))
-              (if (search-backward "(*" nil t)
-                  (progn
-                    (skip-chars-backward " \t\n\f")
-                    t)
-                (progn
-                  (goto-char (+ (point) 2))
-                  nil)))
-             (t
-              (/= (skip-chars-backward " \t\n\f") 0))))))))
+  "Return true if a comment was skipped."
+  (let ((more t))
+    (while more
+      (setq more
+            (let ((state (save-excursion (verilog-syntax-ppss))))
+              (cond
+               ((nth 7 state)                  ;Inside // comment
+                (search-backward "//")
+                (skip-chars-backward "/")
+                (skip-chars-backward " \t\n\f")
+                t)
+               ((nth 4 state)                  ;Inside /* */ comment
+                (search-backward "/*")
+                (skip-chars-backward " \t\n\f")
+                t)
+               ((and (not (bobp))
+                     (= (char-before) ?\/)
+                     (= (char-before (1- (point))) ?\*))
+                (goto-char (- (point) 2))
+                t)  ; Let nth 4 state handle the rest
+               ((and (not (bobp))
+                     ;;(verilog-looking-back "\\*)" nil) ;; super slow, use 
two char-before instead
+                     (= (char-before) ?\))
+                     (= (char-before (1- (point))) ?\*)
+                     (not (verilog-looking-back "(\\s-*\\*)" nil))) ;; slow 
but unlikely to be called
+                (goto-char (- (point) 2))
+                (if (search-backward "(*" nil t)
+                    (progn
+                      (skip-chars-backward " \t\n\f")
+                      t)
+                  (progn
+                    (goto-char (+ (point) 2))
+                    nil)))
+               (t
+                (/= (skip-chars-backward " \t\n\f") 0))))))))
 
 (defun verilog-skip-forward-comment-p ()
   "If in comment, move to end and return true."
@@ -6397,7 +6425,7 @@ Return >0 for nested struct."
              (progn
                (goto-char h)
                nil))))
-        ((and (looking-at "(\\*")              ;; attribute start, but not an 
event (*) or (* )
+         ((and (looking-at "(\\*")  ; attribute start, but not an event (*) or 
(* )
               (not (looking-at "(\\*\\s-*)")))
          (progn
            (setq h (point))
@@ -6463,7 +6491,7 @@ Only look at a few lines to determine indent level."
                     (verilog-beg-of-statement-1)
                     (setq fst (point))
                     (if (looking-at verilog-declaration-re)
-                        (progn ;; we have multiple words
+                         (progn  ; we have multiple words
                           (goto-char (match-end 0))
                           (skip-chars-forward " \t")
                           (cond
@@ -6497,7 +6525,11 @@ Only look at a few lines to determine indent level."
          (let ((val))
            (verilog-beg-of-statement-1)
            (if (and (< (point) here)
-                    (verilog-re-search-forward "=[ \\t]*" here 'move))
+                    (verilog-re-search-forward "=[ \\t]*" here 'move)
+                    ;; not at a |=>, #=#, or [=n] operator
+                    (not (string-match "\\[=.\\|#=#\\||=>"
+                                        (or (buffer-substring (- (point) 2) 
(1+ (point)))
+                                            ""))))  ; don't let buffer 
over/under-run spoil the party
                (setq val (current-column))
              (setq val (eval (cdr (assoc type verilog-indent-alist)))))
            (goto-char here)
@@ -6509,11 +6541,11 @@ Only look at a few lines to determine indent level."
              (val (save-excursion
                     (verilog-backward-up-list 1)
                     (forward-char 1)
-             (if verilog-indent-lists
-                 (skip-chars-forward " \t")
-               (verilog-forward-syntactic-ws))
-             (setq here (point))
-             (current-column)))
+                     (if verilog-indent-lists
+                         (skip-chars-forward " \t")
+                       (verilog-forward-syntactic-ws))
+                     (setq here (point))
+                     (current-column)))
 
              (decl (save-excursion
                      (goto-char here)
@@ -6553,7 +6585,11 @@ Only look at a few lines to determine indent level."
       (and (or
            (eq type 'defun)
            (eq type 'block))
-          (looking-at verilog-declaration-re))
+          (looking-at verilog-declaration-re)
+           ;; Do not consider "virtual function", "virtual task", "virtual 
class"
+           ;; as declarations
+           (not (looking-at (concat verilog-declaration-re
+                                    "\\s-+\\(function\\|task\\|class\\)\\b"))))
       (verilog-indent-declaration ind))
 
      (;-- form feeds - ignored as bug in indent-line-to in < 24.5
@@ -6607,7 +6643,7 @@ Do not count named blocks or case-statements."
              (re-search-backward "/\\*" nil t)
              (1+(current-column))))
           (comment-column
-            comment-column )
+            comment-column )
           (t
            (save-excursion
              (re-search-backward "//" nil t)
@@ -6681,11 +6717,11 @@ Be verbose about progress unless optional QUIET set."
          )
     (save-excursion
       (if (progn
-;          (verilog-beg-of-statement-1)
-          (beginning-of-line)
-          (verilog-forward-syntactic-ws)
-          (and (not (verilog-in-directive-p))    ;; could have `define input 
foo
-               (looking-at verilog-declaration-re)))
+            ;; (verilog-beg-of-statement-1)
+            (beginning-of-line)
+            (verilog-forward-syntactic-ws)
+            (and (not (verilog-in-directive-p))  ; could have `define input foo
+                 (looking-at verilog-declaration-re)))
          (progn
            (if (verilog-parenthesis-depth)
                ;; in an argument list or parameter block
@@ -6693,7 +6729,7 @@ Be verbose about progress unless optional QUIET set."
                      start (progn
                              (goto-char e)
                              (verilog-backward-up-list 1)
-                             (forward-line) ;; ignore ( input foo,
+                              (forward-line)  ; ignore ( input foo,
                              (verilog-re-search-forward verilog-declaration-re 
el 'move)
                              (goto-char (match-beginning 0))
                              (skip-chars-backward " \t")
@@ -6752,11 +6788,11 @@ Be verbose about progress unless optional QUIET set."
              (cond
               ((save-excursion (skip-chars-backward " \t")
                                (bolp))
-                (verilog-forward-ws&directives)
-                (indent-line-to base-ind)
-                (verilog-forward-ws&directives)
-                (if (< (point) e)
-                    (verilog-re-search-forward "[ \t\n\f]" e 'move)))
+                (verilog-forward-ws&directives)
+                (indent-line-to base-ind)
+                (verilog-forward-ws&directives)
+                (if (< (point) e)
+                    (verilog-re-search-forward "[ \t\n\f]" e 'move)))
               (t
                (just-one-space)
                (verilog-re-search-forward "[ \t\n\f]" e 'move)))
@@ -6771,7 +6807,7 @@ Be verbose about progress unless optional QUIET set."
                          (> r 0))
              (setq e (point))
              (unless quiet (message "%d" r))
-          ;;(verilog-do-indent (verilog-calculate-indent)))
+              ;; (verilog-do-indent (verilog-calculate-indent)))
              (verilog-forward-ws&directives)
              (cond
               ((or (and verilog-indent-declaration-macros
@@ -6885,7 +6921,7 @@ Be verbose about progress unless optional QUIET set."
                   (cond
                    ((looking-at verilog-assignment-operation-re)
                     (goto-char (match-beginning 2))
-                    (if (not (or (verilog-in-parenthesis-p) ;; leave 
attributes and comparisons alone
+                    (if (not (or (verilog-in-parenthesis-p)  ; leave 
attributes and comparisons alone
                                  (verilog-in-coverage-p)))
                         (if (eq (char-after) ?=)
                             (indent-to (1+ ind))       ; line up the = of the 
<= with surrounding =
@@ -7018,7 +7054,7 @@ Region is defined by B and EDPOS."
       (while (progn (setq e (marker-position edpos))
                    (< (point) e))
        (if (and (verilog-re-search-forward myre e 'move)
-                (not (verilog-in-attribute-p))) ;; skip attribute exprs
+                 (not (verilog-in-attribute-p)))  ; skip attribute exprs
            (progn
              (goto-char (match-beginning 2))
              (verilog-backward-syntactic-ws)
@@ -7053,9 +7089,8 @@ Region is defined by B and EDPOS."
     (insert
      (format "%s %d" type val))))
 
-;; 
-;;
-;; Completion
+
+;;; Completion:
 ;;
 (defvar verilog-str nil)
 (defvar verilog-all nil)
@@ -7186,14 +7221,14 @@ will be completed at runtime and should not be added to 
this list.")
 
 (defun verilog-func-completion (type)
   "Build regular expression for module/task/function names.
-TYPE is 'module, 'tf for task or function, or t if unknown."
+TYPE is ‘module’, ‘tf’ for task or function, or t if unknown."
   (if (string= verilog-str "")
       (setq verilog-str "[a-zA-Z_]"))
   (let ((verilog-str (concat (cond
-                            ((eq type 'module) "\\<\\(module\\)\\s +")
-                            ((eq type 'tf) "\\<\\(task\\|function\\)\\s +")
-                            (t "\\<\\(task\\|function\\|module\\)\\s +"))
-                           "\\<\\(" verilog-str "[a-zA-Z0-9_.]*\\)\\>"))
+                              ((eq type 'module) "\\<\\(module\\)\\s +")
+                              ((eq type 'tf) "\\<\\(task\\|function\\)\\s +")
+                              (t "\\<\\(task\\|function\\|module\\)\\s +"))
+                             "\\<\\(" verilog-str "[a-zA-Z0-9_.]*\\)\\>"))
        match)
 
     (if (not (looking-at verilog-defun-re))
@@ -7259,7 +7294,7 @@ must be a function to be called for every match to check 
if this should
 really be a match.  If VERILOG-FLAG is t, the function returns a list of
 all possible completions.  If VERILOG-FLAG is nil it returns a string,
 the longest possible completion, or t if VERILOG-STR is an exact match.
-If VERILOG-FLAG is 'lambda, the function returns t if VERILOG-STR is an
+If VERILOG-FLAG is ‘lambda’, the function returns t if VERILOG-STR is an
 exact match, nil otherwise."
   (save-excursion
     (let ((verilog-all nil))
@@ -7454,7 +7489,7 @@ VERILOG-PRED is non-nil, it must be a function to be 
called for every match
 to check if this should really be a match.  If VERILOG-FLAG is t, the
 function returns a list of all possible completions.  If it is nil it
 returns a string, the longest possible completion, or t if VERILOG-STR is
-an exact match.  If VERILOG-FLAG is 'lambda, the function returns t if
+an exact match.  If VERILOG-FLAG is ‘lambda’, the function returns t if
 VERILOG-STR is an exact match, nil otherwise."
   (save-excursion
     (let ((verilog-all nil)
@@ -7533,7 +7568,7 @@ If search fails, other files are checked based on
        (regexp "\\(module\\s-+\\w+\\s-*(\\)\\|\\(\\w+\\s-+\\w+\\s-*(\\)"))
     (with-output-to-temp-buffer "*Occur*"
       (save-excursion
-       (message (format "Searching for %s ..." regexp))
+       (message "Searching for %s ..." regexp)
        ;; Find next match, but give up if prev match was at end of buffer.
        (while (and (not (= prevpos (point-max)))
                    (verilog-re-search-forward regexp nil t))
@@ -7551,7 +7586,7 @@ If search fails, other files are checked based on
                        (goto-char (match-end 0))
                        (if (> nlines 0)
                            (forward-line (1+ nlines))
-                           (forward-line 1))
+                          (forward-line 1))
                        (point)))
                 (tag (format "%3d" linenum))
                 (empty (make-string (length tag) ?\ ))
@@ -7583,6 +7618,7 @@ If search fails, other files are checked based on
 
 ;; Highlight helper functions
 (defconst verilog-directive-regexp "\\(translate\\|coverage\\|lint\\)_")
+
 (defun verilog-within-translate-off ()
   "Return point if within translate-off region, else nil."
   (and (save-excursion
@@ -7595,15 +7631,15 @@ If search fails, other files are checked based on
 (defun verilog-start-translate-off (limit)
   "Return point before translate-off directive if before LIMIT, else nil."
   (when (re-search-forward
-         (concat "//\\s-*.*\\s-*" verilog-directive-regexp "off\\>")
-         limit t)
+         (concat "//\\s-*.*\\s-*" verilog-directive-regexp "off\\>")
+         limit t)
     (match-beginning 0)))
 
 (defun verilog-back-to-start-translate-off (limit)
   "Return point before translate-off directive if before LIMIT, else nil."
   (when (re-search-backward
-         (concat "//\\s-*.*\\s-*" verilog-directive-regexp "off\\>")
-         limit t)
+         (concat "//\\s-*.*\\s-*" verilog-directive-regexp "off\\>")
+         limit t)
     (match-beginning 0)))
 
 (defun verilog-end-translate-off (limit)
@@ -7649,7 +7685,7 @@ Bound search by LIMIT.  Adapted from
 See also `verilog-sk-header' for an alternative format."
   (interactive)
   (let ((start (point)))
-  (insert "\
+    (insert "\
 //-----------------------------------------------------------------------------
 // Title         : <title>
 // Project       : <project>
@@ -7721,8 +7757,7 @@ See also `verilog-sk-header' for an alternative format."
   (insert (format-time-string "%Y")))
 
 
-;;
-;; Signal list parsing
+;;; Signal list parsing:
 ;;
 
 ;; Elements of a signal list
@@ -7731,11 +7766,11 @@ See also `verilog-sk-header' for an alternative format."
   (list name bits comment mem enum signed type multidim modport))
 (defsubst verilog-sig-name (sig)
   (car sig))
-(defsubst verilog-sig-bits (sig) ;; First element of packed array (pre 
signal-name)
+(defsubst verilog-sig-bits (sig)  ; First element of packed array (pre 
signal-name)
   (nth 1 sig))
 (defsubst verilog-sig-comment (sig)
   (nth 2 sig))
-(defsubst verilog-sig-memory (sig) ;; Unpacked array (post signal-name)
+(defsubst verilog-sig-memory (sig)  ; Unpacked array (post signal-name)
   (nth 3 sig))
 (defsubst verilog-sig-enum (sig)
   (nth 4 sig))
@@ -7745,7 +7780,7 @@ See also `verilog-sk-header' for an alternative format."
   (nth 6 sig))
 (defsubst verilog-sig-type-set (sig type)
   (setcar (nthcdr 6 sig) type))
-(defsubst verilog-sig-multidim (sig) ;; Second and additional elements of 
packed array
+(defsubst verilog-sig-multidim (sig)  ; Second and additional elements of 
packed array
   (nth 7 sig))
 (defsubst verilog-sig-multidim-string (sig)
   (if (verilog-sig-multidim sig)
@@ -7777,11 +7812,11 @@ See also `verilog-sk-header' for an alternative format."
 (defsubst verilog-modport-name (sig)
   (car sig))
 (defsubst verilog-modport-clockings (sig)
-  (nth 1 sig)) ;; Returns list of names
+  (nth 1 sig))  ; Returns list of names
 (defsubst verilog-modport-clockings-add (sig val)
   (setcar (nthcdr 1 sig) (cons val (nth 1 sig))))
 (defsubst verilog-modport-decls (sig)
-  (nth 2 sig)) ;; Returns verilog-decls-* structure
+  (nth 2 sig))  ; Returns verilog-decls-* structure
 (defsubst verilog-modport-decls-set (sig val)
   (setcar (nthcdr 2 sig) val))
 
@@ -7793,7 +7828,7 @@ See also `verilog-sk-header' for an alternative format."
   (aref modi 1))
 (defsubst verilog-modi-get-point (modi)
   (aref modi 2))
-(defsubst verilog-modi-get-type (modi) ;; "module" or "interface"
+(defsubst verilog-modi-get-type (modi)  ; "module" or "interface"
   (aref modi 3))
 (defsubst verilog-modi-get-decls (modi)
   (verilog-modi-cache-results modi 'verilog-read-decls))
@@ -7819,8 +7854,8 @@ See also `verilog-sk-header' for an alternative format."
   (aref decls 2))
 (defsubst verilog-decls-get-vars (decls)
   (aref decls 3))
-(defsubst verilog-decls-get-modports (decls) ;; Also for clocking blocks; 
contains another verilog-decls struct
-  (aref decls 4))  ;; Returns verilog-modport* structure
+(defsubst verilog-decls-get-modports (decls)  ; Also for clocking blocks; 
contains another verilog-decls struct
+  (aref decls 4))  ; Returns verilog-modport* structure
 (defsubst verilog-decls-get-assigns (decls)
   (aref decls 5))
 (defsubst verilog-decls-get-consts (decls)
@@ -7985,7 +8020,8 @@ Signals must be in standard (base vector) form."
 (defun verilog-signals-combine-bus (in-list)
   "Return a list of signals in IN-LIST, with buses combined.
 Duplicate signals are also removed.  For example A[2] and A[1] become A[2:1]."
-  (let (combo buswarn
+  (let (combo
+        buswarn
        out-list
        sig highbit lowbit              ; Temp information about current signal
        sv-name sv-highbit sv-lowbit    ; Details about signal we are forming
@@ -8037,7 +8073,7 @@ Duplicate signals are also removed.  For example A[2] and 
A[1] become A[2:1]."
             ;; Combine with this signal
             (when (and sv-busstring
                        (not (equal sv-busstring (verilog-sig-bits sig))))
-              (when nil  ;; Debugging
+               (when nil  ; Debugging
                 (message (concat "Warning, can't merge into single bus "
                                  sv-name bus
                                  ", the AUTOs may be wrong")))
@@ -8157,17 +8193,17 @@ Tieoff value uses `verilog-active-low-regexp' and
 
 (defun verilog-read-inst-backward-name ()
   "Internal.  Move point back to beginning of inst-name."
-    (verilog-backward-open-paren)
-    (let (done)
-      (while (not done)
-       (verilog-re-search-backward-quick "\\()\\|\\b[a-zA-Z0-9`_\$]\\|\\]\\)" 
nil nil)  ; ] isn't word boundary
-       (cond ((looking-at ")")
-              (verilog-backward-open-paren))
-             (t (setq done t)))))
-    (while (looking-at "\\]")
-      (verilog-backward-open-bracket)
-      (verilog-re-search-backward-quick "\\(\\b[a-zA-Z0-9`_\$]\\|\\]\\)" nil 
nil))
-    (skip-chars-backward "a-zA-Z0-9`_$"))
+  (verilog-backward-open-paren)
+  (let (done)
+    (while (not done)
+      (verilog-re-search-backward-quick "\\()\\|\\b[a-zA-Z0-9`_\$]\\|\\]\\)" 
nil nil)  ; ] isn't word boundary
+      (cond ((looking-at ")")
+             (verilog-backward-open-paren))
+            (t (setq done t)))))
+  (while (looking-at "\\]")
+    (verilog-backward-open-bracket)
+    (verilog-re-search-backward-quick "\\(\\b[a-zA-Z0-9`_\$]\\|\\]\\)" nil 
nil))
+  (skip-chars-backward "a-zA-Z0-9`_$"))
 
 (defun verilog-read-inst-module-matcher ()
   "Set match data 0 with module_name when point is inside instantiation."
@@ -8296,12 +8332,12 @@ Return an array of [outputs inouts inputs wire reg 
assign const]."
          (or (search-forward "*)")
              (error "%s: Unmatched (* *), at char %d" (verilog-point-text) 
(point))))
         ((eq ?\" (following-char))
-         (or (re-search-forward "[^\\]\"" nil t)       ;; don't forward-char 
first, since we look for a non backslash first
+          (or (re-search-forward "[^\\]\"" nil t)  ; don't forward-char first, 
since we look for a non backslash first
              (error "%s: Unmatched quotes, at char %d" (verilog-point-text) 
(point))))
         ((eq ?\; (following-char))
-         (cond (in-ign-to-semi  ;; Such as inside a "import ...;" in a module 
header
+          (cond (in-ign-to-semi  ; Such as inside a "import ...;" in a module 
header
                 (setq in-ign-to-semi nil))
-               ((and in-modport (not (eq in-modport t))) ;; end of a modport 
declaration
+                ((and in-modport (not (eq in-modport t)))  ; end of a modport 
declaration
                 (verilog-modport-decls-set
                  in-modport
                  (verilog-decls-new sigs-out sigs-inout sigs-in
@@ -8341,11 +8377,11 @@ Return an array of [outputs inouts inputs wire reg 
assign const]."
                         (if (verilog-sig-memory newsig)
                             (concat (verilog-sig-memory newsig) (match-string 
1))
                           (match-string 1))))
-               (vec ;; Multidimensional
+                (vec  ; Multidimensional
                 (setq multidim (cons vec multidim))
                 (setq vec (verilog-string-replace-matches
                            "\\s-+" "" nil nil (match-string 1))))
-               (t ;; Bit width
+                (t  ; Bit width
                 (setq vec (verilog-string-replace-matches
                            "\\s-+" "" nil nil (match-string 1))))))
         ;; Normal or escaped identifier -- note we remember the \ if escaped
@@ -8353,13 +8389,13 @@ Return an array of [outputs inouts inputs wire reg 
assign const]."
          (goto-char (match-end 0))
          (setq keywd (match-string 1))
          (when (string-match "^\\\\" (match-string 1))
-           (setq keywd (concat keywd " ")))  ;; Escaped ID needs space at end
+            (setq keywd (concat keywd " ")))  ; Escaped ID needs space at end
          ;; Add any :: package names to same identifier
          (while (looking-at "\\s-*::\\s-*\\([a-zA-Z0-9`_$]+\\|\\\\[^ 
\t\n\f]+\\)")
            (goto-char (match-end 0))
            (setq keywd (concat keywd "::" (match-string 1)))
            (when (string-match "^\\\\" (match-string 1))
-             (setq keywd (concat keywd " "))))  ;; Escaped ID needs space at 
end
+              (setq keywd (concat keywd " "))))  ; Escaped ID needs space at 
end
          (cond ((equal keywd "input")
                 (setq vec nil        enum nil      rvalue nil  newsig nil  
signed nil
                       typedefed nil  multidim nil  ptype nil   modport nil
@@ -8419,7 +8455,7 @@ Return an array of [outputs inouts inputs wire reg assign 
const]."
                ((equal keywd "clocking")
                 (setq in-clocking t))
                ((equal keywd "import")
-                (if v2kargs-ok  ;; import in module header, not a modport 
import
+                 (if v2kargs-ok  ; import in module header, not a modport 
import
                     (setq in-ign-to-semi t  rvalue t)))
                ((equal keywd "type")
                 (setq ptype t))
@@ -8552,7 +8588,7 @@ Return an array of [outputs inouts inputs wire reg assign 
const]."
       (if vec (setq vec  (verilog-symbol-detick-denumber vec)))
       (if multidim (setq multidim  (mapcar `verilog-symbol-detick-denumber 
multidim)))
       (unless (or (not sig)
-                 (equal sig ""))  ;; Ignore .foo(1'b1) assignments
+                  (equal sig ""))  ; Ignore .foo(1'b1) assignments
        (cond ((or (setq portdata (assoc port (verilog-decls-get-inouts 
submoddecls)))
                   (equal "inout" verilog-read-sub-decls-gate-ios))
               (setq sigs-inout
@@ -8630,7 +8666,7 @@ Return an array of [outputs inouts inputs wire reg assign 
const]."
 
 (defun verilog-read-sub-decls-expr (submoddecls comment port expr)
   "For `verilog-read-sub-decls-line', parse a subexpression and add signals."
-  ;;(message "vrsde: '%s'" expr)
+  ;;(message "vrsde: ‘%s’" expr)
   ;; Replace special /*[....]*/ comments inserted by verilog-auto-inst-port
   (setq expr (verilog-string-replace-matches "/\\*\\(\\[[^*]+\\]\\)\\*/" "\\1" 
nil nil expr))
   ;; Remove front operators
@@ -8649,25 +8685,25 @@ Return an array of [outputs inouts inputs wire reg 
assign const]."
     (let (sig vec multidim)
       ;; Remove leading reduction operators, etc
       (setq expr (verilog-string-replace-matches "^\\s-*[---+~!|&]+\\s-*" "" 
nil nil expr))
-      ;;(message "vrsde-ptop: '%s'" expr)
-      (cond ;; Find \signal. Final space is part of escaped signal name
+      ;;(message "vrsde-ptop: ‘%s’" expr)
+      (cond  ; Find \signal. Final space is part of escaped signal name
        ((string-match "^\\s-*\\(\\\\[^ \t\n\f]+\\s-\\)" expr)
-       ;;(message "vrsde-s: '%s'" (match-string 1 expr))
+       ;;(message "vrsde-s: ‘%s’" (match-string 1 expr))
        (setq sig (match-string 1 expr)
              expr (substring expr (match-end 0))))
        ;; Find signal
        ((string-match "^\\s-*\\([a-zA-Z_][a-zA-Z_0-9]*\\)" expr)
-       ;;(message "vrsde-s: '%s'" (match-string 1 expr))
+       ;;(message "vrsde-s: ‘%s’" (match-string 1 expr))
        (setq sig (verilog-string-remove-spaces (match-string 1 expr))
              expr (substring expr (match-end 0)))))
       ;; Find [vector] or [multi][multi][multi][vector]
       (while (string-match "^\\s-*\\(\\[[^]]+\\]\\)" expr)
-       ;;(message "vrsde-v: '%s'" (match-string 1 expr))
+       ;;(message "vrsde-v: ‘%s’" (match-string 1 expr))
        (when vec (setq multidim (cons vec multidim)))
        (setq vec (match-string 1 expr)
              expr (substring expr (match-end 0))))
       ;; If found signal, and nothing unrecognized, add the signal
-      ;;(message "vrsde-rem: '%s'" expr)
+      ;;(message "vrsde-rem: ‘%s’" expr)
       (when (and sig (string-match "^\\s-*$" expr))
        (verilog-read-sub-decls-sig submoddecls comment port sig vec 
multidim))))))
 
@@ -8684,7 +8720,7 @@ Inserts the list of signals found, using submodi to look 
up each port."
               (goto-char (match-end 0)))
              ;; .\escaped (
              ((looking-at "\\s-*\\.\\s-*\\(\\\\[^ \t\n\f]*\\)\\s-*(\\s-*")
-              (setq port (concat (match-string 1) " ")) ;; escaped id's need 
trailing space
+               (setq port (concat (match-string 1) " "))  ; escaped id's need 
trailing space
               (goto-char (match-end 0)))
              ;; .name
              ((looking-at "\\s-*\\.\\s-*\\([a-zA-Z0-9`_$]*\\)\\s-*[,)/]")
@@ -8700,10 +8736,10 @@ Inserts the list of signals found, using submodi to 
look up each port."
               (setq port nil))
              ;; random
              ((looking-at "\\s-*\\.[^(]*(")
-              (setq port nil) ;; skip this line
+               (setq port nil)  ; skip this line
               (goto-char (match-end 0)))
              (t
-              (setq port nil  done t))) ;; Unknown, ignore rest of line
+               (setq port nil  done t)))  ; Unknown, ignore rest of line
        ;; Get signal name.  Point is at the first-non-space after (
        ;; We intentionally ignore (non-escaped) signals with .s in them
        ;; this prevents AUTOWIRE etc from noticing hierarchical sigs.
@@ -8819,19 +8855,19 @@ Outputs comments above subcell signals, for example:
                  ;; However I want it to be runnable even on user's manually 
added signals
                  (let ((verilog-read-sub-decls-in-interfaced t))
                    (while (re-search-forward "\\s *(?\\s *// Interfaced" 
end-inst-point t)
-                     (verilog-read-sub-decls-line submoddecls comment))) ;; 
Modifies sigs-ifd
+                      (verilog-read-sub-decls-line submoddecls comment)))  ; 
Modifies sigs-ifd
                  (goto-char st-point)
                  (while (re-search-forward "\\s *(?\\s *// Interfaces" 
end-inst-point t)
-                   (verilog-read-sub-decls-line submoddecls comment)) ;; 
Modifies sigs-out
+                    (verilog-read-sub-decls-line submoddecls comment))  ; 
Modifies sigs-out
                  (goto-char st-point)
                  (while (re-search-forward "\\s *(?\\s *// Outputs" 
end-inst-point t)
-                   (verilog-read-sub-decls-line submoddecls comment)) ;; 
Modifies sigs-out
+                    (verilog-read-sub-decls-line submoddecls comment))  ; 
Modifies sigs-out
                  (goto-char st-point)
                  (while (re-search-forward "\\s *(?\\s *// Inouts" 
end-inst-point t)
-                   (verilog-read-sub-decls-line submoddecls comment)) ;; 
Modifies sigs-inout
+                    (verilog-read-sub-decls-line submoddecls comment))  ; 
Modifies sigs-inout
                  (goto-char st-point)
                  (while (re-search-forward "\\s *(?\\s *// Inputs" 
end-inst-point t)
-                   (verilog-read-sub-decls-line submoddecls comment)) ;; 
Modifies sigs-in
+                    (verilog-read-sub-decls-line submoddecls comment))  ; 
Modifies sigs-in
                  )))))))
       ;; Combine duplicate bits
       ;;(setq rr (vector sigs-out sigs-inout sigs-in))
@@ -8846,7 +8882,7 @@ Outputs comments above subcell signals, for example:
   "Return an array of [ pins ] for the current instantiation at point.
 For example if declare A A (.B(SIG)) then B will be included in the list."
   (save-excursion
-    (let ((end-mod-point (point))      ;; presume at /*AUTOINST*/ point
+    (let ((end-mod-point (point))  ; presume at /*AUTOINST*/ point
          pins pin)
       (verilog-backward-open-paren)
       (while (re-search-forward "\\.\\([^(,) \t\n\f]*\\)\\s-*" end-mod-point t)
@@ -8860,7 +8896,7 @@ For example if declare A A (.B(SIG)) then B will be 
included in the list."
 (defun verilog-read-arg-pins ()
   "Return an array of [ pins ] for the current argument declaration at point."
   (save-excursion
-    (let ((end-mod-point (point))      ;; presume at /*AUTOARG*/ point
+    (let ((end-mod-point (point))  ; presume at /*AUTOARG*/ point
          pins pin)
       (verilog-backward-open-paren)
       (while (re-search-forward "\\([a-zA-Z0-9$_.%`]+\\)" end-mod-point t)
@@ -8881,7 +8917,7 @@ For example if declare A A (.B(SIG)) then B will be 
included in the list."
        (search-forward "(" end-mod-point)
        (setq tpl-end-pt (save-excursion
                           (backward-char 1)
-                          (verilog-forward-sexp-cmt 1)   ;; Moves to paren 
that closes argdecl's
+                           (verilog-forward-sexp-cmt 1)  ; Moves to paren that 
closes argdecl's
                           (backward-char 1)
                           (point)))
        (while (re-search-forward "\\s-*\\([\"a-zA-Z0-9$_.%`]+\\)\\s-*,*" 
tpl-end-pt t)
@@ -8907,18 +8943,18 @@ Must call `verilog-read-auto-lisp-present' before this 
function."
       (while (re-search-forward "\\<AUTO_LISP(" end t)
        (backward-char)
        (let* ((beg-pt (prog1 (point)
-                        (verilog-forward-sexp-cmt 1))) ;; Closing paren
+                         (verilog-forward-sexp-cmt 1)))  ; Closing paren
               (end-pt (point))
               (verilog-in-hooks t))
          (eval-region beg-pt end-pt nil))))))
 
 (defun verilog-read-always-signals-recurse
-  (exit-keywd rvalue temp-next)
+    (exit-keywd rvalue temp-next)
   "Recursive routine for parentheses/bracket matching.
 EXIT-KEYWD is expression to stop at, nil if top level.
 RVALUE is true if at right hand side of equal.
 IGNORE-NEXT is true to ignore next token, fake from inside case statement."
-  (let* ((semi-rvalue (equal "endcase" exit-keywd)) ;; true if after a ; we 
are looking for rvalue
+  (let* ((semi-rvalue (equal "endcase" exit-keywd))  ; true if after a ; we 
are looking for rvalue
         keywd last-keywd sig-tolk sig-last-tolk gotend got-sig got-list 
end-else-check
         ignore-next)
     ;;(if dbg (setq dbg (concat dbg (format "Recursion %S %S %S\n" exit-keywd 
rvalue temp-next))))
@@ -8971,16 +9007,16 @@ IGNORE-NEXT is true to ignore next token, fake from 
inside case statement."
            (if (looking-at "'[sS]?[hdxboHDXBO]?[ \t]*[0-9a-fA-F_xzXZ?]+")
                (goto-char (match-end 0))
              (forward-char 1)))
-          ((equal keywd ":")   ;; Case statement, begin/end label, x?y:z
-           (cond ((equal "endcase" exit-keywd)  ;; case x: y=z; statement next
+           ((equal keywd ":")  ; Case statement, begin/end label, x?y:z
+            (cond ((equal "endcase" exit-keywd)  ; case x: y=z; statement next
                   (setq ignore-next nil rvalue nil))
-                 ((equal "?" exit-keywd)  ;; x?y:z rvalue
-                  ) ;; NOP
-                 ((equal "]" exit-keywd)  ;; [x:y] rvalue
-                  ) ;; NOP
-                 (got-sig      ;; label: statement
+                  ((equal "?" exit-keywd)  ; x?y:z rvalue
+                   )  ; NOP
+                  ((equal "]" exit-keywd)  ; [x:y] rvalue
+                   )  ; NOP
+                  (got-sig  ; label: statement
                   (setq ignore-next nil rvalue semi-rvalue got-sig nil))
-                 ((not rvalue) ;; begin label
+                  ((not rvalue)  ; begin label
                   (setq ignore-next t rvalue nil)))
            (forward-char 1))
           ((equal keywd "=")
@@ -9004,7 +9040,7 @@ IGNORE-NEXT is true to ignore next token, fake from 
inside case statement."
            (verilog-read-always-signals-recurse "]" t nil))
           ((equal keywd "(")
            (forward-char 1)
-           (cond (sig-last-tolk        ;; Function call; zap last signal
+            (cond (sig-last-tolk  ; Function call; zap last signal
                   (setq got-sig nil)))
            (cond ((equal last-keywd "for")
                   ;; temp-next: Variables on LHS are lvalues, but generally we 
want
@@ -9023,13 +9059,13 @@ IGNORE-NEXT is true to ignore next token, fake from 
inside case statement."
            (skip-syntax-forward "w_")
            (verilog-read-always-signals-recurse "endcase" t nil)
            (setq ignore-next nil  rvalue semi-rvalue)
-           (if (not exit-keywd) (setq gotend t)))      ;; top level begin/end
-          ((string-match "^[$`a-zA-Z_]" keywd) ;; not exactly word constituent
+            (if (not exit-keywd) (setq gotend t)))  ; top level begin/end
+           ((string-match "^[$`a-zA-Z_]" keywd)  ; not exactly word constituent
            (cond ((member keywd '("`ifdef" "`ifndef" "`elsif"))
                   (setq ignore-next t))
                  ((or ignore-next
                       (member keywd verilog-keywords)
-                      (string-match "^\\$" keywd))     ;; PLI task
+                       (string-match "^\\$" keywd))  ; PLI task
                   (setq ignore-next nil))
                  (t
                   (setq keywd (verilog-symbol-detick-denumber keywd))
@@ -9062,7 +9098,7 @@ IGNORE-NEXT is true to ignore next token, fake from 
inside case statement."
 (defun verilog-read-always-signals ()
   "Parse always block at point and return list of (outputs inout inputs)."
   (save-excursion
-    (let* (;;(dbg "")
+    (let* (;(dbg "")
           sigs-out-d sigs-out-i sigs-out-unk sigs-temp sigs-in)
       (verilog-read-always-signals-recurse nil nil nil)
       (setq sigs-out-i (append sigs-out-i sigs-out-unk)
@@ -9126,7 +9162,7 @@ Returns REGEXP and list of ( (signal_name 
connection_name)... )."
              (setq lineno (1+ lineno))))))
       (setq tpl-end-pt (save-excursion
                         (backward-char 1)
-                        (verilog-forward-sexp-cmt 1)   ;; Moves to paren that 
closes argdecl's
+                         (verilog-forward-sexp-cmt 1)  ; Moves to paren that 
closes argdecl's
                         (backward-char 1)
                         (point)))
       ;;
@@ -9207,13 +9243,19 @@ If found returns `verilog-read-auto-template-inside' 
structure."
 (defvar verilog-auto-template-hits nil "Successful lookups with 
`verilog-read-auto-template-hit'.")
 (make-variable-buffer-local 'verilog-auto-template-hits)
 
+(defun verilog-read-auto-template-init ()
+  "Initialize `verilog-read-auto-template'."
+  (when (eval-when-compile (fboundp 'make-hash-table))  ; else feature not 
allowed
+    (when verilog-auto-template-warn-unused
+      (setq verilog-auto-template-hits
+           (make-hash-table :test 'equal :rehash-size 4.0)))))
+
 (defun verilog-read-auto-template-hit (tpl-ass)
   "Record that TPL-ASS template from `verilog-read-auto-template' was used."
-  (when (eval-when-compile (fboundp 'make-hash-table)) ;; else feature not 
allowed
+  (when (eval-when-compile (fboundp 'make-hash-table))  ; else feature not 
allowed
     (when verilog-auto-template-warn-unused
       (unless verilog-auto-template-hits
-       (setq verilog-auto-template-hits
-             (make-hash-table :test 'equal :rehash-size 4.0)))
+       (verilog-read-auto-template-init))
       (puthash (vector (nth 2 tpl-ass) (nth 3 tpl-ass)) t
               verilog-auto-template-hits))))
 
@@ -9243,8 +9285,8 @@ Parameters must be simple assignments to constants, or 
have their own
 \"parameter\" label rather than a list of parameters.  Thus:
 
     parameter X = 5, Y = 10;   // Ok
-    parameter X = {1'b1, 2'h2};        // Ok
-    parameter X = {1'b1, 2'h2}, Y = 10;        // Bad, make into 2 parameter 
lines
+    parameter X = {1\\='b1, 2\\='h2};  // Ok
+    parameter X = {1\\='b1, 2\\='h2}, Y = 10;  // Bad, make into 2 parameter 
lines
 
 Defines must be simple text substitutions, one on a line, starting
 at the beginning of the line.  Any ifdefs or multiline comments around the
@@ -9372,10 +9414,10 @@ Some macros and such are also found and included.  For 
dinotrace.el."
         ((looking-at "/\\*")
          (search-forward "*/"))
         ((looking-at "(\\*")
-         (or (looking-at "(\\*\\s-*)")   ; It's a "always @ (*)"
+          (or (looking-at "(\\*\\s-*)")  ; It's an "always @ (*)"
              (search-forward "*)")))
         ((eq ?\" (following-char))
-         (re-search-forward "[^\\]\""))        ;; don't forward-char first, 
since we look for a non backslash first
+          (re-search-forward "[^\\]\""))  ; don't forward-char first, since we 
look for a non backslash first
         ((looking-at "\\s-*\\([a-zA-Z0-9$_.%`]+\\)")
          (goto-char (match-end 0))
          (setq keywd (match-string-no-properties 1))
@@ -9423,19 +9465,19 @@ Some macros and such are also found and included.  For 
dinotrace.el."
                                   (match-string 1 arg))
          (setq arg (match-string 2 arg))))
        ;;
-       ((or (string-match "^-D\\([^+=]*\\)[+=]\\(.*\\)" arg)   ;; -Ddefine=val
-           (string-match "^-D\\([^+=]*\\)\\(\\)" arg)  ;; -Ddefine
-           (string-match "^\\+define\\([^+=]*\\)[+=]\\(.*\\)" arg)     ;; 
+define+val
-           (string-match "^\\+define\\([^+=]*\\)\\(\\)" arg))          ;; 
+define+define
+       ((or (string-match "^-D\\([^+=]*\\)[+=]\\(.*\\)" arg)  ; -Ddefine=val
+            (string-match "^-D\\([^+=]*\\)\\(\\)" arg)  ; -Ddefine
+            (string-match "^\\+define\\([^+=]*\\)[+=]\\(.*\\)" arg)  ; 
+define+val
+            (string-match "^\\+define\\([^+=]*\\)\\(\\)" arg))  ; 
+define+define
        (verilog-set-define (match-string 1 arg) (match-string 2 arg)))
        ;;
-       ((or (string-match "^\\+incdir\\+\\(.*\\)" arg) ;; +incdir+dir
-           (string-match "^-I\\(.*\\)" arg))   ;; -Idir
+       ((or (string-match "^\\+incdir\\+\\(.*\\)" arg)  ; +incdir+dir
+            (string-match "^-I\\(.*\\)" arg))   ; -Idir
        (verilog-add-list-unique `verilog-library-directories
                                 (match-string 1 (substitute-in-file-name 
arg))))
        ;; Ignore
        ((equal "+librescan" arg))
-       ((string-match "^-U\\(.*\\)" arg))      ;; -Udefine
+       ((string-match "^-U\\(.*\\)" arg))  ; -Udefine
        ;; Second parameters
        ((equal next-param "-f")
        (setq next-param nil)
@@ -9513,8 +9555,7 @@ Used for __FLAGS__ in `verilog-expand-command'."
 ;;(verilog-current-flags)
 
 
-;;
-;; Cached directory support
+;;; Cached directory support:
 ;;
 
 (defvar verilog-dir-cache-preserving nil
@@ -9541,12 +9582,12 @@ seen by the `verilog-dir-files' and related functions."
 Relative paths depend on the `default-directory'.
 Results are cached if inside `verilog-preserve-dir-cache'."
   (unless verilog-dir-cache-preserving
-    (setq verilog-dir-cache-list nil)) ;; Cache disabled
+    (setq verilog-dir-cache-list nil))  ; Cache disabled
   ;; We don't use expand-file-name on the dirname to make key, as it's slow
   (let* ((cache-key (list dirname default-directory))
         (fass (assoc cache-key verilog-dir-cache-list))
         exp-dirname data)
-    (cond (fass  ;; Return data from cache hit
+    (cond (fass  ; Return data from cache hit
           (nth 1 fass))
          (t
           (setq exp-dirname (expand-file-name dirname)
@@ -9576,8 +9617,7 @@ Like `file-exists-p' but results are cached if inside
 ;;(verilog-dir-file-exists-p "../verilog-mode/verilog-mode.el")
 
 
-;;
-;; Module name lookup
+;;; Module name lookup:
 ;;
 
 (defun verilog-module-inside-filename-p (module filename)
@@ -9676,9 +9716,9 @@ Or, just the existing dirnames themselves if there are no 
wildcards."
     (while dirnames
       (setq dirname (substitute-in-file-name (car dirnames))
            dirnames (cdr dirnames))
-      (cond ((string-match (concat "^\\(\\|[/\\]*[^*?]*[/\\]\\)"  ;; root
-                                  "\\([^/\\]*[*?][^/\\]*\\)"     ;; filename 
with *?
-                                  "\\(.*\\)")                    ;; rest
+      (cond ((string-match (concat "^\\(\\|[/\\]*[^*?]*[/\\]\\)"  ; root
+                                   "\\([^/\\]*[*?][^/\\]*\\)"     ; filename 
with *?
+                                   "\\(.*\\)")                    ; rest
                           dirname)
             (setq root (match-string 1 dirname)
                   filename (match-string 2 dirname)
@@ -9719,7 +9759,7 @@ variables to build the path.  With optional CHECK-EXT 
also check
   (let* ((cache-key (list filename current check-ext))
         (fass (assoc cache-key verilog-dir-cache-lib-filenames))
         chkdirs chkdir chkexts fn outlist)
-    (cond (fass  ;; Return data from cache hit
+    (cond (fass  ; Return data from cache hit
           (nth 1 fass))
          (t
           ;; Note this expand can't be easily cached, as we need to
@@ -9881,7 +9921,7 @@ Return modi if successful, else print message unless 
IGNORE-ERROR is true."
   (set-buffer (if (bufferp (verilog-modi-file-or-buffer modi))
                  (verilog-modi-file-or-buffer modi)
                (find-file-noselect (verilog-modi-file-or-buffer modi))))
-  (or (equal major-mode `verilog-mode) ;; Put into Verilog mode to get syntax
+  (or (equal major-mode `verilog-mode)  ; Put into Verilog mode to get syntax
       (verilog-mode))
   (goto-char (verilog-modi-get-point modi)))
 
@@ -9897,7 +9937,7 @@ Return modi if successful, else print message unless 
IGNORE-ERROR is true."
   "Run on MODI the given FUNCTION.  Locate the module in a file.
 Cache the output of function so next call may have faster access."
   (let (fass)
-    (save-excursion  ;; Cache is buffer-local so can't avoid this.
+    (save-excursion  ; Cache is buffer-local so can't avoid this.
       (verilog-modi-goto modi)
       (if (and (setq fass (assoc (list modi function)
                                 verilog-modi-cache-list))
@@ -10059,7 +10099,7 @@ if non-nil."
 
 ;; Combined
 (defun verilog-decls-get-signals (decls)
-  "Return all declared signals in DECLS, excluding 'assign' statements."
+  "Return all declared signals in DECLS, excluding ‘assign’ statements."
   (append
    (verilog-decls-get-outputs decls)
    (verilog-decls-get-inouts decls)
@@ -10093,8 +10133,7 @@ if non-nil."
   (verilog-modi-cache-add modi 'verilog-read-decls 7 sig-list))
 
 
-;;
-;; Auto creation utilities
+;;; Auto creation utilities:
 ;;
 
 (defun verilog-auto-re-search-do (search-for func)
@@ -10164,7 +10203,7 @@ When MODI is non-null, also add to modi-cache, for 
tracking."
               (when (member direction '("input" "output" "inout"))
                 (concat direction " "))
               (or (verilog-sig-type sig)
-                 verilog-auto-wire-type)))
+                   verilog-auto-wire-type)))
             ((and verilog-auto-declare-nettype
                   (member direction '("input" "output" "inout")))
              (concat direction " " verilog-auto-declare-nettype))
@@ -10206,10 +10245,10 @@ Presumes that any newlines end a list element."
   ;; Also want "`ifdef X   input foo   `endif" to just leave things to the 
human to deal with
   (save-excursion
     (verilog-backward-syntactic-ws-quick)
-    (when (and (not (save-excursion ;; Not beginning (, or existing ,
+    (when (and (not (save-excursion  ; Not beginning (, or existing ,
                      (backward-char 1)
                      (looking-at "[(,]")))
-              (not (save-excursion ;; Not `endif, or user define
+               (not (save-excursion  ; Not `endif, or user define
                      (backward-char 1)
                      (skip-chars-backward "[a-zA-Z0-9_`]")
                      (looking-at "`"))))
@@ -10250,7 +10289,7 @@ This repairs those mis-inserted by an AUTOARG."
               ((string-match "^\\(.*\\)\\s *:\\s *\\(.*\\)\\s *$" range-exp)
                (concat "(1+(" (match-string 1 range-exp) ")"
                        (if (equal "0" (match-string 2 range-exp))
-                           ""  ;; Don't bother with -(0)
+                           ""  ; Don't bother with -(0)
                          (concat "-(" (match-string 2 range-exp) ")"))
                        ")"))
               (t nil)))))
@@ -10260,7 +10299,7 @@ This repairs those mis-inserted by an AUTOARG."
   "Return a simplified range expression with constants eliminated from EXPR."
   ;; Note this is always called with brackets; ie [z] or [z:z]
   (if (not (string-match "[---+*()]" expr))
-      expr ;; short-circuit
+      expr  ; short-circuit
     (let ((out expr)
          (last-pass ""))
       (while (not (equal last-pass out))
@@ -10315,23 +10354,23 @@ This repairs those mis-inserted by an AUTOARG."
                  out (replace-match
                       (concat (if (and (equal pre "-")
                                        (< val 0))
-                                  "" ;; Not "--20" but just "-20"
+                                  ""  ; Not "--20" but just "-20"
                                 pre)
                               (int-to-string val)
                               post)
                       nil nil out)) )))
       out)))
 
-;;(verilog-simplify-range-expression "[1:3]") ;; 1
-;;(verilog-simplify-range-expression "[(1):3]") ;; 1
-;;(verilog-simplify-range-expression "[(((16)+1)+1+(1+1))]")  ;;20
-;;(verilog-simplify-range-expression "[(2*3+6*7)]") ;; 48
-;;(verilog-simplify-range-expression "[(FOO*4-1*2)]") ;; FOO*4-2
-;;(verilog-simplify-range-expression "[(FOO*4+1-1)]") ;; FOO*4+0
-;;(verilog-simplify-range-expression "[(func(BAR))]") ;; func(BAR)
-;;(verilog-simplify-range-expression "[FOO-1+1-1+1]") ;; FOO-0
-;;(verilog-simplify-range-expression "[$clog2(2)]") ;; 1
-;;(verilog-simplify-range-expression "[$clog2(7)]") ;; 3
+;;(verilog-simplify-range-expression "[1:3]")  ; 1
+;;(verilog-simplify-range-expression "[(1):3]")  ; 1
+;;(verilog-simplify-range-expression "[(((16)+1)+1+(1+1))]")  ; 20
+;;(verilog-simplify-range-expression "[(2*3+6*7)]")  ; 48
+;;(verilog-simplify-range-expression "[(FOO*4-1*2)]")  ; FOO*4-2
+;;(verilog-simplify-range-expression "[(FOO*4+1-1)]")  ; FOO*4+0
+;;(verilog-simplify-range-expression "[(func(BAR))]")  ; func(BAR)
+;;(verilog-simplify-range-expression "[FOO-1+1-1+1]")  ; FOO-0
+;;(verilog-simplify-range-expression "[$clog2(2)]")  ; 1
+;;(verilog-simplify-range-expression "[$clog2(7)]")  ; 3
 
 (defun verilog-clog2 (value)
   "Compute $clog2 - ceiling log2 of VALUE."
@@ -10344,8 +10383,7 @@ This repairs those mis-inserted by an AUTOARG."
   (when verilog-typedef-regexp
     (verilog-string-match-fold verilog-typedef-regexp variable-name)))
 
-;;
-;; Auto deletion
+;;; Auto deletion:
 ;;
 
 (defun verilog-delete-autos-lined ()
@@ -10411,7 +10449,7 @@ Deletion stops at the matching end parenthesis, outside 
comments."
   (delete-region (point)
                 (save-excursion
                   (verilog-backward-open-paren)
-                  (verilog-forward-sexp-ign-cmt 1)   ;; Moves to paren that 
closes argdecl's
+                   (verilog-forward-sexp-ign-cmt 1)  ; Moves to paren that 
closes argdecl's
                   (backward-char 1)
                   (point))))
 
@@ -10477,7 +10515,7 @@ called before and after this function, respectively."
   (interactive)
   (save-excursion
     (if (buffer-file-name)
-       (find-file-noselect (buffer-file-name)))        ;; To check we have 
latest version
+        (find-file-noselect (buffer-file-name)))  ; To check we have latest 
version
     (verilog-save-no-change-functions
      (verilog-save-scan-cache
       ;; Allow user to customize
@@ -10512,8 +10550,7 @@ called before and after this function, respectively."
       ;; Final customize
       (verilog-run-hooks 'verilog-delete-auto-hook)))))
 
-;;
-;; Auto inject
+;;; Auto inject:
 ;;
 
 (defun verilog-inject-auto ()
@@ -10589,7 +10626,7 @@ Typing \\[verilog-inject-auto] will make this into:
             got-sigs)
        (backward-char 1)
        (verilog-forward-sexp-ign-cmt 1)
-       (backward-char 1) ;; End )
+        (backward-char 1)  ; End )
        (when (not (verilog-re-search-backward-quick 
"/\\*\\(AUTOSENSE\\|AS\\)\\*/" start-pt t))
          (setq pre-sigs (verilog-signals-from-signame
                          (verilog-read-signals start-pt (point)))
@@ -10605,23 +10642,23 @@ Typing \\[verilog-inject-auto] will make this into:
     (goto-char (point-min))
     ;; It's hard to distinguish modules; we'll instead search for pins.
     (while (verilog-re-search-forward-quick "\\.\\s *[a-zA-Z0-9`_\$]+\\s *(\\s 
*[a-zA-Z0-9`_\$]+\\s *)" nil t)
-      (verilog-backward-open-paren) ;; Inst start
+      (verilog-backward-open-paren)  ; Inst start
       (cond
-       ((= (preceding-char) ?\#)  ;; #(...) parameter section, not pin.  Skip.
+       ((= (preceding-char) ?\#)  ; #(...) parameter section, not pin.  Skip.
        (forward-char 1)
-       (verilog-forward-close-paren)) ;; Parameters done
+        (verilog-forward-close-paren))  ; Parameters done
        (t
        (forward-char 1)
        (let ((indent-pt (+ (current-column)))
              (end-pt (save-excursion (verilog-forward-close-paren) (point))))
          (cond ((verilog-re-search-forward-quick 
"\\(/\\*AUTOINST\\*/\\|\\.\\*\\)" end-pt t)
-                (goto-char end-pt)) ;; Already there, continue search with 
next instance
+                 (goto-char end-pt))  ; Already there, continue search with 
next instance
                (t
                 ;; Delete identical interconnect
-                (let ((case-fold-search nil))  ;; So we don't convert 
upper-to-lower, etc
+                 (let ((case-fold-search nil))  ; So we don't convert 
upper-to-lower, etc
                   (while (verilog-re-search-forward-quick "\\.\\s 
*\\([a-zA-Z0-9`_\$]+\\)*\\s *(\\s *\\1\\s *)\\s *" end-pt t)
                     (delete-region (match-beginning 0) (match-end 0))
-                    (setq end-pt (- end-pt (- (match-end 0) (match-beginning 
0)))) ;; Keep it correct
+                     (setq end-pt (- end-pt (- (match-end 0) (match-beginning 
0))))  ; Keep it correct
                     (while (or (looking-at "[ \t\n\f,]+")
                                (looking-at "//[^\n]*"))
                       (delete-region (match-beginning 0) (match-end 0))
@@ -10633,9 +10670,9 @@ Typing \\[verilog-inject-auto] will make this into:
                   (delete-region (match-beginning 0) (match-end 0)))
                 (verilog-insert "\n")
                 (verilog-insert-indent "/*AUTOINST*/")))))))))
-
+
 ;;
-;; Auto diff
+;; Auto diff:
 ;;
 
 (defun verilog-diff-buffers-p (b1 b2 &optional whitespace)
@@ -10643,7 +10680,7 @@ Typing \\[verilog-inject-auto] will make this into:
 Else, return point in B1 that first mismatches.
 If optional WHITESPACE true, ignore whitespace."
   (save-excursion
-    (let* ((case-fold-search nil)  ;; compare-buffer-substrings cares
+    (let* ((case-fold-search nil)  ; compare-buffer-substrings cares
           (p1 (with-current-buffer b1 (goto-char (point-min))))
           (p2 (with-current-buffer b2 (goto-char (point-min))))
           (maxp1 (with-current-buffer b1 (point-max)))
@@ -10684,25 +10721,25 @@ Ignores WHITESPACE if t, and writes output to stdout 
if SHOW."
   (if (not (file-exists-p f1))
       (message "Buffer %s has no associated file on disc" (buffer-name b2))
     (with-temp-buffer "*Verilog-Diff*"
-      (let ((outbuf (current-buffer))
-           (f2 (make-temp-file "vm-diff-auto-")))
-       (unwind-protect
-           (progn
-             (with-current-buffer b2
-               (save-restriction
-                 (widen)
-                 (write-region (point-min) (point-max) f2 nil 'nomessage)))
-             (call-process diff-command nil outbuf t
-                           diff-switches ;; User may want -u in diff-switches
-                           (if whitespace "-b" "")
-                           f1 f2)
-             ;; Print out results.  Alternatively we could have call-processed
-             ;; ourself, but this way we can reuse diff switches
-             (when show
-               (with-current-buffer outbuf (message "%s" (buffer-string))))))
-       (sit-for 0)
-       (when (file-exists-p f2)
-         (delete-file f2))))))
+                      (let ((outbuf (current-buffer))
+                            (f2 (make-temp-file "vm-diff-auto-")))
+                        (unwind-protect
+                            (progn
+                              (with-current-buffer b2
+                                (save-restriction
+                                  (widen)
+                                  (write-region (point-min) (point-max) f2 nil 
'nomessage)))
+                              (call-process diff-command nil outbuf t
+                                            diff-switches  ; User may want -u 
in diff-switches
+                                            (if whitespace "-b" "")
+                                            f1 f2)
+                              ;; Print out results.  Alternatively we could 
have call-processed
+                              ;; ourself, but this way we can reuse diff 
switches
+                              (when show
+                                (with-current-buffer outbuf (message "%s" 
(buffer-string))))))
+                        (sit-for 0)
+                        (when (file-exists-p f2)
+                          (delete-file f2))))))
 
 (defun verilog-diff-report (b1 b2 diffpt)
   "Report differences detected with `verilog-diff-auto'.
@@ -10735,7 +10772,7 @@ or `diff' in batch mode."
     (save-excursion
       (when (get-buffer newname)
        (kill-buffer newname))
-      (setq b2 (let (buffer-file-name)  ;; Else clone is upset
+      (setq b2 (let (buffer-file-name)  ; Else clone is upset
                 (clone-buffer newname)))
       (with-current-buffer b2
        ;; auto requires the filename, but can't have same filename in two
@@ -10753,13 +10790,12 @@ or `diff' in batch mode."
       (setq diffpt (verilog-diff-buffers-p b1 b2 t))
       (cond ((not diffpt)
             (unless noninteractive (message "AUTO expansion identical"))
-            (kill-buffer newname)) ;; Nice to cleanup after oneself
+             (kill-buffer newname))  ; Nice to cleanup after oneself
            (t
             (funcall verilog-diff-function b1 b2 diffpt)))
       ;; Return result of compare
       diffpt)))
 
-
 ;;
 ;; Auto save
 ;;
@@ -10785,7 +10821,7 @@ or `diff' in batch mode."
         (set (make-local-variable 'verilog-auto-update-tick) 
(buffer-chars-modified-tick))))
   (when (not verilog-auto-star-save)
     (verilog-delete-auto-star-implicit))
-  nil) ;; Always return nil -- we don't write the file ourselves
+  nil)  ; Always return nil -- we don't write the file ourselves
 
 (defun verilog-auto-read-locals ()
   "Return file local variable segment at bottom of file."
@@ -10807,8 +10843,7 @@ If FORCE, always reread it."
       (hack-local-variables)
       t)))
 
-;;
-;; Auto creation
+;;; Auto creation:
 ;;
 
 (defun verilog-auto-arg-ports (sigs message indent-pt)
@@ -10944,19 +10979,19 @@ See the example in `verilog-auto-inout-modport'."
           (modport-re (nth 1 params))
           (inst-name (nth 2 params))
           (regexp (nth 3 params))
-          direction-re submodi) ;; direction argument not supported until 
requested
+           direction-re submodi)  ; direction argument not supported until 
requested
       ;; Lookup position, etc of co-module
       ;; Note this may raise an error
       (when (setq submodi (verilog-modi-lookup submod t))
        (let* ((indent-pt (current-indentation))
               (submoddecls (verilog-modi-get-decls submodi))
               (submodportdecls (verilog-modi-modport-lookup submodi 
modport-re))
-              (sig-list-i (verilog-signals-in ;; Decls doesn't have data 
types, must resolve
+               (sig-list-i (verilog-signals-in  ; Decls doesn't have data 
types, must resolve
                            (verilog-decls-get-vars submoddecls)
                            (verilog-signals-not-in
                             (verilog-decls-get-inputs submodportdecls)
                             (verilog-decls-get-ports submoddecls))))
-              (sig-list-o (verilog-signals-in ;; Decls doesn't have data 
types, must resolve
+               (sig-list-o (verilog-signals-in  ; Decls doesn't have data 
types, must resolve
                            (verilog-decls-get-vars submoddecls)
                            (verilog-signals-not-in
                             (verilog-decls-get-outputs submodportdecls)
@@ -11140,10 +11175,10 @@ If PAR-VALUES replace final strings with these 
parameter values."
   ;; There maybe an ifdef or something similar before us.  What a mess.  Thus
   ;; to avoid trouble we only insert on preceding ) or *.
   ;; Insert first port on new line
-  (insert "\n")  ;; Must insert before search, so point will move forward if 
insert comma
+  (insert "\n")  ; Must insert before search, so point will move forward if 
insert comma
   (save-excursion
     (verilog-re-search-backward-quick "[^ \t\n\f]" nil nil)
-    (when (looking-at ")\\|\\*")  ;; Generally don't insert, unless we are 
fairly sure
+    (when (looking-at ")\\|\\*")  ; Generally don't insert, unless we are 
fairly sure
       (forward-char 1)
       (insert ","))))
 
@@ -11449,14 +11484,14 @@ Lisp Templates:
   Lisp functions:
 
        vl-name        Name portion of the input/output port.
-       vl-bits        Bus bits portion of the input/output port ('[2:0]').
-       vl-mbits       Multidimensional array bits for port ('[2:0][3:0]').
-       vl-width       Width of the input/output port ('3' for [2:0]).
+       vl-bits        Bus bits portion of the input/output port (‘[2:0]’).
+       vl-mbits       Multidimensional array bits for port (‘[2:0][3:0]’).
+       vl-width       Width of the input/output port (‘3’ for [2:0]).
                        May be a (...) expression if bits isn't a constant.
        vl-dir         Direction of the pin input/output/inout/interface.
        vl-modport     The modport, if an interface with a modport.
-       vl-cell-type   Module name/type of the cell ('InstModule').
-       vl-cell-name   Instance name of the cell ('instName').
+       vl-cell-type   Module name/type of the cell (‘InstModule’).
+       vl-cell-name   Instance name of the cell (‘instName’).
 
   Normal Lisp variables may be used in expressions.  See
   `verilog-read-defines' which can set vh-{definename} variables for use
@@ -11575,11 +11610,11 @@ For more information see the \\[verilog-faq] and 
forums at URL
                 (re-search-backward "," pt t)
                 (delete-char 1)
                 (insert ");")
-                (search-forward "\n")  ;; Added by inst-port
+                 (search-forward "\n")  ; Added by inst-port
                 (delete-char -1)
-                (if (search-forward ")" nil t) ;; From user, moved up a line
+                 (if (search-forward ")" nil t)  ; From user, moved up a line
                     (delete-char -1))
-                (if (search-forward ";" nil t) ;; Don't error if user had 
syntax error and forgot it
+                 (if (search-forward ";" nil t)  ; Don't error if user had 
syntax error and forgot it
                     (delete-char -1)))))))))
 
 (defun verilog-auto-inst-param ()
@@ -11677,9 +11712,9 @@ Templates:
                 (re-search-backward "," pt t)
                 (delete-char 1)
                 (insert ")")
-                (search-forward "\n")  ;; Added by inst-port
+                 (search-forward "\n")  ; Added by inst-port
                 (delete-char -1)
-                (if (search-forward ")" nil t) ;; From user, moved up a line
+                 (if (search-forward ")" nil t)  ; From user, moved up a line
                     (delete-char -1)))))))))
 
 (defun verilog-auto-reg ()
@@ -11721,7 +11756,7 @@ Typing \\[verilog-auto] will make this into:
           (modsubdecls (verilog-modi-get-sub-decls modi))
           (sig-list (verilog-signals-not-in
                      (verilog-decls-get-outputs moddecls)
-                     (append (verilog-signals-with ;; ignore typed signals
+                      (append (verilog-signals-with  ; ignore typed signals
                               'verilog-sig-type
                               (verilog-decls-get-outputs moddecls))
                              (verilog-decls-get-vars moddecls)
@@ -12594,7 +12629,7 @@ driver/monitor using AUTOINST in the testbench."
           (submod (nth 0 params))
           (modport-re (nth 1 params))
           (regexp (nth 2 params))
-          direction-re submodi) ;; direction argument not supported until 
requested
+           direction-re submodi)  ; direction argument not supported until 
requested
       ;; Lookup position, etc of co-module
       ;; Note this may raise an error
       (when (setq submodi (verilog-modi-lookup submod t))
@@ -12604,19 +12639,19 @@ driver/monitor using AUTOINST in the testbench."
               (moddecls (verilog-modi-get-decls modi))
               (submoddecls (verilog-modi-get-decls submodi))
               (submodportdecls (verilog-modi-modport-lookup submodi 
modport-re))
-              (sig-list-i (verilog-signals-in ;; Decls doesn't have data 
types, must resolve
+               (sig-list-i (verilog-signals-in  ; Decls doesn't have data 
types, must resolve
                            (verilog-decls-get-vars submoddecls)
                            (verilog-signals-not-in
                             (verilog-decls-get-inputs submodportdecls)
                             (append (verilog-decls-get-ports submoddecls)
                                     (verilog-decls-get-ports moddecls)))))
-              (sig-list-o (verilog-signals-in ;; Decls doesn't have data 
types, must resolve
+               (sig-list-o (verilog-signals-in  ; Decls doesn't have data 
types, must resolve
                            (verilog-decls-get-vars submoddecls)
                            (verilog-signals-not-in
                             (verilog-decls-get-outputs submodportdecls)
                             (append (verilog-decls-get-ports submoddecls)
                                     (verilog-decls-get-ports moddecls)))))
-              (sig-list-io (verilog-signals-in ;; Decls doesn't have data 
types, must resolve
+               (sig-list-io (verilog-signals-in  ; Decls doesn't have data 
types, must resolve
                             (verilog-decls-get-vars submoddecls)
                             (verilog-signals-not-in
                              (verilog-decls-get-inouts submodportdecls)
@@ -12694,10 +12729,10 @@ text:
     (let* ((indent-pt (current-indentation))
           (cmd-end-pt (save-excursion (search-backward ")")
                                       (forward-char)
-                                      (point)))        ;; Closing paren
+                                       (point)))  ; Closing paren
           (cmd-beg-pt (save-excursion (goto-char cmd-end-pt)
-                                      (backward-sexp 1)  ;; Inside comment
-                                      (point))) ;; Beginning paren
+                                       (backward-sexp 1)  ; Inside comment
+                                       (point)))  ; Beginning paren
           (cmd (buffer-substring-no-properties cmd-beg-pt cmd-end-pt)))
       (verilog-forward-or-insert-line)
       ;; Some commands don't move point (like insert-file) so we always
@@ -12707,7 +12742,7 @@ text:
       (forward-line -1)
       (eval (read cmd))
       (forward-line -1)
-      (setq verilog-scan-cache-tick nil) ;; Clear cache; inserted unknown text
+      (setq verilog-scan-cache-tick nil)  ; Clear cache; inserted unknown text
       (verilog-delete-empty-auto-pair))))
 
 (defun verilog-auto-insert-last ()
@@ -12817,7 +12852,7 @@ operator.  (This was added to the language in part due 
to AUTOSENSE!)
        (let ((tlen (length sig-list)))
          (setq sig-list (verilog-signals-not-in sig-list sig-memories))
          (if (not (eq tlen (length sig-list))) (verilog-insert " /*memory or*/ 
"))))
-      (if (and presense-sigs  ;; Add a "or" if not "(.... or /*AUTOSENSE*/"
+      (if (and presense-sigs  ; Add a "or" if not "(.... or /*AUTOSENSE*/"
               (save-excursion (goto-char (point))
                               (verilog-re-search-backward-quick 
"[a-zA-Z0-9$_.%`]+" start-pt t)
                               (verilog-re-search-backward-quick "\\s-" 
start-pt t)
@@ -12940,7 +12975,7 @@ Typing \\[verilog-auto] will make this into:
        (insert "\n");
        (verilog-insert-indent "// Beginning of autoreset for uninitialized 
flops\n");
        (while sig-list
-         (let ((sig (or (assoc (verilog-sig-name (car sig-list)) all-list) ;; 
As sig-list has no widths
+          (let ((sig (or (assoc (verilog-sig-name (car sig-list)) all-list)  ; 
As sig-list has no widths
                         (car sig-list))))
            (indent-to indent-pt)
            (insert (verilog-sig-name sig)
@@ -12982,9 +13017,9 @@ An example of making a stub for another module:
        /*AUTOINOUTMODULE(\"Foo\")*/
         /*AUTOTIEOFF*/
         // verilator lint_off UNUSED
-        wire _unused_ok = &{1'b0,
+        wire _unused_ok = &{1\\='b0,
                             /*AUTOUNUSED*/
-                            1'b0};
+                            1\\='b0};
         // verilator lint_on  UNUSED
     endmodule
 
@@ -12999,7 +13034,7 @@ Typing \\[verilog-auto] will make this into:
 
         /*AUTOTIEOFF*/
         // Beginning of autotieoff
-        wire [2:0] foo = 3'b0;
+        wire [2:0] foo = 3\\='b0;
         // End of automatics
         ...
     endmodule"
@@ -13092,7 +13127,7 @@ defines the regular expression will be undefed."
                 (setq def (match-string-no-properties 2))
                 (when (and (or (not regexp)
                                (string-match regexp def))
-                           (not (member def defs))) ;; delete-dups not in 21.1
+                            (not (member def defs)))  ; delete-dups not in 21.1
                   (setq defs (cons def defs))))
                (t
                 (setq defs (delete (match-string-no-properties 2) defs))))))
@@ -13124,7 +13159,7 @@ with \"unused\" in the signal name.
 
 To reduce simulation time, the _unused_ok signal should be forced to a
 constant to prevent wiggling.  The easiest thing to do is use a
-reduction-and with 1'b0 as shown.
+reduction-and with 1\\='b0 as shown.
 
 This way all unused signals are in one place, making it convenient to add
 your tool's specific pragmas around the assignment to disable any unused
@@ -13140,9 +13175,9 @@ An example of making a stub for another module:
        /*AUTOINOUTMODULE(\"Examp\")*/
         /*AUTOTIEOFF*/
         // verilator lint_off UNUSED
-        wire _unused_ok = &{1'b0,
+        wire _unused_ok = &{1\\='b0,
                             /*AUTOUNUSED*/
-                            1'b0};
+                            1\\='b0};
         // verilator lint_on  UNUSED
     endmodule
 
@@ -13150,14 +13185,14 @@ Typing \\[verilog-auto] will make this into:
 
         ...
         // verilator lint_off UNUSED
-        wire _unused_ok = &{1'b0,
+        wire _unused_ok = &{1\\='b0,
                             /*AUTOUNUSED*/
                            // Beginning of automatics
                            unused_input_a,
                            unused_input_b,
                            unused_input_c,
                            // End of automatics
-                            1'b0};
+                            1\\='b0};
         // verilator lint_on  UNUSED
     endmodule"
   (interactive)
@@ -13232,9 +13267,9 @@ An example:
 
        //== State enumeration
        parameter [2:0] // synopsys enum state_info
-                          SM_IDLE =  3'b000,
-                          SM_SEND =  3'b001,
-                          SM_WAIT1 = 3'b010;
+                          SM_IDLE =  3\\='b000,
+                          SM_SEND =  3\\='b001,
+                          SM_WAIT1 = 3\\='b010;
        //== State variables
        reg [2:0]  /* synopsys enum state_info */
                   state_r;  /* synopsys state_vector state_r */
@@ -13288,7 +13323,7 @@ Typing \\[verilog-auto] will make this into:
           ;;
           (one-hot (or
                     (string-match "onehot" (or one-hot-flag ""))
-                    (and ;; width(enum) != width(sig)
+                     (and  ; width(enum) != width(sig)
                      (or (not (verilog-sig-bits (car enum-sigs)))
                          (not (equal (verilog-sig-width (car enum-sigs))
                                      (verilog-sig-width undecode-sig))))
@@ -13387,21 +13422,20 @@ Enable with `verilog-auto-template-warn-unused'."
          (while tlines
            (setq tpl-ass (car tlines)
                  tlines (cdr tlines))
-           ;;;
-           (unless (or (not (eval-when-compile (fboundp 'make-hash-table))) ;; 
Not supported, no warning
+           ;;
+            (unless (or (not (eval-when-compile (fboundp 'make-hash-table)))  
; Not supported, no warning
                        (not verilog-auto-template-hits)
                        (gethash (vector (nth 2 tpl-ass) (nth 3 tpl-ass))
                                 verilog-auto-template-hits))
              (verilog-warn-error "%s:%d: AUTO_TEMPLATE line unused: \".%s 
(%s)\""
                                  name1
-                                 (+ (elt tpl-ass 3)  ;; Template line number
+                                  (+ (elt tpl-ass 3)  ; Template line number
                                     (count-lines (point-min) (point)))
                                  (elt tpl-ass 0) (elt tpl-ass 1))
              )))))))
 
 
-;;
-;; Auto top level
+;;; Auto top level:
 ;;
 
 (defun verilog-auto (&optional inject)  ; Use verilog-inject-auto instead of 
passing an arg
@@ -13501,7 +13535,7 @@ Wilson Snyder (address@hidden)."
             ;; we'll misremember we have generated IOs, confusing AUTOOUTPUT
             (setq verilog-modi-cache-list nil)
             ;; Local state
-            (setq verilog-auto-template-hits nil)
+            (verilog-read-auto-template-init)
             ;; If we're not in verilog-mode, change syntax table so parsing 
works right
             (unless (eq major-mode `verilog-mode) (verilog-mode))
             ;; Allow user to customize
@@ -13595,10 +13629,9 @@ Wilson Snyder (address@hidden)."
        ;; Currently handled in verilog-save-font-mods
        ))))
 
-
-;;
-;; Skeleton based code insertion
+;;; Skeletons:
 ;;
+
 (defvar verilog-template-map
   (let ((map (make-sparse-keymap)))
     (define-key map "a" 'verilog-sk-always)
@@ -13645,7 +13678,7 @@ Wilson Snyder (address@hidden)."
 ;; Note \C-c and letter are reserved for users
 (define-key verilog-mode-map "\C-c\C-t" verilog-template-map)
 
-;;; ---- statement skeletons ------------------------------------------
+;; ---- statement skeletons ------------------------------------------
 
 (define-skeleton verilog-sk-prompt-condition
   "Prompt for the loop condition."
@@ -13727,9 +13760,9 @@ See also `verilog-header' for an alternative format."
   > _ \n
   > (- verilog-indent-level-behavioral) "endmodule" (progn 
(electric-verilog-terminate-line) nil))
 
-;;; ------------------------------------------------------------------------
-;;; Define a default OVM class, with macros and new()
-;;; ------------------------------------------------------------------------
+;; ------------------------------------------------------------------------
+;; Define a default OVM class, with macros and new()
+;; ------------------------------------------------------------------------
 
 (define-skeleton verilog-sk-ovm-class
   "Insert a class definition"
@@ -13919,12 +13952,12 @@ and the case items."
   (interactive "*")
   (let* ((sig-re "[a-zA-Z0-9_]*")
         (v1 (buffer-substring
-              (save-excursion
-                (skip-chars-backward sig-re)
-                (point))
-              (save-excursion
-                (skip-chars-forward sig-re)
-                (point)))))
+              (save-excursion
+                (skip-chars-backward sig-re)
+                (point))
+              (save-excursion
+                (skip-chars-forward sig-re)
+                (point)))))
     (if (not (member v1 verilog-keywords))
        (save-excursion
          (setq verilog-sk-signal v1)
@@ -14004,7 +14037,7 @@ and the case items."
   resume: >  (- verilog-case-indent) "endcase" (progn 
(electric-verilog-terminate-line) nil)
   > (- verilog-indent-level-behavioral) "end" (progn 
(electric-verilog-terminate-line) nil))
 
-
+;;; Mouse Events:
 ;;
 ;; Include file loading with mouse/return event
 ;;
@@ -14039,7 +14072,7 @@ Clicking on the middle-mouse button loads them in a 
buffer (as in dired)."
   (when (or verilog-highlight-includes
            verilog-highlight-modules)
     (save-excursion
-      (save-match-data  ;; A query-replace may call this function - do not 
disturb
+      (save-match-data  ; A query-replace may call this function - do not 
disturb
        (verilog-save-buffer-state
         (verilog-save-scan-cache
          (let (end-point)
@@ -14078,7 +14111,7 @@ Clicking on the middle-mouse button loads them in a 
buffer (as in dired)."
                    (save-excursion
                      (goto-char (match-beginning 0))
                      (unless (verilog-inside-comment-or-string-p)
-                       (verilog-read-inst-module-matcher)   ;; sets match 0
+                        (verilog-read-inst-module-matcher)  ; sets match 0
                        (let* ((ov (make-overlay (match-beginning 0) (match-end 
0))))
                          (overlay-put ov 'start-closed 't)
                          (overlay-put ov 'end-closed 't)
@@ -14110,7 +14143,7 @@ Clicking on the middle-mouse button loads them in a 
buffer (as in dired)."
   "Load file under button 2 click's EVENT.
 Files are checked based on `verilog-library-flags'."
   (interactive "@e")
-  (save-excursion ;; implement a Verilog specific ffap-at-mouse
+  (save-excursion  ; implement a Verilog specific ffap-at-mouse
     (mouse-set-point event)
     (verilog-load-file-at-point t)))
 
@@ -14122,7 +14155,7 @@ Files are checked based on `verilog-library-flags'."
 If WARN, throw warning if not found.
 Files are checked based on `verilog-library-flags'."
   (interactive)
-  (save-excursion ;; implement a Verilog specific ffap
+  (save-excursion  ; implement a Verilog specific ffap
     (let ((overlays (overlays-in (point) (point)))
          hit)
       (while (and overlays (not hit))
@@ -14144,11 +14177,11 @@ Files are checked based on `verilog-library-flags'."
                             (match-string 1) (buffer-file-name))))
          (when warn
            (message
-            "File '%s' isn't readable, use shift-mouse2 to paste in this field"
+            "File ‘%s’ isn't readable, use shift-mouse2 to paste in this field"
             (match-string 1))))))))
 
-;;
-;; Bug reporting
+
+;;; Bug reporting:
 ;;
 
 (defun verilog-faq ()
@@ -14284,6 +14317,7 @@ but instead, [[Fill in here]] happens!.
 ;; Local Variables:
 ;; checkdoc-permit-comma-termination-flag:t
 ;; checkdoc-force-docstrings-flag:nil
+;; indent-tabs-mode:nil
 ;; End:
 
 ;;; verilog-mode.el ends here
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 5ed0ff0..1b270e6 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -2305,11 +2305,12 @@ Ignore byte-compiler warnings you might see."
 
 (defun vhdl-warning-when-idle (&rest args)
   "Wait until idle, then print out warning STRING and beep."
-  (if noninteractive
-      (vhdl-warning (apply 'format args) t)
-    (unless vhdl-warnings
-      (vhdl-run-when-idle .1 nil 'vhdl-print-warnings))
-    (push (apply 'format args) vhdl-warnings)))
+  (let ((message (apply #'format-message args)))
+    (if noninteractive
+        (vhdl-warning message t)
+      (unless vhdl-warnings
+        (vhdl-run-when-idle .1 nil 'vhdl-print-warnings))
+      (push message vhdl-warnings))))
 
 (defun vhdl-warning (string &optional nobeep)
   "Print out warning STRING and beep."
@@ -4421,7 +4422,7 @@ Usage:
     according to option `vhdl-argument-list-indent'.
 
       If option `vhdl-indent-tabs-mode' is nil, spaces are used instead of
-    tabs.  `M-x tabify' and `M-x untabify' allow to convert spaces to tabs
+    tabs.  `\\[tabify]' and `\\[untabify]' allow to convert spaces to tabs
     and vice versa.
 
       Syntax-based indentation can be very slow in large files.  Option
@@ -4732,7 +4733,7 @@ Usage:
     `vhdl-highlight-translate-off' is non-nil.
 
       For documentation and customization of the used colors see
-    customization group `vhdl-highlight-faces' (`M-x customize-group').  For
+    customization group `vhdl-highlight-faces' (`\\[customize-group]').  For
     highlighting of matching parenthesis, see customization group
     `paren-showing'.  Automatic buffer highlighting is turned on/off by
     option `global-font-lock-mode' (`font-lock-auto-fontify' in XEmacs).
@@ -4792,14 +4793,14 @@ Usage:
     sessions using the \"Save Options\" menu entry.
 
       Options and their detailed descriptions can also be accessed by using
-    the \"Customize\" menu entry or the command `M-x customize-option' (`M-x
-    customize-group' for groups).  Some customizations only take effect
+    the \"Customize\" menu entry or the command `\\[customize-option]'
+    (`\\[customize-group]' for groups).  Some customizations only take effect
     after some action (read the NOTE in the option documentation).
     Customization can also be done globally (i.e. site-wide, read the
     INSTALL file).
 
       Not all options are described in this documentation, so go and see
-    what other useful user options there are (`M-x vhdl-customize' or menu)!
+    what other useful user options there are (`\\[vhdl-customize]' or menu)!
 
 
   FILE EXTENSIONS:
@@ -4828,7 +4829,7 @@ Usage:
 Maintenance:
 ------------
 
-To submit a bug report, enter `M-x vhdl-submit-bug-report' within VHDL Mode.
+To submit a bug report, enter `\\[vhdl-submit-bug-report]' within VHDL Mode.
 Add a description of the problem and include a reproducible test case.
 
 Questions and enhancement requests can be sent to <address@hidden>.
@@ -7383,11 +7384,11 @@ only-lines."
                (- (nth 1 (current-time)) (aref vhdl-progress-info 2))))
     (let ((delta (- (aref vhdl-progress-info 1)
                     (aref vhdl-progress-info 0))))
-      (if (= 0 delta)
-          (message (concat string "... (100%s)") "%")
-        (message (concat string "... (%2d%s)")
-                 (/ (* 100 (- pos (aref vhdl-progress-info 0)))
-                    delta) "%")))
+      (message "%s... (%2d%%)" string
+              (if (= 0 delta)
+                  100
+                 (floor (* 100.0 (- pos (aref vhdl-progress-info 0)))
+                        delta))))
     (aset vhdl-progress-info 2 (nth 1 (current-time)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -8734,10 +8735,11 @@ is omitted or nil."
                  (let ((next-input (read-char)))
                    (if (= next-input ?-) ; four dashes
                        (vhdl-comment-display t)
-                     (setq unread-command-events ; pushback the char
-                           (list (vhdl-character-to-event next-input))))))
-             (setq unread-command-events ; pushback the char
-                   (list (vhdl-character-to-event next-input)))
+                     (push (vhdl-character-to-event next-input)
+                                        ; pushback the char
+                            unread-command-events))))
+              (push (vhdl-character-to-event next-input) ; pushback the char
+                    unread-command-events)
              (vhdl-comment-insert)))))
     (self-insert-command count)))
 
@@ -10755,8 +10757,8 @@ If starting after end-comment-column, start a new line."
        (setq code t))
       (unless code
        (insert "--")) ; hardwire to 1 space or use vhdl-basic-offset?
-      (setq unread-command-events
-           (list (vhdl-character-to-event next-input)))))) ; pushback the char
+      (push (vhdl-character-to-event next-input) ; pushback the char
+            unread-command-events))))
 
 (defun vhdl-comment-display (&optional line-exists)
   "Add 2 comment lines at the current indent, making a display comment."
@@ -11310,8 +11312,8 @@ but not if inside a comment or quote."
        ;; delete CR which is still in event queue
        (if (fboundp 'enqueue-eval-event)
            (enqueue-eval-event 'delete-char -1)
-         (setq unread-command-events   ; push back a delete char
-               (list (vhdl-character-to-event ?\177))))))))
+         (push (vhdl-character-to-event ?\177) ; push back a delete char
+                unread-command-events))))))
 
 (defun vhdl-template-alias-hook ()
   (vhdl-hooked-abbrev 'vhdl-template-alias))
@@ -13881,10 +13883,10 @@ hierarchy otherwise.")
       ;; do for all files
       (while file-list
        (unless noninteractive
-         (message "Scanning %s %s\"%s\"... (%2d%s)"
+         (message "Scanning %s %s\"%s\"... (%2d%%)"
                   (if is-directory "directory" "files")
                   (or num-string "") name
-                  (/ (* 100 (- no-files (length file-list))) no-files) "%"))
+                  (floor (* 100.0 (- no-files (length file-list))) no-files)))
        (let ((file-name (abbreviate-file-name (car file-list)))
              ent-list arch-list arch-ent-list conf-list
              pack-list pack-body-list inst-list inst-ent-list)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 9764bc7..b0a8eb7 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -65,8 +65,6 @@
 (defclass xref-location () ()
   :documentation "A location represents a position in a file or buffer.")
 
-;; If a backend decides to subclass xref-location it can provide
-;; methods for some of the following functions:
 (cl-defgeneric xref-location-marker (location)
   "Return the marker for LOCATION.")
 
@@ -204,8 +202,10 @@ LOCATION is an `xref-location'."
 It can be called in several ways:
 
  (definitions IDENTIFIER): Find definitions of IDENTIFIER.  The
-result must be a list of xref objects.  If no definitions can be
-found, return nil.
+result must be a list of xref objects.  If IDENTIFIER contains
+sufficient information to determine a unique definition, returns
+only that definition. If there are multiple possible definitions,
+return all of them.  If no definitions can be found, return nil.
 
  (references IDENTIFIER): Find references of IDENTIFIER.  The
 result must be a list of xref objects.  If no references can be
@@ -372,14 +372,19 @@ elements is negated."
   (ring-empty-p xref--marker-ring))
 
 
+
+(defun xref--goto-char (pos)
+  (cond
+   ((and (<= (point-min) pos) (<= pos (point-max))))
+   (widen-automatically (widen))
+   (t (user-error "Position is outside accessible part of buffer")))
+  (goto-char pos))
+
 (defun xref--goto-location (location)
   "Set buffer and point according to xref-location LOCATION."
   (let ((marker (xref-location-marker location)))
     (set-buffer (marker-buffer marker))
-    (cond ((and (<= (point-min) marker) (<= marker (point-max))))
-          (widen-automatically (widen))
-          (t (error "Location is outside accessible part of buffer")))
-    (goto-char marker)))
+    (xref--goto-char marker)))
 
 (defun xref--pop-to-location (item &optional window)
   "Go to the location of ITEM and display the buffer.
@@ -387,11 +392,14 @@ WINDOW controls how the buffer is displayed:
   nil      -- switch-to-buffer
   'window  -- pop-to-buffer (other window)
   'frame   -- pop-to-buffer (other frame)"
-  (xref--goto-location (xref-item-location item))
-  (cl-ecase window
-    ((nil)  (switch-to-buffer (current-buffer)))
-    (window (pop-to-buffer (current-buffer) t))
-    (frame  (let ((pop-up-frames t)) (pop-to-buffer (current-buffer) t))))
+  (let* ((marker (save-excursion
+                   (xref-location-marker (xref-item-location item))))
+         (buf (marker-buffer marker)))
+    (cl-ecase window
+      ((nil)  (switch-to-buffer buf))
+      (window (pop-to-buffer buf t))
+      (frame  (let ((pop-up-frames t)) (pop-to-buffer buf t))))
+    (xref--goto-char marker))
   (let ((xref--current-item item))
     (run-hooks 'xref-after-jump-hook)))
 
@@ -424,30 +432,29 @@ Used for temporary buffers.")
     (when (and restore (not (eq (car restore) 'same)))
       (push (cons buf win) xref--display-history))))
 
-(defun xref--display-position (pos other-window xref-buf)
+(defun xref--display-position (pos other-window buf)
   ;; Show the location, but don't hijack focus.
-  (with-selected-window (display-buffer (current-buffer) other-window)
-    (goto-char pos)
-    (run-hooks 'xref-after-jump-hook)
-    (let ((buf (current-buffer))
-          (win (selected-window)))
-      (with-current-buffer xref-buf
-        (setq-local other-window-scroll-buffer buf)
-        (xref--save-to-history buf win)))))
+  (let ((xref-buf (current-buffer)))
+    (with-selected-window (display-buffer buf other-window)
+      (xref--goto-char pos)
+      (run-hooks 'xref-after-jump-hook)
+      (let ((buf (current-buffer))
+            (win (selected-window)))
+        (with-current-buffer xref-buf
+          (setq-local other-window-scroll-buffer buf)
+          (xref--save-to-history buf win))))))
 
 (defun xref--show-location (location)
   (condition-case err
-      (let ((xref-buf (current-buffer))
-            (bl (buffer-list))
-            (xref--inhibit-mark-current t))
-        (xref--goto-location location)
-        (let ((buf (current-buffer)))
+      (let ((bl (buffer-list))
+            (xref--inhibit-mark-current t)
+            (marker (xref-location-marker location)))
+        (let ((buf (marker-buffer marker)))
           (unless (memq buf bl)
             ;; Newly created.
             (add-hook 'buffer-list-update-hook #'xref--mark-selected nil t)
-            (with-current-buffer xref-buf
-              (push buf xref--temporary-buffers))))
-        (xref--display-position (point) t xref-buf))
+            (push buf xref--temporary-buffers))
+          (xref--display-position marker t buf)))
     (user-error (message (error-message-string err)))))
 
 (defun xref-show-location-at-point ()
@@ -504,6 +511,8 @@ Used for temporary buffers.")
             (while (setq item (xref--search-property 'xref-item))
               (when (xref-match-bounds item)
                 (save-excursion
+                  ;; FIXME: Get rid of xref--goto-location, by making
+                  ;; xref-match-bounds return markers already.
                   (xref--goto-location (xref-item-location item))
                   (let ((bounds (xref--match-buffer-bounds item))
                         (beg (make-marker))
@@ -744,7 +753,14 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
 (defun xref-find-definitions (identifier)
   "Find the definition of the identifier at point.
 With prefix argument or when there's no identifier at point,
-prompt for it."
+prompt for it.
+
+If the backend has sufficient information to determine a unique
+definition for IDENTIFIER, it returns only that definition. If
+there are multiple possible definitions, it returns all of them.
+
+If the backend returns one definition, jump to it; otherwise,
+display the list in a buffer."
   (interactive (list (xref--read-identifier "Find definitions of: ")))
   (xref--find-definitions identifier nil))
 
@@ -791,7 +807,8 @@ to search in, and the file name pattern to search for."
           (lambda (_kind regexp)
             (cl-mapcan
              (lambda (dir)
-               (xref-collect-matches regexp files dir (project-ignores proj)))
+               (xref-collect-matches regexp files dir
+                                     (project-ignores proj dir)))
              dirs))))
     (xref--show-xrefs regexp 'matches regexp nil)))
 
@@ -848,7 +865,6 @@ and just use etags."
                 (cdr xref-etags-mode--saved))))
 
 (declare-function semantic-symref-find-references-by-name "semantic/symref")
-(declare-function semantic-symref-find-text "semantic/symref")
 (declare-function semantic-find-file-noselect "semantic/fw")
 (declare-function grep-read-files "grep")
 (declare-function grep-expand-template "grep")
@@ -928,12 +944,12 @@ IGNORES is a list of glob patterns."
     " -path "
     (mapconcat
      (lambda (ignore)
-       (when (string-match "\\(\\.\\)/" ignore)
-         (setq ignore (replace-match dir t t ignore 1)))
        (when (string-match-p "/\\'" ignore)
          (setq ignore (concat ignore "*")))
-       (unless (string-prefix-p "*" ignore)
-         (setq ignore (concat "*/" ignore)))
+       (if (string-match "\\`\\./" ignore)
+           (setq ignore (replace-match dir t t ignore))
+         (unless (string-prefix-p "*" ignore)
+           (setq ignore (concat "*/" ignore))))
        (shell-quote-argument ignore))
      ignores
      " -o -path ")
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index e76b332..faafe9c 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -4604,8 +4604,8 @@ page-height == ((floor print-height ((th + ls) * zh)) * 
((th + ls) * zh)) - th
                       (setq prompt "File is unwritable"))
                      ((file-exists-p res)
                       (setq prompt "File exists")
-                      (not (y-or-n-p (format "File `%s' exists; overwrite? "
-                                             res))))
+                      (not (y-or-n-p (format-message
+                                      "File `%s' exists; overwrite? " res))))
                      (t nil))
           (setq res (read-file-name
                      (format "%s; save PostScript to file: " prompt)
@@ -5711,7 +5711,7 @@ XSTART YSTART are the relative position for the first 
page in a sheet.")
         (error "Invalid %s `%S'%s"
                mess size
                (if arg
-                   (format " for `%S'" arg)
+                   (format-message " for `%S'" arg)
                  "")))
     siz))
 
@@ -6043,10 +6043,7 @@ XSTART YSTART are the relative position for the first 
page in a sheet.")
            (progn
              (setq ps-razchunk q-done)
              (message "Formatting...%3d%%"
-                      (if (< q-todo 100)
-                          (/ (* 100 q-done) q-todo)
-                        (/ q-done (/ q-todo 100)))
-                      ))))))
+                      (floor (* 100.0 q-done) q-todo)))))))
 
 (defvar ps-last-font nil)
 
diff --git a/lisp/recentf.el b/lisp/recentf.el
index 89c1517..a599383 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -781,7 +781,7 @@ Filenames are relative to the `default-directory'."
     )
   "List of rules used by `recentf-arrange-by-rule' to build sub-menus.
 A rule is a pair (SUB-MENU-TITLE . MATCHER).  SUB-MENU-TITLE is the
-displayed title of the sub-menu where a '%d' `format' pattern is
+displayed title of the sub-menu where a `%d' `format' pattern is
 replaced by the number of items in the sub-menu.  MATCHER is a regexp
 or a list of regexps.  Items matching one of the regular expressions in
 MATCHER are added to the corresponding sub-menu.
@@ -798,7 +798,7 @@ may have been modified to match another rule."
   "Title of the `recentf-arrange-by-rule' sub-menu.
 This is for the menu where items that don't match any
 `recentf-arrange-rules' are displayed.  If nil these items are
-displayed in the main recent files menu.  A '%d' `format' pattern in
+displayed in the main recent files menu.  A `%d' `format' pattern in
 the title is replaced by the number of items in the sub-menu."
   :group 'recentf-filters
   :type '(choice (const  :tag "Main menu" nil)
@@ -1224,7 +1224,7 @@ use for the dialog.  It defaults to 
\"*`recentf-menu-title'*\"."
                        ", or type the corresponding digit key,"
                      "")
                    " to open it.\n"
-                   "Click on Cancel or type `q' to cancel.\n")
+                   (format-message "Click on Cancel or type ‘q’ to cancel.\n"))
     ;; Use a L&F that looks like the recentf menu.
     (tree-widget-set-theme "folder")
     (apply 'widget-create
@@ -1281,7 +1281,8 @@ Write data into the file specified by 
`recentf-save-file'."
       (with-temp-buffer
         (erase-buffer)
         (set-buffer-file-coding-system recentf-save-file-coding-system)
-        (insert (format recentf-save-file-header (current-time-string)))
+        (insert (format-message recentf-save-file-header
+                               (current-time-string)))
         (recentf-dump-variable 'recentf-list recentf-max-saved-items)
         (recentf-dump-variable 'recentf-filter-changer-current)
         (insert "\n\n;; Local Variables:\n"
diff --git a/lisp/register.el b/lisp/register.el
index 7afbc06..110c36f 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -220,7 +220,7 @@ Interactively, reads the register using 
`register-read-with-preview'."
 (set-advertised-calling-convention 'frame-configuration-to-register
                                   '(register) "24.4")
 
-(make-obsolete 'frame-configuration-to-register 'frameset-to-register' "24.4")
+(make-obsolete 'frame-configuration-to-register 'frameset-to-register "24.4")
 
 (defalias 'register-to-point 'jump-to-register)
 (defun jump-to-register (register &optional delete)
diff --git a/lisp/replace.el b/lisp/replace.el
index 41debdd..26870a3 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -33,7 +33,7 @@
   :type 'boolean
   :group 'matching)
 
-(defcustom replace-character-fold t
+(defcustom replace-character-fold nil
   "Non-nil means `query-replace' should do character folding in matches.
 This means, for instance, that ' will match a large variety of
 unicode quotes."
@@ -209,9 +209,9 @@ wants to replace FROM with TO."
              (let ((match (match-string 3 from)))
                (cond
                 ((string= match "\\n")
-                 (message "Note: `\\n' here doesn't match a newline; to do 
that, type C-q C-j instead"))
+                 (message "Note: ‘\\n’ here doesn't match a newline; to do 
that, type C-q C-j instead"))
                 ((string= match "\\t")
-                 (message "Note: `\\t' here doesn't match a tab; to do that, 
just type TAB")))
+                 (message "Note: ‘\\t’ here doesn't match a tab; to do that, 
just type TAB")))
                (sit-for 2)))
         (if (not to)
             from
@@ -1140,7 +1140,7 @@ To return to ordinary Occur mode, use 
\\[occur-cease-edit]."
            (goto-char m)
            (recenter line)
            (if readonly
-               (message "Buffer `%s' is read only." buf)
+               (message "Buffer ‘%s’ is read only." buf)
              (delete-region (line-beginning-position) (line-end-position))
              (insert text))
            (move-to-column col)))))))
@@ -1495,7 +1495,8 @@ See also `multi-occur'."
                     ;; Don't display regexp if with remaining text
                     ;; it is longer than window-width.
                     (if (> (+ (length regexp) 42) (window-width))
-                        "" (format " for `%s'" (query-replace-descr regexp)))))
+                        "" (format-message
+                             " for ‘%s’" (query-replace-descr regexp)))))
          (setq occur-revert-arguments (list regexp nlines bufs))
           (if (= count 0)
               (kill-buffer occur-buf)
@@ -2080,7 +2081,13 @@ see the documentation of `replace-match' to find out how 
to simulate
 `case-replace'.
 
 This function returns nil if and only if there were no matches to
-make, or the user didn't cancel the call."
+make, or the user didn't cancel the call.
+
+REPLACEMENTS is either a string, a list of strings, or a cons cell
+containing a function and its first argument.  The function is
+called to generate each replacement like this:
+  (funcall (car replacements) (cdr replacements) replace-count)
+It must return a string."
   (or map (setq map query-replace-map))
   (and query-flag minibuffer-auto-raise
        (raise-frame (window-frame (minibuffer-window))))
@@ -2136,11 +2143,6 @@ make, or the user didn't cancel the call."
     (when (eq (lookup-key map (vector last-input-event)) 'automatic-all)
       (setq query-flag nil multi-buffer t))
 
-    ;; REPLACEMENTS is either a string, a list of strings, or a cons cell
-    ;; containing a function and its first argument.  The function is
-    ;; called to generate each replacement like this:
-    ;;   (funcall (car replacements) (cdr replacements) replace-count)
-    ;; It must return a string.
     (cond
      ((stringp replacements)
       (setq next-replacement replacements
diff --git a/lisp/savehist.el b/lisp/savehist.el
index 692ee2e..607138c 100644
--- a/lisp/savehist.el
+++ b/lisp/savehist.el
@@ -270,8 +270,12 @@ If AUTO-SAVE is non-nil, compare the saved contents to the 
one last saved,
   (interactive)
   (with-temp-buffer
     (insert
-     (format ";; -*- mode: emacs-lisp; coding: %s -*-\n" 
savehist-coding-system)
-     ";; Minibuffer history file, automatically generated by `savehist'.\n\n")
+     (format-message
+      (concat
+       ";; -*- mode: emacs-lisp; coding: %s -*-\n"
+       ";; Minibuffer history file, automatically generated by `savehist'.\n"
+       "\n")
+      savehist-coding-system))
     (run-hooks 'savehist-save-hook)
     (let ((print-length nil)
          (print-string-length nil)
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index 635990a..c46e05d 100644
--- a/lisp/scroll-bar.el
+++ b/lisp/scroll-bar.el
@@ -61,7 +61,7 @@ SIDE must be the symbol `left' or `right'."
          (cols  (nth 1 wsb)))
     (cond
      ((not (memq side '(left right)))
-      (error "`left' or `right' expected instead of %S" side))
+      (error "‘left’ or ‘right’ expected instead of %S" side))
      ((and (eq vtype side) cols))
      ((eq (frame-parameter nil 'vertical-scroll-bars) side)
       ;; nil means it's a non-toolkit scroll bar, and its width in
diff --git a/lisp/server.el b/lisp/server.el
index b6b0e97..57c16af 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -533,7 +533,8 @@ Creates the directory if necessary and makes sure:
                  ((and w32 (zerop uid))          ; on FAT32?
                   (display-warning
                    'server
-                   (format "Using `%s' to store Emacs-server authentication 
files.
+                   (format-message "\
+Using `%s' to store Emacs-server authentication files.
 Directories on FAT32 filesystems are NOT secure against tampering.
 See variable `server-auth-dir' for details."
                            (file-name-as-directory dir))
@@ -574,7 +575,7 @@ If the key is not valid, signal an error."
   (if server-auth-key
     (if (string-match-p "^[!-~]\\{64\\}$" server-auth-key)
         server-auth-key
-      (error "The key '%s' is invalid" server-auth-key))
+      (error "The key ‘%s’ is invalid" server-auth-key))
     (server-generate-key)))
 
 ;;;###autoload
@@ -624,8 +625,9 @@ To force-start a server, do \\[server-force-delete] and then
         (concat "Unable to start the Emacs server.\n"
                 (format "There is an existing Emacs server, named %S.\n"
                         server-name)
-                "To start the server in this Emacs process, stop the existing
-server or call `M-x server-force-delete' to forcibly disconnect it.")
+                (substitute-command-keys
+                  "To start the server in this Emacs process, stop the existing
+server or call `\\[server-force-delete]' to forcibly disconnect it."))
         :warning)
        (setq leave-dead t))
       ;; If this Emacs already had a server, clear out associated status.
diff --git a/lisp/ses.el b/lisp/ses.el
index e625e4e..0bc43ec 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -3360,8 +3360,10 @@ highlighted range in the spreadsheet."
         (ses-is-cell-sym-p new-name)
         (error "Already a cell name"))
    (and (boundp new-name)
-       (null (yes-or-no-p (format "`%S' is already bound outside this buffer, 
continue? "
-                                  new-name)))
+       (null (yes-or-no-p
+              (format-message
+               "`%S' is already bound outside this buffer, continue? "
+               new-name)))
        (error "Already a bound cell name")))
   (let* (curcell
         (sym (if (ses-cell-p cell)
diff --git a/lisp/simple.el b/lisp/simple.el
index 7eed279..6f76d75 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -693,7 +693,8 @@ any other non-digit terminates the character code and is 
then used as input."))
       (cond ((null translated))
            ((not (integerp translated))
             (setq unread-command-events
-                   (listify-key-sequence (this-single-command-raw-keys))
+                   (nconc (listify-key-sequence (this-single-command-raw-keys))
+                          unread-command-events)
                   done t))
            ((/= (logand translated ?\M-\^@) 0)
             ;; Turn a meta-character into a character with the 0200 bit set.
@@ -713,7 +714,8 @@ any other non-digit terminates the character code and is 
then used as input."))
             (setq done t))
            ((not first)
             (setq unread-command-events
-                   (listify-key-sequence (this-single-command-raw-keys))
+                   (nconc (listify-key-sequence (this-single-command-raw-keys))
+                          unread-command-events)
                   done t))
            (t (setq code translated
                     done t)))
@@ -1255,10 +1257,7 @@ in *Help* buffer.  See also the command `describe-char'."
         (end (point-max))
          (pos (point))
         (total (buffer-size))
-        (percent (if (> total 50000)
-                     ;; Avoid overflow from multiplying by 100!
-                     (/ (+ (/ total 200) (1- pos)) (max (/ total 100) 1))
-                   (/ (+ (/ total 2) (* 100 (1- pos))) (max total 1))))
+        (percent (round (* 100.0 (1- pos)) (max 1 total)))
         (hscroll (if (= (window-hscroll) 0)
                      ""
                    (format " Hscroll=%d" (window-hscroll))))
@@ -1656,7 +1655,7 @@ invoking, give a prefix argument to 
`execute-extended-command'."
                       (not executing-kbd-macro)
                       (where-is-internal function overriding-local-map t))))
     (unless (commandp function)
-      (error "`%s' is not a valid command name" command-name))
+      (error "‘%s’ is not a valid command name" command-name))
     (setq this-command function)
     ;; Normally `real-this-command' should never be changed, but here we really
     ;; want to pretend that M-x <cmd> RET is nothing more than a "key
@@ -1690,11 +1689,11 @@ invoking, give a prefix argument to 
`execute-extended-command'."
                            (symbol-name function) typed))))
         (when binding
           (with-temp-message
-              (format "You can run the command `%s' with %s"
-                      function
-                      (if (stringp binding)
-                          (concat "M-x " binding " RET")
-                        (key-description binding)))
+              (format-message "You can run the command ‘%s’ with %s"
+                              function
+                              (if (stringp binding)
+                                  (concat "M-x " binding " RET")
+                                (key-description binding)))
             (sit-for (if (numberp suggest-key-bindings)
                          suggest-key-bindings
                        2))))))))
@@ -2797,16 +2796,18 @@ This variable only matters if `undo-ask-before-discard' 
is non-nil.")
        ;; but we don't want to ask the question again.
        (setq undo-extra-outer-limit (+ size 50000))
        (if (let (use-dialog-box track-mouse executing-kbd-macro )
-             (yes-or-no-p (format "Buffer `%s' undo info is %d bytes long; 
discard it? "
-                                  (buffer-name) size)))
+             (yes-or-no-p (format-message
+                            "Buffer ‘%s’ undo info is %d bytes long; discard 
it? "
+                            (buffer-name) size)))
            (progn (setq buffer-undo-list nil)
                   (setq undo-extra-outer-limit nil)
                   t)
          nil))
     (display-warning '(undo discard-info)
                     (concat
-                     (format "Buffer `%s' undo info was %d bytes long.\n"
-                             (buffer-name) size)
+                     (format-message
+                       "Buffer ‘%s’ undo info was %d bytes long.\n"
+                       (buffer-name) size)
                      "The undo info was discarded because it exceeded \
 `undo-outer-limit'.
 
@@ -3564,8 +3565,9 @@ Also, delete any process that is exited or signaled."
                  (buf-label (if (buffer-live-p buf)
                                 `(,(buffer-name buf)
                                   face link
-                                  help-echo ,(concat "Visit buffer `"
-                                                     (buffer-name buf) "'")
+                                  help-echo ,(format-message
+                                              "Visit buffer ‘%s’"
+                                              (buffer-name buf))
                                   follow-link t
                                   process-buffer ,buf
                                   action process-menu-visit-buffer)
@@ -6874,17 +6876,22 @@ If called from Lisp, enable the mode if ARG is omitted 
or nil."
 
 (defcustom blink-matching-paren t
   "Non-nil means show matching open-paren when close-paren is inserted.
-If t, highlight the paren.  If `jump', move cursor to its position."
+If t, highlight the paren.  If `jump', briefly move cursor to its
+position.  If `jump-offscreen', move cursor there even if the
+position is off screen.  With any other non-nil value, the
+off-screen position of the opening paren will be shown in the
+echo area."
   :type '(choice
           (const :tag "Disable" nil)
           (const :tag "Highlight" t)
-          (const :tag "Move cursor" jump))
+          (const :tag "Move cursor" jump)
+          (const :tag "Move cursor, even if off screen" jump-offscreen))
   :group 'paren-blinking)
 
 (defcustom blink-matching-paren-on-screen t
   "Non-nil means show matching open-paren when it is on screen.
 If nil, don't show it (but the open-paren can still be shown
-when it is off screen).
+in the echo area when it is off screen).
 
 This variable has no effect if `blink-matching-paren' is nil.
 \(In that case, the open-paren is never shown.)
@@ -6988,13 +6995,15 @@ The function should return non-nil if the two tokens do 
not match.")
               (minibuffer-message "No matching parenthesis found")
             (message "No matching parenthesis found"))))
        ((not blinkpos) nil)
-       ((pos-visible-in-window-p blinkpos)
+       ((or
+         (eq blink-matching-paren 'jump-offscreen)
+         (pos-visible-in-window-p blinkpos))
         ;; Matching open within window, temporarily move to or highlight
         ;; char after blinkpos but only if `blink-matching-paren-on-screen'
         ;; is non-nil.
         (and blink-matching-paren-on-screen
              (not show-paren-mode)
-             (if (eq blink-matching-paren 'jump)
+             (if (memq blink-matching-paren '(jump jump-offscreen))
                  (save-excursion
                    (goto-char blinkpos)
                    (sit-for blink-matching-delay))
@@ -7005,9 +7014,9 @@ The function should return non-nil if the two tokens do 
not match.")
                      (sit-for blink-matching-delay))
                  (delete-overlay blink-matching--overlay)))))
        (t
-        (save-excursion
-          (goto-char blinkpos)
-          (let ((open-paren-line-string
+        (let ((open-paren-line-string
+               (save-excursion
+                 (goto-char blinkpos)
                  ;; Show what precedes the open in its line, if anything.
                  (cond
                   ((save-excursion (skip-chars-backward " \t") (not (bolp)))
@@ -7034,10 +7043,10 @@ The function should return non-nil if the two tokens do 
not match.")
                     "..."
                     (buffer-substring blinkpos (1+ blinkpos))))
                   ;; There is nothing to show except the char itself.
-                  (t (buffer-substring blinkpos (1+ blinkpos))))))
-            (minibuffer-message
-             "Matches %s"
-             (substring-no-properties open-paren-line-string)))))))))
+                  (t (buffer-substring blinkpos (1+ blinkpos)))))))
+          (minibuffer-message
+           "Matches %s"
+           (substring-no-properties open-paren-line-string))))))))
 
 (defvar blink-paren-function 'blink-matching-open
   "Function called, if non-nil, whenever a close parenthesis is inserted.
@@ -7266,8 +7275,8 @@ buffer buried."
                            (format "\
 The default mail mode is now Message mode.
 You have the following Mail mode variable%s customized:
-\n  %s\n\nTo use Mail mode, set `mail-user-agent' to sendmail-user-agent.
-To disable this warning, set `compose-mail-user-agent-warnings' to nil."
+\n  %s\n\nTo use Mail mode, set ‘mail-user-agent’ to sendmail-user-agent.
+To disable this warning, set ‘compose-mail-user-agent-warnings’ to nil."
                                    (if (> (length warn-vars) 1) "s" "")
                                    (mapconcat 'symbol-name
                                               warn-vars " "))))))
@@ -7338,8 +7347,8 @@ With a prefix argument, set VARIABLE to VALUE 
buffer-locally."
                                (t "globally"))))
          (val (progn
                  (when obsolete
-                   (message (concat "`%S' is obsolete; "
-                                    (if (symbolp obsolete) "use `%S' instead" 
"%s"))
+                   (message (concat "‘%S’ is obsolete; "
+                                    (if (symbolp obsolete) "use ‘%S’ instead" 
"%s"))
                             var obsolete)
                    (sit-for 3))
                  (if prop
@@ -7363,7 +7372,7 @@ With a prefix argument, set VARIABLE to VALUE 
buffer-locally."
       (require 'cus-edit)
       (setq type (widget-convert type))
       (unless (widget-apply type :match value)
-       (user-error "Value `%S' does not match type %S of %S"
+       (user-error "Value ‘%S’ does not match type %S of %S"
                    value (car type) variable))))
 
   (if make-local
@@ -7574,7 +7583,7 @@ back on `completion-list-insert-choice-function' when 
nil."
   ;; `base-position'.  It's difficult to make any use of `base-size',
   ;; so we just ignore it.
   (unless (consp base-position)
-    (message "Obsolete `base-size' passed to choose-completion-string")
+    (message "Obsolete ‘base-size’ passed to choose-completion-string")
     (setq base-position nil))
 
   (let* ((buffer (or buffer completion-reference-buffer))
@@ -7687,8 +7696,7 @@ Called from `temp-buffer-show-hook'."
       (when completion-show-help
        (goto-char (point-min))
        (if (display-mouse-p)
-           (insert (substitute-command-keys
-                    "Click on a completion to select it.\n")))
+           (insert "Click on a completion to select it.\n"))
        (insert (substitute-command-keys
                 "In this buffer, type \\[choose-completion] to \
 select the completion near point.\n\n"))))))
@@ -8300,7 +8308,7 @@ CUSTOMIZATIONS, if non-nil, should be composed of 
alternating
     `(progn
 
        (defcustom ,varalt-sym nil
-         ,(format "Alist of alternative implementations for the `%s' command.
+         ,(format "Alist of alternative implementations for the ‘%s’ command.
 
 Each entry must be a pair (ALTNAME . ALTFUN), where:
 ALTNAME - The name shown at user to describe the alternative implementation.
@@ -8313,29 +8321,31 @@ ALTFUN  - The function called to implement this 
alternative."
        (defvar ,varimp-sym nil "Internal use only.")
 
        (defun ,command (&optional arg)
-         ,(format "Run generic command `%s'.
+         ,(format "Run generic command ‘%s’.
 If used for the first time, or with interactive ARG, ask the user which
-implementation to use for `%s'.  The variable `%s'
+implementation to use for ‘%s’.  The variable ‘%s’
 contains the list of implementations currently supported for this command."
                   command-name command-name varalt-name)
          (interactive "P")
          (when (or arg (null ,varimp-sym))
            (let ((val (completing-read
-                      ,(format "Select implementation for command `%s': "
-                               command-name)
+                      ,(format-message
+                         "Select implementation for command ‘%s’: "
+                         command-name)
                       ,varalt-sym nil t)))
              (unless (string-equal val "")
               (when (null ,varimp-sym)
                 (message
-                 "Use `C-u M-x %s RET' to select another implementation"
+                 "Use ‘C-u M-x %s RET’ to select another implementation"
                  ,command-name)
                 (sit-for 3))
               (customize-save-variable ',varimp-sym
                                        (cdr (assoc-string val ,varalt-sym))))))
          (if ,varimp-sym
              (call-interactively ,varimp-sym)
-           (message ,(format "No implementation selected for command `%s'"
-                             command-name)))))))
+           (message "%s" ,(format-message
+                           "No implementation selected for command ‘%s’"
+                           command-name)))))))
 
 
 
diff --git a/lisp/skeleton.el b/lisp/skeleton.el
index 2c017dd..69bd500 100644
--- a/lisp/skeleton.el
+++ b/lisp/skeleton.el
@@ -484,7 +484,7 @@ This allows for context-sensitive checking whether pairing 
is appropriate.")
 Each alist element, which looks like (ELEMENT ...), is passed to
 `skeleton-insert' with no interactor.  Variable `str' does nothing.
 
-Elements might be (?\\=` ?\\=` _ \"''\"), (?\\( ?  _ \" )\") or (?{ \\n > _ 
\\n ?} >).")
+Elements might be (?\\=` ?\\=` _ \"\\='\\='\"), (?\\( ?  _ \" )\") or (?{ \\n 
> _ \\n ?} >).")
 
 (defvar skeleton-pair-default-alist '((?( _ ?)) (?\))
                                      (?[ _ ?]) (?\])
diff --git a/lisp/startup.el b/lisp/startup.el
index cfe2269..1cb3bb6 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -360,7 +360,7 @@ this variable usefully is to set it while building and 
dumping Emacs."
   :group 'initialization
   :initialize #'custom-initialize-default
   :set (lambda (_variable _value)
-         (error "Customizing `site-run-file' does not work")))
+         (error "Customizing ‘site-run-file’ does not work")))
 
 (make-obsolete-variable 'system-name "use (system-name) instead" "25.1")
 
@@ -752,7 +752,7 @@ to prepare for opening the first frame (e.g. open a 
connection to an X server)."
                (let ((elt (assoc completion tty-long-option-alist)))
                  ;; Check for abbreviated long option.
                  (or elt
-                     (error "Option `%s' is ambiguous" argi))
+                     (error "Option ‘%s’ is ambiguous" argi))
                  (setq argi (cdr elt)))
              ;; Check for a short option.
              (setq argval nil
@@ -902,7 +902,7 @@ please check its value")
                  ((stringp completion)
                   (let ((elt (assoc completion longopts)))
                     (unless elt
-                      (error "Option `%s' is ambiguous" argi))
+                      (error "Option ‘%s’ is ambiguous" argi))
                     (setq argi (substring (car elt) 1))))
                  (t
                   (setq argval nil
@@ -945,7 +945,7 @@ please check its value")
           (setq done t)))
        ;; Was argval set but not used?
        (and argval
-            (error "Option `%s' doesn't allow an argument" argi))))
+            (error "Option ‘%s’ doesn't allow an argument" argi))))
 
     ;; Re-attach the --display arg.
     (and display-arg (setq args (append display-arg args)))
@@ -964,7 +964,7 @@ please check its value")
               (not (featurep
                     (intern
                      (concat (symbol-name initial-window-system) "-win")))))
-         (error "Unsupported window system `%s'" initial-window-system))
+         (error "Unsupported window system ‘%s’" initial-window-system))
       ;; Process window-system specific command line parameters.
       (setq command-line-args
             (let ((window-system initial-window-system)) ;Hack attack!
@@ -1023,6 +1023,7 @@ please check its value")
       (or standard-display-table
           (setq standard-display-table (make-display-table)))
       (aset standard-display-table (car char-repl) (cdr char-repl))))
+  (setq internal--text-quoting-flag t)
 
   ;; Re-evaluate predefined variables whose initial value depends on
   ;; the runtime context.
@@ -1114,8 +1115,9 @@ please check its value")
                              "~/.emacs")
                             ((directory-files "~" nil "^_emacs\\(\\.elc?\\)?$")
                              ;; Also support _emacs for compatibility, but 
warn about it.
-                             (push '(initialization
-                                     "`_emacs' init file is deprecated, please 
use `.emacs'")
+                             (push `(initialization
+                                     ,(format-message
+                                       "`_emacs' init file is deprecated, 
please use `.emacs'"))
                                    delayed-warnings-list)
                              "~/_emacs")
                             (t ;; But default to .emacs if _emacs does not 
exist.
@@ -1176,10 +1178,11 @@ please check its value")
            (error
             (display-warning
              'initialization
-             (format "An error occurred while loading `%s':\n\n%s%s%s\n\n\
+             (format-message "\
+An error occurred while loading ‘%s’:\n\n%s%s%s\n\n\
 To ensure normal operation, you should investigate and remove the
 cause of the error in your initialization file.  Start Emacs with
-the `--debug-init' option to view a complete error backtrace."
+the ‘--debug-init’ option to view a complete error backtrace."
                      user-init-file
                      (get (car error) 'error-message)
                      (if (cdr error) ": " "")
@@ -1311,8 +1314,9 @@ the `--debug-init' option to view a complete error 
backtrace."
                         (expand-file-name user-emacs-directory))
           (setq warned t)
           (display-warning 'initialization
-                           (format "Your `load-path' seems to contain
-your `.emacs.d' directory: %s\n\
+                           (format-message "\
+Your ‘load-path’ seems to contain\n\
+your ‘.emacs.d’ directory: %s\n\
 This is likely to cause problems...\n\
 Consider using a subdirectory instead, e.g.: %s"
                                     dir (expand-file-name
@@ -1882,7 +1886,7 @@ splash screen in another window."
                                   auto-save-list-file-prefix)))
            t)
           (insert "\n\nIf an Emacs session crashed recently, "
-                  "type Meta-x recover-session RET\nto recover"
+                  "type M-x recover-session RET\nto recover"
                   " the files you were editing.\n"))
 
       (use-local-map splash-screen-keymap)
@@ -1997,9 +2001,9 @@ To quit a partially entered command, type Control-g.\n")
     (insert (substitute-command-keys "   \\[tmm-menubar]")))
 
   ;; Many users seem to have problems with these.
-  (insert "
+  (insert (substitute-command-keys "
 \(`C-' means use the CTRL key.  `M-' means use the Meta (or Alt) key.
-If you have no Meta key, you may instead type ESC followed by the character.)")
+If you have no Meta key, you may instead type ESC followed by the 
character.)"))
 
   ;; Insert links to useful tasks
   (insert "\nUseful tasks:\n")
@@ -2160,9 +2164,12 @@ A fancy display is used on graphic displays, normal 
otherwise."
   ;; which includes files parsed from the command line arguments and
   ;; `initial-buffer-choice'.  All of the display logic happens at the
   ;; end of this `let'.  As files as processed from the command line
-  ;; arguments, their buffers are prepended to `displayable-buffers'
-  ;; but they are not displayed until command line parsing has
-  ;; finished.
+  ;; arguments, their buffers are prepended to `displayable-buffers'.
+  ;; In order for options like "--eval" to work with the "--file" arg,
+  ;; the file buffers are set as the current buffer as they are seen
+  ;; on the command line (so "emacs --batch --file a --file b
+  ;; --eval='(message "%s" (buffer-name))'" will print "b"), but this
+  ;; does not affect the final displayed state of the buffers.
   (let ((displayable-buffers nil))
     ;; This `let' processes the command line arguments.
     (let ((command-line-args-left args-left))
@@ -2193,10 +2200,11 @@ A fancy display is used on graphic displays, normal 
otherwise."
                                 command-switch-alist)))
                (line 0)
                (column 0)
-               ;; `process-file-arg' opens a file buffer for `name'
-               ;; without switching to the buffer, adds the buffer to
+               ;; `process-file-arg' opens a file buffer for `name',
+               ;; sets that buffer as the current buffer without
+               ;; displaying it, adds the buffer to
                ;; `displayable-buffers', and puts the point at
-               ;; `line':`column'. `line' and `column' are both reset
+               ;; `line':`column'.  `line' and `column' are both reset
                ;; to zero when `process-file-arg' returns.
                (process-file-arg
                 (lambda (name)
@@ -2209,14 +2217,19 @@ nil default-directory" name)
                                  dir))
                           (buf (find-file-noselect file)))
                      (setq displayable-buffers (cons buf displayable-buffers))
-                     (with-current-buffer buf
-                       (unless (zerop line)
-                         (goto-char (point-min))
-                         (forward-line (1- line)))
-                       (setq line 0)
-                       (unless (< column 1)
-                         (move-to-column (1- column)))
-                       (setq column 0)))))))
+                      ;; Set the file buffer to the current buffer so
+                      ;; that it will be used with "--eval" and
+                      ;; similar options.
+                      (set-buffer buf)
+                      ;; Put the point at `line':`column' in the file
+                      ;; buffer, and reset `line' and `column' to 0.
+                      (unless (zerop line)
+                        (goto-char (point-min))
+                        (forward-line (1- line)))
+                      (setq line 0)
+                      (unless (< column 1)
+                        (move-to-column (1- column)))
+                      (setq column 0))))))
 
           ;; Add the long X options to longopts.
           (dolist (tem command-line-x-option-alist)
@@ -2251,7 +2264,7 @@ nil default-directory" name)
                     (if (stringp completion)
                         (let ((elt (member completion longopts)))
                           (or elt
-                              (error "Option `%s' is ambiguous" argi))
+                              (error "Option ‘%s’ is ambiguous" argi))
                           (setq argi (substring (car elt) 1)))
                       (setq argval nil
                             argi orig-argi)))))
@@ -2321,7 +2334,7 @@ nil default-directory" name)
                      (setq inhibit-startup-screen t)
                      (setq tem (or argval (pop command-line-args-left)))
                      (or (stringp tem)
-                         (error "File name omitted from `-insert' option"))
+                         (error "File name omitted from ‘-insert’ option"))
                      (insert-file-contents (command-line-normalize-file-name 
tem)))
 
                     ((equal argi "-kill")
@@ -2356,7 +2369,7 @@ nil default-directory" name)
                      ;; An explicit option to specify visiting a file.
                      (setq tem (or argval (pop command-line-args-left)))
                      (unless (stringp tem)
-                       (error "File name omitted from `%s' option" argi))
+                       (error "File name omitted from ‘%s’ option" argi))
                      (funcall process-file-arg tem))
 
                     ;; These command lines now have no effect.
@@ -2377,7 +2390,7 @@ nil default-directory" name)
                        (unless did-hook
                          ;; Presume that the argument is a file name.
                          (if (string-match "\\`-" argi)
-                             (error "Unknown option `%s'" argi))
+                             (error "Unknown option ‘%s’" argi))
                          ;; FIXME: Why do we only inhibit the startup
                          ;; screen for -nw?
                          (unless initial-window-system
diff --git a/lisp/strokes.el b/lisp/strokes.el
index 2363d33..a4f4a14 100644
--- a/lisp/strokes.el
+++ b/lisp/strokes.el
@@ -423,8 +423,9 @@ or for window START-WINDOW if that is specified."
   (interactive)
   (let ((command (cdar strokes-global-map)))
     (if (y-or-n-p
-        (format "Really delete last stroke definition, defined to `%s'? "
-                command))
+        (format-message
+         "Really delete last stroke definition, defined to `%s'? "
+         command))
        (progn
          (setq strokes-global-map (cdr strokes-global-map))
          (message "That stroke has been deleted"))
@@ -868,8 +869,8 @@ If no stroke matches, nothing is done and return value is 
nil."
          ((null strokes-global-map)
           (if (file-exists-p strokes-file)
               (and (y-or-n-p
-                    (format "No strokes loaded.  Load `%s'? "
-                            strokes-file))
+                    (format-message "No strokes loaded.  Load `%s'? "
+                                    strokes-file))
                    (strokes-load-user-strokes))
             (error "No strokes defined; use `strokes-global-set-stroke'")))
          (t
diff --git a/lisp/subr.el b/lisp/subr.el
index bfdc0ff..53dea3e 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -72,7 +72,7 @@ For more information, see Info node `(elisp)Declaring 
Functions'."
 If FORM does return, signal an error."
   (declare (debug t))
   `(prog1 ,form
-     (error "Form marked with `noreturn' did return")))
+     (error "Form marked with ‘noreturn’ did return")))
 
 (defmacro 1value (form)
   "Evaluate FORM, expecting a constant return value.
@@ -295,7 +295,7 @@ In Emacs, the convention is that error messages start with 
a capital
 letter but *do not* end with a period.  Please follow this convention
 for the sake of consistency."
   (declare (advertised-calling-convention (string &rest args) "23.1"))
-  (signal 'error (list (apply 'format args))))
+  (signal 'error (list (apply #'format-message args))))
 
 (defun user-error (format &rest args)
   "Signal a pilot error, making error message by passing all args to `format'.
@@ -305,7 +305,7 @@ for the sake of consistency.
 This is just like `error' except that `user-error's are expected to be the
 result of an incorrect manipulation on the part of the user, rather than the
 result of an actual problem."
-  (signal 'user-error (list (apply #'format format args))))
+  (signal 'user-error (list (apply #'format-message format args))))
 
 (defun define-error (name message &optional parent)
   "Define NAME as a new error signal.
@@ -320,7 +320,7 @@ Defaults to `error'."
                     (mapcar (lambda (parent)
                               (cons parent
                                     (or (get parent 'error-conditions)
-                                        (error "Unknown signal `%s'" parent))))
+                                        (error "Unknown signal ‘%s’" parent))))
                             parent))
            (cons parent (get parent 'error-conditions)))))
     (put name 'error-conditions
@@ -1606,8 +1606,9 @@ can do the job."
           exp
         (let* ((sym (cadr list-var))
                (append (eval append))
-               (msg (format "`add-to-list' can't use lexical var `%s'; use 
`push' or `cl-pushnew'"
-                            sym))
+               (msg (format-message
+                     "‘add-to-list’ can't use lexical var ‘%s’; use ‘push’ or 
‘cl-pushnew’"
+                     sym))
                ;; Big ugly hack so we only output a warning during
                ;; byte-compilation, and so we can use
                ;; byte-compile-not-lexical-var-p to silence the warning
@@ -2207,7 +2208,7 @@ Any input that is not one of CHARS is ignored.
 If optional argument INHIBIT-KEYBOARD-QUIT is non-nil, ignore
 keyboard-quit events while waiting for a valid input."
   (unless (consp chars)
-    (error "Called `read-char-choice' without valid char choices"))
+    (error "Called ‘read-char-choice’ without valid char choices"))
   (let (char done show-help (helpbuf " *Char Help*"))
     (let ((cursor-in-echo-area t)
           (executing-kbd-macro executing-kbd-macro)
@@ -2539,7 +2540,8 @@ If MESSAGE is nil, instructions to type EXIT-CHAR are 
displayed there."
            (or (eq event exit-char)
                (eq event (event-convert-list exit-char))
                (setq unread-command-events
-                      (append (this-single-command-raw-keys))))))
+                      (append (this-single-command-raw-keys)
+                              unread-command-events)))))
       (delete-overlay ol))))
 
 
@@ -4760,7 +4762,7 @@ Examples of version conversion:
 
 See documentation for `version-separator' and `version-regexp-alist'."
   (or (and (stringp ver) (> (length ver) 0))
-      (error "Invalid version string: '%s'" ver))
+      (error "Invalid version string: ‘%s’" ver))
   ;; Change .x.y to 0.x.y
   (if (and (>= (length ver) (length version-separator))
           (string-equal (substring ver 0 (length version-separator))
@@ -4792,9 +4794,9 @@ See documentation for `version-separator' and 
`version-regexp-alist'."
                  ((string-match "^[-_+ ]?\\([a-zA-Z]\\)$" s)
                   (push (- (aref (downcase (match-string 1 s)) 0) ?a -1)
                         lst))
-                 (t (error "Invalid version syntax: '%s'" ver))))))
+                 (t (error "Invalid version syntax: ‘%s’" ver))))))
       (if (null lst)
-         (error "Invalid version syntax: '%s'" ver)
+         (error "Invalid version syntax: ‘%s’" ver)
        (nreverse lst)))))
 
 
diff --git a/lisp/term.el b/lisp/term.el
index 4c82986..06a44f2 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1649,7 +1649,7 @@ See also `term-read-input-ring'."
       (let ((ch (read-event)))
        (if (eq ch ?\s)
            (set-window-configuration conf)
-         (setq unread-command-events (list ch)))))))
+         (push ch unread-command-events))))))
 
 
 (defun term-regexp-arg (prompt)
@@ -4128,7 +4128,9 @@ Typing SPC flushes the help buffer."
            (set-window-configuration conf))
        (if (eq first ?\s)
            (set-window-configuration conf)
-         (setq unread-command-events (listify-key-sequence key)))))))
+         (setq unread-command-events
+                (nconc (listify-key-sequence key)
+                       unread-command-events)))))))
 
 ;; I need a make-term that doesn't surround with *s -mm
 (defun term-ansi-make-term (name program &optional startfile &rest switches)
diff --git a/lisp/term/common-win.el b/lisp/term/common-win.el
index 98ad5ac..ccac142 100644
--- a/lisp/term/common-win.el
+++ b/lisp/term/common-win.el
@@ -112,7 +112,7 @@
 ;; Handle the -xrm option.
 (defun x-handle-xrm-switch (switch)
   (unless (consp x-invocation-args)
-    (error "%s: missing argument to `%s' option" (invocation-name) switch))
+    (error "%s: missing argument to ‘%s’ option" (invocation-name) switch))
   (setq x-command-line-resources
        (if (null x-command-line-resources)
            (pop x-invocation-args)
@@ -152,7 +152,7 @@
 ;; the initial frame, too.
 (defun x-handle-name-switch (switch)
   (or (consp x-invocation-args)
-      (error "%s: missing argument to `%s' option" (invocation-name) switch))
+      (error "%s: missing argument to ‘%s’ option" (invocation-name) switch))
   (setq x-resource-name (pop x-invocation-args)
        initial-frame-alist (cons (cons 'name x-resource-name)
                                  initial-frame-alist)))
@@ -207,7 +207,7 @@ have been processed."
                  (let ((elt (assoc completion option-alist)))
                    ;; Check for abbreviated long option.
                    (or elt
-                       (error "Option `%s' is ambiguous" this-switch))
+                       (error "Option ‘%s’ is ambiguous" this-switch))
                    (setq this-switch completion))))))
       (setq aelt (assoc this-switch option-alist))
       (if aelt (setq handler (nth 2 aelt)))
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 39145ff..c325661 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1,4 +1,4 @@
-;;; x-win.el --- parse relevant switches and set up for X  -*-coding: 
iso-2022-7bit; lexical-binding:t -*-
+;;; x-win.el --- parse relevant switches and set up for X  -*-coding: utf-8; 
lexical-binding:t -*-
 
 ;; Copyright (C) 1993-1994, 2001-2015 Free Software Foundation, Inc.
 
@@ -93,7 +93,7 @@
 ;; Handle the --parent-id option.
 (defun x-handle-parent-id (switch)
   (or (consp x-invocation-args)
-      (error "%s: missing argument to `%s' option" (invocation-name) switch))
+      (error "%s: missing argument to ‘%s’ option" (invocation-name) switch))
   (setq initial-frame-alist (cons
                              (cons 'parent-id
                                    (string-to-number (car x-invocation-args)))
@@ -104,7 +104,7 @@
 ;; to give us back our session id we had on the previous run.
 (defun x-handle-smid (switch)
   (or (consp x-invocation-args)
-      (error "%s: missing argument to `%s' option" (invocation-name) switch))
+      (error "%s: missing argument to ‘%s’ option" (invocation-name) switch))
   (setq x-session-previous-id (car x-invocation-args)
        x-invocation-args (cdr x-invocation-args)))
 
@@ -307,830 +307,822 @@ as returned by `x-server-vendor'."
      (pair
       '(
        ;; Latin-2
-       (#x1a1 . ?,B!(B)
-       (#x1a2 . ?,B"(B)
-       (#x1a3 . ?,B#(B)
-       (#x1a5 . ?,B%(B)
-       (#x1a6 . ?,B&(B)
-       (#x1a9 . ?,B)(B)
-       (#x1aa . ?,B*(B)
-       (#x1ab . ?,B+(B)
-       (#x1ac . ?,B,(B)
-       (#x1ae . ?,B.(B)
-       (#x1af . ?,B/(B)
-       (#x1b1 . ?,B1(B)
-       (#x1b2 . ?,B2(B)
-       (#x1b3 . ?,B3(B)
-       (#x1b5 . ?,B5(B)
-       (#x1b6 . ?,B6(B)
-       (#x1b7 . ?,B7(B)
-       (#x1b9 . ?,B9(B)
-       (#x1ba . ?,B:(B)
-       (#x1bb . ?,B;(B)
-       (#x1bc . ?,B<(B)
-       (#x1bd . ?,B=(B)
-       (#x1be . ?,B>(B)
-       (#x1bf . ?,B?(B)
-       (#x1c0 . ?,address@hidden(B)
-       (#x1c3 . ?,BC(B)
-       (#x1c5 . ?,BE(B)
-       (#x1c6 . ?,BF(B)
-       (#x1c8 . ?,BH(B)
-       (#x1ca . ?,BJ(B)
-       (#x1cc . ?,BL(B)
-       (#x1cf . ?,BO(B)
-       (#x1d0 . ?,BP(B)
-       (#x1d1 . ?,BQ(B)
-       (#x1d2 . ?,BR(B)
-       (#x1d5 . ?,BU(B)
-       (#x1d8 . ?,BX(B)
-       (#x1d9 . ?,BY(B)
-       (#x1db . ?,B[(B)
-       (#x1de . ?,B^(B)
-       (#x1e0 . ?,B`(B)
-       (#x1e3 . ?,Bc(B)
-       (#x1e5 . ?,Be(B)
-       (#x1e6 . ?,Bf(B)
-       (#x1e8 . ?,Bh(B)
-       (#x1ea . ?,Bj(B)
-       (#x1ec . ?,Bl(B)
-       (#x1ef . ?,Bo(B)
-       (#x1f0 . ?,Bp(B)
-       (#x1f1 . ?,Bq(B)
-       (#x1f2 . ?,Br(B)
-       (#x1f5 . ?,Bu(B)
-       (#x1f8 . ?,Bx(B)
-       (#x1f9 . ?,By(B)
-       (#x1fb . ?,B{(B)
-       (#x1fe . ?,B~(B)
-       (#x1ff . ?,B(B)
+       (#x1a1 . ?Ą)
+       (#x1a2 . ?˘)
+       (#x1a3 . ?Ł)
+       (#x1a5 . ?Ľ)
+       (#x1a6 . ?Ś)
+       (#x1a9 . ?Š)
+       (#x1aa . ?Ş)
+       (#x1ab . ?Ť)
+       (#x1ac . ?Ź)
+       (#x1ae . ?Ž)
+       (#x1af . ?Ż)
+       (#x1b1 . ?ą)
+       (#x1b2 . ?˛)
+       (#x1b3 . ?ł)
+       (#x1b5 . ?ľ)
+       (#x1b6 . ?ś)
+       (#x1b7 . ?ˇ)
+       (#x1b9 . ?š)
+       (#x1ba . ?ş)
+       (#x1bb . ?ť)
+       (#x1bc . ?ź)
+       (#x1bd . ?˝)
+       (#x1be . ?ž)
+       (#x1bf . ?ż)
+       (#x1c0 . ?Ŕ)
+       (#x1c3 . ?Ă)
+       (#x1c5 . ?Ĺ)
+       (#x1c6 . ?Ć)
+       (#x1c8 . ?Č)
+       (#x1ca . ?Ę)
+       (#x1cc . ?Ě)
+       (#x1cf . ?Ď)
+       (#x1d0 . ?Đ)
+       (#x1d1 . ?Ń)
+       (#x1d2 . ?Ň)
+       (#x1d5 . ?Ő)
+       (#x1d8 . ?Ř)
+       (#x1d9 . ?Ů)
+       (#x1db . ?Ű)
+       (#x1de . ?Ţ)
+       (#x1e0 . ?ŕ)
+       (#x1e3 . ?ă)
+       (#x1e5 . ?ĺ)
+       (#x1e6 . ?ć)
+       (#x1e8 . ?č)
+       (#x1ea . ?ę)
+       (#x1ec . ?ě)
+       (#x1ef . ?ď)
+       (#x1f0 . ?đ)
+       (#x1f1 . ?ń)
+       (#x1f2 . ?ň)
+       (#x1f5 . ?ő)
+       (#x1f8 . ?ř)
+       (#x1f9 . ?ů)
+       (#x1fb . ?ű)
+       (#x1fe . ?ţ)
+       (#x1ff . ?˙)
        ;; Latin-3
-       (#x2a1 . ?,C!(B)
-       (#x2a6 . ?,C&(B)
-       (#x2a9 . ?,C)(B)
-       (#x2ab . ?,C+(B)
-       (#x2ac . ?,C,(B)
-       (#x2b1 . ?,C1(B)
-       (#x2b6 . ?,C6(B)
-       (#x2b9 . ?,C9(B)
-       (#x2bb . ?,C;(B)
-       (#x2bc . ?,C<(B)
-       (#x2c5 . ?,CE(B)
-       (#x2c6 . ?,CF(B)
-       (#x2d5 . ?,CU(B)
-       (#x2d8 . ?,CX(B)
-       (#x2dd . ?,C](B)
-       (#x2de . ?,C^(B)
-       (#x2e5 . ?,Ce(B)
-       (#x2e6 . ?,Cf(B)
-       (#x2f5 . ?,Cu(B)
-       (#x2f8 . ?,Cx(B)
-       (#x2fd . ?,C}(B)
-       (#x2fe . ?,C~(B)
+       (#x2a1 . ?Ħ)
+       (#x2a6 . ?Ĥ)
+       (#x2a9 . ?İ)
+       (#x2ab . ?Ğ)
+       (#x2ac . ?Ĵ)
+       (#x2b1 . ?ħ)
+       (#x2b6 . ?ĥ)
+       (#x2b9 . ?ı)
+       (#x2bb . ?ğ)
+       (#x2bc . ?ĵ)
+       (#x2c5 . ?Ċ)
+       (#x2c6 . ?Ĉ)
+       (#x2d5 . ?Ġ)
+       (#x2d8 . ?Ĝ)
+       (#x2dd . ?Ŭ)
+       (#x2de . ?Ŝ)
+       (#x2e5 . ?ċ)
+       (#x2e6 . ?ĉ)
+       (#x2f5 . ?ġ)
+       (#x2f8 . ?ĝ)
+       (#x2fd . ?ŭ)
+       (#x2fe . ?ŝ)
        ;; Latin-4
-       (#x3a2 . ?,D"(B)
-       (#x3a3 . ?,D#(B)
-       (#x3a5 . ?,D%(B)
-       (#x3a6 . ?,D&(B)
-       (#x3aa . ?,D*(B)
-       (#x3ab . ?,D+(B)
-       (#x3ac . ?,D,(B)
-       (#x3b3 . ?,D3(B)
-       (#x3b5 . ?,D5(B)
-       (#x3b6 . ?,D6(B)
-       (#x3ba . ?,D:(B)
-       (#x3bb . ?,D;(B)
-       (#x3bc . ?,D<(B)
-       (#x3bd . ?,D=(B)
-       (#x3bf . ?,D?(B)
-       (#x3c0 . ?,address@hidden(B)
-       (#x3c7 . ?,DG(B)
-       (#x3cc . ?,DL(B)
-       (#x3cf . ?,DO(B)
-       (#x3d1 . ?,DQ(B)
-       (#x3d2 . ?,DR(B)
-       (#x3d3 . ?,DS(B)
-       (#x3d9 . ?,DY(B)
-       (#x3dd . ?,D](B)
-       (#x3de . ?,D^(B)
-       (#x3e0 . ?,D`(B)
-       (#x3e7 . ?,Dg(B)
-       (#x3ec . ?,Dl(B)
-       (#x3ef . ?,Do(B)
-       (#x3f1 . ?,Dq(B)
-       (#x3f2 . ?,Dr(B)
-       (#x3f3 . ?,Ds(B)
-       (#x3f9 . ?,Dy(B)
-       (#x3fd . ?,D}(B)
-       (#x3fe . ?,D~(B)
-       ;; Kana: Fixme: needs conversion to Japanese charset -- seems
-       ;; to require jisx0213, for which the Unicode translation
-       ;; isn't clear.  Using Emacs to convert this to Unicode and back changes
-       ;; this from "(J~(B" (i.e., bytes "ESC ( J ~ ESC ( B") to "$(G"#(B" 
(i.e., bytes
-       ;; "ESC $ ( G " # ESC ( B").
-       (#x47e . ?(J~(B)
-       (#x4a1 . ?$A!#(B)
-       (#x4a2 . ?\$A!8(B)
-       (#x4a3 . ?\$A!9(B)
-       (#x4a4 . ?$A!"(B)
-       (#x4a5 . ?$A!$(B)
-       (#x4a6 . ?$A%r(B)
-       (#x4a7 . ?$A%!(B)
-       (#x4a8 . ?$A%#(B)
-       (#x4a9 . ?$A%%(B)
-       (#x4aa . ?$A%'(B)
-       (#x4ab . ?$A%)(B)
-       (#x4ac . ?$A%c(B)
-       (#x4ad . ?$A%e(B)
-       (#x4ae . ?$A%g(B)
-       (#x4af . ?$A%C(B)
-       (#x4b0 . ?$B!<(B)
-       (#x4b1 . ?$A%"(B)
-       (#x4b2 . ?$A%$(B)
-       (#x4b3 . ?$A%&(B)
-       (#x4b4 . ?$A%((B)
-       (#x4b5 . ?$A%*(B)
-       (#x4b6 . ?$A%+(B)
-       (#x4b7 . ?$A%-(B)
-       (#x4b8 . ?$A%/(B)
-       (#x4b9 . ?$A%1(B)
-       (#x4ba . ?$A%3(B)
-       (#x4bb . ?$A%5(B)
-       (#x4bc . ?$A%7(B)
-       (#x4bd . ?$A%9(B)
-       (#x4be . ?$A%;(B)
-       (#x4bf . ?$A%=(B)
-       (#x4c0 . ?$A%?(B)
-       (#x4c1 . ?$A%A(B)
-       (#x4c2 . ?$A%D(B)
-       (#x4c3 . ?$A%F(B)
-       (#x4c4 . ?$A%H(B)
-       (#x4c5 . ?$A%J(B)
-       (#x4c6 . ?$A%K(B)
-       (#x4c7 . ?$A%L(B)
-       (#x4c8 . ?$A%M(B)
-       (#x4c9 . ?$A%N(B)
-       (#x4ca . ?$A%O(B)
-       (#x4cb . ?$A%R(B)
-       (#x4cc . ?$A%U(B)
-       (#x4cd . ?$A%X(B)
-       (#x4ce . ?$A%[(B)
-       (#x4cf . ?$A%^(B)
-       (#x4d0 . ?$A%_(B)
-       (#x4d1 . ?$A%`(B)
-       (#x4d2 . ?$A%a(B)
-       (#x4d3 . ?$A%b(B)
-       (#x4d4 . ?$A%d(B)
-       (#x4d5 . ?$A%f(B)
-       (#x4d6 . ?$A%h(B)
-       (#x4d7 . ?$A%i(B)
-       (#x4d8 . ?$A%j(B)
-       (#x4d9 . ?$A%k(B)
-       (#x4da . ?$A%l(B)
-       (#x4db . ?$A%m(B)
-       (#x4dc . ?$A%o(B)
-       (#x4dd . ?$A%s(B)
-       (#x4de . ?$B!+(B)
-       (#x4df . ?$B!,(B)
+       (#x3a2 . ?ĸ)
+       (#x3a3 . ?Ŗ)
+       (#x3a5 . ?Ĩ)
+       (#x3a6 . ?Ļ)
+       (#x3aa . ?Ē)
+       (#x3ab . ?Ģ)
+       (#x3ac . ?Ŧ)
+       (#x3b3 . ?ŗ)
+       (#x3b5 . ?ĩ)
+       (#x3b6 . ?ļ)
+       (#x3ba . ?ē)
+       (#x3bb . ?ģ)
+       (#x3bc . ?ŧ)
+       (#x3bd . ?Ŋ)
+       (#x3bf . ?ŋ)
+       (#x3c0 . ?Ā)
+       (#x3c7 . ?Į)
+       (#x3cc . ?Ė)
+       (#x3cf . ?Ī)
+       (#x3d1 . ?Ņ)
+       (#x3d2 . ?Ō)
+       (#x3d3 . ?Ķ)
+       (#x3d9 . ?Ų)
+       (#x3dd . ?Ũ)
+       (#x3de . ?Ū)
+       (#x3e0 . ?ā)
+       (#x3e7 . ?į)
+       (#x3ec . ?ė)
+       (#x3ef . ?ī)
+       (#x3f1 . ?ņ)
+       (#x3f2 . ?ō)
+       (#x3f3 . ?ķ)
+       (#x3f9 . ?ų)
+       (#x3fd . ?ũ)
+       (#x3fe . ?ū)
+       (#x47e . ?‾)
+       (#x4a1 . ?。)
+       (#x4a2 . ?\「)
+       (#x4a3 . ?\」)
+       (#x4a4 . ?、)
+       (#x4a5 . ?・)
+       (#x4a6 . ?ヲ)
+       (#x4a7 . ?ァ)
+       (#x4a8 . ?ィ)
+       (#x4a9 . ?ゥ)
+       (#x4aa . ?ェ)
+       (#x4ab . ?ォ)
+       (#x4ac . ?ャ)
+       (#x4ad . ?ュ)
+       (#x4ae . ?ョ)
+       (#x4af . ?ッ)
+       (#x4b0 . ?ー)
+       (#x4b1 . ?ア)
+       (#x4b2 . ?イ)
+       (#x4b3 . ?ウ)
+       (#x4b4 . ?エ)
+       (#x4b5 . ?オ)
+       (#x4b6 . ?カ)
+       (#x4b7 . ?キ)
+       (#x4b8 . ?ク)
+       (#x4b9 . ?ケ)
+       (#x4ba . ?コ)
+       (#x4bb . ?サ)
+       (#x4bc . ?シ)
+       (#x4bd . ?ス)
+       (#x4be . ?セ)
+       (#x4bf . ?ソ)
+       (#x4c0 . ?タ)
+       (#x4c1 . ?チ)
+       (#x4c2 . ?ツ)
+       (#x4c3 . ?テ)
+       (#x4c4 . ?ト)
+       (#x4c5 . ?ナ)
+       (#x4c6 . ?ニ)
+       (#x4c7 . ?ヌ)
+       (#x4c8 . ?ネ)
+       (#x4c9 . ?ノ)
+       (#x4ca . ?ハ)
+       (#x4cb . ?ヒ)
+       (#x4cc . ?フ)
+       (#x4cd . ?ヘ)
+       (#x4ce . ?ホ)
+       (#x4cf . ?マ)
+       (#x4d0 . ?ミ)
+       (#x4d1 . ?ム)
+       (#x4d2 . ?メ)
+       (#x4d3 . ?モ)
+       (#x4d4 . ?ヤ)
+       (#x4d5 . ?ユ)
+       (#x4d6 . ?ヨ)
+       (#x4d7 . ?ラ)
+       (#x4d8 . ?リ)
+       (#x4d9 . ?ル)
+       (#x4da . ?レ)
+       (#x4db . ?ロ)
+       (#x4dc . ?ワ)
+       (#x4dd . ?ン)
+       (#x4de . ?゛)
+       (#x4df . ?゜)
        ;; Arabic
-       (#x5ac . ?,G,(B)
-       (#x5bb . ?,G;(B)
-       (#x5bf . ?,G?(B)
-       (#x5c1 . ?,GA(B)
-       (#x5c2 . ?,GB(B)
-       (#x5c3 . ?,GC(B)
-       (#x5c4 . ?,GD(B)
-       (#x5c5 . ?,GE(B)
-       (#x5c6 . ?,GF(B)
-       (#x5c7 . ?,GG(B)
-       (#x5c8 . ?,GH(B)
-       (#x5c9 . ?,GI(B)
-       (#x5ca . ?,GJ(B)
-       (#x5cb . ?,GK(B)
-       (#x5cc . ?,GL(B)
-       (#x5cd . ?,GM(B)
-       (#x5ce . ?,GN(B)
-       (#x5cf . ?,GO(B)
-       (#x5d0 . ?,GP(B)
-       (#x5d1 . ?,GQ(B)
-       (#x5d2 . ?,GR(B)
-       (#x5d3 . ?,GS(B)
-       (#x5d4 . ?,GT(B)
-       (#x5d5 . ?,GU(B)
-       (#x5d6 . ?,GV(B)
-       (#x5d7 . ?,GW(B)
-       (#x5d8 . ?,GX(B)
-       (#x5d9 . ?,GY(B)
-       (#x5da . ?,GZ(B)
-       (#x5e0 . ?,G`(B)
-       (#x5e1 . ?,Ga(B)
-       (#x5e2 . ?,Gb(B)
-       (#x5e3 . ?,Gc(B)
-       (#x5e4 . ?,Gd(B)
-       (#x5e5 . ?,Ge(B)
-       (#x5e6 . ?,Gf(B)
-       (#x5e7 . ?,Gg(B)
-       (#x5e8 . ?,Gh(B)
-       (#x5e9 . ?,Gi(B)
-       (#x5ea . ?,Gj(B)
-       (#x5eb . ?,Gk(B)
-       (#x5ec . ?,Gl(B)
-       (#x5ed . ?,Gm(B)
-       (#x5ee . ?,Gn(B)
-       (#x5ef . ?,Go(B)
-       (#x5f0 . ?,Gp(B)
-       (#x5f1 . ?,Gq(B)
-       (#x5f2 . ?,Gr(B)
+       (#x5ac . ?،)
+       (#x5bb . ?؛)
+       (#x5bf . ?؟)
+       (#x5c1 . ?ء)
+       (#x5c2 . ?آ)
+       (#x5c3 . ?أ)
+       (#x5c4 . ?ؤ)
+       (#x5c5 . ?إ)
+       (#x5c6 . ?ئ)
+       (#x5c7 . ?ا)
+       (#x5c8 . ?ب)
+       (#x5c9 . ?ة)
+       (#x5ca . ?ت)
+       (#x5cb . ?ث)
+       (#x5cc . ?ج)
+       (#x5cd . ?ح)
+       (#x5ce . ?خ)
+       (#x5cf . ?د)
+       (#x5d0 . ?ذ)
+       (#x5d1 . ?ر)
+       (#x5d2 . ?ز)
+       (#x5d3 . ?س)
+       (#x5d4 . ?ش)
+       (#x5d5 . ?ص)
+       (#x5d6 . ?ض)
+       (#x5d7 . ?ط)
+       (#x5d8 . ?ظ)
+       (#x5d9 . ?ع)
+       (#x5da . ?غ)
+       (#x5e0 . ?ـ)
+       (#x5e1 . ?ف)
+       (#x5e2 . ?ق)
+       (#x5e3 . ?ك)
+       (#x5e4 . ?ل)
+       (#x5e5 . ?م)
+       (#x5e6 . ?ن)
+       (#x5e7 . ?ه)
+       (#x5e8 . ?و)
+       (#x5e9 . ?ى)
+       (#x5ea . ?ي)
+       (#x5eb . ?ً)
+       (#x5ec . ?ٌ)
+       (#x5ed . ?ٍ)
+       (#x5ee . ?َ)
+       (#x5ef . ?ُ)
+       (#x5f0 . ?ِ)
+       (#x5f1 . ?ّ)
+       (#x5f2 . ?ْ)
        ;; Cyrillic
-       (#x680 . ?$,1)R(B)
-       (#x681 . ?$,1)V(B)
-       (#x682 . ?$,1)Z(B)
-       (#x683 . ?$,1)\(B)
-       (#x684 . ?$,1)b(B)
-       (#x685 . ?$,1)n(B)
-       (#x686 . ?$,1)p(B)
-       (#x687 . ?$,1)r(B)
-       (#x688 . ?$,1)v(B)
-       (#x689 . ?$,1)x(B)
-       (#x68a . ?$,1)z(B)
-       (#x68c . ?$,1*8(B)
-       (#x68d . ?$,1*B(B)
-       (#x68e . ?$,1*H(B)
-       (#x68f . ?$,1*N(B)
-       (#x690 . ?$,1)S(B)
-       (#x691 . ?$,1)W(B)
-       (#x692 . ?$,1)[(B)
-       (#x693 . ?$,1)](B)
-       (#x694 . ?$,1)c(B)
-       (#x695 . ?$,1)o(B)
-       (#x696 . ?$,1)q(B)
-       (#x697 . ?$,1)s(B)
-       (#x698 . ?$,1)w(B)
-       (#x699 . ?$,1)y(B)
-       (#x69a . ?$,1){(B)
-       (#x69c . ?$,1*9(B)
-       (#x69d . ?$,1*C(B)
-       (#x69e . ?$,1*I(B)
-       (#x69f . ?$,1*O(B)
-       (#x6a1 . ?,Lr(B)
-       (#x6a2 . ?,Ls(B)
-       (#x6a3 . ?,Lq(B)
-       (#x6a4 . ?,Lt(B)
-       (#x6a5 . ?,Lu(B)
-       (#x6a6 . ?,Lv(B)
-       (#x6a7 . ?,Lw(B)
-       (#x6a8 . ?,Lx(B)
-       (#x6a9 . ?,Ly(B)
-       (#x6aa . ?,Lz(B)
-       (#x6ab . ?,L{(B)
-       (#x6ac . ?,L|(B)
-       (#x6ae . ?,L~(B)
-       (#x6af . ?,L(B)
-       (#x6b0 . ?,Lp(B)
-       (#x6b1 . ?,L"(B)
-       (#x6b2 . ?,L#(B)
-       (#x6b3 . ?,L!(B)
-       (#x6b4 . ?,L$(B)
-       (#x6b5 . ?,L%(B)
-       (#x6b6 . ?,L&(B)
-       (#x6b7 . ?,L'(B)
-       (#x6b8 . ?,L((B)
-       (#x6b9 . ?,L)(B)
-       (#x6ba . ?,L*(B)
-       (#x6bb . ?,L+(B)
-       (#x6bc . ?,L,(B)
-       (#x6be . ?,L.(B)
-       (#x6bf . ?,L/(B)
-       (#x6c0 . ?,Ln(B)
-       (#x6c1 . ?,LP(B)
-       (#x6c2 . ?,LQ(B)
-       (#x6c3 . ?,Lf(B)
-       (#x6c4 . ?,LT(B)
-       (#x6c5 . ?,LU(B)
-       (#x6c6 . ?,Ld(B)
-       (#x6c7 . ?,LS(B)
-       (#x6c8 . ?,Le(B)
-       (#x6c9 . ?,LX(B)
-       (#x6ca . ?,LY(B)
-       (#x6cb . ?,LZ(B)
-       (#x6cc . ?,L[(B)
-       (#x6cd . ?,L\(B)
-       (#x6ce . ?,L](B)
-       (#x6cf . ?,L^(B)
-       (#x6d0 . ?,L_(B)
-       (#x6d1 . ?,Lo(B)
-       (#x6d2 . ?,L`(B)
-       (#x6d3 . ?,La(B)
-       (#x6d4 . ?,Lb(B)
-       (#x6d5 . ?,Lc(B)
-       (#x6d6 . ?,LV(B)
-       (#x6d7 . ?,LR(B)
-       (#x6d8 . ?,Ll(B)
-       (#x6d9 . ?,Lk(B)
-       (#x6da . ?,LW(B)
-       (#x6db . ?,Lh(B)
-       (#x6dc . ?,Lm(B)
-       (#x6dd . ?,Li(B)
-       (#x6de . ?,Lg(B)
-       (#x6df . ?,Lj(B)
-       (#x6e0 . ?,LN(B)
-       (#x6e1 . ?,L0(B)
-       (#x6e2 . ?,L1(B)
-       (#x6e3 . ?,LF(B)
-       (#x6e4 . ?,L4(B)
-       (#x6e5 . ?,L5(B)
-       (#x6e6 . ?,LD(B)
-       (#x6e7 . ?,L3(B)
-       (#x6e8 . ?,LE(B)
-       (#x6e9 . ?,L8(B)
-       (#x6ea . ?,L9(B)
-       (#x6eb . ?,L:(B)
-       (#x6ec . ?,L;(B)
-       (#x6ed . ?,L<(B)
-       (#x6ee . ?,L=(B)
-       (#x6ef . ?,L>(B)
-       (#x6f0 . ?,L?(B)
-       (#x6f1 . ?,LO(B)
-       (#x6f2 . ?,address@hidden(B)
-       (#x6f3 . ?,LA(B)
-       (#x6f4 . ?,LB(B)
-       (#x6f5 . ?,LC(B)
-       (#x6f6 . ?,L6(B)
-       (#x6f7 . ?,L2(B)
-       (#x6f8 . ?,LL(B)
-       (#x6f9 . ?,LK(B)
-       (#x6fa . ?,L7(B)
-       (#x6fb . ?,LH(B)
-       (#x6fc . ?,LM(B)
-       (#x6fd . ?,LI(B)
-       (#x6fe . ?,LG(B)
-       (#x6ff . ?,LJ(B)
+       (#x680 . ?Ғ)
+       (#x681 . ?Җ)
+       (#x682 . ?Қ)
+       (#x683 . ?Ҝ)
+       (#x684 . ?Ң)
+       (#x685 . ?Ү)
+       (#x686 . ?Ұ)
+       (#x687 . ?Ҳ)
+       (#x688 . ?Ҷ)
+       (#x689 . ?Ҹ)
+       (#x68a . ?Һ)
+       (#x68c . ?Ә)
+       (#x68d . ?Ӣ)
+       (#x68e . ?Ө)
+       (#x68f . ?Ӯ)
+       (#x690 . ?ғ)
+       (#x691 . ?җ)
+       (#x692 . ?қ)
+       (#x693 . ?ҝ)
+       (#x694 . ?ң)
+       (#x695 . ?ү)
+       (#x696 . ?ұ)
+       (#x697 . ?ҳ)
+       (#x698 . ?ҷ)
+       (#x699 . ?ҹ)
+       (#x69a . ?һ)
+       (#x69c . ?ә)
+       (#x69d . ?ӣ)
+       (#x69e . ?ө)
+       (#x69f . ?ӯ)
+       (#x6a1 . ?ђ)
+       (#x6a2 . ?ѓ)
+       (#x6a3 . ?ё)
+       (#x6a4 . ?є)
+       (#x6a5 . ?ѕ)
+       (#x6a6 . ?і)
+       (#x6a7 . ?ї)
+       (#x6a8 . ?ј)
+       (#x6a9 . ?љ)
+       (#x6aa . ?њ)
+       (#x6ab . ?ћ)
+       (#x6ac . ?ќ)
+       (#x6ae . ?ў)
+       (#x6af . ?џ)
+       (#x6b0 . ?№)
+       (#x6b1 . ?Ђ)
+       (#x6b2 . ?Ѓ)
+       (#x6b3 . ?Ё)
+       (#x6b4 . ?Є)
+       (#x6b5 . ?Ѕ)
+       (#x6b6 . ?І)
+       (#x6b7 . ?Ї)
+       (#x6b8 . ?Ј)
+       (#x6b9 . ?Љ)
+       (#x6ba . ?Њ)
+       (#x6bb . ?Ћ)
+       (#x6bc . ?Ќ)
+       (#x6be . ?Ў)
+       (#x6bf . ?Џ)
+       (#x6c0 . ?ю)
+       (#x6c1 . ?а)
+       (#x6c2 . ?б)
+       (#x6c3 . ?ц)
+       (#x6c4 . ?д)
+       (#x6c5 . ?е)
+       (#x6c6 . ?ф)
+       (#x6c7 . ?г)
+       (#x6c8 . ?х)
+       (#x6c9 . ?и)
+       (#x6ca . ?й)
+       (#x6cb . ?к)
+       (#x6cc . ?л)
+       (#x6cd . ?м)
+       (#x6ce . ?н)
+       (#x6cf . ?о)
+       (#x6d0 . ?п)
+       (#x6d1 . ?я)
+       (#x6d2 . ?р)
+       (#x6d3 . ?с)
+       (#x6d4 . ?т)
+       (#x6d5 . ?у)
+       (#x6d6 . ?ж)
+       (#x6d7 . ?в)
+       (#x6d8 . ?ь)
+       (#x6d9 . ?ы)
+       (#x6da . ?з)
+       (#x6db . ?ш)
+       (#x6dc . ?э)
+       (#x6dd . ?щ)
+       (#x6de . ?ч)
+       (#x6df . ?ъ)
+       (#x6e0 . ?Ю)
+       (#x6e1 . ?А)
+       (#x6e2 . ?Б)
+       (#x6e3 . ?Ц)
+       (#x6e4 . ?Д)
+       (#x6e5 . ?Е)
+       (#x6e6 . ?Ф)
+       (#x6e7 . ?Г)
+       (#x6e8 . ?Х)
+       (#x6e9 . ?И)
+       (#x6ea . ?Й)
+       (#x6eb . ?К)
+       (#x6ec . ?Л)
+       (#x6ed . ?М)
+       (#x6ee . ?Н)
+       (#x6ef . ?О)
+       (#x6f0 . ?П)
+       (#x6f1 . ?Я)
+       (#x6f2 . ?Р)
+       (#x6f3 . ?С)
+       (#x6f4 . ?Т)
+       (#x6f5 . ?У)
+       (#x6f6 . ?Ж)
+       (#x6f7 . ?В)
+       (#x6f8 . ?Ь)
+       (#x6f9 . ?Ы)
+       (#x6fa . ?З)
+       (#x6fb . ?Ш)
+       (#x6fc . ?Э)
+       (#x6fd . ?Щ)
+       (#x6fe . ?Ч)
+       (#x6ff . ?Ъ)
        ;; Greek
-       (#x7a1 . ?,F6(B)
-       (#x7a2 . ?,F8(B)
-       (#x7a3 . ?,F9(B)
-       (#x7a4 . ?,F:(B)
-       (#x7a5 . ?,FZ(B)
-       (#x7a7 . ?,F<(B)
-       (#x7a8 . ?,F>(B)
-       (#x7a9 . ?,F[(B)
-       (#x7ab . ?,F?(B)
-       (#x7ae . ?,F5(B)
-       (#x7af . ?,F/(B)
-       (#x7b1 . ?,F\(B)
-       (#x7b2 . ?,F](B)
-       (#x7b3 . ?,F^(B)
-       (#x7b4 . ?,F_(B)
-       (#x7b5 . ?,Fz(B)
-       (#x7b6 . ?,address@hidden(B)
-       (#x7b7 . ?,F|(B)
-       (#x7b8 . ?,F}(B)
-       (#x7b9 . ?,F{(B)
-       (#x7ba . ?,F`(B)
-       (#x7bb . ?,F~(B)
-       (#x7c1 . ?,FA(B)
-       (#x7c2 . ?,FB(B)
-       (#x7c3 . ?,FC(B)
-       (#x7c4 . ?,FD(B)
-       (#x7c5 . ?,FE(B)
-       (#x7c6 . ?,FF(B)
-       (#x7c7 . ?,FG(B)
-       (#x7c8 . ?,FH(B)
-       (#x7c9 . ?,FI(B)
-       (#x7ca . ?,FJ(B)
-       (#x7cb . ?,FK(B)
-       (#x7cc . ?,FL(B)
-       (#x7cd . ?,FM(B)
-       (#x7ce . ?,FN(B)
-       (#x7cf . ?,FO(B)
-       (#x7d0 . ?,FP(B)
-       (#x7d1 . ?,FQ(B)
-       (#x7d2 . ?,FS(B)
-       (#x7d4 . ?,FT(B)
-       (#x7d5 . ?,FU(B)
-       (#x7d6 . ?,FV(B)
-       (#x7d7 . ?,FW(B)
-       (#x7d8 . ?,FX(B)
-       (#x7d9 . ?,FY(B)
-       (#x7e1 . ?,Fa(B)
-       (#x7e2 . ?,Fb(B)
-       (#x7e3 . ?,Fc(B)
-       (#x7e4 . ?,Fd(B)
-       (#x7e5 . ?,Fe(B)
-       (#x7e6 . ?,Ff(B)
-       (#x7e7 . ?,Fg(B)
-       (#x7e8 . ?,Fh(B)
-       (#x7e9 . ?,Fi(B)
-       (#x7ea . ?,Fj(B)
-       (#x7eb . ?,Fk(B)
-       (#x7ec . ?,Fl(B)
-       (#x7ed . ?,Fm(B)
-       (#x7ee . ?,Fn(B)
-       (#x7ef . ?,Fo(B)
-       (#x7f0 . ?,Fp(B)
-       (#x7f1 . ?,Fq(B)
-       (#x7f2 . ?,Fs(B)
-       (#x7f3 . ?,Fr(B)
-       (#x7f4 . ?,Ft(B)
-       (#x7f5 . ?,Fu(B)
-       (#x7f6 . ?,Fv(B)
-       (#x7f7 . ?,Fw(B)
-       (#x7f8 . ?,Fx(B)
-       (#x7f9 . ?,Fy(B)
+       (#x7a1 . ?Ά)
+       (#x7a2 . ?Έ)
+       (#x7a3 . ?Ή)
+       (#x7a4 . ?Ί)
+       (#x7a5 . ?Ϊ)
+       (#x7a7 . ?Ό)
+       (#x7a8 . ?Ύ)
+       (#x7a9 . ?Ϋ)
+       (#x7ab . ?Ώ)
+       (#x7ae . ?΅)
+       (#x7af . ?―)
+       (#x7b1 . ?ά)
+       (#x7b2 . ?έ)
+       (#x7b3 . ?ή)
+       (#x7b4 . ?ί)
+       (#x7b5 . ?ϊ)
+       (#x7b6 . ?ΐ)
+       (#x7b7 . ?ό)
+       (#x7b8 . ?ύ)
+       (#x7b9 . ?ϋ)
+       (#x7ba . ?ΰ)
+       (#x7bb . ?ώ)
+       (#x7c1 . ?Α)
+       (#x7c2 . ?Β)
+       (#x7c3 . ?Γ)
+       (#x7c4 . ?Δ)
+       (#x7c5 . ?Ε)
+       (#x7c6 . ?Ζ)
+       (#x7c7 . ?Η)
+       (#x7c8 . ?Θ)
+       (#x7c9 . ?Ι)
+       (#x7ca . ?Κ)
+       (#x7cb . ?Λ)
+       (#x7cc . ?Μ)
+       (#x7cd . ?Ν)
+       (#x7ce . ?Ξ)
+       (#x7cf . ?Ο)
+       (#x7d0 . ?Π)
+       (#x7d1 . ?Ρ)
+       (#x7d2 . ?Σ)
+       (#x7d4 . ?Τ)
+       (#x7d5 . ?Υ)
+       (#x7d6 . ?Φ)
+       (#x7d7 . ?Χ)
+       (#x7d8 . ?Ψ)
+       (#x7d9 . ?Ω)
+       (#x7e1 . ?α)
+       (#x7e2 . ?β)
+       (#x7e3 . ?γ)
+       (#x7e4 . ?δ)
+       (#x7e5 . ?ε)
+       (#x7e6 . ?ζ)
+       (#x7e7 . ?η)
+       (#x7e8 . ?θ)
+       (#x7e9 . ?ι)
+       (#x7ea . ?κ)
+       (#x7eb . ?λ)
+       (#x7ec . ?μ)
+       (#x7ed . ?ν)
+       (#x7ee . ?ξ)
+       (#x7ef . ?ο)
+       (#x7f0 . ?π)
+       (#x7f1 . ?ρ)
+       (#x7f2 . ?σ)
+       (#x7f3 . ?ς)
+       (#x7f4 . ?τ)
+       (#x7f5 . ?υ)
+       (#x7f6 . ?φ)
+       (#x7f7 . ?χ)
+       (#x7f8 . ?ψ)
+       (#x7f9 . ?ω)
         ;; Technical
-       (#x8a1 . ?$,1|W(B)
-       (#x8a2 . ?$A)0(B)
-       (#x8a3 . ?$A)$(B)
-       (#x8a4 . ?$,1{ (B)
-       (#x8a5 . ?$,1{!(B)
-       (#x8a6 . ?$A)&(B)
-       (#x8a7 . ?$,1|A(B)
-       (#x8a8 . ?$,1|C(B)
-       (#x8a9 . ?$,1|D(B)
-       (#x8aa . ?$,1|F(B)
-       (#x8ab . ?$,1|;(B)
-       (#x8ac . ?$,1|=(B)
-       (#x8ad . ?$,1|>(B)
-       (#x8ae . ?$,1|@(B)
-       (#x8af . ?$,1|H(B)
-       (#x8b0 . ?$,1|L(B)
-       (#x8bc . ?$A!\(B)
-       (#x8bd . ?$A!Y(B)
-       (#x8be . ?$A!](B)
-       (#x8bf . ?$A!R(B)
-       (#x8c0 . ?$A!`(B)
-       (#x8c1 . ?$A!X(B)
-       (#x8c2 . ?$A!^(B)
-       (#x8c5 . ?$B"`(B)
-       (#x8c8 . ?$(G"D(B)
-       (#x8c9 . ?$(O"l(B)
-       (#x8cd . ?$B"N(B)
-       (#x8ce . ?$B"M(B)
-       (#x8cf . ?$A!T(B)
-       (#x8d6 . ?$A!L(B)
-       (#x8da . ?$B">(B)
-       (#x8db . ?$B"?(B)
-       (#x8dc . ?$A!I(B)
-       (#x8dd . ?$A!H(B)
-       (#x8de . ?$A!D(B)
-       (#x8df . ?$A!E(B)
-       (#x8ef . ?$B"_(B)
-       (#x8f6 . ?$,1!R(B)
-       (#x8fb . ?$A!{(B)
-       (#x8fc . ?$A!|(B)
-       (#x8fd . ?$A!z(B)
-       (#x8fe . ?$A!}(B)
+       (#x8a1 . ?⎷)
+       (#x8a2 . ?┌)
+       (#x8a3 . ?─)
+       (#x8a4 . ?⌠)
+       (#x8a5 . ?⌡)
+       (#x8a6 . ?│)
+       (#x8a7 . ?⎡)
+       (#x8a8 . ?⎣)
+       (#x8a9 . ?⎤)
+       (#x8aa . ?⎦)
+       (#x8ab . ?⎛)
+       (#x8ac . ?⎝)
+       (#x8ad . ?⎞)
+       (#x8ae . ?⎠)
+       (#x8af . ?⎨)
+       (#x8b0 . ?⎬)
+       (#x8bc . ?≤)
+       (#x8bd . ?≠)
+       (#x8be . ?≥)
+       (#x8bf . ?∫)
+       (#x8c0 . ?∴)
+       (#x8c1 . ?∝)
+       (#x8c2 . ?∞)
+       (#x8c5 . ?∇)
+       (#x8c8 . ?∼)
+       (#x8c9 . ?≃)
+       (#x8cd . ?⇔)
+       (#x8ce . ?⇒)
+       (#x8cf . ?≡)
+       (#x8d6 . ?√)
+       (#x8da . ?⊂)
+       (#x8db . ?⊃)
+       (#x8dc . ?∩)
+       (#x8dd . ?∪)
+       (#x8de . ?∧)
+       (#x8df . ?∨)
+       (#x8ef . ?∂)
+       (#x8f6 . ?ƒ)
+       (#x8fb . ?←)
+       (#x8fc . ?↑)
+       (#x8fd . ?→)
+       (#x8fe . ?↓)
        ;; Special
-       (#x9e0 . ?$A!t(B)
-       (#x9e1 . ?$(C"F(B)
-       (#x9e2 . ?$(GB*(B)
-       (#x9e3 . ?$(GB-(B)
-       (#x9e4 . ?$(GB.(B)
-       (#x9e5 . ?$(GB+(B)
-       (#x9e8 . ?$,1}d(B)
-       (#x9e9 . ?$(GB,(B)
-       (#x9ea . ?$A)<(B)
-       (#x9eb . ?$A)4(B)
-       (#x9ec . ?$A)0(B)
-       (#x9ed . ?$A)8(B)
-       (#x9ee . ?$A)`(B)
-       (#x9ef . ?$,1|Z(B)
-       (#x9f0 . ?$,1|[(B)
-       (#x9f1 . ?$A)$(B)
-       (#x9f2 . ?$,1|\(B)
-       (#x9f3 . ?$,1|](B)
-       (#x9f4 . ?$A)@(B)
-       (#x9f5 . ?$A)H(B)
-       (#x9f6 . ?$A)X(B)
-       (#x9f7 . ?$A)P(B)
-       (#x9f8 . ?$A)&(B)
+       (#x9e0 . ?◆)
+       (#x9e1 . ?▒)
+       (#x9e2 . ?␉)
+       (#x9e3 . ?␌)
+       (#x9e4 . ?␍)
+       (#x9e5 . ?␊)
+       (#x9e8 . ?␤)
+       (#x9e9 . ?␋)
+       (#x9ea . ?┘)
+       (#x9eb . ?┐)
+       (#x9ec . ?┌)
+       (#x9ed . ?└)
+       (#x9ee . ?┼)
+       (#x9ef . ?⎺)
+       (#x9f0 . ?⎻)
+       (#x9f1 . ?─)
+       (#x9f2 . ?⎼)
+       (#x9f3 . ?⎽)
+       (#x9f4 . ?├)
+       (#x9f5 . ?┤)
+       (#x9f6 . ?┴)
+       (#x9f7 . ?┬)
+       (#x9f8 . ?│)
        ;; Publishing
-       (#xaa1 . ?$,1rc(B)
-       (#xaa2 . ?$,1rb(B)
-       (#xaa3 . ?$,1rd(B)
-       (#xaa4 . ?$,1re(B)
-       (#xaa5 . ?$,1rg(B)
-       (#xaa6 . ?$,1rh(B)
-       (#xaa7 . ?$,1ri(B)
-       (#xaa8 . ?$,1rj(B)
-       (#xaa9 . ?$(G!7(B)
-       (#xaaa . ?$(G!9(B)
-       (#xaae . ?$A!-(B)
-       (#xaaf . ?$(G!-(B)
-       (#xab0 . ?$(O'x(B)
-       (#xab1 . ?$(O'y(B)
-       (#xab2 . ?$(O'z(B)
-       (#xab3 . ?$,1v6(B)
-       (#xab4 . ?$,1v7(B)
-       (#xab5 . ?$,1v8(B)
-       (#xab6 . ?$,1v9(B)
-       (#xab7 . ?$,1v:(B)
-       (#xab8 . ?$(G""(B)
-       (#xabb . ?$,1rr(B)
-       (#xabc . ?$,1{)(B)
-       (#xabe . ?$,1{*(B)
-       (#xac3 . ?$(C({(B)
-       (#xac4 . ?$(C(|(B)
-       (#xac5 . ?$(C(}(B)
-       (#xac6 . ?$(C(~(B)
-       (#xac9 . ?$(D"o(B)
-       (#xaca . ?$,2"s(B)
-       (#xacc . ?$(O##(B)
-       (#xacd . ?$(O#!(B)
-       (#xace . ?$A!p(B)
-       (#xacf . ?$,2!o(B)
-       (#xad0 . ?,F!(B)
-       (#xad1 . ?,F"(B)
-       (#xad2 . ?,Y4(B)
-       (#xad3 . ?,Y!(B)
-       (#xad4 . ?$,1u^(B)
-       (#xad6 . ?$A!d(B)
-       (#xad7 . ?$A!e(B)
-       (#xad9 . ?$,2%](B)
-       (#xadb . ?$,2!l(B)
-       (#xadc . ?$(O#$(B)
-       (#xadd . ?$(O#"(B)
-       (#xade . ?$A!q(B)
-       (#xadf . ?$,2!n(B)
-       (#xae0 . ?$(O#?(B)
-       (#xae1 . ?$,2!k(B)
-       (#xae2 . ?$,2!m(B)
-       (#xae3 . ?$A!w(B)
-       (#xae4 . ?$(G!}(B)
-       (#xae5 . ?$A!n(B)
-       (#xae6 . ?$(address@hidden(B)
-       (#xae7 . ?$,2!j(B)
-       (#xae8 . ?$A!x(B)
-       (#xae9 . ?$(G!~(B)
-       (#xaea . ?$(C"P(B)
-       (#xaeb . ?$(O-~(B)
-       (#xaec . ?$(O&@(B)
-       (#xaed . ?$(O&<(B)
-       (#xaee . ?$(O&>(B)
-       (#xaf0 . ?$,2%`(B)
-       (#xaf1 . ?$B"w(B)
-       (#xaf2 . ?$B"x(B)
-       (#xaf3 . ?$(O'{(B)
-       (#xaf4 . ?$,2%W(B)
-       (#xaf5 . ?$B"t(B)
-       (#xaf6 . ?$B"u(B)
-       (#xaf7 . ?$A!a(B)
-       (#xaf8 . ?$A!b(B)
-       (#xaf9 . ?$(O&g(B)
-       (#xafa . ?$,1zu(B)
-       (#xafb . ?$,1uW(B)
-       (#xafc . ?$,1s8(B)
-       (#xafd . ?$,1rz(B)
-       (#xafe . ?,Y%(B)
+       (#xaa1 . ? )
+       (#xaa2 . ? )
+       (#xaa3 . ? )
+       (#xaa4 . ? )
+       (#xaa5 . ? )
+       (#xaa6 . ? )
+       (#xaa7 . ? )
+       (#xaa8 . ? )
+       (#xaa9 . ?—)
+       (#xaaa . ?–)
+       (#xaae . ?…)
+       (#xaaf . ?‥)
+       (#xab0 . ?⅓)
+       (#xab1 . ?⅔)
+       (#xab2 . ?⅕)
+       (#xab3 . ?⅖)
+       (#xab4 . ?⅗)
+       (#xab5 . ?⅘)
+       (#xab6 . ?⅙)
+       (#xab7 . ?⅚)
+       (#xab8 . ?℅)
+       (#xabb . ?‒)
+       (#xabc . ?〈)
+       (#xabe . ?〉)
+       (#xac3 . ?⅛)
+       (#xac4 . ?⅜)
+       (#xac5 . ?⅝)
+       (#xac6 . ?⅞)
+       (#xac9 . ?™)
+       (#xaca . ?☓)
+       (#xacc . ?◁)
+       (#xacd . ?▷)
+       (#xace . ?○)
+       (#xacf . ?▯)
+       (#xad0 . ?‘)
+       (#xad1 . ?’)
+       (#xad2 . ?“)
+       (#xad3 . ?”)
+       (#xad4 . ?℞)
+       (#xad6 . ?′)
+       (#xad7 . ?″)
+       (#xad9 . ?✝)
+       (#xadb . ?▬)
+       (#xadc . ?◀)
+       (#xadd . ?▶)
+       (#xade . ?●)
+       (#xadf . ?▮)
+       (#xae0 . ?◦)
+       (#xae1 . ?▫)
+       (#xae2 . ?▭)
+       (#xae3 . ?△)
+       (#xae4 . ?▽)
+       (#xae5 . ?☆)
+       (#xae6 . ?•)
+       (#xae7 . ?▪)
+       (#xae8 . ?▲)
+       (#xae9 . ?▼)
+       (#xaea . ?☜)
+       (#xaeb . ?☞)
+       (#xaec . ?♣)
+       (#xaed . ?♦)
+       (#xaee . ?♥)
+       (#xaf0 . ?✠)
+       (#xaf1 . ?†)
+       (#xaf2 . ?‡)
+       (#xaf3 . ?✓)
+       (#xaf4 . ?✗)
+       (#xaf5 . ?♯)
+       (#xaf6 . ?♭)
+       (#xaf7 . ?♂)
+       (#xaf8 . ?♀)
+       (#xaf9 . ?☎)
+       (#xafa . ?⌕)
+       (#xafb . ?℗)
+       (#xafc . ?‸)
+       (#xafd . ?‚)
+       (#xafe . ?„)
        ;; APL
        (#xba3 . ?<)
        (#xba6 . ?>)
-       (#xba8 . ?$A!E(B)
-       (#xba9 . ?$A!D(B)
-       (#xbc0 . ?,A/(B)
-       (#xbc2 . ?$A!M(B)
-       (#xbc3 . ?$A!I(B)
-       (#xbc4 . ?$,1zj(B)
+       (#xba8 . ?∨)
+       (#xba9 . ?∧)
+       (#xbc0 . ?¯)
+       (#xbc2 . ?⊥)
+       (#xbc3 . ?∩)
+       (#xbc4 . ?⌊)
        (#xbc6 . ?_)
-       (#xbca . ?$,1x8(B)
-       (#xbcc . ?$,1|5(B)
-       (#xbce . ?$,1yd(B)
-       (#xbcf . ?$A!p(B)
-       (#xbd3 . ?$,1zh(B)
-       (#xbd6 . ?$A!H(B)
-       (#xbd8 . ?$B"?(B)
-       (#xbda . ?$B">(B)
-       (#xbdc . ?$,1yb(B)
-       (#xbfc . ?$,1yc(B)
+       (#xbca . ?∘)
+       (#xbcc . ?⎕)
+       (#xbce . ?⊤)
+       (#xbcf . ?○)
+       (#xbd3 . ?⌈)
+       (#xbd6 . ?∪)
+       (#xbd8 . ?⊃)
+       (#xbda . ?⊂)
+       (#xbdc . ?⊢)
+       (#xbfc . ?⊣)
        ;; Hebrew
-       (#xcdf . ?,H_(B)
-       (#xce0 . ?,H`(B)
-       (#xce1 . ?,Ha(B)
-       (#xce2 . ?,Hb(B)
-       (#xce3 . ?,Hc(B)
-       (#xce4 . ?,Hd(B)
-       (#xce5 . ?,He(B)
-       (#xce6 . ?,Hf(B)
-       (#xce7 . ?,Hg(B)
-       (#xce8 . ?,Hh(B)
-       (#xce9 . ?,Hi(B)
-       (#xcea . ?,Hj(B)
-       (#xceb . ?,Hk(B)
-       (#xcec . ?,Hl(B)
-       (#xced . ?,Hm(B)
-       (#xcee . ?,Hn(B)
-       (#xcef . ?,Ho(B)
-       (#xcf0 . ?,Hp(B)
-       (#xcf1 . ?,Hq(B)
-       (#xcf2 . ?,Hr(B)
-       (#xcf3 . ?,Hs(B)
-       (#xcf4 . ?,Ht(B)
-       (#xcf5 . ?,Hu(B)
-       (#xcf6 . ?,Hv(B)
-       (#xcf7 . ?,Hw(B)
-       (#xcf8 . ?,Hx(B)
-       (#xcf9 . ?,Hy(B)
-       (#xcfa . ?,Hz(B)
+       (#xcdf . ?‗)
+       (#xce0 . ?א)
+       (#xce1 . ?ב)
+       (#xce2 . ?ג)
+       (#xce3 . ?ד)
+       (#xce4 . ?ה)
+       (#xce5 . ?ו)
+       (#xce6 . ?ז)
+       (#xce7 . ?ח)
+       (#xce8 . ?ט)
+       (#xce9 . ?י)
+       (#xcea . ?ך)
+       (#xceb . ?כ)
+       (#xcec . ?ל)
+       (#xced . ?ם)
+       (#xcee . ?מ)
+       (#xcef . ?ן)
+       (#xcf0 . ?נ)
+       (#xcf1 . ?ס)
+       (#xcf2 . ?ע)
+       (#xcf3 . ?ף)
+       (#xcf4 . ?פ)
+       (#xcf5 . ?ץ)
+       (#xcf6 . ?צ)
+       (#xcf7 . ?ק)
+       (#xcf8 . ?ר)
+       (#xcf9 . ?ש)
+       (#xcfa . ?ת)
        ;; Thai
-       (#xda1 . ?,T!(B)
-       (#xda2 . ?,T"(B)
-       (#xda3 . ?,T#(B)
-       (#xda4 . ?,T$(B)
-       (#xda5 . ?,T%(B)
-       (#xda6 . ?,T&(B)
-       (#xda7 . ?,T'(B)
-       (#xda8 . ?,T((B)
-       (#xda9 . ?,T)(B)
-       (#xdaa . ?,T*(B)
-       (#xdab . ?,T+(B)
-       (#xdac . ?,T,(B)
-       (#xdad . ?,T-(B)
-       (#xdae . ?,T.(B)
-       (#xdaf . ?,T/(B)
-       (#xdb0 . ?,T0(B)
-       (#xdb1 . ?,T1(B)
-       (#xdb2 . ?,T2(B)
-       (#xdb3 . ?,T3(B)
-       (#xdb4 . ?,T4(B)
-       (#xdb5 . ?,T5(B)
-       (#xdb6 . ?,T6(B)
-       (#xdb7 . ?,T7(B)
-       (#xdb8 . ?,T8(B)
-       (#xdb9 . ?,T9(B)
-       (#xdba . ?,T:(B)
-       (#xdbb . ?,T;(B)
-       (#xdbc . ?,T<(B)
-       (#xdbd . ?,T=(B)
-       (#xdbe . ?,T>(B)
-       (#xdbf . ?,T?(B)
-       (#xdc0 . ?,address@hidden(B)
-       (#xdc1 . ?,TA(B)
-       (#xdc2 . ?,TB(B)
-       (#xdc3 . ?,TC(B)
-       (#xdc4 . ?,TD(B)
-       (#xdc5 . ?,TE(B)
-       (#xdc6 . ?,TF(B)
-       (#xdc7 . ?,TG(B)
-       (#xdc8 . ?,TH(B)
-       (#xdc9 . ?,TI(B)
-       (#xdca . ?,TJ(B)
-       (#xdcb . ?,TK(B)
-       (#xdcc . ?,TL(B)
-       (#xdcd . ?,TM(B)
-       (#xdce . ?,TN(B)
-       (#xdcf . ?,TO(B)
-       (#xdd0 . ?,TP(B)
-       (#xdd1 . ?,TQ(B)
-       (#xdd2 . ?,TR(B)
-       (#xdd3 . ?,TS(B)
-       (#xdd4 . ?,TT(B)
-       (#xdd5 . ?,TU(B)
-       (#xdd6 . ?,TV(B)
-       (#xdd7 . ?,TW(B)
-       (#xdd8 . ?,TX(B)
-       (#xdd9 . ?,TY(B)
-       (#xdda . ?,TZ(B)
-       (#xddf . ?,T_(B)
-       (#xde0 . ?,T`(B)
-       (#xde1 . ?,Ta(B)
-       (#xde2 . ?,Tb(B)
-       (#xde3 . ?,Tc(B)
-       (#xde4 . ?,Td(B)
-       (#xde5 . ?,Te(B)
-       (#xde6 . ?,Tf(B)
-       (#xde7 . ?,Tg(B)
-       (#xde8 . ?,Th(B)
-       (#xde9 . ?,Ti(B)
-       (#xdea . ?,Tj(B)
-       (#xdeb . ?,Tk(B)
-       (#xdec . ?,Tl(B)
-       (#xded . ?,Tm(B)
-       (#xdf0 . ?,Tp(B)
-       (#xdf1 . ?,Tq(B)
-       (#xdf2 . ?,Tr(B)
-       (#xdf3 . ?,Ts(B)
-       (#xdf4 . ?,Tt(B)
-       (#xdf5 . ?,Tu(B)
-       (#xdf6 . ?,Tv(B)
-       (#xdf7 . ?,Tw(B)
-       (#xdf8 . ?,Tx(B)
-       (#xdf9 . ?,Ty(B)
+       (#xda1 . ?ก)
+       (#xda2 . ?ข)
+       (#xda3 . ?ฃ)
+       (#xda4 . ?ค)
+       (#xda5 . ?ฅ)
+       (#xda6 . ?ฆ)
+       (#xda7 . ?ง)
+       (#xda8 . ?จ)
+       (#xda9 . ?ฉ)
+       (#xdaa . ?ช)
+       (#xdab . ?ซ)
+       (#xdac . ?ฌ)
+       (#xdad . ?ญ)
+       (#xdae . ?ฎ)
+       (#xdaf . ?ฏ)
+       (#xdb0 . ?ฐ)
+       (#xdb1 . ?ฑ)
+       (#xdb2 . ?ฒ)
+       (#xdb3 . ?ณ)
+       (#xdb4 . ?ด)
+       (#xdb5 . ?ต)
+       (#xdb6 . ?ถ)
+       (#xdb7 . ?ท)
+       (#xdb8 . ?ธ)
+       (#xdb9 . ?น)
+       (#xdba . ?บ)
+       (#xdbb . ?ป)
+       (#xdbc . ?ผ)
+       (#xdbd . ?ฝ)
+       (#xdbe . ?พ)
+       (#xdbf . ?ฟ)
+       (#xdc0 . ?ภ)
+       (#xdc1 . ?ม)
+       (#xdc2 . ?ย)
+       (#xdc3 . ?ร)
+       (#xdc4 . ?ฤ)
+       (#xdc5 . ?ล)
+       (#xdc6 . ?ฦ)
+       (#xdc7 . ?ว)
+       (#xdc8 . ?ศ)
+       (#xdc9 . ?ษ)
+       (#xdca . ?ส)
+       (#xdcb . ?ห)
+       (#xdcc . ?ฬ)
+       (#xdcd . ?อ)
+       (#xdce . ?ฮ)
+       (#xdcf . ?ฯ)
+       (#xdd0 . ?ะ)
+       (#xdd1 . ?ั)
+       (#xdd2 . ?า)
+       (#xdd3 . ?ำ)
+       (#xdd4 . ?ิ)
+       (#xdd5 . ?ี)
+       (#xdd6 . ?ึ)
+       (#xdd7 . ?ื)
+       (#xdd8 . ?ุ)
+       (#xdd9 . ?ู)
+       (#xdda . ?ฺ)
+       (#xddf . ?฿)
+       (#xde0 . ?เ)
+       (#xde1 . ?แ)
+       (#xde2 . ?โ)
+       (#xde3 . ?ใ)
+       (#xde4 . ?ไ)
+       (#xde5 . ?ๅ)
+       (#xde6 . ?ๆ)
+       (#xde7 . ?็)
+       (#xde8 . ?่)
+       (#xde9 . ?้)
+       (#xdea . ?๊)
+       (#xdeb . ?๋)
+       (#xdec . ?์)
+       (#xded . ?ํ)
+       (#xdf0 . ?๐)
+       (#xdf1 . ?๑)
+       (#xdf2 . ?๒)
+       (#xdf3 . ?๓)
+       (#xdf4 . ?๔)
+       (#xdf5 . ?๕)
+       (#xdf6 . ?๖)
+       (#xdf7 . ?๗)
+       (#xdf8 . ?๘)
+       (#xdf9 . ?๙)
        ;; Korean
-       (#xea1 . ?$(C$!(B)
-       (#xea2 . ?$(C$"(B)
-       (#xea3 . ?$(C$#(B)
-       (#xea4 . ?$(C$$(B)
-       (#xea5 . ?$(C$%(B)
-       (#xea6 . ?$(C$&(B)
-       (#xea7 . ?$(C$'(B)
-       (#xea8 . ?$(C$((B)
-       (#xea9 . ?$(C$)(B)
-       (#xeaa . ?$(C$*(B)
-       (#xeab . ?$(C$+(B)
-       (#xeac . ?$(C$,(B)
-       (#xead . ?$(C$-(B)
-       (#xeae . ?$(C$.(B)
-       (#xeaf . ?$(C$/(B)
-       (#xeb0 . ?$(C$0(B)
-       (#xeb1 . ?$(C$1(B)
-       (#xeb2 . ?$(C$2(B)
-       (#xeb3 . ?$(C$3(B)
-       (#xeb4 . ?$(C$4(B)
-       (#xeb5 . ?$(C$5(B)
-       (#xeb6 . ?$(C$6(B)
-       (#xeb7 . ?$(C$7(B)
-       (#xeb8 . ?$(C$8(B)
-       (#xeb9 . ?$(C$9(B)
-       (#xeba . ?$(C$:(B)
-       (#xebb . ?$(C$;(B)
-       (#xebc . ?$(C$<(B)
-       (#xebd . ?$(C$=(B)
-       (#xebe . ?$(C$>(B)
-       (#xebf . ?$(C$?(B)
-       (#xec0 . ?$(address@hidden(B)
-       (#xec1 . ?$(C$A(B)
-       (#xec2 . ?$(C$B(B)
-       (#xec3 . ?$(C$C(B)
-       (#xec4 . ?$(C$D(B)
-       (#xec5 . ?$(C$E(B)
-       (#xec6 . ?$(C$F(B)
-       (#xec7 . ?$(C$G(B)
-       (#xec8 . ?$(C$H(B)
-       (#xec9 . ?$(C$I(B)
-       (#xeca . ?$(C$J(B)
-       (#xecb . ?$(C$K(B)
-       (#xecc . ?$(C$L(B)
-       (#xecd . ?$(C$M(B)
-       (#xece . ?$(C$N(B)
-       (#xecf . ?$(C$O(B)
-       (#xed0 . ?$(C$P(B)
-       (#xed1 . ?$(C$Q(B)
-       (#xed2 . ?$(C$R(B)
-       (#xed3 . ?$(C$S(B)
-       (#xed4 . ?$,1LH(B)
-       (#xed5 . ?$,1LI(B)
-       (#xed6 . ?$,1LJ(B)
-       (#xed7 . ?$,1LK(B)
-       (#xed8 . ?$,1LL(B)
-       (#xed9 . ?$,1LM(B)
-       (#xeda . ?$,1LN(B)
-       (#xedb . ?$,1LO(B)
-       (#xedc . ?$,1LP(B)
-       (#xedd . ?$,1LQ(B)
-       (#xede . ?$,1LR(B)
-       (#xedf . ?$,1LS(B)
-       (#xee0 . ?$,1LT(B)
-       (#xee1 . ?$,1LU(B)
-       (#xee2 . ?$,1LV(B)
-       (#xee3 . ?$,1LW(B)
-       (#xee4 . ?$,1LX(B)
-       (#xee5 . ?$,1LY(B)
-       (#xee6 . ?$,1LZ(B)
-       (#xee7 . ?$,1L[(B)
-       (#xee8 . ?$,1L\(B)
-       (#xee9 . ?$,1L](B)
-       (#xeea . ?$,1L^(B)
-       (#xeeb . ?$,1L_(B)
-       (#xeec . ?$,1L`(B)
-       (#xeed . ?$,1La(B)
-       (#xeee . ?$,1Lb(B)
-       (#xeef . ?$(C$](B)
-       (#xef0 . ?$(C$a(B)
-       (#xef1 . ?$(C$h(B)
-       (#xef2 . ?$(C$o(B)
-       (#xef3 . ?$(C$q(B)
-       (#xef4 . ?$(C$t(B)
-       (#xef5 . ?$(C$v(B)
-       (#xef6 . ?$(C$}(B)
-       (#xef7 . ?$(C$~(B)
-       (#xef8 . ?$,1M+(B)
-       (#xef9 . ?$,1M0(B)
-       (#xefa . ?$,1M9(B)
-       (#xeff . ?$,1tI(B)
+       (#xea1 . ?ㄱ)
+       (#xea2 . ?ㄲ)
+       (#xea3 . ?ㄳ)
+       (#xea4 . ?ㄴ)
+       (#xea5 . ?ㄵ)
+       (#xea6 . ?ㄶ)
+       (#xea7 . ?ㄷ)
+       (#xea8 . ?ㄸ)
+       (#xea9 . ?ㄹ)
+       (#xeaa . ?ㄺ)
+       (#xeab . ?ㄻ)
+       (#xeac . ?ㄼ)
+       (#xead . ?ㄽ)
+       (#xeae . ?ㄾ)
+       (#xeaf . ?ㄿ)
+       (#xeb0 . ?ㅀ)
+       (#xeb1 . ?ㅁ)
+       (#xeb2 . ?ㅂ)
+       (#xeb3 . ?ㅃ)
+       (#xeb4 . ?ㅄ)
+       (#xeb5 . ?ㅅ)
+       (#xeb6 . ?ㅆ)
+       (#xeb7 . ?ㅇ)
+       (#xeb8 . ?ㅈ)
+       (#xeb9 . ?ㅉ)
+       (#xeba . ?ㅊ)
+       (#xebb . ?ㅋ)
+       (#xebc . ?ㅌ)
+       (#xebd . ?ㅍ)
+       (#xebe . ?ㅎ)
+       (#xebf . ?ㅏ)
+       (#xec0 . ?ㅐ)
+       (#xec1 . ?ㅑ)
+       (#xec2 . ?ㅒ)
+       (#xec3 . ?ㅓ)
+       (#xec4 . ?ㅔ)
+       (#xec5 . ?ㅕ)
+       (#xec6 . ?ㅖ)
+       (#xec7 . ?ㅗ)
+       (#xec8 . ?ㅘ)
+       (#xec9 . ?ㅙ)
+       (#xeca . ?ㅚ)
+       (#xecb . ?ㅛ)
+       (#xecc . ?ㅜ)
+       (#xecd . ?ㅝ)
+       (#xece . ?ㅞ)
+       (#xecf . ?ㅟ)
+       (#xed0 . ?ㅠ)
+       (#xed1 . ?ㅡ)
+       (#xed2 . ?ㅢ)
+       (#xed3 . ?ㅣ)
+       (#xed4 . ?ᆨ)
+       (#xed5 . ?ᆩ)
+       (#xed6 . ?ᆪ)
+       (#xed7 . ?ᆫ)
+       (#xed8 . ?ᆬ)
+       (#xed9 . ?ᆭ)
+       (#xeda . ?ᆮ)
+       (#xedb . ?ᆯ)
+       (#xedc . ?ᆰ)
+       (#xedd . ?ᆱ)
+       (#xede . ?ᆲ)
+       (#xedf . ?ᆳ)
+       (#xee0 . ?ᆴ)
+       (#xee1 . ?ᆵ)
+       (#xee2 . ?ᆶ)
+       (#xee3 . ?ᆷ)
+       (#xee4 . ?ᆸ)
+       (#xee5 . ?ᆹ)
+       (#xee6 . ?ᆺ)
+       (#xee7 . ?ᆻ)
+       (#xee8 . ?ᆼ)
+       (#xee9 . ?ᆽ)
+       (#xeea . ?ᆾ)
+       (#xeeb . ?ᆿ)
+       (#xeec . ?ᇀ)
+       (#xeed . ?ᇁ)
+       (#xeee . ?ᇂ)
+       (#xeef . ?ㅭ)
+       (#xef0 . ?ㅱ)
+       (#xef1 . ?ㅸ)
+       (#xef2 . ?ㅿ)
+       (#xef3 . ?ㆁ)
+       (#xef4 . ?ㆄ)
+       (#xef5 . ?ㆆ)
+       (#xef6 . ?ㆍ)
+       (#xef7 . ?ㆎ)
+       (#xef8 . ?ᇫ)
+       (#xef9 . ?ᇰ)
+       (#xefa . ?ᇹ)
+       (#xeff . ?₩)
        ;; Latin-5
        ;; Latin-6
        ;; Latin-7
        ;; Latin-8
        ;; Latin-9
-       (#x13bc . ?,b<(B)
-       (#x13bd . ?,b=(B)
-       (#x13be . ?,_/(B)
+       (#x13bc . ?Œ)
+       (#x13bd . ?œ)
+       (#x13be . ?Ÿ)
        ;; Currency
-       (#x20a0 . ?$,address@hidden(B)
-       (#x20a1 . ?$,1tA(B)
-       (#x20a2 . ?$,1tB(B)
-       (#x20a3 . ?$,1tC(B)
-       (#x20a4 . ?$,1tD(B)
-       (#x20a5 . ?$,1tE(B)
-       (#x20a6 . ?$,1tF(B)
-       (#x20a7 . ?$,1tG(B)
-       (#x20a8 . ?$,1tH(B)
-       (#x20aa . ?$,1tJ(B)
-       (#x20ab . ?$,1tK(B)
-       ;; Kana: Fixme: needs checking.  Using Emacs to convert this to Unicode
-       ;; and back changes this from ",b$(B" (i.e., bytes "ESC , b $ ESC ( 
B") to
-       ;; ",F$(B" (i.e., bytes "ESC , F $ ESC ( B").
-       (#x20ac . ?,b$(B)))
+       (#x20a0 . ?₠)
+       (#x20a1 . ?₡)
+       (#x20a2 . ?₢)
+       (#x20a3 . ?₣)
+       (#x20a4 . ?₤)
+       (#x20a5 . ?₥)
+       (#x20a6 . ?₦)
+       (#x20a7 . ?₧)
+       (#x20a8 . ?₨)
+       (#x20aa . ?₪)
+       (#x20ab . ?₫)
+       (#x20ac . ?€)))
   (puthash (car pair) (cdr pair) x-keysym-table))
 
 ;; The following keysym codes for graphics are listed in the document
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el
index 12b7fc4..2ed5ad8 100644
--- a/lisp/textmodes/bib-mode.el
+++ b/lisp/textmodes/bib-mode.el
@@ -82,8 +82,8 @@ A uthor               T itle          D ate           J ournal
 V olume                N umber         P age           K eywords
 B in book or proceedings       E ditor         C ity & state
 I nstitution, school, or publisher
-R eport number or 'phd thesis' or 'masters thesis' or 'draft' or
-     'unnumbered' or 'unpublished'
+R eport number or `phd thesis' or `masters thesis' or `draft' or
+     `unnumbered' or `unpublished'
 W here can be found locally (login name, or ailib, etc.)
 X comments (not used in indexing)
 
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 9d6d19e..b1232d4 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -2099,7 +2099,7 @@ If FLAG is nil, a message is echoed if point was 
incremented at least
          (let* ((size (- (point-max) (point-min)))
                 (perc (if (= size 0)
                           100
-                        (/ (* 100 (- (point) (point-min))) size))))
+                        (floor (* 100.0 (- (point) (point-min))) size))))
            (when (>= perc (+ bibtex-progress-lastperc
                              bibtex-progress-interval))
              (setq bibtex-progress-lastperc perc)
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 424cdb7..d73780c 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -198,6 +198,16 @@
     (modify-syntax-entry ?- "_" st)
     st))
 
+(eval-and-compile
+  (defconst css--uri-re
+    (concat
+     "url\\((\\)[[:space:]]*\\(?:\\\\.\\|[^()[:space:]\n'\"]\\)+"
+     "[[:space:]]*\\()\\)")))
+
+(defconst css-syntax-propertize-function
+  (syntax-propertize-rules
+   (css--uri-re (1 "|") (2 "|"))))
+
 (defconst css-escapes-re
   "\\\\\\(?:[^\000-\037\177]\\|[0-9a-fA-F]+[ \n\t\r\f]?\\)")
 (defconst css-nmchar-re (concat "\\(?:[-[:alnum:]]\\|" css-escapes-re "\\)"))
@@ -278,7 +288,13 @@
               "\\(?:\\(" css-proprietary-nmstart-re "\\)\\|"
               css-nmstart-re "\\)" css-nmchar-re "*"
               "\\)\\s-*:")
-     (1 (if (match-end 2) 'css-proprietary-property 'css-property)))))
+     (1 (if (match-end 2) 'css-proprietary-property 'css-property)))
+    ;; Make sure the parens in a url(...) expression receive the
+    ;; default face. This is done because the parens may sometimes
+    ;; receive generic string delimiter syntax (see
+    ;; `css-syntax-propertize-function').
+    (,css--uri-re
+     (1 'default t) (2 'default t))))
 
 (defvar css-font-lock-keywords (css--font-lock-keywords))
 
@@ -381,6 +397,8 @@ pseudo-classes, and at-rules."
   (setq-local comment-start-skip "/\\*+[ \t]*")
   (setq-local comment-end "*/")
   (setq-local comment-end-skip "[ \t]*\\*+/")
+  (setq-local syntax-propertize-function
+              css-syntax-propertize-function)
   (setq-local fill-paragraph-function #'css-fill-paragraph)
   (setq-local adaptive-fill-function #'css-adaptive-fill)
   (setq-local add-log-current-defun-function #'css-current-defun-name)
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index e074918..6c4a731 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -501,7 +501,7 @@ invoking `ispell-change-dictionary'.
 
 Consider using the `ispell-parser' to check your text.  For instance
 consider adding:
-\(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex))))
+\(add-hook \\='tex-mode-hook (function (lambda () (setq ispell-parser 
\\='tex))))
 in your init file.
 
 \\[flyspell-region] checks all words inside a region.
@@ -1350,7 +1350,7 @@ that may be included as part of a word (see 
`ispell-dictionary-alist')."
        (if (and flyspell-issue-message-flag (= count 100))
            (progn
              (message "Spell Checking...%d%%"
-                      (* 100 (/ (float (- (point) beg)) (- end beg))))
+                      (floor (* 100.0 (- (point) beg)) (- end beg)))
              (setq count 0))
          (setq count (+ 1 count)))
        (flyspell-word)
@@ -1403,7 +1403,7 @@ The buffer to mark them in is 
`flyspell-large-region-buffer'."
          ;; be unnecessary too. -- rms.
          (if flyspell-issue-message-flag
              (message "Spell Checking...%d%% [%s]"
-                      (* 100 (/ (float (point)) (point-max)))
+                      (floor (* 100.0 (point)) (point-max))
                       word))
          (with-current-buffer flyspell-large-region-buffer
            (goto-char buffer-scan-pos)
@@ -2326,7 +2326,7 @@ If the text between BEG and END is equal to a correction 
suggested by
 Ispell, after transposing two adjacent characters, correct the text,
 and return t.
 
-The third arg POSS is either the symbol 'doublon' or a list of
+The third arg POSS is either the symbol `doublon' or a list of
 possible corrections as returned by `ispell-parse-output'.
 
 This function is meant to be added to `flyspell-incorrect-hook'."
@@ -2356,7 +2356,7 @@ If the text between BEG and END is equal to a correction 
suggested by
 Ispell, after removing a pair of doubled characters, correct the text,
 and return t.
 
-The third arg POSS is either the symbol 'doublon' or a list of
+The third arg POSS is either the symbol `doublon' or a list of
 possible corrections as returned by `ispell-parse-output'.
 
 This function is meant to be added to `flyspell-incorrect-hook'."
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index b0fcb17..dda983b 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -492,7 +492,7 @@ window system by evaluating the following on startup to set 
this variable:
 (defcustom ispell-personal-dictionary nil
   "File name of your personal spelling dictionary, or nil.
 If nil, the default personal dictionary, (\"~/.ispell_DICTNAME\" for ispell or
-\"~/.aspell.LANG.pws\" for aspell) is used, where DICTNAME is the name of your
+\"~/.aspell.LANG.pws\" for Aspell) is used, where DICTNAME is the name of your
 default dictionary and LANG the two letter language code."
   :type '(choice file
                 (const :tag "default" nil))
@@ -747,29 +747,29 @@ when the language uses non-ASCII characters.
 Note that with \"ispell\" as the speller, the CASECHARS and
 OTHERCHARS slots of the alist should contain the same character
 set as casechars and otherchars in the LANGUAGE.aff file \(e.g.,
-english.aff\).  aspell and hunspell don't have this limitation.")
+english.aff\).  Aspell and Hunspell don't have this limitation.")
 
 (defvar ispell-really-aspell nil
-  "Non-nil if we can use aspell extensions.")
+  "Non-nil if we can use Aspell extensions.")
 (defvar ispell-really-hunspell nil
-  "Non-nil if we can use hunspell extensions.")
+  "Non-nil if we can use Hunspell extensions.")
 (defvar ispell-encoding8-command nil
   "Command line option prefix to select encoding if supported, nil otherwise.
 If setting the encoding is supported by spellchecker and is selectable from
-the command line, this variable will contain \"--encoding=\" for aspell
-and \"-i \" for hunspell, so the appropriate mime charset can be selected.
-That will be set in `ispell-check-version' for hunspell >= 1.1.6 and
-aspell >= 0.60.
+the command line, this variable will contain \"--encoding=\" for Aspell
+and \"-i \" for Hunspell, so the appropriate mime charset can be selected.
+That will be set in `ispell-check-version' for Hunspell >= 1.1.6 and
+Aspell >= 0.60.
 
-For aspell, non-nil also means to try to automatically find its dictionaries.
+For Aspell, non-nil also means to try to automatically find its dictionaries.
 
-Earlier aspell versions do not consistently support charset encoding.  Handling
+Earlier Aspell versions do not consistently support charset encoding.  Handling
 this would require some extra guessing in `ispell-aspell-find-dictionary'.")
 
 (defvar ispell-aspell-supports-utf8 nil
-  "Non-nil if aspell has consistent command line UTF-8 support.  Obsolete.
+  "Non-nil if Aspell has consistent command line UTF-8 support.  Obsolete.
 ispell.el and flyspell.el will use for this purpose the more generic
-variable `ispell-encoding8-command' for both aspell and hunspell.  Is left
+variable `ispell-encoding8-command' for both Aspell and Hunspell.  Is left
 here just for backwards compatibility.")
 
 (make-obsolete-variable 'ispell-aspell-supports-utf8
@@ -944,7 +944,7 @@ Otherwise returns the library directory name, if that is 
defined."
 
 (defun ispell-create-debug-buffer (&optional append)
   "Create an ispell debug buffer for debugging output.
-Use APPEND to append the info to previous buffer if exists,
+If APPEND is non-nil, append the info to previous buffer if exists,
 otherwise is reset.  Returns name of ispell debug buffer.
 See `ispell-buffer-with-debug' for an example of use."
   (let ((ispell-debug-buffer (get-buffer-create "*ispell-debug*")))
@@ -956,7 +956,7 @@ See `ispell-buffer-with-debug' for an example of use."
     ispell-debug-buffer))
 
 (defsubst ispell-print-if-debug (format &rest args)
-  "Print message to `ispell-debug-buffer' buffer if enabled."
+  "Print message using FORMAT and ARGS to `ispell-debug-buffer' buffer if 
enabled."
   (if (boundp 'ispell-debug-buffer)
       (with-current-buffer ispell-debug-buffer
        (goto-char (point-max))
@@ -1009,13 +1009,13 @@ and added as a submenu of the \"Edit\" menu.")
 ;; Make ispell.el work better with aspell.
 
 (defvar ispell-aspell-dictionary-alist nil
-  "An alist of parsed aspell dicts and associated parameters.
+  "An alist of parsed Aspell dicts and associated parameters.
 Internal use.")
 
 (defun ispell-find-aspell-dictionaries ()
   "Find Aspell's dictionaries, and record in `ispell-dictionary-alist'."
   (unless (and ispell-really-aspell ispell-encoding8-command)
-    (error "This function only works with aspell >= 0.60"))
+    (error "This function only works with Aspell >= 0.60"))
   (let* ((dictionaries
          (split-string
           (with-temp-buffer
@@ -1053,7 +1053,7 @@ Assumes that value contains no whitespace."
     (car (split-string (buffer-string)))))
 
 (defun ispell-aspell-find-dictionary (dict-name)
-  "For aspell dictionary DICT-NAME, return a list of parameters if an
+  "For Aspell dictionary DICT-NAME, return a list of parameters if an
 associated data file is found or nil otherwise.  List format is that
 of `ispell-dictionary-base-alist' elements."
 
@@ -1119,7 +1119,7 @@ of `ispell-dictionary-base-alist' elements."
                'utf-8)))))
 
 (defun ispell-aspell-add-aliases (alist)
-  "Find aspell's dictionary aliases and add them to dictionary ALIST.
+  "Find Aspell's dictionary aliases and add them to dictionary ALIST.
 Return the new dictionary alist."
   (let ((aliases
          (file-expand-wildcards
@@ -1150,20 +1150,20 @@ Return the new dictionary alist."
 ;; Make ispell.el work better with hunspell.
 
 (defvar ispell-hunspell-dict-paths-alist nil
-  "Alist of parsed hunspell dicts and associated affix files.
+  "Alist of parsed Hunspell dicts and associated affix files.
 Will be used to parse corresponding .aff file and create associated
 parameters to be inserted into `ispell-hunspell-dictionary-alist'.
 Internal use.")
 
 (defvar ispell-hunspell-dictionary-alist nil
-  "Alist of parsed hunspell dicts and associated parameters.
+  "Alist of parsed Hunspell dicts and associated parameters.
 This alist will initially contain names of found dicts.  Associated
 parameters will be added when dict is used for the first time.
 Internal use.")
 
 (defun ispell-hunspell-fill-dictionary-entry (dict)
-  "Fill `ispell-dictionary-alist' uninitialized entries for `DICT' and aliases.
-Value will be extracted from hunspell affix file and used for
+  "Fill uninitialized entries in `ispell-dictionary-alist' for DICT and 
aliases.
+Value of those entries will be extracted from Hunspell affix file and used for
 all uninitialized dicts using that affix file."
   (if (cadr (assoc dict ispell-dictionary-alist))
       (message "ispell-hfde: Non void entry for %s. Skipping.\n" dict)
@@ -1178,13 +1178,13 @@ all uninitialized dicts using that affix file."
              (dict-equiv-value (cadr dict-equiv-alist-entry)))
          (if (or (member dict dict-equiv-alist-entry)
                  (member dict-alias dict-equiv-alist-entry))
-             (dolist ( tmp-dict (list dict-equiv-key dict-equiv-value))
+             (dolist (tmp-dict (list dict-equiv-key dict-equiv-value))
                (if (cadr (assoc tmp-dict ispell-dictionary-alist))
                    (ispell-print-if-debug
-                     "ispell-hfde: %s already expanded. Skipping.\n" tmp-dict)
+                     "ispell-hfde: %s already expanded; skipping.\n" tmp-dict)
                  (add-to-list 'use-for-dicts tmp-dict))))))
       (ispell-print-if-debug
-       "ispell-hfde: Filling %s entry. Use for %s.\n" dict use-for-dicts)
+       "ispell-hfde: Filling %s entry.  Use for %s.\n" dict use-for-dicts)
       ;; The final loop.
       (dolist (entry ispell-dictionary-alist)
        (if (member (car entry) use-for-dicts)
@@ -1194,52 +1194,89 @@ all uninitialized dicts using that affix file."
       (setq ispell-dictionary-alist newlist))))
 
 (defun ispell-parse-hunspell-affix-file (dict-key)
-  "Parse hunspell affix file to extract parameters for `DICT-KEY'.
-Return a list in `ispell-dictionary-alist' format."
-  (let ((affix-file (cadr (assoc dict-key ispell-hunspell-dict-paths-alist))))
-    (unless affix-file
-      (error "ispell-phaf: No matching entry for %s.\n" dict-key))
-    (if (not (file-exists-p affix-file))
-       (error "ispell-phaf: File \"%s\" not found.\n" affix-file))
-    (let ((dict-name (file-name-sans-extension
-                      (file-name-nondirectory affix-file)))
-          otherchars-string otherchars-list)
-      (with-temp-buffer
-        (insert-file-contents affix-file)
-        (setq otherchars-string
-              (save-excursion
-                (goto-char (point-min))
-                (if (search-forward-regexp "^WORDCHARS +" nil t )
-                    (buffer-substring (point)
-                                      (progn (end-of-line) (point))))))
-        ;; Remove trailing whitespace and extra stuff.  Make list if
-        ;; non-nil.
-        (setq otherchars-list
-              (if otherchars-string
-                  (split-string
-                   (if (string-match " +.*$" otherchars-string)
-                       (replace-match "" nil nil otherchars-string)
-                     otherchars-string)
-                   "" t)))
-
-        ;; Fill dict entry
-        (list dict-key
-              "[[:alpha:]]"
-              "[^[:alpha:]]"
-              (if otherchars-list
-                  (regexp-opt otherchars-list)
-                "")
-              t                   ; many-otherchars-p: We can't tell, set to t.
-              (list "-d" dict-name)
-              nil              ; extended-char-mode: not supported by hunspell!
-              'utf-8)))))
+  "Parse Hunspell affix file to extract parameters for DICT-KEY.
+Return a list in `ispell-dictionary-alist' format.
+
+DICT_KEY can be in the \"DICT1,DICT2,DICT3\" format, to invoke Hunspell
+with a list of dictionaries.  The first dictionary in the list must have
+a corresponding .aff affix file; the rest are allowed to have no affix
+files, and will then use the affix file of the preceding dictionary that
+did."
+  (let ((dict-list (split-string dict-key "," t))
+        (first-p t)
+        (dict-arg "")
+        otherchars-list)
+    (dolist (dict-key dict-list)
+      (let ((affix-file
+             (cadr (assoc dict-key ispell-hunspell-dict-paths-alist))))
+        (unless affix-file
+          (error "ispell-phaf: No matching entry for %s in 
`ispell-hunspell-dict-paths-alist'.\n" dict-key))
+        (if (and first-p (not (file-exists-p affix-file)))
+            (error "ispell-phaf: File \"%s\" not found.\n" affix-file))
+        (and first-p (setq first-p nil))
+        (let ((dict-name (file-name-sans-extension
+                          (file-name-nondirectory affix-file)))
+              otherchars-string)
+          (with-temp-buffer
+            (insert-file-contents affix-file)
+            (setq otherchars-string
+                  (save-excursion
+                    (goto-char (point-min))
+                    (if (search-forward-regexp "^WORDCHARS +" nil t )
+                        (buffer-substring (point)
+                                          (progn (end-of-line) (point))))))
+            ;; Remove trailing whitespace and extra stuff.  Make list
+            ;; if non-nil.
+            (if otherchars-string
+                (let* ((otherchars-string
+                        ;; Remove trailing junk.
+                        (substring otherchars-string
+                                   0 (string-match " +" otherchars-string)))
+                       (chars-list (append otherchars-string nil)))
+                  (setq chars-list (delq ?\  chars-list))
+                  (dolist (ch chars-list)
+                    (add-to-list 'otherchars-list ch)))))
+          ;; Cons the argument for the -d switch.
+          (setq dict-arg (concat dict-arg
+                                 (if (> (length dict-arg) 0) ",")
+                                 dict-name)))))
+
+    ;; Fill dict entry
+    (list dict-key
+          "[[:alpha:]]"
+          "[^[:alpha:]]"
+          (if otherchars-list
+              (regexp-opt (mapcar 'char-to-string otherchars-list))
+            "")
+          t                   ; many-otherchars-p: We can't tell, set to t.
+          (list "-d" dict-arg)
+          nil              ; extended-char-mode: not supported by hunspell!
+          'utf-8)))
+
+(defun ispell-hunspell-add-multi-dic (dict)
+  "Add DICT of the form \"DICT1,DICT2,...\" to `ispell-dictionary-alist'.
+
+Invoke this command before you want to start Hunspell for the first time
+with a particular combination of dictionaries.  The first dictionary
+in the list must have an affix file where Hunspell affix files are kept."
+  (interactive "sMulti-dictionary combination: ")
+  ;; Make sure the first dictionary in the list is known to us.
+  (let ((first-dict (car (split-string dict "," t))))
+    (unless ispell-hunspell-dictionary-alist
+      (ispell-find-hunspell-dictionaries)
+      (setq ispell-dictionary-alist ispell-hunspell-dictionary-alist))
+    (or (assoc first-dict ispell-local-dictionary-alist)
+        (assoc first-dict ispell-dictionary-alist)
+        (error "Unknown dictionary: %s" first-dict)))
+  (add-to-list 'ispell-dictionary-alist (list dict '()))
+  (ispell-hunspell-fill-dictionary-entry dict))
 
 (defun ispell-find-hunspell-dictionaries ()
-  "Look for installed hunspell dictionaries.
+  "Look for installed Hunspell dictionaries.
 Will initialize `ispell-hunspell-dictionary-alist' and
 `ispell-hunspell-dictionary-alist' after values found
 and remove `ispell-dicts-name2locale-equivs-alist'
-entries if a specific dict was found."
+entries if a specific dictionary was found."
   (let ((hunspell-found-dicts
         (split-string
          (with-temp-buffer
@@ -1260,7 +1297,7 @@ entries if a specific dict was found."
        (if (string-match "\\.aff$" dict)
            ;; Found default dictionary
            (if hunspell-default-dict
-               (error "ispell-fhd: Default dict already defined as %s. Not 
using %s.\n"
+               (error "ispell-fhd: Default dict already defined as %s.  Not 
using %s.\n"
                       hunspell-default-dict dict)
              (setq affix-file dict)
              (setq hunspell-default-dict (list basename affix-file)))
@@ -1280,7 +1317,7 @@ entries if a specific dict was found."
       (dolist (dict ispell-dicts-name2locale-equivs-alist)
        (if (assoc (car dict) ispell-hunspell-dict-paths-alist)
            (ispell-print-if-debug
-             "-- ispell-fhd: Excluding %s alias. Standalone dict found.\n"
+             "-- ispell-fhd: Excluding %s alias.  Standalone dict found.\n"
              (car dict))
          (add-to-list 'newlist dict)))
       (setq ispell-dicts-name2locale-equivs-alist newlist))
@@ -1401,7 +1438,7 @@ aspell is used along with Emacs).")
                        (setq ispell-args
                              (nconc ispell-args (list "-d" dict-equiv)))
                      (message
-                      "ispell-set-spellchecker-params: Missing hunspell equiv 
for \"%s\". Skipping."
+                      "ispell-set-spellchecker-params: Missing Hunspell equiv 
for \"%s\". Skipping."
                       dict-name)
                      (setq skip-dict t)))
 
@@ -1619,12 +1656,12 @@ The variable `ispell-library-directory' defines their 
location."
 
 (defvar ispell-current-dictionary nil
   "The name of the current dictionary, or nil for the default.
-This is passed to the ispell process using the `-d' switch and is
+This is passed to the Ispell process using the `-d' switch and is
 used as key in `ispell-local-dictionary-alist' and `ispell-dictionary-alist'.")
 
 (defvar ispell-current-personal-dictionary nil
   "The name of the current personal dictionary, or nil for the default.
-This is passed to the ispell process using the `-p' switch.")
+This is passed to the Ispell process using the `-p' switch.")
 
 (defun ispell-decode-string (str)
   "Decodes multibyte character strings.
@@ -1859,7 +1896,7 @@ Currently the only other valid parser is `tex'.
 
 You can set this variable in hooks in your init file -- eg:
 
-\(add-hook 'tex-mode-hook (lambda () (setq ispell-parser 'tex)))")
+\(add-hook \\='tex-mode-hook (lambda () (setq ispell-parser \\='tex)))")
 
 (defvar ispell-region-end (make-marker)
   "Marker that allows spelling continuations.")
@@ -1877,9 +1914,9 @@ You can set this variable in hooks in your init file -- 
eg:
 
 
 (defun ispell-accept-output (&optional timeout-secs timeout-msecs)
-  "Wait for output from ispell process, or TIMEOUT-SECS and TIMEOUT-MSECS.
+  "Wait for output from Ispell process, or TIMEOUT-SECS and TIMEOUT-MSECS.
 If asynchronous subprocesses are not supported, call function `ispell-filter'
-and pass it the output of the last ispell invocation."
+and pass it the output of the last Ispell invocation."
   (if ispell-async-processp
       (accept-process-output ispell-process timeout-secs timeout-msecs)
     (if (null ispell-process)
@@ -1896,8 +1933,8 @@ and pass it the output of the last ispell invocation."
            (erase-buffer)))))))
 
 (defun ispell-send-replacement (misspelled replacement)
-  "Notify aspell that MISSPELLED should be spelled REPLACEMENT.
-This allows it to improve the suggestion list based on actual misspellings."
+  "Notify Aspell that MISSPELLED should be spelled REPLACEMENT.
+This allows to improve the suggestion list based on actual misspellings."
   (and ispell-really-aspell
        (ispell-send-string (concat "$$ra " misspelled "," replacement "\n"))))
 
@@ -3702,7 +3739,7 @@ Returns the sum SHIFT due to changes in word 
replacements."
 ;;;###autoload
 (defun ispell-buffer-with-debug (&optional append)
   "`ispell-buffer' with some output sent to `ispell-debug-buffer' buffer.
-Use APPEND to append the info to previous buffer if exists."
+If APPEND is non-n il, append the info to previous buffer if exists."
   (interactive)
   (let ((ispell-debug-buffer (ispell-create-debug-buffer append)))
     (ispell-buffer)))
@@ -3739,8 +3776,8 @@ Use APPEND to append the info to previous buffer if 
exists."
 
 ;;;###autoload
 (defun ispell-complete-word (&optional interior-frag)
-  "Try to complete the word before or under point.
-If optional INTERIOR-FRAG is non-nil then the word may be a character
+  "Try to complete the word before or at point.
+If optional INTERIOR-FRAG is non-nil, then the word may be a character
 sequence inside of a word.
 
 Standard ispell choices are then available."
@@ -3846,7 +3883,7 @@ typing SPC or RET warns you if the previous word is 
incorrectly
 spelled.
 
 All the buffer-local variables and dictionaries are ignored.  To
-read them into the running ispell process, type \\[ispell-word]
+read them into the running Ispell process, type \\[ispell-word]
 SPC.
 
 For spell-checking \"on the fly\", not just after typing SPC or
@@ -4002,14 +4039,14 @@ The `X' command aborts sending the message so that you 
can edit the buffer.
 
 To spell-check whenever a message is sent, include the appropriate lines
 in your init file:
-   (add-hook 'message-send-hook 'ispell-message)  ;; GNUS 5
-   (add-hook 'news-inews-hook 'ispell-message)    ;; GNUS 4
-   (add-hook 'mail-send-hook  'ispell-message)
-   (add-hook 'mh-before-send-letter-hook 'ispell-message)
+   (add-hook \\='message-send-hook \\='ispell-message)  ;; GNUS 5
+   (add-hook \\='news-inews-hook \\='ispell-message)    ;; GNUS 4
+   (add-hook \\='mail-send-hook  \\='ispell-message)
+   (add-hook \\='mh-before-send-letter-hook \\='ispell-message)
 
 You can bind this to the key C-c i in GNUS or mail by adding to
 `news-reply-mode-hook' or `mail-mode-hook' the following lambda expression:
-   (function (lambda () (local-set-key \"\\C-ci\" 'ispell-message)))"
+   (function (lambda () (local-set-key \"\\C-ci\" \\='ispell-message)))"
   (interactive)
   (save-excursion
     (goto-char (point-min))
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index d0e09bf..0714723 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -228,7 +228,7 @@ This function is controlled by the settings of 
reftex-insert-label-flags."
                                  (symbol-value reftex-docstruct-symbol)))
               (ding)
               (if (y-or-n-p
-                   (format "Label '%s' exists. Use anyway? " label))
+                   (format-message "Label ‘%s’ exists. Use anyway? " label))
                   (setq valid t)))
 
              ;; Label is ok
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index d51fb9b..b9d4b7c 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -876,7 +876,7 @@ label prefix determines the wording of a reference."
     (setq newlabel (read-string (format "Rename label \"%s\" to:" label)))
     (if (assoc newlabel (symbol-value reftex-docstruct-symbol))
         (if (not (y-or-n-p
-                  (format "Label '%s' exists.  Use anyway? " label)))
+                  (format-message "Label ‘%s’ exists.  Use anyway? " label)))
             (error "Abort")))
     (save-excursion
       (save-window-excursion
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index f1a917d..f95f4fa 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -2932,7 +2932,7 @@ When LEVEL is non-nil, increase section numbers on that 
level.
 
 ;;;***
 
-;;;### (autoloads nil "reftex-ref" "reftex-ref.el" 
"2689a4cea701a9d284e0967c313da989")
+;;;### (autoloads nil "reftex-ref" "reftex-ref.el" 
"35c0c8fcf8eebfc4366bf0f78aed7f2f")
 ;;; Generated autoloads from reftex-ref.el
 
 (autoload 'reftex-label-location "reftex-ref" "\
@@ -3046,7 +3046,7 @@ During a selection process, these are the local bindings.
 
 ;;;***
 
-;;;### (autoloads nil "reftex-toc" "reftex-toc.el" 
"70daa7ce5ba54f2c8d469337f64636c1")
+;;;### (autoloads nil "reftex-toc" "reftex-toc.el" 
"e3514ef292edfce6722c75225456ffa1")
 ;;; Generated autoloads from reftex-toc.el
 
 (autoload 'reftex-toc "reftex-toc" "\
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index 9d3f2a9..7a2857a 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -4161,7 +4161,7 @@ cand replace with char: ")
         (let ((width (current-column)))
           (rst-delete-entire-line)
           (insert-char tochar width)))
-      (message (format "%d lines replaced." found)))))
+      (message "%d lines replaced." found))))
 
 ;; FIXME: Unbound command - should be bound or removed.
 (defun rst-join-paragraph ()
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index edc78e5..93b31d5 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -1893,7 +1893,9 @@ all the table specific features."
            (while (and (re-search-forward border3 (point-max) t)
                        (not (and (input-pending-p)
                                  table-abort-recognition-when-input-pending)))
-             (message "Recognizing tables...(%d%%)" (/ (* 100 (match-beginning 
0)) (- (point-max) (point-min))))
+             (message "Recognizing tables...(%d%%)"
+                      (floor (* 100.0 (match-beginning 0))
+                             (- (point-max) (point-min))))
              (let ((beg (match-beginning 0))
                    end)
                (if (re-search-forward non-border (point-max) t)
@@ -2804,8 +2806,8 @@ ORIENTATION is a symbol either horizontally or 
vertically."
 ;;;###autoload
 (defun table-justify (what justify)
   "Justify contents of a cell, a row of cells or a column of cells.
-WHAT is a symbol 'cell, 'row or 'column.  JUSTIFY is a symbol 'left,
-'center, 'right, 'top, 'middle, 'bottom or 'none."
+WHAT is a symbol ‘cell’, ‘row’ or ‘column’.  JUSTIFY is a symbol
+‘left’, ‘center’, ‘right’, ‘top’, ‘middle’, ‘bottom’ or ‘none’."
   (interactive
    (list (let* ((_ (barf-if-buffer-read-only))
                (completion-ignore-case t)
@@ -2820,8 +2822,8 @@ WHAT is a symbol 'cell, 'row or 'column.  JUSTIFY is a 
symbol 'left,
 ;;;###autoload
 (defun table-justify-cell (justify &optional paragraph)
   "Justify cell contents.
-JUSTIFY is a symbol 'left, 'center or 'right for horizontal, or 'top,
-'middle, 'bottom or 'none for vertical.  When optional PARAGRAPH is
+JUSTIFY is a symbol ‘left’, ‘center’ or ‘right’ for horizontal, or ‘top’,
+‘middle’, ‘bottom’ or ‘none’ for vertical.  When optional PARAGRAPH is
 non-nil the justify operation is limited to the current paragraph,
 otherwise the entire cell contents is justified."
   (interactive
@@ -2833,8 +2835,8 @@ otherwise the entire cell contents is justified."
 ;;;###autoload
 (defun table-justify-row (justify)
   "Justify cells of a row.
-JUSTIFY is a symbol 'left, 'center or 'right for horizontal, or top,
-'middle, 'bottom or 'none for vertical."
+JUSTIFY is a symbol ‘left’, ‘center’ or ‘right’ for horizontal,
+or ‘top’, ‘middle’, ‘bottom’ or ‘none’ for vertical."
   (interactive
    (list (table--query-justification)))
   (let((cell-list (table--horizontal-cell-list nil nil 'top)))
@@ -2850,8 +2852,8 @@ JUSTIFY is a symbol 'left, 'center or 'right for 
horizontal, or top,
 ;;;###autoload
 (defun table-justify-column (justify)
   "Justify cells of a column.
-JUSTIFY is a symbol 'left, 'center or 'right for horizontal, or top,
-'middle, 'bottom or 'none for vertical."
+JUSTIFY is a symbol ‘left’, ‘center’ or ‘right’ for horizontal,
+or ‘top’, ‘middle’, ‘bottom’ or ‘none’ for vertical."
   (interactive
    (list (table--query-justification)))
   (let((cell-list (table--vertical-cell-list nil nil 'left)))
@@ -3339,8 +3341,8 @@ INTERVAL is the number of cells to travel between 
sequence element
 insertion which is normally 1.  When zero or less is given for
 INTERVAL it is interpreted as number of cells per row so that sequence
 is placed straight down vertically as long as the table's cell
-structure is uniform.  JUSTIFY is one of the symbol 'left, 'center or
-'right, that specifies justification of the inserted string.
+structure is uniform.  JUSTIFY is a symbol ‘left’, ‘center’ or
+‘right’ that specifies justification of the inserted string.
 
 Example:
 
@@ -4459,8 +4461,8 @@ looking at the appearance of the CELL contents."
 
 (defun table--justify-cell-contents (justify &optional paragraph)
   "Justify the current cell contents.
-JUSTIFY is a symbol 'left, 'center or 'right for horizontal, or 'top,
-'middle, 'bottom or 'none for vertical.  When PARAGRAPH is non-nil the
+JUSTIFY is a symbol ‘left’, ‘center’ or ‘right’ for horizontal, or ‘top’,
+‘middle’, ‘bottom’ or ‘none’ for vertical.  When PARAGRAPH is non-nil the
 justify operation is limited to the current paragraph."
   (table-with-cache-buffer
     (let ((beg (point-min))
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 535b885..6244189 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1035,7 +1035,7 @@ says which mode to use."
   "Major mode for editing files of input for plain TeX.
 Makes $ and } display the characters they match.
 Makes \" insert \\=`\\=` when it seems to be the beginning of a quotation,
-and '' when it appears to be the end; it inserts \" only after a \\.
+and \\='\\=' when it appears to be the end; it inserts \" only after a \\.
 
 Use \\[tex-region] to run TeX on the current region, plus a \"header\"
 copied from the top of the file (containing macro definitions, etc.),
@@ -1081,7 +1081,7 @@ special subshell is initiated, the hook `tex-shell-hook' 
is run."
   "Major mode for editing files of input for LaTeX.
 Makes $ and } display the characters they match.
 Makes \" insert \\=`\\=` when it seems to be the beginning of a quotation,
-and '' when it appears to be the end; it inserts \" only after a \\.
+and \\='\\=' when it appears to be the end; it inserts \" only after a \\.
 
 Use \\[tex-region] to run LaTeX on the current region, plus the preamble
 copied from the top of the file (containing \\documentstyle, etc.),
@@ -1163,7 +1163,7 @@ subshell is initiated, `tex-shell-hook' is run."
   "Major mode for editing files of input for SliTeX.
 Makes $ and } display the characters they match.
 Makes \" insert \\=`\\=` when it seems to be the beginning of a quotation,
-and '' when it appears to be the end; it inserts \" only after a \\.
+and \\='\\=' when it appears to be the end; it inserts \" only after a \\.
 
 Use \\[tex-region] to run SliTeX on the current region, plus the preamble
 copied from the top of the file (containing \\documentstyle, etc.),
@@ -1205,6 +1205,7 @@ Entering SliTeX mode runs the hook `text-mode-hook', then 
the hook
 
 (defvar tildify-space-string)
 (defvar tildify-foreach-region-function)
+(defvar tex--prettify-symbols-alist)
 
 (defun tex-common-initialization ()
   ;; Regexp isearch should accept newline and formfeed as whitespace.
@@ -1246,7 +1247,7 @@ Entering SliTeX mode runs the hook `text-mode-hook', then 
the hook
   (setq-local facemenu-remove-face-function t)
   (setq-local font-lock-defaults
              '((tex-font-lock-keywords tex-font-lock-keywords-1
-                tex-font-lock-keywords-2 tex-font-lock-keywords-3)
+                                        tex-font-lock-keywords-2 
tex-font-lock-keywords-3)
                nil nil nil nil
                ;; Who ever uses that anyway ???
                (font-lock-mark-block-function . mark-paragraph)
@@ -1254,6 +1255,9 @@ Entering SliTeX mode runs the hook `text-mode-hook', then 
the hook
                 . tex-font-lock-syntactic-face-function)
                (font-lock-unfontify-region-function
                 . tex-font-lock-unfontify-region)))
+  (setq-local prettify-symbols-alist tex--prettify-symbols-alist)
+  (add-function :override (local 'prettify-symbols-compose-predicate)
+                #'tex--prettify-symbols-compose-p)
   (setq-local syntax-propertize-function
              (syntax-propertize-rules latex-syntax-propertize-rules))
   ;; TABs in verbatim environments don't do what you think.
@@ -1297,7 +1301,7 @@ Entering SliTeX mode runs the hook `text-mode-hook', then 
the hook
 (defun tex-insert-quote (arg)
   "Insert the appropriate quote marks for TeX.
 Inserts the value of `tex-open-quote' (normally \\=`\\=`) or `tex-close-quote'
-\(normally '') depending on the context.  With prefix argument, always
+\(normally \\='\\=') depending on the context.  With prefix argument, always
 inserts \" characters."
   (interactive "*P")
   ;; Discover if we'll be inserting normal double quotes.
@@ -2943,6 +2947,474 @@ There might be text before point."
   (setq-local syntax-propertize-function
              (syntax-propertize-rules doctex-syntax-propertize-rules)))
 
+;;; Prettify Symbols Support
+
+(defvar tex--prettify-symbols-alist
+  '( ;; Lowercase Greek letters.
+    ("\\alpha" . ?α)
+    ("\\beta" . ?β)
+    ("\\gamma" . ?γ)
+    ("\\delta" . ?δ)
+    ("\\epsilon" . ?ε)
+    ("\\zeta" . ?ζ)
+    ("\\eta" . ?η)
+    ("\\theta" . ?θ)
+    ("\\iota" . ?ι)
+    ("\\kappa" . ?κ)
+    ("\\lambda" . ?λ)
+    ("\\mu" . ?μ)
+    ("\\nu" . ?ν)
+    ("\\xi" . ?ξ)
+    ;; There is no \omicron because it looks like a latin o.
+    ("\\pi" . ?π)
+    ("\\rho" . ?ρ)
+    ("\\sigma" . ?σ)
+    ("\\tau" . ?τ)
+    ("\\upsilon" . ?υ)
+    ("\\phi" . ?φ)
+    ("\\chi" . ?χ)
+    ("\\psi" . ?ψ)
+    ("\\omega" . ?ω)
+    ;; Uppercase Greek letters.
+    ("\\Gamma" . ?Γ)
+    ("\\Delta" . ?Δ)
+    ("\\Lambda" . ?Λ)
+    ("\\Phi" . ?Φ)
+    ("\\Pi" . ?Π)
+    ("\\Psi" . ?Ψ)
+    ("\\Sigma" . ?Σ)
+    ("\\Theta" . ?Θ)
+    ("\\Upsilon" . ?Υ)
+    ("\\Xi" . ?Ξ)
+    ("\\Omega" . ?Ω)
+
+    ;; Other math symbols (taken from leim/quail/latin-ltx.el).
+    ("\\Box" . ?□)
+    ("\\Bumpeq" . ?≎)
+    ("\\Cap" . ?⋒)
+    ("\\Cup" . ?⋓)
+    ("\\Diamond" . ?◇)
+    ("\\Downarrow" . ?⇓)
+    ("\\H{o}" . ?ő)
+    ("\\Im" . ?ℑ)
+    ("\\Join" . ?⋈)
+    ("\\Leftarrow" . ?⇐)
+    ("\\Leftrightarrow" . ?⇔)
+    ("\\Ll" . ?⋘)
+    ("\\Lleftarrow" . ?⇚)
+    ("\\Longleftarrow" . ?⇐)
+    ("\\Longleftrightarrow" . ?⇔)
+    ("\\Longrightarrow" . ?⇒)
+    ("\\Lsh" . ?↰)
+    ("\\Re" . ?ℜ)
+    ("\\Rightarrow" . ?⇒)
+    ("\\Rrightarrow" . ?⇛)
+    ("\\Rsh" . ?↱)
+    ("\\Subset" . ?⋐)
+    ("\\Supset" . ?⋑)
+    ("\\Uparrow" . ?⇑)
+    ("\\Updownarrow" . ?⇕)
+    ("\\Vdash" . ?⊩)
+    ("\\Vert" . ?‖)
+    ("\\Vvdash" . ?⊪)
+    ("\\aleph" . ?ℵ)
+    ("\\amalg" . ?∐)
+    ("\\angle" . ?∠)
+    ("\\approx" . ?≈)
+    ("\\approxeq" . ?≊)
+    ("\\ast" . ?∗)
+    ("\\asymp" . ?≍)
+    ("\\backcong" . ?≌)
+    ("\\backepsilon" . ?∍)
+    ("\\backprime" . ?‵)
+    ("\\backsim" . ?∽)
+    ("\\backsimeq" . ?⋍)
+    ("\\backslash" . ?\\)
+    ("\\barwedge" . ?⊼)
+    ("\\because" . ?∵)
+    ("\\beth" . ?ℶ)
+    ("\\between" . ?≬)
+    ("\\bigcap" . ?⋂)
+    ("\\bigcirc" . ?◯)
+    ("\\bigcup" . ?⋃)
+    ("\\bigstar" . ?★)
+    ("\\bigtriangledown" . ?▽)
+    ("\\bigtriangleup" . ?△)
+    ("\\bigvee" . ?⋁)
+    ("\\bigwedge" . ?⋀)
+    ("\\blacklozenge" . ?✦)
+    ("\\blacksquare" . ?▪)
+    ("\\blacktriangle" . ?▴)
+    ("\\blacktriangledown" . ?▾)
+    ("\\blacktriangleleft" . ?◂)
+    ("\\blacktriangleright" . ?▸)
+    ("\\bot" . ?⊥)
+    ("\\bowtie" . ?⋈)
+    ("\\boxminus" . ?⊟)
+    ("\\boxplus" . ?⊞)
+    ("\\boxtimes" . ?⊠)
+    ("\\bullet" . ?•)
+    ("\\bumpeq" . ?≏)
+    ("\\cap" . ?∩)
+    ("\\cdots" . ?⋯)
+    ("\\centerdot" . ?·)
+    ("\\checkmark" . ?✓)
+    ("\\chi" . ?χ)
+    ("\\cdot" . ?⋅)
+    ("\\cdots" . ?⋯)
+    ("\\circ" . ?∘)
+    ("\\circeq" . ?≗)
+    ("\\circlearrowleft" . ?↺)
+    ("\\circlearrowright" . ?↻)
+    ("\\circledR" . ?®)
+    ("\\circledS" . ?Ⓢ)
+    ("\\circledast" . ?⊛)
+    ("\\circledcirc" . ?⊚)
+    ("\\circleddash" . ?⊝)
+    ("\\clubsuit" . ?♣)
+    ("\\coloneq" . ?≔)
+    ("\\complement" . ?∁)
+    ("\\cong" . ?≅)
+    ("\\coprod" . ?∐)
+    ("\\cup" . ?∪)
+    ("\\curlyeqprec" . ?⋞)
+    ("\\curlyeqsucc" . ?⋟)
+    ("\\curlypreceq" . ?≼)
+    ("\\curlyvee" . ?⋎)
+    ("\\curlywedge" . ?⋏)
+    ("\\curvearrowleft" . ?↶)
+    ("\\curvearrowright" . ?↷)
+    ("\\dag" . ?†)
+    ("\\dagger" . ?†)
+    ("\\daleth" . ?ℸ)
+    ("\\dashv" . ?⊣)
+    ("\\ddag" . ?‡)
+    ("\\ddagger" . ?‡)
+    ("\\ddots" . ?⋱)
+    ("\\diamond" . ?⋄)
+    ("\\diamondsuit" . ?♢)
+    ("\\divideontimes" . ?⋇)
+    ("\\doteq" . ?≐)
+    ("\\doteqdot" . ?≑)
+    ("\\dotplus" . ?∔)
+    ("\\dotsquare" . ?⊡)
+    ("\\downarrow" . ?↓)
+    ("\\downdownarrows" . ?⇊)
+    ("\\downleftharpoon" . ?⇃)
+    ("\\downrightharpoon" . ?⇂)
+    ("\\ell" . ?ℓ)
+    ("\\emptyset" . ?∅)
+    ("\\eqcirc" . ?≖)
+    ("\\eqcolon" . ?≕)
+    ("\\eqslantgtr" . ?⋝)
+    ("\\eqslantless" . ?⋜)
+    ("\\equiv" . ?≡)
+    ("\\exists" . ?∃)
+    ("\\fallingdotseq" . ?≒)
+    ("\\flat" . ?♭)
+    ("\\forall" . ?∀)
+    ("\\frown" . ?⌢)
+    ("\\ge" . ?≥)
+    ("\\geq" . ?≥)
+    ("\\geqq" . ?≧)
+    ("\\geqslant" . ?≥)
+    ("\\gets" . ?←)
+    ("\\gg" . ?≫)
+    ("\\ggg" . ?⋙)
+    ("\\gimel" . ?ℷ)
+    ("\\gnapprox" . ?⋧)
+    ("\\gneq" . ?≩)
+    ("\\gneqq" . ?≩)
+    ("\\gnsim" . ?⋧)
+    ("\\gtrapprox" . ?≳)
+    ("\\gtrdot" . ?⋗)
+    ("\\gtreqless" . ?⋛)
+    ("\\gtreqqless" . ?⋛)
+    ("\\gtrless" . ?≷)
+    ("\\gtrsim" . ?≳)
+    ("\\gvertneqq" . ?≩)
+    ("\\hbar" . ?ℏ)
+    ("\\heartsuit" . ?♥)
+    ("\\hookleftarrow" . ?↩)
+    ("\\hookrightarrow" . ?↪)
+    ("\\iff" . ?⇔)
+    ("\\imath" . ?ı)
+    ("\\in" . ?∈)
+    ("\\infty" . ?∞)
+    ("\\int" . ?∫)
+    ("\\intercal" . ?⊺)
+    ("\\langle" . 10216)          ; Literal ?⟨ breaks indentation.
+    ("\\lbrace" . ?{)
+    ("\\lbrack" . ?\[)
+    ("\\lceil" . ?⌈)
+    ("\\ldots" . ?…)
+    ("\\le" . ?≤)
+    ("\\leadsto" . ?↝)
+    ("\\leftarrow" . ?←)
+    ("\\leftarrowtail" . ?↢)
+    ("\\leftharpoondown" . ?↽)
+    ("\\leftharpoonup" . ?↼)
+    ("\\leftleftarrows" . ?⇇)
+    ;; ("\\leftparengtr" ?〈), see bug#12948.
+    ("\\leftrightarrow" . ?↔)
+    ("\\leftrightarrows" . ?⇆)
+    ("\\leftrightharpoons" . ?⇋)
+    ("\\leftrightsquigarrow" . ?↭)
+    ("\\leftthreetimes" . ?⋋)
+    ("\\leq" . ?≤)
+    ("\\leqq" . ?≦)
+    ("\\leqslant" . ?≤)
+    ("\\lessapprox" . ?≲)
+    ("\\lessdot" . ?⋖)
+    ("\\lesseqgtr" . ?⋚)
+    ("\\lesseqqgtr" . ?⋚)
+    ("\\lessgtr" . ?≶)
+    ("\\lesssim" . ?≲)
+    ("\\lfloor" . ?⌊)
+    ("\\lhd" . ?◁)
+    ("\\rhd" . ?▷)
+    ("\\ll" . ?≪)
+    ("\\llcorner" . ?⌞)
+    ("\\lnapprox" . ?⋦)
+    ("\\lneq" . ?≨)
+    ("\\lneqq" . ?≨)
+    ("\\lnsim" . ?⋦)
+    ("\\longleftarrow" . ?←)
+    ("\\longleftrightarrow" . ?↔)
+    ("\\longmapsto" . ?↦)
+    ("\\longrightarrow" . ?→)
+    ("\\looparrowleft" . ?↫)
+    ("\\looparrowright" . ?↬)
+    ("\\lozenge" . ?✧)
+    ("\\lq" . ?‘)
+    ("\\lrcorner" . ?⌟)
+    ("\\ltimes" . ?⋉)
+    ("\\lvertneqq" . ?≨)
+    ("\\maltese" . ?✠)
+    ("\\mapsto" . ?↦)
+    ("\\measuredangle" . ?∡)
+    ("\\mho" . ?℧)
+    ("\\mid" . ?∣)
+    ("\\models" . ?⊧)
+    ("\\mp" . ?∓)
+    ("\\multimap" . ?⊸)
+    ("\\nLeftarrow" . ?⇍)
+    ("\\nLeftrightarrow" . ?⇎)
+    ("\\nRightarrow" . ?⇏)
+    ("\\nVDash" . ?⊯)
+    ("\\nVdash" . ?⊮)
+    ("\\nabla" . ?∇)
+    ("\\napprox" . ?≉)
+    ("\\natural" . ?♮)
+    ("\\ncong" . ?≇)
+    ("\\ne" . ?≠)
+    ("\\nearrow" . ?↗)
+    ("\\neg" . ?¬)
+    ("\\neq" . ?≠)
+    ("\\nequiv" . ?≢)
+    ("\\newline" . ?
)
+    ("\\nexists" . ?∄)
+    ("\\ngeq" . ?≱)
+    ("\\ngeqq" . ?≱)
+    ("\\ngeqslant" . ?≱)
+    ("\\ngtr" . ?≯)
+    ("\\ni" . ?∋)
+    ("\\nleftarrow" . ?↚)
+    ("\\nleftrightarrow" . ?↮)
+    ("\\nleq" . ?≰)
+    ("\\nleqq" . ?≰)
+    ("\\nleqslant" . ?≰)
+    ("\\nless" . ?≮)
+    ("\\nmid" . ?∤)
+    ;; ("\\not" ?̸)              ;FIXME: conflict with "NOT SIGN" ¬.
+    ("\\notin" . ?∉)
+    ("\\nparallel" . ?∦)
+    ("\\nprec" . ?⊀)
+    ("\\npreceq" . ?⋠)
+    ("\\nrightarrow" . ?↛)
+    ("\\nshortmid" . ?∤)
+    ("\\nshortparallel" . ?∦)
+    ("\\nsim" . ?≁)
+    ("\\nsimeq" . ?≄)
+    ("\\nsubset" . ?⊄)
+    ("\\nsubseteq" . ?⊈)
+    ("\\nsubseteqq" . ?⊈)
+    ("\\nsucc" . ?⊁)
+    ("\\nsucceq" . ?⋡)
+    ("\\nsupset" . ?⊅)
+    ("\\nsupseteq" . ?⊉)
+    ("\\nsupseteqq" . ?⊉)
+    ("\\ntriangleleft" . ?⋪)
+    ("\\ntrianglelefteq" . ?⋬)
+    ("\\ntriangleright" . ?⋫)
+    ("\\ntrianglerighteq" . ?⋭)
+    ("\\nvDash" . ?⊭)
+    ("\\nvdash" . ?⊬)
+    ("\\nwarrow" . ?↖)
+    ("\\odot" . ?⊙)
+    ("\\oint" . ?∮)
+    ("\\ominus" . ?⊖)
+    ("\\oplus" . ?⊕)
+    ("\\oslash" . ?⊘)
+    ("\\otimes" . ?⊗)
+    ("\\par" . ?
)
+    ("\\parallel" . ?∥)
+    ("\\partial" . ?∂)
+    ("\\perp" . ?⊥)
+    ("\\pitchfork" . ?⋔)
+    ("\\prec" . ?≺)
+    ("\\precapprox" . ?≾)
+    ("\\preceq" . ?≼)
+    ("\\precnapprox" . ?⋨)
+    ("\\precnsim" . ?⋨)
+    ("\\precsim" . ?≾)
+    ("\\prime" . ?′)
+    ("\\prod" . ?∏)
+    ("\\propto" . ?∝)
+    ("\\qed" . ?∎)
+    ("\\quad" . ? )
+    ("\\rangle" . 10217)            ; Literal ?⟩ breaks indentation.
+    ("\\rbrace" . ?})
+    ("\\rbrack" . ?\])
+    ("\\rceil" . ?⌉)
+    ("\\rfloor" . ?⌋)
+    ("\\rightarrow" . ?→)
+    ("\\rightarrowtail" . ?↣)
+    ("\\rightharpoondown" . ?⇁)
+    ("\\rightharpoonup" . ?⇀)
+    ("\\rightleftarrows" . ?⇄)
+    ("\\rightleftharpoons" . ?⇌)
+    ;; ("\\rightparengtr" ?⦔) ;; Was ?〉, see bug#12948.
+    ("\\rightrightarrows" . ?⇉)
+    ("\\rightthreetimes" . ?⋌)
+    ("\\risingdotseq" . ?≓)
+    ("\\rtimes" . ?⋊)
+    ("\\sbs" . ?﹨)
+    ("\\searrow" . ?↘)
+    ("\\setminus" . ?∖)
+    ("\\sharp" . ?♯)
+    ("\\shortmid" . ?∣)
+    ("\\shortparallel" . ?∥)
+    ("\\sim" . ?∼)
+    ("\\simeq" . ?≃)
+    ("\\smallamalg" . ?∐)
+    ("\\smallsetminus" . ?∖)
+    ("\\smallsmile" . ?⌣)
+    ("\\smile" . ?⌣)
+    ("\\spadesuit" . ?♠)
+    ("\\sphericalangle" . ?∢)
+    ("\\sqcap" . ?⊓)
+    ("\\sqcup" . ?⊔)
+    ("\\sqsubset" . ?⊏)
+    ("\\sqsubseteq" . ?⊑)
+    ("\\sqsupset" . ?⊐)
+    ("\\sqsupseteq" . ?⊒)
+    ("\\square" . ?□)
+    ("\\squigarrowright" . ?⇝)
+    ("\\star" . ?⋆)
+    ("\\straightphi" . ?φ)
+    ("\\subset" . ?⊂)
+    ("\\subseteq" . ?⊆)
+    ("\\subseteqq" . ?⊆)
+    ("\\subsetneq" . ?⊊)
+    ("\\subsetneqq" . ?⊊)
+    ("\\succ" . ?≻)
+    ("\\succapprox" . ?≿)
+    ("\\succcurlyeq" . ?≽)
+    ("\\succeq" . ?≽)
+    ("\\succnapprox" . ?⋩)
+    ("\\succnsim" . ?⋩)
+    ("\\succsim" . ?≿)
+    ("\\sum" . ?∑)
+    ("\\supset" . ?⊃)
+    ("\\supseteq" . ?⊇)
+    ("\\supseteqq" . ?⊇)
+    ("\\supsetneq" . ?⊋)
+    ("\\supsetneqq" . ?⊋)
+    ("\\surd" . ?√)
+    ("\\swarrow" . ?↙)
+    ("\\therefore" . ?∴)
+    ("\\thickapprox" . ?≈)
+    ("\\thicksim" . ?∼)
+    ("\\to" . ?→)
+    ("\\top" . ?⊤)
+    ("\\triangle" . ?▵)
+    ("\\triangledown" . ?▿)
+    ("\\triangleleft" . ?◃)
+    ("\\trianglelefteq" . ?⊴)
+    ("\\triangleq" . ?≜)
+    ("\\triangleright" . ?▹)
+    ("\\trianglerighteq" . ?⊵)
+    ("\\twoheadleftarrow" . ?↞)
+    ("\\twoheadrightarrow" . ?↠)
+    ("\\ulcorner" . ?⌜)
+    ("\\uparrow" . ?↑)
+    ("\\updownarrow" . ?↕)
+    ("\\upleftharpoon" . ?↿)
+    ("\\uplus" . ?⊎)
+    ("\\uprightharpoon" . ?↾)
+    ("\\upuparrows" . ?⇈)
+    ("\\urcorner" . ?⌝)
+    ("\\u{i}" . ?ĭ)
+    ("\\vDash" . ?⊨)
+    ("\\varprime" . ?′)
+    ("\\varpropto" . ?∝)
+    ;; ("\\varsigma" ?ς)               ;FIXME: Looks reversed with the non\var.
+    ("\\vartriangleleft" . ?⊲)
+    ("\\vartriangleright" . ?⊳)
+    ("\\vdash" . ?⊢)
+    ("\\vdots" . ?⋮)
+    ("\\vee" . ?∨)
+    ("\\veebar" . ?⊻)
+    ("\\vert" . ?|)
+    ("\\wedge" . ?∧)
+    ("\\wp" . ?℘)
+    ("\\wr" . ?≀)
+    ("\\Bbb{N}" . ?ℕ)                  ; AMS commands for blackboard bold
+    ("\\Bbb{P}" . ?ℙ)                  ; Also sometimes \mathbb.
+    ("\\Bbb{R}" . ?ℝ)
+    ("\\Bbb{Z}" . ?ℤ)
+    ("--" . ?–)
+    ("---" . ?—)
+    ("\\ordfeminine" . ?ª)
+    ("\\ordmasculine" . ?º)
+    ("\\lambdabar" . ?ƛ)
+    ("\\celsius" . ?℃)
+    ("\\textmu" . ?µ)
+    ("\\textfractionsolidus" . ?⁄)
+    ("\\textbigcircle" . ?⃝)
+    ("\\textmusicalnote" . ?♪)
+    ("\\textdied" . ?✝)
+    ("\\textcolonmonetary" . ?₡)
+    ("\\textwon" . ?₩)
+    ("\\textnaira" . ?₦)
+    ("\\textpeso" . ?₱)
+    ("\\textlira" . ?₤)
+    ("\\textrecipe" . ?℞)
+    ("\\textinterrobang" . ?‽)
+    ("\\textpertenthousand" . ?‱)
+    ("\\textbaht" . ?฿)
+    ("\\textnumero" . ?№)
+    ("\\textdiscount" . ?⁒)
+    ("\\textestimated" . ?℮)
+    ("\\textopenbullet" . ?◦)
+    ("\\textlquill" . 8261)            ; Literal ?⁅ breaks indentation.
+    ("\\textrquill" . 8262)             ; Literal ?⁆ breaks indentation.
+    ("\\textcircledP" . ?℗)
+    ("\\textreferencemark" . ?※))
+  "A `prettify-symbols-alist' usable for (La)TeX modes.")
+
+(defun tex--prettify-symbols-compose-p (start end _match)
+  (let* ((after-char (char-after end))
+         (after-syntax  (char-syntax after-char)))
+    (not (or
+          ;; Don't compose address@hidden
+          (eq after-syntax ?_)
+          ;; The \alpha in \alpha2 may be composed but of course \alphax may 
not.
+          (and (eq after-syntax ?w)
+               (or (< after-char ?0)
+                   (> after-char ?9)))))))
+
 (run-hooks 'tex-mode-load-hook)
 
 (provide 'tex-mode)
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el
index e1259ff..d08daea 100644
--- a/lisp/textmodes/texinfmt.el
+++ b/lisp/textmodes/texinfmt.el
@@ -1287,7 +1287,7 @@ Leave point after argument."
 (put 'uref 'texinfo-format 'texinfo-format-uref)
 (defun texinfo-format-uref ()
   "Format URL and optional URL-TITLE.
-Insert \\=` ... ' around URL if no URL-TITLE argument;
+Insert \\=` ... \\=' around URL if no URL-TITLE argument;
 otherwise, insert URL-TITLE followed by URL in parentheses."
   (let ((args (texinfo-format-parse-args)))
     (texinfo-discard-command)
@@ -2447,7 +2447,7 @@ Use only the FILENAME arg; for Info, ignore the other 
arguments to @image."
 ;; not lead to inserted ` ... ' in a table, but does elsewhere.
 (put 'option 'texinfo-format 'texinfo-format-option)
 (defun texinfo-format-option ()
-  "Insert \\=` ... ' around arg unless inside a table; in that case, no 
quotes."
+  "Insert \\=` ... \\=' around arg unless inside a table; in that case, no 
quotes."
   ;; `looking-at-backward' not available in v. 18.57, 20.2
   (if (not (search-backward ""    ; searched-for character is a control-H
                     (line-beginning-position)
@@ -2494,7 +2494,7 @@ Enclose the verbatim text, including the delimiters, in 
braces.  Print
 text exactly as written (but not the delimiters) in a fixed-width.
 
 For example, @verb\{|@|\} results in @ and
address@hidden@'e?\\=`!\\=`+} results in @'e?\\=`!\\=`."
address@hidden@\\='e?\\=`!\\=`+} results in @\\='e?\\=`!\\=`."
 
   (let ((delimiter (buffer-substring-no-properties
                    (1+ texinfo-command-end) (+ 2 texinfo-command-end))))
@@ -3127,7 +3127,7 @@ Default is to leave paragraph indentation as is."
 ;; (put '\` 'texinfo-format 'texinfo-format-grave-accent)
 ;; (defun texinfo-format-grave-accent ()
 ;;   (texinfo-discard-command)
-;;   (insert "\`"))
+;;   (insert "`"))
 ;;
 ;; @'              ==>    '         acute accent
 ;; (put '\' 'texinfo-format 'texinfo-format-acute-accent)
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 6b28249..2c6d5b3 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -690,7 +690,7 @@ Puts point on a blank line between them."
 (defun texinfo-insert-quote (&optional arg)
   "Insert the appropriate quote mark for Texinfo.
 Usually inserts the value of `texinfo-open-quote' (normally \\=`\\=`) or
-`texinfo-close-quote' (normally ''), depending on the context.
+`texinfo-close-quote' (normally \\='\\='), depending on the context.
 With prefix argument or inside @code or @example, inserts a plain \"."
   (interactive "*P")
   (let ((top (or (save-excursion (re-search-backward "@node\\>" nil t))
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index eefea1f..0ce7064 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -1407,7 +1407,7 @@ level in the Texinfo file; when looking for the 
`Previous' pointer,
 the section found will be at the same or higher hierarchical level in
 the Texinfo file; when looking for the `Up' pointer, the section found
 will be at some level higher in the Texinfo file.  The fourth argument
-\(one of 'next, 'previous, or 'up\) specifies whether to find the
+\(one of `next’, `previous’, or `up'\) specifies whether to find the
 `Next', `Previous', or `Up' pointer."
   (let ((case-fold-search t))
     (cond ((eq direction 'next)
diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index d8bb8cb..409ba7c 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -102,7 +102,7 @@ When it reaches that size (in bytes), a warning is sent."
     (or (executable-find "convert")
        "/usr/X11R6/bin/convert"))
   "Name of conversion program for thumbnails generation.
-It must be 'convert'."
+It must be \"convert\"."
   :type 'string
   :group 'thumbs)
 
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el
index 1e0fe99..b6a7340 100644
--- a/lisp/time-stamp.el
+++ b/lisp/time-stamp.el
@@ -255,7 +255,7 @@ time-stamped file itself.")
   "Update the time stamp string(s) in the buffer.
 A template in a file can be automatically updated with a new time stamp
 every time you save the file.  Add this line to your init file:
-    (add-hook 'before-save-hook 'time-stamp)
+    (add-hook \\='before-save-hook \\='time-stamp)
 or customize `before-save-hook' through Custom.
 Normally the template must appear in the first 8 lines of a file and
 look like one of the following:
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 3b00761..e9095b3 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -134,21 +134,20 @@ options:
                            (eq map (symbol-value s))
                            ;; then save this value in mapsym
                            (setq mapsym s)))))
-            (insert "The default Emacs binding for the key "
-                    (key-description key)
-                    " is the command `")
-            (insert (format "%s" db))
-            (insert "'.  "
-                    "However, your customizations have "
+            (insert
+             (format
+              "The default Emacs binding for the key %s is the command ‘%s’.  "
+              (key-description key)
+              db))
+            (insert "However, your customizations have "
                     (if cb
-                        (format "rebound it to the command `%s'" cb)
+                        (format-message "rebound it to the command ‘%s’" cb)
                       "unbound it"))
             (insert ".")
             (when mapsym
               (insert "  (For the more advanced user:"
-                      " This binding is in the keymap `"
-                      (format "%s" mapsym)
-                      "'.)"))
+                      (format-message
+                       " This binding is in the keymap ‘%s’.)" mapsym)))
             (if (string= where "")
                 (unless (keymapp db)
                   (insert "\n\nYou can use M-x "
@@ -160,9 +159,7 @@ options:
                           ""
                         "the key")
                       where
-                      " to get the function `"
-                      (format "%s" db)
-                      "'.")))
+                      (format-message " to get the function ‘%s’." db))))
           (fill-region (point-min) (point)))))
       (help-print-return-message))))
 
@@ -454,7 +451,7 @@ where
                                               (lookup-key global-map
                                                           [menu-bar]))))
                                 (stringp cwhere))
-                           (format "the `%s' menu" cwhere)
+                           (format-message "the ‘%s’ menu" cwhere)
                          "the menus"))))
            (setq where ""))
          (setq remark nil)
diff --git a/lisp/type-break.el b/lisp/type-break.el
index 5a12f02..c7043b5 100644
--- a/lisp/type-break.el
+++ b/lisp/type-break.el
@@ -803,8 +803,9 @@ this or ask the user to start one right now."
    (type-break-mode-line-message-mode)
    (t
     (beep t)
-    (message "%sYou should take a typing break now.  Do `M-x type-break'."
-             (type-break-time-stamp))
+    (message "%sYou should take a typing break now.  Do ‘%s’."
+             (type-break-time-stamp)
+             (substitute-command-keys "\\[type-break]"))
     (sit-for 1)
     (beep t)
     ;; return nil so query caller knows to reset reminder, as if user
diff --git a/lisp/uniquify.el b/lisp/uniquify.el
index ce681b4..c5692ff 100644
--- a/lisp/uniquify.el
+++ b/lisp/uniquify.el
@@ -116,20 +116,11 @@ you can set, browse the `uniquify' custom group."
                (const post-forward-angle-brackets)
                (const :tag "numeric suffixes" nil))
   :version "24.4"
-  :require 'uniquify
-  :group 'uniquify)
+  :require 'uniquify)
 
 (defcustom uniquify-after-kill-buffer-p t
   "If non-nil, rerationalize buffer names after a buffer has been killed."
-  :type 'boolean
-  :group 'uniquify)
-
-(defcustom uniquify-ask-about-buffer-names-p nil
-  "If non-nil, permit user to choose names for buffers with same base file.
-If the user chooses to name a buffer, uniquification is preempted and no
-other buffer names are changed."
-  :type 'boolean
-  :group 'uniquify)
+  :type 'boolean)
 
 ;; The default value matches certain Gnus buffers.
 (defcustom uniquify-ignore-buffers-re nil
@@ -137,13 +128,11 @@ other buffer names are changed."
 For instance, set this to \"^draft-[0-9]+$\" to avoid having uniquify rename
 draft buffers even if `uniquify-after-kill-buffer-p' is non-nil and the
 visited file name isn't the same as that of the buffer."
-  :type '(choice (const :tag "Uniquify all buffers" nil) regexp)
-  :group 'uniquify)
+  :type '(choice (const :tag "Uniquify all buffers" nil) regexp))
 
 (defcustom uniquify-min-dir-content 0
   "Minimum number of directory name components included in buffer name."
-  :type 'integer
-  :group 'uniquify)
+  :type 'integer)
 
 (defcustom uniquify-separator nil
   "String separator for buffer name components.
@@ -151,16 +140,14 @@ When `uniquify-buffer-name-style' is `post-forward', 
separates
 base file name from directory part in buffer names (default \"|\").
 When `uniquify-buffer-name-style' is `reverse', separates all
 file name components (default \"\\\")."
-  :type '(choice (const nil) string)
-  :group 'uniquify)
+  :type '(choice (const nil) string))
 
 (defcustom uniquify-trailing-separator-p nil
   "If non-nil, add a file name separator to dired buffer names.
 If `uniquify-buffer-name-style' is `forward', add the separator at the end;
 if it is `reverse', add the separator at the beginning; otherwise, this
 variable is ignored."
-  :type 'boolean
-  :group 'uniquify)
+  :type 'boolean)
 
 (defcustom uniquify-strip-common-suffix
   ;; Using it when uniquify-min-dir-content>0 doesn't make much sense.
@@ -169,8 +156,7 @@ variable is ignored."
 E.g. if you open /a1/b/c/d and /a2/b/c/d, the buffer names will say
 \"d|a1\" and \"d|a2\" instead of \"d|a1/b/c\" and \"d|a2/b/c\".
 This can be handy when you have deep parallel hierarchies."
-  :type 'boolean
-  :group 'uniquify)
+  :type 'boolean)
 
 (defvar uniquify-list-buffers-directory-modes '(dired-mode cvs-mode 
vc-dir-mode)
   "List of modes for which uniquify should obey `list-buffers-directory'.
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el
index 58bf45b..64f56f0 100644
--- a/lisp/url/url-auth.el
+++ b/lisp/url/url-auth.el
@@ -262,12 +262,12 @@ URL    is the url you are requesting authorization to.  
This can be either a
        string representing the URL, or the parsed representation returned by
        `url-generic-parse-url'
 REALM  is the realm at a specific site we are looking for.  This should be a
-       string specifying the exact realm, or nil or the symbol 'any' to
+       string specifying the exact realm, or nil or the symbol `any' to
        specify that the filename portion of the URL should be used as the
        realm
 TYPE   is the type of authentication to be returned.  This is either a string
-       representing the type (basic, digest, etc), or nil or the symbol 'any'
-       to specify that any authentication is acceptable.  If requesting 'any'
+       representing the type (basic, digest, etc), or nil or the symbol `any'
+       to specify that any authentication is acceptable.  If requesting `any'
        the strongest matching authentication will be returned.  If this is
        wrong, it's no big deal, the error from the server will specify exactly
        what type of auth to use
diff --git a/lisp/userlock.el b/lisp/userlock.el
index c47bc4c9..781023c 100644
--- a/lisp/userlock.el
+++ b/lisp/userlock.el
@@ -142,7 +142,7 @@ If you say `r' to revert, the contents of the buffer are 
refreshed
 from the file on disk.
 If you say `n', the change you started to make will be aborted.
 
-Usually, you should type `n' and then `M-x revert-buffer',
+Usually, you should type `n' and then `\\[revert-buffer]',
 to get the latest version of the file, then make the change again.")
     (with-current-buffer standard-output
       (help-mode))))
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index c90413c..e24b6cc 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -685,7 +685,7 @@ nil, by matching `change-log-version-number-regexp-list'."
 
 Optional arg FILE-NAME specifies the file to use.
 If FILE-NAME is nil, use the value of `change-log-default-name'.
-If `change-log-default-name' is nil, behave as though it were 'ChangeLog'
+If `change-log-default-name' is nil, behave as though it were \"ChangeLog\"
 \(or whatever we use on this operating system).
 
 If `change-log-default-name' contains a leading directory component, then
diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el
index d0c0f7b..b309394 100644
--- a/lisp/vc/ediff-diff.el
+++ b/lisp/vc/ediff-diff.el
@@ -1373,7 +1373,7 @@ affects only files whose names match the expression."
   ;; Normalize empty filter RE to nil.
   (unless (> (length filter-re) 0) (setq filter-re nil))
   ;; Indicate progress
-  (message "Comparing '%s' and '%s' modulo '%s'" d1 d2 filter-re)
+  (message "Comparing ‘%s’ and ‘%s’ modulo ‘%s’" d1 d2 filter-re)
   (cond
    ;; D1 & D2 directories => recurse
    ((and (file-directory-p d1)
diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el
index b17d11d..de25cba 100644
--- a/lisp/vc/emerge.el
+++ b/lisp/vc/emerge.el
@@ -3089,7 +3089,7 @@ SPC, it is ignored; if it is anything else, it is 
processed as a command."
            (let* ((echo-keystrokes 0)
                   (c (read-event)))
              (if (not (eq c 32))
-                 (setq unread-command-events (list c)))))
+                 (push c unread-command-events))))
        (erase-buffer)))))
 
 ;; Improved auto-save file names.
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index 9a41905..298bcef 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -281,8 +281,8 @@ committed and support display of sticky tags."
     (propertize
      (if (zerop (length sticky-tag))
         string
-       (setq help-echo (format "%s on the '%s' branch"
-                              help-echo sticky-tag))
+       (setq help-echo (format-message "%s on the ‘%s’ branch"
+                                       help-echo sticky-tag))
        (concat string "[" sticky-tag "]"))
      'help-echo help-echo)))
 
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index 8d6eae5..755dbc1 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -83,7 +83,7 @@ If t, use no switches."
   t                       ;`svn' doesn't support common args like -c or -b.
   "String or list of strings specifying extra switches for svn diff under VC.
 If nil, use the value of `vc-diff-switches' (or `diff-switches'),
-together with \"-x --diff-cmd=\"`diff-command' (since 'svn diff'
+together with \"-x --diff-cmd=\"`diff-command' (since `svn diff'
 does not support the default \"-c\" value of `diff-switches').
 If you want to force an empty list of arguments, use t."
   :type '(choice (const :tag "Unspecified" nil)
diff --git a/lisp/version.el b/lisp/version.el
index c0b975e..43103fd 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -41,6 +41,8 @@ This variable first existed in version 19.23.")
 (defconst emacs-build-time (current-time)
   "Time at which Emacs was dumped out.")
 
+;; I think this should be obsoleted/removed.  It's just one more meaningless
+;; difference between different builds.  It's usually not even an fqdn.
 (defconst emacs-build-system (system-name)
   "Name of the system on which Emacs was built.")
 
@@ -57,8 +59,8 @@ to the system configuration; look at `system-configuration' 
instead."
   (interactive "P")
   (let ((version-string
          (format (if (not (called-interactively-p 'interactive))
-                    "GNU Emacs %s (%s%s%s%s)\n of %s on %s"
-                  "GNU Emacs %s (%s%s%s%s) of %s on %s")
+                    "GNU Emacs %s (%s%s%s%s)\n of %s"
+                  "GNU Emacs %s (%s%s%s%s) of %s")
                  emacs-version
                 system-configuration
                 (cond ((featurep 'motif)
@@ -77,8 +79,7 @@ to the system configuration; look at `system-configuration' 
instead."
                     (format ", %s scroll bars"
                             (capitalize (symbol-name x-toolkit-scroll-bars)))
                   "")
-                (format-time-string "%Y-%m-%d" emacs-build-time)
-                 emacs-build-system)))
+                (format-time-string "%Y-%m-%d" emacs-build-time))))
     (if here
         (insert version-string)
       (if (called-interactively-p 'interactive)
diff --git a/lisp/wdired.el b/lisp/wdired.el
index c72e134..0c113b3 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -494,8 +494,8 @@ non-nil means return old filename."
                                        overwrite))
                 (error
                  (setq errors (1+ errors))
-                 (dired-log (concat "Rename `" file-ori "' to `"
-                                    file-new "' failed:\n%s\n")
+                 (dired-log "Rename ‘%s’ to ‘%s’ failed:\n%s\n"
+                            file-ori file-new
                             err)))))))))
     errors))
 
@@ -651,8 +651,8 @@ If OLD, return the old target.  If MOVE, move point before 
it."
                (substitute-in-file-name link-to-new) link-from))
           (error
            (setq errors (1+ errors))
-           (dired-log (concat "Link `" link-from "' to `"
-                              link-to-new "' failed:\n%s\n")
+           (dired-log "Link ‘%s’ to ‘%s’ failed:\n%s\n"
+                      link-from link-to-new
                       err)))))
     (cons changes errors)))
 
@@ -837,11 +837,11 @@ Like original function but it skips read-only words."
               (unless (equal 0 (process-file dired-chmod-program
                                             nil nil nil perm-tmp filename))
                 (setq errors (1+ errors))
-                (dired-log (concat dired-chmod-program " " perm-tmp
-                                   " `" filename "' failed\n\n"))))
+                (dired-log "%s %s ‘%s’ failed\n\n"
+                           dired-chmod-program perm-tmp filename)))
           (setq errors (1+ errors))
-          (dired-log (concat "Cannot parse permission `" perms-new
-                             "' for file `" filename "'\n\n"))))
+          (dired-log "Cannot parse permission ‘%s’ for file ‘%s’\n\n"
+                     perms-new filename)))
       (goto-char (next-single-property-change (1+ (point)) prop-wanted
                                              nil (point-max))))
     (cons changes errors)))
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index a1a6c3c..ddc37f1 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1866,9 +1866,11 @@ cleaning up these problems."
              (whitespace-insert-value ws-tab-width)
              (when has-bogus
                (goto-char (point-max))
-               (insert " Type `M-x whitespace-cleanup'"
+               (insert (substitute-command-keys
+                         " Type ‘\\[whitespace-cleanup]’")
                        " to cleanup the buffer.\n\n"
-                       " Type `M-x whitespace-cleanup-region'"
+                       (substitute-command-keys
+                         " Type ‘\\[whitespace-cleanup-region]’")
                        " to cleanup a region.\n\n"))
              (whitespace-display-window (current-buffer)))))
        has-bogus))))
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index f7d8964..0c8f4af 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -241,7 +241,7 @@ minibuffer."
             (while items
               (setq choice (pop items))
               (when (consp choice)
-                 (let* ((name (car choice))
+                 (let* ((name (substitute-command-keys (car choice)))
                         (function (cdr choice)))
                    (insert (format "%c = %s\n" next-digit name))
                    (define-key map (vector next-digit) function)
@@ -1503,7 +1503,8 @@ The value of the :type attribute should be an unconverted 
widget type."
                  (insert-char ?\s (widget-get widget :indent))))
               ((eq escape ?t)
                (let ((image (widget-get widget :tag-glyph))
-                     (tag (widget-get widget :tag)))
+                     (tag (substitute-command-keys
+                           (widget-get widget :tag))))
                  (cond (image
                         (widget-image-insert widget (or tag "image") image))
                        (tag
@@ -1515,7 +1516,7 @@ The value of the :type attribute should be an unconverted 
widget type."
                (let ((doc (widget-get widget :doc)))
                  (when doc
                    (setq doc-begin (point))
-                   (insert doc)
+                   (insert (substitute-command-keys doc))
                    (while (eq (preceding-char) ?\n)
                      (delete-char -1))
                    (insert ?\n)
@@ -1675,7 +1676,7 @@ as the argument to `documentation-property'."
                   (cond ((functionp doc-prop)
                          (funcall doc-prop value))
                         ((symbolp doc-prop)
-                         (documentation-property value doc-prop)))))))
+                         (documentation-property value doc-prop t)))))))
     (when (and (stringp doc) (> (length doc) 0))
       ;; Remove any redundant `*' in the beginning.
       (when (eq (aref doc 0) ?*)
@@ -1759,7 +1760,7 @@ If END is omitted, it defaults to the length of LIST."
 
 (defun widget-push-button-value-create (widget)
   "Insert text representing the `on' and `off' states."
-  (let* ((tag (or (widget-get widget :tag)
+  (let* ((tag (or (substitute-command-keys (widget-get widget :tag))
                  (widget-get widget :value)))
         (tag-glyph (widget-get widget :tag-glyph))
         (text (concat widget-push-button-prefix
@@ -2167,7 +2168,8 @@ when he invoked the menu."
 (defun widget-toggle-value-create (widget)
   "Insert text representing the `on' and `off' states."
   (let* ((val (widget-value widget))
-        (text (widget-get widget (if val :on :off)))
+        (text (substitute-command-keys
+               (widget-get widget (if val :on :off))))
         (img (widget-image-find
               (widget-get widget (if val :on-glyph :off-glyph)))))
     (widget-image-insert widget (or text "")
@@ -2914,7 +2916,7 @@ link for that string."
 
 (defun widget-documentation-string-value-create (widget)
   ;; Insert documentation string.
-  (let ((doc (widget-value widget))
+  (let ((doc (substitute-command-keys (widget-value widget)))
        (indent (widget-get widget :indent))
        (shown (widget-get (widget-get widget :parent) :documentation-shown))
        (start (point)))
@@ -3704,9 +3706,9 @@ example:
        (widget-value-set ',(widget-get widget :parent) color)
        (let* ((buf (get-buffer "*Colors*"))
               (win (get-buffer-window buf 0)))
-         (bury-buffer buf)
-         (and win (> (length (window-list)) 1)
-              (delete-window win)))
+         (if win
+             (quit-window nil win)
+           (bury-buffer buf)))
        (pop-to-buffer ,(current-buffer))))))
 
 (defun widget-color-sample-face-get (widget)
diff --git a/lisp/window.el b/lisp/window.el
index 238e53c..65b4ef0 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2299,8 +2299,8 @@ selected frame and no others."
 (defun get-buffer-window-list (&optional buffer-or-name minibuf all-frames)
   "Return list of all windows displaying BUFFER-OR-NAME, or nil if none.
 BUFFER-OR-NAME may be a buffer or the name of an existing buffer
-and defaults to the current buffer.  Windows are scanned starting
-with the selected window.
+and defaults to the current buffer.  If the selected window displays
+BUFFER-OR-NAME, it will be the first in the resulting list.
 
 MINIBUF t means include the minibuffer window even if the
 minibuffer is not active.  MINIBUF nil or omitted means include
@@ -3160,7 +3160,7 @@ move it as far as possible in the desired direction."
   (let* ((frame (window-frame window))
         (minibuffer-window (minibuffer-window frame))
         (right window)
-        left this-delta min-delta max-delta ignore)
+        left first-left first-right this-delta min-delta max-delta ignore)
 
     (unless pixelwise
       (setq pixelwise t)
@@ -3188,6 +3188,7 @@ move it as far as possible in the desired direction."
      (t
       ;; Set LEFT to the first resizable window on the left.  This step is
       ;; needed to handle fixed-size windows.
+      (setq first-left left)
       (while (and left
                  (or (window-size-fixed-p left horizontal)
                      (and (< delta 0)
@@ -3200,8 +3201,10 @@ move it as far as possible in the desired direction."
                                (not (window-combined-p left horizontal))))
                    (window-left left)))))
       (unless left
+       ;; We have to resize a size-preserved window.  Start again with
+       ;; the window initially on the left.
        (setq ignore 'preserved)
-       (setq left window)
+       (setq left first-left)
        (while (and left
                    (or (window-size-fixed-p left horizontal 'preserved)
                        (<= (window-size left horizontal t)
@@ -3220,6 +3223,7 @@ move it as far as possible in the desired direction."
 
       ;; Set RIGHT to the first resizable window on the right.  This step
       ;; is needed to handle fixed-size windows.
+      (setq first-right right)
       (while (and right
                  (or (window-size-fixed-p right horizontal)
                      (and (> delta 0)
@@ -3232,12 +3236,14 @@ move it as far as possible in the desired direction."
                                (not (window-combined-p right horizontal))))
                    (window-right right)))))
       (unless right
+       ;; We have to resize a size-preserved window.  Start again with
+       ;; the window initially on the right.
        (setq ignore 'preserved)
-       (setq right (window-right window))
+       (setq right first-right)
        (while (and right
                    (or (window-size-fixed-p right horizontal 'preserved))
                    (<= (window-size right horizontal t)
-                       (window-min-size right horizontal nil t)))
+                       (window-min-size right horizontal 'preserved t)))
          (setq right
                (or (window-right right)
                    (progn
@@ -3422,6 +3428,134 @@ WINDOW pixelwise."
    (- (window-min-delta window t nil nil nil nil window-resize-pixelwise))
    t nil window-resize-pixelwise))
 
+;;; Window edges
+(defun window-edges (&optional window body absolute pixelwise)
+  "Return a list of the edge distances of WINDOW.
+WINDOW must be a valid window and defaults to the selected one.
+The list returned has the form (LEFT TOP RIGHT BOTTOM).
+
+If the optional argument BODY is nil, this means to return the
+edges corresponding to the total size of WINDOW.  BODY non-nil
+means to return the edges of WINDOW's body (aka text area).  If
+BODY is non-nil, WINDOW must specify a live window.
+
+Optional argument ABSOLUTE nil means to return edges relative to
+the position of WINDOW's native frame.  ABSOLUTE non-nil means to
+return coordinates relative to the origin - the position (0, 0) -
+of FRAME's display.  On non-graphical systems this argument has
+no effect.
+
+Optional argument PIXELWISE nil means to return the coordinates
+in terms of the canonical character width and height of WINDOW's
+frame, rounded if necessary.  PIXELWISE non-nil means to return
+the coordinates in pixels where the values for RIGHT and BOTTOM
+are one more than the actual value of these edges.  Note that if
+ABSOLUTE is non-nil, PIXELWISE is implicitly non-nil too."
+  (let* ((window (window-normalize-window window body))
+        (frame (window-frame window))
+        (border-width (frame-border-width frame))
+        (char-width (frame-char-width frame))
+        (char-height (frame-char-height frame))
+        (left (if pixelwise
+                  (+ (window-pixel-left window) border-width)
+                (+ (window-left-column window)
+                   (/ border-width char-width))))
+        (left-body
+         (when body
+           (+ (window-pixel-left window) border-width
+              (if (eq (car (window-current-scroll-bars window)) 'left)
+                  (window-scroll-bar-width window)
+                0)
+              (nth 0 (window-fringes window))
+              (* (or (nth 0 (window-margins window)) 0) char-width))))
+        (top (if pixelwise
+                 (+ (window-pixel-top window) border-width)
+               (+ (window-top-line window)
+                  (/ border-width char-height))))
+        (top-body
+         (when body
+           (+ (window-pixel-top window) border-width
+              (window-header-line-height window))))
+        (right (+ left (if pixelwise
+                           (window-pixel-width window)
+                         (window-total-width window))))
+        (right-body (and body (+ left-body (window-body-width window t))))
+        (bottom (+ top (if pixelwise
+                           (window-pixel-height window)
+                         (window-total-height window))))
+        (bottom-body (and body (+ top-body (window-body-height window t))))
+        left-off right-off)
+    (if absolute
+       (let* ((native-edges (frame-edges frame 'native-edges))
+              (left-off (nth 0 native-edges))
+              (top-off (nth 1 native-edges)))
+             (if body
+                 (list (+ left-body left-off) (+ top-body top-off)
+                       (+ right-body left-off) (+ bottom-body top-off))
+               (list (+ left left-off) (+ top top-off)
+                     (+ right left-off) (+ bottom top-off))))
+      (if body
+         (if pixelwise
+             (list left-body top-body right-body bottom-body)
+           (list (/ left-body char-width) (/ top-body char-height)
+                 ;; Round up.
+                 (/ (+ right-body char-width -1) char-width)
+                 (/ (+ bottom-body char-height -1) char-height)))
+       (list left top right bottom)))))
+
+(defun window-body-edges (&optional window)
+  "Return a list of the edge coordinates of WINDOW's body.
+The return value is that of `window-edges' called with argument
+BODY non-nil."
+  (window-edges window t))
+(defalias 'window-inside-edges 'window-body-edges)
+
+(defun window-pixel-edges (&optional window)
+  "Return a list of the edge pixel coordinates of WINDOW.
+The return value is that of `window-edges' called with argument
+PIXELWISE non-nil."
+  (window-edges window nil nil t))
+
+(defun window-body-pixel-edges (&optional window)
+  "Return a list of the edge pixel coordinates of WINDOW's body.
+The return value is that of `window-edges' called with arguments
+BODY and PIXELWISE non-nil."
+  (window-edges window t nil t))
+(defalias 'window-inside-pixel-edges 'window-body-pixel-edges)
+
+(defun window-absolute-pixel-edges (&optional window)
+  "Return a list of the edge pixel coordinates of WINDOW.
+The return value is that of `window-edges' called with argument
+ABSOLUTE non-nil."
+  (window-edges window nil t t))
+
+(defun window-absolute-body-pixel-edges (&optional window)
+  "Return a list of the edge pixel coordinates of WINDOW's text area.
+The return value is that of `window-edges' called with arguments
+BODY and ABSOLUTE non-nil."
+  (window-edges window t t t))
+(defalias 'window-inside-absolute-pixel-edges 
'window-absolute-body-pixel-edges)
+
+(defun window-absolute-pixel-position (&optional position window)
+  "Return display coordinates of POSITION in WINDOW.
+If the buffer position POSITION is visible in window WINDOW,
+return the display coordinates of the upper/left corner of the
+glyph at POSITION.  The return value is a cons of the X- and
+Y-coordinates of that corner, relative to an origin at (0, 0) of
+WINDOW's display.  Return nil if POSITION is not visible in
+WINDOW.
+
+WINDOW must be a live window and defaults to the selected window.
+POSITION defaults to the value of `window-point' of WINDOW."
+  (let* ((window (window-normalize-window window t))
+        (pos-in-window
+         (pos-visible-in-window-p
+          (or position (window-point window)) window t)))
+    (when pos-in-window
+      (let ((edges (window-absolute-body-pixel-edges window)))
+       (cons (+ (nth 0 edges) (nth 0 pos-in-window))
+             (+ (nth 1 edges) (nth 1 pos-in-window)))))))
+
 (defun frame-root-window-p (window)
   "Return non-nil if WINDOW is the root window of its frame."
   (eq window (frame-root-window window)))
@@ -5468,18 +5602,18 @@ windows can get as small as `window-safe-min-height' and
 (defun display-buffer-record-window (type window buffer)
   "Record information for window used by `display-buffer'.
 TYPE specifies the type of the calling operation and must be one
-of the symbols 'reuse (when WINDOW existed already and was
-reused for displaying BUFFER), 'window (when WINDOW was created
-on an already existing frame), or 'frame (when WINDOW was
+of the symbols `reuse' (when WINDOW existed already and was
+reused for displaying BUFFER), `window' (when WINDOW was created
+on an already existing frame), or `frame' (when WINDOW was
 created on a new frame).  WINDOW is the window used for or created
 by the `display-buffer' routines.  BUFFER is the buffer that
 shall be displayed.
 
 This function installs or updates the quit-restore parameter of
 WINDOW.  The quit-restore parameter is a list of four elements:
-The first element is one of the symbols 'window, 'frame, 'same or
-'other.  The second element is either one of the symbols 'window
-or 'frame or a list whose elements are the buffer previously
+The first element is one of the symbols `window', `frame', `same' or
+`other'.  The second element is either one of the symbols `window'
+or `frame' or a list whose elements are the buffer previously
 shown in the window, that buffer's window start and window point,
 and the window's height.  The third element is the window
 selected at the time the parameter was created.  The fourth
@@ -6244,6 +6378,7 @@ The actual non-nil value of this variable will be copied 
to the
           (const display-buffer-at-bottom)
           (const display-buffer-in-previous-window)
           (const display-buffer-use-some-window)
+          (const display-buffer-use-some-frame)
           (function :tag "Other function"))
   "Custom type for `display-buffer' action functions.")
 
@@ -6388,6 +6523,7 @@ Available action functions include:
  `display-buffer-pop-up-window'
  `display-buffer-in-previous-window'
  `display-buffer-use-some-window'
+ `display-buffer-use-some-frame'
 
 Recognized alist entries include:
 
@@ -6490,7 +6626,7 @@ its documentation for additional customization 
information."
 
 (defun display-buffer-use-some-frame (buffer alist)
   "Display BUFFER in an existing frame that meets a predicate
-(by default any frame other than the current frame).  If
+\(by default any frame other than the current frame).  If
 successful, return the window used; otherwise return nil.
 
 If ALIST has a non-nil `inhibit-switch-frame' entry, avoid
@@ -6499,8 +6635,12 @@ raising the frame.
 If ALIST has a non-nil `frame-predicate' entry, its value is a
 function taking one argument (a frame), returning non-nil if the
 frame is a candidate; this function replaces the default
-predicate."
-  (let* ((predicate (or (cdr (assoc 'frame-predicate alist))
+predicate.
+
+If ALIST has a non-nil `inhibit-same-window' entry, avoid using
+the currently selected window (only useful with a frame-predicate
+that allows the selected frame)."
+  (let* ((predicate (or (cdr (assq 'frame-predicate alist))
                         (lambda (frame)
                           (and
                            (not (eq frame (selected-frame)))
@@ -6510,7 +6650,7 @@ predicate."
                                   (frame-first-window frame)))))
                           )))
          (frame (car (filtered-frame-list predicate)))
-         (window (and frame (get-lru-window frame))))
+         (window (and frame (get-lru-window frame nil (cdr (assq 
'inhibit-same-window alist))))))
     (when window
       (prog1
           (window--display-buffer
diff --git a/lisp/woman.el b/lisp/woman.el
index 75c3d2e..e903caa 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1651,7 +1651,7 @@ Do not call directly!"
             (setq woman-frame (make-frame)))))
     (set-buffer (get-buffer-create bufname))
     (condition-case nil
-        (switch-to-buffer (current-buffer))
+        (display-buffer (current-buffer))
       (error (pop-to-buffer (current-buffer))))
     (buffer-disable-undo)
     (setq buffer-read-only nil)
@@ -2061,14 +2061,14 @@ alist in `woman-buffer-alist' and return nil."
   (if (zerop woman-buffer-number)
       (let ((buffer (get-buffer (cdr (car woman-buffer-alist)))))
        (if buffer
-           (switch-to-buffer buffer)
+           (display-buffer buffer)
          ;; Delete alist element:
          (setq woman-buffer-alist (cdr woman-buffer-alist))
          nil))
     (let* ((prev-ptr (nthcdr (1- woman-buffer-number) woman-buffer-alist))
           (buffer (get-buffer (cdr (car (cdr prev-ptr))))))
       (if buffer
-         (switch-to-buffer buffer)
+         (display-buffer buffer)
        ;; Delete alist element:
        (setcdr prev-ptr (cdr (cdr prev-ptr)))
        (if (>= woman-buffer-number (length woman-buffer-alist))
diff --git a/lisp/xml.el b/lisp/xml.el
index b3dce41..f5a9a3f 100644
--- a/lisp/xml.el
+++ b/lisp/xml.el
@@ -326,8 +326,8 @@ URIs, and expanded names will be returned as a cons
 If PARSE-NS is an alist, it will be used as the mapping from
 namespace to URIs instead.
 
-If it is the symbol 'symbol-qnames, expanded names will be
-returned as a plain symbol 'namespace:foo instead of a cons.
+If it is the symbol `symbol-qnames', expanded names will be
+returned as a plain symbol `namespace:foo' instead of a cons.
 
 Both features can be combined by providing a cons cell
 
@@ -356,8 +356,8 @@ URIs, and expanded names will be returned as a cons
 If PARSE-NS is an alist, it will be used as the mapping from
 namespace to URIs instead.
 
-If it is the symbol 'symbol-qnames, expanded names will be
-returned as a plain symbol 'namespace:foo instead of a cons.
+If it is the symbol `symbol-qnames', expanded names will be
+returned as a plain symbol `namespace:foo' instead of a cons.
 
 Both features can be combined by providing a cons cell
 
diff --git a/make-dist b/make-dist
index 6bf01ff..79db904 100755
--- a/make-dist
+++ b/make-dist
@@ -338,7 +338,7 @@ files=`find lisp \( -name '*.el' -o -name '*.elc' -o -name 
'ChangeLog*' \
  -o -name 'README' \)`
 
 ### Don't distribute site-init.el, site-load.el, or default.el.
-for file in lisp/Makefile.in lisp/makefile.w32-in $files; do
+for file in lisp/Makefile.in $files; do
   case $file in
     */site-init*|*/site-load*|*/default*) continue ;;
   esac
@@ -347,7 +347,6 @@ done
 
 echo "Making links to 'leim' and its subdirectories"
 (cd leim
- ln makefile.w32-in ../${tempdir}/leim
  ln ChangeLog.*[0-9] README ../${tempdir}/leim
  ln CXTERM-DIC/README CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
  ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
@@ -377,7 +376,6 @@ echo "Making links to 'src'"
  ln [a-zA-Z]*.in ../${tempdir}/src
  ln deps.mk ../${tempdir}/src
  ln README ChangeLog.*[0-9] ../${tempdir}/src
- ln makefile.w32-in ../${tempdir}/src
  ln .gdbinit .dbxinit ../${tempdir}/src
  cd ../${tempdir}/src
  rm -f globals.h config.h epaths.h Makefile buildobj.h)
@@ -390,7 +388,7 @@ echo "Making links to 'lib'"
 (snippet_h=`(cd build-aux/snippet && ls *.h)`
  cd lib
  ln [a-zA-Z]*.[ch] ../${tempdir}/lib
- ln gnulib.mk Makefile.am Makefile.in makefile.w32-in ../${tempdir}/lib
+ ln gnulib.mk Makefile.am Makefile.in ../${tempdir}/lib
  cd ../${tempdir}/lib
  script='/[*]/d; s/\.in\.h$/.h/'
  rm -f `(echo "$snippet_h"; ls *.in.h) | sed "$script"`)
@@ -400,7 +398,6 @@ echo "Making links to 'lib-src'"
  ln [a-zA-Z]*.[ch] ../${tempdir}/lib-src
  ln ChangeLog.*[0-9] Makefile.in README ../${tempdir}/lib-src
  ln rcs2log ../${tempdir}/lib-src
- ln makefile.w32-in ../${tempdir}/lib-src
  ln update-game-score.exe.manifest ../${tempdir}/lib-src)
 
 echo "Making links to 'm4'"
@@ -410,11 +407,10 @@ echo "Making links to 'm4'"
 echo "Making links to 'nt'"
 (cd nt
  ln emacs-x86.manifest emacs-x64.manifest ../${tempdir}/nt
- ln config.nt emacs-src.tags ../${tempdir}/nt
- ln nmake.defs gmake.defs subdirs.el [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt
+ ln subdirs.el [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt
  ln *.in gnulib.mk ../${tempdir}/nt
  ln mingw-cfg.site epaths.nt INSTALL.OLD ../${tempdir}/nt
- ln ChangeLog.*[0-9] INSTALL README README.W32 makefile.w32-in 
../${tempdir}/nt)
+ ln ChangeLog.*[0-9] INSTALL README README.W32 ../${tempdir}/nt)
 
 echo "Making links to 'nt/inc' and its subdirectories"
 for f in `find nt/inc -type f -name '[a-z]*.h'`; do
@@ -500,23 +496,22 @@ ln `find info -type f -print` ${tempdir}/info
 
 echo "Making links to 'doc/emacs'"
 (cd doc/emacs
- ln *.texi *.in makefile.w32-in ChangeLog.*[0-9] ../../${tempdir}/doc/emacs)
+ ln *.texi *.in ChangeLog.*[0-9] ../../${tempdir}/doc/emacs)
 
 echo "Making links to 'doc/misc'"
 (cd doc/misc
- ln *.texi *.tex *.in makefile.w32-in gnus-news.el ChangeLog.*[0-9] \
+ ln *.texi *.tex *.in gnus-news.el ChangeLog.*[0-9] \
     ../../${tempdir}/doc/misc)
 
 echo "Making links to 'doc/lispref'"
 (cd doc/lispref
- ln *.texi *.in makefile.w32-in README ChangeLog.*[0-9] \
-    ../../${tempdir}/doc/lispref
+ ln *.texi *.in README ChangeLog.*[0-9] ../../${tempdir}/doc/lispref
  ln spellfile ../../${tempdir}/doc/lispref
  ln two-volume.make two-volume-cross-refs.txt ../../${tempdir}/doc/lispref)
 
 echo "Making links to 'doc/lispintro'"
 (cd doc/lispintro
- ln *.texi *.in makefile.w32-in *.eps *.pdf ../../${tempdir}/doc/lispintro
+ ln *.texi *.in *.eps *.pdf ../../${tempdir}/doc/lispintro
  ln README ChangeLog.*[0-9] ../../${tempdir}/doc/lispintro
  cd ../../${tempdir}/doc/lispintro)
 
diff --git a/nt/INSTALL.OLD b/nt/INSTALL.OLD
deleted file mode 100644
index 89e87b2..0000000
--- a/nt/INSTALL.OLD
+++ /dev/null
@@ -1,752 +0,0 @@
-                   Building and Installing Emacs on Windows
-                          (from 95 to 7 and beyond)
-
-  Copyright (C) 2001-2015 Free Software Foundation, Inc.
-  See the end of the file for license conditions.
-
-*** This method of building Emacs is no longer supported. ***
-    It may fail to produce a correctly working Emacs.
-    Do not report bugs associated with this build method.
-    Instead, follow the new instructions in INSTALL.
-
-* For the impatient
-
-  Here are the concise instructions for configuring and building the
-  native Windows binary of Emacs, for those who want to skip the
-  complex explanations and ``just do it'':
-
-  Do not use this recipe with Cygwin.  For building on Cygwin,
-  use the normal installation instructions, ../INSTALL.
-
-  Do not use these instructions with MSYS environment.  For building
-  the native Windows binary with MinGW and MSYS, follow the
-  instructions in the file INSTALL in this directory.
-
-  For building without MSYS, if you have a Cygwin or MSYS port of Bash
-  on your Path, you will be better off removing it from PATH.  (For
-  details, search for "MSYS sh.exe" below.)
-
-  1. Change to the `nt' directory (the directory of this file):
-
-       cd nt
-
-  2. Run configure.bat.
-
-  2a.If you use MSVC, set up the build environment by running the
-     SetEnv.cmd batch file from the appropriate SDK directory.  (Skip
-     this step if you are using MinGW.)  For example:
-
-       "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 
/Debug
-
-      if you are going to compile a debug version, or
-
-       "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 
/Release
-
-      if you are going to compile an optimized version.
-
-  2b.From the COMMAND.COM/CMD.EXE command prompt type:
-
-       configure
-
-     From a Unixy shell prompt:
-
-       cmd /c configure.bat
-     or
-       command.com /c configure.bat
-
-  3. Run the Make utility suitable for your environment.  If you build
-     with the Microsoft's Visual C compiler:
-
-       nmake
-
-     For the development environments based on GNU GCC (MinGW, MSYS,
-     Cygwin - but see notes about Cygwin make below), depending on how
-     Make is called, it could be:
-
-       make
-     or
-       mingw32-make
-     or
-       gnumake
-     or
-       gmake
-
-     (If you are building from Bazaar, say "make bootstrap" or "nmake
-     bootstrap" instead, and avoid using Cygwin make.)
-
-     With GNU Make, you can use the -j command-line option to have
-     Make execute several commands at once, like this:
-
-       gmake -j 2
-
-     (With versions of GNU Make before 3.82, you need also set the
-     XMFLAGS variable, like this:
-
-       gmake -j 2 XMFLAGS="-j 2"
-
-     The XMFLAGS variable overrides the default behavior of version
-     3.82 and older of GNU Make on Windows, whereby recursive Make
-     invocations reset the maximum number of simultaneous commands to
-     1.  The above command allows up to 4 simultaneous commands at
-     once in the top-level Make, and up to 3 in each one of the
-     recursive Make's.)
-
-  4. Generate the Info manuals (only if you are building out of Bazaar,
-     and if you have makeinfo.exe installed):
-
-     make info
-
-     (change "make" to "nmake" if you use MSVC).
-
-  5. Install the produced binaries:
-
-     make install
-
-  That's it!
-
-  If these short instructions somehow fail, read the rest of this
-  file.
-
-* Preliminaries
-
-  If you want to build a Cygwin port of Emacs, use the instructions in
-  the INSTALL file in the main Emacs directory (the parent of this
-  directory).  These instructions are for building a native Windows
-  binary of Emacs.
-
-  If you used WinZip to unpack the distribution, we suggest to
-  remove the files and unpack again with a different program!
-  WinZip is known to create some subtle and hard to debug problems,
-  such as converting files to DOS CR-LF format, not creating empty
-  directories, etc.  We suggest to use djtarnt.exe from the GNU FTP
-  site.  For modern formats, such as .tar.xz, we suggest bsdtar.exe
-  from the libarchive package; its precompiled Windows binaries are
-  available from this site:
-
-    http://sourceforge.net/projects/ezwinports/files/
-
-  In addition to this file, if you build a development snapshot, you
-  should also read INSTALL.REPO in the parent directory.
-
-* Supported development environments
-
-  To compile Emacs, you will need either Microsoft Visual C++ 2.0, or
-  later and nmake, or a Windows port of GCC 2.95 or later with MinGW
-  and Windows API support and a port of GNU Make.  You can use the Cygwin
-  ports of GCC, but Emacs requires the MinGW headers and libraries to
-  build (latest versions of the Cygwin toolkit, at least since v1.3.3,
-  include the MinGW headers and libraries as an integral part).
-
-  The rest of this file assumes you have a working development
-  environment.  If you just installed such an environment, try
-  building a trivial C "Hello world" program, and see if it works.  If
-  it doesn't work, resolve that problem first!  If you use Microsoft
-  Visual Studio .NET 2003, don't forget to run the VCVARS32.BAT batch
-  file from the `Bin' subdirectory of the directory where you have
-  installed VS.NET.  With other versions of MSVC, run the SetEnv.cmd
-  batch file from the `Bin' subdirectory of the directory where you
-  have the SDK installed.
-
-  If you use the MinGW port of GCC and GNU Make to build Emacs, there
-  are some compatibility issues wrt Make and the shell that is run by
-  Make, either the standard COMMAND.COM/CMD.EXE supplied with Windows
-  or sh.exe, a port of a Unixy shell.  For reference, below is a list
-  of which builds of GNU Make are known to work or not, and whether
-  they work in the presence and/or absence of sh.exe, the Cygwin port
-  of Bash.  Note that any version of Make that is compiled with Cygwin
-  will only work with Cygwin tools, due to the use of Cygwin style
-  paths.  This means Cygwin Make is unsuitable for building parts of
-  Emacs that need to invoke Emacs itself (leim and "make bootstrap",
-  for example).  Also see the Trouble-shooting section below if you
-  decide to go ahead and use Cygwin make.
-
-  In addition, using 4NT or TCC as your shell is known to fail the
-  build process, at least since 4NT version 3.01.  Use CMD.EXE, the
-  default Windows shell, instead.  MSYS sh.exe also appears to cause
-  various problems, e.g., it is known to cause failures in commands
-  like "cmd /c FOO" in the Makefiles, because it thinks "/c" is a
-  Unix-style file name that needs conversion to the Windows format.
-  If you have MSYS installed, try "make SHELL=cmd.exe" to force the
-  use of cmd.exe instead of the MSYS sh.exe.
-
-                                         sh exists     no sh
-
-    cygwin b20.1 make (3.75):            fails[1, 5]   fails[2, 5]
-    MSVC compiled gmake 3.77:            okay          okay
-    MSVC compiled gmake 3.78.1:          okay          okay
-    MSVC compiled gmake 3.79.1:          okay          okay
-    mingw32/gcc-2.92.2 make (3.77):      okay          okay[4]
-    cygwin compiled gmake 3.77:          fails[1, 5]   fails[2, 5]
-    cygwin compiled make 3.78.1:         fails[5]      fails[2, 5]
-    cygwin compiled make 3.79.1:         fails[3, 5]   fails[2?, 5]
-    cygwin compiled make 3.80:           okay[6]       fails?[7]
-    cygwin compiled make 3.81:           fails         fails?[7]
-    mingw32 compiled make 3.79.1:        okay          okay
-    mingw32 compiled make 3.80:          okay          okay[7]
-    mingw32 compiled make 3.81:          okay          okay[8]
-
-  Notes:
-
-    [1] doesn't cope with makefiles with DOS line endings, so must mount
-        emacs source with text!=binary.
-    [2] fails when needs to invoke shell commands; okay invoking gcc etc.
-    [3] requires LC_MESSAGES support to build; cannot build with early
-        versions of Cygwin.
-    [4] may fail on Windows 9X and Windows ME; if so, install Bash.
-    [5] fails when building leim due to the use of cygwin style paths.
-        May work if building emacs without leim.
-    [6] need to uncomment 3 lines in nt/gmake.defs that invoke `cygpath'
-       (look for "cygpath" near line 85 of gmake.defs).
-    [7] not recommended; please report if you try this combination.
-    [8] tested only on Windows XP.
-
-  Other compilers may work, but specific reports from people that have
-  tried suggest that the Intel C compiler (for example) may produce an
-  Emacs executable with strange filename completion behavior.  Unless
-  you would like to assist by finding and fixing the cause of any bugs
-  like this, we recommend the use of the supported compilers mentioned
-  in the previous paragraph.
-
-  You will also need a copy of the POSIX cp, rm and mv programs.  These
-  and other useful POSIX utilities can be obtained from one of several
-  projects:
-
-  * http://gnuwin32.sourceforge.net/              ( GnuWin32 )
-  * http://www.mingw.org/                         ( MinGW    )
-  * http://www.cygwin.com/                        ( Cygwin   )
-  * http://unxutils.sourceforge.net/              ( UnxUtils )
-
-  If you build Emacs on 16-bit versions of Windows (9X or ME), we
-  suggest to install the Cygwin port of Bash.  That is because the
-  native Windows shell COMMAND.COM is too limited; the Emacs build
-  procedure tries very hard to support even such limited shells, but
-  as none of the Windows developers of Emacs work on Windows 9X, we
-  cannot guarantee that it works without a more powerful shell.
-
-  Additional instructions and help for building Emacs on Windows can be
-  found at the Emacs Wiki:
-
-    http://www.emacswiki.org/cgi-bin/wiki/WThirtyTwoInstallationKit
-
-  and on these URLs:
-
-    http://ourcomments.org/Emacs/w32-build-emacs.html
-    
http://derekslager.com/blog/posts/2007/01/emacs-hack-3-compile-emacs-from-cvs-on-windows.ashx
-
-  Both of those pages were written before Emacs switched from CVS to
-  Bazaar, but the parts about building Emacs still apply in Bazaar.
-  The second URL has instructions for building with MSVC, as well as
-  with MinGW, while the first URL covers only MinGW, but has more
-  details about it.
-
-* Configuring
-
-  Configuration of Emacs is now handled by running configure.bat in the
-  `nt' subdirectory.  It will detect which compiler you have available,
-  and generate makefiles accordingly.  You can override the compiler
-  detection, and control optimization and debug settings, by specifying
-  options on the command line when invoking configure.
-
-  To configure Emacs to build with GCC or MSVC, whichever is available,
-  simply change to the `nt' subdirectory and run `configure.bat' with no
-  options.  To see what options are available, run `configure --help'.
-  Do NOT use the --no-debug option to configure.bat unless you are
-  absolutely sure the produced binaries will never need to be run under
-  a debugger.
-
-  Because of limitations of the stock Windows command shells, special
-  care is needed to pass some characters in the arguments of the
-  --cflags and --ldflags options.  Backslashes should not be used in
-  file names passed to the compiler and linker via these options.  Use
-  forward slashes instead.  If the arguments to these two options
-  include the `=' character, like when passing a -DFOO=bar preprocessor
-  option, the argument with the `=' character should be enclosed in
-  quotes, like this:
-
-    configure --cflags "-DFOO=bar"
-
-  Support for options that include the `=' character require "command
-  extensions" to be enabled.  (They are enabled by default, but your
-  system administrator could have changed that.  See "cmd /?" for
-  details.)  If command extensions are disabled, a warning message might
-  be displayed informing you that "using parameters that include the =
-  character by enclosing them in quotes will not be supported."
-
-  You may also use the --cflags and --ldflags options to pass
-  additional parameters to the compiler and linker, respectively; they
-  are frequently used to pass -I and -L flags to specify supplementary
-  include and library directories.  If a directory name includes
-  spaces, you will need to enclose it in quotes, as follows
-  -I"C:/Program Files/GnuTLS-2.10.1/include".  Note that only the
-  directory name is enclosed in quotes, not the entire argument.  Also
-  note that this functionality is only supported if command extensions
-  are available.  If command extensions are disabled and you attempt to
-  use this functionality you may see the following warning message
-  "Error in --cflags argument: ... Backslashes and quotes cannot be
-  used with --cflags.  Please use forward slashes for filenames and
-  paths (e.g. when passing directories to -I)."
-
-  N.B.  It is normal to see a few error messages output while configure
-  is running, when gcc support is being tested.  These cannot be
-  suppressed because of limitations in the Windows 9X command.com shell.
-
-  You are encouraged to look at the file config.log which shows details
-  for failed tests, after configure.bat finishes.  Any unexplained failure
-  should be investigated and perhaps reported as a bug (see the section
-  about reporting bugs in the file README in this directory and in the
-  Emacs manual).
-
-* Optional image library support
-
-  In addition to its "native" image formats (pbm and xbm), Emacs can
-  handle other image types: xpm, tiff, gif, png, jpeg and experimental
-  support for svg.
-
-  To build Emacs with support for them, the corresponding headers must
-  be in the include path when the configure script is run.  This can
-  be setup using environment variables, or by specifying --cflags
-  -I... options on the command-line to configure.bat.  The configure
-  script will report whether it was able to detect the headers.  If
-  the results of this testing appear to be incorrect, please look for
-  details in the file config.log: it will show the failed test
-  programs and compiler error messages that should explain what is
-  wrong.  (Usually, any such failures happen because some headers are
-  missing due to bad packaging of the image support libraries.)
-
-  Note that any file path passed to the compiler or linker must use
-  forward slashes; using backslashes will cause compiler warnings or
-  errors about unrecognized escape sequences.
-
-  To use the external image support, the DLLs implementing the
-  functionality must be found when Emacs first needs them, either on the
-  PATH, or in the same directory as emacs.exe.  Failure to find a
-  library is not an error; the associated image format will simply be
-  unavailable.  Note that once Emacs has determined that a library can
-  not be found, there's no way to force it to try again, other than
-  restarting.  See the variable `dynamic-library-alist' to configure the
-  expected names of the libraries.
-
-  Some image libraries have dependencies on one another, or on zlib.
-  For example, tiff support depends on the jpeg library.  If you did not
-  compile the libraries yourself, you must make sure that any dependency
-  is in the PATH or otherwise accessible and that the binaries are
-  compatible (for example, that they were built with the same compiler).
-
-  Binaries for the image libraries (among many others) can be found at
-  the GnuWin32 project.  PNG, JPEG and TIFF libraries are also
-  included with GTK, which is installed along with other Free Software
-  that requires it.  These are built with MinGW, but they can be used
-  with both GCC/MinGW and MSVC builds of Emacs.  See the info on
-  http://ourcomments.org/Emacs/w32-build-emacs.html, under "How to Get
-  Images Support", for more details about installing image support
-  libraries.  Note specifically that, due to some packaging snafus in
-  the GnuWin32-supplied image libraries, you will need to download
-  _source_ packages for some of the libraries in order to get the
-  header files necessary for building Emacs with image support.
-
-  If GTK 2.0 is installed, addpm will arrange for its image libraries
-  to be on the DLL search path for Emacs.
-
-  For PNG images, we recommend to use versions 1.4.x and later of
-  libpng, because previous versions had security issues.  You can find
-  precompiled libraries and headers on the GTK download page for
-  Windows (http://www.gtk.org/download/win32.php).
-
-  Versions 1.4.0 and later of libpng are binary incompatible with
-  earlier versions, so Emacs will only look for libpng libraries which
-  are compatible with the version it was compiled against.  That
-  version is given by the value of the Lisp variable `libpng-version';
-  e.g., 10403 means version 1.4.3.  The variable `dynamic-library-alist'
-  is automatically set to name only those DLL names that are known to
-  be compatible with the version given by `libpng-version'.  If PNG
-  support does not work for you even though you have the support DLL
-  installed, check the name of the installed DLL against
-  `dynamic-library-alist' and the value of `libpng-version', and
-  download compatible DLLs if needed.
-
-* Optional GnuTLS support
-
-  If configure.bat finds the gnutls/gnutls.h file in the include path,
-  Emacs is built with GnuTLS support by default; to avoid that you can
-  pass the argument --without-gnutls.
-
-  In order to support GnuTLS at runtime, a GnuTLS-enabled Emacs must
-  be able to find the relevant DLLs during startup; failure to do so
-  is not an error, but GnuTLS won't be available to the running
-  session.
-
-  You can get pre-built binaries (including any required DLL and the
-  header files) at http://sourceforge.net/projects/ezwinports/files/.
-
-* Optional libxml2 support
-
-  If configure.bat finds the libxml/HTMLparser.h file in the include path,
-  Emacs is built with libxml2 support by default; to avoid that you can
-  pass the argument --without-libxml2.
-
-  In order to support libxml2 at runtime, a libxml2-enabled Emacs must
-  be able to find the relevant DLLs during startup; failure to do so
-  is not an error, but libxml2 features won't be available to the
-  running session.
-
-  One place where you can get pre-built Windows binaries of libxml2
-  (including any required DLL and the header files) is here:
-
-     http://sourceforge.net/projects/ezwinports/files/
-
-  To compile Emacs with libxml2 from that site, you will need to pass
-  the "--cflags -I/path/to/include/libxml2" option to configure.bat,
-  because libxml2 header files are installed in the include/libxml2
-  subdirectory of the directory where you unzip the binary
-  distribution.  Other binary distributions might use other
-  directories, although include/libxml2 is the canonical place where
-  libxml2 headers are installed on Posix platforms.
-
-  You will also need to install the libiconv "development" tarball,
-  because the libiconv headers need to be available to the compiler
-  when you compile with libxml2 support.  A MinGW port of libiconv can
-  be found on the MinGW site:
-
-   http://sourceforge.net/projects/mingw/files/MinGW/Base/libiconv/
-
-  You need the libiconv-X.Y.Z-N-mingw32-dev.tar.lzma tarball from that
-  site.
-
-* Experimental SVG support
-
-  SVG support is currently experimental, and not built by default.
-  Specify --with-svg and ensure you have all the dependencies in your
-  include path.  Unless you have built a minimalist librsvg yourself
-  (untested), librsvg depends on a significant chunk of GTK+ to build,
-  plus a few Gnome libraries, libxml2, libbz2 and zlib at runtime.  The
-  easiest way to obtain the dependencies required for building is to
-  download a pre-bundled GTK+ development environment for Windows.
-  GTK puts its header files all over the place, so you will need to
-  run pkgconfig to list the include path you will need (either passed
-  to configure.bat as --cflags options, or set in the environment).
-
-  To use librsvg at runtime, ensure that librsvg and its dependencies
-  are on your PATH.  If you didn't build librsvg yourself, you will
-  need to check with where you downloaded it from for the
-  dependencies, as there are different build options.  If it is a
-  short list, then it most likely only lists the immediate
-  dependencies of librsvg, but the dependencies themselves have
-  dependencies - so don't download individual libraries from GTK+,
-  download and install the whole thing.  If you think you've got all
-  the dependencies and SVG support is still not working, check your
-  PATH for other libraries that shadow the ones you downloaded.
-  Libraries of the same name from different sources may not be
-  compatible, this problem was encountered with libbzip2 from GnuWin32
-  with libcroco from gnome.org.
-
-  If you can see etc/images/splash.svg, then you have managed to get
-  SVG support working.  Congratulations for making it through DLL hell
-  to this point.  You'll probably find that some SVG images crash
-  Emacs.  Problems have been observed in some images that contain
-  text, they seem to be a problem in the Windows port of Pango, or
-  maybe a problem with the way Cairo or librsvg is using it that
-  doesn't show up on other platforms.
-
-* Optional extra runtime checks
-
-  The configure.bat option --enable-checking builds Emacs with some
-  optional extra runtime checks and assertions enabled.  This may be
-  useful for debugging.
-
-* Optional extra libraries
-
-  You can pass --lib LIBNAME option to configure.bat to cause Emacs to
-  link with the specified library.  You can use this option more than once.
-
-* Building
-
-  After running configure, simply run the appropriate `make' program for
-  your compiler to build Emacs.  For MSVC, this is nmake; for GCC, it is
-  GNU make.  (If you are building out of Bazaar, say "make bootstrap" or
-  "nmake bootstrap" instead.)
-
-  As the files are compiled, you will see some warning messages
-  declaring that some functions don't return a value, or that some data
-  conversions will be lossy, etc.  You can safely ignore these messages.
-  The warnings may be fixed in the main FSF source at some point, but
-  until then we will just live with them.
-
-  With GNU Make, you can use the -j command-line option to have Make
-  execute several commands at once, like this:
-
-    gmake -j 4 XMFLAGS="-j 3"
-
-  The XMFLAGS variable overrides the default behavior of GNU Make on
-  Windows, whereby recursive Make invocations reset the maximum number
-  of simultaneous commands to 1.  The above command allows up to 4
-  simultaneous commands at once in the top-level Make, and up to 3 in
-  each one of the recursive Make's; you can use other numbers of jobs,
-  if you wish.
-
-  If you are building from Bazaar, the following commands will produce
-  the Info manuals (which are not part of the Bazaar sources):
-
-    make info
-  or
-    nmake info
-
-  Note that you will need makeinfo.exe (from the GNU Texinfo package)
-  in order for this command to succeed.
-
-* Installing
-
-  To install Emacs after it has compiled, simply run `nmake install'
-  or `make install', depending on which version of the Make utility
-  do you have.
-
-  By default, Emacs will be installed in the location where it was
-  built, but a different location can be specified either using the
-  --prefix option to configure, or by setting INSTALL_DIR when running
-  make, like so:
-
-     make install INSTALL_DIR=D:/emacs
-
-  (for `nmake', type "nmake install INSTALL_DIR=D:/emacs" instead).
-
-  The install process will run addpm to setup the registry entries, and
-  to create a Start menu icon for Emacs.
-
-* Make targets
-
-  The following make targets may be used by users building the source
-  distribution, or users who have checked out of Bazaar after
-  an initial bootstrapping.
-
-  make
-  Builds Emacs from the available sources and pre-compiled lisp files.
-
-  make install
-  Installs programs to the bin directory, and runs addpm to create
-  Start Menu icons.
-
-  make clean
-  Removes object and executable files produced by the build process in
-  the current configuration.  After make clean, you can rebuild with
-  the same configuration using make.
-
-  make distclean
-  In addition to the files removed by make clean, this also removes
-  Makefiles and other generated files to get back to the state of a
-  freshly unpacked source distribution.  Note that this will not remove
-  installed files, or the results of builds performed with different
-  compiler or optimization options than the current configuration.
-  After make distclean, it is necessary to run configure.bat followed
-  by make to rebuild.
-
-  make cleanall
-  Removes object and executable files that may have been created by
-  previous builds with different configure options, in addition to
-  the files produced by the current configuration.
-
-  make realclean
-  Removes the installed files in the bin subdirectory in addition to
-  the files removed by make cleanall.
-
-  make dist
-  Builds Emacs from the available sources and pre-compiled lisp files.
-  Packages Emacs binaries as full distribution and barebin distribution.
-
-  The following targets are intended only for use with the Bazaar sources.
-
-  make bootstrap
-  Creates a temporary emacs binary with lisp source files and
-  uses it to compile the lisp files.  Once the lisp files are built,
-  emacs is redumped with the compiled lisp.
-
-  make recompile
-  Recompiles any changed lisp files after an update.  This saves
-  doing a full bootstrap after every update.  If this or a subsequent
-  make fail, you probably need to perform a full bootstrap, though
-  running this target multiple times may eventually sort out the
-  interdependencies.
-
-  make maintainer-clean
-  Removes everything that can be recreated, including compiled lisp
-  files, to get back to the state of a fresh Bazaar tree.  After make
-  maintainer-clean, it is necessary to run configure.bat and make
-  bootstrap to rebuild.  Occasionally it may be necessary to run this
-  target after an update.
-
-* Creating binary distributions
-
-  Binary distributions (full and barebin distributions) can be
-  automatically built and packaged from source tarballs or a repository
-  checkout.
-
-  When building Emacs binary distributions, the --distfiles argument
-  to configure.bat specifies files to be included in the bin directory
-  of the binary distributions. This is intended for libraries that are
-  not built as part of Emacs, e.g. image libraries.
-
-  For example, specifying
-
-       --distfiles D:\distfiles\libXpm.dll
-
-  results in libXpm.dll being copied from D:\distfiles to the
-  bin directory before packaging starts.
-
-  Multiple files can be specified using multiple --distfiles arguments:
-
-       --distfiles D:\distfiles\libXpm.dll --distfiles C:\jpeglib\jpeg.dll
-
-  For packaging the binary distributions, the 'dist' make target uses
-  7-Zip (http://www.7-zip.org), which must be installed and available
-  on the Windows Path.
-
-
-* Trouble-shooting
-
-  The main problems that are likely to be encountered when building
-  Emacs stem from using an old version of GCC, or old MinGW or Windows API
-  headers.  Additionally, Cygwin ports of GNU make may require the Emacs
-  source tree to be mounted with text!=binary, because the makefiles
-  generated by configure.bat necessarily use DOS line endings.  Also,
-  Cygwin ports of make must run in UNIX mode, either by specifying
-  --unix on the command line, or MAKE_MODE=UNIX in the environment.
-
-  When configure runs, it attempts to detect when GCC itself, or the
-  headers it is using, are not suitable for building Emacs.  GCC version
-  2.95 or later is needed, because that is when the Windows port gained
-  sufficient support for anonymous structs and unions to cope with some
-  definitions from winnt.h that are used by addsection.c.
-  Older versions of the Windows API headers that come with Cygwin and MinGW
-  may be missing some definitions required by Emacs, or broken in other
-  ways.  In particular, uniscribe APIs were added to MinGW CVS only on
-  2006-03-26, so releases from before then cannot be used.
-
-  When in doubt about correctness of what configure did, look at the file
-  config.log, which shows all the failed test programs and compiler
-  messages associated with the failures.  If that doesn't give a clue,
-  please report the problems, together with the relevant fragments from
-  config.log, as bugs.
-
-  If configure succeeds, but make fails, install the Cygwin port of
-  Bash, even if the table above indicates that Emacs should be able to
-  build without sh.exe.  (Some versions of Windows shells are too dumb
-  for Makefile's used by Emacs.)
-
-  If you are using certain Cygwin builds of GCC, such as Cygwin version
-  1.1.8, you may need to specify some extra compiler flags like so:
-
-    configure --with-gcc --cflags -mwin32 --cflags -D__MSVCRT__
-      --ldflags -mwin32
-
-  However, the latest Cygwin versions, such as 1.3.3, don't need those
-  switches; you can simply use "configure --with-gcc".
-
-  We will attempt to auto-detect the need for these flags in a future
-  release.
-
-* Debugging
-
-  You should be able to debug Emacs using the debugger that is
-  appropriate for the compiler you used, namely DevStudio or Windbg if
-  compiled with MSVC, or GDB if compiled with GCC.  (GDB for Windows
-  is available from the MinGW site, http://www.mingw.org/download.shtml.)
-
-  When Emacs aborts due to a fatal internal error, Emacs on Windows
-  pops up an Emacs Abort Dialog asking you whether you want to debug
-  Emacs or terminate it.  If Emacs was built with MSVC, click YES
-  twice, and Windbg or the DevStudio debugger will start up
-  automatically.  If Emacs was built with GCC, first start GDB and
-  attach it to the Emacs process with the "gdb -p EMACS-PID" command,
-  where EMACS-PID is the Emacs process ID (which you can see in the
-  Windows Task Manager), type the "continue" command inside GDB, and
-  only then click YES on the abort dialog.  This will pass control to
-  the debugger, and you will be able to debug the cause of the fatal
-  error.
-
-  The single most important thing to find out when Emacs aborts or
-  crashes is where did that happen in the Emacs code.  This is called
-  "backtrace".
-
-  Emacs on Windows uses more than one thread.  When Emacs aborts due
-  to a fatal error, the current thread may not be the application
-  thread running Emacs code.  Therefore, to produce a meaningful
-  backtrace from a debugger, you need to instruct it to show the
-  backtrace for every thread.  With GDB, you do it like this:
-
-   (gdb) thread apply all backtrace
-
-  To run Emacs under a debugger to begin with, simply start it from
-  the debugger.  With GDB, chdir to the `src' directory (if you have
-  the source tree) or to a directory with the `.gdbinit' file (if you
-  don't have the source tree), and type these commands:
-
-    C:\whatever\src> gdb x:\path\to\emacs.exe
-    (gdb) run <ARGUMENTS TO EMACS>
-
-  Thereafter, use Emacs as usual; you can minimize the debugger
-  window, if you like.  The debugger will take control if and when
-  Emacs crashes.
-
-  Emacs functions implemented in C use a naming convention that reflects
-  their names in lisp.  The names of the C routines are the lisp names
-  prefixed with 'F', and with dashes converted to underscores.  For
-  example, the function call-process is implemented in C by
-  Fcall_process.  Similarly, lisp variables are prefixed with 'V', again
-  with dashes converted to underscores.  These conventions enable you to
-  easily set breakpoints or examine familiar lisp variables by name.
-
-  Since Emacs data is often in the form of a lisp object, and the
-  Lisp_Object type is difficult to examine manually in a debugger,
-  Emacs provides a helper routine called debug_print that prints out a
-  readable representation of a Lisp_Object.  If you are using GDB,
-  there is a .gdbinit file in the src directory which provides
-  definitions that are useful for examining lisp objects.  Therefore,
-  the following tips are mainly of interest when using MSVC.
-
-  The output from debug_print is sent to stderr, and to the debugger
-  via the OutputDebugString routine.  The output sent to stderr should
-  be displayed in the console window that was opened when the
-  emacs.exe executable was started.  The output sent to the debugger
-  should be displayed in its "Debug" output window.
-
-  When you are in the process of debugging Emacs and you would like to
-  examine the contents of a Lisp_Object variable, pop up the QuickWatch
-  window (QuickWatch has an eyeglass symbol on its button in the
-  toolbar).  In the text field at the top of the window, enter
-  debug_print(<variable>) and hit return.  For example, start and run
-  Emacs in the debugger until it is waiting for user input.  Then click
-  on the Break button in the debugger to halt execution.  Emacs should
-  halt in ZwUserGetMessage waiting for an input event.  Use the Call
-  Stack window to select the procedure w32_msp_pump up the call stack
-  (see below for why you have to do this).  Open the QuickWatch window
-  and enter debug_print(Vexec_path).  Evaluating this expression will
-  then print out the contents of the lisp variable exec-path.
-
-  If QuickWatch reports that the symbol is unknown, then check the call
-  stack in the Call Stack window.  If the selected frame in the call
-  stack is not an Emacs procedure, then the debugger won't recognize
-  Emacs symbols.  Instead, select a frame that is inside an Emacs
-  procedure and try using debug_print again.
-
-  If QuickWatch invokes debug_print but nothing happens, then check the
-  thread that is selected in the debugger.  If the selected thread is
-  not the last thread to run (the "current" thread), then it cannot be
-  used to execute debug_print.  Use the Debug menu to select the current
-  thread and try using debug_print again.  Note that the debugger halts
-  execution (e.g., due to a breakpoint) in the context of the current
-  thread, so this should only be a problem if you've explicitly switched
-  threads.
-
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
diff --git a/nt/config.nt b/nt/config.nt
deleted file mode 100644
index aa4a8bc..0000000
--- a/nt/config.nt
+++ /dev/null
@@ -1,1847 +0,0 @@
-/* GNU Emacs site configuration template file.
-
-Copyright (C) 1988, 1993-1994, 2001-2015 Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* NOTE:
-   *** WARNING This file is no longer being updated ***
-   Please do not remove non-Windows related stuff
-   unless strictly necessary.  Also, before adding anything here
-   consider whether inc/ms-w32.h would be a better place; this is
-   particularly true for gcc vs. MSVC conditional defines, MinGW or
-   MSVC specific code, and macros not already defined in config.in.  */
-
-/* No code in Emacs #includes config.h twice, but some bits of code
-   intended to work with other packages as well (like gmalloc.c)
-   think they can include it as many times as they like.  */
-#ifndef EMACS_CONFIG_H
-#define EMACS_CONFIG_H
-
-
-/* Define if building universal (internal helper macro) */
-#undef AC_APPLE_UNIVERSAL_BUILD
-
-/* Define to use the convention that & in the full name stands for the login
-   id. */
-#undef AMPERSAND_FULL_NAME
-
-/* Define to the number of bits in type 'ptrdiff_t'. */
-#undef BITSIZEOF_PTRDIFF_T
-
-/* Define to the number of bits in type 'sig_atomic_t'. */
-#undef BITSIZEOF_SIG_ATOMIC_T
-
-/* Define to the number of bits in type 'size_t'. */
-#undef BITSIZEOF_SIZE_T
-
-/* Define to the number of bits in type 'wchar_t'. */
-#undef BITSIZEOF_WCHAR_T
-
-/* Define to the number of bits in type 'wint_t'. */
-#undef BITSIZEOF_WINT_T
-
-/* Define if get_current_dir_name should not be used. */
-#undef BROKEN_GET_CURRENT_DIR_NAME
-
-/* Define on FreeBSD to work around an issue when reading from a PTY. */
-#undef BROKEN_PTY_READ_AFTER_EAGAIN
-
-/* Define if Emacs cannot be dumped on your system. */
-#undef CANNOT_DUMP
-
-/* Define this to enable compile time checks for the Lisp_Object data type. */
-/* #undef CHECK_LISP_OBJECT_TYPE */
-
-/* Define if you want lock files to be written, so that Emacs can tell
-   instantly when you try to modify a file that someone else has modified in
-   his/her Emacs. */
-#define CLASH_DETECTION 1
-
-/* Short copyright string for this version of Emacs. */
-#define COPYRIGHT "Copyright (C) 2015 Free Software Foundation, Inc."
-
-/* Define to one of '_getb67', 'GETB67', 'getb67' for Cray-2 and Cray-YMP
-   systems. This function is required for 'alloca.c' support on those systems.
-   */
-#undef CRAY_STACKSEG_END
-
-/* Define if the system is Cygwin. */
-#undef CYGWIN
-
-/* Define to 1 if using 'alloca.c'. */
-#undef C_ALLOCA
-
-/* Define if the system is Darwin. */
-#undef DARWIN_OS
-
-/* Extra bits to be or'd in with any pointers stored in a Lisp_Object. */
-#undef DATA_SEG_BITS
-
-/* Name of the default sound device. */
-#undef DEFAULT_SOUND_DEVICE
-
-/* Character that separates a device in a file name. */
-#define DEVICE_SEP ':'
-
-/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
-#undef DGUX
-
-/* Character that separates directories in a file name. */
-#define DIRECTORY_SEP '/'
-
-/* Define if process.c does not need to close a pty to make it a controlling
-   terminal (it is already a controlling terminal of the subprocess, because
-   we did ioctl TIOCSCTTY). */
-#undef DONT_REOPEN_PTY
-
-/* Define if the system is MS DOS or MS Windows. */
-#define DOS_NT
-
-/* Define to 1 if you are using the GNU C Library. */
-#undef DOUG_LEA_MALLOC
-
-/* Define to the canonical Emacs configuration name. */
-#undef EMACS_CONFIGURATION
-
-/* Define to the options passed to configure. */
-#undef EMACS_CONFIG_OPTIONS
-
-/* Define to 1 if expensive run-time data type and consistency checks are
-   enabled. */
-#undef ENABLE_CHECKING
-
-/* Letter to use in finding device name of first PTY, if PTYs are supported.
-   */
-#define FIRST_PTY_LETTER 'a'
-
-/* Enable compile-time and run-time bounds-checking, and some warnings,
-      without upsetting glibc 2.15+. */
-   #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
-   # define _FORTIFY_SOURCE 2
-   #endif
-
-
-/* Define to 1 if futimesat mishandles a NULL file name. */
-#undef FUTIMESAT_NULL_BUG
-
-/* Define this to check for errors in cons list. */
-#undef GC_CHECK_CONS_LIST
-
-/* Define this temporarily to hunt a bug. If defined, the size of strings is
-   redundantly recorded in sdata structures so that it can be compared to the
-   sizes recorded in Lisp strings. */
-#undef GC_CHECK_STRING_BYTES
-
-/* Define this to check the string free list. */
-#undef GC_CHECK_STRING_FREE_LIST
-
-/* Define this to check for short string overrun. */
-#undef GC_CHECK_STRING_OVERRUN
-
-/* Mark a secondary stack, like the register stack on the ia64. */
-#undef GC_MARK_SECONDARY_STACK
-
-/* Define if setjmp is known to save all registers relevant for conservative
-   garbage collection in the jmp_buf.
-   MSVC ignores the "register" keyword, so test fails even though
-   setjmp does work.  */
-#define GC_SETJMP_WORKS 1
-
-/* Define to the type of elements in the array set by `getgroups'. Usually
-   this is either `int' or `gid_t'. */
-#undef GETGROUPS_T
-
-/* Define this to 1 if getgroups(0,NULL) does not return the number of groups.
-   */
-#undef GETGROUPS_ZERO_BUG
-
-/* Define if gettimeofday clobbers the localtime buffer. */
-#undef GETTIMEOFDAY_CLOBBERS_LOCALTIME
-
-/* Define this to 'void' or 'struct timezone' to match the system's
-   declaration of the second argument to gettimeofday. */
-#undef GETTIMEOFDAY_TIMEZONE
-
-/* Define this to enable glyphs debugging code. */
-/* #undef GLYPH_DEBUG */
-
-/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
-   whether the gnulib module close-stream shall be considered present. */
-#undef GNULIB_CLOSE_STREAM
-
-/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
-   whether the gnulib module faccessat shall be considered present. */
-#undef GNULIB_FACCESSAT
-
-/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
-   whether the gnulib module fdopendir shall be considered present. */
-#undef GNULIB_FDOPENDIR
-
-/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
-   whether the gnulib module fscanf shall be considered present. */
-#undef GNULIB_FSCANF
-
-/* enable some gnulib portability checks */
-#undef GNULIB_PORTCHECK
-
-/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
-   whether the gnulib module scanf shall be considered present. */
-#undef GNULIB_SCANF
-
-/* Define if ths system is compatible with GNU/Linux. */
-#undef GNU_LINUX
-
-/* Define to 1 if you want to use the GNU memory allocator. */
-#define GNU_MALLOC 1
-
-/* Define to set the G_SLICE environment variable to "always-malloc" at
-   startup, if using GTK. */
-#undef G_SLICE_ALWAYS_MALLOC
-
-/* Define to 1 if you have the `access' function. */
-#undef HAVE_ACCESS
-
-/* Define to 1 if you have the `aclsort' function. */
-#undef HAVE_ACLSORT
-
-/* Define to 1 if you have the <aclv.h> header file. */
-#undef HAVE_ACLV_H
-
-/* Define to 1 if you have the `aclx_get' function. */
-#undef HAVE_ACLX_GET
-
-/* Define to 1 if you have the `acl_copy_ext_native' function. */
-#undef HAVE_ACL_COPY_EXT_NATIVE
-
-/* Define to 1 if you have the `acl_create_entry_np' function. */
-#undef HAVE_ACL_CREATE_ENTRY_NP
-
-/* Define to 1 if you have the `acl_delete_def_file' function. */
-#undef HAVE_ACL_DELETE_DEF_FILE
-
-/* Define to 1 if you have the `acl_delete_fd_np' function. */
-#undef HAVE_ACL_DELETE_FD_NP
-
-/* Define to 1 if you have the `acl_delete_file_np' function. */
-#undef HAVE_ACL_DELETE_FILE_NP
-
-/* Define to 1 if you have the `acl_entries' function. */
-#undef HAVE_ACL_ENTRIES
-
-/* Define to 1 if you have the `acl_extended_file' function. */
-#undef HAVE_ACL_EXTENDED_FILE
-
-/* Define to 1 if the constant ACL_FIRST_ENTRY exists. */
-#undef HAVE_ACL_FIRST_ENTRY
-
-/* Define to 1 if you have the `acl_free' function. */
-#define HAVE_ACL_FREE 1
-
-/* Define to 1 if you have the `acl_free_text' function. */
-#undef HAVE_ACL_FREE_TEXT
-
-/* Define to 1 if you have the `acl_from_mode' function. */
-#undef HAVE_ACL_FROM_MODE
-
-/* Define to 1 if you have the `acl_from_text' function. */
-#define HAVE_ACL_FROM_TEXT 1
-
-/* Define to 1 if you have the `acl_get_fd' function. */
-#undef HAVE_ACL_GET_FD
-
-/* Define to 1 if you have the `acl_get_file' function. */
-#define HAVE_ACL_GET_FILE 1
-
-/* Define to 1 if you have the <acl/libacl.h> header file. */
-#undef HAVE_ACL_LIBACL_H
-
-/* Define to 1 if you have the `acl_set_fd' function. */
-#undef HAVE_ACL_SET_FD
-
-/* Define to 1 if you have the `acl_set_file' function. */
-#define HAVE_ACL_SET_FILE 1
-
-/* Define to 1 if you have the `acl_to_short_text' function. */
-#undef HAVE_ACL_TO_SHORT_TEXT
-
-/* Define to 1 if you have the `acl_trivial' function. */
-#undef HAVE_ACL_TRIVIAL
-
-/* Define to 1 if the ACL type ACL_TYPE_EXTENDED exists. */
-#undef HAVE_ACL_TYPE_EXTENDED
-
-/* Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists. */
-#undef HAVE_AIX_SMT_EXP
-
-/* Define to 1 if you have 'alloca' after including <alloca.h>, a header that
-   may be supplied by this distribution. */
-#undef HAVE_ALLOCA
-
-/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
-   */
-#undef HAVE_ALLOCA_H
-
-/* Define to 1 if ALSA is available. */
-#undef HAVE_ALSA
-
-/* Define to 1 if strtold conforms to C99. */
-#undef HAVE_C99_STRTOLD
-
-/* Define to 1 if you have the `cfmakeraw' function. */
-#undef HAVE_CFMAKERAW
-
-/* Define to 1 if you have the `cfsetspeed' function. */
-#undef HAVE_CFSETSPEED
-
-/* Define to 1 if you have the `clock_gettime' function. */
-#undef HAVE_CLOCK_GETTIME
-
-/* Define to 1 if you have the `clock_settime' function. */
-#undef HAVE_CLOCK_SETTIME
-
-/* Define to 1 if you have the <coff.h> header file. */
-#undef HAVE_COFF_H
-
-/* Define to 1 if you have the <com_err.h> header file. */
-#undef HAVE_COM_ERR_H
-
-/* Define to 1 if you have the `copysign' function. */
-#define HAVE_COPYSIGN 1
-
-/* Define to 1 if data_start is the address of the start of the main data
-   segment. */
-#undef HAVE_DATA_START
-
-/* Define to 1 if using D-Bus. */
-#undef HAVE_DBUS
-
-/* Define to 1 if you have the `dbus_type_is_valid' function. */
-#undef HAVE_DBUS_TYPE_IS_VALID
-
-/* Define to 1 if you have the `dbus_validate_bus_name' function. */
-#undef HAVE_DBUS_VALIDATE_BUS_NAME
-
-/* Define to 1 if you have the `dbus_validate_interface' function. */
-#undef HAVE_DBUS_VALIDATE_INTERFACE
-
-/* Define to 1 if you have the `dbus_validate_member' function. */
-#undef HAVE_DBUS_VALIDATE_MEMBER
-
-/* Define to 1 if you have the `dbus_validate_path' function. */
-#undef HAVE_DBUS_VALIDATE_PATH
-
-/* Define to 1 if you have the `dbus_watch_get_unix_fd' function. */
-#undef HAVE_DBUS_WATCH_GET_UNIX_FD
-
-/* Define to 1 if you have the declaration of `alarm', and to 0 if you don't.
-   */
-#undef HAVE_DECL_ALARM
-
-/* Define to 1 if you have the declaration of `fdatasync', and to 0 if you
-   don't. */
-#undef HAVE_DECL_FDATASYNC
-
-/* Define to 1 if you have the declaration of `fdopendir', and to 0 if you
-   don't. */
-#undef HAVE_DECL_FDOPENDIR
-
-/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
-   */
-#define HAVE_DECL_GETENV 1
-
-/* Define to 1 if you have the declaration of `localtime_r', and to 0 if you
-   don't. */
-#undef HAVE_DECL_LOCALTIME_R
-
-/* Define to 1 if you have the declaration of `memrchr', and to 0 if you
-   don't. */
-#undef HAVE_DECL_MEMRCHR
-
-/* Define to 1 if you have the declaration of `strmode', and to 0 if you
-   don't. */
-#undef HAVE_DECL_STRMODE
-
-/* Define to 1 if you have the declaration of `strtoimax', and to 0 if you
-   don't. */
-#undef HAVE_DECL_STRTOIMAX
-
-/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
-   don't. */
-#define HAVE_DECL_STRTOLL 1
-
-/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
-   don't. */
-#define HAVE_DECL_STRTOULL 1
-
-/* Define to 1 if you have the declaration of `strtoumax', and to 0 if you
-   don't. */
-#define HAVE_DECL_STRTOUMAX 1
-
-/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
-   don't. */
-#undef HAVE_DECL_SYS_SIGLIST
-
-/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
-   */
-#define HAVE_DECL_TZNAME 1
-
-/* Define to 1 if you have the declaration of `unsetenv', and to 0 if you
-   don't. */
-#undef HAVE_DECL_UNSETENV
-
-/* Define to 1 if you have the declaration of `_putenv', and to 0 if you
-   don't. */
-#undef HAVE_DECL__PUTENV
-
-/* Define to 1 if you have the declaration of `__fpending', and to 0 if you
-   don't. */
-#undef HAVE_DECL___FPENDING
-
-/* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you
-   don't. */
-#undef HAVE_DECL___SYS_SIGLIST
-
-/* Define to 1 if you have the <des.h> header file. */
-#undef HAVE_DES_H
-
-/* Define to 1 if dynamic ptys are supported. */
-#undef HAVE_DEV_PTMX
-
-/* Define to 1 if you have the `difftime' function. */
-#undef HAVE_DIFFTIME
-
-/* Define to 1 if you have the <dirent.h> header file. */
-#undef HAVE_DIRENT_H
-
-/* Define to 1 if you have the 'dup2' function. */
-#define HAVE_DUP2 1
-
-/* Define to 1 if you have the `eaccess' function. */
-#undef HAVE_EACCESS
-
-/* Define to 1 if you have the `endgrent' function. */
-#undef HAVE_ENDGRENT
-
-/* Define to 1 if you have the `endpwent' function. */
-#undef HAVE_ENDPWENT
-
-/* Define if you have the declaration of environ. */
-#undef HAVE_ENVIRON_DECL
-
-/* Define to 1 if you have the `euidaccess' function. */
-#undef HAVE_EUIDACCESS
-
-/* Define to 1 if you have the <execinfo.h> header file. */
-#define HAVE_EXECINFO_H 1
-
-/* Define to 1 if you have the `faccessat' function. */
-#undef HAVE_FACCESSAT
-
-/* Define to 1 if you have the `facl' function. */
-#undef HAVE_FACL
-
-/* Define to 1 if you have the `fdatasync' function. */
-#undef HAVE_FDATASYNC
-
-/* Define to 1 if you have the `fdopendir' function. */
-#undef HAVE_FDOPENDIR
-
-/* Define to 1 if you have the `fork' function. */
-#undef HAVE_FORK
-
-/* Define to 1 if you have the `freeifaddrs' function. */
-#undef HAVE_FREEIFADDRS
-
-/* Define to 1 if using the freetype and fontconfig libraries. */
-#undef HAVE_FREETYPE
-
-/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
-#undef HAVE_FSEEKO
-
-/* Define to 1 if you have the `fstatat' function. */
-#undef HAVE_FSTATAT
-
-/* Define to 1 if you have the `fsync' function. */
-#define HAVE_FSYNC 1
-
-/* Define to 1 if you have the `futimens' function. */
-#undef HAVE_FUTIMENS
-
-/* Define to 1 if you have the `futimes' function. */
-#undef HAVE_FUTIMES
-
-/* Define to 1 if you have the `futimesat' function. */
-#undef HAVE_FUTIMESAT
-
-/* Define to 1 if you have the `gai_strerror' function. */
-#undef HAVE_GAI_STRERROR
-
-/* Define to 1 if using GConf. */
-#undef HAVE_GCONF
-
-/* Define to 1 if you have the `getacl' function. */
-#undef HAVE_GETACL
-
-/* Define to 1 if you have the `getaddrinfo' function. */
-#undef HAVE_GETADDRINFO
-
-/* Define to 1 if you have the `getdelim' function. */
-#undef HAVE_GETDELIM
-
-/* Define to 1 if you have the `getgrent' function. */
-#undef HAVE_GETGRENT
-
-/* Define to 1 if your system has a working `getgroups' function. */
-#undef HAVE_GETGROUPS
-
-/* Define to 1 if you have the `gethostname' function. */
-#define HAVE_GETHOSTNAME 1
-
-/* Define to 1 if you have the `getifaddrs' function. */
-#undef HAVE_GETIFADDRS
-
-/* Define to 1 if you have the `getline' function. */
-#undef HAVE_GETLINE
-
-/* Define to 1 if you have the <getopt.h> header file. */
-#undef HAVE_GETOPT_H
-
-/* Define to 1 if you have the `getopt_long_only' function. */
-#undef HAVE_GETOPT_LONG_ONLY
-
-/* Define to 1 if you have the `getpagesize' function. */
-#define HAVE_GETPAGESIZE 1
-
-/* Define to 1 if you have the `getpeername' function. */
-#define HAVE_GETPEERNAME 1
-
-/* Define to 1 if you have the `getpt' function. */
-#undef HAVE_GETPT
-
-/* Define to 1 if you have the `getpwent' function. */
-#undef HAVE_GETPWENT
-
-/* Define to 1 if you have the `getrlimit' function. */
-#undef HAVE_GETRLIMIT
-
-/* Define to 1 if you have the `getrusage' function. */
-#undef HAVE_GETRUSAGE
-
-/* Define to 1 if you have the `getsockname' function. */
-#define HAVE_GETSOCKNAME 1
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define to 1 if using GFile. */
-#undef HAVE_GFILENOTIFY
-
-/* Define to 1 if you have the `get_current_dir_name' function. */
-#undef HAVE_GET_CURRENT_DIR_NAME
-
-/* Define to 1 if you have a gif (or ungif) library. */
-#undef HAVE_GIF
-
-/* Define if using GnuTLS. */
-#undef HAVE_GNUTLS
-
-/* Define if using GnuTLS certificate verification callbacks. */
-#undef HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY
-
-/* Define to 1 if you have the `gnutls_certificate_set_verify_function'
-   function. */
-#undef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION
-
-/* Define to 1 if you have the gpm library (-lgpm). */
-#undef HAVE_GPM
-
-/* Define to 1 if you have the `grantpt' function. */
-#undef HAVE_GRANTPT
-
-/* Define to 1 if using GSettings. */
-#undef HAVE_GSETTINGS
-
-/* Define to 1 if using GTK 3 or later. */
-#undef HAVE_GTK3
-
-/* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */
-#undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
-
-/* Define to 1 if you have the `gtk_dialog_get_action_area' function. */
-#undef HAVE_GTK_DIALOG_GET_ACTION_AREA
-
-/* Define to 1 if you have the `gtk_file_selection_new' function. */
-#undef HAVE_GTK_FILE_SELECTION_NEW
-
-/* Define to 1 if you have the `gtk_handle_box_new' function. */
-#undef HAVE_GTK_HANDLE_BOX_NEW
-
-/* Define to 1 if you have the `gtk_main' function. */
-#undef HAVE_GTK_MAIN
-
-/* Define to 1 if you have the `gtk_orientable_set_orientation' function. */
-#undef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
-
-/* Define to 1 if you have the `gtk_tearoff_menu_item_new' function. */
-#undef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
-
-/* Define to 1 if you have the `gtk_widget_get_mapped' function. */
-#undef HAVE_GTK_WIDGET_GET_MAPPED
-
-/* Define to 1 if you have the `gtk_widget_get_sensitive' function. */
-#undef HAVE_GTK_WIDGET_GET_SENSITIVE
-
-/* Define to 1 if you have the `gtk_widget_get_window' function. */
-#undef HAVE_GTK_WIDGET_GET_WINDOW
-
-/* Define to 1 if you have the `gtk_widget_set_has_window' function. */
-#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW
-
-/* Define to 1 if you have the `gtk_window_set_has_resize_grip' function. */
-#undef HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP
-
-/* Define to 1 if you have the `g_type_init' function. */
-#undef HAVE_G_TYPE_INIT
-
-/* Define to 1 if netdb.h declares h_errno. */
-#define HAVE_H_ERRNO 1
-
-/* Define to 1 if you have the <ifaddrs.h> header file. */
-#undef HAVE_IFADDRS_H
-
-/* Define to 1 if using imagemagick. */
-#undef HAVE_IMAGEMAGICK
-
-/* Define to 1 if you have inet sockets. */
-#define HAVE_INET_SOCKETS 1
-
-/* Define to 1 to use inotify. */
-#undef HAVE_INOTIFY
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the jpeg library (-ljpeg). */
-#undef HAVE_JPEG
-
-/* Define to 1 if you have the <kerberosIV/des.h> header file. */
-#undef HAVE_KERBEROSIV_DES_H
-
-/* Define to 1 if you have the <kerberosIV/krb.h> header file. */
-#undef HAVE_KERBEROSIV_KRB_H
-
-/* Define to 1 if you have the <kerberos/des.h> header file. */
-#undef HAVE_KERBEROS_DES_H
-
-/* Define to 1 if you have the <kerberos/krb.h> header file. */
-#undef HAVE_KERBEROS_KRB_H
-
-/* Define to 1 if `e_text' is a member of `krb5_error'. */
-#undef HAVE_KRB5_ERROR_E_TEXT
-
-/* Define to 1 if `text' is a member of `krb5_error'. */
-#undef HAVE_KRB5_ERROR_TEXT
-
-/* Define to 1 if you have the <krb5.h> header file. */
-#undef HAVE_KRB5_H
-
-/* Define to 1 if you have the <krb.h> header file. */
-#undef HAVE_KRB_H
-
-/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
-#define HAVE_LANGINFO_CODESET 1
-
-/* Define to 1 if you have the `com_err' library (-lcom_err). */
-#undef HAVE_LIBCOM_ERR
-
-/* Define to 1 if you have the `crypto' library (-lcrypto). */
-#undef HAVE_LIBCRYPTO
-
-/* Define to 1 if you have the `des' library (-ldes). */
-#undef HAVE_LIBDES
-
-/* Define to 1 if you have the `des425' library (-ldes425). */
-#undef HAVE_LIBDES425
-
-/* Define to 1 if you have the `dgc' library (-ldgc). */
-#undef HAVE_LIBDGC
-
-/* Define to 1 if you have the `dnet' library (-ldnet). */
-#undef HAVE_LIBDNET
-
-/* Define to 1 if you have the <libgen.h> header file. */
-#undef HAVE_LIBGEN_H
-
-/* Define to 1 if you have the hesiod library (-lhesiod). */
-#undef HAVE_LIBHESIOD
-
-/* Define to 1 if you have the `k5crypto' library (-lk5crypto). */
-#undef HAVE_LIBK5CRYPTO
-
-/* Define to 1 if you have the `krb' library (-lkrb). */
-#undef HAVE_LIBKRB
-
-/* Define to 1 if you have the `krb4' library (-lkrb4). */
-#undef HAVE_LIBKRB4
-
-/* Define to 1 if you have the `krb5' library (-lkrb5). */
-#undef HAVE_LIBKRB5
-
-/* Define to 1 if you have the `kstat' library (-lkstat). */
-#undef HAVE_LIBKSTAT
-
-/* Define to 1 if you have the `lockfile' library (-llockfile). */
-#undef HAVE_LIBLOCKFILE
-
-/* Define to 1 if you have the `m' library (-lm). */
-#undef HAVE_LIBM
-
-/* Define to 1 if you have the `mail' library (-lmail). */
-#undef HAVE_LIBMAIL
-
-/* Define to 1 if using libotf. */
-#undef HAVE_LIBOTF
-
-/* Define to 1 if you have the `perfstat' library (-lperfstat). */
-#undef HAVE_LIBPERFSTAT
-
-/* Define to 1 if you have the <libpng/png.h> header file. */
-#undef HAVE_LIBPNG_PNG_H
-
-/* Define to 1 if you have the `pthreads' library (-lpthreads). */
-#undef HAVE_LIBPTHREADS
-
-/* Define to 1 if you have the resolv library (-lresolv). */
-#undef HAVE_LIBRESOLV
-
-/* Define to 1 if using SELinux. */
-#undef HAVE_LIBSELINUX
-
-/* Define to 1 if you have the `Xext' library (-lXext). */
-#undef HAVE_LIBXEXT
-
-/* Define to 1 if you have the libxml library (-lxml2). */
-#undef HAVE_LIBXML2
-
-/* Define to 1 if you have the `Xmu' library (-lXmu). */
-#undef HAVE_LIBXMU
-
-/* Define to 1 if you have the <linux/version.h> header file. */
-#undef HAVE_LINUX_VERSION_H
-
-/* Define to 1 if you have the `localtime_r' function. */
-#undef HAVE_LOCALTIME_R
-
-/* Define to 1 if you support file names longer than 14 characters. */
-#define HAVE_LONG_FILE_NAMES 1
-
-/* Define to 1 if the system has the type 'long long int'. */
-#undef HAVE_LONG_LONG_INT
-
-/* Define to 1 if you have the `lrand48' function. */
-#undef HAVE_LRAND48
-
-/* Define to 1 if you have the `lstat' function. */
-#undef HAVE_LSTAT
-
-/* Define to 1 if you have the `lutimes' function. */
-#undef HAVE_LUTIMES
-
-/* Define to 1 if using libm17n-flt. */
-#undef HAVE_M17N_FLT
-
-/* Define to 1 if you have the <machine/soundcard.h> header file. */
-#undef HAVE_MACHINE_SOUNDCARD_H
-
-/* Define to 1 if you have the <mach/mach.h> header file. */
-#undef HAVE_MACH_MACH_H
-
-/* Define to 1 if you have the `MagickExportImagePixels' function. */
-#undef HAVE_MAGICKEXPORTIMAGEPIXELS
-
-/* Define to 1 if you have the `MagickMergeImageLayers' function. */
-#undef HAVE_MAGICKMERGEIMAGELAYERS
-
-/* Define to 1 if you have the <maillock.h> header file. */
-#undef HAVE_MAILLOCK_H
-
-/* Define to 1 if you have the <malloc/malloc.h> header file. */
-#undef HAVE_MALLOC_MALLOC_H
-
-/* Define to 1 if <wchar.h> declares mbstate_t. */
-#undef HAVE_MBSTATE_T
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `memrchr' function. */
-#undef HAVE_MEMRCHR
-
-/* Define to 1 if you have mouse menus. (This is automatic if you use X, but
-   the option to specify it remains.) It is also defined with other window
-   systems that support xmenu.c. */
-#undef HAVE_MENUS
-
-/* Define to 1 if you have the `mkostemp' function. */
-#define HAVE_MKOSTEMP 1
-
-/* Define to 1 if you have the `mkstemp' function. */
-#undef HAVE_MKSTEMP
-
-/* Define to 1 if you have a working `mmap' system call. */
-#undef HAVE_MMAP
-
-/* Define to 1 if you have the `nanotime' function. */
-#undef HAVE_NANOTIME
-
-/* Define to 1 if you have the <net/if_dl.h> header file. */
-#undef HAVE_NET_IF_DL_H
-
-/* Define to 1 if you have the <net/if.h> header file. */
-#undef HAVE_NET_IF_H
-
-/* Define to 1 if you have the <nlist.h> header file. */
-#undef HAVE_NLIST_H
-
-/* Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on
-   Mac OS X. */
-#undef HAVE_NS
-
-/* Define to use native MS Windows GUI. */
-#define HAVE_NTGUI 1
-
-/* Define to 1 if libotf has OTF_get_variation_glyphs. */
-#undef HAVE_OTF_GET_VARIATION_GLYPHS
-
-/* Define to 1 if personality LINUX32 can be set. */
-#undef HAVE_PERSONALITY_LINUX32
-
-/* Define to 1 if you have the png library (-lpng). */
-#undef HAVE_PNG
-
-/* Define to 1 if you have the <png.h> header file. */
-#undef HAVE_PNG_H
-
-/* Define to 1 if you have the `posix_memalign' function. */
-#undef HAVE_POSIX_MEMALIGN
-
-/* Define to 1 if you have the `posix_openpt' function. */
-#undef HAVE_POSIX_OPENPT
-
-/* Define if you have the /proc filesystem. */
-#undef HAVE_PROCFS
-
-/* Define to 1 if you have the `pselect' function. */
-#undef HAVE_PSELECT
-
-/* Define to 1 if you have the `pstat_getdynamic' function. */
-#undef HAVE_PSTAT_GETDYNAMIC
-
-/* Define to 1 if you have pthread (-lpthread). */
-#undef HAVE_PTHREAD
-
-/* Define to 1 if you have the <pthread.h> header file. */
-#undef HAVE_PTHREAD_H
-
-/* Define to 1 if the pthread_sigmask function can be used (despite bugs). */
-#undef HAVE_PTHREAD_SIGMASK
-
-/* Define if the system supports pty devices. */
-#undef HAVE_PTYS
-
-/* Define to 1 if you have the <pty.h> header file. */
-#undef HAVE_PTY_H
-
-/* Define to 1 if you have the <pwd.h> header file. */
-#define HAVE_PWD_H 1
-
-/* Define to 1 if you have the `random' function. */
-#define HAVE_RANDOM 1
-
-/* Define to 1 if you have the `readlink' function. */
-#undef HAVE_READLINK
-
-/* Define to 1 if you have the `readlinkat' function. */
-#undef HAVE_READLINKAT
-
-/* Define to 1 if you have the `recvfrom' function. */
-#define HAVE_RECVFROM 1
-
-/* Define to 1 if res_init is available. */
-#undef HAVE_RES_INIT
-
-/* Define to 1 if you have the `rint' function. */
-#undef HAVE_RINT
-
-/* Define to 1 if using librsvg. */
-#undef HAVE_RSVG
-
-/* Define to 1 if you have the `select' function. */
-#define HAVE_SELECT 1
-
-/* Define to 1 if you have the `sendto' function. */
-#define HAVE_SENDTO 1
-
-/* Define to 1 if you have the `setitimer' function. */
-#define HAVE_SETITIMER 1
-
-/* Define to 1 if you have the `setlocale' function. */
-#define HAVE_SETLOCALE 1
-
-/* Define to 1 if you have the `setrlimit' function. */
-#undef HAVE_SETRLIMIT
-
-/* Define to 1 if you have the `shutdown' function. */
-#define HAVE_SHUTDOWN 1
-
-/* Define to 1 if you have the `sig2str' function. */
-#undef HAVE_SIG2STR
-
-/* Define to 1 if 'sig_atomic_t' is a signed integer type. */
-#undef HAVE_SIGNED_SIG_ATOMIC_T
-
-/* Define to 1 if 'wchar_t' is a signed integer type. */
-#undef HAVE_SIGNED_WCHAR_T
-
-/* Define to 1 if 'wint_t' is a signed integer type. */
-#undef HAVE_SIGNED_WINT_T
-
-/* Define to 1 if sigsetjmp and siglongjmp work. The value of this symbol is
-   irrelevant if HAVE__SETJMP is defined. */
-#undef HAVE_SIGSETJMP
-
-/* Define to 1 if the system has the type `sigset_t'. */
-#undef HAVE_SIGSET_T
-
-/* Define to 1 if you have the `snprintf' function. */
-#define HAVE_SNPRINTF 1
-
-/* Define if the system supports 4.2-compatible sockets.
-   NT supports Winsock which is close enough (with some hacks).  */
-#define HAVE_SOCKETS 1
-
-/* Define to 1 if you have sound support. */
-#define HAVE_SOUND 1
-
-/* Define to 1 if you have the <soundcard.h> header file. */
-#undef HAVE_SOUNDCARD_H
-
-/* Define to 1 if `speed_t' is declared by <termios.h>. */
-#undef HAVE_SPEED_T
-
-/* Define to 1 if you have the `statacl' function. */
-#undef HAVE_STATACL
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdio_ext.h> header file. */
-#undef HAVE_STDIO_EXT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the `strsignal' function. */
-#undef HAVE_STRSIGNAL
-
-/* Define to 1 if you have the `strtoimax' function. */
-#undef HAVE_STRTOIMAX
-
-/* Define to 1 if you have the `strtoll' function. */
-#undef HAVE_STRTOLL
-
-/* Define to 1 if you have the `strtoull' function. */
-#define HAVE_STRTOULL 1
-
-/* Define to 1 if you have the `strtoumax' function. */
-#define HAVE_STRTOUMAX 1
-
-/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */
-#undef HAVE_STRUCT_IFREQ_IFR_ADDR
-
-/* Define to 1 if `ifr_addr.sa_len' is a member of `struct ifreq'. */
-#undef HAVE_STRUCT_IFREQ_IFR_ADDR_SA_LEN
-
-/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */
-#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR
-
-/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */
-#undef HAVE_STRUCT_IFREQ_IFR_FLAGS
-
-/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */
-#undef HAVE_STRUCT_IFREQ_IFR_HWADDR
-
-/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */
-#undef HAVE_STRUCT_IFREQ_IFR_NETMASK
-
-/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */
-#undef HAVE_STRUCT_NLIST_N_UN_N_NAME
-
-/* Define to 1 if `st_atimensec' is a member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_ATIMENSEC
-
-/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
-
-/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC
-
-/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
-
-/* Define to 1 if `st_birthtimensec' is a member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
-
-/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
-
-/* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC
-
-/* Define to 1 if `tm_zone' is a member of `struct tm'. */
-#undef HAVE_STRUCT_TM_TM_ZONE
-
-/* Define if struct utimbuf is declared -- usually in <utime.h>. Some systems
-   have utime.h but don't declare the struct anywhere. */
-#undef HAVE_STRUCT_UTIMBUF
-
-/* Define if struct stat has an st_dm_mode member. */
-#undef HAVE_ST_DM_MODE
-
-/* Define to 1 if you have the `symlink' function. */
-#undef HAVE_SYMLINK
-
-/* Define to 1 if you have the `sync' function. */
-#undef HAVE_SYNC
-
-/* Define to 1 if you have the <sys/acl.h> header file. */
-#define HAVE_SYS_ACL_H 1
-
-/* Define to 1 if you have the <sys/bitypes.h> header file. */
-#undef HAVE_SYS_BITYPES_H
-
-/* Define to 1 if you have the <sys/inotify.h> header file. */
-#undef HAVE_SYS_INOTIFY_H
-
-/* Define to 1 if you have the <sys/inttypes.h> header file. */
-#undef HAVE_SYS_INTTYPES_H
-
-/* Define to 1 if you have the <sys/loadavg.h> header file. */
-#undef HAVE_SYS_LOADAVG_H
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#undef HAVE_SYS_RESOURCE_H
-
-/* Define to 1 if you have the <sys/select.h> header file. */
-#undef HAVE_SYS_SELECT_H
-
-/* Define to 1 if you have the <sys/socket.h> header file. */
-#undef HAVE_SYS_SOCKET_H
-
-/* Define to 1 if you have the <sys/soundcard.h> header file. */
-#undef HAVE_SYS_SOUNDCARD_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/systeminfo.h> header file. */
-#undef HAVE_SYS_SYSTEMINFO_H
-
-/* Define to 1 if you have the <sys/timeb.h> header file. */
-#define HAVE_SYS_TIMEB_H 1
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <sys/un.h> header file. */
-#undef HAVE_SYS_UN_H
-
-/* Define to 1 if you have the <sys/utsname.h> header file. */
-#undef HAVE_SYS_UTSNAME_H
-
-/* Define to 1 if you have the <sys/vlimit.h> header file. */
-#undef HAVE_SYS_VLIMIT_H
-
-/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
-#define HAVE_SYS_WAIT_H 1
-
-/* Define to 1 if you have the <term.h> header file. */
-#undef HAVE_TERM_H
-
-/* Define to 1 if you have the tiff library (-ltiff). */
-#undef HAVE_TIFF
-
-/* Define to 1 if you have the `timer_settime' function. */
-#undef HAVE_TIMER_SETTIME
-
-/* Define if struct tm has the tm_gmtoff member. */
-#undef HAVE_TM_GMTOFF
-
-/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
-   `HAVE_STRUCT_TM_TM_ZONE' instead. */
-#undef HAVE_TM_ZONE
-
-/* Define to 1 if you have the `touchlock' function. */
-#undef HAVE_TOUCHLOCK
-
-/* Define to 1 if you don't have `tm_zone' but do have the external array
-   `tzname'. */
-#define HAVE_TZNAME 1
-
-/* Define to 1 if you have the `tzset' function. */
-#define HAVE_TZSET 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if you have the `unsetenv' function. */
-#define HAVE_UNSETENV 1
-
-/* Define to 1 if the system has the type 'unsigned long long int'. */
-#undef HAVE_UNSIGNED_LONG_LONG_INT
-
-/* Define to 1 if you have the <util.h> header file. */
-#undef HAVE_UTIL_H
-
-/* Define to 1 if you have the `utimensat' function. */
-#undef HAVE_UTIMENSAT
-
-/* Define to 1 if you have the `utimes' function. */
-#undef HAVE_UTIMES
-
-/* Define to 1 if you have the <utime.h> header file. */
-#undef HAVE_UTIME_H
-
-/* Define to 1 if you have the <utmp.h> header file. */
-#undef HAVE_UTMP_H
-
-/* Define to 1 if you have the `vfork' function. */
-#undef HAVE_VFORK
-
-/* Define to 1 if you have the <vfork.h> header file. */
-#undef HAVE_VFORK_H
-
-/* Define to 1 to use w32notify. */
-#define HAVE_W32NOTIFY 1
-
-/* Define to 1 if you have the <wchar.h> header file. */
-#undef HAVE_WCHAR_H
-
-/* Define if you have the 'wchar_t' type. */
-#define HAVE_WCHAR_T 1
-
-/* Define if you have a window system. */
-#undef HAVE_WINDOW_SYSTEM
-
-/* Define to 1 if you have the <winsock2.h> header file. */
-#undef HAVE_WINSOCK2_H
-
-/* Define to 1 if `fork' works. */
-#undef HAVE_WORKING_FORK
-
-/* Define to 1 if fstatat (..., 0) works. For example, it does not work in AIX
-   7.1. */
-#undef HAVE_WORKING_FSTATAT_ZERO_FLAG
-
-/* Define if utimes works properly. */
-#undef HAVE_WORKING_UTIMES
-
-/* Define to 1 if `vfork' works. */
-#undef HAVE_WORKING_VFORK
-
-/* Define to 1 if you have the <ws2tcpip.h> header file. */
-#undef HAVE_WS2TCPIP_H
-
-/* Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs
-   expects to use version 10. */
-#undef HAVE_X11
-
-/* Define to 1 if you have the X11R6 or newer version of Xlib. */
-#undef HAVE_X11R6
-
-/* Define if you have usable X11R6-style XIM support. */
-#undef HAVE_X11R6_XIM
-
-/* Define to 1 if you have the X11R6 or newer version of Xt. */
-#undef HAVE_X11XTR6
-
-/* Define to 1 if you have the Xaw3d library (-lXaw3d). */
-#undef HAVE_XAW3D
-
-/* Define to 1 if you have the Xft library. */
-#undef HAVE_XFT
-
-/* Define to 1 if XIM is available */
-#undef HAVE_XIM
-
-/* Define to 1 if you have the Xinerama extension. */
-#undef HAVE_XINERAMA
-
-/* Define to 1 if you have the Xkb extension. */
-#undef HAVE_XKB
-
-/* Define to 1 if you have the Xpm library (-lXpm). */
-#undef HAVE_XPM
-
-/* Define to 1 if you have the XRandr extension. */
-#undef HAVE_XRANDR
-
-/* Define to 1 if you have the `XrmSetDatabase' function. */
-#undef HAVE_XRMSETDATABASE
-
-/* Define to 1 if you have the `XRRGetOutputPrimary' function. */
-#undef HAVE_XRRGETOUTPUTPRIMARY
-
-/* Define to 1 if you have the `XRRGetScreenResourcesCurrent' function. */
-#undef HAVE_XRRGETSCREENRESOURCESCURRENT
-
-/* Define to 1 if you have the `XScreenNumberOfScreen' function. */
-#undef HAVE_XSCREENNUMBEROFSCREEN
-
-/* Define to 1 if you have the `XScreenResourceString' function. */
-#undef HAVE_XSCREENRESOURCESTRING
-
-/* Define if you have usable i18n support. */
-#undef HAVE_X_I18N
-
-/* Define to 1 if you have the SM library (-lSM). */
-#undef HAVE_X_SM
-
-/* Define to 1 if you want to use the X window system. */
-#undef HAVE_X_WINDOWS
-
-/* Define to 1 if the system has the type `_Bool'. */
-#undef HAVE__BOOL
-
-/* Define to 1 if you have the `_ftime' function. */
-#undef HAVE__FTIME
-
-/* Define to 1 if _setjmp and _longjmp work.  */
-#define HAVE__SETJMP 1
-
-/* Define to 1 if you have the `__builtin_unwind_init' function. */
-#undef HAVE___BUILTIN_UNWIND_INIT
-
-/* Define to 1 if you have the `__executable_start' function. */
-#undef HAVE___EXECUTABLE_START
-
-/* Define to 1 if you have the `__fpending' function. */
-#undef HAVE___FPENDING
-
-/* Define to support using a Hesiod database to find the POP server. */
-#undef HESIOD
-
-/* Define if the system is HPUX. */
-#undef HPUX
-
-/* This is substituted when $TERM is "internal". */
-#undef INTERNAL_TERMINAL
-
-/* Define to read input using SIGIO. */
-#undef INTERRUPT_INPUT
-
-/* Define if the system is IRIX. */
-#undef IRIX6_5
-
-/* Returns true if character is any form of separator. */
-#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
-
-/* Returns true if character is a device separator. */
-#define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP)
-
-/* Returns true if character is a directory separator. */
-#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
-
-/* Define to support Kerberos-authenticated POP mail retrieval. */
-#undef KERBEROS
-
-/* Define to use Kerberos 5 instead of Kerberos 4. */
-#undef KERBEROS5
-
-/* Define to 1 if localtime caches TZ. */
-#define LOCALTIME_CACHE 1
-
-/* Define to 1 if 'lstat' dereferences a symlink specified with a trailing
-   slash. */
-#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
-
-/* String giving fallback POP mail host. */
-#undef MAILHOST
-
-/* Define to unlink, rather than empty, mail spool after reading. */
-#undef MAIL_UNLINK_SPOOL
-
-/* Define if the mailer uses flock to interlock the mail spool. */
-#undef MAIL_USE_FLOCK
-
-/* Define if the mailer uses lockf to interlock the mail spool. */
-#undef MAIL_USE_LOCKF
-
-/* Define to support MMDF mailboxes in movemail. */
-#undef MAIL_USE_MMDF
-
-/* Define to support POP mail retrieval. */
-#define MAIL_USE_POP 1
-
-/* Define if the system is MS DOS. */
-#undef MSDOS
-
-/* Define if system's imake configuration file defines `NeedWidePrototypes' as
-   `NO'. */
-#undef NARROWPROTO
-
-/* Define if XEditRes should not be used. */
-#undef NO_EDITRES
-
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
-/* Minimum value of NSIG. */
-#undef NSIG_MINIMUM
-
-/* Define to 1 if `NSInteger' is defined. */
-#undef NS_HAVE_NSINTEGER
-
-/* Define to 1 if you are using NS windowing under MacOS X. */
-#undef NS_IMPL_COCOA
-
-/* Define to 1 if you are using NS windowing under GNUstep. */
-#undef NS_IMPL_GNUSTEP
-
-/* Name of the file to open to get a null file, or a data sink. */
-#define NULL_DEVICE "NUL:"
-
-/* Define to 1 if the nlist n_name member is a pointer */
-#undef N_NAME_POINTER
-
-/* Name of package */
-#define PACKAGE "emacs"
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* the number of pending output bytes on stream 'fp' */
-#define PENDING_OUTPUT_N_BYTES  (fp->_ptr - fp->_base)
-
-/* Define to empty to suppress deprecation warnings when building with
-   --enable-gcc-warnings and with libpng versions before 1.5, which lack
-   png_longjmp. */
-#undef PNG_DEPSTRUCT
-
-/* Define if process_send_signal should use VSUSP instead of VSWTCH. */
-#undef PREFER_VSUSP
-
-/* Define to 1 if pthread_sigmask(), when it fails, returns -1 and sets errno.
-   */
-#undef PTHREAD_SIGMASK_FAILS_WITH_ERRNO
-
-/* Define to 1 if pthread_sigmask() may returns 0 and have no effect. */
-#undef PTHREAD_SIGMASK_INEFFECTIVE
-
-/* Define to 1 if pthread_sigmask() unblocks signals incorrectly. */
-#undef PTHREAD_SIGMASK_UNBLOCK_BUG
-
-/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
-   'ptrdiff_t'. */
-#undef PTRDIFF_T_SUFFIX
-
-/* How to iterate over PTYs. */
-#undef PTY_ITERATION
-
-/* How to get the device name of the control end of a PTY, if non-standard. */
-#undef PTY_NAME_SPRINTF
-
-/* How to open a PTY, if non-standard. */
-#undef PTY_OPEN
-
-/* How to get device name of the tty end of a PTY, if non-standard. */
-#undef PTY_TTY_NAME_SPRINTF
-
-/* Define to 1 if readlink fails to recognize a trailing slash. */
-#undef READLINK_TRAILING_SLASH_BUG
-
-/* Define REL_ALLOC if you want to use the relocating allocator for buffer
-   space. */
-#define REL_ALLOC 1
-
-/* Define to 1 if stat needs help when passed a directory name with a trailing
-   slash */
-#undef REPLACE_FUNC_STAT_DIR
-
-/* Define to 1 if stat needs help when passed a file name with a trailing
-   slash */
-#undef REPLACE_FUNC_STAT_FILE
-
-/* Define if emacs.c needs to call run_time_remap; for HPUX. */
-#undef RUN_TIME_REMAP
-
-/* Character that separates PATH elements. */
-#define SEPCHAR ';'
-
-/* How to set up a slave PTY, if needed. */
-#undef SETUP_SLAVE_PTY
-
-/* Make process_send_signal work by "typing" a signal character on the pty. */
-#undef SIGNALS_VIA_CHARACTERS
-
-/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
-   'sig_atomic_t'. */
-#undef SIG_ATOMIC_T_SUFFIX
-
-/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
-   'size_t'. */
-#undef SIZE_T_SUFFIX
-
-/* Define if the system is Solaris. */
-#undef SOLARIS2
-
-/* If using the C implementation of alloca, define if you know the
-   direction of stack growth for your system; otherwise it will be
-   automatically deduced at runtime.
-        STACK_DIRECTION > 0 => grows toward higher addresses
-        STACK_DIRECTION < 0 => grows toward lower addresses
-        STACK_DIRECTION = 0 => direction of growth unknown */
-#undef STACK_DIRECTION
-
-/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
-#undef STAT_MACROS_BROKEN
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to 1 on System V Release 4. */
-#undef SVR4
-
-/* Define to use system malloc. */
-#undef SYSTEM_MALLOC
-
-/* The type of system you are compiling for; sets `system-type'. */
-#define SYSTEM_TYPE "windows-nt"
-
-/* Undocumented. */
-#undef TAB3
-
-/* Undocumented. */
-#undef TABDLY
-
-/* Define to 1 if you use terminfo instead of termcap. */
-#undef TERMINFO
-
-/* Define to the header for the built-in window system. */
-#define TERM_HEADER "w32term.h"
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#define TIME_WITH_SYS_TIME 1
-
-/* Some platforms redefine this. */
-#undef TIOCSIGSEND
-
-/* Define to 1 if your <sys/time.h> declares `struct tm'. */
-#undef TM_IN_SYS_TIME
-
-/* Define to 1 if the type of the st_atim member of a struct stat is struct
-   timespec. */
-#undef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC
-
-/* Define to 1 for Encore UMAX. */
-#undef UMAX
-
-/* Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> instead of
-   <sys/cpustats.h>. */
-#undef UMAX4_3
-
-/* Define if the system has Unix98 PTYs. */
-#undef UNIX98_PTYS
-
-/* Define to 1 if FIONREAD is usable. */
-#define USABLE_FIONREAD 1
-
-/* Define to 1 if SIGIO is usable. */
-#undef USABLE_SIGIO
-
-/* How to get a user's full name. */
-#define USER_FULL_NAME pw->pw_gecos
-
-/* Define to nonzero if you want access control list support. */
-#undef USE_ACL
-
-/* Define to 1 if using file notifications. */
-#define USE_FILE_NOTIFY 1
-
-/* Define to 1 if using GTK. */
-#undef USE_GTK
-
-/* Define to 1 if using the Lucid X toolkit. */
-#undef USE_LUCID
-
-/* Define to use mmap to allocate buffer text. */
-#undef USE_MMAP_FOR_BUFFERS
-
-/* Define to 1 if using the Motif X toolkit. */
-#undef USE_MOTIF
-
-/* Enable extensions on AIX 3, Interix.  */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif
-/* Enable general extensions on OS X.  */
-#ifndef _DARWIN_C_SOURCE
-# undef _DARWIN_C_SOURCE
-#endif
-/* Enable GNU extensions on systems that have them.  */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif
-/* Enable threading extensions on Solaris.  */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-/* Enable extensions on HP NonStop.  */
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-/* Enable X/Open extensions if necessary.  HP-UX 11.11 defines
-   mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
-   whether compiling with -Ae or -D_HPUX_SOURCE=1.  */
-#ifndef _XOPEN_SOURCE
-# undef _XOPEN_SOURCE
-#endif
-/* Enable general extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-
-
-/* Define to 1 if we should use toolkit scroll bars. */
-#define USE_TOOLKIT_SCROLL_BARS 1
-
-/* Define to 1 if we should use XIM, if it is available. */
-#undef USE_XIM
-
-/* Define to 1 if using an X toolkit. */
-#undef USE_X_TOOLKIT
-
-/* Define if the system is compatible with System III. */
-#undef USG
-
-/* Define if the system is compatible with System V. */
-#undef USG5
-
-/* Define if the system is compatible with System V Release 4. */
-#undef USG5_4
-
-/* Define for USG systems where it works to open a pty's tty in the parent
-   process, then close and reopen it in the child. */
-#undef USG_SUBTTY_WORKS
-
-/* Version number of package */
-#define VERSION "25.0.50"
-
-/* Define to 1 if unsetenv returns void instead of int. */
-#undef VOID_UNSETENV
-
-/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
-   'wchar_t'. */
-#undef WCHAR_T_SUFFIX
-
-/* Use long long for EMACS_INT if available. */
-/* #undef WIDE_EMACS_INT */
-
-/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
-   'wint_t'. */
-#undef WINT_T_SUFFIX
-
-/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
-   significant byte first (like Motorola and SPARC, unlike Intel). */
-#if defined AC_APPLE_UNIVERSAL_BUILD
-# if defined __BIG_ENDIAN__
-#  define WORDS_BIGENDIAN 1
-# endif
-#else
-# ifndef WORDS_BIGENDIAN
-#  undef WORDS_BIGENDIAN
-# endif
-#endif
-
-/* Define this to check for malloc buffer overrun. */
-#undef XMALLOC_OVERRUN_CHECK
-
-/* Compensate for a bug in Xos.h on some systems, where it requires time.h. */
-#undef XOS_NEEDS_TIME_H
-
-/* Define to the type of the 6th arg of XRegisterIMInstantiateCallback, either
-   XPointer or XPointer*. */
-#undef XRegisterIMInstantiateCallback_arg6
-
-/* Define if the system is AIX. */
-#undef _AIX
-
-/* Enable large inode numbers on Mac OS X 10.5. */
-#undef _DARWIN_USE_64_BIT_INODE
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
-/* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct
-   stat.st_size becomes 64-bit. */
-#undef _GL_WINDOWS_64_BIT_ST_SIZE
-
-/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
-#undef _LARGEFILE_SOURCE
-
-/* Define for large files, on AIX-style hosts. */
-#undef _LARGE_FILES
-
-/* Define to 1 if on MINIX. */
-#undef _MINIX
-
-/* Define if GNUstep uses ObjC exceptions. */
-#undef _NATIVE_OBJC_EXCEPTIONS
-
-/* Define to 1 to make NetBSD features available. MINIX 3 needs this. */
-#undef _NETBSD_SOURCE
-
-/* The _Noreturn keyword of C11.  */
-#if ! (defined _Noreturn \
-       || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
-# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__))
-#  define _Noreturn __attribute__ ((__noreturn__))
-# elif defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
-# else
-#  define _Noreturn
-# endif
-#endif
-
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
-   this defined. */
-#undef _POSIX_1_SOURCE
-
-/* Define to 1 if you need to in order for 'stat' and other things to work. */
-#undef _POSIX_SOURCE
-
-/* Needed for system_process_attributes on Solaris. */
-#undef _STRUCTURED_PROC
-
-/* Define to rpl_ if the getopt replacement functions and variables should be
-   used. */
-#undef __GETOPT_PREFIX
-
-/* Define to compiler's equivalent of C99 restrict keyword in array
-   declarations. Define as empty for no equivalent. */
-#undef __restrict_arr
-
-/* Some platforms that do not use configure define this to include extra
-   configuration information. */
-#define config_opsysfile <ms-w32.h>
-
-/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
-   _GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
-   _GL_INLINE_HEADER_BEGIN contains useful stuff to put
-     in an include file, before uses of _GL_INLINE.
-     It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic,
-     when FOO is an inline function in the header; see
-     <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
-   _GL_INLINE_HEADER_END contains useful stuff to put
-     in the same include file, after uses of _GL_INLINE.
-
-   Suppress extern inline with HP-UX cc, as it appears to be broken; see
-   <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
-
-   Suppress extern inline with Sun C in standards-conformance mode, as it
-   mishandles inline functions that call each other.  E.g., for 'inline void f
-   (void) { } inline void g (void) { f (); }', c99 incorrectly complains
-   'reference to static identifier "f" in extern inline function'.
-   This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
-
-   Suppress the use of extern inline on Apple's platforms, as Libc at least
-   through Libc-825.26 (2013-04-09) is incompatible with it; see, e.g.,
-   <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
-   Perhaps Apple will fix this some day.  */
-#if ((__GNUC__ \
-      ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
-      : (199901L <= __STDC_VERSION__ \
-         && !defined __HP_cc \
-         && !(defined __SUNPRO_C && __STDC__))) \
-     && !defined __APPLE__)
-# define _GL_INLINE inline
-# define _GL_EXTERN_INLINE extern inline
-#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__
-# if __GNUC_GNU_INLINE__
-   /* __gnu_inline__ suppresses a GCC 4.2 diagnostic.  */
-#  define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
-# else
-#  define _GL_INLINE extern inline
-# endif
-# define _GL_EXTERN_INLINE extern
-#else
-# define _GL_INLINE static _GL_UNUSED
-# define _GL_EXTERN_INLINE static _GL_UNUSED
-#endif
-
-#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
-# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
-#  define _GL_INLINE_HEADER_CONST_PRAGMA
-# else
-#  define _GL_INLINE_HEADER_CONST_PRAGMA \
-     _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
-# endif
-# define _GL_INLINE_HEADER_BEGIN \
-    _Pragma ("GCC diagnostic push") \
-    _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
-    _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
-    _GL_INLINE_HEADER_CONST_PRAGMA
-# define _GL_INLINE_HEADER_END \
-    _Pragma ("GCC diagnostic pop")
-#else
-# define _GL_INLINE_HEADER_BEGIN
-# define _GL_INLINE_HEADER_END
-#endif
-
-/* A replacement for va_copy, if needed.  */
-#define gl_va_copy(a,b) ((a) = (b))
-
-/* Define to rpl_gmtime if the replacement function should be used. */
-#undef gmtime
-
-/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
-   the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
-   earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
-   __APPLE__ && __MACH__ test for Mac OS X.
-   __APPLE_CC__ tests for the Apple compiler and its version.
-   __STDC_VERSION__ tests for the C99 mode.  */
-#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined 
__cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
-# define __GNUC_STDC_INLINE__ 1
-#endif
-
-/* Define to 1 if the compiler is checking for lint. */
-#undef lint
-
-/* Define to rpl_localtime if the replacement function should be used. */
-#undef localtime
-
-/* Define to a type if <wchar.h> does not define. */
-#undef mbstate_t
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef mode_t
-
-/* Define to the name of the strftime replacement function. */
-#define my_strftime nstrftime
-
-/* Define to the type of st_nlink in struct stat, or a supertype. */
-#define nlink_t short
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef pid_t
-
-/* Define to the equivalent of the C99 'restrict' keyword, or to
-   nothing if this is not supported.  Do not define if restrict is
-   supported directly.  */
-#undef restrict
-/* Work around a bug in Sun C++: it does not support _Restrict or
-   __restrict__, even though the corresponding Sun C compiler ends up with
-   "#define restrict _Restrict" or "#define restrict __restrict__" in the
-   previous line.  Perhaps some future version of Sun C++ will work with
-   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
-#if defined __SUNPRO_CC && !defined __RESTRICT
-# define _Restrict
-# define __restrict__
-#endif
-
-/* type to use in place of socklen_t if not defined */
-#undef socklen_t
-
-/* Define as a signed type of the same size as size_t. */
-#undef ssize_t
-
-/* Define to enable asynchronous subprocesses. */
-#define subprocesses
-
-/* Define to any substitute for sys_siglist. */
-#undef sys_siglist
-
-/* Define as a marker that can be attached to declarations that might not
-    be used.  This helps to reduce warnings, such as from
-    GCC -Wunused-parameter.  */
-#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_UNUSED __attribute__ ((__unused__))
-#else
-# define _GL_UNUSED
-#endif
-/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
-   is a misnomer outside of parameter lists.  */
-#define _UNUSED_PARAMETER_ _GL_UNUSED
-
-/* The __pure__ attribute was added in gcc 2.96.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE /* empty */
-#endif
-
-/* The __const__ attribute was added in gcc 2.95.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
-# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
-#else
-# define _GL_ATTRIBUTE_CONST /* empty */
-#endif
-
-
-/* Define as a macro for copying va_list variables. */
-#undef va_copy
-
-/* Define as `fork' if `vfork' does not work. */
-#undef vfork
-
-#include <conf_post.h>
-
-#endif /* EMACS_CONFIG_H */
-
-/*
-Local Variables:
-mode: c
-End:
-*/
diff --git a/nt/configure.bat b/nt/configure.bat
index f6ac8fc..629bcc8 100755
--- a/nt/configure.bat
+++ b/nt/configure.bat
@@ -1,6 +1,6 @@
 @echo off
 rem   ----------------------------------------------------------------------
-rem   Configuration script for MS Windows operating systems
+rem   This was the old configuration script for MS Windows operating systems
 rem   Copyright (C) 1999-2015 Free Software Foundation, Inc.
 
 rem   This file is part of GNU Emacs.
@@ -19,956 +19,8 @@ rem   You should have received a copy of the GNU General 
Public License
 rem   along with GNU Emacs.  If not, see http://www.gnu.org/licenses/.
 
 rem   ----------------------------------------------------------------------
-rem   YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:
-rem
-rem   + MS Windows 95, NT or later
-rem   + either MSVC 2.x or later, or gcc-2.95 or later (with GNU make 3.75
-rem     or later) and the Mingw32 and Windows API headers and libraries.
-rem   + Visual Studio 2005 is not supported at this time.
-rem
-rem For reference, here is a list of which builds of GNU make are known to
-rem work or not, and whether they work in the presence and/or absence of
-rem sh.exe.
-rem
-rem                                       sh exists     no sh
-rem  cygwin b20.1 make (3.75):            fails[1,5]    fails[2,5]
-rem  MSVC compiled gmake 3.77:            okay          okay
-rem  MSVC compiled gmake 3.78.1:          okay          okay
-rem  MSVC compiled gmake 3.79.1:          okay          okay
-rem  mingw32/gcc-2.92.2 make (3.77):      okay          okay[4]
-rem  cygwin compiled gmake 3.77:          fails[1,5]    fails[2,5]
-rem  cygwin compiled gmake 3.78.1:        fails[5]      fails[2,5]
-rem  cygwin compiled gmake 3.79.1:        fails[3,5]    fails[2?,5]
-rem  cygwin compiled make 3.80:           okay[6]       fails?[7]
-rem  cygwin compiled make 3.81:           fails         fails?[7]
-rem  mingw32 compiled make 3.79.1:        okay          okay
-rem  mingw32 compiled make 3.80:          okay          okay?[7]
-rem  mingw32 compiled make 3.81:          okay          okay[8]
-rem
-rem [1] doesn't cope with makefiles with DOS line endings, so must mount
-rem     emacs source with text!=binary.
-rem [2] fails when needs to invoke shell commands; okay invoking gcc etc.
-rem [3] requires LC_MESSAGES support to build; cannot build with early
-rem     versions of cygwin.
-rem [4] may fail on Windows 9X and Windows ME; if so, install Bash.
-rem [5] fails when building leim due to the use of cygwin style paths.
-rem     May work if building emacs without leim.
-rem [6] need to uncomment 3 lines in nt/gmake.defs that invoke `cygpath';
-rem            look for "cygpath" near line 85 of gmake.defs.
-rem [7] not recommended; please report if you try this combination.
-rem [8] tested only on Windows XP.
-rem
 echo ****************************************************************
 echo *** THIS METHOD OF BUILDING EMACS IS NO LONGER SUPPORTED.     **
-echo *** INSTEAD, FOLLOW THE INSTRUCTIONS FROM INSTALL.            **
+echo *** INSTEAD, FOLLOW THE INSTRUCTIONS IN THE FILE INSTALL.     **
+echo *** IN THE SAME DIRECTORY AS THIS BATCH FILE.                 **
 echo ****************************************************************
-:confirm_continue
-set /p answer=Continue running this script at your own risks ? (Y/N)
-if x%answer% == xy (goto confirm_continue_y)
-if x%answer% == xY (goto confirm_continue_y)
-if x%answer% == xn (goto end)
-if x%answer% == xN (goto end)
-echo Please answer by Y or N
-goto confirm_continue
-
-:confirm_continue_y
-if exist config.log del config.log
-
-rem ----------------------------------------------------------------------
-rem   See if the environment is large enough.  We need 43 (?) bytes.
-set $foo$=123456789_123456789_123456789_123456789_123
-if not "%$foo$%" == "123456789_123456789_123456789_123456789_123" goto SmallEnv
-set $foo$=
-
-rem ----------------------------------------------------------------------
-rem   Make sure we are running in the nt subdir
-if exist configure.bat goto start
-echo You must run configure from the nt subdirectory.
-goto end
-
-:start
-rem ----------------------------------------------------------------------
-rem   Attempt to enable command extensions.  Set use_extensions to 1 if
-rem   they are available and 0 if they are not available.
-set use_extensions=1
-setlocal ENABLEEXTENSIONS
-if "%CMDEXTVERSION%" == "" set use_extensions=0
-if "%use_extensions%" == "1" goto afterext
-
-echo. Command extensions are not available.  Using parameters that include the 
=
-echo. character by enclosing them in quotes will not be supported.
-
-:afterext
-
-rem ----------------------------------------------------------------------
-rem   Default settings.
-set prefix=
-set nodebug=N
-set noopt=N
-set enablechecking=N
-set profile=N
-set nocygwin=N
-set COMPILER=
-set usercflags=
-set escusercflags=
-set docflags=
-set userldflags=
-set escuserldflags=
-set extrauserlibs=
-set doldflags=
-set doextralibs=
-set sep1=
-set sep2=
-set sep3=
-set sep4=
-set distfiles=
-
-rem ----------------------------------------------------------------------
-rem   Handle arguments.
-:again
-if "%1" == "-h" goto usage
-if "%1" == "--help" goto usage
-if "%1" == "--prefix" goto setprefix
-if "%1" == "--with-gcc" goto withgcc
-if "%1" == "--with-msvc" goto withmsvc
-if "%1" == "--no-debug" goto nodebug
-if "%1" == "--no-opt" goto noopt
-if "%1" == "--enable-checking" goto enablechecking
-if "%1" == "--profile" goto profile
-if "%1" == "--no-cygwin" goto nocygwin
-if "%1" == "--cflags" goto usercflags
-if "%1" == "--ldflags" goto userldflags
-if "%1" == "--lib" goto extrauserlibs
-if "%1" == "--without-png" goto withoutpng
-if "%1" == "--without-jpeg" goto withoutjpeg
-if "%1" == "--without-gif" goto withoutgif
-if "%1" == "--without-tiff" goto withouttiff
-if "%1" == "--without-gnutls" goto withoutgnutls
-if "%1" == "--without-libxml2" goto withoutlibxml2
-if "%1" == "--without-xpm" goto withoutxpm
-if "%1" == "--with-svg" goto withsvg
-if "%1" == "--distfiles" goto distfiles
-if "%1" == "" goto checkutils
-
-:usage
-echo Usage: configure [options]
-echo Options:
-echo.   --prefix PREFIX         install Emacs in directory PREFIX
-echo.   --with-gcc              use GCC to compile Emacs
-echo.   --with-msvc             use MSVC to compile Emacs
-echo.   --no-debug              exclude debug info from executables
-echo.   --no-opt                disable optimization
-echo.   --enable-checking       enable additional run-time checks
-echo.   --profile               enable profiling
-echo.   --no-cygwin             use -mno-cygwin option with GCC
-echo.   --cflags FLAG           pass FLAG to compiler
-echo.   --ldflags FLAG          pass FLAG to compiler when linking
-echo.   --lib LIB               link to extra library LIB
-echo.   --without-png           do not use PNG library even if it is installed
-echo.   --without-jpeg          do not use JPEG library even if it is installed
-echo.   --without-gif           do not use GIF library even if it is installed
-echo.   --without-tiff          do not use TIFF library even if it is installed
-echo.   --without-xpm           do not use XPM library even if it is installed
-echo.   --without-gnutls        do not use GnuTLS library even if it is 
installed
-echo.   --without-libxml2       do not use libxml2 library even if it is 
installed
-echo.   --with-svg              use the RSVG library (experimental)
-echo.   --distfiles             path to files for make dist, e.g. libXpm.dll
-if "%use_extensions%" == "0" goto end
-echo.
-echo. The cflags and ldflags arguments support parameters that include the =
-echo. character.  However, since the = character is normally treated as a
-echo. separator character you will need to enclose any parameter that includes
-echo. the = character in quotes.  For example, to include
-echo. -DSITELOAD_PURESIZE_EXTRA=100000 as one of the cflags you would run
-echo. configure.bat as follows:
-echo. configure.bat --cflags "-DSITELOAD_PURESIZE_EXTRA=100000"
-echo.
-echo. Note that this capability of processing parameters that include the =
-echo. character depends on command extensions.  This batch file attempts to
-echo. enable command extensions.  If command extensions cannot be enabled, a
-echo. warning message will be displayed.
-echo.
-echo. IMPORTANT: This method of building Emacs for MS-Windows is deprecated,
-echo. and could be removed in a future version of Emacs.  The preferred way
-echo  to build Emacs for MS-Windows from now on is using the MSYS environment
-echo. and MinGW development tools.  Please see nt/INSTALL for details.
-goto end
-
-rem ----------------------------------------------------------------------
-
-:setprefix
-shift
-set prefix=%1
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:withgcc
-set COMPILER=gcc
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:withmsvc
-set COMPILER=cl
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:nodebug
-set nodebug=Y
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:noopt
-set noopt=Y
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:enablechecking
-set enablechecking=Y
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:profile
-set profile=Y
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:nocygwin
-set nocygwin=Y
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:usercflags
-if "%use_extensions%" == "1" goto ucflagex
-goto ucflagne
-
-:ucflagex
-shift
-set usercflags=%usercflags%%sep1%%~1
-set escusercflags=%usercflags:"=\"%
-set sep1= %nothing%
-shift
-goto again
-
-:ucflagne
-shift
-set usercflags=%usercflags%%sep1%%1
-set escusercflags=%usercflags%
-set sep1= %nothing%
-shift
-goto again
-
-:extrauserlibs
-shift
-echo. extrauserlibs: %extrauserlibs%
-set extrauserlibs=%extrauserlibs%%sep4%%1
-set sep4= %nothing%
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:userldflags
-if "%use_extensions%" == "1" goto ulflagex
-goto ulflagne
-
-:ulflagex
-shift
-set userldflags=%userldflags%%sep2%%~1
-set escuserldflags=%userldflags:"=\"%
-set sep2= %nothing%
-shift
-goto again
-
-:ulflagne
-shift
-set userldflags=%userldflags%%sep2%%1
-set escuserldflags=%userldflags%
-set sep2= %nothing%
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:withoutpng
-set pngsupport=N
-set HAVE_PNG=
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:withoutjpeg
-set jpegsupport=N
-set HAVE_JPEG=
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:withoutgif
-set gifsupport=N
-set HAVE_GIF=
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:withoutgnutls
-set tlssupport=N
-set HAVE_GNUTLS=
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:withoutlibxml2
-set libxml2support=N
-set HAVE_LIBXML2=
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:withouttiff
-set tiffsupport=N
-set HAVE_TIFF=
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-
-:withoutxpm
-set xpmsupport=N
-set HAVE_XPM=
-shift
-goto again
-
-:withsvg
-shift
-set svgsupport=Y
-goto again
-
-rem ----------------------------------------------------------------------
-
-:distfiles
-set HAVE_DISTFILES=1
-shift
-set distfiles=%distfiles%%sep3%%1
-set sep3= %nothing%
-shift
-goto again
-
-rem ----------------------------------------------------------------------
-rem    Check that necessary utilities (cp and rm) are present.
-
-:checkutils
-echo Checking for 'cp'...
-cp configure.bat junk.bat
-if not exist junk.bat goto needcp
-echo Checking for 'rm'...
-rm junk.bat
-if exist junk.bat goto needrm
-goto checkcompiler
-
-:needcp
-echo You need 'cp' (the Unix file copy program) to build Emacs.
-goto end
-
-:needrm
-del junk.bat
-echo You need 'rm' (the Unix file delete program) to build Emacs.
-goto end
-
-rem ----------------------------------------------------------------------
-rem   Auto-detect compiler if not specified, and validate GCC if chosen.
-
-:checkcompiler
-if (%COMPILER%)==(cl) goto compilercheckdone
-if (%COMPILER%)==(gcc) goto checkgcc
-
-echo Checking whether 'gcc' is available...
-echo main(){} >junk.c
-gcc -c junk.c
-if exist junk.o goto checkgcc
-
-echo Checking whether 'cl' is available...
-cl -nologo -c junk.c
-if exist junk.obj goto clOK
-goto nocompiler
-
-:checkgcc
-if exist junk.o del junk.o
-Rem WARNING -- COMMAND.COM on some systems only looks at the first
-Rem            8 characters of a label.  So do NOT be tempted to change
-Rem            chkapi* into something fancier like checkw32api
-Rem You HAVE been warned!
-if (%nocygwin%) == (Y) goto chkapiN
-echo Checking whether gcc requires '-mno-cygwin'...
-echo #include "cygwin/version.h" >junk.c
-echo main(){} >>junk.c
-echo gcc -c junk.c >>config.log
-gcc -c junk.c >>config.log 2>&1
-if not exist junk.o goto chkapi
-echo gcc -mno-cygwin -c junk.c >>config.log
-gcc -mno-cygwin -c junk.c >>config.log 2>&1
-if exist junk.o set nocygwin=Y
-
-:chkapi
-echo The failed program was: >>config.log
-type junk.c >>config.log
-
-:chkapiN
-rm -f junk.c junk.o
-rem ----------------------------------------------------------------------
-rem   Older versions of the Windows API headers either don't have any of
-rem   the IMAGE_xxx definitions (the headers that come with Cygwin b20.1
-rem   are like this), or have a typo in the definition of
-rem   IMAGE_FIRST_SECTION (the headers with gcc/mingw32 2.95 have this
-rem   problem).  The gcc/mingw32 2.95.2 headers are okay, as are distros
-rem   of w32api-xxx.zip from Anders Norlander since 1999-11-18 at least.
-rem   Beginning with Emacs 23, we need usp10.h.
-rem
-echo Checking whether Windows API headers are too old...
-echo #include "windows.h" >junk.c
-echo #include "usp10.h" >>junk.c
-echo void test(PIMAGE_NT_HEADERS pHeader) >>junk.c
-echo {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);} >>junk.c
-if (%nocygwin%) == (Y) goto chkapi1
-set cf=%usercflags%
-goto chkapi2
-
-:chkapi1
-set cf=%usercflags% -mno-cygwin
-
-:chkapi2
-echo on
-gcc %cf% -c junk.c
address@hidden off
address@hidden gcc %cf% -c junk.c >>config.log
-gcc %cf% -c junk.c >>config.log 2>&1
-set cf=
-if exist junk.o goto chkuser
-echo The failed program was: >>config.log
-type junk.c >>config.log
-goto nocompiler
-
-:chkuser
-rm -f junk.o
-echo int main (int argc, char *argv[]) {>junk.c
-echo char *usercflags = "%escusercflags%";>>junk.c
-echo }>>junk.c
-echo gcc -Werror -c junk.c >>config.log
-gcc -Werror -c junk.c >>config.log 2>&1
-if exist junk.o goto gccOk
-echo.
-echo Error in --cflags argument: %usercflags%
-echo Backslashes and quotes cannot be used with --cflags.  Please use forward
-echo slashes for filenames and paths (e.g. when passing directories to -I).
-rm -f junk.c
-goto end
-
-:nocompiler
-echo.
-echo Configure failed.
-echo To configure Emacs for Windows, you need to have either
-echo gcc-2.95 or later with Mingw32 and the Windows API headers,
-echo or MSVC 2.x or later.
-del junk.c
-goto end
-
-:gccOk
-set COMPILER=gcc
-echo Using 'gcc'
-rm -f junk.c junk.o
-Rem It is not clear what GCC version began supporting -mtune
-Rem and pentium4 on x86, so check this explicitly.
-echo main(){} >junk.c
-echo gcc -c -O2 -mtune=pentium4 junk.c >>config.log
-gcc -c -O2 -mtune=pentium4 junk.c >>config.log 2>&1
-if not errorlevel 1 goto gccMtuneOk
-echo The failed program was: >>config.log
-type junk.c >>config.log
-set mf=-mcpu=i686
-rm -f junk.c junk.o
-goto gccdebug
-
-:gccMtuneOk
-echo GCC supports -mtune=pentium4 >>config.log
-set mf=-mtune=pentium4
-rm -f junk.c junk.o
-
-:gccdebug
-rem Check for DWARF-2 debug info support, else default to stabs
-echo main(){} >junk.c
-echo gcc -c -gdwarf-2 -g3 junk.c >>config.log
-gcc -c -gdwarf-2 -g3 junk.c >>config.log 2>&1
-if not errorlevel 1 goto gccdwarf
-echo The failed program was: >>config.log
-type junk.c >>config.log
-set dbginfo=-gstabs+
-rm -f junk.c junk.o
-goto compilercheckdone
-
-:gccdwarf
-echo GCC supports DWARF-2 >>config.log
-set dbginfo=-gdwarf-2 -g3
-rm -f junk.c junk.o
-goto compilercheckdone
-
-:clOk
-set COMPILER=cl
-rm -f junk.c junk.obj
-echo Using 'MSVC'
-
-:compilercheckdone
-
-rem ----------------------------------------------------------------------
-rem   Check for external image libraries. Since they are loaded
-rem   dynamically, the libraries themselves do not need to be present
-rem   at compile time, but the header files are required.
-
-set mingwflag=
-
-if (%nocygwin%) == (N) goto flagsOK
-set mingwflag=-mno-cygwin
-
-:flagsOK
-
-if (%pngsupport%) == (N) goto pngDone
-
-echo Checking for libpng...
-echo #include "png.h" >junk.c
-echo main (){} >>junk.c
-rem   -o option is ignored with cl, but allows result to be consistent.
-echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
-%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 
2>>config.log
-if exist junk.obj goto havePng
-
-echo ...png.h not found, building without PNG support.
-echo The failed program was: >>config.log
-type junk.c >>config.log
-set HAVE_PNG=
-goto :pngDone
-
-:havePng
-echo ...PNG header available, building with PNG support.
-set HAVE_PNG=1
-
-:pngDone
-rm -f junk.c junk.obj
-
-if (%tlssupport%) == (N) goto tlsDone
-
-rem this is a copy of the PNG detection
-echo Checking for libgnutls...
-echo #include "gnutls/gnutls.h" >junk.c
-echo main (){} >>junk.c
-rem   -o option is ignored with cl, but allows result to be consistent.
-echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
-%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 
2>>config.log
-if exist junk.obj goto haveTls
-
-echo ...gnutls.h not found, building without TLS support.
-echo The failed program was: >>config.log
-type junk.c >>config.log
-set HAVE_GNUTLS=
-goto :tlsDone
-
-:haveTls
-echo ...GnuTLS header available, building with GnuTLS support.
-set HAVE_GNUTLS=1
-
-:tlsDone
-rm -f junk.c junk.obj
-
-if (%libxml2support%) == (N) goto xml2Done
-
-echo Checking for libxml2....
-echo #include "libxml/HTMLparser.h" >junk.c
-echo main(){} >>junk.c
-echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
-%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 
2>>config.log
-if exist junk.obj goto havelibxml2
-
-echo ...libxml/HTMLparser.h not found, building without libxml2 support
-echo The failed program was: >>config.log
-type junk.c >>config.log
-set HAVE_LIBXML2=
-goto xml2Done
-
-:havelibxml2
-echo ...libxml2 header available, building with libxml2 support
-set HAVE_LIBXML2=1
-
-:xml2Done
-rm -f junk.c junk.obj
-
-if (%jpegsupport%) == (N) goto jpegDone
-
-echo Checking for jpeg-6b...
-echo #include "jconfig.h" >junk.c
-echo main (){} >>junk.c
-rem   -o option is ignored with cl, but allows result to be consistent.
-echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
-%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 
2>>config.log
-if exist junk.obj goto haveJpeg
-
-echo ...jconfig.h not found, building without JPEG support.
-echo The failed program was: >>config.log
-type junk.c >>config.log
-set HAVE_JPEG=
-goto :jpegDone
-
-:haveJpeg
-echo ...JPEG header available, building with JPEG support.
-set HAVE_JPEG=1
-
-:jpegDone
-rm -f junk.c junk.obj
-
-if (%gifsupport%) == (N) goto gifDone
-
-echo Checking for libgif...
-rem giflib-5.0.0 needs size_t defined before gif_lib.h is included
-rem redirection characters need to be protected from the shell
-echo #include ^<stddef.h^> >junk.c
-echo #include "gif_lib.h" >>junk.c
-echo main (){} >>junk.c
-rem   -o option is ignored with cl, but allows result to be consistent.
-echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
-%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 
2>>config.log
-if exist junk.obj goto haveGif
-
-echo ...gif_lib.h not found, building without GIF support.
-echo The failed program was: >>config.log
-type junk.c >>config.log
-set HAVE_GIF=
-goto :gifDone
-
-:haveGif
-echo ...GIF header available, building with GIF support.
-set HAVE_GIF=1
-
-:gifDone
-rm -f junk.c junk.obj
-
-if (%tiffsupport%) == (N) goto tiffDone
-
-echo Checking for tiff...
-echo #include "tiffio.h" >junk.c
-echo main (){} >>junk.c
-rem   -o option is ignored with cl, but allows result to be consistent.
-echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
-%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 
2>>config.log
-if exist junk.obj goto haveTiff
-
-echo ...tiffio.h not found, building without TIFF support.
-echo The failed program was: >>config.log
-type junk.c >>config.log
-set HAVE_TIFF=
-goto :tiffDone
-
-:haveTiff
-echo ...TIFF header available, building with TIFF support.
-set HAVE_TIFF=1
-
-:tiffDone
-rm -f junk.c junk.obj
-
-if (%xpmsupport%) == (N) goto xpmDone
-
-echo Checking for libXpm...
-echo #define FOR_MSW 1 >junk.c
-echo #include "X11/xpm.h" >>junk.c
-echo main (){} >>junk.c
-rem   -o option is ignored with cl, but allows result to be consistent.
-echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
-%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 
2>>config.log
-if exist junk.obj goto haveXpm
-
-echo ...X11/xpm.h not found, building without XPM support.
-echo The failed program was: >>config.log
-type junk.c >>config.log
-set HAVE_XPM=
-goto :xpmDone
-
-:haveXpm
-echo ...XPM header available, building with XPM support.
-set HAVE_XPM=1
-
-:xpmDone
-rm -f junk.c junk.obj
-
-if not (%svgsupport%) == (Y) goto :svgDone
-echo Checking for librsvg...
-echo #include "librsvg/rsvg.h" >junk.c
-echo main (){} >>junk.c
-rem   -o option is ignored with cl, but allows result to be consistent.
-echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log
-%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 
2>>config.log
-if exist junk.obj goto haveSvg
-
-echo ...librsvg/rsvg.h or dependencies not found, building without SVG support.
-echo The failed program was: >>config.log
-type junk.c >>config.log
-set HAVE_RSVG=
-goto :svgDone
-
-:haveSvg
-echo ...librsvg header available, building with SVG support (EXPERIMENTAL).
-set HAVE_RSVG=1
-
-:svgDone
-rm -f junk.c junk.obj junk.err junk.out
-
-rem Any distfiles provided for building distribution? If no, we're done.
-if "(%HAVE_DISTFILES%)"=="()" goto :distFilesDone
-
-rem Any arguments to --distfiles specified? If no, we're done.
-if not "%distfiles%"=="" goto :checkDistFiles
-set distFilesOk=0
-echo No arguments specified for option --distfiles!
-goto distfilesDone
-
-:checkDistFiles
-echo Checking for distfiles...
-rem Check if all specified distfiles exist
-set fileNotFound=
-for %%d in (%distfiles%) do if not exist %%d set fileNotFound=%%d
-if not "%fileNotFound%"=="" goto distFilesNotFound
-
-set distFilesOK=1
-echo ...all distfiles found.
-goto :distFilesDone
-
-:distFilesNotFound
-set distFilesOk=0
-echo ...%fileNotFound% not found.
-set distfiles=
-goto :distfilesDone
-
-:distFilesDone
-set fileNotFound=
-
-rem ----------------------------------------------------------------------
-
-:genmakefiles
-echo Generating makefiles
-if %COMPILER% == gcc set MAKECMD=gmake
-if %COMPILER% == cl set MAKECMD=nmake
-
-rem   Pass on chosen settings to makefiles.
-rem
-rem   The weird place we put the redirection is to make sure no extra
-rem   whitespace winds up at the end of the Make variables, since some
-rem   variables, e.g. INSTALL_DIR, cannot stand that.  Yes, echo will
-rem   write the blanks between the end of command arguments and the
-rem   redirection symbol to the file.  OTOH, we cannot put the
-rem   redirection immediately after the last character of the command,
-rem   because environment variable expansion can yield a digit there,
-rem   which will then be misinterpreted as the file descriptor to
-rem   redirect...
-echo # Start of settings from configure.bat >config.settings
->>config.settings echo COMPILER=%COMPILER%
-if not "(%mf%)" == "()" >>config.settings echo MCPU_FLAG=%mf%
-if not "(%dbginfo%)" == "()" >>config.settings echo DEBUG_INFO=%dbginfo%
-if (%nodebug%) == (Y) >>config.settings echo NODEBUG=1
-if (%noopt%) == (Y) >>config.settings echo NOOPT=1
-if (%profile%) == (Y) >>config.settings echo PROFILE=1
-if (%nocygwin%) == (Y) >>config.settings echo NOCYGWIN=1
-if not "(%prefix%)" == "()" >>config.settings echo INSTALL_DIR=%prefix%
-if not "(%distfiles%)" == "()" >>config.settings echo DIST_FILES=%distfiles%
-rem We go thru docflags because usercflags could be "-DFOO=bar" -something
-rem and the if command cannot cope with this
-for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y
-if (%docflags%)==(Y) >>config.settings echo USER_CFLAGS=%usercflags%
-if (%docflags%)==(Y) >>config.settings echo ESC_USER_CFLAGS=%escusercflags%
-for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y
-if (%doldflags%)==(Y) >>config.settings echo USER_LDFLAGS=%userldflags%
-for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y
-if (%doextralibs%)==(Y) >>config.settings echo USER_LIBS=%extrauserlibs%
-echo # End of settings from configure.bat>>config.settings
-echo. >>config.settings
-
-copy config.nt config.tmp
-echo. >>config.tmp
-echo /* Start of settings from configure.bat.  */ >>config.tmp
-rem   We write USER_CFLAGS and USER_LDFLAGS starting with a space to simplify
-rem   processing of compiler options in w32.c:get_emacs_configuration_options
-if (%docflags%) == (Y) echo #define USER_CFLAGS " %escusercflags%" >>config.tmp
-if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %escuserldflags%" 
>>config.tmp
-if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp
-if (%enablechecking%) == (Y) echo #define ENABLE_CHECKING 1 >>config.tmp
-if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp
-if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp
-if not "(%HAVE_LIBXML2%)" == "()" echo #define HAVE_LIBXML2 1 >>config.tmp
-if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp
-if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp
-if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp
-if not "(%HAVE_XPM%)" == "()" echo #define HAVE_XPM 1 >>config.tmp
-if "(%HAVE_RSVG%)" == "(1)" echo #define HAVE_RSVG 1 >>config.tmp
-
-echo /* End of settings from configure.bat.  */ >>config.tmp
-
-Rem See if fc.exe returns a meaningful exit status.  If it does, we
-Rem might as well avoid unnecessary overwriting of config.h and epaths.h,
-Rem since this forces recompilation of every source file.
-if exist foo.bar del foo.bar
-fc /b foo.bar foo.bar >nul 2>&1
-if not errorlevel 2 goto doCopy
-fc /b config.tmp ..\src\config.h >nul 2>&1
-if errorlevel 1 goto doCopy
-fc /b paths.h ..\src\epaths.h >nul 2>&1
-if not errorlevel 1 goto dontCopy
-
-:doCopy
-copy config.tmp ..\src\config.h
-copy paths.h ..\src\epaths.h
-
-:dontCopy
-if exist config.tmp del config.tmp
-copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile
-if exist ..\admin\unidata copy /b 
config.settings+%MAKECMD%.defs+..\admin\unidata\makefile.w32-in 
..\admin\unidata\makefile
-copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in 
..\lib-src\makefile
-copy /b config.settings+%MAKECMD%.defs+..\lib\makefile.w32-in ..\lib\makefile
-copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile
-copy /b config.settings+%MAKECMD%.defs+..\doc\emacs\makefile.w32-in 
..\doc\emacs\makefile
-copy /b config.settings+%MAKECMD%.defs+..\doc\misc\makefile.w32-in 
..\doc\misc\makefile
-copy /b config.settings+%MAKECMD%.defs+..\doc\lispref\makefile.w32-in 
..\doc\lispref\makefile
-copy /b config.settings+%MAKECMD%.defs+..\doc\lispintro\makefile.w32-in 
..\doc\lispintro\makefile
-if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile
-copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile
-rem   Use the default (no-op) Makefile.in if the nt version is not present.
-if exist ..\leim\makefile.w32-in copy /b 
config.settings+%MAKECMD%.defs+..\leim\makefile.w32-in ..\leim\makefile
-if not exist ..\leim\makefile.w32-in copy /b 
config.settings+%MAKECMD%.defs+..\leim\Makefile.in ..\leim\makefile
-del config.settings
-
-Rem Some people use WinZip which doesn't create empty directories!
-if not exist ..\site-lisp\nul mkdir ..\site-lisp\
-Rem Update subdirs.el only if it is different or fc.exe doesn't work.
-if exist foo.bar del foo.bar
-fc /b foo.bar foo.bar >nul 2>&1
-if not errorlevel 2 goto doUpdateSubdirs
-fc /b subdirs.el ..\site-lisp\subdirs.el >nul 2>&1
-if not errorlevel 1 goto dontUpdateSubdirs
-
-:doUpdateSubdirs
-if exist ..\site-lisp\subdirs.el del ..\site-lisp\subdirs.el
-copy subdirs.el ..\site-lisp\subdirs.el
-
-:dontUpdateSubdirs
-echo.
-
-rem check that we have all the libraries we need.
-set libsOK=1
-
-if not "(%HAVE_XPM%)" == "()" goto checkpng
-if (%xpmsupport%) == (N) goto checkpng
- set libsOK=0
- echo XPM support is missing. It is required for color icons in the toolbar.
- echo   Install libXpm development files or use --without-xpm
-
-:checkpng
-if not "(%HAVE_PNG%)" == "()" goto checkjpeg
-if (%pngsupport%) == (N) goto checkjpeg
- set libsOK=0
- echo PNG support is missing.
- echo   Install libpng development files or use --without-png
-
-:checkjpeg
-if not "(%HAVE_JPEG%)" == "()" goto checktiff
-if (%jpegsupport%) == (N) goto checktiff
- set libsOK=0
- echo JPEG support is missing.
- echo   Install jpeg development files or use --without-jpeg
-
-:checktiff
-if not "(%HAVE_TIFF%)" == "()" goto checkgif
-if (%tiffsupport%) == (N) goto checkgif
- set libsOK=0
- echo TIFF support is missing.
- echo   Install libtiff development files or use --without-tiff
-
-:checkgif
-if not "(%HAVE_GIF%)" == "()" goto checkdistfiles
-if (%gifsupport%) == (N) goto checkdistfiles
- set libsOK=0
- echo GIF support is missing.
- echo   Install giflib or libungif development files or use --without-gif
-
-:checkdistfiles
-if "(%HAVE_DISTFILES%)" == "()" goto donelibchecks
-if (%distFilesOk%) == (1) goto donelibchecks
-echo.
-echo Files specified with option --distfiles could not be found.
-echo   Fix these issues before running make dist
-
-:donelibchecks
-if (%libsOK%) == (1) goto success
-echo.
-echo Important libraries are missing. Fix these issues before running make.
-goto end
-
-:success
-echo Emacs successfully configured.
-echo Emacs successfully configured. >>config.log
-if (%MAKECMD%) == (gmake) set MAKECMD=make
-echo Run `%MAKECMD%' to build, then run `%MAKECMD% install' to install.
-goto end
-
-:SmallEnv
-echo Your environment size is too small.  Please enlarge it and rerun 
configure.
-echo For example, type "command.com /e:2048" to have 2048 bytes available.
-set $foo$=
-
-:end
-set prefix=
-set nodebug=
-set noopt=
-set enablechecking=
-set profile=
-set nocygwin=
-set COMPILER=
-set MAKECMD=
-set usercflags=
-set docflags=
-set userldflags=
-set doldflags=
-set mingwflag=
-set mf=
-set distfiles=
-set HAVE_DISTFILES=
-set distFilesOk=
-set pngsupport=
-set tlssupport=
-set libxml2support=
-set jpegsupport=
-set gifsupport=
-set tiffsupport=
-set xpmsupport=
-set svgsupport=
-set libsOK=
-set HAVE_GIF=
-set HAVE_JPEG=
-set HAVE_PNG=
-set HAVE_TIFF=
-set HAVE_XPM=
-set dbginfo=
-endlocal
-set use_extensions=
diff --git a/nt/emacs-src.tags b/nt/emacs-src.tags
deleted file mode 100644
index 8c18713..0000000
--- a/nt/emacs-src.tags
+++ /dev/null
@@ -1,6 +0,0 @@
-  This file defines the regular expressions for etags to look for
-  in the src directory.  It is used by the w32 build to work around
-  the annoyances of quoting command-line arguments with various
-  w32 shell.
-
-/[     ]*DEFVAR_[A-Z_  (]+"\([^"]+\)"/
diff --git a/nt/envadd.bat b/nt/envadd.bat
deleted file mode 100644
index 21f0f4b..0000000
--- a/nt/envadd.bat
+++ /dev/null
@@ -1,43 +0,0 @@
-rem  Hack to change/add environment variables in the makefiles for the
-rem  Windows platform.
-
-rem Copyright (C) 2003-2015 Free Software Foundation, Inc.
-
-rem  This file is part of GNU Emacs.
-
-rem  GNU Emacs is free software: you can redistribute it and/or modify
-rem  it under the terms of the GNU General Public License as published by
-rem  the Free Software Foundation, either version 3 of the License, or
-rem  (at your option) any later version.
-
-rem  GNU Emacs is distributed in the hope that it will be useful,
-rem  but WITHOUT ANY WARRANTY; without even the implied warranty of
-rem  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-rem  GNU General Public License for more details.
-
-rem  You should have received a copy of the GNU General Public License
-rem  along with GNU Emacs.  If not, see http://www.gnu.org/licenses/.
-
-
-rem  Usage:
-rem    envadd "ENV1=VAL1" "ENV2=VAL2" ... /C <command line>
-rem
-rem  The "/C" switch marks the end of environment variables, and the
-rem  beginning of the command line.
-rem
-rem  By Peter 'Luna' Runestig <address@hidden> 2003
-
-:Loop
-if .%1% == ./C goto EndLoop
-rem just to avoid an endless loop:
-if .%1% == . goto EndLoop
-set %1
-shift
-goto Loop
-:EndLoop
-
-rem Eat the "/C"
-shift
-rem Now, run the command line
-%1 %2 %3 %4 %5 %6 %7 %8 %9
-
diff --git a/nt/gmake.defs b/nt/gmake.defs
deleted file mode 100644
index 90a3709..0000000
--- a/nt/gmake.defs
+++ /dev/null
@@ -1,333 +0,0 @@
-#  -*- Makefile -*- definition file for building GNU Emacs on Windows NT.
-# Copyright (C) 2000-2015 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-# Ensure 'all' is the default target
-all:
-
-# NOTES
-#
-# I tried to force gmake to use the native shell for simplicity, by
-# setting SHELL as below, but this didn't work reliably because of
-# various case sensitivity niggles.  Specifically, COMSPEC (which is in
-# fact usually spelled ComSpec on NT, to make life difficult) typically
-# references "cmd.exe" (on NT) when the file is actually called
-# "CMD.EXE" on disk for hysterical raisons.  As a result, GNU make
-# thinks it doesn't exist (unless compiled with a switch to ignore
-# case), and so doesn't change which shell it will invoke to execute
-# commands.
-#
-# It would be possible, though very tedious using just gmake facilities,
-# to convert the COMSPEC value to uppercase to solve this problem, but
-# it isn't worth it.  That is partly because, even when using the native
-# shell, gmake tends to not be happy with backslashes in command
-# strings.  The obvious solution is to use forward slashes as much as
-# possible, which can be made to work most of the time (putting
-# filenames in quotes often helps), but there are still some internal
-# cmd.exe commands like `del' and `copy' that won't work with them.
-# Although it is possible to convert slashes to backslashes when
-# necessary, gmake requires explicitly calling its subst function, which
-# nmake does not understand).  For this reason, it is simplest to
-# mandate that rm and cp be available, so we can use Unix-format file
-# names everywhere.  (Fortunately both MS and GNU make, and the
-# respective compilers, are happy with Unix-format names.)
-#
-# Since we cannot easily force the choice of a particular shell, we must
-# make the effort to cope with whichever shell is being used.
-# Fortunately, the only command we need to use that is shell specific is
-# the testing of a file's existence for the purpose of working out when
-# we are copying files to their original location.  That particular
-# requirement is abstracted easily enough.
-#
-# The only other problem area was the change of directory when running
-# temacs to dump emacs.exe (where gmake doesn't support cd foo in any
-# useful way), but that has been resolved by modifying the Windows
-# unexec function slightly to not require the directory change while
-# still allowing objects and binaries to be in subdirectories.
-
-# This doesn't work.
-#SHELL:=$(COMSPEC)
-
-# Determine whether make is using sh or cmd/command as shell; cmd.exe
-# will output "ECHO is on" when echo is given by itself, while sh will
-# not produce any output.
-sh_output := $(shell echo)
-ifeq "$(findstring ECHO, $(sh_output))" "ECHO"
-THE_SHELL = $(COMSPEC)$(ComSpec)
-SHELLTYPE=CMD
-SWITCHCHAR=/
-else
-USING_SH = 1
-THE_SHELL = $(SHELL)
-SHELLTYPE=SH
-# MSYS needs to double the slash in cmd-style switches to avoid
-# interpreting /x as a Posix style file name reference
-ifneq ($(MSYSTEM),)
-SWITCHCHAR=//
-else
-SWITCHCHAR=/
-endif
-endif
-
-MAKETYPE=gmake
-
-# The following "ifeq" does not appear to DTRT, and therefore breaks
-# the build on mingw32. Also the -m option does not exist in many
-# (reasonably recent even) versions of Cygwin. These issues need to be
-# remedied before putting this cygpath kludge back in.
-
-# Convert CURDIR to native file name, if in Cygwin format
-#ifeq "$(shell cygpath $(CURDIR))" "$(CURDIR)"
-#CURDIR                := $(shell cygpath -m $(CURDIR))
-#endif
-
-THISDIR                = .
-
-# Cygwin has changed quoting rules somewhat since b20, in a way that
-# affects makefiles using sh as the command processor, so we need to
-# detect which rules to use.
-ifdef USING_SH
-sh_output := $(shell echo [Please ignore a syntax error on the next line - it 
is intentional] 1>&2)
-sh_output := $(shell echo foo")
-# This single quote " is to fix fontification due to previous line
-ifeq "$(sh_output)" ""
-NEW_CYGWIN = 1
-endif
-
-# By default, newer versions of Cygwin mess with NTFS ACLs in an
-# attempt to emulate traditional posix file permissions. This can
-# cause bad effects, such as .exe files that are missing the
-# FILE_EXECUTE/FILE_GENERIC_EXECUTE permissions when they are created
-# with Cygwin commands that don't expect to be creating executable
-# files. Then when we later use a non-Cygwin program to create the
-# real .exe, the previous Cygwin defined ACL sticks.
-CYGWIN=nontsec
-export CYGWIN
-endif
-
-ALL_DEPS       = $^
-EMPTY =
-SPACE = $(EMPTY) $(EMPTY)
-
-SUBSYSTEM_WINDOWS=-Wl,-subsystem,windows
-SUBSYSTEM_CONSOLE=-Wl,-subsystem,console
-
-# INSTALL_DIR is the directory into which emacs will be installed.
-#
-ifndef INSTALL_DIR
-INSTALL_DIR     = $(CURDIR)/..
-endif
-
-export EMACSLOADPATH
-
-# Determine the architecture we're running on.
-# Define ARCH for our purposes;
-# Define CPU for use by ntwin32.mak;
-# Define CONFIG_H to the appropriate config.h for the system;
-#
-ifdef PROCESSOR_ARCHITECTURE
-# We're on Windows NT
-CPU            = $(PROCESSOR_ARCHITECTURE)
-CONFIG_H       = config.nt
-OS_TYPE                = windowsnt
- ifeq "$(PROCESSOR_ARCHITECTURE)" "x86"
-ARCH           = i386
-CPU            = i386
-EMACS_HEAPSIZE = 27
-EMACS_PURESIZE = 5000000
-EMACS_MANIFEST = emacs-x86.manifest
- else
-  ifeq "$(PROCESSOR_ARCHITECTURE)" "MIPS"
-ARCH           = mips
-EMACS_HEAPSIZE = 27
-EMACS_PURESIZE = 5000000
-EMACS_MANIFEST = emacs-mips.manifest
-  else
-   ifeq "$(PROCESSOR_ARCHITECTURE)" "ALPHA"
-ARCH           = alpha
-EMACS_HEAPSIZE = 27
-EMACS_PURESIZE = 5000000
-EMACS_MANIFEST = emacs-alpha.manifest
-   else
-    ifeq "$(PROCESSOR_ARCHITECTURE)" "PPC"
-ARCH           = ppc
-EMACS_HEAPSIZE = 27
-EMACS_PURESIZE = 5000000
-EMACS_MANIFEST = emacs-ppc.manifest
-    else
-     $(error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)")
-    endif
-   endif
-  endif
- endif
-else
-# We're on Windows 95
-ARCH           = i386
-CPU            = i386
-CONFIG_H       = config.nt
-OS_TYPE                = windows95
-endif
-
-AR             = ar -rsc
-AR_OUT         =
-CC             = gcc
-CC_OUT         = -o$(SPACE)
-LINK           = gcc
-LINK_OUT       = -o$(SPACE)
-RC             = windres -O coff
-RC_OUT         = -o$(SPACE)
-RC_INCLUDE     = --include-dir$(SPACE)
-
-libc           =
-baselibs       =
-O              = o
-A              = a
-
-BASE_LIBS      = $(libc) $(baselibs)
-
-ADVAPI32       = -ladvapi32
-COMCTL32       = -lcomctl32
-COMDLG32       = -lcomdlg32
-GDI32          = -lgdi32
-MPR            = -lmpr
-SHELL32                = -lshell32
-USER32         = -luser32
-WSOCK32                = -lwsock32
-WINMM          = -lwinmm
-WINSPOOL       = -lwinspool
-OLE32          = -lole32
-UNISCRIBE      = -lusp10
-UUID           = -luuid
-
-# Used by src/makefile.w32-in, since Nmake barfs on $(func SOMETHING)
-OBJ0_c         = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0))
-OBJ1_c         = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1))
-OBJ2_c         = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2))
-
-ifdef NOOPT
-DEBUG_CFLAGS   = -DEMACSDEBUG -fno-crossjumping -std=gnu99
-else
-DEBUG_CFLAGS   =
-endif
-
-MWINDOWS        = -mwindows
-
-CFLAGS          = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(PROFILE_CFLAGS) 
$(USER_CFLAGS) $(LOCAL_FLAGS)
-ESC_CFLAGS      = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(PROFILE_CFLAGS) 
$(ESC_USER_CFLAGS) $(LOCAL_FLAGS)
-EMACS_EXTRA_C_FLAGS = -DUSE_CRT_DLL=1
-
-ifdef PROFILE
-PROFILE_CFLAGS  = -pg
-PROFILE_LDFLAGS  = -pg
-else
-PROFILE_CFLAGS  =
-PROFILE_LDFLAGS =
-endif
-
-
-# see comments in allocate_heap in w32heap.c before changing any of the
-# -stack, -heap, or -image-base settings.
-TEMACS_EXTRA_LINK = -Wl,-stack,0x00800000 -Wl,-heap,0x00100000 
-Wl,-image-base,0x01000000 $(SUBSYSTEM_CONSOLE) -Wl,-entry,__start 
-Wl,-Map,$(BLD)/temacs.map
-
-ifdef NOOPT
-OBJDIR          = oo
-else
-OBJDIR          = oo-spd
-endif
-$(OBJDIR):;    -mkdir "$(OBJDIR)"
-BLD             = $(OBJDIR)/$(ARCH)
-stamp_BLD:      $(OBJDIR)
-               -mkdir "$(BLD)"
-               echo $(BLD) > $@
-
-COMPILER_TEMP_FILES =
-
-CP             = cp -f
-CP_DIR         = cp -rf
-DEL            = rm
-DEL_TREE       = rm -r
-
-DIRNAME                = $(notdir $(CURDIR))
-
-ifdef USING_SH
-
-IFNOTSAMEDIR   = if [ ! -s ../$(DIRNAME)_same-dir.tst ] ; then
-FOREACH                = for f in
-FORVAR         = $${f}
-FORDO          = ; do
-ENDFOR         = ; done
-ENDIF          = ; fi
-ARGQUOTE       = '
-ifdef NEW_CYGWIN
-DQUOTE         = "
-else
-DQUOTE         = ""
-endif
-
-else
-
-IFNOTSAMEDIR   = if not exist ../$(DIRNAME)_same-dir.tst
-FOREACH                = for %%f in (
-FORVAR         = %%f
-FORDO          = ) do
-ENDFOR         =
-ENDIF          =
-ARGQUOTE       = "
-DQUOTE         = \"
-
-endif
-
-ifdef NODEBUG
-DEBUG_FLAG =
-DEBUG_LINK =
-else
-DEBUG_FLAG = $(DEBUG_INFO)
-DEBUG_LINK = $(DEBUG_INFO)
-endif
-
-ifdef NOCYGWIN
-NOCYGWIN = -mno-cygwin
-endif
-
-ifdef USER_LIBS
-USER_LIBS := $(patsubst %,-l%,$(USER_LIBS))
-endif
-
-PRAGMA_SYSTEM_HEADER = \#pragma GCC system_header
-
-ifeq "$(ARCH)" "i386"
-ifdef NOOPT
-ARCH_CFLAGS     = -c $(DEBUG_FLAG) $(NOCYGWIN)
-else
-ARCH_CFLAGS     = -c $(DEBUG_FLAG) $(NOCYGWIN) $(MCPU_FLAG) -O2 \
-                 # -fbuiltin \
-                 # -finline-functions \
-                 # -fomit-frame-pointer
-endif
-ARCH_LDFLAGS   = $(SYS_LDFLAGS)
-else
-ERROR Unknown architecture type "$(ARCH)".
-endif
-
-LINK_FLAGS     = $(ARCH_LDFLAGS) $(DEBUG_LINK) $(PROFILE_LDFLAGS) $(NOCYGWIN) 
$(USER_LDFLAGS)
-
-export XMFLAGS
-
-.DEFAULT:
-
-$(BLD)/%.o: %.c
-               $(CC) $(CFLAGS) $(CC_OUT)$@ $<
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 4fb32df..e7a94e8 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -187,6 +187,20 @@ extern struct tm * sys_localtime (const time_t *);
 #undef HAVE__SETJMP
 #endif
 
+/* The following is needed for recovery from C stack overflows.  */
+#include <setjmp.h>
+typedef jmp_buf sigjmp_buf;
+#ifdef MINGW_W64
+/* Evidently, MinGW64's longjmp crashes when invoked from an exception
+   handler, see https://sourceforge.net/p/mingw-w64/mailman/message/32421953/.
+   This seems to be an unsolved problem in the MinGW64 runtime.  So we
+   use the GCC intrinsics instead.  FIXME.  */
+#define sigsetjmp(j,m) __builtin_setjmp(j)
+#else
+#define sigsetjmp(j,m) setjmp(j)
+#endif
+extern void w32_reset_stack_overflow_guard (void);
+
 #ifdef _MSC_VER
 #include <sys/timeb.h>
 #include <sys/stat.h>
diff --git a/nt/makefile.w32-in b/nt/makefile.w32-in
deleted file mode 100644
index ff2bf27..0000000
--- a/nt/makefile.w32-in
+++ /dev/null
@@ -1,465 +0,0 @@
-# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
-# Copyright (C) 2000-2015 Free Software Foundation, Inc.
-#
-# Top level makefile for building GNU Emacs on Windows NT
-#
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-# FIXME: This file uses DOS EOLs.  Convert to Unix after 22.1 is out
-#        (and remove or replace this comment).
-
-VERSION                = 25.0.50
-
-TMP_DIST_DIR   = emacs-$(VERSION)
-
-TRES           = $(BLD)/emacs.res
-CLIENTRES      = $(BLD)/emacsclient.res
-
-LOCAL_FLAGS    = -DOLD_PATHS=1
-
-XMFLAGS                =
-
-ALL            = $(BLD)/addpm.exe $(BLD)/ddeclient.exe $(BLD)/runemacs.exe \
-                 $(BLD)/cmdproxy.exe $(BLD)/addsection.exe $(BLD)/preprep.exe
-
-$(BLD)/addpm.exe: $(BLD)/addpm.$(O)
-                 $(LINK) $(LINK_OUT)$@ \
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) \
-                 $(USER32) $(OLE32) $(UUID) $(SHELL32)
-
-$(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
-                 $(LINK) $(LINK_OUT)$@ \
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
-
-$(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
-                 $(LINK) $(LINK_OUT)$@ \
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
-
-$(BLD)/addsection.exe: $(BLD)/addsection.$(O)
-                 $(LINK) $(LINK_OUT)$@ \
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
-
-$(BLD)/preprep.exe: $(BLD)/preprep.$(O)
-                 $(LINK) $(LINK_OUT)$@ \
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)
-
-#
-# The resource file.  NT 3.10 requires the use of cvtres; even though
-# it is not necessary on later versions, it is still ok to use it.
-#
-$(TRES):       emacs.rc icons/emacs.ico $(EMACS_MANIFEST) stamp_BLD
-               $(RC) $(RC_OUT)$(TRES) emacs.rc
-
-$(CLIENTRES):  emacsclient.rc stamp_BLD
-               $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
-
-$(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
-                 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
-
-which-sh:
-       @echo Using $(THE_SHELL) as shell.
-
-# These depend on stamp_BLD to make sure the $(BLD) directory is created
-# before the compilation begins, even if Make runs several commands
-# in parallel under "make -j".
-#
-$(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) 
$(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
-
-#
-# Build emacs
-#
-all:   which-sh $(ALL) $(CLIENTRES) all-other-dirs-$(MAKETYPE)
-
-all-other-dirs-$(MAKETYPE): maybe-bootstrap
-
-all-other-dirs-nmake: $(BLD)/addsection.exe
-       cd ..\lib
-       $(MAKE) $(MFLAGS) all
-       cd ..\lib-src
-       $(MAKE) $(MFLAGS) all
-       cd ..\src
-       $(MAKE) $(MFLAGS) all
-       cd ..\lisp
-       $(MAKE) $(MFLAGS) all
-       cd ..\leim
-       $(MAKE) $(MFLAGS) all
-       cd ..\nt
-
-all-other-dirs-gmake: $(BLD)/addsection.exe
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
-
-recompile:     recompile-$(MAKETYPE)
-
-recompile-nmake:
-       cd ..\lisp
-       $(MAKE) $(MFLAGS) recompile
-       cd ..\nt
-
-recompile-gmake:
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
-
-#### Bootstrapping.
-
-### This is meant for Emacs maintainers only.  It first cleans the
-### lisp subdirectory, removing all compiled Lisp files.  Then a
-### special emacs executable is built from Lisp sources, which is then
-### used to compile Lisp files.  The last step is a "normal" make.
-
-maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
-
-# dummy target to force other targets to be evaluated.
-doit:
-
-maybe-bootstrap-CMD:   doit
-       @echo .
-       @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be 
missing.  You should either
-       @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 
'lisp/abbrev.elc' somehow
-       @echo .
-       @if not EXIST ..\lisp\abbrev.elc exit -1
-
-maybe-bootstrap-SH: doit
-       @if [ ! -f ../lisp/abbrev.elc ] ; then \
-         echo; \
-         echo "Essential Lisp files seem to be missing.  You should either"; \
-         echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow.";  \
-         echo; \
-         exit -1; \
-       fi
-
-# Bootstrap depends on cmdproxy because some Lisp functions
-# loaded during bootstrap may need to run shell commands.
-bootstrap:     $(BLD)/addsection.exe $(BLD)/cmdproxy.exe bootstrap-$(MAKETYPE)
-       $(MAKE) $(MFLAGS) $(XMFLAGS) all
-
-bootstrap-nmake: $(BLD)/addsection.exe $(BLD)/cmdproxy.exe
-       cd ..\lisp
-       $(MAKE) $(MFLAGS) bootstrap-clean
-       cd ..\src
-       $(MAKE) $(MFLAGS) clean
-       cd ..\lib-src
-       $(MAKE) $(MFLAGS) clean make-docfile
-       cd ..\lib
-       $(MAKE) $(MFLAGS) clean all
-       cd ..\src
-       $(MAKE) $(MFLAGS) bootstrap
-       $(MAKE) $(MFLAGS) bootstrap-clean
-       cd ..\nt
-       $(CP) $(BLD)/cmdproxy.exe ../bin
-       cd ..\lisp
-       $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
-       cd ..\lib-src
-       $(MAKE) $(MFLAGS) DOC
-       cd ..\nt
-
-bootstrap-gmake: $(BLD)/addsection.exe $(BLD)/cmdproxy.exe
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src make-docfile
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
-       $(CP) $(BLD)/cmdproxy.exe ../bin
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
-
-bootstrap-clean: bootstrap-clean-$(MAKETYPE)
-
-bootstrap-clean-nmake:
-       cd ..\src
-       $(MAKE) $(MFLAGS) bootstrap-clean
-       cd ..\lib
-       $(MAKE) $(MFLAGS) clean
-       cd ..\lisp
-       $(MAKE) $(MFLAGS) bootstrap-clean
-
-bootstrap-clean-gmake:
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
-
-$(INSTALL_DIR):
-       - mkdir "$(INSTALL_DIR)"
-
-$(INSTALL_DIR)/bin: $(INSTALL_DIR)
-       - mkdir "$(INSTALL_DIR)/bin"
-
-#
-# Build and install emacs in INSTALL_DIR
-#
-.PHONY: install-bin install-shortcuts
-
-install: install-bin install-shortcuts
-
-install-bin: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
-       - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
-       - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
-       - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
-       - $(CP) README.W32 $(INSTALL_DIR)
-       - $(DEL) ../$(DIRNAME)_same-dir.tst
-       - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
-       echo SameDirTest > "$(INSTALL_DIR)/$(DIRNAME)_same-dir.tst"
-       - mkdir "$(INSTALL_DIR)/etc"
-       - mkdir "$(INSTALL_DIR)/info"
-       - mkdir "$(INSTALL_DIR)/lock"
-       - mkdir "$(INSTALL_DIR)/data"
-       - mkdir "$(INSTALL_DIR)/site-lisp"
-       - mkdir "$(INSTALL_DIR)/etc/icons"
-       $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp 
$(ENDIF)
-       $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
-       - $(CP_DIR) icons $(INSTALL_DIR)/etc
-       $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
-       $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
-       - $(CP) ../COPYING $(INSTALL_DIR)/bin
-       - $(DEL) ../$(DIRNAME)_same-dir.tst
-       - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
-
-install-other-dirs-nmake: all
-       cd ..\lib-src
-       $(MAKE) $(MFLAGS) install
-       cd ..\src
-       $(MAKE) $(MFLAGS) install
-       cd ..\lisp
-       $(MAKE) $(MFLAGS) install
-       cd ..\leim
-       $(MAKE) $(MFLAGS) install
-       cd ..\nt
-
-install-other-dirs-gmake: all
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
-
-install-addpm: $(INSTALL_DIR)/bin $(BLD)/addpm.exe
-       - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
-
-install-shortcuts: install-addpm
-       "$(INSTALL_DIR)/bin/addpm" -q
-
-maybe-copy-distfiles: maybe-copy-distfiles-$(SHELLTYPE)
-
-maybe-copy-distfiles-CMD: create-tmp-dist-dir doit
-       @if not $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" $(CP_DIR) 
$(DIST_FILES) $(TMP_DIST_DIR)/bin
-
-maybe-copy-distfiles-SH: create-tmp-dist-dir doit
-       @if [ ! $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" ] ; then \
-         $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin ; \
-       fi
-
-create-tmp-dist-dir:
-       mkdir "$(TMP_DIST_DIR)"
-# Also create bin directory for dist files.
-       mkdir "$(TMP_DIST_DIR)/bin"
-
-dist: install-bin install-addpm maybe-copy-distfiles
-       $(CP) "$(INSTALL_DIR)/BUGS" $(TMP_DIST_DIR)
-       $(CP) "$(INSTALL_DIR)/COPYING" $(TMP_DIST_DIR)
-       $(CP) "$(INSTALL_DIR)/README" $(TMP_DIST_DIR)
-       $(CP) "$(INSTALL_DIR)/README.W32" $(TMP_DIST_DIR)
-       $(CP_DIR) "$(INSTALL_DIR)/bin" $(TMP_DIST_DIR)
-       $(CP_DIR) "$(INSTALL_DIR)/etc" $(TMP_DIST_DIR)
-       $(CP_DIR) "$(INSTALL_DIR)/info" $(TMP_DIST_DIR)
-       $(CP_DIR) "$(INSTALL_DIR)/lisp" $(TMP_DIST_DIR)
-       $(CP_DIR) "$(INSTALL_DIR)/leim" $(TMP_DIST_DIR)
-       $(CP_DIR) "$(INSTALL_DIR)/site-lisp" $(TMP_DIST_DIR)
-       $(COMSPEC)$(ComSpec) /c $(ARGQUOTE)zipdist.bat $(VERSION)$(ARGQUOTE)
-       $(DEL_TREE) $(TMP_DIST_DIR)
-
-force-info:
-# Note that doc/emacs/makefile knows how to
-# put the info files in $(infodir),
-# so we can do ok running make in the build dir.
-info: force-info info-$(MAKETYPE)
-
-info-nmake:
-       cd ..\doc\emacs
-       $(MAKE) $(MFLAGS) info
-       cd ..\misc
-       $(MAKE) $(MFLAGS) info
-       cd ..\lispref
-       $(MAKE) $(MFLAGS) info
-       cd ..\lispintro
-       $(MAKE) $(MFLAGS) info
-       cd $(MAKEDIR)
-
-info-gmake: emacs misc lispref lispintro
-
-emacs misc lispref lispintro:
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/$@ info
-
-#
-# Maintenance
-#
-clean: clean-other-dirs-$(MAKETYPE)
-       - $(DEL) $(COMPILER_TEMP_FILES)
-       - $(DEL_TREE) $(OBJDIR)
-       - $(DEL) stamp_BLD
-       - $(DEL) ../etc/DOC
-
-clean-other-dirs-nmake:
-       cd ..\lib
-       $(MAKE) $(MFLAGS) clean
-       cd ..\lib-src
-       $(MAKE) $(MFLAGS) clean
-       cd ..\src
-       $(MAKE) $(MFLAGS) clean
-       cd ..\doc\lispintro
-       $(MAKE) $(MFLAGS) clean
-       cd ..\lispref
-       $(MAKE) $(MFLAGS) clean
-       cd ..\..\leim
-       $(MAKE) $(MFLAGS) clean
-       cd ..\doc\emacs
-       $(MAKE) $(MFLAGS) clean
-       cd ..\misc
-       $(MAKE) $(MFLAGS) clean
-       cd ..\..\nt
-
-clean-other-dirs-gmake:
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
-
-cleanall-other-dirs-nmake:
-       cd ..\lib
-       $(MAKE) $(MFLAGS) cleanall
-       cd ..\lib-src
-       $(MAKE) $(MFLAGS) cleanall
-       cd ..\src
-       $(MAKE) $(MFLAGS) cleanall
-       cd ..\nt
-
-cleanall-other-dirs-gmake:
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib cleanall
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
-
-# We used to delete *~ here, but that might inadvertently remove
-# precious files if it happens to match their short 8+3 aliases.
-cleanall: clean cleanall-other-dirs-$(MAKETYPE)
-        - $(DEL_TREE) obj
-        - $(DEL_TREE) obj-spd
-        - $(DEL_TREE) oo
-        - $(DEL_TREE) oo-spd
-
-top-distclean:
-       - $(DEL) $(COMPILER_TEMP_FILES)
-       - $(DEL_TREE) obj
-       - $(DEL_TREE) obj-spd
-       - $(DEL_TREE) oo
-       - $(DEL_TREE) oo-spd
-       - $(DEL) stamp_BLD
-       - $(DEL) ../etc/DOC
-       - $(DEL) config.log Makefile
-       - $(DEL) ../README.W32
-
-distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
-
-distclean-other-dirs-nmake:
-       cd ..\lib
-       $(MAKE) $(MFLAGS) distclean
-       cd ..\lib-src
-       $(MAKE) $(MFLAGS) distclean
-       cd ..\src
-       $(MAKE) $(MFLAGS) distclean
-       cd ..\lisp
-       $(MAKE) $(MFLAGS) distclean
-       cd ..\leim
-       $(MAKE) $(MFLAGS) distclean
-       cd ..\doc\emacs
-       $(MAKE) $(MFLAGS) distclean
-       cd ..\misc
-       $(MAKE) $(MFLAGS) distclean
-       cd ..\lispintro
-       $(MAKE) $(MFLAGS) distclean
-       cd ..\lispref
-       $(MAKE) $(MFLAGS) distclean
-       cd ..\..\nt
-
-distclean-other-dirs-gmake:
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
-
-maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
-
-maintainer-clean-other-dirs-nmake:
-       cd ..\lib
-       $(MAKE) $(MFLAGS) maintainer-clean
-       cd ..\lib-src
-       $(MAKE) $(MFLAGS) maintainer-clean
-       cd ..\src
-       $(MAKE) $(MFLAGS) maintainer-clean
-       cd ..\lisp
-       $(MAKE) $(MFLAGS) maintainer-clean
-       cd ..\leim
-       $(MAKE) $(MFLAGS) maintainer-clean
-       cd ..\doc\emacs
-       $(MAKE) $(MFLAGS) maintainer-clean
-       cd ..\misc
-       $(MAKE) $(MFLAGS) maintainer-clean
-       cd ..\lispintro
-       $(MAKE) $(MFLAGS) maintainer-clean
-       cd ..\lispref
-       $(MAKE) $(MFLAGS) maintainer-clean
-       cd ..\..\nt
-
-maintainer-clean-other-dirs-gmake:
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean
-
-realclean: cleanall
-       - $(DEL_TREE) ../bin
-
-TAGS: TAGS-$(MAKETYPE)
-
-frc:
-TAGS-gmake: frc
-       ../lib-src/$(BLD)/etags $(CURDIR)/*.c
-       $(MAKE) $(MFLAGS) -C ../src TAGS TAGS-LISP
-       $(MAKE) $(MFLAGS) -C ../lib-src TAGS
-       $(MAKE) $(MFLAGS) -C ../lib TAGS
-
-TAGS-nmake:
-       echo This target is not supported with NMake
-
-.PHONY: frc
diff --git a/nt/multi-install-info.bat b/nt/multi-install-info.bat
deleted file mode 100644
index f69ee48..0000000
--- a/nt/multi-install-info.bat
+++ /dev/null
@@ -1,40 +0,0 @@
address@hidden off
-
-rem  Hack to run install-info with multiple info files on the command
-rem  line on the Windows platform.
-
-rem Copyright (C) 2003-2015 Free Software Foundation, Inc.
-
-rem  This file is part of GNU Emacs.
-
-rem   GNU Emacs is free software: you can redistribute it and/or modify
-rem   it under the terms of the GNU General Public License as published by
-rem   the Free Software Foundation, either version 3 of the License, or
-rem   (at your option) any later version.
-
-rem   GNU Emacs is distributed in the hope that it will be useful,
-rem   but WITHOUT ANY WARRANTY; without even the implied warranty of
-rem   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-rem   GNU General Public License for more details.
-
-rem   You should have received a copy of the GNU General Public License
-rem   along with GNU Emacs.  If not, see http://www.gnu.org/licenses/.
-
-
-rem  Usage:
-rem   multi-install-info <switch passed to install-info> FILE1 FILE2 ...
-rem
-rem  By Peter 'Luna' Runestig <address@hidden> 2003
-
-set INSTALL_INFO=install-info
-set II_SWITCH=%1=%2
-rem Eat the install-info switch:
-shift
-
-:Loop
-shift
-if .%1% == . goto EndLoop
-%INSTALL_INFO% %II_SWITCH% %1
-goto Loop
-:EndLoop
-
diff --git a/nt/nmake.defs b/nt/nmake.defs
deleted file mode 100644
index 5424b9d..0000000
--- a/nt/nmake.defs
+++ /dev/null
@@ -1,294 +0,0 @@
-#  -*- Makefile -*- definition file for building GNU Emacs on Windows NT.
-# Copyright (C) 2000-2015 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-# Ensure 'all' is the default target
-all:
-
-THE_SHELL = $(COMSPEC)
-SHELLTYPE=CMD
-SWITCHCHAR=/
-
-MAKETYPE=nmake
-
-CURDIR         = $(MAKEDIR:\=/)
-THISDIR                = $(MAKEDIR)
-DIRNAME                =
-
-ALL_DEPS       = $**
-
-SUBSYSTEM_WINDOWS=-subsystem:windows
-SUBSYSTEM_CONSOLE=-subsystem:console
-
-# INSTALL_DIR is the directory into which emacs will be installed.
-#
-!ifndef INSTALL_DIR
-INSTALL_DIR     = $(CURDIR)/..
-!endif
-
-# Ensure EMACSLOADPATH is defined in the environment.
-#
-!if [set EMACSLOADPATH=foo]
-!endif
-
-# Allow detection of builds with MSVC 5 or later, so we can
-# speed up compiles (see rule at end).
-#
-_NMAKE_VER_5=162
-_NMAKE_VER_4=0
-
-!IFNDEF _NMAKE_VER
-_NMAKE_VER=$(_NMAKE_VER_4)
-!ENDIF
-
-# Check that the INCLUDE and LIB environment variables are set.
-#
-!ifndef INCLUDE
-!error The INCLUDE environment variable needs to be set.
-!endif
-!ifndef LIB
-!error The LIB environment variable needs to be set.
-!endif
-
-# Determine the architecture we're running on.
-# Define ARCH for our purposes;
-# Define CPU for use by ntwin32.mak;
-# Define CONFIG_H to the appropriate config.h for the system;
-#
-!ifdef PROCESSOR_ARCHITECTURE
-# We're on Windows NT
-CPU            = $(PROCESSOR_ARCHITECTURE)
-CONFIG_H       = config.nt
-OS_TYPE                = windowsnt
-! if "$(PROCESSOR_ARCHITECTURE)" == "x86"
-ARCH           = i386
-CPU            = i386
-! else
-!  if "$(PROCESSOR_ARCHITECTURE)" == "MIPS"
-ARCH           = mips
-!  else
-!   if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
-ARCH           = alpha
-!   else
-!    if "$(PROCESSOR_ARCHITECTURE)" == "PPC"
-ARCH           = ppc
-!    else
-!     if "$(PROCESSOR_ARCHITECTURE)" == "AMD64"
-ARCH           = AMD64
-!     else
-!      error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)"
-!     endif
-!    endif
-!   endif
-!  endif
-! endif
-!else
-# We're on Windows 95
-ARCH           = i386
-CPU            = i386
-CONFIG_H       = config.nt
-OS_TYPE                = windows95
-!endif
-
-AR             = lib
-AR_OUT         = -out:
-CC             = cl
-CC_OUT         = -Fo
-LINK           = link
-LINK_OUT       = -out:
-RC             = rc $(ARCH_RCFLAGS)
-RC_OUT         = -Fo
-RC_INCLUDE     = -i
-
-USE_CRT_DLL    = 1
-
-!if $(USE_CRT_DLL)
-libc           = msvcrt$(D).lib
-EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1
-!else
-libc           = libcmt$(D).lib
-EMACS_EXTRA_C_FLAGS= -D_MT
-!endif
-baselibs       =
-O              = obj
-A              = lib
-
-BASE_LIBS      = $(libc) $(baselibs) oldnames.lib
-
-ADVAPI32       = advapi32.lib
-COMCTL32       = comctl32.lib
-COMDLG32       = comdlg32.lib
-GDI32          = gdi32.lib
-MPR            = mpr.lib
-SHELL32                = shell32.lib
-USER32         = user32.lib
-WSOCK32                = wsock32.lib
-WINMM          = winmm.lib
-WINSPOOL       = winspool.lib
-OLE32          = ole32.lib
-UNISCRIBE      = usp10.lib
-UUID           = uuid.lib
-
-!ifdef NOOPT
-DEBUG_CFLAGS   = -DEMACSDEBUG
-!else
-DEBUG_CFLAGS   =
-!endif
-
-MWINDOWS        = -subsystem:windows -entry:mainCRTStartup
-
-CFLAGS          = -I. $(ARCH_CFLAGS) -D_CRT_SECURE_NO_WARNINGS \
-                 $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
-ESC_CFLAGS      = -I. $(ARCH_CFLAGS) -D_CRT_SECURE_NO_WARNINGS \
-                 $(DEBUG_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)
-
-#SYS_LDFLAGS   = -nologo -release -incremental:no -version:3.10 -swaprun:cd 
-swaprun:net setargv.obj
-SYS_LDFLAGS    = -nologo -manifest -dynamicbase:no -incremental:no 
-version:3.10 -swaprun:cd -swaprun:net setargv.obj
-
-# see comments in allocate_heap in w32heap.c before changing any of the
-# -stack, -heap, or -base settings.
-!if "$(ARCH)" == "i386"
-TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x01000000 
-pdb:$(BLD)\temacs.pdb -machine:x86 $(SUBSYSTEM_CONSOLE) -entry:_start 
-map:$(BLD)\temacs.map $(EXTRA_LINK)
-!elseif "$(ARCH)" == "AMD64"
-TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x400000000 
-pdb:$(BLD)\temacs.pdb -machine:x64 $(SUBSYSTEM_CONSOLE) -entry:_start 
-map:$(BLD)\temacs.map $(EXTRA_LINK)
-!endif
-
-!ifdef NOOPT
-OBJDIR          = obj
-!else
-OBJDIR          = obj-spd
-!endif
-$(OBJDIR):;    -mkdir $(OBJDIR)
-BLD             = $(OBJDIR)/$(ARCH)
-stamp_BLD:      $(OBJDIR)
-               -mkdir "$(BLD)"
-               echo $(BLD) > $@
-
-COMPILER_TEMP_FILES = *.pdb
-
-CP             = cp -f
-CP_DIR         = cp -rf
-IFNOTSAMEDIR   = if not exist ..\$(DIRNAME)_same-dir.tst
-ENDIF          =
-FOREACH                = for %%f in (
-FORVAR         = %%f
-FORDO          = ) do
-ENDFOR         =
-ARGQUOTE       = "
-# "
-DQUOTE         = \"
-DEL            = rm
-DEL_TREE       = rm -r
-
-!ifdef NODEBUG
-DEBUG_FLAG =
-DEBUG_LINK =
-D =
-!else
-DEBUG_FLAG = -Zi
-DEBUG_LINK = -debug
-D = d
-!endif
-
-# gcc-specific pragma (ignore for MSVC)
-PRAGMA_SYSTEM_HEADER =
-
-!if "$(ARCH)" == "i386"
-!ifdef NOOPT
-#ARCH_CFLAGS     = -nologo -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG)
-ARCH_CFLAGS     = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Od -Gd $(DEBUG_FLAG)
-!else
-#ARCH_CFLAGS     = -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 
$(DEBUG_FLAG)
-ARCH_CFLAGS     = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Oi -Ot -Oy- -Ob2 -GF -Gy 
-Gd $(DEBUG_FLAG)
-!endif
-ARCH_LDFLAGS   = $(SYS_LDFLAGS)
-EMACS_HEAPSIZE = 27
-EMACS_PURESIZE = 5000000
-EMACS_MANIFEST = emacs-x86.manifest
-
-!else
-!if "$(ARCH)" == "mips"
-ARCH_CFLAGS     = -D_MIPS_=1 -c -W2 -Zi -Od -Gt0
-ARCH_LDFLAGS   = $(SYS_LDFLAGS)
-EMACS_HEAPSIZE = 27
-EMACS_PURESIZE = 5000000
-EMACS_MANIFEST = emacs-mips.manifest
-
-!else
-!if "$(ARCH)" == "alpha"
-!if "$(BUILD_TYPE)" == "spd"
-ARCH_CFLAGS     = -D_ALPHA_=1 -c -Ze -Zi -W2 -Od -D__stdcall= -D__cdecl=
-!else
-ARCH_CFLAGS     = -D_ALPHA_=1 -c -Ze -Zi -W2 -O1 -D__stdcall= -D__cdecl=
-!endif
-ARCH_LDFLAGS   = $(SYS_LDFLAGS)
-EMACS_HEAPSIZE = 27
-EMACS_PURESIZE = 5000000
-EMACS_MANIFEST = emacs-alpha.manifest
-
-!else
-!if "$(ARCH)" == "ppc"
-# These flags are a guess...if they don't work, please send me mail.
-ARCH_LDFLAGS   = $(SYS_LDFLAGS)
-EMACS_HEAPSIZE = 27
-EMACS_PURESIZE = 5000000
-EMACS_MANIFEST = emacs-ppc.manifest
-
-!else
-!if "$(ARCH)" == "AMD64"
-!ifdef NOOPT
-ARCH_CFLAGS     = -nologo -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -c -Zl 
-Zp8 -W2 -Od -Gd -Wp64 $(DEBUG_FLAG)
-!else
-ARCH_CFLAGS     = -nologo -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -c -Zl 
-Zp8 -W2 -O2x -GF -Gy -Gd $(DEBUG_FLAG)
-!endif
-ARCH_LDFLAGS   = $(SYS_LDFLAGS) -machine:x64
-ARCH_RCFLAGS   = -DWIN64
-EMACS_HEAPSIZE = 42
-EMACS_PURESIZE = 10000000
-EMACS_MANIFEST = emacs-x64.manifest
-
-!else
-!ERROR Unknown architecture type "$(ARCH)".
-!endif
-!endif
-!endif
-!endif
-!endif
-
-LINK_FLAGS     = $(ARCH_LDFLAGS) $(DEBUG_LINK) $(USER_LDFLAGS)
-
-# From MSVC 5.0 onwards, it seem base relocation information is not included,
-# at least in release builds.  We need to ensure the reloc info is included
-# in order to use the MSVC profiler.
-!IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
-EXTRA_LINK      =
-!ELSE
-EXTRA_LINK      = -profile
-!ENDIF
-
-#
-# If the compiler supports compiling multiple .c files to .o files at
-# one time, use this feature.
-#
-!IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
-.c{$(BLD)}.obj:
-               $(CC) $(CFLAGS) -Fo$(BLD)\ $<
-!ELSE
-.c{$(BLD)}.obj::
-               $(CC) $(CFLAGS) -Fo$(BLD)\ $<
-!ENDIF
diff --git a/nt/paths.h b/nt/paths.h
deleted file mode 100644
index d6dfaad..0000000
--- a/nt/paths.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* paths.h file for MS Windows
-
-Copyright (C) 1993, 1995, 1997, 1999, 2001-2015 Free Software
-Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Relative file names in this file that begin with "%emacs_dir%/" are
-   treated specially by decode_env_path: they are expanded relative to
-   the value of the emacs_dir environment variable, which points to
-   the root of the Emacs tree.  */
-
-/* The default search path for Lisp function "load".
-   Together with PATH_SITELOADSEARCH, this sets load-path.  */
-/* #define PATH_LOADSEARCH "/usr/local/lib/emacs/lisp" */
-#define PATH_LOADSEARCH "%emacs_dir%/lisp"
-
-/* Like PATH_LOADSEARCH, but contains the non-standard pieces.  */
-#define PATH_SITELOADSEARCH "%emacs_dir%/site-lisp;%emacs_dir%/../site-lisp"
-
-/* Like PATH_LOADSEARCH, but used only when Emacs is dumping.  This
-   path is usually identical to PATH_LOADSEARCH except that the entry
-   for the directory containing the installed lisp files has been
-   replaced with ../lisp.  */
-#define PATH_DUMPLOADSEARCH "../lisp"
-
-/* The extra search path for programs to invoke.  This is appended to
-   whatever the PATH environment variable says to set the Lisp
-   variable exec-path and the first file name in it sets the Lisp
-   variable exec-directory.  exec-directory is used for finding
-   executables and other architecture-dependent files.  */
-/* #define PATH_EXEC "/usr/local/lib/emacs/etc" */
-#define PATH_EXEC 
"%emacs_dir%/bin;%emacs_dir%/lib-src/oo-spd/i386;%emacs_dir%/lib-src/oo/i386;%emacs_dir%/nt/oo-spd/i386;%emacs_dir%/nt/oo/i386"
-
-/* Where Emacs should look for its architecture-independent data
-   files, like the NEWS file.  The lisp variable data-directory
-   is set to this value.  */
-/* #define PATH_DATA "/usr/local/lib/emacs/data" */
-#define PATH_DATA "%emacs_dir%/etc"
-
-/* Where Emacs should look for X bitmap files.
-   The lisp variable x-bitmap-file-path is set based on this value.  */
-#define PATH_BITMAPS ""
-
-/* Where Emacs should look for its docstring file.  The lisp variable
-   doc-directory is set to this value.  */
-#define PATH_DOC "%emacs_dir%/etc"
-
-/* Where the configuration process believes the info tree lives.  The
-   lisp variable configure-info-directory gets its value from this
-   macro, and is then used to set the Info-default-directory-list.  */
-/* #define PATH_INFO "/usr/local/info" */
-#define PATH_INFO "C:/emacs/info"
diff --git a/nt/zipdist.bat b/nt/zipdist.bat
deleted file mode 100644
index 55ba9ae..0000000
--- a/nt/zipdist.bat
+++ /dev/null
@@ -1,43 +0,0 @@
address@hidden off
-rem Copyright (C) 2001-2015 Free Software Foundation, Inc.
-
-rem Author: Christoph Scholtes cschol2112 at gmail.com
-
-rem This file is part of GNU Emacs.
-
-rem GNU Emacs is free software: you can redistribute it and/or modify
-rem it under the terms of the GNU General Public License as published by
-rem the Free Software Foundation, either version 3 of the License, or
-rem (at your option) any later version.
-
-rem GNU Emacs is distributed in the hope that it will be useful,
-rem but WITHOUT ANY WARRANTY; without even the implied warranty of
-rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-rem GNU General Public License for more details.
-
-rem You should have received a copy of the GNU General Public License
-rem along with GNU Emacs.  If not, see http://www.gnu.org/licenses/.
-
-SETLOCAL
-rem arg 1: Emacs version number
-set EMACS_VER=%1
-
-set TMP_DIST_DIR=emacs-%EMACS_VER%
-
-rem Check, if 7zip is installed and available on path
-7z 1>NUL 2>NUL
-if %ERRORLEVEL% NEQ 0 goto ZIP_ERROR
-goto ZIP_DIST
-
-:ZIP_ERROR
-echo.
-echo ERROR: Make sure 7zip is installed and available on the Windows Path!
-goto EXIT
-
-rem Build and verify the binary distribution
-:ZIP_DIST
-7z a -bd -tZIP -mx=9 -x!.gitignore -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ 
-xr!CVS -xr!.arch-inventory emacs-%EMACS_VER%-bin-i386.zip %TMP_DIST_DIR%
-7z t emacs-%EMACS_VER%-bin-i386.zip
-goto EXIT
-
-:EXIT
diff --git a/src/alloc.c b/src/alloc.c
index 9ac3ad8..3ab2a6e 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -69,11 +69,7 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 static bool valgrind_p;
 #endif
 
-/* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects.
-   Doable only if GC_MARK_STACK.  */
-#if ! GC_MARK_STACK
-# undef GC_CHECK_MARKED_OBJECTS
-#endif
+/* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects.  */
 
 /* GC_MALLOC_CHECK defined means perform validity checks of malloc'd
    memory.  Can do this only if using gmalloc.c and if not checking
@@ -298,8 +294,6 @@ enum mem_type
   MEM_TYPE_SPARE
 };
 
-#if GC_MARK_STACK || defined GC_MALLOC_CHECK
-
 /* A unique object in pure space used to make some Lisp objects
    on free lists recognizable in O(1).  */
 
@@ -380,16 +374,10 @@ static void mem_delete (struct mem_node *);
 static void mem_delete_fixup (struct mem_node *);
 static struct mem_node *mem_find (void *);
 
-#endif /* GC_MARK_STACK || GC_MALLOC_CHECK */
-
 #ifndef DEADP
 # define DEADP(x) 0
 #endif
 
-/* Recording what needs to be marked for gc.  */
-
-struct gcpro *gcprolist;
-
 /* Addresses of staticpro'd variables.  Initialize it to a nonzero
    value; otherwise some compilers put it into BSS.  */
 
@@ -965,7 +953,7 @@ lisp_malloc (size_t nbytes, enum mem_type type)
     }
 #endif
 
-#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
+#ifndef GC_MALLOC_CHECK
   if (val && type != MEM_TYPE_NON_LISP)
     mem_insert (val, (char *) val + nbytes, type);
 #endif
@@ -985,7 +973,7 @@ lisp_free (void *block)
 {
   MALLOC_BLOCK_INPUT;
   free (block);
-#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
+#ifndef GC_MALLOC_CHECK
   mem_delete (mem_find (block));
 #endif
   MALLOC_UNBLOCK_INPUT;
@@ -1190,7 +1178,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
   val = free_ablock;
   free_ablock = free_ablock->x.next_free;
 
-#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
+#ifndef GC_MALLOC_CHECK
   if (type != MEM_TYPE_NON_LISP)
     mem_insert (val, (char *) val + nbytes, type);
 #endif
@@ -1210,7 +1198,7 @@ lisp_align_free (void *block)
   struct ablocks *abase = ABLOCK_ABASE (ablock);
 
   MALLOC_BLOCK_INPUT;
-#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
+#ifndef GC_MALLOC_CHECK
   mem_delete (mem_find (block));
 #endif
   /* Put on free list.  */
@@ -2499,9 +2487,7 @@ void
 free_cons (struct Lisp_Cons *ptr)
 {
   ptr->u.chain = cons_free_list;
-#if GC_MARK_STACK
   ptr->car = Vdead;
-#endif
   cons_free_list = ptr;
   consing_since_gc -= sizeof *ptr;
   total_free_conses++;
@@ -2849,7 +2835,7 @@ allocate_vector_block (void)
 {
   struct vector_block *block = xmalloc (sizeof *block);
 
-#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
+#ifndef GC_MALLOC_CHECK
   mem_insert (block->data, block->data + VECTOR_BLOCK_BYTES,
              MEM_TYPE_VECTOR_BLOCK);
 #endif
@@ -3058,7 +3044,7 @@ sweep_vectors (void)
       if (free_this_block)
        {
          *bprev = block->next;
-#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
+#ifndef GC_MALLOC_CHECK
          mem_delete (mem_find (block->data));
 #endif
          xfree (block);
@@ -3765,21 +3751,18 @@ queue_doomed_finalizers (struct Lisp_Finalizer *dest,
 static Lisp_Object
 run_finalizer_handler (Lisp_Object args)
 {
-  add_to_log ("finalizer failed: %S", args, Qnil);
+  add_to_log ("finalizer failed: %S", args);
   return Qnil;
 }
 
 static void
 run_finalizer_function (Lisp_Object function)
 {
-  struct gcpro gcpro1;
   ptrdiff_t count = SPECPDL_INDEX ();
 
-  GCPRO1 (function);
   specbind (Qinhibit_quit, Qt);
   internal_condition_case_1 (call0, function, Qt, run_finalizer_handler);
   unbind_to (count, Qnil);
-  UNGCPRO;
 }
 
 static void
@@ -3918,8 +3901,6 @@ refill_memory_reserve (void)
                           C Stack Marking
  ************************************************************************/
 
-#if GC_MARK_STACK || defined GC_MALLOC_CHECK
-
 /* Conservative C stack marking requires a method to identify possibly
    live Lisp objects given a pointer value.  We do this by keeping
    track of blocks of Lisp data that are allocated in a red-black tree
@@ -3986,26 +3967,12 @@ mem_insert (void *start, void *end, enum mem_type type)
   c = mem_root;
   parent = NULL;
 
-#if GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS
-
-  while (c != MEM_NIL)
-    {
-      if (start >= c->start && start < c->end)
-       emacs_abort ();
-      parent = c;
-      c = start < c->start ? c->left : c->right;
-    }
-
-#else /* GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS */
-
   while (c != MEM_NIL)
     {
       parent = c;
       c = start < c->start ? c->left : c->right;
     }
 
-#endif /* GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS */
-
   /* Create a new node.  */
 #ifdef GC_MALLOC_CHECK
   x = malloc (sizeof *x);
@@ -4491,62 +4458,6 @@ live_buffer_p (struct mem_node *m, void *p)
          && !NILP (((struct buffer *) p)->name_));
 }
 
-#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */
-
-#if GC_MARK_STACK
-
-#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
-
-/* Currently not used, but may be called from gdb.  */
-
-void dump_zombies (void) EXTERNALLY_VISIBLE;
-
-/* Array of objects that are kept alive because the C stack contains
-   a pattern that looks like a reference to them.  */
-
-#define MAX_ZOMBIES 10
-static Lisp_Object zombies[MAX_ZOMBIES];
-
-/* Number of zombie objects.  */
-
-static EMACS_INT nzombies;
-
-/* Number of garbage collections.  */
-
-static EMACS_INT ngcs;
-
-/* Average percentage of zombies per collection.  */
-
-static double avg_zombies;
-
-/* Max. number of live and zombie objects.  */
-
-static EMACS_INT max_live, max_zombies;
-
-/* Average number of live objects per GC.  */
-
-static double avg_live;
-
-DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "",
-       doc: /* Show information about live and zombie objects.  */)
-  (void)
-{
-  Lisp_Object zombie_list = Qnil;
-  for (int i = 0; i < min (MAX_ZOMBIES, nzombies); i++)
-    zombie_list = Fcons (zombies[i], zombie_list);
-  AUTO_STRING (format, ("%d GCs, avg live/zombies = %.2f/%.2f (%f%%),"
-                       " max %d/%d\nzombies: %S"));
-  return CALLN (Fmessage, format,
-               make_number (ngcs), make_float (avg_live),
-               make_float (avg_zombies),
-               make_float (avg_zombies / avg_live / 100),
-               make_number (max_live), make_number (max_zombies),
-               zombie_list);
-}
-
-#endif /* GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES */
-
-
 /* Mark OBJ if we can prove it's a Lisp_Object.  */
 
 static void
@@ -4608,14 +4519,7 @@ mark_maybe_object (Lisp_Object obj)
        }
 
       if (mark_p)
-       {
-#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
-         if (nzombies < MAX_ZOMBIES)
-           zombies[nzombies] = obj;
-         ++nzombies;
-#endif
-         mark_object (obj);
-       }
+       mark_object (obj);
     }
 }
 
@@ -4723,10 +4627,6 @@ mark_memory (void *start, void *end)
   void **pp;
   int i;
 
-#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
-  nzombies = 0;
-#endif
-
   /* Make START the pointer to the start of the memory region,
      if it isn't already.  */
   if (end < start)
@@ -4847,42 +4747,6 @@ test_setjmp (void)
 #endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */
 
 
-#if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS
-
-/* Abort if anything GCPRO'd doesn't survive the GC.  */
-
-static void
-check_gcpros (void)
-{
-  struct gcpro *p;
-  ptrdiff_t i;
-
-  for (p = gcprolist; p; p = p->next)
-    for (i = 0; i < p->nvars; ++i)
-      if (!survives_gc_p (p->var[i]))
-       /* FIXME: It's not necessarily a bug.  It might just be that the
-          GCPRO is unnecessary or should release the object sooner.  */
-       emacs_abort ();
-}
-
-#elif GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
-
-void
-dump_zombies (void)
-{
-  int i;
-
-  fprintf (stderr, "\nZombies kept alive = %"pI"d:\n", nzombies);
-  for (i = 0; i < min (MAX_ZOMBIES, nzombies); ++i)
-    {
-      fprintf (stderr, "  %d = ", i);
-      debug_print (zombies[i]);
-    }
-}
-
-#endif /* GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES */
-
-
 /* Mark live Lisp objects on the C stack.
 
    There are several system-dependent problems to consider when
@@ -4945,18 +4809,8 @@ mark_stack (void *end)
 #ifdef GC_MARK_SECONDARY_STACK
   GC_MARK_SECONDARY_STACK ();
 #endif
-
-#if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS
-  check_gcpros ();
-#endif
 }
 
-#else /* GC_MARK_STACK == 0 */
-
-#define mark_maybe_object(obj) emacs_abort ()
-
-#endif /* GC_MARK_STACK != 0 */
-
 static bool
 c_symbol_p (struct Lisp_Symbol *sym)
 {
@@ -5007,9 +4861,7 @@ int
 valid_lisp_object_p (Lisp_Object obj)
 {
   void *p;
-#if GC_MARK_STACK
   struct mem_node *m;
-#endif
 
   if (INTEGERP (obj))
     return 1;
@@ -5024,10 +4876,6 @@ valid_lisp_object_p (Lisp_Object obj)
   if (p == &buffer_defaults || p == &buffer_local_symbols)
     return 2;
 
-#if !GC_MARK_STACK
-  return valid_pointer_p (p);
-#else
-
   m = mem_find (p);
 
   if (m == MEM_NIL)
@@ -5075,35 +4923,6 @@ valid_lisp_object_p (Lisp_Object obj)
     }
 
   return 0;
-#endif
-}
-
-/* If GC_MARK_STACK, return 1 if STR is a relocatable data of Lisp_String
-   (i.e. there is a non-pure Lisp_Object X so that SDATA (X) == STR) and 0
-   if not.  Otherwise we can't rely on valid_lisp_object_p and return -1.
-   This function is slow and should be used for debugging purposes.  */
-
-int
-relocatable_string_data_p (const char *str)
-{
-  if (PURE_POINTER_P (str))
-    return 0;
-#if GC_MARK_STACK
-  if (str)
-    {
-      struct sdata *sdata
-       = (struct sdata *) (str - offsetof (struct sdata, data));
-
-      if (0 < valid_pointer_p (sdata)
-         && 0 < valid_pointer_p (sdata->string)
-         && maybe_lisp_pointer (sdata->string))
-       return (valid_lisp_object_p
-               (make_lisp_ptr (sdata->string, Lisp_String))
-               && (const char *) sdata->string->data == str);
-    }
-  return 0;
-#endif /* GC_MARK_STACK */
-  return -1;
 }
 
 /***********************************************************************
@@ -5339,6 +5158,10 @@ purecopy (Lisp_Object obj)
   if (PURE_POINTER_P (XPNTR (obj)) || INTEGERP (obj) || SUBRP (obj))
     return obj;    /* Already pure.  */
 
+  if (STRINGP (obj) && XSTRING (obj)->intervals)
+    message_with_string ("Dropping text-properties while making string `%s' 
pure",
+                        obj, true);
+
   if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing.  */
     {
       Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil);
@@ -5351,13 +5174,9 @@ purecopy (Lisp_Object obj)
   else if (FLOATP (obj))
     obj = make_pure_float (XFLOAT_DATA (obj));
   else if (STRINGP (obj))
-    {
-      if (XSTRING (obj)->intervals)
-       message ("Dropping text-properties when making string pure");
-      obj = make_pure_string (SSDATA (obj), SCHARS (obj),
-                             SBYTES (obj),
-                             STRING_MULTIBYTE (obj));
-    }
+    obj = make_pure_string (SSDATA (obj), SCHARS (obj),
+                           SBYTES (obj),
+                           STRING_MULTIBYTE (obj));
   else if (COMPILEDP (obj) || VECTORP (obj) || HASH_TABLE_P (obj))
     {
       struct Lisp_Vector *objp = XVECTOR (obj);
@@ -5675,18 +5494,8 @@ garbage_collect_1 (void *end)
   xg_mark_data ();
 #endif
 
-#if (GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS \
-     || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS)
   mark_stack (end);
-#else
-  {
-    register struct gcpro *tail;
-    for (tail = gcprolist; tail; tail = tail->next)
-      for (i = 0; i < tail->nvars; i++)
-       mark_object (tail->var[i]);
-  }
-  mark_byte_stack ();
-#endif
+
   {
     struct handler *handler;
     for (handler = handlerlist; handler; handler = handler->next)
@@ -5699,10 +5508,6 @@ garbage_collect_1 (void *end)
   mark_fringe_data ();
 #endif
 
-#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
-  mark_stack (end);
-#endif
-
   /* Everything is now marked, except for the data in font caches,
      undo lists, and finalizers.  The first two are compacted by
      removing an items which aren't reachable otherwise.  */
@@ -5730,16 +5535,12 @@ garbage_collect_1 (void *end)
 
   gc_sweep ();
 
-  /* Clear the mark bits that we set in certain root slots.  */
+  relocate_byte_stack ();
 
-  unmark_byte_stack ();
+  /* Clear the mark bits that we set in certain root slots.  */
   VECTOR_UNMARK (&buffer_defaults);
   VECTOR_UNMARK (&buffer_local_symbols);
 
-#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES && 0
-  dump_zombies ();
-#endif
-
   check_cons_list ();
 
   gc_in_progress = 0;
@@ -5813,21 +5614,6 @@ garbage_collect_1 (void *end)
   };
   retval = CALLMANY (Flist, total);
 
-#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
-  {
-    /* Compute average percentage of zombies.  */
-    double nlive
-      = (total_conses + total_symbols + total_markers + total_strings
-         + total_vectors + total_floats + total_intervals + total_buffers);
-
-    avg_live = (avg_live * ngcs + nlive) / (ngcs + 1);
-    max_live = max (nlive, max_live);
-    avg_zombies = (avg_zombies * ngcs + nzombies) / (ngcs + 1);
-    max_zombies = max (nzombies, max_zombies);
-    ++ngcs;
-  }
-#endif
-
   /* GC is complete: now we can run our finalizer callbacks.  */
   run_finalizers (&doomed_finalizers);
 
@@ -5878,9 +5664,6 @@ returns nil, because real GC can't be done.
 See Info node `(elisp)Garbage Collection'.  */)
   (void)
 {
-#if (GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS             \
-     || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS    \
-     || GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES)
   void *end;
 
 #ifdef HAVE___BUILTIN_UNWIND_INIT
@@ -5935,12 +5718,6 @@ See Info node `(elisp)Garbage Collection'.  */)
 #endif /* not GC_SAVE_REGISTERS_ON_STACK */
 #endif /* not HAVE___BUILTIN_UNWIND_INIT */
   return garbage_collect_1 (end);
-#elif (GC_MARK_STACK == GC_USE_GCPROS_AS_BEFORE)
-  /* Old GCPROs-based method without stack marking.  */
-  return garbage_collect_1 (NULL);
-#else
-  emacs_abort ();
-#endif /* GC_MARK_STACK */
 }
 
 /* Mark Lisp objects in glyph matrix MATRIX.  Currently the
@@ -6133,7 +5910,7 @@ mark_save_value (struct Lisp_Save_Value *ptr)
   /* If `save_type' is zero, `data[0].pointer' is the address
      of a memory area containing `data[1].integer' potential
      Lisp_Objects.  */
-  if (GC_MARK_STACK && ptr->save_type == SAVE_TYPE_MEMORY)
+  if (ptr->save_type == SAVE_TYPE_MEMORY)
     {
       Lisp_Object *p = ptr->data[0].pointer;
       ptrdiff_t nelt;
@@ -6208,7 +5985,7 @@ mark_object (Lisp_Object arg)
 
   /* Perform some sanity checks on the objects marked here.  Abort if
      we encounter an object we know is bogus.  This increases GC time
-     by ~80%, and requires compilation with GC_MARK_STACK != 0.  */
+     by ~80%.  */
 #ifdef GC_CHECK_MARKED_OBJECTS
 
   /* Check that the object pointed to by PO is known to be a Lisp
@@ -6634,9 +6411,7 @@ sweep_conses (void)
                       this_free++;
                       cblk->conses[pos].u.chain = cons_free_list;
                       cons_free_list = &cblk->conses[pos];
-#if GC_MARK_STACK
                       cons_free_list->car = Vdead;
-#endif
                     }
                   else
                     {
@@ -6795,9 +6570,7 @@ sweep_symbols (void)
                 xfree (SYMBOL_BLV (&sym->s));
               sym->s.next = symbol_free_list;
               symbol_free_list = &sym->s;
-#if GC_MARK_STACK
               symbol_free_list->function = Vdead;
-#endif
               ++this_free;
             }
           else
@@ -7226,7 +6999,6 @@ init_alloc_once (void)
 {
   /* Even though Qt's contents are not set up, its address is known.  */
   Vpurify_flag = Qt;
-  gc_precise = (GC_MARK_STACK == GC_USE_GCPROS_AS_BEFORE);
 
   purebeg = PUREBEG;
   pure_size = PURESIZE;
@@ -7235,10 +7007,8 @@ init_alloc_once (void)
   init_finalizer_list (&finalizers);
   init_finalizer_list (&doomed_finalizers);
 
-#if GC_MARK_STACK || defined GC_MALLOC_CHECK
   mem_init ();
   Vdead = make_pure_string ("DEAD", 4, 4, 0);
-#endif
 
 #ifdef DOUG_LEA_MALLOC
   mallopt (M_TRIM_THRESHOLD, 128 * 1024); /* Trim threshold.  */
@@ -7255,11 +7025,9 @@ init_alloc_once (void)
 void
 init_alloc (void)
 {
-#if GC_MARK_STACK
 #if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS
   setjmp_tested_p = longjmps_done = 0;
 #endif
-#endif
   Vgc_elapsed = make_float (0.0);
   gcs_done = 0;
 
@@ -7368,11 +7136,6 @@ The time is in seconds as a floating point value.  */);
   DEFVAR_INT ("gcs-done", gcs_done,
               doc: /* Accumulated number of garbage collections done.  */);
 
-  DEFVAR_BOOL ("gc-precise", gc_precise,
-               doc: /* Non-nil means GC stack marking is precise.
-Useful mainly for automated GC tests.  Build time constant.*/);
-  XSYMBOL (intern_c_string ("gc-precise"))->constant = 1;
-
   defsubr (&Scons);
   defsubr (&Slist);
   defsubr (&Svector);
@@ -7391,10 +7154,6 @@ Useful mainly for automated GC tests.  Build time 
constant.*/);
   defsubr (&Smemory_info);
   defsubr (&Smemory_use_counts);
   defsubr (&Ssuspicious_object);
-
-#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
-  defsubr (&Sgc_status);
-#endif
 }
 
 /* When compiled with GCC, GDB might say "No enum type named
diff --git a/src/bidi.c b/src/bidi.c
index e06430c..9427b81 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1313,13 +1313,13 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t *disp_pos,
          /* `(space ...)' display specs are handled as paragraph
             separators for the purposes of the reordering; see UAX#9
             section 3 and clause HL1 in section 4.3 there.  */
-         ch = 0x2029;
+         ch = PARAGRAPH_SEPARATOR;
        }
       else
        {
          /* All other display specs are handled as the Unicode Object
             Replacement Character.  */
-         ch = 0xFFFC;
+         ch = OBJECT_REPLACEMENT_CHARACTER;
        }
       disp_end_pos = compute_display_string_end (*disp_pos, string);
       if (disp_end_pos < 0)
@@ -2482,8 +2482,8 @@ typedef struct bpa_stack_entry {
 
 #define CANONICAL_EQU(c)                                       \
   ( ASCII_CHAR_P (c) ? c                                       \
-    : (c) == 0x2329 ? 0x3008                                   \
-    : (c) == 0x232a ? 0x3009                                   \
+    : (c) == LEFT_POINTING_ANGLE_BRACKET ? LEFT_ANGLE_BRACKET  \
+    : (c) == RIGHT_POINTING_ANGLE_BRACKET ? RIGHT_ANGLE_BRACKET        \
     : c )
 
 #ifdef ENABLE_CHECKING
@@ -3348,7 +3348,6 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
 {
   int old_level, new_level, next_level;
   struct bidi_it sentinel;
-  struct gcpro gcpro1;
 
   if (bidi_it->charpos < 0 || bidi_it->bytepos < 0)
     emacs_abort ();
@@ -3358,11 +3357,6 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
       bidi_it->scan_dir = 1;   /* default to logical order */
     }
 
-  /* The code below can call eval, and thus cause GC.  If we are
-     iterating a Lisp string, make sure it won't be GCed.  */
-  if (STRINGP (bidi_it->string.lstring))
-    GCPRO1 (bidi_it->string.lstring);
-
   /* If we just passed a newline, initialize for the next line.  */
   if (!bidi_it->first_elt
       && (bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB))
@@ -3508,9 +3502,6 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
 
   eassert (bidi_it->resolved_level >= 0
           && bidi_it->resolved_level <= BIDI_MAXDEPTH + 2);
-
-  if (STRINGP (bidi_it->string.lstring))
-    UNGCPRO;
 }
 
 /* Utility function for looking for strong directional characters
diff --git a/src/buffer.c b/src/buffer.c
index cdf6c72..88a47a6 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1632,10 +1632,9 @@ cleaning up all windows currently displaying the buffer 
to be killed. */)
   (Lisp_Object buffer_or_name)
 {
   Lisp_Object buffer;
-  register struct buffer *b;
-  register Lisp_Object tem;
-  register struct Lisp_Marker *m;
-  struct gcpro gcpro1;
+  struct buffer *b;
+  Lisp_Object tem;
+  struct Lisp_Marker *m;
 
   if (NILP (buffer_or_name))
     buffer = Fcurrent_buffer ();
@@ -1668,10 +1667,8 @@ cleaning up all windows currently displaying the buffer 
to be killed. */)
     if (INTERACTIVE && !NILP (BVAR (b, filename))
        && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
       {
-        GCPRO1 (buffer);
        AUTO_STRING (format, "Buffer %s modified; kill anyway? ");
        tem = do_yes_or_no_p (CALLN (Fformat, format, BVAR (b, name)));
-       UNGCPRO;
        if (NILP (tem))
          return unbind_to (count, Qnil);
       }
@@ -1705,8 +1702,6 @@ cleaning up all windows currently displaying the buffer 
to be killed. */)
     {
       struct buffer *other;
 
-      GCPRO1 (buffer);
-
       FOR_EACH_BUFFER (other)
        if (other->base_buffer == b)
          {
@@ -1715,8 +1710,6 @@ cleaning up all windows currently displaying the buffer 
to be killed. */)
            Fkill_buffer (buf);
          }
 
-      UNGCPRO;
-
       /* Exit if we now have killed the base buffer (Bug#11665).  */
       if (!BUFFER_LIVE_P (b))
        return Qt;
@@ -1754,9 +1747,7 @@ cleaning up all windows currently displaying the buffer 
to be killed. */)
   /* Unlock this buffer's file, if it is locked.  */
   unlock_buffer (b);
 
-  GCPRO1 (buffer);
   kill_buffer_processes (buffer);
-  UNGCPRO;
 
 #ifdef HAVE_XWIDGETS
   GCPRO1 (buffer);
@@ -2417,7 +2408,6 @@ current buffer is cleared.  */)
   bool narrowed = (BEG != BEGV || Z != ZV);
   bool modified_p = !NILP (Fbuffer_modified_p (Qnil));
   Lisp_Object old_undo = BVAR (current_buffer, undo_list);
-  struct gcpro gcpro1;
 
   if (current_buffer->base_buffer)
     error ("Cannot do `set-buffer-multibyte' on an indirect buffer");
@@ -2426,8 +2416,6 @@ current buffer is cleared.  */)
   if (NILP (flag) == NILP (BVAR (current_buffer, enable_multibyte_characters)))
     return flag;
 
-  GCPRO1 (old_undo);
-
   /* Don't record these buffer changes.  We will put a special undo entry
      instead.  */
   bset_undo_list (current_buffer, Qt);
@@ -2657,8 +2645,6 @@ current buffer is cleared.  */)
                             old_undo));
     }
 
-  UNGCPRO;
-
   current_buffer->prevent_redisplay_optimizations_p = 1;
 
   /* If buffer is shown in a window, let redisplay consider other windows.  */
@@ -4402,7 +4388,6 @@ report_overlay_modification (Lisp_Object start, 
Lisp_Object end, bool after,
   struct Lisp_Overlay *tail;
   /* True if this change is an insertion.  */
   bool insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end));
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
   overlay = Qnil;
   tail = NULL;
@@ -4495,7 +4480,6 @@ report_overlay_modification (Lisp_Object start, 
Lisp_Object end, bool after,
        }
     }
 
-  GCPRO4 (overlay, arg1, arg2, arg3);
   {
     /* Call the functions recorded in last_overlay_modification_hooks.
        First copy the vector contents, in case some of these hooks
@@ -4519,17 +4503,12 @@ report_overlay_modification (Lisp_Object start, 
Lisp_Object end, bool after,
 
     SAFE_FREE ();
   }
-  UNGCPRO;
 }
 
 static void
 call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, bool after,
                        Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
 {
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
-
-  GCPRO4 (list, arg1, arg2, arg3);
-
   while (CONSP (list))
     {
       if (NILP (arg3))
@@ -4538,7 +4517,6 @@ call_overlay_mod_hooks (Lisp_Object list, Lisp_Object 
overlay, bool after,
        call5 (XCAR (list), overlay, after ? Qt : Qnil, arg1, arg2, arg3);
       list = XCDR (list);
     }
-  UNGCPRO;
 }
 
 /* Delete any zero-sized overlays at position POS, if the `evaporate'
@@ -5548,12 +5526,12 @@ This is the same as (default-value 
'indicate-buffer-boundaries).  */);
   DEFVAR_BUFFER_DEFAULTS ("default-fringe-indicator-alist",
                          fringe_indicator_alist,
                          doc: /* Default value of `fringe-indicator-alist' for 
buffers that don't override it.
-This is the same as (default-value 'fringe-indicator-alist').  */);
+This is the same as (default-value 'fringe-indicator-alist).  */);
 
   DEFVAR_BUFFER_DEFAULTS ("default-fringe-cursor-alist",
                          fringe_cursor_alist,
                          doc: /* Default value of `fringe-cursor-alist' for 
buffers that don't override it.
-This is the same as (default-value 'fringe-cursor-alist').  */);
+This is the same as (default-value 'fringe-cursor-alist).  */);
 
   DEFVAR_BUFFER_DEFAULTS ("default-scroll-up-aggressively",
                          scroll_up_aggressively,
diff --git a/src/bytecode.c b/src/bytecode.c
index 55789b4..86d44ab 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -296,7 +296,7 @@ enum byte_code_op
 };
 
 /* Whether to maintain a `top' and `bottom' field in the stack frame.  */
-#define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK)
+#define BYTE_MAINTAIN_TOP BYTE_CODE_SAFE
 
 /* Structure describing a value stack used during byte-code execution
    in Fbyte_code.  */
@@ -319,12 +319,6 @@ struct byte_stack
   Lisp_Object byte_string;
   const unsigned char *byte_string_start;
 
-#if BYTE_MARK_STACK
-  /* The vector of constants used during byte-code execution.  Storing
-     this here protects it from GC because mark_byte_stack marks it.  */
-  Lisp_Object constants;
-#endif
-
   /* Next entry in byte_stack_list.  */
   struct byte_stack *next;
 };
@@ -332,46 +326,16 @@ struct byte_stack
 /* A list of currently active byte-code execution value stacks.
    Fbyte_code adds an entry to the head of this list before it starts
    processing byte-code, and it removes the entry again when it is
-   done.  Signaling an error truncates the list analogous to
-   gcprolist.  */
+   done.  Signaling an error truncates the list.  */
 
 struct byte_stack *byte_stack_list;
 
 
-/* Mark objects on byte_stack_list.  Called during GC.  */
-
-#if BYTE_MARK_STACK
-void
-mark_byte_stack (void)
-{
-  struct byte_stack *stack;
-  Lisp_Object *obj;
-
-  for (stack = byte_stack_list; stack; stack = stack->next)
-    {
-      /* If STACK->top is null here, this means there's an opcode in
-        Fbyte_code that wasn't expected to GC, but did.  To find out
-        which opcode this is, record the value of `stack', and walk
-        up the stack in a debugger, stopping in frames of Fbyte_code.
-        The culprit is found in the frame of Fbyte_code where the
-        address of its local variable `stack' is equal to the
-        recorded value of `stack' here.  */
-      eassert (stack->top);
-
-      for (obj = stack->bottom; obj <= stack->top; ++obj)
-       mark_object (*obj);
-
-      mark_object (stack->byte_string);
-      mark_object (stack->constants);
-    }
-}
-#endif
-
-/* Unmark objects in the stacks on byte_stack_list.  Relocate program
-   counters.  Called when GC has completed.  */
+/* Relocate program counters in the stacks on byte_stack_list.  Called
+   when GC has completed.  */
 
 void
-unmark_byte_stack (void)
+relocate_byte_stack (void)
 {
   struct byte_stack *stack;
 
@@ -554,9 +518,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
 
   stack.byte_string = bytestr;
   stack.pc = stack.byte_string_start = SDATA (bytestr);
-#if BYTE_MARK_STACK
-  stack.constants = vector;
-#endif
   if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth))
     memory_full (SIZE_MAX);
   top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top);
diff --git a/src/callint.c b/src/callint.c
index 2ff2f80..12d116d 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -228,11 +228,9 @@ static Lisp_Object
 read_file_name (Lisp_Object default_filename, Lisp_Object mustmatch,
                Lisp_Object initial, Lisp_Object predicate)
 {
-  struct gcpro gcpro1;
-  GCPRO1 (default_filename);
-  RETURN_UNGCPRO (CALLN (Ffuncall, intern ("read-file-name"),
-                        callint_message, Qnil, default_filename,
-                        mustmatch, initial, predicate));
+  return CALLN (Ffuncall, intern ("read-file-name"),
+               callint_message, Qnil, default_filename,
+               mustmatch, initial, predicate);
 }
 
 /* BEWARE: Calling this directly from C would defeat the purpose!  */
@@ -298,7 +296,6 @@ invoke it.  If KEYS is omitted or nil, the return value of
   ptrdiff_t i, nargs;
   ptrdiff_t mark;
   bool arg_from_tty = 0;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   ptrdiff_t key_count;
   bool record_then_fail = 0;
 
@@ -340,9 +337,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
   /* Set SPECS to the interactive form, or barf if not interactive.  */
   {
     Lisp_Object form;
-    GCPRO2 (function, prefix_arg);
     form = Finteractive_form (function);
-    UNGCPRO;
     if (CONSP (form))
       specs = filter_specs = Fcar (XCDR (form));
     else
@@ -357,11 +352,9 @@ invoke it.  If KEYS is omitted or nil, the return value of
       uintmax_t events = num_input_events;
       input = specs;
       /* Compute the arg values using the user's expression.  */
-      GCPRO2 (input, filter_specs);
       specs = Feval (specs,
                     CONSP (funval) && EQ (Qclosure, XCAR (funval))
                     ? CAR_SAFE (XCDR (funval)) : Qnil);
-      UNGCPRO;
       if (events != num_input_events || !NILP (record_flag))
        {
          /* We should record this command on the command history.  */
@@ -500,10 +493,6 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
   memclear (args, nargs * (2 * word_size + 1));
 
-  GCPRO5 (prefix_arg, function, *args, *visargs, up_event);
-  gcpro3.nvars = nargs;
-  gcpro4.nvars = nargs;
-
   if (!NILP (enable))
     specbind (Qenable_recursive_minibuffers, Qt);
 
@@ -512,7 +501,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
     {
       visargs[1] = make_string (tem + 1, strcspn (tem + 1, "\n"));
       if (strchr (SSDATA (visargs[1]), '%'))
-       callint_message = Fformat (i - 1, visargs + 1);
+       callint_message = Fformat_message (i - 1, visargs + 1);
       else
        callint_message = visargs[1];
 
@@ -847,7 +836,6 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
   {
     Lisp_Object val = Ffuncall (nargs, args);
-    UNGCPRO;
     val = unbind_to (speccount, val);
     SAFE_FREE ();
     return val;
diff --git a/src/callproc.c b/src/callproc.c
index 12c8143..39f0eb6 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -113,10 +113,8 @@ Lisp_Object
 encode_current_directory (void)
 {
   Lisp_Object dir;
-  struct gcpro gcpro1;
 
   dir = BVAR (current_buffer, directory);
-  GCPRO1 (dir);
 
   dir = Funhandled_file_name_directory (dir);
 
@@ -138,7 +136,7 @@ encode_current_directory (void)
     report_file_error ("Setting current directory",
                       BVAR (current_buffer, directory));
 
-  RETURN_UNGCPRO (dir);
+  return dir;
 }
 
 /* If P is reapable, record it as a deleted process and kill it.
@@ -252,7 +250,6 @@ usage: (call-process PROGRAM &optional INFILE DESTINATION 
DISPLAY &rest ARGS)  *
 {
   Lisp_Object infile, encoded_infile;
   int filefd;
-  struct gcpro gcpro1;
   ptrdiff_t count = SPECPDL_INDEX ();
 
   if (nargs >= 2 && ! NILP (args[1]))
@@ -263,14 +260,12 @@ usage: (call-process PROGRAM &optional INFILE DESTINATION 
DISPLAY &rest ARGS)  *
   else
     infile = build_string (NULL_DEVICE);
 
-  GCPRO1 (infile);
   encoded_infile = ENCODE_FILE (infile);
 
   filefd = emacs_open (SSDATA (encoded_infile), O_RDONLY, 0);
   if (filefd < 0)
     report_file_error ("Opening process input file", infile);
   record_unwind_protect_int (close_file_unwind, filefd);
-  UNGCPRO;
   return unbind_to (count, call_process (nargs, args, filefd, -1));
 }
 
@@ -422,26 +417,13 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
   /* Make sure that the child will be able to chdir to the current
      buffer's current directory, or its unhandled equivalent.  We
      can't just have the child check for an error when it does the
-     chdir, since it's in a vfork.
+     chdir, since it's in a vfork.  */
+  current_dir = encode_current_directory ();
 
-     We have to GCPRO around this because Fexpand_file_name,
-     Funhandled_file_name_directory, and Ffile_accessible_directory_p
-     might call a file name handling function.  The argument list is
-     protected by the caller, so all we really have to worry about is
-     buffer.  */
-  {
-    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
-
-    current_dir = encode_current_directory ();
-
-    GCPRO4 (buffer, current_dir, error_file, output_file);
-
-    if (STRINGP (error_file))
-      error_file = ENCODE_FILE (error_file);
-    if (STRINGP (output_file))
-      output_file = ENCODE_FILE (output_file);
-    UNGCPRO;
-  }
+  if (STRINGP (error_file))
+    error_file = ENCODE_FILE (error_file);
+  if (STRINGP (output_file))
+    output_file = ENCODE_FILE (output_file);
 
   display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]);
 
@@ -454,13 +436,10 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
 
   /* Search for program; barf if not found.  */
   {
-    struct gcpro gcpro1, gcpro2, gcpro3;
     int ok;
 
-    GCPRO3 (buffer, current_dir, error_file);
     ok = openp (Vexec_path, args[0], Vexec_suffixes, &path,
                make_number (X_OK), false);
-    UNGCPRO;
     if (ok < 0)
       report_file_error ("Searching for program", args[0]);
   }
@@ -470,32 +449,26 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
 
   SAFE_NALLOCA (new_argv, 1, nargs < 4 ? 2 : nargs - 2);
 
-  {
-    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
-
-    GCPRO4 (buffer, current_dir, path, error_file);
-    if (nargs > 4)
-      {
-       ptrdiff_t i;
+  if (nargs > 4)
+    {
+      ptrdiff_t i;
 
-       argument_coding.dst_multibyte = 0;
-       for (i = 4; i < nargs; i++)
-         {
-           argument_coding.src_multibyte = STRING_MULTIBYTE (args[i]);
-           if (CODING_REQUIRE_ENCODING (&argument_coding))
-             /* We must encode this argument.  */
-             args[i] = encode_coding_string (&argument_coding, args[i], 1);
-         }
-       for (i = 4; i < nargs; i++)
-         new_argv[i - 3] = SSDATA (args[i]);
-       new_argv[i - 3] = 0;
-      }
-    else
-      new_argv[1] = 0;
-    path = ENCODE_FILE (path);
-    new_argv[0] = SSDATA (path);
-    UNGCPRO;
-  }
+      argument_coding.dst_multibyte = 0;
+      for (i = 4; i < nargs; i++)
+       {
+         argument_coding.src_multibyte = STRING_MULTIBYTE (args[i]);
+         if (CODING_REQUIRE_ENCODING (&argument_coding))
+           /* We must encode this argument.  */
+           args[i] = encode_coding_string (&argument_coding, args[i], 1);
+       }
+      for (i = 4; i < nargs; i++)
+       new_argv[i - 3] = SSDATA (args[i]);
+      new_argv[i - 3] = 0;
+    }
+  else
+    new_argv[1] = 0;
+  path = ENCODE_FILE (path);
+  new_argv[0] = SSDATA (path);
 
   discard_output = INTEGERP (buffer) || (NILP (buffer) && NILP (output_file));
 
@@ -936,7 +909,6 @@ create_temp_file (ptrdiff_t nargs, Lisp_Object *args,
                  Lisp_Object *filename_string_ptr)
 {
   int fd;
-  struct gcpro gcpro1;
   Lisp_Object filename_string;
   Lisp_Object val, start, end;
   Lisp_Object tmpdir;
@@ -980,7 +952,6 @@ create_temp_file (ptrdiff_t nargs, Lisp_Object *args,
 #endif
 
     filename_string = Fcopy_sequence (ENCODE_FILE (pattern));
-    GCPRO1 (filename_string);
     tempfile = SSDATA (filename_string);
 
     count = SPECPDL_INDEX ();
@@ -1033,7 +1004,6 @@ create_temp_file (ptrdiff_t nargs, Lisp_Object *args,
      coding-system-for-read.  */
 
   *filename_string_ptr = filename_string;
-  UNGCPRO;
   return fd;
 }
 
@@ -1064,7 +1034,6 @@ If you quit, the process is killed with SIGINT, or 
SIGKILL if you quit again.
 usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY 
&rest ARGS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
-  struct gcpro gcpro1;
   Lisp_Object infile, val;
   ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object start = args[0];
@@ -1095,8 +1064,6 @@ usage: (call-process-region START END PROGRAM &optional 
DELETE BUFFER DISPLAY &r
       record_unwind_protect_int (close_file_unwind, fd);
     }
 
-  GCPRO1 (infile);
-
   if (nargs > 3 && !NILP (args[3]))
     Fdelete_region (start, end);
 
@@ -1113,7 +1080,7 @@ usage: (call-process-region START END PROGRAM &optional 
DELETE BUFFER DISPLAY &r
   args[1] = infile;
 
   val = call_process (nargs, args, fd, empty_input ? -1 : count);
-  RETURN_UNGCPRO (unbind_to (count, val));
+  return unbind_to (count, val);
 }
 
 #ifndef WINDOWSNT
diff --git a/src/character.h b/src/character.h
index 859d717..67d4bca 100644
--- a/src/character.h
+++ b/src/character.h
@@ -59,6 +59,30 @@ INLINE_HEADER_BEGIN
 /* Maximum leading code of multibyte characters.  */
 #define MAX_MULTIBYTE_LEADING_CODE 0xF8
 
+/* Unicode character values.  */
+enum
+{
+  NO_BREAK_SPACE = 0x00A0,
+  SOFT_HYPHEN = 0x00AD,
+  ZERO_WIDTH_NON_JOINER = 0x200C,
+  ZERO_WIDTH_JOINER = 0x200D,
+  HYPHEN = 0x2010,
+  NON_BREAKING_HYPHEN = 0x2011,
+  LEFT_SINGLE_QUOTATION_MARK = 0x2018,
+  RIGHT_SINGLE_QUOTATION_MARK = 0x2019,
+  PARAGRAPH_SEPARATOR = 0x2029,
+  LEFT_POINTING_ANGLE_BRACKET = 0x2329,
+  RIGHT_POINTING_ANGLE_BRACKET = 0x232A,
+  LEFT_ANGLE_BRACKET = 0x3008,
+  RIGHT_ANGLE_BRACKET = 0x3009,
+  OBJECT_REPLACEMENT_CHARACTER = 0xFFFC,
+};
+
+/* UTF-8 encodings.  Use \x escapes, so they are portable to pre-C11
+   compilers and can be concatenated with ordinary string literals.  */
+#define uLSQM "\xE2\x80\x98" /* U+2018 LEFT SINGLE QUOTATION MARK */
+#define uRSQM "\xE2\x80\x99" /* U+2019 RIGHT SINGLE QUOTATION MARK */
+
 /* Nonzero iff C is a character that corresponds to a raw 8-bit
    byte.  */
 #define CHAR_BYTE8_P(c) ((c) > MAX_5_BYTE_CHAR)
diff --git a/src/charset.c b/src/charset.c
index b19e344..eeebf17 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -555,7 +555,7 @@ load_charset_map_from_vector (struct charset *charset, 
Lisp_Object vec, int cont
 
   if (len % 2 == 1)
     {
-      add_to_log ("Failure in loading charset map: %V", vec, Qnil);
+      add_to_log ("Failure in loading charset map: %V", vec);
       return;
     }
 
diff --git a/src/chartab.c b/src/chartab.c
index acaabce..bd14c4d 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -863,13 +863,11 @@ map_char_table (void (*c_function) (Lisp_Object, 
Lisp_Object, Lisp_Object),
                Lisp_Object function, Lisp_Object table, Lisp_Object arg)
 {
   Lisp_Object range, val, parent;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   uniprop_decoder_t decoder = UNIPROP_GET_DECODER (table);
 
   range = Fcons (make_number (0), make_number (MAX_CHAR));
   parent = XCHAR_TABLE (table)->parent;
 
-  GCPRO4 (table, arg, range, parent);
   val = XCHAR_TABLE (table)->ascii;
   if (SUB_CHAR_TABLE_P (val))
     val = XSUB_CHAR_TABLE (val)->contents[0];
@@ -920,8 +918,6 @@ map_char_table (void (*c_function) (Lisp_Object, 
Lisp_Object, Lisp_Object),
            }
        }
     }
-
-  UNGCPRO;
 }
 
 DEFUN ("map-char-table", Fmap_char_table, Smap_char_table,
@@ -1031,10 +1027,8 @@ map_char_table_for_charset (void (*c_function) 
(Lisp_Object, Lisp_Object),
 {
   Lisp_Object range;
   int c, i;
-  struct gcpro gcpro1;
 
   range = Fcons (Qnil, Qnil);
-  GCPRO1 (range);
 
   for (i = 0, c = 0; i < chartab_size[0]; i++, c += chartab_chars[0])
     {
@@ -1065,8 +1059,6 @@ map_char_table_for_charset (void (*c_function) 
(Lisp_Object, Lisp_Object),
       else
        call2 (function, range, arg);
     }
-
-  UNGCPRO;
 }
 
 
@@ -1299,11 +1291,8 @@ uniprop_table (Lisp_Object prop)
   table = XCDR (val);
   if (STRINGP (table))
     {
-      struct gcpro gcpro1;
-      GCPRO1 (val);
       AUTO_STRING (intl, "international/");
       result = Fload (concat2 (intl, table), Qt, Qt, Qt, Qt);
-      UNGCPRO;
       if (NILP (result))
        return Qnil;
       table = XCDR (val);
diff --git a/src/coding.c b/src/coding.c
index 1887560..1544f31 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7833,9 +7833,7 @@ static void
 code_conversion_restore (Lisp_Object arg)
 {
   Lisp_Object current, workbuf;
-  struct gcpro gcpro1;
 
-  GCPRO1 (arg);
   current = XCAR (arg);
   workbuf = XCDR (arg);
   if (! NILP (workbuf))
@@ -7846,7 +7844,6 @@ code_conversion_restore (Lisp_Object arg)
        Fkill_buffer (workbuf);
     }
   set_buffer_internal (XBUFFER (current));
-  UNGCPRO;
 }
 
 Lisp_Object
@@ -8118,16 +8115,12 @@ decode_coding_object (struct coding_system *coding,
 
   if (! NILP (CODING_ATTR_POST_READ (attrs)))
     {
-      struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
       ptrdiff_t prev_Z = Z, prev_Z_BYTE = Z_BYTE;
       Lisp_Object val;
 
       TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte);
-      GCPRO5 (coding->src_object, coding->dst_object, src_object, dst_object,
-             old_deactivate_mark);
       val = safe_call1 (CODING_ATTR_POST_READ (attrs),
                        make_number (coding->produced_char));
-      UNGCPRO;
       CHECK_NATNUM (val);
       coding->produced_char += Z - prev_Z;
       coding->produced += Z_BYTE - prev_Z_BYTE;
@@ -8255,15 +8248,8 @@ encode_coding_object (struct coding_system *coding,
          set_buffer_internal (XBUFFER (coding->src_object));
        }
 
-      {
-       struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
-
-       GCPRO5 (coding->src_object, coding->dst_object, src_object, dst_object,
-               old_deactivate_mark);
-       safe_call2 (CODING_ATTR_PRE_WRITE (attrs),
-                   make_number (BEG), make_number (Z));
-       UNGCPRO;
-      }
+      safe_call2 (CODING_ATTR_PRE_WRITE (attrs),
+                 make_number (BEG), make_number (Z));
       if (XBUFFER (coding->src_object) != current_buffer)
        kill_src_buffer = 1;
       coding->src_object = Fcurrent_buffer ();
diff --git a/src/composite.c b/src/composite.c
index 1c18165..88cef22 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -927,7 +927,7 @@ char_composable_p (int c)
 {
   Lisp_Object val;
   return (c > ' '
-         && (c == 0x200C || c == 0x200D
+         && (c == ZERO_WIDTH_NON_JOINER || c == ZERO_WIDTH_JOINER
              || (val = CHAR_TABLE_REF (Vunicode_category_table, c),
                  (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So)))));
 }
diff --git a/src/data.c b/src/data.c
index 80f2ac9..784d127 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1529,10 +1529,8 @@ usage: (setq-default [VAR VALUE]...)  */)
   (Lisp_Object args)
 {
   Lisp_Object args_left, symbol, val;
-  struct gcpro gcpro1;
 
   args_left = val = args;
-  GCPRO1 (args);
 
   while (CONSP (args_left))
     {
@@ -1542,7 +1540,6 @@ usage: (setq-default [VAR VALUE]...)  */)
       args_left = Fcdr (XCDR (args_left));
     }
 
-  UNGCPRO;
   return val;
 }
 
diff --git a/src/dbusbind.c b/src/dbusbind.c
index be1b890..e5318fd 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -906,11 +906,9 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
     case DBUS_TYPE_DICT_ENTRY:
       {
        Lisp_Object result;
-       struct gcpro gcpro1;
        DBusMessageIter subiter;
        int subtype;
        result = Qnil;
-       GCPRO1 (result);
        dbus_message_iter_recurse (iter, &subiter);
        while ((subtype = dbus_message_iter_get_arg_type (&subiter))
               != DBUS_TYPE_INVALID)
@@ -919,7 +917,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
            dbus_message_iter_next (&subiter);
          }
        XD_DEBUG_MESSAGE ("%c %s", dtype, XD_OBJECT_TO_STRING (result));
-       RETURN_UNGCPRO (Fnreverse (result));
+       return Fnreverse (result);
       }
 
     default:
@@ -1259,7 +1257,6 @@ usage: (dbus-message-internal &rest REST)  */)
   Lisp_Object interface = Qnil;
   Lisp_Object member = Qnil;
   Lisp_Object result;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
   DBusConnection *connection;
   DBusMessage *dmessage;
   DBusMessageIter iter;
@@ -1317,9 +1314,6 @@ usage: (dbus-message-internal &rest REST)  */)
        wrong_type_argument (Qinvalid_function, handler);
     }
 
-  /* Protect Lisp variables.  */
-  GCPRO6 (bus, service, path, interface, member, handler);
-
   /* Trace parameters.  */
   switch (mtype)
     {
@@ -1357,10 +1351,7 @@ usage: (dbus-message-internal &rest REST)  */)
   /* Create the D-Bus message.  */
   dmessage = dbus_message_new (mtype);
   if (dmessage == NULL)
-    {
-      UNGCPRO;
-      XD_SIGNAL1 (build_string ("Unable to create a new message"));
-    }
+    XD_SIGNAL1 (build_string ("Unable to create a new message"));
 
   if (STRINGP (service))
     {
@@ -1368,11 +1359,8 @@ usage: (dbus-message-internal &rest REST)  */)
        /* Set destination.  */
        {
          if (!dbus_message_set_destination (dmessage, SSDATA (service)))
-           {
-             UNGCPRO;
-             XD_SIGNAL2 (build_string ("Unable to set the destination"),
-                         service);
-           }
+           XD_SIGNAL2 (build_string ("Unable to set the destination"),
+                       service);
        }
 
       else
@@ -1392,11 +1380,8 @@ usage: (dbus-message-internal &rest REST)  */)
              && (strcmp (dbus_bus_get_unique_name (connection), SSDATA (uname))
                  != 0)
              && (!dbus_message_set_destination (dmessage, SSDATA (service))))
-           {
-             UNGCPRO;
-             XD_SIGNAL2 (build_string ("Unable to set signal destination"),
-                         service);
-           }
+           XD_SIGNAL2 (build_string ("Unable to set signal destination"),
+                       service);
        }
     }
 
@@ -1407,26 +1392,17 @@ usage: (dbus-message-internal &rest REST)  */)
       if ((!dbus_message_set_path (dmessage, SSDATA (path)))
          || (!dbus_message_set_interface (dmessage, SSDATA (interface)))
          || (!dbus_message_set_member (dmessage, SSDATA (member))))
-       {
-         UNGCPRO;
-         XD_SIGNAL1 (build_string ("Unable to set the message parameter"));
-       }
+       XD_SIGNAL1 (build_string ("Unable to set the message parameter"));
     }
 
   else /* DBUS_MESSAGE_TYPE_METHOD_RETURN, DBUS_MESSAGE_TYPE_ERROR  */
     {
       if (!dbus_message_set_reply_serial (dmessage, serial))
-       {
-         UNGCPRO;
-         XD_SIGNAL1 (build_string ("Unable to create a return message"));
-       }
+       XD_SIGNAL1 (build_string ("Unable to create a return message"));
 
       if ((mtype == DBUS_MESSAGE_TYPE_ERROR)
          && (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED)))
-       {
-         UNGCPRO;
-         XD_SIGNAL1 (build_string ("Unable to create a error message"));
-       }
+       XD_SIGNAL1 (build_string ("Unable to create a error message"));
     }
 
   /* Check for timeout parameter.  */
@@ -1473,10 +1449,7 @@ usage: (dbus-message-internal &rest REST)  */)
         message queue.  */
       if (!dbus_connection_send_with_reply (connection, dmessage,
                                            NULL, timeout))
-       {
-         UNGCPRO;
-         XD_SIGNAL1 (build_string ("Cannot send message"));
-       }
+       XD_SIGNAL1 (build_string ("Cannot send message"));
 
       /* The result is the key in Vdbus_registered_objects_table.  */
       serial = dbus_message_get_serial (dmessage);
@@ -1491,10 +1464,7 @@ usage: (dbus-message-internal &rest REST)  */)
       /* Send the message.  The message is just added to the outgoing
         message queue.  */
       if (!dbus_connection_send (connection, dmessage, NULL))
-       {
-         UNGCPRO;
-         XD_SIGNAL1 (build_string ("Cannot send message"));
-       }
+       XD_SIGNAL1 (build_string ("Cannot send message"));
 
       result = Qnil;
     }
@@ -1505,7 +1475,7 @@ usage: (dbus-message-internal &rest REST)  */)
   dbus_message_unref (dmessage);
 
   /* Return the result.  */
-  RETURN_UNGCPRO (result);
+  return result;
 }
 
 /* Read one queued incoming message of the D-Bus BUS.
@@ -1515,7 +1485,6 @@ static void
 xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
 {
   Lisp_Object args, key, value;
-  struct gcpro gcpro1;
   struct input_event event;
   DBusMessage *dmessage;
   DBusMessageIter iter;
@@ -1533,7 +1502,6 @@ xd_read_message_1 (DBusConnection *connection, 
Lisp_Object bus)
 
   /* Collect the parameters.  */
   args = Qnil;
-  GCPRO1 (args);
 
   /* Loop over the resulting parameters.  Construct a list.  */
   if (dbus_message_iter_init (dmessage, &iter))
@@ -1657,8 +1625,6 @@ xd_read_message_1 (DBusConnection *connection, 
Lisp_Object bus)
   /* Cleanup.  */
  cleanup:
   dbus_message_unref (dmessage);
-
-  UNGCPRO;
 }
 
 /* Read queued incoming messages of the D-Bus BUS.
diff --git a/src/dired.c b/src/dired.c
index 5038e04..e70f136 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -166,21 +166,17 @@ directory_files_internal (Lisp_Object directory, 
Lisp_Object full,
   struct re_pattern_buffer *bufp = NULL;
   bool needsep = 0;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
 #ifdef WINDOWSNT
   Lisp_Object w32_save = Qnil;
 #endif
 
   /* Don't let the compiler optimize away all copies of DIRECTORY,
-     which would break GC; see Bug#16986.  Although this is required
-     only in the common case where GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS,
-     it shouldn't break anything in the other cases.  */
+     which would break GC; see Bug#16986.  */
   Lisp_Object volatile directory_volatile = directory;
 
   /* Because of file name handlers, these functions might call
      Ffuncall, and cause a GC.  */
   list = encoded_directory = dirfilename = Qnil;
-  GCPRO5 (match, directory, list, dirfilename, encoded_directory);
   dirfilename = Fdirectory_file_name (directory);
 
   if (!NILP (match))
@@ -254,8 +250,6 @@ directory_files_internal (Lisp_Object directory, 
Lisp_Object full,
       ptrdiff_t len = dirent_namelen (dp);
       Lisp_Object name = make_unibyte_string (dp->d_name, len);
       Lisp_Object finalname = name;
-      struct gcpro gcpro1, gcpro2;
-      GCPRO2 (finalname, name);
 
       /* Note: DECODE_FILE can GC; it should protect its argument,
         though.  */
@@ -314,8 +308,6 @@ directory_files_internal (Lisp_Object directory, 
Lisp_Object full,
          else
            list = Fcons (finalname, list);
        }
-
-      UNGCPRO;
     }
 
   block_input ();
@@ -334,7 +326,7 @@ directory_files_internal (Lisp_Object directory, 
Lisp_Object full,
                  attrs ? Qfile_attributes_lessp : Qstring_lessp);
 
   (void) directory_volatile;
-  RETURN_UNGCPRO (list);
+  return list;
 }
 
 
@@ -472,7 +464,6 @@ file_name_completion (Lisp_Object file, Lisp_Object 
dirname, bool all_flag,
      anything.  */
   bool includeall = 1;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
 
   elt = Qnil;
 
@@ -480,7 +471,6 @@ file_name_completion (Lisp_Object file, Lisp_Object 
dirname, bool all_flag,
 
   bestmatch = Qnil;
   encoded_file = encoded_dir = Qnil;
-  GCPRO5 (file, dirname, bestmatch, encoded_file, encoded_dir);
   specbind (Qdefault_directory, dirname);
 
   /* Do completion on the encoded file name
@@ -640,18 +630,8 @@ file_name_completion (Lisp_Object file, Lisp_Object 
dirname, bool all_flag,
        name = Ffile_name_as_directory (name);
 
       /* Test the predicate, if any.  */
-      if (!NILP (predicate))
-       {
-         Lisp_Object val;
-         struct gcpro gcpro1;
-
-         GCPRO1 (name);
-         val = call1 (predicate, name);
-         UNGCPRO;
-
-         if (NILP (val))
-           continue;
-       }
+      if (!NILP (predicate) && NILP (call1 (predicate, name)))
+       continue;
 
       /* Suitably record this match.  */
 
@@ -731,7 +711,6 @@ file_name_completion (Lisp_Object file, Lisp_Object 
dirname, bool all_flag,
        }
     }
 
-  UNGCPRO;
   /* This closes the directory.  */
   bestmatch = unbind_to (count, bestmatch);
 
diff --git a/src/dispnew.c b/src/dispnew.c
index 861ede2..3101c3f 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -181,7 +181,7 @@ add_window_display_history (struct window *w, const char 
*msg, bool paused_p)
   ++history_idx;
 
   snprintf (buf, sizeof redisplay_history[0].trace,
-           "%"pMu": window %p (`%s')%s\n%s",
+           "%"pMu": window %p (%s)%s\n%s",
            history_tick++,
            ptr,
            ((BUFFERP (w->contents)
diff --git a/src/doc.c b/src/doc.c
index 78a7815..5d0aae7 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -407,10 +407,7 @@ string is passed through `substitute-command-keys'.  */)
       if (NILP (tem) && try_reload)
        {
          /* The file is newer, we need to reset the pointers.  */
-         struct gcpro gcpro1, gcpro2;
-         GCPRO2 (function, raw);
          try_reload = reread_doc_file (Fcar_safe (doc));
-         UNGCPRO;
          if (try_reload)
            {
              try_reload = 0;
@@ -452,10 +449,7 @@ aren't strings.  */)
       if (NILP (tem) && try_reload)
        {
          /* The file is newer, we need to reset the pointers.  */
-         struct gcpro gcpro1, gcpro2, gcpro3;
-         GCPRO3 (symbol, prop, raw);
          try_reload = reread_doc_file (Fcar_safe (doc));
-         UNGCPRO;
          if (try_reload)
            {
              try_reload = 0;
@@ -684,17 +678,33 @@ the same file name is found in the `doc-directory'.  */)
   return unbind_to (count, Qnil);
 }
 
-/* Declare named constants for U+2018 LEFT SINGLE QUOTATION MARK and
-   U+2019 RIGHT SINGLE QUOTATION MARK, which have UTF-8 encodings
-   "\xE2\x80\x98" and "\xE2\x80\x99", respectively.  */
-enum
-  {
-    LEFT_SINGLE_QUOTATION_MARK = 0x2018,
-    uLSQM0 = 0xE2, uLSQM1 = 0x80, uLSQM2 = 0x98,
-    uRSQM0 = 0xE2, uRSQM1 = 0x80, uRSQM2 = 0x99,
-  };
-static unsigned char const LSQM[] = { uLSQM0, uLSQM1, uLSQM2 };
-static unsigned char const RSQM[] = { uRSQM0, uRSQM1, uRSQM2 };
+/* Return true if text quoting style should default to quote `like this'.  */
+static bool
+default_to_grave_quoting_style (void)
+{
+  if (!text_quoting_flag)
+    return true;
+  if (! DISP_TABLE_P (Vstandard_display_table))
+    return false;
+  Lisp_Object dv = DISP_CHAR_VECTOR (XCHAR_TABLE (Vstandard_display_table),
+                                    LEFT_SINGLE_QUOTATION_MARK);
+  return (VECTORP (dv) && ASIZE (dv) == 1
+         && EQ (AREF (dv, 0), make_number ('`')));
+}
+
+/* Return the current effective text quoting style.  */
+enum text_quoting_style
+text_quoting_style (void)
+{
+  if (NILP (Vtext_quoting_style)
+      ? default_to_grave_quoting_style ()
+      : EQ (Vtext_quoting_style, Qgrave))
+    return GRAVE_QUOTING_STYLE;
+  else if (EQ (Vtext_quoting_style, Qstraight))
+    return STRAIGHT_QUOTING_STYLE;
+  else
+    return CURVE_QUOTING_STYLE;
+}
 
 DEFUN ("substitute-command-keys", Fsubstitute_command_keys,
        Ssubstitute_command_keys, 1, 1, 0,
@@ -712,10 +722,9 @@ summary).
 Each substring of the form \\=\\<MAPVAR> specifies the use of MAPVAR
 as the keymap for future \\=\\[COMMAND] substrings.
 
-Each \\=‘ and \\=’ are replaced by left and right quote.  Each \\=` is
-replaced by left quote, and each ' preceded by \\=` and without
-intervening ' is replaced by right quote.  Left and right quote
-characters are specified by ‘help-quote-translation’.
+Each \\=‘ and \\=` is replaced by left quote, and each \\=’ and \\='
+is replaced by right quote.  Left and right quote characters are
+specified by ‘text-quoting-style’.
 
 \\=\\= quotes the following character and is discarded; thus,
 \\=\\=\\=\\= puts \\=\\= into the output, \\=\\=\\=\\[ puts \\=\\[ into the 
output, and
@@ -727,7 +736,6 @@ Otherwise, return a new string.  */)
 {
   char *buf;
   bool changed = false;
-  bool in_quote = false;
   unsigned char *strp;
   char *bufp;
   ptrdiff_t idx;
@@ -737,7 +745,6 @@ Otherwise, return a new string.  */)
   unsigned char const *start;
   ptrdiff_t length, length_byte;
   Lisp_Object name;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   bool multibyte;
   ptrdiff_t nchars;
 
@@ -748,22 +755,8 @@ Otherwise, return a new string.  */)
   tem = Qnil;
   keymap = Qnil;
   name = Qnil;
-  GCPRO4 (string, tem, keymap, name);
-
-  enum { unicode, grave_accent, apostrophe } quote_translation = unicode;
-  if (EQ (Vhelp_quote_translation, make_number ('`')))
-    quote_translation = grave_accent;
-  else if (EQ (Vhelp_quote_translation, make_number ('\'')))
-    quote_translation = apostrophe;
-  else if (NILP (Vhelp_quote_translation)
-          && DISP_TABLE_P (Vstandard_display_table))
-    {
-      Lisp_Object dv = DISP_CHAR_VECTOR (XCHAR_TABLE (Vstandard_display_table),
-                                        LEFT_SINGLE_QUOTATION_MARK);
-      if (VECTORP (dv) && ASIZE (dv) == 1
-         && EQ (AREF (dv, 0), make_number ('`')))
-       quote_translation = grave_accent;
-    }
+
+  enum text_quoting_style quoting_style = text_quoting_style ();
 
   multibyte = STRING_MULTIBYTE (string);
   nchars = 0;
@@ -921,11 +914,13 @@ Otherwise, return a new string.  */)
          if (NILP (tem))
            {
              name = Fsymbol_name (name);
-             insert_string ("\nUses keymap `");
+             AUTO_STRING (msg_prefix, "\nUses keymap `");
+             insert1 (Fsubstitute_command_keys (msg_prefix));
              insert_from_string (name, 0, 0,
                                  SCHARS (name),
                                  SBYTES (name), 1);
-             insert_string ("', which is not currently defined.\n");
+             AUTO_STRING (msg_suffix, "', which is not currently defined.\n");
+             insert1 (Fsubstitute_command_keys (msg_suffix));
              if (start[-1] == '<') keymap = Qnil;
            }
          else if (start[-1] == '<')
@@ -962,52 +957,44 @@ Otherwise, return a new string.  */)
            strp = SDATA (string) + idx;
          }
        }
-      else if (strp[0] == '`' && quote_translation == unicode)
+      else if ((strp[0] == '`' || strp[0] == '\'')
+              && quoting_style == CURVE_QUOTING_STYLE)
        {
-         in_quote = true;
-         start = LSQM;
-       subst_quote:
+         start = (unsigned char const *) (strp[0] == '`' ? uLSQM : uRSQM);
          length = 1;
-         length_byte = 3;
+         length_byte = sizeof uLSQM - 1;
          idx = strp - SDATA (string) + 1;
          goto subst;
        }
-      else if (strp[0] == '`' && quote_translation == apostrophe)
+      else if (strp[0] == '`' && quoting_style == STRAIGHT_QUOTING_STYLE)
        {
          *bufp++ = '\'';
          strp++;
          nchars++;
          changed = true;
        }
-      else if (strp[0] == '\'' && in_quote)
-       {
-         in_quote = false;
-         start = RSQM;
-         goto subst_quote;
-       }
-      else if (strp[0] == uLSQM0 && strp[1] == uLSQM1
-              && (strp[2] == uLSQM2 || strp[2] == uRSQM2)
-              && quote_translation != unicode)
-        {
-         *bufp++ = (strp[2] == uLSQM2 && quote_translation == grave_accent
-                    ? '`' : '\'');
-         strp += 3;
-         nchars++;
-         changed = true;
-        }
-      else if (! multibyte)            /* just copy other chars */
+      else if (! multibyte)
        *bufp++ = *strp++, nchars++;
       else
        {
          int len;
-
-         STRING_CHAR_AND_LENGTH (strp, len);
-         if (len == 1)
-           *bufp = *strp;
+         int ch = STRING_CHAR_AND_LENGTH (strp, len);
+         if ((ch == LEFT_SINGLE_QUOTATION_MARK
+              || ch == RIGHT_SINGLE_QUOTATION_MARK)
+             && quoting_style != CURVE_QUOTING_STYLE)
+           {
+             *bufp++ = ((ch == LEFT_SINGLE_QUOTATION_MARK
+                         && quoting_style == GRAVE_QUOTING_STYLE)
+                        ? '`' : '\'');
+             strp += len;
+             changed = true;
+           }
          else
-           memcpy (bufp, strp, len);
-         strp += len;
-         bufp += len;
+           {
+             do
+               *bufp++ = *strp++;
+             while (--len != 0);
+           }
          nchars++;
        }
     }
@@ -1017,13 +1004,15 @@ Otherwise, return a new string.  */)
   else
     tem = string;
   xfree (buf);
-  RETURN_UNGCPRO (tem);
+  return tem;
 }
 
 void
 syms_of_doc (void)
 {
   DEFSYM (Qfunction_documentation, "function-documentation");
+  DEFSYM (Qgrave, "grave");
+  DEFSYM (Qstraight, "straight");
 
   DEFVAR_LISP ("internal-doc-file-name", Vdoc_file_name,
               doc: /* Name of file containing documentation strings of 
built-in symbols.  */);
@@ -1033,15 +1022,18 @@ syms_of_doc (void)
                doc: /* A list of files used to build this Emacs binary.  */);
   Vbuild_files = Qnil;
 
-  DEFVAR_LISP ("help-quote-translation", Vhelp_quote_translation,
-               doc: /* Style to use for single quotes in help.
-The value is a left single quote character of some style.
-Quote \\=‘like this\\=’ if the value is ?\\=‘ (left single quotation mark).
-Quote 'like this' if the value is ?' (apostrophe).
-Quote \\=`like this' if the value is ?\\=` (grave accent).
-The default value is nil, which means quote with left single quotation mark
-if displayable, and with grave accent otherwise.  */);
-  Vhelp_quote_translation = Qnil;
+  DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style,
+               doc: /* Style to use for single quotes when generating text.
+‘curve’ means quote with curved single quotes \\=‘like this\\=’.
+‘straight’ means quote with straight apostrophes \\='like this\\='.
+‘grave’ means quote with grave accent and apostrophe \\=`like this\\='.
+The default value nil acts like ‘curve’ if curved single quotes are
+displayable, and like ‘grave’ otherwise.  */);
+  Vtext_quoting_style = Qnil;
+
+  DEFVAR_BOOL ("internal--text-quoting-flag", text_quoting_flag,
+              doc: /* If nil, a nil ‘text-quoting-style’ is treated as 
‘grave’.  */);
+  /* Initialized by ‘main’.  */
 
   defsubr (&Sdocumentation);
   defsubr (&Sdocumentation_property);
diff --git a/src/doprnt.c b/src/doprnt.c
index 68750f5..7c5a6af 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -49,8 +49,9 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
    support features beyond those in `Fformat', which is used by `error' on the
    Lisp level.  */
 
-/* This function supports the following %-sequences in the `format'
-   argument:
+/* In the FORMAT argument this function supports ` and ' as directives
+   that output left and right quotes as per ‘text-quoting style’.  It
+   also supports the following %-sequences:
 
    %s means print a string argument.
    %S is silently treated as %s, for loose compatibility with `Fformat'.
@@ -144,6 +145,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
   /* Buffer we have got with malloc.  */
   char *big_buffer = NULL;
 
+  enum text_quoting_style quoting_style = text_quoting_style ();
   ptrdiff_t tem = -1;
   char *string;
   char fixed_buffer[20];       /* Default buffer for small formatting. */
@@ -164,7 +166,9 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
   /* Loop until end of format string or buffer full. */
   while (fmt < format_end && bufsize > 0)
     {
-      if (*fmt == '%') /* Check for a '%' character */
+      char const *fmt0 = fmt;
+      char fmtchar = *fmt++;
+      if (fmtchar == '%')
        {
          ptrdiff_t size_bound = 0;
          ptrdiff_t width;  /* Columns occupied by STRING on display.  */
@@ -180,7 +184,6 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
          int maxmlen = max (max (1, pDlen), max (pIlen, pMlen));
          int mlen;
 
-         fmt++;
          /* Copy this one %-spec into fmtcpy.  */
          string = fmtcpy;
          *string++ = '%';
@@ -438,22 +441,36 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char 
*format,
            }
        }
 
-      {
-       /* Just some character; Copy it if the whole multi-byte form
-          fit in the buffer.  */
-       char *save_bufptr = bufptr;
-
-       do { *bufptr++ = *fmt++; }
-       while (fmt < format_end && --bufsize > 0 && !CHAR_HEAD_P (*fmt));
-       if (!CHAR_HEAD_P (*fmt))
-         {
-           /* Truncate, but return value that will signal to caller
-              that the buffer was too small.  */
-           *save_bufptr = 0;
-           break;
-         }
-      }
-    };
+      char const *src;
+      ptrdiff_t srclen;
+      if (quoting_style == CURVE_QUOTING_STYLE && fmtchar == '`')
+       src = uLSQM, srclen = sizeof uLSQM - 1;
+      else if (quoting_style == CURVE_QUOTING_STYLE && fmtchar == '\'')
+       src = uRSQM, srclen = sizeof uRSQM - 1;
+      else if (quoting_style == STRAIGHT_QUOTING_STYLE && fmtchar == '`')
+       src = "'", srclen = 1;
+      else
+       {
+         while (fmt < format_end && !CHAR_HEAD_P (*fmt))
+           fmt++;
+         src = fmt0, srclen = fmt - fmt0;
+       }
+
+      if (bufsize < srclen)
+       {
+         /* Truncate, but return value that will signal to caller
+            that the buffer was too small.  */
+         do
+           *bufptr++ = '\0';
+         while (--bufsize != 0);
+       }
+      else
+       {
+         do
+           *bufptr++ = *src++;
+         while (--srclen != 0);
+       }
+    }
 
   /* If we had to malloc something, free it.  */
   xfree (big_buffer);
@@ -467,7 +484,8 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
 /* Format to an unbounded buffer BUF.  This is like sprintf, except it
    is not limited to returning an 'int' so it doesn't have a silly 2
    GiB limit on typical 64-bit hosts.  However, it is limited to the
-   Emacs-style formats that doprnt supports.
+   Emacs-style formats that doprnt supports, and it requotes ` and '
+   as per ‘text-quoting-style’.
 
    Return the number of bytes put into BUF, excluding the terminating
    '\0'.  */
diff --git a/src/editfns.c b/src/editfns.c
index 9ff39f9..a85c9e7 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -72,6 +72,7 @@ static Lisp_Object format_time_string (char const *, 
ptrdiff_t, struct timespec,
 static long int tm_gmtoff (struct tm *);
 static int tm_diff (struct tm *, struct tm *);
 static void update_buffer_properties (ptrdiff_t, ptrdiff_t);
+static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool);
 
 #ifndef HAVE_TM_GMTOFF
 # define HAVE_TM_GMTOFF false
@@ -957,7 +958,6 @@ void
 save_excursion_restore (Lisp_Object info)
 {
   Lisp_Object tem, tem1;
-  struct gcpro gcpro1;
 
   tem = Fmarker_buffer (XSAVE_OBJECT (info, 0));
   /* If we're unwinding to top level, saved buffer may be deleted.  This
@@ -965,8 +965,6 @@ save_excursion_restore (Lisp_Object info)
   if (NILP (tem))
     goto out;
 
-  GCPRO1 (info);
-
   Fset_buffer (tem);
 
   /* Point marker.  */
@@ -987,8 +985,6 @@ save_excursion_restore (Lisp_Object info)
           && XBUFFER (tem1) == current_buffer)))
     Fset_window_point (tem, make_number (PT));
 
-  UNGCPRO;
-
  out:
 
   free_misc (info);
@@ -2481,11 +2477,6 @@ insert1 (Lisp_Object arg)
 }
 
 
-/* Callers passing one argument to Finsert need not gcpro the
-   argument "array", since the only element of the array will
-   not be used after calling insert or insert_from_string, so
-   we don't care if it gets trashed.  */
-
 DEFUN ("insert", Finsert, Sinsert, 0, MANY, 0,
        doc: /* Insert the arguments, either strings or characters, at point.
 Point and before-insertion markers move forward to end up
@@ -3190,10 +3181,7 @@ Both characters must have the same length of multi-byte 
form.  */)
            {
              Lisp_Object tem, string;
 
-             struct gcpro gcpro1;
-
              tem = BVAR (current_buffer, undo_list);
-             GCPRO1 (tem);
 
              /* Make a multibyte string containing this single character.  */
              string = make_multibyte_string ((char *) tostr, 1, len);
@@ -3212,8 +3200,6 @@ Both characters must have the same length of multi-byte 
form.  */)
 
              if (! NILP (noundo))
                bset_undo_list (current_buffer, tem);
-
-             UNGCPRO;
            }
          else
            {
@@ -3696,8 +3682,7 @@ usage: (message FORMAT-STRING &rest ARGS)  */)
     }
   else
     {
-      register Lisp_Object val;
-      val = Fformat (nargs, args);
+      Lisp_Object val = Fformat_message (nargs, args);
       message3 (val);
       return val;
     }
@@ -3722,15 +3707,12 @@ usage: (message-box FORMAT-STRING &rest ARGS)  */)
     }
   else
     {
-      Lisp_Object val = Fformat (nargs, args);
+      Lisp_Object val = Fformat_message (nargs, args);
       Lisp_Object pane, menu;
-      struct gcpro gcpro1;
 
       pane = list1 (Fcons (build_string ("OK"), Qt));
-      GCPRO1 (pane);
       menu = Fcons (val, pane);
       Fx_popup_dialog (Qt, menu, Qt);
-      UNGCPRO;
       return val;
     }
 }
@@ -3772,7 +3754,6 @@ usage: (propertize STRING &rest PROPERTIES)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
   Lisp_Object properties, string;
-  struct gcpro gcpro1, gcpro2;
   ptrdiff_t i;
 
   /* Number of args must be odd.  */
@@ -3780,7 +3761,6 @@ usage: (propertize STRING &rest PROPERTIES)  */)
     error ("Wrong number of arguments");
 
   properties = string = Qnil;
-  GCPRO2 (properties, string);
 
   /* First argument must be a string.  */
   CHECK_STRING (args[0]);
@@ -3792,7 +3772,7 @@ usage: (propertize STRING &rest PROPERTIES)  */)
   Fadd_text_properties (make_number (0),
                        make_number (SCHARS (string)),
                        properties, string);
-  RETURN_UNGCPRO (string);
+  return string;
 }
 
 DEFUN ("format", Fformat, Sformat, 1, MANY, 0,
@@ -3849,6 +3829,31 @@ specifier truncates the string to the given width.
 usage: (format STRING &rest OBJECTS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
+  return styled_format (nargs, args, false);
+}
+
+DEFUN ("format-message", Fformat_message, Sformat_message, 1, MANY, 0,
+       doc: /* Format a string out of a format-string and arguments.
+The first argument is a format control string.
+The other arguments are substituted into it to make the result, a string.
+
+This acts like ‘format’, except it also replaces each left single
+quotation mark (\\=‘) and grave accent (\\=`) by a left quote, and each
+right single quotation mark (\\=’) and apostrophe (\\=') by a right quote.
+The left and right quote replacement characters are specified by
+‘text-quoting-style’.
+
+usage: (format-message STRING &rest OBJECTS)  */)
+  (ptrdiff_t nargs, Lisp_Object *args)
+{
+  return styled_format (nargs, args, true);
+}
+
+/* Implement ‘format-message’ if MESSAGE is true, ‘format’ otherwise.  */
+
+static Lisp_Object
+styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
+{
   ptrdiff_t n;         /* The number of the next arg to substitute.  */
   char initial_buffer[4000];
   char *buf = initial_buffer;
@@ -3856,70 +3861,61 @@ usage: (format STRING &rest OBJECTS)  */)
   ptrdiff_t max_bufsize = STRING_BYTES_BOUND + 1;
   char *p;
   ptrdiff_t buf_save_value_index IF_LINT (= 0);
-  char *format, *end, *format_start;
-  ptrdiff_t formatlen, nchars;
-  /* True if the format is multibyte.  */
-  bool multibyte_format = 0;
-  /* True if the output should be a multibyte string,
-     which is true if any of the inputs is one.  */
-  bool multibyte = 0;
+  char *format, *end;
+  ptrdiff_t nchars;
   /* When we make a multibyte string, we must pay attention to the
      byte combining problem, i.e., a byte may be combined with a
      multibyte character of the previous string.  This flag tells if we
      must consider such a situation or not.  */
   bool maybe_combine_byte;
-  Lisp_Object val;
-  bool arg_intervals = 0;
+  bool arg_intervals = false;
   USE_SAFE_ALLOCA;
 
-  /* discarded[I] is 1 if byte I of the format
-     string was not copied into the output.
-     It is 2 if byte I was not the first byte of its character.  */
-  char *discarded;
-
   /* Each element records, for one argument,
      the start and end bytepos in the output string,
      whether the argument has been converted to string (e.g., due to "%S"),
-     and whether the argument is a string with intervals.
-     info[0] is unused.  Unused elements have -1 for start.  */
+     and whether the argument is a string with intervals.  */
   struct info
   {
     ptrdiff_t start, end;
     bool_bf converted_to_string : 1;
     bool_bf intervals : 1;
-  } *info = 0;
-
-  /* It should not be necessary to GCPRO ARGS, because
-     the caller in the interpreter should take care of that.  */
+  } *info;
 
   CHECK_STRING (args[0]);
-  format_start = SSDATA (args[0]);
-  formatlen = SBYTES (args[0]);
+  char *format_start = SSDATA (args[0]);
+  ptrdiff_t formatlen = SBYTES (args[0]);
 
   /* Allocate the info and discarded tables.  */
-  {
-    ptrdiff_t i;
-    if ((SIZE_MAX - formatlen) / sizeof (struct info) <= nargs)
-      memory_full (SIZE_MAX);
-    info = SAFE_ALLOCA ((nargs + 1) * sizeof *info + formatlen);
-    discarded = (char *) &info[nargs + 1];
-    for (i = 0; i < nargs + 1; i++)
-      {
-       info[i].start = -1;
-       info[i].intervals = info[i].converted_to_string = 0;
-      }
-    memset (discarded, 0, formatlen);
-  }
+  if ((SIZE_MAX - formatlen) / sizeof (struct info) <= nargs)
+    memory_full (SIZE_MAX);
+  size_t alloca_size = (nargs + 1) * sizeof *info + formatlen;
+  /* info[0] is unused.  Unused elements have -1 for start.  */
+  info = SAFE_ALLOCA (alloca_size);
+  memset (info, 0, alloca_size);
+  for (ptrdiff_t i = 0; i < nargs + 1; i++)
+    info[i].start = -1;
+  /* discarded[I] is 1 if byte I of the format
+     string was not copied into the output.
+     It is 2 if byte I was not the first byte of its character.  */
+  char *discarded = (char *) &info[nargs + 1];
 
   /* Try to determine whether the result should be multibyte.
      This is not always right; sometimes the result needs to be multibyte
-     because of an object that we will pass through prin1,
+     because of an object that we will pass through prin1.
+     or because a grave accent or apostrophe is requoted,
      and in that case, we won't know it here.  */
-  multibyte_format = STRING_MULTIBYTE (args[0]);
-  multibyte = multibyte_format;
-  for (n = 1; !multibyte && n < nargs; n++)
-    if (STRINGP (args[n]) && STRING_MULTIBYTE (args[n]))
-      multibyte = 1;
+
+  /* True if the format is multibyte.  */
+  bool multibyte_format = STRING_MULTIBYTE (args[0]);
+  /* True if the output should be a multibyte string,
+     which is true if any of the inputs is one.  */
+  bool multibyte = multibyte_format;
+  for (ptrdiff_t i = 1; !multibyte && i < nargs; i++)
+    if (STRINGP (args[i]) && STRING_MULTIBYTE (args[i]))
+      multibyte = true;
+
+  int quoting_style = message ? text_quoting_style () : -1;
 
   /* If we start out planning a unibyte result,
      then discover it has to be multibyte, we jump back to retry.  */
@@ -3932,18 +3928,20 @@ usage: (format STRING &rest OBJECTS)  */)
   /* Scan the format and store result in BUF.  */
   format = format_start;
   end = format + formatlen;
-  maybe_combine_byte = 0;
+  maybe_combine_byte = false;
 
   while (format != end)
     {
       /* The values of N and FORMAT when the loop body is entered.  */
       ptrdiff_t n0 = n;
       char *format0 = format;
+      char const *convsrc = format;
+      unsigned char format_char = *format++;
 
       /* Bytes needed to represent the output of this conversion.  */
-      ptrdiff_t convbytes;
+      ptrdiff_t convbytes = 1;
 
-      if (*format == '%')
+      if (format_char == '%')
        {
          /* General format specifications look like
 
@@ -3963,26 +3961,21 @@ usage: (format STRING &rest OBJECTS)  */)
             digits to print after the '.' for floats, or the max.
             number of chars to print from a string.  */
 
-         bool minus_flag = 0;
-         bool  plus_flag = 0;
-         bool space_flag = 0;
-         bool sharp_flag = 0;
-         bool  zero_flag = 0;
-         ptrdiff_t field_width;
-         bool precision_given;
-         uintmax_t precision = UINTMAX_MAX;
-         char *num_end;
-         char conversion;
+         bool minus_flag = false;
+         bool  plus_flag = false;
+         bool space_flag = false;
+         bool sharp_flag = false;
+         bool  zero_flag = false;
 
-         while (1)
+         for (; ; format++)
            {
-             switch (*++format)
+             switch (*format)
                {
-               case '-': minus_flag = 1; continue;
-               case '+':  plus_flag = 1; continue;
-               case ' ': space_flag = 1; continue;
-               case '#': sharp_flag = 1; continue;
-               case '0':  zero_flag = 1; continue;
+               case '-': minus_flag = true; continue;
+               case '+':  plus_flag = true; continue;
+               case ' ': space_flag = true; continue;
+               case '#': sharp_flag = true; continue;
+               case '0':  zero_flag = true; continue;
                }
              break;
            }
@@ -3991,26 +3984,26 @@ usage: (format STRING &rest OBJECTS)  */)
          space_flag &= ~ plus_flag;
          zero_flag &= ~ minus_flag;
 
-         {
-           uintmax_t w = strtoumax (format, &num_end, 10);
-           if (max_bufsize <= w)
-             string_overflow ();
-           field_width = w;
-         }
-         precision_given = *num_end == '.';
-         if (precision_given)
-           precision = strtoumax (num_end + 1, &num_end, 10);
+         char *num_end;
+         uintmax_t raw_field_width = strtoumax (format, &num_end, 10);
+         if (max_bufsize <= raw_field_width)
+           string_overflow ();
+         ptrdiff_t field_width = raw_field_width;
+
+         bool precision_given = *num_end == '.';
+         uintmax_t precision = (precision_given
+                                ? strtoumax (num_end + 1, &num_end, 10)
+                                : UINTMAX_MAX);
          format = num_end;
 
          if (format == end)
            error ("Format string ends in middle of format specifier");
 
-         memset (&discarded[format0 - format_start], 1, format - format0);
-         conversion = *format;
+         char conversion = *format++;
+         memset (&discarded[format0 - format_start], 1,
+                 format - format0 - (conversion == '%'));
          if (conversion == '%')
            goto copy_char;
-         discarded[format - format_start] = 1;
-         format++;
 
          ++n;
          if (! (n < nargs))
@@ -4028,10 +4021,10 @@ usage: (format STRING &rest OBJECTS)  */)
                {
                  Lisp_Object noescape = conversion == 'S' ? Qnil : Qt;
                  args[n] = Fprin1_to_string (args[n], noescape);
-                 info[n].converted_to_string = 1;
+                 info[n].converted_to_string = true;
                  if (STRING_MULTIBYTE (args[n]) && ! multibyte)
                    {
-                     multibyte = 1;
+                     multibyte = true;
                      goto retry;
                    }
                }
@@ -4049,16 +4042,16 @@ usage: (format STRING &rest OBJECTS)  */)
                {
                  if (!multibyte)
                    {
-                     multibyte = 1;
+                     multibyte = true;
                      goto retry;
                    }
                  args[n] = Fchar_to_string (args[n]);
-                 info[n].converted_to_string = 1;
+                 info[n].converted_to_string = true;
                }
 
              if (info[n].converted_to_string)
                conversion = 's';
-             zero_flag = 0;
+             zero_flag = false;
            }
 
          if (SYMBOLP (args[n]))
@@ -4066,7 +4059,7 @@ usage: (format STRING &rest OBJECTS)  */)
              args[n] = SYMBOL_NAME (args[n]);
              if (STRING_MULTIBYTE (args[n]) && ! multibyte)
                {
-                 multibyte = 1;
+                 multibyte = true;
                  goto retry;
                }
            }
@@ -4075,9 +4068,6 @@ usage: (format STRING &rest OBJECTS)  */)
            {
              /* handle case (precision[n] >= 0) */
 
-             ptrdiff_t width, padding, nbytes;
-             ptrdiff_t nchars_string;
-
              ptrdiff_t prec = -1;
              if (precision_given && precision <= TYPE_MAXIMUM (ptrdiff_t))
                prec = precision;
@@ -4088,6 +4078,8 @@ usage: (format STRING &rest OBJECTS)  */)
                 lisp_string_width is the right thing, and will be
                 done, but meanwhile we work with it. */
 
+             ptrdiff_t width, nbytes;
+             ptrdiff_t nchars_string;
              if (prec == 0)
                width = nchars_string = nbytes = 0;
              else
@@ -4110,7 +4102,8 @@ usage: (format STRING &rest OBJECTS)  */)
              if (convbytes && multibyte && ! STRING_MULTIBYTE (args[n]))
                convbytes = count_size_as_multibyte (SDATA (args[n]), nbytes);
 
-             padding = width < field_width ? field_width - width : 0;
+             ptrdiff_t padding
+               = width < field_width ? field_width - width : 0;
 
              if (max_bufsize - padding <= convbytes)
                string_overflow ();
@@ -4129,7 +4122,7 @@ usage: (format STRING &rest OBJECTS)  */)
                      && !ASCII_CHAR_P (*((unsigned char *) p - 1))
                      && STRING_MULTIBYTE (args[n])
                      && !CHAR_HEAD_P (SREF (args[n], 0)))
-                   maybe_combine_byte = 1;
+                   maybe_combine_byte = true;
 
                  p += copy_text (SDATA (args[n]), (unsigned char *) p,
                                  nbytes,
@@ -4149,7 +4142,7 @@ usage: (format STRING &rest OBJECTS)  */)
                  /* If this argument has text properties, record where
                     in the result string it appears.  */
                  if (string_intervals (args[n]))
-                   info[n].intervals = arg_intervals = 1;
+                   info[n].intervals = arg_intervals = true;
 
                  continue;
                }
@@ -4188,24 +4181,15 @@ usage: (format STRING &rest OBJECTS)  */)
              };
              verify (USEFUL_PRECISION_MAX > 0);
 
-             int prec;
-             ptrdiff_t padding, sprintf_bytes;
-             uintmax_t excess_precision, numwidth;
-             uintmax_t leading_zeros = 0, trailing_zeros = 0;
-
-             char sprintf_buf[SPRINTF_BUFSIZE];
-
-             /* Copy of conversion specification, modified somewhat.
-                At most three flags F can be specified at once.  */
-             char convspec[sizeof "%FFF.*d" + pMlen];
-
              /* Avoid undefined behavior in underlying sprintf.  */
              if (conversion == 'd' || conversion == 'i')
-               sharp_flag = 0;
+               sharp_flag = false;
 
              /* Create the copy of the conversion specification, with
                 any width and precision removed, with ".*" inserted,
-                and with pM inserted for integer formats.  */
+                and with pM inserted for integer formats.
+                At most three flags F can be specified at once.  */
+             char convspec[sizeof "%FFF.*d" + pMlen];
              {
                char *f = convspec;
                *f++ = '%';
@@ -4228,7 +4212,7 @@ usage: (format STRING &rest OBJECTS)  */)
                *f = '\0';
              }
 
-             prec = -1;
+             int prec = -1;
              if (precision_given)
                prec = min (precision, USEFUL_PRECISION_MAX);
 
@@ -4243,6 +4227,8 @@ usage: (format STRING &rest OBJECTS)  */)
                 careful about integer overflow, NaNs, infinities, and
                 conversions; for example, the min and max macros are
                 not suitable here.  */
+             char sprintf_buf[SPRINTF_BUFSIZE];
+             ptrdiff_t sprintf_bytes;
              if (conversion == 'e' || conversion == 'f' || conversion == 'g')
                {
                  double x = (INTEGERP (args[n])
@@ -4307,7 +4293,8 @@ usage: (format STRING &rest OBJECTS)  */)
                 padding and excess precision.  Deal with excess precision
                 first.  This happens only when the format specifies
                 ridiculously large precision.  */
-             excess_precision = precision - prec;
+             uintmax_t excess_precision = precision - prec;
+             uintmax_t leading_zeros = 0, trailing_zeros = 0;
              if (excess_precision)
                {
                  if (conversion == 'e' || conversion == 'f'
@@ -4334,8 +4321,9 @@ usage: (format STRING &rest OBJECTS)  */)
 
              /* Compute the total bytes needed for this item, including
                 excess precision and padding.  */
-             numwidth = sprintf_bytes + excess_precision;
-             padding = numwidth < field_width ? field_width - numwidth : 0;
+             uintmax_t numwidth = sprintf_bytes + excess_precision;
+             ptrdiff_t padding
+               = numwidth < field_width ? field_width - numwidth : 0;
              if (max_bufsize - sprintf_bytes <= excess_precision
                  || max_bufsize - padding <= numwidth)
                string_overflow ();
@@ -4350,7 +4338,6 @@ usage: (format STRING &rest OBJECTS)  */)
                  char src0 = src[0];
                  int exponent_bytes = 0;
                  bool signedp = src0 == '-' || src0 == '+' || src0 == ' ';
-                 int significand_bytes;
                  if (zero_flag
                      && ((src[signedp] >= '0' && src[signedp] <= '9')
                          || (src[signedp] >= 'a' && src[signedp] <= 'f')
@@ -4380,7 +4367,8 @@ usage: (format STRING &rest OBJECTS)  */)
                  p += signedp;
                  memset (p, '0', leading_zeros);
                  p += leading_zeros;
-                 significand_bytes = sprintf_bytes - signedp - exponent_bytes;
+                 int significand_bytes
+                   = sprintf_bytes - signedp - exponent_bytes;
                  memcpy (p, src, significand_bytes);
                   p += significand_bytes;
                  src += significand_bytes;
@@ -4405,44 +4393,72 @@ usage: (format STRING &rest OBJECTS)  */)
            }
        }
       else
-      copy_char:
        {
-         /* Copy a single character from format to buf.  */
+         /* Named constants for the UTF-8 encodings of U+2018 LEFT SINGLE
+            QUOTATION MARK and U+2019 RIGHT SINGLE QUOTATION MARK.  */
+         enum
+         {
+           uLSQM0 = 0xE2, uLSQM1 = 0x80, uLSQM2 = 0x98,
+           /* uRSQM0 = 0xE2, uRSQM1 = 0x80, */ uRSQM2 = 0x99
+         };
 
-         char *src = format;
          unsigned char str[MAX_MULTIBYTE_LENGTH];
 
-         if (multibyte_format)
+         if ((format_char == '`' || format_char == '\'')
+             && quoting_style == CURVE_QUOTING_STYLE)
+           {
+             if (! multibyte)
+               {
+                 multibyte = true;
+                 goto retry;
+               }
+             convsrc = format_char == '`' ? uLSQM : uRSQM;
+             convbytes = 3;
+           }
+         else if (format_char == '`' && quoting_style == 
STRAIGHT_QUOTING_STYLE)
+           convsrc = "'";
+         else if (format_char == uLSQM0 && CURVE_QUOTING_STYLE < quoting_style
+                  && multibyte_format
+                  && (unsigned char) format[0] == uLSQM1
+                  && ((unsigned char) format[1] == uLSQM2
+                      || (unsigned char) format[1] == uRSQM2))
            {
-             /* Copy a whole multibyte character.  */
-             if (p > buf
-                 && !ASCII_CHAR_P (*((unsigned char *) p - 1))
-                 && !CHAR_HEAD_P (*format))
-               maybe_combine_byte = 1;
-
-             do
-               format++;
-             while (! CHAR_HEAD_P (*format));
-
-             convbytes = format - src;
-             memset (&discarded[src + 1 - format_start], 2, convbytes - 1);
+             convsrc = (((unsigned char) format[1] == uLSQM2
+                         && quoting_style == GRAVE_QUOTING_STYLE)
+                        ? "`" : "'");
+             format += 2;
+             memset (&discarded[format0 + 1 - format_start], 2, 2);
            }
          else
            {
-             unsigned char uc = *format++;
-             if (! multibyte || ASCII_CHAR_P (uc))
-               convbytes = 1;
-             else
+             /* Copy a single character from format to buf.  */
+             if (multibyte_format)
                {
-                 int c = BYTE8_TO_CHAR (uc);
+                 /* Copy a whole multibyte character.  */
+                 if (p > buf
+                     && !ASCII_CHAR_P (*((unsigned char *) p - 1))
+                     && !CHAR_HEAD_P (format_char))
+                   maybe_combine_byte = true;
+
+                 while (! CHAR_HEAD_P (*format))
+                   format++;
+
+                 convbytes = format - format0;
+                 memset (&discarded[format0 + 1 - format_start], 2,
+                         convbytes - 1);
+               }
+             else if (multibyte && !ASCII_CHAR_P (format_char))
+               {
+                 int c = BYTE8_TO_CHAR (format_char);
                  convbytes = CHAR_STRING (c, str);
-                 src = (char *) str;
+                 convsrc = (char *) str;
                }
            }
 
+       copy_char:
          if (convbytes <= buf + bufsize - p)
            {
-             memcpy (p, src, convbytes);
+             memcpy (p, convsrc, convbytes);
              p += convbytes;
              nchars++;
              continue;
@@ -4452,31 +4468,28 @@ usage: (format STRING &rest OBJECTS)  */)
       /* There wasn't enough room to store this conversion or single
         character.  CONVBYTES says how much room is needed.  Allocate
         enough room (and then some) and do it again.  */
-      {
-       ptrdiff_t used = p - buf;
 
-       if (max_bufsize - used < convbytes)
-         string_overflow ();
-       bufsize = used + convbytes;
-       bufsize = bufsize < max_bufsize / 2 ? bufsize * 2 : max_bufsize;
-
-       if (buf == initial_buffer)
-         {
-           buf = xmalloc (bufsize);
-           sa_must_free = true;
-           buf_save_value_index = SPECPDL_INDEX ();
-           record_unwind_protect_ptr (xfree, buf);
-           memcpy (buf, initial_buffer, used);
-         }
-       else
-         {
-           buf = xrealloc (buf, bufsize);
-           set_unwind_protect_ptr (buf_save_value_index, xfree, buf);
-         }
+      ptrdiff_t used = p - buf;
+      if (max_bufsize - used < convbytes)
+       string_overflow ();
+      bufsize = used + convbytes;
+      bufsize = bufsize < max_bufsize / 2 ? bufsize * 2 : max_bufsize;
 
-       p = buf + used;
-      }
+      if (buf == initial_buffer)
+       {
+         buf = xmalloc (bufsize);
+         sa_must_free = true;
+         buf_save_value_index = SPECPDL_INDEX ();
+         record_unwind_protect_ptr (xfree, buf);
+         memcpy (buf, initial_buffer, used);
+       }
+      else
+       {
+         buf = xrealloc (buf, bufsize);
+         set_unwind_protect_ptr (buf_save_value_index, xfree, buf);
+       }
 
+      p = buf + used;
       format = format0;
       n = n0;
     }
@@ -4486,7 +4499,7 @@ usage: (format STRING &rest OBJECTS)  */)
 
   if (maybe_combine_byte)
     nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf);
-  val = make_specified_string (buf, nchars, p - buf, multibyte);
+  Lisp_Object val = make_specified_string (buf, nchars, p - buf, multibyte);
 
   /* If the format string has text properties, or any of the string
      arguments has text properties, set up text properties of the
@@ -4494,19 +4507,14 @@ usage: (format STRING &rest OBJECTS)  */)
 
   if (string_intervals (args[0]) || arg_intervals)
     {
-      Lisp_Object len, new_len, props;
-      struct gcpro gcpro1;
-
       /* Add text properties from the format string.  */
-      len = make_number (SCHARS (args[0]));
-      props = text_property_list (args[0], make_number (0), len, Qnil);
-      GCPRO1 (props);
-
+      Lisp_Object len = make_number (SCHARS (args[0]));
+      Lisp_Object props = text_property_list (args[0], make_number (0),
+                                             len, Qnil);
       if (CONSP (props))
        {
          ptrdiff_t bytepos = 0, position = 0, translated = 0;
          ptrdiff_t argn = 1;
-         Lisp_Object list;
 
          /* Adjust the bounds of each text property
             to the proper start and end in the output string.  */
@@ -4520,15 +4528,12 @@ usage: (format STRING &rest OBJECTS)  */)
             POSITION is the untranslated char position in it,
             TRANSLATED is the translated char position in BUF,
             and ARGN is the number of the next arg we will come to.  */
-         for (list = props; CONSP (list); list = XCDR (list))
+         for (Lisp_Object list = props; CONSP (list); list = XCDR (list))
            {
-             Lisp_Object item;
-             ptrdiff_t pos;
-
-             item = XCAR (list);
+             Lisp_Object item = XCAR (list);
 
              /* First adjust the property start position.  */
-             pos = XINT (XCAR (item));
+             ptrdiff_t pos = XINT (XCAR (item));
 
              /* Advance BYTEPOS, POSITION, TRANSLATED and ARGN
                 up to this position.  */
@@ -4575,22 +4580,20 @@ usage: (format STRING &rest OBJECTS)  */)
 
       /* Add text properties from arguments.  */
       if (arg_intervals)
-       for (n = 1; n < nargs; ++n)
-         if (info[n].intervals)
+       for (ptrdiff_t i = 1; i < nargs; i++)
+         if (info[i].intervals)
            {
-             len = make_number (SCHARS (args[n]));
-             new_len = make_number (info[n].end - info[n].start);
-             props = text_property_list (args[n], make_number (0), len, Qnil);
+             len = make_number (SCHARS (args[i]));
+             Lisp_Object new_len = make_number (info[i].end - info[i].start);
+             props = text_property_list (args[i], make_number (0), len, Qnil);
              props = extend_property_ranges (props, new_len);
              /* If successive arguments have properties, be sure that
                 the value of `composition' property be the copy.  */
-             if (n > 1 && info[n - 1].end)
+             if (1 < i && info[i - 1].end)
                make_composition_value_copy (props);
              add_text_properties_from_list (val, props,
-                                            make_number (info[n].start));
+                                            make_number (info[i].start));
            }
-
-      UNGCPRO;
     }
 
   /* If we allocated BUF or INFO with malloc, free it too.  */
@@ -5154,6 +5157,7 @@ functions if all the text being accessed has this 
property.  */);
   defsubr (&Smessage_or_box);
   defsubr (&Scurrent_message);
   defsubr (&Sformat);
+  defsubr (&Sformat_message);
 
   defsubr (&Sinsert_buffer_substring);
   defsubr (&Scompare_buffer_substrings);
diff --git a/src/emacs.c b/src/emacs.c
index aca966c..aabb2f2 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -98,6 +98,10 @@ extern void moncontrol (int mode);
 #include <locale.h>
 #endif
 
+#if HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+
 #ifdef HAVE_SETRLIMIT
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -347,6 +351,19 @@ setlocale (int cat, char const *locale)
 }
 #endif
 
+/* True if the current system locale uses UTF-8 encoding.  */
+static bool
+using_utf8 (void)
+{
+#ifdef HAVE_WCHAR_H
+  wchar_t wc;
+  mbstate_t mbs = { 0 };
+  return mbrtowc (&wc, "\xc4\x80", 2, &mbs) == 2 && wc == 0x100;
+#else
+  return false;
+#endif
+}
+
 
 /* Report a fatal error due to signal SIG, output a backtrace of at
    most BACKTRACE_LIMIT lines, and exit.  */
@@ -700,9 +717,7 @@ close_output_streams (void)
 int
 main (int argc, char **argv)
 {
-#if GC_MARK_STACK
   Lisp_Object dummy;
-#endif
   char stack_bottom_variable;
   bool do_initial_setlocale;
   bool dumping;
@@ -721,9 +736,7 @@ main (int argc, char **argv)
   /* If we use --chdir, this records the original directory.  */
   char *original_pwd = 0;
 
-#if GC_MARK_STACK
   stack_base = &dummy;
-#endif
 
 #ifndef CANNOT_DUMP
   might_dump = !initialized;
@@ -927,6 +940,7 @@ main (int argc, char **argv)
      fixup_locale must wait until later, since it builds strings.  */
   if (do_initial_setlocale)
     setlocale (LC_ALL, "");
+  text_quoting_flag = using_utf8 ();
 
   inhibit_window_system = 0;
 
@@ -1920,16 +1934,12 @@ all of which are called before Emacs is actually 
killed.  */
        attributes: noreturn)
   (Lisp_Object arg)
 {
-  struct gcpro gcpro1;
   int exit_code;
 
-  GCPRO1 (arg);
-
   /* Fsignal calls emacs_abort () if it sees that waiting_for_input is
      set.  */
   waiting_for_input = 0;
   run_hook (Qkill_emacs_hook);
-  UNGCPRO;
 
 #ifdef HAVE_X_WINDOWS
   /* Transfer any clipboards we own to the clipboard manager.  */
@@ -2160,17 +2170,23 @@ synchronize_locale (int category, Lisp_Object *plocale, 
Lisp_Object desired_loca
 {
   if (! EQ (*plocale, desired_locale))
     {
+      *plocale = desired_locale;
 #ifdef WINDOWSNT
       /* Changing categories like LC_TIME usually requires to specify
         an encoding suitable for the new locale, but MS-Windows's
         'setlocale' will only switch the encoding when LC_ALL is
-        specified.  So we ignore CATEGORY and use LC_ALL instead.  */
-      category = LC_ALL;
-#endif
-      *plocale = desired_locale;
+        specified.  So we ignore CATEGORY, use LC_ALL instead, and
+        then restore LC_NUMERIC to "C", so reading and printing
+        numbers is unaffected.  */
+      setlocale (LC_ALL, (STRINGP (desired_locale)
+                         ? SSDATA (desired_locale)
+                         : ""));
+      fixup_locale ();
+#else  /* !WINDOWSNT */
       setlocale (category, (STRINGP (desired_locale)
                            ? SSDATA (desired_locale)
                            : ""));
+#endif /* !WINDOWSNT */
     }
 }
 
@@ -2429,7 +2445,7 @@ Special values:
 Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix,
 hpux, irix, usg-unix-v) indicates some sort of Unix system.  */);
   Vsystem_type = intern_c_string (SYSTEM_TYPE);
-  /* See configure.ac (and config.nt) for the possible SYSTEM_TYPEs.  */
+  /* See configure.ac for the possible SYSTEM_TYPEs.  */
 
   DEFVAR_LISP ("system-configuration", Vsystem_configuration,
               doc: /* Value is string indicating configuration Emacs was built 
for.  */);
diff --git a/src/eval.c b/src/eval.c
index 9bdcf4b..6fde7e3 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -33,11 +33,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 struct handler *handlerlist;
 
-#ifdef DEBUG_GCPRO
-/* Count levels of GCPRO to detect failure to UNGCPRO.  */
-int gcpro_level;
-#endif
-
 /* Non-nil means record all fset's and provide's, to be undone
    if the file being autoloaded is not fully loaded.
    They are recorded by being consed onto the front of Vautoload_queue:
@@ -226,7 +221,6 @@ static struct handler handlerlist_sentinel;
 void
 init_eval (void)
 {
-  gcprolist = 0;
   byte_stack_list = 0;
   specpdl_ptr = specpdl;
   { /* Put a dummy catcher at top-level so that handlerlist is never NULL.
@@ -242,9 +236,6 @@ init_eval (void)
   Vquit_flag = Qnil;
   debug_on_next_call = 0;
   lisp_eval_depth = 0;
-#ifdef DEBUG_GCPRO
-  gcpro_level = 0;
-#endif
   /* This is less than the initial value of num_nonmacro_input_events.  */
   when_entered_debugger = -1;
 }
@@ -344,10 +335,7 @@ If all args return nil, return nil.
 usage: (or CONDITIONS...)  */)
   (Lisp_Object args)
 {
-  register Lisp_Object val = Qnil;
-  struct gcpro gcpro1;
-
-  GCPRO1 (args);
+  Lisp_Object val = Qnil;
 
   while (CONSP (args))
     {
@@ -357,7 +345,6 @@ usage: (or CONDITIONS...)  */)
       args = XCDR (args);
     }
 
-  UNGCPRO;
   return val;
 }
 
@@ -368,10 +355,7 @@ If no arg yields nil, return the last arg's value.
 usage: (and CONDITIONS...)  */)
   (Lisp_Object args)
 {
-  register Lisp_Object val = Qt;
-  struct gcpro gcpro1;
-
-  GCPRO1 (args);
+  Lisp_Object val = Qt;
 
   while (CONSP (args))
     {
@@ -381,7 +365,6 @@ usage: (and CONDITIONS...)  */)
       args = XCDR (args);
     }
 
-  UNGCPRO;
   return val;
 }
 
@@ -394,11 +377,8 @@ usage: (if COND THEN ELSE...)  */)
   (Lisp_Object args)
 {
   Lisp_Object cond;
-  struct gcpro gcpro1;
 
-  GCPRO1 (args);
   cond = eval_sub (XCAR (args));
-  UNGCPRO;
 
   if (!NILP (cond))
     return eval_sub (Fcar (XCDR (args)));
@@ -418,9 +398,7 @@ usage: (cond CLAUSES...)  */)
   (Lisp_Object args)
 {
   Lisp_Object val = args;
-  struct gcpro gcpro1;
 
-  GCPRO1 (args);
   while (CONSP (args))
     {
       Lisp_Object clause = XCAR (args);
@@ -433,7 +411,6 @@ usage: (cond CLAUSES...)  */)
        }
       args = XCDR (args);
     }
-  UNGCPRO;
 
   return val;
 }
@@ -444,9 +421,6 @@ usage: (progn BODY...)  */)
   (Lisp_Object body)
 {
   Lisp_Object val = Qnil;
-  struct gcpro gcpro1;
-
-  GCPRO1 (body);
 
   while (CONSP (body))
     {
@@ -454,7 +428,6 @@ usage: (progn BODY...)  */)
       body = XCDR (body);
     }
 
-  UNGCPRO;
   return val;
 }
 
@@ -476,17 +449,14 @@ usage: (prog1 FIRST BODY...)  */)
 {
   Lisp_Object val;
   Lisp_Object args_left;
-  struct gcpro gcpro1, gcpro2;
 
   args_left = args;
   val = args;
-  GCPRO2 (args, val);
 
   val = eval_sub (XCAR (args_left));
   while (CONSP (args_left = XCDR (args_left)))
     eval_sub (XCAR (args_left));
 
-  UNGCPRO;
   return val;
 }
 
@@ -497,11 +467,7 @@ remaining args, whose values are discarded.
 usage: (prog2 FORM1 FORM2 BODY...)  */)
   (Lisp_Object args)
 {
-  struct gcpro gcpro1;
-
-  GCPRO1 (args);
   eval_sub (XCAR (args));
-  UNGCPRO;
   return Fprog1 (XCDR (args));
 }
 
@@ -522,8 +488,6 @@ usage: (setq [SYM VAL]...)  */)
   if (CONSP (args))
     {
       Lisp_Object args_left = args;
-      struct gcpro gcpro1;
-      GCPRO1 (args);
 
       do
        {
@@ -543,8 +507,6 @@ usage: (setq [SYM VAL]...)  */)
          args_left = Fcdr (XCDR (args_left));
        }
       while (CONSP (args_left));
-
-      UNGCPRO;
     }
 
   return val;
@@ -854,9 +816,6 @@ usage: (let* VARLIST BODY...)  */)
 {
   Lisp_Object varlist, var, val, elt, lexenv;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3;
-
-  GCPRO3 (args, elt, varlist);
 
   lexenv = Vinternal_interpreter_environment;
 
@@ -900,7 +859,7 @@ usage: (let* VARLIST BODY...)  */)
 
       varlist = XCDR (varlist);
     }
-  UNGCPRO;
+
   val = Fprogn (XCDR (args));
   return unbind_to (count, val);
 }
@@ -915,10 +874,9 @@ usage: (let VARLIST BODY...)  */)
   (Lisp_Object args)
 {
   Lisp_Object *temps, tem, lexenv;
-  register Lisp_Object elt, varlist;
+  Lisp_Object elt, varlist;
   ptrdiff_t count = SPECPDL_INDEX ();
   ptrdiff_t argnum;
-  struct gcpro gcpro1, gcpro2;
   USE_SAFE_ALLOCA;
 
   varlist = XCAR (args);
@@ -929,9 +887,6 @@ usage: (let VARLIST BODY...)  */)
 
   /* Compute the values and store them in `temps'.  */
 
-  GCPRO2 (args, *temps);
-  gcpro2.nvars = 0;
-
   for (argnum = 0; CONSP (varlist); varlist = XCDR (varlist))
     {
       QUIT;
@@ -942,9 +897,7 @@ usage: (let VARLIST BODY...)  */)
        signal_error ("`let' bindings can have only one value-form", elt);
       else
        temps [argnum++] = eval_sub (Fcar (Fcdr (elt)));
-      gcpro2.nvars = argnum;
     }
-  UNGCPRO;
 
   lexenv = Vinternal_interpreter_environment;
 
@@ -984,9 +937,6 @@ usage: (while TEST BODY...)  */)
   (Lisp_Object args)
 {
   Lisp_Object test, body;
-  struct gcpro gcpro1, gcpro2;
-
-  GCPRO2 (test, body);
 
   test = XCAR (args);
   body = XCDR (args);
@@ -996,7 +946,6 @@ usage: (while TEST BODY...)  */)
       Fprogn (body);
     }
 
-  UNGCPRO;
   return Qnil;
 }
 
@@ -1043,10 +992,7 @@ definitions to shadow the loaded ones for use in file 
byte-compilation.  */)
        {
          /* SYM is not mentioned in ENVIRONMENT.
             Look at its function definition.  */
-         struct gcpro gcpro1;
-         GCPRO1 (form);
          def = Fautoload_do_load (def, sym, Qmacro);
-         UNGCPRO;
          if (!CONSP (def))
            /* Not defined or definition not suitable.  */
            break;
@@ -1082,12 +1028,7 @@ If a throw happens, it specifies the value to return 
from `catch'.
 usage: (catch TAG BODY...)  */)
   (Lisp_Object args)
 {
-  register Lisp_Object tag;
-  struct gcpro gcpro1;
-
-  GCPRO1 (args);
-  tag = eval_sub (XCAR (args));
-  UNGCPRO;
+  Lisp_Object tag = eval_sub (XCAR (args));
   return internal_catch (tag, Fprogn, XCDR (args));
 }
 
@@ -1172,10 +1113,6 @@ unwind_to_catch (struct handler *catch, Lisp_Object 
value)
   eassert (handlerlist == catch);
 
   byte_stack_list = catch->byte_stack;
-  gcprolist = catch->gcpro;
-#ifdef DEBUG_GCPRO
-  gcpro_level = gcprolist ? gcprolist->level + 1 : 0;
-#endif
   lisp_eval_depth = catch->lisp_eval_depth;
 
   sys_longjmp (catch->jmp, 1);
@@ -1932,7 +1869,6 @@ it defines a macro.  */)
   (Lisp_Object fundef, Lisp_Object funname, Lisp_Object macro_only)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3;
 
   if (!CONSP (fundef) || !EQ (Qautoload, XCAR (fundef)))
     return fundef;
@@ -1951,7 +1887,6 @@ it defines a macro.  */)
           SDATA (SYMBOL_NAME (funname)));
 
   CHECK_SYMBOL (funname);
-  GCPRO3 (funname, fundef, macro_only);
 
   /* Preserve the match data.  */
   record_unwind_save_match_data ();
@@ -1974,8 +1909,6 @@ it defines a macro.  */)
   Vautoload_queue = Qt;
   unbind_to (count, Qnil);
 
-  UNGCPRO;
-
   if (NILP (funname))
     return Qnil;
   else
@@ -2063,7 +1996,6 @@ eval_sub (Lisp_Object form)
 {
   Lisp_Object fun, val, original_fun, original_args;
   Lisp_Object funcar;
-  struct gcpro gcpro1, gcpro2, gcpro3;
   ptrdiff_t count;
 
   if (SYMBOLP (form))
@@ -2086,9 +2018,7 @@ eval_sub (Lisp_Object form)
 
   QUIT;
 
-  GCPRO1 (form);
   maybe_gc ();
-  UNGCPRO;
 
   if (++lisp_eval_depth > max_lisp_eval_depth)
     {
@@ -2146,38 +2076,26 @@ eval_sub (Lisp_Object form)
 
          SAFE_ALLOCA_LISP (vals, XINT (numargs));
 
-         GCPRO3 (args_left, fun, fun);
-         gcpro3.var = vals;
-         gcpro3.nvars = 0;
-
          while (!NILP (args_left))
            {
              vals[argnum++] = eval_sub (Fcar (args_left));
              args_left = Fcdr (args_left);
-             gcpro3.nvars = argnum;
            }
 
          set_backtrace_args (specpdl + count, vals, XINT (numargs));
 
          val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals);
-         UNGCPRO;
          SAFE_FREE ();
        }
       else
        {
-         GCPRO3 (args_left, fun, fun);
-         gcpro3.var = argvals;
-         gcpro3.nvars = 0;
-
          maxargs = XSUBR (fun)->max_args;
-         for (i = 0; i < maxargs; args_left = Fcdr (args_left))
+         for (i = 0; i < maxargs; i++)
            {
              argvals[i] = eval_sub (Fcar (args_left));
-             gcpro3.nvars = ++i;
+             args_left = Fcdr (args_left);
            }
 
-         UNGCPRO;
-
          set_backtrace_args (specpdl + count, argvals, XINT (numargs));
 
          switch (i)
@@ -2341,7 +2259,6 @@ usage: (apply FUNCTION &rest ARGUMENTS)  */)
       spread_arg = XCDR (spread_arg);
     }
 
-  /* Ffuncall gcpro's all of its args.  */
   retval = Ffuncall (funcall_nargs, funcall_args);
 
   SAFE_FREE ();
@@ -2470,16 +2387,13 @@ usage: (run-hook-wrapped HOOK WRAP-FUNCTION &rest ARGS) 
 */)
 /* ARGS[0] should be a hook symbol.
    Call each of the functions in the hook value, passing each of them
    as arguments all the rest of ARGS (all NARGS - 1 elements).
-   FUNCALL specifies how to call each function on the hook.
-   The caller (or its caller, etc) must gcpro all of ARGS,
-   except that it isn't necessary to gcpro ARGS[0].  */
+   FUNCALL specifies how to call each function on the hook.  */
 
 Lisp_Object
 run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args,
                    Lisp_Object (*funcall) (ptrdiff_t nargs, Lisp_Object *args))
 {
   Lisp_Object sym, val, ret = Qnil;
-  struct gcpro gcpro1, gcpro2, gcpro3;
 
   /* If we are dying or still initializing,
      don't do anything--it would probably crash if we tried.  */
@@ -2499,7 +2413,6 @@ run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args,
   else
     {
       Lisp_Object global_vals = Qnil;
-      GCPRO3 (sym, val, global_vals);
 
       for (;
           CONSP (val) && NILP (ret);
@@ -2538,7 +2451,6 @@ run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args,
            }
        }
 
-      UNGCPRO;
       return ret;
     }
 }
@@ -2633,8 +2545,6 @@ call7 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object 
arg2, Lisp_Object arg3,
   return CALLN (Ffuncall, fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
 }
 
-/* The caller should GCPRO all the elements of ARGS.  */
-
 DEFUN ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0,
        doc: /* Non-nil if OBJECT is a function.  */)
      (Lisp_Object object)
@@ -2669,10 +2579,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS)  */)
        error ("Lisp nesting exceeds `max-lisp-eval-depth'");
     }
 
-  /* This also GCPROs them.  */
   count = record_in_backtrace (args[0], &args[1], nargs - 1);
 
-  /* Call GC after setting up the backtrace, so the latter GCPROs the args.  */
   maybe_gc ();
 
   if (debug_on_next_call)
@@ -2808,28 +2716,21 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, 
ptrdiff_t count)
   Lisp_Object args_left;
   ptrdiff_t i;
   EMACS_INT numargs;
-  register Lisp_Object *arg_vector;
-  struct gcpro gcpro1, gcpro2, gcpro3;
-  register Lisp_Object tem;
+  Lisp_Object *arg_vector;
+  Lisp_Object tem;
   USE_SAFE_ALLOCA;
 
   numargs = XFASTINT (Flength (args));
   SAFE_ALLOCA_LISP (arg_vector, numargs);
   args_left = args;
 
-  GCPRO3 (*arg_vector, args_left, fun);
-  gcpro1.nvars = 0;
-
   for (i = 0; i < numargs; )
     {
       tem = Fcar (args_left), args_left = Fcdr (args_left);
       tem = eval_sub (tem);
       arg_vector[i++] = tem;
-      gcpro1.nvars = i;
     }
 
-  UNGCPRO;
-
   set_backtrace_args (specpdl + count, arg_vector, i);
   tem = funcall_lambda (fun, numargs, arg_vector);
 
@@ -3196,9 +3097,7 @@ Lisp_Object
 unbind_to (ptrdiff_t count, Lisp_Object value)
 {
   Lisp_Object quitf = Vquit_flag;
-  struct gcpro gcpro1, gcpro2;
 
-  GCPRO2 (value, quitf);
   Vquit_flag = Qnil;
 
   while (specpdl_ptr != specpdl + count)
@@ -3265,7 +3164,6 @@ unbind_to (ptrdiff_t count, Lisp_Object value)
   if (NILP (Vquit_flag) && !NILP (quitf))
     Vquit_flag = quitf;
 
-  UNGCPRO;
   return value;
 }
 
diff --git a/src/fileio.c b/src/fileio.c
index 905778e..debd1f3 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -867,11 +867,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
 #endif /* not DOS_NT */
        )
       {
-       struct gcpro gcpro1;
-
-       GCPRO1 (name);
        default_directory = Fexpand_file_name (default_directory, Qnil);
-       UNGCPRO;
       }
   }
   multibyte = STRING_MULTIBYTE (name);
@@ -1793,7 +1789,6 @@ barf_or_query_if_file_exists (Lisp_Object absname, bool 
known_to_exist,
 {
   Lisp_Object tem, encoded_filename;
   struct stat statbuf;
-  struct gcpro gcpro1;
 
   encoded_filename = ENCODE_FILE (absname);
 
@@ -1810,14 +1805,12 @@ barf_or_query_if_file_exists (Lisp_Object absname, bool 
known_to_exist,
       if (! interactive)
        xsignal2 (Qfile_already_exists,
                  build_string ("File already exists"), absname);
-      GCPRO1 (absname);
       AUTO_STRING (format, "File %s already exists; %s anyway? ");
       tem = CALLN (Fformat, format, absname, build_string (querystring));
       if (quick)
        tem = call1 (intern ("y-or-n-p"), tem);
       else
        tem = do_yes_or_no_p (tem);
-      UNGCPRO;
       if (NILP (tem))
        xsignal2 (Qfile_already_exists,
                  build_string ("File already exists"), absname);
@@ -1858,7 +1851,6 @@ permissions.  */)
    Lisp_Object preserve_permissions)
 {
   Lisp_Object handler;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object encoded_file, encoded_newname;
 #if HAVE_LIBSELINUX
@@ -1875,7 +1867,6 @@ permissions.  */)
 #endif
 
   encoded_file = encoded_newname = Qnil;
-  GCPRO4 (file, newname, encoded_file, encoded_newname);
   CHECK_STRING (file);
   CHECK_STRING (newname);
 
@@ -1893,9 +1884,9 @@ permissions.  */)
   if (NILP (handler))
     handler = Ffind_file_name_handler (newname, Qcopy_file);
   if (!NILP (handler))
-    RETURN_UNGCPRO (call7 (handler, Qcopy_file, file, newname,
-                          ok_if_already_exists, keep_time, preserve_uid_gid,
-                          preserve_permissions));
+    return call7 (handler, Qcopy_file, file, newname,
+                 ok_if_already_exists, keep_time, preserve_uid_gid,
+                 preserve_permissions);
 
   encoded_file = ENCODE_FILE (file);
   encoded_newname = ENCODE_FILE (newname);
@@ -2095,7 +2086,6 @@ permissions.  */)
   /* Discard the unwind protects.  */
   specpdl_ptr = specpdl + count;
 
-  UNGCPRO;
   return Qnil;
 }
 
@@ -2165,15 +2155,12 @@ With a prefix argument, TRASH is nil.  */)
 {
   Lisp_Object handler;
   Lisp_Object encoded_file;
-  struct gcpro gcpro1;
 
-  GCPRO1 (filename);
   if (!NILP (Ffile_directory_p (filename))
       && NILP (Ffile_symlink_p (filename)))
     xsignal2 (Qfile_error,
              build_string ("Removing old name: is a directory"),
              filename);
-  UNGCPRO;
   filename = Fexpand_file_name (filename, Qnil);
 
   handler = Ffind_file_name_handler (filename, Qdelete_file);
@@ -2220,11 +2207,9 @@ This is what happens in interactive use with M-x.  */)
   (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists)
 {
   Lisp_Object handler;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   Lisp_Object encoded_file, encoded_newname, symlink_target;
 
   symlink_target = encoded_file = encoded_newname = Qnil;
-  GCPRO5 (file, newname, encoded_file, encoded_newname, symlink_target);
   CHECK_STRING (file);
   CHECK_STRING (newname);
   file = Fexpand_file_name (file, Qnil);
@@ -2250,8 +2235,8 @@ This is what happens in interactive use with M-x.  */)
   if (NILP (handler))
     handler = Ffind_file_name_handler (newname, Qrename_file);
   if (!NILP (handler))
-    RETURN_UNGCPRO (call4 (handler, Qrename_file,
-                          file, newname, ok_if_already_exists));
+    return call4 (handler, Qrename_file,
+                 file, newname, ok_if_already_exists);
 
   encoded_file = ENCODE_FILE (file);
   encoded_newname = ENCODE_FILE (newname);
@@ -2297,7 +2282,7 @@ This is what happens in interactive use with M-x.  */)
       else
        report_file_errno ("Renaming", list2 (file, newname), rename_errno);
     }
-  UNGCPRO;
+
   return Qnil;
 }
 
@@ -2312,9 +2297,7 @@ This is what happens in interactive use with M-x.  */)
 {
   Lisp_Object handler;
   Lisp_Object encoded_file, encoded_newname;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
-  GCPRO4 (file, newname, encoded_file, encoded_newname);
   encoded_file = encoded_newname = Qnil;
   CHECK_STRING (file);
   CHECK_STRING (newname);
@@ -2329,15 +2312,15 @@ This is what happens in interactive use with M-x.  */)
      call the corresponding file handler.  */
   handler = Ffind_file_name_handler (file, Qadd_name_to_file);
   if (!NILP (handler))
-    RETURN_UNGCPRO (call4 (handler, Qadd_name_to_file, file,
-                          newname, ok_if_already_exists));
+    return call4 (handler, Qadd_name_to_file, file,
+                 newname, ok_if_already_exists);
 
   /* If the new name has special constructs in it,
      call the corresponding file handler.  */
   handler = Ffind_file_name_handler (newname, Qadd_name_to_file);
   if (!NILP (handler))
-    RETURN_UNGCPRO (call4 (handler, Qadd_name_to_file, file,
-                          newname, ok_if_already_exists));
+    return call4 (handler, Qadd_name_to_file, file,
+                 newname, ok_if_already_exists);
 
   encoded_file = ENCODE_FILE (file);
   encoded_newname = ENCODE_FILE (newname);
@@ -2354,7 +2337,6 @@ This is what happens in interactive use with M-x.  */)
       report_file_errno ("Adding new name", list2 (file, newname), link_errno);
     }
 
-  UNGCPRO;
   return Qnil;
 }
 
@@ -2370,9 +2352,7 @@ This happens for interactive use with M-x.  */)
 {
   Lisp_Object handler;
   Lisp_Object encoded_target, encoded_linkname;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
-  GCPRO4 (target, linkname, encoded_target, encoded_linkname);
   encoded_target = encoded_linkname = Qnil;
   CHECK_STRING (target);
   CHECK_STRING (linkname);
@@ -2391,15 +2371,15 @@ This happens for interactive use with M-x.  */)
      call the corresponding file handler.  */
   handler = Ffind_file_name_handler (target, Qmake_symbolic_link);
   if (!NILP (handler))
-    RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, target,
-                          linkname, ok_if_already_exists));
+    return call4 (handler, Qmake_symbolic_link, target,
+                 linkname, ok_if_already_exists);
 
   /* If the new link name has special constructs in it,
      call the corresponding file handler.  */
   handler = Ffind_file_name_handler (linkname, Qmake_symbolic_link);
   if (!NILP (handler))
-    RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, target,
-                          linkname, ok_if_already_exists));
+    return call4 (handler, Qmake_symbolic_link, target,
+                 linkname, ok_if_already_exists);
 
   encoded_target = ENCODE_FILE (target);
   encoded_linkname = ENCODE_FILE (linkname);
@@ -2417,23 +2397,17 @@ This happens for interactive use with M-x.  */)
          unlink (SSDATA (encoded_linkname));
          if (symlink (SSDATA (encoded_target), SSDATA (encoded_linkname))
              >= 0)
-           {
-             UNGCPRO;
-             return Qnil;
-           }
+           return Qnil;
        }
       if (errno == ENOSYS)
-       {
-         UNGCPRO;
-         xsignal1 (Qfile_error,
-                   build_string ("Symbolic links are not supported"));
-       }
+       xsignal1 (Qfile_error,
+                 build_string ("Symbolic links are not supported"));
 
       symlink_errno = errno;
       report_file_errno ("Making symbolic link", list2 (target, linkname),
                         symlink_errno);
     }
-  UNGCPRO;
+
   return Qnil;
 }
 
@@ -2681,7 +2655,11 @@ and the directory must allow you to open files in it.  
In order to use a
 directory as a buffer's current directory, this predicate must return true.
 A directory name spec may be given instead; then the value is t
 if the directory so specified exists and really is a readable and
-searchable directory.  */)
+searchable directory.
+
+The result might be a false positive on MS-Windows in some rare cases,
+i.e., this function could return t for a directory that is not
+accessible by the current user.  */)
   (Lisp_Object filename)
 {
   Lisp_Object absname;
@@ -3181,16 +3159,13 @@ otherwise, if FILE2 does not exist, the answer is t.  
*/)
   Lisp_Object absname1, absname2;
   struct stat st1, st2;
   Lisp_Object handler;
-  struct gcpro gcpro1, gcpro2;
 
   CHECK_STRING (file1);
   CHECK_STRING (file2);
 
   absname1 = Qnil;
-  GCPRO2 (absname1, file2);
   absname1 = expand_and_dir_to_file (file1, BVAR (current_buffer, directory));
   absname2 = expand_and_dir_to_file (file2, BVAR (current_buffer, directory));
-  UNGCPRO;
 
   /* If the file name has special constructs in it,
      call the corresponding file handler.  */
@@ -3200,10 +3175,8 @@ otherwise, if FILE2 does not exist, the answer is t.  */)
   if (!NILP (handler))
     return call3 (handler, Qfile_newer_than_file_p, absname1, absname2);
 
-  GCPRO2 (absname1, absname2);
   absname1 = ENCODE_FILE (absname1);
   absname2 = ENCODE_FILE (absname2);
-  UNGCPRO;
 
   if (stat (SSDATA (absname1), &st1) < 0)
     return Qnil;
@@ -3406,7 +3379,6 @@ by calling `format-decode', which see.  */)
   off_t beg_offset, end_offset;
   int unprocessed;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   Lisp_Object handler, val, insval, orig_filename, old_undo;
   Lisp_Object p;
   ptrdiff_t total = 0;
@@ -3446,8 +3418,6 @@ by calling `format-decode', which see.  */)
   orig_filename = Qnil;
   old_undo = Qnil;
 
-  GCPRO5 (filename, val, p, orig_filename, old_undo);
-
   CHECK_STRING (filename);
   filename = Fexpand_file_name (filename, Qnil);
 
@@ -3898,7 +3868,6 @@ by calling `format-decode', which see.  */)
       bool multibyte
        = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
       Lisp_Object conversion_buffer;
-      struct gcpro gcpro1;
 
       conversion_buffer = code_conversion_save (1, multibyte);
 
@@ -3911,7 +3880,6 @@ by calling `format-decode', which see.  */)
       inserted = 0;            /* Bytes put into CONVERSION_BUFFER so far.  */
       unprocessed = 0;         /* Bytes not processed in previous loop.  */
 
-      GCPRO1 (conversion_buffer);
       while (1)
        {
          /* Read at most READ_BUF_SIZE bytes at a time, to allow
@@ -3935,7 +3903,7 @@ by calling `format-decode', which see.  */)
          if (coding.carryover_bytes > 0)
            memcpy (read_buf, coding.carryover, unprocessed);
        }
-      UNGCPRO;
+
       if (this < 0)
        report_file_error ("Read error", orig_filename);
       emacs_close (fd);
@@ -4507,7 +4475,7 @@ by calling `format-decode', which see.  */)
   if (NILP (val))
     val = list2 (orig_filename, make_number (inserted));
 
-  RETURN_UNGCPRO (unbind_to (count, val));
+  return unbind_to (count, val);
 }
 
 static Lisp_Object build_annotations (Lisp_Object, Lisp_Object);
@@ -4694,7 +4662,6 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
   bool visiting = (EQ (visit, Qt) || STRINGP (visit));
   bool quietly = !NILP (visit);
   bool file_locked = 0;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   struct buffer *given_buffer;
   struct coding_system coding;
 
@@ -4705,7 +4672,6 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
     validate_region (&start, &end);
 
   visit_file = Qnil;
-  GCPRO5 (start, filename, visit, visit_file, lockname);
 
   filename = Fexpand_file_name (filename, Qnil);
 
@@ -4741,7 +4707,7 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
          XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
          bset_filename (current_buffer, visit_file);
        }
-      UNGCPRO;
+
       return val;
     }
 
@@ -4781,10 +4747,6 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
       XSETFASTINT (end, ZV);
     }
 
-  UNGCPRO;
-
-  GCPRO5 (start, filename, annotations, visit_file, lockname);
-
   /* Decide the coding-system to encode the data with.
      We used to make this choice before calling build_annotations, but that
      leads to problems when a write-annotate-function takes care of
@@ -4821,7 +4783,6 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
          int open_errno = errno;
          if (file_locked)
            unlock_file (lockname);
-         UNGCPRO;
          report_file_errno ("Opening output file", filename, open_errno);
        }
 
@@ -4837,13 +4798,10 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
          int lseek_errno = errno;
          if (file_locked)
            unlock_file (lockname);
-         UNGCPRO;
          report_file_errno ("Lseek error", filename, lseek_errno);
        }
     }
 
-  UNGCPRO;
-
   immediate_quit = 1;
 
   if (STRINGP (start))
@@ -5042,7 +5000,6 @@ build_annotations (Lisp_Object start, Lisp_Object end)
 {
   Lisp_Object annotations;
   Lisp_Object p, res;
-  struct gcpro gcpro1, gcpro2;
   Lisp_Object original_buffer;
   int i;
   bool used_global = false;
@@ -5051,7 +5008,6 @@ build_annotations (Lisp_Object start, Lisp_Object end)
 
   annotations = Qnil;
   p = Vwrite_region_annotate_functions;
-  GCPRO2 (annotations, p);
   while (CONSP (p))
     {
       struct buffer *given_buffer = current_buffer;
@@ -5111,7 +5067,6 @@ build_annotations (Lisp_Object start, Lisp_Object end)
        annotations = merge (annotations, res, Qcar_less_than_car);
     }
 
-  UNGCPRO;
   return annotations;
 }
 
@@ -5382,7 +5337,6 @@ auto_save_error (Lisp_Object error_val)
 {
   Lisp_Object msg;
   int i;
-  struct gcpro gcpro1;
 
   auto_save_error_occurred = 1;
 
@@ -5391,7 +5345,6 @@ auto_save_error (Lisp_Object error_val)
   AUTO_STRING (format, "Auto-saving %s: %s");
   msg = CALLN (Fformat, format, BVAR (current_buffer, name),
               Ferror_message_string (error_val));
-  GCPRO1 (msg);
 
   for (i = 0; i < 3; ++i)
     {
@@ -5402,7 +5355,6 @@ auto_save_error (Lisp_Object error_val)
       Fsleep_for (make_number (1), Qnil);
     }
 
-  UNGCPRO;
   return Qnil;
 }
 
@@ -5494,7 +5446,6 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
   bool orig_minibuffer_auto_raise = minibuffer_auto_raise;
   bool old_message_p = 0;
   struct auto_save_unwind auto_save_unwind;
-  struct gcpro gcpro1, gcpro2;
 
   if (max_specpdl_size < specpdl_size + 40)
     max_specpdl_size = specpdl_size + 40;
@@ -5513,9 +5464,6 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
   oquit = Vquit_flag;
   Vquit_flag = Qnil;
 
-  /* No GCPRO needed, because (when it matters) all Lisp_Object variables
-     point to non-strings reached from Vbuffer_alist.  */
-
   hook = intern ("auto-save-hook");
   safe_run_hooks (hook);
 
@@ -5531,14 +5479,11 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
       if (!NILP (Vrun_hooks))
        {
          Lisp_Object dir;
-         dir = Qnil;
-         GCPRO2 (dir, listfile);
          dir = Ffile_name_directory (listfile);
          if (NILP (Ffile_directory_p (dir)))
            internal_condition_case_1 (do_auto_save_make_dir,
                                       dir, Qt,
                                       do_auto_save_eh);
-         UNGCPRO;
        }
 
       stream = emacs_fopen (SSDATA (listfile), "w");
diff --git a/src/filelock.c b/src/filelock.c
index 4ee7a01..cad6f83 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -666,7 +666,6 @@ lock_file (Lisp_Object fn)
   Lisp_Object orig_fn, encoded_fn;
   char *lfname;
   lock_info_type lock_info;
-  struct gcpro gcpro1;
   USE_SAFE_ALLOCA;
 
   /* Don't do locking while dumping Emacs.
@@ -676,7 +675,6 @@ lock_file (Lisp_Object fn)
     return;
 
   orig_fn = fn;
-  GCPRO1 (fn);
   fn = Fexpand_file_name (fn, Qnil);
 #ifdef WINDOWSNT
   /* Ensure we have only '/' separators, to avoid problems with
@@ -727,8 +725,6 @@ lock_file (Lisp_Object fn)
        }
       SAFE_FREE ();
     }
-
-  UNGCPRO;
 }
 
 void
diff --git a/src/floatfns.c b/src/floatfns.c
index 072e857..63d35b8 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -377,32 +377,22 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
   return arg;
 }
 
-/* With C's /, the result is implementation-defined if either operand
-   is negative, so take care with negative operands in the following
-   integer functions.  */
-
 static EMACS_INT
 ceiling2 (EMACS_INT i1, EMACS_INT i2)
 {
-  return (i2 < 0
-         ? (i1 < 0  ?  ((-1 - i1) / -i2) + 1  :  - (i1 / -i2))
-         : (i1 <= 0  ?  - (-i1 / i2)  :  ((i1 - 1) / i2) + 1));
+  return i1 / i2 + ((i1 % i2 != 0) & ((i1 < 0) == (i2 < 0)));
 }
 
 static EMACS_INT
 floor2 (EMACS_INT i1, EMACS_INT i2)
 {
-  return (i2 < 0
-         ? (i1 <= 0  ?  -i1 / -i2  :  -1 - ((i1 - 1) / -i2))
-         : (i1 < 0  ?  -1 - ((-1 - i1) / i2)  :  i1 / i2));
+  return i1 / i2 - ((i1 % i2 != 0) & ((i1 < 0) != (i2 < 0)));
 }
 
 static EMACS_INT
 truncate2 (EMACS_INT i1, EMACS_INT i2)
 {
-  return (i2 < 0
-         ? (i1 < 0  ?  -i1 / -i2  :  - (i1 / -i2))
-         : (i1 < 0  ?  - (-i1 / i2)  :  i1 / i2));
+  return i1 / i2;
 }
 
 static EMACS_INT
diff --git a/src/fns.c b/src/fns.c
index cef2823..26a98ab 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1863,8 +1863,7 @@ static Lisp_Object
 sort_list (Lisp_Object list, Lisp_Object predicate)
 {
   Lisp_Object front, back;
-  register Lisp_Object len, tem;
-  struct gcpro gcpro1, gcpro2;
+  Lisp_Object len, tem;
   EMACS_INT length;
 
   front = list;
@@ -1878,10 +1877,8 @@ sort_list (Lisp_Object list, Lisp_Object predicate)
   back = Fcdr (tem);
   Fsetcdr (tem, Qnil);
 
-  GCPRO2 (front, back);
   front = Fsort (front, predicate);
   back = Fsort (back, predicate);
-  UNGCPRO;
   return merge (front, back, predicate);
 }
 
@@ -1977,15 +1974,12 @@ sort_vector (Lisp_Object vector, Lisp_Object predicate)
     return;
   ptrdiff_t halflen = len >> 1;
   Lisp_Object *tmp;
-  struct gcpro gcpro1, gcpro2;
-  GCPRO2 (vector, predicate);
   USE_SAFE_ALLOCA;
   SAFE_ALLOCA_LISP (tmp, halflen);
   for (ptrdiff_t i = 0; i < halflen; i++)
     tmp[i] = make_number (0);
   sort_vector_inplace (predicate, len, XVECTOR (vector)->contents, tmp);
   SAFE_FREE ();
-  UNGCPRO;
 }
 
 DEFUN ("sort", Fsort, Ssort, 2, 2, 0,
@@ -2008,27 +2002,15 @@ the second.  */)
 Lisp_Object
 merge (Lisp_Object org_l1, Lisp_Object org_l2, Lisp_Object pred)
 {
-  Lisp_Object value;
-  register Lisp_Object tail;
-  Lisp_Object tem;
-  register Lisp_Object l1, l2;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
-
-  l1 = org_l1;
-  l2 = org_l2;
-  tail = Qnil;
-  value = Qnil;
-
-  /* It is sufficient to protect org_l1 and org_l2.
-     When l1 and l2 are updated, we copy the new values
-     back into the org_ vars.  */
-  GCPRO4 (org_l1, org_l2, pred, value);
+  Lisp_Object l1 = org_l1;
+  Lisp_Object l2 = org_l2;
+  Lisp_Object tail = Qnil;
+  Lisp_Object value = Qnil;
 
   while (1)
     {
       if (NILP (l1))
        {
-         UNGCPRO;
          if (NILP (tail))
            return l2;
          Fsetcdr (tail, l2);
@@ -2036,12 +2018,13 @@ merge (Lisp_Object org_l1, Lisp_Object org_l2, 
Lisp_Object pred)
        }
       if (NILP (l2))
        {
-         UNGCPRO;
          if (NILP (tail))
            return l1;
          Fsetcdr (tail, l1);
          return value;
        }
+
+      Lisp_Object tem;
       if (inorder (pred, Fcar (l1), Fcar (l2)))
        {
          tem = l1;
@@ -2504,22 +2487,6 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object 
fn, Lisp_Object seq)
 {
   Lisp_Object tail, dummy;
   EMACS_INT i;
-  struct gcpro gcpro1, gcpro2, gcpro3;
-
-  if (vals)
-    {
-      /* Don't let vals contain any garbage when GC happens.  */
-      memclear (vals, leni * word_size);
-
-      GCPRO3 (dummy, fn, seq);
-      gcpro1.var = vals;
-      gcpro1.nvars = leni;
-    }
-  else
-    GCPRO2 (fn, seq);
-  /* We need not explicitly protect `tail' because it is used only on lists, 
and
-    1) lists are not relocated and 2) the list is marked via `seq' so will not
-    be freed */
 
   if (VECTORP (seq) || COMPILEDP (seq))
     {
@@ -2566,8 +2533,6 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object 
fn, Lisp_Object seq)
          tail = XCDR (tail);
        }
     }
-
-  UNGCPRO;
 }
 
 DEFUN ("mapconcat", Fmapconcat, Smapconcat, 3, 3, 0,
@@ -2578,11 +2543,10 @@ SEQUENCE may be a list, a vector, a bool-vector, or a 
string.  */)
   (Lisp_Object function, Lisp_Object sequence, Lisp_Object separator)
 {
   Lisp_Object len;
-  register EMACS_INT leni;
+  EMACS_INT leni;
   EMACS_INT nargs;
   ptrdiff_t i;
-  register Lisp_Object *args;
-  struct gcpro gcpro1;
+  Lisp_Object *args;
   Lisp_Object ret;
   USE_SAFE_ALLOCA;
 
@@ -2595,9 +2559,7 @@ SEQUENCE may be a list, a vector, a bool-vector, or a 
string.  */)
 
   SAFE_ALLOCA_LISP (args, nargs);
 
-  GCPRO1 (separator);
   mapcar1 (leni, args, function, sequence);
-  UNGCPRO;
 
   for (i = leni - 1; i > 0; i--)
     args[i + i] = args[i];
@@ -2655,9 +2617,7 @@ SEQUENCE may be a list, a vector, a bool-vector, or a 
string.  */)
 }
 
 /* This is how C code calls `yes-or-no-p' and allows the user
-   to redefined it.
-
-   Anything that calls this function must protect from GC!  */
+   to redefine it.  */
 
 Lisp_Object
 do_yes_or_no_p (Lisp_Object prompt)
@@ -2665,8 +2625,6 @@ do_yes_or_no_p (Lisp_Object prompt)
   return call1 (intern ("yes-or-no-p"), prompt);
 }
 
-/* Anything that calls this function must protect from GC!  */
-
 DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
        doc: /* Ask user a yes-or-no question.
 Return t if answer is yes, and nil if the answer is no.
@@ -2681,7 +2639,6 @@ if `last-nonmenu-event' is nil, and `use-dialog-box' is 
non-nil.  */)
   (Lisp_Object prompt)
 {
   Lisp_Object ans;
-  struct gcpro gcpro1;
 
   CHECK_STRING (prompt);
 
@@ -2692,16 +2649,13 @@ if `last-nonmenu-event' is nil, and `use-dialog-box' is 
non-nil.  */)
       redisplay_preserve_echo_area (4);
       pane = list2 (Fcons (build_string ("Yes"), Qt),
                    Fcons (build_string ("No"), Qnil));
-      GCPRO1 (pane);
       menu = Fcons (prompt, pane);
       obj = Fx_popup_dialog (Qt, menu, Qnil);
-      UNGCPRO;
       return obj;
     }
 
   AUTO_STRING (yes_or_no, "(yes or no) ");
   prompt = CALLN (Fconcat, prompt, yes_or_no);
-  GCPRO1 (prompt);
 
   while (1)
     {
@@ -2709,15 +2663,9 @@ if `last-nonmenu-event' is nil, and `use-dialog-box' is 
non-nil.  */)
                                              Qyes_or_no_p_history, Qnil,
                                              Qnil));
       if (SCHARS (ans) == 3 && !strcmp (SSDATA (ans), "yes"))
-       {
-         UNGCPRO;
-         return Qt;
-       }
+       return Qt;
       if (SCHARS (ans) == 2 && !strcmp (SSDATA (ans), "no"))
-       {
-         UNGCPRO;
-         return Qnil;
-       }
+       return Qnil;
 
       Fding (Qnil);
       Fdiscard_input ();
@@ -2834,7 +2782,6 @@ The normal messages at start and end of loading FILENAME 
are suppressed.  */)
   (Lisp_Object feature, Lisp_Object filename, Lisp_Object noerror)
 {
   Lisp_Object tem;
-  struct gcpro gcpro1, gcpro2;
   bool from_file = load_in_progress;
 
   CHECK_SYMBOL (feature);
@@ -2890,10 +2837,8 @@ The normal messages at start and end of loading FILENAME 
are suppressed.  */)
       Vautoload_queue = Qt;
 
       /* Load the file.  */
-      GCPRO2 (feature, filename);
       tem = Fload (NILP (filename) ? Fsymbol_name (feature) : filename,
                   noerror, Qt, Qnil, (NILP (filename) ? Qt : Qnil));
-      UNGCPRO;
 
       /* If load failed entirely, return nil.  */
       if (NILP (tem))
@@ -2979,15 +2924,11 @@ ARGS are passed as extra arguments to the function.
 usage: (widget-apply WIDGET PROPERTY &rest ARGS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
-  /* This function can GC.  */
-  struct gcpro gcpro1, gcpro2;
   Lisp_Object widget = args[0];
   Lisp_Object property = args[1];
   Lisp_Object propval = Fwidget_get (widget, property);
   Lisp_Object trailing_args = Flist (nargs - 2, args + 2);
-  GCPRO2 (propval, trailing_args);
   Lisp_Object result = CALLN (Fapply, propval, widget, trailing_args);
-  UNGCPRO;
   return result;
 }
 
@@ -3030,8 +2971,6 @@ The data read from the system are decoded using 
`locale-coding-system'.  */)
       Lisp_Object v = Fmake_vector (make_number (7), Qnil);
       const int days[7] = {DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7};
       int i;
-      struct gcpro gcpro1;
-      GCPRO1 (v);
       synchronize_system_time_locale ();
       for (i = 0; i < 7; i++)
        {
@@ -3042,7 +2981,6 @@ The data read from the system are decoded using 
`locale-coding-system'.  */)
          ASET (v, i, code_convert_string_norecord (val, Vlocale_coding_system,
                                                    0));
        }
-      UNGCPRO;
       return v;
     }
 #endif /* DAY_1 */
@@ -3053,8 +2991,6 @@ The data read from the system are decoded using 
`locale-coding-system'.  */)
       const int months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7,
                              MON_8, MON_9, MON_10, MON_11, MON_12};
       int i;
-      struct gcpro gcpro1;
-      GCPRO1 (v);
       synchronize_system_time_locale ();
       for (i = 0; i < 12; i++)
        {
@@ -3063,7 +2999,6 @@ The data read from the system are decoded using 
`locale-coding-system'.  */)
          ASET (v, i, code_convert_string_norecord (val, Vlocale_coding_system,
                                                    0));
        }
-      UNGCPRO;
       return v;
     }
 #endif /* MON_1 */
@@ -4015,7 +3950,6 @@ hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, 
EMACS_UINT *hash)
   start_of_bucket = hash_code % ASIZE (h->index);
   idx = HASH_INDEX (h, start_of_bucket);
 
-  /* We need not gcpro idx since it's either an integer or nil.  */
   while (!NILP (idx))
     {
       ptrdiff_t i = XFASTINT (idx);
@@ -4079,7 +4013,6 @@ hash_remove_from_table (struct Lisp_Hash_Table *h, 
Lisp_Object key)
   idx = HASH_INDEX (h, start_of_bucket);
   prev = Qnil;
 
-  /* We need not gcpro idx, prev since they're either integers or nil.  */
   while (!NILP (idx))
     {
       ptrdiff_t i = XFASTINT (idx);
diff --git a/src/frame.c b/src/frame.c
index 9e69598..d3e4780 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -611,10 +611,10 @@ struct frame *
 make_frame (bool mini_p)
 {
   Lisp_Object frame;
-  register struct frame *f;
-  register struct window *rw, *mw;
-  register Lisp_Object root_window;
-  register Lisp_Object mini_window;
+  struct frame *f;
+  struct window *rw, *mw IF_LINT (= NULL);
+  Lisp_Object root_window;
+  Lisp_Object mini_window;
 
   f = allocate_frame ();
   XSETFRAME (frame, f);
@@ -735,10 +735,10 @@ make_frame (bool mini_p)
    default (the global minibuffer).  */
 
 struct frame *
-make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, 
Lisp_Object display)
+make_frame_without_minibuffer (Lisp_Object mini_window, KBOARD *kb,
+                              Lisp_Object display)
 {
-  register struct frame *f;
-  struct gcpro gcpro1;
+  struct frame *f;
 
   if (!NILP (mini_window))
     CHECK_LIVE_WINDOW (mini_window);
@@ -759,11 +759,9 @@ make_frame_without_minibuffer (register Lisp_Object 
mini_window, KBOARD *kb, Lis
           Lisp_Object frame_dummy;
 
           XSETFRAME (frame_dummy, f);
-          GCPRO1 (frame_dummy);
          /* If there's no minibuffer frame to use, create one.  */
          kset_default_minibuffer_frame
            (kb, call1 (intern ("make-initial-minibuffer-frame"), display));
-          UNGCPRO;
        }
 
       mini_window
@@ -1855,7 +1853,6 @@ and returns whatever that function returns.  */)
   struct frame *f;
   Lisp_Object lispy_dummy;
   Lisp_Object x, y, retval;
-  struct gcpro gcpro1;
 
   f = SELECTED_FRAME ();
   x = y = Qnil;
@@ -1881,10 +1878,9 @@ and returns whatever that function returns.  */)
     }
   XSETFRAME (lispy_dummy, f);
   retval = Fcons (lispy_dummy, Fcons (x, y));
-  GCPRO1 (retval);
   if (!NILP (Vmouse_position_function))
     retval = call1 (Vmouse_position_function, retval);
-  RETURN_UNGCPRO (retval);
+  return retval;
 }
 
 DEFUN ("mouse-pixel-position", Fmouse_pixel_position,
@@ -1901,7 +1897,6 @@ and nil for X and Y.  */)
   struct frame *f;
   Lisp_Object lispy_dummy;
   Lisp_Object x, y, retval;
-  struct gcpro gcpro1;
 
   f = SELECTED_FRAME ();
   x = y = Qnil;
@@ -1919,10 +1914,9 @@ and nil for X and Y.  */)
 
   XSETFRAME (lispy_dummy, f);
   retval = Fcons (lispy_dummy, Fcons (x, y));
-  GCPRO1 (retval);
   if (!NILP (Vmouse_position_function))
     retval = call1 (Vmouse_position_function, retval);
-  RETURN_UNGCPRO (retval);
+  return retval;
 }
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -2510,13 +2504,11 @@ If FRAME is omitted or nil, return information on the 
currently selected frame.
   Lisp_Object alist;
   struct frame *f = decode_any_frame (frame);
   int height, width;
-  struct gcpro gcpro1;
 
   if (!FRAME_LIVE_P (f))
     return Qnil;
 
   alist = Fcopy_alist (f->param_alist);
-  GCPRO1 (alist);
 
   if (!FRAME_WINDOW_P (f))
     {
@@ -2586,7 +2578,6 @@ If FRAME is omitted or nil, return information on the 
currently selected frame.
       store_in_alist (&alist, Qmenu_bar_lines, lines);
     }
 
-  UNGCPRO;
   return alist;
 }
 
@@ -2977,24 +2968,40 @@ font height.  */)
   return Qnil;
 }
 
+DEFUN ("frame-position", Fframe_position,
+       Sframe_position, 0, 1, 0,
+       doc: /* Return top left corner of FRAME in pixels.
+FRAME must be a live frame and defaults to the selected one.  The return
+value is a cons (x, y) of the coordinates of the top left corner of
+FRAME's outer frame, in pixels relative to an origin (0, 0) of FRAME's
+display.  */)
+     (Lisp_Object frame)
+{
+  register struct frame *f = decode_live_frame (frame);
+
+  return Fcons (make_number (f->left_pos), make_number (f->top_pos));
+}
+
 DEFUN ("set-frame-position", Fset_frame_position,
        Sset_frame_position, 3, 3, 0,
-       doc: /* Sets position of FRAME in pixels to XOFFSET by YOFFSET.
-If FRAME is nil, the selected frame is used.  XOFFSET and YOFFSET are
-actually the position of the upper left corner of the frame.  Negative
-values for XOFFSET or YOFFSET are interpreted relative to the rightmost
-or bottommost possible position (that stays within the screen).  */)
-  (Lisp_Object frame, Lisp_Object xoffset, Lisp_Object yoffset)
+       doc: /* Set position of FRAME to (X, Y).
+FRAME must be a live frame and defaults to the selected one.  X and Y,
+if positive, specify the coordinate of the left and top edge of FRAME's
+outer frame in pixels relative to an origin (0, 0) of FRAME's display.
+If any of X or Y is negative, it specifies the coordinates of the right
+or bottom edge of the outer frame of FRAME relative to the right or
+bottom edge of FRAME's display.  */)
+  (Lisp_Object frame, Lisp_Object x, Lisp_Object y)
 {
   register struct frame *f = decode_live_frame (frame);
 
-  CHECK_TYPE_RANGED_INTEGER (int, xoffset);
-  CHECK_TYPE_RANGED_INTEGER (int, yoffset);
+  CHECK_TYPE_RANGED_INTEGER (int, x);
+  CHECK_TYPE_RANGED_INTEGER (int, y);
 
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (f))
-    x_set_offset (f, XINT (xoffset), XINT (yoffset), 1);
+    x_set_offset (f, XINT (x), XINT (y), 1);
 #endif
 
   return Qt;
@@ -3119,8 +3126,6 @@ x_set_frame_parameters (struct frame *f, Lisp_Object 
alist)
   /* TAIL and ALIST are not used again below here.  */
   alist = tail = Qnil;
 
-  /* There is no need to gcpro LEFT, TOP, ICON_LEFT, or ICON_TOP,
-     because their values appear in VALUES and strings are not valid.  */
   top = left = Qunbound;
   icon_left = icon_top = Qunbound;
 
@@ -4890,15 +4895,17 @@ syms_of_frame (void)
   DEFSYM (Qframes, "frames");
   DEFSYM (Qsource, "source");
 
-  DEFSYM (Qframe_position, "frame-position");
-  DEFSYM (Qframe_outer_size, "frame-outer-size");
+  DEFSYM (Qouter_edges, "outer-edges");
+  DEFSYM (Qouter_position, "outer-position");
+  DEFSYM (Qouter_size, "outer-size");
+  DEFSYM (Qnative_edges, "native-edges");
+  DEFSYM (Qinner_edges, "inner-edges");
   DEFSYM (Qexternal_border_size, "external-border-size");
-  DEFSYM (Qtitle_height, "title-height");
+  DEFSYM (Qtitle_bar_size, "title-bar-size");
   DEFSYM (Qmenu_bar_external, "menu-bar-external");
   DEFSYM (Qmenu_bar_size, "menu-bar-size");
   DEFSYM (Qtool_bar_external, "tool-bar-external");
   DEFSYM (Qtool_bar_size, "tool-bar-size");
-  DEFSYM (Qframe_inner_size, "frame-inner-size");
   /* The following are used for frame_size_history.  */
   DEFSYM (Qadjust_frame_size_1, "adjust-frame-size-1");
   DEFSYM (Qadjust_frame_size_2, "adjust-frame-size-2");
@@ -5263,6 +5270,7 @@ in a more readable form.  */);
   defsubr (&Sset_frame_height);
   defsubr (&Sset_frame_width);
   defsubr (&Sset_frame_size);
+  defsubr (&Sframe_position);
   defsubr (&Sset_frame_position);
   defsubr (&Sframe_pointer_visible_p);
 
diff --git a/src/gfilenotify.c b/src/gfilenotify.c
index 08713a8..5c6ebe6 100644
--- a/src/gfilenotify.c
+++ b/src/gfilenotify.c
@@ -119,9 +119,9 @@ watched for some reason, this function signals a 
`file-notify-error' error.
 FLAGS is a list of conditions to set what will be watched for.  It can
 include the following symbols:
 
-  'watch-mounts' -- watch for mount events
-  'send-moved'   -- pair 'deleted' and 'created' events caused by file
-                    renames and send a single 'renamed' event instead
+  `watch-mounts' -- watch for mount events
+  `send-moved'   -- pair `deleted' and `created' events caused by file
+                    renames and send a single `renamed' event instead
 
 When any event happens, Emacs will call the CALLBACK function passing
 it a single argument EVENT, which is of the form
@@ -132,24 +132,25 @@ DESCRIPTOR is the same object as the one returned by this 
function.
 ACTION is the description of the event.  It could be any one of the
 following:
 
-  'changed'           -- FILE has changed
-  'changes-done-hint' -- a hint that this was probably the last change
+  `changed'           -- FILE has changed
+  `changes-done-hint' -- a hint that this was probably the last change
                          in a set of changes
-  'deleted'           -- FILE was deleted
-  'created'           -- FILE was created
-  'attribute-changed' -- a FILE attribute was changed
-  'pre-unmount'       -- the FILE location will soon be unmounted
-  'unmounted'         -- the FILE location was unmounted
-  'moved'             -- FILE was moved to FILE1
+  `deleted'           -- FILE was deleted
+  `created'           -- FILE was created
+  `attribute-changed' -- a FILE attribute was changed
+  `pre-unmount'       -- the FILE location will soon be unmounted
+  `unmounted'         -- the FILE location was unmounted
+  `moved'             -- FILE was moved to FILE1
 
 FILE is the name of the file whose event is being reported.  FILE1
-will be reported only in case of the 'moved' event.  */)
+will be reported only in case of the `moved' event.  */)
   (Lisp_Object file, Lisp_Object flags, Lisp_Object callback)
 {
   Lisp_Object watch_object;
   GFile *gfile;
   GFileMonitor *monitor;
   GFileMonitorFlags gflags = G_FILE_MONITOR_NONE;
+  GError *gerror = NULL;
 
   /* Check parameters.  */
   CHECK_STRING (file);
@@ -172,7 +173,14 @@ will be reported only in case of the 'moved' event.  */)
     gflags |= G_FILE_MONITOR_SEND_MOVED;
 
   /* Enable watch.  */
-  monitor = g_file_monitor (gfile, gflags, NULL, NULL);
+  monitor = g_file_monitor (gfile, gflags, NULL, &gerror);
+  if (gerror)
+    {
+      char msg[1024];
+      strcpy (msg, gerror->message);
+      g_error_free (gerror);
+      xsignal1 (Qfile_notify_error, build_string (msg));
+    }
   if (! monitor)
     xsignal2 (Qfile_notify_error, build_string ("Cannot watch file"), file);
 
diff --git a/src/gtkutil.c b/src/gtkutil.c
index a4b4331..89647ee 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -382,10 +382,11 @@ xg_get_image_for_pixmap (struct frame *f,
   if (STRINGP (specified_file)
       && STRINGP (file = x_find_image_file (specified_file)))
     {
+      char *encoded_file = SSDATA (ENCODE_FILE (file));
       if (! old_widget)
-        old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file)));
+        old_widget = GTK_IMAGE (gtk_image_new_from_file (encoded_file));
       else
-        gtk_image_set_from_file (old_widget, SSDATA (file));
+        gtk_image_set_from_file (old_widget, encoded_file);
 
       return GTK_WIDGET (old_widget);
     }
@@ -1374,7 +1375,9 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool 
user_position)
 
   XSETFRAME (frame, f);
   fs_state = Fframe_parameter (frame, Qfullscreen);
-  if (EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth))
+  if ((EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth)) &&
+      (x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_wm_state) ||
+       x_wm_supports (f, FRAME_DISPLAY_INFO 
(f)->Xatom_net_wm_state_fullscreen)))
     {
       /* Don't set hints when maximized or fullscreen.  Apparently KWin and
          Gtk3 don't get along and the frame shrinks (!).
@@ -1925,9 +1928,7 @@ xg_get_file_with_chooser (struct frame *f,
   if (default_filename)
     {
       Lisp_Object file;
-      struct gcpro gcpro1;
       char *utf8_filename;
-      GCPRO1 (file);
 
       file = build_string (default_filename);
 
@@ -1952,8 +1953,6 @@ xg_get_file_with_chooser (struct frame *f,
               gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filewin), 
cp);
             }
         }
-
-      UNGCPRO;
     }
 
   *func = xg_get_file_name_from_chooser;
@@ -4456,8 +4455,6 @@ find_rtl_image (struct frame *f, Lisp_Object image, 
Lisp_Object rtl)
 {
   int i;
   Lisp_Object file, rtl_name;
-  struct gcpro gcpro1, gcpro2;
-  GCPRO2 (file, rtl_name);
 
   rtl_name = Ffile_name_nondirectory (rtl);
 
diff --git a/src/image.c b/src/image.c
index 066db74..743d230 100644
--- a/src/image.c
+++ b/src/image.c
@@ -629,18 +629,26 @@ valid_image_p (Lisp_Object object)
 }
 
 
-/* Log error message with format string FORMAT and argument ARG.
+/* Log error message with format string FORMAT and trailing arguments.
    Signaling an error, e.g. when an image cannot be loaded, is not a
    good idea because this would interrupt redisplay, and the error
    message display would lead to another redisplay.  This function
    therefore simply displays a message.  */
 
 static void
-image_error (const char *format, Lisp_Object arg1, Lisp_Object arg2)
+image_error (const char *format, ...)
 {
-  add_to_log (format, arg1, arg2);
+  va_list ap;
+  va_start (ap, format);
+  vadd_to_log (format, ap);
+  va_end (ap);
 }
 
+static void
+image_size_error (void)
+{
+  image_error ("Invalid image size (see `%s')", "max-image-size");
+}
 
 
 /***********************************************************************
@@ -1954,7 +1962,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, 
int height, int depth,
                        depth > 16 ? 32 : depth > 8 ? 16 : 8, 0);
   if (*ximg == NULL)
     {
-      image_error ("Unable to allocate X image", Qnil, Qnil);
+      image_error ("Unable to allocate X image");
       return 0;
     }
 
@@ -1976,7 +1984,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, 
int height, int depth,
     {
       x_destroy_x_image (*ximg);
       *ximg = NULL;
-      image_error ("Unable to create X pixmap", Qnil, Qnil);
+      image_error ("Unable to create X pixmap");
       return 0;
     }
 
@@ -1997,7 +2005,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, 
int height, int depth,
   if (depth != 1 && depth != 4 && depth != 8
       && depth != 16 && depth != 24 && depth != 32)
     {
-      image_error ("Invalid image bit depth specified", Qnil, Qnil);
+      image_error ("Invalid image bit depth specified");
       return 0;
     }
 
@@ -2055,7 +2063,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, 
int height, int depth,
       Lisp_Object errcode;
       /* All system errors are < 10000, so the following is safe.  */
       XSETINT (errcode, err);
-      image_error ("Unable to create bitmap, error code %d", errcode, Qnil);
+      image_error ("Unable to create bitmap, error code %d", errcode);
       x_destroy_x_image (*ximg);
       *ximg = NULL;
       return 0;
@@ -2070,7 +2078,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, 
int height, int depth,
   if (*pixmap == 0)
     {
       *ximg = NULL;
-      image_error ("Unable to allocate NSImage for XPM pixmap", Qnil, Qnil);
+      image_error ("Unable to allocate NSImage for XPM pixmap");
       return 0;
     }
   *ximg = *pixmap;
@@ -2267,11 +2275,13 @@ image_unget_x_image (struct image *img, bool mask_p, 
XImagePtr ximg)
  ***********************************************************************/
 
 /* Find image file FILE.  Look in data-directory/images, then
-   x-bitmap-file-path.  Value is the encoded full name of the file
-   found, or nil if not found.  */
+   x-bitmap-file-path.  Value is the full name of the file
+   found, or nil if not found.  If PFD is nonnull store into *PFD a
+   readable file descriptor for the file, opened in binary mode.  If
+   PFD is null, do not open the file.  */
 
-Lisp_Object
-x_find_image_file (Lisp_Object file)
+static Lisp_Object
+x_find_image_fd (Lisp_Object file, int *pfd)
 {
   Lisp_Object file_found, search_path;
   int fd;
@@ -2283,29 +2293,35 @@ x_find_image_file (Lisp_Object file)
                       Vx_bitmap_file_path);
 
   /* Try to find FILE in data-directory/images, then x-bitmap-file-path.  */
-  fd = openp (search_path, file, Qnil, &file_found, Qnil, false);
-
-  if (fd == -1)
-    file_found = Qnil;
-  else
-    {
-      file_found = ENCODE_FILE (file_found);
-      if (fd != -2)
-       emacs_close (fd);
-    }
-
+  fd = openp (search_path, file, Qnil, &file_found,
+             pfd ? Qt : make_number (R_OK), false);
+  if (fd < 0)
+    return Qnil;
+  if (pfd)
+    *pfd = fd;
   return file_found;
 }
 
+/* Find image file FILE.  Look in data-directory/images, then
+   x-bitmap-file-path.  Value is the encoded full name of the file
+   found, or nil if not found.  */
+
+Lisp_Object
+x_find_image_file (Lisp_Object file)
+{
+  return x_find_image_fd (file, 0);
+}
 
 /* Read FILE into memory.  Value is a pointer to a buffer allocated
    with xmalloc holding FILE's contents.  Value is null if an error
-   occurred.  *SIZE is set to the size of the file.  */
+   occurred.  FD is a file descriptor open for reading FILE.  Set
+   *SIZE to the size of the file.  */
 
 static unsigned char *
-slurp_file (char *file, ptrdiff_t *size)
+slurp_file (int fd, ptrdiff_t *size)
 {
-  FILE *fp = emacs_fopen (file, "rb");
+  FILE *fp = fdopen (fd, "rb");
+
   unsigned char *buf = NULL;
   struct stat st;
 
@@ -2791,7 +2807,7 @@ xbm_read_bitmap_data (struct frame *f, unsigned char 
*contents, unsigned char *e
   if (!check_image_size (f, *width, *height))
     {
       if (!inhibit_image_error)
-       image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+       image_size_error ();
       goto failure;
     }
   else if (data == NULL)
@@ -2936,13 +2952,13 @@ xbm_load_image (struct frame *f, struct image *img, 
unsigned char *contents,
       if (img->pixmap == NO_PIXMAP)
        {
          x_clear_image (f, img);
-         image_error ("Unable to create X pixmap for `%s'", img->spec, Qnil);
+         image_error ("Unable to create X pixmap for `%s'", img->spec);
        }
       else
        success_p = 1;
     }
   else
-    image_error ("Error loading XBM image `%s'", img->spec, Qnil);
+    image_error ("Error loading XBM image `%s'", img->spec);
 
   return success_p;
 }
@@ -2976,21 +2992,19 @@ xbm_load (struct frame *f, struct image *img)
   file_name = image_spec_value (img->spec, QCfile, NULL);
   if (STRINGP (file_name))
     {
-      Lisp_Object file;
-      unsigned char *contents;
-      ptrdiff_t size;
-
-      file = x_find_image_file (file_name);
+      int fd;
+      Lisp_Object file = x_find_image_fd (file_name, &fd);
       if (!STRINGP (file))
        {
-         image_error ("Cannot find image file `%s'", file_name, Qnil);
+         image_error ("Cannot find image file `%s'", file_name);
          return 0;
        }
 
-      contents = slurp_file (SSDATA (file), &size);
+      ptrdiff_t size;
+      unsigned char *contents = slurp_file (fd, &size);
       if (contents == NULL)
        {
-         image_error ("Error loading XBM image `%s'", img->spec, Qnil);
+         image_error ("Error loading XBM image `%s'", file);
          return 0;
        }
 
@@ -3025,8 +3039,7 @@ xbm_load (struct frame *f, struct image *img)
          eassert (img->width > 0 && img->height > 0);
          if (!check_image_size (f, img->width, img->height))
            {
-             image_error ("Invalid image size (see `max-image-size')",
-                          Qnil, Qnil);
+             image_size_error ();
              return 0;
            }
        }
@@ -3104,7 +3117,7 @@ xbm_load (struct frame *f, struct image *img)
          else
            {
              image_error ("Unable to create pixmap for XBM image `%s'",
-                          img->spec, Qnil);
+                          img->spec);
              x_clear_image (f, img);
            }
 
@@ -3626,7 +3639,7 @@ xpm_load (struct frame *f, struct image *img)
       Lisp_Object file = x_find_image_file (specified_file);
       if (!STRINGP (file))
        {
-         image_error ("Cannot find image file `%s'", specified_file, Qnil);
+         image_error ("Cannot find image file `%s'", specified_file);
 #ifdef ALLOC_XPM_COLORS
          xpm_free_color_cache ();
 #endif
@@ -3634,6 +3647,7 @@ xpm_load (struct frame *f, struct image *img)
          return 0;
        }
 
+      file = ENCODE_FILE (file);
 #ifdef HAVE_NTGUI
 #ifdef WINDOWSNT
       /* FILE is encoded in UTF-8, but image libraries on Windows
@@ -3657,7 +3671,7 @@ xpm_load (struct frame *f, struct image *img)
       Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL);
       if (!STRINGP (buffer))
        {
-         image_error ("Invalid image data `%s'", buffer, Qnil);
+         image_error ("Invalid image data `%s'", buffer);
 #ifdef ALLOC_XPM_COLORS
          xpm_free_color_cache ();
 #endif
@@ -3815,23 +3829,23 @@ xpm_load (struct frame *f, struct image *img)
       switch (rc)
        {
        case XpmOpenFailed:
-         image_error ("Error opening XPM file (%s)", img->spec, Qnil);
+         image_error ("Error opening XPM file (%s)", img->spec);
          break;
 
        case XpmFileInvalid:
-         image_error ("Invalid XPM file (%s)", img->spec, Qnil);
+         image_error ("Invalid XPM file (%s)", img->spec);
          break;
 
        case XpmNoMemory:
-         image_error ("Out of memory (%s)", img->spec, Qnil);
+         image_error ("Out of memory (%s)", img->spec);
          break;
 
        case XpmColorFailed:
-         image_error ("Color allocation error (%s)", img->spec, Qnil);
+         image_error ("Color allocation error (%s)", img->spec);
          break;
 
        default:
-         image_error ("Unknown error (%s)", img->spec, Qnil);
+         image_error ("Unknown error (%s)", img->spec);
          break;
        }
     }
@@ -4101,7 +4115,7 @@ xpm_load_image (struct frame *f,
 
   if (!check_image_size (f, width, height))
     {
-      image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+      image_size_error ();
       goto failure;
     }
 
@@ -4112,7 +4126,7 @@ xpm_load_image (struct frame *f,
 #endif
       )
     {
-      image_error ("Image too large", Qnil, Qnil);
+      image_error ("Image too large");
       goto failure;
     }
 
@@ -4262,7 +4276,7 @@ xpm_load_image (struct frame *f,
   return 1;
 
  failure:
-  image_error ("Invalid XPM file (%s)", img->spec, Qnil);
+  image_error ("Invalid XPM file (%s)", img->spec);
   x_destroy_x_image (ximg);
   x_destroy_x_image (mask_img);
   x_clear_image (f, img);
@@ -4284,21 +4298,19 @@ xpm_load (struct frame *f,
   file_name = image_spec_value (img->spec, QCfile, NULL);
   if (STRINGP (file_name))
     {
-      Lisp_Object file;
-      unsigned char *contents;
-      ptrdiff_t size;
-
-      file = x_find_image_file (file_name);
+      int fd;
+      Lisp_Object file = x_find_image_fd (file_name, &fd);
       if (!STRINGP (file))
        {
-         image_error ("Cannot find image file `%s'", file_name, Qnil);
+         image_error ("Cannot find image file `%s'", file_name);
          return 0;
        }
 
-      contents = slurp_file (SSDATA (file), &size);
+      ptrdiff_t size;
+      unsigned char *contents = slurp_file (fd, &size);
       if (contents == NULL)
        {
-         image_error ("Error loading XPM image `%s'", img->spec, Qnil);
+         image_error ("Error loading XPM image `%s'", file);
          return 0;
        }
 
@@ -4312,7 +4324,7 @@ xpm_load (struct frame *f,
       data = image_spec_value (img->spec, QCdata, NULL);
       if (!STRINGP (data))
        {
-         image_error ("Invalid image data `%s'", data, Qnil);
+         image_error ("Invalid image data `%s'", data);
          return 0;
        }
       success_p = xpm_load_image (f, img, SDATA (data),
@@ -4734,7 +4746,7 @@ XPutPixel (XImagePtr ximg, int x, int y, COLORREF color)
        *pixel = *pixel & ~(1 << x % 8);
     }
   else
-    image_error ("XPutPixel: palette image not supported", Qnil, Qnil);
+    image_error ("XPutPixel: palette image not supported");
 }
 
 #endif /* HAVE_NTGUI */
@@ -5247,11 +5259,10 @@ pbm_load (struct frame *f, struct image *img)
   bool raw_p;
   int x, y;
   int width, height, max_color_idx = 0;
-  Lisp_Object file, specified_file;
+  Lisp_Object specified_file;
   enum {PBM_MONO, PBM_GRAY, PBM_COLOR} type;
   unsigned char *contents = NULL;
   unsigned char *end, *p;
-  ptrdiff_t size;
 #ifdef USE_CAIRO
   unsigned char *data = 0;
   uint32_t *dataptr;
@@ -5263,17 +5274,19 @@ pbm_load (struct frame *f, struct image *img)
 
   if (STRINGP (specified_file))
     {
-      file = x_find_image_file (specified_file);
+      int fd;
+      Lisp_Object file = x_find_image_fd (specified_file, &fd);
       if (!STRINGP (file))
        {
-         image_error ("Cannot find image file `%s'", specified_file, Qnil);
+         image_error ("Cannot find image file `%s'", specified_file);
          return 0;
        }
 
-      contents = slurp_file (SSDATA (file), &size);
+      ptrdiff_t size;
+      contents = slurp_file (fd, &size);
       if (contents == NULL)
        {
-         image_error ("Error reading `%s'", file, Qnil);
+         image_error ("Error reading `%s'", file);
          return 0;
        }
 
@@ -5286,7 +5299,7 @@ pbm_load (struct frame *f, struct image *img)
       data = image_spec_value (img->spec, QCdata, NULL);
       if (!STRINGP (data))
        {
-         image_error ("Invalid image data `%s'", data, Qnil);
+         image_error ("Invalid image data `%s'", data);
          return 0;
        }
       p = SDATA (data);
@@ -5296,7 +5309,7 @@ pbm_load (struct frame *f, struct image *img)
   /* Check magic number.  */
   if (end - p < 2 || *p++ != 'P')
     {
-      image_error ("Not a PBM image: `%s'", img->spec, Qnil);
+      image_error ("Not a PBM image: `%s'", img->spec);
     error:
       xfree (contents);
       img->pixmap = NO_PIXMAP;
@@ -5330,7 +5343,7 @@ pbm_load (struct frame *f, struct image *img)
       break;
 
     default:
-      image_error ("Not a PBM image: `%s'", img->spec, Qnil);
+      image_error ("Not a PBM image: `%s'", img->spec);
       goto error;
     }
 
@@ -5349,14 +5362,14 @@ pbm_load (struct frame *f, struct image *img)
       max_color_idx = pbm_scan_number (&p, end);
       if (max_color_idx > 65535 || max_color_idx < 0)
        {
-         image_error ("Unsupported maximum PBM color value", Qnil, Qnil);
+         image_error ("Unsupported maximum PBM color value");
          goto error;
        }
     }
 
   if (!check_image_size (f, width, height))
     {
-      image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+      image_size_error ();
       goto error;
     }
 
@@ -5430,7 +5443,7 @@ pbm_load (struct frame *f, struct image *img)
 #endif
                        x_clear_image (f, img);
                        image_error ("Invalid image size in image `%s'",
-                                    img->spec, Qnil);
+                                    img->spec);
                        goto error;
                      }
                    c = *p++;
@@ -5464,8 +5477,7 @@ pbm_load (struct frame *f, struct image *img)
          x_destroy_x_image (ximg);
 #endif
          x_clear_image (f, img);
-         image_error ("Invalid image size in image `%s'",
-                      img->spec, Qnil);
+         image_error ("Invalid image size in image `%s'", img->spec);
          goto error;
        }
 
@@ -5508,8 +5520,7 @@ pbm_load (struct frame *f, struct image *img)
 #else
                x_destroy_x_image (ximg);
 #endif
-               image_error ("Invalid pixel value in image `%s'",
-                            img->spec, Qnil);
+               image_error ("Invalid pixel value in image `%s'", img->spec);
                goto error;
              }
 
@@ -5800,7 +5811,7 @@ my_png_error (png_struct *png_ptr, const char *msg)
   eassert (png_ptr != NULL);
   /* Avoid compiler warning about deprecated direct access to
      png_ptr's fields in libpng versions 1.4.x.  */
-  image_error ("PNG error: %s", build_string (msg), Qnil);
+  image_error ("PNG error: %s", build_string (msg));
   PNG_LONGJMP (png_ptr);
 }
 
@@ -5809,7 +5820,7 @@ static void
 my_png_warning (png_struct *png_ptr, const char *msg)
 {
   eassert (png_ptr != NULL);
-  image_error ("PNG warning: %s", build_string (msg), Qnil);
+  image_error ("PNG warning: %s", build_string (msg));
 }
 
 /* Memory source for PNG decoding.  */
@@ -5870,7 +5881,7 @@ struct png_load_context
 static bool
 png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
 {
-  Lisp_Object file, specified_file;
+  Lisp_Object specified_file;
   Lisp_Object specified_data;
   int x, y;
   ptrdiff_t i;
@@ -5901,18 +5912,19 @@ png_load_body (struct frame *f, struct image *img, 
struct png_load_context *c)
 
   if (NILP (specified_data))
     {
-      file = x_find_image_file (specified_file);
+      int fd;
+      Lisp_Object file = x_find_image_fd (specified_file, &fd);
       if (!STRINGP (file))
        {
-         image_error ("Cannot find image file `%s'", specified_file, Qnil);
+         image_error ("Cannot find image file `%s'", specified_file);
          return 0;
        }
 
       /* Open the image file.  */
-      fp = emacs_fopen (SSDATA (file), "rb");
+      fp = fdopen (fd, "rb");
       if (!fp)
        {
-         image_error ("Cannot open image file `%s'", file, Qnil);
+         image_error ("Cannot open image file `%s'", file);
          return 0;
        }
 
@@ -5921,7 +5933,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
          || png_sig_cmp (sig, 0, sizeof sig))
        {
          fclose (fp);
-         image_error ("Not a PNG file: `%s'", file, Qnil);
+         image_error ("Not a PNG file: `%s'", file);
          return 0;
        }
     }
@@ -5929,7 +5941,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
     {
       if (!STRINGP (specified_data))
        {
-         image_error ("Invalid image data `%s'", specified_data, Qnil);
+         image_error ("Invalid image data `%s'", specified_data);
          return 0;
        }
 
@@ -5942,7 +5954,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
       if (tbr.len < sizeof sig
          || png_sig_cmp (tbr.bytes, 0, sizeof sig))
        {
-         image_error ("Not a PNG image: `%s'", img->spec, Qnil);
+         image_error ("Not a PNG image: `%s'", img->spec);
          return 0;
        }
 
@@ -6010,7 +6022,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
   if (! (width <= INT_MAX && height <= INT_MAX
         && check_image_size (f, width, height)))
     {
-      image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+      image_size_error ();
       goto error;
     }
 
@@ -6645,7 +6657,7 @@ static bool
 jpeg_load_body (struct frame *f, struct image *img,
                struct my_jpeg_error_mgr *mgr)
 {
-  Lisp_Object file, specified_file;
+  Lisp_Object specified_file;
   Lisp_Object specified_data;
   /* The 'volatile' silences a bogus diagnostic; see GCC bug 54561.  */
   FILE * IF_LINT (volatile) fp = NULL;
@@ -6665,23 +6677,24 @@ jpeg_load_body (struct frame *f, struct image *img,
 
   if (NILP (specified_data))
     {
-      file = x_find_image_file (specified_file);
+      int fd;
+      Lisp_Object file = x_find_image_fd (specified_file, &fd);
       if (!STRINGP (file))
        {
-         image_error ("Cannot find image file `%s'", specified_file, Qnil);
+         image_error ("Cannot find image file `%s'", specified_file);
          return 0;
        }
 
-      fp = emacs_fopen (SSDATA (file), "rb");
+      fp = fdopen (fd, "rb");
       if (fp == NULL)
        {
-         image_error ("Cannot open `%s'", file, Qnil);
+         image_error ("Cannot open `%s'", file);
          return 0;
        }
     }
   else if (!STRINGP (specified_data))
     {
-      image_error ("Invalid image data `%s'", specified_data, Qnil);
+      image_error ("Invalid image data `%s'", specified_data);
       return 0;
     }
 
@@ -6697,13 +6710,13 @@ jpeg_load_body (struct frame *f, struct image *img,
          {
            char buf[JMSG_LENGTH_MAX];
            mgr->cinfo.err->format_message ((j_common_ptr) &mgr->cinfo, buf);
-           image_error ("Error reading JPEG image `%s': %s", img->spec,
-                        build_string (buf));
+           image_error ("Error reading JPEG image `%s': %s",
+                        img->spec, build_string (buf));
            break;
          }
 
        case MY_JPEG_INVALID_IMAGE_SIZE:
-         image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+         image_size_error ();
          break;
 
        case MY_JPEG_CANNOT_CREATE_X:
@@ -7161,7 +7174,7 @@ tiff_warning_handler (const char *title, const char 
*format, va_list ap)
 static bool
 tiff_load (struct frame *f, struct image *img)
 {
-  Lisp_Object file, specified_file;
+  Lisp_Object specified_file;
   Lisp_Object specified_data;
   TIFF *tiff;
   int width, height, x, y, count;
@@ -7180,21 +7193,23 @@ tiff_load (struct frame *f, struct image *img)
   if (NILP (specified_data))
     {
       /* Read from a file */
-      file = x_find_image_file (specified_file);
+      Lisp_Object file = x_find_image_file (specified_file);
       if (!STRINGP (file))
        {
-         image_error ("Cannot find image file `%s'", specified_file, Qnil);
+         image_error ("Cannot find image file `%s'", specified_file);
          return 0;
        }
+
+      Lisp_Object encoded_file = ENCODE_FILE (file);
 # ifdef WINDOWSNT
-      file = ansi_encode_filename (file);
+      encoded_file = ansi_encode_filename (encoded_file);
 # endif
 
       /* Try to open the image file.  */
-      tiff = TIFFOpen (SSDATA (file), "r");
+      tiff = TIFFOpen (SSDATA (encoded_file), "r");
       if (tiff == NULL)
        {
-         image_error ("Cannot open `%s'", file, Qnil);
+         image_error ("Cannot open `%s'", file);
          return 0;
        }
     }
@@ -7202,7 +7217,7 @@ tiff_load (struct frame *f, struct image *img)
     {
       if (!STRINGP (specified_data))
        {
-         image_error ("Invalid image data `%s'", specified_data, Qnil);
+         image_error ("Invalid image data `%s'", specified_data);
          return 0;
        }
 
@@ -7222,7 +7237,7 @@ tiff_load (struct frame *f, struct image *img)
 
       if (!tiff)
        {
-         image_error ("Cannot open memory source for `%s'", img->spec, Qnil);
+         image_error ("Cannot open memory source for `%s'", img->spec);
          return 0;
        }
     }
@@ -7248,7 +7263,7 @@ tiff_load (struct frame *f, struct image *img)
 
   if (!check_image_size (f, width, height))
     {
-      image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+      image_size_error ();
       TIFFClose (tiff);
       return 0;
     }
@@ -7278,7 +7293,7 @@ tiff_load (struct frame *f, struct image *img)
   TIFFClose (tiff);
   if (!rc)
     {
-      image_error ("Error reading TIFF image `%s'", img->spec, Qnil);
+      image_error ("Error reading TIFF image `%s'", img->spec);
       xfree (buf);
       return 0;
     }
@@ -7591,7 +7606,6 @@ static const int interlace_increment[] = {8, 8, 4, 2};
 static bool
 gif_load (struct frame *f, struct image *img)
 {
-  Lisp_Object file;
   int rc, width, height, x, y, i, j;
   ColorMapObject *gif_color_map;
   unsigned long pixel_colors[256];
@@ -7612,26 +7626,28 @@ gif_load (struct frame *f, struct image *img)
 
   if (NILP (specified_data))
     {
-      file = x_find_image_file (specified_file);
+      Lisp_Object file = x_find_image_file (specified_file);
       if (!STRINGP (file))
        {
-         image_error ("Cannot find image file `%s'", specified_file, Qnil);
+         image_error ("Cannot find image file `%s'", specified_file);
          return 0;
        }
+
+      Lisp_Object encoded_file = ENCODE_FILE (file);
 #ifdef WINDOWSNT
-      file = ansi_encode_filename (file);
+      encoded_file = ansi_encode_filename (encoded_file);
 #endif
 
       /* Open the GIF file.  */
 #if GIFLIB_MAJOR < 5
-      gif = DGifOpenFileName (SSDATA (file));
+      gif = DGifOpenFileName (SSDATA (encoded_file));
       if (gif == NULL)
        {
-         image_error ("Cannot open `%s'", file, Qnil);
+         image_error ("Cannot open `%s'", file);
          return 0;
        }
 #else
-      gif = DGifOpenFileName (SSDATA (file), &gif_err);
+      gif = DGifOpenFileName (SSDATA (encoded_file), &gif_err);
       if (gif == NULL)
        {
          image_error ("Cannot open `%s': %s",
@@ -7644,7 +7660,7 @@ gif_load (struct frame *f, struct image *img)
     {
       if (!STRINGP (specified_data))
        {
-         image_error ("Invalid image data `%s'", specified_data, Qnil);
+         image_error ("Invalid image data `%s'", specified_data);
          return 0;
        }
 
@@ -7658,7 +7674,7 @@ gif_load (struct frame *f, struct image *img)
       gif = DGifOpen (&memsrc, gif_read_from_memory);
       if (!gif)
        {
-         image_error ("Cannot open memory source `%s'", img->spec, Qnil);
+         image_error ("Cannot open memory source `%s'", img->spec);
          return 0;
        }
 #else
@@ -7675,7 +7691,7 @@ gif_load (struct frame *f, struct image *img)
   /* Before reading entire contents, check the declared image size. */
   if (!check_image_size (f, gif->SWidth, gif->SHeight))
     {
-      image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+      image_size_error ();
       gif_close (gif, NULL);
       return 0;
     }
@@ -7684,7 +7700,7 @@ gif_load (struct frame *f, struct image *img)
   rc = DGifSlurp (gif);
   if (rc == GIF_ERROR || gif->ImageCount <= 0)
     {
-      image_error ("Error reading `%s'", img->spec, Qnil);
+      image_error ("Error reading `%s'", img->spec);
       gif_close (gif, NULL);
       return 0;
     }
@@ -7714,7 +7730,7 @@ gif_load (struct frame *f, struct image *img)
 
   if (!check_image_size (f, width, height))
     {
-      image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+      image_size_error ();
       gif_close (gif, NULL);
       return 0;
     }
@@ -7732,7 +7748,7 @@ gif_load (struct frame *f, struct image *img)
             && 0 <= subimg_top && subimg_top <= height - subimg_height
             && 0 <= subimg_left && subimg_left <= width - subimg_width))
        {
-         image_error ("Subimage does not fit in image", Qnil, Qnil);
+         image_error ("Subimage does not fit in image");
          gif_close (gif, NULL);
          return 0;
        }
@@ -7971,7 +7987,7 @@ gif_load (struct frame *f, struct image *img)
        image_error ("Error closing `%s': %s",
                     img->spec, build_string (error_text));
 #else
-      image_error ("Error closing `%s'", img->spec, Qnil);
+      image_error ("Error closing `%s'", img->spec);
 #endif
     }
 
@@ -8220,9 +8236,7 @@ imagemagick_error (MagickWand *wand)
   ExceptionType severity;
 
   description = MagickGetException (wand, &severity);
-  image_error ("ImageMagick error: %s",
-              build_string (description),
-              Qnil);
+  image_error ("ImageMagick error: %s", build_string (description));
   MagickRelinquishMemory (description);
 }
 
@@ -8383,8 +8397,7 @@ imagemagick_compute_animated_image (MagickWand 
*super_wand, int ino)
          DestroyMagickWand (composite_wand);
          DestroyMagickWand (sub_wand);
          cache->wand = NULL;
-         image_error ("Imagemagick pixel iterator creation failed",
-                      Qnil, Qnil);
+         image_error ("Imagemagick pixel iterator creation failed");
          return NULL;
        }
 
@@ -8395,8 +8408,7 @@ imagemagick_compute_animated_image (MagickWand 
*super_wand, int ino)
          DestroyMagickWand (sub_wand);
          DestroyPixelIterator (source_iterator);
          cache->wand = NULL;
-         image_error ("Imagemagick pixel iterator creation failed",
-                      Qnil, Qnil);
+         image_error ("Imagemagick pixel iterator creation failed");
          return NULL;
        }
 
@@ -8516,8 +8528,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
 
   if (ino < 0 || ino >= MagickGetNumberImages (image_wand))
     {
-      image_error ("Invalid image number `%s' in image `%s'",
-                  image, img->spec);
+      image_error ("Invalid image number `%s' in image `%s'", image, 
img->spec);
       DestroyMagickWand (image_wand);
       return 0;
     }
@@ -8571,7 +8582,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
       status = MagickScaleImage (image_wand, desired_width, desired_height);
       if (status == MagickFalse)
        {
-         image_error ("Imagemagick scale failed", Qnil, Qnil);
+         image_error ("Imagemagick scale failed");
          imagemagick_error (image_wand);
          goto imagemagick_error;
        }
@@ -8621,7 +8632,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
       status = MagickRotateImage (image_wand, bg_wand, rotation);
       if (status == MagickFalse)
         {
-          image_error ("Imagemagick image rotate failed", Qnil, Qnil);
+          image_error ("Imagemagick image rotate failed");
          imagemagick_error (image_wand);
           goto imagemagick_error;
         }
@@ -8651,7 +8662,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
   if (! (image_width <= INT_MAX && image_height <= INT_MAX
         && check_image_size (f, image_width, image_height)))
     {
-      image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+      image_size_error ();
       goto imagemagick_error;
     }
 
@@ -8678,7 +8689,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
 #ifdef COLOR_TABLE_SUPPORT
          free_color_table ();
 #endif
-         image_error ("Imagemagick X bitmap allocation failure", Qnil, Qnil);
+         image_error ("Imagemagick X bitmap allocation failure");
          goto imagemagick_error;
        }
 
@@ -8718,7 +8729,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
 #ifdef COLOR_TABLE_SUPPORT
          free_color_table ();
 #endif
-          image_error ("Imagemagick X bitmap allocation failure", Qnil, Qnil);
+          image_error ("Imagemagick X bitmap allocation failure");
           goto imagemagick_error;
         }
 
@@ -8734,8 +8745,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
          free_color_table ();
 #endif
          x_destroy_x_image (ximg);
-          image_error ("Imagemagick pixel iterator creation failed",
-                       Qnil, Qnil);
+          image_error ("Imagemagick pixel iterator creation failed");
           goto imagemagick_error;
         }
 
@@ -8787,7 +8797,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
 
   MagickWandTerminus ();
   /* TODO more cleanup.  */
-  image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
+  image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec);
   return 0;
 }
 
@@ -8806,14 +8816,13 @@ imagemagick_load (struct frame *f, struct image *img)
   file_name = image_spec_value (img->spec, QCfile, NULL);
   if (STRINGP (file_name))
     {
-      Lisp_Object file;
-
-      file = x_find_image_file (file_name);
+      Lisp_Object file = x_find_image_file (file_name);
       if (!STRINGP (file))
        {
-         image_error ("Cannot find image file `%s'", file_name, Qnil);
+         image_error ("Cannot find image file `%s'", file_name);
          return 0;
        }
+      file = ENCODE_FILE (file);
 #ifdef WINDOWSNT
       file = ansi_encode_filename (file);
 #endif
@@ -8828,7 +8837,7 @@ imagemagick_load (struct frame *f, struct image *img)
       data = image_spec_value (img->spec, QCdata, NULL);
       if (!STRINGP (data))
        {
-         image_error ("Invalid image data `%s'", data, Qnil);
+         image_error ("Invalid image data `%s'", data);
          return 0;
        }
       success_p = imagemagick_load_image (f, img, SDATA (data),
@@ -9085,26 +9094,25 @@ svg_load (struct frame *f, struct image *img)
   file_name = image_spec_value (img->spec, QCfile, NULL);
   if (STRINGP (file_name))
     {
-      Lisp_Object file;
-      unsigned char *contents;
-      ptrdiff_t size;
-
-      file = x_find_image_file (file_name);
+      int fd;
+      Lisp_Object file = x_find_image_fd (file_name, &fd);
       if (!STRINGP (file))
        {
-         image_error ("Cannot find image file `%s'", file_name, Qnil);
+         image_error ("Cannot find image file `%s'", file_name);
          return 0;
        }
 
       /* Read the entire file into memory.  */
-      contents = slurp_file (SSDATA (file), &size);
+      ptrdiff_t size;
+      unsigned char *contents = slurp_file (fd, &size);
       if (contents == NULL)
        {
-         image_error ("Error loading SVG image `%s'", img->spec, Qnil);
+         image_error ("Error loading SVG image `%s'", file);
          return 0;
        }
       /* If the file was slurped into memory properly, parse it.  */
-      success_p = svg_load_image (f, img, contents, size, SSDATA (file));
+      success_p = svg_load_image (f, img, contents, size,
+                                 SSDATA (ENCODE_FILE (file)));
       xfree (contents);
     }
   /* Else its not a file, its a lisp object.  Load the image from a
@@ -9116,7 +9124,7 @@ svg_load (struct frame *f, struct image *img)
       data = image_spec_value (img->spec, QCdata, NULL);
       if (!STRINGP (data))
        {
-         image_error ("Invalid image data `%s'", data, Qnil);
+         image_error ("Invalid image data `%s'", data);
          return 0;
        }
       original_filename = BVAR (current_buffer, filename);
@@ -9183,7 +9191,7 @@ svg_load_image (struct frame *f,         /* Pointer to 
emacs frame structure.  *
   rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
   if (! check_image_size (f, dimension_data.width, dimension_data.height))
     {
-      image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+      image_size_error ();
       goto rsvg_error;
     }
 
@@ -9315,7 +9323,7 @@ svg_load_image (struct frame *f,         /* Pointer to 
emacs frame structure.  *
   g_object_unref (rsvg_handle);
   /* FIXME: Use error->message so the user knows what is the actual
      problem with the image.  */
-  image_error ("Error parsing SVG image `%s'", img->spec, Qnil);
+  image_error ("Error parsing SVG image `%s'", img->spec);
   g_error_free (err);
   return 0;
 }
@@ -9468,7 +9476,7 @@ gs_load (struct frame *f, struct image *img)
   if (! (in_width <= INT_MAX && in_height <= INT_MAX
         && check_image_size (f, in_width, in_height)))
     {
-      image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+      image_size_error ();
       return 0;
     }
   img->width = in_width;
@@ -9489,7 +9497,7 @@ gs_load (struct frame *f, struct image *img)
 
   if (!img->pixmap)
     {
-      image_error ("Unable to create pixmap for `%s'", img->spec, Qnil);
+      image_error ("Unable to create pixmap for `%s'" , img->spec);
       return 0;
     }
 
@@ -9602,7 +9610,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
        }
       else
        image_error ("Cannot get X image of `%s'; colors will not be freed",
-                    img->spec, Qnil);
+                    img->spec);
 
       unblock_input ();
     }
diff --git a/src/indent.c b/src/indent.c
index b4e6d74..7e8f0a5 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1984,7 +1984,6 @@ whether or not it is currently displayed in some window.  
*/)
   struct window *w;
   Lisp_Object old_buffer;
   EMACS_INT old_charpos IF_LINT (= 0), old_bytepos IF_LINT (= 0);
-  struct gcpro gcpro1;
   Lisp_Object lcols;
   void *itdata = NULL;
 
@@ -2000,7 +1999,6 @@ whether or not it is currently displayed in some window.  
*/)
   w = decode_live_window (window);
 
   old_buffer = Qnil;
-  GCPRO1 (old_buffer);
   if (XBUFFER (w->contents) != current_buffer)
     {
       /* Set the window's buffer temporarily to the current buffer.  */
@@ -2210,7 +2208,7 @@ whether or not it is currently displayed in some window.  
*/)
                       old_charpos, old_bytepos);
     }
 
-  RETURN_UNGCPRO (make_number (it.vpos));
+  return make_number (it.vpos);
 }
 
 
diff --git a/src/insdel.c b/src/insdel.c
index 22c2bcc..a977b79 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -892,7 +892,6 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, 
ptrdiff_t pos_byte,
                      ptrdiff_t nchars, ptrdiff_t nbytes,
                      bool inherit, bool before_markers)
 {
-  struct gcpro gcpro1;
   ptrdiff_t outgoing_nbytes = nbytes;
   INTERVAL intervals;
 
@@ -906,7 +905,6 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, 
ptrdiff_t pos_byte,
       = count_size_as_multibyte (SDATA (string) + pos_byte,
                                 nbytes);
 
-  GCPRO1 (string);
   /* Do this before moving and increasing the gap,
      because the before-change hooks might move the gap
      or make it smaller.  */
@@ -916,7 +914,6 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, 
ptrdiff_t pos_byte,
     move_gap_both (PT, PT_BYTE);
   if (GAP_SIZE < outgoing_nbytes)
     make_gap (outgoing_nbytes - GAP_SIZE);
-  UNGCPRO;
 
   /* Copy the string text into the buffer, perhaps converting
      between single-byte and multibyte.  */
@@ -1278,14 +1275,12 @@ replace_range (ptrdiff_t from, ptrdiff_t to, 
Lisp_Object new,
   ptrdiff_t insbytes = SBYTES (new);
   ptrdiff_t from_byte, to_byte;
   ptrdiff_t nbytes_del, nchars_del;
-  struct gcpro gcpro1;
   INTERVAL intervals;
   ptrdiff_t outgoing_insbytes = insbytes;
   Lisp_Object deletion;
 
   check_markers ();
 
-  GCPRO1 (new);
   deletion = Qnil;
 
   if (prepare)
@@ -1295,8 +1290,6 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object 
new,
       to = from + range_length;
     }
 
-  UNGCPRO;
-
   /* Make args be valid.  */
   if (from < BEGV)
     from = BEGV;
@@ -1321,8 +1314,6 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object 
new,
     outgoing_insbytes
       = count_size_as_multibyte (SDATA (new), insbytes);
 
-  GCPRO1 (new);
-
   /* Make sure the gap is somewhere in or next to what we are deleting.  */
   if (from > GPT)
     gap_right (from, from_byte);
@@ -1424,7 +1415,6 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object 
new,
 
   MODIFF++;
   CHARS_MODIFF = MODIFF;
-  UNGCPRO;
 
   signal_after_change (from, nchars_del, GPT - from);
   update_compositions (from, GPT, CHECK_BORDER);
@@ -1561,7 +1551,6 @@ del_range_1 (ptrdiff_t from, ptrdiff_t to, bool prepare, 
bool ret_string)
 {
   ptrdiff_t from_byte, to_byte;
   Lisp_Object deletion;
-  struct gcpro gcpro1;
 
   /* Make args be valid */
   if (from < BEGV)
@@ -1583,10 +1572,8 @@ del_range_1 (ptrdiff_t from, ptrdiff_t to, bool prepare, 
bool ret_string)
   to_byte = CHAR_TO_BYTE (to);
 
   deletion = del_range_2 (from, from_byte, to, to_byte, ret_string);
-  GCPRO1 (deletion);
   signal_after_change (from, to - from, 0);
   update_compositions (from, from, CHECK_HEAD);
-  UNGCPRO;
   return deletion;
 }
 
@@ -1806,13 +1793,10 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t 
end,
       if (preserve_ptr)
        {
          Lisp_Object preserve_marker;
-         struct gcpro gcpro1;
          preserve_marker = Fcopy_marker (make_number (*preserve_ptr), Qnil);
-         GCPRO1 (preserve_marker);
          verify_interval_modification (current_buffer, start, end);
          *preserve_ptr = marker_position (preserve_marker);
          unchain_marker (XMARKER (preserve_marker));
-         UNGCPRO;
        }
       else
        verify_interval_modification (current_buffer, start, end);
@@ -1970,7 +1954,6 @@ signal_before_change (ptrdiff_t start_int, ptrdiff_t 
end_int,
   Lisp_Object start, end;
   Lisp_Object start_marker, end_marker;
   Lisp_Object preserve_marker;
-  struct gcpro gcpro1, gcpro2, gcpro3;
   ptrdiff_t count = SPECPDL_INDEX ();
   struct rvoe_arg rvoe_arg;
 
@@ -1979,7 +1962,6 @@ signal_before_change (ptrdiff_t start_int, ptrdiff_t 
end_int,
   preserve_marker = Qnil;
   start_marker = Qnil;
   end_marker = Qnil;
-  GCPRO3 (preserve_marker, start_marker, end_marker);
 
   specbind (Qinhibit_modification_hooks, Qt);
 
@@ -2025,7 +2007,6 @@ signal_before_change (ptrdiff_t start_int, ptrdiff_t 
end_int,
   if (! NILP (end_marker))
     free_marker (end_marker);
   RESTORE_VALUE;
-  UNGCPRO;
 
   unbind_to (count, Qnil);
 }
diff --git a/src/keyboard.c b/src/keyboard.c
index 8b4d9c3..3fbfa9b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -583,7 +583,7 @@ echo_now (void)
   if (!current_kboard->immediate_echo)
     {
       ptrdiff_t i;
-      current_kboard->immediate_echo = 1;
+      current_kboard->immediate_echo = true;
 
       for (i = 0; i < this_command_key_count; i++)
        {
@@ -611,10 +611,10 @@ echo_now (void)
       echo_dash ();
     }
 
-  echoing = 1;
+  echoing = true;
   /* FIXME: Use call (Qmessage) so it can be advised (e.g. emacspeak).  */
   message3_nolog (KVAR (current_kboard, echo_string));
-  echoing = 0;
+  echoing = false;
 
   /* Record in what buffer we echoed, and from which kboard.  */
   echo_message_buffer = echo_area_buffer[0];
@@ -629,7 +629,7 @@ echo_now (void)
 void
 cancel_echoing (void)
 {
-  current_kboard->immediate_echo = 0;
+  current_kboard->immediate_echo = false;
   current_kboard->echo_after_prompt = -1;
   kset_echo_string (current_kboard, Qnil);
   ok_to_echo_at_next_pause = NULL;
@@ -819,11 +819,11 @@ any_kboard_state ()
     {
       current_kboard->kbd_queue
        = nconc2 (Vunread_command_events, current_kboard->kbd_queue);
-      current_kboard->kbd_queue_has_data = 1;
+      current_kboard->kbd_queue_has_data = true;
     }
   Vunread_command_events = Qnil;
 #endif
-  single_kboard = 0;
+  single_kboard = false;
 }
 
 /* Switch to the single-kboard state, making current_kboard
@@ -832,7 +832,7 @@ any_kboard_state ()
 void
 single_kboard_state ()
 {
-  single_kboard = 1;
+  single_kboard = true;
 }
 #endif
 
@@ -843,7 +843,7 @@ void
 not_single_kboard_state (KBOARD *kboard)
 {
   if (kboard == current_kboard)
-    single_kboard = 0;
+    single_kboard = false;
 }
 
 /* Maintain a stack of kboards, so other parts of Emacs
@@ -875,13 +875,13 @@ pop_kboard (void)
 {
   struct terminal *t;
   struct kboard_stack *p = kboard_stack;
-  bool found = 0;
+  bool found = false;
   for (t = terminal_list; t; t = t->next_terminal)
     {
       if (t->kboard == p->kboard)
         {
           current_kboard = p->kboard;
-          found = 1;
+          found = true;
           break;
         }
     }
@@ -889,7 +889,7 @@ pop_kboard (void)
     {
       /* The terminal we remembered has been deleted.  */
       current_kboard = FRAME_KBOARD (SELECTED_FRAME ());
-      single_kboard = 0;
+      single_kboard = false;
     }
   kboard_stack = p->next;
   xfree (p);
@@ -929,7 +929,7 @@ temporarily_switch_to_single_kboard (struct frame *f)
     }
   else if (f != NULL)
     current_kboard = FRAME_KBOARD (f);
-  single_kboard = 1;
+  single_kboard = true;
   record_unwind_protect_int (restore_kboard_configuration, was_locked);
 }
 
@@ -1092,7 +1092,11 @@ command_loop (void)
   /* At least on GNU/Linux, saving signal mask is important here.  */
   if (sigsetjmp (return_to_command_loop, 1) != 0)
     {
-      /* Comes here from handle_sigsegv, see sysdep.c.  */
+      /* Comes here from handle_sigsegv (see sysdep.c) and
+        stack_overflow_handler (see w32fns.c).  */
+#ifdef WINDOWSNT
+      w32_reset_stack_overflow_guard ();
+#endif
       init_eval ();
       Vinternal__top_level_message = recover_top_level_message;
     }
@@ -1298,11 +1302,11 @@ command_loop_1 (void)
   kset_prefix_arg (current_kboard, Qnil);
   kset_last_prefix_arg (current_kboard, Qnil);
   Vdeactivate_mark = Qnil;
-  waiting_for_input = 0;
+  waiting_for_input = false;
   cancel_echoing ();
 
   this_command_key_count = 0;
-  this_command_key_count_reset = 0;
+  this_command_key_count_reset = false;
   this_single_command_key_start = 0;
 
   if (NILP (Vmemory_full))
@@ -1420,7 +1424,7 @@ command_loop_1 (void)
        {
          cancel_echoing ();
          this_command_key_count = 0;
-         this_command_key_count_reset = 0;
+         this_command_key_count_reset = false;
          this_single_command_key_start = 0;
          goto finalize;
        }
@@ -1562,7 +1566,7 @@ command_loop_1 (void)
            kset_last_repeatable_command (current_kboard, Vreal_this_command);
          cancel_echoing ();
          this_command_key_count = 0;
-         this_command_key_count_reset = 0;
+         this_command_key_count_reset = false;
          this_single_command_key_start = 0;
        }
 
@@ -1679,7 +1683,8 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
      suppress the point adjustment for automatic composition so that a
      user can keep inserting another character at point or keep
      deleting characters around point.  */
-  bool check_composition = ! modified, check_display = 1, check_invisible = 1;
+  bool check_composition = ! modified;
+  bool check_display = true, check_invisible = true;
   ptrdiff_t orig_pt = PT;
 
   eassert (XBUFFER (XWINDOW (selected_window)->contents) == current_buffer);
@@ -1694,9 +1699,9 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
          && (beg = composition_adjust_point (last_pt, PT)) != PT)
        {
          SET_PT (beg);
-         check_display = check_invisible = 1;
+         check_display = check_invisible = true;
        }
-      check_composition = 0;
+      check_composition = false;
       if (check_display
          && PT > BEGV && PT < ZV
          && !NILP (val = get_char_property_and_overlay
@@ -1716,13 +1721,13 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
                     ? max (beg - 1, BEGV)
                     : beg)
                  : end);
-         check_composition = check_invisible = 1;
+         check_composition = check_invisible = true;
        }
-      check_display = 0;
+      check_display = false;
       if (check_invisible && PT > BEGV && PT < ZV)
        {
          int inv;
-         bool ellipsis = 0;
+         bool ellipsis = false;
          beg = end = PT;
 
          /* Find boundaries `beg' and `end' of the invisible area, if any.  */
@@ -1788,7 +1793,7 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
                         was already in the range: we don't get to choose
                         which end of the range we have to go to.  */
                      : (PT < last_pt ? beg : end));
-             check_composition = check_display = 1;
+             check_composition = check_display = true;
            }
 #if 0 /* This assertion isn't correct, because SET_PT may end up setting
         the point to something other than its argument, due to
@@ -1801,9 +1806,9 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
          if (!modified && !ellipsis && beg < end)
            {
              if (last_pt == beg && PT == end && end < ZV)
-               (check_composition = check_display = 1, SET_PT (end + 1));
+               (check_composition = check_display = true, SET_PT (end + 1));
              else if (last_pt == end && PT == beg && beg > BEGV)
-               (check_composition = check_display = 1, SET_PT (beg - 1));
+               (check_composition = check_display = true, SET_PT (beg - 1));
              else if (PT == ((PT < last_pt) ? beg : end))
                /* We've already moved as far as we can.  Trying to go
                   to the other end would mean moving backwards and thus
@@ -1816,11 +1821,11 @@ adjust_point_for_property (ptrdiff_t last_pt, bool 
modified)
                                  (make_number (PT == beg ? end : beg),
                                   Qinvisible, Qnil)),
                           !TEXT_PROP_MEANS_INVISIBLE (val)))
-               (check_composition = check_display = 1,
+               (check_composition = check_display = true,
                 SET_PT (PT == beg ? end : beg));
            }
        }
-      check_invisible = 0;
+      check_invisible = false;
     }
 }
 
@@ -1848,11 +1853,11 @@ safe_run_hooks_error (Lisp_Object error, ptrdiff_t 
nargs, Lisp_Object *args)
   if (SYMBOLP (hook))
     {
       Lisp_Object val;
-      bool found = 0;
+      bool found = false;
       Lisp_Object newval = Qnil;
       for (val = find_symbol_value (hook); CONSP (val); val = XCDR (val))
        if (EQ (fun, XCAR (val)))
-         found = 1;
+         found = true;
        else
          newval = Fcons (XCAR (val), newval);
       if (found)
@@ -1864,7 +1869,7 @@ safe_run_hooks_error (Lisp_Object error, ptrdiff_t nargs, 
Lisp_Object *args)
                  : Fdefault_value (hook));
           CONSP (val); val = XCDR (val))
        if (EQ (fun, XCAR (val)))
-         found = 1;
+         found = true;
        else
          newval = Fcons (XCAR (val), newval);
       if (found)
@@ -1891,14 +1896,11 @@ safe_run_hook_funcall (ptrdiff_t nargs, Lisp_Object 
*args)
 void
 safe_run_hooks (Lisp_Object hook)
 {
-  struct gcpro gcpro1;
   ptrdiff_t count = SPECPDL_INDEX ();
 
-  GCPRO1 (hook);
   specbind (Qinhibit_quit, Qt);
   run_hook_with_args (2, ((Lisp_Object []) {hook, hook}), 
safe_run_hook_funcall);
   unbind_to (count, Qnil);
-  UNGCPRO;
 }
 
 
@@ -1929,7 +1931,7 @@ static void
 poll_for_input (struct atimer *timer)
 {
   if (poll_suppress_count == 0)
-    pending_signals = 1;
+    pending_signals = true;
 }
 
 #endif /* POLL_FOR_INPUT */
@@ -2133,13 +2135,13 @@ show_help_echo (Lisp_Object help, Lisp_Object window, 
Lisp_Object object,
       struct frame *f = NILP (do_mouse_tracking) ? NULL : some_mouse_moved ();
       help = call1 (Qmouse_fixup_help_message, help);
       if (f)
-       f->mouse_moved = 1;
+       f->mouse_moved = true;
     }
 
   if (STRINGP (help) || NILP (help))
     {
       if (!NILP (Vshow_help_function))
-       call1 (Vshow_help_function, help);
+       call1 (Vshow_help_function, Fsubstitute_command_keys (help));
       help_echo_showing_p = STRINGP (help);
     }
 }
@@ -2164,11 +2166,11 @@ read_char_help_form_unwind (void)
 
 #define STOP_POLLING                                   \
 do { if (! polling_stopped_here) stop_polling ();      \
-       polling_stopped_here = 1; } while (0)
+       polling_stopped_here = true; } while (0)
 
 #define RESUME_POLLING                                 \
 do { if (polling_stopped_here) start_polling ();       \
-       polling_stopped_here = 0; } while (0)
+       polling_stopped_here = false; } while (0)
 
 static Lisp_Object
 read_event_from_main_queue (struct timespec *end_time,
@@ -2209,13 +2211,11 @@ read_event_from_main_queue (struct timespec *end_time,
         kset_kbd_queue (kb, list1 (c));
       else
         XSETCDR (last, list1 (c));
-      kb->kbd_queue_has_data = 1;
+      kb->kbd_queue_has_data = true;
       c = Qnil;
       if (single_kboard)
         goto start;
       current_kboard = kb;
-      /* This is going to exit from read_char
-         so we had better get rid of this frame's stuff.  */
       return make_number (-2);
     }
 
@@ -2383,9 +2383,8 @@ read_char (int commandflag, Lisp_Object map,
   Lisp_Object tem, save;
   volatile Lisp_Object previous_echo_area_message;
   volatile Lisp_Object also_record;
-  volatile bool reread;
-  struct gcpro gcpro1, gcpro2;
-  bool volatile polling_stopped_here = 0;
+  volatile bool reread, recorded;
+  bool volatile polling_stopped_here = false;
   struct kboard *orig_kboard = current_kboard;
 
   also_record = Qnil;
@@ -2397,10 +2396,10 @@ read_char (int commandflag, Lisp_Object map,
   c = Qnil;
   previous_echo_area_message = Qnil;
 
-  GCPRO2 (c, previous_echo_area_message);
-
  retry:
 
+  recorded = false;
+
   if (CONSP (Vunread_post_input_method_events))
     {
       c = XCAR (Vunread_post_input_method_events);
@@ -2423,7 +2422,7 @@ read_char (int commandflag, Lisp_Object map,
 
   if (CONSP (Vunread_command_events))
     {
-      bool was_disabled = 0;
+      bool was_disabled = false;
 
       c = XCAR (Vunread_command_events);
       Vunread_command_events = XCDR (Vunread_command_events);
@@ -2442,7 +2441,7 @@ read_char (int commandflag, Lisp_Object map,
          && EQ (XCDR (c), Qdisabled)
          && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c))))
        {
-         was_disabled = 1;
+         was_disabled = true;
          c = XCAR (c);
        }
 
@@ -2452,7 +2451,7 @@ read_char (int commandflag, Lisp_Object map,
          /* Also check was_disabled so last-nonmenu-event won't return
             a bad value when submenus are involved.  (Bug#447)  */
          && (EQ (c, Qtool_bar) || EQ (c, Qmenu_bar) || was_disabled))
-       *used_mouse_menu = 1;
+       *used_mouse_menu = true;
 
       goto reread_for_input_method;
     }
@@ -2472,7 +2471,7 @@ read_char (int commandflag, Lisp_Object map,
       goto reread_for_input_method;
     }
 
-  this_command_key_count_reset = 0;
+  this_command_key_count_reset = false;
 
   if (!NILP (Vexecuting_kbd_macro))
     {
@@ -2654,11 +2653,8 @@ read_char (int commandflag, Lisp_Object map,
              kset_kbd_queue (kb, list1 (c));
            else
              XSETCDR (last, list1 (c));
-           kb->kbd_queue_has_data = 1;
+           kb->kbd_queue_has_data = true;
            current_kboard = kb;
-           /* This is going to exit from read_char
-              so we had better get rid of this frame's stuff.  */
-           UNGCPRO;
             return make_number (-2); /* wrong_kboard_jmpbuf */
          }
       }
@@ -2800,10 +2796,7 @@ read_char (int commandflag, Lisp_Object map,
      interpret the next key sequence using the wrong translation
      tables and function keymaps.  */
   if (NILP (c) && current_kboard != orig_kboard)
-    {
-      UNGCPRO;
-      return make_number (-2);  /* wrong_kboard_jmpbuf */
-    }
+    return make_number (-2);  /* wrong_kboard_jmpbuf */
 
   /* If this has become non-nil here, it has been set by a timer
      or sentinel or filter.  */
@@ -2830,7 +2823,7 @@ read_char (int commandflag, Lisp_Object map,
          kset_kbd_queue (current_kboard,
                          XCDR (KVAR (current_kboard, kbd_queue)));
          if (NILP (KVAR (current_kboard, kbd_queue)))
-           current_kboard->kbd_queue_has_data = 0;
+           current_kboard->kbd_queue_has_data = false;
          input_pending = readable_events (0);
          if (EVENT_HAS_PARAMETERS (c)
              && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qswitch_frame))
@@ -2854,9 +2847,6 @@ read_char (int commandflag, Lisp_Object map,
        if (kb->kbd_queue_has_data)
          {
            current_kboard = kb;
-           /* This is going to exit from read_char
-              so we had better get rid of this frame's stuff.  */
-           UNGCPRO;
             return make_number (-2); /* wrong_kboard_jmpbuf */
          }
     }
@@ -2876,12 +2866,7 @@ read_char (int commandflag, Lisp_Object map,
         }
 
       if (EQ (c, make_number (-2)))
-        {
-         /* This is going to exit from read_char
-            so we had better get rid of this frame's stuff.  */
-         UNGCPRO;
-          return c;
-        }
+       return c;
   }
 
  non_reread:
@@ -2990,6 +2975,7 @@ read_char (int commandflag, Lisp_Object map,
   /* Store these characters into recent_keys, the dribble file if any,
      and the keyboard macro being defined, if any.  */
   record_char (c);
+  recorded = true;
   if (! NILP (also_record))
     record_char (also_record);
 
@@ -3034,7 +3020,6 @@ read_char (int commandflag, Lisp_Object map,
       ptrdiff_t key_count;
       bool key_count_reset;
       ptrdiff_t command_key_start;
-      struct gcpro gcpro1;
       ptrdiff_t count = SPECPDL_INDEX ();
 
       /* Save the echo status.  */
@@ -3063,11 +3048,10 @@ read_char (int commandflag, Lisp_Object map,
        keys = Fcopy_sequence (this_command_keys);
       else
        keys = Qnil;
-      GCPRO1 (keys);
 
       /* Clear out this_command_keys.  */
       this_command_key_count = 0;
-      this_command_key_count_reset = 0;
+      this_command_key_count_reset = false;
       this_single_command_key_start = 0;
 
       /* Now wipe the echo area.  */
@@ -3110,8 +3094,6 @@ read_char (int commandflag, Lisp_Object map,
       if (saved_immediate_echo)
        echo_now ();
 
-      UNGCPRO;
-
       /* The input method can return no events.  */
       if (! CONSP (tem))
        {
@@ -3125,6 +3107,14 @@ read_char (int commandflag, Lisp_Object map,
       Vunread_post_input_method_events
        = nconc2 (XCDR (tem), Vunread_post_input_method_events);
     }
+  /* When we consume events from the various unread-*-events lists, we
+     bypass the code that records input, so record these events now if
+     they were not recorded already.  */
+  if (!recorded)
+    {
+      record_char (c);
+      recorded = true;
+    }
 
  reread_first:
 
@@ -3214,7 +3204,7 @@ read_char (int commandflag, Lisp_Object map,
  exit:
   RESUME_POLLING;
   input_was_pending = input_pending;
-  RETURN_UNGCPRO (c);
+  return c;
 }
 
 /* Record a key that came from a mouse menu.
@@ -3575,7 +3565,7 @@ kbd_buffer_store_buffered_event (union 
buffered_input_event *event,
              kset_kbd_queue
                (kb, list2 (make_lispy_switch_frame (event->ie.frame_or_window),
                            make_number (c)));
-             kb->kbd_queue_has_data = 1;
+             kb->kbd_queue_has_data = true;
              union buffered_input_event *sp;
              for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
                {
@@ -3669,7 +3659,7 @@ kbd_buffer_store_buffered_event (union 
buffered_input_event *event,
         do it now.  */
       if (immediate_quit && NILP (Vinhibit_quit))
        {
-         immediate_quit = 0;
+         immediate_quit = false;
          QUIT;
        }
     }
@@ -3987,7 +3977,7 @@ kbd_buffer_get_event (KBOARD **kbp,
             obj = list1 (intern ("ns-unput-working-text"));
          kbd_fetch_ptr = event + 1;
           if (used_mouse_menu)
-            *used_mouse_menu = 1;
+            *used_mouse_menu = true;
         }
 #endif
 
@@ -4189,13 +4179,13 @@ kbd_buffer_get_event (KBOARD **kbp,
                  && !EQ (event->ie.frame_or_window, event->ie.arg)
                  && (event->kind == MENU_BAR_EVENT
                      || event->kind == TOOL_BAR_EVENT))
-               *used_mouse_menu = 1;
+               *used_mouse_menu = true;
 #endif
 #ifdef HAVE_NS
              /* Certain system events are non-key events.  */
              if (used_mouse_menu
                   && event->kind == NS_NONKEY_EVENT)
-               *used_mouse_menu = 1;
+               *used_mouse_menu = true;
 #endif
 
              /* Wipe out this event, to catch bugs.  */
@@ -4422,12 +4412,10 @@ timer_check_2 (Lisp_Object timers, Lisp_Object 
idle_timers)
   struct timespec now;
   struct timespec idleness_now;
   Lisp_Object chosen_timer;
-  struct gcpro gcpro1;
 
   nexttime = invalid_timespec ();
 
   chosen_timer = Qnil;
-  GCPRO1 (chosen_timer);
 
   /* First run the code that was delayed.  */
   while (CONSP (pending_funcalls))
@@ -4552,14 +4540,12 @@ timer_check_2 (Lisp_Object timers, Lisp_Object 
idle_timers)
        /* When we encounter a timer that is still waiting,
           return the amount of time to wait before it is ripe.  */
        {
-         UNGCPRO;
          return difference;
        }
     }
 
   /* No timers are pending in the future.  */
   /* Return 0 if we generated an event, and -1 if not.  */
-  UNGCPRO;
   return nexttime;
 }
 
@@ -4578,7 +4564,6 @@ timer_check (void)
 {
   struct timespec nexttime;
   Lisp_Object timers, idle_timers;
-  struct gcpro gcpro1, gcpro2;
 
   Lisp_Object tem = Vinhibit_quit;
   Vinhibit_quit = Qt;
@@ -4597,15 +4582,12 @@ timer_check (void)
 
   Vinhibit_quit = tem;
 
-  GCPRO2 (timers, idle_timers);
-
   do
     {
       nexttime = timer_check_2 (timers, idle_timers);
     }
   while (nexttime.tv_sec == 0 && nexttime.tv_nsec == 0);
 
-  UNGCPRO;
   return nexttime;
 }
 
@@ -6241,6 +6223,10 @@ parse_modifiers_uncached (Lisp_Object symbol, ptrdiff_t 
*modifier_end)
        case 't':
          MULTI_LETTER_MOD (triple_modifier, "triple", 6);
          break;
+
+       case 'u':
+         MULTI_LETTER_MOD (up_modifier, "up", 2);
+         break;
 #undef MULTI_LETTER_MOD
 
        }
@@ -6288,16 +6274,19 @@ apply_modifiers_uncached (int modifiers, char *base, 
int base_len, int base_len_
   /* Since BASE could contain nulls, we can't use intern here; we have
      to use Fintern, which expects a genuine Lisp_String, and keeps a
      reference to it.  */
-  char new_mods[sizeof "A-C-H-M-S-s-down-drag-double-triple-"];
+  char new_mods[sizeof "A-C-H-M-S-s-up-down-drag-double-triple-"];
   int mod_len;
 
   {
     char *p = new_mods;
 
-    /* Only the event queue may use the `up' modifier; it should always
-       be turned into a click or drag event before presented to lisp code.  */
-    if (modifiers & up_modifier)
-      emacs_abort ();
+    /* Mouse events should not exhibit the `up' modifier once they
+       leave the event queue only accessible to C code; `up' will
+       always be turned into a click or drag event before being
+       presented to lisp code.  But since lisp events can be
+       synthesized bypassing the event queue and pushed into
+       `unread-command-events' or its companions, it's better to just
+       deal with unexpected modifier combinations. */
 
     if (modifiers & alt_modifier)   { *p++ = 'A'; *p++ = '-'; }
     if (modifiers & ctrl_modifier)  { *p++ = 'C'; *p++ = '-'; }
@@ -6307,6 +6296,7 @@ apply_modifiers_uncached (int modifiers, char *base, int 
base_len, int base_len_
     if (modifiers & super_modifier) { *p++ = 's'; *p++ = '-'; }
     if (modifiers & double_modifier) p = stpcpy (p, "double-");
     if (modifiers & triple_modifier) p = stpcpy (p, "triple-");
+    if (modifiers & up_modifier) p = stpcpy (p, "up-");
     if (modifiers & down_modifier) p = stpcpy (p, "down-");
     if (modifiers & drag_modifier) p = stpcpy (p, "drag-");
     /* The click modifier is denoted by the absence of other modifiers.  */
@@ -6426,8 +6416,7 @@ DEFUN ("internal-event-symbol-parse-modifiers", 
Fevent_symbol_parse_modifiers,
    BASE must be unmodified.
 
    This is like apply_modifiers_uncached, but uses BASE's
-   Qmodifier_cache property, if present.  It also builds
-   Qevent_symbol_elements properties, since it has that info anyway.
+   Qmodifier_cache property, if present.
 
    apply_modifiers copies the value of BASE's Qevent_kind property to
    the modified symbol.  */
@@ -6773,6 +6762,10 @@ parse_solitary_modifier (Lisp_Object symbol)
       MULTI_LETTER_MOD (triple_modifier, "triple", 6);
       break;
 
+    case 'u':
+      MULTI_LETTER_MOD (up_modifier, "up", 2);
+      break;
+
 #undef SINGLE_LETTER_MOD
 #undef MULTI_LETTER_MOD
     }
@@ -6885,7 +6878,7 @@ int
 gobble_input (void)
 {
   int nread = 0;
-  bool err = 0;
+  bool err = false;
   struct terminal *t;
 
   /* Store pending user signal events, if any.  */
@@ -6904,7 +6897,7 @@ gobble_input (void)
 
          if (input_blocked_p ())
            {
-             pending_signals = 1;
+             pending_signals = true;
              break;
            }
 
@@ -6917,7 +6910,7 @@ gobble_input (void)
 
           if (nr == -1)          /* Not OK to read input now.  */
             {
-              err = 1;
+              err = true;
             }
           else if (nr == -2)          /* Non-transient error.  */
             {
@@ -7177,7 +7170,7 @@ handle_async_input (void)
 void
 process_pending_signals (void)
 {
-  pending_signals = 0;
+  pending_signals = false;
   handle_async_input ();
   do_pending_atimers ();
 }
@@ -7229,7 +7222,7 @@ totally_unblock_input (void)
 void
 handle_input_available_signal (int sig)
 {
-  pending_signals = 1;
+  pending_signals = true;
 
   if (input_available_clear_time)
     *input_available_clear_time = make_timespec (0, 0);
@@ -7300,8 +7293,8 @@ handle_user_signal (int sig)
            && strcmp (special_event_name, p->name) == 0)
           {
             /* Enter the debugger in many ways.  */
-            debug_on_next_call = 1;
-            debug_on_quit = 1;
+            debug_on_next_call = true;
+            debug_on_quit = true;
             Vquit_flag = Qt;
             Vinhibit_quit = Qnil;
 
@@ -7348,7 +7341,7 @@ store_user_signal_events (void)
 {
   struct user_signal_info *p;
   struct input_event buf;
-  bool buf_initialized = 0;
+  bool buf_initialized = false;
 
   for (p = user_signals; p; p = p->next)
     if (p->npending > 0)
@@ -7358,7 +7351,7 @@ store_user_signal_events (void)
            memset (&buf, 0, sizeof buf);
            buf.kind = USER_SIGNAL_EVENT;
            buf.frame_or_window = selected_frame;
-           buf_initialized = 1;
+           buf_initialized = true;
          }
 
        do
@@ -7496,18 +7489,19 @@ menu_bar_items (Lisp_Object old)
           properties may not work reliable, as they are only
           recognized when the menu-bar (or mode-line) is updated,
           which does not normally happen after every command.  */
-       Lisp_Object tem;
-       ptrdiff_t nminor;
-       nminor = current_minor_maps (NULL, &tmaps);
+       ptrdiff_t nminor = current_minor_maps (NULL, &tmaps);
        SAFE_NALLOCA (maps, 1, nminor + 4);
        nmaps = 0;
-       tem = KVAR (current_kboard, Voverriding_terminal_local_map);
+       Lisp_Object tem = KVAR (current_kboard, Voverriding_terminal_local_map);
        if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag))
          maps[nmaps++] = tem;
        if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
          maps[nmaps++] = tem;
-       memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
-       nmaps += nminor;
+       if (nminor != 0)
+         {
+           memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
+           nmaps += nminor;
+         }
        maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
       }
     maps[nmaps++] = current_global_map;
@@ -7583,7 +7577,6 @@ Lisp_Object item_properties;
 static void
 menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void 
*dummy2)
 {
-  struct gcpro gcpro1;
   int i;
   bool parsed;
   Lisp_Object tem;
@@ -7616,9 +7609,7 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, 
Lisp_Object dummy1, void *dumm
   /* We add to menu_bar_one_keymap_changed_items before doing the
      parse_menu_item, so that if it turns out it wasn't a menu item,
      it still correctly hides any further menu item.  */
-  GCPRO1 (key);
   parsed = parse_menu_item (item, 1);
-  UNGCPRO;
   if (!parsed)
     return;
 
@@ -7734,7 +7725,8 @@ parse_menu_item (Lisp_Object item, int inmenubar)
       /* Maybe help string.  */
       if (CONSP (item) && STRINGP (XCAR (item)))
        {
-         ASET (item_properties, ITEM_PROPERTY_HELP, XCAR (item));
+         ASET (item_properties, ITEM_PROPERTY_HELP,
+               Fsubstitute_command_keys (XCAR (item)));
          start = item;
          item = XCDR (item);
        }
@@ -7795,7 +7787,12 @@ parse_menu_item (Lisp_Object item, int inmenubar)
                    return 0;
                }
              else if (EQ (tem, QChelp))
-               ASET (item_properties, ITEM_PROPERTY_HELP, XCAR (item));
+               {
+                 Lisp_Object help = XCAR (item);
+                 if (STRINGP (help))
+                   help = Fsubstitute_command_keys (help);
+                 ASET (item_properties, ITEM_PROPERTY_HELP, help);
+               }
              else if (EQ (tem, QCfilter))
                filter = item;
              else if (EQ (tem, QCkey_sequence))
@@ -8045,18 +8042,19 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
         properties may not work reliable, as they are only
         recognized when the tool-bar (or mode-line) is updated,
         which does not normally happen after every command.  */
-      Lisp_Object tem;
-      ptrdiff_t nminor;
-      nminor = current_minor_maps (NULL, &tmaps);
+      ptrdiff_t nminor = current_minor_maps (NULL, &tmaps);
       SAFE_NALLOCA (maps, 1, nminor + 4);
       nmaps = 0;
-      tem = KVAR (current_kboard, Voverriding_terminal_local_map);
+      Lisp_Object tem = KVAR (current_kboard, Voverriding_terminal_local_map);
       if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag))
        maps[nmaps++] = tem;
       if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
        maps[nmaps++] = tem;
-      memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
-      nmaps += nminor;
+      if (nminor != 0)
+       {
+         memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
+         nmaps += nminor;
+       }
       maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
     }
 
@@ -8088,11 +8086,6 @@ static void
 process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, 
void *args)
 {
   int i;
-  struct gcpro gcpro1, gcpro2;
-
-  /* Protect KEY and DEF from GC because parse_tool_bar_item may call
-     eval.  */
-  GCPRO2 (key, def);
 
   if (EQ (def, Qundefined))
     {
@@ -8117,8 +8110,6 @@ process_tool_bar_item (Lisp_Object key, Lisp_Object def, 
Lisp_Object data, void
     /* Append a new tool bar item to tool_bar_items_vector.  Accept
        more than one definition for the same key.  */
     append_tool_bar_item ();
-
-  UNGCPRO;
 }
 
 /* Access slot with index IDX of vector tool_bar_item_properties.  */
@@ -8182,7 +8173,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
   Lisp_Object filter = Qnil;
   Lisp_Object caption;
   int i;
-  bool have_label = 0;
+  bool have_label = false;
 
   /* Definition looks like `(menu-item CAPTION BINDING PROPS...)'.
      Rule out items that aren't lists, don't start with
@@ -8291,7 +8282,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
           /* `:label LABEL-STRING'.  */
           set_prop (TOOL_BAR_ITEM_LABEL,
                    STRINGP (value) ? value : build_string (bad_label));
-          have_label = 1;
+          have_label = true;
         }
       else if (EQ (ikey, QCfilter))
        /* ':filter FORM'.  */
@@ -8457,7 +8448,7 @@ read_char_x_menu_prompt (Lisp_Object map,
                         Lisp_Object prev_event, bool *used_mouse_menu)
 {
   if (used_mouse_menu)
-    *used_mouse_menu = 0;
+    *used_mouse_menu = false;
 
   /* Use local over global Menu maps.  */
 
@@ -8506,7 +8497,7 @@ read_char_x_menu_prompt (Lisp_Object map,
       else if (NILP (value))
        value = Qt;
       if (used_mouse_menu)
-       *used_mouse_menu = 1;
+       *used_mouse_menu = true;
       return value;
     }
   return Qnil ;
@@ -8521,7 +8512,7 @@ read_char_minibuf_menu_prompt (int commandflag,
   /* FIXME: Use the minibuffer's frame width.  */
   ptrdiff_t width = FRAME_COLS (SELECTED_FRAME ()) - 4;
   ptrdiff_t idx = -1;
-  bool nobindings = 1;
+  bool nobindings = true;
   Lisp_Object rest, vector;
   Lisp_Object prompt_strings = Qnil;
 
@@ -8550,7 +8541,7 @@ read_char_minibuf_menu_prompt (int commandflag,
   /* Present the documented bindings, a line at a time.  */
   while (1)
     {
-      bool notfirst = 0;
+      bool notfirst = false;
       Lisp_Object menu_strings = prompt_strings;
       ptrdiff_t i = nlength;
       Lisp_Object obj;
@@ -8661,8 +8652,8 @@ read_char_minibuf_menu_prompt (int commandflag,
                          PUSH_C_STR (", ", menu_strings);
                          i += 2;
                        }
-                     notfirst = 1;
-                     nobindings = 0;
+                     notfirst = true;
+                     nobindings = false;
 
                      /* If the char to type doesn't match the string's
                         first char, explicitly show what char to type.  */
@@ -8798,9 +8789,7 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, 
Lisp_Object prompt,
 
       next = call1 (next, prompt);
       /* If the function returned something invalid,
-        barf--don't ignore it.
-        (To ignore it safely, we would need to gcpro a bunch of
-        other variables.)  */
+        barf--don't ignore it.  */
       if (! (NILP (next) || VECTORP (next) || STRINGP (next)))
        error ("Function %s returns invalid key sequence",
               SSDATA (SYMBOL_NAME (tem)));
@@ -8978,7 +8967,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
   /* True if we are trying to map a key by changing an upper-case
      letter to lower case, or a shifted function key to an unshifted
      one.  */
-  bool shift_translated = 0;
+  bool shift_translated = false;
 
   /* If we receive a `switch-frame' or `select-window' event in the middle of
      a key sequence, we put it off for later.
@@ -8989,16 +8978,13 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
   int original_uppercase_position = -1;
 
   /* Gets around Microsoft compiler limitations.  */
-  bool dummyflag = 0;
+  bool dummyflag = false;
 
   struct buffer *starting_buffer;
 
   /* List of events for which a fake prefix key has been generated.  */
   Lisp_Object fake_prefixed_keys = Qnil;
 
-  struct gcpro gcpro1;
-
-  GCPRO1 (fake_prefixed_keys);
   raw_keybuf_count = 0;
 
   last_nonmenu_event = Qnil;
@@ -9079,7 +9065,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
         : (/* indec.start < t || fkey.start < t || */ keytran.start < t))
     {
       Lisp_Object key;
-      bool used_mouse_menu = 0;
+      bool used_mouse_menu = false;
 
       /* Where the last real key started.  If we need to throw away a
          key that has expanded into more than one element of keybuf
@@ -9176,12 +9162,12 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
                   return.  Any better way to fix this? -- cyd  */
                || (interrupted_kboard != current_kboard))
              {
-               bool found = 0;
+               bool found = false;
                struct kboard *k;
 
                for (k = all_kboards; k; k = k->next_kboard)
                  if (k == interrupted_kboard)
-                   found = 1;
+                   found = true;
 
                if (!found)
                  {
@@ -9230,7 +9216,6 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
          if (EQ (key, Qt))
            {
              unbind_to (count, Qnil);
-             UNGCPRO;
              return -1;
            }
 
@@ -9242,7 +9227,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
              t = 0;
              /* The Microsoft C compiler can't handle the goto that
                 would go here.  */
-             dummyflag = 1;
+             dummyflag = true;
              break;
            }
 
@@ -9478,14 +9463,16 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
                   Drags reduce to clicks.
                   Double-clicks reduce to clicks.
                   Triple-clicks reduce to double-clicks, then to clicks.
-                  Down-clicks are eliminated.
+                  Up/Down-clicks are eliminated.
                   Double-downs reduce to downs, then are eliminated.
                   Triple-downs reduce to double-downs, then to downs,
                     then are eliminated.  */
-             if (modifiers & (down_modifier | drag_modifier
+             if (modifiers & (up_modifier | down_modifier
+                              | drag_modifier
                               | double_modifier | triple_modifier))
                {
-                 while (modifiers & (down_modifier | drag_modifier
+                 while (modifiers & (up_modifier | down_modifier
+                                     | drag_modifier
                                      | double_modifier | triple_modifier))
                    {
                      Lisp_Object new_head, new_click;
@@ -9497,7 +9484,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
                        modifiers &= ~drag_modifier;
                      else
                        {
-                         /* Dispose of this `down' event by simply jumping
+                         /* Dispose of this `up/down' event by simply jumping
                             back to replay_key, to get another event.
 
                             Note that if this event came from mock input,
@@ -9619,14 +9606,11 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
         Scan from indec.end until we find a bound suffix.  */
       while (indec.end < t)
        {
-         struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
          bool done;
          int diff;
 
-         GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
          done = keyremap_step (keybuf, bufsize, &indec, max (t, mock_input),
                                1, &diff, prompt);
-         UNGCPRO;
          if (done)
            {
              mock_input = diff + max (t, mock_input);
@@ -9653,11 +9637,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
        /* Continue scan from fkey.end until we find a bound suffix.  */
        while (fkey.end < indec.start)
          {
-           struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
            bool done;
            int diff;
 
-           GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
            done = keyremap_step (keybuf, bufsize, &fkey,
                                  max (t, mock_input),
                                  /* If there's a binding (i.e.
@@ -9666,7 +9648,6 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
                                  fkey.end + 1 == t
                                  && (test_undefined (current_binding)),
                                  &diff, prompt);
-           UNGCPRO;
            if (done)
              {
                mock_input = diff + max (t, mock_input);
@@ -9682,14 +9663,11 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
         Scan from keytran.end until we find a bound suffix.  */
       while (keytran.end < fkey.start)
        {
-         struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
          bool done;
          int diff;
 
-         GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
          done = keyremap_step (keybuf, bufsize, &keytran, max (t, mock_input),
                                1, &diff, prompt);
-         UNGCPRO;
          if (done)
            {
              mock_input = diff + max (t, mock_input);
@@ -9730,7 +9708,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
             might get translated through function-key-map.  */
          keybuf[t - 1] = new_key;
          mock_input = max (t, mock_input);
-         shift_translated = 1;
+         shift_translated = true;
 
          goto replay_sequence;
        }
@@ -9741,7 +9719,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
              read_key_sequence_cmd = Vprefix_help_command;
              /* The Microsoft C compiler can't handle the goto that
                 would go here.  */
-             dummyflag = 1;
+             dummyflag = true;
              break;
            }
 
@@ -9783,7 +9761,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
                 input-decode-map doesn't need to go through it again.  */
              fkey.start = fkey.end = 0;
              keytran.start = keytran.end = 0;
-             shift_translated = 1;
+             shift_translated = true;
 
              goto replay_sequence;
            }
@@ -9809,7 +9787,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
       && t - 1 == original_uppercase_position)
     {
       keybuf[t - 1] = original_uppercase;
-      shift_translated = 0;
+      shift_translated = false;
     }
 
   if (shift_translated)
@@ -9831,7 +9809,6 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, 
Lisp_Object prompt,
       add_command_key (keybuf[t]);
     }
 
-  UNGCPRO;
   return t;
 }
 
@@ -9842,8 +9819,7 @@ read_key_sequence_vs (Lisp_Object prompt, Lisp_Object 
continue_echo,
                      Lisp_Object cmd_loop, bool allow_string)
 {
   Lisp_Object keybuf[30];
-  register int i;
-  struct gcpro gcpro1;
+  int i;
   ptrdiff_t count = SPECPDL_INDEX ();
 
   if (!NILP (prompt))
@@ -9855,14 +9831,10 @@ read_key_sequence_vs (Lisp_Object prompt, Lisp_Object 
continue_echo,
   specbind (Qinput_method_use_echo_area,
            (NILP (cmd_loop) ? Qt : Qnil));
 
-  memset (keybuf, 0, sizeof keybuf);
-  GCPRO1 (keybuf[0]);
-  gcpro1.nvars = ARRAYELTS (keybuf);
-
   if (NILP (continue_echo))
     {
       this_command_key_count = 0;
-      this_command_key_count_reset = 0;
+      this_command_key_count_reset = false;
       this_single_command_key_start = 0;
     }
 
@@ -9889,7 +9861,7 @@ read_key_sequence_vs (Lisp_Object prompt, Lisp_Object 
continue_echo,
       Vquit_flag = Qt;
       QUIT;
     }
-  UNGCPRO;
+
   return unbind_to (count,
                    ((allow_string ? make_event_array : Fvector)
                     (i, keybuf)));
@@ -9997,7 +9969,7 @@ detect_input_pending_run_timers (bool do_display)
 void
 clear_input_pending (void)
 {
-  input_pending = 0;
+  input_pending = false;
 }
 
 /* Return true if there are pending requeued events.
@@ -10141,7 +10113,7 @@ these events the first time.  */)
 
   /* Cause whatever we put into unread-command-events
      to echo as if it were being freshly read from the keyboard.  */
-  this_command_key_count_reset = 1;
+  this_command_key_count_reset = true;
 
   return Qnil;
 }
@@ -10156,7 +10128,7 @@ KEEP-RECORD is non-nil.  */)
   int i;
 
   this_command_key_count = 0;
-  this_command_key_count_reset = 0;
+  this_command_key_count_reset = false;
 
   if (NILP (keep_record))
     {
@@ -10230,7 +10202,7 @@ Also end any kbd macro being defined.  */)
   discard_tty_input ();
 
   kbd_fetch_ptr =  kbd_store_ptr;
-  input_pending = 0;
+  input_pending = false;
 
   return Qnil;
 }
@@ -10253,7 +10225,6 @@ On such systems, Emacs starts a subshell instead of 
suspending.  */)
   ptrdiff_t count = SPECPDL_INDEX ();
   int old_height, old_width;
   int width, height;
-  struct gcpro gcpro1;
 
   if (tty_list && tty_list->next)
     error ("There are other tty frames open; close them before suspending 
Emacs");
@@ -10263,7 +10234,6 @@ On such systems, Emacs starts a subshell instead of 
suspending.  */)
 
   run_hook (intern ("suspend-hook"));
 
-  GCPRO1 (stuffstring);
   get_tty_size (fileno (CURTTY ()->input), &old_width, &old_height);
   reset_all_sys_modes ();
   /* sys_suspend can get an error if it tries to fork a subshell
@@ -10287,7 +10257,6 @@ On such systems, Emacs starts a subshell instead of 
suspending.  */)
 
   run_hook (intern ("suspend-resume-hook"));
 
-  UNGCPRO;
   return Qnil;
 }
 
@@ -10328,7 +10297,7 @@ stuff_buffered_input (Lisp_Object stuffstring)
       clear_event (kbd_fetch_ptr);
     }
 
-  input_pending = 0;
+  input_pending = false;
 #endif /* SIGTSTP */
 }
 
@@ -10338,7 +10307,7 @@ set_waiting_for_input (struct timespec *time_to_clear)
   input_available_clear_time = time_to_clear;
 
   /* Tell handle_interrupt to throw back to read_char,  */
-  waiting_for_input = 1;
+  waiting_for_input = true;
 
   /* If handle_interrupt was called before and buffered a C-g,
      make it run again now, to avoid timing error.  */
@@ -10350,7 +10319,7 @@ void
 clear_waiting_for_input (void)
 {
   /* Tell handle_interrupt not to throw back to read_char,  */
-  waiting_for_input = 0;
+  waiting_for_input = false;
   input_available_clear_time = 0;
 }
 
@@ -10509,16 +10478,12 @@ handle_interrupt (bool in_signal_handler)
       if (immediate_quit && NILP (Vinhibit_quit))
        {
          struct gl_state_s saved;
-         struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
-         immediate_quit = 0;
+         immediate_quit = false;
          pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
          saved = gl_state;
-         GCPRO4 (saved.object, saved.global_code,
-                 saved.current_syntax_table, saved.old_prop);
          Fsignal (Qquit, Qnil);
          gl_state = saved;
-         UNGCPRO;
        }
       else
         { /* Else request quit when it's safe.  */
@@ -10526,7 +10491,7 @@ handle_interrupt (bool in_signal_handler)
          force_quit_count = count;
          if (count == 3)
             {
-              immediate_quit = 1;
+              immediate_quit = true;
               Vinhibit_quit = Qnil;
             }
           Vquit_flag = Qt;
@@ -10560,7 +10525,7 @@ quit_throw_to_read_char (bool from_signal)
 
   /* Prevent another signal from doing this before we finish.  */
   clear_waiting_for_input ();
-  input_pending = 0;
+  input_pending = false;
 
   Vunread_command_events = Qnil;
 
@@ -10588,13 +10553,13 @@ See also `current-input-mode'.  */)
     {
       /* When using X, don't give the user a real choice,
         because we haven't implemented the mechanisms to support it.  */
-      new_interrupt_input = 1;
+      new_interrupt_input = true;
     }
   else
 #endif /* HAVE_X_WINDOWS */
     new_interrupt_input = !NILP (interrupt);
 #else /* not USABLE_SIGIO */
-  new_interrupt_input = 0;
+  new_interrupt_input = false;
 #endif /* not USABLE_SIGIO */
 
   if (new_interrupt_input != interrupt_input)
@@ -10886,8 +10851,8 @@ init_kboard (KBOARD *kb, Lisp_Object type)
   kset_prefix_arg (kb, Qnil);
   kset_last_prefix_arg (kb, Qnil);
   kset_kbd_queue (kb, Qnil);
-  kb->kbd_queue_has_data = 0;
-  kb->immediate_echo = 0;
+  kb->kbd_queue_has_data = false;
+  kb->immediate_echo = false;
   kset_echo_string (kb, Qnil);
   kb->echo_after_prompt = -1;
   kb->kbd_macro_buffer = 0;
@@ -10947,7 +10912,7 @@ delete_kboard (KBOARD *kb)
       && FRAME_LIVE_P (XFRAME (selected_frame)))
     {
       current_kboard = FRAME_KBOARD (XFRAME (selected_frame));
-      single_kboard = 0;
+      single_kboard = false;
       if (current_kboard == kb)
        emacs_abort ();
     }
@@ -10961,7 +10926,7 @@ init_keyboard (void)
 {
   /* This is correct before outermost invocation of the editor loop.  */
   command_loop_level = -1;
-  immediate_quit = 0;
+  immediate_quit = false;
   quit_char = Ctl ('g');
   Vunread_command_events = Qnil;
   timer_idleness_start_time = invalid_timespec ();
@@ -10970,9 +10935,9 @@ init_keyboard (void)
   kbd_fetch_ptr = kbd_buffer;
   kbd_store_ptr = kbd_buffer;
   do_mouse_tracking = Qnil;
-  input_pending = 0;
+  input_pending = false;
   interrupt_input_blocked = 0;
-  pending_signals = 0;
+  pending_signals = false;
 
   /* This means that command_loop_1 won't try to select anything the first
      time through.  */
@@ -11528,7 +11493,7 @@ See Info node `(elisp)Multiple Terminals'.  */);
   DEFVAR_BOOL ("cannot-suspend", cannot_suspend,
               doc: /* Non-nil means to always spawn a subshell instead of 
suspending.
 \(Even if the operating system has support for stopping a process.\)  */);
-  cannot_suspend = 0;
+  cannot_suspend = false;
 
   DEFVAR_BOOL ("menu-prompting", menu_prompting,
               doc: /* Non-nil means prompt with menus when appropriate.
@@ -11538,7 +11503,7 @@ The menu is displayed on the screen
 if X menus were enabled at configuration
 time and the previous event was a mouse click prefix key.
 Otherwise, menu prompting uses the echo area.  */);
-  menu_prompting = 1;
+  menu_prompting = true;
 
   DEFVAR_LISP ("menu-prompt-more-char", menu_prompt_more_char,
               doc: /* Character to see next line of menu prompt.
diff --git a/src/keyboard.h b/src/keyboard.h
index b843e8d..3e4c475 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -170,7 +170,7 @@ struct kboard
        kbd_queue_has_data is 0.  When we push back an incomplete
        command, then this flag is 0, meaning we don't want to try
        reading from this KBOARD again until more input arrives.  */
-    char kbd_queue_has_data;
+    bool_bf kbd_queue_has_data;
 
     /* True means echo each character as typed.  */
     bool_bf immediate_echo : 1;
diff --git a/src/keymap.c b/src/keymap.c
index b69b409..3668d4b 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -254,12 +254,7 @@ get_keymap (Lisp_Object object, bool error_if_not_keymap, 
bool autoload)
            {
              if (autoload)
                {
-                 struct gcpro gcpro1, gcpro2;
-
-                 GCPRO2 (tem, object);
                  Fautoload_do_load (tem, object, Qnil);
-                 UNGCPRO;
-
                  goto autoload_retry;
                }
              else
@@ -322,12 +317,10 @@ Return PARENT.  PARENT should be nil or another keymap.  
*/)
   (Lisp_Object keymap, Lisp_Object parent)
 {
   Lisp_Object list, prev;
-  struct gcpro gcpro1, gcpro2;
 
   /* Flush any reverse-map cache.  */
   where_is_cache = Qnil; where_is_cache_keymaps = Qt;
 
-  GCPRO2 (keymap, parent);
   keymap = get_keymap (keymap, 1, 1);
 
   if (!NILP (parent))
@@ -350,7 +343,7 @@ Return PARENT.  PARENT should be nil or another keymap.  */)
        {
          CHECK_IMPURE (prev);
          XSETCDR (prev, parent);
-         RETURN_UNGCPRO (parent);
+         return parent;
        }
       prev = list;
     }
@@ -397,9 +390,7 @@ access_keymap_1 (Lisp_Object map, Lisp_Object idx,
     {
       /* See if there is a meta-map.  If there's none, there is
          no binding for IDX, unless a default binding exists in MAP.  */
-      struct gcpro gcpro1;
       Lisp_Object event_meta_binding, event_meta_map;
-      GCPRO1 (map);
       /* A strange value in which Meta is set would cause
         infinite recursion.  Protect against that.  */
       if (XINT (meta_prefix_char) & CHAR_META)
@@ -407,7 +398,6 @@ access_keymap_1 (Lisp_Object map, Lisp_Object idx,
       event_meta_binding = access_keymap_1 (map, meta_prefix_char, t_ok,
                                            noinherit, autoload);
       event_meta_map = get_keymap (event_meta_binding, 0, autoload);
-      UNGCPRO;
       if (CONSP (event_meta_map))
        {
          map = event_meta_map;
@@ -429,9 +419,6 @@ access_keymap_1 (Lisp_Object map, Lisp_Object idx,
     Lisp_Object t_binding = Qunbound;
     Lisp_Object retval = Qunbound;
     Lisp_Object retval_tail = Qnil;
-    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
-
-    GCPRO4 (tail, idx, t_binding, retval);
 
     for (tail = (CONSP (map) && EQ (Qkeymap, XCAR (map))) ? XCDR (map) : map;
         (CONSP (tail)
@@ -539,7 +526,7 @@ access_keymap_1 (Lisp_Object map, Lisp_Object idx,
          }
        QUIT;
       }
-    UNGCPRO;
+
     return EQ (Qunbound, retval) ? get_keyelt (t_binding, autoload) : retval;
   }
 }
@@ -584,11 +571,9 @@ map_keymap_internal (Lisp_Object map,
                     Lisp_Object args,
                     void *data)
 {
-  struct gcpro gcpro1, gcpro2, gcpro3;
   Lisp_Object tail
     = (CONSP (map) && EQ (Qkeymap, XCAR (map))) ? XCDR (map) : map;
 
-  GCPRO3 (map, args, tail);
   for (; CONSP (tail) && !EQ (Qkeymap, XCAR (tail)); tail = XCDR (tail))
     {
       Lisp_Object binding = XCAR (tail);
@@ -614,7 +599,7 @@ map_keymap_internal (Lisp_Object map,
                        make_save_funcptr_ptr_obj ((voidfuncptr) fun, data,
                                                   args));
     }
-  UNGCPRO;
+
   return tail;
 }
 
@@ -630,8 +615,6 @@ void
 map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args,
            void *data, bool autoload)
 {
-  struct gcpro gcpro1;
-  GCPRO1 (args);
   map = get_keymap (map, 1, autoload);
   while (CONSP (map))
     {
@@ -645,7 +628,6 @@ map_keymap (Lisp_Object map, map_keymap_function_t fun, 
Lisp_Object args,
       if (!CONSP (map))
        map = get_keymap (map, 0, autoload);
     }
-  UNGCPRO;
 }
 
 /* Same as map_keymap, but does it right, properly eliminating duplicate
@@ -653,14 +635,11 @@ map_keymap (Lisp_Object map, map_keymap_function_t fun, 
Lisp_Object args,
 void
 map_keymap_canonical (Lisp_Object map, map_keymap_function_t fun, Lisp_Object 
args, void *data)
 {
-  struct gcpro gcpro1;
-  GCPRO1 (args);
   /* map_keymap_canonical may be used from redisplay (e.g. when building menus)
      so be careful to ignore errors and to inhibit redisplay.  */
   map = safe_call1 (Qkeymap_canonicalize, map);
   /* No need to use `map_keymap' here because canonical map has no parent.  */
   map_keymap_internal (map, fun, args, data);
-  UNGCPRO;
 }
 
 DEFUN ("map-keymap-internal", Fmap_keymap_internal, Smap_keymap_internal, 2, 
2, 0,
@@ -670,11 +649,8 @@ the definition it is bound to.  The event may be a 
character range.
 If KEYMAP has a parent, this function returns it without processing it.  */)
   (Lisp_Object function, Lisp_Object keymap)
 {
-  struct gcpro gcpro1;
-  GCPRO1 (function);
   keymap = get_keymap (keymap, 1, 1);
   keymap = map_keymap_internal (keymap, map_keymap_call, function, NULL);
-  UNGCPRO;
   return keymap;
 }
 
@@ -1079,14 +1055,12 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
   bool metized = 0;
   int meta_bit;
   ptrdiff_t length;
-  struct gcpro gcpro1, gcpro2, gcpro3;
 
-  GCPRO3 (keymap, key, def);
   keymap = get_keymap (keymap, 1, 1);
 
   length = CHECK_VECTOR_OR_STRING (key);
   if (length == 0)
-    RETURN_UNGCPRO (Qnil);
+    return Qnil;
 
   if (SYMBOLP (def) && !EQ (Vdefine_key_rebound_commands, Qt))
     Vdefine_key_rebound_commands = Fcons (def, Vdefine_key_rebound_commands);
@@ -1149,7 +1123,7 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
        message_with_string ("Key sequence contains invalid event %s", c, 1);
 
       if (idx == length)
-       RETURN_UNGCPRO (store_in_keymap (keymap, c, def));
+       return store_in_keymap (keymap, c, def);
 
       cmd = access_keymap (keymap, c, 0, 1, 1);
 
@@ -1233,14 +1207,12 @@ recognize the default bindings, just as 
`read-key-sequence' does.  */)
   Lisp_Object c;
   ptrdiff_t length;
   bool t_ok = !NILP (accept_default);
-  struct gcpro gcpro1, gcpro2;
 
-  GCPRO2 (keymap, key);
   keymap = get_keymap (keymap, 1, 1);
 
   length = CHECK_VECTOR_OR_STRING (key);
   if (length == 0)
-    RETURN_UNGCPRO (keymap);
+    return keymap;
 
   idx = 0;
   while (1)
@@ -1261,11 +1233,11 @@ recognize the default bindings, just as 
`read-key-sequence' does.  */)
 
       cmd = access_keymap (keymap, c, t_ok, 0, 1);
       if (idx == length)
-       RETURN_UNGCPRO (cmd);
+       return cmd;
 
       keymap = get_keymap (cmd, 0, 1);
       if (!CONSP (keymap))
-       RETURN_UNGCPRO (make_number (idx));
+       return make_number (idx);
 
       QUIT;
     }
@@ -1744,14 +1716,10 @@ bindings; see the description of `lookup-key' for more 
details about this.  */)
   int nmaps;
   Lisp_Object binding;
   int i, j;
-  struct gcpro gcpro1, gcpro2;
 
   nmaps = current_minor_maps (&modes, &maps);
-  /* Note that all these maps are GCPRO'd
-     in the places where we found them.  */
 
   binding = Qnil;
-  GCPRO2 (key, binding);
 
   for (i = j = 0; i < nmaps; i++)
     if (!NILP (maps[i])
@@ -1761,10 +1729,9 @@ bindings; see the description of `lookup-key' for more 
details about this.  */)
        if (KEYMAPP (binding))
          maps[j++] = Fcons (modes[i], binding);
        else if (j == 0)
-         RETURN_UNGCPRO (list1 (Fcons (modes[i], binding)));
+         return list1 (Fcons (modes[i], binding));
       }
 
-  UNGCPRO;
   return Flist (j, maps);
 }
 
@@ -1922,8 +1889,6 @@ then the value includes only maps for prefixes that start 
with PREFIX.  */)
   Lisp_Object maps, tail;
   EMACS_INT prefixlen = XFASTINT (Flength (prefix));
 
-  /* no need for gcpro because we don't autoload any keymaps.  */
-
   if (!NILP (prefix))
     {
       /* If a prefix was specified, start with the keymap (if any) for
@@ -2553,7 +2518,6 @@ The optional 5th arg NO-REMAP alters how command 
remapping is handled:
   Lisp_Object found = Qnil;
   /* 1 means ignore all menu bindings entirely.  */
   bool nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii);
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
   /* List of sequences found via remapping.  Keep them in a separate
      variable, so as to push them later, since we prefer
      non-remapped binding.  */
@@ -2576,8 +2540,6 @@ The optional 5th arg NO-REMAP alters how command 
remapping is handled:
   else
     keymaps = Fcurrent_active_maps (Qnil, Qnil);
 
-  GCPRO6 (definition, keymaps, found, sequences, remapped_sequences, tem);
-
   tem = Fcommand_remapping (definition, Qnil, keymaps);
   /* If `definition' is remapped to tem', then OT1H no key will run
      that command (since they will run `tem' instead), so we should
@@ -2603,11 +2565,11 @@ The optional 5th arg NO-REMAP alters how command 
remapping is handled:
       /* We have a list of advertised bindings.  */
       while (CONSP (tem))
        if (EQ (shadow_lookup (keymaps, XCAR (tem), Qnil, 0), definition))
-         RETURN_UNGCPRO (XCAR (tem));
+         return XCAR (tem);
        else
          tem = XCDR (tem);
       if (EQ (shadow_lookup (keymaps, tem, Qnil, 0), definition))
-       RETURN_UNGCPRO (tem);
+       return tem;
     }
 
   sequences = Freverse (where_is_internal (definition, keymaps,
@@ -2676,14 +2638,12 @@ The optional 5th arg NO-REMAP alters how command 
remapping is handled:
         nil, then we should return the first ascii-only binding
         we find.  */
       if (EQ (firstonly, Qnon_ascii))
-       RETURN_UNGCPRO (sequence);
+       return sequence;
       else if (!NILP (firstonly)
               && 2 == preferred_sequence_p (sequence))
-       RETURN_UNGCPRO (sequence);
+       return sequence;
     }
 
-  UNGCPRO;
-
   found = Fnreverse (found);
 
   /* firstonly may have been t, but we may have gone all the way through
@@ -2769,7 +2729,6 @@ The optional argument MENUS, if non-nil, says to mention 
menu bindings.
   Lisp_Object outbuf, shadow;
   bool nomenu = NILP (menus);
   Lisp_Object start1;
-  struct gcpro gcpro1;
 
   const char *alternate_heading
     = "\
@@ -2780,8 +2739,6 @@ You type        Translation\n\
   CHECK_BUFFER (buffer);
 
   shadow = Qnil;
-  GCPRO1 (shadow);
-
   outbuf = Fcurrent_buffer ();
 
   /* Report on alternates for keys.  */
@@ -2927,7 +2884,6 @@ You type        Translation\n\
     describe_map_tree (KVAR (current_kboard, Vinput_decode_map), 0, Qnil, 
prefix,
                       "\f\nInput decoding map translations", nomenu, 1, 0, 0);
 
-  UNGCPRO;
   return Qnil;
 }
 
@@ -2959,7 +2915,6 @@ describe_map_tree (Lisp_Object startmap, bool partial, 
Lisp_Object shadow,
                   bool transl, bool always_title, bool mention_shadow)
 {
   Lisp_Object maps, orig_maps, seen, sub_shadows;
-  struct gcpro gcpro1, gcpro2, gcpro3;
   bool something = 0;
   const char *key_heading
     = "\
@@ -2969,7 +2924,6 @@ key             binding\n\
   orig_maps = maps = Faccessible_keymaps (startmap, prefix);
   seen = Qnil;
   sub_shadows = Qnil;
-  GCPRO3 (maps, seen, sub_shadows);
 
   if (nomenu)
     {
@@ -3065,8 +3019,6 @@ key             binding\n\
 
   if (something)
     insert_string ("\n");
-
-  UNGCPRO;
 }
 
 static int previous_description_column;
@@ -3178,7 +3130,6 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
   Lisp_Object suppress;
   Lisp_Object kludge;
   bool first = 1;
-  struct gcpro gcpro1, gcpro2, gcpro3;
 
   /* These accumulate the values from sparse keymap bindings,
      so we can sort them and handle them in order.  */
@@ -3198,8 +3149,6 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
   kludge = Fmake_vector (make_number (1), Qnil);
   definition = Qnil;
 
-  GCPRO3 (prefix, definition, kludge);
-
   map = call1 (Qkeymap_canonicalize, map);
 
   for (tail = map; CONSP (tail); tail = XCDR (tail))
@@ -3350,7 +3299,6 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
     }
 
   SAFE_FREE ();
-  UNGCPRO;
 }
 
 static void
@@ -3423,7 +3371,6 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, 
Lisp_Object args,
   Lisp_Object suppress;
   Lisp_Object kludge;
   bool first = 1;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   /* Range of elements to be handled.  */
   int from, to, stop;
   Lisp_Object character;
@@ -3449,7 +3396,6 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, 
Lisp_Object args,
      that is done once per vector element, we don't want to cons up a
      fresh vector every time.  */
   kludge = Fmake_vector (make_number (1), Qnil);
-  GCPRO4 (elt_prefix, prefix, definition, kludge);
 
   if (partial)
     suppress = intern ("suppress-keymap");
@@ -3599,8 +3545,6 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, 
Lisp_Object args,
       insert ("default", 7);
       (*elt_describer) (XCHAR_TABLE (vector)->defalt, args);
     }
-
-  UNGCPRO;
 }
 
 /* Apropos - finding all symbols whose names match a regexp.           */
diff --git a/src/lisp.h b/src/lisp.h
index f012cb2..f6b0962 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3037,9 +3037,6 @@ struct handler
 
   /* Most global vars are reset to their value via the specpdl mechanism,
      but a few others are handled by storing their value here.  */
-#if true /* GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS, but defined later.  */
-  struct gcpro *gcpro;
-#endif
   sys_jmp_buf jmp;
   EMACS_INT lisp_eval_depth;
   ptrdiff_t pdlcount;
@@ -3066,7 +3063,6 @@ struct handler
   (c)->pdlcount = SPECPDL_INDEX ();                    \
   (c)->poll_suppress_count = poll_suppress_count;      \
   (c)->interrupt_input_blocked = interrupt_input_blocked;\
-  (c)->gcpro = gcprolist;                              \
   (c)->byte_stack = byte_stack_list;                   \
   handlerlist = (c);
 
@@ -3113,262 +3109,6 @@ extern void process_quit_flag (void);
 extern Lisp_Object Vascii_downcase_table;
 extern Lisp_Object Vascii_canon_table;
 
-/* Structure for recording stack slots that need marking.  */
-
-/* This is a chain of structures, each of which points at a Lisp_Object
-   variable whose value should be marked in garbage collection.
-   Normally every link of the chain is an automatic variable of a function,
-   and its `val' points to some argument or local variable of the function.
-   On exit to the function, the chain is set back to the value it had on entry.
-   This way, no link remains in the chain when the stack frame containing the
-   link disappears.
-
-   Every function that can call Feval must protect in this fashion all
-   Lisp_Object variables whose contents will be used again.  */
-
-extern struct gcpro *gcprolist;
-
-struct gcpro
-{
-  struct gcpro *next;
-
-  /* Address of first protected variable.  */
-  volatile Lisp_Object *var;
-
-  /* Number of consecutive protected variables.  */
-  ptrdiff_t nvars;
-
-#ifdef DEBUG_GCPRO
-  /* File name where this record is used.  */
-  const char *name;
-
-  /* Line number in this file.  */
-  int lineno;
-
-  /* Index in the local chain of records.  */
-  int idx;
-
-  /* Nesting level.  */
-  int level;
-#endif
-};
-
-/* Values of GC_MARK_STACK during compilation:
-
-   0   Use GCPRO as before
-   1   Do the real thing, make GCPROs and UNGCPRO no-ops.
-   2    Mark the stack, and check that everything GCPRO'd is
-       marked.
-   3   Mark using GCPRO's, mark stack last, and count how many
-       dead objects are kept alive.
-
-   Formerly, method 0 was used.  Currently, method 1 is used unless
-   otherwise specified by hand when building, e.g.,
-   "make CPPFLAGS='-DGC_MARK_STACK=GC_USE_GCPROS_AS_BEFORE'".
-   Methods 2 and 3 are present mainly to debug the transition from 0 to 1.  */
-
-#define GC_USE_GCPROS_AS_BEFORE                0
-#define GC_MAKE_GCPROS_NOOPS           1
-#define GC_MARK_STACK_CHECK_GCPROS     2
-#define GC_USE_GCPROS_CHECK_ZOMBIES    3
-
-#ifndef GC_MARK_STACK
-#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
-#endif
-
-/* Whether we do the stack marking manually.  */
-#define BYTE_MARK_STACK !(GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS                
\
-                         || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS)
-
-
-#if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
-
-/* Do something silly with gcproN vars just so gcc shuts up.  */
-/* You get warnings from MIPSPro...  */
-
-#define GCPRO1(varname) ((void) gcpro1)
-#define GCPRO2(varname1, varname2) ((void) gcpro2, (void) gcpro1)
-#define GCPRO3(varname1, varname2, varname3) \
-  ((void) gcpro3, (void) gcpro2, (void) gcpro1)
-#define GCPRO4(varname1, varname2, varname3, varname4) \
-  ((void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)
-#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \
-  ((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)
-#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
-  ((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, \
-   (void) gcpro1)
-#define GCPRO7(a, b, c, d, e, f, g) (GCPRO6 (a, b, c, d, e, f), (void) gcpro7)
-#define UNGCPRO ((void) 0)
-
-#else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
-
-#ifndef DEBUG_GCPRO
-
-#define GCPRO1(a)                                                      \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcprolist = &gcpro1; }
-
-#define GCPRO2(a, b)                                                   \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcprolist = &gcpro2; }
-
-#define GCPRO3(a, b, c)                                                        
\
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro3.next = &gcpro2; gcpro3.var = &(c); gcpro3.nvars = 1;                
\
-    gcprolist = &gcpro3; }
-
-#define GCPRO4(a, b, c, d)                                             \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro3.next = &gcpro2; gcpro3.var = &(c); gcpro3.nvars = 1;                
\
-    gcpro4.next = &gcpro3; gcpro4.var = &(d); gcpro4.nvars = 1;                
\
-    gcprolist = &gcpro4; }
-
-#define GCPRO5(a, b, c, d, e)                                          \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro3.next = &gcpro2; gcpro3.var = &(c); gcpro3.nvars = 1;                
\
-    gcpro4.next = &gcpro3; gcpro4.var = &(d); gcpro4.nvars = 1;                
\
-    gcpro5.next = &gcpro4; gcpro5.var = &(e); gcpro5.nvars = 1;                
\
-    gcprolist = &gcpro5; }
-
-#define GCPRO6(a, b, c, d, e, f)                                       \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro3.next = &gcpro2; gcpro3.var = &(c); gcpro3.nvars = 1;                
\
-    gcpro4.next = &gcpro3; gcpro4.var = &(d); gcpro4.nvars = 1;                
\
-    gcpro5.next = &gcpro4; gcpro5.var = &(e); gcpro5.nvars = 1;                
\
-    gcpro6.next = &gcpro5; gcpro6.var = &(f); gcpro6.nvars = 1;                
\
-    gcprolist = &gcpro6; }
-
-#define GCPRO7(a, b, c, d, e, f, g)                                    \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro3.next = &gcpro2; gcpro3.var = &(c); gcpro3.nvars = 1;                
\
-    gcpro4.next = &gcpro3; gcpro4.var = &(d); gcpro4.nvars = 1;                
\
-    gcpro5.next = &gcpro4; gcpro5.var = &(e); gcpro5.nvars = 1;                
\
-    gcpro6.next = &gcpro5; gcpro6.var = &(f); gcpro6.nvars = 1;                
\
-    gcpro7.next = &gcpro6; gcpro7.var = &(g); gcpro7.nvars = 1;                
\
-    gcprolist = &gcpro7; }
-
-#define UNGCPRO (gcprolist = gcpro1.next)
-
-#else /* !DEBUG_GCPRO */
-
-extern int gcpro_level;
-
-#define GCPRO1(a)                                                      \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro1.name = __FILE__; gcpro1.lineno = __LINE__; gcpro1.idx = 1;  \
-    gcpro1.level = gcpro_level++;                                      \
-    gcprolist = &gcpro1; }
-
-#define GCPRO2(a, b)                                                   \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro1.name = __FILE__; gcpro1.lineno = __LINE__; gcpro1.idx = 1;  \
-    gcpro1.level = gcpro_level;                                                
\
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro2.name = __FILE__; gcpro2.lineno = __LINE__; gcpro2.idx = 2;  \
-    gcpro2.level = gcpro_level++;                                      \
-    gcprolist = &gcpro2; }
-
-#define GCPRO3(a, b, c)                                                        
\
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro1.name = __FILE__; gcpro1.lineno = __LINE__; gcpro1.idx = 1;  \
-    gcpro1.level = gcpro_level;                                                
\
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro2.name = __FILE__; gcpro2.lineno = __LINE__; gcpro2.idx = 2;  \
-    gcpro3.next = &gcpro2; gcpro3.var = &(c); gcpro3.nvars = 1;                
\
-    gcpro3.name = __FILE__; gcpro3.lineno = __LINE__; gcpro3.idx = 3;  \
-    gcpro3.level = gcpro_level++;                                      \
-    gcprolist = &gcpro3; }
-
-#define GCPRO4(a, b, c, d)                                             \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro1.name = __FILE__; gcpro1.lineno = __LINE__; gcpro1.idx = 1;  \
-    gcpro1.level = gcpro_level;                                                
\
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro2.name = __FILE__; gcpro2.lineno = __LINE__; gcpro2.idx = 2;  \
-    gcpro3.next = &gcpro2; gcpro3.var = &(c); gcpro3.nvars = 1;                
\
-    gcpro3.name = __FILE__; gcpro3.lineno = __LINE__; gcpro3.idx = 3;  \
-    gcpro4.next = &gcpro3; gcpro4.var = &(d); gcpro4.nvars = 1;                
\
-    gcpro4.name = __FILE__; gcpro4.lineno = __LINE__; gcpro4.idx = 4;  \
-    gcpro4.level = gcpro_level++;                                      \
-    gcprolist = &gcpro4; }
-
-#define GCPRO5(a, b, c, d, e)                                          \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro1.name = __FILE__; gcpro1.lineno = __LINE__; gcpro1.idx = 1;  \
-    gcpro1.level = gcpro_level;                                                
\
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro2.name = __FILE__; gcpro2.lineno = __LINE__; gcpro2.idx = 2;  \
-    gcpro3.next = &gcpro2; gcpro3.var = &(c); gcpro3.nvars = 1;                
\
-    gcpro3.name = __FILE__; gcpro3.lineno = __LINE__; gcpro3.idx = 3;  \
-    gcpro4.next = &gcpro3; gcpro4.var = &(d); gcpro4.nvars = 1;                
\
-    gcpro4.name = __FILE__; gcpro4.lineno = __LINE__; gcpro4.idx = 4;  \
-    gcpro5.next = &gcpro4; gcpro5.var = &(e); gcpro5.nvars = 1;                
\
-    gcpro5.name = __FILE__; gcpro5.lineno = __LINE__; gcpro5.idx = 5;  \
-    gcpro5.level = gcpro_level++;                                      \
-    gcprolist = &gcpro5; }
-
-#define GCPRO6(a, b, c, d, e, f)                                       \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro1.name = __FILE__; gcpro1.lineno = __LINE__; gcpro1.idx = 1;  \
-    gcpro1.level = gcpro_level;                                                
\
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro2.name = __FILE__; gcpro2.lineno = __LINE__; gcpro2.idx = 2;  \
-    gcpro3.next = &gcpro2; gcpro3.var = &(c); gcpro3.nvars = 1;                
\
-    gcpro3.name = __FILE__; gcpro3.lineno = __LINE__; gcpro3.idx = 3;  \
-    gcpro4.next = &gcpro3; gcpro4.var = &(d); gcpro4.nvars = 1;                
\
-    gcpro4.name = __FILE__; gcpro4.lineno = __LINE__; gcpro4.idx = 4;  \
-    gcpro5.next = &gcpro4; gcpro5.var = &(e); gcpro5.nvars = 1;                
\
-    gcpro5.name = __FILE__; gcpro5.lineno = __LINE__; gcpro5.idx = 5;  \
-    gcpro6.next = &gcpro5; gcpro6.var = &(f); gcpro6.nvars = 1;                
\
-    gcpro6.name = __FILE__; gcpro6.lineno = __LINE__; gcpro6.idx = 6;  \
-    gcpro6.level = gcpro_level++;                                      \
-    gcprolist = &gcpro6; }
-
-#define GCPRO7(a, b, c, d, e, f, g)                                    \
-  { gcpro1.next = gcprolist; gcpro1.var = &(a); gcpro1.nvars = 1;      \
-    gcpro1.name = __FILE__; gcpro1.lineno = __LINE__; gcpro1.idx = 1;  \
-    gcpro1.level = gcpro_level;                                                
\
-    gcpro2.next = &gcpro1; gcpro2.var = &(b); gcpro2.nvars = 1;                
\
-    gcpro2.name = __FILE__; gcpro2.lineno = __LINE__; gcpro2.idx = 2;  \
-    gcpro3.next = &gcpro2; gcpro3.var = &(c); gcpro3.nvars = 1;                
\
-    gcpro3.name = __FILE__; gcpro3.lineno = __LINE__; gcpro3.idx = 3;  \
-    gcpro4.next = &gcpro3; gcpro4.var = &(d); gcpro4.nvars = 1;                
\
-    gcpro4.name = __FILE__; gcpro4.lineno = __LINE__; gcpro4.idx = 4;  \
-    gcpro5.next = &gcpro4; gcpro5.var = &(e); gcpro5.nvars = 1;                
\
-    gcpro5.name = __FILE__; gcpro5.lineno = __LINE__; gcpro5.idx = 5;  \
-    gcpro6.next = &gcpro5; gcpro6.var = &(f); gcpro6.nvars = 1;                
\
-    gcpro6.name = __FILE__; gcpro6.lineno = __LINE__; gcpro6.idx = 6;  \
-    gcpro7.next = &gcpro6; gcpro7.var = &(g); gcpro7.nvars = 1;                
\
-    gcpro7.name = __FILE__; gcpro7.lineno = __LINE__; gcpro7.idx = 7;  \
-    gcpro7.level = gcpro_level++;                                      \
-    gcprolist = &gcpro7; }
-
-#define UNGCPRO                                        \
-  (--gcpro_level != gcpro1.level               \
-   ? emacs_abort ()                            \
-   : (void) (gcprolist = gcpro1.next))
-
-#endif /* DEBUG_GCPRO */
-#endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
-
-
-/* Evaluate expr, UNGCPRO, and then return the value of expr.  */
-#define RETURN_UNGCPRO(expr)                   \
-  do                                           \
-    {                                          \
-      Lisp_Object ret_ungc_val;                        \
-      ret_ungc_val = (expr);                   \
-      UNGCPRO;                                 \
-      return ret_ungc_val;                     \
-    }                                          \
-  while (false)
-
 /* Call staticpro (&var) to protect static variable `var'.  */
 
 void staticpro (Lisp_Object *);
@@ -3673,7 +3413,8 @@ extern Lisp_Object sit_for (Lisp_Object, bool, int);
 /* Defined in xdisp.c.  */
 extern bool noninteractive_need_newline;
 extern Lisp_Object echo_area_buffer[2];
-extern void add_to_log (const char *, Lisp_Object, Lisp_Object);
+extern void add_to_log (char const *, ...);
+extern void vadd_to_log (char const *, va_list);
 extern void check_message_stack (void);
 extern void setup_echo_area_for_printing (bool);
 extern bool push_message (void);
@@ -3882,7 +3623,6 @@ extern void init_alloc (void);
 extern void syms_of_alloc (void);
 extern struct buffer * allocate_buffer (void);
 extern int valid_lisp_object_p (Lisp_Object);
-extern int relocatable_string_data_p (const char *);
 #ifdef GC_CHECK_CONS_LIST
 extern void check_cons_list (void);
 #else
@@ -4305,6 +4045,18 @@ extern void set_initial_environment (void);
 extern void syms_of_callproc (void);
 
 /* Defined in doc.c.  */
+enum text_quoting_style
+  {
+    /* Use curved single quotes ‘like this’.  */
+    CURVE_QUOTING_STYLE,
+
+    /* Use grave accent and apostrophe  `like this'.  */
+    GRAVE_QUOTING_STYLE,
+
+    /* Use apostrophes 'like this'.  */
+    STRAIGHT_QUOTING_STYLE
+  };
+extern enum text_quoting_style text_quoting_style (void);
 extern Lisp_Object read_doc_string (Lisp_Object);
 extern Lisp_Object get_doc_string (Lisp_Object, bool, bool);
 extern void syms_of_doc (void);
@@ -4313,10 +4065,7 @@ extern int read_bytecode_char (bool);
 /* Defined in bytecode.c.  */
 extern void syms_of_bytecode (void);
 extern struct byte_stack *byte_stack_list;
-#if BYTE_MARK_STACK
-extern void mark_byte_stack (void);
-#endif
-extern void unmark_byte_stack (void);
+extern void relocate_byte_stack (void);
 extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object,
                                   Lisp_Object, ptrdiff_t, Lisp_Object *);
 
@@ -4651,13 +4400,6 @@ lisp_word_count (ptrdiff_t nbytes)
 # define USE_STACK_LISP_OBJECTS true
 #endif
 
-/* USE_STACK_LISP_OBJECTS requires GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS.  */
-
-#if GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS
-# undef USE_STACK_LISP_OBJECTS
-# define USE_STACK_LISP_OBJECTS false
-#endif
-
 #ifdef GC_CHECK_STRING_BYTES
 enum { defined_GC_CHECK_STRING_BYTES = true };
 #else
diff --git a/src/lread.c b/src/lread.c
index 11c8d00..6099545 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1025,7 +1025,6 @@ Return t if the file exists and loads successfully.  */)
   int fd;
   int fd_index;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3;
   Lisp_Object found, efound, hist_file_name;
   /* True means we printed the ".el is newer" message.  */
   bool newer = 0;
@@ -1044,10 +1043,7 @@ Return t if the file exists and loads successfully.  */)
     if (!NILP (handler))
       return call5 (handler, Qload, file, noerror, nomessage, nosuffix); */
 
-  /* Do this after the handler to avoid
-     the need to gcpro noerror, nomessage and nosuffix.
-     (Below here, we care only whether they are nil or not.)
-     The presence of this call is the result of a historical accident:
+  /* The presence of this call is the result of a historical accident:
      it used to be in every file-operation and when it got removed
      everywhere, it accidentally stayed here.  Since then, enough people
      supposedly have things like (load "$PROJECT/foo.el") in their .emacs
@@ -1073,7 +1069,6 @@ Return t if the file exists and loads successfully.  */)
     {
       Lisp_Object suffixes;
       found = Qnil;
-      GCPRO2 (file, found);
 
       if (! NILP (must_suffix))
        {
@@ -1101,7 +1096,6 @@ Return t if the file exists and loads successfully.  */)
        }
 
       fd = openp (Vload_path, file, suffixes, &found, Qnil, load_prefer_newer);
-      UNGCPRO;
     }
 
   if (fd == -1)
@@ -1204,8 +1198,6 @@ Return t if the file exists and loads successfully.  */)
          struct stat s1, s2;
          int result;
 
-         GCPRO3 (file, found, hist_file_name);
-
          if (version < 0
              && ! (version = safe_to_load_version (fd)))
            {
@@ -1250,7 +1242,6 @@ Return t if the file exists and loads successfully.  */)
                     }
                 }
             } /* !load_prefer_newer */
-         UNGCPRO;
        }
     }
   else
@@ -1272,8 +1263,6 @@ Return t if the file exists and loads successfully.  */)
        }
     }
 
-  GCPRO3 (file, found, hist_file_name);
-
   if (fd < 0)
     {
       /* We somehow got here with fd == -2, meaning the file is deemed
@@ -1339,8 +1328,6 @@ Return t if the file exists and loads successfully.  */)
   if (!NILP (Ffboundp (Qdo_after_load_evaluation)))
     call1 (Qdo_after_load_evaluation, hist_file_name) ;
 
-  UNGCPRO;
-
   xfree (saved_doc_string);
   saved_doc_string = 0;
   saved_doc_string_size = 0;
@@ -1402,7 +1389,8 @@ directories, make sure the PREDICATE function returns 
`dir-ok' for them.  */)
    SUFFIXES is a list of strings containing possible suffixes.
    The empty suffix is automatically added if the list is empty.
 
-   PREDICATE non-nil means don't open the files,
+   PREDICATE t means the files are binary.
+   PREDICATE non-nil and non-t means don't open the files,
    just look for one that satisfies the predicate.  In this case,
    return 1 on success.  The predicate can be a lisp function or
    an integer to pass to `access' (in which case file-name-handlers
@@ -1417,7 +1405,7 @@ directories, make sure the PREDICATE function returns 
`dir-ok' for them.  */)
 
    If NEWER is true, try all SUFFIXes and return the result for the
    newest file that exists.  Does not apply to remote files,
-   or if PREDICATE is specified.  */
+   or if a non-nil and non-t PREDICATE is specified.  */
 
 int
 openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes,
@@ -1429,7 +1417,6 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
   bool absolute;
   ptrdiff_t want_length;
   Lisp_Object filename;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6, gcpro7;
   Lisp_Object string, tail, encoded_fn, save_string;
   ptrdiff_t max_suffix_len = 0;
   int last_errno = ENOENT;
@@ -1450,7 +1437,6 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
     }
 
   string = filename = encoded_fn = save_string = Qnil;
-  GCPRO7 (str, string, save_string, filename, path, suffixes, encoded_fn);
 
   if (storeptr)
     *storeptr = Qnil;
@@ -1519,10 +1505,11 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
          else
            string = make_string (fn, fnlen);
          handler = Ffind_file_name_handler (string, Qfile_exists_p);
-         if ((!NILP (handler) || !NILP (predicate)) && !NATNUMP (predicate))
+         if ((!NILP (handler) || (!NILP (predicate) && !EQ (predicate, Qt)))
+             && !NATNUMP (predicate))
             {
              bool exists;
-             if (NILP (predicate))
+             if (NILP (predicate) || EQ (predicate, Qt))
                exists = !NILP (Ffile_readable_p (string));
              else
                {
@@ -1545,7 +1532,6 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
                   if (storeptr)
                     *storeptr = string;
                  SAFE_FREE ();
-                  UNGCPRO;
                   return -2;
                }
            }
@@ -1576,7 +1562,8 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
                }
              else
                {
-                 fd = emacs_open (pfn, O_RDONLY, 0);
+                 int oflags = O_RDONLY + (NILP (predicate) ? 0 : O_BINARY);
+                 fd = emacs_open (pfn, oflags, 0);
                  if (fd < 0)
                    {
                      if (errno != ENOENT)
@@ -1618,7 +1605,6 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
                       if (storeptr)
                         *storeptr = string;
                      SAFE_FREE ();
-                      UNGCPRO;
                       return fd;
                     }
                }
@@ -1629,7 +1615,6 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
                   if (storeptr)
                     *storeptr = save_string;
                  SAFE_FREE ();
-                  UNGCPRO;
                   return save_fd;
                 }
            }
@@ -1639,7 +1624,6 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object 
suffixes,
     }
 
   SAFE_FREE ();
-  UNGCPRO;
   errno = last_errno;
   return -1;
 }
@@ -1743,14 +1727,11 @@ readevalloop_eager_expand_eval (Lisp_Object val, 
Lisp_Object macroexpand)
   val = call2 (macroexpand, val, Qnil);
   if (EQ (CAR_SAFE (val), Qprogn))
     {
-      struct gcpro gcpro1;
       Lisp_Object subforms = XCDR (val);
 
-      GCPRO1 (subforms);
       for (val = Qnil; CONSP (subforms); subforms = XCDR (subforms))
           val = readevalloop_eager_expand_eval (XCAR (subforms),
                                                 macroexpand);
-      UNGCPRO;
     }
   else
       val = eval_sub (call2 (macroexpand, val, Qt));
@@ -1772,10 +1753,9 @@ readevalloop (Lisp_Object readcharfun,
              Lisp_Object unibyte, Lisp_Object readfun,
              Lisp_Object start, Lisp_Object end)
 {
-  register int c;
-  register Lisp_Object val;
+  int c;
+  Lisp_Object val;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   struct buffer *b = 0;
   bool continue_reading_p;
   Lisp_Object lex_bound;
@@ -1810,7 +1790,7 @@ readevalloop (Lisp_Object readcharfun,
   if (! NILP (start) && !b)
     emacs_abort ();
 
-  specbind (Qstandard_input, readcharfun); /* GCPROs readcharfun.  */
+  specbind (Qstandard_input, readcharfun);
   specbind (Qcurrent_load_list, Qnil);
   record_unwind_protect_int (readevalloop_1, load_convert_to_unibyte);
   load_convert_to_unibyte = !NILP (unibyte);
@@ -1823,8 +1803,6 @@ readevalloop (Lisp_Object readcharfun,
            (NILP (lex_bound) || EQ (lex_bound, Qunbound)
             ? Qnil : list1 (Qt)));
 
-  GCPRO4 (sourcename, readfun, start, end);
-
   /* Try to ensure sourcename is a truename, except whilst preloading.  */
   if (NILP (Vpurify_flag)
       && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename))
@@ -1885,7 +1863,7 @@ readevalloop (Lisp_Object readcharfun,
 
       /* Ignore whitespace here, so we can detect eof.  */
       if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r'
-         || c == 0xa0)  /* NBSP */
+         || c == NO_BREAK_SPACE)
        goto read_next;
 
       if (!NILP (Vpurify_flag) && c == '(')
@@ -1943,8 +1921,6 @@ readevalloop (Lisp_Object readcharfun,
   build_load_history (sourcename,
                      stream || whole_buffer);
 
-  UNGCPRO;
-
   unbind_to (count, Qnil);
 }
 
@@ -2661,14 +2637,12 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
       if (c == '(')
        {
          Lisp_Object tmp;
-         struct gcpro gcpro1;
          int ch;
 
          /* Read the string itself.  */
          tmp = read1 (readcharfun, &ch, 0);
          if (ch != 0 || !STRINGP (tmp))
            invalid_syntax ("#");
-         GCPRO1 (tmp);
          /* Read the intervals and their properties.  */
          while (1)
            {
@@ -2686,7 +2660,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
                invalid_syntax ("Invalid string property list");
              Fset_text_properties (beg, end, plist, tmp);
            }
-         UNGCPRO;
+
          return tmp;
        }
 
@@ -2793,7 +2767,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
          uninterned_symbol = 1;
          c = READCHAR;
          if (!(c > 040
-               && c != 0xa0    /* NBSP */
+               && c != NO_BREAK_SPACE
                && (c >= 0200
                    || strchr ("\"';()[]#`,", c) == NULL)))
            {
@@ -3127,7 +3101,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
     default:
     default_label:
       if (c <= 040) goto retry;
-      if (c == 0xa0) /* NBSP */
+      if (c == NO_BREAK_SPACE)
        goto retry;
 
     read_symbol:
@@ -3167,7 +3141,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list)
              c = READCHAR;
            }
          while (c > 040
-                && c != 0xa0 /* NBSP */
+                && c != NO_BREAK_SPACE
                 && (c >= 0200
                     || strchr ("\"';()[]#`,", c) == NULL));
 
@@ -3568,7 +3542,6 @@ read_list (bool flag, Lisp_Object readcharfun)
 {
   Lisp_Object val, tail;
   Lisp_Object elt, tem;
-  struct gcpro gcpro1, gcpro2;
   /* 0 is the normal case.
      1 means this list is a doc reference; replace it with the number 0.
      2 means this list is a doc reference; replace it with the doc string.  */
@@ -3583,9 +3556,7 @@ read_list (bool flag, Lisp_Object readcharfun)
   while (1)
     {
       int ch;
-      GCPRO2 (val, tail);
       elt = read1 (readcharfun, &ch, first_in_list);
-      UNGCPRO;
 
       first_in_list = 0;
 
@@ -3628,13 +3599,12 @@ read_list (bool flag, Lisp_Object readcharfun)
            return val;
          if (ch == '.')
            {
-             GCPRO2 (val, tail);
              if (!NILP (tail))
                XSETCDR (tail, read0 (readcharfun));
              else
                val = read0 (readcharfun);
              read1 (readcharfun, &ch, 0);
-             UNGCPRO;
+
              if (ch == ')')
                {
                  if (doc_reference == 1)
diff --git a/src/macfont.m b/src/macfont.m
index 02dc468..d0d7252 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -1038,49 +1038,44 @@ static CFStringRef
 macfont_create_family_with_symbol (Lisp_Object symbol)
 {
   CFStringRef result = NULL, family_name;
-  CFComparatorFunction family_name_comparator;
+  CFDictionaryRef attributes = NULL;
+  FontDescriptorRef pat_desc = NULL;
 
   if (macfont_get_family_cache_if_present (symbol, &result))
     return result ? CFRetain (result) : NULL;
 
   family_name = cfstring_create_with_string_noencode (SYMBOL_NAME (symbol));
-  if (family_name == NULL)
-    return NULL;
-
+  if (family_name)
     {
-      family_name_comparator = CTFontManagerCompareFontFamilyNames;
+      attributes =
+       CFDictionaryCreate (NULL,
+                           (const void **) &MAC_FONT_FAMILY_NAME_ATTRIBUTE,
+                           (const void **) &family_name, 1,
+                           &kCFTypeDictionaryKeyCallBacks,
+                           &kCFTypeDictionaryValueCallBacks);
+      CFRelease (family_name);
     }
-
-  if ((*family_name_comparator) (family_name, CFSTR ("LastResort"), NULL)
-      == kCFCompareEqualTo)
-    result = CFSTR ("LastResort");
-  else
+  if (attributes)
     {
-      CFIndex i, count;
-      CFArrayRef families = macfont_copy_available_families_cache ();
+      pat_desc = mac_font_descriptor_create_with_attributes (attributes);
+      CFRelease (attributes);
+    }
+  if (pat_desc)
+    {
+      FontDescriptorRef desc =
+       mac_font_descriptor_create_matching_font_descriptor (pat_desc, NULL);
 
-      if (families)
+      if (desc)
        {
-         count = CFArrayGetCount (families);
-         i = CFArrayBSearchValues (families, CFRangeMake (0, count),
-                                   (const void *) family_name,
-                                   family_name_comparator, NULL);
-         if (i < count)
-           {
-             CFStringRef name = CFArrayGetValueAtIndex (families, i);
-
-             if ((*family_name_comparator) (name, family_name, NULL)
-                 == kCFCompareEqualTo)
-               result = CFRetain (name);
-           }
-         CFRelease (families);
+         result =
+           mac_font_descriptor_copy_attribute (desc,
+                                               MAC_FONT_FAMILY_NAME_ATTRIBUTE);
+         CFRelease (desc);
        }
+      macfont_set_family_cache (symbol, result);
+      CFRelease (pat_desc);
     }
 
-  CFRelease (family_name);
-
-  macfont_set_family_cache (symbol, result);
-
   return result;
 }
 
diff --git a/src/macros.c b/src/macros.c
index 79ed5b5..1bf2cd7 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -294,7 +294,6 @@ each iteration of the macro.  Iteration stops if LOOPFUNC 
returns nil.  */)
   Lisp_Object tem;
   ptrdiff_t pdlcount = SPECPDL_INDEX ();
   EMACS_INT repeat = 1;
-  struct gcpro gcpro1, gcpro2;
   EMACS_INT success_count = 0;
 
   executing_kbd_macro_iterations = 0;
@@ -314,7 +313,6 @@ each iteration of the macro.  Iteration stops if LOOPFUNC 
returns nil.  */)
                      Vreal_this_command));
   record_unwind_protect (pop_kbd_macro, tem);
 
-  GCPRO2 (final, loopfunc);
   do
     {
       Vexecuting_kbd_macro = final;
@@ -344,7 +342,6 @@ each iteration of the macro.  Iteration stops if LOOPFUNC 
returns nil.  */)
 
   Vreal_this_command = Vexecuting_kbd_macro;
 
-  UNGCPRO;
   return unbind_to (pdlcount, Qnil);
 }
 
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
deleted file mode 100644
index 795b55a..0000000
--- a/src/makefile.w32-in
+++ /dev/null
@@ -1,1725 +0,0 @@
-# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
-# Copyright (C) 2000-2015 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-ALL = emacs
-
-.PHONY: $(ALL)
-
-# Set EMACSLOADPATH correctly (in case already defined in environment).
-EMACSLOADPATH=$(CURDIR)/../lisp
-
-# Size in MBs of the static heap in temacs.exe.
-HEAPSIZE = $(EMACS_HEAPSIZE)
-
-LOCAL_FLAGS     = -Demacs=1 -I../lib -I../nt/inc $(EMACS_EXTRA_C_FLAGS)
-
-SRC             = .
-EMACS           = $(BLD)/emacs.exe
-TEMACS          = $(BLD)/temacs.exe
-TEMACS_TMP      = $(BLD)/temacs.bin
-TLIB0           = $(BLD)/temacs0.$(A)
-TLIB1           = $(BLD)/temacs1.$(A)
-TLIB2           = $(BLD)/temacs2.$(A)
-TOBJ            = $(BLD)/firstfile.$(O)
-TRES           = $(BLD)/emacs.res
-TLASTLIB       = $(BLD)/lastfile.$(A)
-GNULIB         = ../lib/$(BLD)/libgnu.$(A)
-
-DOC            = $(OBJDIR)/etc/DOC
-
-FULL_LINK_FLAGS = $(LINK_FLAGS) $(TEMACS_EXTRA_LINK)
-
-#
-# Split up the objects into two sets so that we don't run out of
-# command line space when we link them into a library.
-#
-# Put emacs.$(O) in a separate lib, since we need to have firstfile.$(O)
-# as the "main" object file when linking.
-#
-OBJ0 =  $(BLD)/emacs.$(O)
-
-OBJ1 =  $(BLD)/alloc.$(O)              \
-       $(BLD)/atimer.$(O)              \
-       $(BLD)/buffer.$(O)              \
-       $(BLD)/bytecode.$(O)            \
-       $(BLD)/callint.$(O)             \
-       $(BLD)/callproc.$(O)            \
-       $(BLD)/casefiddle.$(O)          \
-       $(BLD)/cmds.$(O)                \
-       $(BLD)/data.$(O)                \
-       $(BLD)/dired.$(O)               \
-       $(BLD)/dispnew.$(O)             \
-       $(BLD)/doc.$(O)                 \
-       $(BLD)/doprnt.$(O)              \
-       $(BLD)/editfns.$(O)             \
-       $(BLD)/eval.$(O)                \
-       $(BLD)/fileio.$(O)              \
-       $(BLD)/filelock.$(O)            \
-       $(BLD)/fns.$(O)                 \
-       $(BLD)/indent.$(O)              \
-       $(BLD)/insdel.$(O)              \
-       $(BLD)/keyboard.$(O)            \
-       $(BLD)/keymap.$(O)              \
-       $(BLD)/lread.$(O)               \
-       $(BLD)/macros.$(O)              \
-       $(BLD)/marker.$(O)              \
-       $(BLD)/minibuf.$(O)             \
-       $(BLD)/w32.$(O)                 \
-       $(BLD)/w32heap.$(O)             \
-       $(BLD)/w32inevt.$(O)            \
-       $(BLD)/w32proc.$(O)             \
-       $(BLD)/w32console.$(O)          \
-       $(BLD)/print.$(O)               \
-       $(BLD)/process.$(O)             \
-       $(BLD)/regex.$(O)               \
-       $(BLD)/scroll.$(O)              \
-       $(BLD)/search.$(O)              \
-       $(BLD)/sound.$(O)               \
-       $(BLD)/syntax.$(O)
-
-OBJ2 =  $(BLD)/sysdep.$(O)             \
-       $(BLD)/term.$(O)                \
-       $(BLD)/tparam.$(O)              \
-       $(BLD)/undo.$(O)                \
-       $(BLD)/unexw32.$(O)             \
-       $(BLD)/window.$(O)              \
-       $(BLD)/xdisp.$(O)               \
-       $(BLD)/casetab.$(O)             \
-       $(BLD)/floatfns.$(O)            \
-       $(BLD)/frame.$(O)               \
-       $(BLD)/gmalloc.$(O)             \
-       $(BLD)/gnutls.$(O)              \
-       $(BLD)/intervals.$(O)           \
-       $(BLD)/composite.$(O)           \
-       $(BLD)/ralloc.$(O)              \
-       $(BLD)/textprop.$(O)            \
-       $(BLD)/vm-limit.$(O)            \
-       $(BLD)/region-cache.$(O)        \
-       $(BLD)/bidi.$(O)                \
-       $(BLD)/charset.$(O)             \
-       $(BLD)/character.$(O)           \
-       $(BLD)/chartab.$(O)             \
-       $(BLD)/coding.$(O)              \
-       $(BLD)/category.$(O)            \
-       $(BLD)/ccl.$(O)                 \
-       $(BLD)/font.$(O)                \
-       $(BLD)/fontset.$(O)             \
-       $(BLD)/fringe.$(O)              \
-       $(BLD)/image.$(O)               \
-       $(BLD)/terminal.$(O)            \
-       $(BLD)/menu.$(O)                \
-       $(BLD)/xml.$(O)                 \
-       $(BLD)/profiler.$(O)            \
-       $(BLD)/w32term.$(O)             \
-       $(BLD)/w32xfns.$(O)             \
-       $(BLD)/w32fns.$(O)              \
-       $(BLD)/xfaces.$(O)              \
-       $(BLD)/w32select.$(O)           \
-       $(BLD)/w32menu.$(O)             \
-       $(BLD)/w32reg.$(O)              \
-       $(BLD)/w32font.$(O)             \
-       $(BLD)/w32notify.$(O)           \
-       $(BLD)/w32uniscribe.$(O)
-
-LIBS =  $(TLIB0)       \
-       $(TLIB1)        \
-       $(TLIB2)        \
-       $(TLASTLIB)     \
-       $(GNULIB)       \
-       $(WINMM)        \
-       $(ADVAPI32)     \
-       $(GDI32)        \
-       $(COMDLG32)     \
-       $(USER32)       \
-       $(MPR)          \
-       $(SHELL32)      \
-       $(WINSPOOL)     \
-       $(OLE32)        \
-       $(COMCTL32)     \
-       $(UNISCRIBE)    \
-       $(USER_LIBS)    \
-       $(libc)
-
-#
-# Build the executable and dump it.
-#
-all:            $(ALL)
-
-#
-# The dumped executable
-#
-emacs:          stamp_BLD $(EMACS)
-$(EMACS):       $(DOC) $(TEMACS)
-       "$(THISDIR)/$(BLD)/temacs.exe" -batch -l loadup dump
-       -"$(THISDIR)/$(BLD)/emacs.exe" -batch -f list-load-path-shadows
-
-#
-# The undumped executable
-# Note the extra post-link step to insert a static preload heap section.
-# If preload runs out of memory, increase the last argument to addsection
-# (it is the preload heap size in MB).
-#
-temacs:         stamp_BLD $(TEMACS)
-$(TEMACS):      $(TLIB0) $(TLIB1) $(TLIB2) $(TLASTLIB) $(TOBJ) $(TRES) \
-                 ../nt/$(BLD)/addsection.exe $(GNULIB)
-       $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) 
$(LIBS)
-       "$(THISDIR)/../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 
$(HEAPSIZE)
-
-# These omit firstfile.${O}, but there's no documentation in there
-# anyways.
-buildobj.h: $(SRC)/makefile.w32-in
-       $(MAKE) $(MFLAGS) make-buildobj-$(SHELLTYPE)
-
-# Cannot have blanks between the backslash and the redirection
-# characters, because CMD's `echo' will put them in buildobj.h.
-make-buildobj-CMD:
-       echo #define BUILDOBJ ^"\> buildobj.h
-       echo $(OBJ0)            \>> buildobj.h
-       echo $(OBJ1)            \>> buildobj.h
-       echo $(OBJ2)            \>> buildobj.h
-       echo ^">> buildobj.h
-
-# "
-# The above line is here to countermand the single quote
-# on the last "echo" command above, wrt font-lock.
-make-buildobj-SH:
-       echo '#define BUILDOBJ $(DQUOTE)\'  > buildobj.h
-       echo $(OBJ0)                   '\' >> buildobj.h
-       echo $(OBJ1)                   '\' >> buildobj.h
-       echo $(OBJ2)                   '\' >> buildobj.h
-       echo '$(DQUOTE)'                   >> buildobj.h
-
-GLOBAL_SOURCES =   dosfns.c msdos.c \
-       xterm.c xfns.c xmenu.c xselect.c xrdb.c xsmfns.c fringe.c image.c \
-       fontset.c menu.c dbusbind.c \
-       w32.c w32console.c w32fns.c w32heap.c w32inevt.c cygw32.c \
-       w32menu.c w32proc.c w32reg.c w32select.c w32term.c w32xfns.c \
-       font.c w32font.c w32uniscribe.c w32notify.c \
-       dispnew.c frame.c scroll.c xdisp.c window.c bidi.c \
-       charset.c coding.c category.c ccl.c character.c chartab.c \
-       cm.c term.c terminal.c xfaces.c \
-       emacs.c keyboard.c macros.c keymap.c sysdep.c \
-       buffer.c filelock.c insdel.c marker.c \
-       minibuf.c fileio.c dired.c \
-       cmds.c casetab.c casefiddle.c indent.c search.c regex.c undo.c \
-       alloc.c data.c doc.c editfns.c callint.c \
-       eval.c floatfns.c fns.c print.c lread.c \
-       syntax.c bytecode.c \
-       process.c callproc.c unexw32.c \
-       region-cache.c sound.c atimer.c \
-       doprnt.c intervals.c textprop.c composite.c \
-       gnutls.c xml.c profiler.c
-SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
-       xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o
-obj = $(GLOBAL_SOURCES:.c=.o)
-
-globals.h: gl-stamp
-       @cmd $(SWITCHCHAR)c rem true
-
-gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES)
-       - $(DEL) gl-tmp
-       "$(THISDIR)/../lib-src/$(BLD)/make-docfile" -d . -g 
$(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
-       fc.exe $(SWITCHCHAR)b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp 
globals.h
-       - $(DEL) gl-tmp
-       echo timestamp > $@
-
-bootstrap: bootstrap-emacs
-
-#
-# Build a temacs with a sufficiently large PURESIZE to load the
-# Lisp files from loadup.el in source form.
-#
-# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
-#          this can break with GNU Make 3.81 and later if sh.exe is used.
-bootstrap-temacs-CMD:
-       $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(ESC_CFLAGS) 
-DPURESIZE=$(EMACS_PURESIZE)$(ARGQUOTE)
-
-bootstrap-temacs-SH:
-       $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(CFLAGS) 
-DPURESIZE=$(EMACS_PURESIZE)$(ARGQUOTE)
-
-bootstrap-temacs:
-       $(MAKE) $(MFLAGS) bootstrap-temacs-$(SHELLTYPE)
-
-#
-# Dump an Emacs executable named bootstrap-emacs containing the
-# files from loadup.el in source form.
-#
-bootstrap-emacs: bootstrap-temacs
-       "$(THISDIR)/$(BLD)/temacs.exe" -batch -l loadup bootstrap
-       - mkdir "../bin"
-       $(CP) $(EMACS) ../bin
-
-#
-# Force recompile of files that depend on PURESIZE
-#
-bootstrap-clean:
-       - $(DEL) $(BLD)/alloc.$(O)
-       - $(DEL) $(BLD)/data.$(O)
-       - $(DEL) $(BLD)/intervals.$(O)
-       - $(DEL) $(BLD)/keyboard.$(O)
-       - $(DEL) $(BLD)/keymap.$(O)
-
-#
-# The resource file.  NT 3.10 requires the use of cvtres; even though
-# it is not necessary on later versions, it is still ok to use it.
-#
-$(TRES): ../nt/emacs.rc stamp_BLD
-       $(RC) $(RC_INCLUDE)../nt $(RC_OUT)$@ ../nt/emacs.rc
-
-#
-# Build the library.  Split up the build into two phases...otherwise we
-# run out of command line space.
-#
-$(TLIB0):       $(OBJ0)
-       - $(DEL) $@
-       $(AR) $(AR_OUT)$@ $(ALL_DEPS)
-$(TLIB1):       $(OBJ1)
-       - $(DEL) $@
-       $(AR) $(AR_OUT)$@ $(ALL_DEPS)
-$(TLIB2):      $(OBJ2)
-       - $(DEL) $@
-       $(AR) $(AR_OUT)$@ $(ALL_DEPS)
-
-#
-# Place lastfile.$(O) in its own library so that it can be loaded after
-# the source libraries but before any system libraries.  Doing so defines
-# the end of Emacs' data section portably across compilers and systems.
-#
-$(TLASTLIB):   $(BLD)/lastfile.$(O)
-       - $(DEL) $@
-       $(AR) $(AR_OUT)$@ $(ALL_DEPS)
-
-#
-# Assuming INSTALL_DIR is defined, build and install emacs in it.
-#
-install:        $(ALL)
-       - mkdir "$(INSTALL_DIR)/bin"
-       $(CP) $(EMACS) $(INSTALL_DIR)/bin
-
-#
-# Maintenance
-#
-# We used to delete *~, s/*~, m/*~ here, but that might inadvertently
-# remove precious files if it happens to match their short 8+3 aliases.
-clean:
-       - $(DEL) "s/*.h~" "m/*.h~"
-       - $(DEL) $(COMPILER_TEMP_FILES)
-       - $(DEL_TREE) $(OBJDIR)
-       - $(DEL) stamp_BLD gl-stamp globals.h
-       - $(DEL) buildobj.h
-
-distclean:     cleanall
-       - $(DEL) config.h epaths.h Makefile
-
-maintainer-clean: distclean
-       - $(DEL) TAGS
-
-cleanall:      clean
-       - $(DEL_TREE) obj
-       - $(DEL_TREE) obj-spd
-       - $(DEL_TREE) oo
-       - $(DEL_TREE) oo-spd
-
-## Arrange to make a tags table TAGS-LISP for ../lisp,
-## plus TAGS for the C files, which includes ../lisp/TAGS by reference.
-##
-## This works only with GNU Make.
-
-TAGS: $(OBJ0) $(OBJ1) $(OBJ2) $(CURDIR)/../nt/inc/ms-w32.h
-       $(MAKE) $(MFLAGS) TAGS-$(MAKETYPE)
-
-TAGS-LISP: $(OBJ0) $(OBJ1) $(OBJ2)
-       $(MAKE) $(MFLAGS) TAGS-LISP-$(MAKETYPE)
-
-TAGS-gmake:
-       ../lib-src/$(BLD)/etags.exe --include=TAGS-LISP --include=../nt/TAGS \
-         address@hidden/nt/emacs-src.tags \
-         $(OBJ0_c)
-       ../lib-src/$(BLD)/etags.exe -a address@hidden/nt/emacs-src.tags \
-         $(OBJ1_c)
-       ../lib-src/$(BLD)/etags.exe -a address@hidden/nt/emacs-src.tags \
-         $(OBJ2_c) \
-         $(CURDIR)/*.h $(CURDIR)/../nt/inc/ms-w32.h
-
-TAGS-nmake:
-       echo This target is not supported with NMake
-       exit -1
-
-frc:
-TAGS-LISP-gmake: frc
-       $(MAKE) $(MFLAGS) -C ../lisp TAGS-LISP DEST=../src
-
-TAGS-LISP-nmake:
-       echo This target is not supported with NMake
-       exit -1
-
-../nt/TAGS: frc
-       $(MAKE) $(MFLAGS) nt-TAGS-$(MAKETYPE)
-
-nt-TAGS-gmake:
-       $(MAKE) $(MFLAGS) -C ../nt TAGS
-
-nt-TAGS-nmake:
-       echo This target is not supported with NMake
-       exit -1
-
-full-tags: TAGS TAGS-LISP ../nt/TAGS
-.PHONY: full-tags
-
-### DEPENDENCIES ###
-
-EMACS_ROOT = ..
-GNU_LIB = $(EMACS_ROOT)/lib
-NT_INC = $(EMACS_ROOT)/nt/inc
-
-ACL_H         = $(GNU_LIB)/acl.h \
-                $(NT_INC)/sys/stat.h \
-                $(NT_INC)/stdbool.h
-SYSTIME_H      = $(SRC)/systime.h \
-                $(NT_INC)/sys/time.h \
-                $(GNU_LIB)/timespec.h
-ATIMER_H       = $(SRC)/atimer.h \
-                $(NT_INC)/stdbool.h \
-                $(SYSTIME_H)
-BUFFER_H       = $(SRC)/buffer.h \
-                $(SYSTIME_H)
-C_CTYPE_H      = $(GNU_LIB)/c-ctype.h \
-                $(NT_INC)/stdbool.h
-CAREADLINKAT_H = $(GNU_LIB)/careadlinkat.h \
-                $(NT_INC)/unistd.h
-CHARACTER_H    = $(SRC)/character.h \
-                $(GNU_LIB)/verify.h
-CCL_H          = $(SRC)/ccl.h \
-                $(CHARACTER_H)
-CHARSET_H      = $(SRC)/charset.h \
-                $(GNU_LIB)/verify.h
-CODING_H       = $(SRC)/coding.h \
-                $(SRC)/composite.h
-MS_W32_H       = $(NT_INC)/ms-w32.h \
-                $(NT_INC)/sys/stat.h
-CONF_POST_H    = $(SRC)/conf_post.h \
-                $(MS_W32_H)
-CONFIG_H       = $(SRC)/config.h \
-                $(CONF_POST_H)
-W32GUI_H       = $(SRC)/w32gui.h \
-                $(SYSTIME_H)
-DISPEXTERN_H   = $(SRC)/dispextern.h \
-                $(GNU_LIB)/c-strcase.h \
-                $(SYSTIME_H) \
-                $(W32GUI_H)
-FILEMODE_H     = $(GNU_LIB)/filemode.h \
-                $(NT_INC)/sys/stat.h
-FRAME_H        = $(SRC)/frame.h \
-                $(DISPEXTERN_H)
-FONT_H         = $(SRC)/font.h \
-                $(CCL_H) \
-                $(FRAME_H)
-FTOASTR_H      = $(GNU_LIB)/ftoastr.h \
-                $(GNU_LIB)/intprops.h
-GRP_H          = $(NT_INC)/grp.h \
-                $(NT_INC)/pwd.h
-INTERVALS_H    = $(SRC)/intervals.h \
-                $(SRC)/composite.h \
-                $(DISPEXTERN_H)
-INTTYPES_H     = $(NT_INC)/inttypes.h \
-                $(NT_INC)/stdint.h
-KEYBOARD_H     = $(SRC)/keyboard.h \
-                $(CODING_H) \
-                $(SYSTIME_H)
-LANGINFO_H     = $(NT_INC)/langinfo.h \
-                $(NT_INC)/nl_types.h
-LISP_H         = $(SRC)/lisp.h \
-                $(SRC)/globals.h \
-                $(GNU_LIB)/intprops.h \
-                $(INTTYPES_H) \
-                $(NT_INC)/stdalign.h \
-                $(NT_INC)/stdbool.h
-MD5_H          = $(GNU_LIB)/md5.h \
-                $(NT_INC)/stdint.h
-MENU_H         = $(SRC)/menu.h \
-                $(SYSTIME_H)
-PROCESS_H      = $(SRC)/process.h \
-                $(SRC)/gnutls.h \
-                $(NT_INC)/unistd.h
-SHA1_H         = $(GNU_LIB)/sha1.h \
-                $(NT_INC)/stdint.h
-SHA256_H       = $(GNU_LIB)/sha256.h \
-                $(NT_INC)/stdint.h
-U64_H          = $(GNU_LIB)/u64.h \
-                $(NT_INC)/stdint.h
-SHA512_H       = $(GNU_LIB)/sha512.h \
-                $(U64_H)
-SIG2STR_H      = $(GNU_LIB)/sig2str.h \
-                $(GNU_LIB)/intprops.h
-SOCKET_H       = $(NT_INC)/sys/socket.h \
-                $(SRC)/w32.h
-STAT_TIME_H    = $(GNU_LIB)/stat-time.h \
-                $(NT_INC)/sys/stat.h
-SYSSIGNAL_H    = $(SRC)/syssignal.h \
-                $(NT_INC)/stdbool.h
-SYSTTY_H       = $(SRC)/systty.h \
-                $(NT_INC)/sys/ioctl.h \
-                $(NT_INC)/unistd.h
-SYSWAIT_H      = $(SRC)/syswait.h \
-                $(NT_INC)/stdbool.h \
-                $(NT_INC)/sys/wait.h
-TERMHOOKS_H    = $(SRC)/termhooks.h \
-                $(SYSTIME_H)
-W32FONT_H      = $(SRC)/w32font.h \
-                $(FONT_H)
-W32TERM_H      = $(SRC)/w32term.h \
-                $(ATIMER_H) \
-                $(FRAME_H) \
-                $(W32GUI_H)
-WINDOW_H       = $(SRC)/window.h \
-                $(DISPEXTERN_H)
-
-$(BLD)/alloc.$(O) : \
-       $(SRC)/alloc.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/puresize.h \
-       $(SRC)/w32.h \
-       $(SRC)/w32heap.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/verify.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(TERMHOOKS_H) \
-       $(WINDOW_H)
-
-$(BLD)/atimer.$(O) : \
-       $(SRC)/atimer.c \
-       $(SRC)/blockinput.h \
-       $(NT_INC)/unistd.h \
-       $(ATIMER_H) \
-       $(CONFIG_H) \
-       $(LISP_H) \
-       $(SYSSIGNAL_H) \
-       $(SYSTIME_H)
-
-$(BLD)/bidi.$(O) : \
-       $(SRC)/bidi.c \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(LISP_H)
-
-$(BLD)/buffer.$(O) : \
-       $(SRC)/buffer.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/indent.h \
-       $(SRC)/keymap.h \
-       $(SRC)/region-cache.h \
-       $(NT_INC)/sys/param.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/verify.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(WINDOW_H)
-
-$(BLD)/bytecode.$(O) : \
-       $(SRC)/bytecode.c \
-       $(SRC)/syntax.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(LISP_H) \
-       $(WINDOW_H)
-
-$(BLD)/callint.$(O) : \
-       $(SRC)/callint.c \
-       $(SRC)/commands.h \
-       $(SRC)/keymap.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(WINDOW_H)
-
-$(BLD)/callproc.$(O) : \
-       $(SRC)/callproc.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/composite.h \
-       $(SRC)/epaths.h \
-       $(SRC)/w32.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/unistd.h \
-       $(BUFFER_H) \
-       $(CCL_H) \
-       $(CHARACTER_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(SYSSIGNAL_H) \
-       $(SYSTTY_H) \
-       $(SYSWAIT_H) \
-       $(TERMHOOKS_H)
-
-$(BLD)/casefiddle.$(O) : \
-       $(SRC)/casefiddle.c \
-       $(SRC)/commands.h \
-       $(SRC)/composite.h \
-       $(SRC)/keymap.h \
-       $(SRC)/syntax.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/casetab.$(O) : \
-       $(SRC)/casetab.c \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/category.$(O) : \
-       $(SRC)/category.c \
-       $(SRC)/category.h \
-       $(SRC)/keymap.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/ccl.$(O) : \
-       $(SRC)/ccl.c \
-       $(CCL_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/character.$(O) : \
-       $(SRC)/character.c \
-       $(SRC)/composite.h \
-       $(SRC)/disptab.h \
-       $(GNU_LIB)/intprops.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/charset.$(O) : \
-       $(SRC)/charset.c \
-       $(SRC)/disptab.h \
-       $(NT_INC)/unistd.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(C_CTYPE_H) \
-       $(LISP_H)
-
-$(BLD)/chartab.$(O) : \
-       $(SRC)/chartab.c \
-       $(CCL_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/cmds.$(O) : \
-       $(SRC)/cmds.c \
-       $(SRC)/commands.h \
-       $(SRC)/keymap.h \
-       $(SRC)/syntax.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(WINDOW_H)
-
-$(BLD)/coding.$(O) : \
-       $(SRC)/coding.c \
-       $(SRC)/composite.h \
-       $(BUFFER_H) \
-       $(CCL_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(WINDOW_H)
-
-$(BLD)/composite.$(O) : \
-       $(SRC)/composite.c \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(WINDOW_H)
-
-$(BLD)/data.$(O) : \
-       $(SRC)/data.c \
-       $(SRC)/keymap.h \
-       $(SRC)/puresize.h \
-       $(GNU_LIB)/intprops.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(SYSSIGNAL_H) \
-       $(TERMHOOKS_H)
-
-$(BLD)/dired.$(O) : \
-       $(SRC)/dired.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/regex.h \
-       $(NT_INC)/dirent.h \
-       $(NT_INC)/pwd.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(FILEMODE_H) \
-       $(GRP_H) \
-       $(LISP_H) \
-       $(STAT_TIME_H) \
-       $(SYSTIME_H)
-
-$(BLD)/dispnew.$(O) : \
-       $(SRC)/dispnew.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/cm.h \
-       $(SRC)/commands.h \
-       $(SRC)/disptab.h \
-       $(SRC)/indent.h \
-       $(SRC)/termchar.h \
-       $(SRC)/w32.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/fpending.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(SYSSIGNAL_H) \
-       $(SYSTIME_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/doc.$(O) : \
-       $(SRC)/doc.c \
-       $(SRC)/buildobj.h \
-       $(SRC)/keymap.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/unistd.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(C_CTYPE_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H)
-
-$(BLD)/doprnt.$(O) : \
-       $(SRC)/doprnt.c \
-       $(NT_INC)/unistd.h \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/editfns.$(O) : \
-       $(SRC)/editfns.c \
-       $(SRC)/blockinput.h \
-       $(NT_INC)/pwd.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/intprops.h \
-       $(GNU_LIB)/strftime.h \
-       $(GNU_LIB)/verify.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(GRP_H) \
-       $(INTERVALS_H) \
-       $(LISP_H) \
-       $(SYSTIME_H) \
-       $(WINDOW_H)
-
-$(BLD)/emacs.$(O) : \
-       $(SRC)/emacs.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/gnutls.h \
-       $(SRC)/keymap.h \
-       $(SRC)/unexec.h \
-       $(SRC)/w32.h \
-       $(SRC)/w32common.h \
-       $(SRC)/w32heap.h \
-       $(SRC)/w32select.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/close-stream.h \
-       $(ATIMER_H) \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(SYSSIGNAL_H) \
-       $(SYSTTY_H) \
-       $(TERMHOOKS_H) \
-       $(W32FONT_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/eval.$(O) : \
-       $(SRC)/eval.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H)
-
-$(BLD)/fileio.$(O) : \
-       $(SRC)/fileio.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/w32.h \
-       $(NT_INC)/pwd.h \
-       $(NT_INC)/sys/acl.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/allocator.h \
-       $(ACL_H) \
-       $(BUFFER_H) \
-       $(CAREADLINKAT_H) \
-       $(CHARACTER_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(C_CTYPE_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(LISP_H) \
-       $(STAT_TIME_H) \
-       $(SYSTIME_H) \
-       $(WINDOW_H)
-
-$(BLD)/filelock.$(O) : \
-       $(SRC)/filelock.c \
-       $(SRC)/w32.h \
-       $(NT_INC)/pwd.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(C_CTYPE_H) \
-       $(LISP_H) \
-       $(SYSTIME_H)
-
-$(BLD)/firstfile.$(O) : \
-       $(SRC)/firstfile.c \
-       $(CONFIG_H)
-
-$(BLD)/floatfns.$(O) : \
-       $(SRC)/floatfns.c \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/fns.$(O) : \
-       $(SRC)/fns.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/keymap.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/intprops.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LANGINFO_H) \
-       $(LISP_H) \
-       $(MD5_H) \
-       $(SHA1_H) \
-       $(SHA256_H) \
-       $(SHA512_H) \
-       $(WINDOW_H)
-
-$(BLD)/font.$(O) : \
-       $(SRC)/font.c \
-       $(SRC)/composite.h \
-       $(SRC)/fontset.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(C_CTYPE_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(LISP_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/fontset.$(O) : \
-       $(SRC)/fontset.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/fontset.h \
-       $(BUFFER_H) \
-       $(CCL_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/frame.$(O) : \
-       $(SRC)/frame.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/fontset.h \
-       $(SRC)/termchar.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(C_CTYPE_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/fringe.$(O) : \
-       $(SRC)/fringe.c \
-       $(SRC)/blockinput.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(WINDOW_H)
-
-$(BLD)/gmalloc.$(O) : \
-       $(SRC)/gmalloc.c \
-       $(SRC)/w32heap.h \
-       $(NT_INC)/stdint.h \
-       $(NT_INC)/unistd.h \
-       $(CONFIG_H)
-
-$(BLD)/gnutls.$(O) : \
-       $(SRC)/gnutls.c \
-       $(SRC)/w32.h \
-       $(CONFIG_H) \
-       $(LISP_H) \
-       $(PROCESS_H)
-
-$(BLD)/xml.$(O) : \
-       $(SRC)/xml.c \
-       $(SRC)/w32.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/profiler.$(O) : \
-       $(SRC)/profiler.c \
-       $(CONFIG_H) \
-       $(LISP_H) \
-       $(SYSSIGNAL_H) \
-       $(SYSTIME_H)
-
-$(BLD)/image.$(O) : \
-       $(SRC)/image.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/epaths.h \
-       $(SRC)/w32.h \
-       $(NT_INC)/unistd.h \
-       $(CHARACTER_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(C_CTYPE_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(LISP_H) \
-       $(SYSTIME_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/indent.$(O) : \
-       $(SRC)/indent.c \
-       $(SRC)/category.h \
-       $(SRC)/composite.h \
-       $(SRC)/disptab.h \
-       $(SRC)/indent.h \
-       $(SRC)/region-cache.h \
-       $(SRC)/termchar.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(WINDOW_H)
-
-$(BLD)/insdel.$(O) : \
-       $(SRC)/insdel.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/region-cache.h \
-       $(GNU_LIB)/intprops.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(INTERVALS_H) \
-       $(LISP_H) \
-       $(WINDOW_H)
-
-$(BLD)/intervals.$(O) : \
-       $(SRC)/intervals.c \
-       $(SRC)/keymap.h \
-       $(SRC)/puresize.h \
-       $(GNU_LIB)/intprops.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H)
-
-$(BLD)/keyboard.$(O) : \
-       $(SRC)/keyboard.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/disptab.h \
-       $(SRC)/keymap.h \
-       $(SRC)/macros.h \
-       $(SRC)/puresize.h \
-       $(SRC)/syntax.h \
-       $(SRC)/termchar.h \
-       $(SRC)/termopts.h \
-       $(NT_INC)/sys/ioctl.h \
-       $(NT_INC)/unistd.h \
-       $(ATIMER_H) \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(SYSSIGNAL_H) \
-       $(SYSTIME_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/keymap.$(O) : \
-       $(SRC)/keymap.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/keymap.h \
-       $(SRC)/puresize.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(WINDOW_H)
-
-$(BLD)/lastfile.$(O) : \
-       $(SRC)/lastfile.c \
-       $(CONFIG_H)
-
-$(BLD)/lread.$(O) : \
-       $(SRC)/lread.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/epaths.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(STAT_TIME_H) \
-       $(TERMHOOKS_H)
-
-$(BLD)/macros.$(O) : \
-       $(SRC)/macros.c \
-       $(SRC)/commands.h \
-       $(SRC)/macros.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(WINDOW_H)
-
-$(BLD)/marker.$(O) : \
-       $(SRC)/marker.c \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/menu.$(O) : \
-       $(SRC)/menu.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/keymap.h \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(MENU_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/minibuf.$(O) : \
-       $(SRC)/minibuf.c \
-       $(SRC)/commands.h \
-       $(SRC)/keymap.h \
-       $(SRC)/syntax.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(WINDOW_H)
-
-$(BLD)/w32.$(O) : \
-       $(SRC)/w32.c \
-       $(SRC)/w32.h \
-       $(SRC)/w32common.h \
-       $(SRC)/w32heap.h \
-       $(SRC)/w32select.h \
-       $(NT_INC)/dirent.h \
-       $(NT_INC)/pwd.h \
-       $(NT_INC)/sys/acl.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/sys/time.h \
-       $(GNU_LIB)/allocator.h \
-       $(CAREADLINKAT_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(GRP_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(SOCKET_H) \
-       $(SYSTIME_H)
-
-$(BLD)/w32heap.$(O) : \
-       $(SRC)/w32heap.c \
-       $(SRC)/w32common.h \
-       $(SRC)/w32heap.h \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/w32inevt.$(O) : \
-       $(SRC)/w32inevt.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/termchar.h \
-       $(SRC)/w32heap.h \
-       $(SRC)/w32inevt.h \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/w32proc.$(O) : \
-       $(SRC)/w32proc.c \
-       $(SRC)/w32.h \
-       $(SRC)/w32common.h \
-       $(SRC)/w32heap.h \
-       $(NT_INC)/nl_types.h \
-       $(NT_INC)/sys/file.h \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(LANGINFO_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(SYSSIGNAL_H) \
-       $(SYSTIME_H) \
-       $(SYSWAIT_H) \
-       $(W32TERM_H)
-
-$(BLD)/w32console.$(O) : \
-       $(SRC)/w32console.c \
-       $(SRC)/disptab.h \
-       $(SRC)/termchar.h \
-       $(SRC)/w32common.h \
-       $(SRC)/w32inevt.h \
-       $(CHARACTER_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/print.$(O) : \
-       $(SRC)/print.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/termchar.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(FTOASTR_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(TERMHOOKS_H) \
-       $(WINDOW_H)
-
-$(BLD)/process.$(O) : \
-       $(SRC)/process.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/composite.h \
-       $(SRC)/gnutls.h \
-       $(SRC)/sysselect.h \
-       $(SRC)/termopts.h \
-       $(NT_INC)/arpa/inet.h \
-       $(NT_INC)/netdb.h \
-       $(NT_INC)/netinet/in.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/sys/ioctl.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(ATIMER_H) \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(C_CTYPE_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(SIG2STR_H) \
-       $(SOCKET_H) \
-       $(SYSSIGNAL_H) \
-       $(SYSTIME_H) \
-       $(SYSTTY_H) \
-       $(SYSWAIT_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/ralloc.$(O) : \
-       $(SRC)/ralloc.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/getpagesize.h \
-       $(NT_INC)/unistd.h \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/regex.$(O) : \
-       $(SRC)/regex.c \
-       $(SRC)/category.h \
-       $(SRC)/regex.h \
-       $(SRC)/syntax.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/region-cache.$(O) : \
-       $(SRC)/region-cache.c \
-       $(SRC)/region-cache.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/scroll.$(O) : \
-       $(SRC)/scroll.c \
-       $(SRC)/termchar.h \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(WINDOW_H)
-
-$(BLD)/search.$(O) : \
-       $(SRC)/search.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/category.h \
-       $(SRC)/commands.h \
-       $(SRC)/regex.h \
-       $(SRC)/region-cache.h \
-       $(SRC)/syntax.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(INTERVALS_H) \
-       $(LISP_H)
-
-$(BLD)/sound.$(O) : \
-       $(SRC)/sound.c \
-       $(NT_INC)/unistd.h \
-       $(ATIMER_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(LISP_H) \
-       $(SYSSIGNAL_H)
-
-$(BLD)/syntax.$(O) : \
-       $(SRC)/syntax.c \
-       $(SRC)/category.h \
-       $(SRC)/commands.h \
-       $(SRC)/keymap.h \
-       $(SRC)/regex.h \
-       $(SRC)/syntax.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(INTERVALS_H) \
-       $(LISP_H)
-
-$(BLD)/sysdep.$(O) : \
-       $(SRC)/sysdep.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/cm.h \
-       $(SRC)/sysselect.h \
-       $(SRC)/termchar.h \
-       $(SRC)/termopts.h \
-       $(NT_INC)/netdb.h \
-       $(NT_INC)/pwd.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/sys/param.h \
-       $(NT_INC)/sys/stat.h \
-       $(NT_INC)/unistd.h \
-       $(GNU_LIB)/execinfo.h \
-       $(GNU_LIB)/utimens.h \
-       $(CONFIG_H) \
-       $(C_CTYPE_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(GRP_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(SOCKET_H) \
-       $(SYSSIGNAL_H) \
-       $(SYSTIME_H) \
-       $(SYSTTY_H) \
-       $(SYSWAIT_H) \
-       $(TERMHOOKS_H) \
-       $(WINDOW_H)
-
-$(BLD)/term.$(O) : \
-       $(SRC)/term.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/cm.h \
-       $(SRC)/composite.h \
-       $(SRC)/disptab.h \
-       $(SRC)/keymap.h \
-       $(SRC)/termchar.h \
-       $(SRC)/tparam.h \
-       $(NT_INC)/sys/file.h \
-       $(NT_INC)/sys/time.h \
-       $(NT_INC)/unistd.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(SYSSIGNAL_H) \
-       $(SYSTTY_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/terminal.$(O) : \
-       $(SRC)/terminal.c \
-       $(SRC)/termchar.h \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H)
-
-$(BLD)/textprop.$(O) : \
-       $(SRC)/textprop.c \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(INTERVALS_H) \
-       $(LISP_H) \
-       $(WINDOW_H)
-
-$(BLD)/tparam.$(O) : \
-       $(SRC)/tparam.c \
-       $(SRC)/tparam.h \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/undo.$(O) : \
-       $(SRC)/undo.c \
-       $(SRC)/commands.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(LISP_H) \
-       $(WINDOW_H)
-
-$(BLD)/unexw32.$(O) : \
-       $(SRC)/unexw32.c \
-       $(SRC)/unexec.h \
-       $(SRC)/w32.h \
-       $(SRC)/w32common.h \
-       $(SRC)/w32heap.h \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/vm-limit.$(O) : \
-       $(SRC)/vm-limit.c \
-       $(SRC)/w32heap.h \
-       $(NT_INC)/unistd.h \
-       $(CONFIG_H) \
-       $(LISP_H)
-
-$(BLD)/window.$(O) : \
-       $(SRC)/window.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/disptab.h \
-       $(SRC)/indent.h \
-       $(SRC)/keymap.h \
-       $(SRC)/termchar.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/xdisp.$(O) : \
-       $(SRC)/xdisp.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/commands.h \
-       $(SRC)/disptab.h \
-       $(SRC)/fontset.h \
-       $(SRC)/indent.h \
-       $(SRC)/keymap.h \
-       $(SRC)/macros.h \
-       $(SRC)/region-cache.h \
-       $(SRC)/termchar.h \
-       $(SRC)/termopts.h \
-       $(ATIMER_H) \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/xfaces.$(O) : \
-       $(SRC)/xfaces.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/fontset.h \
-       $(SRC)/termchar.h \
-       $(NT_INC)/sys/stat.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(C_CTYPE_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/w32fns.$(O) : \
-       $(SRC)/w32fns.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/epaths.h \
-       $(SRC)/fontset.h \
-       $(SRC)/w32.h \
-       $(SRC)/w32common.h \
-       $(SRC)/w32heap.h \
-       $(NT_INC)/unistd.h \
-       $(BUFFER_H) \
-       $(CCL_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(SYSTIME_H) \
-       $(TERMHOOKS_H) \
-       $(W32FONT_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/w32menu.$(O) : \
-       $(SRC)/w32menu.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/keymap.h \
-       $(SRC)/w32common.h \
-       $(BUFFER_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(MENU_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/w32term.$(O) : \
-       $(SRC)/w32term.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/disptab.h \
-       $(SRC)/fontset.h \
-       $(SRC)/keymap.h \
-       $(SRC)/termchar.h \
-       $(SRC)/termopts.h \
-       $(SRC)/w32heap.h \
-       $(NT_INC)/sys/stat.h \
-       $(ATIMER_H) \
-       $(BUFFER_H) \
-       $(CCL_H) \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(INTERVALS_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(PROCESS_H) \
-       $(SYSTIME_H) \
-       $(SYSTTY_H) \
-       $(TERMHOOKS_H) \
-       $(W32FONT_H) \
-       $(W32TERM_H) \
-       $(WINDOW_H)
-
-$(BLD)/w32select.$(O) : \
-       $(SRC)/w32select.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/composite.h \
-       $(SRC)/w32common.h \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(W32TERM_H)
-
-$(BLD)/w32reg.$(O) : \
-       $(SRC)/w32reg.c \
-       $(SRC)/blockinput.h \
-       $(CONFIG_H) \
-       $(LISP_H) \
-       $(W32TERM_H)
-
-$(BLD)/w32xfns.$(O) : \
-       $(SRC)/w32xfns.c \
-       $(SRC)/blockinput.h \
-       $(SRC)/fontset.h \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(W32TERM_H)
-
-$(BLD)/w32font.$(O) : \
-       $(SRC)/w32font.c \
-       $(SRC)/fontset.h \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(LISP_H) \
-       $(W32FONT_H) \
-       $(W32TERM_H)
-
-$(BLD)/w32uniscribe.$(O) : \
-       $(SRC)/w32uniscribe.c \
-       $(SRC)/composite.h \
-       $(SRC)/fontset.h \
-       $(CHARACTER_H) \
-       $(CHARSET_H) \
-       $(CONFIG_H) \
-       $(DISPEXTERN_H) \
-       $(FONT_H) \
-       $(FRAME_H) \
-       $(LISP_H) \
-       $(W32FONT_H) \
-       $(W32TERM_H)
-
-$(BLD)/w32notify.$(O) : \
-       $(SRC)/w32notify.c \
-       $(SRC)/w32.h \
-       $(SRC)/w32common.h \
-       $(CODING_H) \
-       $(CONFIG_H) \
-       $(FRAME_H) \
-       $(KEYBOARD_H) \
-       $(LISP_H) \
-       $(TERMHOOKS_H) \
-       $(W32TERM_H)
-
-# Each object file depends on stamp_BLD, because in parallel builds we must
-# make sure $(BLD) exists before starting compilations.
-#
-$(OBJ0) $(OBJ1) $(OBJ2) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD
diff --git a/src/menu.c b/src/menu.c
index e925f29..e36fe26 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -276,7 +276,6 @@ single_keymap_panes (Lisp_Object keymap, Lisp_Object 
pane_name,
                     Lisp_Object prefix, int maxdepth)
 {
   struct skp skp;
-  struct gcpro gcpro1;
 
   skp.pending_maps = Qnil;
   skp.maxdepth = maxdepth;
@@ -296,9 +295,7 @@ single_keymap_panes (Lisp_Object keymap, Lisp_Object 
pane_name,
       skp.notbuttons = menu_items_used;
     }
 
-  GCPRO1 (skp.pending_maps);
   map_keymap_canonical (keymap, single_menu_item, Qnil, &skp);
-  UNGCPRO;
 
   /* Process now any submenus which want to be panes at this level.  */
   while (CONSP (skp.pending_maps))
@@ -325,14 +322,11 @@ static void
 single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void 
*skp_v)
 {
   Lisp_Object map, item_string, enabled;
-  struct gcpro gcpro1, gcpro2;
   bool res;
   struct skp *skp = skp_v;
 
   /* Parse the menu item and leave the result in item_properties.  */
-  GCPRO2 (key, item);
   res = parse_menu_item (item, 0);
-  UNGCPRO;
   if (!res)
     return;                    /* Not a menu item.  */
 
@@ -1177,7 +1171,6 @@ no quit occurs and `x-popup-menu' returns nil.  */)
   Lisp_Object x, y, window;
   int menuflags = 0;
   ptrdiff_t specpdl_count = SPECPDL_INDEX ();
-  struct gcpro gcpro1;
 
   if (NILP (position))
     /* This is an obsolete call, which wants us to precompute the
@@ -1329,7 +1322,6 @@ no quit occurs and `x-popup-menu' returns nil.  */)
   record_unwind_protect_void (unuse_menu_items);
 
   title = Qnil;
-  GCPRO1 (title);
 
   /* Decode the menu items from what was specified.  */
 
@@ -1422,7 +1414,6 @@ no quit occurs and `x-popup-menu' returns nil.  */)
     {
       discard_menu_items ();
       FRAME_DISPLAY_INFO (f)->grabbed = 0;
-      UNGCPRO;
       return Qnil;
     }
 #endif
@@ -1449,8 +1440,6 @@ no quit occurs and `x-popup-menu' returns nil.  */)
     FRAME_DISPLAY_INFO (f)->grabbed = 0;
 #endif
 
-  UNGCPRO;
-
   if (error_name) error ("%s", error_name);
   return selection;
 }
diff --git a/src/minibuf.c b/src/minibuf.c
index 03be8d1..cf0cbca 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -150,12 +150,9 @@ static void run_exit_minibuf_hook (void);
 static Lisp_Object
 string_to_object (Lisp_Object val, Lisp_Object defalt)
 {
-  struct gcpro gcpro1, gcpro2;
   Lisp_Object expr_and_pos;
   ptrdiff_t pos;
 
-  GCPRO2 (val, defalt);
-
   if (STRINGP (val) && SCHARS (val) == 0)
     {
       if (STRINGP (defalt))
@@ -181,7 +178,7 @@ string_to_object (Lisp_Object val, Lisp_Object defalt)
     }
 
   val = Fcar (expr_and_pos);
-  RETURN_UNGCPRO (val);
+  return val;
 }
 
 
@@ -384,7 +381,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
   Lisp_Object val;
   ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object mini_frame, ambient_dir, minibuffer, input_method;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   Lisp_Object enable_multibyte;
   EMACS_INT pos = 0;
   /* String to add to the history.  */
@@ -437,11 +433,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
   input_method = Qnil;
   enable_multibyte = Qnil;
 
-  /* Don't need to protect PROMPT, HISTVAR, and HISTPOS because we
-     store them away before we can GC.  Don't need to protect
-     BACKUP_N because we use the value only if it is an integer.  */
-  GCPRO5 (map, initial, val, ambient_dir, input_method);
-
   if (!STRINGP (prompt))
     prompt = empty_unibyte_string;
 
@@ -466,7 +457,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
                                         make_number (pos),
                                         expflag, histvar, histpos, defalt,
                                         allow_props, inherit_input_method);
-      UNGCPRO;
       return unbind_to (count, val);
     }
 
@@ -758,7 +748,6 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, 
Lisp_Object prompt,
 
   /* The appropriate frame will get selected
      in set-window-configuration.  */
-  UNGCPRO;
   return unbind_to (count, val);
 }
 
@@ -936,7 +925,6 @@ and some related functions, which use zero-indexing for 
POSITION.  */)
   (Lisp_Object prompt, Lisp_Object initial_contents, Lisp_Object keymap, 
Lisp_Object read, Lisp_Object hist, Lisp_Object default_value, Lisp_Object 
inherit_input_method)
 {
   Lisp_Object histvar, histpos, val;
-  struct gcpro gcpro1;
 
   CHECK_STRING (prompt);
   if (NILP (keymap))
@@ -959,13 +947,11 @@ and some related functions, which use zero-indexing for 
POSITION.  */)
   if (NILP (histpos))
     XSETFASTINT (histpos, 0);
 
-  GCPRO1 (default_value);
   val = read_minibuf (keymap, initial_contents, prompt,
                      !NILP (read),
                      histvar, histpos, default_value,
                      minibuffer_allow_text_properties,
                      !NILP (inherit_input_method));
-  UNGCPRO;
   return val;
 }
 
@@ -1212,7 +1198,6 @@ is used to further constrain the set of candidates.  */)
   int matchcount = 0;
   ptrdiff_t bindcount = -1;
   Lisp_Object bucket, zero, end, tem;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
   CHECK_STRING (string);
   if (type == function_table)
@@ -1325,13 +1310,11 @@ is used to further constrain the set of candidates.  */)
                      unbind_to (bindcount, Qnil);
                      bindcount = -1;
                    }
-                 GCPRO4 (tail, string, eltstring, bestmatch);
                  tem = (type == hash_table
                         ? call2 (predicate, elt,
                                  HASH_VALUE (XHASH_TABLE (collection),
                                              idx - 1))
                         : call1 (predicate, elt));
-                 UNGCPRO;
                }
              if (NILP (tem)) continue;
            }
@@ -1469,7 +1452,6 @@ with a space are ignored unless STRING itself starts with 
a space.  */)
   ptrdiff_t idx = 0, obsize = 0;
   ptrdiff_t bindcount = -1;
   Lisp_Object bucket, tem, zero;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
   CHECK_STRING (string);
   if (type == 0)
@@ -1587,12 +1569,10 @@ with a space are ignored unless STRING itself starts 
with a space.  */)
                    unbind_to (bindcount, Qnil);
                    bindcount = -1;
                  }
-                 GCPRO4 (tail, eltstring, allmatches, string);
                  tem = type == 3
                    ? call2 (predicate, elt,
                             HASH_VALUE (XHASH_TABLE (collection), idx - 1))
                    : call1 (predicate, elt);
-                 UNGCPRO;
                }
              if (NILP (tem)) continue;
            }
diff --git a/src/nsfns.m b/src/nsfns.m
index 0fc867c..89b9f7c 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -408,14 +408,11 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, 
Lisp_Object oldval)
 static void
 ns_set_name_internal (struct frame *f, Lisp_Object name)
 {
-  struct gcpro gcpro1;
   Lisp_Object encoded_name, encoded_icon_name;
   NSString *str;
   NSView *view = FRAME_NS_VIEW (f);
 
-  GCPRO1 (name);
   encoded_name = ENCODE_UTF_8 (name);
-  UNGCPRO;
 
   str = [NSString stringWithUTF8String: SSDATA (encoded_name)];
 
@@ -534,7 +531,6 @@ ns_set_name_as_filename (struct frame *f)
   Lisp_Object buf = XWINDOW (f->selected_window)->contents;
   const char *title;
   NSAutoreleasePool *pool;
-  struct gcpro gcpro1;
   Lisp_Object encoded_name, encoded_filename;
   NSString *str;
   NSTRACE (ns_set_name_as_filename);
@@ -555,9 +551,7 @@ ns_set_name_as_filename (struct frame *f)
         name = build_string ([ns_app_name UTF8String]);
     }
 
-  GCPRO1 (name);
   encoded_name = ENCODE_UTF_8 (name);
-  UNGCPRO;
 
   view = FRAME_NS_VIEW (f);
 
@@ -582,9 +576,7 @@ ns_set_name_as_filename (struct frame *f)
 
       if (! NILP (filename))
         {
-          GCPRO1 (filename);
           encoded_filename = ENCODE_UTF_8 (filename);
-          UNGCPRO;
 
           fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)];
           if (fstr == nil) fstr = @"";
@@ -1085,7 +1077,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
   int minibuffer_only = 0;
   long window_prompting = 0;
   ptrdiff_t count = specpdl_ptr - specpdl;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   Lisp_Object display;
   struct ns_display_info *dpyinfo = NULL;
   Lisp_Object parent;
@@ -1127,7 +1118,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
   /* No need to protect DISPLAY because that's not used after passing
      it to make_frame_without_minibuffer.  */
   frame = Qnil;
-  GCPRO4 (parms, parent, name, frame);
   tem = x_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer", "Minibuffer",
                   RES_TYPE_SYMBOL);
   if (EQ (tem, Qnone) || NILP (tem))
@@ -1368,8 +1358,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
     if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
       fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
 
-  UNGCPRO;
-
   if (window_prompting & USPosition)
     x_set_offset (f, f->left_pos, f->top_pos, 1);
 
@@ -2775,7 +2763,6 @@ Text larger than the specified size is clipped.  */)
      (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object 
timeout, Lisp_Object dx, Lisp_Object dy)
 {
   int root_x, root_y;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   ptrdiff_t count = SPECPDL_INDEX ();
   struct frame *f;
   char *str;
@@ -2783,8 +2770,6 @@ Text larger than the specified size is clipped.  */)
 
   specbind (Qinhibit_redisplay, Qt);
 
-  GCPRO4 (string, parms, frame, timeout);
-
   CHECK_STRING (string);
   str = SSDATA (string);
   f = decode_window_system_frame (frame);
@@ -2820,7 +2805,6 @@ Text larger than the specified size is clipped.  */)
   [ns_tooltip showAtX: root_x Y: root_y for: XINT (timeout)];
   unblock_input ();
 
-  UNGCPRO;
   return unbind_to (count, Qnil);
 }
 
@@ -2836,91 +2820,142 @@ Value is t if tooltip was open, nil otherwise.  */)
   return Qt;
 }
 
-DEFUN ("x-frame-geometry", Fx_frame_geometry, Sx_frame_geometry, 0, 1, 0,
-       doc: /* Return geometric attributes of frame FRAME.
-
-FRAME must be a live frame and defaults to the selected one.
-
-The return value is an association list containing the following
-elements (all size values are in pixels).
-
-- `frame-outer-size' is a cons of the outer width and height of FRAME.
-  The outer size include the title bar and the external borders as well
-  as any menu and/or tool bar of frame.
-
-- `border' is a cons of the horizontal and vertical width of FRAME's
-  external borders.
-
-- `title-bar-height' is the height of the title bar of FRAME.
-
-- `menu-bar-external' if t means the menu bar is external (not
+/* Return geometric attributes of FRAME.  According to the value of
+   ATTRIBUTES return the outer edges of FRAME (Qouter_edges), the inner
+   edges of FRAME, the root window edges of frame (Qroot_edges).  Any
+   other value means to return the geometry as returned by
+   Fx_frame_geometry.  */
+static Lisp_Object
+frame_geometry (Lisp_Object frame, Lisp_Object attribute)
+{
+  struct frame *f = decode_live_frame (frame);
+  Lisp_Object fullscreen_symbol = Fframe_parameter (frame, Qfullscreen);
+  bool fullscreen = (EQ (fullscreen_symbol, Qfullboth)
+                    || EQ (fullscreen_symbol, Qfullscreen));
+  int border = fullscreen ? 0 : f->border_width;
+  int title_height = fullscreen ? 0 : FRAME_NS_TITLEBAR_HEIGHT (f);
+  int native_width = FRAME_PIXEL_WIDTH (f);
+  int native_height = FRAME_PIXEL_HEIGHT (f);
+  int outer_width = native_width + 2 * border;
+  int outer_height = native_height + 2 * border + title_height;
+  int native_left = f->left_pos + border;
+  int native_top = f->top_pos + border + title_height;
+  int native_right = f->left_pos + outer_width - border;
+  int native_bottom = f->top_pos + outer_height - border;
+  int internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
+  int tool_bar_height = FRAME_TOOLBAR_HEIGHT (f);
+  int tool_bar_width = (tool_bar_height
+                       ? outer_width - 2 * internal_border_width
+                       : 0);
+
+  /* Construct list.  */
+  if (EQ (attribute, Qouter_edges))
+    return list4 (make_number (f->left_pos), make_number (f->top_pos),
+                 make_number (f->left_pos + outer_width),
+                 make_number (f->top_pos + outer_height));
+  else if (EQ (attribute, Qnative_edges))
+    return list4 (make_number (native_left), make_number (native_top),
+                 make_number (native_right), make_number (native_bottom));
+  else if (EQ (attribute, Qinner_edges))
+    return list4 (make_number (native_left + internal_border_width),
+                 make_number (native_top
+                              + tool_bar_height
+                              + internal_border_width),
+                 make_number (native_right - internal_border_width),
+                 make_number (native_bottom - internal_border_width));
+  else
+    return
+      listn (CONSTYPE_HEAP, 10,
+            Fcons (Qouter_position,
+                   Fcons (make_number (f->left_pos),
+                          make_number (f->top_pos))),
+            Fcons (Qouter_size,
+                   Fcons (make_number (outer_width),
+                          make_number (outer_height))),
+            Fcons (Qexternal_border_size,
+                   (fullscreen
+                    ? Fcons (make_number (0), make_number (0))
+                    : Fcons (make_number (border), make_number (border)))),
+            Fcons (Qtitle_bar_size,
+                   Fcons (make_number (0), make_number (title_height))),
+            Fcons (Qmenu_bar_external, Qnil),
+            Fcons (Qmenu_bar_size, Fcons (make_number (0), make_number (0))),
+            Fcons (Qtool_bar_external,
+                   FRAME_EXTERNAL_TOOL_BAR (f) ? Qt : Qnil),
+            Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)),
+            Fcons (Qtool_bar_size,
+                   Fcons (make_number (tool_bar_width),
+                          make_number (tool_bar_height))),
+            Fcons (Qinternal_border_width,
+                   make_number (internal_border_width)));
+}
+
+DEFUN ("ns-frame-geometry", Fns_frame_geometry, Sns_frame_geometry, 0, 1, 0,
+       doc: /* Return geometric attributes of FRAME.
+FRAME must be a live frame and defaults to the selected one.  The return
+value is an association list of the attributes listed below.  All height
+and width values are in pixels.
+
+`outer-position' is a cons of the outer left and top edges of FRAME
+  relative to the origin - the position (0, 0) - of FRAME's display.
+
+`outer-size' is a cons of the outer width and height of FRAME.  The
+  outer size includes the title bar and the external borders as well as
+  any menu and/or tool bar of frame.
+
+`external-border-size' is a cons of the horizontal and vertical width of
+  FRAME's external borders as supplied by the window manager.
+
+`title-bar-size' is a cons of the width and height of the title bar of
+  FRAME as supplied by the window manager.  If both of them are zero,
+  FRAME has no title bar.  If only the width is zero, Emacs was not
+  able to retrieve the width information.
+
+`menu-bar-external', if non-nil, means the menu bar is external (never
   included in the inner edges of FRAME).
 
-- `menu-bar-size' is a cons of the width and height of the menu bar of
+`menu-bar-size' is a cons of the width and height of the menu bar of
   FRAME.
 
-- `tool-bar-external' if t means the tool bar is external (not
+`tool-bar-external', if non-nil, means the tool bar is external (never
   included in the inner edges of FRAME).
 
-- `tool-bar-side' tells tells on which side the tool bar on FRAME is and
-  can be one of `left', `top', `right' or `bottom'.
+`tool-bar-position' tells on which side the tool bar on FRAME is and can
+  be one of `left', `top', `right' or `bottom'.  If this is nil, FRAME
+  has no tool bar.
 
-- `tool-bar-size' is a cons of the width and height of the tool bar of
+`tool-bar-size' is a cons of the width and height of the tool bar of
   FRAME.
 
-- `frame-inner-size' is a cons of the inner width and height of FRAME.
-  This excludes FRAME's title bar and external border as well as any
-  external menu and/or tool bar.  */)
+`internal-border-width' is the width of the internal border of
+  FRAME.  */)
   (Lisp_Object frame)
 {
-  struct frame *f = decode_live_frame (frame);
-  int inner_width = FRAME_PIXEL_WIDTH (f);
-  int inner_height = FRAME_PIXEL_HEIGHT (f);
-  Lisp_Object fullscreen = Fframe_parameter (frame, Qfullscreen);
-  int border, title, outer_width, outer_height;
-  int tool_bar_height, tool_bar_width;
-  // Always 0 on NS.
-  int menu_bar_height = 0;
-  int menu_bar_width = 0;
-
-  if (FRAME_INITIAL_P (f) || !FRAME_NS_P (f))
-    return Qnil;
+  return frame_geometry (frame, Qnil);
+}
 
-  border = f->border_width;
-  title = FRAME_NS_TITLEBAR_HEIGHT (f);
-  outer_width = FRAME_PIXEL_WIDTH (f) + 2 * border;
-  outer_height = FRAME_PIXEL_HEIGHT (f) + 2 * border;
-  tool_bar_height = FRAME_TOOLBAR_HEIGHT (f);
-  tool_bar_width = tool_bar_height > 0
-    ? outer_width - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)
-    : 0;
-
-  return
-    listn (CONSTYPE_HEAP, 10,
-          Fcons (Qframe_position,
-                 Fcons (make_number (f->left_pos), make_number (f->top_pos))),
-          Fcons (Qframe_outer_size,
-                 Fcons (make_number (outer_width), make_number 
(outer_height))),
-          Fcons (Qexternal_border_size,
-                 ((EQ (fullscreen, Qfullboth) || EQ (fullscreen, Qfullscreen))
-                  ? Fcons (make_number (0), make_number (0))
-                  : Fcons (make_number (border), make_number (border)))),
-           Fcons (Qtitle_height,
-                 ((EQ (fullscreen, Qfullboth) || EQ (fullscreen, Qfullscreen))
-                  ? make_number (0)
-                  : make_number (title))),
-          Fcons (Qmenu_bar_external, FRAME_EXTERNAL_MENU_BAR (f) ? Qt : Qnil),
-          Fcons (Qmenu_bar_size,
-                 Fcons (make_number (menu_bar_width),
-                        make_number (menu_bar_height))),
-          Fcons (Qtool_bar_external, FRAME_EXTERNAL_TOOL_BAR (f) ? Qt : Qnil),
-          Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)),
-          Fcons (Qtool_bar_size,
-                 Fcons (make_number (tool_bar_width),
-                        make_number (tool_bar_height))),
-          Fcons (Qframe_inner_size,
-                 Fcons (make_number (inner_width),
-                        make_number (inner_height))));
+DEFUN ("ns-frame-edges", Fns_frame_edges, Sns_frame_edges, 0, 2, 0,
+       doc: /* Return edge coordinates of FRAME.
+FRAME must be a live frame and defaults to the selected one.  The return
+value is a list of the form (LEFT, TOP, RIGHT, BOTTOM).  All values are
+in pixels relative to the origin - the position (0, 0) - of FRAME's
+display.
+
+If optional argument TYPE is the symbol `outer-edges', return the outer
+edges of FRAME.  The outer edges comprise the decorations of the window
+manager (like the title bar or external borders) as well as any external
+menu or tool bar of FRAME.  If optional argument TYPE is the symbol
+`native-edges' or nil, return the native edges of FRAME.  The native
+edges exclude the decorations of the window manager and any external
+menu or tool bar of FRAME.  If TYPE is the symbol `inner-edges', return
+the inner edges of FRAME.  These edges exclude title bar, any borders,
+menu bar or tool bar of FRAME.  */)
+  (Lisp_Object frame, Lisp_Object type)
+{
+  return frame_geometry (frame, ((EQ (type, Qouter_edges)
+                                 || EQ (type, Qinner_edges))
+                                ? type
+                                : Qnative_edges));
 }
 
 /* ==========================================================================
@@ -3105,7 +3140,8 @@ be used as the image of the icon representing the frame.  
*/);
   defsubr (&Sx_display_pixel_width);
   defsubr (&Sx_display_pixel_height);
   defsubr (&Sns_display_monitor_attributes_list);
-  defsubr (&Sx_frame_geometry);
+  defsubr (&Sns_frame_geometry);
+  defsubr (&Sns_frame_edges);
   defsubr (&Sx_display_mm_width);
   defsubr (&Sx_display_mm_height);
   defsubr (&Sx_display_screens);
diff --git a/src/nsfont.m b/src/nsfont.m
index d450df3..3d278c0 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -781,7 +781,7 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int 
pixel_size)
 
   if (nsfont == nil)
     {
-      message_with_string ("*** Warning: font in family '%s' not found",
+      message_with_string ("*** Warning: font in family `%s' not found",
                           build_string ([family UTF8String]), 1);
       nsfont = [NSFont userFixedPitchFontOfSize: pixel_size];
     }
diff --git a/src/nsimage.m b/src/nsimage.m
index 9302cd2..9eaeefe 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -33,6 +33,7 @@ GNUstep port and post-20 update by Adrian Robert 
(address@hidden)
 #include "dispextern.h"
 #include "nsterm.h"
 #include "frame.h"
+#include "coding.h"
 
 /* call tracing */
 #if 0
@@ -102,7 +103,7 @@ ns_load_image (struct frame *f, struct image *img,
 
   if (eImg == nil)
     {
-      add_to_log ("Unable to load image %s", img->spec, Qnil);
+      add_to_log ("Unable to load image %s", img->spec);
       return 0;
     }
 
@@ -169,6 +170,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
   found = x_find_image_file (file);
   if (!STRINGP (found))
     return nil;
+  found = ENCODE_FILE (found);
 
   image = [[EmacsImage alloc] initByReferencingFile:
                      [NSString stringWithUTF8String: SSDATA (found)]];
diff --git a/src/print.c b/src/print.c
index eb24d46..7a30fea 100644
--- a/src/print.c
+++ b/src/print.c
@@ -469,8 +469,6 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
       ptrdiff_t i;
       ptrdiff_t size = SCHARS (string);
       ptrdiff_t size_byte = SBYTES (string);
-      struct gcpro gcpro1;
-      GCPRO1 (string);
       if (size == size_byte)
        for (i = 0; i < size; i++)
          printchar (SREF (string, i), printcharfun);
@@ -484,7 +482,6 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
            printchar (ch, printcharfun);
            i += len;
          }
-      UNGCPRO;
     }
 }
 
@@ -743,17 +740,13 @@ If PRINTCHARFUN is omitted, the value of 
`standard-output' (which see)
 is used instead.  */)
   (Lisp_Object object, Lisp_Object printcharfun)
 {
-  struct gcpro gcpro1;
-
   if (NILP (printcharfun))
     printcharfun = Vstandard_output;
-  GCPRO1 (object);
   PRINTPREPARE;
   printchar ('\n', printcharfun);
   print (object, printcharfun, 1);
   printchar ('\n', printcharfun);
   PRINTFINISH;
-  UNGCPRO;
   return object;
 }
 
@@ -858,7 +851,6 @@ error message is constructed.  */)
 {
   struct buffer *old = current_buffer;
   Lisp_Object value;
-  struct gcpro gcpro1;
 
   /* If OBJ is (error STRING), just return STRING.
      That is not only faster, it also avoids the need to allocate
@@ -874,10 +866,8 @@ error message is constructed.  */)
   set_buffer_internal (XBUFFER (Vprin1_to_string_buffer));
   value = Fbuffer_string ();
 
-  GCPRO1 (value);
   Ferase_buffer ();
   set_buffer_internal (old);
-  UNGCPRO;
 
   return value;
 }
@@ -892,7 +882,6 @@ print_error_message (Lisp_Object data, Lisp_Object stream, 
const char *context,
                     Lisp_Object caller)
 {
   Lisp_Object errname, errmsg, file_error, tail;
-  struct gcpro gcpro1;
 
   if (context != 0)
     write_string_1 (context, stream);
@@ -906,7 +895,7 @@ print_error_message (Lisp_Object data, Lisp_Object stream, 
const char *context,
       USE_SAFE_ALLOCA;
       char *name = SAFE_ALLOCA (cnamelen);
       memcpy (name, SDATA (cname), cnamelen);
-      message_dolog (name, cnamelen, 0, 0);
+      message_dolog (name, cnamelen, 0, STRING_MULTIBYTE (cname));
       message_dolog (": ", 2, 0, 0);
       SAFE_FREE ();
     }
@@ -931,7 +920,6 @@ print_error_message (Lisp_Object data, Lisp_Object stream, 
const char *context,
   /* Print an error message including the data items.  */
 
   tail = Fcdr_safe (data);
-  GCPRO1 (tail);
 
   /* For file-error, make error message by concatenating
      all the data items.  They are all strings.  */
@@ -944,7 +932,7 @@ print_error_message (Lisp_Object data, Lisp_Object stream, 
const char *context,
     if (!STRINGP (errmsg))
       write_string_1 ("peculiar error", stream);
     else if (SCHARS (errmsg))
-      Fprinc (errmsg, stream);
+      Fprinc (Fsubstitute_command_keys (errmsg), stream);
     else
       sep = NULL;
 
@@ -962,8 +950,6 @@ print_error_message (Lisp_Object data, Lisp_Object stream, 
const char *context,
          Fprin1 (obj, stream);
       }
   }
-
-  UNGCPRO;
 }
 
 
@@ -1432,16 +1418,13 @@ print_object (Lisp_Object obj, Lisp_Object 
printcharfun, bool escapeflag)
        print_string (obj, printcharfun);
       else
        {
-         register ptrdiff_t i, i_byte;
-         struct gcpro gcpro1;
+         ptrdiff_t i, i_byte;
          ptrdiff_t size_byte;
          /* True means we must ensure that the next character we output
             cannot be taken as part of a hex character escape.  */
          bool need_nonhex = false;
          bool multibyte = STRING_MULTIBYTE (obj);
 
-         GCPRO1 (obj);
-
          if (! EQ (Vprint_charset_text_property, Qt))
            obj = print_prune_string_charset (obj);
 
@@ -1511,8 +1494,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
                                  0, print_interval, printcharfun);
              printchar (')', printcharfun);
            }
-
-         UNGCPRO;
        }
       break;
 
@@ -1706,11 +1687,9 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
        {
          ptrdiff_t i;
          unsigned char c;
-         struct gcpro gcpro1;
          EMACS_INT size = bool_vector_size (obj);
          ptrdiff_t size_in_chars = bool_vector_bytes (size);
          ptrdiff_t real_size_in_chars = size_in_chars;
-         GCPRO1 (obj);
 
          int len = sprintf (buf, "#&%"pI"d\"", size);
          strout (buf, len, len, printcharfun);
@@ -1747,8 +1726,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
          if (size_in_chars < real_size_in_chars)
            print_c_string (" ...", printcharfun);
          printchar ('\"', printcharfun);
-
-         UNGCPRO;
        }
       else if (SUBRP (obj))
        {
@@ -2057,8 +2034,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
              {
                ptrdiff_t amount = v->data[1].integer;
 
-#if GC_MARK_STACK
-
                /* valid_lisp_object_p is reliable, so try to print up
                   to 8 saved objects.  This code is rarely used, so
                   it's OK that valid_lisp_object_p is slow.  */
@@ -2083,16 +2058,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
                  }
                if (i == limit && i < amount)
                  print_c_string (" ...", printcharfun);
-
-#else /* not GC_MARK_STACK */
-
-               /* There is no reliable way to determine whether the objects
-                  are initialized, so do not try to print them.  */
-
-               i = sprintf (buf, "with %"pD"d objects", amount);
-               strout (buf, i, i, printcharfun);
-
-#endif /* GC_MARK_STACK */
              }
            else
              {
diff --git a/src/process.c b/src/process.c
index 9d8fa22..17e9187 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1402,7 +1402,6 @@ usage: (make-process &rest ARGS)  */)
   Lisp_Object buffer, name, command, program, proc, contact, current_dir, tem;
   Lisp_Object xstderr, stderrproc;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1;
   USE_SAFE_ALLOCA;
 
   if (nargs == 0)
@@ -1410,7 +1409,6 @@ usage: (make-process &rest ARGS)  */)
 
   /* Save arguments for process-contact and clone-process.  */
   contact = Flist (nargs, args);
-  GCPRO1 (contact);
 
   buffer = Fplist_get (contact, QCbuffer);
   if (!NILP (buffer))
@@ -1419,18 +1417,8 @@ usage: (make-process &rest ARGS)  */)
   /* Make sure that the child will be able to chdir to the current
      buffer's current directory, or its unhandled equivalent.  We
      can't just have the child check for an error when it does the
-     chdir, since it's in a vfork.
-
-     We have to GCPRO around this because Fexpand_file_name and
-     Funhandled_file_name_directory might call a file name handling
-     function.  The argument list is protected by the caller, so all
-     we really have to worry about is buffer.  */
-  {
-    struct gcpro gcpro1;
-    GCPRO1 (buffer);
-    current_dir = encode_current_directory ();
-    UNGCPRO;
-  }
+     chdir, since it's in a vfork.  */
+  current_dir = encode_current_directory ();
 
   name = Fplist_get (contact, QCname);
   CHECK_STRING (name);
@@ -1454,15 +1442,12 @@ usage: (make-process &rest ARGS)  */)
     }
   else if (!NILP (xstderr))
     {
-      struct gcpro gcpro1, gcpro2;
       CHECK_STRING (program);
-      GCPRO2 (buffer, current_dir);
       stderrproc = CALLN (Fmake_pipe_process,
                          QCname,
                          concat2 (name, build_string (" stderr")),
                          QCbuffer,
                          Fget_buffer_create (xstderr));
-      UNGCPRO;
     }
 
   proc = make_process (name);
@@ -1526,7 +1511,6 @@ usage: (make-process &rest ARGS)  */)
     /* Qt denotes we have not yet called Ffind_operation_coding_system.  */
     Lisp_Object coding_systems = Qt;
     Lisp_Object val, *args2;
-    struct gcpro gcpro1, gcpro2;
 
     tem = Fplist_get (contact, QCcoding);
     if (!NILP (tem))
@@ -1548,10 +1532,8 @@ usage: (make-process &rest ARGS)  */)
        args2[i++] = buffer;
        for (tem2 = command; CONSP (tem2); tem2 = XCDR (tem2))
          args2[i++] = XCAR (tem2);
-       GCPRO2 (proc, current_dir);
        if (!NILP (program))
          coding_systems = Ffind_operation_coding_system (nargs2, args2);
-       UNGCPRO;
        if (CONSP (coding_systems))
          val = XCAR (coding_systems);
        else if (CONSP (Vdefault_process_coding_system))
@@ -1580,10 +1562,8 @@ usage: (make-process &rest ARGS)  */)
            args2[i++] = buffer;
            for (tem2 = command; CONSP (tem2); tem2 = XCDR (tem2))
              args2[i++] = XCAR (tem2);
-           GCPRO2 (proc, current_dir);
            if (!NILP (program))
              coding_systems = Ffind_operation_coding_system (nargs2, args2);
-           UNGCPRO;
          }
        if (CONSP (coding_systems))
          val = XCDR (coding_systems);
@@ -1616,13 +1596,9 @@ usage: (make-process &rest ARGS)  */)
          && !(SCHARS (program) > 1
               && IS_DEVICE_SEP (SREF (program, 1))))
        {
-         struct gcpro gcpro1, gcpro2;
-
          tem = Qnil;
-         GCPRO2 (buffer, current_dir);
          openp (Vexec_path, program, Vexec_suffixes, &tem,
                 make_number (X_OK), false);
-         UNGCPRO;
          if (NILP (tem))
            report_file_error ("Searching for program", program);
          tem = Fexpand_file_name (tem, Qnil);
@@ -1638,8 +1614,6 @@ usage: (make-process &rest ARGS)  */)
       tem = remove_slash_colon (tem);
 
       Lisp_Object arg_encoding = Qnil;
-      struct gcpro gcpro1;
-      GCPRO1 (tem);
 
       /* Encode the file name and put it in NEW_ARGV.
         That's where the child will use it to execute the program.  */
@@ -1666,8 +1640,6 @@ usage: (make-process &rest ARGS)  */)
          new_argc++;
        }
 
-      UNGCPRO;
-
       /* Now that everything is encoded we can collect the strings into
         NEW_ARGV.  */
       char **new_argv;
@@ -1685,7 +1657,6 @@ usage: (make-process &rest ARGS)  */)
   else
     create_pty (proc);
 
-  UNGCPRO;
   SAFE_FREE ();
   return unbind_to (count, proc);
 }
@@ -2110,7 +2081,6 @@ usage:  (make-pipe-process &rest ARGS)  */)
 {
   Lisp_Object proc, contact;
   struct Lisp_Process *p;
-  struct gcpro gcpro1;
   Lisp_Object name, buffer;
   Lisp_Object tem;
   ptrdiff_t specpdl_count;
@@ -2120,7 +2090,6 @@ usage:  (make-pipe-process &rest ARGS)  */)
     return Qnil;
 
   contact = Flist (nargs, args);
-  GCPRO1 (contact);
 
   name = Fplist_get (contact, QCname);
   CHECK_STRING (name);
@@ -2244,7 +2213,6 @@ usage:  (make-pipe-process &rest ARGS)  */)
 
   specpdl_ptr = specpdl + specpdl_count;
 
-  UNGCPRO;
   return proc;
 }
 
@@ -2727,10 +2695,8 @@ usage: (serial-process-configure &rest ARGS)  */)
   struct Lisp_Process *p;
   Lisp_Object contact = Qnil;
   Lisp_Object proc = Qnil;
-  struct gcpro gcpro1;
 
   contact = Flist (nargs, args);
-  GCPRO1 (contact);
 
   proc = Fplist_get (contact, QCprocess);
   if (NILP (proc))
@@ -2745,14 +2711,9 @@ usage: (serial-process-configure &rest ARGS)  */)
     error ("Not a serial process");
 
   if (NILP (Fplist_get (p->childp, QCspeed)))
-    {
-      UNGCPRO;
-      return Qnil;
-    }
+    return Qnil;
 
   serial_configure (p, contact);
-
-  UNGCPRO;
   return Qnil;
 }
 
@@ -2834,7 +2795,6 @@ usage:  (make-serial-process &rest ARGS)  */)
   int fd = -1;
   Lisp_Object proc, contact, port;
   struct Lisp_Process *p;
-  struct gcpro gcpro1;
   Lisp_Object name, buffer;
   Lisp_Object tem, val;
   ptrdiff_t specpdl_count;
@@ -2843,7 +2803,6 @@ usage:  (make-serial-process &rest ARGS)  */)
     return Qnil;
 
   contact = Flist (nargs, args);
-  GCPRO1 (contact);
 
   port = Fplist_get (contact, QCport);
   if (NILP (port))
@@ -2946,7 +2905,6 @@ usage:  (make-serial-process &rest ARGS)  */)
 
   specpdl_ptr = specpdl + specpdl_count;
 
-  UNGCPRO;
   return proc;
 }
 
@@ -3137,7 +3095,6 @@ usage: (make-network-process &rest ARGS)  */)
   int ret = 0;
   int xerrno = 0;
   int s = -1, outch, inch;
-  struct gcpro gcpro1;
   ptrdiff_t count = SPECPDL_INDEX ();
   ptrdiff_t count1;
   Lisp_Object colon_address;  /* Either QClocal or QCremote.  */
@@ -3155,7 +3112,6 @@ usage: (make-network-process &rest ARGS)  */)
 
   /* Save arguments for process-contact and clone-process.  */
   contact = Flist (nargs, args);
-  GCPRO1 (contact);
 
 #ifdef WINDOWSNT
   /* Ensure socket support is loaded if available.  */
@@ -3722,7 +3678,6 @@ usage: (make-network-process &rest ARGS)  */)
 
   {
     /* Setup coding systems for communicating with the network stream.  */
-    struct gcpro gcpro1;
     /* Qt denotes we have not yet called Ffind_operation_coding_system.  */
     Lisp_Object coding_systems = Qt;
     Lisp_Object val;
@@ -3747,13 +3702,9 @@ usage: (make-network-process &rest ARGS)  */)
        if (NILP (host) || NILP (service))
          coding_systems = Qnil;
        else
-         {
-           GCPRO1 (proc);
-           coding_systems = CALLN (Ffind_operation_coding_system,
-                                   Qopen_network_stream, name, buffer,
-                                   host, service);
-           UNGCPRO;
-         }
+         coding_systems = CALLN (Ffind_operation_coding_system,
+                                 Qopen_network_stream, name, buffer,
+                                 host, service);
        if (CONSP (coding_systems))
          val = XCAR (coding_systems);
        else if (CONSP (Vdefault_process_coding_system))
@@ -3780,13 +3731,9 @@ usage: (make-network-process &rest ARGS)  */)
            if (NILP (host) || NILP (service))
              coding_systems = Qnil;
            else
-             {
-               GCPRO1 (proc);
-               coding_systems = CALLN (Ffind_operation_coding_system,
-                                       Qopen_network_stream, name, buffer,
-                                       host, service);
-               UNGCPRO;
-             }
+             coding_systems = CALLN (Ffind_operation_coding_system,
+                                     Qopen_network_stream, name, buffer,
+                                     host, service);
          }
        if (CONSP (coding_systems))
          val = XCDR (coding_systems);
@@ -3806,7 +3753,6 @@ usage: (make-network-process &rest ARGS)  */)
   p->inherit_coding_system_flag
     = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
 
-  UNGCPRO;
   return proc;
 }
 
@@ -5422,8 +5368,6 @@ read_and_dispose_of_process_output (struct Lisp_Process 
*p, char *chars,
   bool outer_running_asynch_code = running_asynch_code;
   int waiting = waiting_for_user_input_p;
 
-  /* No need to gcpro these, because all we do with them later
-     is test them for EQness, and none of them should be a string.  */
 #if 0
   Lisp_Object obuffer, okeymap;
   XSETBUFFER (obuffer, current_buffer);
@@ -6605,8 +6549,6 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
   if (inhibit_sentinels)
     return;
 
-  /* No need to gcpro these, because all we do with them later
-     is test them for EQness, and none of them should be a string.  */
   odeactivate = Vdeactivate_mark;
 #if 0
   Lisp_Object obuffer, okeymap;
@@ -6684,16 +6626,10 @@ status_notify (struct Lisp_Process *deleting_process,
 {
   Lisp_Object proc;
   Lisp_Object tail, msg;
-  struct gcpro gcpro1, gcpro2;
   int got_some_output = -1;
 
   tail = Qnil;
   msg = Qnil;
-  /* We need to gcpro tail; if read_process_output calls a filter
-     which deletes a process and removes the cons to which tail points
-     from Vprocess_alist, and then causes a GC, tail is an unprotected
-     reference.  */
-  GCPRO2 (tail, msg);
 
   /* Set this now, so that if new processes are created by sentinels
      that we run, we get called again to handle their status changes.  */
@@ -6754,7 +6690,6 @@ status_notify (struct Lisp_Process *deleting_process,
     } /* end for */
 
   update_mode_lines = 24;  /* In case buffers use %s in mode-line-format.  */
-  UNGCPRO;
   return got_some_output;
 }
 
diff --git a/src/profiler.c b/src/profiler.c
index d4c98a8..efdb1d9 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -38,7 +38,7 @@ typedef struct Lisp_Hash_Table log_t;
 static struct hash_table_test hashtest_profiler;
 
 static Lisp_Object
-make_log (int heap_size, int max_stack_depth)
+make_log (EMACS_INT heap_size, EMACS_INT max_stack_depth)
 {
   /* We use a standard Elisp hash-table object, but we use it in
      a special way.  This is OK as long as the object is not exposed
@@ -53,7 +53,7 @@ make_log (int heap_size, int max_stack_depth)
 
   /* What is special about our hash-tables is that the keys are pre-filled
      with the vectors we'll put in them.  */
-  int i = ASIZE (h->key_and_value) / 2;
+  ptrdiff_t i = ASIZE (h->key_and_value) >> 1;
   while (i > 0)
     set_hash_key_slot (h, --i,
                       Fmake_vector (make_number (max_stack_depth), Qnil));
@@ -120,12 +120,11 @@ static void evict_lower_half (log_t *log)
          Fremhash (key, tmp);
        }
        eassert (EQ (log->next_free, make_number (i)));
-       {
-         int j;
-         eassert (VECTORP (key));
-         for (j = 0; j < ASIZE (key); j++)
-           ASET (key, j, Qnil);
-       }
+
+       eassert (VECTORP (key));
+       for (ptrdiff_t j = 0; j < ASIZE (key); j++)
+         ASET (key, j, Qnil);
+
        set_hash_key_slot (log, i, key);
       }
 }
@@ -165,9 +164,8 @@ record_backtrace (log_t *log, EMACS_INT count)
     else
       { /* BEWARE!  hash_put in general can allocate memory.
           But currently it only does that if log->next_free is nil.  */
-       int j;
        eassert (!NILP (log->next_free));
-       j = hash_put (log, backtrace, make_number (count), hash);
+       ptrdiff_t j = hash_put (log, backtrace, make_number (count), hash);
        /* Let's make sure we've put `backtrace' right where it
           already was to start with.  */
        eassert (index == j);
diff --git a/src/regex.c b/src/regex.c
index 38c5e35..dcf2864 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -1544,9 +1544,9 @@ do {                                                      
                \
   DEBUG_PRINT ("  Push frame index: %zd\n", fail_stack.frame);         \
   PUSH_FAILURE_INT (fail_stack.frame);                                 \
                                                                        \
-  DEBUG_PRINT ("  Push string %p: `", string_place);                   \
+  DEBUG_PRINT ("  Push string %p: \"", string_place);                  \
   DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, size2);\
-  DEBUG_PRINT ("'\n");                                                 \
+  DEBUG_PRINT ("\"\n");                                                        
\
   PUSH_FAILURE_POINTER (string_place);                                 \
                                                                        \
   DEBUG_PRINT ("  Push pattern %p: ", pattern);                                
\
@@ -1598,9 +1598,9 @@ do {                                                      
                \
      on_failure_keep_string_jump opcode, and we want to throw away the \
      saved NULL, thus retaining our current position in the string.  */        
\
   str = POP_FAILURE_POINTER ();                                                
\
-  DEBUG_PRINT ("  Popping string %p: `", str);                         \
+  DEBUG_PRINT ("  Popping string %p: \"", str);                                
\
   DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2);     \
-  DEBUG_PRINT ("'\n");                                                 \
+  DEBUG_PRINT ("\"\n");                                                        
\
                                                                        \
   fail_stack.frame = POP_FAILURE_INT ();                               \
   DEBUG_PRINT ("  Popping  frame index: %zd\n", fail_stack.frame);     \
@@ -5127,9 +5127,9 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
const_re_char *string1,
 
   DEBUG_PRINT ("The compiled pattern is: ");
   DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
-  DEBUG_PRINT ("The string to match is: `");
+  DEBUG_PRINT ("The string to match is: \"");
   DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
-  DEBUG_PRINT ("'\n");
+  DEBUG_PRINT ("\"\n");
 
   /* This loops over pattern commands.  It exits by returning from the
      function if the match is complete, or it drops through if the match
@@ -5435,7 +5435,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
const_re_char *string1,
                    && buf_ch == '\000'))
              goto fail;
 
-           DEBUG_PRINT ("  Matched `%d'.\n", *d);
+           DEBUG_PRINT ("  Matched \"%d\".\n", *d);
            d += buf_charlen;
          }
          break;
diff --git a/src/regex.h b/src/regex.h
index 3dfecf0..c89ca46 100644
--- a/src/regex.h
+++ b/src/regex.h
@@ -603,7 +603,9 @@ typedef wchar_t re_wchar_t;
 # define re_wctype_to_bit(cc) 0
 #else
 # define CHAR_CLASS_MAX_LENGTH  9 /* Namely, `multibyte'.  */
-# define btowc(c) c
+# ifndef emacs
+#  define btowc(c) c
+# endif
 
 /* Character classes.  */
 typedef enum { RECC_ERROR = 0,
diff --git a/src/search.c b/src/search.c
index 5da99c4..106a462 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2754,7 +2754,9 @@ SUBEXP, a number, specifies which parenthesized 
expression in the last
   regexp.
 Value is nil if SUBEXPth pair didn't match, or there were less than
   SUBEXP pairs.
-Zero means the entire text matched by the whole regexp or whole string.  */)
+Zero means the entire text matched by the whole regexp or whole string.
+
+Return value is undefined if the last search failed.  */)
   (Lisp_Object subexp)
 {
   return match_limit (subexp, 1);
@@ -2766,14 +2768,16 @@ SUBEXP, a number, specifies which parenthesized 
expression in the last
   regexp.
 Value is nil if SUBEXPth pair didn't match, or there were less than
   SUBEXP pairs.
-Zero means the entire text matched by the whole regexp or whole string.  */)
+Zero means the entire text matched by the whole regexp or whole string.
+
+Return value is undefined if the last search failed.  */)
   (Lisp_Object subexp)
 {
   return match_limit (subexp, 0);
 }
 
 DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 3, 0,
-       doc: /* Return a list containing all info on what the last search 
matched.
+       doc: /* Return a list describing what the last search matched.
 Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'.
 All the elements are markers or nil (nil if the Nth pair didn't match)
 if the last match was on a buffer; integers or nil if a string was matched.
diff --git a/src/sound.c b/src/sound.c
index 05c7b06..9a365c7 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -1351,7 +1351,6 @@ Internal use only, use `play-sound' instead.  */)
 {
   Lisp_Object attrs[SOUND_ATTR_SENTINEL];
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2;
 
 #ifdef WINDOWSNT
   unsigned long ui_volume_tmp = UINT_MAX;
@@ -1363,7 +1362,6 @@ Internal use only, use `play-sound' instead.  */)
     error ("Invalid sound specification");
 
   Lisp_Object file = Qnil;
-  GCPRO2 (sound, file);
 
 #ifndef WINDOWSNT
   current_sound_device = xzalloc (sizeof *current_sound_device);
@@ -1452,7 +1450,6 @@ Internal use only, use `play-sound' instead.  */)
 
 #endif /* WINDOWSNT */
 
-  UNGCPRO;
   return unbind_to (count, Qnil);
 }
 
diff --git a/src/syntax.c b/src/syntax.c
index 0d8b08c..30560af 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1333,7 +1333,11 @@ DEFUN ("internal-describe-syntax-value", 
Finternal_describe_syntax_value,
     insert_string (" (nestable)");
 
   if (prefix)
-    insert_string (",\n\t  is a prefix character for `backward-prefix-chars'");
+    {
+      AUTO_STRING (prefixdoc,
+                  ",\n\t  is a prefix character for `backward-prefix-chars'");
+      insert1 (Fsubstitute_command_keys (prefixdoc));
+    }
 
   return syntax;
 }
diff --git a/src/sysdep.c b/src/sysdep.c
index df3e573..836cc27 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1612,7 +1612,7 @@ handle_arith_signal (int sig)
   xsignal0 (Qarith_error);
 }
 
-#ifdef HAVE_STACK_OVERFLOW_HANDLING
+#if defined HAVE_STACK_OVERFLOW_HANDLING && !defined WINDOWSNT
 
 /* Alternate stack used by SIGSEGV handler below.  */
 
@@ -1708,7 +1708,7 @@ init_sigsegv (void)
   return sigaction (SIGSEGV, &sa, NULL) < 0 ? 0 : 1;
 }
 
-#else /* not HAVE_STACK_OVERFLOW_HANDLING */
+#else /* not HAVE_STACK_OVERFLOW_HANDLING or WINDOWSNT */
 
 static bool
 init_sigsegv (void)
@@ -1716,7 +1716,7 @@ init_sigsegv (void)
   return 0;
 }
 
-#endif /* HAVE_STACK_OVERFLOW_HANDLING */
+#endif /* HAVE_STACK_OVERFLOW_HANDLING && !WINDOWSNT */
 
 static void
 deliver_arith_signal (int sig)
@@ -2719,10 +2719,8 @@ Lisp_Object
 list_system_processes (void)
 {
   Lisp_Object procdir, match, proclist, next;
-  struct gcpro gcpro1, gcpro2;
-  register Lisp_Object tail;
+  Lisp_Object tail;
 
-  GCPRO2 (procdir, match);
   /* For every process on the system, there's a directory in the
      "/proc" pseudo-directory whose name is the numeric ID of that
      process.  */
@@ -2737,7 +2735,6 @@ list_system_processes (void)
       next = XCDR (tail);
       XSETCAR (tail, Fstring_to_number (XCAR (tail), Qnil));
     }
-  UNGCPRO;
 
   /* directory_files_internal returns the files in reverse order; undo
      that.  */
@@ -2759,7 +2756,6 @@ list_system_processes (void)
   struct kinfo_proc *procs;
   size_t i;
 
-  struct gcpro gcpro1;
   Lisp_Object proclist = Qnil;
 
   if (sysctl (mib, 3, NULL, &len, NULL, 0) != 0)
@@ -2772,7 +2768,6 @@ list_system_processes (void)
       return proclist;
     }
 
-  GCPRO1 (proclist);
   len /= sizeof (struct kinfo_proc);
   for (i = 0; i < len; i++)
     {
@@ -2782,7 +2777,6 @@ list_system_processes (void)
       proclist = Fcons (make_fixnum_or_float (procs[i].ki_pid), proclist);
 #endif
     }
-  UNGCPRO;
 
   xfree (procs);
 
@@ -2993,7 +2987,6 @@ system_process_attributes (Lisp_Object pid)
   Lisp_Object attrs = Qnil;
   Lisp_Object cmd_str, decoded_cmd;
   ptrdiff_t count;
-  struct gcpro gcpro1, gcpro2;
 
   CHECK_NUMBER_OR_FLOAT (pid);
   CONS_TO_INTEGER (pid, pid_t, proc_id);
@@ -3001,8 +2994,6 @@ system_process_attributes (Lisp_Object pid)
   if (stat (procfn, &st) < 0)
     return attrs;
 
-  GCPRO2 (attrs, decoded_cmd);
-
   /* euid egid */
   uid = st.st_uid;
   attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
@@ -3191,7 +3182,6 @@ system_process_attributes (Lisp_Object pid)
       attrs = Fcons (Fcons (Qargs, decoded_cmd), attrs);
     }
 
-  UNGCPRO;
   return attrs;
 }
 
@@ -3230,7 +3220,6 @@ system_process_attributes (Lisp_Object pid)
   gid_t gid;
   Lisp_Object attrs = Qnil;
   Lisp_Object decoded_cmd;
-  struct gcpro gcpro1, gcpro2;
   ptrdiff_t count;
 
   CHECK_NUMBER_OR_FLOAT (pid);
@@ -3239,8 +3228,6 @@ system_process_attributes (Lisp_Object pid)
   if (stat (procfn, &st) < 0)
     return attrs;
 
-  GCPRO2 (attrs, decoded_cmd);
-
   /* euid egid */
   uid = st.st_uid;
   attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
@@ -3333,7 +3320,6 @@ system_process_attributes (Lisp_Object pid)
       attrs = Fcons (Fcons (Qargs, decoded_cmd), attrs);
     }
   unbind_to (count, Qnil);
-  UNGCPRO;
   return attrs;
 }
 
@@ -3369,7 +3355,6 @@ system_process_attributes (Lisp_Object pid)
   struct kinfo_proc proc;
   size_t proclen = sizeof proc;
 
-  struct gcpro gcpro1, gcpro2;
   Lisp_Object attrs = Qnil;
   Lisp_Object decoded_comm;
 
@@ -3380,8 +3365,6 @@ system_process_attributes (Lisp_Object pid)
   if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0)
     return attrs;
 
-  GCPRO2 (attrs, decoded_comm);
-
   attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs);
 
   block_input ();
@@ -3519,7 +3502,6 @@ system_process_attributes (Lisp_Object pid)
       attrs = Fcons (Fcons (Qargs, decoded_comm), attrs);
     }
 
-  UNGCPRO;
   return attrs;
 }
 
diff --git a/src/systime.h b/src/systime.h
index abbe601..315f9d1 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -83,9 +83,8 @@ extern struct timeval make_timeval (struct timespec) 
ATTRIBUTE_CONST;
 extern void set_waiting_for_input (struct timespec *);
 
 /* When lisp.h is not included Lisp_Object is not defined (this can
-   happen when this files is used outside the src directory).
-   Use GCPRO1 to determine if lisp.h was included.  */
-#ifdef GCPRO1
+   happen when this files is used outside the src directory).  */
+#ifdef EMACS_LISP_H
 
 /* Emacs uses the integer list (HI LO US PS) to represent the time
    (HI << LO_TIME_BITS) + LO + US / 1e6 + PS / 1e12.  */
diff --git a/src/textprop.c b/src/textprop.c
index f6dbab0..3f7c8d1 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -375,15 +375,10 @@ add_properties (Lisp_Object plist, INTERVAL i, 
Lisp_Object object,
 {
   Lisp_Object tail1, tail2, sym1, val1;
   bool changed = false;
-  struct gcpro gcpro1, gcpro2, gcpro3;
 
   tail1 = plist;
   sym1 = Qnil;
   val1 = Qnil;
-  /* No need to protect OBJECT, because we can GC only in the case
-     where it is a buffer, and live buffers are always protected.
-     I and its plist are also protected, via OBJECT.  */
-  GCPRO3 (tail1, sym1, val1);
 
   /* Go through each element of PLIST.  */
   for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1)))
@@ -396,9 +391,7 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object 
object,
       for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2)))
        if (EQ (sym1, XCAR (tail2)))
          {
-           /* No need to gcpro, because tail2 protects this
-              and it must be a cons cell (we get an error otherwise).  */
-           register Lisp_Object this_cdr;
+           Lisp_Object this_cdr;
 
            this_cdr = XCDR (tail2);
            /* Found the property.  Now check its value.  */
@@ -456,8 +449,6 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object 
object,
        }
     }
 
-  UNGCPRO;
-
   return changed;
 }
 
@@ -1160,7 +1151,6 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end,
   INTERVAL i, unchanged;
   ptrdiff_t s, len;
   bool modified = false;
-  struct gcpro gcpro1;
   bool first_time = true;
 
   properties = validate_plist (properties);
@@ -1178,10 +1168,6 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object 
end,
   s = XINT (start);
   len = XINT (end) - s;
 
-  /* No need to protect OBJECT, because we GC only if it's a buffer,
-     and live buffers are always protected.  */
-  GCPRO1 (properties);
-
   /* If this interval already has the properties, we can skip it.  */
   if (interval_has_all_properties (properties, i))
     {
@@ -1190,7 +1176,7 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end,
       do
        {
          if (got >= len)
-           RETURN_UNGCPRO (Qnil);
+           return Qnil;
          len -= got;
          i = next_interval (i);
          got = LENGTH (i);
@@ -1233,11 +1219,6 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object 
end,
 
       if (LENGTH (i) >= len)
        {
-         /* We can UNGCPRO safely here, because there will be just
-            one more chance to gc, in the next call to add_properties,
-            and after that we will not need PROPERTIES or OBJECT again.  */
-         UNGCPRO;
-
          if (interval_has_all_properties (properties, i))
            {
              if (BUFFERP (object))
@@ -1906,7 +1887,6 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object src,
   Lisp_Object plist;
   ptrdiff_t s, e, e2, p, len;
   bool modified = false;
-  struct gcpro gcpro1, gcpro2;
 
   i = validate_interval_range (src, &start, &end, soft);
   if (!i)
@@ -1964,8 +1944,6 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object src,
       s = i->position;
     }
 
-  GCPRO2 (stuff, dest);
-
   while (! NILP (stuff))
     {
       res = Fcar (stuff);
@@ -1976,8 +1954,6 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object src,
       stuff = Fcdr (stuff);
     }
 
-  UNGCPRO;
-
   return modified ? Qt : Qnil;
 }
 
@@ -2047,10 +2023,6 @@ text_property_list (Lisp_Object object, Lisp_Object 
start, Lisp_Object end, Lisp
 void
 add_text_properties_from_list (Lisp_Object object, Lisp_Object list, 
Lisp_Object delta)
 {
-  struct gcpro gcpro1, gcpro2;
-
-  GCPRO2 (list, object);
-
   for (; CONSP (list); list = XCDR (list))
     {
       Lisp_Object item, start, end, plist;
@@ -2062,8 +2034,6 @@ add_text_properties_from_list (Lisp_Object object, 
Lisp_Object list, Lisp_Object
 
       Fadd_text_properties (start, end, plist, object);
     }
-
-  UNGCPRO;
 }
 
 
@@ -2111,14 +2081,11 @@ extend_property_ranges (Lisp_Object list, Lisp_Object 
new_end)
 static void
 call_mod_hooks (Lisp_Object list, Lisp_Object start, Lisp_Object end)
 {
-  struct gcpro gcpro1;
-  GCPRO1 (list);
   while (!NILP (list))
     {
       call2 (Fcar (list), start, end);
       list = Fcdr (list);
     }
-  UNGCPRO;
 }
 
 /* Check for read-only intervals between character positions START ... END,
@@ -2138,7 +2105,6 @@ verify_interval_modification (struct buffer *buf,
   Lisp_Object hooks;
   Lisp_Object prev_mod_hooks;
   Lisp_Object mod_hooks;
-  struct gcpro gcpro1;
 
   hooks = Qnil;
   prev_mod_hooks = Qnil;
@@ -2295,7 +2261,6 @@ verify_interval_modification (struct buffer *buf,
 
       if (!inhibit_modification_hooks)
        {
-         GCPRO1 (hooks);
          hooks = Fnreverse (hooks);
          while (! EQ (hooks, Qnil))
            {
@@ -2303,7 +2268,6 @@ verify_interval_modification (struct buffer *buf,
                              make_number (end));
              hooks = Fcdr (hooks);
            }
-         UNGCPRO;
        }
     }
 }
diff --git a/src/w32.c b/src/w32.c
index 296729a..b421667 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -6544,7 +6544,6 @@ global_memory_status_ex (MEMORY_STATUS_EX *buf)
 Lisp_Object
 list_system_processes (void)
 {
-  struct gcpro gcpro1;
   Lisp_Object proclist = Qnil;
   HANDLE h_snapshot;
 
@@ -6556,8 +6555,6 @@ list_system_processes (void)
       DWORD proc_id;
       BOOL res;
 
-      GCPRO1 (proclist);
-
       proc_entry.dwSize = sizeof (PROCESSENTRY32);
       for (res = process32_first (h_snapshot, &proc_entry); res;
           res = process32_next  (h_snapshot, &proc_entry))
@@ -6567,7 +6564,6 @@ list_system_processes (void)
        }
 
       CloseHandle (h_snapshot);
-      UNGCPRO;
       proclist = Fnreverse (proclist);
     }
 
@@ -6696,7 +6692,6 @@ process_times (HANDLE h_proc, Lisp_Object *ctime, 
Lisp_Object *etime,
 Lisp_Object
 system_process_attributes (Lisp_Object pid)
 {
-  struct gcpro gcpro1, gcpro2, gcpro3;
   Lisp_Object attrs = Qnil;
   Lisp_Object cmd_str, decoded_cmd, tem;
   HANDLE h_snapshot, h_proc;
@@ -6728,8 +6723,6 @@ system_process_attributes (Lisp_Object pid)
 
   h_snapshot = create_toolhelp32_snapshot (TH32CS_SNAPPROCESS, 0);
 
-  GCPRO3 (attrs, decoded_cmd, tem);
-
   if (h_snapshot != INVALID_HANDLE_VALUE)
     {
       PROCESSENTRY32 pe;
@@ -6771,10 +6764,7 @@ system_process_attributes (Lisp_Object pid)
     }
 
   if (!found_proc)
-    {
-      UNGCPRO;
-      return Qnil;
-    }
+    return Qnil;
 
   h_proc = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
                        FALSE, proc_id);
@@ -6991,7 +6981,6 @@ system_process_attributes (Lisp_Object pid)
 
   if (h_proc)
     CloseHandle (h_proc);
-  UNGCPRO;
   return attrs;
 }
 
diff --git a/src/w32fns.c b/src/w32fns.c
index 1c72974..f279fb8 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -138,6 +138,19 @@ struct MONITOR_INFO
     DWORD   dwFlags;
 };
 
+#if _WIN32_WINDOWS >= 0x0410
+#define C_CHILDREN_TITLEBAR CCHILDREN_TITLEBAR
+typedef TITLEBARINFO TITLEBAR_INFO;
+#else
+#define C_CHILDREN_TITLEBAR 5
+typedef struct
+{
+  DWORD cbSize;
+  RECT  rcTitleBar;
+  DWORD rgstate[C_CHILDREN_TITLEBAR+1];
+} TITLEBAR_INFO, *PTITLEBAR_INFO;
+#endif
+
 #ifndef CCHDEVICENAME
 #define CCHDEVICENAME 32
 #endif
@@ -172,6 +185,8 @@ typedef BOOL CALLBACK (* MonitorEnum_Proc)
   (IN HMONITOR monitor, IN HDC hdc, IN RECT *rcMonitor, IN LPARAM dwData);
 typedef BOOL (WINAPI * EnumDisplayMonitors_Proc)
   (IN HDC hdc, IN RECT *rcClip, IN MonitorEnum_Proc fnEnum, IN LPARAM dwData);
+typedef BOOL (WINAPI * GetTitleBarInfo_Proc)
+  (IN HWND hwnd, OUT TITLEBAR_INFO* info);
 
 TrackMouseEvent_Proc track_mouse_event_fn = NULL;
 ImmGetCompositionString_Proc get_composition_string_fn = NULL;
@@ -182,6 +197,7 @@ MonitorFromPoint_Proc monitor_from_point_fn = NULL;
 GetMonitorInfo_Proc get_monitor_info_fn = NULL;
 MonitorFromWindow_Proc monitor_from_window_fn = NULL;
 EnumDisplayMonitors_Proc enum_display_monitors_fn = NULL;
+GetTitleBarInfo_Proc get_title_bar_info_fn = NULL;
 
 #ifdef NTGUI_UNICODE
 #define unicode_append_menu AppendMenuW
@@ -2848,11 +2864,11 @@ get_wm_chars (HWND aWnd, int *buf, int buflen, int 
ignore_ctrl, int ctrl,
     *ctrl_cnt = 0;
   if (is_dead)
     *is_dead = -1;
-  eassert(w32_unicode_gui);
+  eassert (w32_unicode_gui);
   while (buflen
         /* Should be called only when w32_unicode_gui:  */
-        && PeekMessageW(&msg, aWnd, WM_KEYFIRST, WM_KEYLAST,
-                     PM_NOREMOVE | PM_NOYIELD)
+        && PeekMessageW (&msg, aWnd, WM_KEYFIRST, WM_KEYLAST,
+                         PM_NOREMOVE | PM_NOYIELD)
         && (msg.message == WM_CHAR || msg.message == WM_SYSCHAR
             || msg.message == WM_DEADCHAR || msg.message == WM_SYSDEADCHAR
             || msg.message == WM_UNICHAR))
@@ -2861,7 +2877,7 @@ get_wm_chars (HWND aWnd, int *buf, int buflen, int 
ignore_ctrl, int ctrl,
         characters which come BEFORE the next keyup/keydown message.  */
       int dead;
 
-      GetMessageW(&msg, aWnd, msg.message, msg.message);
+      GetMessageW (&msg, aWnd, msg.message, msg.message);
       dead = (msg.message == WM_DEADCHAR || msg.message == WM_SYSDEADCHAR);
       if (is_dead)
        *is_dead = (dead ? msg.wParam : -1);
@@ -2920,7 +2936,7 @@ get_wm_chars (HWND aWnd, int *buf, int buflen, int 
ignore_ctrl, int ctrl,
          && ((vk >= VK_NUMPAD0 && vk <= VK_DIVIDE)
              || (exp && ((vk >= VK_PRIOR && vk <= VK_DOWN) ||
                     vk == VK_INSERT || vk == VK_DELETE || vk == VK_CLEAR)))
-         && strchr("0123456789/*-+.,", code_unit))
+         && strchr ("0123456789/*-+.,", code_unit))
        continue;
       *buf++ = code_unit;
       buflen--;
@@ -2941,7 +2957,11 @@ get_wm_chars (HWND aWnd, int *buf, int buflen, int 
ignore_ctrl, int ctrl,
    environments!) should  have different values.  Moreover, switching to a
    non-Emacs window with the same language environment, and using (dead)keys
    there would change the value stored in the kernel, but not this value.  */
-static int after_deadkey = 0;
+/* A layout may emit deadkey=0.  It looks like this would reset the state
+   of the kernel's finite automaton (equivalent to emiting 0-length string,
+   which is otherwise impossible in the dead-key map of a layout).
+   Be ready to treat the case when this delivers WM_(SYS)DEADCHAR. */
+static int after_deadkey = -1;
 
 int
 deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam,
@@ -2951,7 +2971,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, 
UINT wParam,
      points to a keypress.
      (However, the "old style" TranslateMessage() would deliver at most 16 of
      them.)  Be on a safe side, and prepare to treat many more.  */
-  int ctrl_cnt, buf[1024], count, is_dead, after_dead = (after_deadkey != -1);
+  int ctrl_cnt, buf[1024], count, is_dead, after_dead = (after_deadkey > 0);
 
   /* Since the keypress processing logic of Windows has a lot of state, it
      is important to call TranslateMessage() for every keyup/keydown, AND
@@ -2974,7 +2994,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, 
UINT wParam,
       windows_msg.time = GetMessageTime ();
       TranslateMessage (&windows_msg);
     }
-  count = get_wm_chars (hwnd, buf, sizeof(buf)/sizeof(*buf), 1,
+  count = get_wm_chars (hwnd, buf, sizeof (buf)/sizeof (*buf), 1,
                        /* The message may have been synthesized by
                           who knows what; be conservative.  */
                        modifier_set (VK_LCONTROL)
@@ -3131,7 +3151,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, 
UINT wParam,
            }
          else if (wmsg.dwModifiers & (alt_modifier | meta_modifier)
                   || (console_modifiers
-                      & (RIGHT_WIN_PRESSED | RIGHT_WIN_PRESSED
+                      & (LEFT_WIN_PRESSED | RIGHT_WIN_PRESSED
                          | APPS_PRESSED | SCROLLLOCK_ON)))
            {
              /* Pure Alt (or combination of Alt, Win, APPS, scrolllock.  */
@@ -3140,7 +3160,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, 
UINT wParam,
          if (type_CtrlAlt)
            {
              /* Out of bound bitmap:  */
-             SHORT r = VkKeyScanW( *b ), bitmap = 0x1FF;
+             SHORT r = VkKeyScanW (*b), bitmap = 0x1FF;
 
              FPRINTF_WM_CHARS((stderr, "VkKeyScanW %#06x %#04x\n", (int)r,
                               wParam));
@@ -3203,12 +3223,12 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT 
msg, UINT wParam,
                 other cases, we ignore the delivered character.  */
 #define S_TYPES_TO_IGNORE_CHARACTER_PAYLOAD "aldb"
 #define S_TYPES_TO_REPORT_CHARACTER_PAYLOAD_WITH_MODIFIERS ""
-             if (strchr(S_TYPES_TO_IGNORE_CHARACTER_PAYLOAD,
-                        type_CtrlAlt[hairy]))
+             if (strchr (S_TYPES_TO_IGNORE_CHARACTER_PAYLOAD,
+                         type_CtrlAlt[hairy]))
                return 0;
              /* If in neither list, report all the modifiers we see COMBINED
                 WITH the reported character.  */
-             if (strchr(S_TYPES_TO_REPORT_CHARACTER_PAYLOAD_WITH_MODIFIERS,
+             if (strchr (S_TYPES_TO_REPORT_CHARACTER_PAYLOAD_WITH_MODIFIERS,
                          type_CtrlAlt[hairy]))
                strip_ExtraMods = 0;
            }
@@ -3572,7 +3592,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM 
lParam)
                 keycode, and expansion.  (Additionally, one knows
                 boundaries of expansion of different keypresses.)  */
              res = deliver_wm_chars (1, hwnd, msg, wParam, lParam, 1);
-             windows_translate = -( res != 0 );
+             windows_translate = -(res != 0);
              if (res > 0) /* Bound to character(s) or a deadkey */
                break;
              /* deliver_wm_chars may make some branches after this vestigal.  
*/
@@ -4954,7 +4974,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
   bool minibuffer_only = false;
   long window_prompting = 0;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   Lisp_Object display;
   struct w32_display_info *dpyinfo = NULL;
   Lisp_Object parent;
@@ -5003,7 +5022,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
   /* No need to protect DISPLAY because that's not used after passing
      it to make_frame_without_minibuffer.  */
   frame = Qnil;
-  GCPRO4 (parameters, parent, name, frame);
   tem = x_get_arg (dpyinfo, parameters, Qminibuffer, "minibuffer", 
"Minibuffer",
                   RES_TYPE_SYMBOL);
   if (EQ (tem, Qnone) || NILP (tem))
@@ -5265,8 +5283,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
     if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
       fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
 
-  UNGCPRO;
-
   /* Make sure windows on this frame appear in calls to next-window
      and similar functions.  */
   Vwindow_list = Qnil;
@@ -5590,7 +5606,6 @@ w32_display_monitor_attributes_list (void)
   Lisp_Object monitor_list = Qnil, monitor_frames, rest, frame;
   int i, n_monitors;
   HMONITOR *monitors;
-  struct gcpro gcpro1, gcpro2, gcpro3;
 
   if (!(enum_display_monitors_fn && get_monitor_info_fn
        && monitor_from_window_fn))
@@ -5632,8 +5647,6 @@ w32_display_monitor_attributes_list (void)
        }
     }
 
-  GCPRO3 (attributes_list, primary_monitor_attributes, monitor_frames);
-
   for (i = 0; i < n_monitors; i++)
     {
       Lisp_Object geometry, workarea, name, attributes = Qnil;
@@ -5681,8 +5694,6 @@ w32_display_monitor_attributes_list (void)
   if (!NILP (primary_monitor_attributes))
     attributes_list = Fcons (primary_monitor_attributes, attributes_list);
 
-  UNGCPRO;
-
   xfree (monitors);
 
   return attributes_list;
@@ -5869,20 +5880,15 @@ terminate Emacs if we can't open the connection.
      HOME directory, then in Emacs etc dir for a file called rgb.txt. */
   {
     Lisp_Object color_file;
-    struct gcpro gcpro1;
 
     color_file = build_string ("~/rgb.txt");
 
-    GCPRO1 (color_file);
-
     if (NILP (Ffile_readable_p (color_file)))
       color_file =
        Fexpand_file_name (build_string ("rgb.txt"),
                           Fsymbol_value (intern ("data-directory")));
 
     Vw32_color_map = Fx_load_color_file (color_file);
-
-    UNGCPRO;
   }
   if (NILP (Vw32_color_map))
     Vw32_color_map = w32_default_color_map ();
@@ -6170,7 +6176,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
   long window_prompting = 0;
   int width, height;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3;
   struct kboard *kb;
   bool face_change_before = face_change;
   Lisp_Object buffer;
@@ -6195,7 +6200,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
   Vx_resource_name = name;
 
   frame = Qnil;
-  GCPRO3 (parms, name, frame);
   /* Make a frame without minibuffer nor mode-line.  */
   f = make_frame (false);
   f->wants_modeline = 0;
@@ -6371,8 +6375,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
 
   f->no_split = true;
 
-  UNGCPRO;
-
   /* Now that the frame is official, it counts as a reference to
      its display.  */
   FRAME_DISPLAY_INFO (f)->reference_count++;
@@ -6531,14 +6533,11 @@ Text larger than the specified size is clipped.  */)
   struct text_pos pos;
   int i, width, height;
   bool seen_reversed_p;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   int old_windows_or_buffers_changed = windows_or_buffers_changed;
   ptrdiff_t count = SPECPDL_INDEX ();
 
   specbind (Qinhibit_redisplay, Qt);
 
-  GCPRO4 (string, parms, frame, timeout);
-
   CHECK_STRING (string);
   f = decode_window_system_frame (frame);
   if (NILP (timeout))
@@ -6820,7 +6819,6 @@ Text larger than the specified size is clipped.  */)
   tip_timer = call3 (intern ("run-at-time"), timeout, Qnil,
                     intern ("x-hide-tip"));
 
-  UNGCPRO;
   return unbind_to (count, Qnil);
 }
 
@@ -6832,7 +6830,6 @@ Value is t if tooltip was open, nil otherwise.  */)
 {
   ptrdiff_t count;
   Lisp_Object deleted, frame, timer;
-  struct gcpro gcpro1, gcpro2;
 
   /* Return quickly if nothing to do.  */
   if (NILP (tip_timer) && NILP (tip_frame))
@@ -6840,7 +6837,6 @@ Value is t if tooltip was open, nil otherwise.  */)
 
   frame = tip_frame;
   timer = tip_timer;
-  GCPRO2 (frame, timer);
   tip_frame = tip_timer = deleted = Qnil;
 
   count = SPECPDL_INDEX ();
@@ -6856,7 +6852,6 @@ Value is t if tooltip was open, nil otherwise.  */)
       deleted = Qt;
     }
 
-  UNGCPRO;
   return unbind_to (count, deleted);
 }
 
@@ -7029,13 +7024,7 @@ value of DIR as in previous invocations; this is 
standard Windows behavior.  */)
   char fname_ret[MAX_UTF8_PATH];
 #endif /* NTGUI_UNICODE */
 
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
-  GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, filename);
-
   {
-    struct gcpro gcpro1, gcpro2;
-    GCPRO2 (orig_dir, orig_prompt); /* There is no GCPRON, N>6.  */
-
     /* Note: under NTGUI_UNICODE, we do _NOT_ use ENCODE_FILE: the
        system file encoding expected by the platform APIs (e.g. Cygwin's
        POSIX implementation) may not be the same as the encoding expected
@@ -7264,15 +7253,13 @@ value of DIR as in previous invocations; this is 
standard Windows behavior.  */)
        Qfile_name_history,
        default_filename,
        Qnil);
-
-    UNGCPRO;
   }
 
   /* Make "Cancel" equivalent to C-g.  */
   if (NILP (filename))
     Fsignal (Qquit, Qnil);
 
-  RETURN_UNGCPRO (filename);
+  return filename;
 }
 
 
@@ -7478,7 +7465,6 @@ a ShowWindow flag:
   char *doc_a = NULL, *params_a = NULL, *ops_a = NULL;
   Lisp_Object absdoc, handler;
   BOOL success;
-  struct gcpro gcpro1;
 #endif
 
   CHECK_STRING (document);
@@ -7578,7 +7564,6 @@ a ShowWindow flag:
      absolute.  But DOCUMENT does not have to be a file, it can be a
      URL, for example.  So we make it absolute only if it is an
      existing file; if it is a file that does not exist, tough.  */
-  GCPRO1 (absdoc);
   absdoc = Fexpand_file_name (document, Qnil);
   /* Don't call file handlers for file-exists-p, since they might
      attempt to access the file, which could fail or produce undesired
@@ -7602,7 +7587,6 @@ a ShowWindow flag:
     }
   else
     document = ENCODE_FILE (document);
-  UNGCPRO;
 
   current_dir = ENCODE_FILE (current_dir);
   /* Cannot use filename_to_utf16/ansi with DOCUMENT, since it could
@@ -7748,22 +7732,17 @@ w32_parse_hot_key (Lisp_Object key)
   int vk_code;
   int lisp_modifiers;
   int w32_modifiers;
-  struct gcpro gcpro1;
 
   CHECK_VECTOR (key);
 
   if (ASIZE (key) != 1)
     return Qnil;
 
-  GCPRO1 (key);
-
   c = AREF (key, 0);
 
   if (CONSP (c) && lucid_event_type_list_p (c))
     c = Fevent_convert_list (c);
 
-  UNGCPRO;
-
   if (! INTEGERP (c) && ! SYMBOLP (c))
     error ("Key definition is invalid");
 
@@ -7982,183 +7961,249 @@ This is a direct interface to the Windows API 
FindWindow function.  */)
   return Qt;
 }
 
-DEFUN ("w32-frame-menu-bar-size", Fw32_frame_menu_bar_size, 
Sw32_frame_menu_bar_size, 0, 1, 0,
-       doc: /* Return sizes of menu bar on frame FRAME.
-The return value is a list of four elements: The current width and
-height of FRAME's menu bar in pixels, the height of one menu bar line in
-a wrapped menu bar in pixels, and the height of a single line menu bar
-in pixels.
-
-If FRAME is omitted or nil, the selected frame is used.  */)
-  (Lisp_Object frame)
-{
-  struct frame *f = decode_any_frame (frame);
-  MENUBARINFO menu_bar;
-  int width, height, single_height, wrapped_height;
-
-  if (FRAME_INITIAL_P (f) || !FRAME_W32_P (f))
-    return Qnil;
+DEFUN ("w32-frame-geometry", Fw32_frame_geometry, Sw32_frame_geometry, 0, 1, 0,
+       doc: /* Return geometric attributes of FRAME.
+FRAME must be a live frame and defaults to the selected one.  The return
+value is an association list of the attributes listed below.  All height
+and width values are in pixels.
 
-  block_input ();
+`outer-position' is a cons of the outer left and top edges of FRAME
+  relative to the origin - the position (0, 0) - of FRAME's display.
 
-  single_height = GetSystemMetrics (SM_CYMENU);
-  wrapped_height = GetSystemMetrics (SM_CYMENUSIZE);
-  menu_bar.cbSize = sizeof (menu_bar);
-  menu_bar.rcBar.right = menu_bar.rcBar.left = 0;
-  menu_bar.rcBar.top = menu_bar.rcBar.bottom = 0;
-  GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &menu_bar);
-  width = menu_bar.rcBar.right - menu_bar.rcBar.left;
-  height = menu_bar.rcBar.bottom - menu_bar.rcBar.top;
+`outer-size' is a cons of the outer width and height of FRAME.  The
+  outer size includes the title bar and the external borders as well as
+  any menu and/or tool bar of frame.
 
-  unblock_input ();
+`external-border-size' is a cons of the horizontal and vertical width of
+  FRAME's external borders as supplied by the window manager.
 
-  return list4 (make_number (width), make_number (height),
-               make_number (wrapped_height), make_number (single_height));
-}
+`title-bar-size' is a cons of the width and height of the title bar of
+  FRAME as supplied by the window manager.  If both of them are zero,
+  FRAME has no title bar.  If only the width is zero, Emacs was not
+  able to retrieve the width information.
 
-DEFUN ("w32-frame-rect", Fw32_frame_rect, Sw32_frame_rect, 0, 2, 0,
-       doc: /* Return boundary rectangle of FRAME in screen coordinates.
-FRAME must be a live frame and defaults to the selected one.
+`menu-bar-external', if non-nil, means the menu bar is external (never
+  included in the inner edges of FRAME).
 
-The boundary rectangle is a list of four elements, specifying the left,
-top, right and bottom screen coordinates of FRAME including menu and
-title bar and decorations.  Optional argument CLIENT non-nil means to
-return the boundaries of the client rectangle which excludes menu and
-title bar and decorations.  */)
-  (Lisp_Object frame, Lisp_Object client)
-{
-  struct frame *f = decode_live_frame (frame);
-  RECT rect;
-
-  if (FRAME_INITIAL_P (f) || !FRAME_W32_P (f))
-    return Qnil;
-
-  block_input ();
-
-  if (!NILP (client))
-    GetClientRect (FRAME_W32_WINDOW (f), &rect);
-  else
-    GetWindowRect (FRAME_W32_WINDOW (f), &rect);
-
-  unblock_input ();
-
-  return list4 (make_number (rect.left), make_number (rect.top),
-               make_number (rect.right), make_number (rect.bottom));
-}
-
-DEFUN ("x-frame-geometry", Fx_frame_geometry, Sx_frame_geometry, 0, 1, 0,
-       doc: /* Return geometric attributes of frame FRAME.
-FRAME must be a live frame and defaults to the selected one.
-
-The return value is an association list containing the following
-elements (all size values are in pixels).
-
-- `frame-outer-size' is a cons of the outer width and height of FRAME.
-  The outer size includes the title bar and the external borders as well
-  as any menu and/or tool bar of frame.
-
-- `border' is a cons of the horizontal and vertical width of FRAME's
-  external borders.
-
-- `title-bar-height' is the height of the title bar of FRAME.
-
-- `menu-bar-external' if t means the menu bar is by default external
-  (not included in the inner size of FRAME).
-
-- `menu-bar-size' is a cons of the width and height of the menu bar of
+`menu-bar-size' is a cons of the width and height of the menu bar of
   FRAME.
 
-- `tool-bar-external' if t means the tool bar is by default external
-  (not included in the inner size of FRAME).
+`tool-bar-external', if non-nil, means the tool bar is external (never
+  included in the inner edges of FRAME).
 
-- `tool-bar-side' tells tells on which side the tool bar on FRAME is by
-  default and can be one of `left', `top', `right' or `bottom'.
+`tool-bar-position' tells on which side the tool bar on FRAME is and can
+  be one of `left', `top', `right' or `bottom'.  If this is nil, FRAME
+  has no tool bar.
 
-- `tool-bar-size' is a cons of the width and height of the tool bar of
+`tool-bar-size' is a cons of the width and height of the tool bar of
   FRAME.
 
-- `frame-inner-size' is a cons of the inner width and height of FRAME.
-  This excludes FRAME's title bar and external border as well as any
-  external menu and/or tool bar.  */)
+`internal-border-width' is the width of the internal border of
+  FRAME.  */)
   (Lisp_Object frame)
 {
   struct frame *f = decode_live_frame (frame);
-  Lisp_Object geometry = Qnil;
-  RECT frame_outer_edges, frame_inner_edges;
+
   MENUBARINFO menu_bar;
-  int  border_width, border_height, title_height;
-  int single_bar_height, wrapped_bar_height, menu_bar_height;
-  Lisp_Object fullscreen = Fframe_parameter (frame, Qfullscreen);
+  WINDOWINFO window;
+  int left, top, right, bottom;
+  unsigned int external_border_width, external_border_height;
+  int title_bar_width = 0, title_bar_height = 0;
+  int single_menu_bar_height, wrapped_menu_bar_height, menu_bar_height;
+  int tool_bar_height = FRAME_TOOL_BAR_HEIGHT (f);
+  int internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
+  bool fullboth = EQ (get_frame_param (f, Qfullscreen), Qfullboth);
 
   if (FRAME_INITIAL_P (f) || !FRAME_W32_P (f))
     return Qnil;
 
   block_input ();
-
-  /* Outer frame rectangle, including outer borders and title bar. */
-  GetWindowRect (FRAME_W32_WINDOW (f), &frame_outer_edges);
-  /* Inner frame rectangle, excluding borders and title bar.  */
-  GetClientRect (FRAME_W32_WINDOW (f), &frame_inner_edges);
-  /* Outer border.  */
-  border_width = GetSystemMetrics (SM_CXFRAME);
-  border_height = GetSystemMetrics (SM_CYFRAME);
+  /* Outer rectangle and borders.  */
+  window.cbSize = sizeof (window);
+  GetWindowInfo (FRAME_W32_WINDOW (f), &window);
+  external_border_width = window.cxWindowBorders;
+  external_border_height = window.cyWindowBorders;
   /* Title bar.  */
-  title_height = GetSystemMetrics (SM_CYCAPTION);
+  if (get_title_bar_info_fn)
+    {
+      TITLEBAR_INFO title_bar;
+
+      title_bar.cbSize = sizeof (title_bar);
+      title_bar.rcTitleBar.left = title_bar.rcTitleBar.right = 0;
+      title_bar.rcTitleBar.top = title_bar.rcTitleBar.bottom = 0;
+      for (int i = 0; i < 6; i++)
+       title_bar.rgstate[i] = 0;
+      if (get_title_bar_info_fn (FRAME_W32_WINDOW (f), &title_bar)
+         && !(title_bar.rgstate[0] & 0x00008001))
+       {
+         title_bar_width
+           = title_bar.rcTitleBar.right - title_bar.rcTitleBar.left;
+         title_bar_height
+           = title_bar.rcTitleBar.bottom - title_bar.rcTitleBar.top;
+       }
+    }
+  else if ((window.dwStyle & WS_CAPTION) == WS_CAPTION)
+    title_bar_height = GetSystemMetrics (SM_CYCAPTION);
   /* Menu bar.  */
   menu_bar.cbSize = sizeof (menu_bar);
   menu_bar.rcBar.right = menu_bar.rcBar.left = 0;
   menu_bar.rcBar.top = menu_bar.rcBar.bottom = 0;
   GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &menu_bar);
-  single_bar_height = GetSystemMetrics (SM_CYMENU);
-  wrapped_bar_height = GetSystemMetrics (SM_CYMENUSIZE);
+  single_menu_bar_height = GetSystemMetrics (SM_CYMENU);
+  wrapped_menu_bar_height = GetSystemMetrics (SM_CYMENUSIZE);
   unblock_input ();
 
+  left = window.rcWindow.left;
+  top = window.rcWindow.top;
+  right = window.rcWindow.right;
+  bottom = window.rcWindow.bottom;
+
+  /* Menu bar.  */
   menu_bar_height = menu_bar.rcBar.bottom - menu_bar.rcBar.top;
   /* Fix menu bar height reported by GetMenuBarInfo.  */
-  if (menu_bar_height > single_bar_height)
+  if (menu_bar_height > single_menu_bar_height)
     /* A wrapped menu bar.  */
-    menu_bar_height += single_bar_height - wrapped_bar_height;
+    menu_bar_height += single_menu_bar_height - wrapped_menu_bar_height;
   else if (menu_bar_height > 0)
     /* A single line menu bar.  */
-    menu_bar_height = single_bar_height;
-
-  return
-    listn (CONSTYPE_HEAP, 10,
-          Fcons (Qframe_position,
-                 Fcons (make_number (frame_outer_edges.left),
-                        make_number (frame_outer_edges.top))),
-          Fcons (Qframe_outer_size,
-                 Fcons (make_number
-                        (frame_outer_edges.right - frame_outer_edges.left),
-                        make_number
-                        (frame_outer_edges.bottom - frame_outer_edges.top))),
+    menu_bar_height = single_menu_bar_height;
+
+  return listn (CONSTYPE_HEAP, 10,
+               Fcons (Qouter_position,
+                      Fcons (make_number (left), make_number (top))),
+               Fcons (Qouter_size,
+                      Fcons (make_number (right - left),
+                             make_number (bottom - top))),
           Fcons (Qexternal_border_size,
-                 ((EQ (fullscreen, Qfullboth) || EQ (fullscreen, Qfullscreen))
-                  ? Fcons (make_number (0), make_number (0))
-                  : Fcons (make_number (border_width),
-                           make_number (border_height)))),
-          Fcons (Qtitle_height,
-                 ((EQ (fullscreen, Qfullboth) || EQ (fullscreen, Qfullscreen))
-                  ? make_number (0)
-                  : make_number (title_height))),
+                      Fcons (make_number (external_border_width),
+                             make_number (external_border_height))),
+               Fcons (Qtitle_bar_size,
+                      Fcons (make_number (title_bar_width),
+                             make_number (title_bar_height))),
           Fcons (Qmenu_bar_external, Qt),
           Fcons (Qmenu_bar_size,
                  Fcons (make_number
                         (menu_bar.rcBar.right - menu_bar.rcBar.left),
                         make_number (menu_bar_height))),
           Fcons (Qtool_bar_external, Qnil),
-          Fcons (Qtool_bar_position, Qtop),
+               Fcons (Qtool_bar_position, tool_bar_height ? Qtop : Qnil),
           Fcons (Qtool_bar_size,
-                 Fcons (make_number (FRAME_TOOL_BAR_LINES (f)
-                                     ? (FRAME_PIXEL_WIDTH (f)
-                                        - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
+                      Fcons (make_number
+                             (tool_bar_height
+                              ? right - left - 2 * internal_border_width
                                      : 0),
-                        make_number (FRAME_TOOL_BAR_HEIGHT (f)))),
-          Fcons (Qframe_inner_size,
-                 Fcons (make_number
-                        (frame_inner_edges.right - frame_inner_edges.left),
-                        make_number
-                        (frame_inner_edges.bottom - frame_inner_edges.top))));
+                             make_number (tool_bar_height))),
+               Fcons (Qinternal_border_width,
+                      make_number (internal_border_width)));
+}
+
+DEFUN ("w32-frame-edges", Fw32_frame_edges, Sw32_frame_edges, 0, 2, 0,
+       doc: /* Return edge coordinates of FRAME.
+FRAME must be a live frame and defaults to the selected one.  The return
+value is a list of the form (LEFT, TOP, RIGHT, BOTTOM).  All values are
+in pixels relative to the origin - the position (0, 0) - of FRAME's
+display.
+
+If optional argument TYPE is the symbol `outer-edges', return the outer
+edges of FRAME.  The outer edges comprise the decorations of the window
+manager (like the title bar or external borders) as well as any external
+menu or tool bar of FRAME.  If optional argument TYPE is the symbol
+`native-edges' or nil, return the native edges of FRAME.  The native
+edges exclude the decorations of the window manager and any external
+menu or tool bar of FRAME.  If TYPE is the symbol `inner-edges', return
+the inner edges of FRAME.  These edges exclude title bar, any borders,
+menu bar or tool bar of FRAME.  */)
+  (Lisp_Object frame, Lisp_Object type)
+{
+  struct frame *f = decode_live_frame (frame);
+
+  if (FRAME_INITIAL_P (f) || !FRAME_W32_P (f))
+    return Qnil;
+
+  if (EQ (type, Qouter_edges))
+    {
+      RECT rectangle;
+
+      block_input ();
+      /* Outer frame rectangle, including outer borders and title bar. */
+      GetWindowRect (FRAME_W32_WINDOW (f), &rectangle);
+      unblock_input ();
+
+      return list4 (make_number (rectangle.left),
+                   make_number (rectangle.top),
+                   make_number (rectangle.right),
+                   make_number (rectangle.bottom));
+    }
+  else
+    {
+      RECT rectangle;
+      POINT pt;
+      int left, top, right, bottom;
+
+      block_input ();
+      /* Inner frame rectangle, excluding borders and title bar.  */
+      GetClientRect (FRAME_W32_WINDOW (f), &rectangle);
+      /* Get top-left corner of native rectangle in screen
+        coordinates.  */
+      pt.x = 0;
+      pt.y = 0;
+      ClientToScreen (FRAME_W32_WINDOW (f), &pt);
+      unblock_input ();
+
+      left = pt.x;
+      top = pt.y;
+      right = left + rectangle.right;
+      bottom = top + rectangle.bottom;
+
+      if (EQ (type, Qinner_edges))
+       {
+         int internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
+
+         return list4 (make_number (left + internal_border_width),
+                       make_number (top
+                                    + FRAME_TOOL_BAR_HEIGHT (f)
+                                    + internal_border_width),
+                       make_number (right - internal_border_width),
+                       make_number (bottom - internal_border_width));
+       }
+      else
+       return list4 (make_number (left), make_number (top),
+                     make_number (right), make_number (bottom));
+    }
+}
+
+DEFUN ("w32-mouse-absolute-pixel-position", Fw32_mouse_absolute_pixel_position,
+       Sw32_mouse_absolute_pixel_position, 0, 0, 0,
+       doc: /* Return absolute position of mouse cursor in pixels.
+The position is returned as a cons cell (X . Y) of the coordinates of
+the mouse cursor position in pixels relative to a position (0, 0) of the
+selected frame's display.  */)
+  (void)
+{
+  POINT pt;
+
+  block_input ();
+  GetCursorPos (&pt);
+  unblock_input ();
+
+  return Fcons (make_number (pt.x), make_number (pt.y));
+}
+
+DEFUN ("w32-set-mouse-absolute-pixel-position", 
Fw32_set_mouse_absolute_pixel_position,
+       Sw32_set_mouse_absolute_pixel_position, 2, 2, 0,
+       doc: /* Move mouse pointer to absolute pixel position (X, Y).
+The coordinates X and Y are interpreted in pixels relative to a position
+(0, 0) of the selected frame's display.  */)
+  (Lisp_Object x, Lisp_Object y)
+{
+  CHECK_TYPE_RANGED_INTEGER (int, x);
+  CHECK_TYPE_RANGED_INTEGER (int, y);
+
+  block_input ();
+  SetCursorPos (XINT (x), XINT (y));
+  unblock_input ();
+
+  return Qnil;
 }
 
 DEFUN ("w32-battery-status", Fw32_battery_status, Sw32_battery_status, 0, 0, 0,
@@ -9158,6 +9203,16 @@ Default is nil.
 This variable has effect only on NT family of systems, not on Windows 9X.  */);
   w32_use_fallback_wm_chars_method = 0;
 
+  DEFVAR_BOOL ("w32-disable-new-uniscribe-apis",
+              w32_disable_new_uniscribe_apis,
+              doc: /* Non-nil means don't use new Uniscribe APIs.
+The new APIs are used to access OTF features supported by fonts.
+This is intended only for debugging of the new Uniscribe-related code.
+Default is nil.
+
+This variable has effect only on Windows Vista and later.  */);
+  w32_disable_new_uniscribe_apis = 0;
+
 #if 0 /* TODO: Port to W32 */
   defsubr (&Sx_change_window_property);
   defsubr (&Sx_delete_window_property);
@@ -9184,7 +9239,10 @@ This variable has effect only on NT family of systems, 
not on Windows 9X.  */);
   defsubr (&Sx_open_connection);
   defsubr (&Sx_close_connection);
   defsubr (&Sx_display_list);
-  defsubr (&Sx_frame_geometry);
+  defsubr (&Sw32_frame_geometry);
+  defsubr (&Sw32_frame_edges);
+  defsubr (&Sw32_mouse_absolute_pixel_position);
+  defsubr (&Sw32_set_mouse_absolute_pixel_position);
   defsubr (&Sx_synchronize);
 
   /* W32 specific functions */
@@ -9200,8 +9258,6 @@ This variable has effect only on NT family of systems, 
not on Windows 9X.  */);
   defsubr (&Sw32_reconstruct_hot_key);
   defsubr (&Sw32_toggle_lock_key);
   defsubr (&Sw32_window_exists_p);
-  defsubr (&Sw32_frame_rect);
-  defsubr (&Sw32_frame_menu_bar_size);
   defsubr (&Sw32_battery_status);
   defsubr (&Sw32__menu_bar_in_use);
 
@@ -9239,18 +9295,71 @@ static DWORD except_code;
 static PVOID except_addr;
 
 #ifndef CYGWIN
+
+/* Stack overflow recovery.  */
+
+/* Re-establish the guard page at stack limit.  This is needed because
+   when a stack overflow is detected, Windows removes the guard bit
+   from the guard page, so if we don't re-establish that protection,
+   the next stack overflow will cause a crash.  */
+void
+w32_reset_stack_overflow_guard (void)
+{
+  /* MinGW headers don't declare this (should be in malloc.h).  */
+  _CRTIMP int __cdecl _resetstkoflw (void);
+
+  /* We ignore the return value.  If _resetstkoflw fails, the next
+     stack overflow will crash the program.  */
+  (void)_resetstkoflw ();
+}
+
+static void
+stack_overflow_handler (void)
+{
+  /* Hard GC error may lead to stack overflow caused by
+     too nested calls to mark_object.  No way to survive.  */
+  if (gc_in_progress)
+    terminate_due_to_signal (SIGSEGV, 40);
+#ifdef _WIN64
+  /* See ms-w32.h: MinGW64's longjmp crashes if invoked in this context.  */
+  __builtin_longjmp (return_to_command_loop, 1);
+#else
+  sys_longjmp (return_to_command_loop, 1);
+#endif
+}
+
 /* This handler records the exception code and the address where it
    was triggered so that this info could be included in the backtrace.
    Without that, the backtrace in some cases has no information
    whatsoever about the offending code, and looks as if the top-level
-   exception handler in the MinGW startup code di the one that
-   crashed.  */
+   exception handler in the MinGW startup code was the one that
+   crashed.  We also recover from stack overflow, by calling our stack
+   overflow handler that jumps back to top level.  */
 static LONG CALLBACK
 my_exception_handler (EXCEPTION_POINTERS * exception_data)
 {
   except_code = exception_data->ExceptionRecord->ExceptionCode;
   except_addr = exception_data->ExceptionRecord->ExceptionAddress;
 
+  /* If this is a stack overflow exception, attempt to recover.  */
+  if (exception_data->ExceptionRecord->ExceptionCode == 
EXCEPTION_STACK_OVERFLOW
+      && exception_data->ExceptionRecord->NumberParameters == 2
+      /* We can only longjmp to top level from the main thread.  */
+      && GetCurrentThreadId () == dwMainThreadId)
+    {
+      /* Call stack_overflow_handler ().  */
+#ifdef _WIN64
+      exception_data->ContextRecord->Rip = (DWORD_PTR) &stack_overflow_handler;
+#else
+      exception_data->ContextRecord->Eip = (DWORD_PTR) &stack_overflow_handler;
+#endif
+      /* Zero this out, so the stale address of the stack overflow
+        exception we handled is not displayed in some future
+        unrelated crash.  */
+      except_addr = 0;
+      return EXCEPTION_CONTINUE_EXECUTION;
+    }
+
   if (prev_exception_handler)
     return prev_exception_handler (exception_data);
   return EXCEPTION_EXECUTE_HANDLER;
@@ -9413,6 +9522,8 @@ globals_of_w32fns (void)
     GetProcAddress (user32_lib, "MonitorFromWindow");
   enum_display_monitors_fn = (EnumDisplayMonitors_Proc)
     GetProcAddress (user32_lib, "EnumDisplayMonitors");
+  get_title_bar_info_fn = (GetTitleBarInfo_Proc)
+    GetProcAddress (user32_lib, "GetTitleBarInfo");
 
   {
     HMODULE imm32_lib = GetModuleHandle ("imm32.dll");
@@ -9442,10 +9553,16 @@ globals_of_w32fns (void)
   else
     w32_unicode_gui = 0;
 
+  after_deadkey = -1;
+
   /* MessageBox does not work without this when linked to comctl32.dll 6.0.  */
   InitCommonControls ();
 
   syms_of_w32uniscribe ();
+
+  /* Needed for recovery from C stack overflows in batch mode.  */
+  if (noninteractive)
+    dwMainThreadId = GetCurrentThreadId ();
 }
 
 #ifdef NTGUI_UNICODE
diff --git a/src/w32proc.c b/src/w32proc.c
index 66a9761..62d6531 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1748,13 +1748,9 @@ sys_spawnve (int mode, char *cmdname, char **argv, char 
**envp)
      absolute.  So we double-check this here, just in case.  */
   if (faccessat (AT_FDCWD, cmdname, X_OK, AT_EACCESS) != 0)
     {
-      struct gcpro gcpro1;
-
       program = build_string (cmdname);
       full = Qnil;
-      GCPRO1 (program);
       openp (Vexec_path, program, Vexec_suffixes, &full, make_number (X_OK), 
0);
-      UNGCPRO;
       if (NILP (full))
        {
          errno = EINVAL;
@@ -1813,9 +1809,27 @@ sys_spawnve (int mode, char *cmdname, char **argv, char 
**envp)
 
       cmdname = alloca (MAX_PATH);
       if (egetenv ("CMDPROXY"))
-       strcpy (cmdname, egetenv ("CMDPROXY"));
+       {
+         /* Implementation note: since process-environment, where
+            'egetenv' looks, is encoded in the system codepage, we
+            don't need to encode the cmdproxy file name if we get it
+            from the environment.  */
+         strcpy (cmdname, egetenv ("CMDPROXY"));
+       }
       else
-       strcpy (lispstpcpy (cmdname, Vinvocation_directory), "cmdproxy.exe");
+       {
+         char *q = lispstpcpy (cmdname,
+                               /* exec-directory needs to be encoded.  */
+                               ansi_encode_filename (Vexec_directory));
+         /* If we are run from the source tree, use cmdproxy.exe from
+            the same source tree.  */
+         for (p = q - 2; p > cmdname; p = CharPrevA (cmdname, p))
+           if (*p == '/')
+             break;
+         if (*p == '/' && xstrcasecmp (p, "/lib-src/") == 0)
+           q = stpcpy (p, "/nt/");
+         strcpy (q, "cmdproxy.exe");
+       }
 
       /* Can't use unixtodos_filename here, since that needs its file
         name argument encoded in UTF-8.  */
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 73c0410..8b3bf60 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -18,13 +18,15 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 
 #include <config.h>
-/* Override API version - Uniscribe is only available as standard since
-   Windows 2000, though most users of older systems will have it
+/* Override API version - Uniscribe is only available as standard
+   since Windows 2000, though most users of older systems will have it
    since it installs with Internet Explorer 5.0 and other software.
-   We only enable the feature if it is available, so there is no chance
-   of calling non-existent functions.  */
+   Also, MinGW64 w32api headers by default define OPENTYPE_TAG typedef
+   only if _WIN32_WINNT >= 0x0600.  We only use the affected APIs if
+   they are available, so there is no chance of calling non-existent
+   functions.  */
 #undef _WIN32_WINNT
-#define _WIN32_WINNT 0x500
+#define _WIN32_WINNT 0x0600
 #include <windows.h>
 #include <usp10.h>
 
@@ -141,7 +143,26 @@ uniscribe_close (struct font *font)
 }
 
 /* Return a list describing which scripts/languages FONT supports by
-   which GSUB/GPOS features of OpenType tables.  */
+   which GSUB/GPOS features of OpenType tables.
+
+   Implementation note: otf_features called by this function uses
+   GetFontData to access the font tables directly, instead of using
+   ScriptGetFontScriptTags etc. APIs even if those are available.  The
+   reason is that font-get, which uses the result of this function,
+   expects a cons cell (GSUB . GPOS) where the features are reported
+   separately for these 2 OTF tables, while the Uniscribe APIs report
+   the features as a single list.  There doesn't seem to be a reason
+   for returning the features in 2 separate parts, except for
+   compatibility with libotf; the features are disjoint (each can
+   appear only in one of the 2 slots), and no client of this data
+   discerns between the two slots: the few that request this data all
+   look in both slots.  If use of the Uniscribe APIs ever becomes
+   necessary here, and the 2 separate slots are still required, it
+   should be possible to split the feature list the APIs return into 2
+   because each sub-list is alphabetically sorted, so the place where
+   the sorting order breaks is where the GSUB features end and GPOS
+   features begin.  But for now, this is not necessary, so we leave
+   the original code in place.  */
 static Lisp_Object
 uniscribe_otf_capability (struct font *font)
 {
@@ -643,7 +664,7 @@ add_opentype_font_name_to_list (ENUMLOGFONTEX *logical_font,
 
 /* :otf property handling.
    Since the necessary Uniscribe APIs for getting font tag information
-   are only available in Vista, we need to parse the font data directly
+   are only available in Vista, we may need to parse the font data directly
    according to the OpenType Specification.  */
 
 /* Push into DWORD backwards to cope with endianness.  */
@@ -674,7 +695,171 @@ add_opentype_font_name_to_list (ENUMLOGFONTEX 
*logical_font,
     STR[4] = '\0';                                           \
   } while (0)
 
-#define SNAME(VAL) SDATA (SYMBOL_NAME (VAL))
+#define SNAME(VAL) SSDATA (SYMBOL_NAME (VAL))
+
+/* Uniscribe APIs available only since Windows Vista.  */
+typedef HRESULT (WINAPI *ScriptGetFontScriptTags_Proc)
+  (HDC, SCRIPT_CACHE *, SCRIPT_ANALYSIS *, int, OPENTYPE_TAG *, int *);
+
+typedef HRESULT (WINAPI *ScriptGetFontLanguageTags_Proc)
+  (HDC, SCRIPT_CACHE *, SCRIPT_ANALYSIS *, OPENTYPE_TAG, int, OPENTYPE_TAG *, 
int *);
+
+typedef HRESULT (WINAPI *ScriptGetFontFeatureTags_Proc)
+  (HDC, SCRIPT_CACHE *, SCRIPT_ANALYSIS *, OPENTYPE_TAG, OPENTYPE_TAG, int, 
OPENTYPE_TAG *, int *);
+
+ScriptGetFontScriptTags_Proc script_get_font_scripts_fn;
+ScriptGetFontLanguageTags_Proc script_get_font_languages_fn;
+ScriptGetFontFeatureTags_Proc script_get_font_features_fn;
+
+static bool uniscribe_new_apis;
+
+/* Verify that all the required features in FEATURES, each of whose
+   elements is a list or nil, can be found among the N feature tags in
+   FTAGS.  Return 'true' if the required features are supported,
+   'false' if not.  Each list in FEATURES can include an element of
+   nil, which means all the elements after it must not be in FTAGS.  */
+static bool
+uniscribe_check_features (Lisp_Object features[2], OPENTYPE_TAG *ftags, int n)
+{
+  int j;
+
+  for (j = 0; j < 2; j++)
+    {
+      bool negative = false;
+      Lisp_Object rest;
+
+      for (rest = features[j]; CONSP (rest); rest = XCDR (rest))
+       {
+         Lisp_Object feature = XCAR (rest);
+
+         /* The font must NOT have any of the features after nil.
+            See the doc string of 'font-spec', under ':otf'.  */
+         if (NILP (feature))
+           negative = true;
+         else
+           {
+             OPENTYPE_TAG feature_tag = OTF_TAG (SNAME (feature));
+             int i;
+
+             for (i = 0; i < n; i++)
+               {
+                 if (ftags[i] == feature_tag)
+                   {
+                     /* Test fails if we find a feature that the font
+                        must NOT have.  */
+                     if (negative)
+                       return false;
+                     break;
+                   }
+               }
+
+             /* Test fails if we do NOT find a feature that the font
+                should have.  */
+             if (i >= n && !negative)
+               return false;
+           }
+       }
+    }
+
+  return true;
+}
+
+/* Check if font supports the required OTF script/language/features
+   using the Unsicribe APIs available since Windows Vista.  We prefer
+   these APIs as a kind of future-proofing Emacs: they seem to
+   retrieve script tags that the old code (and also libotf) doesn't
+   seem to be able to get, e.g., some fonts that claim support for
+   "dev2" script don't show "deva", but the new APIs do report it.  */
+static int
+uniscribe_check_otf_1 (HDC context, Lisp_Object script, Lisp_Object lang,
+                      Lisp_Object features[2], int *retval)
+{
+  SCRIPT_CACHE cache = NULL;
+  OPENTYPE_TAG tags[32], script_tag, lang_tag;
+  int max_tags = ARRAYELTS (tags);
+  int ntags, i, ret = 0;
+  HRESULT rslt;
+  Lisp_Object rest;
+
+  *retval = 0;
+
+  rslt = script_get_font_scripts_fn (context, &cache, NULL, max_tags,
+                                    tags, &ntags);
+  if (FAILED (rslt))
+    {
+      DebPrint (("ScriptGetFontScriptTags failed with 0x%x\n", rslt));
+      ret = -1;
+      goto no_support;
+    }
+  if (NILP (script))
+    script_tag = OTF_TAG ("DFLT");
+  else
+    script_tag = OTF_TAG (SNAME (script));
+  for (i = 0; i < ntags; i++)
+    if (tags[i] == script_tag)
+      break;
+
+  if (i >= ntags)
+    goto no_support;
+
+  if (NILP (lang))
+    lang_tag = OTF_TAG ("dflt");
+  else
+    {
+      rslt = script_get_font_languages_fn (context, &cache, NULL, script_tag,
+                                          max_tags, tags, &ntags);
+      if (FAILED (rslt))
+       {
+         DebPrint (("ScriptGetFontLanguageTags failed with 0x%x\n", rslt));
+         ret = -1;
+         goto no_support;
+       }
+      if (ntags == 0)
+       lang_tag = OTF_TAG ("dflt");
+      else
+       {
+         lang_tag = OTF_TAG (SNAME (lang));
+         for (i = 0; i < ntags; i++)
+           if (tags[i] == lang_tag)
+             break;
+
+         if (i >= ntags)
+           goto no_support;
+       }
+    }
+
+  if (!NILP (features[0]))
+    {
+      /* Are the 2 feature lists valid?  */
+      if (!CONSP (features[0])
+         || (!NILP (features[1]) && !CONSP (features[1])))
+       goto no_support;
+      rslt = script_get_font_features_fn (context, &cache, NULL,
+                                         script_tag, lang_tag,
+                                         max_tags, tags, &ntags);
+      if (FAILED (rslt))
+       {
+         DebPrint (("ScriptGetFontFeatureTags failed with 0x%x\n", rslt));
+         ret = -1;
+         goto no_support;
+       }
+
+      /* ScriptGetFontFeatureTags doesn't let us query features
+        separately for GSUB and GPOS, so we check them all together.
+        It doesn't really matter, since the features in GSUB and GPOS
+        are disjoint, i.e. no feature can appear in both tables.  */
+      if (!uniscribe_check_features (features, tags, ntags))
+       goto no_support;
+    }
+
+  ret = 1;
+  *retval = 1;
+
+ no_support:
+  if (cache)
+    ScriptFreeCache (&cache);
+  return ret;
+}
 
 /* Check if font supports the otf script/language/features specified.
    OTF_SPEC is in the format
@@ -690,7 +875,6 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec)
   HDC context;
   HFONT check_font, old_font;
   int i, retval = 0;
-  struct gcpro gcpro1;
 
   /* Check the spec is in the right format.  */
   if (!CONSP (otf_spec) || XINT (Flength (otf_spec)) < 3)
@@ -710,6 +894,18 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec)
   else
     features[1] = XCAR (rest);
 
+  /* Set up graphics context so we can use the font.  */
+  f = XFRAME (selected_frame);
+  context = get_frame_dc (f);
+  check_font = CreateFontIndirect (font);
+  old_font = SelectObject (context, check_font);
+
+  /* If we are on Vista or later, use the new APIs.  */
+  if (uniscribe_new_apis
+      && !w32_disable_new_uniscribe_apis
+      && uniscribe_check_otf_1 (context, script, lang, features, &retval) != 
-1)
+    goto done;
+
   /* Set up tags we will use in the search.  */
   feature_tables[0] = OTF_TAG ("GSUB");
   feature_tables[1] = OTF_TAG ("GPOS");
@@ -721,16 +917,6 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec)
   if (!NILP (lang))
     lang_tag = OTF_TAG (SNAME (lang));
 
-  /* Set up graphics context so we can use the font.  */
-  f = XFRAME (selected_frame);
-  context = get_frame_dc (f);
-  check_font = CreateFontIndirect (font);
-  old_font = SelectObject (context, check_font);
-
-  /* Everything else is contained within otf_spec so should get
-     marked along with it.  */
-  GCPRO1 (otf_spec);
-
   /* Scan GSUB and GPOS tables.  */
   for (i = 0; i < 2; i++)
     {
@@ -739,6 +925,8 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec)
       unsigned short script_table, langsys_table, n_langs;
       unsigned short feature_index, n_features;
       DWORD tbl = feature_tables[i];
+      DWORD feature_id, *ftags;
+      Lisp_Object farray[2];
 
       /* Skip if no features requested from this table.  */
       if (NILP (features[i]))
@@ -805,51 +993,49 @@ uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec)
       /* Offset is from beginning of script table.  */
       langsys_table += script_table;
 
-      /* Check the features.  Features may contain nil according to
-        documentation in font_prop_validate_otf, so count them.  */
-      n_match_features = 0;
-      for (rest = features[i]; CONSP (rest); rest = XCDR (rest))
-       {
-         Lisp_Object feature = XCAR (rest);
-         if (!NILP (feature))
-           n_match_features++;
-       }
-
       /* If there are no features to check, skip checking.  */
-      if (!n_match_features)
+      if (NILP (features[i]))
        continue;
+      if (!CONSP (features[i]))
+       goto no_support;
+
+      n_match_features = 0;
 
-      /* First check required feature (if any).  */
+      /* First get required feature (if any).  */
       OTF_INT16_VAL (tbl, langsys_table + 2, &feature_index);
       if (feature_index != 0xFFFF)
+       n_match_features = 1;
+      OTF_INT16_VAL (tbl, langsys_table + 4, &n_features);
+      n_match_features += n_features;
+      USE_SAFE_ALLOCA;
+      SAFE_NALLOCA (ftags, 1, n_match_features);
+      int k = 0;
+      if (feature_index != 0xFFFF)
        {
-         char feature_id[5];
-         OTF_TAG_VAL (tbl, feature_table + 2 + feature_index * 6, feature_id);
-         OTF_TAG_VAL (tbl, feature_table + 2 + feature_index * 6, feature_id);
-         /* Assume no duplicates in the font table. This allows us to mark
-            the features off by simply decrementing a counter.  */
-         if (!NILP (Fmemq (intern (feature_id), features[i])))
-           n_match_features--;
+         OTF_DWORDTAG_VAL (tbl, feature_table + 2 + feature_index * 6,
+                           &feature_id);
+         ftags[k++] = feature_id;
        }
-      /* Now check all the other features.  */
-      OTF_INT16_VAL (tbl, langsys_table + 4, &n_features);
+      /* Now get all the other features.  */
       for (j = 0; j < n_features; j++)
        {
-         char feature_id[5];
          OTF_INT16_VAL (tbl, langsys_table + 6 + j * 2, &feature_index);
-         OTF_TAG_VAL (tbl, feature_table + 2 + feature_index * 6, feature_id);
-         /* Assume no duplicates in the font table. This allows us to mark
-            the features off by simply decrementing a counter.  */
-         if (!NILP (Fmemq (intern (feature_id), features[i])))
-           n_match_features--;
+         OTF_DWORDTAG_VAL (tbl, feature_table + 2 + feature_index * 6,
+                           &feature_id);
+         ftags[k++] = feature_id;
        }
 
-      if (n_match_features > 0)
+      /* Check the features for this table.  */
+      farray[0] = features[i];
+      farray[1] = Qnil;
+      if (!uniscribe_check_features (farray, ftags, n_match_features))
        goto no_support;
+      SAFE_FREE ();
     }
 
   retval = 1;
 
+ done:
  no_support:
  font_table_error:
   /* restore graphics context.  */
@@ -873,7 +1059,7 @@ otf_features (HDC context, char *table)
   OTF_INT16_VAL (tbl, 6, &feature_table);
   OTF_INT16_VAL (tbl, scriptlist_table, &n_scripts);
 
-  for (i = 0; i < n_scripts; i++)
+  for (i = n_scripts - 1; i >= 0; i--)
     {
       char script[5], lang[5];
       unsigned short script_table, lang_count, langsys_table, feature_count;
@@ -898,7 +1084,7 @@ otf_features (HDC context, char *table)
          langsys_tag = Qnil;
          feature_list = Qnil;
          OTF_INT16_VAL (tbl, langsys_table + 4, &feature_count);
-         for (k = 0; k < feature_count; k++)
+         for (k = feature_count - 1; k >= 0; k--)
            {
              char feature[5];
              unsigned short index;
@@ -913,7 +1099,7 @@ otf_features (HDC context, char *table)
       /* List of supported languages.  */
       OTF_INT16_VAL (tbl, script_table + 2, &lang_count);
 
-      for (j = 0; j < lang_count; j++)
+      for (j = lang_count - 1; j >= 0; j--)
        {
          record_offset = script_table + 4 + j * 6;
          OTF_TAG_VAL (tbl, record_offset, lang);
@@ -925,7 +1111,7 @@ otf_features (HDC context, char *table)
          langsys_tag = intern (lang);
          feature_list = Qnil;
          OTF_INT16_VAL (tbl, langsys_table + 4, &feature_count);
-         for (k = 0; k < feature_count; k++)
+         for (k = feature_count - 1; k >= 0; k--)
            {
              char feature[5];
              unsigned short index;
@@ -1003,4 +1189,17 @@ syms_of_w32uniscribe (void)
   uniscribe_available = 1;
 
   register_font_driver (&uniscribe_font_driver, NULL);
+
+  script_get_font_scripts_fn = (ScriptGetFontScriptTags_Proc)
+    GetProcAddress (uniscribe, "ScriptGetFontScriptTags");
+  script_get_font_languages_fn = (ScriptGetFontLanguageTags_Proc)
+    GetProcAddress (uniscribe, "ScriptGetFontLanguageTags");
+  script_get_font_features_fn = (ScriptGetFontFeatureTags_Proc)
+    GetProcAddress (uniscribe, "ScriptGetFontFeatureTags");
+  if (script_get_font_scripts_fn
+      && script_get_font_languages_fn
+      && script_get_font_features_fn)
+    uniscribe_new_apis = true;
+  else
+    uniscribe_new_apis = false;
 }
diff --git a/src/window.c b/src/window.c
index c1e82ec..bf5e715 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1104,186 +1104,6 @@ end-trigger value is reset to nil.  */)
   return value;
 }
 
-DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0,
-       doc: /* Return a list of the edge coordinates of WINDOW.
-WINDOW must be a valid window and defaults to the selected one.
-
-The returned list has the form (LEFT TOP RIGHT BOTTOM).  TOP and BOTTOM
-count by lines, and LEFT and RIGHT count by columns, all relative to 0,
-0 at top left corner of frame.
-
-RIGHT is one more than the rightmost column occupied by WINDOW.  BOTTOM
-is one more than the bottommost row occupied by WINDOW.  The edges
-include the space used by WINDOW's scroll bar, display margins, fringes,
-header line, and/or mode line.  For the edges of just the text area, use
-`window-inside-edges'.  */)
-  (Lisp_Object window)
-{
-  register struct window *w = decode_valid_window (window);
-
-  return list4i (WINDOW_LEFT_EDGE_COL (w), WINDOW_TOP_EDGE_LINE (w),
-                WINDOW_RIGHT_EDGE_COL (w), WINDOW_BOTTOM_EDGE_LINE (w));
-}
-
-DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0,
-       doc: /* Return a list of the edge pixel coordinates of WINDOW.
-WINDOW must be a valid window and defaults to the selected one.
-
-The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to
-0, 0 at the top left corner of the frame.
-
-RIGHT is one more than the rightmost x position occupied by WINDOW.
-BOTTOM is one more than the bottommost y position occupied by WINDOW.
-The pixel edges include the space used by WINDOW's scroll bar, display
-margins, fringes, header line, and/or mode line.  For the pixel edges
-of just the text area, use `window-inside-pixel-edges'.  */)
-  (Lisp_Object window)
-{
-  register struct window *w = decode_valid_window (window);
-
-  return list4i (WINDOW_LEFT_EDGE_X (w), WINDOW_TOP_EDGE_Y (w),
-                WINDOW_RIGHT_EDGE_X (w), WINDOW_BOTTOM_EDGE_Y (w));
-}
-
-static void
-calc_absolute_offset (struct window *w, int *add_x, int *add_y)
-{
-  struct frame *f = XFRAME (w->frame);
-  *add_y = f->top_pos;
-#ifdef FRAME_MENUBAR_HEIGHT
-  *add_y += FRAME_MENUBAR_HEIGHT (f);
-#endif
-#ifdef FRAME_TOOLBAR_TOP_HEIGHT
-  *add_y += FRAME_TOOLBAR_TOP_HEIGHT (f);
-#elif defined (FRAME_TOOLBAR_HEIGHT)
-  *add_y += FRAME_TOOLBAR_HEIGHT (f);
-#endif
-#ifdef FRAME_NS_TITLEBAR_HEIGHT
-  *add_y += FRAME_NS_TITLEBAR_HEIGHT (f);
-#endif
-  *add_x = f->left_pos;
-#ifdef FRAME_TOOLBAR_LEFT_WIDTH
-  *add_x += FRAME_TOOLBAR_LEFT_WIDTH (f);
-#endif
-}
-
-DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges,
-       Swindow_absolute_pixel_edges, 0, 1, 0,
-       doc: /* Return a list of the edge pixel coordinates of WINDOW.
-WINDOW must be a valid window and defaults to the selected one.
-
-The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to
-0, 0 at the top left corner of the display.
-
-RIGHT is one more than the rightmost x position occupied by WINDOW.
-BOTTOM is one more than the bottommost y position occupied by WINDOW.
-The pixel edges include the space used by WINDOW's scroll bar, display
-margins, fringes, header line, and/or mode line.  For the pixel edges
-of just the text area, use `window-inside-absolute-pixel-edges'.  */)
-  (Lisp_Object window)
-{
-  register struct window *w = decode_valid_window (window);
-  int add_x, add_y;
-
-  calc_absolute_offset (w, &add_x, &add_y);
-
-  return list4i (WINDOW_LEFT_EDGE_X (w) + add_x,
-                WINDOW_TOP_EDGE_Y (w) + add_y,
-                WINDOW_RIGHT_EDGE_X (w) + add_x,
-                WINDOW_BOTTOM_EDGE_Y (w) + add_y);
-}
-
-DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 
1, 0,
-       doc: /* Return a list of the edge coordinates of WINDOW.
-WINDOW must be a live window and defaults to the selected one.
-
-The returned list has the form (LEFT TOP RIGHT BOTTOM).  TOP and BOTTOM
-count by lines, and LEFT and RIGHT count by columns, all relative to 0,
-0 at top left corner of frame.
-
-RIGHT is one more than the rightmost column of WINDOW's text area.
-BOTTOM is one more than the bottommost row of WINDOW's text area.  The
-inside edges do not include the space used by the WINDOW's scroll bar,
-display margins, fringes, header line, and/or mode line.  */)
-  (Lisp_Object window)
-{
-  register struct window *w = decode_live_window (window);
-
-  return list4i ((WINDOW_BOX_LEFT_EDGE_COL (w)
-                 + WINDOW_LEFT_MARGIN_COLS (w)
-                 + ((WINDOW_LEFT_FRINGE_WIDTH (w)
-                     + WINDOW_FRAME_COLUMN_WIDTH (w) - 1)
-                    / WINDOW_FRAME_COLUMN_WIDTH (w))),
-                (WINDOW_TOP_EDGE_LINE (w)
-                 + WINDOW_HEADER_LINE_LINES (w)),
-                (WINDOW_BOX_RIGHT_EDGE_COL (w)
-                 - WINDOW_RIGHT_MARGIN_COLS (w)
-                 - ((WINDOW_RIGHT_FRINGE_WIDTH (w)
-                     + WINDOW_FRAME_COLUMN_WIDTH (w) - 1)
-                    / WINDOW_FRAME_COLUMN_WIDTH (w))),
-                (WINDOW_BOTTOM_EDGE_LINE (w)
-                 - WINDOW_MODE_LINE_LINES (w)));
-}
-
-DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, 
Swindow_inside_pixel_edges, 0, 1, 0,
-       doc: /* Return a list of the edge pixel coordinates of WINDOW's text 
area.
-WINDOW must be a live window and defaults to the selected one.
-
-The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to
-(0,0) at the top left corner of the frame's window area.
-
-RIGHT is one more than the rightmost x position of WINDOW's text area.
-BOTTOM is one more than the bottommost y position of WINDOW's text area.
-The inside edges do not include the space used by WINDOW's scroll bar,
-display margins, fringes, header line, and/or mode line.  */)
-  (Lisp_Object window)
-{
-  register struct window *w = decode_live_window (window);
-
-  return list4i ((WINDOW_BOX_LEFT_EDGE_X (w)
-                 + WINDOW_LEFT_MARGIN_WIDTH (w)
-                 + WINDOW_LEFT_FRINGE_WIDTH (w)),
-                (WINDOW_TOP_EDGE_Y (w)
-                 + WINDOW_HEADER_LINE_HEIGHT (w)),
-                (WINDOW_BOX_RIGHT_EDGE_X (w)
-                 - WINDOW_RIGHT_MARGIN_WIDTH (w)
-                 - WINDOW_RIGHT_FRINGE_WIDTH (w)),
-                (WINDOW_BOTTOM_EDGE_Y (w)
-                 - WINDOW_MODE_LINE_HEIGHT (w)));
-}
-
-DEFUN ("window-inside-absolute-pixel-edges",
-       Fwindow_inside_absolute_pixel_edges,
-       Swindow_inside_absolute_pixel_edges, 0, 1, 0,
-       doc: /* Return a list of the edge pixel coordinates of WINDOW's text 
area.
-WINDOW must be a live window and defaults to the selected one.
-
-The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to
-(0,0) at the top left corner of the frame's window area.
-
-RIGHT is one more than the rightmost x position of WINDOW's text area.
-BOTTOM is one more than the bottommost y position of WINDOW's text area.
-The inside edges do not include the space used by WINDOW's scroll bar,
-display margins, fringes, header line, and/or mode line.  */)
-  (Lisp_Object window)
-{
-  register struct window *w = decode_live_window (window);
-  int add_x, add_y;
-
-  calc_absolute_offset (w, &add_x, &add_y);
-
-  return list4i ((WINDOW_BOX_LEFT_EDGE_X (w)
-                 + WINDOW_LEFT_MARGIN_WIDTH (w)
-                 + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x),
-                (WINDOW_TOP_EDGE_Y (w)
-                 + WINDOW_HEADER_LINE_HEIGHT (w) + add_y),
-                (WINDOW_BOX_RIGHT_EDGE_X (w)
-                 - WINDOW_RIGHT_MARGIN_WIDTH (w)
-                 - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x),
-                (WINDOW_BOTTOM_EDGE_Y (w)
-                 - WINDOW_MODE_LINE_HEIGHT (w) + add_y));
-}
-
 /* Test if the character at column X, row Y is within window W.
    If it is not, return ON_NOTHING;
    if it is on the window's vertical divider, return
@@ -2816,7 +2636,6 @@ window_loop (enum window_loop type, Lisp_Object obj, bool 
mini,
   Lisp_Object window, windows, best_window, frame_arg;
   bool frame_best_window_flag = false;
   struct frame *f;
-  struct gcpro gcpro1;
 
   /* If we're only looping through windows on a particular frame,
      frame points to that frame.  If we're looping through windows
@@ -2850,7 +2669,6 @@ window_loop (enum window_loop type, Lisp_Object obj, bool 
mini,
     window = FRAME_SELECTED_WINDOW (SELECTED_FRAME ());
 
   windows = window_list_1 (window, mini ? Qt : Qnil, frame_arg);
-  GCPRO1 (windows);
   best_window = Qnil;
 
   for (; CONSP (windows); windows = XCDR (windows))
@@ -2878,7 +2696,7 @@ window_loop (enum window_loop type, Lisp_Object obj, bool 
mini,
              {
                if (EQ (window, selected_window))
                  /* Preferably return the selected window.  */
-                 RETURN_UNGCPRO (window);
+                 return window;
                else if (EQ (XWINDOW (window)->frame, selected_frame)
                         && !frame_best_window_flag)
                  /* Prefer windows on the current frame (but don't
@@ -2944,7 +2762,6 @@ window_loop (enum window_loop type, Lisp_Object obj, bool 
mini,
          }
     }
 
-  UNGCPRO;
   return best_window;
 }
 
@@ -7554,18 +7371,12 @@ displayed after a scrolling operation to be somewhat 
inaccurate.  */);
   defsubr (&Sset_window_hscroll);
   defsubr (&Swindow_redisplay_end_trigger);
   defsubr (&Sset_window_redisplay_end_trigger);
-  defsubr (&Swindow_edges);
-  defsubr (&Swindow_pixel_edges);
-  defsubr (&Swindow_absolute_pixel_edges);
   defsubr (&Swindow_mode_line_height);
   defsubr (&Swindow_header_line_height);
   defsubr (&Swindow_right_divider_width);
   defsubr (&Swindow_bottom_divider_width);
   defsubr (&Swindow_scroll_bar_width);
   defsubr (&Swindow_scroll_bar_height);
-  defsubr (&Swindow_inside_edges);
-  defsubr (&Swindow_inside_pixel_edges);
-  defsubr (&Swindow_inside_absolute_pixel_edges);
   defsubr (&Scoordinates_in_window_p);
   defsubr (&Swindow_at);
   defsubr (&Swindow_point);
diff --git a/src/xdisp.c b/src/xdisp.c
index 696d3fa..e68ff42 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -845,6 +845,9 @@ static void normal_char_ascent_descent (struct font *, int, 
int *, int *);
 static void append_stretch_glyph (struct it *, Lisp_Object,
                                   int, int, int);
 
+static Lisp_Object get_it_property (struct it *, Lisp_Object);
+static Lisp_Object calc_line_height_property (struct it *, Lisp_Object,
+                                             struct font *, int, bool);
 
 #endif /* HAVE_WINDOW_SYSTEM */
 
@@ -3723,10 +3726,8 @@ handle_fontified_prop (struct it *it)
       else
        {
          Lisp_Object fns, fn;
-         struct gcpro gcpro1, gcpro2;
 
          fns = Qnil;
-         GCPRO2 (val, fns);
 
          for (; CONSP (val); val = XCDR (val))
            {
@@ -3751,8 +3752,6 @@ handle_fontified_prop (struct it *it)
              else
                safe_call1 (fn, pos);
            }
-
-         UNGCPRO;
        }
 
       unbind_to (count, Qnil);
@@ -4190,13 +4189,13 @@ handle_invisible_prop (struct it *it)
 
   if (STRINGP (it->string))
     {
-      Lisp_Object end_charpos, limit, charpos;
+      Lisp_Object end_charpos, limit;
 
       /* Get the value of the invisible text property at the
         current position.  Value will be nil if there is no such
         property.  */
-      charpos = make_number (IT_STRING_CHARPOS (*it));
-      prop = Fget_text_property (charpos, Qinvisible, it->string);
+      end_charpos = make_number (IT_STRING_CHARPOS (*it));
+      prop = Fget_text_property (end_charpos, Qinvisible, it->string);
       invis = TEXT_PROP_MEANS_INVISIBLE (prop);
 
       if (invis != 0 && IT_STRING_CHARPOS (*it) < it->end_charpos)
@@ -4214,8 +4213,12 @@ handle_invisible_prop (struct it *it)
          XSETINT (limit, len);
          do
            {
-             end_charpos = Fnext_single_property_change (charpos, Qinvisible,
-                                                         it->string, limit);
+             end_charpos
+               = Fnext_single_property_change (end_charpos, Qinvisible,
+                                               it->string, limit);
+             /* Since LIMIT is always an integer, so should be the
+                value returned by Fnext_single_property_change.  */
+             eassert (INTEGERP (end_charpos));
              if (INTEGERP (end_charpos))
                {
                  endpos = XFASTINT (end_charpos);
@@ -4224,6 +4227,8 @@ handle_invisible_prop (struct it *it)
                  if (invis == 2)
                    display_ellipsis_p = true;
                }
+             else /* Should never happen; but if it does, exit the loop.  */
+               endpos = len;
            }
          while (invis != 0 && endpos < len);
 
@@ -4259,7 +4264,7 @@ handle_invisible_prop (struct it *it)
                }
              else
                {
-                 IT_STRING_CHARPOS (*it) = XFASTINT (end_charpos);
+                 IT_STRING_CHARPOS (*it) = endpos;
                  compute_string_pos (&it->current.string_pos, old, it->string);
                }
            }
@@ -4745,7 +4750,6 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
   if (!NILP (form) && !EQ (form, Qt))
     {
       ptrdiff_t count = SPECPDL_INDEX ();
-      struct gcpro gcpro1;
 
       /* Bind `object' to the object having the `display' property, a
         buffer or string.  Bind `position' to the position in the
@@ -4757,9 +4761,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
       specbind (Qobject, object);
       specbind (Qposition, make_number (CHARPOS (*position)));
       specbind (Qbuffer_position, make_number (bufpos));
-      GCPRO1 (form);
       form = safe_eval (form);
-      UNGCPRO;
       unbind_to (count, Qnil);
     }
 
@@ -5993,6 +5995,7 @@ pop_it (struct it *it)
 {
   struct iterator_stack_entry *p;
   bool from_display_prop = it->from_disp_prop_p;
+  ptrdiff_t prev_pos = IT_CHARPOS (*it);
 
   eassert (it->sp > 0);
   --it->sp;
@@ -6086,6 +6089,11 @@ pop_it (struct it *it)
                   && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos)
               || (CONSP (it->object) && it->method == GET_FROM_STRETCH));
     }
+  /* If we move the iterator over text covered by a display property
+     to a new buffer position, any info about previously seen overlays
+     is no longer valid.  */
+  if (from_display_prop && it->sp == 0 && CHARPOS (it->position) != prev_pos)
+    it->ignore_overlay_strings_at_pos_p = false;
 }
 
 
@@ -6913,9 +6921,10 @@ get_next_display_element (struct it *it)
             non-ASCII spaces and hyphens specially.  */
          if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display))
            {
-             if (c == 0xA0)
+             if (c == NO_BREAK_SPACE)
                nonascii_space_p = true;
-             else if (c == 0xAD || c == 0x2010 || c == 0x2011)
+             else if (c == SOFT_HYPHEN || c == HYPHEN
+                      || c == NON_BREAKING_HYPHEN)
                nonascii_hyphen_p = true;
            }
 
@@ -9832,33 +9841,53 @@ include the height of both, if present, in the return 
value.  */)
                               Messages
  ***********************************************************************/
 
+/* Return the number of arguments the format string FORMAT needs.  */
 
-/* Add a message with format string FORMAT and arguments ARG1 and ARG2
+static ptrdiff_t
+format_nargs (char const *format)
+{
+  ptrdiff_t nargs = 0;
+  for (char const *p = format; (p = strchr (p, '%')); p++)
+    if (p[1] == '%')
+      p++;
+    else
+      nargs++;
+  return nargs;
+}
+
+/* Add a message with format string FORMAT and formatted arguments
    to *Messages*.  */
 
 void
-add_to_log (const char *format, Lisp_Object arg1, Lisp_Object arg2)
+add_to_log (const char *format, ...)
 {
-  Lisp_Object msg, fmt;
-  char *buffer;
-  ptrdiff_t len;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
-  USE_SAFE_ALLOCA;
-
-  fmt = msg = Qnil;
-  GCPRO4 (fmt, msg, arg1, arg2);
-
-  fmt = build_string (format);
-  msg = CALLN (Fformat, fmt, arg1, arg2);
+  va_list ap;
+  va_start (ap, format);
+  vadd_to_log (format, ap);
+  va_end (ap);
+}
 
-  len = SBYTES (msg) + 1;
-  buffer = SAFE_ALLOCA (len);
+void
+vadd_to_log (char const *format, va_list ap)
+{
+  ptrdiff_t form_nargs = format_nargs (format);
+  ptrdiff_t nargs = 1 + form_nargs;
+  Lisp_Object args[10];
+  eassert (nargs <= ARRAYELTS (args));
+  AUTO_STRING (args0, format);
+  args[0] = args0;
+  for (ptrdiff_t i = 1; i <= nargs; i++)
+    args[i] = va_arg (ap, Lisp_Object);
+  Lisp_Object msg = Qnil;
+  msg = Fformat_message (nargs, args);
+
+  ptrdiff_t len = SBYTES (msg) + 1;
+  USE_SAFE_ALLOCA;
+  char *buffer = SAFE_ALLOCA (len);
   memcpy (buffer, SDATA (msg), len);
 
-  message_dolog (buffer, len - 1, true, false);
+  message_dolog (buffer, len - 1, true, STRING_MULTIBYTE (msg));
   SAFE_FREE ();
-
-  UNGCPRO;
 }
 
 
@@ -9897,7 +9926,6 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool 
nlflag, bool multibyte)
       ptrdiff_t point_at_end = 0;
       ptrdiff_t zv_at_end = 0;
       Lisp_Object old_deactivate_mark;
-      struct gcpro gcpro1;
 
       old_deactivate_mark = Vdeactivate_mark;
       oldbuf = current_buffer;
@@ -9919,7 +9947,6 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool 
nlflag, bool multibyte)
       set_marker_restricted_both (oldbegv, Qnil, BEGV, BEGV_BYTE);
       oldzv = message_dolog_marker3;
       set_marker_restricted_both (oldzv, Qnil, ZV, ZV_BYTE);
-      GCPRO1 (old_deactivate_mark);
 
       if (PT == Z)
        point_at_end = 1;
@@ -10043,7 +10070,6 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool 
nlflag, bool multibyte)
        TEMP_SET_PT_BOTH (marker_position (oldpoint),
                          marker_byte_position (oldpoint));
 
-      UNGCPRO;
       unchain_marker (XMARKER (oldpoint));
       unchain_marker (XMARKER (oldbegv));
       unchain_marker (XMARKER (oldzv));
@@ -10111,9 +10137,6 @@ message_log_check_duplicate (ptrdiff_t prev_bol_byte, 
ptrdiff_t this_bol_byte)
 void
 message3 (Lisp_Object m)
 {
-  struct gcpro gcpro1;
-
-  GCPRO1 (m);
   clear_message (true, true);
   cancel_echoing ();
 
@@ -10131,9 +10154,27 @@ message3 (Lisp_Object m)
     }
   if (! inhibit_message)
     message3_nolog (m);
-  UNGCPRO;
 }
 
+/* Log the message M to stderr.  Log an empty line if M is not a string.  */
+
+static void
+message_to_stderr (Lisp_Object m)
+{
+  if (noninteractive_need_newline)
+    {
+      noninteractive_need_newline = false;
+      fputc ('\n', stderr);
+    }
+  if (STRINGP (m))
+    {
+      Lisp_Object s = ENCODE_SYSTEM (m);
+      fwrite (SDATA (s), SBYTES (s), 1, stderr);
+    }
+  if (!cursor_in_echo_area)
+    fputc ('\n', stderr);
+  fflush (stderr);
+}
 
 /* The non-logging version of message3.
    This does not cancel echoing, because it is used for echoing.
@@ -10146,20 +10187,7 @@ message3_nolog (Lisp_Object m)
   struct frame *sf = SELECTED_FRAME ();
 
   if (FRAME_INITIAL_P (sf))
-    {
-      if (noninteractive_need_newline)
-       putc ('\n', stderr);
-      noninteractive_need_newline = false;
-      if (STRINGP (m))
-       {
-         Lisp_Object s = ENCODE_SYSTEM (m);
-
-         fwrite (SDATA (s), SBYTES (s), 1, stderr);
-       }
-      if (!cursor_in_echo_area)
-       fprintf (stderr, "\n");
-      fflush (stderr);
-    }
+    message_to_stderr (m);
   /* Error messages get reported properly by cmd_error, so this must be just an
      informative message; if the frame hasn't really been initialized yet, just
      toss it.  */
@@ -10226,24 +10254,12 @@ message_with_string (const char *m, Lisp_Object 
string, bool log)
 {
   CHECK_STRING (string);
 
+  bool need_message;
   if (noninteractive)
-    {
-      if (m)
-       {
-         /* ENCODE_SYSTEM below can GC and/or relocate the
-            Lisp data, so make sure we don't use it here.  */
-         eassert (relocatable_string_data_p (m) != 1);
-
-         if (noninteractive_need_newline)
-           putc ('\n', stderr);
-         noninteractive_need_newline = false;
-         fprintf (stderr, m, SDATA (ENCODE_SYSTEM (string)));
-         if (!cursor_in_echo_area)
-           fprintf (stderr, "\n");
-         fflush (stderr);
-       }
-    }
-  else if (INTERACTIVE)
+    need_message = !!m;
+  else if (!INTERACTIVE)
+    need_message = false;
+  else
     {
       /* The frame whose minibuffer we're going to display the message on.
         It may be larger than the selected frame, so we need
@@ -10259,23 +10275,23 @@ message_with_string (const char *m, Lisp_Object 
string, bool log)
       /* Error messages get reported properly by cmd_error, so this must be
         just an informative message; if the frame hasn't really been
         initialized yet, just toss it.  */
-      if (f->glyphs_initialized_p)
-       {
-         struct gcpro gcpro1, gcpro2;
-
-         Lisp_Object fmt = build_string (m);
-         Lisp_Object msg = string;
-         GCPRO2 (fmt, msg);
+      need_message = f->glyphs_initialized_p;
+    }
 
-         msg = CALLN (Fformat, fmt, msg);
+  if (need_message)
+    {
+      AUTO_STRING (fmt, m);
+      Lisp_Object msg = CALLN (Fformat_message, fmt, string);
 
+      if (noninteractive)
+       message_to_stderr (msg);
+      else
+       {
          if (log)
            message3 (msg);
          else
            message3_nolog (msg);
 
-         UNGCPRO;
-
          /* Print should start at the beginning of the message
             buffer next time.  */
          message_buf_print = false;
@@ -10287,9 +10303,9 @@ message_with_string (const char *m, Lisp_Object string, 
bool log)
 /* Dump an informative message to the minibuf.  If M is 0, clear out
    any existing message, and let the mini-buffer text show through.
 
-   The message must be safe ASCII only.  If strings may contain escape
-   sequences or non-ASCII characters, convert them to Lisp strings and
-   use Fmessage.  */
+   The message must be safe ASCII and the format must not contain ` or
+   '.  If your message and format do not fit into this category,
+   convert your arguments to Lisp objects and use Fmessage instead.  */
 
 static void ATTRIBUTE_FORMAT_PRINTF (1, 0)
 vmessage (const char *m, va_list ap)
@@ -11567,7 +11583,6 @@ prepare_menu_bars (void)
 {
   bool all_windows = windows_or_buffers_changed || update_mode_lines;
   bool some_windows = REDISPLAY_SOME_P ();
-  struct gcpro gcpro1, gcpro2;
   Lisp_Object tooltip_frame;
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -11670,7 +11685,6 @@ prepare_menu_bars (void)
              /* Clear flag first in case we get an error below.  */
              FRAME_WINDOW_SIZES_CHANGED (f) = false;
              functions = Vwindow_size_change_functions;
-             GCPRO2 (tail, functions);
 
              while (CONSP (functions))
                {
@@ -11678,15 +11692,12 @@ prepare_menu_bars (void)
                    call1 (XCAR (functions), frame);
                  functions = XCDR (functions);
                }
-             UNGCPRO;
            }
 
-         GCPRO1 (tail);
          menu_bar_hooks_run = update_menu_bar (f, false, menu_bar_hooks_run);
 #ifdef HAVE_WINDOW_SYSTEM
          update_tool_bar (f, false);
 #endif
-         UNGCPRO;
        }
 
       unbind_to (count, Qnil);
@@ -11872,7 +11883,6 @@ update_tool_bar (struct frame *f, bool save_match_data)
          ptrdiff_t count = SPECPDL_INDEX ();
          Lisp_Object frame, new_tool_bar;
           int new_n_tool_bar;
-         struct gcpro gcpro1;
 
          /* Set current_buffer to the buffer of the selected
             window of the frame, so that we get the right local
@@ -11890,8 +11900,6 @@ update_tool_bar (struct frame *f, bool save_match_data)
              specbind (Qoverriding_local_map, Qnil);
            }
 
-         GCPRO1 (new_tool_bar);
-
          /* We must temporarily set the selected frame to this frame
             before calling tool_bar_items, because the calculation of
             the tool-bar keymap uses the selected frame (see
@@ -11923,8 +11931,6 @@ update_tool_bar (struct frame *f, bool save_match_data)
               unblock_input ();
             }
 
-         UNGCPRO;
-
          unbind_to (count, Qnil);
          set_buffer_internal_1 (prev);
        }
@@ -11941,11 +11947,9 @@ static void
 build_desired_tool_bar_string (struct frame *f)
 {
   int i, size, size_needed;
-  struct gcpro gcpro1, gcpro2;
   Lisp_Object image, plist;
 
   image = plist = Qnil;
-  GCPRO2 (image, plist);
 
   /* Prepare F->desired_tool_bar_string.  If we can reuse it, do so.
      Otherwise, make a new string.  */
@@ -11965,11 +11969,8 @@ build_desired_tool_bar_string (struct frame *f)
   else
     {
       AUTO_LIST4 (props, Qdisplay, Qnil, Qmenu_item, Qnil);
-      struct gcpro gcpro1;
-      GCPRO1 (props);
       Fremove_text_properties (make_number (0), make_number (size),
                               props, f->desired_tool_bar_string);
-      UNGCPRO;
     }
 
   /* Put a `display' property on the string for the images to display,
@@ -12082,8 +12083,6 @@ build_desired_tool_bar_string (struct frame *f)
       image = Fcons (Qimage, plist);
       AUTO_LIST4 (props, Qdisplay, image, Qmenu_item,
                  make_number (i * TOOL_BAR_ITEM_NSLOTS));
-      struct gcpro gcpro1;
-      GCPRO1 (props);
 
       /* Let the last image hide all remaining spaces in the tool bar
          string.  The string can be longer than needed when we reuse a
@@ -12094,11 +12093,8 @@ build_desired_tool_bar_string (struct frame *f)
        end = i + 1;
       Fadd_text_properties (make_number (i), make_number (end),
                            props, f->desired_tool_bar_string);
-      UNGCPRO;
 #undef PROP
     }
-
-  UNGCPRO;
 }
 
 
@@ -17801,7 +17797,7 @@ try_window_id (struct window *w)
 #if false
 #define GIVE_UP(X)                                             \
   do {                                                         \
-    fprintf (stderr, "try_window_id give up %d\n", (X));       \
+    TRACE ((stderr, "try_window_id give up %d\n", (X)));       \
     return 0;                                                  \
   } while (false)
 #else
@@ -17823,7 +17819,7 @@ try_window_id (struct window *w)
      changed in the buffer displayed by the window, so give up if they
      have.  */
   if (w->last_overlay_modified != OVERLAY_MODIFF)
-    GIVE_UP (21);
+    GIVE_UP (200);
 
   /* Verify that narrowing has not changed.
      Also verify that we were not told to prevent redisplay optimizations.
@@ -17883,6 +17879,11 @@ try_window_id (struct window *w)
       && NILP (BVAR (XBUFFER (w->contents), bidi_paragraph_direction)))
     GIVE_UP (22);
 
+  /* Give up if the buffer has line-spacing set, as Lisp-level changes
+     to that variable require thorough redisplay.  */
+  if (!NILP (BVAR (XBUFFER (w->contents), extra_line_spacing)))
+    GIVE_UP (23);
+
   /* Make sure beg_unchanged and end_unchanged are up to date.  Do it
      only if buffer has really changed.  The reason is that the gap is
      initially at Z for freshly visited files.  The code below would
@@ -19278,12 +19279,74 @@ append_space_for_newline (struct it *it, bool 
default_face_p)
 #ifdef HAVE_WINDOW_SYSTEM
          /* Make sure this space glyph has the right ascent and
             descent values, or else cursor at end of line will look
-            funny.  */
+            funny, and height of empty lines will be incorrect.  */
          g = it->glyph_row->glyphs[TEXT_AREA] + n;
          struct font *font = face->font ? face->font : FRAME_FONT (it->f);
-         if (n == 0 || it->glyph_row->height < font->pixel_size)
+         if (n == 0)
            {
+             Lisp_Object height, total_height;
+             int extra_line_spacing = it->extra_line_spacing;
+             int boff = font->baseline_offset;
+
+             if (font->vertical_centering)
+               boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
+
+             it->object = saved_object; /* get_it_property needs this */
              normal_char_ascent_descent (font, -1, &it->ascent, &it->descent);
+             /* Must do a subset of line height processing from
+                x_produce_glyph for newline characters.  */
+             height = get_it_property (it, Qline_height);
+             if (CONSP (height)
+                 && CONSP (XCDR (height))
+                 && NILP (XCDR (XCDR (height))))
+               {
+                 total_height = XCAR (XCDR (height));
+                 height = XCAR (height);
+               }
+             else
+               total_height = Qnil;
+             height = calc_line_height_property (it, height, font, boff, true);
+
+             if (it->override_ascent >= 0)
+               {
+                 it->ascent = it->override_ascent;
+                 it->descent = it->override_descent;
+                 boff = it->override_boff;
+               }
+             if (EQ (height, Qt))
+               extra_line_spacing = 0;
+             else
+               {
+                 Lisp_Object spacing;
+
+                 it->phys_ascent = it->ascent;
+                 it->phys_descent = it->descent;
+                 if (!NILP (height)
+                     && XINT (height) > it->ascent + it->descent)
+                   it->ascent = XINT (height) - it->descent;
+
+                 if (!NILP (total_height))
+                   spacing = calc_line_height_property (it, total_height, font,
+                                                        boff, false);
+                 else
+                   {
+                     spacing = get_it_property (it, Qline_spacing);
+                     spacing = calc_line_height_property (it, spacing, font,
+                                                          boff, false);
+                   }
+                 if (INTEGERP (spacing))
+                   {
+                     extra_line_spacing = XINT (spacing);
+                     if (!NILP (total_height))
+                       extra_line_spacing -= (it->phys_ascent + 
it->phys_descent);
+                   }
+               }
+             if (extra_line_spacing > 0)
+               {
+                 it->descent += extra_line_spacing;
+                 if (extra_line_spacing > it->max_extra_line_spacing)
+                   it->max_extra_line_spacing = extra_line_spacing;
+               }
              it->max_ascent = it->ascent;
              it->max_descent = it->descent;
              /* Make sure compute_line_metrics recomputes the row height.  */
diff --git a/src/xfaces.c b/src/xfaces.c
index f0b6d39..556f361 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -797,7 +797,7 @@ load_pixmap (struct frame *f, Lisp_Object name)
 
   if (bitmap_id < 0)
     {
-      add_to_log ("Invalid or undefined bitmap `%s'", name, Qnil);
+      add_to_log ("Invalid or undefined bitmap `%s'", name);
       bitmap_id = 0;
     }
   else
@@ -1099,7 +1099,7 @@ load_color2 (struct frame *f, struct face *face, 
Lisp_Object name,
      to the values in an existing cell. */
   if (!defined_color (f, SSDATA (name), color, true))
     {
-      add_to_log ("Unable to load color \"%s\"", name, Qnil);
+      add_to_log ("Unable to load color \"%s\"", name);
 
       switch (target_index)
        {
@@ -2177,17 +2177,12 @@ merge_named_face (struct frame *f, Lisp_Object 
face_name, Lisp_Object *to,
                              face_name, NAMED_MERGE_POINT_NORMAL,
                              &named_merge_points))
     {
-      struct gcpro gcpro1;
       Lisp_Object from[LFACE_VECTOR_SIZE];
       bool ok = get_lface_attributes (f, face_name, from, false,
                                      named_merge_points);
 
       if (ok)
-       {
-         GCPRO1 (named_merge_point.face_name);
-         merge_face_vectors (f, from, to, named_merge_points);
-         UNGCPRO;
-       }
+       merge_face_vectors (f, from, to, named_merge_points);
 
       return ok;
     }
@@ -2247,7 +2242,7 @@ merge_face_ref (struct frame *f, Lisp_Object face_ref, 
Lisp_Object *to,
          else
            {
              if (err_msgs)
-               add_to_log ("Invalid face color", color_name, Qnil);
+               add_to_log ("Invalid face color %S", color_name);
              ok = false;
            }
        }
@@ -2452,7 +2447,7 @@ merge_face_ref (struct frame *f, Lisp_Object face_ref, 
Lisp_Object *to,
       /* FACE_REF ought to be a face name.  */
       ok = merge_named_face (f, face_ref, to, named_merge_points);
       if (!ok && err_msgs)
-       add_to_log ("Invalid face reference: %s", face_ref, Qnil);
+       add_to_log ("Invalid face reference: %s", face_ref);
     }
 
   return ok;
diff --git a/src/xfns.c b/src/xfns.c
index 8137cea..0079e7b 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -548,7 +548,7 @@ xg_set_icon (struct frame *f, Lisp_Object file)
     {
       GdkPixbuf *pixbuf;
       GError *err = NULL;
-      char *filename = SSDATA (found);
+      char *filename = SSDATA (ENCODE_FILE (found));
       block_input ();
 
       pixbuf = gdk_pixbuf_new_from_file (filename, &err);
@@ -1323,8 +1323,6 @@ x_set_scroll_bar_background (struct frame *f, Lisp_Object 
value, Lisp_Object old
 /* Encode Lisp string STRING as a text in a format appropriate for
    XICCC (X Inter Client Communication Conventions).
 
-   This can call Lisp code, so callers must GCPRO.
-
    If STRING contains only ASCII characters, do no conversion and
    return the string data of STRING.  Otherwise, encode the text by
    CODING_SYSTEM, and return a newly allocated memory area which
@@ -1386,13 +1384,10 @@ x_set_name_internal (struct frame *f, Lisp_Object name)
        Lisp_Object coding_system;
        Lisp_Object encoded_name;
        Lisp_Object encoded_icon_name;
-       struct gcpro gcpro1;
 
        /* As ENCODE_UTF_8 may cause GC and relocation of string data,
           we use it before x_encode_text that may return string data.  */
-       GCPRO1 (name);
        encoded_name = ENCODE_UTF_8 (name);
-       UNGCPRO;
 
        coding_system = Qcompound_text;
        /* Note: Encoding strategy
@@ -2979,7 +2974,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
   bool minibuffer_only = false;
   long window_prompting = 0;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   Lisp_Object display;
   struct x_display_info *dpyinfo = NULL;
   Lisp_Object parent;
@@ -3018,11 +3012,7 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
   if (! NILP (parent))
     CHECK_NUMBER (parent);
 
-  /* make_frame_without_minibuffer can run Lisp code and garbage collect.  */
-  /* No need to protect DISPLAY because that's not used after passing
-     it to make_frame_without_minibuffer.  */
   frame = Qnil;
-  GCPRO4 (parms, parent, name, frame);
   tem = x_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer", "Minibuffer",
                   RES_TYPE_SYMBOL);
   if (EQ (tem, Qnone) || NILP (tem))
@@ -3069,7 +3059,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
      to get the color reference counts right, so initialize them!  */
   {
     Lisp_Object black;
-    struct gcpro gcpro1;
 
     /* Function x_decode_color can signal an error.  Make
        sure to initialize color slots so that we won't try
@@ -3082,7 +3071,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
     f->output_data.x->mouse_pixel = -1;
 
     black = build_string ("black");
-    GCPRO1 (black);
     FRAME_FOREGROUND_PIXEL (f)
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
     FRAME_BACKGROUND_PIXEL (f)
@@ -3095,7 +3083,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
     f->output_data.x->mouse_pixel
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
-    UNGCPRO;
   }
 
   /* Specify the parent under which to make this X window.  */
@@ -3397,8 +3384,6 @@ This function is an internal primitive--use `make-frame' 
instead.  */)
     if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
       fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
 
-  UNGCPRO;
-
   /* Make sure windows on this frame appear in calls to next-window
      and similar functions.  */
   Vwindow_list = Qnil;
@@ -4312,130 +4297,262 @@ Internal use only, use 
`display-monitor-attributes-list' instead.  */)
   return attributes_list;
 }
 
-DEFUN ("x-frame-geometry", Fx_frame_geometry, Sx_frame_geometry, 0, 1, 0,
-       doc: /* Return geometric attributes of frame FRAME.
+/* Return geometric attributes of FRAME.  According to the value of
+   ATTRIBUTES return the outer edges of FRAME (Qouter_edges), the native
+   edges of FRAME (Qnative_edges), or the inner edges of frame
+   (Qinner_edges).  Any other value means to return the geometry as
+   returned by Fx_frame_geometry.  */
+static Lisp_Object
+frame_geometry (Lisp_Object frame, Lisp_Object attribute)
+{
+  struct frame *f = decode_live_frame (frame);
+  /**   XWindowAttributes atts; **/
+  Window rootw;
+  unsigned int ign, native_width, native_height;
+  int xy_ign, xptr, yptr;
+  int left_off, right_off, top_off, bottom_off;
+  int outer_left, outer_top, outer_right, outer_bottom;
+  int native_left, native_top, native_right, native_bottom;
+  int inner_left, inner_top, inner_right, inner_bottom;
+  int internal_border_width;
+  bool menu_bar_external = false, tool_bar_external = false;
+  int menu_bar_height = 0, menu_bar_width = 0;
+  int tool_bar_height = 0, tool_bar_width = 0;
+
+  if (FRAME_INITIAL_P (f) || !FRAME_X_P (f))
+    return Qnil;
+
+  block_input ();
+  XGetGeometry (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
+               &rootw, &xy_ign, &xy_ign, &native_width, &native_height,
+               &ign, &ign);
+  /**   XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 
&atts); **/
+  x_real_pos_and_offsets (f, &left_off, &right_off, &top_off, &bottom_off,
+                          NULL, NULL, &xptr, &yptr, NULL);
+  unblock_input ();
+
+  /**   native_width = atts.width; **/
+  /**   native_height = atts.height; **/
+
+  outer_left = xptr;
+  outer_top = yptr;
+  outer_right = outer_left + left_off + native_width + right_off;
+  outer_bottom = outer_top + top_off + native_height + bottom_off;
+
+  native_left = outer_left + left_off;
+  native_top = outer_top + top_off;
+  native_right = native_left + native_width;
+  native_bottom = native_top + native_height;
+
+  internal_border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
+  inner_left = native_left + internal_border_width;
+  inner_top = native_top + internal_border_width;
+  inner_right = native_right - internal_border_width;
+  inner_bottom = native_bottom - internal_border_width;
+
+#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
+  menu_bar_external = true;
+  menu_bar_height = FRAME_MENUBAR_HEIGHT (f);
+  native_top += menu_bar_height;
+  inner_top += menu_bar_height;
+#else
+  menu_bar_height = FRAME_MENU_BAR_HEIGHT (f);
+  inner_top += menu_bar_height;
+#endif
+  menu_bar_width = menu_bar_height ? native_width : 0;
 
-FRAME must be a live frame and defaults to the selected one.
+#if defined (USE_GTK)
+  tool_bar_external = true;
+  if (EQ (FRAME_TOOL_BAR_POSITION (f), Qleft))
+    {
+      tool_bar_width = FRAME_TOOLBAR_WIDTH (f);
+      native_left += tool_bar_width;
+      inner_left += tool_bar_width;
+      tool_bar_height
+       = tool_bar_width ? native_height - menu_bar_height : 0;
+    }
+  else if (EQ (FRAME_TOOL_BAR_POSITION (f), Qtop))
+    {
+      tool_bar_height = FRAME_TOOLBAR_HEIGHT (f);
+      native_top += tool_bar_height;
+      inner_top += tool_bar_height;
+      tool_bar_width = tool_bar_height ? native_width : 0;
+    }
+  else if (EQ (FRAME_TOOL_BAR_POSITION (f), Qright))
+    {
+      tool_bar_width = FRAME_TOOLBAR_WIDTH (f);
+      native_right -= tool_bar_width;
+      inner_right -= tool_bar_width;
+      tool_bar_height
+       = tool_bar_width ? native_height - menu_bar_height : 0;
+    }
+  else
+    {
+      tool_bar_height = FRAME_TOOLBAR_HEIGHT (f);
+      native_bottom -= tool_bar_height;
+      inner_bottom -= tool_bar_height;
+      tool_bar_width = tool_bar_height ? native_width : 0;
+    }
+#else
+  tool_bar_height = FRAME_TOOL_BAR_HEIGHT (f);
+  tool_bar_width = tool_bar_height ? native_width : 0;
+  inner_top += tool_bar_height;
+#endif
+
+  /* Construct list.  */
+  if (EQ (attribute, Qouter_edges))
+    return list4 (make_number (outer_left), make_number (outer_top),
+                 make_number (outer_right), make_number (outer_bottom));
+  else if (EQ (attribute, Qnative_edges))
+    return list4 (make_number (native_left), make_number (native_top),
+                 make_number (native_right), make_number (native_bottom));
+  else if (EQ (attribute, Qinner_edges))
+    return list4 (make_number (inner_left), make_number (inner_top),
+                 make_number (inner_right), make_number (inner_bottom));
+  else
+    return
+      listn (CONSTYPE_HEAP, 10,
+            Fcons (Qouter_position,
+                   Fcons (make_number (outer_left),
+                          make_number (outer_top))),
+            Fcons (Qouter_size,
+                   Fcons (make_number (outer_right - outer_left),
+                          make_number (outer_bottom - outer_top))),
+            /* Approximate.  */
+            Fcons (Qexternal_border_size,
+                   Fcons (make_number (right_off),
+                          make_number (bottom_off))),
+            /* Approximate.  */
+            Fcons (Qtitle_bar_size,
+                   Fcons (make_number (0),
+                          make_number (top_off - bottom_off))),
+            Fcons (Qmenu_bar_external, menu_bar_external ? Qt : Qnil),
+            Fcons (Qmenu_bar_size,
+                   Fcons (make_number (menu_bar_width),
+                          make_number (menu_bar_height))),
+            Fcons (Qtool_bar_external, tool_bar_external ? Qt : Qnil),
+            Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)),
+            Fcons (Qtool_bar_size,
+                   Fcons (make_number (tool_bar_width),
+                          make_number (tool_bar_height))),
+            Fcons (Qinternal_border_width,
+                   make_number (internal_border_width)));
+}
 
-The return value is an association list containing the following
-elements (all size values are in pixels).
+DEFUN ("x-frame-geometry", Fx_frame_geometry, Sx_frame_geometry, 0, 1, 0,
+       doc: /* Return geometric attributes of FRAME.
+FRAME must be a live frame and defaults to the selected one.  The return
+value is an association list of the attributes listed below.  All height
+and width values are in pixels.
 
-- `frame-outer-size' is a cons of the outer width and height of FRAME.
-  The outer size include the title bar and the external borders as well
-  as any menu and/or tool bar of frame.
+`outer-position' is a cons of the outer left and top edges of FRAME
+  relative to the origin - the position (0, 0) - of FRAME's display.
 
-- `border' is a cons of the horizontal and vertical width of FRAME's
-  external borders.
+`outer-size' is a cons of the outer width and height of FRAME.  The
+  outer size includes the title bar and the external borders as well as
+  any menu and/or tool bar of frame.
 
-- `title-bar-height' is the height of the title bar of FRAME.
+`external-border-size' is a cons of the horizontal and vertical width of
+  FRAME's external borders as supplied by the window manager.
 
-- `menu-bar-external' if t means the menu bar is external (not
+`title-bar-size' is a cons of the width and height of the title bar of
+  FRAME as supplied by the window manager.  If both of them are zero,
+  FRAME has no title bar.  If only the width is zero, Emacs was not
+  able to retrieve the width information.
+
+`menu-bar-external', if non-nil, means the menu bar is external (never
   included in the inner edges of FRAME).
 
-- `menu-bar-size' is a cons of the width and height of the menu bar of
+`menu-bar-size' is a cons of the width and height of the menu bar of
   FRAME.
 
-- `tool-bar-external' if t means the tool bar is external (not
+`tool-bar-external', if non-nil, means the tool bar is external (never
   included in the inner edges of FRAME).
 
-- `tool-bar-side' tells tells on which side the tool bar on FRAME is and
-  can be one of `left', `top', `right' or `bottom'.
+`tool-bar-position' tells on which side the tool bar on FRAME is and can
+  be one of `left', `top', `right' or `bottom'.  If this is nil, FRAME
+  has no tool bar.
 
-- `tool-bar-size' is a cons of the width and height of the tool bar of
+`tool-bar-size' is a cons of the width and height of the tool bar of
   FRAME.
 
-- `frame-inner-size' is a cons of the inner width and height of FRAME.
-  This excludes FRAME's title bar and external border as well as any
-  external menu and/or tool bar.  */)
+`internal-border-width' is the width of the internal border of
+  FRAME.  */)
   (Lisp_Object frame)
 {
-  struct frame *f = decode_live_frame (frame);
-  int inner_width = FRAME_PIXEL_WIDTH (f);
-  int inner_height = FRAME_PIXEL_HEIGHT (f);
-  int outer_width, outer_height, border, title;
-  Lisp_Object fullscreen = Fframe_parameter (frame, Qfullscreen);
-  int menu_bar_height, menu_bar_width, tool_bar_height, tool_bar_width;
+  return frame_geometry (frame, Qnil);
+}
 
-  int left_off, right_off, top_off, bottom_off, outer_border;
-  XWindowAttributes atts;
+DEFUN ("x-frame-edges", Fx_frame_edges, Sx_frame_edges, 0, 2, 0,
+       doc: /* Return edge coordinates of FRAME.
+FRAME must be a live frame and defaults to the selected one.  The return
+value is a list of the form (LEFT, TOP, RIGHT, BOTTOM).  All values are
+in pixels relative to the origin - the position (0, 0) - of FRAME's
+display.
+
+If optional argument TYPE is the symbol `outer-edges', return the outer
+edges of FRAME.  The outer edges comprise the decorations of the window
+manager (like the title bar or external borders) as well as any external
+menu or tool bar of FRAME.  If optional argument TYPE is the symbol
+`native-edges' or nil, return the native edges of FRAME.  The native
+edges exclude the decorations of the window manager and any external
+menu or tool bar of FRAME.  If TYPE is the symbol `inner-edges', return
+the inner edges of FRAME.  These edges exclude title bar, any borders,
+menu bar or tool bar of FRAME.  */)
+  (Lisp_Object frame, Lisp_Object type)
+{
+  return frame_geometry (frame, ((EQ (type, Qouter_edges)
+                                 || EQ (type, Qinner_edges))
+                                ? type
+                                : Qnative_edges));
+}
+
+DEFUN ("x-mouse-absolute-pixel-position", Fx_mouse_absolute_pixel_position,
+       Sx_mouse_absolute_pixel_position, 0, 0, 0,
+       doc: /* Return absolute position of mouse cursor in pixels.
+The position is returned as a cons cell (X . Y) of the coordinates of
+the mouse cursor position in pixels relative to a position (0, 0) of the
+selected frame's display.  */)
+  (void)
+{
+  struct frame *f = SELECTED_FRAME ();
+  Window root, dummy_window;
+  int x, y, dummy;
 
   if (FRAME_INITIAL_P (f) || !FRAME_X_P (f))
     return Qnil;
 
   block_input ();
-
-  XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &atts);
-
-  x_real_pos_and_offsets (f, &left_off, &right_off, &top_off, &bottom_off,
-                          NULL, NULL, NULL, NULL, &outer_border);
-
-
+  XQueryPointer (FRAME_X_DISPLAY (f),
+                 DefaultRootWindow (FRAME_X_DISPLAY (f)),
+                 &root, &dummy_window, &x, &y, &dummy, &dummy,
+                 (unsigned int *) &dummy);
   unblock_input ();
 
-  border = atts.border_width;
-  title = top_off;
-
-  outer_width = atts.width + 2 * border + right_off + left_off
-    + 2 * outer_border;
-  outer_height = atts.height + 2 * border + top_off + bottom_off
-    + 2 * outer_border;
+  return Fcons (make_number (x), make_number (y));
+}
 
-#if defined (USE_GTK)
+DEFUN ("x-set-mouse-absolute-pixel-position", 
Fx_set_mouse_absolute_pixel_position,
+       Sx_set_mouse_absolute_pixel_position, 2, 2, 0,
+       doc: /* Move mouse pointer to absolute pixel position (X, Y).
+The coordinates X and Y are interpreted in pixels relative to a position
+(0, 0) of the selected frame's display.  */)
+  (Lisp_Object x, Lisp_Object y)
   {
-    bool tool_bar_left_right = (EQ (FRAME_TOOL_BAR_POSITION (f), Qleft)
-                               || EQ (FRAME_TOOL_BAR_POSITION (f), Qright));
-
-    tool_bar_width = (tool_bar_left_right
-                     ? FRAME_TOOLBAR_WIDTH (f)
-                     : FRAME_PIXEL_WIDTH (f));
-    tool_bar_height = (tool_bar_left_right
-                      ? FRAME_PIXEL_HEIGHT (f)
-                      : FRAME_TOOLBAR_HEIGHT (f));
-  }
-#else
-  tool_bar_height = FRAME_TOOL_BAR_HEIGHT (f);
-  tool_bar_width = tool_bar_height > 0 ? FRAME_PIXEL_WIDTH (f) : 0;
-#endif
+  struct frame *f = SELECTED_FRAME ();
 
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
-  menu_bar_height = FRAME_MENUBAR_HEIGHT (f);
-#else
-  menu_bar_height = FRAME_MENU_BAR_HEIGHT (f);
-#endif
+  if (FRAME_INITIAL_P (f) || !FRAME_X_P (f))
+    return Qnil;
+
+  CHECK_TYPE_RANGED_INTEGER (int, x);
+  CHECK_TYPE_RANGED_INTEGER (int, y);
 
-  menu_bar_width = menu_bar_height > 0 ? FRAME_PIXEL_WIDTH (f) : 0;
-
-  if (!FRAME_EXTERNAL_MENU_BAR (f))
-    inner_height -= menu_bar_height;
-  if (!FRAME_EXTERNAL_TOOL_BAR (f))
-    inner_height -= tool_bar_height;
-
-  return
-    listn (CONSTYPE_HEAP, 10,
-          Fcons (Qframe_position,
-                 Fcons (make_number (f->left_pos), make_number (f->top_pos))),
-          Fcons (Qframe_outer_size,
-                 Fcons (make_number (outer_width), make_number 
(outer_height))),
-          Fcons (Qexternal_border_size,
-                 ((EQ (fullscreen, Qfullboth) || EQ (fullscreen, Qfullscreen))
-                  ? Fcons (make_number (0), make_number (0))
-                  : Fcons (make_number (border), make_number (border)))),
-          Fcons (Qtitle_height,
-                 ((EQ (fullscreen, Qfullboth) || EQ (fullscreen, Qfullscreen))
-                  ? make_number (0)
-                  : make_number (title))),
-          Fcons (Qmenu_bar_external, FRAME_EXTERNAL_MENU_BAR (f) ? Qt : Qnil),
-          Fcons (Qmenu_bar_size,
-                 Fcons (make_number (menu_bar_width),
-                        make_number (menu_bar_height))),
-          Fcons (Qtool_bar_external, FRAME_EXTERNAL_TOOL_BAR (f) ? Qt : Qnil),
-          Fcons (Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)),
-          Fcons (Qtool_bar_size,
-                 Fcons (make_number (tool_bar_width),
-                        make_number (tool_bar_height))),
-          Fcons (Qframe_inner_size,
-                 Fcons (make_number (inner_width),
-                        make_number (inner_height))));
+  block_input ();
+  XWarpPointer (FRAME_X_DISPLAY (f), None, DefaultRootWindow (FRAME_X_DISPLAY 
(f)),
+               0, 0, 0, 0, XINT (x), XINT (y));
+  unblock_input ();
+
+  return Qnil;
 }
 
 /************************************************************************
@@ -4827,9 +4944,6 @@ x_window_property_intern (struct frame *f,
   int actual_format;
   unsigned long actual_size, bytes_remaining;
   int rc;
-  struct gcpro gcpro1;
-
-  GCPRO1 (prop_value);
 
   rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window,
                           prop_atom, 0, 0, False, target_type,
@@ -4888,7 +5002,6 @@ x_window_property_intern (struct frame *f,
       if (tmp_data) XFree (tmp_data);
     }
 
-  UNGCPRO;
   return prop_value;
 }
 
@@ -4917,10 +5030,8 @@ no value of TYPE (always string in the MS Windows case). 
 */)
   Lisp_Object prop_value = Qnil;
   Atom target_type = XA_STRING;
   Window target_window = FRAME_X_WINDOW (f);
-  struct gcpro gcpro1;
   bool found;
 
-  GCPRO1 (prop_value);
   CHECK_STRING (prop);
 
   if (! NILP (source))
@@ -4963,7 +5074,6 @@ no value of TYPE (always string in the MS Windows case).  
*/)
 
 
   unblock_input ();
-  UNGCPRO;
   return prop_value;
 }
 
@@ -5025,7 +5135,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
   Lisp_Object name;
   int width, height;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3;
   bool face_change_before = face_change;
   Lisp_Object buffer;
   struct buffer *old_buffer;
@@ -5043,7 +5152,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
     error ("Invalid frame name--not a string or nil");
 
   frame = Qnil;
-  GCPRO3 (parms, name, frame);
   f = make_frame (true);
   XSETFRAME (frame, f);
 
@@ -5091,7 +5199,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
      to get the color reference counts right, so initialize them!  */
   {
     Lisp_Object black;
-    struct gcpro gcpro1;
 
     /* Function x_decode_color can signal an error.  Make
        sure to initialize color slots so that we won't try
@@ -5104,7 +5211,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
     f->output_data.x->mouse_pixel = -1;
 
     black = build_string ("black");
-    GCPRO1 (black);
     FRAME_FOREGROUND_PIXEL (f)
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
     FRAME_BACKGROUND_PIXEL (f)
@@ -5117,7 +5223,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
     f->output_data.x->mouse_pixel
       = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
-    UNGCPRO;
   }
 
   /* Set the name; the functions to which we pass f expect the name to
@@ -5313,8 +5418,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
 
   f->no_split = true;
 
-  UNGCPRO;
-
   /* Now that the frame will be official, it counts as a reference to
      its display and terminal.  */
   FRAME_DISPLAY_INFO (f)->reference_count++;
@@ -5444,14 +5547,11 @@ Text larger than the specified size is clipped.  */)
   struct text_pos pos;
   int i, width, height;
   bool seen_reversed_p;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   int old_windows_or_buffers_changed = windows_or_buffers_changed;
   ptrdiff_t count = SPECPDL_INDEX ();
 
   specbind (Qinhibit_redisplay, Qt);
 
-  GCPRO4 (string, parms, frame, timeout);
-
   CHECK_STRING (string);
   if (SCHARS (string) == 0)
     string = make_unibyte_string (" ", 1);
@@ -5707,7 +5807,6 @@ Text larger than the specified size is clipped.  */)
   tip_timer = call3 (intern ("run-at-time"), timeout, Qnil,
                     intern ("x-hide-tip"));
 
-  UNGCPRO;
   return unbind_to (count, Qnil);
 }
 
@@ -5719,7 +5818,6 @@ Value is t if tooltip was open, nil otherwise.  */)
 {
   ptrdiff_t count;
   Lisp_Object deleted, frame, timer;
-  struct gcpro gcpro1, gcpro2;
 
   /* Return quickly if nothing to do.  */
   if (NILP (tip_timer) && NILP (tip_frame))
@@ -5727,7 +5825,6 @@ Value is t if tooltip was open, nil otherwise.  */)
 
   frame = tip_frame;
   timer = tip_timer;
-  GCPRO2 (frame, timer);
   tip_frame = tip_timer = deleted = Qnil;
 
   count = SPECPDL_INDEX ();
@@ -5772,7 +5869,6 @@ Value is t if tooltip was open, nil otherwise.  */)
 #endif /* USE_LUCID */
     }
 
-  UNGCPRO;
   return unbind_to (count, deleted);
 }
 
@@ -5862,12 +5958,9 @@ value of DIR as in previous invocations; this is 
standard Windows behavior.  */)
   int ac = 0;
   XmString dir_xmstring, pattern_xmstring;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
 
   check_window_system (f);
 
-  GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
-
   if (popup_activated ())
     error ("Trying to use a menu from within a menu-entry");
 
@@ -5992,7 +6085,6 @@ value of DIR as in previous invocations; this is standard 
Windows behavior.  */)
     file = Qnil;
 
   unblock_input ();
-  UNGCPRO;
 
   /* Make "Cancel" equivalent to C-g.  */
   if (NILP (file))
@@ -6033,13 +6125,10 @@ value of DIR as in previous invocations; this is 
standard Windows behavior.  */)
   Lisp_Object file = Qnil;
   Lisp_Object decoded_file;
   ptrdiff_t count = SPECPDL_INDEX ();
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
   char *cdef_file;
 
   check_window_system (f);
 
-  GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
-
   if (popup_activated ())
     error ("Trying to use a menu from within a menu-entry");
 
@@ -6068,7 +6157,6 @@ value of DIR as in previous invocations; this is standard 
Windows behavior.  */)
     }
 
   unblock_input ();
-  UNGCPRO;
 
   /* Make "Cancel" equivalent to C-g.  */
   if (NILP (file))
@@ -6095,7 +6183,6 @@ nil, it defaults to the selected frame. */)
   Lisp_Object font;
   Lisp_Object font_param;
   char *default_name = NULL;
-  struct gcpro gcpro1, gcpro2;
   ptrdiff_t count = SPECPDL_INDEX ();
 
   if (popup_activated ())
@@ -6107,8 +6194,6 @@ nil, it defaults to the selected frame. */)
 
   block_input ();
 
-  GCPRO2 (font_param, font);
-
   XSETFONT (font, FRAME_FONT (f));
   font_param = Ffont_get (font, QCname);
   if (STRINGP (font_param))
@@ -6639,6 +6724,9 @@ When using Gtk+ tooltips, the tooltip face is not used.  
*/);
   defsubr (&Sx_display_save_under);
   defsubr (&Sx_display_monitor_attributes_list);
   defsubr (&Sx_frame_geometry);
+  defsubr (&Sx_frame_edges);
+  defsubr (&Sx_mouse_absolute_pixel_position);
+  defsubr (&Sx_set_mouse_absolute_pixel_position);
   defsubr (&Sx_wm_set_size_hint);
   defsubr (&Sx_create_frame);
   defsubr (&Sx_open_connection);
diff --git a/src/xrdb.c b/src/xrdb.c
index 9e85e5a..2235b45 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -119,8 +119,8 @@ magic_db (const char *string, ptrdiff_t string_len, const 
char *class,
   while (p < string + string_len)
     {
       /* The chunk we're about to stick on the end of result.  */
-      const char *next = NULL;
-      ptrdiff_t next_len;
+      const char *next = p;
+      ptrdiff_t next_len = 1;
 
       if (*p == '%')
        {
@@ -137,10 +137,13 @@ magic_db (const char *string, ptrdiff_t string_len, const 
char *class,
                break;
 
              case 'C':
-               next = (x_customization_string
-                       ? x_customization_string
-                       : "");
-               next_len = strlen (next);
+               if (x_customization_string)
+                 {
+                   next = x_customization_string;
+                   next_len = strlen (next);
+                 }
+               else
+                 next_len = 0;
                break;
 
              case 'N':
@@ -176,8 +179,6 @@ magic_db (const char *string, ptrdiff_t string_len, const 
char *class,
                return NULL;
              }
        }
-      else
-       next = p, next_len = 1;
 
       /* Do we have room for this component followed by a '\0'?  */
       if (path_size - path_len <= next_len)
diff --git a/src/xselect.c b/src/xselect.c
index bd2d65e..94a5584 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -384,8 +384,6 @@ x_get_local_selection (Lisp_Object selection_symbol, 
Lisp_Object target_type,
 
       CHECK_SYMBOL (target_type);
       handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist));
-      /* gcpro is not needed here since nothing but HANDLER_FN
-        is live, and that ought to be a symbol.  */
 
       if (!NILP (handler_fn))
        value = call3 (handler_fn,
@@ -753,7 +751,6 @@ x_reply_selection_request (struct selection_input_event 
*event,
 static void
 x_handle_selection_request (struct selection_input_event *event)
 {
-  struct gcpro gcpro1, gcpro2;
   Time local_selection_time;
 
   struct x_display_info *dpyinfo = SELECTION_EVENT_DPYINFO (event);
@@ -765,7 +762,6 @@ x_handle_selection_request (struct selection_input_event 
*event)
   Lisp_Object local_selection_data;
   bool success = false;
   ptrdiff_t count = SPECPDL_INDEX ();
-  GCPRO2 (local_selection_data, target_symbol);
 
   if (!dpyinfo) goto DONE;
 
@@ -849,7 +845,6 @@ x_handle_selection_request (struct selection_input_event 
*event)
           selection_symbol, target_symbol, success ? Qt : Qnil);
 
   unbind_to (count, Qnil);
-  UNGCPRO;
 }
 
 /* Perform the requested selection conversion, and write the data to
@@ -864,10 +859,8 @@ x_convert_selection (Lisp_Object selection_symbol,
                     Lisp_Object target_symbol, Atom property,
                     bool for_multiple, struct x_display_info *dpyinfo)
 {
-  struct gcpro gcpro1;
   Lisp_Object lisp_selection;
   struct selection_data *cs;
-  GCPRO1 (lisp_selection);
 
   lisp_selection
     = x_get_local_selection (selection_symbol, target_symbol,
@@ -891,7 +884,6 @@ x_convert_selection (Lisp_Object selection_symbol,
          converted_selections = cs;
        }
 
-      UNGCPRO;
       return false;
     }
 
@@ -904,7 +896,6 @@ x_convert_selection (Lisp_Object selection_symbol,
   cs->next = converted_selections;
   converted_selections = cs;
   lisp_data_to_selection_data (dpyinfo, lisp_selection, cs);
-  UNGCPRO;
   return true;
 }
 
@@ -1968,9 +1959,7 @@ On Nextstep, TIME-STAMP and TERMINAL are unused.  */)
    Lisp_Object time_stamp, Lisp_Object terminal)
 {
   Lisp_Object val = Qnil;
-  struct gcpro gcpro1, gcpro2;
   struct frame *f = frame_for_x_selection (terminal);
-  GCPRO2 (target_type, val); /* we store newly consed data into these */
 
   CHECK_SYMBOL (selection_symbol);
   CHECK_SYMBOL (target_type);
@@ -1986,8 +1975,8 @@ On Nextstep, TIME-STAMP and TERMINAL are unused.  */)
     {
       Lisp_Object frame;
       XSETFRAME (frame, f);
-      RETURN_UNGCPRO (x_get_foreign_selection (selection_symbol, target_type,
-                                              time_stamp, frame));
+      return x_get_foreign_selection (selection_symbol, target_type,
+                                     time_stamp, frame);
     }
 
   if (CONSP (val) && SYMBOLP (XCAR (val)))
@@ -1996,7 +1985,7 @@ On Nextstep, TIME-STAMP and TERMINAL are unused.  */)
       if (CONSP (val) && NILP (XCDR (val)))
        val = XCAR (val);
     }
-  RETURN_UNGCPRO (clean_local_selection_data (val));
+  return clean_local_selection_data (val);
 }
 
 DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
@@ -2148,8 +2137,9 @@ static Lisp_Object
 x_clipboard_manager_error_1 (Lisp_Object err)
 {
   AUTO_STRING (format, "X clipboard manager error: %s\n\
-If the problem persists, set `x-select-enable-clipboard-manager' to nil.");
-  CALLN (Fmessage, format, CAR (CDR (err)));
+If the problem persists, set `%s' to nil.");
+  AUTO_STRING (varname, "x-select-enable-clipboard-manager");
+  CALLN (Fmessage, format, CAR (CDR (err)), varname);
   return Qnil;
 }
 
@@ -2159,8 +2149,8 @@ static Lisp_Object
 x_clipboard_manager_error_2 (Lisp_Object err)
 {
   fprintf (stderr, "Error saving to X clipboard manager.\n\
-If the problem persists, set `x-select-enable-clipboard-manager' \
-to nil.\n");
+If the problem persists, set '%s' \
+to nil.\n", "x-select-enable-clipboard-manager");
   return Qnil;
 }
 
diff --git a/src/xsettings.c b/src/xsettings.c
index 028487b..f6a8bfd 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -537,10 +537,10 @@ parse_settings (unsigned char *prop,
               else
                 settings->seen &= ~SEEN_RGBA;
             }
-          else if (strcmp (name, "Xft/DPI") == 0)
+          else if (strcmp (name, "Xft/DPI") == 0 && ival != (CARD32) -1)
             {
               settings->seen |= SEEN_DPI;
-              settings->dpi = (double)ival/1024.0;
+              settings->dpi = ival / 1024.0;
             }
           else if (strcmp (name, "Xft/lcdfilter") == 0)
             {
diff --git a/src/xterm.c b/src/xterm.c
index 0581280..fc02657 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9796,8 +9796,8 @@ x_set_offset (struct frame *f, register int xoff, 
register int yoff, int change_
    Specification/Extended Window Manager Hints at
    http://freedesktop.org/wiki/Specifications/wm-spec.  */
 
-static bool
-wm_supports (struct frame *f, Atom want_atom)
+bool
+x_wm_supports (struct frame *f, Atom want_atom)
 {
   Atom actual_type;
   unsigned long actual_size, bytes_remaining;
@@ -9990,7 +9990,7 @@ static bool
 do_ewmh_fullscreen (struct frame *f)
 {
   struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
-  bool have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state);
+  bool have_net_atom = x_wm_supports (f, dpyinfo->Xatom_net_wm_state);
   int cur;
   bool dummy;
 
@@ -9999,7 +9999,7 @@ do_ewmh_fullscreen (struct frame *f)
   /* Some window managers don't say they support _NET_WM_STATE, but they do say
      they support _NET_WM_STATE_FULLSCREEN.  Try that also.  */
   if (!have_net_atom)
-    have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen);
+    have_net_atom = x_wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen);
 
   if (have_net_atom && cur != f->want_fullscreen)
     {
@@ -10169,6 +10169,8 @@ x_handle_net_wm_state (struct frame *f, const 
XPropertyEvent *event)
 static void
 x_check_fullscreen (struct frame *f)
 {
+  Lisp_Object lval = Qnil;
+
   if (do_ewmh_fullscreen (f))
     return;
 
@@ -10187,22 +10189,31 @@ x_check_fullscreen (struct frame *f)
       switch (f->want_fullscreen)
         {
           /* No difference between these two when there is no WM */
-        case FULLSCREEN_BOTH:
         case FULLSCREEN_MAXIMIZED:
+          lval = Qmaximized;
+          width = x_display_pixel_width (dpyinfo);
+          height = x_display_pixel_height (dpyinfo);
+          break;
+        case FULLSCREEN_BOTH:
+          lval = Qfullboth;
           width = x_display_pixel_width (dpyinfo);
           height = x_display_pixel_height (dpyinfo);
           break;
         case FULLSCREEN_WIDTH:
+          lval = Qfullwidth;
           width = x_display_pixel_width (dpyinfo);
          height = height + FRAME_MENUBAR_HEIGHT (f);
          break;
         case FULLSCREEN_HEIGHT:
+          lval = Qfullheight;
           height = x_display_pixel_height (dpyinfo);
         }
 
       frame_size_history_add
        (f, Qx_check_fullscreen, width, height, Qnil);
 
+      x_wm_set_size_hint (f, 0, false);
+
       XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                     width, height);
 
@@ -10215,6 +10226,10 @@ x_check_fullscreen (struct frame *f)
          x_sync (f);
        }
     }
+
+  /* `x_net_wm_state' might have reset the fullscreen frame parameter,
+     restore it. */
+  store_frame_param (f, Qfullscreen, lval);
 }
 
 /* This function is called by x_set_offset to determine whether the window
@@ -10578,7 +10593,7 @@ x_ewmh_activate_frame (struct frame *f)
 
   struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
 
-  if (FRAME_VISIBLE_P (f) && wm_supports (f, dpyinfo->Xatom_net_active_window))
+  if (FRAME_VISIBLE_P (f) && x_wm_supports (f, 
dpyinfo->Xatom_net_active_window))
     {
       Lisp_Object frame;
       XSETFRAME (frame, f);
@@ -11758,13 +11773,6 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
          {
            char *vendor = ServerVendor (dpy);
 
-           /* Protect terminal from GC before removing it from the
-              list of terminals.  */
-           struct gcpro gcpro1;
-           Lisp_Object gcpro_term;
-           XSETTERMINAL (gcpro_term, terminal);
-           GCPRO1 (gcpro_term);
-
            /* Temporarily hide the partially initialized terminal.  */
            terminal_list = terminal->next_terminal;
            unblock_input ();
@@ -11775,7 +11783,6 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
            block_input ();
            terminal->next_terminal = terminal_list;
            terminal_list = terminal;
-           UNGCPRO;
          }
 
        /* Don't let the initial kboard remain current longer than necessary.
diff --git a/src/xterm.h b/src/xterm.h
index 5622344..6165906 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1072,6 +1072,7 @@ x_display_set_last_user_time (struct x_display_info 
*dpyinfo, Time t)
 }
 
 extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object);
+extern bool x_wm_supports (struct frame *, Atom);
 extern void x_wait_for_event (struct frame *, int);
 extern void x_clear_under_internal_border (struct frame *f);
 
diff --git a/test/automated/elisp-mode-tests.el 
b/test/automated/elisp-mode-tests.el
index 2581de4..ec01477 100644
--- a/test/automated/elisp-mode-tests.el
+++ b/test/automated/elisp-mode-tests.el
@@ -3,6 +3,7 @@
 ;; Copyright (C) 2015 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <address@hidden>
+;; Author: Stephen Leake <address@hidden>
 
 ;; This file is part of GNU Emacs.
 
@@ -113,26 +114,514 @@
       (should (member "backup-buffer" comps))
       (should-not (member "backup-inhibited" comps)))))
 
-;;; Navigation
+;;; xref
 
-(ert-deftest elisp-xref-finds-both-function-and-variable ()
-  ;; "system-name" is both: a variable and a function
-  (let ((defs (elisp-xref-find 'definitions "system-name")))
-    (should (= (length defs) 2))
-    (should (string= (xref-item-summary (nth 0 defs))
-                     "(defun system-name)"))
-    (should (string= (xref-item-summary (nth 1 defs))
-                     "(defvar system-name)")))
+(defun xref-elisp-test-descr-to-target (xref)
+  "Return an appropriate `looking-at' match string for XREF."
+  (let* ((loc (xref-item-location xref))
+        (type (or (xref-elisp-location-type loc)
+                 'defun)))
+
+    (cl-case type
+      (defalias
+       ;; summary: "(defalias xref)"
+       ;; target : "(defalias 'xref)"
+       (concat "(defalias '" (substring (xref-item-summary xref) 10 -1)))
+
+      (defun
+       (let ((summary (xref-item-summary xref))
+            (file (xref-elisp-location-file loc)))
+        (cond
+         ((string= "c" (file-name-extension file))
+          ;; summary: "(defun buffer-live-p)"
+          ;; target : "DEFUN (buffer-live-p"
+          (concat
+           (upcase (substring summary 1 6))
+           " (\""
+           (substring summary 7 -1)
+           "\""))
+
+         (t
+          (substring summary 0 -1))
+         )))
+
+      (defvar
+       (let ((summary (xref-item-summary xref))
+            (file (xref-elisp-location-file loc)))
+        (cond
+         ((string= "c" (file-name-extension file))
+          ;; summary: "(defvar system-name)"
+          ;; target : "DEFVAR_LISP ("system-name", "
+           ;; summary: "(defvar abbrev-mode)"
+           ;; target : DEFVAR_PER_BUFFER ("abbrev-mode"
+          (concat
+           (upcase (substring summary 1 7))
+            (if (bufferp (variable-binding-locus (xref-elisp-location-symbol 
loc)))
+                "_PER_BUFFER (\""
+              "_LISP (\"")
+           (substring summary 8 -1)
+           "\""))
+
+         (t
+          (substring summary 0 -1))
+         )))
+
+      (feature
+       ;; summary: "(feature xref)"
+       ;; target : "(provide 'xref)"
+       (concat "(provide '" (substring (xref-item-summary xref) 9 -1)))
+
+      (otherwise
+       (substring (xref-item-summary xref) 0 -1))
+      )))
+
+
+(defun xref-elisp-test-run (xrefs expected-xrefs)
+  (should (= (length xrefs) (length expected-xrefs)))
+  (while xrefs
+    (let ((xref (pop xrefs))
+          (expected (pop expected-xrefs)))
+
+      (should (equal xref
+                     (or (when (consp expected) (car expected)) expected)))
+
+      (xref--goto-location (xref-item-location xref))
+      (back-to-indentation)
+      (should (looking-at (or (when (consp expected) (cdr expected))
+                              (xref-elisp-test-descr-to-target expected)))))
+    ))
+
+(defmacro xref-elisp-deftest (name computed-xrefs expected-xrefs)
+  "Define an ert test for an xref-elisp feature.
+COMPUTED-XREFS and EXPECTED-XREFS are lists of xrefs, except if
+an element of EXPECTED-XREFS is a cons (XREF . TARGET), TARGET is
+matched to the found location; otherwise, match
+to (xref-elisp-test-descr-to-target xref)."
+  (declare (indent defun)
+           (debug (symbolp "name")))
+  `(ert-deftest ,(intern (concat "xref-elisp-test-" (symbol-name name))) ()
+     (xref-elisp-test-run ,computed-xrefs ,expected-xrefs)
+     ))
+
+;; When tests are run from the Makefile, 'default-directory' is $HOME,
+;; so we must provide this dir to expand-file-name in the expected
+;; results. This also allows running these tests from other
+;; directories.
+(defconst emacs-test-dir (file-name-directory (or load-file-name 
(buffer-file-name))))
+
+;; alphabetical by test name
+
+;; FIXME: autoload
+
+;; FIXME: defalias-defun-c cmpl-prefix-entry-head
+;; FIXME: defalias-defvar-el allout-mode-map
+
+(xref-elisp-deftest find-defs-constructor
+  (elisp--xref-find-definitions 'xref-make-elisp-location)
+  ;; 'xref-make-elisp-location' is just a name for the default
+  ;; constructor created by the cl-defstruct, so the location is the
+  ;; cl-defstruct location.
+  (list
+   (cons
+    (xref-make "(cl-defstruct (xref-elisp-location (:constructor 
xref-make-elisp-location)))"
+               (xref-make-elisp-location
+                'xref-elisp-location 'define-type
+                (expand-file-name "../../lisp/progmodes/elisp-mode.el" 
emacs-test-dir)))
+    ;; It's not worth adding another special case to 
`xref-elisp-test-descr-to-target' for this
+    "(cl-defstruct (xref-elisp-location")
+   ))
+
+(xref-elisp-deftest find-defs-defalias-defun-el
+  (elisp--xref-find-definitions 'Buffer-menu-sort)
+  (list
+   (xref-make "(defalias Buffer-menu-sort)"
+             (xref-make-elisp-location
+              'Buffer-menu-sort 'defalias
+              (expand-file-name "../../lisp/buff-menu.elc" emacs-test-dir)))
+   (xref-make "(defun tabulated-list-sort)"
+             (xref-make-elisp-location
+              'tabulated-list-sort nil
+              (expand-file-name "../../lisp/emacs-lisp/tabulated-list.el" 
emacs-test-dir)))
+   ))
+
+;; FIXME: defconst
+
+;; FIXME: eieio defclass
+
+;; Possible ways of defining the default method implementation for a
+;; generic function. We declare these here, so we know we cover all
+;; cases, and we don't rely on other code not changing.
+;;
+;; When the generic and default method are declared in the same place,
+;; elisp--xref-find-definitions only returns one.
+
+(cl-defstruct (xref-elisp-root-type)
+  slot-1)
+
+(cl-defgeneric xref-elisp-generic-no-methods ()
+  "doc string generic no-methods"
+  ;; No default implementation, no methods, but fboundp is true for
+  ;; this symbol; it calls cl-no-applicable-method
+  )
+
+;; WORKAROUND: ‘this’ is unused, and the byte compiler complains, so
+;; it should be spelled ‘_this’. But for some unknown reason, that
+;; causes the batch mode test to fail; the symbol shows up as
+;; ‘this’. It passes in interactive tests, so I haven't been able to
+;; track down the problem.
+(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type))
+  "doc string generic no-default xref-elisp-root-type"
+  "non-default for no-default")
+
+;; defgeneric after defmethod in file to ensure the fallback search
+;; method of just looking for the function name will fail.
+(cl-defgeneric xref-elisp-generic-no-default ()
+  "doc string generic no-default generic"
+  ;; No default implementation; this function calls the cl-generic
+  ;; dispatching code.
+  )
+
+(cl-defgeneric xref-elisp-generic-co-located-default ()
+  "doc string generic co-located-default"
+  "co-located default")
+
+(cl-defmethod xref-elisp-generic-co-located-default ((this 
xref-elisp-root-type))
+  "doc string generic co-located-default xref-elisp-root-type"
+  "non-default for co-located-default")
+
+(cl-defgeneric xref-elisp-generic-separate-default ()
+  "doc string generic separate-default"
+  ;; default implementation provided separately
+  )
+
+(cl-defmethod xref-elisp-generic-separate-default ()
+  "doc string generic separate-default default"
+  "separate default")
+
+(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type))
+  "doc string generic separate-default xref-elisp-root-type"
+  "non-default for separate-default")
+
+(cl-defmethod xref-elisp-generic-implicit-generic ()
+  "doc string generic implicit-generic default"
+  "default for implicit generic")
+
+(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type))
+  "doc string generic implicit-generic xref-elisp-root-type"
+  "non-default for implicit generic")
+
+
+(xref-elisp-deftest find-defs-defgeneric-no-methods
+  (elisp--xref-find-definitions 'xref-elisp-generic-no-methods)
+  (list
+   (xref-make "(cl-defgeneric xref-elisp-generic-no-methods)"
+             (xref-make-elisp-location
+              'xref-elisp-generic-no-methods 'cl-defgeneric
+              (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   ))
+
+(xref-elisp-deftest find-defs-defgeneric-no-default
+  (elisp--xref-find-definitions 'xref-elisp-generic-no-default)
+  (list
+   (xref-make "(cl-defgeneric xref-elisp-generic-no-default)"
+             (xref-make-elisp-location
+              'xref-elisp-generic-no-default 'cl-defgeneric
+              (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   (xref-make "(cl-defmethod xref-elisp-generic-no-default ((this 
xref-elisp-root-type)))"
+             (xref-make-elisp-location
+              '(xref-elisp-generic-no-default xref-elisp-root-type) 
'cl-defmethod
+              (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   ))
+
+(xref-elisp-deftest find-defs-defgeneric-co-located-default
+  (elisp--xref-find-definitions 'xref-elisp-generic-co-located-default)
+  (list
+   (xref-make "(cl-defgeneric xref-elisp-generic-co-located-default)"
+             (xref-make-elisp-location
+              'xref-elisp-generic-co-located-default 'cl-defgeneric
+              (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   (xref-make "(cl-defmethod xref-elisp-generic-co-located-default ((this 
xref-elisp-root-type)))"
+             (xref-make-elisp-location
+              '(xref-elisp-generic-co-located-default xref-elisp-root-type) 
'cl-defmethod
+              (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   ))
+
+(xref-elisp-deftest find-defs-defgeneric-separate-default
+  (elisp--xref-find-definitions 'xref-elisp-generic-separate-default)
+  (list
+   (xref-make "(cl-defgeneric xref-elisp-generic-separate-default)"
+             (xref-make-elisp-location
+              'xref-elisp-generic-separate-default 'cl-defgeneric
+              (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   (xref-make "(cl-defmethod xref-elisp-generic-separate-default ())"
+              (xref-make-elisp-location
+               '(xref-elisp-generic-separate-default) 'cl-defmethod
+               (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   (xref-make "(cl-defmethod xref-elisp-generic-separate-default ((this 
xref-elisp-root-type)))"
+             (xref-make-elisp-location
+              '(xref-elisp-generic-separate-default xref-elisp-root-type) 
'cl-defmethod
+              (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   ))
+
+(xref-elisp-deftest find-defs-defgeneric-implicit-generic
+  (elisp--xref-find-definitions 'xref-elisp-generic-implicit-generic)
+  (list
+   (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ())"
+             (xref-make-elisp-location
+              '(xref-elisp-generic-implicit-generic) 'cl-defmethod
+              (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ((this 
xref-elisp-root-type)))"
+             (xref-make-elisp-location
+              '(xref-elisp-generic-implicit-generic xref-elisp-root-type) 
'cl-defmethod
+              (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   ))
+
+;; Test that we handle more than one method
+
+;; When run from the Makefile, etags is not loaded at compile time,
+;; but it is by the time this test is run.  interactively; don't fail
+;; for that.
+(require 'etags)
+(xref-elisp-deftest find-defs-defgeneric-el
+  (elisp--xref-find-definitions 'xref-location-marker)
+  (list
+   (xref-make "(cl-defgeneric xref-location-marker)"
+             (xref-make-elisp-location
+              'xref-location-marker 'cl-defgeneric
+              (expand-file-name "../../lisp/progmodes/xref.el" 
emacs-test-dir)))
+   (xref-make "(cl-defmethod xref-location-marker ((l xref-elisp-location)))"
+             (xref-make-elisp-location
+              '(xref-location-marker xref-elisp-location) 'cl-defmethod
+              (expand-file-name "../../lisp/progmodes/elisp-mode.el" 
emacs-test-dir)))
+   (xref-make "(cl-defmethod xref-location-marker ((l xref-file-location)))"
+             (xref-make-elisp-location
+              '(xref-location-marker xref-file-location) 'cl-defmethod
+              (expand-file-name "../../lisp/progmodes/xref.el" 
emacs-test-dir)))
+   (xref-make "(cl-defmethod xref-location-marker ((l xref-buffer-location)))"
+             (xref-make-elisp-location
+              '(xref-location-marker xref-buffer-location) 'cl-defmethod
+              (expand-file-name "../../lisp/progmodes/xref.el" 
emacs-test-dir)))
+   (xref-make "(cl-defmethod xref-location-marker ((l xref-bogus-location)))"
+             (xref-make-elisp-location
+              '(xref-location-marker xref-bogus-location) 'cl-defmethod
+              (expand-file-name "../../lisp/progmodes/xref.el" 
emacs-test-dir)))
+   (xref-make "(cl-defmethod xref-location-marker ((l xref-etags-location)))"
+              (xref-make-elisp-location
+               '(xref-location-marker xref-etags-location) 'cl-defmethod
+               (expand-file-name "../../lisp/progmodes/etags.el" 
emacs-test-dir)))
+   ))
+
+(xref-elisp-deftest find-defs-defgeneric-eval
+  (elisp--xref-find-definitions (eval '(cl-defgeneric 
stephe-leake-cl-defgeneric ())))
+  nil)
+
+;; Define some mode-local overloadable/overridden functions for xref to find
+(require 'mode-local)
+
+(define-overloadable-function xref-elisp-overloadable-no-methods ()
+  "doc string overloadable no-methods")
+
+(define-overloadable-function xref-elisp-overloadable-no-default ()
+  "doc string overloadable no-default")
+
+;; FIXME: byte compiler complains about unused lexical arguments
+;; generated by this macro.
+(define-mode-local-override xref-elisp-overloadable-no-default c-mode
+  (start end &optional nonterminal depth returnonerror)
+  "doc string overloadable no-default c-mode."
+  "result overloadable no-default c-mode.")
+
+(define-overloadable-function xref-elisp-overloadable-co-located-default ()
+  "doc string overloadable co-located-default"
+  "result overloadable co-located-default.")
+
+(define-mode-local-override xref-elisp-overloadable-co-located-default c-mode
+  (start end &optional nonterminal depth returnonerror)
+  "doc string overloadable co-located-default c-mode."
+  "result overloadable co-located-default c-mode.")
+
+(define-overloadable-function xref-elisp-overloadable-separate-default ()
+  "doc string overloadable separate-default.")
+
+(defun xref-elisp-overloadable-separate-default-default ()
+  "doc string overloadable separate-default default"
+  "result overloadable separate-default.")
+
+(define-mode-local-override xref-elisp-overloadable-separate-default c-mode
+  (start end &optional nonterminal depth returnonerror)
+  "doc string overloadable separate-default c-mode."
+  "result overloadable separate-default c-mode.")
+
+(xref-elisp-deftest find-defs-define-overload-no-methods
+  (elisp--xref-find-definitions 'xref-elisp-overloadable-no-methods)
+  (list
+   (xref-make "(define-overloadable-function 
xref-elisp-overloadable-no-methods)"
+              (xref-make-elisp-location
+               'xref-elisp-overloadable-no-methods 
'define-overloadable-function
+               (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   ))
+
+(xref-elisp-deftest find-defs-define-overload-no-default
+  (elisp--xref-find-definitions 'xref-elisp-overloadable-no-default)
+  (list
+   (xref-make "(define-overloadable-function 
xref-elisp-overloadable-no-default)"
+              (xref-make-elisp-location
+               'xref-elisp-overloadable-no-default 
'define-overloadable-function
+               (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   (xref-make "(define-mode-local-override xref-elisp-overloadable-no-default 
c-mode)"
+              (xref-make-elisp-location
+               '(xref-elisp-overloadable-no-default-c-mode . c-mode) 
'define-mode-local-override
+               (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   ))
+
+(xref-elisp-deftest find-defs-define-overload-co-located-default
+  (elisp--xref-find-definitions 'xref-elisp-overloadable-co-located-default)
+  (list
+   (xref-make "(define-overloadable-function 
xref-elisp-overloadable-co-located-default)"
+              (xref-make-elisp-location
+               'xref-elisp-overloadable-co-located-default 
'define-overloadable-function
+               (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   (xref-make "(define-mode-local-override 
xref-elisp-overloadable-co-located-default c-mode)"
+              (xref-make-elisp-location
+               '(xref-elisp-overloadable-co-located-default-c-mode . c-mode) 
'define-mode-local-override
+               (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   ))
+
+(xref-elisp-deftest find-defs-define-overload-separate-default
+  (elisp--xref-find-definitions 'xref-elisp-overloadable-separate-default)
+  (list
+   (xref-make "(define-overloadable-function 
xref-elisp-overloadable-separate-default)"
+              (xref-make-elisp-location
+               'xref-elisp-overloadable-separate-default 
'define-overloadable-function
+               (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   (xref-make "(defun xref-elisp-overloadable-separate-default-default)"
+              (xref-make-elisp-location
+               'xref-elisp-overloadable-separate-default-default nil
+               (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   (xref-make "(define-mode-local-override 
xref-elisp-overloadable-separate-default c-mode)"
+              (xref-make-elisp-location
+               '(xref-elisp-overloadable-separate-default-c-mode . c-mode) 
'define-mode-local-override
+               (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
+   ))
+
+(xref-elisp-deftest find-defs-defun-el
+  (elisp--xref-find-definitions 'xref-find-definitions)
+  (list
+   (xref-make "(defun xref-find-definitions)"
+             (xref-make-elisp-location
+              'xref-find-definitions nil
+              (expand-file-name "../../lisp/progmodes/xref.el" 
emacs-test-dir)))))
+
+(xref-elisp-deftest find-defs-defun-eval
+  (elisp--xref-find-definitions (eval '(defun stephe-leake-defun ())))
+  nil)
+
+(xref-elisp-deftest find-defs-defun-c
+  (elisp--xref-find-definitions 'buffer-live-p)
+  (list
+   (xref-make "(defun buffer-live-p)"
+             (xref-make-elisp-location 'buffer-live-p nil "src/buffer.c"))))
+
+;; FIXME: deftype
+
+(xref-elisp-deftest find-defs-defun-c-defvar-c
+  (elisp-xref-find 'definitions "system-name")
+  (list
+   (xref-make "(defvar system-name)"
+             (xref-make-elisp-location 'system-name 'defvar "src/editfns.c"))
+   (xref-make "(defun system-name)"
+              (xref-make-elisp-location 'system-name nil "src/editfns.c")))
+  )
+
+(xref-elisp-deftest find-defs-defun-el-defvar-c
+  (elisp-xref-find 'definitions "abbrev-mode")
   ;; It's a minor mode, but the variable is defined in buffer.c
-  (let ((defs (elisp-xref-find 'definitions "abbrev-mode")))
-    (should (= (length defs) 2))))
-
-(ert-deftest elisp-xref-finds-only-function-for-minor-mode ()
-  ;; Both variable and function are defined in the same place.
-  (let ((defs (elisp-xref-find 'definitions "visible-mode")))
-    (should (= (length defs) 1))
-    (should (string= (xref-item-summary (nth 0 defs))
-                     "(defun visible-mode)"))))
+  (list
+   (xref-make "(defvar abbrev-mode)"
+             (xref-make-elisp-location 'abbrev-mode 'defvar "src/buffer.c"))
+   (cons
+    (xref-make "(defun abbrev-mode)"
+               (xref-make-elisp-location
+                'abbrev-mode nil
+                (expand-file-name "../../lisp/abbrev.el" emacs-test-dir)))
+    "(define-minor-mode abbrev-mode"))
+  )
+
+;; Source for both variable and defun is "(define-minor-mode
+;; compilation-minor-mode". There is no way to tell that directly from
+;; the symbol, but we can use (memq sym minor-mode-list) to detect
+;; that the symbol is a minor mode. See `elisp--xref-find-definitions'
+;; for more comments.
+;;
+;; IMPROVEME: return defvar instead of defun if source near starting
+;; point indicates the user is searching for a variable, not a
+;; function.
+(require 'compile) ;; not loaded by default at test time
+(xref-elisp-deftest find-defs-defun-defvar-el
+  (elisp--xref-find-definitions 'compilation-minor-mode)
+  (list
+   (cons
+    (xref-make "(defun compilation-minor-mode)"
+               (xref-make-elisp-location
+                'compilation-minor-mode nil
+                (expand-file-name "../../lisp/progmodes/compile.el" 
emacs-test-dir)))
+    "(define-minor-mode compilation-minor-mode")
+   ))
+
+(xref-elisp-deftest find-defs-defvar-el
+  (elisp--xref-find-definitions 'xref--marker-ring)
+  (list
+   (xref-make "(defvar xref--marker-ring)"
+             (xref-make-elisp-location
+              'xref--marker-ring 'defvar
+              (expand-file-name "../../lisp/progmodes/xref.el" 
emacs-test-dir)))
+    ))
+
+(xref-elisp-deftest find-defs-defvar-c
+  (elisp--xref-find-definitions 'default-directory)
+  (list
+   (cons
+    (xref-make "(defvar default-directory)"
+               (xref-make-elisp-location 'default-directory 'defvar 
"src/buffer.c"))
+    ;; IMPROVEME: we might be able to compute this target
+    "DEFVAR_PER_BUFFER (\"default-directory\"")))
+
+(xref-elisp-deftest find-defs-defvar-eval
+  (elisp--xref-find-definitions (eval '(defvar stephe-leake-defvar nil)))
+  nil)
+
+(xref-elisp-deftest find-defs-face-el
+  (elisp--xref-find-definitions 'font-lock-keyword-face)
+  ;; 'font-lock-keyword-face is both a face and a var
+  (list
+   (xref-make "(defvar font-lock-keyword-face)"
+             (xref-make-elisp-location
+              'font-lock-keyword-face 'defvar
+              (expand-file-name "../../lisp/font-lock.el" emacs-test-dir)))
+   (xref-make "(defface font-lock-keyword-face)"
+             (xref-make-elisp-location
+              'font-lock-keyword-face 'defface
+              (expand-file-name "../../lisp/font-lock.el" emacs-test-dir)))
+   ))
+
+(xref-elisp-deftest find-defs-face-eval
+  (elisp--xref-find-definitions (eval '(defface stephe-leake-defface nil "")))
+  nil)
+
+(xref-elisp-deftest find-defs-feature-el
+  (elisp--xref-find-definitions 'xref)
+  (list
+   (cons
+    (xref-make "(feature xref)"
+             (xref-make-elisp-location
+              'xref 'feature
+              (expand-file-name "../../lisp/progmodes/xref.el" 
emacs-test-dir)))
+    ";;; Code:")
+   ))
+
+(xref-elisp-deftest find-defs-feature-eval
+  (elisp--xref-find-definitions (eval '(provide 'stephe-leake-feature)))
+  nil)
 
 (provide 'elisp-mode-tests)
 ;;; elisp-mode-tests.el ends here
diff --git a/test/automated/ert-tests.el b/test/automated/ert-tests.el
index fcfc7ee..5382c40 100644
--- a/test/automated/ert-tests.el
+++ b/test/automated/ert-tests.el
@@ -345,6 +345,10 @@ This macro is used to test if macroexpansion in `should' 
works."
         (should (equal actual-condition expected-condition)))))))
 
 (ert-deftest ert-test-deftest ()
+  ;; FIXME: These tests don't look very good.  What is their intent, i.e. what
+  ;; are they really testing?  The precise generated code shouldn't matter, so
+  ;; we should either test the behavior of the code, or else try to express the
+  ;; kind of efficiency guarantees we're looking for.
   (should (equal (macroexpand '(ert-deftest abc () "foo" :tags '(bar)))
                 '(progn
                    (ert-set-test 'abc
diff --git a/test/automated/finalizer-tests.el 
b/test/automated/finalizer-tests.el
index 142152e..218df05 100644
--- a/test/automated/finalizer-tests.el
+++ b/test/automated/finalizer-tests.el
@@ -29,55 +29,5 @@
 (require 'ert)
 (require 'cl-lib)
 
-(ert-deftest finalizer-basic ()
-  "Test that finalizers run at all."
-  (skip-unless gc-precise)
-  (let* ((finalized nil)
-         (finalizer (make-finalizer (lambda () (setf finalized t)))))
-    (garbage-collect)
-    (should (equal finalized nil))
-    (setf finalizer nil)
-    (garbage-collect)
-    (should (equal finalized t))))
-
-(ert-deftest finalizer-circular-reference ()
-  "Test references from a callback to a finalizer."
-  (skip-unless gc-precise)
-  (let ((finalized nil))
-    (let* ((value nil)
-           (finalizer (make-finalizer (lambda () (setf finalized value)))))
-      (setf value finalizer)
-      (setf finalizer nil))
-    (garbage-collect)
-    (should finalized)))
-
-(ert-deftest finalizer-cross-reference ()
-  "Test that between-finalizer references do not prevent collection."
-  (skip-unless gc-precise)
-  (let ((d nil) (fc 0))
-    (let* ((f1-data (cons nil nil))
-           (f2-data (cons nil nil))
-           (f1 (make-finalizer
-                (lambda () (cl-incf fc) (setf d f1-data))))
-           (f2 (make-finalizer
-                (lambda () (cl-incf fc) (setf d f2-data)))))
-      (setcar f1-data f2)
-      (setcar f2-data f1))
-    (garbage-collect)
-    (should (equal fc 2))))
-
-(ert-deftest finalizer-error ()
-  "Test that finalizer errors are suppressed"
-  (skip-unless gc-precise)
-  (make-finalizer (lambda () (error "ABCDEF")))
-  (garbage-collect)
-  (with-current-buffer "*Messages*"
-    (save-excursion
-      (goto-char (point-max))
-      (forward-line -1)
-      (should (equal
-               (buffer-substring (point) (point-at-eol))
-               "finalizer failed: (error \"ABCDEF\")")))))
-
 (ert-deftest finalizer-object-type ()
   (should (equal (type-of (make-finalizer nil)) 'finalizer)))
diff --git a/test/automated/generator-tests.el 
b/test/automated/generator-tests.el
index d9c81b5..96a68d1 100644
--- a/test/automated/generator-tests.el
+++ b/test/automated/generator-tests.el
@@ -260,20 +260,6 @@ identical output.
       (iter-close iter)
       (should (not cps-test-closed-flag)))))
 
-(ert-deftest cps-test-iter-close-finalizer ()
-  (skip-unless gc-precise)
-  (garbage-collect)
-  (let ((cps-test-closed-flag nil))
-    (let ((iter (funcall
-                 (iter-lambda ()
-                   (unwind-protect (iter-yield 1)
-                     (setf cps-test-closed-flag t))))))
-      (should (equal (iter-next iter) 1))
-      (should (not cps-test-closed-flag))
-      (setf iter nil)
-      (garbage-collect)
-      (should cps-test-closed-flag))))
-
 (ert-deftest cps-test-iter-cleanup-once-only ()
   (let* ((nr-unwound 0)
          (iter
diff --git a/test/automated/icalendar-tests.el 
b/test/automated/icalendar-tests.el
index 3614c7a..c83044c 100644
--- a/test/automated/icalendar-tests.el
+++ b/test/automated/icalendar-tests.el
@@ -391,8 +391,8 @@ END:VTIMEZONE
 
 (ert-deftest icalendar--import-format-sample ()
   "Test method for `icalendar-import-format-sample'."
-  (should (string= (concat "SUMMARY=`a' DESCRIPTION=`b' LOCATION=`c' "
-                           "ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'")
+  (should (string= (concat "SUMMARY='a' DESCRIPTION='b' LOCATION='c' "
+                           "ORGANIZER='d' STATUS='' URL='' CLASS=''")
                   (icalendar-import-format-sample
                     (icalendar-tests--get-ical-event "BEGIN:VEVENT
 DTSTAMP:20030509T043439Z
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index d490f7f..30b1b48 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -2440,107 +2440,191 @@ Using `python-shell-interpreter' and
                      python-shell-interpreter-args)
              (python-shell-calculate-command)))))
 
+(ert-deftest python-shell-calculate-pythonpath-1 ()
+  "Test PYTHONPATH calculation."
+  (let ((process-environment '("PYTHONPATH=/path0"))
+        (python-shell-extra-pythonpaths '("/path1" "/path2")))
+    (should (string= (python-shell-calculate-pythonpath)
+                     "/path1:/path2:/path0"))))
+
+(ert-deftest python-shell-calculate-pythonpath-2 ()
+  "Test existing paths are moved to front."
+  (let ((process-environment '("PYTHONPATH=/path0:/path1"))
+        (python-shell-extra-pythonpaths '("/path1" "/path2")))
+    (should (string= (python-shell-calculate-pythonpath)
+                     "/path1:/path2:/path0"))))
+
 (ert-deftest python-shell-calculate-process-environment-1 ()
   "Test `python-shell-process-environment' modification."
   (let* ((python-shell-process-environment
           '("TESTVAR1=value1" "TESTVAR2=value2"))
-         (process-environment
-          (python-shell-calculate-process-environment)))
+         (process-environment (python-shell-calculate-process-environment)))
     (should (equal (getenv "TESTVAR1") "value1"))
     (should (equal (getenv "TESTVAR2") "value2"))))
 
 (ert-deftest python-shell-calculate-process-environment-2 ()
   "Test `python-shell-extra-pythonpaths' modification."
   (let* ((process-environment process-environment)
-         (original-pythonpath (setenv "PYTHONPATH" "path3"))
-         (paths '("path1" "path2"))
-         (python-shell-extra-pythonpaths paths)
-         (process-environment
-          (python-shell-calculate-process-environment)))
-    (should (equal (getenv "PYTHONPATH")
-                   (concat
-                    (mapconcat 'identity paths path-separator)
-                    path-separator original-pythonpath)))))
+         (original-pythonpath (setenv "PYTHONPATH" "/path0"))
+         (python-shell-extra-pythonpaths '("/path1" "/path2"))
+         (process-environment (python-shell-calculate-process-environment)))
+    (should (equal (getenv "PYTHONPATH") "/path1:/path2:/path0"))))
 
 (ert-deftest python-shell-calculate-process-environment-3 ()
   "Test `python-shell-virtualenv-root' modification."
-  (let* ((python-shell-virtualenv-root
-          (directory-file-name user-emacs-directory))
+  (let* ((python-shell-virtualenv-root "/env")
          (process-environment
-          (python-shell-calculate-process-environment)))
+          (let (process-environment process-environment)
+            (setenv "PYTHONHOME" "/home")
+            (setenv "VIRTUAL_ENV")
+            (python-shell-calculate-process-environment))))
     (should (not (getenv "PYTHONHOME")))
-    (should (string= (getenv "VIRTUAL_ENV") python-shell-virtualenv-root))))
+    (should (string= (getenv "VIRTUAL_ENV") "/env"))))
 
 (ert-deftest python-shell-calculate-process-environment-4 ()
-  "Test `python-shell-unbuffered' modification."
-  (setenv "PYTHONUNBUFFERED")
-  (let* ((process-environment
-          (python-shell-calculate-process-environment)))
-    ;; Defaults to t
-    (should python-shell-unbuffered)
+  "Test PYTHONUNBUFFERED when `python-shell-unbuffered' is non-nil."
+  (let* ((python-shell-unbuffered t)
+         (process-environment
+          (let ((process-environment process-environment))
+            (setenv "PYTHONUNBUFFERED")
+            (python-shell-calculate-process-environment))))
     (should (string= (getenv "PYTHONUNBUFFERED") "1"))))
 
 (ert-deftest python-shell-calculate-process-environment-5 ()
-  (setenv "PYTHONUNBUFFERED")
-  "Test `python-shell-unbuffered' modification."
+  "Test PYTHONUNBUFFERED when `python-shell-unbuffered' is nil."
   (let* ((python-shell-unbuffered nil)
          (process-environment
-          (python-shell-calculate-process-environment)))
+          (let ((process-environment process-environment))
+            (setenv "PYTHONUNBUFFERED")
+            (python-shell-calculate-process-environment))))
     (should (not (getenv "PYTHONUNBUFFERED")))))
 
+(ert-deftest python-shell-calculate-process-environment-6 ()
+  "Test PYTHONUNBUFFERED=1 when `python-shell-unbuffered' is nil."
+  (let* ((python-shell-unbuffered nil)
+         (process-environment
+          (let ((process-environment process-environment))
+            (setenv "PYTHONUNBUFFERED" "1")
+            (python-shell-calculate-process-environment))))
+    ;; User default settings must remain untouched:
+    (should (string= (getenv "PYTHONUNBUFFERED") "1"))))
+
+(ert-deftest python-shell-calculate-process-environment-7 ()
+  "Test no side-effects on `process-environment'."
+  (let* ((python-shell-process-environment
+          '("TESTVAR1=value1" "TESTVAR2=value2"))
+         (python-shell-virtualenv-root "/env")
+         (python-shell-unbuffered t)
+         (python-shell-extra-pythonpaths'("/path1" "/path2"))
+         (original-process-environment (copy-sequence process-environment)))
+    (python-shell-calculate-process-environment)
+    (should (equal process-environment original-process-environment))))
+
+(ert-deftest python-shell-calculate-process-environment-8 ()
+  "Test no side-effects on `tramp-remote-process-environment'."
+  (let* ((default-directory "/ssh::/example/dir/")
+         (python-shell-process-environment
+          '("TESTVAR1=value1" "TESTVAR2=value2"))
+         (python-shell-virtualenv-root "/env")
+         (python-shell-unbuffered t)
+         (python-shell-extra-pythonpaths'("/path1" "/path2"))
+         (original-process-environment
+          (copy-sequence tramp-remote-process-environment)))
+    (python-shell-calculate-process-environment)
+    (should (equal tramp-remote-process-environment 
original-process-environment))))
+
 (ert-deftest python-shell-calculate-exec-path-1 ()
   "Test `python-shell-exec-path' modification."
-  (let* ((original-exec-path exec-path)
-         (python-shell-exec-path '("path1" "path2"))
-         (exec-path (python-shell-calculate-exec-path)))
-    (should (equal
-             exec-path
-             (append python-shell-exec-path
-                     original-exec-path)))))
+  (let* ((exec-path '("/path0"))
+         (python-shell-exec-path '("/path1" "/path2"))
+         (new-exec-path (python-shell-calculate-exec-path)))
+    (should (equal new-exec-path '("/path1" "/path2" "/path0")))))
 
 (ert-deftest python-shell-calculate-exec-path-2 ()
   "Test `python-shell-virtualenv-root' modification."
-  (let* ((original-exec-path exec-path)
-         (python-shell-virtualenv-root
-          (directory-file-name (expand-file-name user-emacs-directory)))
-         (exec-path (python-shell-calculate-exec-path)))
-    (should (equal
-             exec-path
-             (append (cons
-                      (format "%s/bin" python-shell-virtualenv-root)
-                      original-exec-path))))))
+  (let* ((exec-path '("/path0"))
+         (python-shell-virtualenv-root "/env")
+         (new-exec-path (python-shell-calculate-exec-path)))
+    (should (equal new-exec-path '("/env/bin" "/path0")))))
+
+(ert-deftest python-shell-calculate-exec-path-3 ()
+  "Test complete `python-shell-virtualenv-root' modification."
+  (let* ((exec-path '("/path0"))
+         (python-shell-exec-path '("/path1" "/path2"))
+         (python-shell-virtualenv-root "/env")
+         (new-exec-path (python-shell-calculate-exec-path)))
+    (should (equal new-exec-path '("/env/bin" "/path1" "/path2" "/path0")))))
+
+(ert-deftest python-shell-calculate-exec-path-4 ()
+  "Test complete `python-shell-virtualenv-root' with remote."
+  (let* ((default-directory "/ssh::/example/dir/")
+         (python-shell-remote-exec-path '("/path0"))
+         (python-shell-exec-path '("/path1" "/path2"))
+         (python-shell-virtualenv-root "/env")
+         (new-exec-path (python-shell-calculate-exec-path)))
+    (should (equal new-exec-path '("/env/bin" "/path1" "/path2" "/path0")))))
+
+(ert-deftest python-shell-calculate-exec-path-5 ()
+  "Test no side-effects on `exec-path'."
+  (let* ((exec-path '("/path0"))
+         (python-shell-exec-path '("/path1" "/path2"))
+         (python-shell-virtualenv-root "/env")
+         (original-exec-path (copy-sequence exec-path)))
+    (python-shell-calculate-exec-path)
+    (should (equal exec-path original-exec-path))))
+
+(ert-deftest python-shell-calculate-exec-path-6 ()
+  "Test no side-effects on `python-shell-remote-exec-path'."
+  (let* ((default-directory "/ssh::/example/dir/")
+         (python-shell-remote-exec-path '("/path0"))
+         (python-shell-exec-path '("/path1" "/path2"))
+         (python-shell-virtualenv-root "/env")
+         (original-exec-path (copy-sequence python-shell-remote-exec-path)))
+    (python-shell-calculate-exec-path)
+    (should (equal python-shell-remote-exec-path original-exec-path))))
 
 (ert-deftest python-shell-with-environment-1 ()
-  "Test with local `default-directory'."
-  (let* ((original-exec-path exec-path)
-         (python-shell-virtualenv-root
-          (directory-file-name (expand-file-name user-emacs-directory))))
+  "Test environment with local `default-directory'."
+  (let* ((exec-path '("/path0"))
+         (python-shell-exec-path '("/path1" "/path2"))
+         (original-exec-path exec-path)
+         (python-shell-virtualenv-root "/env"))
     (python-shell-with-environment
-      (should (equal
-               exec-path
-               (append (cons
-                        (format "%s/bin" python-shell-virtualenv-root)
-                        original-exec-path))))
+      (should (equal exec-path '("/env/bin" "/path1" "/path2" "/path0")))
       (should (not (getenv "PYTHONHOME")))
-      (should (string= (getenv "VIRTUAL_ENV") python-shell-virtualenv-root)))))
+      (should (string= (getenv "VIRTUAL_ENV") "/env")))
+    (should (equal exec-path original-exec-path))))
 
 (ert-deftest python-shell-with-environment-2 ()
-  "Test with remote `default-directory'."
+  "Test environment with remote `default-directory'."
   (let* ((default-directory "/ssh::/example/dir/")
-         (original-exec-path tramp-remote-path)
-         (original-process-environment tramp-remote-process-environment)
-         (python-shell-virtualenv-root
-          (directory-file-name (expand-file-name user-emacs-directory))))
+         (python-shell-remote-exec-path '("/remote1" "/remote2"))
+         (python-shell-exec-path '("/path1" "/path2"))
+         (tramp-remote-process-environment '("EMACS=t"))
+         (original-process-environment (copy-sequence 
tramp-remote-process-environment))
+         (python-shell-virtualenv-root "/env"))
     (python-shell-with-environment
-      (should (equal
-               tramp-remote-path
-               (append (cons
-                        (format "%s/bin" python-shell-virtualenv-root)
-                        original-exec-path))))
-      (let ((process-environment tramp-remote-process-environment))
+      (should (equal (python-shell-calculate-exec-path)
+                     '("/env/bin" "/path1" "/path2" "/remote1" "/remote2")))
+      (let ((process-environment (python-shell-calculate-process-environment)))
         (should (not (getenv "PYTHONHOME")))
-        (should (string= (getenv "VIRTUAL_ENV")
-                         python-shell-virtualenv-root))))))
+        (should (string= (getenv "VIRTUAL_ENV") "/env"))
+        (should (equal tramp-remote-process-environment process-environment))))
+    (should (equal tramp-remote-process-environment 
original-process-environment))))
+
+(ert-deftest python-shell-with-environment-3 ()
+  "Test `python-shell-with-environment' is idempotent."
+  (let* ((python-shell-extra-pythonpaths '("/example/dir/"))
+         (python-shell-exec-path '("path1" "path2"))
+         (python-shell-virtualenv-root "/home/user/env")
+         (single-call
+          (python-shell-with-environment
+            (list exec-path process-environment)))
+         (nested-call
+          (python-shell-with-environment
+            (python-shell-with-environment
+              (list exec-path process-environment)))))
+    (should (equal single-call nested-call))))
 
 (ert-deftest python-shell-make-comint-1 ()
   "Check comint creation for global shell buffer."
@@ -3192,6 +3276,61 @@ class Foo(models.Model):
 
 "))))
 
+(ert-deftest python-shell-buffer-substring-10 ()
+  "Check substring from partial block."
+  (python-tests-with-temp-buffer
+   "
+def foo():
+    print ('a')
+"
+   (should (string= (python-shell-buffer-substring
+                     (python-tests-look-at "print ('a')")
+                     (point-max))
+                    "if True:
+
+    print ('a')
+"))))
+
+(ert-deftest python-shell-buffer-substring-11 ()
+  "Check substring from partial block and point within indentation."
+  (python-tests-with-temp-buffer
+   "
+def foo():
+    print ('a')
+"
+   (should (string= (python-shell-buffer-substring
+                     (progn
+                       (python-tests-look-at "print ('a')")
+                       (backward-char 1)
+                       (point))
+                     (point-max))
+                    "if True:
+
+    print ('a')
+"))))
+
+(ert-deftest python-shell-buffer-substring-12 ()
+  "Check substring from partial block and point in whitespace."
+  (python-tests-with-temp-buffer
+   "
+def foo():
+
+        # Whitespace
+
+    print ('a')
+"
+   (should (string= (python-shell-buffer-substring
+                     (python-tests-look-at "# Whitespace")
+                     (point-max))
+                    "if True:
+
+
+        # Whitespace
+
+    print ('a')
+"))))
+
+
 
 ;;; Shell completion
 
diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el
index 3643ce5..482daee 100644
--- a/test/automated/seq-tests.el
+++ b/test/automated/seq-tests.el
@@ -54,6 +54,11 @@ Evaluate BODY for each created sequence.
   "Return t if INTEGER is odd."
   (not (test-sequences-evenp integer)))
 
+(ert-deftest test-setf-seq-elt ()
+  (with-test-sequences (seq '(1 2 3))
+    (setf (seq-elt seq 1) 4)
+    (should (= 4 (seq-elt seq 1)))))
+
 (ert-deftest test-seq-drop ()
   (with-test-sequences (seq '(1 2 3 4))
     (should (equal (seq-drop seq 0) seq))
@@ -187,7 +192,12 @@ Evaluate BODY for each created sequence.
   (should-not   (seq-subseq '(1 2 3) 3))
   (should       (seq-subseq '(1 2 3) -3))
   (should-error (seq-subseq '(1 2 3) 1 4))
-  (should       (seq-subseq '(1 2 3) 1 3)))
+  (should       (seq-subseq '(1 2 3) 1 3))
+  (should-error (seq-subseq '() -1))
+  (should-error (seq-subseq [] -1))
+  (should-error (seq-subseq "" -1))
+  (should-not (seq-subseq '() 0))
+  (should-error (seq-subseq '() 0 -1)))
 
 (ert-deftest test-seq-concatenate ()
   (with-test-sequences (seq '(2 4 6))
@@ -302,5 +312,10 @@ Evaluate BODY for each created sequence.
     (should (= (seq-min seq) 0))
     (should (= (seq-max seq) 5))))
 
+(ert-deftest test-seq-into-sequence ()
+  (with-test-sequences (seq '(1 2 3))
+    (should (eq seq (seq-into-sequence seq)))
+    (should-error (seq-into-sequence 2))))
+
 (provide 'seq-tests)
 ;;; seq-tests.el ends here
diff --git a/test/automated/textprop-tests.el b/test/automated/textprop-tests.el
index 310a7a0..f6604fb 100644
--- a/test/automated/textprop-tests.el
+++ b/test/automated/textprop-tests.el
@@ -24,6 +24,18 @@
 
 (require 'ert)
 
+(ert-deftest textprop-tests-format ()
+  "Test ‘format’ with text properties."
+  ;; See Bug#21351.
+  (should (equal-including-properties
+           (format #("mouse-1, RET: %s -- w: copy %s"
+                     12 20 (face minibuffer-prompt)
+                     21 30 (face minibuffer-prompt))
+                   "visit" "link")
+           #("mouse-1, RET: visit -- w: copy link"
+             12 23 (face minibuffer-prompt)
+             24 35 (face minibuffer-prompt)))))
+
 (ert-deftest textprop-tests-font-lock--remove-face-from-text-property ()
   "Test `font-lock--remove-face-from-text-property'."
   (let* ((string "foobar")
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el
index e6f77e4..498a0cf 100644
--- a/test/automated/tramp-tests.el
+++ b/test/automated/tramp-tests.el
@@ -1058,6 +1058,13 @@ This tests also `file-readable-p' and `file-regular-p'."
          (file-truename tramp-test-temporary-file-directory))
         (tmp-name1 (tramp--test-make-temp-name))
         (tmp-name2 (tramp--test-make-temp-name))
+        ;; File name with "//".
+        (tmp-name3
+         (format
+          "%s%s"
+          (file-remote-p tmp-name1)
+          (replace-regexp-in-string
+           "/" "//" (file-remote-p tmp-name1 'localname))))
         attr)
     (unwind-protect
        (progn
@@ -1099,8 +1106,24 @@ This tests also `file-readable-p' and `file-regular-p'."
            (file-error
             (should (string-equal (error-message-string err)
                                   "make-symbolic-link not supported"))))
-         (delete-file tmp-name1)
 
+         ;; Check, that "//" in symlinks are handled properly.
+         (with-temp-buffer
+           (let ((default-directory tramp-test-temporary-file-directory))
+             (shell-command
+              (format
+               "ln -s %s %s"
+               (tramp-file-name-localname (tramp-dissect-file-name tmp-name3))
+               (tramp-file-name-localname (tramp-dissect-file-name tmp-name2)))
+              t)))
+         (when (file-symlink-p tmp-name2)
+           (setq attr (file-attributes tmp-name2))
+           (should (string-equal
+                    (car attr)
+                    (file-remote-p (file-truename tmp-name3) 'localname)))
+           (delete-file tmp-name2))
+
+         (delete-file tmp-name1)
          (make-directory tmp-name1)
          (should (file-exists-p tmp-name1))
          (should (file-readable-p tmp-name1))
@@ -1109,7 +1132,9 @@ This tests also `file-readable-p' and `file-regular-p'."
          (should (eq (car attr) t)))
 
       ;; Cleanup.
-      (ignore-errors (delete-directory tmp-name1)))))
+      (ignore-errors (delete-directory tmp-name1))
+      (ignore-errors (delete-file tmp-name1))
+      (ignore-errors (delete-file tmp-name2)))))
 
 (ert-deftest tramp-test19-directory-files-and-attributes ()
   "Check `directory-files-and-attributes'."
@@ -1198,6 +1223,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
         (tmp-name1 (tramp--test-make-temp-name))
         (tmp-name2 (tramp--test-make-temp-name))
         (tmp-name3 (tramp--test-make-temp-name 'local)))
+
+    ;; Check `make-symbolic-link'.
     (unwind-protect
        (progn
          (write-region "foo" nil tmp-name1)
@@ -1223,6 +1250,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
        (delete-file tmp-name1)
        (delete-file tmp-name2)))
 
+    ;; Check `add-name-to-file'.
     (unwind-protect
        (progn
          (write-region "foo" nil tmp-name1)
@@ -1240,6 +1268,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
        (delete-file tmp-name1)
        (delete-file tmp-name2)))
 
+    ;; Check `file-truename'.
     (unwind-protect
        (progn
          (write-region "foo" nil tmp-name1)
diff --git a/test/indent/css-mode.css b/test/indent/css-mode.css
index faf9153..67a6b1e 100644
--- a/test/indent/css-mode.css
+++ b/test/indent/css-mode.css
@@ -29,7 +29,7 @@ a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x { /* 
bug:20282 */
 }
 .x2
 {
-    foo: bar;
+    /* foo: bar; */ foo2: bar2;
     bar: baz;
 }
 
diff --git a/test/redisplay-testsuite.el b/test/redisplay-testsuite.el
index 357ab08..332eeb1 100644
--- a/test/redisplay-testsuite.el
+++ b/test/redisplay-testsuite.el
@@ -251,6 +251,45 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 
0xa5, 0xbd, 0x81, 0xff
          (str "ABC"))
       (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis str)
       (overlay-put ov 'display str)))
+  ;; Overlay string over invisible text and non-default face.
+  (insert "\n  Expected: ..." (propertize "ABC" 'face 'highlight) "XYZ")
+  (insert "\n    Result: ")
+  (insert (propertize "foo" 'invisible 'test-redisplay--ellipsis-invis))
+  (let ((ov (make-overlay (point) (point))))
+    (overlay-put ov 'invisible t)
+    (overlay-put ov 'window (selected-window))
+    (overlay-put ov 'after-string
+                 (propertize "ABC" 'face 'highlight)))
+  (insert "XYZ\n")
+  ;; Overlay strings with partial `invisibility' property and with a
+  ;; display property on the before-string.
+  (insert "\n  Expected: ..."
+          (propertize "DEF" 'display '(image :type xpm :file "close.xpm"))
+          (propertize "ABC" 'face 'highlight) "XYZ")
+  (insert "\n    Result: ")
+  (insert (propertize "foo" 'invisible 'test-redisplay--ellipsis-invis))
+  (let ((ov (make-overlay (point) (point))))
+    (overlay-put ov 'invisible t)
+    (overlay-put ov 'window (selected-window))
+    (overlay-put ov 'after-string
+                 (propertize "ABC" 'face 'highlight))
+    (overlay-put ov 'before-string
+                 (propertize "DEF"
+                             'display '(image :type xpm :file "close.xpm"))))
+  (insert "XYZ\n")
+
+  ;; Overlay string with 2 adjacent and different invisible
+  ;; properties.  This caused an infloop before Emacs 25.
+  (insert "\n  Expected: ABC")
+  (insert "\n    Result: ")
+  (let ((opoint (point)))
+    (insert "ABC\n")
+    (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))
+          (str (concat (propertize "X"
+                                   'invisible 'test-redisplay--simple-invis)
+                       (propertize "Y"
+                                   'invisible 
'test-redisplay--simple-invis2))))
+      (overlay-put ov 'after-string str)))
 
   (insert "\n"))
 
@@ -264,6 +303,7 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 
0xa5, 0xbd, 0x81, 0xff
     (erase-buffer)
     (setq buffer-invisibility-spec
          '(test-redisplay--simple-invis
+            test-redisplay--simple-invis2
            (test-redisplay--ellipsis-invis . t)))
     (test-redisplay-1)
     (test-redisplay-2)



reply via email to

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