Subject: Re: bug#78582: 30.1; which-key-mode overwrites custom key bindings

From: Stefan Monnier <[email-masked]>
Date: Mon, 02 Jun 2025 11:38:17 -0400

> Alas, the "supposed to happen only" is apparently not the case. The
> Emacs where I see this is an Emacs installation. In the case of macOS,
> this means "make install" has created an Emacs.app directory, a "bundle"
> as it is called on macOS, containing what a "normal" installation would
> contain. That Emacs.app I copied to the Desktop folder and start if from
> there.
>
> Too bad that I don't have a debug build so that I could see more.
> Why does it think in my case that it needs to reread_doc_file?

  if (FIXNUMP (doc) || (CONSP (doc) && FIXNUMP (XCDR (doc))))
    {
      Lisp_Object tem = get_doc_string (doc, 0);
      if (NILP (tem) && try_reload)
	{
	  /* The file is newer, we need to reset the pointers.  */
	  reread_doc_file (Fcar_safe (doc));
	  try_reload = false;
	  goto retry;
	}
      doc = tem;
    }

so it's because `get_doc_string` returned nil.
Usually this is because the doc reference points to a place that
"doesn't look right" (is not immediately preceded by `#@NNN`).

So maybe check the raw doc-string reference for `rectangle-mark-mode`:

    (nth 2 (symbol-function 'rectangle-mark-mode))

gives me ("loaddefs.elc" . 1044279).
Then go look at loaddefs.elc to see if that byte position points to
a docstring?
Or maybe the problem is somewhere in our handling of preloaded files
(i.e. those where the doc string reference uses a relative file name as
above) where it ends up looking in the wrong directory?

        Stefan