Another idea; do you need to change the theme per buffer, or per buffer displayed in a window? If the latter, then you could ensure that buffer themes are only changed if a buffer is actually shown on screen. On 03/18/2016 07:04 AM, Iñigo Serna wrote: > Hi, > > I'm the author of “per-buffer-theme”, a simple package available in > MELPA [1], which changes emacs theme when switching to a buffer according to > some configured rules (f.e. use a dark theme when coding, light theme > for email or web navigation). It advices `select-window', checks buffer > name or major-mode, and changes theme. > > It worked correctly and fast with emacs 24.5, but now with emacs 25.x it > produces additional “flickering” when switching buffers, especially for > eww/shr buffers, where it makes package useless. > > I think problem comes that, when switching to a eww/shr buffer, shr > rendering uses many temporal buffers, so theme changes many times > producing that "flickering" effect. But I'm not sure as my elisp skills > and emacs internals knowledge is quite limited. > > I don't know how to solve it… I've tested with before/after variations > to `advice-add' but results are similar. First versions used > `window-configuration-change-hook' but add-advice to select-window was > much better option then. Any ideas? > > Thanks in advance, > Iñigo Serna > > [1] http://melpa.org/#/per-buffer-theme > https://bitbucket.org/inigoserna/per-buffer-theme.el > >