I keep my notes in Markdown. Often I would like to collect various links by drag-and-dropping them from the browser.

However, Emacs opens them instead. I know that this is probably what most people want, but is there any way to disable this, so Emacs will not open a link but just insert it as a text


You can customize the Drag and Drop behavior using the variable dnd-protocol-alist. The ultimate fallback is inserting the link as text, so this is what you want:

(setq dnd-protocol-alist nil)

The following is the default value, you can also remove http only

(("^file:///" . dnd-open-local-file)
 ("^file://" . dnd-open-file)
 ("^file:" . dnd-open-local-file)
 ("^\\(https?\\|ftp\\|file\\|nfs\\)://" . dnd-open-file))

By the way, you can do interesting thing with dnd-protocol-alist, such as, drag a html url into a markdown buffer and insert it as markdown link automatically. One existing cool use of it is Dired, when you drag a file into a dired buffer, the file will be copy&paste into that directory.

| improve this answer | |
  • Thank you, both solutions worked. The first one to switch off brutally ;-) and the second one with the removal of http. Thanks! – Marcin Magnus Jan 7 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.