1

I have an org file and buffer named test.org that contains this line:

[[https://en.wikipedia.org/wiki/Emacs#/media/File:Emacs_Dired_buffers.png][myimg]]

I want to put my cursor/point somewhere on this link and then run a function that downloads this png file and adjusts the link to something like this

[[file:img/Emacs_Dired_buffers.png][myimg]]

I use img/ because I prefer relative paths. So I'd like to download the picture to a subfolder which is in the same folder as my org file.

At the moment I can't find a solution.

1

You can easily build this functionality by getting at abo-abo's org-download package. Look at the command org-download-image which takes an image address as its argument and downloads it to an attachment directory.

For associating an image directory with an org document, I would always recommend to use the org attachment mechanism. I prefer to have a clear naming convention for attachments and my org documents. For an agenda it may be appropriate to have an attachment directory associated to a particular heading (task), but for authoring documents, I usually prefer a single attachment directory for the whole document. Currently I do this by setting the attachment dir to a directory I conventionally name {documentname}-att/. Else an attachment will be created in data/ + some hash based on the current headline ID. I also add the inherit property, so that all sub-headlines also inherit this setting.C-c C-a brings you to the attachment dialogue where you get a menu for all of these options.

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.