Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Slime documentation search for 4 common lisp search engines on the web.
;; refactoring from Ben Hyde's slime-documentation-search
;; this creates 8 kbd shortcuts to 4 lisp search engines
;; by specifying a key.
;; C-c C-d key should browse with the emacs default browser (my case w3m)
;; C-c C-d C-key should browse with the OS default browser
;; C-c C-d is the default for the slime-doc-map
(defvar slime-documentation-format-quickdocs
"Format string to create quickdocs url.")
(defvar slime-documentation-format-l1sp
"Format string to create l1sp url.")
(defvar slime-documentation-format-lispdoc
"Format string to create lispdocs url.")
(defvar slime-documentation-format-manifest
"Format string to create lisp-search manifest url.")
(defmacro slime-documentation-macro (key site-name)
(let* ((format-var (intern (concat "slime-documentation-format-"
(defun-name (intern (concat "slime-documentation-"
(defun-external-name (intern (concat "slime-documentation-external-"
(prompt (concat site-name " search for:"))
(key-external (concat "C-" key)))
(defun ,defun-name (name)
,(concat "Search request on " site-name " web site")
(interactive (list (slime-read-symbol-name ,prompt)))
(browse-url (format ,format-var (browse-url-encode-url name))))
(defun ,defun-external-name (name)
,(concat "External search request on " site-name " web site")
(interactive (list (slime-read-symbol-name ,prompt)))
(let* ((browse-url-browser-function 'browse-url-default-browser))
(browse-url (format ,format-var (browse-url-encode-url name)))))
(define-key slime-doc-map ,key (quote ,defun-name))
(define-key slime-doc-map (kbd ,key-external)
(quote ,defun-external-name)))))
;; don't use "a", "d", "f", "h", "p", "z", "~", "#"
;; unless you want to override slime defaults.
;; you can give "s" to your favorite.
(slime-documentation-macro "q" "quickdocs")
(slime-documentation-macro "x" "l1sp")
(slime-documentation-macro "m" "manifest")
(slime-documentation-macro "l" "lispdoc")

This comment has been minimized.

Copy link
Owner Author

@aarvid aarvid commented Aug 16, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.