>> (1) The first interpretation means (implicitly) that we could replace >> the call to `buffer-list-update-hook' by calling instead something >> we could name `record-buffer-hook'. > > I'm not sure I understand. I see that near the end of select_window > we now call record_buffer, which in turn runs `buffer-list-update-hook'; > are you suggesting that if we went down this path then record_buffer > would run a new `record-buffer-hook' (and no longer run > `buffer-list-update-hook')? Yes. All callers of `buffer-list-update-hook' would then have to call `record-buffer-hook' too. >> You didn't explain _what_ you want to solve. Adding the name of the >> current buffer whenever a hook is run doesn't sound very reasonable to >> me. > > Sure, it was just an experiment intended to help me understand how > often that hook is run and under what conditions. Aha. You now know that it's run too often for your needs. But doesn't `select-window' also run too often for you, for example, when selecting the minibuffer window? > Thanks for explanation and suggestion. I'll experiment some more > to see if there's a reasonable way to obtain the desired behavior > with the existing machinery, which I agree would be better than > introducing a new hook. If you told me a bit what you the "desired behavior" is, I might provide suggestions. > Incidentally, I just noticed that though record_buffer runs > `buffer-list-update-hook' it's not mentioned in the docstring: > > Functions running this hook are `get-buffer-create', > `make-indirect-buffer', `rename-buffer', `kill-buffer', > and `bury-buffer-internal'. > > Perhaps this is intentional because record_buffer is not exposed at > the Lisp level, though? Hmm... Actually it's not there because I have added it only recently. Stefan soon detected some bug in the initial change so it's not safe yet either. That is, if you do something silly there, you might easily infloop or crash Emacs. But the same would obviously hold for a `select-window-hook'. martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4