Last active
December 21, 2015 04:39
-
-
Save aarvid/6250845 to your computer and use it in GitHub Desktop.
Slime documentation search for 4 common lisp search engines on the web.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; refactoring from Ben Hyde's slime-documentation-search | |
;; https://gist.github.com/bhyde/5735219 | |
;; 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 | |
"http://quickdocs.org/search?q=%s" | |
"Format string to create quickdocs url.") | |
(defvar slime-documentation-format-l1sp | |
"http://l1sp.org/search?q=%s" | |
"Format string to create l1sp url.") | |
(defvar slime-documentation-format-lispdoc | |
"http://lispdoc.com/?q=%s&search=Full+text+search" | |
"Format string to create lispdocs url.") | |
(defvar slime-documentation-format-manifest | |
"http://lisp-search.acceleration.net/search?q=%s" | |
"Format string to create lisp-search manifest url.") | |
(defmacro slime-documentation-macro (key site-name) | |
(let* ((format-var (intern (concat "slime-documentation-format-" | |
site-name))) | |
(defun-name (intern (concat "slime-documentation-" | |
site-name))) | |
(defun-external-name (intern (concat "slime-documentation-external-" | |
site-name))) | |
(prompt (concat site-name " search for:")) | |
(key-external (concat "C-" key))) | |
`(progn | |
(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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Link to the original: https://gist.github.com/bhyde/5735219