This is pretty simple, I'm trying to find (or build) a hook that fires when files are visited and selected (i.e. immediately displayed).
I'm writing a UI centric entry for
find-file-hook, but it turns out that
find-file-hook is fired for all sorts of things that I don't need:
- Semantic assets which are loaded when semantic starts
- Files opened in the background for my on-the-fly diffing program
- Probably other stuff, that's all I could think of off the top of my head
Most of this is done by way of
find-file-noselect, which associates a buffer with a file, but does not
switch-to-buffer on the newly created buffer like
I would like my hook to execute only when the current buffer changes.
find-file-noselect")? Do you mean displayed?
find-file-noselectfinds the file but does not display it (the documentation calls it "selecting" a file?)
window.el, or something else? Consider adding a specific example so that forum participants have a better idea of what you are seeking.
find-file-noselectensures that a buffer has the contents of a file. Buffers are visited, not files. If a buffer already has the file contents in it then that buffer is returned (the buffer contents are also checked wrt the file on disk, and you are alerted if they are out of sync). So a file being "visited and selected" doesn't mean much (to me anyway). When
find-file-noselectreturns a buffer that is visiting the file, I guess that is what you mean by "visited and selected", but then you add "(i.e., not by
find-file-noselect)". So it's unclear to me what you mean.