emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp bc50c0c 2/2: Merge remote-tracking branch 'savannah/


From: Andrea Corallo
Subject: feature/native-comp bc50c0c 2/2: Merge remote-tracking branch 'savannah/master' into HEAD
Date: Sat, 9 May 2020 15:10:31 -0400 (EDT)

branch: feature/native-comp
commit bc50c0c57eca22cb290465ae5df93d48326eeb05
Merge: bd8be64 9d8fc3a
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>

    Merge remote-tracking branch 'savannah/master' into HEAD
---
 build-aux/config.sub                  |   4 +-
 doc/emacs/calendar.texi               |   4 +-
 doc/emacs/custom.texi                 |   2 +-
 doc/emacs/dired.texi                  |   6 ++
 doc/emacs/package.texi                |   6 ++
 doc/misc/texinfo.tex                  |  56 +++++++----
 etc/NEWS                              |   1 +
 etc/NEWS.27                           |  16 +++-
 lib/attribute.h                       |  12 +--
 lib/dirent.in.h                       |  10 +-
 lib/limits.in.h                       |  23 ++++-
 lib/stdio.in.h                        |  10 +-
 lib/stdlib.in.h                       |  10 +-
 lib/string.in.h                       |  10 +-
 lisp/cus-start.el                     |  11 ++-
 lisp/display-fill-column-indicator.el |   8 +-
 lisp/emacs-lisp/byte-run.el           |  11 ++-
 lisp/emacs-lisp/package.el            |  31 +++++++
 lisp/help-mode.el                     |  13 +--
 lisp/hi-lock.el                       |  20 +++-
 lisp/menu-bar.el                      |   4 +-
 lisp/progmodes/vhdl-mode.el           |   2 +-
 m4/gnulib-common.m4                   |  10 +-
 src/emacs-module.h.in                 |  16 ++--
 src/xdisp.c                           |  66 +++++++++----
 test/lisp/emacs-lisp/package-tests.el |  15 +++
 test/lisp/help-mode-tests.el          | 169 ++++++++++++++++++++++++++++++++++
 27 files changed, 438 insertions(+), 108 deletions(-)

diff --git a/build-aux/config.sub b/build-aux/config.sub
index a0d1227..973a298 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -2,7 +2,7 @@
 # Configuration validation subroutine script.
 #   Copyright 1992-2020 Free Software Foundation, Inc.
 
-timestamp='2020-04-24'
+timestamp='2020-05-04'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -1366,7 +1366,7 @@ case $os in
             | skyos* | haiku* | rdos* | toppers* | drops* | es* \
             | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
             | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
-            | nsk* | powerunix*)
+            | nsk* | powerunix* | genode*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        qnx*)
diff --git a/doc/emacs/calendar.texi b/doc/emacs/calendar.texi
index 0911185..8dc1a0b 100644
--- a/doc/emacs/calendar.texi
+++ b/doc/emacs/calendar.texi
@@ -532,8 +532,8 @@ holidays centered around a different month, use @kbd{C-u M-x
 holidays}, which prompts for the month and year.
 
   The holidays known to Emacs include United States holidays and the
-major Bahá'í, Chinese, Christian, Islamic, and Jewish holidays; also the
-solstices and equinoxes.
+major Bah@'{a}@t{'}@'{i}, Chinese, Christian, Islamic, and Jewish
+holidays; also the solstices and equinoxes.
 
 @findex list-holidays
    The command @kbd{M-x holiday-list} displays the list of holidays for
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 406f0c9..d034a78 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -1882,7 +1882,7 @@ also unset keys, when passed @code{nil} as the binding.
 
   Since a mode's keymaps are not constructed until it has been loaded,
 you must delay running code which modifies them, e.g., by putting it
-on a @dfn{mode hook} (@pxref{(Hooks)}).  For example, Texinfo mode
+on a @dfn{mode hook} (@pxref{Hooks}).  For example, Texinfo mode
 runs the hook @code{texinfo-mode-hook}.  Here's how you can use the
 hook to add local bindings for @kbd{C-c n} and @kbd{C-c p}, and remove
 the one for @kbd{C-c C-x x} in Texinfo mode:
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index d514414..4ff1dc1 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -723,7 +723,13 @@ with renamed files so that they refer to the new names.
 @vindex dired-vc-rename-file
 If the value of the variable @code{dired-vc-rename-file} is non-@code{nil},
 files are renamed using the commands of the underlying VCS, via
+@ifnottex
 @code{vc-rename-file} (@pxref{VC Delete/Rename}).
+@end ifnottex
+@iftex
+@code{vc-rename-file} (@pxref{VC Delete/Rename,, Deleting and Renaming
+Version-Controlled Files, emacs-xtra, Specialized Emacs Features}).
+@end iftex
 
 @findex dired-do-hardlink
 @kindex H @r{(Dired)}
diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index db3cf31..91e44b8 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -202,6 +202,12 @@ This prompts first for one of the qualifiers @samp{<}, 
@samp{>} or
 @samp{=}, and then a package version, and shows packages that has a
 lower, equal or higher version than the one specified.
 
+@item / m
+@kindex / m @r{(Package Menu)}
+@findex package-menu-filter-marked
+Filter package list by non-empty mark (@code{package-menu-filter-marked}).
+This shows only the packages that have been marked to be installed or deleted.
+
 @item / /
 @kindex / / @r{(Package Menu)}
 @findex package-menu-filter-clear
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 427494c..2b7b31b 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,9 +3,9 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2020-05-02.00}
+\def\texinfoversion{2020-05-07.17}
 %
-% Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc.
+% Copyright 1985, 1986, 1988, 1990-2020 Free Software Foundation, Inc.
 %
 % This texinfo.tex file is free software: you can redistribute it and/or
 % modify it under the terms of the GNU General Public License as
@@ -1430,7 +1430,13 @@ output) for that.)}
       % subentries, which we calculated on our first read of the .toc above.
       %
       % We use the node names as the destinations.
+      %
+      % Currently we prefix the section name with the section number
+      % for chapter and appendix headings only in order to avoid too much
+      % horizontal space being required in the PDF viewer.
       \def\numchapentry##1##2##3##4{%
+        \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
+      \def\unnchapentry##1##2##3##4{%
         \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
       \def\numsecentry##1##2##3##4{%
         \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
@@ -1672,9 +1678,13 @@ output) for that.)}
       % Therefore, we read toc only once.
       %
       % We use node names as destinations.
+      %
+      % Currently we prefix the section name with the section number
+      % for chapter and appendix headings only in order to avoid too much
+      % horizontal space being required in the PDF viewer.
       \def\partentry##1##2##3##4{}% ignore parts in the outlines
       \def\numchapentry##1##2##3##4{%
-        \dopdfoutline{##1}{1}{##3}{##4}}%
+        \dopdfoutline{##2 ##1}{1}{##3}{##4}}%
       \def\numsecentry##1##2##3##4{%
         \dopdfoutline{##1}{2}{##3}{##4}}%
       \def\numsubsecentry##1##2##3##4{%
@@ -1686,7 +1696,8 @@ output) for that.)}
       \let\appsecentry\numsecentry%
       \let\appsubsecentry\numsubsecentry%
       \let\appsubsubsecentry\numsubsubsecentry%
-      \let\unnchapentry\numchapentry%
+      \def\unnchapentry##1##2##3##4{%
+        \dopdfoutline{##1}{1}{##3}{##4}}%
       \let\unnsecentry\numsecentry%
       \let\unnsubsecentry\numsubsecentry%
       \let\unnsubsubsecentry\numsubsubsecentry%
@@ -2499,7 +2510,7 @@ end
 \def\it{\fam=\itfam \setfontstyle{it}}
 \def\sl{\fam=\slfam \setfontstyle{sl}}
 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
-\def\tt{\fam=\ttfam \setfontstyle{tt}}
+\def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt}
 
 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
 % So we set up a \sf.
@@ -3512,7 +3523,7 @@ end
 
 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
 %
-\def\pounds{{\it\$}}
+\def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi}
 
 % @euro{} comes from a separate font, depending on the current style.
 % We use the free feym* fonts from the eurosym package by Henrik
@@ -3661,11 +3672,19 @@ end
 \fi
 
 % Quotes.
-\chardef\quotedblleft="5C
-\chardef\quotedblright=`\"
 \chardef\quoteleft=`\`
 \chardef\quoteright=`\'
 
+% only change font for tt for correct kerning and to avoid using
+% \ecfont unless necessary.
+\def\quotedblleft{%
+  \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi
+}
+
+\def\quotedblright{%
+  \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi
+}
+
 
 \message{page headings,}
 
@@ -7447,13 +7466,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
 %
 % We typeset each line of the verbatim in an \hbox, so we can handle
-% tabs.  The \global is in case the verbatim line starts with an accent,
-% or some other command that starts with a begin-group.  Otherwise, the
-% entire \verbbox would disappear at the corresponding end-group, before
-% it is typeset.  Meanwhile, we can't have nested verbatim commands
-% (can we?), so the \global won't be overwriting itself.
+% tabs.
 \newbox\verbbox
-\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
+\def\starttabbox{\setbox\verbbox=\hbox\bgroup}
 %
 \begingroup
   \catcode`\^^I=\active
@@ -7464,7 +7479,8 @@ might help (with 'rm \jobname.?? \jobname.??s')%
       \divide\dimen\verbbox by\tabw
       \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
       \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
-      \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
+      \wd\verbbox=\dimen\verbbox
+      \leavevmode\box\verbbox \starttabbox
     }%
   }
 \endgroup
@@ -7474,9 +7490,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \let\nonarrowing = t%
   \nonfillstart
   \tt % easiest (and conventionally used) font for verbatim
-  % The \leavevmode here is for blank lines.  Otherwise, we would
-  % never \starttabbox and the \egroup would end verbatim mode.
-  \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
+  \def\par{\egroup\box\verbbox\endgraf\starttabbox}%
   \tabexpand
   \setupmarkupstyle{verbatim}%
   % Respect line breaks,
@@ -7484,7 +7498,6 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   % make each space count.
   % Must do in this order:
   \obeylines \uncatcodespecials \sepspaces
-  \everypar{\starttabbox}%
 }
 
 % Do the @verb magic: verbatim text is quoted by unique
@@ -7519,9 +7532,12 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   % ignore everything up to the first ^^M, that's the newline at the end
   % of the @verbatim input line itself.  Otherwise we get an extra blank
   % line in the output.
-  \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
+  \xdef\doverbatim#1^^M#2@end verbatim{%
+    \starttabbox#2\egroup\noexpand\end\gobble verbatim}%
   % We really want {...\end verbatim} in the body of the macro, but
   % without the active space; thus we have to use \xdef and \gobble.
+  % The \egroup ends the \verbbox started at the end of the last line in
+  % the block.
 \endgroup
 %
 \envdef\verbatim{%
diff --git a/etc/NEWS b/etc/NEWS
index 12406ee..ae676a9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -219,6 +219,7 @@ key             binding
 / n             package-menu-filter-by-name
 / s             package-menu-filter-by-status
 / v             package-menu-filter-by-version
+/ m             package-menu-filter-marked
 / /             package-menu-filter-clear
 
 ** gdb-mi
diff --git a/etc/NEWS.27 b/etc/NEWS.27
index 42133b8..bb275b7 100644
--- a/etc/NEWS.27
+++ b/etc/NEWS.27
@@ -881,21 +881,27 @@ list the contents of such directories when completing 
file names.
 ** Minibuffer
 
 +++
-*** A new user option, 'minibuffer-beginning-of-buffer-movement', has
-been introduced to allow controlling how the 'M-<' command works in
+*** New user option 'minibuffer-beginning-of-buffer-movement'.
+This option allows control of how the 'M-<' command works in
 the minibuffer.  If non-nil, point will move to the end of the prompt
-(if point is after the end of the prompt).
+(if point is after the end of the prompt).  The default is nil, which
+preserves the original behavior of 'M-<' moving to the beginning of
+the prompt.
 
 +++
 *** When the minibuffer is active, echo-area messages are displayed at
 the end of the minibuffer instead of hiding the minibuffer by the echo
 area display.  The new user option 'minibuffer-message-clear-timeout'
 controls how messages displayed in this situation are removed from the
-minibuffer.
+minibuffer.  To revert to previous behavior, where echo-area messages
+temporarily overwrote the minibuffer contents until the user typed
+something, set 'set-message-function' and 'clear-message-function' to
+nil.
 
 ---
 *** Minibuffer now uses 'minibuffer-message' to display error messages
-at the end of the active minibuffer.
+at the end of the active minibuffer.  To disable this, remove
+'minibuffer-error-initialize' from 'minibuffer-setup-hook'.
 
 +++
 *** 'y-or-n-p' now uses the minibuffer to read 'y' or 'n' answer.
diff --git a/lib/attribute.h b/lib/attribute.h
index 8ef9a39..c5919d9 100644
--- a/lib/attribute.h
+++ b/lib/attribute.h
@@ -33,26 +33,26 @@
 /* Selected GCC attributes; see:
    https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
    These names begin with 'ATTRIBUTE_' to avoid name clashes.  */
-#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE(args)
+#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args)
 #define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE
 #define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL
 #define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD
 #define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
 #define ATTRIBUTE_DEPRECATED _GL_ATTRIBUTE_DEPRECATED
-#define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR(msg)
+#define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR (msg)
 #define ATTRIBUTE_EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
-#define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT(spec)
+#define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT (spec)
 #define ATTRIBUTE_LEAF _GL_ATTRIBUTE_LEAF
 #define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS
 #define ATTRIBUTE_MALLOC _GL_ATTRIBUTE_MALLOC
 #define ATTRIBUTE_NOINLINE _GL_ATTRIBUTE_NOINLINE
-#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL(args)
+#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL (args)
 #define ATTRIBUTE_NONSTRING _GL_ATTRIBUTE_NONSTRING
 #define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW
 #define ATTRIBUTE_PACKED _GL_ATTRIBUTE_PACKED
 #define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
 #define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL
-#define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL(pos)
-#define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING(msg)
+#define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL (pos)
+#define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING (msg)
 
 #endif /* _GL_ATTRIBUTE_H */
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index f7c2681..6fa44f0 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -57,10 +57,12 @@ typedef struct gl_directory DIR;
 
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
    The attribute __pure__ 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 */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE /* empty */
+# endif
 #endif
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
diff --git a/lib/limits.in.h b/lib/limits.in.h
index 90c273f..d25c523 100644
--- a/lib/limits.in.h
+++ b/lib/limits.in.h
@@ -15,16 +15,32 @@
    You should have received a copy of the GNU General Public License
    along with this program; if not, see <https://www.gnu.org/licenses/>.  */
 
-#ifndef _@GUARD_PREFIX@_LIMITS_H
-
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 @PRAGMA_COLUMNS@
 
-/* The include_next requires a split double-inclusion guard.  */
+#if defined _GL_ALREADY_INCLUDING_LIMITS_H
+/* Special invocation convention:
+   On Haiku/x86_64, we have a sequence of nested includes
+   <limits.h> -> <syslimits.h> -> <limits.h>.
+   In this situation, LONG_MAX and INT_MAX are not yet defined,
+   therefore we should not attempt to define LONG_BIT.  */
+
 #@INCLUDE_NEXT@ @NEXT_LIMITS_H@
 
+#else
+/* Normal invocation convention.  */
+
+#ifndef _@GUARD_PREFIX@_LIMITS_H
+
+# define _GL_ALREADY_INCLUDING_LIMITS_H
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_LIMITS_H@
+
+# undef _GL_ALREADY_INCLUDING_LIMITS_H
+
 #ifndef _@GUARD_PREFIX@_LIMITS_H
 #define _@GUARD_PREFIX@_LIMITS_H
 
@@ -102,3 +118,4 @@
 
 #endif /* _@GUARD_PREFIX@_LIMITS_H */
 #endif /* _@GUARD_PREFIX@_LIMITS_H */
+#endif
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 4a95f32..6c338dd 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -62,10 +62,12 @@
    We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
    gnulib and libintl do '#define printf __printf__' when they override
    the 'printf' function.  */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
+#ifndef _GL_ATTRIBUTE_FORMAT
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+#  define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+# else
+#  define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
+# endif
 #endif
 
 /* _GL_ATTRIBUTE_FORMAT_PRINTF
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index ec5f124..59f9e6c 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -101,10 +101,12 @@ struct random_data
 
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
    The attribute __pure__ 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 */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE /* empty */
+# endif
 #endif
 
 /* The definition of _Noreturn is copied here.  */
diff --git a/lib/string.in.h b/lib/string.in.h
index 596c99b..96e132f 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -54,10 +54,12 @@
 
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
    The attribute __pure__ 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 */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define _GL_ATTRIBUTE_PURE /* empty */
+# endif
 #endif
 
 /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>.  */
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index dff4d9a..6632687 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -771,9 +771,16 @@ since it could result in memory overflow and make Emacs 
crash."
               :safe (lambda (value) (or (booleanp value) (integerp value))))
              (display-fill-column-indicator-character
               display-fill-column-indicator
-              character
+              (choice
+               (character :tag "Use U+2502 to indicate fill column"
+                      :value ?│)
+               (character :tag "Use | to indicate fill column"
+                      :value ?|)
+               (const :tag "If possible, use U+2502 to indicate fill column, 
otherwise use |"
+                      :value nil)
+               character)
               "27.1"
-              :safe characterp)
+              :safe (lambda (value) (or (characterp value) (null value))))
             ;; xfaces.c
             (scalable-fonts-allowed display boolean "22.1")
             ;; xfns.c
diff --git a/lisp/display-fill-column-indicator.el 
b/lisp/display-fill-column-indicator.el
index 25259aa..3f947bd 100644
--- a/lisp/display-fill-column-indicator.el
+++ b/lisp/display-fill-column-indicator.el
@@ -31,7 +31,7 @@
 
 ;; NOTE: Customization variables for
 ;; `display-fill-column-indicator-column' and
-;; `display-fill-column-indicator-char' itself are defined in
+;; `display-fill-column-indicator-character' itself are defined in
 ;; cus-start.el.
 
 ;;; Code:
@@ -39,7 +39,8 @@
 (defgroup display-fill-column-indicator nil
   "Display a fill column indicator in the buffer."
   :group 'convenience
-  :group 'display)
+  :group 'display
+  :link '(info-link "(emacs)Displaying Boundaries"))
 
 
 ;;;###autoload
@@ -49,7 +50,8 @@ This uses `display-fill-column-indicator' internally.
 
 To change the position of the column displayed by default
 customize `display-fill-column-indicator-column'.  You can change the
-character for the indicator setting `display-fill-column-indicator-character'."
+character for the indicator setting `display-fill-column-indicator-character'.
+See Info node `Displaying Boundaries' for details."
   :lighter nil
   (if display-fill-column-indicator-mode
       (progn
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index fa769ad..88e21b7 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -536,11 +536,12 @@ wrong number of parameters, say
   (zot 1 2))
 
 The warnings that can be suppressed are a subset of the warnings
-in `byte-compile-warning-types'; see this variable for a fuller
-explanation of the warning types.  The types that can be
-suppressed with this macro are `free-vars', `callargs',
-`redefine', `obsolete', `interactive-only', `lexical', `mapcar',
-`constants' and `suspicious'.
+in `byte-compile-warning-types'; see the variable
+`byte-compile-warnings' for a fuller explanation of the warning
+types.  The types that can be suppressed with this macro are
+`free-vars', `callargs', `redefine', `obsolete',
+`interactive-only', `lexical', `mapcar', `constants' and
+`suspicious'.
 
 For the `mapcar' case, only the `mapcar' function can be used in
 the symbol list.  For `suspicious', only `set-buffer' can be used."
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index b33e489..9565984 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2692,6 +2692,7 @@ either a full name or nil, and EMAIL is a valid email 
address."
     (define-key map (kbd "/ n") 'package-menu-filter-by-name)
     (define-key map (kbd "/ s") 'package-menu-filter-by-status)
     (define-key map (kbd "/ v") 'package-menu-filter-by-version)
+    (define-key map (kbd "/ m") 'package-menu-filter-marked)
     map)
   "Local keymap for `package-menu-mode' buffers.")
 
@@ -2722,6 +2723,7 @@ either a full name or nil, and EMAIL is a valid email 
address."
      ["Filter by Name" package-menu-filter-by-name :help "Filter packages by 
name"]
      ["Filter by Status" package-menu-filter-by-status :help "Filter packages 
by status"]
      ["Filter by Version" package-menu-filter-by-version :help "Filter 
packages by version"]
+     ["Filter Marked" package-menu-filter-marked :help "Filter packages marked 
for upgrade"]
      ["Clear Filter" package-menu-clear-filter :help "Clear package list 
filter"])
 
     ["Hide by Regexp" package-menu-hide-package :help "Hide all packages 
matching a regexp"]
@@ -3855,6 +3857,35 @@ If VERSION is nil or the empty string, show all 
packages."
            (funcall fun (package-desc-version pkg-desc) ver)))
        (format "versions:%s%s" predicate version)))))
 
+(defun package-menu-filter-marked ()
+  "Filter \"*Packages*\" buffer by non-empty upgrade mark.
+Unlike other filters, this leaves the marks intact."
+  (interactive)
+  (package--ensure-package-menu-mode)
+  (widen)
+  (let (found-entries mark pkg-id entry marks)
+    (save-excursion
+      (goto-char (point-min))
+      (while (not (eobp))
+        (setq mark (char-after))
+        (unless (eq mark ?\s)
+         (setq pkg-id (tabulated-list-get-id))
+          (setq entry (package-menu--print-info-simple pkg-id))
+         (push entry found-entries)
+         ;; remember the mark
+         (push (cons pkg-id mark) marks))
+        (forward-line))
+      (if found-entries
+          (progn
+            (setq tabulated-list-entries found-entries)
+            (package-menu--display t nil)
+           ;; redo the marks, but we must remember the marks!!
+           (goto-char (point-min))
+           (while (not (eobp))
+             (setq mark (cdr (assq (tabulated-list-get-id) marks)))
+             (tabulated-list-put-tag (char-to-string mark) t)))
+       (user-error "No packages found")))))
+
 (defun package-menu-clear-filter ()
   "Clear any filter currently applied to the \"*Packages*\" buffer."
   (interactive)
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index bae8281..9c2d1d7 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -1,4 +1,4 @@
-;;; help-mode.el --- `help-mode' used by *Help* buffers
+;;; help-mode.el --- `help-mode' used by *Help* buffers  -*- lexical-binding: 
t; -*-
 
 ;; Copyright (C) 1985-1986, 1993-1994, 1998-2020 Free Software
 ;; Foundation, Inc.
@@ -47,10 +47,10 @@
     (define-key map "\C-c\C-c" 'help-follow-symbol)
     (define-key map "\r" 'help-follow)
     map)
-  "Keymap for help mode.")
+  "Keymap for Help mode.")
 
 (easy-menu-define help-mode-menu help-mode-map
-  "Menu for Help Mode."
+  "Menu for Help mode."
   '("Help-Mode"
     ["Show Help for Symbol" help-follow-symbol
      :help "Show the docs for the symbol at point"]
@@ -327,13 +327,13 @@ Commands:
 
 ;;;###autoload
 (defun help-mode-setup ()
-  "Enter Help Mode in the current buffer."
+  "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."
+  "Finalize Help mode setup in current buffer."
   (when (derived-mode-p 'help-mode)
     (setq buffer-read-only t)
     (help-make-xrefs (current-buffer))))
@@ -719,7 +719,8 @@ a proper [back] button."
   ;; There is a reference at point.  Follow it.
   (let ((help-xref-following t))
     (apply function (if (eq function 'info)
-                       (append args (list (generate-new-buffer-name 
"*info*"))) args))))
+                        (append args (list (generate-new-buffer-name 
"*info*")))
+                      args))))
 
 ;; The doc string is meant to explain what buttons do.
 (defun help-follow-mouse ()
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 08d8217..a183103 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -322,7 +322,10 @@ or add (global-hi-lock-mode 1) to your init file.
 In buffers where Font Lock mode is enabled, patterns are
 highlighted using font lock.  In buffers where Font Lock mode is
 disabled, patterns are applied using overlays; in this case, the
-highlighting will not be updated as you type.
+highlighting will not be updated as you type.  The Font Lock mode
+is considered \"enabled\" in a buffer if its `major-mode'
+causes `font-lock-specified-p' to return non-nil, which means
+the major mode specifies support for Font Lock.
 
 When Hi Lock mode is enabled, a \"Regexp Highlighting\" submenu
 is added to the \"Edit\" menu.  The commands in the submenu,
@@ -480,7 +483,10 @@ and `search-upper-case' is non-nil, the matching is 
case-sensitive.
 
 Use Font lock mode, if enabled, to highlight REGEXP.  Otherwise,
 use overlays for highlighting.  If overlays are used, the
-highlighting will not update as you type."
+highlighting will not update as you type.  The Font Lock mode
+is considered \"enabled\" in a buffer if its `major-mode'
+causes `font-lock-specified-p' to return non-nil, which means
+the major mode specifies support for Font Lock."
   (interactive
    (list
     (hi-lock-regexp-okay
@@ -510,7 +516,10 @@ Also set `search-spaces-regexp' to the value of 
`search-whitespace-regexp'.
 
 Use Font lock mode, if enabled, to highlight REGEXP.  Otherwise,
 use overlays for highlighting.  If overlays are used, the
-highlighting will not update as you type."
+highlighting will not update as you type.  The Font Lock mode
+is considered \"enabled\" in a buffer if its `major-mode'
+causes `font-lock-specified-p' to return non-nil, which means
+the major mode specifies support for Font Lock."
   (interactive
    (list
     (hi-lock-regexp-okay
@@ -538,7 +547,10 @@ If REGEXP contains upper case characters (excluding those 
preceded by `\\')
 and `search-upper-case' is non-nil, the matching is case-sensitive.
 
 This uses Font lock mode if it is enabled; otherwise it uses overlays,
-in which case the highlighting will not update as you type."
+in which case the highlighting will not update as you type.  The Font
+Lock mode is considered \"enabled\" in a buffer if its `major-mode'
+causes `font-lock-specified-p' to return non-nil, which means
+the major mode specifies support for Font Lock."
   (interactive)
   (let* ((regexp (hi-lock-regexp-okay
                  (find-tag-default-as-symbol-regexp)))
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 731da19..9bc667a 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1085,10 +1085,10 @@ The selected font will be the default on both the 
existing and future frames."
                     :visible (display-graphic-p)
                     :button
                     (:radio . (and tool-bar-mode
-                                   (frame-parameter
+                                   (eq (frame-parameter
                                         (menu-bar-frame-for-menubar)
                                         'tool-bar-position)
-                                       'left))))
+                                       'left)))))
 
       (bindings--define-key menu [showhide-tool-bar-right]
         '(menu-item "On the Right"
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 22c6158..9cd84cf 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -14730,7 +14730,7 @@ if required."
     (speedbar-add-mode-functions-list
      '("vhdl directory"
        (speedbar-item-info . vhdl-speedbar-item-info)
-       (speedbar-line-directory . speedbar-files-line-path)))
+       (speedbar-line-directory . speedbar-files-line-directory)))
     (speedbar-add-mode-functions-list
      '("vhdl project"
        (speedbar-item-info . vhdl-speedbar-item-info)
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index b0010d0..f4ba5e3 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 49
+# gnulib-common.m4 serial 50
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -96,7 +96,7 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9)
 # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0)
 # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7)
-# define _GL_ATTR_warn_unused_result_GL_GNUC_PREREQ (3, 4)
+# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
 #endif
 
 ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead.
@@ -122,7 +122,7 @@ AC_DEFUN([gl_COMMON_BODY], [
 /* Avoid __attribute__ ((cold)) on MinGW; see thread starting at
    <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. */
 #if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__
-# define _GL_ATTRIBUTE_COLD __attribute__ ((cold))
+# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__))
 #else
 # define _GL_ATTRIBUTE_COLD
 #endif
@@ -142,8 +142,8 @@ AC_DEFUN([gl_COMMON_BODY], [
 #endif
 
 #if _GL_HAS_ATTRIBUTE (error)
-# define _GL_ATTRIBUTE_ERROR(msg) __attribute__((__error__ (msg)))
-# define _GL_ATTRIBUTE_WARNING(msg) __attribute__((__warning__ (msg)))
+# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg)))
+# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg)))
 #else
 # define _GL_ATTRIBUTE_ERROR(msg)
 # define _GL_ATTRIBUTE_WARNING(msg)
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index cd75c09..6a39d50 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -48,10 +48,14 @@ information how to write modules and use this header file.
 # define EMACS_NOEXCEPT_TYPEDEF
 #endif
 
-#ifdef __has_attribute
-#if __has_attribute(__nonnull__)
-# define EMACS_ATTRIBUTE_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
-#endif
+#if 3 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# define EMACS_ATTRIBUTE_NONNULL(...) \
+   __attribute__ ((__nonnull__ (__VA_ARGS__)))
+#elif defined __has_attribute
+# if __has_attribute (__nonnull__)
+#  define EMACS_ATTRIBUTE_NONNULL(...) \
+    __attribute__ ((__nonnull__ (__VA_ARGS__)))
+# endif
 #endif
 #ifndef EMACS_ATTRIBUTE_NONNULL
 # define EMACS_ATTRIBUTE_NONNULL(...)
@@ -81,7 +85,7 @@ struct emacs_runtime
 
   /* Return an environment pointer.  */
   emacs_env *(*get_environment) (struct emacs_runtime *runtime)
-    EMACS_ATTRIBUTE_NONNULL(1);
+    EMACS_ATTRIBUTE_NONNULL (1);
 };
 
 /* Type aliases for function pointer types used in the module API.
@@ -166,7 +170,7 @@ struct emacs_env_28
 /* Every module should define a function as follows.  */
 extern int emacs_module_init (struct emacs_runtime *runtime)
   EMACS_NOEXCEPT
-  EMACS_ATTRIBUTE_NONNULL(1);
+  EMACS_ATTRIBUTE_NONNULL (1);
 
 #ifdef __cplusplus
 }
diff --git a/src/xdisp.c b/src/xdisp.c
index 140d134..d65bb38 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10486,7 +10486,7 @@ include the height of both, if present, in the return 
value.  */)
   struct buffer *b;
   struct it it;
   struct buffer *old_b = NULL;
-  ptrdiff_t start, end, pos;
+  ptrdiff_t start, end, bpos;
   struct text_pos startp;
   void *itdata = NULL;
   int c, max_x = 0, max_y = 0, x = 0, y = 0;
@@ -10501,29 +10501,55 @@ include the height of both, if present, in the return 
value.  */)
     }
 
   if (NILP (from))
-    start = BEGV;
+    {
+      start = BEGV;
+      bpos = BEGV_BYTE;
+    }
   else if (EQ (from, Qt))
     {
-      start = pos = BEGV;
-      while ((pos++ < ZV) && (c = FETCH_CHAR (pos))
-            && (c == ' ' || c == '\t' || c == '\n' || c == '\r'))
-       start = pos;
-      while ((pos-- > BEGV) && (c = FETCH_CHAR (pos)) && (c == ' ' || c == 
'\t'))
-       start = pos;
+      start = BEGV;
+      bpos = BEGV_BYTE;
+      while (bpos < ZV_BYTE)
+       {
+         c = fetch_char_advance (&start, &bpos);
+         if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r'))
+           break;
+       }
+      while (bpos > BEGV_BYTE)
+       {
+         dec_both (&start, &bpos);
+         c = FETCH_CHAR (bpos);
+         if (!(c == ' ' || c == '\t'))
+           break;
+       }
     }
   else
-    start = clip_to_bounds (BEGV, fix_position (from), ZV);
+    {
+      start = clip_to_bounds (BEGV, fix_position (from), ZV);
+      bpos = CHAR_TO_BYTE (start);
+    }
+
+  SET_TEXT_POS (startp, start, bpos);
 
   if (NILP (to))
     end = ZV;
   else if (EQ (to, Qt))
     {
-      end = pos = ZV;
-      while ((pos-- > BEGV) && (c = FETCH_CHAR (pos))
-            && (c == ' ' || c == '\t' || c == '\n' || c == '\r'))
-       end = pos;
-      while ((pos++ < ZV) && (c = FETCH_CHAR (pos)) && (c == ' ' || c == '\t'))
-       end = pos;
+      end = ZV;
+      bpos = ZV_BYTE;
+      while (bpos > BEGV_BYTE)
+       {
+         dec_both (&end, &bpos);
+         c = FETCH_CHAR (bpos);
+         if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r'))
+           break;
+       }
+      while (bpos < ZV_BYTE)
+       {
+         c = fetch_char_advance (&end, &bpos);
+         if (!(c == ' ' || c == '\t'))
+           break;
+       }
     }
   else
     end = clip_to_bounds (start, fix_position (to), ZV);
@@ -10537,7 +10563,6 @@ include the height of both, if present, in the return 
value.  */)
     max_y = XFIXNUM (y_limit);
 
   itdata = bidi_shelve_cache ();
-  SET_TEXT_POS (startp, start, CHAR_TO_BYTE (start));
   start_display (&it, w, startp);
   /* It makes no sense to measure dimensions of region of text that
      crosses the point where bidi reordering changes scan direction.
@@ -34965,7 +34990,8 @@ It has no effect when set to 0, or when line numbers 
are not absolute.  */);
   Fmake_variable_buffer_local (Qdisplay_line_numbers_offset);
 
   DEFVAR_BOOL ("display-fill-column-indicator", Vdisplay_fill_column_indicator,
-    doc: /* Non-nil means display the fill column indicator.  */);
+    doc: /* Non-nil means display the fill column indicator.
+See Info node `Displaying Boundaries' for details.  */);
   Vdisplay_fill_column_indicator = false;
   DEFSYM (Qdisplay_fill_column_indicator, "display-fill-column-indicator");
   Fmake_variable_buffer_local (Qdisplay_fill_column_indicator);
@@ -34974,7 +35000,8 @@ It has no effect when set to 0, or when line numbers 
are not absolute.  */);
     doc: /* Column for indicator when `display-fill-column-indicator' is 
non-nil.
 The default value is t which means that the indicator
 will use the `fill-column' variable.  If it is set to an integer the
-indicator will be drawn in that column.  */);
+indicator will be drawn in that column.
+See Info node `Displaying Boundaries' for details.  */);
   Vdisplay_fill_column_indicator_column = Qt;
   DEFSYM (Qdisplay_fill_column_indicator_column, 
"display-fill-column-indicator-column");
   Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_column);
@@ -34982,7 +35009,8 @@ indicator will be drawn in that column.  */);
   DEFVAR_LISP ("display-fill-column-indicator-character", 
Vdisplay_fill_column_indicator_character,
     doc: /* Character to draw the indicator when 
`display-fill-column-indicator' is non-nil.
 The default is U+2502 but a good alternative is (ascii 124)
-if the font in fill-column-indicator face does not support Unicode characters. 
 */);
+if the font in fill-column-indicator face does not support Unicode characters.
+See Info node `Displaying Boundaries' for details.  */);
   Vdisplay_fill_column_indicator_character = Qnil;
   DEFSYM (Qdisplay_fill_column_indicator_character, 
"display-fill-column-indicator-character");
   Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_character);
diff --git a/test/lisp/emacs-lisp/package-tests.el 
b/test/lisp/emacs-lisp/package-tests.el
index c0ed82c..732bf5e 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -413,6 +413,21 @@ Must called from within a `tar-mode' buffer."
     ;; No installed packages in default environment.
     (should-error (package-menu-filter-by-status "installed"))))
 
+(ert-deftest package-test-list-filter-marked ()
+  "Ensure package list is filtered correctly by non-empty mark."
+  (with-package-test ()
+    (let ((buf (package-list-packages)))
+      (revert-buffer)
+      (search-forward-regexp "^ +simple-single")
+      (package-menu-mark-install)
+      (package-menu-filter-marked)
+      (goto-char (point-min))
+      (should (re-search-forward "^I +simple-single" nil t))
+      (should (= (count-lines (point-min) (point-max)) 1))
+      (package-menu-mark-unmark)
+      ;; No marked packages in default environment.
+      (should-error (package-menu-filter-marked)))))
+
 (ert-deftest package-test-list-filter-by-version ()
   (with-package-menu-test
     (should-error (package-menu-filter-by-version "1.1" 'unknown-symbol)))  )
diff --git a/test/lisp/help-mode-tests.el b/test/lisp/help-mode-tests.el
new file mode 100644
index 0000000..2b9552a
--- /dev/null
+++ b/test/lisp/help-mode-tests.el
@@ -0,0 +1,169 @@
+;;; help-mode-tests.el --- Tests for help-mode.el    -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2020 Free Software Foundation, Inc.
+
+;; Author: Simen Heggestøyl <address@hidden>
+;; Keywords:
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'ert)
+(require 'help-mode)
+(require 'pp)
+
+(ert-deftest help-mode-tests-help-buffer ()
+  (let ((help-xref-following nil))
+    (should (equal "*Help*" (help-buffer)))))
+
+(ert-deftest help-mode-tests-help-buffer-current-buffer ()
+  (with-temp-buffer
+    (help-mode)
+    (let ((help-xref-following t))
+      (should (equal (buffer-name (current-buffer))
+                     (help-buffer))))))
+
+(ert-deftest help-mode-tests-help-buffer-current-buffer-error ()
+  (with-temp-buffer
+    (let ((help-xref-following t))
+      (should-error (help-buffer)))))
+
+(ert-deftest help-mode-tests-make-xrefs ()
+  (with-temp-buffer
+    (insert "car is a built-in function in ‘C source code’.
+
+(car LIST)
+
+  Probably introduced at or before Emacs version 1.2.
+  This function does not change global state, including the match data.
+
+Return the car of LIST.  If arg is nil, return nil.
+Error if arg is not nil and not a cons cell.  See also ‘car-safe’.
+
+See Info node ‘(elisp)Cons Cells’ for a discussion of related basic
+Lisp concepts such as car, cdr, cons cell and list.")
+    (help-mode)
+    (help-make-xrefs)
+    (let ((car-safe-button (button-at 298)))
+      (should (eq (button-type car-safe-button) 'help-symbol))
+      (should (eq (button-get car-safe-button 'help-function)
+                  #'describe-symbol)))
+    (let ((cons-cells-info-button (button-at 333)))
+      (should (eq (button-type cons-cells-info-button) 'help-info))
+      (should (eq (button-get cons-cells-info-button 'help-function)
+                  #'info)))))
+
+(ert-deftest help-mode-tests-xref-button ()
+  (with-temp-buffer
+    (insert "See also the function ‘interactive’.")
+    (string-match help-xref-symbol-regexp (buffer-string))
+    (help-xref-button 8 'help-function)
+    (should-not (button-at 22))
+    (should-not (button-at 35))
+    (let ((button (button-at 30)))
+      (should (eq (button-type button) 'help-function)))))
+
+(ert-deftest help-mode-tests-insert-xref-button ()
+  (with-temp-buffer
+    (help-insert-xref-button "[back]" 'help-back)
+    (goto-char (point-min))
+    (should (eq (button-type (button-at (point))) 'help-back))
+    (help-insert-xref-button "[forward]" 'help-forward)
+    ;; The back button should stay unchanged.
+    (should (eq (button-type (button-at (point))) 'help-back))))
+
+(ert-deftest help-mode-tests-xref-on-pp ()
+  (with-temp-buffer
+    (insert (pp '(cons fill-column)))
+    (help-xref-on-pp (point-min) (point-max))
+    (goto-char (point-min))
+    (search-forward "co")
+    (should (eq (button-type (button-at (point))) 'help-function))
+    (search-forward "-")
+    (should (eq (button-type (button-at (point))) 'help-variable))))
+
+(ert-deftest help-mode-tests-xref-go-back ()
+  (let ((help-xref-stack
+         `((2 ,(lambda () (erase-buffer) (insert "bar"))))))
+    (with-temp-buffer
+      (insert "foo")
+      (help-xref-go-back (current-buffer))
+      (should (= (point) 2))
+      (should (equal (buffer-string) "bar")))))
+
+(ert-deftest help-mode-tests-xref-go-forward ()
+  (let ((help-xref-forward-stack
+         `((2 ,(lambda () (erase-buffer) (insert "bar"))))))
+    (with-temp-buffer
+      (insert "foo")
+      (help-xref-go-forward (current-buffer))
+      (should (= (point) 2))
+      (should (equal (buffer-string) "bar")))))
+
+(ert-deftest help-mode-tests-go-back ()
+  (let ((help-xref-stack
+         `((2 ,(lambda () (erase-buffer) (insert "bar"))))))
+    (with-temp-buffer
+      (insert "foo")
+      (help-go-back)
+      (should (= (point) 2))
+      (should (equal (buffer-string) "bar")))))
+
+(ert-deftest help-mode-tests-go-back-no-stack ()
+  (let ((help-xref-stack '()))
+    (should-error (help-go-back))))
+
+(ert-deftest help-mode-tests-go-forward ()
+  (let ((help-xref-forward-stack
+         `((2 ,(lambda () (erase-buffer) (insert "bar"))))))
+    (with-temp-buffer
+      (insert "foo")
+      (help-go-forward)
+      (should (= (point) 2))
+      (should (equal (buffer-string) "bar")))))
+
+(ert-deftest help-mode-tests-go-forward-no-stack ()
+  (let ((help-xref-forward-stack '()))
+    (should-error (help-go-forward))))
+
+(ert-deftest help-mode-tests-do-xref ()
+  (with-temp-buffer
+    (help-mode)
+    (help-do-xref 0 #'describe-symbol '(car))
+    (should (looking-at-p "car is a"))
+    (should (string-match-p "[back]" (buffer-string)))))
+
+(ert-deftest help-mode-tests-follow-symbol ()
+  (with-temp-buffer
+    (insert "car")
+    (help-mode)
+    (help-follow-symbol 0)
+    (should (looking-at-p "car is a"))
+    (should (string-match-p "[back]" (buffer-string)))))
+
+(ert-deftest help-mode-tests-follow-symbol-no-symbol ()
+  (with-temp-buffer
+    (insert "fXYEWnRHI0B9w6VJqQIw")
+    (help-mode)
+    (should-error (help-follow-symbol 0))))
+
+(provide 'help-mode-tests)
+;;; help-mode-tests.el ends here



reply via email to

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