On Sat, 06 Aug 2011 11:20:41 +1000 Kevin Ryde wrote: > reopen 5293 > thanks > > Stefan Monnier writes: >> >>> No, just the hooks. If it makes sense to remove unloaded funcs from >>> hook global values then surely the same rationale applies to remove them >>> from the buffer-local values too. >> >> Agreed. Someone would have to try it out to see if it can be >> done efficiently. ^^^^^^^^^^^ :-D > Reopened for that, or failing that then for clarifying the docstring. > > I imagine there's not normally many hooks or many buffers, or many > buffer-local variables, whichever one of those was the efficient way to > scan ... and unload-feature isn't used very much anyway. Coming back to this after 10 years, it appears that we (I, certainly) underestimated the computation involved. While the attached patch(es) work for emacs -Q toy examples like Kevin's or more recently the one from bug#34686, when I tried M-x load-library allout RET M-x unload-feature allout RET in my normal Emacs session with ~300 buffers and ~1000 features, it took my venerable laptop 8 minutes to complete. Based on that experience, unless someone has better ideas, I suggest we close this and clarify the (henceforth intentional) lack of attention to buffer-local hook values in the documentation instead. Actually, I wonder if ignoring even the global hooks (as opined by Juanma) and enforcing more widespread usage of FEATURE-unload-function wouldn't be better; or/also, couldn't stray undefined functions on hooks be handled similarly to how it's done for errors e.g. in `post-command-hook', i.e. auto-removed when encountered? I guess wrapping all hooks like that would be overkill? (That said, I think [1/3] and [3/3] could/should be applied nonetheless.)