my-emacs-d/elpa/yasnippet-20161022.646/snippets/clojure-mode/ns
2016-10-24 08:30:06 +02:00

22 lines
561 B
Plaintext

# -*- coding: utf-8 -*-
# name: ns
# key: ns
# --
(ns `(flet ((try-src-prefix
(path src-pfx)
(let ((parts (split-string path src-pfx)))
(if (= 2 (length parts))
(second parts)
nil))))
(let* ((p (buffer-file-name))
(p2 (first
(remove-if-not '(lambda (x) x)
(mapcar
'(lambda (pfx)
(try-src-prefix p pfx))
'("/src/cljs/" "/src/clj/" "/src/")))))
(p3 (file-name-sans-extension p2))
(p4 (mapconcat '(lambda (x) x)
(split-string p3 "/")
".")))
(replace-regexp-in-string "_" "-" p4)))`)