Created
January 13, 2013 19:47
-
-
Save anonymous/4525871 to your computer and use it in GitHub Desktop.
custom-functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun paste () | |
(interactive) | |
(let ((begin (if (and transient-mark-mode mark-active) | |
(region-beginning) | |
(point-min))) | |
(end (if (and transient-mark-mode mark-active) | |
(copy-marker (region-end)) | |
(point-max-marker)))) | |
(save-excursion | |
(shell-command-on-region begin end | |
(concat | |
"wgetpaste -s gists --xpaste -d " | |
(or (file-name-base buffer-file-name) | |
buffer-name) | |
(let ((lang (cdr (assoc major-mode '((c-mode . "C") | |
(c++-mode . "C++") | |
(d-mode . "D") | |
(haskell-mode . "Haskell") | |
(lua-mode . "Lua") | |
(emacs-lisp-mode . "'Emacs Lisp'") | |
(lisp-mode . "'Common Lisp'") | |
(ocaml-mode . "OCaml") | |
(php-mode . "PHP") | |
(perl-mode . "Perl") | |
(python-mode . "Python") | |
(ruby-mode . "Ruby") | |
(scheme-mode . "Scheme") | |
(tcl-mode . "Tcl")))))) | |
(if lang | |
(concat " --language " lang) | |
""))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment