Klimi's new dotfiles with stow.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

65 satır
2.3 KiB

5 yıl önce
  1. (in-package :swank)
  2. (defslimefun package= (string1 string2)
  3. (let* ((pkg1 (guess-package string1))
  4. (pkg2 (guess-package string2)))
  5. (and pkg1 pkg2 (eq pkg1 pkg2))))
  6. (defslimefun export-symbol-for-emacs (symbol-str package-str)
  7. (let ((package (guess-package package-str)))
  8. (when package
  9. (let ((*buffer-package* package))
  10. (export `(,(from-string symbol-str)) package)))))
  11. (defslimefun unexport-symbol-for-emacs (symbol-str package-str)
  12. (let ((package (guess-package package-str)))
  13. (when package
  14. (let ((*buffer-package* package))
  15. (unexport `(,(from-string symbol-str)) package)))))
  16. #+sbcl
  17. (defun list-structure-symbols (name)
  18. (let ((dd (sb-kernel:find-defstruct-description name )))
  19. (list* name
  20. (sb-kernel:dd-default-constructor dd)
  21. (sb-kernel:dd-predicate-name dd)
  22. (sb-kernel::dd-copier-name dd)
  23. (mapcar #'sb-kernel:dsd-accessor-name
  24. (sb-kernel:dd-slots dd)))))
  25. #+ccl
  26. (defun list-structure-symbols (name)
  27. (let ((definition (gethash name ccl::%defstructs%)))
  28. (list* name
  29. (ccl::sd-constructor definition)
  30. (ccl::sd-refnames definition))))
  31. (defun list-class-symbols (name)
  32. (let* ((class (find-class name))
  33. (slots (swank-mop:class-direct-slots class)))
  34. (labels ((extract-symbol (name)
  35. (if (and (consp name) (eql (car name) 'setf))
  36. (cadr name)
  37. name))
  38. (slot-accessors (slot)
  39. (nintersection (copy-list (swank-mop:slot-definition-readers slot))
  40. (copy-list (swank-mop:slot-definition-readers slot))
  41. :key #'extract-symbol)))
  42. (list* (class-name class)
  43. (mapcan #'slot-accessors slots)))))
  44. (defslimefun export-structure (name package)
  45. (let ((*package* (guess-package package)))
  46. (when *package*
  47. (let* ((name (from-string name))
  48. (symbols (cond #+(or sbcl ccl)
  49. ((or (not (find-class name nil))
  50. (subtypep name 'structure-object))
  51. (list-structure-symbols name))
  52. (t
  53. (list-class-symbols name)))))
  54. (export symbols)
  55. symbols))))
  56. (provide :swank-package-fu)