Subject: bug#58950: [PATCH] * lisp/subr.el (buffer-match-p): Optimise performance

From: Mattias Engdegård <[email-masked]>
Date: Sat, 7 Jan 2023 13:57:14 +0100

6 jan. 2023 kl. 22.41 skrev Dmitry Gutov <[email-masked]>:

>> (I wish we had (byte-)compiled elisp functions carrying their own source, either as s-exp, string of formatted source text, or source file reference -- that would allow for sensible editing in Customise without performance penalty. But Santa gave me a wool jumper instead, that's nice too.)
> 
> We kind of have that already, if we just made the type for be 'sexp', or a Lisp form. With all the freedom associated with it, just lower performance compared to a compiled function.

That's short in two respects: performance, and non-retention of formatting and comments. We could store source refs in:

- a hash table weakly keyed on the code object
- some back corner of byte-code objects
- OClosures

We have a similar problem with regexps, which are only retained and edited in the traditional syntax.

We are veering off-topic. Sorry about that.

> I'm on the fence regarding changing it, though, for compatibility and ergonomical reasons (it's easier for the user to avoid typing a dot).

Is compatibility a serious concern given that buffer-match-p is new in 29?