11

I have an image generated by plantuml which I open in an Image mode buffer. I want to use Auto-Revert mode so it auto-refreshes, but it doesn't seem to work on Image mode buffers for some reason. Is there something I'm missing?

9

As someone who just had this problem, I found another solution: auto-image-file-mode. What it does is automatically make sure the file is in image mode instead of binary, so enable both that and auto-revert-mode and everything works as expected. Emacs 24.4.1

Source: http://osdir.com/ml/bug-gnu-emacs-gnu/2014-01/msg01061.html

4

You don't provide much information about what you are doing or what you are seeing. Try to give a step-by-step recipe, preferably starting from emacs -Q, and say what you expect versus what you see.

Does manually reverting the buffer work (M-x revert-buffer, after setting the current buffer to the image buffer)? If so, then investigate what is different about auto-reversion.

Are you using global-auto-revert-mode? If not, is your image buffer on auto-revert-buffer-list? If not, then that would explain things: auto-revert-mode adds the current buffer to that list, and auto-revert-buffers reverts buffers that are on that list.

I'm no expert on image-mode, but searching for revert in image-mode.el I see function image-after-revert-hook. If it were I, I might start by M-x debug-on-entry image-after-revert-hook (after loading image-mode.el, not image-mode.elc), and then stepping through the debugger (e.g., using d).

(A wild guess tells me that that function is not even called, and that the image buffer is not a candidate for reverting. See above. Maybe try global-auto-revert-mode, to start with.)

3

I tried opening a png in emacs, enabling auto-revert-mode and then from a shell, copying another image over it and then replacing that file with a copy of the original png.

What I found is that the file is sometimes updated to the new files binary contents, but not the rendered content. If it opens the binary content, try using C-c C-c to convert it to an image.

After doing that conversion at least once, it starts auto-reverting as I would expect by keeping it an image.

Note: I tried this with Emacs 25.1, so it may be a new feature. What version are you using?

  • 24.3 - time to update! I used to stay on the source head or near it, but the release version is pretty good these days. – Mark Aufflick Nov 2 '14 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.