Skip to content

Instantly share code, notes, and snippets.

@kentaro
Created November 4, 2010 06:08
Show Gist options
  • Save kentaro/662175 to your computer and use it in GitHub Desktop.
Save kentaro/662175 to your computer and use it in GitHub Desktop.
;;; hatena-let.el ---
;; Copyright (C) 2010 Kentaro Kuribayashi
;; Author: kentrok@gmail.com <kentarok@gmail.com>
;; Keywords: javascript
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; hatena-let.el requires deferred.el
;; (https://github.com/kiwanami/emacs-deferred)
;; in your .emacs:
;; (require 'hatena-let)
;; (setq hatena-let/apikey " ... ")
;;; Code:
(eval-when-compile
(require 'deferred))
(defvar hatena-let/apikey "" "Your API key for Hatena::Let")
(defun hatena-let/save-code ()
(interactive)
(if (or (not hatena-let/apikey) (string= hatena-let/apikey ""))
(error "API key is required")
(deferred:$
(deferred:url-post
"http://let.hatelabo.jp/api/code.save"
`(("api_key" . ,hatena-let/apikey) ("source" . ,(buffer-string)))))))
(provide 'hatena-let)
;;; hatena-let.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment