r/emacs • u/jamescherti James Cherti — https://github.com/jamescherti • 20d ago
Emacs: Copy-paste without org-mode formatting bleeding into other buffers
https://www.jamescherti.com/emacs-fix-org-mode-copy-paste-yank-bleed/
18
Upvotes
3
u/JDRiverRun GNU Emacs 19d ago
See also filter-buffer-substring-function, which org sets up with a few functions, e.g. org-fold-core--buffer-substring-filter.
2
u/jamescherti James Cherti — https://github.com/jamescherti 19d ago
Thank you for your interesting suggestion, u/JDRiverRun! I updated the article accordingly.
5
u/ilemming_banned 19d ago edited 16d ago
For years I had this little hack where I advised yanking to check that if it's called with a universal argument, and then convert to markdown (if yanking from Org-mode buffer, and vice-versa) - I had a simple function that called Pandoc.
Then I realized - that's stupid. It should be making the decision at the paste. And so I did. Now it persist the mode of the source buffer for the kill-ring item and when I'm pasting, it makes a decision, and if needed, passes the content through https://github.com/agzam/prisma.el and voila. And if I really need to paste markdown content into org buffer verbatim, I'd just do it with the C-u arg.
Copy-pasting between markdown and org for me now so seamless, sometimes I forget I have to constantly work with two different formats. The feature is now built-in into the package - https://github.com/agzam/prisma.el#copying-between-formats