Subject: bug#49265: [External] : bug#49265: 28.0.50; repeat mode feature request

From: Robert Pluim <[email-masked]>
Date: Wed, 30 Jun 2021 11:59:07 +0200

>>>>> On Tue, 29 Jun 2021 21:33:07 +0000, Drew Adams <[email-masked]> said:

    >> Now a new command named 'describe-repeat' was pushed to master.  Please try
    >> it.  If everything is right, this request could be closed.

    Drew> Where was it added to master?  I downloaded the latest
    Drew> help-fns.el, and I don't see it there.  Could you perhaps
    Drew> post the code here?  Could you perhaps say, here, just
    Drew> what it does?  Thx.

Itʼs in repeat.el (and it does what I described 30 seconds ago, but
better :-) )

Iʼm not sure what the use of showing the keymaps is though. Theyʼre an
internal implementation detail, showing the potential bindings would
be more useful.

(defun describe-repeat ()
  "Describe repeatable commands and keymaps."
  (interactive)
  (help-setup-xref (list #'describe-repeat)
                   (called-interactively-p 'interactive))
  (let ((keymaps nil))
    (all-completions
     "" obarray (lambda (s)
                  (and (commandp s)
                       (get s 'repeat-map)
                       (push s (alist-get (get s 'repeat-map) keymaps)))))
    (with-help-window (help-buffer)
      (with-current-buffer standard-output
        (princ "This is a list of repeatable keymaps and commands.\n\n")

        (dolist (keymap (sort keymaps (lambda (a b) (string-lessp (car a) (car b)))))
          (princ (format-message "`%s' keymap is repeatable by these commands:\n"
                                 (car keymap)))
          (dolist (command (sort (cdr keymap) 'string-lessp))
            (princ (format-message " `%s'\n" command)))
          (princ "\n"))))))

Robert
--