Subject: bug#72616: 30.0.60; M-x apropos-library eglot fails

From: Stefan Monnier <[email-masked]>
Date: Wed, 14 Aug 2024 08:47:40 -0400

>> This doesn't look right: the meaning of `define-symbol-props` in
>> `load-history` should be defined in a more modular way, near
>> `define-symbol-prop` rather than by hardcoding something in
>> `apropos.el`.
>
> Is it better to leave us where we are now: that apropos-library
> signals an error instead of displaying the information about the
> library?

In the mean time we could just sanitize the data we use heuristically,
as in the patch below.

> Patches are welcome, but maybe we should start with someone explaining
> what are those define-symbol-props elements in load-history.  They are
> currently completely undocumented AFAICT, and so anyone but the
> person(s) who added that to Emacs will have hard time coming up with
> changes such as you describe.  (Apologies if this is already
> documented and I just missed it.)

Indeed, we currently don't have a good way to document the new kinds of
elements that can occur in `load-history` and the new ones we do have
(e.g. `cl-defmethod`, `define-type`, ...) are currently undocumented.

        Stefan

diff --git a/lisp/apropos.el b/lisp/apropos.el
index 6c6cd0b593d..0655fecd0e8 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -734,7 +734,10 @@ apropos-library
         ;; FIXME: Print information about each individual method: both
         ;; its docstring and specializers (bug#21422).
         ('cl-defmethod (push (cadr x) provides))
-	(_ (push (or (cdr-safe x) x) symbols))))
+        ;; FIXME: Add extension point (bug#72616).
+	(_ (let ((sym (or (cdr-safe x) x)))
+	     (and sym (symbolp sym)
+	          (push sym symbols))))))
     (let ((apropos-pattern "") ;Dummy binding for apropos-symbols-internal.
           (text
            (concat