Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.2 KiB

5 years ago
  1. (require 'slime)
  2. (require 'cl-lib)
  3. (define-slime-contrib slime-mdot-fu
  4. "Making M-. work on local functions."
  5. (:authors "Tobias C. Rittweiler <tcr@freebits.de>")
  6. (:license "GPL")
  7. (:slime-dependencies slime-enclosing-context)
  8. (:on-load
  9. (add-hook 'slime-edit-definition-hooks 'slime-edit-local-definition))
  10. (:on-unload
  11. (remove-hook 'slime-edit-definition-hooks 'slime-edit-local-definition)))
  12. (defun slime-edit-local-definition (name &optional where)
  13. "Like `slime-edit-definition', but tries to find the definition
  14. in a local function binding near point."
  15. (interactive (list (slime-read-symbol-name "Name: ")))
  16. (cl-multiple-value-bind (binding-name point)
  17. (cl-multiple-value-call #'cl-some #'(lambda (binding-name point)
  18. (when (cl-equalp binding-name name)
  19. (cl-values binding-name point)))
  20. (slime-enclosing-bound-names))
  21. (when (and binding-name point)
  22. (slime-edit-definition-cont
  23. `((,binding-name
  24. ,(make-slime-buffer-location (buffer-name (current-buffer)) point)))
  25. name
  26. where))))
  27. (provide 'slime-mdot-fu)