Skip to content

Commit

Permalink
emacs-w3m setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Bin committed May 15, 2024
1 parent 143237b commit 744634e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
(require-init 'init-dictionary t)
(require-init 'init-emms t)

(require-init 'init-emacs-w3m t)
(require-init 'init-browser t)
(require-init 'init-shackle t)
(require-init 'init-dired t)
Expand Down
41 changes: 41 additions & 0 deletions lisp/init-emacs-w3m.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
;; -*- coding: utf-8; lexical-binding: t; -*-

(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
;; emacs-w3m will test the ImageMagick support for png32
;; and create files named "png32:-" everywhere
w3m-imagick-convert-program nil
w3m-terminal-coding-system 'utf-8
w3m-use-cookies t
w3m-cookie-accept-bad-cookies t
w3m-home-page "https://www.duckduckgo.com"
w3m-command-arguments '("-F" "-cookie")
w3m-mailto-url-function 'compose-mail
browse-url-browser-function 'w3m
;; use shr to view html mail which is dependent on libxml
;; I prefer w3m. That's emacs 24.3+ default setup.
;; If you prefer colored mail body and other advanced features,
;; you can either comment out below line and let Emacs decide the
;; best html mail rendering engine, or "(setq mm-text-html-renderer 'shr)"
;; in "~/.gnus.el"
;; mm-text-html-renderer 'w3m ; I prefer w3m
w3m-use-toolbar t
;; show images in the browser
;; setq w3m-default-display-inline-images t
;; w3m-use-tab nil
w3m-confirm-leaving-secure-page nil
w3m-search-default-engine "g"
w3m-key-binding 'info)

(defun my-w3m-mode-hook-setup ()
"Set up w3m."
(w3m-lnum-mode 1)
(local-set-key (kbd "w") #'mybigword-big-words-in-current-window)
(local-set-key (kbd ";") #'w3m-lnum-follow))
(add-hook 'w3m-mode-hook 'my-w3m-mode-hook-setup)

(provide 'init-emacs-w3m)
;;; init-emacs-w3m.el ends here
3 changes: 2 additions & 1 deletion lisp/init-linum-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
vc-git-log-edit-mode
log-edit-mode
term-mode
w3m-mode
speedbar-mode
gnus-summary-mode
gnus-article-mode
Expand All @@ -50,7 +51,7 @@
(unless (or (memq major-mode my-linum-inhibit-modes)
;; don't show line number for certain file extensions
(my-should-use-minimum-resource))
(my-run-with-idle-timer 1 #'display-line-numbers-mode)))
(my-run-with-idle-timer 0.5 #'display-line-numbers-mode)))

(add-hook 'prog-mode-hook #'my-setup-line-number-mode)
;; (add-hook 'text-mode-hook #'my-setup-line-number-mode)
Expand Down

0 comments on commit 744634e

Please sign in to comment.