Searching Racket documentation from Emacs
I’ve been working with Racket lately, and got tired of clumsily going to a
docs.racket-lang.org tab in my browser to look up Racket symbols. A one-minute hack of a function originally written for lispdoc (by whom, I don’t know), solved this problem handily.
(defun racket-doc () "Searches docs.racket-lang.org for SYMBOL, which is by default the symbol currently under the cursor." (interactive) (let* ((word-at-point (word-at-point)) (symbol-at-point (symbol-at-point)) (default (symbol-name symbol-at-point)) (inp (read-from-minibuffer (if (or word-at-point symbol-at-point) (concat "Symbol (default " default "): ") "Symbol (no default): ")))) (if (and (string= inp "") (not word-at-point) (not symbol-at-point)) (message "you didn't enter a symbol!") (browse-url (concat "http://docs.racket-lang.org/search/index.html?q=" (if (string= inp "") default inp)))))) (define-key scheme-mode-map (kbd "C-c l") 'racket-doc)