-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdka-w3m-wiki.el
50 lines (48 loc) · 2.11 KB
/
dka-w3m-wiki.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;;;
;;; w3m wiki stuff.;
;;
(makunbound 'dka-w3m-wikis)
(defvar dka-w3m-wikis
'(
("aw" "https://wiki.archlinux.org/index.php?search=")
("aur" "https://aur.archlinux.org/packages?O=0&SB=v&SO=d&K=" "")
("aurn" "https://aur.archlinux.org/packages?O=0&SeB=n&SB=v&SO=d&K=" "")
("b" "http://cn.bing.com/search?q=" "")
("d" "https://hub.docker.com/search/?q=" "")
("deb" "http://wiki.debian.net/" "")
("e" "http://www.emacswiki.org/cgi-bin/wiki.pl?" "RecentChanges")
("g" "https://www.google.com/search?q=" "")
("gk" "https://www.google.com.hk/search?q=" "")
("h" "https://github.com/search?o=desc&s=stars&utf8=%E2%9C%93&q=")
("lathi" "http://www.lathi.net/twiki-bin/view/Main/" "WebHome")
("lathi" "http://www.lathi.net/twiki-bin/view/Main/" "WebHome")
("n" "https://www.npmjs.com/search?q=" "")
("np" "https://www.npmjs.com/package/" "")
("p" "https://pypi.org/search/?q=" "")
("py" "https://pypi.org/project/" "")
("gs" "https://rubygems.org/search?utf8=%E2%9C%93&query=" "")
("gm" "https://rubygems.org/gems/" "")
("gp" "https://pkg.go.dev/search?q=" "")
("rfc" "https://tools.ietf.org/html/rfc" "/index")
("tk" "http://www.torrentkitty.me/search/%s/" "")
("u" "https://ubuntu.com/search?q=" "")
("w" "https://en.wikipedia.org/w/index.php?search=" "")
("wm" "https://en.m.wikipedia.org/w/index.php?search=" "")
))
(defun dka-w3m-goto-wiki ()
(interactive)
(let ((wiki-topic (read-from-minibuffer "Wiki:Topic? "))
topic wiki wiki-list)
(message wiki-topic)
(if (string-match "\\([^/]*\\)/\\(.*\\)" wiki-topic)
(setq wiki (match-string 1 wiki-topic)
topic (match-string 2 wiki-topic)
wiki-list (assoc wiki dka-w3m-wikis))
(error "Must specify a wiki name and topic (Wiki:TopicName)"))
(unless wiki-list
(error (format "\"%s\" is not a defined wiki" wiki)))
(unless topic
(setq topic (nth 2 wiki-list)))
(w3m-goto-url (if (string-match "%s" (nth 1 wiki-list))
(format (nth 1 wiki-list) (w3m-url-encode-string topic))
(concat (nth 1 wiki-list) (w3m-url-encode-string topic))))))