Skip to content

Instantly share code, notes, and snippets.

Created January 13, 2013 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4525871 to your computer and use it in GitHub Desktop.
Save anonymous/4525871 to your computer and use it in GitHub Desktop.
custom-functions
(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