Skip to content

Instantly share code, notes, and snippets.

@skeptomai
Created June 14, 2011 16:20
Show Gist options
  • Select an option

  • Save skeptomai/1025251 to your computer and use it in GitHub Desktop.

Select an option

Save skeptomai/1025251 to your computer and use it in GitHub Desktop.
(require 'json)
(defun file->filename (file)
(cdr (assoc 'filename (cdr file))))
(defun file->content (file)
(cdr (assoc 'content (cdr file))))
(defun gist-to-buffers (gist-buffer)
(interactive "bGist Buffer: ")
(let* ((gist-json (with-current-buffer "gist.json"
(json-read-from-string (buffer-string))))
(gist-files (cdr (assoc 'files gist-json) ) ))
(dolist (gist-file gist-files)
(let* ((filename (file->filename gist-file))
(content (file->content gist-file)))
(with-current-buffer (get-buffer-create filename)
(insert content))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment