Subject: [PATCH] Make leaving Info-summary more intuitive

From: Stefan Kangas <[email-masked]>
Date: Tue, 28 Apr 2020 00:28:31 +0200

Severity: minor

There's a small issue with the Info-summary command:

0. emacs -Q
1. C-h i
2. ?
3. q

Result: Now in *scratch* buffer
Expected: Should end up in *info* buffer

The attached patch should fix it by not pushing the character ('q' in
this case) onto 'unread-command-events' before burying the help
buffer.

Best regards,
Stefan Kangas

In GNU Emacs 28.0.50 (build 14, x86_64-pc-linux-gnu, GTK+ Version
3.24.18, cairo version 1.16.0)
 of 2020-04-27 built on joffe
From 0d34e8b98c76bfc1f9dcd24dc0691793b2e03ae5 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Tue, 28 Apr 2020 00:25:11 +0200
Subject: [PATCH] Make leaving Info-summary more intuitive

* lisp/info.el (Info-summary): Discard character on exit instead of
pushing it onto 'unread-command-events'.
---
 lisp/info.el | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lisp/info.el b/lisp/info.el
index 3015e60a4f..703907b98f 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3828,14 +3828,14 @@ Info-summary
     (insert (documentation 'Info-mode))
     (help-mode)
     (goto-char (point-min))
-    (let (ch flag)
-      (while (progn (setq flag (not (pos-visible-in-window-p (point-max))))
-		    (message (if flag "Type Space to see more"
-			       "Type Space to return to Info"))
-		    (if (not (eq ?\s (setq ch (read-event))))
-			(progn (push ch unread-command-events) nil)
-		      flag))
-	(scroll-up)))
+    (while (let ((flag (not (pos-visible-in-window-p (point-max)))))
+	     (message (if flag "Type Space to see more"
+			"Type any key to return to Info"))
+             ;; Space scrolls if there is more content.
+             ;; Any other key returns.
+             (setq ch (read-event))
+	     (and flag (eq ch ?\s)))
+      (scroll-up))
     (bury-buffer "*Help*")))
 
 (defun Info-get-token (pos start all &optional errorstring)
-- 
2.26.2