[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A faster derived-mode-p
From: |
Lars Ingebrigtsen |
Subject: |
A faster derived-mode-p |
Date: |
Sun, 14 Feb 2021 21:22:11 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
There are only 11K commands in the Emacs tree, so I don't know whether
the current default completion predicate is going to turn out to be
problematically slow or not.
It basically calls `provided-mode-derived-p' for all annotated commands,
and this is a loop that chases mode parenthood back to its ultimate
ancestor.
It seems like this could done more efficiently by just resolving the
chain at `define-derived-mode' time. That is, in addition to putting
`derived-mode-parent', it could put `derived-mode-parents', too, where
it chases the chain upwards. Then we'd just have to look at a single
property list...
Does anybody see any disadvantages to doing it this way? (This would
speed up `derived-mode-p', which we use all over Emacs, in general.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no