March 19, 2022

Configuring the org-download save directory

When I drag and drop an image into Emacs, I want the attached file to end up in ./img/YYYY/. This is how I tried configuring org-download in my setup (I use Doom Emacs):

    (setq org-download-method 'directory
            org-download-image-dir (concat "img/"  (format-time-string "%Y") "/")
            org-download-image-org-width 600
            org-download-heading-lvl 1)

    (setq org-download-method 'directory
            org-download-image-dir (concat "img/"  (format-time-string "%Y") "/")
            org-download-image-org-width 600
            org-download-heading-lvl 1)

For some reason, org-download-method was being reset from 'directory to 'attachafter loading, and this broke things. I thought maybe I needed to set the variables _after_org-download was loaded, so I did this:

    (after! org-download
      (setq org-download-method 'directory
            org-download-image-dir (concat "img/"  (format-time-string "%Y") "/")
            org-download-image-org-width 600
            org-download-heading-lvl 1))

That didn’t work. At startup I was seeing this error:

Error (org-mode-hook): Error running hook org-fancy-priorities-mode” because: (void-variable org-download-image-dir)

Huh. I guess not everything can be set after org-download, so I tried only setting org-download-method

    (after! org-download
      (setq org-download-method 'directory))

This worked. The other settings are done in the (after! org block.

It feels like I have to fight Doom too often, but the details and refinement of Doom is worth the trouble.


Emacs Misc


Previous post
Feelings about the Leica M10-R I’m feeling twitchy about owning the Leica M10-R . The M10-R is an astonishingly good camera. World-beating build quality, timeless design, and a
Next post
Wednesday, March 23, 2022 My tendency to write daily posts here vs the wiki is tied to how deep I am into Emacs at the moment. Right now… that’s very deep. I’ve spent hours