日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

emacs-w3m查看html帮助手册

發布時間:2023/12/13 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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,查找非常方便:


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


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

總結

以上是生活随笔為你收集整理的emacs-w3m查看html帮助手册的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。