"REDACTED" indicates a personal detail i don't want to divulge
(require 'w3m-search)
(eval-after-load "w3m-search"
'(progn
(add-to-list 'w3m-search-engine-alist
'("quote"
"http://finance.yahoo.com/q?s=%s"
nil))
(add-to-list 'w3m-search-engine-alist
'("ports"
"http://www.freebsd.org/cgi/ports.cgi?query=%s"
nil))
;; http://www.dict.org/bin/Dict?Form=Dict2&Database=*&Query=
(add-to-list 'w3m-search-engine-alist
'("dict"
"http://www.dict.org/bin/Dict?Form=Dict2&Database=*&Query=%s"
nil))
(add-to-list 'w3m-uri-replace-alist
'("\\`q:" w3m-search-uri-replace "quote"))
(add-to-list 'w3m-uri-replace-alist
'("\\`y:" w3m-search-uri-replace "yahoo"))
(add-to-list 'w3m-uri-replace-alist
'("\\`g:" w3m-search-uri-replace "google"))
(add-to-list 'w3m-uri-replace-alist
'("\\`dict:" w3m-search-uri-replace "dict"))
(add-to-list 'w3m-uri-replace-alist
'("\\`fp:" w3m-search-uri-replace "ports"))))
(setq w3m-use-cookies t)
(setq browse-url-browser-function 'w3m-browse-url)
(global-set-key "\C-xm" 'browse-url-at-point)
;; use M-W (uppercase) to copy the url at the point
(defun w3m-copy-url-at-point ()
(interactive)
(let ((url (w3m-anchor)))
(if (w3m-url-valid url)
(kill-new (w3m-anchor))
(message "No URL at point!"))))
(add-hook 'w3m-mode-hook
(lambda ()
(local-set-key "\M-W" 'w3m-copy-url-at-point)))
;; call out to a perl script to post links to delicious
(defun delicious-post-url ()
(interactive)
(if (null (w3m-anchor))
(message "no anchor at point")
(let ((url (w3m-anchor))
(title (buffer-substring-no-properties
(previous-single-property-change (1+ (point)) 'w3m-href-anchor)
(next-single-property-change (point) 'w3m-href-anchor))))
(if (w3m-url-valid url)
(progn
(setq delicious-tags (read-string "post tags: "))
(setq delicious-cmd (concat "~/bin/dp.pl \"" url
"\" \"" title
"\" \"" delicious-tags "\""))
(shell-command (concat delicious-cmd)))
(message "no URL at point!")))))
last update 2008-04-05