This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 28th, 2012  |  syntax: None  |  size: 1.42 KB  |  views: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ;;; hatena-let.el ---
  2.  
  3. ;; Copyright (C) 2010 Kentaro Kuribayashi
  4.  
  5. ;; Author: kentrok@gmail.com <kentarok@gmail.com>
  6. ;; Keywords: javascript
  7.  
  8. ;; This program is free software; you can redistribute it and/or modify
  9. ;; it under the terms of the GNU General Public License as published by
  10. ;; the Free Software Foundation, either version 3 of the License, or
  11. ;; (at your option) any later version.
  12.  
  13. ;; This program is distributed in the hope that it will be useful,
  14. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ;; GNU General Public License for more details.
  17.  
  18. ;; You should have received a copy of the GNU General Public License
  19. ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  20.  
  21. ;;; Commentary:
  22.  
  23. ;; hatena-let.el requires deferred.el
  24. ;; (https://github.com/kiwanami/emacs-deferred)
  25.  
  26. ;; in your .emacs:
  27.  
  28. ;; (require 'hatena-let)
  29. ;; (setq hatena-let/apikey " ... ")
  30.  
  31. ;;; Code:
  32.  
  33. (eval-when-compile
  34.   (require 'deferred))
  35.  
  36. (defvar hatena-let/apikey "" "Your API key for Hatena::Let")
  37.  
  38. (defun hatena-let/save-code ()
  39.   (interactive)
  40.   (if (or (not hatena-let/apikey) (string= hatena-let/apikey ""))
  41.       (error "API key is required")
  42.     (deferred:$
  43.       (deferred:url-post
  44.         "http://let.hatelabo.jp/api/code.save"
  45.         `(("api_key" . ,hatena-let/apikey) ("source" . ,(buffer-string)))))))
  46.  
  47. (provide 'hatena-let)
  48. ;;; hatena-let.el ends here
clone this paste RAW Paste Data