branch: elpa/xkcd commit 51a00504a12b03fcd6c5c7f7e44468479a872243 Author: Vibhav Pant <vibh...@gmail.com> Commit: Vibhav Pant <vibh...@gmail.com>
Release Version 1.0 --- emacs-xkcd.el | 54 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/emacs-xkcd.el b/emacs-xkcd.el index 28de911cb4..72172b1184 100644 --- a/emacs-xkcd.el +++ b/emacs-xkcd.el @@ -1,18 +1,41 @@ +;;; emacs-xkcd.el --- View xkcd from Emacs +;;; Copyright 2014 Vibhav Pant <vibh...@gmail.com> -(require 'json) -(require 'url) +;; Url: https://github.com/vibhavp/emacs-xkcd +;; Author: Vibhav Pant <vibh...@gmail.com> +;; Version: 1.0 +;; Package-Requires: ((json "1.4")) +;; Keywords: xkcd webcomic -(defvar xkcd-alt nil) -(defvar xkcd-cur nil) +;; This file is not a part of GNU Emacs. -(defgroup xkcd nil - "A xkcd reader for Emacs") +;; 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. -(defcustom xkcd-cache-dir "~/.emacs.d/xkcd/" - "Directory to cache images and json files to." - :group 'xkcd - :type 'directory) +;; 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: + +;; emacs-xkcd uses the JSON interface provided by xkcd (http://xkcd.com) +;; to fetch comics. + +;; Comics can be viewed offline as they are stored by default in +;; ~/.emacs.d/xkcd/ + +;; For more information, visit https://github.com/vibhavp/emacs-xkcd +(require 'json) +(require 'url) + +;;;###autoload (define-minor-mode xkcd-mode "Minor mode for viewing xkcd in Emacs" :lighter " xkcd" @@ -25,6 +48,17 @@ (define-key map (kbd "q") 'xkcd-kill-buffer) map)) +(defvar xkcd-alt nil) +(defvar xkcd-cur nil) + +(defgroup xkcd nil + "A xkcd reader for Emacs") + +(defcustom xkcd-cache-dir "~/.emacs.d/xkcd/" + "Directory to cache images and json files to." + :group 'xkcd + :type 'directory) + (defun xkcd-get-json (url &optional num) (let ((json nil)) (let ((file (concat xkcd-cache-dir (number-to-string num) ".json")))