Skip to content

Latest commit

 

History

History
131 lines (110 loc) · 4.52 KB

starter-kit-browser.org

File metadata and controls

131 lines (110 loc) · 4.52 KB

Starter Kit Browser

Starter Kit Browser

w3m

w3m is a text-based web browser as well as a pager like `more’ or `less’. With w3m you can browse web pages through a terminal emulator window (xterm, rxvt or something like that). Moreover, w3m can be used as a text formatting tool which typesets HTML into plain text.

Basic configuration

(setq w3m-command "w3m"
      browse-url-browser-function 'w3m-browse-url
      w3m-use-cookies t
      w3m-cookie-accept-bad-cookies t
      w3m-default-display-inline-images t
      w3m-command-arguments '("-F" "-cookie")
      w3m-home-page "https://www.google.com.hk"
      w3m-default-save-directory "~/.w3m/download"
      w3m-bookmark-file (concat starter-kit-dir ".w3m-bookmarks.html"))
(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
      w3m-terminal-coding-system 'utf-8)
(eval-after-load "w3m-search"
  `(progn
     (add-to-list 'w3m-search-engine-alist
                  '("DuckDuck Go" "http://www.duckduckgo.com/?q=%s" utf-8))
     (add-to-list 'w3m-search-engine-alist
                  '("dictionary" "http://dictionary.reference.com/search?q=%s" utf-8))
     (add-to-list 'w3m-search-engine-alist
                  '("youdao" "http://dict.youdao.com/search?q=%s" utf-8))
     (add-to-list 'w3m-search-engine-alist
                  '("Stack Overflow" "https://stackoverflow.com/search?q=%s" utf-8))
     (add-to-list 'w3m-search-engine-alist
                  '("Bing" "http://www.bing.com/search?q=%s" utf-8))
     (setq w3m-search-default-engine "yahoo")))

Rename w3m buffer name to favor helm-mini

(add-hook 'w3m-display-hook
          (lambda (url)
            (rename-buffer
             (format "*w3m: %s*"
                     (or w3m-current-title
                         w3m-current-url))
             t)))

Key bindings

(global-set-key (kbd "C-c S") 'w3m-search)
(eval-after-load "w3m"
  `(progn
     (define-key w3m-mode-map (kbd "<") 'beginning-of-buffer)
     (define-key w3m-mode-map (kbd "S") 'w3m-search-new-session)
     (define-key w3m-mode-map (kbd ">") 'end-of-buffer)
     (define-key w3m-mode-map (kbd "o") 'w3m-view-this-url-new-session)
     (define-key w3m-mode-map (kbd "w") (lambda ()
                                          (interactive)
                                          (if (w3m-anchor)
                                              (w3m-print-this-url)
                                            (w3m-print-current-url))))))

How to install

  • Install mew, apel and flim from melpa.
  • Install w3m form melpa.
  • Error during compilation for lack of Mule-UCS. Don’t care it, Mule-UCS is obsolete.

Usage

  • To copy url as kill: w3m-print-current-url or w3m-print-this-url.

Select search engine

call w3m-search with a prefix.

w3m cannot retrieve url

w3m-reload-this-page or type R.

Use google search

  • C-u w3m-search
  • select google engine
  • search something and see it fail
  • w to print current url
  • goto Free Proxy Server for sites and enter url into the form
  • use C-c C-c to send to form

eww

Key bindings

(eval-after-load "eww"
  `(progn
     (define-key eww-mode-map "B" 'eww-back-url)
     (define-key eww-mode-map "b" 'scroll-down-command)
     (define-key eww-mode-map "j" 'next-line)
     (define-key eww-mode-map "k" 'previous-line)
     (define-key eww-mode-map (kbd "<") 'beginning-of-buffer)
     (define-key eww-mode-map (kbd ">") 'end-of-buffer)
     (define-key eww-mode-map "R" 'eww-reload)))

Multiple eww

Just rename current eww buffer and eww will open new url in other eww buffer.

EWW use google search

The default earch engine of EWW is DuckDuckGo, to use google search, add to your ~/.emacs and use helm-google-suggest-url to enter key words.[fn:1]

(setq browse-url-browser-function 'eww-browse-url)

Footnotes

[fn:1] From emacs (org-mode/helm-google) open links in eww? - Stack Overflow