/
init-emacs-w3m.el
59 lines (53 loc) · 2.94 KB
/
init-emacs-w3m.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
51
52
53
54
55
56
57
58
59
(require 'w3m-load)
(setq w3m-coding-system 'utf-8
w3m-file-coding-system 'utf-8
w3m-file-name-coding-system 'utf-8
w3m-input-coding-system 'utf-8
w3m-output-coding-system 'utf-8
w3m-terminal-coding-system 'utf-8)
(setq w3m-use-cookies t)
(setq w3m-cookie-accept-bad-cookies t)
(setq w3m-home-page
(if (file-readable-p "~/html/home.html")
(concat "file://" (expand-file-name "~/html/home.html"))
"http://www.google.com.au"))
(setq w3m-use-toolbar t
;w3m-use-tab nil
w3m-key-binding 'info
)
(setq w3m-search-default-engine "g")
(eval-after-load "w3m-search" '(progn
; C-u S g RET <search term> RET
(add-to-list 'w3m-search-engine-alist '("g"
"http://www.google.com.au/search?hl=zh-CN&q=%s" utf-8))
(add-to-list 'w3m-search-engine-alist '("wz"
"http://zh.wikipedia.org/wiki/Special:Search?search=%s" utf-8))
(add-to-list 'w3m-search-engine-alist '("q"
"http://www.google.com.au/search?hl=en&q=%s+site:stackoverflow.com" utf-8))
(add-to-list 'w3m-search-engine-alist '("s"
"http://www.google.com.au/codesearch?q=%s" utf-8))
(add-to-list 'w3m-search-engine-alist '("b"
"http://blogsearch.google.com.au/blogsearch?q=%s" utf-8))
(add-to-list 'w3m-search-engine-alist '("w"
"http://en.wikipedia.org/wiki/Special:Search?search=%s" utf-8))
(add-to-list 'w3m-search-engine-alist '("d"
"http://dictionary.reference.com/search?q=%s" utf-8))
))
(setq w3m-command-arguments '("-F" "-cookie")
w3m-mailto-url-function 'compose-mail
browse-url-browser-function 'w3m
mm-text-html-renderer 'w3m)
(defun ted-delicious-url ()
"Bookmark this page with del.icio.us."
(interactive)
(w3m-goto-url
(concat "http://del.icio.us/redguardtoo?"
"url=" (w3m-url-encode-string w3m-current-url)
"&title=" (w3m-url-encode-string w3m-current-title))))
;bind this function to ‘a’, which is the normal w3m bookmark binding:
(eval-after-load "w3m" '(progn
(define-key w3m-info-like-map "A" 'ted-delicious-url)))
(require 'w3m-lnum)
(autoload 'w3m-link-numbering-mode "w3m-lnum" nil t)
(add-hook 'w3m-mode-hook 'w3m-link-numbering-mode)
(provide 'init-emacs-w3m)