Subject: bug#49953: 28.0.50; tmm is broken on compiled menus

From: Juri Linkov <[email-masked]>
Date: Mon, 09 Aug 2021 10:12:28 +0300

0. emacs -Q
1. Eval: (tmm-prompt (mouse-buffer-menu-keymap))
2. Select a menu item with the mouse click
   from the *Completions* buffer
3. It fails with this backtrace:

Debugger entered--Lisp error: (error "Empty menu reached")
  error("Empty menu reached")
  tmm-prompt((keymap "Select Buffer" [("*scratch* * " . #f(compiled-function () (interactive nil) #<bytecode...
  tmm-prompt((keymap (Select\ Buffer "Select Buffer" keymap ...
  (progn (tmm-prompt (mouse-buffer-menu-keymap)))
  eval((progn (tmm-prompt (mouse-buffer-menu-keymap))) t)
  elisp--eval-last-sexp((4))
  eval-last-sexp((4))
  funcall-interactively(eval-last-sexp (4))
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

This regression began to occur after merging native-compilation.
It seems the problem is that tmm-get-keymap does very strange things:

	(cond ((if (listp elt)
		   (or (keymapp elt) (eq (car elt) 'lambda))
		 (and (symbolp elt) (fboundp elt)))

I don't know why it checks for 'lambda' and 'symbolp',
but such checks fail on a compiled function.