Compare commits

...

No commits in common. "72d0f5aea788ab16c05c8e11f6ea48d6bb56ed40" and "69028afabf1d7e837dd61f6b99f7438e2c4cf956" have entirely different histories.

1 changed files with 12 additions and 10 deletions

22
h.el
View File

@ -49,25 +49,27 @@
'(h-root-directory . 3)
)
(defun h--extract-http-status-from-header (response-buffer)
(goto-char (point-min))
(defun h--extract-http-status-from-header ()
"Private function, it'll eat your kittens.
RESPONSE-BUFFER: url-retrieve response buffer."
(let ((p (point)))
(
(set-buffer response-buffer)
(goto-char (point-min))
(search-forward-regexp "^status: ")
(buffer-substring (point) (point-at-eol)))
(goto-char p)
))
(goto-char (point-min))
(search-forward-regexp "^status: ")
(let* ((current-point (point))
(move-to-beginning (goto-char (point-min)))
(look-for-status (search-forward-regexp "^status: "))
(http-status (buffer-substring (point) (point-at-eol)))
(reset-previous-ponit (goto-char current-point)))
http-status))
(url-retrieve
"https://api.github.com/repos/zimbatm/h"
(lambda (status)
(split-window-below)
(display-buffer (current-buffer))
(message (h--extract-http-status-code (current-buffer)))
(message (h--extract-http-status-from-header))
(delete-region (point-min) (search-forward "\n\n"))
(let ((json-object-type 'plist)
(json-key-type 'symbol)