Main / Emacs / Emacs-w3m

<< Gnus | Emacs-w3m | Emacs-muse >>

Updated: 2007-08-28-09:53:42
Muse File: /emacs/w3m.muse Δ

Emacs-W3m简介

  Emacs-W3m 是 Emacs 下的 W3m 的 interface ( 接口 or 界面 ),虽然功能上

比不上IE,FireFox,但因为简单,所以,用来阅读HTML文档,清爽的效果很棒。操作也

非常简单,下面是安装步骤。

 

  下载w3m程序,我是从cygwin里提取出来的,正常运行需要6个文件当然如果你的是

Linux就没这么麻烦,装上w3m的包就可以了

 w3m.exe
 cygintl-3.dll
 cygwin1.dll
 cygssl-0.9.7.dll
 cygcrypto-0.9.7.dll
 dirlist.cgi

 

  我将他们都拷贝到~/bin目录下,在终端下运行w3m出现了乱码,解决办法是添加环境变量

 LANG = zh_CN

 

  添加代码到 $HOME/.emacs

;;网页浏览
(setq load-path (cons "~/../site-lisp/emacs-w3m" load-path))
(require 'w3m-load)
;;(setq exec-path (cons "~/bin" exec-path))
(setq w3m-command (concat "w3m.exe" ""))
(setq w3m-browse-url (concat "w3m.exe" ""))
(setq w3m-find-file (concat "w3m.exe" ""))
(setq browse-url-browser-function 'w3m-browse-url)
;(setq w3m-local-find-file-function nil)
;;; Allow browsing of local files:
(setq w3m-dirlist-cgi-program "~/../bin/w3m/dirlist.cgi")
;;; causes the return key to submit a form
(setq w3m-use-form t)
(setq w3m-use-mule-ucs t)
(setq w3m-use-toolbar t)
(setq w3m-use-cookies t)
(setq w3m-display-inline-image t)
;;_+ 设置后满眼都是乱码
;; (setq w3m-bookmark-file-coding-system 'chinese-iso-8bit)
;; (setq w3m-coding-system 'chinese-iso-8bit)
;; (setq w3m-default-coding-system 'chinese-iso-8bit)
;; (setq w3m-file-coding-system 'chinese-iso-8bit)
;; (setq w3m-file-name-coding-system 'chinese-iso-8bit)
;; (setq w3m-terminal-coding-system 'chinese-iso-8bit)
;; (setq w3m-input-coding-system 'chinese-iso-8bit)
;; (setq w3m-output-coding-system 'chinese-iso-8bit)
(setq w3m-tab-width 4)
(setq w3m-fill-column 120);;设置浏览窗的宽度,1024*768的就用这个设置吧
(setq w3m-home-page "~/index.html")
(setq w3m-view-this-url-new-session-in-background t)
;(require 'mime-w3m) 不知道怎么用,包含就出错,抄来的
(add-hook 'w3m-fontify-after-hook 'remove-w3m-output-garbages)
(defun remove-w3m-output-garbages ()
      (interactive)
      (let ((buffer-read-only))
        (setf (point) (point-min))
        (while (re-search-forward "[\200-\240]" nil t)
          (replace-match " "))
        (set-buffer-multibyte t))
      (set-buffer-modified-p nil))

 

  M-x w3m[RET]看看,如果你打开tool-bar的话,上面还有一些方便的按钮,让喜欢鼠标操作的用户也能习惯