Chinaunix首页 | 论坛 | 博客
  • 博客访问: 892041
  • 博文数量: 113
  • 博客积分: 3160
  • 博客等级: 少校
  • 技术积分: 1801
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-19 10:09
文章分类

全部博文(113)

分类: LINUX

2012-06-19 17:32:11



二:编辑emacs-w3m的lisp代码



要想使emacs中的w3m顺利的工作,相应的lisp代码是必不可少的,这有点像硬件的驱动程序。。。。

下面是我的~/.emacs中关于emacs-w3m部分。


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;  设置emacs-w3m浏览器
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(add-to-list 'load-path "~/emacs-w3m/")
(require 'w3m-load)
(require 'mime-w3m)
(autoload 'w3m "w3m" "interface for w3m on emacs" t) 

;; 设置w3m主页
(setq w3m-home-page "")

;; 默认显示图片
(setq w3m-default-display-inline-images t)
(setq w3m-default-toggle-inline-images t)

;; 使用cookies
(setq w3m-use-cookies t)

;;设定w3m运行的参数,分别为使用cookie和使用框架  
(setq w3m-command-arguments '("-cookie" "-F"))               

;; 使用w3m作为默认浏览器
(setq browse-url-browser-function 'w3m-browse-url)                
(setq w3m-view-this-url-new-session-in-background t)


;;显示图标                                                      
(setq w3m-show-graphic-icons-in-header-line t)                  
(setq w3m-show-graphic-icons-in-mode-line t) 

;;C-c C-p 打开,这个好用                                        
(setq w3m-view-this-url-new-session-in-background t)  

          
(add-hook 'w3m-fontify-after-hook 'remove-w3m-output-garbages)                                    
(defun remove-w3m-output-garbages ()                            
"去掉w3m输出的垃圾."                                            
(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))




问题:

由于w3m-el和emacs23并不能充分匹配,有的时候会出现中文乱码问题。这个时候你需要卸载w3m-el包,同时安装w3m-el-snapshot包。

命令如下:

sudo apt-get remove w3m-el
sudo apt-get install w3m-el-snapshot



阅读(4092) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~