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.

22 lines
632 B

5 years ago
  1. # -*- mode: snippet -*-
  2. # -*- coding: utf-8 -*-
  3. # name: ns
  4. # key: ns
  5. # --
  6. (ns `(cl-flet ((try-src-prefix
  7. (path src-pfx)
  8. (let ((parts (split-string path src-pfx)))
  9. (if (= 2 (length parts))
  10. (cl-second parts)
  11. nil))))
  12. (let* ((p (buffer-file-name))
  13. (p2 (cl-first
  14. (cl-remove-if-not '(lambda (x) x)
  15. (mapcar
  16. '(lambda (pfx)
  17. (try-src-prefix p pfx))
  18. '("/src/cljs/" "/src/clj/" "/src/" "/test/")))))
  19. (p3 (file-name-sans-extension p2))
  20. (p4 (mapconcat '(lambda (x) x)
  21. (split-string p3 "/")
  22. ".")))
  23. (replace-regexp-in-string "_" "-" p4)))`)