TGViewer
/r/emacs /r/emacs @r_emacs · 81 subscribers
Post #28725 9
My org-attach config, only place files go (paste / drag / download), with names I can actually read

My notes had two image piles: org-download threw everything into one folder, and org-attach had files called WechatIMG7604.jpg or some 64-char hash. Every time I added a file I had to think about where it should go. Got tired of it.

Now anything that enters an Org buffer becomes an attachment of the current heading and gets a link inserted. The nice part is how little it took, because everything already ends up in org-attach-attach:

(setq org-yank-dnd-method 'attach
org-yank-image-save-method 'attach
org-download-method 'attach)

Then one :around advice on org-attach-attach does the rest:

junk names (hashes, `IMG_1234`, `Screenshot…`) become `20261010-083713-heading-title.png`; names that already mean something are left alone
files are moved instead of copied, so ~/Downloads doesn't fill up with leftovers

s-v pastes an image as an attachment if the clipboard has one, otherwise it's a normal yank. This was the annoying bit. "Clipboard has an image" isn't enough: browsers put the URL next to the image, and spreadsheets put a rendered picture next to the cells you copied. I ended up with "image + a single line that looks like a URL or image filename = image, anything else = text". Works for the apps I use, probably not for all of them.

There's also a transient on C-c C-a (attach newest download, rename and fix the links, Quick Look, reveal in Finder).

Full file: https://gist.github.com/yibie/9bd280522c24eec41ce0b32b327967cd

Caveats: the clipboard part is macOS only (needs pngpaste), and since it moves files, don't point it at a folder you want to keep intact.

How do you all tell "image" from "text" on paste? Curious if there's a better rule.

https://redd.it/1x4kb1e
@r_emacs
Gist org-attach as the single place every file goes: paste, drag, download, readable names, a transient menu org-attach as the single place every file goes: paste, drag, download, readable names, a transient menu - my-org-attach.el
More from @r_emacs
  1. Oct 13, 2026Can the :mode command take multiple extensions to trigger a mode? Take this set of extensi…
  2. Oct 13, 2026photo post
  3. Oct 13, 2026agent-shell 0.87 updates https://redd.it/1x4t0hl @r_emacs
  4. Oct 13, 2026Rome Wasn't Built In A Day, More Like 10 Minutes https://www.youtube.com/watch?v=BuqZb6Avd…
  5. Oct 13, 2026How can you design your init.el and use-package clauses so that features which are UI base…
  6. Oct 13, 2026arena](https://preview.redd.it/rpohg4omi4vh1.png?width=2208&format=png&auto=webp&s=61fe901…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →