Whenever I drap&drop an image into a note, it’ll open an image in a new buffer. An image won’t get embedded or attached onto a note. Why not? Hasn’t d&d functionality been added since several versions ago, natively?
How to embed or attach an image onto a note? Preferably, a) by Drap&Drop b) without any third-party package
It looks like yank, yank-media, and drag-and-drop are all different things in Emacs.
Have a look at customizing variable org-yank-dnd-method for drag-and-drop (see the excerpt below). It works on my end. I have a screenshot in another thread: Embed documents into nodes - #2 by nobiot
org-yank-dnd-method is a variable defined in ‘org.el’.
Its value is ‘ask’
Action to perform on the dropped and the pasted files.
When the value is the symbol,
. ‘attach’ -- attach dropped/pasted file
. ‘open’ -- visit/open dropped/pasted file in Emacs
. ‘file-link’ -- insert file: link to dropped/pasted file
. ‘ask’ -- ask what to do out of the above.
This variable was introduced, or its default value was changed, in
version 9.7 of the Org package that is part of Emacs 30.1.
You can customize this variable.
Alright, d&d works and allows me to select an action manually. C-y doesn’t work with media although it does with a M-x yank-media, somehow.
If a newly attached for the same note has the same name as the one that’s been attached already, there will an error - “file already exists”. But such files might be different. Is there a setting to resolve this? Such that a 2nd file be renamed to “__2” or “(2)” or anything similar.
I do not know. Personally I always have different filenames for each file, and I don’t attach files to a note with org-attach. Perhaps you can dig deeper into how org-attach works. You may need to craft your own function.