;;; w3m-init.el --- Initialize w3m

;; This file is part of Michael Olson's Emacs settings.

;; The code in this file may be used, distributed, and modified
;; without restriction.

;; I use initsplit.el to separate customize settings on a per-project
;; basis.

;; Set load path

;; Add working directories to load path
;; already done by Debian, the following is for http-emacs
(add-to-list 'load-path "~/proj/emacs/http-emacs")

;; Initialize
(require 'w3m-load)
(require 'w3m)

;; Insinuate with BBDB
(when (featurep 'bbdb)
  (provide 'w3)
  (bbdb-initialize 'w3))

;; Allow editing of EmacsWiki.org files
(require 'simple-wiki-completion)

;;; Functions

;; Use ido for mode line switching
(defun w3m-e21-switch-to-buffer ()
  "Run `id-switch-buffer' and redisplay the header-line.
Redisplaying is done by wobbling the window size."
  (interactive)
  (prog1
      (ido-switch-buffer)
    (when (and header-line-format
               (eq major-mode 'w3m-mode))
      (w3m-force-window-update))))

(defun my-w3m-go ()
  "Switch to an existing w3m buffer or look at bookmarks."
  (interactive)
  (let ((buf (get-buffer "*w3m*")))
    (if buf
        (switch-to-buffer buf)
      (w3m-bookmark-view))))

;;; Keystrokes
(global-set-key "\C-c3" 'my-w3m-go)

(defun my-w3m-mode-stuff ()
  (define-key w3m-mode-map [?\C-c ?\C-\ ] 'erc-track-switch-buffer))

(add-hook 'w3m-mode-hook 'my-w3m-mode-stuff)

;;; Customizations

(custom-set-variables
 '(swc-pages-get-function (quote swc-pages-get-w3m))
 '(w3m-arrived-file "/home/mwolson/.emacs.d/.w3m/.arrived")
 '(w3m-command-arguments (quote ("-o" "ssl_verify_server=false")))
 '(w3m-cookie-accept-domains (quote ("")))
 '(w3m-default-save-directory "~/.emacs.d/.w3m")
 '(w3m-fill-column 78)
 '(w3m-form-input-map-mode-hook (quote (flyspell-mode)))
 '(w3m-init-file "~/.emacs.d/.emacs-w3m")
 '(w3m-key-binding (quote info))
 '(w3m-profile-directory "~/.emacs.d/.w3m")
 '(w3m-use-cookies t))
(custom-set-faces
 '(w3m-arrived-anchor ((((class color) (background light)) (:foreground "dark green")))))

;;; w3m-init.el ends here