aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init/ycp-markup.el4
-rw-r--r--emacs/.emacs.d/lisp/my/link-gopher.el2
-rw-r--r--emacs/.emacs.d/lisp/my/my-wikipedia.el14
3 files changed, 16 insertions, 4 deletions
diff --git a/emacs/.emacs.d/init/ycp-markup.el b/emacs/.emacs.d/init/ycp-markup.el
index fb31663..9dc888b 100644
--- a/emacs/.emacs.d/init/ycp-markup.el
+++ b/emacs/.emacs.d/init/ycp-markup.el
@@ -70,7 +70,9 @@
;; mediawiki
(my-package mediawiki)
-(my-package wiki)
+(my-package wiki
+ (my-keybind wiki-mode-map
+ "C-'" #'my-wiki-grok-wikipedia))
(my-package ledger-mode
(:install t)
diff --git a/emacs/.emacs.d/lisp/my/link-gopher.el b/emacs/.emacs.d/lisp/my/link-gopher.el
index cf8b47a..11bb75d 100644
--- a/emacs/.emacs.d/lisp/my/link-gopher.el
+++ b/emacs/.emacs.d/lisp/my/link-gopher.el
@@ -106,7 +106,7 @@ removing frags
(defun http-s-media-links-in-buffer ()
(http-s-links-in-buffer
- "\\.\\(jpg\\|png\\|gif\\|webp\\|mp4\\|flv\\|mkv\\|mov\\|webm\\|ogv\\|avi\\|rmvb\\|mp3\\|ogg\\|opus\\|pdf\\|docx\\|epub\\)$"))
+ "\\.\\(jpeg\\|jpg\\|png\\|gif\\|webp\\|mp4\\|flv\\|mkv\\|mov\\|webm\\|ogv\\|avi\\|rmvb\\|mp3\\|ogg\\|opus\\|pdf\\|docx\\|epub\\)$"))
(provide 'link-gopher)
;;; link-gopher.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-wikipedia.el b/emacs/.emacs.d/lisp/my/my-wikipedia.el
index f2a4365..af954bf 100644
--- a/emacs/.emacs.d/lisp/my/my-wikipedia.el
+++ b/emacs/.emacs.d/lisp/my/my-wikipedia.el
@@ -31,6 +31,7 @@
(require 'my-markup)
(require 'my-net)
(require 'my-mediawiki)
+(require 'wiki)
;; TODO: much of these can be generalised to any mediawiki site
(defvar my-wikipedia-lang "en")
@@ -46,6 +47,15 @@
(libxml-parse-html-region (point-min) (point-max))))
(append (my-grok-wikipedia-html html url) results))))
+(defun my-wiki-grok-wikipedia ()
+ "groks current wiki-mode buffer if the site is wikipedia."
+ (interactive)
+ (unless (and (derived-mode-p 'wiki-mode)
+ (string-prefix-p "wikipedia" (format "%s" wiki-site)))
+ (error "Not in wiki mode or wikipedia."))
+ (my-org-grok
+ (wiki-current-html-url)))
+
(defun my-grok-wikipedia-get-imdb-rating ()
(when (re-search-forward
"\\(https://\\(www\\.\\)?imdb.com/title/tt[0-9]+/\\)" nil t)
@@ -53,9 +63,9 @@
(with-current-buffer (url-retrieve-synchronously
(concat url "ratings"))
(goto-char (point-min))
- (when
+ (when
(re-search-forward
- "\\([0-9,]+\\)\\s-*IMDb.*?\\([0-9\\.]+\\) / 10" nil t)
+ "\\([0-9,]+\\)\\s-*IMDb.*?\\([0-9\\.]+\\) / 10" nil t)
(list (cons "IMDB-link" url)
(cons "IMDB-rating" (match-string 2))
(cons "IMDB-rated-by" (match-string 1))))))))