├── README.md ├── c ├── condp ├── defm ├── defmm ├── defn ├── defp ├── defr ├── deft ├── f ├── fn ├── if ├── import ├── kwargs ├── let ├── letfn ├── m ├── ns ├── perf ├── pm ├── refer ├── require ├── rn ├── rstar └── use /README.md: -------------------------------------------------------------------------------- 1 | # Warning 2 | 3 | ************************************************************************** 4 | 5 | **NOTE:** these snippets are **no longer** actively maintained. For 6 | the latest actively maintained snippets, organised into a package 7 | see [https://github.com/mpenet/clojure-snippets](https://github.com/mpenet/clojure-snippets) 8 | 9 | This repo is kept only for reference purposes 10 | 11 | ************************************************************************** 12 | 13 | # Previously 14 | 15 | Install yasnippet via the Emacs package manager. 16 | 17 | Then: 18 | 19 | ``` 20 | git clone http://github.com/swannodette/clojure-snippets ~/.emacs.d/snippets/clojure-mode 21 | ``` 22 | 23 | Or whatever location you prefer. Then In your `.emacs` you should have 24 | something like the following 25 | 26 | ```elisp 27 | (when (require 'yasnippet nil 'noerror) 28 | (progn 29 | (yas/load-directory "~/.emacs.d/snippets"))) 30 | ``` 31 | -------------------------------------------------------------------------------- /c: -------------------------------------------------------------------------------- 1 | #name: comment 2 | # -- 3 | (comment 4 | $0 5 | ) -------------------------------------------------------------------------------- /condp: -------------------------------------------------------------------------------- 1 | #name: condp 2 | # -- 3 | (condp ${1:pred} ${2:expr} 4 | $0) -------------------------------------------------------------------------------- /defm: -------------------------------------------------------------------------------- 1 | #name: defmethod 2 | # -- 3 | (defmethod ${1:name} ${2:match} 4 | [${3:args}] 5 | $0) -------------------------------------------------------------------------------- /defmm: -------------------------------------------------------------------------------- 1 | #name: defmulti 2 | # -- 3 | (defmulti ${1:name} ${2:dispatch-fn}) -------------------------------------------------------------------------------- /defn: -------------------------------------------------------------------------------- 1 | #name: defn 2 | # -- 3 | (defn ${1:name} ${2: 4 | "${3:doc-string}" 5 | }[${4:arg-list}] 6 | $0) -------------------------------------------------------------------------------- /defp: -------------------------------------------------------------------------------- 1 | #name: defprotocol 2 | # -- 3 | (defprotocol ${1:Name} 4 | $0) -------------------------------------------------------------------------------- /defr: -------------------------------------------------------------------------------- 1 | #name: defrecord 2 | # -- 3 | (defrecord ${1:Name} [${2:fields}] 4 | ${3:Protocol} 5 | $0) -------------------------------------------------------------------------------- /deft: -------------------------------------------------------------------------------- 1 | #name: deftype 2 | # -- 3 | (deftype ${1:Name} [${2:fields}] 4 | ${3:Protocol} 5 | $0) -------------------------------------------------------------------------------- /f: -------------------------------------------------------------------------------- 1 | #name: fresh 2 | # -- 3 | (fresh [${1:vars}] 4 | $0) -------------------------------------------------------------------------------- /fn: -------------------------------------------------------------------------------- 1 | #name: fn 2 | # -- 3 | (fn [${1:arg-list}] $0) -------------------------------------------------------------------------------- /if: -------------------------------------------------------------------------------- 1 | #name: if 2 | # -- 3 | (if ${1:test-expr} 4 | ${2:then-expr} 5 | ${3:else-expr}) -------------------------------------------------------------------------------- /import: -------------------------------------------------------------------------------- 1 | #name: import 2 | # -- 3 | (:import [${1:package}]) -------------------------------------------------------------------------------- /kwargs: -------------------------------------------------------------------------------- 1 | #name: keyword args 2 | # -- 3 | & {:keys [${1:keys}] :or {${2:defaults}}} -------------------------------------------------------------------------------- /let: -------------------------------------------------------------------------------- 1 | #name: let 2 | # -- 3 | (let [$0]) -------------------------------------------------------------------------------- /letfn: -------------------------------------------------------------------------------- 1 | #name: letfn 2 | # -- 3 | (letfn [(${1:name) [${2:args}] 4 | $0)]) -------------------------------------------------------------------------------- /m: -------------------------------------------------------------------------------- 1 | #name: method 2 | # -- 3 | (${1:name} [${2:this} ${3:args}] 4 | $0) -------------------------------------------------------------------------------- /ns: -------------------------------------------------------------------------------- 1 | #name: ns 2 | # -- 3 | (ns `(clojure-expected-ns)` 4 | $0) -------------------------------------------------------------------------------- /perf: -------------------------------------------------------------------------------- 1 | #name: perf 2 | # -- 3 | (dotimes [_ 10] 4 | (time 5 | (dotimes [_ ${1:times}] 6 | $0))) -------------------------------------------------------------------------------- /pm: -------------------------------------------------------------------------------- 1 | #name: protocol method 2 | # -- 3 | (${1:name} [${2:this} ${3:args}]) -------------------------------------------------------------------------------- /refer: -------------------------------------------------------------------------------- 1 | #name: refer 2 | # -- 3 | (:refer-clojure :exclude [$0]) -------------------------------------------------------------------------------- /require: -------------------------------------------------------------------------------- 1 | #name: require 2 | # -- 3 | (:require [${1:namespace} :as [$0]]) -------------------------------------------------------------------------------- /rn: -------------------------------------------------------------------------------- 1 | #name: run n 2 | # -- 3 | (run ${1:n} [q] 4 | $0) -------------------------------------------------------------------------------- /rstar: -------------------------------------------------------------------------------- 1 | #name: run* 2 | # -- 3 | (run* [q] 4 | $0) -------------------------------------------------------------------------------- /use: -------------------------------------------------------------------------------- 1 | #name: use 2 | # -- 3 | (:use [${1:namespace} :only [$0]]) --------------------------------------------------------------------------------