Instantly share code, notes, and snippets.

@pallix /ns
Created Apr 20, 2011

Embed
What would you like to do?
Emacs YASnippet snippet for Clojure ns declarations
(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