From: Christian Metts Date: 2005-03-20T18:49:17+09:00 Subject: fun syntax.carldr.com trick for Emacs on OSX A fun trick I whipped up to make syntax.carldr.com more useful to me. It's a bit messy and probably brittle (as my elisp is weak) but it works. (define-key ruby-mode-map (kbd "C-c M-|") (lambda (reg-start reg-end) (interactive "r") (shell-command-on-region reg-start reg-end "curl -s -F 'description=Code' -F 'code=<-' http://syntax.carldr.com/syntax/make | grep 'Link 2:' | /usr/local/bin/ruby -e 'print gets[/http:.*/]' | pbcopy"))) It allows me to hit crtl-c meta-| in any ruby buffer and it posts the current region to http://syntax.carldr.com/ and copies the resulting http://smallr.com url to my OSX clipboard. Yay for glue! Things to note: * It uses an unannounced and probably non-final CLI interface to the paste-site. Carl may very well break it. * This posts whatever is in your region to a public server. Don't do it to sensitive data! * It occasionally fails for an unknown reason, probably a network/curl issue, repeating the command works. * My Emacs doesn't read my environment properly and I've never bothered to fix it. So the full path to ruby is used. Fix it if you need too. -- Xian