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

From: Drew Adams <[email-masked]>
Date: Tue, 28 Apr 2020 11:43:54 -0700 (PDT)

> > For (a), what do you mean by a "general" help
> > command?  The point of Info-summary is to provide
> > succinct help about Info.
> 
> I meant that you can have a command which works in any major mode very
> easily:
> 
>  (defun Info-summary ()
>    "Display a brief summary of all Info commands."
>    (interactive)
>    (save-window-excursion
>      (switch-to-buffer "*Help*")
>      (setq buffer-read-only nil)
>      (erase-buffer)
> -    (insert (documentation 'Info-mode))
> +    (insert (documentation major-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)))
>      (bury-buffer "*Help*")))

I see.  +1.

But maybe consider something like this instead.
IOW, let it be useful for any major mode, from
anywhere, not just for the current major mode.

(defun summarize-major-mode (mode)
  (interactive
   (list (completing-read
          (format "Mode (default %s): " major-mode)
          obarray
          (lambda (ss)
            (and (commandp ss)
                 (boundp ss)
                 (string-match-p "-mode\\'"
                                 (symbol-name ss))))
          t nil nil major-mode)))
  ...) ; The rest as you showed