fnwiya's quine

自分自身を出力するブログ

eww使ってみた

emacs組み込みのテキストブラウザeww
ちょっとググるだけならいちいちウィンドウを切り替えるのも面倒なのでありかなと思って導入してみました。
自分の場合はブラウザを完全に捨て去るつもりはないので設定は軽めです。

ace-linkを使うとhint-a-hint的にリンクをたどれるのでテキストブラウザらしくキーボードですばやく選択できていい感じですね。

(use-package eww
  :commands (eww)
  :config
  (setq eww-search-prefix "http://www.google.co.jp/search?q=")
  (defadvice linum-on(around my-linum-eww-on() activate)
    (unless (eq major-mode 'eww-mode) ad-do-it))

  ;;背景を白くさせない
  (defvar eww-disable-colorize t)
  (defun shr-colorize-region--disable (orig start end fg &optional bg &rest _)
    (unless eww-disable-colorize
      (funcall orig start end fg)))
  (advice-add 'shr-colorize-region :around 'shr-colorize-region--disable)
  (advice-add 'eww-colorize-region :around 'shr-colorize-region--disable)
  (defun eww-disable-color ()
    "eww で文字色を反映させない"
    (interactive)
    (setq-local eww-disable-colorize t)
    (eww-reload))
  (defun eww-enable-color ()
    "eww で文字色を反映させる"
    (interactive)
    (setq-local eww-disable-colorize nil)
    (eww-reload))
  )

(use-package ace-link
  :config
  (eval-after-load 'eww '(define-key eww-mode-map "f" 'ace-link-eww))
  (ace-link-setup-default)
  )