[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/xkcd 5693718f71 52/82: Add support for browse-url.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/xkcd 5693718f71 52/82: Add support for browse-url. |
Date: |
Mon, 12 Dec 2022 21:59:53 -0500 (EST) |
branch: elpa/xkcd
commit 5693718f717821a0608e10918b6d06943a128965
Author: Vibhav Pant <vibhavp@gmail.com>
Commit: Vibhav Pant <vibhavp@gmail.com>
Add support for browse-url.
---
xkcd.el | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/xkcd.el b/xkcd.el
index dbae5499a5..b3bea57897 100644
--- a/xkcd.el
+++ b/xkcd.el
@@ -186,6 +186,19 @@ If the image is a gif, animate it."
(xkcd-get-json url 0))))))
(xkcd-get (random last))))
+(defun get-xkcd-from-url (url)
+ "Load xkcd pointed to by URL"
+ (let* ((string (substring url (string-match "[0-9]+" url)))
+ (number (substring string 0 (string-match "/" string))))
+ (xkcd-get (string-to-number number))))
+
+(setq browse-url-browser-function (lambda (url etc) (if
+ (string-match
+ "xkcd.com/[0-9]+"
+ "http://xkcd.com/123/")
+ (get-xkcd-from-url url)
+
'browse-url-default-browser)))
+
(defun xkcd-get-latest ()
"Get the latest xkcd."
(interactive)
- [nongnu] elpa/xkcd 25594f98c7 31/82: Add info about Melpa in README., (continued)
- [nongnu] elpa/xkcd 25594f98c7 31/82: Add info about Melpa in README., ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 52c0d270de 36/82: Use one-letter keybindings, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 20e0b48044 42/82: Correct flycheck warnings, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd f5942003bf 45/82: Fix xkcd-get-json, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 3c13ae29c4 49/82: Docstrings, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd e2daa08012 25/82: Add a better screenshot., ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd df47be622f 28/82: The package isn't that hackish now., ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd d1bc89dee2 34/82: Add variable xkcd-latest: Stores the latest cached xkcd number., ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 7b1a312239 37/82: Add an help-echo text property to display the alt-text, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd e61b7e6ed6 51/82: xkcd-get-json: Get substring between (point) and (point-max), instead of, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 5693718f71 52/82: Add support for browse-url.,
ELPA Syncer <=
- [nongnu] elpa/xkcd 0db98c2ca2 72/82: Add instructions for el-get., ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 046ad2c582 67/82: Add README.org, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 7987d64a7e 71/82: * README.md: Remove. Replaced with README.org., ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd b637a2aa84 13/82: Update README.md, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd b9095c5aae 16/82: Make xkcd-get-latest work., ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd 2da77a12e2 29/82: Provide xkcd instead of emacs-xkcd, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd e8bb80c4a0 30/82: Make comments work with Melpa., ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd b303669b33 39/82: Merge pull request #7 from rafoo/master, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd ef6e51ade7 43/82: Code simplification, ELPA Syncer, 2022/12/12
- [nongnu] elpa/xkcd f2650dc392 46/82: Retrieve correct substring, ELPA Syncer, 2022/12/12