1

Normally I do all work locally (data analysis, image generation, etc.). However, recently I've started using the server more. When working locally I'll write the analysis code (in Python), generate the image, open the image to see what needs updated, rerun the code and see how the image changes. When working on the server this is not possible (I have to scp or rsync the new image to my computer and then open): I would like to see these images updated without these additional steps.

I tried using tramp to ssh into the server. This allows me to open the image in an emacs buffer, but does not allow me to scroll through multiple images (apparently image-dired does not work on remote files). Another issue is that the image, when opened, is bigger than the buffer, making visualization difficult.

I also tried creating an org file on the server and linking the image(s), but this results in an emacs error "No images to display inline". I tried this with and without captions, to no avail.

Is there a way to view these images in closer to real time like I do locally, or to at least view them in an emacs buffer so they fit nicely and allow me to scroll between images?

Here is the example remote org-mode file I used for testing. This same file worked when I used it locally.

#+STARTUP: inlineimages

[[file:test0.png]]
11
  • I can open a directory on the server in my local emacs, using Tramp. I can open files in the directory using f, although there's a delay while the image is downloaded. Is that enough? If you need something more, please describe in detail.
    – NickD
    Apr 4 at 19:03
  • I do something like this with orgmode. If you provide the details of your org file, we may be able to help you get that working
    – Tyler
    Apr 4 at 21:55
  • @Tyler: I'm not sure there is an Org mode file here.
    – NickD
    Apr 4 at 23:44
  • @NickD OP said he tried to accomplish his objective with org mode (among other things), and I think it is possible to do. I have done something which I think is very similar.
    – Tyler
    Apr 5 at 0:37
  • Ah, missed that - thanks!
    – NickD
    Apr 5 at 1:28

1 Answer 1

1

Not quite a complete answer, but if you open an org file on a remote server:

C-x C-f /ssh:server:file

And put a link in that file:

Here is my image:

[[./iris.png]]

You will get an active link. Note that the link path is relative to the remote file. If you're editing a remote file, orgmode looks for links in that file on the remote machine.

This doesn't work as an inline-image, C-c C-x C-v won't do anything. But if you press enter on the link, it will open in an Emacs window for you. You can 'refresh' the file by pressing g while in that window. If you know when the file has changed, you can get 'near-realtime' updates this way. It won't update automatically on change though. I tried auto-revert-mode, which doesn't seem to work remotely (I only did a quick test).

You can use this approach to generate image files on the remote machine with orgmode code blocks, and view the resulting graphics from your local emacs.

5
  • That's a neat trick!
    – NickD
    Apr 5 at 22:10
  • Have you tried setting org-display-remote-online-images to download? Or perhaps cache? It's set to skip by default, presumably to avoid long delays, but it's worth trying in this case. I'm not sure how strong the cache consistency is though: it may need manual intervention.
    – NickD
    Apr 6 at 0:39
  • BTW, C-x C-v C-i does not seem right: org-toggle-inline-images is bound to C-c C-x C-v in my case.
    – NickD
    Apr 6 at 0:50
  • @NickD thanks. org keybindings are pretty ugly, I don't remember many that go more than 2 keys deep.
    – Tyler
    Apr 6 at 1:05
  • Gaah - that should be org-display-remote-inline-images.
    – NickD
    Apr 7 at 20:11

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.