I would like to drag and drop an image file into an emacs buffer and make the filename appear instead of the image. Is this possible?
1 Answer
(setq dnd-protocol-alist '(("^file:" . dnd-insert-filename)))
(defun dnd-insert-filename (uri _action)
(insert (dnd-get-local-file-name uri)))
I learnt the dnd-protocol-alist
user option from Elisp manual: (elisp) Drag and Drop and read its docstring to know how to customize its value.