読者です 読者をやめる 読者になる 読者になる

tanzaku.el(Web API版)

emacs 七夕

http://tanzak.herokuapp.com

コード

(require 'json)
(defun tanzak-web (negaigoto)
  (interactive
   (list (read-string "願い事: ")))
  (with-temp-buffer
    (let ((url (concat "http://tanzak.herokuapp.com/api?q=" (url-encode-url negaigoto))))
      (unless (zerop (call-process "curl" nil t nil "-s" url))
        (error "Failed: access api"))
      (let ((tanzaku (assoc-default 'c (json-read-from-string (buffer-string)))))
        (with-current-buffer (get-buffer-create "*tanzaku*")
          (erase-buffer)
          (insert tanzaku)
          (goto-char (point-min))
          (pop-to-buffer (current-buffer)))))))

イメージ