[திங்கள் அக்டோபர் 09, 2023] Visuwesh wrote: > [திங்கள் அக்டோபர் 09, 2023] Ihor Radchenko wrote: > >> Thanks! >> >>> +(defun org--dnd-attach-file (url action) >>> ... >>> + (insert >>> + (org-link-make-string >>> + (concat (if separatep >>> + "file:" >>> + "attachment:") >>> + (if separatep >>> + (expand-file-name (file-name-nondirectory filename) >>> + org-yank-image-save-type) >>> + (file-name-nondirectory filename)))) >>> + "\n") >>> + 'private)) >> >>> + (pcase org--dnd-xds-method >>> + (`attach (insert (org-link-make-string >>> + (concat "attachment:" (file-name-nondirectory >>> filename))) >> >>> + (`file-link (insert (org-link-make-string (concat "file:" filename)) >>> + "\n")) >> >> Is there any particular reason why you insert a newline after the image >> link? > > It is for when you drop multiple files onto a frame. AFAIU/AFAICT > there's no way to know beforehand if multiple files will be dropped or > not. I will look into it in bit more detail in the coming days and drop > the newline if only one file is dropped.
OK, seems like the actual handling is done by x-dnd-handle-uri-list where the URI list is split and each URI is handled separately. We can override this function by our own by changing the entry in x-dnd-types-alist but we need to do the same for pgtk-dnd-types-alist and from what I can tell there are no such facilities for MS Windows and NS? I think we need to accept that we will have sub-optimal interface for multi file drops. WDYT? Also, can I know what you think about using a popup-menu instead of a dialog box for prompting as Liu Hui suggests in https://yhetil.org/orgmode/caoqtw-mas6b2uh9z52ejn7ebwni+suhq9dwe0fky_rzvhox...@mail.gmail.com ? If you're okay with it, I will write a function to use rmc or popup-menu for prompting as per what use-dialog-box-p returns.