Klimi's new dotfiles with stow.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

48 Zeilen
1.8 KiB

vor 5 Jahren
  1. (require 'slime)
  2. (require 'url-http)
  3. (require 'browse-url)
  4. (eval-when-compile (require 'cl)) ; lexical-let
  5. (defvar slime-old-documentation-lookup-function
  6. slime-documentation-lookup-function)
  7. (define-slime-contrib slime-hyperdoc
  8. "Extensible C-c C-d h."
  9. (:authors "Tobias C Rittweiler <tcr@freebits.de>")
  10. (:license "GPL")
  11. (:swank-dependencies swank-hyperdoc)
  12. (:on-load
  13. (setq slime-documentation-lookup-function 'slime-hyperdoc-lookup))
  14. (:on-unload
  15. (setq slime-documentation-lookup-function
  16. slime-old-documentation-lookup-function)))
  17. ;;; TODO: `url-http-file-exists-p' is slow, make it optional behaviour.
  18. (defun slime-hyperdoc-lookup-rpc (symbol-name)
  19. (slime-eval-async `(swank:hyperdoc ,symbol-name)
  20. (lexical-let ((symbol-name symbol-name))
  21. #'(lambda (result)
  22. (slime-log-event result)
  23. (cl-loop with foundp = nil
  24. for (doc-type . url) in result do
  25. (when (and url (stringp url)
  26. (let ((url-show-status nil))
  27. (url-http-file-exists-p url)))
  28. (message "Visiting documentation for %s `%s'..."
  29. (substring (symbol-name doc-type) 1)
  30. symbol-name)
  31. (browse-url url)
  32. (setq foundp t))
  33. finally
  34. (unless foundp
  35. (error "Could not find documentation for `%s'."
  36. symbol-name)))))))
  37. (defun slime-hyperdoc-lookup (symbol-name)
  38. (interactive (list (slime-read-symbol-name "Symbol: ")))
  39. (if (memq :hyperdoc (slime-lisp-features))
  40. (slime-hyperdoc-lookup-rpc symbol-name)
  41. (slime-hyperspec-lookup symbol-name)))
  42. (provide 'slime-hyperdoc)