Skip to content

Instantly share code, notes, and snippets.

@codeout
Created May 17, 2013 15:02
Show Gist options
  • Save codeout/5599644 to your computer and use it in GitHub Desktop.
Save codeout/5599644 to your computer and use it in GitHub Desktop.
w3m configuration for Eijiro lookup (M-x eijiro)
(defadvice w3m-header-arguments (around alc activate)
"If URL matches with \"alc.co.jp\", modify w3m-user-agent tentatively"
(if (string-match "alc.co.jp" url)
(let ((w3m-user-agent
"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"))
ad-do-it)
ad-do-it))
(eval-after-load "w3m-search"
'(add-to-list
'w3m-search-engine-alist
'("eijiro" "http://eow.alc.co.jp/%s/UTF-8/" utf-8)))
(eval-after-load "w3m-filter"
'(progn
(setq w3m-use-filter t)
(defun w3m-filter-alc (url)
(w3m-filter-delete-regions url "<!-- interest_match_relevant_zone_start -->" "<!-- ▲ 英辞郎ヘッダ ▲ -->"))
(add-to-list 'w3m-filter-rules '("\\`http://eow\.alc\.co\.jp/[^/]+/UTF-8" w3m-filter-alc))))
(defun eijiro ()
"\"C-u M-x w3m-search ejr\" is annoying ..."
(require 'w3m-search)
(require 'w3m-filter) (interactive)
(let ((w3m-search-default-engine "eijiro")) (call-interactively 'w3m-search)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment