On Wed, Apr 06 2011, Ted Zlatanov wrote: > I want to copy some text into the clipboard and then paste it into an > Emacs buffer (not necessarily Gnus). The original mode, e.g. lisp-mode, > should be considered when specifying the language of the code block. So > if I copy my function, it should look like this when pasted: > > #+begin_src lisp > (define-skeleton skeleton-src-quote > "Insert a quoted Gnus source listing" "language: " > \n > > "#+begin_src " str \n > > "(CODE GOES HERE)" \n > > "#+end_src" \n \n) > #+end_src > > ...and I'd like to do it all without using Org functionality. Is that > possible? Well, Org is only used to colorize the text rendered in Gnus, something which is transparent since Org is included in Emacs. What you want to do seems totally doable if we can have some information about which buffer comes the yank from. But I doubt this is the case. However you can still write something like (pseudo code :-)) and bind it to a key: (defun gnus-yank-code (code) (interactive (get-selection-content-if-active) (let ((buf (choose-a-buffer-using-something-like-gnus-dired-mail-buffers)) (mode (symbol-name major-mode))) (with-current-buffer buf (insert "#+begin_src " mode "\n") (insert code) (insert "+end_src"))))) -- Julien Danjou ❱ http://julien.danjou.info