Skip to content
📋 Rich text clipboard for org-mode: Paste into a #+BEGIN_SRC block of correct mode, with link to where it came from
Emacs Lisp
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
org-rich-yank.gif org-rich-yank: paste in a SRC block with org-link and correct mode Feb 9, 2018


Do you often yank source code into your org files, manually surrounding it in #+BEGIN_SRC blocks? This package will give you a new way of pasting that automatically surrounds the snippet in blocks, marked with the major mode of where the code came from, and adds a link to the source file after the block.




If you use MELPA, you can just do M-x list-packages, find org-rich-yank in the list and hit i x.


Just put org-rich-yank.el somewhere in load-path.


Manual, loading on startup:

To use, require and bind whatever keys you prefer to the interactive function:

(require 'org-rich-yank)
(define-key org-mode-map (kbd "C-M-y") #'org-rich-yank)

With use-package, enabled after org:

If you prefer use-package, the above settings would be:

(use-package org-rich-yank
  :ensure t
  :demand t
  :bind (:map org-mode-map
              ("C-M-y" . org-rich-yank)))

The :demand t in there is because we never know when the user will hit C-M-y, so we always have to store the current buffer on kills. You can remove the :demand t and have lazy/deferred loading, but then the first time you hit C-M-y after startup, you’ll get a message that you have to kill the selection again.

You can’t perform that action at this time.