[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/xkcd 51bf8b0d49 05/82: Rename functions, make json retriev
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/xkcd 51bf8b0d49 05/82: Rename functions, make json retrieving function smaller. |
Date: |
Mon, 12 Dec 2022 21:59:49 -0500 (EST) |
branch: elpa/xkcd
commit 51bf8b0d49ea528c98ab79fae803afe2f62b96df
Author: Vibhav Pant <vibhavp@cthulhu-p5kpl.lan>
Commit: Vibhav Pant <vibhavp@cthulhu-p5kpl.lan>
Rename functions, make json retrieving function smaller.
---
emacs-xkcd.el | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/emacs-xkcd.el b/emacs-xkcd.el
index 7a5dfe5f74..830a934e38 100644
--- a/emacs-xkcd.el
+++ b/emacs-xkcd.el
@@ -43,14 +43,12 @@
(define-key map (kbd "C-c t") 'xkcd-alt-text)
map))
-;;taken from http://frozenlock.org/2012/07/07/url-retrieve-and-json-api/
-(defun get-json (url)
+(defun xkcd-get-json (url)
(let ((buffer (url-retrieve-synchronously url))
(json nil))
(with-current-buffer buffer
- (goto-char (point-min))
- (re-search-forward "^$" nil 'move)
- (setq json (buffer-substring-no-properties (point) (point-max)))
+ (re-search-backward "^$")
+ (setq json (buffer-substring-no-properties (+ (point) 1) (point-max)))
(kill-buffer (current-buffer)))
json))
@@ -109,7 +107,7 @@
(xkcd-get (random (cdr (assoc 'num (json-read-from-string
(get-json
"http://xkcd.com/info.0.json")))))))
-(defun get-lastest-xkcd ()
+(defun xkcd-get-latest ()
"Get the latest xkcd"
(interactive)
(if (and (boundp 'xkcd-mode) (not xkcd-mode))
- [nongnu] branch elpa/xkcd created (now 80011da2e7), ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 51bf8b0d49 05/82: Rename functions, make json retrieving function smaller.,
ELPA Syncer <=
- [nongnu] elpa/xkcd fcedf74f71 01/82: Initial commit, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 620f3417cf 08/82: Update README.md, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd d890179cde 09/82: Add xkcd-download, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd add1413ee9 11/82: Correct typo in readme., ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd c816cfa893 12/82: Add caching and offline support., ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 736b1c9abf 02/82: Initial commit, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 0f1abaebf5 14/82: typo: keybinding is t not r, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd f7b5157cdd 03/82: * README.md: Fix directory path, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 7ceb6cfb46 04/82: Update README.md, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 3acd31542b 06/82: Fix up search in xkcd-get-json. Add new line to README.md., ELPA Syncer, 2022/12/12