Subject: bug#52291: 29.0.50; "Unknown button type ‘help-function’"

From: David Bremner <[email-masked]>
Date: Sun, 5 Dec 2021 01:22:49 +0000

Please find attached "foo.el", a somewhat reduced test case from the
notmuch source.

When I run

% emacs-29.0.50 -l foo.el --eval "(toggle-debug-on-error)" --eval \
  "(documentation #'notmuch-search-mode)"

I get the following backtrace

Debugger entered--Lisp error: (error "Unknown button type ‘help-function’")
  signal(error ("Unknown button type ‘help-function’"))
  error("Unknown button type `%s'" help-function)
  make-text-button(1300 1324 type help-function help-args (notmuch-search-scroll-up))
  apply(make-text-button 1300 1324 (type help-function help-args (notmuch-search-scroll-up)))
  insert-text-button("notmuch-search-scroll-up" type help-function help-args (notmuch-search-scroll-up))
  help--describe-command(notmuch-search-scroll-up nil)
  describe-map((keymap (85 . notmuch-unthreaded-from-search-current-query) (90 . notmuch-tree-from-search-current-query) (27 keymap (13 . notmuch-tree-from-search-thread)) (13 . notmuch-search-show-thread) (43 . notmuch-search-add-tag) (45 . notmuch-search-remove-tag) (97 . notmuch-search-archive-thread) (42 . notmuch-search-tag-all) (107 . notmuch-tag-jump) (mouse-1 . notmuch-search-show-thread) (108 . notmuch-search-filter) (116 . notmuch-search-filter-by-tag) (99 . notmuch-search-stash-map) (111 . notmuch-search-toggle-order) (82 . notmuch-search-reply-to-thread) (114 . notmuch-search-reply-to-thread-sender) (110 . notmuch-search-next-thread) (112 . notmuch-search-previous-thread) (62 . notmuch-search-last-thread) (60 . notmuch-search-first-thread) (32 . notmuch-search-scroll-up) (98 . notmuch-search-scroll-down) (127 . notmuch-search-scroll-down) (120 . notmuch-bury-or-kill-this-buffer)) [] nil t nil t t)
  describe-map-tree((keymap (85 . notmuch-unthreaded-from-search-current-query) (90 . notmuch-tree-from-search-current-query) (27 keymap (13 . notmuch-tree-from-search-thread)) (13 . notmuch-search-show-thread) (43 . notmuch-search-add-tag) (45 . notmuch-search-remove-tag) (97 . notmuch-search-archive-thread) (42 . notmuch-search-tag-all) (107 . notmuch-tag-jump) (mouse-1 . notmuch-search-show-thread) (108 . notmuch-search-filter) (116 . notmuch-search-filter-by-tag) (99 . notmuch-search-stash-map) (111 . notmuch-search-toggle-order) (82 . notmuch-search-reply-to-thread) (114 . notmuch-search-reply-to-thread-sender) (110 . notmuch-search-next-thread) (112 . notmuch-search-previous-thread) (62 . notmuch-search-last-thread) (60 . notmuch-search-first-thread) (32 . notmuch-search-scroll-up) (98 . notmuch-search-scroll-down) (127 . notmuch-search-scroll-down) (120 . notmuch-bury-or-kill-this-buffer)) t nil nil nil t nil nil t)
  substitute-command-keys("Major mode displaying results of a notmuch search....")
  documentation(notmuch-search-mode)
  eval((documentation #'notmuch-search-mode) t)
  command-line-1(("-l" "foo.el" "--eval" "(toggle-debug-on-error)" "--eval" "(documentation #'notmuch-search-mode)"))
  command-line()
  normal-top-level()

But only the _first_ time. If I then run (documentation
#'notmuch-search-mode) a second time interactively, it works more or
less as I expect and returns a docstring.

The command line invocation is just for ease of duplication; the same
backtrace is obtainable interactively.

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2021-12-04 built on convex
Repository revision: b3505e31d6ce4ea7c2cf1b01b8b7357b1f527bf1
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --prefix=/usr/local'

Configured features:
ACL DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS JPEG LIBSELINUX
LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XFT XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message yank-media rmc puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail tempo org-install rx vc vc-dispatcher finder-inf
gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search time-date mail-utils mm-util mail-prsvr wid-edit
cus-load package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map url-vars seq gv subr-x byte-opt
bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 169665 6495)
 (symbols 48 13628 1)
 (strings 32 57293 2568)
 (string-bytes 1 1483987)
 (vectors 16 20194)
 (vector-slots 8 271675 9533)
 (floats 8 32 25)
 (intervals 56 216 0)
 (buffers 992 11))