-
-
Save pallix/931439 to your computer and use it in GitHub Desktop.
Emacs YASnippet snippet for Clojure ns declarations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns `(let* ((nsname '()) | |
(dirs (split-string (buffer-file-name) "/")) | |
(aftersrc nil)) | |
(dolist (dir dirs) | |
(if aftersrc | |
(progn | |
(setq nsname (cons dir nsname)) | |
(setq nsname (cons "." nsname))) | |
(when (or (string= dir "src") (string= dir "test")) | |
(setq aftersrc t)))) | |
(when nsname | |
(replace-regexp-in-string "_" "-" (substring (apply 'concat (reverse nsname)) 0 -5))))` | |
(:use $1) | |
(:require )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment