emacs-circe / circe

Circe, a Client for IRC in Emacs
GNU General Public License v3.0
395 stars 51 forks source link

Use buffer-list-update-hook instead of advicing select-window #363

Open jaor opened 4 years ago

jaor commented 4 years ago

As asked for in a comment in the existing advice definition, since there seems to be a hook for this after all.

The natural implementation of the hook would use with-circe-server-buffer, but i think that it since uses (indirectly, via with-current-buffer) save-current-buffer, it alters the list of buffers ordering, something not expected by some other functions adding hooks here. In my case, it wreaks havoc with exwm's input focus management, which uses this hook (advising select-window has the same negative effect).


#

wasamasa commented 4 years ago

This is one of the worse hooks to call because it's called far more often, like whenever using with-temp-buffer. Which happens on every incoming IRC line, slowing down operations like ZNC buffer playback. The final call is up to @jorgenschaefer of course.

jorgenschaefer commented 4 years ago

We tried that hook, actually. It was incredibly slow. :-(

jaor commented 4 years ago

I see, thanks for the quick responses. I will close this PR then (for the record, I haven't noticed any slowdown, and I spend nearly 100% of my time in Emacs, but this is a very new laptop).

Moreover, after a bit more experimentation, using this hook is not solving my problems with exwm. Running circe makes it lose track of focus for X applications after a while, but I don't know why.

wasamasa commented 4 years ago

It seems Emacs 27.1 caters better for this usecase: https://old.reddit.com/r/emacs/comments/ex94aj/boooo_boooo_i_say_boo_sir/

wasamasa commented 4 years ago

@jaor Is there a reason why you've reopened this?