emacs-w3m查看html幫助手冊

<?xml version="1.0" encoding="utf-8"?> emacs-w3m查看html幫助手冊

emacs-w3m查看html幫助手冊

Table of Contents

  • 1. 使用效果
  • 2. 為什么要用emacs-w3m來查看html的幫助手冊?
  • 3. 什么是w3m?
  • 4. 配置
  • 5. 額外資源

1 使用效果

使用快捷鍵C-c C-j之后,打開如圖所示的輸入界面,可以用 正則表達式 搜索想要的API,查找非常方便:

screenshot_2016-12-31_10-43-19.png

用emacs-w3m打開html文件的效果如圖:

screenshot_2016-12-31_10-44-05.png

2 為什么要用emacs-w3m來查看html的幫助手冊?

  • 每次打開firefox,要等待較長時間,只為查看一個API的用法,感覺不爽。
  • 直接用emacs將html文件當作文本文件打開,一堆的tags不方便看。
  • 用瀏覽器搜索命令不夠方便,不如emacs的正則表達式來的帶勁。
  • 就是喜歡在emacs中做所有的事,這一條就夠了。

3 什么是w3m?

http://blog.csdn.net/superwengo/article/details/8241601

4 配置

;;; init-emacs-w3m.el --- Summary
;;; Commentary:
;; comments;;; Code:
(use-package w3m:commands (w3m):config;; (require 'w3m-load)(setq w3m-coding-system 'utf-8w3m-file-coding-system 'utf-8w3m-file-name-coding-system 'utf-8w3m-input-coding-system 'utf-8w3m-output-coding-system 'utf-8w3m-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 (expand-file-name "html/home.html" unimacs-tempfiles-dir))(concat "file://" (expand-file-name "html/home.html" unimacs-tempfiles-dir))"http://www.baidu.com"));; set proxy(defun toggle-env-http-proxy ()"set/unset the environment variable http_proxy which w3m uses"(interactive)(let ((proxy "http://proxynj.huawei.com:8080"))(if (string= (getenv "http_proxy") proxy);; clear the the proxy(progn(setenv "http_proxy" "")(message "env http_proxy is empty now"));; set the proxy(progn(setenv "http_proxy" proxy)(message "env http_proxy is %s now" proxy)))))(setq w3m-use-toolbar tw3m-key-binding 'info);; show images in the browser;; (setq w3m-default-display-inline-images t);; (setq w3m-default-toggle-inline-images t)(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)(setq w3m-search-default-engine "b")(eval-after-load "w3m-search"'(progn;; C-u S g RET <search term> RET(add-to-list 'w3m-search-engine-alist '("b" "http://www.baidu.com/search?hl=en&q=%s" utf-8))(add-to-list 'w3m-search-engine-alist '("g" "http://www.google.com.au/search?hl=en&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://code.ohloh.net/search?s=%s&browser=Default"  utf-8))(add-to-list 'w3m-search-engine-alist '("bl" "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))(add-to-list 'w3m-search-engine-alist '("j" "http://www.google.com.au/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&btnI=1&q=%s+site:developer.mozilla.org" utf-8))))(setq w3m-command-arguments       '("-F" "-cookie")w3m-mailto-url-function     'compose-mailbrowse-url-browser-function 'w3mmm-text-html-renderer       'w3m);; bind this function to ‘a’, which is the normal w3m bookmark binding:(eval-after-load "w3m" '(progn(w3m-lnum-mode 1)));; external browser(setq browse-url-generic-program(cond(*is-a-mac* "open")(*linux* (executable-find "firefox"))))(setq browse-url-browser-function 'browse-url-generic);; use external browser to search programming stuff(defun w3mext-hacker-search ()"search word under cursor in google code search and stackoverflow.com"(interactive)(require 'w3m)(let ((keyword (w3m-url-encode-string (thing-at-point 'symbol))));; google(browse-url-generic(concat "http://www.google.com.au/search?hl=en&q=%22"keyword"%22"(if buffer-file-name(concat "+filetype%3A" (file-name-extension buffer-file-name))"")  ))(browse-url-generic(concat "http://www.google.com.au/search?hl=en&q="keyword"+site:stackoverflow.com" ));; koders.com(browse-url-generic(concat "http://code.ohloh.net/search?s=\""keyword"\"&browser=Default&mp=1&ml=1&me=1&md=1&filterChecked=true" ))))(defun w3mext-open-link-or-image-or-url ()"Opens the current link or image or current page's uri or any url-like text under cursor in firefox."(interactive)(let (url)(if (or (string= major-mode "w3m-mode") (string= major-mode "gnus-article-mode"))(setq url (or (w3m-anchor) (w3m-image) w3m-current-url)))(browse-url-generic (if url url (car (browse-url-interactive-arg "URL: "))))))(global-set-key (kbd "C-c b") 'w3mext-open-link-or-image-or-url)(defun w3mext-search-js-api-mdn ()"search current symbol under cursor in Mozilla Developer Network (MDN)"(interactive)(let ((keyword (thing-at-point 'symbol)))(w3m-search "j" keyword)))(add-hook 'prog-mode-hook '( lambda () (local-set-key (kbd "C-c ; h") 'w3mext-hacker-search)));; Find in blog.;; @see: http://blog.csdn.net/superwen_go/article/details/8241601(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)))(provide 'init-emacs-w3m)
;;; init-emacs-w3m.el ends here

5 額外資源

如果找不到w3m的執行程序,可以在我的github上面下載,這個是最新版的:
https://github.com/yangwen0228/unimacs/tree/master/utils/extra-bins/msys64

也可以下載我的配置,或者使用其中的部分配置,配置文件放置在 personal/configures中。

Date: 2016-12-31 10:38

Created: 2017-03-11 周六 21:53

Emacs 26.0.50.4 (Org mode 8.2.10)

Validate

轉載于:https://www.cnblogs.com/yangwen0228/p/4269923.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/259403.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/259403.shtml
英文地址,請注明出處:http://en.pswp.cn/news/259403.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

c語言生命游戲代碼大全,c++生命游戲源碼

該樓層疑似違規已被系統折疊 隱藏此樓查看此樓glViewport( 0, 0, width, height );glMatrixMode( GL_PROJECTION );glLoadIdentity( );}//程序入口int main(int argc, char *argv[]){//隨機生成細胞的狀態MapRand();std::cout<//SDL初始化const SDL_VideoInfo* info NULL;i…

初學React,setState后獲取到的thisstate沒變,還是初始state?

問題&#xff1a;(javascript)初學React&#xff0c;setState后獲取到的thisstate沒變&#xff0c;還是初始state&#xff1f;描述: getInitialState(){return {data:[]};},componentDidMount(){var data [ { author: "Pete Hunt", text: "This is one comment…

sizeof(數組名)和sizeof(指針)

轉載&#xff1a;http://blog.csdn.net/kangroger/article/details/20653255 在做這道題時&#xff1a; 32位環境下&#xff0c;int *pnew int[10];請問sizeof(p)的值為&#xff08;&#xff09; A、4 B、10 C、40 D、8 我以為正確答…

工作中的問題

今天寫一專題頁面&#xff0c;寫出的結果在各個瀏覽器下都不同&#xff0c;心情不好。。。 就是紅線的地方老對不齊。。。 在朋友指導下改了下樣式好了 右邊代碼結構 1 <div class"fr Img"> 2 <h3>相關專題</h3> 3 <a href"#"…

數組的sizeof

轉載&#xff1a;http://blog.163.com/chen_xinghuan/blog/static/17220158220112182838196/ 數組的sizeof值等于數組所占用的內存字節數&#xff0c;如&#xff1a;   char a1[] “abc”;   int a2[3];   sizeof( a1 ); // 結果為4&#xff0c;字符 末尾還存在一個…

數據結構行編輯成簇 c語言,索引的數據結構及底層存儲

索引是幫助數據庫高效獲取數據的數據結構索引的數據結構1.hash表a.利用hash存儲的話需要將所有的數據文件添加到內存&#xff0c;比較耗費內存空間b.hash表存儲的是無序數據&#xff0c;范圍查找的時候需要挨個進行遍歷&#xff0c;比較耗費時間。2.二叉樹二叉樹規定左子樹必須…

卓同學的 Swift 面試題

我覺得應該掌握的知識點&#xff0c;沒有實際意義。 class 和 struct 的區別不通過繼承&#xff0c;代碼復用&#xff08;共享&#xff09;的方式有哪些Set 獨有的方法有哪些&#xff1f;實現一個 min 函數&#xff0c;返回兩個元素較小的元素map、filter、reduce 的作用map 與…

使用CImage雙緩沖

一普通顯示&#xff1a;現在的VC顯示圖片非常方便&#xff0c;遠不是VC6.0那個年代的技術可比&#xff0c;而且支持多種格式的如JPG&#xff0c;PNG。 CImage _img; 初始化&#xff1a; _img.Load(L"map.png"); 顯示&#xff1a;OnPaint事件中 CRect rect; this…

匯編語言學習系列 for循環實現

假如匯編語言要實現如下C語言的功能&#xff0c;編譯環境Ubuntu14.04&#xff08;32位&#xff09;。 #include<stdio.h> int fact_for(int n) {int i;int result 1;for(i 2; i < n; i)result * i;return result; }int main(){printf("%d\n", fact_for(3)…

川大錦城c語言期末考試答案,四川大學《計算機組成原理》2018期末考試B卷答案及評分標準.doc...

四川大學期末考試試題(閉卷)答案及評分標準(2017——2018學年第 2 學期) B卷課程號&#xff1a;304036030 課程名稱&#xff1a;計算機組成原理填空題(本大題共15空&#xff0c;每空2分&#xff0c;共30分)在評價計算機性能時用 響應時間 表示計算機完成某任務所需時間;用 吞吐…

2014屆華為校園招聘機試題2

第一題、輸入一個正整數&#xff0c;并編碼為字符串進行輸出 描述: 1、輸入一個正整數&#xff0c;并編碼為字符串進行輸出。 編碼規則為&#xff1a;數字0-9分別編碼為字符a-j 2、輸入肯定是正整數&#xff0c;不用做錯誤較驗 運行時間限制: 無限制 內存限制: 無限制 輸…

圖解phpstorm常用快捷鍵

查詢快捷鍵 CTRLN 查找類 CTRLSHIFTN 全局搜索文件 ,優先文件名匹配的文件 CTRLSHIFTALTN 查找php類名/變量名 ,js方法名/變量名, css 選擇器 CIRLB 找變量的來源&#xff0c;跳到變量申明處 (CTRL 鼠標單擊 也可以) CTRLALTB 找到繼承該接口或者父級 的所有子類, 統計所有子類…

The C Programming Language--可變參數的函數

函數 printf的正確聲明形式為&#xff1a;int printf(char *fmt, ...) void va_start (va list ap, last-required) type va_arg (va list ap, type) void va_end (va list ap) 其中&#xff0c;省略號表示參數表中參數的數量和類型是可變的。 va_list 類型用于聲明一個變量&am…

二分查找法的循環與遞歸實現及時間復雜度分析

轉載&#xff1a;http://baike.baidu.com/link?url3aEK-qcVbYi6ioJOsf-dFmvFQ6WQgzTwnE9JkmlHBc88qk-D00SambfrSl3hVh_UyqyxF8QEUosfq20IQQW5z_ 和http://hi.baidu.com/networkor/item/80d817f8331d8e08a7298834 設數組為整數數組&#xff0c;從小到大排序。二分法強調一定是…

cifar10 c語言,Python3讀取深度學習CIFAR-10數據集出現的若干問題解決

今天在看網上的視頻學習深度學習的時候&#xff0c;用到了CIFAR-10數據集。當我興高采烈的運行代碼時&#xff0c;卻發現了一些錯誤&#xff1a;# -*- coding: utf-8 -*-import pickle as pimport numpy as np import os def load_CIFAR_batch(filename): """ 載…

Java程序性能優化

一、避免在循環條件中使用復雜表達式 在不做編譯優化的情況下&#xff0c;在循環中&#xff0c;循環條件會被反復計算&#xff0c;如果不使用復雜表達式&#xff0c;而使循環條件值不變的話&#xff0c;程序將會運行的更快。 例子&#xff1a; import java.util.vector; class …

asp.net表單提交方法:GET\POST介紹

表單form的提交有兩種方式&#xff0c;一種是get的方法&#xff0c;一種是post 的方法&#xff0c;如果沒有特殊指定&#xff0c;默認為post。看下面代碼,理解ASP.NET Get和Post兩種提交的區別: 1.< form id"form1" method"get" runat"server"…

各種排序算法總結

轉載&#xff1a;http://blog.csdn.net/warringah1/article/details/8951220 明天就要去參加阿里巴巴的實習生筆試了&#xff0c;雖然沒想著能進去&#xff0c;但是態度還是要端正的&#xff0c;也沒什么可以準備的&#xff0c;復習復習排序吧。 1 插入排序 void InsertSort(in…

CentOS7 上安裝 Zookeeper-3.4.9 服務

在 CentOS7 上安裝 zookeeper-3.4.9 服務1、創建 /usr/local/services/zookeeper 文件夾&#xff1a; mkdir -p /usr/local/services/zookeeper 2、進入到 /usr/local/services/zookeeper 目錄中&#xff1a; cd /usr/local/services/zookeeper 3、下載 zookeeper-3.4.9.…

c語言在程序中顯示現在星期幾,C語言程序設計: 輸入年月日 然后輸出是星期幾...

該樓層疑似違規已被系統折疊 隱藏此樓查看此樓#include main(){int year,month,day0,a,b,week,c,i,sum0,days,d;printf("please input year,month,days\n");scanf("%d,%d,%d",&year,&month,&days);for(i1;i{if (year%40){if(year%1000){if (ye…