Skip to content

Commit 744634e

Browse files
author
Chen Bin
committed
emacs-w3m setup
1 parent 143237b commit 744634e

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

init.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
(require-init 'init-dictionary t)
133133
(require-init 'init-emms t)
134134

135+
(require-init 'init-emacs-w3m t)
135136
(require-init 'init-browser t)
136137
(require-init 'init-shackle t)
137138
(require-init 'init-dired t)

lisp/init-emacs-w3m.el

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
;; -*- coding: utf-8; lexical-binding: t; -*-
2+
3+
(setq w3m-coding-system 'utf-8
4+
w3m-file-coding-system 'utf-8
5+
w3m-file-name-coding-system 'utf-8
6+
w3m-input-coding-system 'utf-8
7+
w3m-output-coding-system 'utf-8
8+
;; emacs-w3m will test the ImageMagick support for png32
9+
;; and create files named "png32:-" everywhere
10+
w3m-imagick-convert-program nil
11+
w3m-terminal-coding-system 'utf-8
12+
w3m-use-cookies t
13+
w3m-cookie-accept-bad-cookies t
14+
w3m-home-page "https://www.duckduckgo.com"
15+
w3m-command-arguments '("-F" "-cookie")
16+
w3m-mailto-url-function 'compose-mail
17+
browse-url-browser-function 'w3m
18+
;; use shr to view html mail which is dependent on libxml
19+
;; I prefer w3m. That's emacs 24.3+ default setup.
20+
;; If you prefer colored mail body and other advanced features,
21+
;; you can either comment out below line and let Emacs decide the
22+
;; best html mail rendering engine, or "(setq mm-text-html-renderer 'shr)"
23+
;; in "~/.gnus.el"
24+
;; mm-text-html-renderer 'w3m ; I prefer w3m
25+
w3m-use-toolbar t
26+
;; show images in the browser
27+
;; setq w3m-default-display-inline-images t
28+
;; w3m-use-tab nil
29+
w3m-confirm-leaving-secure-page nil
30+
w3m-search-default-engine "g"
31+
w3m-key-binding 'info)
32+
33+
(defun my-w3m-mode-hook-setup ()
34+
"Set up w3m."
35+
(w3m-lnum-mode 1)
36+
(local-set-key (kbd "w") #'mybigword-big-words-in-current-window)
37+
(local-set-key (kbd ";") #'w3m-lnum-follow))
38+
(add-hook 'w3m-mode-hook 'my-w3m-mode-hook-setup)
39+
40+
(provide 'init-emacs-w3m)
41+
;;; init-emacs-w3m.el ends here

lisp/init-linum-mode.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
vc-git-log-edit-mode
3939
log-edit-mode
4040
term-mode
41+
w3m-mode
4142
speedbar-mode
4243
gnus-summary-mode
4344
gnus-article-mode
@@ -50,7 +51,7 @@
5051
(unless (or (memq major-mode my-linum-inhibit-modes)
5152
;; don't show line number for certain file extensions
5253
(my-should-use-minimum-resource))
53-
(my-run-with-idle-timer 1 #'display-line-numbers-mode)))
54+
(my-run-with-idle-timer 0.5 #'display-line-numbers-mode)))
5455

5556
(add-hook 'prog-mode-hook #'my-setup-line-number-mode)
5657
;; (add-hook 'text-mode-hook #'my-setup-line-number-mode)

0 commit comments

Comments
 (0)