Googleで検索するlisp

誰でも1度はつくる、キーワードをGoogleで検索するlisp
一応[Shift-F1]にバインドしている。

(global-set-key #\S-F1 'search-google-selection)
(set-function-bar-label #\S-F1 "Google")

(defun get-selection-string()
  (selection-start-end (start end)
	(buffer-substring start end)))

(defun search-google-selection ()
  "カーソル上の文字列をGoogleで検索する"
  (interactive)
  (let ( (pattern "") )
	(if (and (get-selection-type) (= (get-selection-type) 2))
		(setq pattern (selection-start-end (start end)
						(buffer-substring start end)))
	  (save-excursion
		(let *1
	(shell-execute (concat "http://www.google.com/search?as_q=" pattern) t)))

*1:start (progn (skip-syntax-spec-forward "wj") (point))) (end (progn (skip-syntax-spec-backward "wj") (point)))) (setq pattern (buffer-substring start end)))