Recently, I have been doing more remote pair programming at my day job, and I was copying some code snippets into pastie. Pastie is a site that allows you to share code snippets with nice syntax highlighting. One thing led to another, and next I was searching for emacs integration with pastie. I found it here, but unfortunately the lisp package no longer seemed to work. It turned out that the package just needed to support a minor change to the pastie API. I have fixed it, and added support for sniffing more of the emacs modes associated with Ruby on Rails and java. Here is the updated version of pastie.el. (Note: After publishing I added it to the emacs wiki based on a user’s suggestion: pastie.el). The package has the following functions:
pastie-buffer – Posts the current buffer as a new paste at pastie.caboo.se.
pastie-region – Posts the selected region as a new paste at pastie.caboo.se.
pastie-get – Fetches the contents of a paste from pastie.caboo.se into a new buffer.
10 responses so far ↓
Great Job! Very useful! Pyhton mode is still missing though :-]
me again … I thought it might be a great idea if you create a “pastie” page at emacswiki.org so pastie might thrive since others might add code etc.
Tia, Suno
Here it is with python mode enabled: http://pastie.caboo.se/paste/136134
@Sunu,
Good idea. It is now on the wiki at pastie.el.
Here’s a version with python mode and a function that lets you browse to the last paste.
http://pastie.caboo.se/paste/136194
Dan, Good call. I wonder if it makes sense to
pastie-browseautomatically at the end ofpastie-region?Hi and great work! Nice to see you post again!
Great, thanks!
I wonder how many copies of pastie.el is now on pastie – it’s a pretty obvious choice for trying itself out
I’ve just coded up a similar package (though much, much less code) called SCPaste that leverages Emacs’ font-lock so it knows how to syntax highlight everything that Emacs supports.
http://p.hagelb.org
Phil, Clever and simple.
Leave a Comment